aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/8253pit.h10
-rw-r--r--include/asm-mips/a.out.h47
-rw-r--r--include/asm-mips/addrspace.h187
-rw-r--r--include/asm-mips/arc/hinv.h174
-rw-r--r--include/asm-mips/arc/types.h87
-rw-r--r--include/asm-mips/asm.h396
-rw-r--r--include/asm-mips/asmmacro-32.h158
-rw-r--r--include/asm-mips/asmmacro-64.h140
-rw-r--r--include/asm-mips/asmmacro.h51
-rw-r--r--include/asm-mips/atomic.h653
-rw-r--r--include/asm-mips/bcache.h62
-rw-r--r--include/asm-mips/bitops.h850
-rw-r--r--include/asm-mips/bootinfo.h256
-rw-r--r--include/asm-mips/branch.h38
-rw-r--r--include/asm-mips/break.h33
-rw-r--r--include/asm-mips/bug.h14
-rw-r--r--include/asm-mips/bugs.h23
-rw-r--r--include/asm-mips/byteorder.h30
-rw-r--r--include/asm-mips/cache.h23
-rw-r--r--include/asm-mips/cachectl.h26
-rw-r--r--include/asm-mips/cacheflush.h81
-rw-r--r--include/asm-mips/cacheops.h81
-rw-r--r--include/asm-mips/checksum.h253
-rw-r--r--include/asm-mips/cobalt/cobalt.h90
-rw-r--r--include/asm-mips/compat.h144
-rw-r--r--include/asm-mips/compiler.h17
-rw-r--r--include/asm-mips/cpu-features.h159
-rw-r--r--include/asm-mips/cpu-info.h82
-rw-r--r--include/asm-mips/cpu.h222
-rw-r--r--include/asm-mips/cputime.h6
-rw-r--r--include/asm-mips/current.h23
-rw-r--r--include/asm-mips/ddb5074.h11
-rw-r--r--include/asm-mips/ddb5xxx/ddb5074.h38
-rw-r--r--include/asm-mips/ddb5xxx/ddb5476.h157
-rw-r--r--include/asm-mips/ddb5xxx/ddb5477.h346
-rw-r--r--include/asm-mips/ddb5xxx/ddb5xxx.h273
-rw-r--r--include/asm-mips/debug.h49
-rw-r--r--include/asm-mips/dec/ecc.h55
-rw-r--r--include/asm-mips/dec/interrupts.h125
-rw-r--r--include/asm-mips/dec/ioasic.h36
-rw-r--r--include/asm-mips/dec/ioasic_addrs.h151
-rw-r--r--include/asm-mips/dec/ioasic_ints.h74
-rw-r--r--include/asm-mips/dec/kn01.h83
-rw-r--r--include/asm-mips/dec/kn02.h106
-rw-r--r--include/asm-mips/dec/kn02ba.h67
-rw-r--r--include/asm-mips/dec/kn02ca.h79
-rw-r--r--include/asm-mips/dec/kn02xa.h75
-rw-r--r--include/asm-mips/dec/kn03.h83
-rw-r--r--include/asm-mips/dec/kn05.h71
-rw-r--r--include/asm-mips/dec/kn230.h26
-rw-r--r--include/asm-mips/dec/machtype.h27
-rw-r--r--include/asm-mips/dec/prom.h173
-rw-r--r--include/asm-mips/dec/serial.h36
-rw-r--r--include/asm-mips/dec/tc.h43
-rw-r--r--include/asm-mips/dec/tcinfo.h47
-rw-r--r--include/asm-mips/dec/tcmodule.h39
-rw-r--r--include/asm-mips/delay.h93
-rw-r--r--include/asm-mips/div64.h127
-rw-r--r--include/asm-mips/dma-mapping.h79
-rw-r--r--include/asm-mips/dma.h313
-rw-r--r--include/asm-mips/ds1286.h15
-rw-r--r--include/asm-mips/elf.h282
-rw-r--r--include/asm-mips/errno.h127
-rw-r--r--include/asm-mips/fcntl.h125
-rw-r--r--include/asm-mips/fixmap.h110
-rw-r--r--include/asm-mips/floppy.h56
-rw-r--r--include/asm-mips/fpregdef.h99
-rw-r--r--include/asm-mips/fpu.h138
-rw-r--r--include/asm-mips/fpu_emulator.h38
-rw-r--r--include/asm-mips/galileo-boards/ev96100.h55
-rw-r--r--include/asm-mips/galileo-boards/ev96100int.h12
-rw-r--r--include/asm-mips/galileo-boards/gt96100.h427
-rw-r--r--include/asm-mips/gcc/sgidefs.h17
-rw-r--r--include/asm-mips/gdb-stub.h215
-rw-r--r--include/asm-mips/gfx.h55
-rw-r--r--include/asm-mips/gt64120.h561
-rw-r--r--include/asm-mips/gt64240.h1235
-rw-r--r--include/asm-mips/hardirq.h24
-rw-r--r--include/asm-mips/hazards.h217
-rw-r--r--include/asm-mips/hdreg.h1
-rw-r--r--include/asm-mips/highmem.h103
-rw-r--r--include/asm-mips/hp-lj/asic.h7
-rw-r--r--include/asm-mips/hw_irq.h27
-rw-r--r--include/asm-mips/i8259.h67
-rw-r--r--include/asm-mips/ide.h13
-rw-r--r--include/asm-mips/inst.h371
-rw-r--r--include/asm-mips/interrupt.h134
-rw-r--r--include/asm-mips/inventory.h20
-rw-r--r--include/asm-mips/io.h630
-rw-r--r--include/asm-mips/ioctl.h99
-rw-r--r--include/asm-mips/ioctls.h105
-rw-r--r--include/asm-mips/ip32/crime.h161
-rw-r--r--include/asm-mips/ip32/ip32_ints.h94
-rw-r--r--include/asm-mips/ip32/mace.h334
-rw-r--r--include/asm-mips/ip32/machine.h21
-rw-r--r--include/asm-mips/ipc.h1
-rw-r--r--include/asm-mips/ipcbuf.h28
-rw-r--r--include/asm-mips/irq.h55
-rw-r--r--include/asm-mips/irq_cpu.h20
-rw-r--r--include/asm-mips/isadep.h35
-rw-r--r--include/asm-mips/it8172/it8172.h348
-rw-r--r--include/asm-mips/it8172/it8172_cir.h140
-rw-r--r--include/asm-mips/it8172/it8172_dbg.h38
-rw-r--r--include/asm-mips/it8172/it8172_int.h144
-rw-r--r--include/asm-mips/it8172/it8172_pci.h108
-rw-r--r--include/asm-mips/it8712.h28
-rw-r--r--include/asm-mips/jazz.h322
-rw-r--r--include/asm-mips/jazzdma.h96
-rw-r--r--include/asm-mips/jmr3927/irq.h62
-rw-r--r--include/asm-mips/jmr3927/jmr3927.h325
-rw-r--r--include/asm-mips/jmr3927/tx3927.h365
-rw-r--r--include/asm-mips/jmr3927/txx927.h175
-rw-r--r--include/asm-mips/kmap_types.h31
-rw-r--r--include/asm-mips/lasat/ds1603.h18
-rw-r--r--include/asm-mips/lasat/eeprom.h17
-rw-r--r--include/asm-mips/lasat/head.h22
-rw-r--r--include/asm-mips/lasat/lasat.h255
-rw-r--r--include/asm-mips/lasat/lasatint.h12
-rw-r--r--include/asm-mips/lasat/picvue.h15
-rw-r--r--include/asm-mips/lasat/serial.h13
-rw-r--r--include/asm-mips/linkage.h6
-rw-r--r--include/asm-mips/local.h61
-rw-r--r--include/asm-mips/m48t35.h27
-rw-r--r--include/asm-mips/m48t37.h35
-rw-r--r--include/asm-mips/mach-atlas/mc146818rtc.h58
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h1408
-rw-r--r--include/asm-mips/mach-au1x00/au1000_dma.h446
-rw-r--r--include/asm-mips/mach-au1x00/au1000_gpio.h56
-rw-r--r--include/asm-mips/mach-au1x00/au1000_usbdev.h73
-rw-r--r--include/asm-mips/mach-au1x00/au1100_mmc.h205
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_dbdma.h299
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_psc.h522
-rw-r--r--include/asm-mips/mach-au1x00/timex.h13
-rw-r--r--include/asm-mips/mach-db1x00/db1x00.h205
-rw-r--r--include/asm-mips/mach-ddb5074/mc146818rtc.h31
-rw-r--r--include/asm-mips/mach-dec/mc146818rtc.h46
-rw-r--r--include/asm-mips/mach-dec/param.h18
-rw-r--r--include/asm-mips/mach-ev64120/mach-gt64120.h61
-rw-r--r--include/asm-mips/mach-ev96100/mach-gt64120.h46
-rw-r--r--include/asm-mips/mach-generic/cpu-feature-overrides.h13
-rw-r--r--include/asm-mips/mach-generic/floppy.h139
-rw-r--r--include/asm-mips/mach-generic/ide.h119
-rw-r--r--include/asm-mips/mach-generic/irq.h13
-rw-r--r--include/asm-mips/mach-generic/mangle-port.h16
-rw-r--r--include/asm-mips/mach-generic/mc146818rtc.h36
-rw-r--r--include/asm-mips/mach-generic/param.h13
-rw-r--r--include/asm-mips/mach-generic/spaces.h72
-rw-r--r--include/asm-mips/mach-generic/timex.h22
-rw-r--r--include/asm-mips/mach-generic/topology.h1
-rw-r--r--include/asm-mips/mach-ip22/cpu-feature-overrides.h29
-rw-r--r--include/asm-mips/mach-ip22/ds1286.h18
-rw-r--r--include/asm-mips/mach-ip22/spaces.h55
-rw-r--r--include/asm-mips/mach-ip27/cpu-feature-overrides.h39
-rw-r--r--include/asm-mips/mach-ip27/irq.h22
-rw-r--r--include/asm-mips/mach-ip27/mangle-port.h16
-rw-r--r--include/asm-mips/mach-ip27/mmzone.h36
-rw-r--r--include/asm-mips/mach-ip27/spaces.h34
-rw-r--r--include/asm-mips/mach-ip27/topology.h38
-rw-r--r--include/asm-mips/mach-ip32/cpu-feature-overrides.h41
-rw-r--r--include/asm-mips/mach-ip32/mangle-port.h17
-rw-r--r--include/asm-mips/mach-ip32/mc146818rtc.h35
-rw-r--r--include/asm-mips/mach-ip32/spaces.h36
-rw-r--r--include/asm-mips/mach-ja/cpu-feature-overrides.h45
-rw-r--r--include/asm-mips/mach-ja/spaces.h20
-rw-r--r--include/asm-mips/mach-jazz/floppy.h135
-rw-r--r--include/asm-mips/mach-jazz/mc146818rtc.h34
-rw-r--r--include/asm-mips/mach-jazz/param.h16
-rw-r--r--include/asm-mips/mach-jazz/timex.h16
-rw-r--r--include/asm-mips/mach-jmr3927/asm/ds1742.h16
-rw-r--r--include/asm-mips/mach-lasat/mach-gt64120.h27
-rw-r--r--include/asm-mips/mach-mips/cpu-feature-overrides.h67
-rw-r--r--include/asm-mips/mach-mips/mach-gt64120.h28
-rw-r--r--include/asm-mips/mach-mips/mc146818rtc.h48
-rw-r--r--include/asm-mips/mach-ocelot/mach-gt64120.h30
-rw-r--r--include/asm-mips/mach-ocelot3/cpu-feature-overrides.h48
-rw-r--r--include/asm-mips/mach-pb1x00/mc146818rtc.h34
-rw-r--r--include/asm-mips/mach-pb1x00/pb1000.h172
-rw-r--r--include/asm-mips/mach-pb1x00/pb1100.h85
-rw-r--r--include/asm-mips/mach-pb1x00/pb1500.h51
-rw-r--r--include/asm-mips/mach-pb1x00/pb1550.h169
-rw-r--r--include/asm-mips/mach-rm200/cpu-feature-overrides.h42
-rw-r--r--include/asm-mips/mach-rm200/mc146818rtc.h17
-rw-r--r--include/asm-mips/mach-sibyte/cpu-feature-overrides.h39
-rw-r--r--include/asm-mips/mach-vr41xx/timex.h18
-rw-r--r--include/asm-mips/mach-yosemite/cpu-feature-overrides.h45
-rw-r--r--include/asm-mips/marvell.h56
-rw-r--r--include/asm-mips/mc146818-time.h128
-rw-r--r--include/asm-mips/mc146818rtc.h16
-rw-r--r--include/asm-mips/mips-boards/atlas.h64
-rw-r--r--include/asm-mips/mips-boards/atlasint.h84
-rw-r--r--include/asm-mips/mips-boards/bonito64.h431
-rw-r--r--include/asm-mips/mips-boards/generic.h82
-rw-r--r--include/asm-mips/mips-boards/malta.h75
-rw-r--r--include/asm-mips/mips-boards/maltaint.h33
-rw-r--r--include/asm-mips/mips-boards/msc01_pci.h256
-rw-r--r--include/asm-mips/mips-boards/piix4.h80
-rw-r--r--include/asm-mips/mips-boards/prom.h49
-rw-r--r--include/asm-mips/mips-boards/saa9730_uart.h69
-rw-r--r--include/asm-mips/mips-boards/sead.h36
-rw-r--r--include/asm-mips/mips-boards/seadint.h28
-rw-r--r--include/asm-mips/mipsprom.h74
-rw-r--r--include/asm-mips/mipsregs.h1018
-rw-r--r--include/asm-mips/mman.h73
-rw-r--r--include/asm-mips/mmu.h6
-rw-r--r--include/asm-mips/mmu_context.h196
-rw-r--r--include/asm-mips/mmzone.h39
-rw-r--r--include/asm-mips/module.h56
-rw-r--r--include/asm-mips/msc01_ic.h151
-rw-r--r--include/asm-mips/msgbuf.h48
-rw-r--r--include/asm-mips/namei.h26
-rw-r--r--include/asm-mips/nile4.h310
-rw-r--r--include/asm-mips/numnodes.h7
-rw-r--r--include/asm-mips/paccess.h113
-rw-r--r--include/asm-mips/page.h151
-rw-r--r--include/asm-mips/param.h31
-rw-r--r--include/asm-mips/parport.h15
-rw-r--r--include/asm-mips/pci.h160
-rw-r--r--include/asm-mips/pci/bridge.h851
-rw-r--r--include/asm-mips/percpu.h6
-rw-r--r--include/asm-mips/pgalloc.h125
-rw-r--r--include/asm-mips/pgtable-32.h243
-rw-r--r--include/asm-mips/pgtable-64.h227
-rw-r--r--include/asm-mips/pgtable-bits.h149
-rw-r--r--include/asm-mips/pgtable.h404
-rw-r--r--include/asm-mips/pmon.h46
-rw-r--r--include/asm-mips/poll.h27
-rw-r--r--include/asm-mips/posix_types.h144
-rw-r--r--include/asm-mips/prctl.h41
-rw-r--r--include/asm-mips/prefetch.h88
-rw-r--r--include/asm-mips/processor.h220
-rw-r--r--include/asm-mips/ptrace.h79
-rw-r--r--include/asm-mips/r4kcache.h598
-rw-r--r--include/asm-mips/reboot.h16
-rw-r--r--include/asm-mips/reg.h129
-rw-r--r--include/asm-mips/regdef.h100
-rw-r--r--include/asm-mips/resource.h36
-rw-r--r--include/asm-mips/riscos-syscall.h979
-rw-r--r--include/asm-mips/rtc.h37
-rw-r--r--include/asm-mips/scatterlist.h23
-rw-r--r--include/asm-mips/sections.h8
-rw-r--r--include/asm-mips/segment.h6
-rw-r--r--include/asm-mips/semaphore.h112
-rw-r--r--include/asm-mips/sembuf.h22
-rw-r--r--include/asm-mips/serial.h444
-rw-r--r--include/asm-mips/setup.h8
-rw-r--r--include/asm-mips/sgi/gio.h86
-rw-r--r--include/asm-mips/sgi/hpc3.h317
-rw-r--r--include/asm-mips/sgi/ioc.h200
-rw-r--r--include/asm-mips/sgi/ip22.h77
-rw-r--r--include/asm-mips/sgi/mc.h231
-rw-r--r--include/asm-mips/sgi/pi1.h71
-rw-r--r--include/asm-mips/sgi/sgi.h47
-rw-r--r--include/asm-mips/sgialib.h127
-rw-r--r--include/asm-mips/sgiarcs.h549
-rw-r--r--include/asm-mips/sgidefs.h44
-rw-r--r--include/asm-mips/shmbuf.h38
-rw-r--r--include/asm-mips/shmparam.h13
-rw-r--r--include/asm-mips/sibyte/board.h69
-rw-r--r--include/asm-mips/sibyte/carmel.h60
-rw-r--r--include/asm-mips/sibyte/sb1250.h63
-rw-r--r--include/asm-mips/sibyte/sb1250_defs.h242
-rw-r--r--include/asm-mips/sibyte/sb1250_dma.h594
-rw-r--r--include/asm-mips/sibyte/sb1250_genbus.h276
-rw-r--r--include/asm-mips/sibyte/sb1250_int.h247
-rw-r--r--include/asm-mips/sibyte/sb1250_l2c.h128
-rw-r--r--include/asm-mips/sibyte/sb1250_ldt.h425
-rw-r--r--include/asm-mips/sibyte/sb1250_mac.h643
-rw-r--r--include/asm-mips/sibyte/sb1250_mc.h548
-rw-r--r--include/asm-mips/sibyte/sb1250_regs.h836
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h582
-rw-r--r--include/asm-mips/sibyte/sb1250_smbus.h170
-rw-r--r--include/asm-mips/sibyte/sb1250_syncser.h148
-rw-r--r--include/asm-mips/sibyte/sb1250_uart.h354
-rw-r--r--include/asm-mips/sibyte/sentosa.h41
-rw-r--r--include/asm-mips/sibyte/swarm.h71
-rw-r--r--include/asm-mips/sibyte/trace_prof.h110
-rw-r--r--include/asm-mips/sigcontext.h93
-rw-r--r--include/asm-mips/siginfo.h132
-rw-r--r--include/asm-mips/signal.h178
-rw-r--r--include/asm-mips/sim.h83
-rw-r--r--include/asm-mips/smp.h111
-rw-r--r--include/asm-mips/sn/addrs.h458
-rw-r--r--include/asm-mips/sn/agent.h47
-rw-r--r--include/asm-mips/sn/arch.h66
-rw-r--r--include/asm-mips/sn/gda.h107
-rw-r--r--include/asm-mips/sn/hub.h16
-rw-r--r--include/asm-mips/sn/intr.h129
-rw-r--r--include/asm-mips/sn/io.h60
-rw-r--r--include/asm-mips/sn/ioc3.h661
-rw-r--r--include/asm-mips/sn/klconfig.h980
-rw-r--r--include/asm-mips/sn/kldir.h248
-rw-r--r--include/asm-mips/sn/klkernvars.h29
-rw-r--r--include/asm-mips/sn/launch.h107
-rw-r--r--include/asm-mips/sn/mapped_kernel.h59
-rw-r--r--include/asm-mips/sn/nmi.h125
-rw-r--r--include/asm-mips/sn/sn0/addrs.h364
-rw-r--r--include/asm-mips/sn/sn0/arch.h89
-rw-r--r--include/asm-mips/sn/sn0/hub.h44
-rw-r--r--include/asm-mips/sn/sn0/hubio.h988
-rw-r--r--include/asm-mips/sn/sn0/hubmd.h790
-rw-r--r--include/asm-mips/sn/sn0/hubni.h255
-rw-r--r--include/asm-mips/sn/sn0/hubpi.h427
-rw-r--r--include/asm-mips/sn/sn0/ip27.h92
-rw-r--r--include/asm-mips/sn/sn0/sn0_fru.h44
-rw-r--r--include/asm-mips/sn/sn_private.h19
-rw-r--r--include/asm-mips/sn/types.h26
-rw-r--r--include/asm-mips/sni.h107
-rw-r--r--include/asm-mips/socket.h102
-rw-r--r--include/asm-mips/sockios.h25
-rw-r--r--include/asm-mips/spinlock.h299
-rw-r--r--include/asm-mips/stackframe.h346
-rw-r--r--include/asm-mips/stat.h132
-rw-r--r--include/asm-mips/statfs.h96
-rw-r--r--include/asm-mips/string.h166
-rw-r--r--include/asm-mips/suspend.h6
-rw-r--r--include/asm-mips/sysmips.h25
-rw-r--r--include/asm-mips/system.h438
-rw-r--r--include/asm-mips/termbits.h207
-rw-r--r--include/asm-mips/termios.h148
-rw-r--r--include/asm-mips/thread_info.h137
-rw-r--r--include/asm-mips/time.h96
-rw-r--r--include/asm-mips/timex.h54
-rw-r--r--include/asm-mips/titan_dep.h231
-rw-r--r--include/asm-mips/tlb.h23
-rw-r--r--include/asm-mips/tlbdebug.h20
-rw-r--r--include/asm-mips/tlbflush.h55
-rw-r--r--include/asm-mips/topology.h1
-rw-r--r--include/asm-mips/traps.h24
-rw-r--r--include/asm-mips/tx3912.h361
-rw-r--r--include/asm-mips/tx4927/smsc_fdc37m81x.h69
-rw-r--r--include/asm-mips/tx4927/toshiba_rbtx4927.h56
-rw-r--r--include/asm-mips/tx4927/tx4927.h525
-rw-r--r--include/asm-mips/tx4927/tx4927_mips.h4177
-rw-r--r--include/asm-mips/tx4927/tx4927_pci.h275
-rw-r--r--include/asm-mips/types.h108
-rw-r--r--include/asm-mips/uaccess.h830
-rw-r--r--include/asm-mips/ucontext.h21
-rw-r--r--include/asm-mips/unaligned.h14
-rw-r--r--include/asm-mips/unistd.h1185
-rw-r--r--include/asm-mips/user.h58
-rw-r--r--include/asm-mips/vga.h19
-rw-r--r--include/asm-mips/vr4181/irq.h122
-rw-r--r--include/asm-mips/vr4181/vr4181.h413
-rw-r--r--include/asm-mips/vr41xx/capcella.h43
-rw-r--r--include/asm-mips/vr41xx/cmbvr4133.h61
-rw-r--r--include/asm-mips/vr41xx/e55.h43
-rw-r--r--include/asm-mips/vr41xx/mpc30x.h37
-rw-r--r--include/asm-mips/vr41xx/siu.h50
-rw-r--r--include/asm-mips/vr41xx/tb0219.h42
-rw-r--r--include/asm-mips/vr41xx/tb0226.h43
-rw-r--r--include/asm-mips/vr41xx/vr41xx.h320
-rw-r--r--include/asm-mips/vr41xx/vrc4173.h222
-rw-r--r--include/asm-mips/vr41xx/workpad.h43
-rw-r--r--include/asm-mips/war.h224
-rw-r--r--include/asm-mips/watch.h35
-rw-r--r--include/asm-mips/wbflush.h35
-rw-r--r--include/asm-mips/xor.h1
-rw-r--r--include/asm-mips/xtalk/xtalk.h52
-rw-r--r--include/asm-mips/xtalk/xwidget.h167
-rw-r--r--include/asm-mips/xxs1500.h35
360 files changed, 57431 insertions, 0 deletions
diff --git a/include/asm-mips/8253pit.h b/include/asm-mips/8253pit.h
new file mode 100644
index 000000000000..285f78488ccb
--- /dev/null
+++ b/include/asm-mips/8253pit.h
@@ -0,0 +1,10 @@
1/*
2 * 8253/8254 Programmable Interval Timer
3 */
4
5#ifndef _8253PIT_H
6#define _8253PIT_H
7
8#define PIT_TICK_RATE 1193182UL
9
10#endif
diff --git a/include/asm-mips/a.out.h b/include/asm-mips/a.out.h
new file mode 100644
index 000000000000..e42b3093e903
--- /dev/null
+++ b/include/asm-mips/a.out.h
@@ -0,0 +1,47 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2003 by Ralf Baechle
7 */
8#ifndef _ASM_A_OUT_H
9#define _ASM_A_OUT_H
10
11#ifdef __KERNEL__
12
13#include <linux/config.h>
14
15#endif
16
17struct exec
18{
19 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
20 unsigned a_text; /* length of text, in bytes */
21 unsigned a_data; /* length of data, in bytes */
22 unsigned a_bss; /* length of uninitialized data area for
23 file, in bytes */
24 unsigned a_syms; /* length of symbol table data in file,
25 in bytes */
26 unsigned a_entry; /* start address */
27 unsigned a_trsize; /* length of relocation info for text, in
28 bytes */
29 unsigned a_drsize; /* length of relocation info for data, in bytes */
30};
31
32#define N_TRSIZE(a) ((a).a_trsize)
33#define N_DRSIZE(a) ((a).a_drsize)
34#define N_SYMSIZE(a) ((a).a_syms)
35
36#ifdef __KERNEL__
37
38#ifdef CONFIG_MIPS32
39#define STACK_TOP TASK_SIZE
40#endif
41#ifdef CONFIG_MIPS64
42#define STACK_TOP (current->thread.mflags & MF_32BIT_ADDR ? TASK_SIZE32 : TASK_SIZE)
43#endif
44
45#endif
46
47#endif /* _ASM_A_OUT_H */
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
new file mode 100644
index 000000000000..2caa8c427204
--- /dev/null
+++ b/include/asm-mips/addrspace.h
@@ -0,0 +1,187 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 99 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999 by Silicon Graphics, Inc.
9 */
10#ifndef _ASM_ADDRSPACE_H
11#define _ASM_ADDRSPACE_H
12
13#include <linux/config.h>
14#include <spaces.h>
15
16/*
17 * Configure language
18 */
19#ifdef __ASSEMBLY__
20#define _ATYPE_
21#define _ATYPE32_
22#define _ATYPE64_
23#else
24#define _ATYPE_ __PTRDIFF_TYPE__
25#define _ATYPE32_ int
26#define _ATYPE64_ long long
27#endif
28
29/*
30 * 32-bit MIPS address spaces
31 */
32#ifdef __ASSEMBLY__
33#define _ACAST32_
34#define _ACAST64_
35#else
36#define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */
37#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */
38#endif
39
40/*
41 * Returns the kernel segment base of a given address
42 */
43#define KSEGX(a) ((_ACAST32_ (a)) & 0xe0000000)
44
45/*
46 * Returns the physical address of a CKSEGx / XKPHYS address
47 */
48#define CPHYSADDR(a) ((_ACAST32_ (a)) & 0x1fffffff)
49#define XPHYSADDR(a) ((_ACAST64_ (a)) & 0x000000ffffffffff)
50
51#ifdef CONFIG_MIPS64
52
53/*
54 * Memory segments (64bit kernel mode addresses)
55 * The compatibility segments use the full 64-bit sign extended value. Note
56 * the R8000 doesn't have them so don't reference these in generic MIPS code.
57 */
58#define XKUSEG 0x0000000000000000
59#define XKSSEG 0x4000000000000000
60#define XKPHYS 0x8000000000000000
61#define XKSEG 0xc000000000000000
62#define CKSEG0 0xffffffff80000000
63#define CKSEG1 0xffffffffa0000000
64#define CKSSEG 0xffffffffc0000000
65#define CKSEG3 0xffffffffe0000000
66
67#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
68#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1)
69#define CKSEG2ADDR(a) (CPHYSADDR(a) | CKSEG2)
70#define CKSEG3ADDR(a) (CPHYSADDR(a) | CKSEG3)
71
72#else
73
74#define CKSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
75#define CKSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
76#define CKSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
77#define CKSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
78
79/*
80 * Map an address to a certain kernel segment
81 */
82#define KSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
83#define KSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
84#define KSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
85#define KSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
86
87/*
88 * Memory segments (32bit kernel mode addresses)
89 * These are the traditional names used in the 32-bit universe.
90 */
91#define KUSEG 0x00000000
92#define KSEG0 0x80000000
93#define KSEG1 0xa0000000
94#define KSEG2 0xc0000000
95#define KSEG3 0xe0000000
96
97#define CKUSEG 0x00000000
98#define CKSEG0 0x80000000
99#define CKSEG1 0xa0000000
100#define CKSEG2 0xc0000000
101#define CKSEG3 0xe0000000
102
103#endif
104
105/*
106 * Cache modes for XKPHYS address conversion macros
107 */
108#define K_CALG_COH_EXCL1_NOL2 0
109#define K_CALG_COH_SHRL1_NOL2 1
110#define K_CALG_UNCACHED 2
111#define K_CALG_NONCOHERENT 3
112#define K_CALG_COH_EXCL 4
113#define K_CALG_COH_SHAREABLE 5
114#define K_CALG_NOTUSED 6
115#define K_CALG_UNCACHED_ACCEL 7
116
117/*
118 * 64-bit address conversions
119 */
120#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED,(p))
121#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE,(p))
122#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
123#define PHYS_TO_XKPHYS(cm,a) (0x8000000000000000 | ((cm)<<59) | (a))
124
125#if defined (CONFIG_CPU_R4300) \
126 || defined (CONFIG_CPU_R4X00) \
127 || defined (CONFIG_CPU_R5000) \
128 || defined (CONFIG_CPU_NEVADA) \
129 || defined (CONFIG_CPU_TX49XX) \
130 || defined (CONFIG_CPU_MIPS64)
131#define KUSIZE 0x0000010000000000 /* 2^^40 */
132#define KUSIZE_64 0x0000010000000000 /* 2^^40 */
133#define K0SIZE 0x0000001000000000 /* 2^^36 */
134#define K1SIZE 0x0000001000000000 /* 2^^36 */
135#define K2SIZE 0x000000ff80000000
136#define KSEGSIZE 0x000000ff80000000 /* max syssegsz */
137#define TO_PHYS_MASK 0x0000000fffffffff /* 2^^36 - 1 */
138#endif
139
140#if defined (CONFIG_CPU_R8000)
141/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */
142#define KUSIZE 0x0000010000000000 /* 2^^40 */
143#define KUSIZE_64 0x0000010000000000 /* 2^^40 */
144#define K0SIZE 0x0000010000000000 /* 2^^40 */
145#define K1SIZE 0x0000010000000000 /* 2^^40 */
146#define K2SIZE 0x0001000000000000
147#define KSEGSIZE 0x0000010000000000 /* max syssegsz */
148#define TO_PHYS_MASK 0x000000ffffffffff /* 2^^40 - 1 */
149#endif
150
151#if defined (CONFIG_CPU_R10000)
152#define KUSIZE 0x0000010000000000 /* 2^^40 */
153#define KUSIZE_64 0x0000010000000000 /* 2^^40 */
154#define K0SIZE 0x0000010000000000 /* 2^^40 */
155#define K1SIZE 0x0000010000000000 /* 2^^40 */
156#define K2SIZE 0x00000fff80000000
157#define KSEGSIZE 0x00000fff80000000 /* max syssegsz */
158#define TO_PHYS_MASK 0x000000ffffffffff /* 2^^40 - 1 */
159#endif
160
161/*
162 * Further names for SGI source compatibility. These are stolen from
163 * IRIX's <sys/mips_addrspace.h>.
164 */
165#define KUBASE 0
166#define KUSIZE_32 0x0000000080000000 /* KUSIZE
167 for a 32 bit proc */
168#define K0BASE_EXL_WR 0xa800000000000000 /* exclusive on write */
169#define K0BASE_NONCOH 0x9800000000000000 /* noncoherent */
170#define K0BASE_EXL 0xa000000000000000 /* exclusive */
171
172#ifndef CONFIG_CPU_R8000
173
174/*
175 * The R8000 doesn't have the 32-bit compat spaces so we don't define them
176 * in order to catch bugs in the source code.
177 */
178
179#define COMPAT_K1BASE32 0xffffffffa0000000
180#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
181
182#endif
183
184#define KDM_TO_PHYS(x) (_ACAST64_ (x) & TO_PHYS_MASK)
185#define PHYS_TO_K0(x) (_ACAST64_ (x) | CAC_BASE)
186
187#endif /* _ASM_ADDRSPACE_H */
diff --git a/include/asm-mips/arc/hinv.h b/include/asm-mips/arc/hinv.h
new file mode 100644
index 000000000000..ee792bf04002
--- /dev/null
+++ b/include/asm-mips/arc/hinv.h
@@ -0,0 +1,174 @@
1/*
2 * ARCS hardware/memory inventory/configuration and system ID definitions.
3 */
4#ifndef _ASM_ARC_HINV_H
5#define _ASM_ARC_HINV_H
6
7#include <asm/arc/types.h>
8
9/* configuration query defines */
10typedef enum configclass {
11 SystemClass,
12 ProcessorClass,
13 CacheClass,
14#ifndef _NT_PROM
15 MemoryClass,
16 AdapterClass,
17 ControllerClass,
18 PeripheralClass
19#else /* _NT_PROM */
20 AdapterClass,
21 ControllerClass,
22 PeripheralClass,
23 MemoryClass
24#endif /* _NT_PROM */
25} CONFIGCLASS;
26
27typedef enum configtype {
28 ARC,
29 CPU,
30 FPU,
31 PrimaryICache,
32 PrimaryDCache,
33 SecondaryICache,
34 SecondaryDCache,
35 SecondaryCache,
36#ifndef _NT_PROM
37 Memory,
38#endif
39 EISAAdapter,
40 TCAdapter,
41 SCSIAdapter,
42 DTIAdapter,
43 MultiFunctionAdapter,
44 DiskController,
45 TapeController,
46 CDROMController,
47 WORMController,
48 SerialController,
49 NetworkController,
50 DisplayController,
51 ParallelController,
52 PointerController,
53 KeyboardController,
54 AudioController,
55 OtherController,
56 DiskPeripheral,
57 FloppyDiskPeripheral,
58 TapePeripheral,
59 ModemPeripheral,
60 MonitorPeripheral,
61 PrinterPeripheral,
62 PointerPeripheral,
63 KeyboardPeripheral,
64 TerminalPeripheral,
65 LinePeripheral,
66 NetworkPeripheral,
67#ifdef _NT_PROM
68 Memory,
69#endif
70 OtherPeripheral,
71
72 /* new stuff for IP30 */
73 /* added without moving anything */
74 /* except ANONYMOUS. */
75
76 XTalkAdapter,
77 PCIAdapter,
78 GIOAdapter,
79 TPUAdapter,
80
81 Anonymous
82} CONFIGTYPE;
83
84typedef enum {
85 Failed = 1,
86 ReadOnly = 2,
87 Removable = 4,
88 ConsoleIn = 8,
89 ConsoleOut = 16,
90 Input = 32,
91 Output = 64
92} IDENTIFIERFLAG;
93
94#ifndef NULL /* for GetChild(NULL); */
95#define NULL 0
96#endif
97
98union key_u {
99 struct {
100#ifdef _MIPSEB
101 unsigned char c_bsize; /* block size in lines */
102 unsigned char c_lsize; /* line size in bytes/tag */
103 unsigned short c_size; /* cache size in 4K pages */
104#else /* _MIPSEL */
105 unsigned short c_size; /* cache size in 4K pages */
106 unsigned char c_lsize; /* line size in bytes/tag */
107 unsigned char c_bsize; /* block size in lines */
108#endif /* _MIPSEL */
109 } cache;
110 ULONG FullKey;
111};
112
113#if _MIPS_SIM == _ABI64
114#define SGI_ARCS_VERS 64 /* sgi 64-bit version */
115#define SGI_ARCS_REV 0 /* rev .00 */
116#else
117#define SGI_ARCS_VERS 1 /* first version */
118#define SGI_ARCS_REV 10 /* rev .10, 3/04/92 */
119#endif
120
121typedef struct component {
122 CONFIGCLASS Class;
123 CONFIGTYPE Type;
124 IDENTIFIERFLAG Flags;
125 USHORT Version;
126 USHORT Revision;
127 ULONG Key;
128 ULONG AffinityMask;
129 ULONG ConfigurationDataSize;
130 ULONG IdentifierLength;
131 char *Identifier;
132} COMPONENT;
133
134/* internal structure that holds pathname parsing data */
135struct cfgdata {
136 char *name; /* full name */
137 int minlen; /* minimum length to match */
138 CONFIGTYPE type; /* type of token */
139};
140
141/* System ID */
142typedef struct systemid {
143 CHAR VendorId[8];
144 CHAR ProductId[8];
145} SYSTEMID;
146
147/* memory query functions */
148typedef enum memorytype {
149 ExceptionBlock,
150 SPBPage, /* ARCS == SystemParameterBlock */
151#ifndef _NT_PROM
152 FreeContiguous,
153 FreeMemory,
154 BadMemory,
155 LoadedProgram,
156 FirmwareTemporary,
157 FirmwarePermanent
158#else /* _NT_PROM */
159 FreeMemory,
160 BadMemory,
161 LoadedProgram,
162 FirmwareTemporary,
163 FirmwarePermanent,
164 FreeContiguous
165#endif /* _NT_PROM */
166} MEMORYTYPE;
167
168typedef struct memorydescriptor {
169 MEMORYTYPE Type;
170 LONG BasePage;
171 LONG PageCount;
172} MEMORYDESCRIPTOR;
173
174#endif /* _ASM_ARC_HINV_H */
diff --git a/include/asm-mips/arc/types.h b/include/asm-mips/arc/types.h
new file mode 100644
index 000000000000..bbb725c366fb
--- /dev/null
+++ b/include/asm-mips/arc/types.h
@@ -0,0 +1,87 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright 1999 Ralf Baechle (ralf@gnu.org)
7 * Copyright 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_ARC_TYPES_H
10#define _ASM_ARC_TYPES_H
11
12#include <linux/config.h>
13
14#ifdef CONFIG_ARC32
15
16typedef char CHAR;
17typedef short SHORT;
18typedef long LARGE_INTEGER __attribute__ ((__mode__ (__DI__)));
19typedef long LONG __attribute__ ((__mode__ (__SI__)));
20typedef unsigned char UCHAR;
21typedef unsigned short USHORT;
22typedef unsigned long ULONG __attribute__ ((__mode__ (__SI__)));
23typedef void VOID;
24
25/* The pointer types. Note that we're using a 64-bit compiler but all
26 pointer in the ARC structures are only 32-bit, so we need some disgusting
27 workarounds. Keep your vomit bag handy. */
28typedef LONG _PCHAR;
29typedef LONG _PSHORT;
30typedef LONG _PLARGE_INTEGER;
31typedef LONG _PLONG;
32typedef LONG _PUCHAR;
33typedef LONG _PUSHORT;
34typedef LONG _PULONG;
35typedef LONG _PVOID;
36
37#endif /* CONFIG_ARC32 */
38
39#ifdef CONFIG_ARC64
40
41typedef char CHAR;
42typedef short SHORT;
43typedef long LARGE_INTEGER __attribute__ ((__mode__ (__DI__)));
44typedef long LONG __attribute__ ((__mode__ (__DI__)));
45typedef unsigned char UCHAR;
46typedef unsigned short USHORT;
47typedef unsigned long ULONG __attribute__ ((__mode__ (__DI__)));
48typedef void VOID;
49
50/* The pointer types. We're 64-bit and the firmware is also 64-bit, so
51 live is sane ... */
52typedef CHAR *_PCHAR;
53typedef SHORT *_PSHORT;
54typedef LARGE_INTEGER *_PLARGE_INTEGER;
55typedef LONG *_PLONG;
56typedef UCHAR *_PUCHAR;
57typedef USHORT *_PUSHORT;
58typedef ULONG *_PULONG;
59typedef VOID *_PVOID;
60
61#endif /* CONFIG_ARC64 */
62
63typedef CHAR *PCHAR;
64typedef SHORT *PSHORT;
65typedef LARGE_INTEGER *PLARGE_INTEGER;
66typedef LONG *PLONG;
67typedef UCHAR *PUCHAR;
68typedef USHORT *PUSHORT;
69typedef ULONG *PULONG;
70typedef VOID *PVOID;
71
72/*
73 * Return type of ArcGetDisplayStatus()
74 */
75typedef struct {
76 USHORT CursorXPosition;
77 USHORT CursorYPosition;
78 USHORT CursorMaxXPosition;
79 USHORT CursorMaxYPosition;
80 USHORT ForegroundColor;
81 USHORT BackgroundColor;
82 UCHAR HighIntensity;
83 UCHAR Underscored;
84 UCHAR ReverseVideo;
85} DISPLAY_STATUS;
86
87#endif /* _ASM_ARC_TYPES_H */
diff --git a/include/asm-mips/asm.h b/include/asm-mips/asm.h
new file mode 100644
index 000000000000..f53237772985
--- /dev/null
+++ b/include/asm-mips/asm.h
@@ -0,0 +1,396 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1996, 1997, 1999, 2001 by Ralf Baechle
7 * Copyright (C) 1999 by Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 * Copyright (C) 2002 Maciej W. Rozycki
10 *
11 * Some useful macros for MIPS assembler code
12 *
13 * Some of the routines below contain useless nops that will be optimized
14 * away by gas in -O mode. These nops are however required to fill delay
15 * slots in noreorder mode.
16 */
17#ifndef __ASM_ASM_H
18#define __ASM_ASM_H
19
20#include <linux/config.h>
21#include <asm/sgidefs.h>
22
23#ifndef CAT
24#ifdef __STDC__
25#define __CAT(str1,str2) str1##str2
26#else
27#define __CAT(str1,str2) str1/**/str2
28#endif
29#define CAT(str1,str2) __CAT(str1,str2)
30#endif
31
32/*
33 * PIC specific declarations
34 * Not used for the kernel but here seems to be the right place.
35 */
36#ifdef __PIC__
37#define CPRESTORE(register) \
38 .cprestore register
39#define CPADD(register) \
40 .cpadd register
41#define CPLOAD(register) \
42 .cpload register
43#else
44#define CPRESTORE(register)
45#define CPADD(register)
46#define CPLOAD(register)
47#endif
48
49/*
50 * LEAF - declare leaf routine
51 */
52#define LEAF(symbol) \
53 .globl symbol; \
54 .align 2; \
55 .type symbol,@function; \
56 .ent symbol,0; \
57symbol: .frame sp,0,ra
58
59/*
60 * NESTED - declare nested routine entry point
61 */
62#define NESTED(symbol, framesize, rpc) \
63 .globl symbol; \
64 .align 2; \
65 .type symbol,@function; \
66 .ent symbol,0; \
67symbol: .frame sp, framesize, rpc
68
69/*
70 * END - mark end of function
71 */
72#define END(function) \
73 .end function; \
74 .size function,.-function
75
76/*
77 * EXPORT - export definition of symbol
78 */
79#define EXPORT(symbol) \
80 .globl symbol; \
81symbol:
82
83/*
84 * FEXPORT - export definition of a function symbol
85 */
86#define FEXPORT(symbol) \
87 .globl symbol; \
88 .type symbol,@function; \
89symbol:
90
91/*
92 * ABS - export absolute symbol
93 */
94#define ABS(symbol,value) \
95 .globl symbol; \
96symbol = value
97
98#define PANIC(msg) \
99 .set push; \
100 .set reorder; \
101 PTR_LA a0,8f; \
102 jal panic; \
1039: b 9b; \
104 .set pop; \
105 TEXT(msg)
106
107/*
108 * Print formatted string
109 */
110#define PRINT(string) \
111 .set push; \
112 .set reorder; \
113 PTR_LA a0,8f; \
114 jal printk; \
115 .set pop; \
116 TEXT(string)
117
118#define TEXT(msg) \
119 .pushsection .data; \
1208: .asciiz msg; \
121 .popsection;
122
123/*
124 * Build text tables
125 */
126#define TTABLE(string) \
127 .pushsection .text; \
128 .word 1f; \
129 .popsection \
130 .pushsection .data; \
1311: .asciiz string; \
132 .popsection
133
134/*
135 * MIPS IV pref instruction.
136 * Use with .set noreorder only!
137 *
138 * MIPS IV implementations are free to treat this as a nop. The R5000
139 * is one of them. So we should have an option not to use this instruction.
140 */
141#ifdef CONFIG_CPU_HAS_PREFETCH
142
143#define PREF(hint,addr) \
144 .set push; \
145 .set mips4; \
146 pref hint,addr; \
147 .set pop
148
149#define PREFX(hint,addr) \
150 .set push; \
151 .set mips4; \
152 prefx hint,addr; \
153 .set pop
154
155#else /* !CONFIG_CPU_HAS_PREFETCH */
156
157#define PREF(hint,addr)
158#define PREFX(hint,addr)
159
160#endif /* !CONFIG_CPU_HAS_PREFETCH */
161
162/*
163 * MIPS ISA IV/V movn/movz instructions and equivalents for older CPUs.
164 */
165#if (_MIPS_ISA == _MIPS_ISA_MIPS1)
166#define MOVN(rd,rs,rt) \
167 .set push; \
168 .set reorder; \
169 beqz rt,9f; \
170 move rd,rs; \
171 .set pop; \
1729:
173#define MOVZ(rd,rs,rt) \
174 .set push; \
175 .set reorder; \
176 bnez rt,9f; \
177 move rd,rs; \
178 .set pop; \
1799:
180#endif /* _MIPS_ISA == _MIPS_ISA_MIPS1 */
181#if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3)
182#define MOVN(rd,rs,rt) \
183 .set push; \
184 .set noreorder; \
185 bnezl rt,9f; \
186 move rd,rs; \
187 .set pop; \
1889:
189#define MOVZ(rd,rs,rt) \
190 .set push; \
191 .set noreorder; \
192 beqzl rt,9f; \
193 move rd,rs; \
194 .set pop; \
1959:
196#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) */
197#if (_MIPS_ISA == _MIPS_ISA_MIPS4 ) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
198 (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
199#define MOVN(rd,rs,rt) \
200 movn rd,rs,rt
201#define MOVZ(rd,rs,rt) \
202 movz rd,rs,rt
203#endif /* MIPS IV, MIPS V, MIPS32 or MIPS64 */
204
205/*
206 * Stack alignment
207 */
208#if (_MIPS_SIM == _MIPS_SIM_ABI32)
209#define ALSZ 7
210#define ALMASK ~7
211#endif
212#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
213#define ALSZ 15
214#define ALMASK ~15
215#endif
216
217/*
218 * Macros to handle different pointer/register sizes for 32/64-bit code
219 */
220
221/*
222 * Size of a register
223 */
224#ifdef __mips64
225#define SZREG 8
226#else
227#define SZREG 4
228#endif
229
230/*
231 * Use the following macros in assemblercode to load/store registers,
232 * pointers etc.
233 */
234#if (_MIPS_SIM == _MIPS_SIM_ABI32)
235#define REG_S sw
236#define REG_L lw
237#define REG_SUBU subu
238#define REG_ADDU addu
239#endif
240#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
241#define REG_S sd
242#define REG_L ld
243#define REG_SUBU dsubu
244#define REG_ADDU daddu
245#endif
246
247/*
248 * How to add/sub/load/store/shift C int variables.
249 */
250#if (_MIPS_SZINT == 32)
251#define INT_ADD add
252#define INT_ADDU addu
253#define INT_ADDI addi
254#define INT_ADDIU addiu
255#define INT_SUB sub
256#define INT_SUBU subu
257#define INT_L lw
258#define INT_S sw
259#define INT_SLL sll
260#define INT_SLLV sllv
261#define INT_SRL srl
262#define INT_SRLV srlv
263#define INT_SRA sra
264#define INT_SRAV srav
265#endif
266
267#if (_MIPS_SZINT == 64)
268#define INT_ADD dadd
269#define INT_ADDU daddu
270#define INT_ADDI daddi
271#define INT_ADDIU daddiu
272#define INT_SUB dsub
273#define INT_SUBU dsubu
274#define INT_L ld
275#define INT_S sd
276#define INT_SLL dsll
277#define INT_SLLV dsllv
278#define INT_SRL dsrl
279#define INT_SRLV dsrlv
280#define INT_SRA dsra
281#define INT_SRAV dsrav
282#endif
283
284/*
285 * How to add/sub/load/store/shift C long variables.
286 */
287#if (_MIPS_SZLONG == 32)
288#define LONG_ADD add
289#define LONG_ADDU addu
290#define LONG_ADDI addi
291#define LONG_ADDIU addiu
292#define LONG_SUB sub
293#define LONG_SUBU subu
294#define LONG_L lw
295#define LONG_S sw
296#define LONG_SLL sll
297#define LONG_SLLV sllv
298#define LONG_SRL srl
299#define LONG_SRLV srlv
300#define LONG_SRA sra
301#define LONG_SRAV srav
302
303#define LONG .word
304#define LONGSIZE 4
305#define LONGMASK 3
306#define LONGLOG 2
307#endif
308
309#if (_MIPS_SZLONG == 64)
310#define LONG_ADD dadd
311#define LONG_ADDU daddu
312#define LONG_ADDI daddi
313#define LONG_ADDIU daddiu
314#define LONG_SUB dsub
315#define LONG_SUBU dsubu
316#define LONG_L ld
317#define LONG_S sd
318#define LONG_SLL dsll
319#define LONG_SLLV dsllv
320#define LONG_SRL dsrl
321#define LONG_SRLV dsrlv
322#define LONG_SRA dsra
323#define LONG_SRAV dsrav
324
325#define LONG .dword
326#define LONGSIZE 8
327#define LONGMASK 7
328#define LONGLOG 3
329#endif
330
331/*
332 * How to add/sub/load/store/shift pointers.
333 */
334#if (_MIPS_SZPTR == 32)
335#define PTR_ADD add
336#define PTR_ADDU addu
337#define PTR_ADDI addi
338#define PTR_ADDIU addiu
339#define PTR_SUB sub
340#define PTR_SUBU subu
341#define PTR_L lw
342#define PTR_S sw
343#define PTR_LA la
344#define PTR_SLL sll
345#define PTR_SLLV sllv
346#define PTR_SRL srl
347#define PTR_SRLV srlv
348#define PTR_SRA sra
349#define PTR_SRAV srav
350
351#define PTR_SCALESHIFT 2
352
353#define PTR .word
354#define PTRSIZE 4
355#define PTRLOG 2
356#endif
357
358#if (_MIPS_SZPTR == 64)
359#define PTR_ADD dadd
360#define PTR_ADDU daddu
361#define PTR_ADDI daddi
362#define PTR_ADDIU daddiu
363#define PTR_SUB dsub
364#define PTR_SUBU dsubu
365#define PTR_L ld
366#define PTR_S sd
367#define PTR_LA dla
368#define PTR_SLL dsll
369#define PTR_SLLV dsllv
370#define PTR_SRL dsrl
371#define PTR_SRLV dsrlv
372#define PTR_SRA dsra
373#define PTR_SRAV dsrav
374
375#define PTR_SCALESHIFT 3
376
377#define PTR .dword
378#define PTRSIZE 8
379#define PTRLOG 3
380#endif
381
382/*
383 * Some cp0 registers were extended to 64bit for MIPS III.
384 */
385#if (_MIPS_SIM == _MIPS_SIM_ABI32)
386#define MFC0 mfc0
387#define MTC0 mtc0
388#endif
389#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
390#define MFC0 dmfc0
391#define MTC0 dmtc0
392#endif
393
394#define SSNOP sll zero,zero,1
395
396#endif /* __ASM_ASM_H */
diff --git a/include/asm-mips/asmmacro-32.h b/include/asm-mips/asmmacro-32.h
new file mode 100644
index 000000000000..ac8823df2554
--- /dev/null
+++ b/include/asm-mips/asmmacro-32.h
@@ -0,0 +1,158 @@
1/*
2 * asmmacro.h: Assembler macros to make things easier to read.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1998, 1999, 2003 Ralf Baechle
6 */
7#ifndef _ASM_ASMMACRO_32_H
8#define _ASM_ASMMACRO_32_H
9
10#include <asm/offset.h>
11#include <asm/regdef.h>
12#include <asm/fpregdef.h>
13#include <asm/mipsregs.h>
14
15 .macro fpu_save_double thread status tmp1=t0 tmp2
16 cfc1 \tmp1, fcr31
17 sdc1 $f0, THREAD_FPR0(\thread)
18 sdc1 $f2, THREAD_FPR2(\thread)
19 sdc1 $f4, THREAD_FPR4(\thread)
20 sdc1 $f6, THREAD_FPR6(\thread)
21 sdc1 $f8, THREAD_FPR8(\thread)
22 sdc1 $f10, THREAD_FPR10(\thread)
23 sdc1 $f12, THREAD_FPR12(\thread)
24 sdc1 $f14, THREAD_FPR14(\thread)
25 sdc1 $f16, THREAD_FPR16(\thread)
26 sdc1 $f18, THREAD_FPR18(\thread)
27 sdc1 $f20, THREAD_FPR20(\thread)
28 sdc1 $f22, THREAD_FPR22(\thread)
29 sdc1 $f24, THREAD_FPR24(\thread)
30 sdc1 $f26, THREAD_FPR26(\thread)
31 sdc1 $f28, THREAD_FPR28(\thread)
32 sdc1 $f30, THREAD_FPR30(\thread)
33 sw \tmp1, THREAD_FCR31(\thread)
34 .endm
35
36 .macro fpu_save_single thread tmp=t0
37 cfc1 \tmp, fcr31
38 swc1 $f0, THREAD_FPR0(\thread)
39 swc1 $f1, THREAD_FPR1(\thread)
40 swc1 $f2, THREAD_FPR2(\thread)
41 swc1 $f3, THREAD_FPR3(\thread)
42 swc1 $f4, THREAD_FPR4(\thread)
43 swc1 $f5, THREAD_FPR5(\thread)
44 swc1 $f6, THREAD_FPR6(\thread)
45 swc1 $f7, THREAD_FPR7(\thread)
46 swc1 $f8, THREAD_FPR8(\thread)
47 swc1 $f9, THREAD_FPR9(\thread)
48 swc1 $f10, THREAD_FPR10(\thread)
49 swc1 $f11, THREAD_FPR11(\thread)
50 swc1 $f12, THREAD_FPR12(\thread)
51 swc1 $f13, THREAD_FPR13(\thread)
52 swc1 $f14, THREAD_FPR14(\thread)
53 swc1 $f15, THREAD_FPR15(\thread)
54 swc1 $f16, THREAD_FPR16(\thread)
55 swc1 $f17, THREAD_FPR17(\thread)
56 swc1 $f18, THREAD_FPR18(\thread)
57 swc1 $f19, THREAD_FPR19(\thread)
58 swc1 $f20, THREAD_FPR20(\thread)
59 swc1 $f21, THREAD_FPR21(\thread)
60 swc1 $f22, THREAD_FPR22(\thread)
61 swc1 $f23, THREAD_FPR23(\thread)
62 swc1 $f24, THREAD_FPR24(\thread)
63 swc1 $f25, THREAD_FPR25(\thread)
64 swc1 $f26, THREAD_FPR26(\thread)
65 swc1 $f27, THREAD_FPR27(\thread)
66 swc1 $f28, THREAD_FPR28(\thread)
67 swc1 $f29, THREAD_FPR29(\thread)
68 swc1 $f30, THREAD_FPR30(\thread)
69 swc1 $f31, THREAD_FPR31(\thread)
70 sw \tmp, THREAD_FCR31(\thread)
71 .endm
72
73 .macro fpu_restore_double thread tmp=t0
74 lw \tmp, THREAD_FCR31(\thread)
75 ldc1 $f0, THREAD_FPR0(\thread)
76 ldc1 $f2, THREAD_FPR2(\thread)
77 ldc1 $f4, THREAD_FPR4(\thread)
78 ldc1 $f6, THREAD_FPR6(\thread)
79 ldc1 $f8, THREAD_FPR8(\thread)
80 ldc1 $f10, THREAD_FPR10(\thread)
81 ldc1 $f12, THREAD_FPR12(\thread)
82 ldc1 $f14, THREAD_FPR14(\thread)
83 ldc1 $f16, THREAD_FPR16(\thread)
84 ldc1 $f18, THREAD_FPR18(\thread)
85 ldc1 $f20, THREAD_FPR20(\thread)
86 ldc1 $f22, THREAD_FPR22(\thread)
87 ldc1 $f24, THREAD_FPR24(\thread)
88 ldc1 $f26, THREAD_FPR26(\thread)
89 ldc1 $f28, THREAD_FPR28(\thread)
90 ldc1 $f30, THREAD_FPR30(\thread)
91 ctc1 \tmp, fcr31
92 .endm
93
94 .macro fpu_restore_single thread tmp=t0
95 lw \tmp, THREAD_FCR31(\thread)
96 lwc1 $f0, THREAD_FPR0(\thread)
97 lwc1 $f1, THREAD_FPR1(\thread)
98 lwc1 $f2, THREAD_FPR2(\thread)
99 lwc1 $f3, THREAD_FPR3(\thread)
100 lwc1 $f4, THREAD_FPR4(\thread)
101 lwc1 $f5, THREAD_FPR5(\thread)
102 lwc1 $f6, THREAD_FPR6(\thread)
103 lwc1 $f7, THREAD_FPR7(\thread)
104 lwc1 $f8, THREAD_FPR8(\thread)
105 lwc1 $f9, THREAD_FPR9(\thread)
106 lwc1 $f10, THREAD_FPR10(\thread)
107 lwc1 $f11, THREAD_FPR11(\thread)
108 lwc1 $f12, THREAD_FPR12(\thread)
109 lwc1 $f13, THREAD_FPR13(\thread)
110 lwc1 $f14, THREAD_FPR14(\thread)
111 lwc1 $f15, THREAD_FPR15(\thread)
112 lwc1 $f16, THREAD_FPR16(\thread)
113 lwc1 $f17, THREAD_FPR17(\thread)
114 lwc1 $f18, THREAD_FPR18(\thread)
115 lwc1 $f19, THREAD_FPR19(\thread)
116 lwc1 $f20, THREAD_FPR20(\thread)
117 lwc1 $f21, THREAD_FPR21(\thread)
118 lwc1 $f22, THREAD_FPR22(\thread)
119 lwc1 $f23, THREAD_FPR23(\thread)
120 lwc1 $f24, THREAD_FPR24(\thread)
121 lwc1 $f25, THREAD_FPR25(\thread)
122 lwc1 $f26, THREAD_FPR26(\thread)
123 lwc1 $f27, THREAD_FPR27(\thread)
124 lwc1 $f28, THREAD_FPR28(\thread)
125 lwc1 $f29, THREAD_FPR29(\thread)
126 lwc1 $f30, THREAD_FPR30(\thread)
127 lwc1 $f31, THREAD_FPR31(\thread)
128 ctc1 \tmp, fcr31
129 .endm
130
131 .macro cpu_save_nonscratch thread
132 LONG_S s0, THREAD_REG16(\thread)
133 LONG_S s1, THREAD_REG17(\thread)
134 LONG_S s2, THREAD_REG18(\thread)
135 LONG_S s3, THREAD_REG19(\thread)
136 LONG_S s4, THREAD_REG20(\thread)
137 LONG_S s5, THREAD_REG21(\thread)
138 LONG_S s6, THREAD_REG22(\thread)
139 LONG_S s7, THREAD_REG23(\thread)
140 LONG_S sp, THREAD_REG29(\thread)
141 LONG_S fp, THREAD_REG30(\thread)
142 .endm
143
144 .macro cpu_restore_nonscratch thread
145 LONG_L s0, THREAD_REG16(\thread)
146 LONG_L s1, THREAD_REG17(\thread)
147 LONG_L s2, THREAD_REG18(\thread)
148 LONG_L s3, THREAD_REG19(\thread)
149 LONG_L s4, THREAD_REG20(\thread)
150 LONG_L s5, THREAD_REG21(\thread)
151 LONG_L s6, THREAD_REG22(\thread)
152 LONG_L s7, THREAD_REG23(\thread)
153 LONG_L sp, THREAD_REG29(\thread)
154 LONG_L fp, THREAD_REG30(\thread)
155 LONG_L ra, THREAD_REG31(\thread)
156 .endm
157
158#endif /* _ASM_ASMMACRO_32_H */
diff --git a/include/asm-mips/asmmacro-64.h b/include/asm-mips/asmmacro-64.h
new file mode 100644
index 000000000000..bbed35511f5a
--- /dev/null
+++ b/include/asm-mips/asmmacro-64.h
@@ -0,0 +1,140 @@
1/*
2 * asmmacro.h: Assembler macros to make things easier to read.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1998, 1999 Ralf Baechle
6 * Copyright (C) 1999 Silicon Graphics, Inc.
7 */
8#ifndef _ASM_ASMMACRO_64_H
9#define _ASM_ASMMACRO_64_H
10
11#include <asm/offset.h>
12#include <asm/regdef.h>
13#include <asm/fpregdef.h>
14#include <asm/mipsregs.h>
15
16 .macro fpu_save_16even thread tmp=t0
17 cfc1 \tmp, fcr31
18 sdc1 $f0, THREAD_FPR0(\thread)
19 sdc1 $f2, THREAD_FPR2(\thread)
20 sdc1 $f4, THREAD_FPR4(\thread)
21 sdc1 $f6, THREAD_FPR6(\thread)
22 sdc1 $f8, THREAD_FPR8(\thread)
23 sdc1 $f10, THREAD_FPR10(\thread)
24 sdc1 $f12, THREAD_FPR12(\thread)
25 sdc1 $f14, THREAD_FPR14(\thread)
26 sdc1 $f16, THREAD_FPR16(\thread)
27 sdc1 $f18, THREAD_FPR18(\thread)
28 sdc1 $f20, THREAD_FPR20(\thread)
29 sdc1 $f22, THREAD_FPR22(\thread)
30 sdc1 $f24, THREAD_FPR24(\thread)
31 sdc1 $f26, THREAD_FPR26(\thread)
32 sdc1 $f28, THREAD_FPR28(\thread)
33 sdc1 $f30, THREAD_FPR30(\thread)
34 sw \tmp, THREAD_FCR31(\thread)
35 .endm
36
37 .macro fpu_save_16odd thread
38 sdc1 $f1, THREAD_FPR1(\thread)
39 sdc1 $f3, THREAD_FPR3(\thread)
40 sdc1 $f5, THREAD_FPR5(\thread)
41 sdc1 $f7, THREAD_FPR7(\thread)
42 sdc1 $f9, THREAD_FPR9(\thread)
43 sdc1 $f11, THREAD_FPR11(\thread)
44 sdc1 $f13, THREAD_FPR13(\thread)
45 sdc1 $f15, THREAD_FPR15(\thread)
46 sdc1 $f17, THREAD_FPR17(\thread)
47 sdc1 $f19, THREAD_FPR19(\thread)
48 sdc1 $f21, THREAD_FPR21(\thread)
49 sdc1 $f23, THREAD_FPR23(\thread)
50 sdc1 $f25, THREAD_FPR25(\thread)
51 sdc1 $f27, THREAD_FPR27(\thread)
52 sdc1 $f29, THREAD_FPR29(\thread)
53 sdc1 $f31, THREAD_FPR31(\thread)
54 .endm
55
56 .macro fpu_save_double thread status tmp1 tmp2
57 sll \tmp2, \tmp1, 5
58 bgez \tmp2, 2f
59 fpu_save_16odd \thread
602:
61 fpu_save_16even \thread \tmp1 # clobbers t1
62 .endm
63
64 .macro fpu_restore_16even thread tmp=t0
65 lw \tmp, THREAD_FCR31(\thread)
66 ldc1 $f0, THREAD_FPR0(\thread)
67 ldc1 $f2, THREAD_FPR2(\thread)
68 ldc1 $f4, THREAD_FPR4(\thread)
69 ldc1 $f6, THREAD_FPR6(\thread)
70 ldc1 $f8, THREAD_FPR8(\thread)
71 ldc1 $f10, THREAD_FPR10(\thread)
72 ldc1 $f12, THREAD_FPR12(\thread)
73 ldc1 $f14, THREAD_FPR14(\thread)
74 ldc1 $f16, THREAD_FPR16(\thread)
75 ldc1 $f18, THREAD_FPR18(\thread)
76 ldc1 $f20, THREAD_FPR20(\thread)
77 ldc1 $f22, THREAD_FPR22(\thread)
78 ldc1 $f24, THREAD_FPR24(\thread)
79 ldc1 $f26, THREAD_FPR26(\thread)
80 ldc1 $f28, THREAD_FPR28(\thread)
81 ldc1 $f30, THREAD_FPR30(\thread)
82 ctc1 \tmp, fcr31
83 .endm
84
85 .macro fpu_restore_16odd thread
86 ldc1 $f1, THREAD_FPR1(\thread)
87 ldc1 $f3, THREAD_FPR3(\thread)
88 ldc1 $f5, THREAD_FPR5(\thread)
89 ldc1 $f7, THREAD_FPR7(\thread)
90 ldc1 $f9, THREAD_FPR9(\thread)
91 ldc1 $f11, THREAD_FPR11(\thread)
92 ldc1 $f13, THREAD_FPR13(\thread)
93 ldc1 $f15, THREAD_FPR15(\thread)
94 ldc1 $f17, THREAD_FPR17(\thread)
95 ldc1 $f19, THREAD_FPR19(\thread)
96 ldc1 $f21, THREAD_FPR21(\thread)
97 ldc1 $f23, THREAD_FPR23(\thread)
98 ldc1 $f25, THREAD_FPR25(\thread)
99 ldc1 $f27, THREAD_FPR27(\thread)
100 ldc1 $f29, THREAD_FPR29(\thread)
101 ldc1 $f31, THREAD_FPR31(\thread)
102 .endm
103
104 .macro fpu_restore_double thread tmp
105 mfc0 t0, CP0_STATUS
106 sll t1, t0, 5
107 bgez t1, 1f # 16 register mode?
108
109 fpu_restore_16odd a0
1101: fpu_restore_16even a0, t0 # clobbers t0
111 .endm
112
113 .macro cpu_save_nonscratch thread
114 LONG_S s0, THREAD_REG16(\thread)
115 LONG_S s1, THREAD_REG17(\thread)
116 LONG_S s2, THREAD_REG18(\thread)
117 LONG_S s3, THREAD_REG19(\thread)
118 LONG_S s4, THREAD_REG20(\thread)
119 LONG_S s5, THREAD_REG21(\thread)
120 LONG_S s6, THREAD_REG22(\thread)
121 LONG_S s7, THREAD_REG23(\thread)
122 LONG_S sp, THREAD_REG29(\thread)
123 LONG_S fp, THREAD_REG30(\thread)
124 .endm
125
126 .macro cpu_restore_nonscratch thread
127 LONG_L s0, THREAD_REG16(\thread)
128 LONG_L s1, THREAD_REG17(\thread)
129 LONG_L s2, THREAD_REG18(\thread)
130 LONG_L s3, THREAD_REG19(\thread)
131 LONG_L s4, THREAD_REG20(\thread)
132 LONG_L s5, THREAD_REG21(\thread)
133 LONG_L s6, THREAD_REG22(\thread)
134 LONG_L s7, THREAD_REG23(\thread)
135 LONG_L sp, THREAD_REG29(\thread)
136 LONG_L fp, THREAD_REG30(\thread)
137 LONG_L ra, THREAD_REG31(\thread)
138 .endm
139
140#endif /* _ASM_ASMMACRO_64_H */
diff --git a/include/asm-mips/asmmacro.h b/include/asm-mips/asmmacro.h
new file mode 100644
index 000000000000..37a460aa0378
--- /dev/null
+++ b/include/asm-mips/asmmacro.h
@@ -0,0 +1,51 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 Ralf Baechle
7 */
8#ifndef _ASM_ASMMACRO_H
9#define _ASM_ASMMACRO_H
10
11#include <linux/config.h>
12#include <asm/hazards.h>
13
14#ifdef CONFIG_MIPS32
15#include <asm/asmmacro-32.h>
16#endif
17#ifdef CONFIG_MIPS64
18#include <asm/asmmacro-64.h>
19#endif
20
21 .macro local_irq_enable reg=t0
22 mfc0 \reg, CP0_STATUS
23 ori \reg, \reg, 1
24 mtc0 \reg, CP0_STATUS
25 irq_enable_hazard
26 .endm
27
28 .macro local_irq_disable reg=t0
29 mfc0 \reg, CP0_STATUS
30 ori \reg, \reg, 1
31 xori \reg, \reg, 1
32 mtc0 \reg, CP0_STATUS
33 irq_disable_hazard
34 .endm
35
36#ifdef CONFIG_CPU_SB1
37 .macro fpu_enable_hazard
38 .set push
39 .set noreorder
40 .set mips2
41 SSNOP
42 bnezl $0, .+4
43 SSNOP
44 .set pop
45 .endm
46#else
47 .macro fpu_enable_hazard
48 .endm
49#endif
50
51#endif /* _ASM_ASMMACRO_H */
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
new file mode 100644
index 000000000000..7d89e87bc8c6
--- /dev/null
+++ b/include/asm-mips/atomic.h
@@ -0,0 +1,653 @@
1/*
2 * Atomic operations that C can't guarantee us. Useful for
3 * resource counting etc..
4 *
5 * But use these as seldom as possible since they are much more slower
6 * than regular operations.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 *
12 * Copyright (C) 1996, 97, 99, 2000, 03, 04 by Ralf Baechle
13 */
14
15/*
16 * As workaround for the ATOMIC_DEC_AND_LOCK / atomic_dec_and_lock mess in
17 * <linux/spinlock.h> we have to include <linux/spinlock.h> outside the
18 * main big wrapper ...
19 */
20#include <linux/config.h>
21#include <linux/spinlock.h>
22
23#ifndef _ASM_ATOMIC_H
24#define _ASM_ATOMIC_H
25
26#include <asm/cpu-features.h>
27#include <asm/war.h>
28
29extern spinlock_t atomic_lock;
30
31typedef struct { volatile int counter; } atomic_t;
32
33#define ATOMIC_INIT(i) { (i) }
34
35/*
36 * atomic_read - read atomic variable
37 * @v: pointer of type atomic_t
38 *
39 * Atomically reads the value of @v.
40 */
41#define atomic_read(v) ((v)->counter)
42
43/*
44 * atomic_set - set atomic variable
45 * @v: pointer of type atomic_t
46 * @i: required value
47 *
48 * Atomically sets the value of @v to @i.
49 */
50#define atomic_set(v,i) ((v)->counter = (i))
51
52/*
53 * atomic_add - add integer to atomic variable
54 * @i: integer value to add
55 * @v: pointer of type atomic_t
56 *
57 * Atomically adds @i to @v.
58 */
59static __inline__ void atomic_add(int i, atomic_t * v)
60{
61 if (cpu_has_llsc && R10000_LLSC_WAR) {
62 unsigned long temp;
63
64 __asm__ __volatile__(
65 "1: ll %0, %1 # atomic_add \n"
66 " addu %0, %2 \n"
67 " sc %0, %1 \n"
68 " beqzl %0, 1b \n"
69 : "=&r" (temp), "=m" (v->counter)
70 : "Ir" (i), "m" (v->counter));
71 } else if (cpu_has_llsc) {
72 unsigned long temp;
73
74 __asm__ __volatile__(
75 "1: ll %0, %1 # atomic_add \n"
76 " addu %0, %2 \n"
77 " sc %0, %1 \n"
78 " beqz %0, 1b \n"
79 : "=&r" (temp), "=m" (v->counter)
80 : "Ir" (i), "m" (v->counter));
81 } else {
82 unsigned long flags;
83
84 spin_lock_irqsave(&atomic_lock, flags);
85 v->counter += i;
86 spin_unlock_irqrestore(&atomic_lock, flags);
87 }
88}
89
90/*
91 * atomic_sub - subtract the atomic variable
92 * @i: integer value to subtract
93 * @v: pointer of type atomic_t
94 *
95 * Atomically subtracts @i from @v.
96 */
97static __inline__ void atomic_sub(int i, atomic_t * v)
98{
99 if (cpu_has_llsc && R10000_LLSC_WAR) {
100 unsigned long temp;
101
102 __asm__ __volatile__(
103 "1: ll %0, %1 # atomic_sub \n"
104 " subu %0, %2 \n"
105 " sc %0, %1 \n"
106 " beqzl %0, 1b \n"
107 : "=&r" (temp), "=m" (v->counter)
108 : "Ir" (i), "m" (v->counter));
109 } else if (cpu_has_llsc) {
110 unsigned long temp;
111
112 __asm__ __volatile__(
113 "1: ll %0, %1 # atomic_sub \n"
114 " subu %0, %2 \n"
115 " sc %0, %1 \n"
116 " beqz %0, 1b \n"
117 : "=&r" (temp), "=m" (v->counter)
118 : "Ir" (i), "m" (v->counter));
119 } else {
120 unsigned long flags;
121
122 spin_lock_irqsave(&atomic_lock, flags);
123 v->counter -= i;
124 spin_unlock_irqrestore(&atomic_lock, flags);
125 }
126}
127
128/*
129 * Same as above, but return the result value
130 */
131static __inline__ int atomic_add_return(int i, atomic_t * v)
132{
133 unsigned long result;
134
135 if (cpu_has_llsc && R10000_LLSC_WAR) {
136 unsigned long temp;
137
138 __asm__ __volatile__(
139 "1: ll %1, %2 # atomic_add_return \n"
140 " addu %0, %1, %3 \n"
141 " sc %0, %2 \n"
142 " beqzl %0, 1b \n"
143 " addu %0, %1, %3 \n"
144 " sync \n"
145 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
146 : "Ir" (i), "m" (v->counter)
147 : "memory");
148 } else if (cpu_has_llsc) {
149 unsigned long temp;
150
151 __asm__ __volatile__(
152 "1: ll %1, %2 # atomic_add_return \n"
153 " addu %0, %1, %3 \n"
154 " sc %0, %2 \n"
155 " beqz %0, 1b \n"
156 " addu %0, %1, %3 \n"
157 " sync \n"
158 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
159 : "Ir" (i), "m" (v->counter)
160 : "memory");
161 } else {
162 unsigned long flags;
163
164 spin_lock_irqsave(&atomic_lock, flags);
165 result = v->counter;
166 result += i;
167 v->counter = result;
168 spin_unlock_irqrestore(&atomic_lock, flags);
169 }
170
171 return result;
172}
173
174static __inline__ int atomic_sub_return(int i, atomic_t * v)
175{
176 unsigned long result;
177
178 if (cpu_has_llsc && R10000_LLSC_WAR) {
179 unsigned long temp;
180
181 __asm__ __volatile__(
182 "1: ll %1, %2 # atomic_sub_return \n"
183 " subu %0, %1, %3 \n"
184 " sc %0, %2 \n"
185 " beqzl %0, 1b \n"
186 " subu %0, %1, %3 \n"
187 " sync \n"
188 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
189 : "Ir" (i), "m" (v->counter)
190 : "memory");
191 } else if (cpu_has_llsc) {
192 unsigned long temp;
193
194 __asm__ __volatile__(
195 "1: ll %1, %2 # atomic_sub_return \n"
196 " subu %0, %1, %3 \n"
197 " sc %0, %2 \n"
198 " beqz %0, 1b \n"
199 " subu %0, %1, %3 \n"
200 " sync \n"
201 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
202 : "Ir" (i), "m" (v->counter)
203 : "memory");
204 } else {
205 unsigned long flags;
206
207 spin_lock_irqsave(&atomic_lock, flags);
208 result = v->counter;
209 result -= i;
210 v->counter = result;
211 spin_unlock_irqrestore(&atomic_lock, flags);
212 }
213
214 return result;
215}
216
217/*
218 * atomic_sub_if_positive - add integer to atomic variable
219 * @v: pointer of type atomic_t
220 *
221 * Atomically test @v and decrement if it is greater than 0.
222 * The function returns the old value of @v minus 1.
223 */
224static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
225{
226 unsigned long result;
227
228 if (cpu_has_llsc && R10000_LLSC_WAR) {
229 unsigned long temp;
230
231 __asm__ __volatile__(
232 "1: ll %1, %2 # atomic_sub_if_positive\n"
233 " subu %0, %1, %3 \n"
234 " bltz %0, 1f \n"
235 " sc %0, %2 \n"
236 " beqzl %0, 1b \n"
237 " sync \n"
238 "1: \n"
239 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
240 : "Ir" (i), "m" (v->counter)
241 : "memory");
242 } else if (cpu_has_llsc) {
243 unsigned long temp;
244
245 __asm__ __volatile__(
246 "1: ll %1, %2 # atomic_sub_if_positive\n"
247 " subu %0, %1, %3 \n"
248 " bltz %0, 1f \n"
249 " sc %0, %2 \n"
250 " beqz %0, 1b \n"
251 " sync \n"
252 "1: \n"
253 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
254 : "Ir" (i), "m" (v->counter)
255 : "memory");
256 } else {
257 unsigned long flags;
258
259 spin_lock_irqsave(&atomic_lock, flags);
260 result = v->counter;
261 result -= i;
262 if (result >= 0)
263 v->counter = result;
264 spin_unlock_irqrestore(&atomic_lock, flags);
265 }
266
267 return result;
268}
269
270#define atomic_dec_return(v) atomic_sub_return(1,(v))
271#define atomic_inc_return(v) atomic_add_return(1,(v))
272
273/*
274 * atomic_sub_and_test - subtract value from variable and test result
275 * @i: integer value to subtract
276 * @v: pointer of type atomic_t
277 *
278 * Atomically subtracts @i from @v and returns
279 * true if the result is zero, or false for all
280 * other cases.
281 */
282#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
283
284/*
285 * atomic_inc_and_test - increment and test
286 * @v: pointer of type atomic_t
287 *
288 * Atomically increments @v by 1
289 * and returns true if the result is zero, or false for all
290 * other cases.
291 */
292#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
293
294/*
295 * atomic_dec_and_test - decrement by 1 and test
296 * @v: pointer of type atomic_t
297 *
298 * Atomically decrements @v by 1 and
299 * returns true if the result is 0, or false for all other
300 * cases.
301 */
302#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
303
304/*
305 * atomic_dec_if_positive - decrement by 1 if old value positive
306 * @v: pointer of type atomic_t
307 */
308#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)
309
310/*
311 * atomic_inc - increment atomic variable
312 * @v: pointer of type atomic_t
313 *
314 * Atomically increments @v by 1.
315 */
316#define atomic_inc(v) atomic_add(1,(v))
317
318/*
319 * atomic_dec - decrement and test
320 * @v: pointer of type atomic_t
321 *
322 * Atomically decrements @v by 1.
323 */
324#define atomic_dec(v) atomic_sub(1,(v))
325
326/*
327 * atomic_add_negative - add and test if negative
328 * @v: pointer of type atomic_t
329 * @i: integer value to add
330 *
331 * Atomically adds @i to @v and returns true
332 * if the result is negative, or false when
333 * result is greater than or equal to zero.
334 */
335#define atomic_add_negative(i,v) (atomic_add_return(i, (v)) < 0)
336
337#ifdef CONFIG_MIPS64
338
339typedef struct { volatile __s64 counter; } atomic64_t;
340
341#define ATOMIC64_INIT(i) { (i) }
342
343/*
344 * atomic64_read - read atomic variable
345 * @v: pointer of type atomic64_t
346 *
347 */
348#define atomic64_read(v) ((v)->counter)
349
350/*
351 * atomic64_set - set atomic variable
352 * @v: pointer of type atomic64_t
353 * @i: required value
354 */
355#define atomic64_set(v,i) ((v)->counter = (i))
356
357/*
358 * atomic64_add - add integer to atomic variable
359 * @i: integer value to add
360 * @v: pointer of type atomic64_t
361 *
362 * Atomically adds @i to @v.
363 */
364static __inline__ void atomic64_add(long i, atomic64_t * v)
365{
366 if (cpu_has_llsc && R10000_LLSC_WAR) {
367 unsigned long temp;
368
369 __asm__ __volatile__(
370 "1: lld %0, %1 # atomic64_add \n"
371 " addu %0, %2 \n"
372 " scd %0, %1 \n"
373 " beqzl %0, 1b \n"
374 : "=&r" (temp), "=m" (v->counter)
375 : "Ir" (i), "m" (v->counter));
376 } else if (cpu_has_llsc) {
377 unsigned long temp;
378
379 __asm__ __volatile__(
380 "1: lld %0, %1 # atomic64_add \n"
381 " addu %0, %2 \n"
382 " scd %0, %1 \n"
383 " beqz %0, 1b \n"
384 : "=&r" (temp), "=m" (v->counter)
385 : "Ir" (i), "m" (v->counter));
386 } else {
387 unsigned long flags;
388
389 spin_lock_irqsave(&atomic_lock, flags);
390 v->counter += i;
391 spin_unlock_irqrestore(&atomic_lock, flags);
392 }
393}
394
395/*
396 * atomic64_sub - subtract the atomic variable
397 * @i: integer value to subtract
398 * @v: pointer of type atomic64_t
399 *
400 * Atomically subtracts @i from @v.
401 */
402static __inline__ void atomic64_sub(long i, atomic64_t * v)
403{
404 if (cpu_has_llsc && R10000_LLSC_WAR) {
405 unsigned long temp;
406
407 __asm__ __volatile__(
408 "1: lld %0, %1 # atomic64_sub \n"
409 " subu %0, %2 \n"
410 " scd %0, %1 \n"
411 " beqzl %0, 1b \n"
412 : "=&r" (temp), "=m" (v->counter)
413 : "Ir" (i), "m" (v->counter));
414 } else if (cpu_has_llsc) {
415 unsigned long temp;
416
417 __asm__ __volatile__(
418 "1: lld %0, %1 # atomic64_sub \n"
419 " subu %0, %2 \n"
420 " scd %0, %1 \n"
421 " beqz %0, 1b \n"
422 : "=&r" (temp), "=m" (v->counter)
423 : "Ir" (i), "m" (v->counter));
424 } else {
425 unsigned long flags;
426
427 spin_lock_irqsave(&atomic_lock, flags);
428 v->counter -= i;
429 spin_unlock_irqrestore(&atomic_lock, flags);
430 }
431}
432
433/*
434 * Same as above, but return the result value
435 */
436static __inline__ long atomic64_add_return(long i, atomic64_t * v)
437{
438 unsigned long result;
439
440 if (cpu_has_llsc && R10000_LLSC_WAR) {
441 unsigned long temp;
442
443 __asm__ __volatile__(
444 "1: lld %1, %2 # atomic64_add_return \n"
445 " addu %0, %1, %3 \n"
446 " scd %0, %2 \n"
447 " beqzl %0, 1b \n"
448 " addu %0, %1, %3 \n"
449 " sync \n"
450 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
451 : "Ir" (i), "m" (v->counter)
452 : "memory");
453 } else if (cpu_has_llsc) {
454 unsigned long temp;
455
456 __asm__ __volatile__(
457 "1: lld %1, %2 # atomic64_add_return \n"
458 " addu %0, %1, %3 \n"
459 " scd %0, %2 \n"
460 " beqz %0, 1b \n"
461 " addu %0, %1, %3 \n"
462 " sync \n"
463 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
464 : "Ir" (i), "m" (v->counter)
465 : "memory");
466 } else {
467 unsigned long flags;
468
469 spin_lock_irqsave(&atomic_lock, flags);
470 result = v->counter;
471 result += i;
472 v->counter = result;
473 spin_unlock_irqrestore(&atomic_lock, flags);
474 }
475
476 return result;
477}
478
479static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
480{
481 unsigned long result;
482
483 if (cpu_has_llsc && R10000_LLSC_WAR) {
484 unsigned long temp;
485
486 __asm__ __volatile__(
487 "1: lld %1, %2 # atomic64_sub_return \n"
488 " subu %0, %1, %3 \n"
489 " scd %0, %2 \n"
490 " beqzl %0, 1b \n"
491 " subu %0, %1, %3 \n"
492 " sync \n"
493 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
494 : "Ir" (i), "m" (v->counter)
495 : "memory");
496 } else if (cpu_has_llsc) {
497 unsigned long temp;
498
499 __asm__ __volatile__(
500 "1: lld %1, %2 # atomic64_sub_return \n"
501 " subu %0, %1, %3 \n"
502 " scd %0, %2 \n"
503 " beqz %0, 1b \n"
504 " subu %0, %1, %3 \n"
505 " sync \n"
506 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
507 : "Ir" (i), "m" (v->counter)
508 : "memory");
509 } else {
510 unsigned long flags;
511
512 spin_lock_irqsave(&atomic_lock, flags);
513 result = v->counter;
514 result -= i;
515 v->counter = result;
516 spin_unlock_irqrestore(&atomic_lock, flags);
517 }
518
519 return result;
520}
521
522/*
523 * atomic64_sub_if_positive - add integer to atomic variable
524 * @v: pointer of type atomic64_t
525 *
526 * Atomically test @v and decrement if it is greater than 0.
527 * The function returns the old value of @v minus 1.
528 */
529static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
530{
531 unsigned long result;
532
533 if (cpu_has_llsc && R10000_LLSC_WAR) {
534 unsigned long temp;
535
536 __asm__ __volatile__(
537 "1: lld %1, %2 # atomic64_sub_if_positive\n"
538 " dsubu %0, %1, %3 \n"
539 " bltz %0, 1f \n"
540 " scd %0, %2 \n"
541 " beqzl %0, 1b \n"
542 " sync \n"
543 "1: \n"
544 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
545 : "Ir" (i), "m" (v->counter)
546 : "memory");
547 } else if (cpu_has_llsc) {
548 unsigned long temp;
549
550 __asm__ __volatile__(
551 "1: lld %1, %2 # atomic64_sub_if_positive\n"
552 " dsubu %0, %1, %3 \n"
553 " bltz %0, 1f \n"
554 " scd %0, %2 \n"
555 " beqz %0, 1b \n"
556 " sync \n"
557 "1: \n"
558 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
559 : "Ir" (i), "m" (v->counter)
560 : "memory");
561 } else {
562 unsigned long flags;
563
564 spin_lock_irqsave(&atomic_lock, flags);
565 result = v->counter;
566 result -= i;
567 if (result >= 0)
568 v->counter = result;
569 spin_unlock_irqrestore(&atomic_lock, flags);
570 }
571
572 return result;
573}
574
575#define atomic64_dec_return(v) atomic64_sub_return(1,(v))
576#define atomic64_inc_return(v) atomic64_add_return(1,(v))
577
578/*
579 * atomic64_sub_and_test - subtract value from variable and test result
580 * @i: integer value to subtract
581 * @v: pointer of type atomic64_t
582 *
583 * Atomically subtracts @i from @v and returns
584 * true if the result is zero, or false for all
585 * other cases.
586 */
587#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0)
588
589/*
590 * atomic64_inc_and_test - increment and test
591 * @v: pointer of type atomic64_t
592 *
593 * Atomically increments @v by 1
594 * and returns true if the result is zero, or false for all
595 * other cases.
596 */
597#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
598
599/*
600 * atomic64_dec_and_test - decrement by 1 and test
601 * @v: pointer of type atomic64_t
602 *
603 * Atomically decrements @v by 1 and
604 * returns true if the result is 0, or false for all other
605 * cases.
606 */
607#define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0)
608
609/*
610 * atomic64_dec_if_positive - decrement by 1 if old value positive
611 * @v: pointer of type atomic64_t
612 */
613#define atomic64_dec_if_positive(v) atomic64_sub_if_positive(1, v)
614
615/*
616 * atomic64_inc - increment atomic variable
617 * @v: pointer of type atomic64_t
618 *
619 * Atomically increments @v by 1.
620 */
621#define atomic64_inc(v) atomic64_add(1,(v))
622
623/*
624 * atomic64_dec - decrement and test
625 * @v: pointer of type atomic64_t
626 *
627 * Atomically decrements @v by 1.
628 */
629#define atomic64_dec(v) atomic64_sub(1,(v))
630
631/*
632 * atomic64_add_negative - add and test if negative
633 * @v: pointer of type atomic64_t
634 * @i: integer value to add
635 *
636 * Atomically adds @i to @v and returns true
637 * if the result is negative, or false when
638 * result is greater than or equal to zero.
639 */
640#define atomic64_add_negative(i,v) (atomic64_add_return(i, (v)) < 0)
641
642#endif /* CONFIG_MIPS64 */
643
644/*
645 * atomic*_return operations are serializing but not the non-*_return
646 * versions.
647 */
648#define smp_mb__before_atomic_dec() smp_mb()
649#define smp_mb__after_atomic_dec() smp_mb()
650#define smp_mb__before_atomic_inc() smp_mb()
651#define smp_mb__after_atomic_inc() smp_mb()
652
653#endif /* _ASM_ATOMIC_H */
diff --git a/include/asm-mips/bcache.h b/include/asm-mips/bcache.h
new file mode 100644
index 000000000000..446102b34f4e
--- /dev/null
+++ b/include/asm-mips/bcache.h
@@ -0,0 +1,62 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 1997, 1999 by Ralf Baechle
7 * Copyright (c) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_BCACHE_H
10#define _ASM_BCACHE_H
11
12#include <linux/config.h>
13
14/* Some R4000 / R4400 / R4600 / R5000 machines may have a non-dma-coherent,
15 chipset implemented caches. On machines with other CPUs the CPU does the
16 cache thing itself. */
17struct bcache_ops {
18 void (*bc_enable)(void);
19 void (*bc_disable)(void);
20 void (*bc_wback_inv)(unsigned long page, unsigned long size);
21 void (*bc_inv)(unsigned long page, unsigned long size);
22};
23
24extern void indy_sc_init(void);
25extern void sni_pcimt_sc_init(void);
26
27#ifdef CONFIG_BOARD_SCACHE
28
29extern struct bcache_ops *bcops;
30
31static inline void bc_enable(void)
32{
33 bcops->bc_enable();
34}
35
36static inline void bc_disable(void)
37{
38 bcops->bc_disable();
39}
40
41static inline void bc_wback_inv(unsigned long page, unsigned long size)
42{
43 bcops->bc_wback_inv(page, size);
44}
45
46static inline void bc_inv(unsigned long page, unsigned long size)
47{
48 bcops->bc_inv(page, size);
49}
50
51#else /* !defined(CONFIG_BOARD_SCACHE) */
52
53/* Not R4000 / R4400 / R4600 / R5000. */
54
55#define bc_enable() do { } while (0)
56#define bc_disable() do { } while (0)
57#define bc_wback_inv(page, size) do { } while (0)
58#define bc_inv(page, size) do { } while (0)
59
60#endif /* !defined(CONFIG_BOARD_SCACHE) */
61
62#endif /* _ASM_BCACHE_H */
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
new file mode 100644
index 000000000000..779d2187a6a4
--- /dev/null
+++ b/include/asm-mips/bitops.h
@@ -0,0 +1,850 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 1994 - 1997, 1999, 2000 Ralf Baechle (ralf@gnu.org)
7 * Copyright (c) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_BITOPS_H
10#define _ASM_BITOPS_H
11
12#include <linux/config.h>
13#include <linux/compiler.h>
14#include <linux/types.h>
15#include <asm/byteorder.h> /* sigh ... */
16#include <asm/cpu-features.h>
17
18#if (_MIPS_SZLONG == 32)
19#define SZLONG_LOG 5
20#define SZLONG_MASK 31UL
21#define __LL "ll "
22#define __SC "sc "
23#define cpu_to_lelongp(x) cpu_to_le32p((__u32 *) (x))
24#elif (_MIPS_SZLONG == 64)
25#define SZLONG_LOG 6
26#define SZLONG_MASK 63UL
27#define __LL "lld "
28#define __SC "scd "
29#define cpu_to_lelongp(x) cpu_to_le64p((__u64 *) (x))
30#endif
31
32#ifdef __KERNEL__
33
34#include <asm/interrupt.h>
35#include <asm/sgidefs.h>
36#include <asm/war.h>
37
38/*
39 * clear_bit() doesn't provide any barrier for the compiler.
40 */
41#define smp_mb__before_clear_bit() smp_mb()
42#define smp_mb__after_clear_bit() smp_mb()
43
44/*
45 * Only disable interrupt for kernel mode stuff to keep usermode stuff
46 * that dares to use kernel include files alive.
47 */
48
49#define __bi_flags unsigned long flags
50#define __bi_local_irq_save(x) local_irq_save(x)
51#define __bi_local_irq_restore(x) local_irq_restore(x)
52#else
53#define __bi_flags
54#define __bi_local_irq_save(x)
55#define __bi_local_irq_restore(x)
56#endif /* __KERNEL__ */
57
58/*
59 * set_bit - Atomically set a bit in memory
60 * @nr: the bit to set
61 * @addr: the address to start counting from
62 *
63 * This function is atomic and may not be reordered. See __set_bit()
64 * if you do not require the atomic guarantees.
65 * Note that @nr may be almost arbitrarily large; this function is not
66 * restricted to acting on a single-word quantity.
67 */
68static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
69{
70 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
71 unsigned long temp;
72
73 if (cpu_has_llsc && R10000_LLSC_WAR) {
74 __asm__ __volatile__(
75 "1: " __LL "%0, %1 # set_bit \n"
76 " or %0, %2 \n"
77 " "__SC "%0, %1 \n"
78 " beqzl %0, 1b \n"
79 : "=&r" (temp), "=m" (*m)
80 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m));
81 } else if (cpu_has_llsc) {
82 __asm__ __volatile__(
83 "1: " __LL "%0, %1 # set_bit \n"
84 " or %0, %2 \n"
85 " "__SC "%0, %1 \n"
86 " beqz %0, 1b \n"
87 : "=&r" (temp), "=m" (*m)
88 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m));
89 } else {
90 volatile unsigned long *a = addr;
91 unsigned long mask;
92 __bi_flags;
93
94 a += nr >> SZLONG_LOG;
95 mask = 1UL << (nr & SZLONG_MASK);
96 __bi_local_irq_save(flags);
97 *a |= mask;
98 __bi_local_irq_restore(flags);
99 }
100}
101
102/*
103 * __set_bit - Set a bit in memory
104 * @nr: the bit to set
105 * @addr: the address to start counting from
106 *
107 * Unlike set_bit(), this function is non-atomic and may be reordered.
108 * If it's called on the same region of memory simultaneously, the effect
109 * may be that only one operation succeeds.
110 */
111static inline void __set_bit(unsigned long nr, volatile unsigned long * addr)
112{
113 unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
114
115 *m |= 1UL << (nr & SZLONG_MASK);
116}
117
118/*
119 * clear_bit - Clears a bit in memory
120 * @nr: Bit to clear
121 * @addr: Address to start counting from
122 *
123 * clear_bit() is atomic and may not be reordered. However, it does
124 * not contain a memory barrier, so if it is used for locking purposes,
125 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
126 * in order to ensure changes are visible on other processors.
127 */
128static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
129{
130 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
131 unsigned long temp;
132
133 if (cpu_has_llsc && R10000_LLSC_WAR) {
134 __asm__ __volatile__(
135 "1: " __LL "%0, %1 # clear_bit \n"
136 " and %0, %2 \n"
137 " " __SC "%0, %1 \n"
138 " beqzl %0, 1b \n"
139 : "=&r" (temp), "=m" (*m)
140 : "ir" (~(1UL << (nr & SZLONG_MASK))), "m" (*m));
141 } else if (cpu_has_llsc) {
142 __asm__ __volatile__(
143 "1: " __LL "%0, %1 # clear_bit \n"
144 " and %0, %2 \n"
145 " " __SC "%0, %1 \n"
146 " beqz %0, 1b \n"
147 : "=&r" (temp), "=m" (*m)
148 : "ir" (~(1UL << (nr & SZLONG_MASK))), "m" (*m));
149 } else {
150 volatile unsigned long *a = addr;
151 unsigned long mask;
152 __bi_flags;
153
154 a += nr >> SZLONG_LOG;
155 mask = 1UL << (nr & SZLONG_MASK);
156 __bi_local_irq_save(flags);
157 *a &= ~mask;
158 __bi_local_irq_restore(flags);
159 }
160}
161
162/*
163 * __clear_bit - Clears a bit in memory
164 * @nr: Bit to clear
165 * @addr: Address to start counting from
166 *
167 * Unlike clear_bit(), this function is non-atomic and may be reordered.
168 * If it's called on the same region of memory simultaneously, the effect
169 * may be that only one operation succeeds.
170 */
171static inline void __clear_bit(unsigned long nr, volatile unsigned long * addr)
172{
173 unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
174
175 *m &= ~(1UL << (nr & SZLONG_MASK));
176}
177
178/*
179 * change_bit - Toggle a bit in memory
180 * @nr: Bit to change
181 * @addr: Address to start counting from
182 *
183 * change_bit() is atomic and may not be reordered.
184 * Note that @nr may be almost arbitrarily large; this function is not
185 * restricted to acting on a single-word quantity.
186 */
187static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
188{
189 if (cpu_has_llsc && R10000_LLSC_WAR) {
190 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
191 unsigned long temp;
192
193 __asm__ __volatile__(
194 "1: " __LL "%0, %1 # change_bit \n"
195 " xor %0, %2 \n"
196 " "__SC "%0, %1 \n"
197 " beqzl %0, 1b \n"
198 : "=&r" (temp), "=m" (*m)
199 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m));
200 } else if (cpu_has_llsc) {
201 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
202 unsigned long temp;
203
204 __asm__ __volatile__(
205 "1: " __LL "%0, %1 # change_bit \n"
206 " xor %0, %2 \n"
207 " "__SC "%0, %1 \n"
208 " beqz %0, 1b \n"
209 : "=&r" (temp), "=m" (*m)
210 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m));
211 } else {
212 volatile unsigned long *a = addr;
213 unsigned long mask;
214 __bi_flags;
215
216 a += nr >> SZLONG_LOG;
217 mask = 1UL << (nr & SZLONG_MASK);
218 __bi_local_irq_save(flags);
219 *a ^= mask;
220 __bi_local_irq_restore(flags);
221 }
222}
223
224/*
225 * __change_bit - Toggle a bit in memory
226 * @nr: the bit to change
227 * @addr: the address to start counting from
228 *
229 * Unlike change_bit(), this function is non-atomic and may be reordered.
230 * If it's called on the same region of memory simultaneously, the effect
231 * may be that only one operation succeeds.
232 */
233static inline void __change_bit(unsigned long nr, volatile unsigned long * addr)
234{
235 unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
236
237 *m ^= 1UL << (nr & SZLONG_MASK);
238}
239
240/*
241 * test_and_set_bit - Set a bit and return its old value
242 * @nr: Bit to set
243 * @addr: Address to count from
244 *
245 * This operation is atomic and cannot be reordered.
246 * It also implies a memory barrier.
247 */
248static inline int test_and_set_bit(unsigned long nr,
249 volatile unsigned long *addr)
250{
251 if (cpu_has_llsc && R10000_LLSC_WAR) {
252 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
253 unsigned long temp, res;
254
255 __asm__ __volatile__(
256 "1: " __LL "%0, %1 # test_and_set_bit \n"
257 " or %2, %0, %3 \n"
258 " " __SC "%2, %1 \n"
259 " beqzl %2, 1b \n"
260 " and %2, %0, %3 \n"
261#ifdef CONFIG_SMP
262 "sync \n"
263#endif
264 : "=&r" (temp), "=m" (*m), "=&r" (res)
265 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
266 : "memory");
267
268 return res != 0;
269 } else if (cpu_has_llsc) {
270 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
271 unsigned long temp, res;
272
273 __asm__ __volatile__(
274 " .set noreorder # test_and_set_bit \n"
275 "1: " __LL "%0, %1 \n"
276 " or %2, %0, %3 \n"
277 " " __SC "%2, %1 \n"
278 " beqz %2, 1b \n"
279 " and %2, %0, %3 \n"
280#ifdef CONFIG_SMP
281 "sync \n"
282#endif
283 ".set\treorder"
284 : "=&r" (temp), "=m" (*m), "=&r" (res)
285 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
286 : "memory");
287
288 return res != 0;
289 } else {
290 volatile unsigned long *a = addr;
291 unsigned long mask;
292 int retval;
293 __bi_flags;
294
295 a += nr >> SZLONG_LOG;
296 mask = 1UL << (nr & SZLONG_MASK);
297 __bi_local_irq_save(flags);
298 retval = (mask & *a) != 0;
299 *a |= mask;
300 __bi_local_irq_restore(flags);
301
302 return retval;
303 }
304}
305
306/*
307 * __test_and_set_bit - Set a bit and return its old value
308 * @nr: Bit to set
309 * @addr: Address to count from
310 *
311 * This operation is non-atomic and can be reordered.
312 * If two examples of this operation race, one can appear to succeed
313 * but actually fail. You must protect multiple accesses with a lock.
314 */
315static inline int __test_and_set_bit(unsigned long nr,
316 volatile unsigned long *addr)
317{
318 volatile unsigned long *a = addr;
319 unsigned long mask;
320 int retval;
321
322 a += nr >> SZLONG_LOG;
323 mask = 1UL << (nr & SZLONG_MASK);
324 retval = (mask & *a) != 0;
325 *a |= mask;
326
327 return retval;
328}
329
330/*
331 * test_and_clear_bit - Clear a bit and return its old value
332 * @nr: Bit to clear
333 * @addr: Address to count from
334 *
335 * This operation is atomic and cannot be reordered.
336 * It also implies a memory barrier.
337 */
338static inline int test_and_clear_bit(unsigned long nr,
339 volatile unsigned long *addr)
340{
341 if (cpu_has_llsc && R10000_LLSC_WAR) {
342 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
343 unsigned long temp, res;
344
345 __asm__ __volatile__(
346 "1: " __LL "%0, %1 # test_and_clear_bit \n"
347 " or %2, %0, %3 \n"
348 " xor %2, %3 \n"
349 __SC "%2, %1 \n"
350 " beqzl %2, 1b \n"
351 " and %2, %0, %3 \n"
352#ifdef CONFIG_SMP
353 " sync \n"
354#endif
355 : "=&r" (temp), "=m" (*m), "=&r" (res)
356 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
357 : "memory");
358
359 return res != 0;
360 } else if (cpu_has_llsc) {
361 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
362 unsigned long temp, res;
363
364 __asm__ __volatile__(
365 " .set noreorder # test_and_clear_bit \n"
366 "1: " __LL "%0, %1 \n"
367 " or %2, %0, %3 \n"
368 " xor %2, %3 \n"
369 __SC "%2, %1 \n"
370 " beqz %2, 1b \n"
371 " and %2, %0, %3 \n"
372#ifdef CONFIG_SMP
373 " sync \n"
374#endif
375 " .set reorder \n"
376 : "=&r" (temp), "=m" (*m), "=&r" (res)
377 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
378 : "memory");
379
380 return res != 0;
381 } else {
382 volatile unsigned long *a = addr;
383 unsigned long mask;
384 int retval;
385 __bi_flags;
386
387 a += nr >> SZLONG_LOG;
388 mask = 1UL << (nr & SZLONG_MASK);
389 __bi_local_irq_save(flags);
390 retval = (mask & *a) != 0;
391 *a &= ~mask;
392 __bi_local_irq_restore(flags);
393
394 return retval;
395 }
396}
397
398/*
399 * __test_and_clear_bit - Clear a bit and return its old value
400 * @nr: Bit to clear
401 * @addr: Address to count from
402 *
403 * This operation is non-atomic and can be reordered.
404 * If two examples of this operation race, one can appear to succeed
405 * but actually fail. You must protect multiple accesses with a lock.
406 */
407static inline int __test_and_clear_bit(unsigned long nr,
408 volatile unsigned long * addr)
409{
410 volatile unsigned long *a = addr;
411 unsigned long mask;
412 int retval;
413
414 a += (nr >> SZLONG_LOG);
415 mask = 1UL << (nr & SZLONG_MASK);
416 retval = ((mask & *a) != 0);
417 *a &= ~mask;
418
419 return retval;
420}
421
422/*
423 * test_and_change_bit - Change a bit and return its old value
424 * @nr: Bit to change
425 * @addr: Address to count from
426 *
427 * This operation is atomic and cannot be reordered.
428 * It also implies a memory barrier.
429 */
430static inline int test_and_change_bit(unsigned long nr,
431 volatile unsigned long *addr)
432{
433 if (cpu_has_llsc && R10000_LLSC_WAR) {
434 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
435 unsigned long temp, res;
436
437 __asm__ __volatile__(
438 "1: " __LL " %0, %1 # test_and_change_bit \n"
439 " xor %2, %0, %3 \n"
440 " "__SC "%2, %1 \n"
441 " beqzl %2, 1b \n"
442 " and %2, %0, %3 \n"
443#ifdef CONFIG_SMP
444 " sync \n"
445#endif
446 : "=&r" (temp), "=m" (*m), "=&r" (res)
447 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
448 : "memory");
449
450 return res != 0;
451 } else if (cpu_has_llsc) {
452 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
453 unsigned long temp, res;
454
455 __asm__ __volatile__(
456 " .set noreorder # test_and_change_bit \n"
457 "1: " __LL " %0, %1 \n"
458 " xor %2, %0, %3 \n"
459 " "__SC "\t%2, %1 \n"
460 " beqz %2, 1b \n"
461 " and %2, %0, %3 \n"
462#ifdef CONFIG_SMP
463 " sync \n"
464#endif
465 " .set reorder \n"
466 : "=&r" (temp), "=m" (*m), "=&r" (res)
467 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
468 : "memory");
469
470 return res != 0;
471 } else {
472 volatile unsigned long *a = addr;
473 unsigned long mask, retval;
474 __bi_flags;
475
476 a += nr >> SZLONG_LOG;
477 mask = 1UL << (nr & SZLONG_MASK);
478 __bi_local_irq_save(flags);
479 retval = (mask & *a) != 0;
480 *a ^= mask;
481 __bi_local_irq_restore(flags);
482
483 return retval;
484 }
485}
486
487/*
488 * __test_and_change_bit - Change a bit and return its old value
489 * @nr: Bit to change
490 * @addr: Address to count from
491 *
492 * This operation is non-atomic and can be reordered.
493 * If two examples of this operation race, one can appear to succeed
494 * but actually fail. You must protect multiple accesses with a lock.
495 */
496static inline int __test_and_change_bit(unsigned long nr,
497 volatile unsigned long *addr)
498{
499 volatile unsigned long *a = addr;
500 unsigned long mask;
501 int retval;
502
503 a += (nr >> SZLONG_LOG);
504 mask = 1UL << (nr & SZLONG_MASK);
505 retval = ((mask & *a) != 0);
506 *a ^= mask;
507
508 return retval;
509}
510
511#undef __bi_flags
512#undef __bi_local_irq_save
513#undef __bi_local_irq_restore
514
515/*
516 * test_bit - Determine whether a bit is set
517 * @nr: bit number to test
518 * @addr: Address to start counting from
519 */
520static inline int test_bit(unsigned long nr, const volatile unsigned long *addr)
521{
522 return 1UL & (addr[nr >> SZLONG_LOG] >> (nr & SZLONG_MASK));
523}
524
525/*
526 * ffz - find first zero in word.
527 * @word: The word to search
528 *
529 * Undefined if no zero exists, so code should check against ~0UL first.
530 */
531static inline unsigned long ffz(unsigned long word)
532{
533 int b = 0, s;
534
535 word = ~word;
536#ifdef CONFIG_MIPS32
537 s = 16; if (word << 16 != 0) s = 0; b += s; word >>= s;
538 s = 8; if (word << 24 != 0) s = 0; b += s; word >>= s;
539 s = 4; if (word << 28 != 0) s = 0; b += s; word >>= s;
540 s = 2; if (word << 30 != 0) s = 0; b += s; word >>= s;
541 s = 1; if (word << 31 != 0) s = 0; b += s;
542#endif
543#ifdef CONFIG_MIPS64
544 s = 32; if (word << 32 != 0) s = 0; b += s; word >>= s;
545 s = 16; if (word << 48 != 0) s = 0; b += s; word >>= s;
546 s = 8; if (word << 56 != 0) s = 0; b += s; word >>= s;
547 s = 4; if (word << 60 != 0) s = 0; b += s; word >>= s;
548 s = 2; if (word << 62 != 0) s = 0; b += s; word >>= s;
549 s = 1; if (word << 63 != 0) s = 0; b += s;
550#endif
551
552 return b;
553}
554
555/*
556 * __ffs - find first bit in word.
557 * @word: The word to search
558 *
559 * Undefined if no bit exists, so code should check against 0 first.
560 */
561static inline unsigned long __ffs(unsigned long word)
562{
563 return ffz(~word);
564}
565
566/*
567 * fls: find last bit set.
568 */
569
570#define fls(x) generic_fls(x)
571
572/*
573 * find_next_zero_bit - find the first zero bit in a memory region
574 * @addr: The address to base the search on
575 * @offset: The bitnumber to start searching at
576 * @size: The maximum size to search
577 */
578static inline unsigned long find_next_zero_bit(const unsigned long *addr,
579 unsigned long size, unsigned long offset)
580{
581 const unsigned long *p = addr + (offset >> SZLONG_LOG);
582 unsigned long result = offset & ~SZLONG_MASK;
583 unsigned long tmp;
584
585 if (offset >= size)
586 return size;
587 size -= result;
588 offset &= SZLONG_MASK;
589 if (offset) {
590 tmp = *(p++);
591 tmp |= ~0UL >> (_MIPS_SZLONG-offset);
592 if (size < _MIPS_SZLONG)
593 goto found_first;
594 if (~tmp)
595 goto found_middle;
596 size -= _MIPS_SZLONG;
597 result += _MIPS_SZLONG;
598 }
599 while (size & ~SZLONG_MASK) {
600 if (~(tmp = *(p++)))
601 goto found_middle;
602 result += _MIPS_SZLONG;
603 size -= _MIPS_SZLONG;
604 }
605 if (!size)
606 return result;
607 tmp = *p;
608
609found_first:
610 tmp |= ~0UL << size;
611 if (tmp == ~0UL) /* Are any bits zero? */
612 return result + size; /* Nope. */
613found_middle:
614 return result + ffz(tmp);
615}
616
617#define find_first_zero_bit(addr, size) \
618 find_next_zero_bit((addr), (size), 0)
619
620/*
621 * find_next_bit - find the next set bit in a memory region
622 * @addr: The address to base the search on
623 * @offset: The bitnumber to start searching at
624 * @size: The maximum size to search
625 */
626static inline unsigned long find_next_bit(const unsigned long *addr,
627 unsigned long size, unsigned long offset)
628{
629 const unsigned long *p = addr + (offset >> SZLONG_LOG);
630 unsigned long result = offset & ~SZLONG_MASK;
631 unsigned long tmp;
632
633 if (offset >= size)
634 return size;
635 size -= result;
636 offset &= SZLONG_MASK;
637 if (offset) {
638 tmp = *(p++);
639 tmp &= ~0UL << offset;
640 if (size < _MIPS_SZLONG)
641 goto found_first;
642 if (tmp)
643 goto found_middle;
644 size -= _MIPS_SZLONG;
645 result += _MIPS_SZLONG;
646 }
647 while (size & ~SZLONG_MASK) {
648 if ((tmp = *(p++)))
649 goto found_middle;
650 result += _MIPS_SZLONG;
651 size -= _MIPS_SZLONG;
652 }
653 if (!size)
654 return result;
655 tmp = *p;
656
657found_first:
658 tmp &= ~0UL >> (_MIPS_SZLONG - size);
659 if (tmp == 0UL) /* Are any bits set? */
660 return result + size; /* Nope. */
661found_middle:
662 return result + __ffs(tmp);
663}
664
665/*
666 * find_first_bit - find the first set bit in a memory region
667 * @addr: The address to start the search at
668 * @size: The maximum size to search
669 *
670 * Returns the bit-number of the first set bit, not the number of the byte
671 * containing a bit.
672 */
673#define find_first_bit(addr, size) \
674 find_next_bit((addr), (size), 0)
675
676#ifdef __KERNEL__
677
678/*
679 * Every architecture must define this function. It's the fastest
680 * way of searching a 140-bit bitmap where the first 100 bits are
681 * unlikely to be set. It's guaranteed that at least one of the 140
682 * bits is cleared.
683 */
684static inline int sched_find_first_bit(const unsigned long *b)
685{
686#ifdef CONFIG_MIPS32
687 if (unlikely(b[0]))
688 return __ffs(b[0]);
689 if (unlikely(b[1]))
690 return __ffs(b[1]) + 32;
691 if (unlikely(b[2]))
692 return __ffs(b[2]) + 64;
693 if (b[3])
694 return __ffs(b[3]) + 96;
695 return __ffs(b[4]) + 128;
696#endif
697#ifdef CONFIG_MIPS64
698 if (unlikely(b[0]))
699 return __ffs(b[0]);
700 if (unlikely(b[1]))
701 return __ffs(b[1]) + 64;
702 return __ffs(b[2]) + 128;
703#endif
704}
705
706/*
707 * ffs - find first bit set
708 * @x: the word to search
709 *
710 * This is defined the same way as
711 * the libc and compiler builtin ffs routines, therefore
712 * differs in spirit from the above ffz (man ffs).
713 */
714
715#define ffs(x) generic_ffs(x)
716
717/*
718 * hweightN - returns the hamming weight of a N-bit word
719 * @x: the word to weigh
720 *
721 * The Hamming Weight of a number is the total number of bits set in it.
722 */
723
724#define hweight64(x) generic_hweight64(x)
725#define hweight32(x) generic_hweight32(x)
726#define hweight16(x) generic_hweight16(x)
727#define hweight8(x) generic_hweight8(x)
728
729static inline int __test_and_set_le_bit(unsigned long nr, unsigned long *addr)
730{
731 unsigned char *ADDR = (unsigned char *) addr;
732 int mask, retval;
733
734 ADDR += nr >> 3;
735 mask = 1 << (nr & 0x07);
736 retval = (mask & *ADDR) != 0;
737 *ADDR |= mask;
738
739 return retval;
740}
741
742static inline int __test_and_clear_le_bit(unsigned long nr, unsigned long *addr)
743{
744 unsigned char *ADDR = (unsigned char *) addr;
745 int mask, retval;
746
747 ADDR += nr >> 3;
748 mask = 1 << (nr & 0x07);
749 retval = (mask & *ADDR) != 0;
750 *ADDR &= ~mask;
751
752 return retval;
753}
754
755static inline int test_le_bit(unsigned long nr, const unsigned long * addr)
756{
757 const unsigned char *ADDR = (const unsigned char *) addr;
758 int mask;
759
760 ADDR += nr >> 3;
761 mask = 1 << (nr & 0x07);
762
763 return ((mask & *ADDR) != 0);
764}
765
766static inline unsigned long find_next_zero_le_bit(unsigned long *addr,
767 unsigned long size, unsigned long offset)
768{
769 unsigned long *p = ((unsigned long *) addr) + (offset >> SZLONG_LOG);
770 unsigned long result = offset & ~SZLONG_MASK;
771 unsigned long tmp;
772
773 if (offset >= size)
774 return size;
775 size -= result;
776 offset &= SZLONG_MASK;
777 if (offset) {
778 tmp = cpu_to_lelongp(p++);
779 tmp |= ~0UL >> (_MIPS_SZLONG-offset); /* bug or feature ? */
780 if (size < _MIPS_SZLONG)
781 goto found_first;
782 if (~tmp)
783 goto found_middle;
784 size -= _MIPS_SZLONG;
785 result += _MIPS_SZLONG;
786 }
787 while (size & ~SZLONG_MASK) {
788 if (~(tmp = cpu_to_lelongp(p++)))
789 goto found_middle;
790 result += _MIPS_SZLONG;
791 size -= _MIPS_SZLONG;
792 }
793 if (!size)
794 return result;
795 tmp = cpu_to_lelongp(p);
796
797found_first:
798 tmp |= ~0UL << size;
799 if (tmp == ~0UL) /* Are any bits zero? */
800 return result + size; /* Nope. */
801
802found_middle:
803 return result + ffz(tmp);
804}
805
806#define find_first_zero_le_bit(addr, size) \
807 find_next_zero_le_bit((addr), (size), 0)
808
809#define ext2_set_bit(nr,addr) \
810 __test_and_set_le_bit((nr),(unsigned long*)addr)
811#define ext2_clear_bit(nr, addr) \
812 __test_and_clear_le_bit((nr),(unsigned long*)addr)
813 #define ext2_set_bit_atomic(lock, nr, addr) \
814({ \
815 int ret; \
816 spin_lock(lock); \
817 ret = ext2_set_bit((nr), (addr)); \
818 spin_unlock(lock); \
819 ret; \
820})
821
822#define ext2_clear_bit_atomic(lock, nr, addr) \
823({ \
824 int ret; \
825 spin_lock(lock); \
826 ret = ext2_clear_bit((nr), (addr)); \
827 spin_unlock(lock); \
828 ret; \
829})
830#define ext2_test_bit(nr, addr) test_le_bit((nr),(unsigned long*)addr)
831#define ext2_find_first_zero_bit(addr, size) \
832 find_first_zero_le_bit((unsigned long*)addr, size)
833#define ext2_find_next_zero_bit(addr, size, off) \
834 find_next_zero_le_bit((unsigned long*)addr, size, off)
835
836/*
837 * Bitmap functions for the minix filesystem.
838 *
839 * FIXME: These assume that Minix uses the native byte/bitorder.
840 * This limits the Minix filesystem's value for data exchange very much.
841 */
842#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
843#define minix_set_bit(nr,addr) set_bit(nr,addr)
844#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
845#define minix_test_bit(nr,addr) test_bit(nr,addr)
846#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
847
848#endif /* __KERNEL__ */
849
850#endif /* _ASM_BITOPS_H */
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
new file mode 100644
index 000000000000..b1e57d783604
--- /dev/null
+++ b/include/asm-mips/bootinfo.h
@@ -0,0 +1,256 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file COPYING in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1996, 2003 by Ralf Baechle
7 * Copyright (C) 1995, 1996 Andreas Busse
8 * Copyright (C) 1995, 1996 Stoned Elipot
9 * Copyright (C) 1995, 1996 Paul M. Antoine.
10 */
11#ifndef _ASM_BOOTINFO_H
12#define _ASM_BOOTINFO_H
13
14#include <linux/types.h>
15#include <asm/setup.h>
16
17/*
18 * The MACH_GROUP_ IDs are the equivalent to PCI vendor IDs; the remaining
19 * MACH_ values equivalent to product IDs. As such the numbers do not
20 * necessarily reflect technical relations or similarities between systems.
21 */
22
23/*
24 * Valid machtype values for group unknown
25 */
26#define MACH_GROUP_UNKNOWN 0 /* whatever... */
27#define MACH_UNKNOWN 0 /* whatever... */
28
29/*
30 * Valid machtype values for group JAZZ
31 */
32#define MACH_GROUP_JAZZ 1 /* Jazz */
33#define MACH_ACER_PICA_61 0 /* Acer PICA-61 (PICA1) */
34#define MACH_MIPS_MAGNUM_4000 1 /* Mips Magnum 4000 "RC4030" */
35#define MACH_OLIVETTI_M700 2 /* Olivetti M700-10 (-15 ??) */
36
37/*
38 * Valid machtype for group DEC
39 */
40#define MACH_GROUP_DEC 2 /* Digital Equipment */
41#define MACH_DSUNKNOWN 0
42#define MACH_DS23100 1 /* DECstation 2100 or 3100 */
43#define MACH_DS5100 2 /* DECsystem 5100 */
44#define MACH_DS5000_200 3 /* DECstation 5000/200 */
45#define MACH_DS5000_1XX 4 /* DECstation 5000/120, 125, 133, 150 */
46#define MACH_DS5000_XX 5 /* DECstation 5000/20, 25, 33, 50 */
47#define MACH_DS5000_2X0 6 /* DECstation 5000/240, 260 */
48#define MACH_DS5400 7 /* DECsystem 5400 */
49#define MACH_DS5500 8 /* DECsystem 5500 */
50#define MACH_DS5800 9 /* DECsystem 5800 */
51#define MACH_DS5900 10 /* DECsystem 5900 */
52
53/*
54 * Valid machtype for group ARC
55 */
56#define MACH_GROUP_ARC 3 /* Deskstation */
57#define MACH_DESKSTATION_RPC44 0 /* Deskstation rPC44 */
58#define MACH_DESKSTATION_TYNE 1 /* Deskstation Tyne */
59
60/*
61 * Valid machtype for group SNI_RM
62 */
63#define MACH_GROUP_SNI_RM 4 /* Siemens Nixdorf RM series */
64#define MACH_SNI_RM200_PCI 0 /* RM200/RM300/RM400 PCI series */
65
66/*
67 * Valid machtype for group ACN
68 */
69#define MACH_GROUP_ACN 5
70#define MACH_ACN_MIPS_BOARD 0 /* ACN MIPS single board */
71
72/*
73 * Valid machtype for group SGI
74 */
75#define MACH_GROUP_SGI 6 /* Silicon Graphics */
76#define MACH_SGI_IP22 0 /* Indy, Indigo2, Challenge S */
77#define MACH_SGI_IP27 1 /* Origin 200, Origin 2000, Onyx 2 */
78#define MACH_SGI_IP28 2 /* Indigo2 Impact */
79#define MACH_SGI_IP32 3 /* O2 */
80
81/*
82 * Valid machtype for group COBALT
83 */
84#define MACH_GROUP_COBALT 7 /* Cobalt servers */
85#define MACH_COBALT_27 0 /* Proto "27" hardware */
86
87/*
88 * Valid machtype for group NEC DDB
89 */
90#define MACH_GROUP_NEC_DDB 8 /* NEC DDB */
91#define MACH_NEC_DDB5074 0 /* NEC DDB Vrc-5074 */
92#define MACH_NEC_DDB5476 1 /* NEC DDB Vrc-5476 */
93#define MACH_NEC_DDB5477 2 /* NEC DDB Vrc-5477 */
94#define MACH_NEC_ROCKHOPPER 3 /* Rockhopper base board */
95#define MACH_NEC_ROCKHOPPERII 4 /* Rockhopper II base board */
96
97/*
98 * Valid machtype for group BAGET
99 */
100#define MACH_GROUP_BAGET 9 /* Baget */
101#define MACH_BAGET201 0 /* BT23-201 */
102#define MACH_BAGET202 1 /* BT23-202 */
103
104/*
105 * Cosine boards.
106 */
107#define MACH_GROUP_COSINE 10 /* CoSine Orion */
108#define MACH_COSINE_ORION 0
109
110/*
111 * Valid machtype for group GALILEO
112 */
113#define MACH_GROUP_GALILEO 11 /* Galileo Eval Boards */
114#define MACH_EV96100 0 /* EV96100 */
115#define MACH_EV64120A 1 /* EV64120A */
116
117/*
118 * Valid machtype for group MOMENCO
119 */
120#define MACH_GROUP_MOMENCO 12 /* Momentum Boards */
121#define MACH_MOMENCO_OCELOT 0
122#define MACH_MOMENCO_OCELOT_G 1
123#define MACH_MOMENCO_OCELOT_C 2
124#define MACH_MOMENCO_JAGUAR_ATX 3
125#define MACH_MOMENCO_OCELOT_3 4
126
127/*
128 * Valid machtype for group ITE
129 */
130#define MACH_GROUP_ITE 13 /* ITE Semi Eval Boards */
131#define MACH_QED_4N_S01B 0 /* ITE8172 based eval board */
132
133/*
134 * Valid machtype for group PHILIPS
135 */
136#define MACH_GROUP_PHILIPS 14
137#define MACH_PHILIPS_NINO 0 /* Nino */
138#define MACH_PHILIPS_VELO 1 /* Velo */
139
140/*
141 * Valid machtype for group Globespan
142 */
143#define MACH_GROUP_GLOBESPAN 15 /* Globespan */
144#define MACH_IVR 0 /* IVR eval board */
145
146/*
147 * Valid machtype for group SIBYTE
148 */
149#define MACH_GROUP_SIBYTE 16 /* Sibyte / Broadcom */
150#define MACH_SWARM 0
151
152/*
153 * Valid machtypes for group Toshiba
154 */
155#define MACH_GROUP_TOSHIBA 17 /* Toshiba Reference Systems TSBREF */
156#define MACH_PALLAS 0
157#define MACH_TOPAS 1
158#define MACH_JMR 2
159#define MACH_TOSHIBA_JMR3927 3 /* JMR-TX3927 CPU/IO board */
160#define MACH_TOSHIBA_RBTX4927 4
161#define MACH_TOSHIBA_RBTX4937 5
162
163#define GROUP_TOSHIBA_NAMES { "Pallas", "TopasCE", "JMR", "JMR TX3927", \
164 "RBTX4927", "RBTX4937" }
165
166/*
167 * Valid machtype for group Alchemy
168 */
169#define MACH_GROUP_ALCHEMY 18 /* AMD Alchemy */
170#define MACH_PB1000 0 /* Au1000-based eval board */
171#define MACH_PB1100 1 /* Au1100-based eval board */
172#define MACH_PB1500 2 /* Au1500-based eval board */
173#define MACH_DB1000 3 /* Au1000-based eval board */
174#define MACH_DB1100 4 /* Au1100-based eval board */
175#define MACH_DB1500 5 /* Au1500-based eval board */
176#define MACH_XXS1500 6 /* Au1500-based eval board */
177#define MACH_MTX1 7 /* 4G MTX-1 Au1500-based board */
178#define MACH_PB1550 8 /* Au1550-based eval board */
179#define MACH_DB1550 9 /* Au1550-based eval board */
180
181/*
182 * Valid machtype for group NEC_VR41XX
183 *
184 * Various NEC-based devices.
185 *
186 * FIXME: MACH_GROUPs should be by _MANUFACTURER_ of * the device, not by
187 * technical properties, so no new additions to this group.
188 */
189#define MACH_GROUP_NEC_VR41XX 19
190#define MACH_NEC_OSPREY 0 /* Osprey eval board */
191#define MACH_NEC_EAGLE 1 /* NEC Eagle/Hawk board */
192#define MACH_ZAO_CAPCELLA 2 /* ZAO Networks Capcella */
193#define MACH_VICTOR_MPC30X 3 /* Victor MP-C303/304 */
194#define MACH_IBM_WORKPAD 4 /* IBM WorkPad z50 */
195#define MACH_CASIO_E55 5 /* CASIO CASSIOPEIA E-10/15/55/65 */
196#define MACH_TANBAC_TB0226 6 /* TANBAC TB0226 (Mbase) */
197#define MACH_TANBAC_TB0229 7 /* TANBAC TB0229 (VR4131DIMM) */
198#define MACH_NEC_CMBVR4133 8 /* CMB VR4133 Board */
199
200#define MACH_GROUP_HP_LJ 20 /* Hewlett Packard LaserJet */
201#define MACH_HP_LASERJET 1
202
203/*
204 * Valid machtype for group LASAT
205 */
206#define MACH_GROUP_LASAT 21
207#define MACH_LASAT_100 0 /* Masquerade II/SP100/SP50/SP25 */
208#define MACH_LASAT_200 1 /* Masquerade PRO/SP200 */
209
210/*
211 * Valid machtype for group TITAN
212 */
213#define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
214#define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
215
216#define CL_SIZE COMMAND_LINE_SIZE
217
218const char *get_system_type(void);
219
220extern unsigned long mips_machtype;
221extern unsigned long mips_machgroup;
222
223#define BOOT_MEM_MAP_MAX 32
224#define BOOT_MEM_RAM 1
225#define BOOT_MEM_ROM_DATA 2
226#define BOOT_MEM_RESERVED 3
227
228/*
229 * A memory map that's built upon what was determined
230 * or specified on the command line.
231 */
232struct boot_mem_map {
233 int nr_map;
234 struct boot_mem_map_entry {
235 phys_t addr; /* start of memory segment */
236 phys_t size; /* size of memory segment */
237 long type; /* type of memory segment */
238 } map[BOOT_MEM_MAP_MAX];
239};
240
241extern struct boot_mem_map boot_mem_map;
242
243extern void add_memory_region(phys_t start, phys_t size, long type);
244
245extern void prom_init(void);
246
247/*
248 * Initial kernel command line, usually setup by prom_init()
249 */
250extern char arcs_cmdline[CL_SIZE];
251
252/*
253 * Registers a0, a1, a3 and a4 as passed to the kenrel entry by firmware
254 */
255extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
256#endif /* _ASM_BOOTINFO_H */
diff --git a/include/asm-mips/branch.h b/include/asm-mips/branch.h
new file mode 100644
index 000000000000..37c6857c8d4a
--- /dev/null
+++ b/include/asm-mips/branch.h
@@ -0,0 +1,38 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 1997, 1998, 2001 by Ralf Baechle
7 */
8#ifndef _ASM_BRANCH_H
9#define _ASM_BRANCH_H
10
11#include <asm/ptrace.h>
12
13static inline int delay_slot(struct pt_regs *regs)
14{
15 return regs->cp0_cause & CAUSEF_BD;
16}
17
18static inline unsigned long exception_epc(struct pt_regs *regs)
19{
20 if (!delay_slot(regs))
21 return regs->cp0_epc;
22
23 return regs->cp0_epc + 4;
24}
25
26extern int __compute_return_epc(struct pt_regs *regs);
27
28static inline int compute_return_epc(struct pt_regs *regs)
29{
30 if (!delay_slot(regs)) {
31 regs->cp0_epc += 4;
32 return 0;
33 }
34
35 return __compute_return_epc(regs);
36}
37
38#endif /* _ASM_BRANCH_H */
diff --git a/include/asm-mips/break.h b/include/asm-mips/break.h
new file mode 100644
index 000000000000..2e6de788f207
--- /dev/null
+++ b/include/asm-mips/break.h
@@ -0,0 +1,33 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 2003 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef __ASM_BREAK_H
10#define __ASM_BREAK_H
11
12/*
13 * The following break codes are or were in use for specific purposes in
14 * other MIPS operating systems. Linux/MIPS doesn't use all of them. The
15 * unused ones are here as placeholders; we might encounter them in
16 * non-Linux/MIPS object files or make use of them in the future.
17 */
18#define BRK_USERBP 0 /* User bp (used by debuggers) */
19#define BRK_KERNELBP 1 /* Break in the kernel */
20#define BRK_ABORT 2 /* Sometimes used by abort(3) to SIGIOT */
21#define BRK_BD_TAKEN 3 /* For bd slot emulation - not implemented */
22#define BRK_BD_NOTTAKEN 4 /* For bd slot emulation - not implemented */
23#define BRK_SSTEPBP 5 /* User bp (used by debuggers) */
24#define BRK_OVERFLOW 6 /* Overflow check */
25#define BRK_DIVZERO 7 /* Divide by zero check */
26#define BRK_RANGE 8 /* Range error check */
27#define BRK_STACKOVERFLOW 9 /* For Ada stackchecking */
28#define BRK_NORLD 10 /* No rld found - not used by Linux/MIPS */
29#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */
30#define BRK_BUG 512 /* Used by BUG() */
31#define BRK_MULOVF 1023 /* Multiply overflow */
32
33#endif /* __ASM_BREAK_H */
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h
new file mode 100644
index 000000000000..eb94bb96cfbc
--- /dev/null
+++ b/include/asm-mips/bug.h
@@ -0,0 +1,14 @@
1#ifndef __ASM_BUG_H
2#define __ASM_BUG_H
3
4#include <asm/break.h>
5
6#define BUG() \
7do { \
8 __asm__ __volatile__("break %0" : : "i" (BRK_BUG)); \
9} while (0)
10
11#define HAVE_ARCH_BUG
12#include <asm-generic/bug.h>
13
14#endif
diff --git a/include/asm-mips/bugs.h b/include/asm-mips/bugs.h
new file mode 100644
index 000000000000..18cced19cca4
--- /dev/null
+++ b/include/asm-mips/bugs.h
@@ -0,0 +1,23 @@
1/*
2 * This is included by init/main.c to check for architecture-dependent bugs.
3 *
4 * Needs:
5 * void check_bugs(void);
6 */
7#ifndef _ASM_BUGS_H
8#define _ASM_BUGS_H
9
10#include <linux/config.h>
11
12extern void check_bugs32(void);
13extern void check_bugs64(void);
14
15static inline void check_bugs(void)
16{
17 check_bugs32();
18#ifdef CONFIG_MIPS64
19 check_bugs64();
20#endif
21}
22
23#endif /* _ASM_BUGS_H */
diff --git a/include/asm-mips/byteorder.h b/include/asm-mips/byteorder.h
new file mode 100644
index 000000000000..d1fe9e5c62e4
--- /dev/null
+++ b/include/asm-mips/byteorder.h
@@ -0,0 +1,30 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 99, 2003 by Ralf Baechle
7 */
8#ifndef _ASM_BYTEORDER_H
9#define _ASM_BYTEORDER_H
10
11#include <asm/types.h>
12
13#ifdef __GNUC__
14
15#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
16# define __BYTEORDER_HAS_U64__
17# define __SWAB_64_THRU_32__
18#endif
19
20#endif /* __GNUC__ */
21
22#if defined (__MIPSEB__)
23# include <linux/byteorder/big_endian.h>
24#elif defined (__MIPSEL__)
25# include <linux/byteorder/little_endian.h>
26#else
27# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
28#endif
29
30#endif /* _ASM_BYTEORDER_H */
diff --git a/include/asm-mips/cache.h b/include/asm-mips/cache.h
new file mode 100644
index 000000000000..4517bdf20953
--- /dev/null
+++ b/include/asm-mips/cache.h
@@ -0,0 +1,23 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1997, 98, 99, 2000, 2003 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_CACHE_H
10#define _ASM_CACHE_H
11
12#include <linux/config.h>
13
14#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT
15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
16
17#define L1_CACHE_SHIFT_MAX 6
18#define SMP_CACHE_SHIFT L1_CACHE_SHIFT
19#define SMP_CACHE_BYTES L1_CACHE_BYTES
20
21#define ARCH_KMALLOC_MINALIGN 8
22
23#endif /* _ASM_CACHE_H */
diff --git a/include/asm-mips/cachectl.h b/include/asm-mips/cachectl.h
new file mode 100644
index 000000000000..f3ce721861d3
--- /dev/null
+++ b/include/asm-mips/cachectl.h
@@ -0,0 +1,26 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 1995, 1996 by Ralf Baechle
7 */
8#ifndef _ASM_CACHECTL
9#define _ASM_CACHECTL
10
11/*
12 * Options for cacheflush system call
13 */
14#define ICACHE (1<<0) /* flush instruction cache */
15#define DCACHE (1<<1) /* writeback and flush data cache */
16#define BCACHE (ICACHE|DCACHE) /* flush both caches */
17
18/*
19 * Caching modes for the cachectl(2) call
20 *
21 * cachectl(2) is currently not supported and returns ENOSYS.
22 */
23#define CACHEABLE 0 /* make pages cacheable */
24#define UNCACHEABLE 1 /* make pages uncacheable */
25
26#endif /* _ASM_CACHECTL */
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
new file mode 100644
index 000000000000..635f1bfb403e
--- /dev/null
+++ b/include/asm-mips/cacheflush.h
@@ -0,0 +1,81 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 by Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_CACHEFLUSH_H
10#define _ASM_CACHEFLUSH_H
11
12/* Keep includes the same across arches. */
13#include <linux/mm.h>
14#include <asm/cpu-features.h>
15
16/* Cache flushing:
17 *
18 * - flush_cache_all() flushes entire cache
19 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
20 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
21 * - flush_cache_range(vma, start, end) flushes a range of pages
22 * - flush_icache_range(start, end) flush a range of instructions
23 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
24 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
25 *
26 * MIPS specific flush operations:
27 *
28 * - flush_cache_sigtramp() flush signal trampoline
29 * - flush_icache_all() flush the entire instruction cache
30 * - flush_data_cache_page() flushes a page from the data cache
31 */
32extern void (*flush_cache_all)(void);
33extern void (*__flush_cache_all)(void);
34extern void (*flush_cache_mm)(struct mm_struct *mm);
35extern void (*flush_cache_range)(struct vm_area_struct *vma,
36 unsigned long start, unsigned long end);
37extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);
38extern void __flush_dcache_page(struct page *page);
39
40static inline void flush_dcache_page(struct page *page)
41{
42 if (cpu_has_dc_aliases)
43 __flush_dcache_page(page);
44
45}
46
47#define flush_dcache_mmap_lock(mapping) do { } while (0)
48#define flush_dcache_mmap_unlock(mapping) do { } while (0)
49
50extern void (*flush_icache_page)(struct vm_area_struct *vma,
51 struct page *page);
52extern void (*flush_icache_range)(unsigned long start, unsigned long end);
53#define flush_cache_vmap(start, end) flush_cache_all()
54#define flush_cache_vunmap(start, end) flush_cache_all()
55
56#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
57do { \
58 memcpy(dst, (void *) src, len); \
59 flush_icache_page(vma, page); \
60} while (0)
61#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
62 memcpy(dst, src, len)
63
64extern void (*flush_cache_sigtramp)(unsigned long addr);
65extern void (*flush_icache_all)(void);
66extern void (*flush_data_cache_page)(unsigned long addr);
67
68/*
69 * This flag is used to indicate that the page pointed to by a pte
70 * is dirty and requires cleaning before returning it to the user.
71 */
72#define PG_dcache_dirty PG_arch_1
73
74#define Page_dcache_dirty(page) \
75 test_bit(PG_dcache_dirty, &(page)->flags)
76#define SetPageDcacheDirty(page) \
77 set_bit(PG_dcache_dirty, &(page)->flags)
78#define ClearPageDcacheDirty(page) \
79 clear_bit(PG_dcache_dirty, &(page)->flags)
80
81#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-mips/cacheops.h b/include/asm-mips/cacheops.h
new file mode 100644
index 000000000000..c4a1ec31ff6a
--- /dev/null
+++ b/include/asm-mips/cacheops.h
@@ -0,0 +1,81 @@
1/*
2 * Cache operations for the cache instruction.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * (C) Copyright 1996, 97, 99, 2002, 03 Ralf Baechle
9 * (C) Copyright 1999 Silicon Graphics, Inc.
10 */
11#ifndef __ASM_CACHEOPS_H
12#define __ASM_CACHEOPS_H
13
14/*
15 * Cache Operations available on all MIPS processors with R4000-style caches
16 */
17#define Index_Invalidate_I 0x00
18#define Index_Writeback_Inv_D 0x01
19#define Index_Load_Tag_I 0x04
20#define Index_Load_Tag_D 0x05
21#define Index_Store_Tag_I 0x08
22#define Index_Store_Tag_D 0x09
23#define Hit_Invalidate_I 0x10
24#define Hit_Invalidate_D 0x11
25#define Hit_Writeback_Inv_D 0x15
26
27/*
28 * R4000-specific cacheops
29 */
30#define Create_Dirty_Excl_D 0x0d
31#define Fill 0x14
32#define Hit_Writeback_I 0x18
33#define Hit_Writeback_D 0x19
34
35/*
36 * R4000SC and R4400SC-specific cacheops
37 */
38#define Index_Invalidate_SI 0x02
39#define Index_Writeback_Inv_SD 0x03
40#define Index_Load_Tag_SI 0x06
41#define Index_Load_Tag_SD 0x07
42#define Index_Store_Tag_SI 0x0A
43#define Index_Store_Tag_SD 0x0B
44#define Create_Dirty_Excl_SD 0x0f
45#define Hit_Invalidate_SI 0x12
46#define Hit_Invalidate_SD 0x13
47#define Hit_Writeback_Inv_SD 0x17
48#define Hit_Writeback_SD 0x1b
49#define Hit_Set_Virtual_SI 0x1e
50#define Hit_Set_Virtual_SD 0x1f
51
52/*
53 * R5000-specific cacheops
54 */
55#define R5K_Page_Invalidate_S 0x17
56
57/*
58 * RM7000-specific cacheops
59 */
60#define Page_Invalidate_T 0x16
61
62/*
63 * R1000-specific cacheops
64 *
65 * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused.
66 * Most of the _S cacheops are identical to the R4000SC _SD cacheops.
67 */
68#define Index_Writeback_Inv_S 0x03
69#define Index_Load_Tag_S 0x07
70#define Index_Store_Tag_S 0x0B
71#define Hit_Invalidate_S 0x13
72#define Cache_Barrier 0x14
73#define Hit_Writeback_Inv_S 0x17
74#define Index_Load_Data_I 0x18
75#define Index_Load_Data_D 0x19
76#define Index_Load_Data_S 0x1b
77#define Index_Store_Data_I 0x1c
78#define Index_Store_Data_D 0x1d
79#define Index_Store_Data_S 0x1f
80
81#endif /* __ASM_CACHEOPS_H */
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
new file mode 100644
index 000000000000..c25cc92b9950
--- /dev/null
+++ b/include/asm-mips/checksum.h
@@ -0,0 +1,253 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 96, 97, 98, 99, 2001 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 * Copyright (C) 2001 Thiemo Seufer.
9 * Copyright (C) 2002 Maciej W. Rozycki
10 */
11#ifndef _ASM_CHECKSUM_H
12#define _ASM_CHECKSUM_H
13
14#include <linux/config.h>
15#include <linux/in6.h>
16
17#include <asm/uaccess.h>
18
19/*
20 * computes the checksum of a memory block at buff, length len,
21 * and adds in "sum" (32-bit)
22 *
23 * returns a 32-bit number suitable for feeding into itself
24 * or csum_tcpudp_magic
25 *
26 * this function must be called with even lengths, except
27 * for the last fragment, which may be odd
28 *
29 * it's best to have buff aligned on a 32-bit boundary
30 */
31unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum);
32
33/*
34 * this is a new version of the above that records errors it finds in *errp,
35 * but continues and zeros the rest of the buffer.
36 */
37unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int len,
38 unsigned int sum, int *errp);
39
40/*
41 * Copy and checksum to user
42 */
43#define HAVE_CSUM_COPY_USER
44static inline unsigned int csum_and_copy_to_user (const unsigned char *src,
45 unsigned char __user *dst,
46 int len, int sum,
47 int *err_ptr)
48{
49 might_sleep();
50 sum = csum_partial(src, len, sum);
51
52 if (copy_to_user(dst, src, len)) {
53 *err_ptr = -EFAULT;
54 return -1;
55 }
56
57 return sum;
58}
59
60/*
61 * the same as csum_partial, but copies from user space (but on MIPS
62 * we have just one address space, so this is identical to the above)
63 */
64unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst,
65 int len, unsigned int sum);
66
67/*
68 * Fold a partial checksum without adding pseudo headers
69 */
70static inline unsigned short int csum_fold(unsigned int sum)
71{
72 __asm__(
73 ".set\tnoat\t\t\t# csum_fold\n\t"
74 "sll\t$1,%0,16\n\t"
75 "addu\t%0,$1\n\t"
76 "sltu\t$1,%0,$1\n\t"
77 "srl\t%0,%0,16\n\t"
78 "addu\t%0,$1\n\t"
79 "xori\t%0,0xffff\n\t"
80 ".set\tat"
81 : "=r" (sum)
82 : "0" (sum));
83
84 return sum;
85}
86
87/*
88 * This is a version of ip_compute_csum() optimized for IP headers,
89 * which always checksum on 4 octet boundaries.
90 *
91 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
92 * Arnt Gulbrandsen.
93 */
94static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
95{
96 unsigned int *word = (unsigned int *) iph;
97 unsigned int *stop = word + ihl;
98 unsigned int csum;
99 int carry;
100
101 csum = word[0];
102 csum += word[1];
103 carry = (csum < word[1]);
104 csum += carry;
105
106 csum += word[2];
107 carry = (csum < word[2]);
108 csum += carry;
109
110 csum += word[3];
111 carry = (csum < word[3]);
112 csum += carry;
113
114 word += 4;
115 do {
116 csum += *word;
117 carry = (csum < *word);
118 csum += carry;
119 word++;
120 } while (word != stop);
121
122 return csum_fold(csum);
123}
124
125static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
126 unsigned long daddr, unsigned short len, unsigned short proto,
127 unsigned int sum)
128{
129 __asm__(
130 ".set\tnoat\t\t\t# csum_tcpudp_nofold\n\t"
131#ifdef CONFIG_MIPS32
132 "addu\t%0, %2\n\t"
133 "sltu\t$1, %0, %2\n\t"
134 "addu\t%0, $1\n\t"
135
136 "addu\t%0, %3\n\t"
137 "sltu\t$1, %0, %3\n\t"
138 "addu\t%0, $1\n\t"
139
140 "addu\t%0, %4\n\t"
141 "sltu\t$1, %0, %4\n\t"
142 "addu\t%0, $1\n\t"
143#endif
144#ifdef CONFIG_MIPS64
145 "daddu\t%0, %2\n\t"
146 "daddu\t%0, %3\n\t"
147 "daddu\t%0, %4\n\t"
148 "dsll32\t$1, %0, 0\n\t"
149 "daddu\t%0, $1\n\t"
150 "dsrl32\t%0, %0, 0\n\t"
151#endif
152 ".set\tat"
153 : "=r" (sum)
154 : "0" (daddr), "r"(saddr),
155#ifdef __MIPSEL__
156 "r" (((unsigned long)htons(len)<<16) + proto*256),
157#else
158 "r" (((unsigned long)(proto)<<16) + len),
159#endif
160 "r" (sum));
161
162 return sum;
163}
164
165/*
166 * computes the checksum of the TCP/UDP pseudo-header
167 * returns a 16-bit checksum, already complemented
168 */
169static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
170 unsigned long daddr,
171 unsigned short len,
172 unsigned short proto,
173 unsigned int sum)
174{
175 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
176}
177
178/*
179 * this routine is used for miscellaneous IP-like checksums, mainly
180 * in icmp.c
181 */
182static inline unsigned short ip_compute_csum(unsigned char * buff, int len)
183{
184 return csum_fold(csum_partial(buff, len, 0));
185}
186
187#define _HAVE_ARCH_IPV6_CSUM
188static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
189 struct in6_addr *daddr,
190 __u32 len,
191 unsigned short proto,
192 unsigned int sum)
193{
194 __asm__(
195 ".set\tpush\t\t\t# csum_ipv6_magic\n\t"
196 ".set\tnoreorder\n\t"
197 ".set\tnoat\n\t"
198 "addu\t%0, %5\t\t\t# proto (long in network byte order)\n\t"
199 "sltu\t$1, %0, %5\n\t"
200 "addu\t%0, $1\n\t"
201
202 "addu\t%0, %6\t\t\t# csum\n\t"
203 "sltu\t$1, %0, %6\n\t"
204 "lw\t%1, 0(%2)\t\t\t# four words source address\n\t"
205 "addu\t%0, $1\n\t"
206 "addu\t%0, %1\n\t"
207 "sltu\t$1, %0, %1\n\t"
208
209 "lw\t%1, 4(%2)\n\t"
210 "addu\t%0, $1\n\t"
211 "addu\t%0, %1\n\t"
212 "sltu\t$1, %0, %1\n\t"
213
214 "lw\t%1, 8(%2)\n\t"
215 "addu\t%0, $1\n\t"
216 "addu\t%0, %1\n\t"
217 "sltu\t$1, %0, %1\n\t"
218
219 "lw\t%1, 12(%2)\n\t"
220 "addu\t%0, $1\n\t"
221 "addu\t%0, %1\n\t"
222 "sltu\t$1, %0, %1\n\t"
223
224 "lw\t%1, 0(%3)\n\t"
225 "addu\t%0, $1\n\t"
226 "addu\t%0, %1\n\t"
227 "sltu\t$1, %0, %1\n\t"
228
229 "lw\t%1, 4(%3)\n\t"
230 "addu\t%0, $1\n\t"
231 "addu\t%0, %1\n\t"
232 "sltu\t$1, %0, %1\n\t"
233
234 "lw\t%1, 8(%3)\n\t"
235 "addu\t%0, $1\n\t"
236 "addu\t%0, %1\n\t"
237 "sltu\t$1, %0, %1\n\t"
238
239 "lw\t%1, 12(%3)\n\t"
240 "addu\t%0, $1\n\t"
241 "addu\t%0, %1\n\t"
242 "sltu\t$1, %0, %1\n\t"
243
244 "addu\t%0, $1\t\t\t# Add final carry\n\t"
245 ".set\tpop"
246 : "=r" (sum), "=r" (proto)
247 : "r" (saddr), "r" (daddr),
248 "0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
249
250 return csum_fold(sum);
251}
252
253#endif /* _ASM_CHECKSUM_H */
diff --git a/include/asm-mips/cobalt/cobalt.h b/include/asm-mips/cobalt/cobalt.h
new file mode 100644
index 000000000000..ca1fbc0579fe
--- /dev/null
+++ b/include/asm-mips/cobalt/cobalt.h
@@ -0,0 +1,90 @@
1/*
2 * Lowlevel hardware stuff for the MIPS based Cobalt microservers.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1997 Cobalt Microserver
9 * Copyright (C) 1997, 2003 Ralf Baechle
10 * Copyright (C) 2001, 2002, 2003 Liam Davies (ldavies@agile.tv)
11 */
12#ifndef __ASM_COBALT_H
13#define __ASM_COBALT_H
14
15/*
16 * i8259 legacy interrupts used on Cobalt:
17 *
18 * 8 - RTC
19 * 9 - PCI
20 * 14 - IDE0
21 * 15 - IDE1
22 *
23 * CPU IRQs are 16 ... 23
24 */
25#define COBALT_TIMER_IRQ 18
26#define COBALT_SCC_IRQ 19 /* pre-production has 85C30 */
27#define COBALT_RAQ_SCSI_IRQ 19
28#define COBALT_ETH0_IRQ 19
29#define COBALT_ETH1_IRQ 20
30#define COBALT_SERIAL_IRQ 21
31#define COBALT_SCSI_IRQ 21
32#define COBALT_VIA_IRQ 22 /* Chained to VIA ISA bridge */
33#define COBALT_QUBE_SLOT_IRQ 23
34
35/*
36 * PCI configuration space manifest constants. These are wired into
37 * the board layout according to the PCI spec to enable the software
38 * to probe the hardware configuration space in a well defined manner.
39 *
40 * The PCI_DEVSHFT() macro transforms these values into numbers
41 * suitable for passing as the dev parameter to the various
42 * pcibios_read/write_config routines.
43 */
44#define COBALT_PCICONF_CPU 0x06
45#define COBALT_PCICONF_ETH0 0x07
46#define COBALT_PCICONF_RAQSCSI 0x08
47#define COBALT_PCICONF_VIA 0x09
48#define COBALT_PCICONF_PCISLOT 0x0A
49#define COBALT_PCICONF_ETH1 0x0C
50
51
52/*
53 * The Cobalt board id information. The boards have an ID number wired
54 * into the VIA that is available in the high nibble of register 94.
55 * This register is available in the VIA configuration space through the
56 * interface routines qube_pcibios_read/write_config. See cobalt/pci.c
57 */
58#define VIA_COBALT_BRD_ID_REG 0x94
59#define VIA_COBALT_BRD_REG_to_ID(reg) ((unsigned char) (reg) >> 4)
60#define COBALT_BRD_ID_QUBE1 0x3
61#define COBALT_BRD_ID_RAQ1 0x4
62#define COBALT_BRD_ID_QUBE2 0x5
63#define COBALT_BRD_ID_RAQ2 0x6
64
65/*
66 * Galileo chipset access macros for the Cobalt. The base address for
67 * the GT64111 chip is 0x14000000
68 *
69 * Most of this really should go into a separate GT64111 header file.
70 */
71#define GT64111_IO_BASE 0x10000000UL
72#define GT64111_BASE 0x14000000UL
73#define GALILEO_REG(ofs) (KSEG0 + GT64111_BASE + (unsigned long)(ofs))
74
75#define GALILEO_INL(port) (*(volatile unsigned int *) GALILEO_REG(port))
76#define GALILEO_OUTL(val, port) \
77do { \
78 *(volatile unsigned int *) GALILEO_REG(port) = (port); \
79} while (0)
80
81#define GALILEO_T0EXP 0x0100
82#define GALILEO_ENTC0 0x01
83#define GALILEO_SELTC0 0x02
84
85#define PCI_CFG_SET(devfn,where) \
86 GALILEO_OUTL((0x80000000 | (PCI_SLOT (devfn) << 11) | \
87 (PCI_FUNC (devfn) << 8) | (where)), GT_PCI0_CFGADDR_OFS)
88
89
90#endif /* __ASM_COBALT_H */
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
new file mode 100644
index 000000000000..dce92079e7fc
--- /dev/null
+++ b/include/asm-mips/compat.h
@@ -0,0 +1,144 @@
1#ifndef _ASM_COMPAT_H
2#define _ASM_COMPAT_H
3/*
4 * Architecture specific compatibility types
5 */
6#include <linux/types.h>
7#include <asm/page.h>
8
9#define COMPAT_USER_HZ 100
10
11typedef u32 compat_size_t;
12typedef s32 compat_ssize_t;
13typedef s32 compat_time_t;
14typedef s32 compat_clock_t;
15typedef s32 compat_suseconds_t;
16
17typedef s32 compat_pid_t;
18typedef s32 compat_uid_t;
19typedef s32 compat_gid_t;
20typedef u32 compat_mode_t;
21typedef u32 compat_ino_t;
22typedef u32 compat_dev_t;
23typedef s32 compat_off_t;
24typedef s64 compat_loff_t;
25typedef u32 compat_nlink_t;
26typedef s32 compat_ipc_pid_t;
27typedef s32 compat_daddr_t;
28typedef s32 compat_caddr_t;
29typedef struct {
30 s32 val[2];
31} compat_fsid_t;
32
33typedef s32 compat_int_t;
34typedef s32 compat_long_t;
35typedef u32 compat_uint_t;
36typedef u32 compat_ulong_t;
37
38struct compat_timespec {
39 compat_time_t tv_sec;
40 s32 tv_nsec;
41};
42
43struct compat_timeval {
44 compat_time_t tv_sec;
45 s32 tv_usec;
46};
47
48struct compat_stat {
49 compat_dev_t st_dev;
50 s32 st_pad1[3];
51 compat_ino_t st_ino;
52 compat_mode_t st_mode;
53 compat_nlink_t st_nlink;
54 compat_uid_t st_uid;
55 compat_gid_t st_gid;
56 compat_dev_t st_rdev;
57 s32 st_pad2[2];
58 compat_off_t st_size;
59 s32 st_pad3;
60 compat_time_t st_atime;
61 s32 st_atime_nsec;
62 compat_time_t st_mtime;
63 s32 st_mtime_nsec;
64 compat_time_t st_ctime;
65 s32 st_ctime_nsec;
66 s32 st_blksize;
67 s32 st_blocks;
68 s32 st_pad4[14];
69};
70
71struct compat_flock {
72 short l_type;
73 short l_whence;
74 compat_off_t l_start;
75 compat_off_t l_len;
76 s32 l_sysid;
77 compat_pid_t l_pid;
78 short __unused;
79 s32 pad[4];
80};
81
82#define F_GETLK64 33
83#define F_SETLK64 34
84#define F_SETLKW64 35
85
86struct compat_flock64 {
87 short l_type;
88 short l_whence;
89 compat_loff_t l_start;
90 compat_loff_t l_len;
91 compat_pid_t l_pid;
92};
93
94struct compat_statfs {
95 int f_type;
96 int f_bsize;
97 int f_frsize;
98 int f_blocks;
99 int f_bfree;
100 int f_files;
101 int f_ffree;
102 int f_bavail;
103 compat_fsid_t f_fsid;
104 int f_namelen;
105 int f_spare[6];
106};
107
108#define COMPAT_RLIM_INFINITY 0x7fffffffUL
109
110typedef u32 compat_old_sigset_t; /* at least 32 bits */
111
112#define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
113#define _COMPAT_NSIG_BPW 32
114
115typedef u32 compat_sigset_word;
116
117#define COMPAT_OFF_T_MAX 0x7fffffff
118#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
119
120/*
121 * A pointer passed in from user mode. This should not
122 * be used for syscall parameters, just declare them
123 * as pointers because the syscall entry code will have
124 * appropriately comverted them already.
125 */
126typedef u32 compat_uptr_t;
127
128static inline void *compat_ptr(compat_uptr_t uptr)
129{
130 return (void *)(long)uptr;
131}
132
133static inline void *compat_alloc_user_space(long len)
134{
135 struct pt_regs *regs = (struct pt_regs *)
136 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
137
138 return (void *) (regs->regs[29] - len);
139}
140#if defined (__MIPSEL__)
141#define __COMPAT_ENDIAN_SWAP__ 1
142#endif
143
144#endif /* _ASM_COMPAT_H */
diff --git a/include/asm-mips/compiler.h b/include/asm-mips/compiler.h
new file mode 100644
index 000000000000..169ae26105e9
--- /dev/null
+++ b/include/asm-mips/compiler.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2004 Maciej W. Rozycki
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8#ifndef _ASM_COMPILER_H
9#define _ASM_COMPILER_H
10
11#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
12#define GCC_REG_ACCUM "$0"
13#else
14#define GCC_REG_ACCUM "accum"
15#endif
16
17#endif /* _ASM_COMPILER_H */
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
new file mode 100644
index 000000000000..1df2c299de82
--- /dev/null
+++ b/include/asm-mips/cpu-features.h
@@ -0,0 +1,159 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle
7 */
8#ifndef __ASM_CPU_FEATURES_H
9#define __ASM_CPU_FEATURES_H
10
11#include <linux/config.h>
12
13#include <asm/cpu.h>
14#include <asm/cpu-info.h>
15#include <cpu-feature-overrides.h>
16
17/*
18 * SMP assumption: Options of CPU 0 are a superset of all processors.
19 * This is true for all known MIPS systems.
20 */
21#ifndef cpu_has_tlb
22#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB)
23#endif
24#ifndef cpu_has_4kex
25#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX)
26#endif
27#ifndef cpu_has_4ktlb
28#define cpu_has_4ktlb (cpu_data[0].options & MIPS_CPU_4KTLB)
29#endif
30#ifndef cpu_has_fpu
31#define cpu_has_fpu (cpu_data[0].options & MIPS_CPU_FPU)
32#endif
33#ifndef cpu_has_32fpr
34#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR)
35#endif
36#ifndef cpu_has_counter
37#define cpu_has_counter (cpu_data[0].options & MIPS_CPU_COUNTER)
38#endif
39#ifndef cpu_has_watch
40#define cpu_has_watch (cpu_data[0].options & MIPS_CPU_WATCH)
41#endif
42#ifndef cpu_has_mips16
43#define cpu_has_mips16 (cpu_data[0].options & MIPS_CPU_MIPS16)
44#endif
45#ifndef cpu_has_divec
46#define cpu_has_divec (cpu_data[0].options & MIPS_CPU_DIVEC)
47#endif
48#ifndef cpu_has_vce
49#define cpu_has_vce (cpu_data[0].options & MIPS_CPU_VCE)
50#endif
51#ifndef cpu_has_cache_cdex_p
52#define cpu_has_cache_cdex_p (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_P)
53#endif
54#ifndef cpu_has_cache_cdex_s
55#define cpu_has_cache_cdex_s (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_S)
56#endif
57#ifndef cpu_has_prefetch
58#define cpu_has_prefetch (cpu_data[0].options & MIPS_CPU_PREFETCH)
59#endif
60#ifndef cpu_has_mcheck
61#define cpu_has_mcheck (cpu_data[0].options & MIPS_CPU_MCHECK)
62#endif
63#ifndef cpu_has_ejtag
64#define cpu_has_ejtag (cpu_data[0].options & MIPS_CPU_EJTAG)
65#endif
66#ifndef cpu_has_llsc
67#define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC)
68#endif
69#ifndef cpu_has_vtag_icache
70#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG)
71#endif
72#ifndef cpu_has_dc_aliases
73#define cpu_has_dc_aliases (cpu_data[0].dcache.flags & MIPS_CACHE_ALIASES)
74#endif
75#ifndef cpu_has_ic_fills_f_dc
76#define cpu_has_ic_fills_f_dc (cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC)
77#endif
78
79/*
80 * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors
81 * such as the R10000 have I-Caches that snoop local stores; the embedded ones
82 * don't. For maintaining I-cache coherency this means we need to flush the
83 * D-cache all the way back to whever the I-cache does refills from, so the
84 * I-cache has a chance to see the new data at all. Then we have to flush the
85 * I-cache also.
86 * Note we may have been rescheduled and may no longer be running on the CPU
87 * that did the store so we can't optimize this into only doing the flush on
88 * the local CPU.
89 */
90#ifndef cpu_icache_snoops_remote_store
91#ifdef CONFIG_SMP
92#define cpu_icache_snoops_remote_store (cpu_data[0].icache.flags & MIPS_IC_SNOOPS_REMOTE)
93#else
94#define cpu_icache_snoops_remote_store 1
95#endif
96#endif
97
98/*
99 * Certain CPUs may throw bizarre exceptions if not the whole cacheline
100 * contains valid instructions. For these we ensure proper alignment of
101 * signal trampolines and pad them to the size of a full cache lines with
102 * nops. This is also used in structure definitions so can't be a test macro
103 * like the others.
104 */
105#ifndef PLAT_TRAMPOLINE_STUFF_LINE
106#define PLAT_TRAMPOLINE_STUFF_LINE 0UL
107#endif
108
109#ifdef CONFIG_MIPS32
110# ifndef cpu_has_nofpuex
111# define cpu_has_nofpuex (cpu_data[0].options & MIPS_CPU_NOFPUEX)
112# endif
113# ifndef cpu_has_64bits
114# define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
115# endif
116# ifndef cpu_has_64bit_zero_reg
117# define cpu_has_64bit_zero_reg (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
118# endif
119# ifndef cpu_has_64bit_gp_regs
120# define cpu_has_64bit_gp_regs 0
121# endif
122# ifndef cpu_has_64bit_addresses
123# define cpu_has_64bit_addresses 0
124# endif
125#endif
126
127#ifdef CONFIG_MIPS64
128# ifndef cpu_has_nofpuex
129# define cpu_has_nofpuex 0
130# endif
131# ifndef cpu_has_64bits
132# define cpu_has_64bits 1
133# endif
134# ifndef cpu_has_64bit_zero_reg
135# define cpu_has_64bit_zero_reg 1
136# endif
137# ifndef cpu_has_64bit_gp_regs
138# define cpu_has_64bit_gp_regs 1
139# endif
140# ifndef cpu_has_64bit_addresses
141# define cpu_has_64bit_addresses 1
142# endif
143#endif
144
145#ifndef cpu_has_subset_pcaches
146#define cpu_has_subset_pcaches (cpu_data[0].options & MIPS_CPU_SUBSET_CACHES)
147#endif
148
149#ifndef cpu_dcache_line_size
150#define cpu_dcache_line_size() current_cpu_data.dcache.linesz
151#endif
152#ifndef cpu_icache_line_size
153#define cpu_icache_line_size() current_cpu_data.icache.linesz
154#endif
155#ifndef cpu_scache_line_size
156#define cpu_scache_line_size() current_cpu_data.scache.linesz
157#endif
158
159#endif /* __ASM_CPU_FEATURES_H */
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
new file mode 100644
index 000000000000..20a35b15a31d
--- /dev/null
+++ b/include/asm-mips/cpu-info.h
@@ -0,0 +1,82 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 Waldorf GMBH
7 * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 Ralf Baechle
8 * Copyright (C) 1996 Paul M. Antoine
9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 */
11#ifndef __ASM_CPU_INFO_H
12#define __ASM_CPU_INFO_H
13
14#include <linux/config.h>
15#include <asm/cache.h>
16
17#ifdef CONFIG_SGI_IP27
18#include <asm/sn/types.h>
19#endif
20
21/*
22 * Descriptor for a cache
23 */
24struct cache_desc {
25 unsigned short linesz; /* Size of line in bytes */
26 unsigned short ways; /* Number of ways */
27 unsigned short sets; /* Number of lines per set */
28 unsigned int waysize; /* Bytes per way */
29 unsigned int waybit; /* Bits to select in a cache set */
30 unsigned int flags; /* Flags describing cache properties */
31};
32
33/*
34 * Flag definitions
35 */
36#define MIPS_CACHE_NOT_PRESENT 0x00000001
37#define MIPS_CACHE_VTAG 0x00000002 /* Virtually tagged cache */
38#define MIPS_CACHE_ALIASES 0x00000004 /* Cache could have aliases */
39#define MIPS_CACHE_IC_F_DC 0x00000008 /* Ic can refill from D-cache */
40#define MIPS_IC_SNOOPS_REMOTE 0x00000010 /* Ic snoops remote stores */
41
42struct cpuinfo_mips {
43 unsigned long udelay_val;
44 unsigned long asid_cache;
45#if defined(CONFIG_SGI_IP27)
46// cpuid_t p_cpuid; /* PROM assigned cpuid */
47 cnodeid_t p_nodeid; /* my node ID in compact-id-space */
48 nasid_t p_nasid; /* my node ID in numa-as-id-space */
49 unsigned char p_slice; /* Physical position on node board */
50#endif
51#if 0
52 unsigned long loops_per_sec;
53 unsigned long ipi_count;
54 unsigned long irq_attempt[NR_IRQS];
55 unsigned long smp_local_irq_count;
56 unsigned long prof_multiplier;
57 unsigned long prof_counter;
58#endif
59
60 /*
61 * Capability and feature descriptor structure for MIPS CPU
62 */
63 unsigned long options;
64 unsigned int processor_id;
65 unsigned int fpu_id;
66 unsigned int cputype;
67 int isa_level;
68 int tlbsize;
69 struct cache_desc icache; /* Primary I-cache */
70 struct cache_desc dcache; /* Primary D or combined I/D cache */
71 struct cache_desc scache; /* Secondary cache */
72 struct cache_desc tcache; /* Tertiary/split secondary cache */
73 void *data; /* Additional data */
74} __attribute__((aligned(SMP_CACHE_BYTES)));
75
76extern struct cpuinfo_mips cpu_data[];
77#define current_cpu_data cpu_data[smp_processor_id()]
78
79extern void cpu_probe(void);
80extern void cpu_report(void);
81
82#endif /* __ASM_CPU_INFO_H */
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h
new file mode 100644
index 000000000000..dec060b49556
--- /dev/null
+++ b/include/asm-mips/cpu.h
@@ -0,0 +1,222 @@
1/*
2 * cpu.h: Values of the PRId register used to match up
3 * various MIPS cpu types.
4 *
5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 */
7#ifndef _ASM_CPU_H
8#define _ASM_CPU_H
9
10/* Assigned Company values for bits 23:16 of the PRId Register
11 (CP0 register 15, select 0). As of the MIPS32 and MIPS64 specs from
12 MTI, the PRId register is defined in this (backwards compatible)
13 way:
14
15 +----------------+----------------+----------------+----------------+
16 | Company Options| Company ID | Processor ID | Revision |
17 +----------------+----------------+----------------+----------------+
18 31 24 23 16 15 8 7
19
20 I don't have docs for all the previous processors, but my impression is
21 that bits 16-23 have been 0 for all MIPS processors before the MIPS32/64
22 spec.
23*/
24
25#define PRID_COMP_LEGACY 0x000000
26#define PRID_COMP_MIPS 0x010000
27#define PRID_COMP_BROADCOM 0x020000
28#define PRID_COMP_ALCHEMY 0x030000
29#define PRID_COMP_SIBYTE 0x040000
30#define PRID_COMP_SANDCRAFT 0x050000
31
32/*
33 * Assigned values for the product ID register. In order to detect a
34 * certain CPU type exactly eventually additional registers may need to
35 * be examined. These are valid when 23:16 == PRID_COMP_LEGACY
36 */
37#define PRID_IMP_R2000 0x0100
38#define PRID_IMP_AU1_REV1 0x0100
39#define PRID_IMP_AU1_REV2 0x0200
40#define PRID_IMP_R3000 0x0200 /* Same as R2000A */
41#define PRID_IMP_R6000 0x0300 /* Same as R3000A */
42#define PRID_IMP_R4000 0x0400
43#define PRID_IMP_R6000A 0x0600
44#define PRID_IMP_R10000 0x0900
45#define PRID_IMP_R4300 0x0b00
46#define PRID_IMP_VR41XX 0x0c00
47#define PRID_IMP_R12000 0x0e00
48#define PRID_IMP_R8000 0x1000
49#define PRID_IMP_R4600 0x2000
50#define PRID_IMP_R4700 0x2100
51#define PRID_IMP_TX39 0x2200
52#define PRID_IMP_R4640 0x2200
53#define PRID_IMP_R4650 0x2200 /* Same as R4640 */
54#define PRID_IMP_R5000 0x2300
55#define PRID_IMP_TX49 0x2d00
56#define PRID_IMP_SONIC 0x2400
57#define PRID_IMP_MAGIC 0x2500
58#define PRID_IMP_RM7000 0x2700
59#define PRID_IMP_NEVADA 0x2800 /* RM5260 ??? */
60#define PRID_IMP_RM9000 0x3400
61#define PRID_IMP_R5432 0x5400
62#define PRID_IMP_R5500 0x5500
63#define PRID_IMP_4KC 0x8000
64#define PRID_IMP_5KC 0x8100
65#define PRID_IMP_20KC 0x8200
66#define PRID_IMP_4KEC 0x8400
67#define PRID_IMP_4KSC 0x8600
68#define PRID_IMP_25KF 0x8800
69#define PRID_IMP_5KE 0x8900
70#define PRID_IMP_4KECR2 0x9000
71#define PRID_IMP_4KEMPR2 0x9100
72#define PRID_IMP_4KSD 0x9200
73#define PRID_IMP_24K 0x9300
74
75#define PRID_IMP_UNKNOWN 0xff00
76
77/*
78 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
79 */
80
81#define PRID_IMP_SB1 0x0100
82
83/*
84 * These are the PRID's for when 23:16 == PRID_COMP_SANDCRAFT
85 */
86
87#define PRID_IMP_SR71000 0x0400
88
89/*
90 * Definitions for 7:0 on legacy processors
91 */
92
93
94#define PRID_REV_TX4927 0x0022
95#define PRID_REV_TX4937 0x0030
96#define PRID_REV_R4400 0x0040
97#define PRID_REV_R3000A 0x0030
98#define PRID_REV_R3000 0x0020
99#define PRID_REV_R2000A 0x0010
100#define PRID_REV_TX3912 0x0010
101#define PRID_REV_TX3922 0x0030
102#define PRID_REV_TX3927 0x0040
103#define PRID_REV_VR4111 0x0050
104#define PRID_REV_VR4181 0x0050 /* Same as VR4111 */
105#define PRID_REV_VR4121 0x0060
106#define PRID_REV_VR4122 0x0070
107#define PRID_REV_VR4181A 0x0070 /* Same as VR4122 */
108#define PRID_REV_VR4130 0x0080
109
110/*
111 * FPU implementation/revision register (CP1 control register 0).
112 *
113 * +---------------------------------+----------------+----------------+
114 * | 0 | Implementation | Revision |
115 * +---------------------------------+----------------+----------------+
116 * 31 16 15 8 7 0
117 */
118
119#define FPIR_IMP_NONE 0x0000
120
121#define CPU_UNKNOWN 0
122#define CPU_R2000 1
123#define CPU_R3000 2
124#define CPU_R3000A 3
125#define CPU_R3041 4
126#define CPU_R3051 5
127#define CPU_R3052 6
128#define CPU_R3081 7
129#define CPU_R3081E 8
130#define CPU_R4000PC 9
131#define CPU_R4000SC 10
132#define CPU_R4000MC 11
133#define CPU_R4200 12
134#define CPU_R4400PC 13
135#define CPU_R4400SC 14
136#define CPU_R4400MC 15
137#define CPU_R4600 16
138#define CPU_R6000 17
139#define CPU_R6000A 18
140#define CPU_R8000 19
141#define CPU_R10000 20
142#define CPU_R12000 21
143#define CPU_R4300 22
144#define CPU_R4650 23
145#define CPU_R4700 24
146#define CPU_R5000 25
147#define CPU_R5000A 26
148#define CPU_R4640 27
149#define CPU_NEVADA 28
150#define CPU_RM7000 29
151#define CPU_R5432 30
152#define CPU_4KC 31
153#define CPU_5KC 32
154#define CPU_R4310 33
155#define CPU_SB1 34
156#define CPU_TX3912 35
157#define CPU_TX3922 36
158#define CPU_TX3927 37
159#define CPU_AU1000 38
160#define CPU_4KEC 39
161#define CPU_4KSC 40
162#define CPU_VR41XX 41
163#define CPU_R5500 42
164#define CPU_TX49XX 43
165#define CPU_AU1500 44
166#define CPU_20KC 45
167#define CPU_VR4111 46
168#define CPU_VR4121 47
169#define CPU_VR4122 48
170#define CPU_VR4131 49
171#define CPU_VR4181 50
172#define CPU_VR4181A 51
173#define CPU_AU1100 52
174#define CPU_SR71000 53
175#define CPU_RM9000 54
176#define CPU_25KF 55
177#define CPU_VR4133 56
178#define CPU_AU1550 57
179#define CPU_24K 58
180#define CPU_LAST 58
181
182/*
183 * ISA Level encodings
184 *
185 */
186#define MIPS_CPU_ISA_I 0x00000001
187#define MIPS_CPU_ISA_II 0x00000002
188#define MIPS_CPU_ISA_III 0x00008003
189#define MIPS_CPU_ISA_IV 0x00008004
190#define MIPS_CPU_ISA_V 0x00008005
191#define MIPS_CPU_ISA_M32 0x00000020
192#define MIPS_CPU_ISA_M64 0x00008040
193
194/*
195 * Bit 15 encodes if an ISA level supports 64-bit operations.
196 */
197#define MIPS_CPU_ISA_64BIT 0x00008000
198
199/*
200 * CPU Option encodings
201 */
202#define MIPS_CPU_TLB 0x00000001 /* CPU has TLB */
203/* Leave a spare bit for variant MMU types... */
204#define MIPS_CPU_4KEX 0x00000004 /* "R4K" exception model */
205#define MIPS_CPU_4KTLB 0x00000008 /* "R4K" TLB handler */
206#define MIPS_CPU_FPU 0x00000010 /* CPU has FPU */
207#define MIPS_CPU_32FPR 0x00000020 /* 32 dbl. prec. FP registers */
208#define MIPS_CPU_COUNTER 0x00000040 /* Cycle count/compare */
209#define MIPS_CPU_WATCH 0x00000080 /* watchpoint registers */
210#define MIPS_CPU_MIPS16 0x00000100 /* code compression */
211#define MIPS_CPU_DIVEC 0x00000200 /* dedicated interrupt vector */
212#define MIPS_CPU_VCE 0x00000400 /* virt. coherence conflict possible */
213#define MIPS_CPU_CACHE_CDEX_P 0x00000800 /* Create_Dirty_Exclusive CACHE op */
214#define MIPS_CPU_CACHE_CDEX_S 0x00001000 /* ... same for seconary cache ... */
215#define MIPS_CPU_MCHECK 0x00002000 /* Machine check exception */
216#define MIPS_CPU_EJTAG 0x00004000 /* EJTAG exception */
217#define MIPS_CPU_NOFPUEX 0x00008000 /* no FPU exception */
218#define MIPS_CPU_LLSC 0x00010000 /* CPU has ll/sc instructions */
219#define MIPS_CPU_SUBSET_CACHES 0x00020000 /* P-cache subset enforced */
220#define MIPS_CPU_PREFETCH 0x00040000 /* CPU has usable prefetch */
221
222#endif /* _ASM_CPU_H */
diff --git a/include/asm-mips/cputime.h b/include/asm-mips/cputime.h
new file mode 100644
index 000000000000..c00eacbdd979
--- /dev/null
+++ b/include/asm-mips/cputime.h
@@ -0,0 +1,6 @@
1#ifndef __MIPS_CPUTIME_H
2#define __MIPS_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __MIPS_CPUTIME_H */
diff --git a/include/asm-mips/current.h b/include/asm-mips/current.h
new file mode 100644
index 000000000000..559db66b9790
--- /dev/null
+++ b/include/asm-mips/current.h
@@ -0,0 +1,23 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2002 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_CURRENT_H
10#define _ASM_CURRENT_H
11
12#include <linux/thread_info.h>
13
14struct task_struct;
15
16static inline struct task_struct * get_current(void)
17{
18 return current_thread_info()->task;
19}
20
21#define current get_current()
22
23#endif /* _ASM_CURRENT_H */
diff --git a/include/asm-mips/ddb5074.h b/include/asm-mips/ddb5074.h
new file mode 100644
index 000000000000..0d09ac27f9a5
--- /dev/null
+++ b/include/asm-mips/ddb5074.h
@@ -0,0 +1,11 @@
1/*
2 * include/asm-mips/ddb5074.h -- NEC DDB Vrc-5074 definitions
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7
8extern void ddb5074_led_hex(int hex);
9extern void ddb5074_led_d2(int on);
10extern void ddb5074_led_d3(int on);
11
diff --git a/include/asm-mips/ddb5xxx/ddb5074.h b/include/asm-mips/ddb5xxx/ddb5074.h
new file mode 100644
index 000000000000..58d88306af65
--- /dev/null
+++ b/include/asm-mips/ddb5xxx/ddb5074.h
@@ -0,0 +1,38 @@
1/*
2 * include/asm-mips/ddb5074.h -- NEC DDB Vrc-5074 definitions
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7
8#ifndef _ASM_DDB5XXX_DDB5074_H
9#define _ASM_DDB5XXX_DDB5074_H
10
11#include <asm/nile4.h>
12
13#define DDB_SDRAM_SIZE 0x04000000 /* 64MB */
14
15#define DDB_PCI_IO_BASE 0x06000000
16#define DDB_PCI_IO_SIZE 0x02000000 /* 32 MB */
17
18#define DDB_PCI_MEM_BASE 0x08000000
19#define DDB_PCI_MEM_SIZE 0x08000000 /* 128 MB */
20
21#define DDB_PCI_CONFIG_BASE DDB_PCI_MEM_BASE
22#define DDB_PCI_CONFIG_SIZE DDB_PCI_MEM_SIZE
23
24#define NILE4_PCI_IO_BASE 0xa6000000
25#define NILE4_PCI_MEM_BASE 0xa8000000
26#define NILE4_PCI_CFG_BASE NILE4_PCI_MEM_BASE
27#define DDB_PCI_IACK_BASE NILE4_PCI_IO_BASE
28
29#define NILE4_IRQ_BASE NUM_I8259_INTERRUPTS
30#define CPU_IRQ_BASE (NUM_NILE4_INTERRUPTS + NILE4_IRQ_BASE)
31#define CPU_NILE4_CASCADE 2
32
33extern void ddb5074_led_hex(int hex);
34extern void ddb5074_led_d2(int on);
35extern void ddb5074_led_d3(int on);
36
37extern void nile4_irq_setup(u32 base);
38#endif
diff --git a/include/asm-mips/ddb5xxx/ddb5476.h b/include/asm-mips/ddb5xxx/ddb5476.h
new file mode 100644
index 000000000000..4c23390d9354
--- /dev/null
+++ b/include/asm-mips/ddb5xxx/ddb5476.h
@@ -0,0 +1,157 @@
1/*
2 * header file specific for ddb5476
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14/*
15 * Memory map (physical address)
16 *
17 * Note most of the following address must be properly aligned by the
18 * corresponding size. For example, if PCI_IO_SIZE is 16MB, then
19 * PCI_IO_BASE must be aligned along 16MB boundary.
20 */
21#define DDB_SDRAM_BASE 0x00000000
22#define DDB_SDRAM_SIZE 0x04000000 /* 64MB */
23
24#define DDB_DCS3_BASE 0x04000000 /* flash 1 */
25#define DDB_DCS3_SIZE 0x01000000 /* 16MB */
26
27#define DDB_DCS2_BASE 0x05000000 /* flash 2 */
28#define DDB_DCS2_SIZE 0x01000000 /* 16MB */
29
30#define DDB_PCI_IO_BASE 0x06000000
31#define DDB_PCI_IO_SIZE 0x02000000 /* 32 MB */
32
33#define DDB_PCI_MEM_BASE 0x08000000
34#define DDB_PCI_MEM_SIZE 0x08000000 /* 128 MB */
35
36#define DDB_DCS5_BASE 0x13000000 /* DDB status regs */
37#define DDB_DCS5_SIZE 0x00200000 /* 2MB, 8-bit */
38
39#define DDB_DCS4_BASE 0x14000000 /* DDB control regs */
40#define DDB_DCS4_SIZE 0x00200000 /* 2MB, 8-bit */
41
42#define DDB_INTCS_BASE 0x1fa00000 /* VRC5476 control regs */
43#define DDB_INTCS_SIZE 0x00200000 /* 2MB */
44
45#define DDB_BOOTCS_BASE 0x1fc00000 /* Boot ROM / EPROM /Flash */
46#define DDB_BOOTCS_SIZE 0x00200000 /* 2 MB - doc says 4MB */
47
48
49/* aliases */
50#define DDB_PCI_CONFIG_BASE DDB_PCI_MEM_BASE
51#define DDB_PCI_CONFIG_SIZE DDB_PCI_MEM_SIZE
52
53/* PCI intr ack share PCIW0 with PCI IO */
54#define DDB_PCI_IACK_BASE DDB_PCI_IO_BASE
55
56/*
57 * Interrupt mapping
58 *
59 * We have three interrupt controllers:
60 *
61 * . CPU itself - 8 sources
62 * . i8259 - 16 sources
63 * . vrc5476 - 16 sources
64 *
65 * They connected as follows:
66 * all vrc5476 interrupts are routed to cpu IP2 (by software setting)
67 * all i2869 are routed to INTC in vrc5476 (by hardware connection)
68 *
69 * All VRC5476 PCI interrupts are level-triggered (no ack needed).
70 * All PCI irq but INTC are active low.
71 */
72
73/*
74 * irq number block assignment
75 */
76
77#define NUM_CPU_IRQ 8
78#define NUM_I8259_IRQ 16
79#define NUM_VRC5476_IRQ 16
80
81#define DDB_IRQ_BASE 0
82
83#define I8259_IRQ_BASE DDB_IRQ_BASE
84#define VRC5476_IRQ_BASE (I8259_IRQ_BASE + NUM_I8259_IRQ)
85#define CPU_IRQ_BASE (VRC5476_IRQ_BASE + NUM_VRC5476_IRQ)
86
87/*
88 * vrc5476 irq defs, see page 52-64 of Vrc5074 system controller manual
89 */
90
91#define VRC5476_IRQ_CPCE 0 /* cpu parity error */
92#define VRC5476_IRQ_CNTD 1 /* cpu no target */
93#define VRC5476_IRQ_MCE 2 /* memory check error */
94#define VRC5476_IRQ_DMA 3 /* DMA */
95#define VRC5476_IRQ_UART 4 /* vrc5476 builtin UART, not used */
96#define VRC5476_IRQ_WDOG 5 /* watchdog timer */
97#define VRC5476_IRQ_GPT 6 /* general purpose timer */
98#define VRC5476_IRQ_LBRT 7 /* local bus read timeout */
99#define VRC5476_IRQ_INTA 8 /* PCI INT #A */
100#define VRC5476_IRQ_INTB 9 /* PCI INT #B */
101#define VRC5476_IRQ_INTC 10 /* PCI INT #C */
102#define VRC5476_IRQ_INTD 11 /* PCI INT #D */
103#define VRC5476_IRQ_INTE 12 /* PCI INT #E */
104#define VRC5476_IRQ_RESERVED_13 13 /* reserved */
105#define VRC5476_IRQ_PCIS 14 /* PCI SERR # */
106#define VRC5476_IRQ_PCI 15 /* PCI internal error */
107
108/*
109 * i2859 irq assignment
110 */
111#define I8259_IRQ_RESERVED_0 0
112#define I8259_IRQ_KEYBOARD 1 /* M1543 default */
113#define I8259_IRQ_CASCADE 2
114#define I8259_IRQ_UART_B 3 /* M1543 default, may conflict with RTC according to schematic diagram */
115#define I8259_IRQ_UART_A 4 /* M1543 default */
116#define I8259_IRQ_PARALLEL 5 /* M1543 default */
117#define I8259_IRQ_RESERVED_6 6
118#define I8259_IRQ_RESERVED_7 7
119#define I8259_IRQ_RTC 8 /* who set this? */
120#define I8259_IRQ_USB 9 /* ddb_setup */
121#define I8259_IRQ_PMU 10 /* ddb_setup */
122#define I8259_IRQ_RESERVED_11 11
123#define I8259_IRQ_RESERVED_12 12 /* m1543_irq_setup */
124#define I8259_IRQ_RESERVED_13 13
125#define I8259_IRQ_HDC1 14 /* default and ddb_setup */
126#define I8259_IRQ_HDC2 15 /* default */
127
128
129/*
130 * misc
131 */
132#define VRC5476_I8259_CASCADE VRC5476_IRQ_INTC
133#define CPU_VRC5476_CASCADE 2
134
135#define is_i8259_irq(irq) ((irq) < NUM_I8259_IRQ)
136#define nile4_to_irq(n) ((n)+NUM_I8259_IRQ)
137#define irq_to_nile4(n) ((n)-NUM_I8259_IRQ)
138
139/*
140 * low-level irq functions
141 */
142#ifndef __ASSEMBLY__
143extern void nile4_map_irq(int nile4_irq, int cpu_irq);
144extern void nile4_map_irq_all(int cpu_irq);
145extern void nile4_enable_irq(int nile4_irq);
146extern void nile4_disable_irq(int nile4_irq);
147extern void nile4_disable_irq_all(void);
148extern u16 nile4_get_irq_stat(int cpu_irq);
149extern void nile4_enable_irq_output(int cpu_irq);
150extern void nile4_disable_irq_output(int cpu_irq);
151extern void nile4_set_pci_irq_polarity(int pci_irq, int high);
152extern void nile4_set_pci_irq_level_or_edge(int pci_irq, int level);
153extern void nile4_clear_irq(int nile4_irq);
154extern void nile4_clear_irq_mask(u32 mask);
155extern u8 nile4_i8259_iack(void);
156extern void nile4_dump_irq_status(void); /* Debug */
157#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-mips/ddb5xxx/ddb5477.h b/include/asm-mips/ddb5xxx/ddb5477.h
new file mode 100644
index 000000000000..ae3e2a38fd5f
--- /dev/null
+++ b/include/asm-mips/ddb5xxx/ddb5477.h
@@ -0,0 +1,346 @@
1/***********************************************************************
2 *
3 * Copyright 2001 MontaVista Software Inc.
4 * Author: jsun@mvista.com or jsun@junsun.net
5 *
6 * include/asm-mips/ddb5xxx/ddb5477.h
7 * DDB 5477 specific definitions and macros.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 ***********************************************************************
15 */
16
17#ifndef __ASM_DDB5XXX_DDB5477_H
18#define __ASM_DDB5XXX_DDB5477_H
19
20#include <linux/config.h>
21
22/*
23 * This contains macros that are specific to DDB5477 or renamed from
24 * DDB5476.
25 */
26
27/*
28 * renamed PADRs
29 */
30#define DDB_LCS0 DDB_DCS2
31#define DDB_LCS1 DDB_DCS3
32#define DDB_LCS2 DDB_DCS4
33#define DDB_VRC5477 DDB_INTCS
34
35/*
36 * New CPU interface registers
37 */
38#define DDB_INTCTRL0 0x0400 /* Interrupt Control 0 */
39#define DDB_INTCTRL1 0x0404 /* Interrupt Control 1 */
40#define DDB_INTCTRL2 0x0408 /* Interrupt Control 2 */
41#define DDB_INTCTRL3 0x040c /* Interrupt Control 3 */
42
43#define DDB_INT0STAT 0x0420 /* INT0 Status [R] */
44#define DDB_INT1STAT 0x0428 /* INT1 Status [R] */
45#define DDB_INT2STAT 0x0430 /* INT2 Status [R] */
46#define DDB_INT3STAT 0x0438 /* INT3 Status [R] */
47#define DDB_INT4STAT 0x0440 /* INT4 Status [R] */
48#define DDB_NMISTAT 0x0450 /* NMI Status [R] */
49
50#define DDB_INTCLR32 0x0468 /* Interrupt Clear */
51
52#define DDB_INTPPES0 0x0470 /* PCI0 Interrupt Control */
53#define DDB_INTPPES1 0x0478 /* PCI1 Interrupt Control */
54
55#undef DDB_CPUSTAT /* duplicate in Vrc-5477 */
56#define DDB_CPUSTAT 0x0480 /* CPU Status [R] */
57#define DDB_BUSCTRL 0x0488 /* Internal Bus Control */
58
59
60/*
61 * Timer registers
62 */
63#define DDB_REFCTRL_L DDB_T0CTRL
64#define DDB_REFCTRL_H (DDB_T0CTRL+4)
65#define DDB_REFCNTR DDB_T0CNTR
66#define DDB_SPT0CTRL_L DDB_T1CTRL
67#define DDB_SPT0CTRL_H (DDB_T1CTRL+4)
68#define DDB_SPT1CTRL_L DDB_T2CTRL
69#define DDB_SPT1CTRL_H (DDB_T2CTRL+4)
70#define DDB_SPT1CNTR DDB_T1CTRL
71#define DDB_WDTCTRL_L DDB_T3CTRL
72#define DDB_WDTCTRL_H (DDB_T3CTRL+4)
73#define DDB_WDTCNTR DDB_T3CNTR
74
75/*
76 * DMA registers are moved. We don't care about it for now. TODO.
77 */
78
79/*
80 * BARs for ext PCI (PCI0)
81 */
82#undef DDB_BARC
83#undef DDB_BARB
84
85#define DDB_BARC0 0x0210 /* PCI0 Control */
86#define DDB_BARM010 0x0218 /* PCI0 SDRAM bank01 */
87#define DDB_BARM230 0x0220 /* PCI0 SDRAM bank23 */
88#define DDB_BAR00 0x0240 /* PCI0 LDCS0 */
89#define DDB_BAR10 0x0248 /* PCI0 LDCS1 */
90#define DDB_BAR20 0x0250 /* PCI0 LDCS2 */
91#define DDB_BAR30 0x0258 /* PCI0 LDCS3 */
92#define DDB_BAR40 0x0260 /* PCI0 LDCS4 */
93#define DDB_BAR50 0x0268 /* PCI0 LDCS5 */
94#define DDB_BARB0 0x0280 /* PCI0 BOOT */
95#define DDB_BARP00 0x0290 /* PCI0 for IOPCI Window0 */
96#define DDB_BARP10 0x0298 /* PCI0 for IOPCI Window1 */
97
98/*
99 * BARs for IOPIC (PCI1)
100 */
101#define DDB_BARC1 0x0610 /* PCI1 Control */
102#define DDB_BARM011 0x0618 /* PCI1 SDRAM bank01 */
103#define DDB_BARM231 0x0620 /* PCI1 SDRAM bank23 */
104#define DDB_BAR01 0x0640 /* PCI1 LDCS0 */
105#define DDB_BAR11 0x0648 /* PCI1 LDCS1 */
106#define DDB_BAR21 0x0650 /* PCI1 LDCS2 */
107#define DDB_BAR31 0x0658 /* PCI1 LDCS3 */
108#define DDB_BAR41 0x0660 /* PCI1 LDCS4 */
109#define DDB_BAR51 0x0668 /* PCI1 LDCS5 */
110#define DDB_BARB1 0x0680 /* PCI1 BOOT */
111#define DDB_BARP01 0x0690 /* PCI1 for ext PCI Window0 */
112#define DDB_BARP11 0x0698 /* PCI1 for ext PCI Window1 */
113
114/*
115 * Other registers for ext PCI (PCI0)
116 */
117#define DDB_PCIINIT00 0x02f0 /* PCI0 Initiator 0 */
118#define DDB_PCIINIT10 0x02f8 /* PCI0 Initiator 1 */
119
120#define DDB_PCISWP0 0x02b0 /* PCI0 Swap */
121#define DDB_PCIERR0 0x02b8 /* PCI0 Error */
122
123#define DDB_PCICTL0_L 0x02e0 /* PCI0 Control-L */
124#define DDB_PCICTL0_H 0x02e4 /* PCI0 Control-H */
125#define DDB_PCIARB0_L 0x02e8 /* PCI0 Arbitration-L */
126#define DDB_PCIARB0_H 0x02ec /* PCI0 Arbitration-H */
127
128/*
129 * Other registers for IOPCI (PCI1)
130 */
131#define DDB_IOPCIW0 0x00d0 /* PCI Address Window 0 [R/W] */
132#define DDB_IOPCIW1 0x00d8 /* PCI Address Window 1 [R/W] */
133
134#define DDB_PCIINIT01 0x06f0 /* PCI1 Initiator 0 */
135#define DDB_PCIINIT11 0x06f8 /* PCI1 Initiator 1 */
136
137#define DDB_PCISWP1 0x06b0 /* PCI1 Swap */
138#define DDB_PCIERR1 0x06b8 /* PCI1 Error */
139
140#define DDB_PCICTL1_L 0x06e0 /* PCI1 Control-L */
141#define DDB_PCICTL1_H 0x06e4 /* PCI1 Control-H */
142#define DDB_PCIARB1_L 0x06e8 /* PCI1 Arbitration-L */
143#define DDB_PCIARB1_H 0x06ec /* PCI1 Arbitration-H */
144
145/*
146 * Local Bus
147 */
148#define DDB_LCST0 0x0110 /* LB Chip Select Timing 0 */
149#define DDB_LCST1 0x0118 /* LB Chip Select Timing 1 */
150#undef DDB_LCST2
151#define DDB_LCST2 0x0120 /* LB Chip Select Timing 2 */
152#undef DDB_LCST3
153#undef DDB_LCST4
154#undef DDB_LCST5
155#undef DDB_LCST6
156#undef DDB_LCST7
157#undef DDB_LCST8
158#define DDB_ERRADR 0x0150 /* Error Address Register */
159#define DDB_ERRCS 0x0160
160#define DDB_BTM 0x0170 /* Boot Time Mode value */
161
162/*
163 * MISC registers
164 */
165#define DDB_GIUFUNSEL 0x4040 /* select dual-func pins */
166#define DDB_PIBMISC 0x0750 /* USB buffer enable / power saving */
167
168/*
169 * Memory map (physical address)
170 *
171 * Note most of the following address must be properly aligned by the
172 * corresponding size. For example, if PCI_IO_SIZE is 16MB, then
173 * PCI_IO_BASE must be aligned along 16MB boundary.
174 */
175
176/* the actual ram size is detected at run-time */
177#define DDB_SDRAM_BASE 0x00000000
178#define DDB_MAX_SDRAM_SIZE 0x08000000 /* less than 128MB */
179
180#define DDB_PCI0_MEM_BASE 0x08000000
181#define DDB_PCI0_MEM_SIZE 0x08000000 /* 128 MB */
182
183#define DDB_PCI1_MEM_BASE 0x10000000
184#define DDB_PCI1_MEM_SIZE 0x08000000 /* 128 MB */
185
186#define DDB_PCI0_CONFIG_BASE 0x18000000
187#define DDB_PCI0_CONFIG_SIZE 0x01000000 /* 16 MB */
188
189#define DDB_PCI1_CONFIG_BASE 0x19000000
190#define DDB_PCI1_CONFIG_SIZE 0x01000000 /* 16 MB */
191
192#define DDB_PCI_IO_BASE 0x1a000000 /* we concatenate two IOs */
193#define DDB_PCI0_IO_BASE 0x1a000000
194#define DDB_PCI0_IO_SIZE 0x01000000 /* 16 MB */
195#define DDB_PCI1_IO_BASE 0x1b000000
196#define DDB_PCI1_IO_SIZE 0x01000000 /* 16 MB */
197
198#define DDB_LCS0_BASE 0x1c000000 /* flash memory */
199#define DDB_LCS0_SIZE 0x01000000 /* 16 MB */
200
201#define DDB_LCS1_BASE 0x1d000000 /* misc */
202#define DDB_LCS1_SIZE 0x01000000 /* 16 MB */
203
204#define DDB_LCS2_BASE 0x1e000000 /* Mezzanine */
205#define DDB_LCS2_SIZE 0x01000000 /* 16 MB */
206
207#define DDB_VRC5477_BASE 0x1fa00000 /* VRC5477 control regs */
208#define DDB_VRC5477_SIZE 0x00200000 /* 2MB */
209
210#define DDB_BOOTCS_BASE 0x1fc00000 /* Boot ROM / EPROM /Flash */
211#define DDB_BOOTCS_SIZE 0x00200000 /* 2 MB - doc says 4MB */
212
213#define DDB_LED DDB_LCS1_BASE + 0x10000
214
215
216/*
217 * DDB5477 specific functions
218 */
219#ifndef __ASSEMBLY__
220extern void ddb5477_irq_setup(void);
221
222/* route irq to cpu int pin */
223extern void ll_vrc5477_irq_route(int vrc5477_irq, int ip);
224
225/* low-level routine for enabling vrc5477 irq, bypassing high-level */
226extern void ll_vrc5477_irq_enable(int vrc5477_irq);
227extern void ll_vrc5477_irq_disable(int vrc5477_irq);
228#endif /* !__ASSEMBLY__ */
229
230/* PCI intr ack share PCIW0 with PCI IO */
231#define DDB_PCI_IACK_BASE DDB_PCI_IO_BASE
232
233/*
234 * Interrupt mapping
235 *
236 * We have three interrupt controllers:
237 *
238 * . CPU itself - 8 sources
239 * . i8259 - 16 sources
240 * . vrc5477 - 32 sources
241 *
242 * They connected as follows:
243 * all vrc5477 interrupts are routed to cpu IP2 (by software setting)
244 * all i8359 are routed to INTC in vrc5477 (by hardware connection)
245 *
246 * All VRC5477 PCI interrupts are level-triggered (no ack needed).
247 * All PCI irq but INTC are active low.
248 */
249
250/*
251 * irq number block assignment
252 */
253
254#define NUM_CPU_IRQ 8
255#define NUM_I8259_IRQ 16
256#define NUM_VRC5477_IRQ 32
257
258#define DDB_IRQ_BASE 0
259
260#define I8259_IRQ_BASE DDB_IRQ_BASE
261#define VRC5477_IRQ_BASE (I8259_IRQ_BASE + NUM_I8259_IRQ)
262#define CPU_IRQ_BASE (VRC5477_IRQ_BASE + NUM_VRC5477_IRQ)
263
264/*
265 * vrc5477 irq defs
266 */
267
268#define VRC5477_IRQ_CPCE (0 + VRC5477_IRQ_BASE) /* cpu parity error */
269#define VRC5477_IRQ_CNTD (1 + VRC5477_IRQ_BASE) /* cpu no target */
270#define VRC5477_IRQ_I2C (2 + VRC5477_IRQ_BASE) /* I2C */
271#define VRC5477_IRQ_DMA (3 + VRC5477_IRQ_BASE) /* DMA */
272#define VRC5477_IRQ_UART0 (4 + VRC5477_IRQ_BASE)
273#define VRC5477_IRQ_WDOG (5 + VRC5477_IRQ_BASE) /* watchdog timer */
274#define VRC5477_IRQ_SPT1 (6 + VRC5477_IRQ_BASE) /* special purpose timer 1 */
275#define VRC5477_IRQ_LBRT (7 + VRC5477_IRQ_BASE) /* local bus read timeout */
276#define VRC5477_IRQ_INTA (8 + VRC5477_IRQ_BASE) /* PCI INT #A */
277#define VRC5477_IRQ_INTB (9 + VRC5477_IRQ_BASE) /* PCI INT #B */
278#define VRC5477_IRQ_INTC (10 + VRC5477_IRQ_BASE) /* PCI INT #C */
279#define VRC5477_IRQ_INTD (11 + VRC5477_IRQ_BASE) /* PCI INT #D */
280#define VRC5477_IRQ_INTE (12 + VRC5477_IRQ_BASE) /* PCI INT #E */
281#define VRC5477_IRQ_RESERVED_13 (13 + VRC5477_IRQ_BASE) /* reserved */
282#define VRC5477_IRQ_PCIS (14 + VRC5477_IRQ_BASE) /* PCI SERR # */
283#define VRC5477_IRQ_PCI (15 + VRC5477_IRQ_BASE) /* PCI internal error */
284#define VRC5477_IRQ_IOPCI_INTA (16 + VRC5477_IRQ_BASE) /* USB-H */
285#define VRC5477_IRQ_IOPCI_INTB (17 + VRC5477_IRQ_BASE) /* USB-P */
286#define VRC5477_IRQ_IOPCI_INTC (18 + VRC5477_IRQ_BASE) /* AC97 */
287#define VRC5477_IRQ_IOPCI_INTD (19 + VRC5477_IRQ_BASE) /* Reserved */
288#define VRC5477_IRQ_UART1 (20 + VRC5477_IRQ_BASE)
289#define VRC5477_IRQ_SPT0 (21 + VRC5477_IRQ_BASE) /* special purpose timer 0 */
290#define VRC5477_IRQ_GPT0 (22 + VRC5477_IRQ_BASE) /* general purpose timer 0 */
291#define VRC5477_IRQ_GPT1 (23 + VRC5477_IRQ_BASE) /* general purpose timer 1 */
292#define VRC5477_IRQ_GPT2 (24 + VRC5477_IRQ_BASE) /* general purpose timer 2 */
293#define VRC5477_IRQ_GPT3 (25 + VRC5477_IRQ_BASE) /* general purpose timer 3 */
294#define VRC5477_IRQ_GPIO (26 + VRC5477_IRQ_BASE)
295#define VRC5477_IRQ_SIO0 (27 + VRC5477_IRQ_BASE)
296#define VRC5477_IRQ_SIO1 (28 + VRC5477_IRQ_BASE)
297#define VRC5477_IRQ_RESERVED_29 (29 + VRC5477_IRQ_BASE) /* reserved */
298#define VRC5477_IRQ_IOPCISERR (30 + VRC5477_IRQ_BASE) /* IO PCI SERR # */
299#define VRC5477_IRQ_IOPCI (31 + VRC5477_IRQ_BASE)
300
301/*
302 * i2859 irq assignment
303 */
304#define I8259_IRQ_RESERVED_0 (0 + I8259_IRQ_BASE)
305#define I8259_IRQ_KEYBOARD (1 + I8259_IRQ_BASE) /* M1543 default */
306#define I8259_IRQ_CASCADE (2 + I8259_IRQ_BASE)
307#define I8259_IRQ_UART_B (3 + I8259_IRQ_BASE) /* M1543 default, may conflict with RTC according to schematic diagram */
308#define I8259_IRQ_UART_A (4 + I8259_IRQ_BASE) /* M1543 default */
309#define I8259_IRQ_PARALLEL (5 + I8259_IRQ_BASE) /* M1543 default */
310#define I8259_IRQ_RESERVED_6 (6 + I8259_IRQ_BASE)
311#define I8259_IRQ_RESERVED_7 (7 + I8259_IRQ_BASE)
312#define I8259_IRQ_RTC (8 + I8259_IRQ_BASE) /* who set this? */
313#define I8259_IRQ_USB (9 + I8259_IRQ_BASE) /* ddb_setup */
314#define I8259_IRQ_PMU (10 + I8259_IRQ_BASE) /* ddb_setup */
315#define I8259_IRQ_RESERVED_11 (11 + I8259_IRQ_BASE)
316#define I8259_IRQ_RESERVED_12 (12 + I8259_IRQ_BASE) /* m1543_irq_setup */
317#define I8259_IRQ_RESERVED_13 (13 + I8259_IRQ_BASE)
318#define I8259_IRQ_HDC1 (14 + I8259_IRQ_BASE) /* default and ddb_setup */
319#define I8259_IRQ_HDC2 (15 + I8259_IRQ_BASE) /* default */
320
321
322/*
323 * misc
324 */
325#define VRC5477_I8259_CASCADE (VRC5477_IRQ_INTC - VRC5477_IRQ_BASE)
326#define CPU_VRC5477_CASCADE 2
327
328/*
329 * debug routines
330 */
331#ifndef __ASSEMBLY__
332#if defined(CONFIG_RUNTIME_DEBUG)
333extern void vrc5477_show_pdar_regs(void);
334extern void vrc5477_show_pci_regs(void);
335extern void vrc5477_show_bar_regs(void);
336extern void vrc5477_show_int_regs(void);
337extern void vrc5477_show_all_regs(void);
338#endif
339
340/*
341 * RAM size
342 */
343extern int board_ram_size;
344#endif /* !__ASSEMBLY__ */
345
346#endif /* __ASM_DDB5XXX_DDB5477_H */
diff --git a/include/asm-mips/ddb5xxx/ddb5xxx.h b/include/asm-mips/ddb5xxx/ddb5xxx.h
new file mode 100644
index 000000000000..873c03f2c5fe
--- /dev/null
+++ b/include/asm-mips/ddb5xxx/ddb5xxx.h
@@ -0,0 +1,273 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
6 * Sony Software Development Center Europe (SDCE), Brussels
7 *
8 * include/asm-mips/ddb5xxx/ddb5xxx.h
9 * Common header for all NEC DDB 5xxx boards, including 5074, 5476, 5477.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17
18#ifndef __ASM_DDB5XXX_DDB5XXX_H
19#define __ASM_DDB5XXX_DDB5XXX_H
20
21#include <linux/config.h>
22#include <linux/types.h>
23
24/*
25 * This file is based on the following documentation:
26 *
27 * NEC Vrc 5074 System Controller Data Sheet, June 1998
28 *
29 * [jsun] It is modified so that this file only contains the macros
30 * that are true for all DDB 5xxx boards. The modification is based on
31 *
32 * uPD31577(VRC5477) VR5432-SDRAM/PCI Bridge (Luke)
33 * Preliminary Specification Decoment, Rev 1.1, 27 Dec, 2000
34 *
35 */
36
37
38#define DDB_BASE 0xbfa00000
39#define DDB_SIZE 0x00200000 /* 2 MB */
40
41
42/*
43 * Physical Device Address Registers (PDARs)
44 */
45
46#define DDB_SDRAM0 0x0000 /* SDRAM Bank 0 [R/W] */
47#define DDB_SDRAM1 0x0008 /* SDRAM Bank 1 [R/W] */
48#define DDB_DCS2 0x0010 /* Device Chip-Select 2 [R/W] */
49#define DDB_DCS3 0x0018 /* Device Chip-Select 3 [R/W] */
50#define DDB_DCS4 0x0020 /* Device Chip-Select 4 [R/W] */
51#define DDB_DCS5 0x0028 /* Device Chip-Select 5 [R/W] */
52#define DDB_DCS6 0x0030 /* Device Chip-Select 6 [R/W] */
53#define DDB_DCS7 0x0038 /* Device Chip-Select 7 [R/W] */
54#define DDB_DCS8 0x0040 /* Device Chip-Select 8 [R/W] */
55#define DDB_PCIW0 0x0060 /* PCI Address Window 0 [R/W] */
56#define DDB_PCIW1 0x0068 /* PCI Address Window 1 [R/W] */
57#define DDB_INTCS 0x0070 /* Controller Internal Registers and Devices */
58 /* [R/W] */
59#define DDB_BOOTCS 0x0078 /* Boot ROM Chip-Select [R/W] */
60/* Vrc5477 has two more, IOPCIW0, IOPCIW1 */
61
62/*
63 * CPU Interface Registers
64 */
65#define DDB_CPUSTAT 0x0080 /* CPU Status [R/W] */
66#define DDB_INTCTRL 0x0088 /* Interrupt Control [R/W] */
67#define DDB_INTSTAT0 0x0090 /* Interrupt Status 0 [R] */
68#define DDB_INTSTAT1 0x0098 /* Interrupt Status 1 and CPU Interrupt */
69 /* Enable [R/W] */
70#define DDB_INTCLR 0x00A0 /* Interrupt Clear [R/W] */
71#define DDB_INTPPES 0x00A8 /* PCI Interrupt Control [R/W] */
72
73
74/*
75 * Memory-Interface Registers
76 */
77#define DDB_MEMCTRL 0x00C0 /* Memory Control */
78#define DDB_ACSTIME 0x00C8 /* Memory Access Timing [R/W] */
79#define DDB_CHKERR 0x00D0 /* Memory Check Error Status [R] */
80
81
82/*
83 * PCI-Bus Registers
84 */
85#define DDB_PCICTRL 0x00E0 /* PCI Control [R/W] */
86#define DDB_PCIARB 0x00E8 /* PCI Arbiter [R/W] */
87#define DDB_PCIINIT0 0x00F0 /* PCI Master (Initiator) 0 [R/W] */
88#define DDB_PCIINIT1 0x00F8 /* PCI Master (Initiator) 1 [R/W] */
89#define DDB_PCIERR 0x00B8 /* PCI Error [R/W] */
90
91
92/*
93 * Local-Bus Registers
94 */
95#define DDB_LCNFG 0x0100 /* Local Bus Configuration [R/W] */
96#define DDB_LCST2 0x0110 /* Local Bus Chip-Select Timing 2 [R/W] */
97#define DDB_LCST3 0x0118 /* Local Bus Chip-Select Timing 3 [R/W] */
98#define DDB_LCST4 0x0120 /* Local Bus Chip-Select Timing 4 [R/W] */
99#define DDB_LCST5 0x0128 /* Local Bus Chip-Select Timing 5 [R/W] */
100#define DDB_LCST6 0x0130 /* Local Bus Chip-Select Timing 6 [R/W] */
101#define DDB_LCST7 0x0138 /* Local Bus Chip-Select Timing 7 [R/W] */
102#define DDB_LCST8 0x0140 /* Local Bus Chip-Select Timing 8 [R/W] */
103#define DDB_DCSFN 0x0150 /* Device Chip-Select Muxing and Output */
104 /* Enables [R/W] */
105#define DDB_DCSIO 0x0158 /* Device Chip-Selects As I/O Bits [R/W] */
106#define DDB_BCST 0x0178 /* Local Boot Chip-Select Timing [R/W] */
107
108
109/*
110 * DMA Registers
111 */
112#define DDB_DMACTRL0 0x0180 /* DMA Control 0 [R/W] */
113#define DDB_DMASRCA0 0x0188 /* DMA Source Address 0 [R/W] */
114#define DDB_DMADESA0 0x0190 /* DMA Destination Address 0 [R/W] */
115#define DDB_DMACTRL1 0x0198 /* DMA Control 1 [R/W] */
116#define DDB_DMASRCA1 0x01A0 /* DMA Source Address 1 [R/W] */
117#define DDB_DMADESA1 0x01A8 /* DMA Destination Address 1 [R/W] */
118
119
120/*
121 * Timer Registers
122 */
123#define DDB_T0CTRL 0x01C0 /* SDRAM Refresh Control [R/W] */
124#define DDB_T0CNTR 0x01C8 /* SDRAM Refresh Counter [R/W] */
125#define DDB_T1CTRL 0x01D0 /* CPU-Bus Read Time-Out Control [R/W] */
126#define DDB_T1CNTR 0x01D8 /* CPU-Bus Read Time-Out Counter [R/W] */
127#define DDB_T2CTRL 0x01E0 /* General-Purpose Timer Control [R/W] */
128#define DDB_T2CNTR 0x01E8 /* General-Purpose Timer Counter [R/W] */
129#define DDB_T3CTRL 0x01F0 /* Watchdog Timer Control [R/W] */
130#define DDB_T3CNTR 0x01F8 /* Watchdog Timer Counter [R/W] */
131
132
133/*
134 * PCI Configuration Space Registers
135 */
136#define DDB_PCI_BASE 0x0200
137
138#define DDB_VID 0x0200 /* PCI Vendor ID [R] */
139#define DDB_DID 0x0202 /* PCI Device ID [R] */
140#define DDB_PCICMD 0x0204 /* PCI Command [R/W] */
141#define DDB_PCISTS 0x0206 /* PCI Status [R/W] */
142#define DDB_REVID 0x0208 /* PCI Revision ID [R] */
143#define DDB_CLASS 0x0209 /* PCI Class Code [R] */
144#define DDB_CLSIZ 0x020C /* PCI Cache Line Size [R/W] */
145#define DDB_MLTIM 0x020D /* PCI Latency Timer [R/W] */
146#define DDB_HTYPE 0x020E /* PCI Header Type [R] */
147#define DDB_BIST 0x020F /* BIST [R] (unimplemented) */
148#define DDB_BARC 0x0210 /* PCI Base Address Register Control [R/W] */
149#define DDB_BAR0 0x0218 /* PCI Base Address Register 0 [R/W] */
150#define DDB_BAR1 0x0220 /* PCI Base Address Register 1 [R/W] */
151#define DDB_CIS 0x0228 /* PCI Cardbus CIS Pointer [R] */
152 /* (unimplemented) */
153#define DDB_SSVID 0x022C /* PCI Sub-System Vendor ID [R/W] */
154#define DDB_SSID 0x022E /* PCI Sub-System ID [R/W] */
155#define DDB_ROM 0x0230 /* Expansion ROM Base Address [R] */
156 /* (unimplemented) */
157#define DDB_INTLIN 0x023C /* PCI Interrupt Line [R/W] */
158#define DDB_INTPIN 0x023D /* PCI Interrupt Pin [R] */
159#define DDB_MINGNT 0x023E /* PCI Min_Gnt [R] (unimplemented) */
160#define DDB_MAXLAT 0x023F /* PCI Max_Lat [R] (unimplemented) */
161#define DDB_BAR2 0x0240 /* PCI Base Address Register 2 [R/W] */
162#define DDB_BAR3 0x0248 /* PCI Base Address Register 3 [R/W] */
163#define DDB_BAR4 0x0250 /* PCI Base Address Register 4 [R/W] */
164#define DDB_BAR5 0x0258 /* PCI Base Address Register 5 [R/W] */
165#define DDB_BAR6 0x0260 /* PCI Base Address Register 6 [R/W] */
166#define DDB_BAR7 0x0268 /* PCI Base Address Register 7 [R/W] */
167#define DDB_BAR8 0x0270 /* PCI Base Address Register 8 [R/W] */
168#define DDB_BARB 0x0278 /* PCI Base Address Register BOOT [R/W] */
169
170
171/*
172 * Nile 4 Register Access
173 */
174
175static inline void ddb_sync(void)
176{
177/* The DDB5074 doesn't seem to like these accesses. They kill the board on
178 * interrupt load
179 */
180#ifndef CONFIG_DDB5074
181 volatile u32 *p = (volatile u32 *)0xbfc00000;
182 (void)(*p);
183#endif
184}
185
186static inline void ddb_out32(u32 offset, u32 val)
187{
188 *(volatile u32 *)(DDB_BASE+offset) = val;
189 ddb_sync();
190}
191
192static inline u32 ddb_in32(u32 offset)
193{
194 u32 val = *(volatile u32 *)(DDB_BASE+offset);
195 ddb_sync();
196 return val;
197}
198
199static inline void ddb_out16(u32 offset, u16 val)
200{
201 *(volatile u16 *)(DDB_BASE+offset) = val;
202 ddb_sync();
203}
204
205static inline u16 ddb_in16(u32 offset)
206{
207 u16 val = *(volatile u16 *)(DDB_BASE+offset);
208 ddb_sync();
209 return val;
210}
211
212static inline void ddb_out8(u32 offset, u8 val)
213{
214 *(volatile u8 *)(DDB_BASE+offset) = val;
215 ddb_sync();
216}
217
218static inline u8 ddb_in8(u32 offset)
219{
220 u8 val = *(volatile u8 *)(DDB_BASE+offset);
221 ddb_sync();
222 return val;
223}
224
225
226/*
227 * Physical Device Address Registers
228 */
229
230extern u32
231ddb_calc_pdar(u32 phys, u32 size, int width, int on_memory_bus, int pci_visible);
232extern void
233ddb_set_pdar(u32 pdar, u32 phys, u32 size, int width,
234 int on_memory_bus, int pci_visible);
235
236/*
237 * PCI Master Registers
238 */
239
240#define DDB_PCICMD_IACK 0 /* PCI Interrupt Acknowledge */
241#define DDB_PCICMD_IO 1 /* PCI I/O Space */
242#define DDB_PCICMD_MEM 3 /* PCI Memory Space */
243#define DDB_PCICMD_CFG 5 /* PCI Configuration Space */
244
245/*
246 * additional options for pci init reg (no shifting needed)
247 */
248#define DDB_PCI_CFGTYPE1 0x200 /* for pci init0/1 regs */
249#define DDB_PCI_ACCESS_32 0x10 /* for pci init0/1 regs */
250
251
252extern void ddb_set_pmr(u32 pmr, u32 type, u32 addr, u32 options);
253
254/*
255 * we need to reset pci bus when we start up and shutdown
256 */
257extern void ddb_pci_reset_bus(void);
258
259
260/*
261 * include the board dependent part
262 */
263#if defined(CONFIG_DDB5074)
264#include <asm/ddb5xxx/ddb5074.h>
265#elif defined(CONFIG_DDB5476)
266#include <asm/ddb5xxx/ddb5476.h>
267#elif defined(CONFIG_DDB5477)
268#include <asm/ddb5xxx/ddb5477.h>
269#else
270#error "Unknown DDB board!"
271#endif
272
273#endif /* __ASM_DDB5XXX_DDB5XXX_H */
diff --git a/include/asm-mips/debug.h b/include/asm-mips/debug.h
new file mode 100644
index 000000000000..930f2b75e766
--- /dev/null
+++ b/include/asm-mips/debug.h
@@ -0,0 +1,49 @@
1/*
2 * Debug macros for run-time debugging.
3 * Turned on/off with CONFIG_RUNTIME_DEBUG option.
4 *
5 * Copyright (C) 2001 MontaVista Software Inc.
6 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef _ASM_DEBUG_H
16#define _ASM_DEBUG_H
17
18#include <linux/config.h>
19
20/*
21 * run-time macros for catching spurious errors. Eable CONFIG_RUNTIME_DEBUG in
22 * kernel hacking config menu to use them.
23 *
24 * Use them as run-time debugging aid. NEVER USE THEM AS ERROR HANDLING CODE!!!
25 */
26
27#ifdef CONFIG_RUNTIME_DEBUG
28
29#include <linux/kernel.h>
30
31#define db_assert(x) if (!(x)) { \
32 panic("assertion failed at %s:%d: %s", __FILE__, __LINE__, #x); }
33#define db_warn(x) if (!(x)) { \
34 printk(KERN_WARNING "warning at %s:%d: %s", __FILE__, __LINE__, #x); }
35#define db_verify(x, y) db_assert(x y)
36#define db_verify_warn(x, y) db_warn(x y)
37#define db_run(x) do { x; } while (0)
38
39#else
40
41#define db_assert(x)
42#define db_warn(x)
43#define db_verify(x, y) x
44#define db_verify_warn(x, y) x
45#define db_run(x)
46
47#endif
48
49#endif /* _ASM_DEBUG_H */
diff --git a/include/asm-mips/dec/ecc.h b/include/asm-mips/dec/ecc.h
new file mode 100644
index 000000000000..724908b0bf13
--- /dev/null
+++ b/include/asm-mips/dec/ecc.h
@@ -0,0 +1,55 @@
1/*
2 * include/asm-mips/dec/ecc.h
3 *
4 * ECC handling logic definitions common to DECstation/DECsystem
5 * 5000/200 (KN02), 5000/240 (KN03), 5000/260 (KN05) and
6 * DECsystem 5900 (KN03), 5900/260 (KN05) systems.
7 *
8 * Copyright (C) 2003 Maciej W. Rozycki
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15#ifndef __ASM_MIPS_DEC_ECC_H
16#define __ASM_MIPS_DEC_ECC_H
17
18/*
19 * Error Address Register bits.
20 * The register is r/wc -- any write clears it.
21 */
22#define KN0X_EAR_VALID (1<<31) /* error data valid, bus IRQ */
23#define KN0X_EAR_CPU (1<<30) /* CPU/DMA transaction */
24#define KN0X_EAR_WRITE (1<<29) /* write/read transaction */
25#define KN0X_EAR_ECCERR (1<<28) /* ECC/timeout or overrun */
26#define KN0X_EAR_RES_27 (1<<27) /* unused */
27#define KN0X_EAR_ADDRESS (0x7ffffff<<0) /* address involved */
28
29/*
30 * Error Syndrome Register bits.
31 * The register is frozen when EAR.VALID is set, otherwise it records bits
32 * from the last memory read. The register is r/wc -- any write clears it.
33 */
34#define KN0X_ESR_VLDHI (1<<31) /* error data valid hi word */
35#define KN0X_ESR_CHKHI (0x7f<<24) /* check bits read from mem */
36#define KN0X_ESR_SNGHI (1<<23) /* single/double bit error */
37#define KN0X_ESR_SYNHI (0x7f<<16) /* syndrome from ECC logic */
38#define KN0X_ESR_VLDLO (1<<15) /* error data valid lo word */
39#define KN0X_ESR_CHKLO (0x7f<<8) /* check bits read from mem */
40#define KN0X_ESR_SNGLO (1<<7) /* single/double bit error */
41#define KN0X_ESR_SYNLO (0x7f<<0) /* syndrome from ECC logic */
42
43
44#ifndef __ASSEMBLY__
45
46#include <linux/interrupt.h>
47
48struct pt_regs;
49
50extern void dec_ecc_be_init(void);
51extern int dec_ecc_be_handler(struct pt_regs *regs, int is_fixup);
52extern irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id, struct pt_regs *regs);
53#endif
54
55#endif /* __ASM_MIPS_DEC_ECC_H */
diff --git a/include/asm-mips/dec/interrupts.h b/include/asm-mips/dec/interrupts.h
new file mode 100644
index 000000000000..273e4d65bfe6
--- /dev/null
+++ b/include/asm-mips/dec/interrupts.h
@@ -0,0 +1,125 @@
1/*
2 * Miscellaneous definitions used to initialise the interrupt vector table
3 * with the machine-specific interrupt routines.
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *
9 * Copyright (C) 1997 by Paul M. Antoine.
10 * reworked 1998 by Harald Koerfgen.
11 * Copyright (C) 2001, 2002, 2003 Maciej W. Rozycki
12 */
13
14#ifndef __ASM_DEC_INTERRUPTS_H
15#define __ASM_DEC_INTERRUPTS_H
16
17#include <asm/mipsregs.h>
18
19
20/*
21 * The list of possible system devices which provide an
22 * interrupt. Not all devices exist on a given system.
23 */
24#define DEC_IRQ_CASCADE 0 /* cascade from CSR or I/O ASIC */
25
26/* Ordinary interrupts */
27#define DEC_IRQ_AB_RECV 1 /* ACCESS.bus receive */
28#define DEC_IRQ_AB_XMIT 2 /* ACCESS.bus transmit */
29#define DEC_IRQ_DZ11 3 /* DZ11 (DC7085) serial */
30#define DEC_IRQ_ASC 4 /* ASC (NCR53C94) SCSI */
31#define DEC_IRQ_FLOPPY 5 /* 82077 FDC */
32#define DEC_IRQ_FPU 6 /* R3k FPU */
33#define DEC_IRQ_HALT 7 /* HALT button or from ACCESS.Bus */
34#define DEC_IRQ_ISDN 8 /* Am79C30A ISDN */
35#define DEC_IRQ_LANCE 9 /* LANCE (Am7990) Ethernet */
36#define DEC_IRQ_BUS 10 /* memory, I/O bus read/write errors */
37#define DEC_IRQ_PSU 11 /* power supply unit warning */
38#define DEC_IRQ_RTC 12 /* DS1287 RTC */
39#define DEC_IRQ_SCC0 13 /* SCC (Z85C30) serial #0 */
40#define DEC_IRQ_SCC1 14 /* SCC (Z85C30) serial #1 */
41#define DEC_IRQ_SII 15 /* SII (DC7061) SCSI */
42#define DEC_IRQ_TC0 16 /* TURBOchannel slot #0 */
43#define DEC_IRQ_TC1 17 /* TURBOchannel slot #1 */
44#define DEC_IRQ_TC2 18 /* TURBOchannel slot #2 */
45#define DEC_IRQ_TIMER 19 /* ARC periodic timer */
46#define DEC_IRQ_VIDEO 20 /* framebuffer */
47
48/* I/O ASIC DMA interrupts */
49#define DEC_IRQ_ASC_MERR 21 /* ASC memory read error */
50#define DEC_IRQ_ASC_ERR 22 /* ASC page overrun */
51#define DEC_IRQ_ASC_DMA 23 /* ASC buffer pointer loaded */
52#define DEC_IRQ_FLOPPY_ERR 24 /* FDC error */
53#define DEC_IRQ_ISDN_ERR 25 /* ISDN memory read/overrun error */
54#define DEC_IRQ_ISDN_RXDMA 26 /* ISDN recv buffer pointer loaded */
55#define DEC_IRQ_ISDN_TXDMA 27 /* ISDN xmit buffer pointer loaded */
56#define DEC_IRQ_LANCE_MERR 28 /* LANCE memory read error */
57#define DEC_IRQ_SCC0A_RXERR 29 /* SCC0A (printer) receive overrun */
58#define DEC_IRQ_SCC0A_RXDMA 30 /* SCC0A receive half page */
59#define DEC_IRQ_SCC0A_TXERR 31 /* SCC0A xmit memory read/overrun */
60#define DEC_IRQ_SCC0A_TXDMA 32 /* SCC0A transmit page end */
61#define DEC_IRQ_AB_RXERR 33 /* ACCESS.bus receive overrun */
62#define DEC_IRQ_AB_RXDMA 34 /* ACCESS.bus receive half page */
63#define DEC_IRQ_AB_TXERR 35 /* ACCESS.bus xmit memory read/ovrn */
64#define DEC_IRQ_AB_TXDMA 36 /* ACCESS.bus transmit page end */
65#define DEC_IRQ_SCC1A_RXERR 37 /* SCC1A (modem) receive overrun */
66#define DEC_IRQ_SCC1A_RXDMA 38 /* SCC1A receive half page */
67#define DEC_IRQ_SCC1A_TXERR 39 /* SCC1A xmit memory read/overrun */
68#define DEC_IRQ_SCC1A_TXDMA 40 /* SCC1A transmit page end */
69
70/* TC5 & TC6 are virtual slots for KN02's onboard devices */
71#define DEC_IRQ_TC5 DEC_IRQ_ASC /* virtual PMAZ-AA */
72#define DEC_IRQ_TC6 DEC_IRQ_LANCE /* virtual PMAD-AA */
73
74#define DEC_NR_INTS 41
75
76
77/* Largest of cpu mask_nr tables. */
78#define DEC_MAX_CPU_INTS 6
79/* Largest of asic mask_nr tables. */
80#define DEC_MAX_ASIC_INTS 9
81
82
83/*
84 * CPU interrupt bits common to all systems.
85 */
86#define DEC_CPU_INR_FPU 7 /* R3k FPU */
87#define DEC_CPU_INR_SW1 1 /* software #1 */
88#define DEC_CPU_INR_SW0 0 /* software #0 */
89
90#define DEC_CPU_IRQ_BASE 0 /* first IRQ assigned to CPU */
91
92#define DEC_CPU_IRQ_NR(n) ((n) + DEC_CPU_IRQ_BASE)
93#define DEC_CPU_IRQ_MASK(n) (1 << ((n) + CAUSEB_IP))
94#define DEC_CPU_IRQ_ALL (0xff << CAUSEB_IP)
95
96
97#ifndef __ASSEMBLY__
98
99/*
100 * Interrupt table structures to hide differences between systems.
101 */
102typedef union { int i; void *p; } int_ptr;
103extern int dec_interrupt[DEC_NR_INTS];
104extern int_ptr cpu_mask_nr_tbl[DEC_MAX_CPU_INTS][2];
105extern int_ptr asic_mask_nr_tbl[DEC_MAX_ASIC_INTS][2];
106extern int cpu_fpu_mask;
107
108
109/*
110 * Common interrupt routine prototypes for all DECStations
111 */
112extern void kn02_io_int(void);
113extern void kn02xa_io_int(void);
114extern void kn03_io_int(void);
115extern void asic_dma_int(void);
116extern void asic_all_int(void);
117extern void kn02_all_int(void);
118extern void cpu_all_int(void);
119
120extern void dec_intr_unimplemented(void);
121extern void asic_intr_unimplemented(void);
122
123#endif /* __ASSEMBLY__ */
124
125#endif
diff --git a/include/asm-mips/dec/ioasic.h b/include/asm-mips/dec/ioasic.h
new file mode 100644
index 000000000000..486a5b0a1302
--- /dev/null
+++ b/include/asm-mips/dec/ioasic.h
@@ -0,0 +1,36 @@
1/*
2 * include/asm-mips/dec/ioasic.h
3 *
4 * DEC I/O ASIC access operations.
5 *
6 * Copyright (C) 2000, 2002, 2003 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#ifndef __ASM_DEC_IOASIC_H
15#define __ASM_DEC_IOASIC_H
16
17#include <linux/spinlock.h>
18#include <linux/types.h>
19
20extern spinlock_t ioasic_ssr_lock;
21
22extern volatile u32 *ioasic_base;
23
24static inline void ioasic_write(unsigned int reg, u32 v)
25{
26 ioasic_base[reg / 4] = v;
27}
28
29static inline u32 ioasic_read(unsigned int reg)
30{
31 return ioasic_base[reg / 4];
32}
33
34extern void init_ioasic_irqs(int base);
35
36#endif /* __ASM_DEC_IOASIC_H */
diff --git a/include/asm-mips/dec/ioasic_addrs.h b/include/asm-mips/dec/ioasic_addrs.h
new file mode 100644
index 000000000000..5e18a7510592
--- /dev/null
+++ b/include/asm-mips/dec/ioasic_addrs.h
@@ -0,0 +1,151 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Definitions for the address map in the JUNKIO Asic
7 *
8 * Created with Information from:
9 *
10 * "DEC 3000 300/400/500/600/700/800/900 AXP Models System Programmer's Manual"
11 *
12 * and the Mach Sources
13 *
14 * Copyright (C) 199x the Anonymous
15 * Copyright (C) 2002, 2003 Maciej W. Rozycki
16 */
17
18#ifndef __ASM_MIPS_DEC_IOASIC_ADDRS_H
19#define __ASM_MIPS_DEC_IOASIC_ADDRS_H
20
21#define IOASIC_SLOT_SIZE 0x00040000
22
23/*
24 * Address ranges decoded by the I/O ASIC for onboard devices.
25 */
26#define IOASIC_SYS_ROM (0*IOASIC_SLOT_SIZE) /* system board ROM */
27#define IOASIC_IOCTL (1*IOASIC_SLOT_SIZE) /* I/O ASIC */
28#define IOASIC_ESAR (2*IOASIC_SLOT_SIZE) /* LANCE MAC address chip */
29#define IOASIC_LANCE (3*IOASIC_SLOT_SIZE) /* LANCE Ethernet */
30#define IOASIC_SCC0 (4*IOASIC_SLOT_SIZE) /* SCC #0 */
31#define IOASIC_VDAC_HI (5*IOASIC_SLOT_SIZE) /* VDAC (maxine) */
32#define IOASIC_SCC1 (6*IOASIC_SLOT_SIZE) /* SCC #1 (3min, 3max+) */
33#define IOASIC_VDAC_LO (7*IOASIC_SLOT_SIZE) /* VDAC (maxine) */
34#define IOASIC_TOY (8*IOASIC_SLOT_SIZE) /* RTC */
35#define IOASIC_ISDN (9*IOASIC_SLOT_SIZE) /* ISDN (maxine) */
36#define IOASIC_ERRADDR (9*IOASIC_SLOT_SIZE) /* bus error address (3max+) */
37#define IOASIC_CHKSYN (10*IOASIC_SLOT_SIZE) /* ECC syndrome (3max+) */
38#define IOASIC_ACC_BUS (10*IOASIC_SLOT_SIZE) /* ACCESS.bus (maxine) */
39#define IOASIC_MCR (11*IOASIC_SLOT_SIZE) /* memory control (3max+) */
40#define IOASIC_FLOPPY (11*IOASIC_SLOT_SIZE) /* FDC (maxine) */
41#define IOASIC_SCSI (12*IOASIC_SLOT_SIZE) /* ASC SCSI */
42#define IOASIC_FDC_DMA (13*IOASIC_SLOT_SIZE) /* FDC DMA (maxine) */
43#define IOASIC_SCSI_DMA (14*IOASIC_SLOT_SIZE) /* ??? */
44#define IOASIC_RES_15 (15*IOASIC_SLOT_SIZE) /* unused? */
45
46
47/*
48 * Offsets for I/O ASIC registers (relative to (system_base + IOASIC_IOCTL)).
49 */
50 /* all systems */
51#define IO_REG_SCSI_DMA_P 0x00 /* SCSI DMA Pointer */
52#define IO_REG_SCSI_DMA_BP 0x10 /* SCSI DMA Buffer Pointer */
53#define IO_REG_LANCE_DMA_P 0x20 /* LANCE DMA Pointer */
54#define IO_REG_SCC0A_T_DMA_P 0x30 /* SCC0A Transmit DMA Pointer */
55#define IO_REG_SCC0A_R_DMA_P 0x40 /* SCC0A Receive DMA Pointer */
56
57 /* except Maxine */
58#define IO_REG_SCC1A_T_DMA_P 0x50 /* SCC1A Transmit DMA Pointer */
59#define IO_REG_SCC1A_R_DMA_P 0x60 /* SCC1A Receive DMA Pointer */
60
61 /* Maxine */
62#define IO_REG_AB_T_DMA_P 0x50 /* ACCESS.bus Transmit DMA Pointer */
63#define IO_REG_AB_R_DMA_P 0x60 /* ACCESS.bus Receive DMA Pointer */
64#define IO_REG_FLOPPY_DMA_P 0x70 /* Floppy DMA Pointer */
65#define IO_REG_ISDN_T_DMA_P 0x80 /* ISDN Transmit DMA Pointer */
66#define IO_REG_ISDN_T_DMA_BP 0x90 /* ISDN Transmit DMA Buffer Pointer */
67#define IO_REG_ISDN_R_DMA_P 0xa0 /* ISDN Receive DMA Pointer */
68#define IO_REG_ISDN_R_DMA_BP 0xb0 /* ISDN Receive DMA Buffer Pointer */
69
70 /* all systems */
71#define IO_REG_DATA_0 0xc0 /* System Data Buffer 0 */
72#define IO_REG_DATA_1 0xd0 /* System Data Buffer 1 */
73#define IO_REG_DATA_2 0xe0 /* System Data Buffer 2 */
74#define IO_REG_DATA_3 0xf0 /* System Data Buffer 3 */
75
76 /* all systems */
77#define IO_REG_SSR 0x100 /* System Support Register */
78#define IO_REG_SIR 0x110 /* System Interrupt Register */
79#define IO_REG_SIMR 0x120 /* System Interrupt Mask Reg. */
80#define IO_REG_SAR 0x130 /* System Address Register */
81
82 /* Maxine */
83#define IO_REG_ISDN_T_DATA 0x140 /* ISDN Xmit Data Register */
84#define IO_REG_ISDN_R_DATA 0x150 /* ISDN Receive Data Register */
85
86 /* all systems */
87#define IO_REG_LANCE_SLOT 0x160 /* LANCE I/O Slot Register */
88#define IO_REG_SCSI_SLOT 0x170 /* SCSI Slot Register */
89#define IO_REG_SCC0A_SLOT 0x180 /* SCC0A DMA Slot Register */
90
91 /* except Maxine */
92#define IO_REG_SCC1A_SLOT 0x190 /* SCC1A DMA Slot Register */
93
94 /* Maxine */
95#define IO_REG_AB_SLOT 0x190 /* ACCESS.bus DMA Slot Register */
96#define IO_REG_FLOPPY_SLOT 0x1a0 /* Floppy Slot Register */
97
98 /* all systems */
99#define IO_REG_SCSI_SCR 0x1b0 /* SCSI Partial-Word DMA Control */
100#define IO_REG_SCSI_SDR0 0x1c0 /* SCSI DMA Partial Word 0 */
101#define IO_REG_SCSI_SDR1 0x1d0 /* SCSI DMA Partial Word 1 */
102#define IO_REG_FCTR 0x1e0 /* Free-Running Counter */
103#define IO_REG_RES_31 0x1f0 /* unused */
104
105
106/*
107 * The upper 16 bits of the System Support Register are a part of the
108 * I/O ASIC's internal DMA engine and thus are common to all I/O ASIC
109 * machines. The exception is the Maxine, which makes use of the
110 * FLOPPY and ISDN bits (otherwise unused) and has a different SCC
111 * wiring.
112 */
113 /* all systems */
114#define IO_SSR_SCC0A_TX_DMA_EN (1<<31) /* SCC0A transmit DMA enable */
115#define IO_SSR_SCC0A_RX_DMA_EN (1<<30) /* SCC0A receive DMA enable */
116#define IO_SSR_RES_27 (1<<27) /* unused */
117#define IO_SSR_RES_26 (1<<26) /* unused */
118#define IO_SSR_RES_25 (1<<25) /* unused */
119#define IO_SSR_RES_24 (1<<24) /* unused */
120#define IO_SSR_RES_23 (1<<23) /* unused */
121#define IO_SSR_SCSI_DMA_DIR (1<<18) /* SCSI DMA direction */
122#define IO_SSR_SCSI_DMA_EN (1<<17) /* SCSI DMA enable */
123#define IO_SSR_LANCE_DMA_EN (1<<16) /* LANCE DMA enable */
124
125 /* except Maxine */
126#define IO_SSR_SCC1A_TX_DMA_EN (1<<29) /* SCC1A transmit DMA enable */
127#define IO_SSR_SCC1A_RX_DMA_EN (1<<28) /* SCC1A receive DMA enable */
128#define IO_SSR_RES_22 (1<<22) /* unused */
129#define IO_SSR_RES_21 (1<<21) /* unused */
130#define IO_SSR_RES_20 (1<<20) /* unused */
131#define IO_SSR_RES_19 (1<<19) /* unused */
132
133 /* Maxine */
134#define IO_SSR_AB_TX_DMA_EN (1<<29) /* ACCESS.bus xmit DMA enable */
135#define IO_SSR_AB_RX_DMA_EN (1<<28) /* ACCESS.bus recv DMA enable */
136#define IO_SSR_FLOPPY_DMA_DIR (1<<22) /* Floppy DMA direction */
137#define IO_SSR_FLOPPY_DMA_EN (1<<21) /* Floppy DMA enable */
138#define IO_SSR_ISDN_TX_DMA_EN (1<<20) /* ISDN transmit DMA enable */
139#define IO_SSR_ISDN_RX_DMA_EN (1<<19) /* ISDN receive DMA enable */
140
141/*
142 * The lower 16 bits are system-specific. Bits 15,11:8 are common and
143 * defined here. The rest is defined in system-specific headers.
144 */
145#define KN0X_IO_SSR_DIAGDN (1<<15) /* diagnostic jumper */
146#define KN0X_IO_SSR_SCC_RST (1<<11) /* ~SCC0,1 (Z85C30) reset */
147#define KN0X_IO_SSR_RTC_RST (1<<10) /* ~RTC (DS1287) reset */
148#define KN0X_IO_SSR_ASC_RST (1<<9) /* ~ASC (NCR53C94) reset */
149#define KN0X_IO_SSR_LANCE_RST (1<<8) /* ~LANCE (Am7990) reset */
150
151#endif /* __ASM_MIPS_DEC_IOASIC_ADDRS_H */
diff --git a/include/asm-mips/dec/ioasic_ints.h b/include/asm-mips/dec/ioasic_ints.h
new file mode 100644
index 000000000000..9aaa9869615f
--- /dev/null
+++ b/include/asm-mips/dec/ioasic_ints.h
@@ -0,0 +1,74 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Definitions for the interrupt related bits in the I/O ASIC
7 * interrupt status register (and the interrupt mask register, of course)
8 *
9 * Created with Information from:
10 *
11 * "DEC 3000 300/400/500/600/700/800/900 AXP Models System Programmer's Manual"
12 *
13 * and the Mach Sources
14 *
15 * Copyright (C) 199x the Anonymous
16 * Copyright (C) 2002 Maciej W. Rozycki
17 */
18
19#ifndef __ASM_DEC_IOASIC_INTS_H
20#define __ASM_DEC_IOASIC_INTS_H
21
22/*
23 * The upper 16 bits are a part of the I/O ASIC's internal DMA engine
24 * and thus are common to all I/O ASIC machines. The exception is
25 * the Maxine, which makes use of the FLOPPY and ISDN bits (otherwise
26 * unused) and has a different SCC wiring.
27 */
28 /* all systems */
29#define IO_INR_SCC0A_TXDMA 31 /* SCC0A transmit page end */
30#define IO_INR_SCC0A_TXERR 30 /* SCC0A transmit memory read error */
31#define IO_INR_SCC0A_RXDMA 29 /* SCC0A receive half page */
32#define IO_INR_SCC0A_RXERR 28 /* SCC0A receive overrun */
33#define IO_INR_ASC_DMA 19 /* ASC buffer pointer loaded */
34#define IO_INR_ASC_ERR 18 /* ASC page overrun */
35#define IO_INR_ASC_MERR 17 /* ASC memory read error */
36#define IO_INR_LANCE_MERR 16 /* LANCE memory read error */
37
38 /* except Maxine */
39#define IO_INR_SCC1A_TXDMA 27 /* SCC1A transmit page end */
40#define IO_INR_SCC1A_TXERR 26 /* SCC1A transmit memory read error */
41#define IO_INR_SCC1A_RXDMA 25 /* SCC1A receive half page */
42#define IO_INR_SCC1A_RXERR 24 /* SCC1A receive overrun */
43#define IO_INR_RES_23 23 /* unused */
44#define IO_INR_RES_22 22 /* unused */
45#define IO_INR_RES_21 21 /* unused */
46#define IO_INR_RES_20 20 /* unused */
47
48 /* Maxine */
49#define IO_INR_AB_TXDMA 27 /* ACCESS.bus transmit page end */
50#define IO_INR_AB_TXERR 26 /* ACCESS.bus xmit memory read error */
51#define IO_INR_AB_RXDMA 25 /* ACCESS.bus receive half page */
52#define IO_INR_AB_RXERR 24 /* ACCESS.bus receive overrun */
53#define IO_INR_FLOPPY_ERR 23 /* FDC error */
54#define IO_INR_ISDN_TXDMA 22 /* ISDN xmit buffer pointer loaded */
55#define IO_INR_ISDN_RXDMA 21 /* ISDN recv buffer pointer loaded */
56#define IO_INR_ISDN_ERR 20 /* ISDN memory read/overrun error */
57
58#define IO_INR_DMA 16 /* first DMA IRQ */
59
60/*
61 * The lower 16 bits are system-specific and thus defined in
62 * system-specific headers.
63 */
64
65
66#define IO_IRQ_BASE 8 /* first IRQ assigned to I/O ASIC */
67#define IO_IRQ_LINES 32 /* number of I/O ASIC interrupts */
68
69#define IO_IRQ_NR(n) ((n) + IO_IRQ_BASE)
70#define IO_IRQ_MASK(n) (1 << (n))
71#define IO_IRQ_ALL 0x0000ffff
72#define IO_IRQ_DMA 0xffff0000
73
74#endif /* __ASM_DEC_IOASIC_INTS_H */
diff --git a/include/asm-mips/dec/kn01.h b/include/asm-mips/dec/kn01.h
new file mode 100644
index 000000000000..946943502f83
--- /dev/null
+++ b/include/asm-mips/dec/kn01.h
@@ -0,0 +1,83 @@
1/*
2 * Hardware info about DECstation DS2100/3100 systems (otherwise known as
3 * pmin/pmax or KN01).
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *
9 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
10 * are by courtesy of Chris Fraser.
11 * Copyright (C) 2002, 2003 Maciej W. Rozycki
12 */
13#ifndef __ASM_MIPS_DEC_KN01_H
14#define __ASM_MIPS_DEC_KN01_H
15
16#include <asm/addrspace.h>
17
18#define KN01_SLOT_BASE KSEG1ADDR(0x10000000)
19#define KN01_SLOT_SIZE 0x01000000
20
21/*
22 * Address ranges for devices.
23 */
24#define KN01_PMASK (0*KN01_SLOT_SIZE) /* color plane mask */
25#define KN01_PCC (1*KN01_SLOT_SIZE) /* PCC (DC503) cursor */
26#define KN01_VDAC (2*KN01_SLOT_SIZE) /* color map */
27#define KN01_RES_3 (3*KN01_SLOT_SIZE) /* unused */
28#define KN01_RES_4 (4*KN01_SLOT_SIZE) /* unused */
29#define KN01_RES_5 (5*KN01_SLOT_SIZE) /* unused */
30#define KN01_RES_6 (6*KN01_SLOT_SIZE) /* unused */
31#define KN01_ERRADDR (7*KN01_SLOT_SIZE) /* write error address */
32#define KN01_LANCE (8*KN01_SLOT_SIZE) /* LANCE (Am7990) Ethernet */
33#define KN01_LANCE_MEM (9*KN01_SLOT_SIZE) /* LANCE buffer memory */
34#define KN01_SII (10*KN01_SLOT_SIZE) /* SII (DC7061) SCSI */
35#define KN01_SII_MEM (11*KN01_SLOT_SIZE) /* SII buffer memory */
36#define KN01_DZ11 (12*KN01_SLOT_SIZE) /* DZ11 (DC7085) serial */
37#define KN01_RTC (13*KN01_SLOT_SIZE) /* DS1287 RTC (bytes #0) */
38#define KN01_ESAR (13*KN01_SLOT_SIZE) /* MAC address (bytes #1) */
39#define KN01_CSR (14*KN01_SLOT_SIZE) /* system ctrl & status reg */
40#define KN01_SYS_ROM (15*KN01_SLOT_SIZE) /* system board ROM */
41
42
43/*
44 * Some port addresses...
45 */
46#define KN01_LANCE_BASE (KN01_SLOT_BASE + KN01_LANCE) /* 0xB8000000 */
47#define KN01_DZ11_BASE (KN01_SLOT_BASE + KN01_DZ11) /* 0xBC000000 */
48#define KN01_RTC_BASE (KN01_SLOT_BASE + KN01_RTC) /* 0xBD000000 */
49
50
51/*
52 * Frame buffer memory address.
53 */
54#define KN01_VFB_MEM KSEG1ADDR(0x0fc00000)
55
56/*
57 * CPU interrupt bits.
58 */
59#define KN01_CPU_INR_BUS 6 /* memory, I/O bus read/write errors */
60#define KN01_CPU_INR_VIDEO 6 /* PCC area detect #2 */
61#define KN01_CPU_INR_RTC 5 /* DS1287 RTC */
62#define KN01_CPU_INR_DZ11 4 /* DZ11 (DC7085) serial */
63#define KN01_CPU_INR_LANCE 3 /* LANCE (Am7990) Ethernet */
64#define KN01_CPU_INR_SII 2 /* SII (DC7061) SCSI */
65
66
67/*
68 * System Control & Status Register bits.
69 */
70#define KN01_CSR_MNFMOD (1<<15) /* MNFMOD manufacturing jumper */
71#define KN01_CSR_STATUS (1<<14) /* self-test result status output */
72#define KN01_CSR_PARDIS (1<<13) /* parity error disable */
73#define KN01_CSR_CRSRTST (1<<12) /* PCC test output */
74#define KN01_CSR_MONO (1<<11) /* mono/color fb SIMM installed */
75#define KN01_CSR_MEMERR (1<<10) /* write timeout error status & ack*/
76#define KN01_CSR_VINT (1<<9) /* PCC area detect #2 status & ack */
77#define KN01_CSR_TXDIS (1<<8) /* DZ11 transmit disable */
78#define KN01_CSR_VBGTRG (1<<2) /* blue DAC voltage over green (r/o) */
79#define KN01_CSR_VRGTRG (1<<1) /* red DAC voltage over green (r/o) */
80#define KN01_CSR_VRGTRB (1<<0) /* red DAC voltage over blue (r/o) */
81#define KN01_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
82
83#endif /* __ASM_MIPS_DEC_KN01_H */
diff --git a/include/asm-mips/dec/kn02.h b/include/asm-mips/dec/kn02.h
new file mode 100644
index 000000000000..f797f7045920
--- /dev/null
+++ b/include/asm-mips/dec/kn02.h
@@ -0,0 +1,106 @@
1/*
2 * Hardware info about DECstation 5000/200 systems (otherwise known as
3 * 3max or KN02).
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *
9 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
10 * are by courtesy of Chris Fraser.
11 * Copyright (C) 2002, 2003 Maciej W. Rozycki
12 */
13#ifndef __ASM_MIPS_DEC_KN02_H
14#define __ASM_MIPS_DEC_KN02_H
15
16#ifndef __ASSEMBLY__
17#include <linux/spinlock.h>
18#include <linux/types.h>
19#endif
20
21#include <asm/addrspace.h>
22#include <asm/dec/ecc.h>
23
24
25#define KN02_SLOT_BASE KSEG1ADDR(0x1fc00000)
26#define KN02_SLOT_SIZE 0x00080000
27
28/*
29 * Address ranges decoded by the "system slot" logic for onboard devices.
30 */
31#define KN02_SYS_ROM (0*KN02_SLOT_SIZE) /* system board ROM */
32#define KN02_RES_1 (1*KN02_SLOT_SIZE) /* unused */
33#define KN02_CHKSYN (2*KN02_SLOT_SIZE) /* ECC syndrome */
34#define KN02_ERRADDR (3*KN02_SLOT_SIZE) /* bus error address */
35#define KN02_DZ11 (4*KN02_SLOT_SIZE) /* DZ11 (DC7085) serial */
36#define KN02_RTC (5*KN02_SLOT_SIZE) /* DS1287 RTC */
37#define KN02_CSR (6*KN02_SLOT_SIZE) /* system ctrl & status reg */
38#define KN02_SYS_ROM_7 (7*KN02_SLOT_SIZE) /* system board ROM (alias) */
39
40
41/*
42 * Some port addresses...
43 */
44#define KN02_DZ11_BASE (KN02_SLOT_BASE + KN02_DZ11) /* DZ11 */
45#define KN02_RTC_BASE (KN02_SLOT_BASE + KN02_RTC) /* RTC */
46#define KN02_CSR_BASE (KN02_SLOT_BASE + KN02_CSR) /* CSR */
47
48
49/*
50 * System Control & Status Register bits.
51 */
52#define KN02_CSR_RES_28 (0xf<<28) /* unused */
53#define KN02_CSR_PSU (1<<27) /* power supply unit warning */
54#define KN02_CSR_NVRAM (1<<26) /* ~NVRAM clear jumper */
55#define KN02_CSR_REFEVEN (1<<25) /* mem refresh bank toggle */
56#define KN03_CSR_NRMOD (1<<24) /* ~NRMOD manufact. jumper */
57#define KN03_CSR_IOINTEN (0xff<<16) /* IRQ mask bits */
58#define KN02_CSR_DIAGCHK (1<<15) /* diagn/norml ECC reads */
59#define KN02_CSR_DIAGGEN (1<<14) /* diagn/norml ECC writes */
60#define KN02_CSR_CORRECT (1<<13) /* ECC correct/check */
61#define KN02_CSR_LEDIAG (1<<12) /* ECC diagn. latch strobe */
62#define KN02_CSR_TXDIS (1<<11) /* DZ11 transmit disable */
63#define KN02_CSR_BNK32M (1<<10) /* 32M/8M stride */
64#define KN02_CSR_DIAGDN (1<<9) /* DIAGDN manufact. jumper */
65#define KN02_CSR_BAUD38 (1<<8) /* DZ11 38/19kbps ext. rate */
66#define KN03_CSR_IOINT (0xff<<0) /* IRQ status bits (r/o) */
67#define KN03_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
68
69
70/*
71 * CPU interrupt bits.
72 */
73#define KN02_CPU_INR_RES_6 6 /* unused */
74#define KN02_CPU_INR_BUS 5 /* memory, I/O bus read/write errors */
75#define KN02_CPU_INR_RES_4 4 /* unused */
76#define KN02_CPU_INR_RTC 3 /* DS1287 RTC */
77#define KN02_CPU_INR_CASCADE 2 /* CSR cascade */
78
79/*
80 * CSR interrupt bits.
81 */
82#define KN02_CSR_INR_DZ11 7 /* DZ11 (DC7085) serial */
83#define KN02_CSR_INR_LANCE 6 /* LANCE (Am7990) Ethernet */
84#define KN02_CSR_INR_ASC 5 /* ASC (NCR53C94) SCSI */
85#define KN02_CSR_INR_RES_4 4 /* unused */
86#define KN02_CSR_INR_RES_3 3 /* unused */
87#define KN02_CSR_INR_TC2 2 /* TURBOchannel slot #2 */
88#define KN02_CSR_INR_TC1 1 /* TURBOchannel slot #1 */
89#define KN02_CSR_INR_TC0 0 /* TURBOchannel slot #0 */
90
91
92#define KN02_IRQ_BASE 8 /* first IRQ assigned to CSR */
93#define KN02_IRQ_LINES 8 /* number of CSR interrupts */
94
95#define KN02_IRQ_NR(n) ((n) + KN02_IRQ_BASE)
96#define KN02_IRQ_MASK(n) (1 << (n))
97#define KN02_IRQ_ALL 0xff
98
99
100#ifndef __ASSEMBLY__
101extern u32 cached_kn02_csr;
102extern spinlock_t kn02_lock;
103extern void init_kn02_irqs(int base);
104#endif
105
106#endif /* __ASM_MIPS_DEC_KN02_H */
diff --git a/include/asm-mips/dec/kn02ba.h b/include/asm-mips/dec/kn02ba.h
new file mode 100644
index 000000000000..c957a4f1b32d
--- /dev/null
+++ b/include/asm-mips/dec/kn02ba.h
@@ -0,0 +1,67 @@
1/*
2 * include/asm-mips/dec/kn02ba.h
3 *
4 * DECstation 5000/1xx (3min or KN02-BA) definitions.
5 *
6 * Copyright (C) 2002, 2003 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef __ASM_MIPS_DEC_KN02BA_H
14#define __ASM_MIPS_DEC_KN02BA_H
15
16#include <asm/dec/kn02xa.h> /* For common definitions. */
17
18/*
19 * CPU interrupt bits.
20 */
21#define KN02BA_CPU_INR_HALT 6 /* HALT button */
22#define KN02BA_CPU_INR_CASCADE 5 /* I/O ASIC cascade */
23#define KN02BA_CPU_INR_TC2 4 /* TURBOchannel slot #2 */
24#define KN02BA_CPU_INR_TC1 3 /* TURBOchannel slot #1 */
25#define KN02BA_CPU_INR_TC0 2 /* TURBOchannel slot #0 */
26
27/*
28 * I/O ASIC interrupt bits. Star marks denote non-IRQ status bits.
29 */
30#define KN02BA_IO_INR_RES_15 15 /* unused */
31#define KN02BA_IO_INR_NVRAM 14 /* (*) NVRAM clear jumper */
32#define KN02BA_IO_INR_RES_13 13 /* unused */
33#define KN02BA_IO_INR_BUS 12 /* memory, I/O bus read/write errors */
34#define KN02BA_IO_INR_RES_11 11 /* unused */
35#define KN02BA_IO_INR_NRMOD 10 /* (*) NRMOD manufacturing jumper */
36#define KN02BA_IO_INR_ASC 9 /* ASC (NCR53C94) SCSI */
37#define KN02BA_IO_INR_LANCE 8 /* LANCE (Am7990) Ethernet */
38#define KN02BA_IO_INR_SCC1 7 /* SCC (Z85C30) serial #1 */
39#define KN02BA_IO_INR_SCC0 6 /* SCC (Z85C30) serial #0 */
40#define KN02BA_IO_INR_RTC 5 /* DS1287 RTC */
41#define KN02BA_IO_INR_PSU 4 /* power supply unit warning */
42#define KN02BA_IO_INR_RES_3 3 /* unused */
43#define KN02BA_IO_INR_ASC_DATA 2 /* SCSI data ready (for PIO) */
44#define KN02BA_IO_INR_PBNC 1 /* ~HALT button debouncer */
45#define KN02BA_IO_INR_PBNO 0 /* HALT button debouncer */
46
47
48/*
49 * Memory Error Register bits.
50 */
51#define KN02BA_MER_RES_27 (1<<27) /* unused */
52
53/*
54 * Memory Size Register bits.
55 */
56#define KN02BA_MSR_RES_17 (0x3ff<<17) /* unused */
57
58/*
59 * I/O ASIC System Support Register bits.
60 */
61#define KN02BA_IO_SSR_TXDIS1 (1<<14) /* SCC1 transmit disable */
62#define KN02BA_IO_SSR_TXDIS0 (1<<13) /* SCC0 transmit disable */
63#define KN02BA_IO_SSR_RES_12 (1<<12) /* unused */
64
65#define KN02BA_IO_SSR_LEDS (0xff<<0) /* ~diagnostic LEDs */
66
67#endif /* __ASM_MIPS_DEC_KN02BA_H */
diff --git a/include/asm-mips/dec/kn02ca.h b/include/asm-mips/dec/kn02ca.h
new file mode 100644
index 000000000000..92c0fe256099
--- /dev/null
+++ b/include/asm-mips/dec/kn02ca.h
@@ -0,0 +1,79 @@
1/*
2 * include/asm-mips/dec/kn02ca.h
3 *
4 * Personal DECstation 5000/xx (Maxine or KN02-CA) definitions.
5 *
6 * Copyright (C) 2002, 2003 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef __ASM_MIPS_DEC_KN02CA_H
14#define __ASM_MIPS_DEC_KN02CA_H
15
16#include <asm/dec/kn02xa.h> /* For common definitions. */
17
18/*
19 * CPU interrupt bits.
20 */
21#define KN02CA_CPU_INR_HALT 6 /* HALT from ACCESS.Bus */
22#define KN02CA_CPU_INR_CASCADE 5 /* I/O ASIC cascade */
23#define KN02CA_CPU_INR_BUS 4 /* memory, I/O bus read/write errors */
24#define KN02CA_CPU_INR_RTC 3 /* DS1287 RTC */
25#define KN02CA_CPU_INR_TIMER 2 /* ARC periodic timer */
26
27/*
28 * I/O ASIC interrupt bits. Star marks denote non-IRQ status bits.
29 */
30#define KN02CA_IO_INR_FLOPPY 15 /* 82077 FDC */
31#define KN02CA_IO_INR_NVRAM 14 /* (*) NVRAM clear jumper */
32#define KN02CA_IO_INR_POWERON 13 /* (*) ACCESS.Bus/power-on reset */
33#define KN02CA_IO_INR_TC0 12 /* TURBOchannel slot #0 */
34#define KN02CA_IO_INR_TIMER 12 /* ARC periodic timer (?) */
35#define KN02CA_IO_INR_ISDN 11 /* Am79C30A ISDN */
36#define KN02CA_IO_INR_NRMOD 10 /* (*) NRMOD manufacturing jumper */
37#define KN02CA_IO_INR_ASC 9 /* ASC (NCR53C94) SCSI */
38#define KN02CA_IO_INR_LANCE 8 /* LANCE (Am7990) Ethernet */
39#define KN02CA_IO_INR_HDFLOPPY 7 /* (*) HD (1.44MB) floppy status */
40#define KN02CA_IO_INR_SCC0 6 /* SCC (Z85C30) serial #0 */
41#define KN02CA_IO_INR_TC1 5 /* TURBOchannel slot #1 */
42#define KN02CA_IO_INR_XDFLOPPY 4 /* (*) XD (2.88MB) floppy status */
43#define KN02CA_IO_INR_VIDEO 3 /* framebuffer */
44#define KN02CA_IO_INR_XVIDEO 2 /* ~framebuffer */
45#define KN02CA_IO_INR_AB_XMIT 1 /* ACCESS.bus transmit */
46#define KN02CA_IO_INR_AB_RECV 0 /* ACCESS.bus receive */
47
48
49/*
50 * Memory Error Register bits.
51 */
52#define KN02CA_MER_INTR (1<<27) /* ARC IRQ status & ack */
53
54/*
55 * Memory Size Register bits.
56 */
57#define KN02CA_MSR_INTREN (1<<26) /* ARC periodic IRQ enable */
58#define KN02CA_MSR_MS10EN (1<<25) /* 10/1ms IRQ period select */
59#define KN02CA_MSR_PFORCE (0xf<<21) /* byte lane error force */
60#define KN02CA_MSR_MABEN (1<<20) /* A side VFB address enable */
61#define KN02CA_MSR_LASTBANK (0x7<<17) /* onboard RAM bank # */
62
63/*
64 * I/O ASIC System Support Register bits.
65 */
66#define KN03CA_IO_SSR_RES_14 (1<<14) /* unused */
67#define KN03CA_IO_SSR_RES_13 (1<<13) /* unused */
68#define KN03CA_IO_SSR_ISDN_RST (1<<12) /* ~ISDN (Am79C30A) reset */
69
70#define KN03CA_IO_SSR_FLOPPY_RST (1<<7) /* ~FDC (82077) reset */
71#define KN03CA_IO_SSR_VIDEO_RST (1<<6) /* ~framebuffer reset */
72#define KN03CA_IO_SSR_AB_RST (1<<5) /* ACCESS.bus reset */
73#define KN03CA_IO_SSR_RES_4 (1<<4) /* unused */
74#define KN03CA_IO_SSR_RES_3 (1<<4) /* unused */
75#define KN03CA_IO_SSR_RES_2 (1<<2) /* unused */
76#define KN03CA_IO_SSR_RES_1 (1<<1) /* unused */
77#define KN03CA_IO_SSR_LED (1<<0) /* power LED */
78
79#endif /* __ASM_MIPS_DEC_KN02CA_H */
diff --git a/include/asm-mips/dec/kn02xa.h b/include/asm-mips/dec/kn02xa.h
new file mode 100644
index 000000000000..648c4dcbba1d
--- /dev/null
+++ b/include/asm-mips/dec/kn02xa.h
@@ -0,0 +1,75 @@
1/*
2 * Hardware info common to DECstation 5000/1xx systems (otherwise
3 * known as 3min or kn02ba) and Personal DECstations 5000/xx ones
4 * (otherwise known as maxine or kn02ca).
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
11 * are by courtesy of Chris Fraser.
12 * Copyright (C) 2000, 2002, 2003 Maciej W. Rozycki
13 *
14 * These are addresses which have to be known early in the boot process.
15 * For other addresses refer to tc.h, ioasic_addrs.h and friends.
16 */
17#ifndef __ASM_MIPS_DEC_KN02XA_H
18#define __ASM_MIPS_DEC_KN02XA_H
19
20#include <asm/addrspace.h>
21#include <asm/dec/ioasic_addrs.h>
22
23#define KN02XA_SLOT_BASE KSEG1ADDR(0x1c000000)
24
25/*
26 * Some port addresses...
27 */
28#define KN02XA_IOASIC_BASE (KN02XA_SLOT_BASE + IOASIC_IOCTL) /* I/O ASIC */
29#define KN02XA_RTC_BASE (KN02XA_SLOT_BASE + IOASIC_TOY) /* RTC */
30
31
32/*
33 * Memory control ASIC registers.
34 */
35#define KN02XA_MER KSEG1ADDR(0x0c400000) /* memory error register */
36#define KN02XA_MSR KSEG1ADDR(0x0c800000) /* memory size register */
37
38/*
39 * CPU control ASIC registers.
40 */
41#define KN02XA_MEM_CONF KSEG1ADDR(0x0e000000) /* write timeout config */
42#define KN02XA_EAR KSEG1ADDR(0x0e000004) /* error address register */
43#define KN02XA_BOOT0 KSEG1ADDR(0x0e000008) /* boot 0 register */
44#define KN02XA_MEM_INTR KSEG1ADDR(0x0e00000c) /* write err IRQ stat & ack */
45
46/*
47 * Memory Error Register bits, common definitions.
48 * The rest is defined in system-specific headers.
49 */
50#define KN02XA_MER_RES_28 (0xf<<28) /* unused */
51#define KN02XA_MER_RES_17 (0x3ff<<17) /* unused */
52#define KN02XA_MER_PAGERR (1<<16) /* 2k page boundary error */
53#define KN02XA_MER_TRANSERR (1<<15) /* transfer length error */
54#define KN02XA_MER_PARDIS (1<<14) /* parity error disable */
55#define KN02XA_MER_RES_12 (0x3<<12) /* unused */
56#define KN02XA_MER_BYTERR (0xf<<8) /* byte lane error bitmask */
57#define KN02XA_MER_RES_0 (0xff<<0) /* unused */
58
59/*
60 * Memory Size Register bits, common definitions.
61 * The rest is defined in system-specific headers.
62 */
63#define KN02XA_MSR_RES_27 (0x1f<<27) /* unused */
64#define KN02XA_MSR_RES_14 (0x7<<14) /* unused */
65#define KN02XA_MSR_SIZE (1<<13) /* 16M/4M stride */
66#define KN02XA_MSR_RES_0 (0x1fff<<0) /* unused */
67
68/*
69 * Error Address Register bits.
70 */
71#define KN02XA_EAR_RES_29 (0x7<<29) /* unused */
72#define KN02XA_EAR_ADDRESS (0x7ffffff<<2) /* address involved */
73#define KN02XA_EAR_RES_0 (0x3<<0) /* unused */
74
75#endif /* __ASM_MIPS_DEC_KN02XA_H */
diff --git a/include/asm-mips/dec/kn03.h b/include/asm-mips/dec/kn03.h
new file mode 100644
index 000000000000..676abd17c6a4
--- /dev/null
+++ b/include/asm-mips/dec/kn03.h
@@ -0,0 +1,83 @@
1/*
2 * Hardware info about DECstation 5000/2x0 systems (otherwise known as
3 * 3max+) and DECsystem 5900 systems (otherwise known as bigmax) which
4 * differ mechanically but are otherwise identical (both are known as
5 * KN03).
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
12 * are by courtesy of Chris Fraser.
13 * Copyright (C) 2000, 2002, 2003 Maciej W. Rozycki
14 */
15#ifndef __ASM_MIPS_DEC_KN03_H
16#define __ASM_MIPS_DEC_KN03_H
17
18#include <asm/addrspace.h>
19#include <asm/dec/ecc.h>
20#include <asm/dec/ioasic_addrs.h>
21
22#define KN03_SLOT_BASE KSEG1ADDR(0x1f800000)
23
24/*
25 * Some port addresses...
26 */
27#define KN03_IOASIC_BASE (KN03_SLOT_BASE + IOASIC_IOCTL) /* I/O ASIC */
28#define KN03_RTC_BASE (KN03_SLOT_BASE + IOASIC_TOY) /* RTC */
29#define KN03_MCR_BASE (KN03_SLOT_BASE + IOASIC_MCR) /* MCR */
30
31
32/*
33 * CPU interrupt bits.
34 */
35#define KN03_CPU_INR_HALT 6 /* HALT button */
36#define KN03_CPU_INR_BUS 5 /* memory, I/O bus read/write errors */
37#define KN03_CPU_INR_RES_4 4 /* unused */
38#define KN03_CPU_INR_RTC 3 /* DS1287 RTC */
39#define KN03_CPU_INR_CASCADE 2 /* I/O ASIC cascade */
40
41/*
42 * I/O ASIC interrupt bits. Star marks denote non-IRQ status bits.
43 */
44#define KN03_IO_INR_3MAXP 15 /* (*) 3max+/bigmax ID */
45#define KN03_IO_INR_NVRAM 14 /* (*) NVRAM clear jumper */
46#define KN03_IO_INR_TC2 13 /* TURBOchannel slot #2 */
47#define KN03_IO_INR_TC1 12 /* TURBOchannel slot #1 */
48#define KN03_IO_INR_TC0 11 /* TURBOchannel slot #0 */
49#define KN03_IO_INR_NRMOD 10 /* (*) NRMOD manufacturing jumper */
50#define KN03_IO_INR_ASC 9 /* ASC (NCR53C94) SCSI */
51#define KN03_IO_INR_LANCE 8 /* LANCE (Am7990) Ethernet */
52#define KN03_IO_INR_SCC1 7 /* SCC (Z85C30) serial #1 */
53#define KN03_IO_INR_SCC0 6 /* SCC (Z85C30) serial #0 */
54#define KN03_IO_INR_RTC 5 /* DS1287 RTC */
55#define KN03_IO_INR_PSU 4 /* power supply unit warning */
56#define KN03_IO_INR_RES_3 3 /* unused */
57#define KN03_IO_INR_ASC_DATA 2 /* SCSI data ready (for PIO) */
58#define KN03_IO_INR_PBNC 1 /* ~HALT button debouncer */
59#define KN03_IO_INR_PBNO 0 /* HALT button debouncer */
60
61
62/*
63 * Memory Control Register bits.
64 */
65#define KN03_MCR_RES_16 (0xffff<<16) /* unused */
66#define KN03_MCR_DIAGCHK (1<<15) /* diagn/norml ECC reads */
67#define KN03_MCR_DIAGGEN (1<<14) /* diagn/norml ECC writes */
68#define KN03_MCR_CORRECT (1<<13) /* ECC correct/check */
69#define KN03_MCR_RES_11 (0x3<<12) /* unused */
70#define KN03_MCR_BNK32M (1<<10) /* 32M/8M stride */
71#define KN03_MCR_RES_7 (0x7<<7) /* unused */
72#define KN03_MCR_CHECK (0x7f<<0) /* diagnostic check bits */
73
74/*
75 * I/O ASIC System Support Register bits.
76 */
77#define KN03_IO_SSR_TXDIS1 (1<<14) /* SCC1 transmit disable */
78#define KN03_IO_SSR_TXDIS0 (1<<13) /* SCC0 transmit disable */
79#define KN03_IO_SSR_RES_12 (1<<12) /* unused */
80
81#define KN03_IO_SSR_LEDS (0xff<<0) /* ~diagnostic LEDs */
82
83#endif /* __ASM_MIPS_DEC_KN03_H */
diff --git a/include/asm-mips/dec/kn05.h b/include/asm-mips/dec/kn05.h
new file mode 100644
index 000000000000..b120362b8f13
--- /dev/null
+++ b/include/asm-mips/dec/kn05.h
@@ -0,0 +1,71 @@
1/*
2 * include/asm-mips/dec/kn05.h
3 *
4 * DECstation 5000/260 (4max+ or KN05) and DECsystem 5900/260
5 * definitions.
6 *
7 * Copyright (C) 2002, 2003 Maciej W. Rozycki
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 * WARNING! All this information is pure guesswork based on the
15 * ROM. It is provided here in hope it will give someone some
16 * food for thought. No documentation for the KN05 module has
17 * been located so far.
18 */
19#ifndef __ASM_MIPS_DEC_KN05_H
20#define __ASM_MIPS_DEC_KN05_H
21
22#include <asm/dec/ioasic_addrs.h>
23
24/*
25 * The oncard MB (Memory Buffer) ASIC provides an additional address
26 * decoder. Certain address ranges within the "high" 16 slots are
27 * passed to the I/O ASIC's decoder like with the KN03. Others are
28 * handled locally. "Low" slots are always passed.
29 */
30#define KN05_MB_ROM (16*IOASIC_SLOT_SIZE) /* KN05 card ROM */
31#define KN05_IOCTL (17*IOASIC_SLOT_SIZE) /* I/O ASIC */
32#define KN05_ESAR (18*IOASIC_SLOT_SIZE) /* LANCE MAC address chip */
33#define KN05_LANCE (19*IOASIC_SLOT_SIZE) /* LANCE Ethernet */
34#define KN05_MB_INT (20*IOASIC_SLOT_SIZE) /* MB interrupt register */
35#define KN05_MB_EA (21*IOASIC_SLOT_SIZE) /* MB error address? */
36#define KN05_MB_EC (22*IOASIC_SLOT_SIZE) /* MB error ??? */
37#define KN05_MB_CSR (23*IOASIC_SLOT_SIZE) /* MB control & status */
38#define KN05_RES_24 (24*IOASIC_SLOT_SIZE) /* unused? */
39#define KN05_RES_25 (25*IOASIC_SLOT_SIZE) /* unused? */
40#define KN05_RES_26 (26*IOASIC_SLOT_SIZE) /* unused? */
41#define KN05_RES_27 (27*IOASIC_SLOT_SIZE) /* unused? */
42#define KN05_SCSI (28*IOASIC_SLOT_SIZE) /* ASC SCSI */
43#define KN05_RES_29 (29*IOASIC_SLOT_SIZE) /* unused? */
44#define KN05_RES_30 (30*IOASIC_SLOT_SIZE) /* unused? */
45#define KN05_RES_31 (31*IOASIC_SLOT_SIZE) /* unused? */
46
47/*
48 * Bits for the MB interrupt register.
49 * The register appears read-only.
50 */
51#define KN05_MB_INT_TC (1<<0) /* TURBOchannel? */
52#define KN05_MB_INT_RTC (1<<1) /* RTC? */
53#define KN05_MB_INT_MT (1<<3) /* ??? */
54
55/*
56 * Bits for the MB control & status register.
57 * Set to 0x00bf8001 on my system by the ROM.
58 */
59#define KN05_MB_CSR_PF (1<<0) /* PreFetching enable? */
60#define KN05_MB_CSR_F (1<<1) /* ??? */
61#define KN05_MB_CSR_ECC (0xff<<2) /* ??? */
62#define KN05_MB_CSR_OD (1<<10) /* ??? */
63#define KN05_MB_CSR_CP (1<<11) /* ??? */
64#define KN05_MB_CSR_UNC (1<<12) /* ??? */
65#define KN05_MB_CSR_IM (1<<13) /* ??? */
66#define KN05_MB_CSR_NC (1<<14) /* ??? */
67#define KN05_MB_CSR_EE (1<<15) /* (bus) Exception Enable? */
68#define KN05_MB_CSR_MSK (0x1f<<16) /* ??? */
69#define KN05_MB_CSR_FW (1<<21) /* ??? */
70
71#endif /* __ASM_MIPS_DEC_KN05_H */
diff --git a/include/asm-mips/dec/kn230.h b/include/asm-mips/dec/kn230.h
new file mode 100644
index 000000000000..ff1bf17de8d8
--- /dev/null
+++ b/include/asm-mips/dec/kn230.h
@@ -0,0 +1,26 @@
1/*
2 * include/asm-mips/dec/kn230.h
3 *
4 * DECsystem 5100 (MIPSmate or KN230) definitions.
5 *
6 * Copyright (C) 2002, 2003 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef __ASM_MIPS_DEC_KN230_H
14#define __ASM_MIPS_DEC_KN230_H
15
16/*
17 * CPU interrupt bits.
18 */
19#define KN230_CPU_INR_HALT 6 /* HALT button */
20#define KN230_CPU_INR_BUS 5 /* memory, I/O bus read/write errors */
21#define KN230_CPU_INR_RTC 4 /* DS1287 RTC */
22#define KN230_CPU_INR_SII 3 /* SII (DC7061) SCSI */
23#define KN230_CPU_INR_LANCE 3 /* LANCE (Am7990) Ethernet */
24#define KN230_CPU_INR_DZ11 2 /* DZ11 (DC7085) serial */
25
26#endif /* __ASM_MIPS_DEC_KN230_H */
diff --git a/include/asm-mips/dec/machtype.h b/include/asm-mips/dec/machtype.h
new file mode 100644
index 000000000000..a6ecdebc430a
--- /dev/null
+++ b/include/asm-mips/dec/machtype.h
@@ -0,0 +1,27 @@
1/*
2 * Various machine type macros
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (c) 1998, 2000 Harald Koerfgen
9 */
10
11#ifndef __ASM_DEC_MACHTYPE_H
12#define __ASM_DEC_MACHTYPE_H
13
14#include <asm/bootinfo.h>
15
16#define TURBOCHANNEL (mips_machtype == MACH_DS5000_200 || \
17 mips_machtype == MACH_DS5000_1XX || \
18 mips_machtype == MACH_DS5000_XX || \
19 mips_machtype == MACH_DS5000_2X0 || \
20 mips_machtype == MACH_DS5900)
21
22#define IOASIC (mips_machtype == MACH_DS5000_1XX || \
23 mips_machtype == MACH_DS5000_XX || \
24 mips_machtype == MACH_DS5000_2X0 || \
25 mips_machtype == MACH_DS5900)
26
27#endif
diff --git a/include/asm-mips/dec/prom.h b/include/asm-mips/dec/prom.h
new file mode 100644
index 000000000000..b63e2f2317d1
--- /dev/null
+++ b/include/asm-mips/dec/prom.h
@@ -0,0 +1,173 @@
1/*
2 * include/asm-mips/dec/prom.h
3 *
4 * DECstation PROM interface.
5 *
6 * Copyright (C) 2002 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 *
13 * Based on arch/mips/dec/prom/prom.h by the Anonymous.
14 */
15#ifndef _ASM_DEC_PROM_H
16#define _ASM_DEC_PROM_H
17
18#include <linux/config.h>
19#include <linux/types.h>
20
21#include <asm/addrspace.h>
22
23/*
24 * PMAX/3MAX PROM entry points for DS2100/3100's and DS5000/2xx's.
25 * Many of these will work for MIPSen as well!
26 */
27#define VEC_RESET (u64 *)KSEG1ADDR(0x1fc00000)
28 /* Prom base address */
29
30#define PMAX_PROM_ENTRY(x) (VEC_RESET + (x)) /* Prom jump table */
31
32#define PMAX_PROM_HALT PMAX_PROM_ENTRY(2) /* valid on MIPSen */
33#define PMAX_PROM_AUTOBOOT PMAX_PROM_ENTRY(5) /* valid on MIPSen */
34#define PMAX_PROM_OPEN PMAX_PROM_ENTRY(6)
35#define PMAX_PROM_READ PMAX_PROM_ENTRY(7)
36#define PMAX_PROM_CLOSE PMAX_PROM_ENTRY(10)
37#define PMAX_PROM_LSEEK PMAX_PROM_ENTRY(11)
38#define PMAX_PROM_GETCHAR PMAX_PROM_ENTRY(12)
39#define PMAX_PROM_PUTCHAR PMAX_PROM_ENTRY(13) /* 12 on MIPSen */
40#define PMAX_PROM_GETS PMAX_PROM_ENTRY(15)
41#define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17)
42#define PMAX_PROM_GETENV PMAX_PROM_ENTRY(33) /* valid on MIPSen */
43
44
45/*
46 * Magic number indicating REX PROM available on DECstation. Found in
47 * register a2 on transfer of control to program from PROM.
48 */
49#define REX_PROM_MAGIC 0x30464354
50
51#ifdef CONFIG_MIPS64
52
53#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */
54
55#else /* !CONFIG_MIPS64 */
56
57#define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC)
58
59#endif /* !CONFIG_MIPS64 */
60
61
62/*
63 * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and
64 * DS5000/2x0.
65 */
66#define REX_PROM_GETBITMAP 0x84/4 /* get mem bitmap */
67#define REX_PROM_GETCHAR 0x24/4 /* getch() */
68#define REX_PROM_GETENV 0x64/4 /* get env. variable */
69#define REX_PROM_GETSYSID 0x80/4 /* get system id */
70#define REX_PROM_GETTCINFO 0xa4/4
71#define REX_PROM_PRINTF 0x30/4 /* printf() */
72#define REX_PROM_SLOTADDR 0x6c/4 /* slotaddr */
73#define REX_PROM_BOOTINIT 0x54/4 /* open() */
74#define REX_PROM_BOOTREAD 0x58/4 /* read() */
75#define REX_PROM_CLEARCACHE 0x7c/4
76
77
78/*
79 * Used by rex_getbitmap().
80 */
81typedef struct {
82 int pagesize;
83 unsigned char bitmap[0];
84} memmap;
85
86
87/*
88 * Function pointers as read from a PROM's callback vector.
89 */
90extern int (*__rex_bootinit)(void);
91extern int (*__rex_bootread)(void);
92extern int (*__rex_getbitmap)(memmap *);
93extern unsigned long *(*__rex_slot_address)(int);
94extern void *(*__rex_gettcinfo)(void);
95extern int (*__rex_getsysid)(void);
96extern void (*__rex_clear_cache)(void);
97
98extern int (*__prom_getchar)(void);
99extern char *(*__prom_getenv)(char *);
100extern int (*__prom_printf)(char *, ...);
101
102extern int (*__pmax_open)(char*, int);
103extern int (*__pmax_lseek)(int, long, int);
104extern int (*__pmax_read)(int, void *, int);
105extern int (*__pmax_close)(int);
106
107
108#ifdef CONFIG_MIPS64
109
110/*
111 * On MIPS64 we have to call PROM functions via a helper
112 * dispatcher to accomodate ABI incompatibilities.
113 */
114#define __DEC_PROM_O32 __attribute__((alias("call_o32")))
115
116int _rex_bootinit(int (*)(void)) __DEC_PROM_O32;
117int _rex_bootread(int (*)(void)) __DEC_PROM_O32;
118int _rex_getbitmap(int (*)(memmap *), memmap *) __DEC_PROM_O32;
119unsigned long *_rex_slot_address(unsigned long *(*)(int), int) __DEC_PROM_O32;
120void *_rex_gettcinfo(void *(*)(void)) __DEC_PROM_O32;
121int _rex_getsysid(int (*)(void)) __DEC_PROM_O32;
122void _rex_clear_cache(void (*)(void)) __DEC_PROM_O32;
123
124int _prom_getchar(int (*)(void)) __DEC_PROM_O32;
125char *_prom_getenv(char *(*)(char *), char *) __DEC_PROM_O32;
126int _prom_printf(int (*)(char *, ...), char *, ...) __DEC_PROM_O32;
127
128
129#define rex_bootinit() _rex_bootinit(__rex_bootinit)
130#define rex_bootread() _rex_bootread(__rex_bootread)
131#define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, x)
132#define rex_slot_address(x) _rex_slot_address(__rex_slot_address, x)
133#define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo)
134#define rex_getsysid() _rex_getsysid(__rex_getsysid)
135#define rex_clear_cache() _rex_clear_cache(__rex_clear_cache)
136
137#define prom_getchar() _prom_getchar(__prom_getchar)
138#define prom_getenv(x) _prom_getenv(__prom_getenv, x)
139#define prom_printf(x...) _prom_printf(__prom_printf, x)
140
141#else /* !CONFIG_MIPS64 */
142
143/*
144 * On plain MIPS we just call PROM functions directly.
145 */
146#define rex_bootinit __rex_bootinit
147#define rex_bootread __rex_bootread
148#define rex_getbitmap __rex_getbitmap
149#define rex_slot_address __rex_slot_address
150#define rex_gettcinfo __rex_gettcinfo
151#define rex_getsysid __rex_getsysid
152#define rex_clear_cache __rex_clear_cache
153
154#define prom_getchar __prom_getchar
155#define prom_getenv __prom_getenv
156#define prom_printf __prom_printf
157
158#define pmax_open __pmax_open
159#define pmax_lseek __pmax_lseek
160#define pmax_read __pmax_read
161#define pmax_close __pmax_close
162
163#endif /* !CONFIG_MIPS64 */
164
165
166extern void prom_meminit(u32);
167extern void prom_identify_arch(u32);
168extern void prom_init_cmdline(s32, s32 *, u32);
169
170extern void register_prom_console(void);
171extern void unregister_prom_console(void);
172
173#endif /* _ASM_DEC_PROM_H */
diff --git a/include/asm-mips/dec/serial.h b/include/asm-mips/dec/serial.h
new file mode 100644
index 000000000000..acad75890a05
--- /dev/null
+++ b/include/asm-mips/dec/serial.h
@@ -0,0 +1,36 @@
1/*
2 * include/asm-mips/dec/serial.h
3 *
4 * Definitions common to all DECstation serial devices.
5 *
6 * Copyright (C) 2004 Maciej W. Rozycki
7 *
8 * Based on bits extracted from drivers/tc/zs.h for which
9 * the following copyrights apply:
10 *
11 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
12 * Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au)
13 * Copyright (C) Harald Koerfgen
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20#ifndef __ASM_MIPS_DEC_SERIAL_H
21#define __ASM_MIPS_DEC_SERIAL_H
22
23struct dec_serial_hook {
24 int (*init_channel)(void *handle);
25 void (*init_info)(void *handle);
26 void (*rx_char)(unsigned char ch, unsigned char fl);
27 int (*poll_rx_char)(void *handle);
28 int (*poll_tx_char)(void *handle, unsigned char ch);
29 unsigned int cflags;
30};
31
32extern int register_dec_serial_hook(unsigned int channel,
33 struct dec_serial_hook *hook);
34extern int unregister_dec_serial_hook(unsigned int channel);
35
36#endif /* __ASM_MIPS_DEC_SERIAL_H */
diff --git a/include/asm-mips/dec/tc.h b/include/asm-mips/dec/tc.h
new file mode 100644
index 000000000000..d7bba43f863a
--- /dev/null
+++ b/include/asm-mips/dec/tc.h
@@ -0,0 +1,43 @@
1/*
2 * Interface to the TURBOchannel related routines
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (c) 1998 Harald Koerfgen
9 */
10#ifndef ASM_TC_H
11#define ASM_TC_H
12
13extern unsigned long system_base;
14
15/*
16 * Search for a TURBOchannel Option Module
17 * with a certain name. Returns slot number
18 * of the first card not in use or -ENODEV
19 * if none found.
20 */
21extern int search_tc_card(const char *);
22/*
23 * Marks the card in slot as used
24 */
25extern void claim_tc_card(int);
26/*
27 * Marks the card in slot as free
28 */
29extern void release_tc_card(int);
30/*
31 * Return base address of card in slot
32 */
33extern unsigned long get_tc_base_addr(int);
34/*
35 * Return interrupt number of slot
36 */
37extern unsigned long get_tc_irq_nr(int);
38/*
39 * Return TURBOchannel clock frequency in hz
40 */
41extern unsigned long get_tc_speed(void);
42
43#endif
diff --git a/include/asm-mips/dec/tcinfo.h b/include/asm-mips/dec/tcinfo.h
new file mode 100644
index 000000000000..cc23509ee77a
--- /dev/null
+++ b/include/asm-mips/dec/tcinfo.h
@@ -0,0 +1,47 @@
1/*
2 * Various TURBOchannel related stuff
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Information obtained through the get_tcinfo prom call
9 * created from:
10 *
11 * TURBOchannel Firmware Specification
12 *
13 * EK-TCAAD-FS-004
14 * from Digital Equipment Corporation
15 *
16 * Copyright (c) 1998 Harald Koerfgen
17 */
18
19typedef struct {
20 int revision;
21 int clk_period;
22 int slot_size;
23 int io_timeout;
24 int dma_range;
25 int max_dma_burst;
26 int parity;
27 int reserved[4];
28} tcinfo;
29
30#define MAX_SLOT 7
31
32typedef struct {
33 unsigned long base_addr;
34 unsigned char name[9];
35 unsigned char vendor[9];
36 unsigned char firmware[9];
37 int interrupt;
38 int flags;
39} slot_info;
40
41/*
42 * Values for flags
43 */
44#define FREE 1<<0
45#define IN_USE 1<<1
46
47
diff --git a/include/asm-mips/dec/tcmodule.h b/include/asm-mips/dec/tcmodule.h
new file mode 100644
index 000000000000..6268e8915d87
--- /dev/null
+++ b/include/asm-mips/dec/tcmodule.h
@@ -0,0 +1,39 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Offsets for the ROM header locations for
7 * TURBOchannel cards
8 *
9 * created from:
10 *
11 * TURBOchannel Firmware Specification
12 *
13 * EK-TCAAD-FS-004
14 * from Digital Equipment Corporation
15 *
16 * Jan.1998 Harald Koerfgen
17 */
18#ifndef __ASM_DEC_TCMODULE_H
19#define __ASM_DEC_TCMODULE_H
20
21#define OLDCARD 0x3c0000
22#define NEWCARD 0x000000
23
24#define TC_ROM_WIDTH 0x3e0
25#define TC_ROM_STRIDE 0x3e4
26#define TC_ROM_SIZE 0x3e8
27#define TC_SLOT_SIZE 0x3ec
28#define TC_PATTERN0 0x3f0
29#define TC_PATTERN1 0x3f4
30#define TC_PATTERN2 0x3f8
31#define TC_PATTERN3 0x3fc
32#define TC_FIRM_VER 0x400
33#define TC_VENDOR 0x420
34#define TC_MODULE 0x440
35#define TC_FIRM_TYPE 0x460
36#define TC_FLAGS 0x470
37#define TC_ROM_OBJECTS 0x480
38
39#endif /* __ASM_DEC_TCMODULE_H */
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
new file mode 100644
index 000000000000..d0f68447e5a7
--- /dev/null
+++ b/include/asm-mips/delay.h
@@ -0,0 +1,93 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 by Waldorf Electronics
7 * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_DELAY_H
11#define _ASM_DELAY_H
12
13#include <linux/config.h>
14#include <linux/param.h>
15
16#include <asm/compiler.h>
17
18extern unsigned long loops_per_jiffy;
19
20static inline void __delay(unsigned long loops)
21{
22 if (sizeof(long) == 4)
23 __asm__ __volatile__ (
24 ".set\tnoreorder\n"
25 "1:\tbnez\t%0,1b\n\t"
26 "subu\t%0,1\n\t"
27 ".set\treorder"
28 : "=r" (loops)
29 : "0" (loops));
30 else if (sizeof(long) == 8)
31 __asm__ __volatile__ (
32 ".set\tnoreorder\n"
33 "1:\tbnez\t%0,1b\n\t"
34 "dsubu\t%0,1\n\t"
35 ".set\treorder"
36 :"=r" (loops)
37 :"0" (loops));
38}
39
40
41/*
42 * Division by multiplication: you don't have to worry about
43 * loss of precision.
44 *
45 * Use only for very small delays ( < 1 msec). Should probably use a
46 * lookup table, really, as the multiplications take much too long with
47 * short delays. This is a "reasonable" implementation, though (and the
48 * first constant multiplications gets optimized away if the delay is
49 * a constant)
50 */
51
52static inline void __udelay(unsigned long usecs, unsigned long lpj)
53{
54 unsigned long lo;
55
56 /*
57 * The common rates of 1000 and 128 are rounded wrongly by the
58 * catchall case for 64-bit. Excessive precission? Probably ...
59 */
60#if defined(CONFIG_MIPS64) && (HZ == 128)
61 usecs *= 0x0008637bd05af6c7UL; /* 2**64 / (1000000 / HZ) */
62#elif defined(CONFIG_MIPS64) && (HZ == 1000)
63 usecs *= 0x004189374BC6A7f0UL; /* 2**64 / (1000000 / HZ) */
64#elif defined(CONFIG_MIPS64)
65 usecs *= (0x8000000000000000UL / (500000 / HZ));
66#else /* 32-bit junk follows here */
67 usecs *= (unsigned long) (((0x8000000000000000ULL / (500000 / HZ)) +
68 0x80000000ULL) >> 32);
69#endif
70
71 if (sizeof(long) == 4)
72 __asm__("multu\t%2, %3"
73 : "=h" (usecs), "=l" (lo)
74 : "r" (usecs), "r" (lpj)
75 : GCC_REG_ACCUM);
76 else if (sizeof(long) == 8)
77 __asm__("dmultu\t%2, %3"
78 : "=h" (usecs), "=l" (lo)
79 : "r" (usecs), "r" (lpj)
80 : GCC_REG_ACCUM);
81
82 __delay(usecs);
83}
84
85#ifdef CONFIG_SMP
86#define __udelay_val cpu_data[smp_processor_id()].udelay_val
87#else
88#define __udelay_val loops_per_jiffy
89#endif
90
91#define udelay(usecs) __udelay((usecs),__udelay_val)
92
93#endif /* _ASM_DELAY_H */
diff --git a/include/asm-mips/div64.h b/include/asm-mips/div64.h
new file mode 100644
index 000000000000..5f7dcf5452e7
--- /dev/null
+++ b/include/asm-mips/div64.h
@@ -0,0 +1,127 @@
1/*
2 * Copyright (C) 2000, 2004 Maciej W. Rozycki
3 * Copyright (C) 2003 Ralf Baechle
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9#ifndef _ASM_DIV64_H
10#define _ASM_DIV64_H
11
12#if (_MIPS_SZLONG == 32)
13
14#include <asm/compiler.h>
15
16/*
17 * No traps on overflows for any of these...
18 */
19
20#define do_div64_32(res, high, low, base) ({ \
21 unsigned long __quot, __mod; \
22 unsigned long __cf, __tmp, __tmp2, __i; \
23 \
24 __asm__(".set push\n\t" \
25 ".set noat\n\t" \
26 ".set noreorder\n\t" \
27 "move %2, $0\n\t" \
28 "move %3, $0\n\t" \
29 "b 1f\n\t" \
30 " li %4, 0x21\n" \
31 "0:\n\t" \
32 "sll $1, %0, 0x1\n\t" \
33 "srl %3, %0, 0x1f\n\t" \
34 "or %0, $1, %5\n\t" \
35 "sll %1, %1, 0x1\n\t" \
36 "sll %2, %2, 0x1\n" \
37 "1:\n\t" \
38 "bnez %3, 2f\n\t" \
39 " sltu %5, %0, %z6\n\t" \
40 "bnez %5, 3f\n" \
41 "2:\n\t" \
42 " addiu %4, %4, -1\n\t" \
43 "subu %0, %0, %z6\n\t" \
44 "addiu %2, %2, 1\n" \
45 "3:\n\t" \
46 "bnez %4, 0b\n\t" \
47 " srl %5, %1, 0x1f\n\t" \
48 ".set pop" \
49 : "=&r" (__mod), "=&r" (__tmp), "=&r" (__quot), "=&r" (__cf), \
50 "=&r" (__i), "=&r" (__tmp2) \
51 : "Jr" (base), "0" (high), "1" (low)); \
52 \
53 (res) = __quot; \
54 __mod; })
55
56#define do_div(n, base) ({ \
57 unsigned long long __quot; \
58 unsigned long __mod; \
59 unsigned long long __div; \
60 unsigned long __upper, __low, __high, __base; \
61 \
62 __div = (n); \
63 __base = (base); \
64 \
65 __high = __div >> 32; \
66 __low = __div; \
67 __upper = __high; \
68 \
69 if (__high) \
70 __asm__("divu $0, %z2, %z3" \
71 : "=h" (__upper), "=l" (__high) \
72 : "Jr" (__high), "Jr" (__base) \
73 : GCC_REG_ACCUM); \
74 \
75 __mod = do_div64_32(__low, __upper, __low, __base); \
76 \
77 __quot = __high; \
78 __quot = __quot << 32 | __low; \
79 (n) = __quot; \
80 __mod; })
81#endif /* (_MIPS_SZLONG == 32) */
82
83#if (_MIPS_SZLONG == 64)
84
85/*
86 * Don't use this one in new code
87 */
88#define do_div64_32(res, high, low, base) ({ \
89 unsigned int __quot, __mod; \
90 unsigned long __div; \
91 unsigned int __low, __high, __base; \
92 \
93 __high = (high); \
94 __low = (low); \
95 __div = __high; \
96 __div = __div << 32 | __low; \
97 __base = (base); \
98 \
99 __mod = __div % __base; \
100 __div = __div / __base; \
101 \
102 __quot = __div; \
103 (res) = __quot; \
104 __mod; })
105
106/*
107 * Hey, we're already 64-bit, no
108 * need to play games..
109 */
110#define do_div(n, base) ({ \
111 unsigned long __quot; \
112 unsigned int __mod; \
113 unsigned long __div; \
114 unsigned int __base; \
115 \
116 __div = (n); \
117 __base = (base); \
118 \
119 __mod = __div % __base; \
120 __quot = __div / __base; \
121 \
122 (n) = __quot; \
123 __mod; })
124
125#endif /* (_MIPS_SZLONG == 64) */
126
127#endif /* _ASM_DIV64_H */
diff --git a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h
new file mode 100644
index 000000000000..af28dc88930b
--- /dev/null
+++ b/include/asm-mips/dma-mapping.h
@@ -0,0 +1,79 @@
1#ifndef _ASM_DMA_MAPPING_H
2#define _ASM_DMA_MAPPING_H
3
4#include <asm/scatterlist.h>
5#include <asm/cache.h>
6
7void *dma_alloc_noncoherent(struct device *dev, size_t size,
8 dma_addr_t *dma_handle, int flag);
9
10void dma_free_noncoherent(struct device *dev, size_t size,
11 void *vaddr, dma_addr_t dma_handle);
12
13void *dma_alloc_coherent(struct device *dev, size_t size,
14 dma_addr_t *dma_handle, int flag);
15
16void dma_free_coherent(struct device *dev, size_t size,
17 void *vaddr, dma_addr_t dma_handle);
18
19extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
20 enum dma_data_direction direction);
21extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
22 size_t size, enum dma_data_direction direction);
23extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
24 enum dma_data_direction direction);
25extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
26 unsigned long offset, size_t size, enum dma_data_direction direction);
27extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
28 size_t size, enum dma_data_direction direction);
29extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
30 int nhwentries, enum dma_data_direction direction);
31extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
32 size_t size, enum dma_data_direction direction);
33extern void dma_sync_single_for_device(struct device *dev,
34 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction);
35extern void dma_sync_single_range_for_cpu(struct device *dev,
36 dma_addr_t dma_handle, unsigned long offset, size_t size,
37 enum dma_data_direction direction);
38extern void dma_sync_single_range_for_device(struct device *dev,
39 dma_addr_t dma_handle, unsigned long offset, size_t size,
40 enum dma_data_direction direction);
41extern void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
42 int nelems, enum dma_data_direction direction);
43extern void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
44 int nelems, enum dma_data_direction direction);
45extern int dma_mapping_error(dma_addr_t dma_addr);
46extern int dma_supported(struct device *dev, u64 mask);
47
48static inline int
49dma_set_mask(struct device *dev, u64 mask)
50{
51 if(!dev->dma_mask || !dma_supported(dev, mask))
52 return -EIO;
53
54 *dev->dma_mask = mask;
55
56 return 0;
57}
58
59static inline int
60dma_get_cache_alignment(void)
61{
62 /* XXX Largest on any MIPS */
63 return 128;
64}
65
66extern int dma_is_consistent(dma_addr_t dma_addr);
67
68extern void dma_cache_sync(void *vaddr, size_t size,
69 enum dma_data_direction direction);
70
71#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
72
73extern int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
74 dma_addr_t device_addr, size_t size, int flags);
75extern void dma_release_declared_memory(struct device *dev);
76extern void * dma_mark_declared_memory_occupied(struct device *dev,
77 dma_addr_t device_addr, size_t size);
78
79#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
new file mode 100644
index 000000000000..6aaf9939a716
--- /dev/null
+++ b/include/asm-mips/dma.h
@@ -0,0 +1,313 @@
1/*
2 * linux/include/asm/dma.h: Defines for using and allocating dma channels.
3 * Written by Hennus Bergman, 1992.
4 * High DMA channel support & info by Hannu Savolainen
5 * and John Boyd, Nov. 1992.
6 *
7 * NOTE: all this is true *only* for ISA/EISA expansions on Mips boards
8 * and can only be used for expansion cards. Onboard DMA controllers, such
9 * as the R4030 on Jazz boards behave totally different!
10 */
11
12#ifndef _ASM_DMA_H
13#define _ASM_DMA_H
14
15#include <linux/config.h>
16#include <asm/io.h> /* need byte IO */
17#include <linux/spinlock.h> /* And spinlocks */
18#include <linux/delay.h>
19#include <asm/system.h>
20
21
22#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
23#define dma_outb outb_p
24#else
25#define dma_outb outb
26#endif
27
28#define dma_inb inb
29
30/*
31 * NOTES about DMA transfers:
32 *
33 * controller 1: channels 0-3, byte operations, ports 00-1F
34 * controller 2: channels 4-7, word operations, ports C0-DF
35 *
36 * - ALL registers are 8 bits only, regardless of transfer size
37 * - channel 4 is not used - cascades 1 into 2.
38 * - channels 0-3 are byte - addresses/counts are for physical bytes
39 * - channels 5-7 are word - addresses/counts are for physical words
40 * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries
41 * - transfer count loaded to registers is 1 less than actual count
42 * - controller 2 offsets are all even (2x offsets for controller 1)
43 * - page registers for 5-7 don't use data bit 0, represent 128K pages
44 * - page registers for 0-3 use bit 0, represent 64K pages
45 *
46 * DMA transfers are limited to the lower 16MB of _physical_ memory.
47 * Note that addresses loaded into registers must be _physical_ addresses,
48 * not logical addresses (which may differ if paging is active).
49 *
50 * Address mapping for channels 0-3:
51 *
52 * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses)
53 * | ... | | ... | | ... |
54 * | ... | | ... | | ... |
55 * | ... | | ... | | ... |
56 * P7 ... P0 A7 ... A0 A7 ... A0
57 * | Page | Addr MSB | Addr LSB | (DMA registers)
58 *
59 * Address mapping for channels 5-7:
60 *
61 * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses)
62 * | ... | \ \ ... \ \ \ ... \ \
63 * | ... | \ \ ... \ \ \ ... \ (not used)
64 * | ... | \ \ ... \ \ \ ... \
65 * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0
66 * | Page | Addr MSB | Addr LSB | (DMA registers)
67 *
68 * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
69 * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at
70 * the hardware level, so odd-byte transfers aren't possible).
71 *
72 * Transfer count (_not # bytes_) is limited to 64K, represented as actual
73 * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more,
74 * and up to 128K bytes may be transferred on channels 5-7 in one operation.
75 *
76 */
77
78#define MAX_DMA_CHANNELS 8
79
80/*
81 * The maximum address in KSEG0 that we can perform a DMA transfer to on this
82 * platform. This describes only the PC style part of the DMA logic like on
83 * Deskstations or Acer PICA but not the much more versatile DMA logic used
84 * for the local devices on Acer PICA or Magnums.
85 */
86#ifdef CONFIG_SGI_IP22
87/* Horrible hack to have a correct DMA window on IP22 */
88#include <asm/sgi/mc.h>
89#define MAX_DMA_ADDRESS (PAGE_OFFSET + SGIMC_SEG0_BADDR + 0x01000000)
90#else
91#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
92#endif
93
94/* 8237 DMA controllers */
95#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
96#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
97
98/* DMA controller registers */
99#define DMA1_CMD_REG 0x08 /* command register (w) */
100#define DMA1_STAT_REG 0x08 /* status register (r) */
101#define DMA1_REQ_REG 0x09 /* request register (w) */
102#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
103#define DMA1_MODE_REG 0x0B /* mode register (w) */
104#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
105#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
106#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
107#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
108#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
109
110#define DMA2_CMD_REG 0xD0 /* command register (w) */
111#define DMA2_STAT_REG 0xD0 /* status register (r) */
112#define DMA2_REQ_REG 0xD2 /* request register (w) */
113#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
114#define DMA2_MODE_REG 0xD6 /* mode register (w) */
115#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
116#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
117#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
118#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
119#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
120
121#define DMA_ADDR_0 0x00 /* DMA address registers */
122#define DMA_ADDR_1 0x02
123#define DMA_ADDR_2 0x04
124#define DMA_ADDR_3 0x06
125#define DMA_ADDR_4 0xC0
126#define DMA_ADDR_5 0xC4
127#define DMA_ADDR_6 0xC8
128#define DMA_ADDR_7 0xCC
129
130#define DMA_CNT_0 0x01 /* DMA count registers */
131#define DMA_CNT_1 0x03
132#define DMA_CNT_2 0x05
133#define DMA_CNT_3 0x07
134#define DMA_CNT_4 0xC2
135#define DMA_CNT_5 0xC6
136#define DMA_CNT_6 0xCA
137#define DMA_CNT_7 0xCE
138
139#define DMA_PAGE_0 0x87 /* DMA page registers */
140#define DMA_PAGE_1 0x83
141#define DMA_PAGE_2 0x81
142#define DMA_PAGE_3 0x82
143#define DMA_PAGE_5 0x8B
144#define DMA_PAGE_6 0x89
145#define DMA_PAGE_7 0x8A
146
147#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
148#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
149#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
150
151#define DMA_AUTOINIT 0x10
152
153extern spinlock_t dma_spin_lock;
154
155static __inline__ unsigned long claim_dma_lock(void)
156{
157 unsigned long flags;
158 spin_lock_irqsave(&dma_spin_lock, flags);
159 return flags;
160}
161
162static __inline__ void release_dma_lock(unsigned long flags)
163{
164 spin_unlock_irqrestore(&dma_spin_lock, flags);
165}
166
167/* enable/disable a specific DMA channel */
168static __inline__ void enable_dma(unsigned int dmanr)
169{
170 if (dmanr<=3)
171 dma_outb(dmanr, DMA1_MASK_REG);
172 else
173 dma_outb(dmanr & 3, DMA2_MASK_REG);
174}
175
176static __inline__ void disable_dma(unsigned int dmanr)
177{
178 if (dmanr<=3)
179 dma_outb(dmanr | 4, DMA1_MASK_REG);
180 else
181 dma_outb((dmanr & 3) | 4, DMA2_MASK_REG);
182}
183
184/* Clear the 'DMA Pointer Flip Flop'.
185 * Write 0 for LSB/MSB, 1 for MSB/LSB access.
186 * Use this once to initialize the FF to a known state.
187 * After that, keep track of it. :-)
188 * --- In order to do that, the DMA routines below should ---
189 * --- only be used while holding the DMA lock ! ---
190 */
191static __inline__ void clear_dma_ff(unsigned int dmanr)
192{
193 if (dmanr<=3)
194 dma_outb(0, DMA1_CLEAR_FF_REG);
195 else
196 dma_outb(0, DMA2_CLEAR_FF_REG);
197}
198
199/* set mode (above) for a specific DMA channel */
200static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
201{
202 if (dmanr<=3)
203 dma_outb(mode | dmanr, DMA1_MODE_REG);
204 else
205 dma_outb(mode | (dmanr&3), DMA2_MODE_REG);
206}
207
208/* Set only the page register bits of the transfer address.
209 * This is used for successive transfers when we know the contents of
210 * the lower 16 bits of the DMA current address register, but a 64k boundary
211 * may have been crossed.
212 */
213static __inline__ void set_dma_page(unsigned int dmanr, char pagenr)
214{
215 switch(dmanr) {
216 case 0:
217 dma_outb(pagenr, DMA_PAGE_0);
218 break;
219 case 1:
220 dma_outb(pagenr, DMA_PAGE_1);
221 break;
222 case 2:
223 dma_outb(pagenr, DMA_PAGE_2);
224 break;
225 case 3:
226 dma_outb(pagenr, DMA_PAGE_3);
227 break;
228 case 5:
229 dma_outb(pagenr & 0xfe, DMA_PAGE_5);
230 break;
231 case 6:
232 dma_outb(pagenr & 0xfe, DMA_PAGE_6);
233 break;
234 case 7:
235 dma_outb(pagenr & 0xfe, DMA_PAGE_7);
236 break;
237 }
238}
239
240
241/* Set transfer address & page bits for specific DMA channel.
242 * Assumes dma flipflop is clear.
243 */
244static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
245{
246 set_dma_page(dmanr, a>>16);
247 if (dmanr <= 3) {
248 dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
249 dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
250 } else {
251 dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
252 dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
253 }
254}
255
256
257/* Set transfer size (max 64k for DMA0..3, 128k for DMA5..7) for
258 * a specific DMA channel.
259 * You must ensure the parameters are valid.
260 * NOTE: from a manual: "the number of transfers is one more
261 * than the initial word count"! This is taken into account.
262 * Assumes dma flip-flop is clear.
263 * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
264 */
265static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
266{
267 count--;
268 if (dmanr <= 3) {
269 dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
270 dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
271 } else {
272 dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
273 dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
274 }
275}
276
277
278/* Get DMA residue count. After a DMA transfer, this
279 * should return zero. Reading this while a DMA transfer is
280 * still in progress will return unpredictable results.
281 * If called before the channel has been used, it may return 1.
282 * Otherwise, it returns the number of _bytes_ left to transfer.
283 *
284 * Assumes DMA flip-flop is clear.
285 */
286static __inline__ int get_dma_residue(unsigned int dmanr)
287{
288 unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
289 : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
290
291 /* using short to get 16-bit wrap around */
292 unsigned short count;
293
294 count = 1 + dma_inb(io_port);
295 count += dma_inb(io_port) << 8;
296
297 return (dmanr<=3)? count : (count<<1);
298}
299
300
301/* These are in kernel/dma.c: */
302extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
303extern void free_dma(unsigned int dmanr); /* release it again */
304
305/* From PCI */
306
307#ifdef CONFIG_PCI
308extern int isa_dma_bridge_buggy;
309#else
310#define isa_dma_bridge_buggy (0)
311#endif
312
313#endif /* _ASM_DMA_H */
diff --git a/include/asm-mips/ds1286.h b/include/asm-mips/ds1286.h
new file mode 100644
index 000000000000..6983b6ff0af3
--- /dev/null
+++ b/include/asm-mips/ds1286.h
@@ -0,0 +1,15 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Machine dependent access functions for RTC registers.
7 *
8 * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org)
9 */
10#ifndef _ASM_DS1286_H
11#define _ASM_DS1286_H
12
13#include <ds1286.h>
14
15#endif /* _ASM_DS1286_H */
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
new file mode 100644
index 000000000000..7b92c8045cc2
--- /dev/null
+++ b/include/asm-mips/elf.h
@@ -0,0 +1,282 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 */
6#ifndef _ASM_ELF_H
7#define _ASM_ELF_H
8
9#include <linux/config.h>
10
11/* ELF header e_flags defines. */
12/* MIPS architecture level. */
13#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
14#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
15#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
16#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
17#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
18#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */
19#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */
20
21/* The ABI of a file. */
22#define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */
23#define EF_MIPS_ABI_O64 0x00002000 /* O32 extended for 64 bit. */
24
25#define PT_MIPS_REGINFO 0x70000000
26#define PT_MIPS_RTPROC 0x70000001
27#define PT_MIPS_OPTIONS 0x70000002
28
29/* Flags in the e_flags field of the header */
30#define EF_MIPS_NOREORDER 0x00000001
31#define EF_MIPS_PIC 0x00000002
32#define EF_MIPS_CPIC 0x00000004
33#define EF_MIPS_ABI2 0x00000020
34#define EF_MIPS_OPTIONS_FIRST 0x00000080
35#define EF_MIPS_32BITMODE 0x00000100
36#define EF_MIPS_ABI 0x0000f000
37#define EF_MIPS_ARCH 0xf0000000
38
39#define DT_MIPS_RLD_VERSION 0x70000001
40#define DT_MIPS_TIME_STAMP 0x70000002
41#define DT_MIPS_ICHECKSUM 0x70000003
42#define DT_MIPS_IVERSION 0x70000004
43#define DT_MIPS_FLAGS 0x70000005
44 #define RHF_NONE 0x00000000
45 #define RHF_HARDWAY 0x00000001
46 #define RHF_NOTPOT 0x00000002
47 #define RHF_SGI_ONLY 0x00000010
48#define DT_MIPS_BASE_ADDRESS 0x70000006
49#define DT_MIPS_CONFLICT 0x70000008
50#define DT_MIPS_LIBLIST 0x70000009
51#define DT_MIPS_LOCAL_GOTNO 0x7000000a
52#define DT_MIPS_CONFLICTNO 0x7000000b
53#define DT_MIPS_LIBLISTNO 0x70000010
54#define DT_MIPS_SYMTABNO 0x70000011
55#define DT_MIPS_UNREFEXTNO 0x70000012
56#define DT_MIPS_GOTSYM 0x70000013
57#define DT_MIPS_HIPAGENO 0x70000014
58#define DT_MIPS_RLD_MAP 0x70000016
59
60#define R_MIPS_NONE 0
61#define R_MIPS_16 1
62#define R_MIPS_32 2
63#define R_MIPS_REL32 3
64#define R_MIPS_26 4
65#define R_MIPS_HI16 5
66#define R_MIPS_LO16 6
67#define R_MIPS_GPREL16 7
68#define R_MIPS_LITERAL 8
69#define R_MIPS_GOT16 9
70#define R_MIPS_PC16 10
71#define R_MIPS_CALL16 11
72#define R_MIPS_GPREL32 12
73/* The remaining relocs are defined on Irix, although they are not
74 in the MIPS ELF ABI. */
75#define R_MIPS_UNUSED1 13
76#define R_MIPS_UNUSED2 14
77#define R_MIPS_UNUSED3 15
78#define R_MIPS_SHIFT5 16
79#define R_MIPS_SHIFT6 17
80#define R_MIPS_64 18
81#define R_MIPS_GOT_DISP 19
82#define R_MIPS_GOT_PAGE 20
83#define R_MIPS_GOT_OFST 21
84/*
85 * The following two relocation types are specified in the MIPS ABI
86 * conformance guide version 1.2 but not yet in the psABI.
87 */
88#define R_MIPS_GOTHI16 22
89#define R_MIPS_GOTLO16 23
90#define R_MIPS_SUB 24
91#define R_MIPS_INSERT_A 25
92#define R_MIPS_INSERT_B 26
93#define R_MIPS_DELETE 27
94#define R_MIPS_HIGHER 28
95#define R_MIPS_HIGHEST 29
96/*
97 * The following two relocation types are specified in the MIPS ABI
98 * conformance guide version 1.2 but not yet in the psABI.
99 */
100#define R_MIPS_CALLHI16 30
101#define R_MIPS_CALLLO16 31
102/*
103 * This range is reserved for vendor specific relocations.
104 */
105#define R_MIPS_LOVENDOR 100
106#define R_MIPS_HIVENDOR 127
107
108#define SHN_MIPS_ACCOMON 0xff00
109
110#define SHT_MIPS_LIST 0x70000000
111#define SHT_MIPS_CONFLICT 0x70000002
112#define SHT_MIPS_GPTAB 0x70000003
113#define SHT_MIPS_UCODE 0x70000004
114
115#define SHF_MIPS_GPREL 0x10000000
116
117#ifndef ELF_ARCH
118/* ELF register definitions */
119#define ELF_NGREG 45
120#define ELF_NFPREG 33
121
122typedef unsigned long elf_greg_t;
123typedef elf_greg_t elf_gregset_t[ELF_NGREG];
124
125typedef double elf_fpreg_t;
126typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
127
128#ifdef CONFIG_MIPS32
129
130/*
131 * This is used to ensure we don't load something for the wrong architecture.
132 */
133#define elf_check_arch(hdr) \
134({ \
135 int __res = 1; \
136 struct elfhdr *__h = (hdr); \
137 \
138 if (__h->e_machine != EM_MIPS) \
139 __res = 0; \
140 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
141 __res = 0; \
142 if ((__h->e_flags & EF_MIPS_ABI2) != 0) \
143 __res = 0; \
144 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
145 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
146 __res = 0; \
147 \
148 __res; \
149})
150
151/*
152 * These are used to set parameters in the core dumps.
153 */
154#define ELF_CLASS ELFCLASS32
155
156#endif /* CONFIG_MIPS32 */
157
158#ifdef CONFIG_MIPS64
159/*
160 * This is used to ensure we don't load something for the wrong architecture.
161 */
162#define elf_check_arch(hdr) \
163({ \
164 int __res = 1; \
165 struct elfhdr *__h = (hdr); \
166 \
167 if (__h->e_machine != EM_MIPS) \
168 __res = 0; \
169 if (__h->e_ident[EI_CLASS] != ELFCLASS64) \
170 __res = 0; \
171 \
172 __res; \
173})
174
175/*
176 * These are used to set parameters in the core dumps.
177 */
178#define ELF_CLASS ELFCLASS64
179
180#endif /* CONFIG_MIPS64 */
181
182/*
183 * These are used to set parameters in the core dumps.
184 */
185#ifdef __MIPSEB__
186#define ELF_DATA ELFDATA2MSB
187#elif __MIPSEL__
188#define ELF_DATA ELFDATA2LSB
189#endif
190#define ELF_ARCH EM_MIPS
191
192#endif /* !defined(ELF_ARCH) */
193
194#ifdef __KERNEL__
195
196#ifdef CONFIG_MIPS32
197
198#define SET_PERSONALITY(ex, ibcs2) \
199do { \
200 if (ibcs2) \
201 set_personality(PER_SVR4); \
202 set_personality(PER_LINUX); \
203} while (0)
204
205#endif /* CONFIG_MIPS32 */
206
207#ifdef CONFIG_MIPS64
208
209#define SET_PERSONALITY(ex, ibcs2) \
210do { current->thread.mflags &= ~MF_ABI_MASK; \
211 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) { \
212 if ((((ex).e_flags & EF_MIPS_ABI2) != 0) && \
213 ((ex).e_flags & EF_MIPS_ABI) == 0) \
214 current->thread.mflags |= MF_N32; \
215 else \
216 current->thread.mflags |= MF_O32; \
217 } else \
218 current->thread.mflags |= MF_N64; \
219 if (ibcs2) \
220 set_personality(PER_SVR4); \
221 else if (current->personality != PER_LINUX32) \
222 set_personality(PER_LINUX); \
223} while (0)
224
225#endif /* CONFIG_MIPS64 */
226
227extern void dump_regs(elf_greg_t *, struct pt_regs *regs);
228extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
229
230#define ELF_CORE_COPY_REGS(elf_regs, regs) \
231 dump_regs((elf_greg_t *)&(elf_regs), regs);
232#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \
233 dump_task_fpu(tsk, elf_fpregs)
234
235#endif /* __KERNEL__ */
236
237/* This one accepts IRIX binaries. */
238#define irix_elf_check_arch(hdr) ((hdr)->e_flags & RHF_SGI_ONLY)
239
240#define USE_ELF_CORE_DUMP
241#define ELF_EXEC_PAGESIZE PAGE_SIZE
242
243/* This yields a mask that user programs can use to figure out what
244 instruction set this cpu supports. This could be done in userspace,
245 but it's not easy, and we've already done it here. */
246
247#define ELF_HWCAP (0)
248
249/* This yields a string that ld.so will use to load implementation
250 specific libraries for optimization. This is more specific in
251 intent than poking at uname or /proc/cpuinfo.
252
253 For the moment, we have only optimizations for the Intel generations,
254 but that could change... */
255
256#define ELF_PLATFORM (NULL)
257
258/*
259 * See comments in asm-alpha/elf.h, this is the same thing
260 * on the MIPS.
261 */
262#define ELF_PLAT_INIT(_r, load_addr) do { \
263 _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \
264 _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \
265 _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \
266 _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; \
267 _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; \
268 _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; \
269 _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; \
270 _r->regs[30] = _r->regs[31] = 0; \
271} while (0)
272
273/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
274 use of this is to invoke "./ld.so someprog" to test out a new version of
275 the loader. We need to make sure that it is out of the way of the program
276 that it will "exec", and that there is sufficient room for the brk. */
277
278#ifndef ELF_ET_DYN_BASE
279#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
280#endif
281
282#endif /* _ASM_ELF_H */
diff --git a/include/asm-mips/errno.h b/include/asm-mips/errno.h
new file mode 100644
index 000000000000..2b458f9538cd
--- /dev/null
+++ b/include/asm-mips/errno.h
@@ -0,0 +1,127 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1999, 2001, 2002 by Ralf Baechle
7 */
8#ifndef _ASM_ERRNO_H
9#define _ASM_ERRNO_H
10
11/*
12 * These error numbers are intended to be MIPS ABI compatible
13 */
14
15#include <asm-generic/errno-base.h>
16
17#define ENOMSG 35 /* No message of desired type */
18#define EIDRM 36 /* Identifier removed */
19#define ECHRNG 37 /* Channel number out of range */
20#define EL2NSYNC 38 /* Level 2 not synchronized */
21#define EL3HLT 39 /* Level 3 halted */
22#define EL3RST 40 /* Level 3 reset */
23#define ELNRNG 41 /* Link number out of range */
24#define EUNATCH 42 /* Protocol driver not attached */
25#define ENOCSI 43 /* No CSI structure available */
26#define EL2HLT 44 /* Level 2 halted */
27#define EDEADLK 45 /* Resource deadlock would occur */
28#define ENOLCK 46 /* No record locks available */
29#define EBADE 50 /* Invalid exchange */
30#define EBADR 51 /* Invalid request descriptor */
31#define EXFULL 52 /* Exchange full */
32#define ENOANO 53 /* No anode */
33#define EBADRQC 54 /* Invalid request code */
34#define EBADSLT 55 /* Invalid slot */
35#define EDEADLOCK 56 /* File locking deadlock error */
36#define EBFONT 59 /* Bad font file format */
37#define ENOSTR 60 /* Device not a stream */
38#define ENODATA 61 /* No data available */
39#define ETIME 62 /* Timer expired */
40#define ENOSR 63 /* Out of streams resources */
41#define ENONET 64 /* Machine is not on the network */
42#define ENOPKG 65 /* Package not installed */
43#define EREMOTE 66 /* Object is remote */
44#define ENOLINK 67 /* Link has been severed */
45#define EADV 68 /* Advertise error */
46#define ESRMNT 69 /* Srmount error */
47#define ECOMM 70 /* Communication error on send */
48#define EPROTO 71 /* Protocol error */
49#define EDOTDOT 73 /* RFS specific error */
50#define EMULTIHOP 74 /* Multihop attempted */
51#define EBADMSG 77 /* Not a data message */
52#define ENAMETOOLONG 78 /* File name too long */
53#define EOVERFLOW 79 /* Value too large for defined data type */
54#define ENOTUNIQ 80 /* Name not unique on network */
55#define EBADFD 81 /* File descriptor in bad state */
56#define EREMCHG 82 /* Remote address changed */
57#define ELIBACC 83 /* Can not access a needed shared library */
58#define ELIBBAD 84 /* Accessing a corrupted shared library */
59#define ELIBSCN 85 /* .lib section in a.out corrupted */
60#define ELIBMAX 86 /* Attempting to link in too many shared libraries */
61#define ELIBEXEC 87 /* Cannot exec a shared library directly */
62#define EILSEQ 88 /* Illegal byte sequence */
63#define ENOSYS 89 /* Function not implemented */
64#define ELOOP 90 /* Too many symbolic links encountered */
65#define ERESTART 91 /* Interrupted system call should be restarted */
66#define ESTRPIPE 92 /* Streams pipe error */
67#define ENOTEMPTY 93 /* Directory not empty */
68#define EUSERS 94 /* Too many users */
69#define ENOTSOCK 95 /* Socket operation on non-socket */
70#define EDESTADDRREQ 96 /* Destination address required */
71#define EMSGSIZE 97 /* Message too long */
72#define EPROTOTYPE 98 /* Protocol wrong type for socket */
73#define ENOPROTOOPT 99 /* Protocol not available */
74#define EPROTONOSUPPORT 120 /* Protocol not supported */
75#define ESOCKTNOSUPPORT 121 /* Socket type not supported */
76#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */
77#define EPFNOSUPPORT 123 /* Protocol family not supported */
78#define EAFNOSUPPORT 124 /* Address family not supported by protocol */
79#define EADDRINUSE 125 /* Address already in use */
80#define EADDRNOTAVAIL 126 /* Cannot assign requested address */
81#define ENETDOWN 127 /* Network is down */
82#define ENETUNREACH 128 /* Network is unreachable */
83#define ENETRESET 129 /* Network dropped connection because of reset */
84#define ECONNABORTED 130 /* Software caused connection abort */
85#define ECONNRESET 131 /* Connection reset by peer */
86#define ENOBUFS 132 /* No buffer space available */
87#define EISCONN 133 /* Transport endpoint is already connected */
88#define ENOTCONN 134 /* Transport endpoint is not connected */
89#define EUCLEAN 135 /* Structure needs cleaning */
90#define ENOTNAM 137 /* Not a XENIX named type file */
91#define ENAVAIL 138 /* No XENIX semaphores available */
92#define EISNAM 139 /* Is a named type file */
93#define EREMOTEIO 140 /* Remote I/O error */
94#define EINIT 141 /* Reserved */
95#define EREMDEV 142 /* Error 142 */
96#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */
97#define ETOOMANYREFS 144 /* Too many references: cannot splice */
98#define ETIMEDOUT 145 /* Connection timed out */
99#define ECONNREFUSED 146 /* Connection refused */
100#define EHOSTDOWN 147 /* Host is down */
101#define EHOSTUNREACH 148 /* No route to host */
102#define EWOULDBLOCK EAGAIN /* Operation would block */
103#define EALREADY 149 /* Operation already in progress */
104#define EINPROGRESS 150 /* Operation now in progress */
105#define ESTALE 151 /* Stale NFS file handle */
106#define ECANCELED 158 /* AIO operation canceled */
107
108/*
109 * These error are Linux extensions.
110 */
111#define ENOMEDIUM 159 /* No medium found */
112#define EMEDIUMTYPE 160 /* Wrong medium type */
113#define ENOKEY 161 /* Required key not available */
114#define EKEYEXPIRED 162 /* Key has expired */
115#define EKEYREVOKED 163 /* Key has been revoked */
116#define EKEYREJECTED 164 /* Key was rejected by service */
117
118#define EDQUOT 1133 /* Quota exceeded */
119
120#ifdef __KERNEL__
121
122/* The biggest error number defined here or in <linux/errno.h>. */
123#define EMAXERRNO 1133
124
125#endif /* __KERNEL__ */
126
127#endif /* _ASM_ERRNO_H */
diff --git a/include/asm-mips/fcntl.h b/include/asm-mips/fcntl.h
new file mode 100644
index 000000000000..2436392e7990
--- /dev/null
+++ b/include/asm-mips/fcntl.h
@@ -0,0 +1,125 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 96, 97, 98, 99, 2003 Ralf Baechle
7 */
8#ifndef _ASM_FCNTL_H
9#define _ASM_FCNTL_H
10
11/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
12 located on an ext2 file system */
13#define O_ACCMODE 0x0003
14#define O_RDONLY 0x0000
15#define O_WRONLY 0x0001
16#define O_RDWR 0x0002
17#define O_APPEND 0x0008
18#define O_SYNC 0x0010
19#define O_NONBLOCK 0x0080
20#define O_CREAT 0x0100 /* not fcntl */
21#define O_TRUNC 0x0200 /* not fcntl */
22#define O_EXCL 0x0400 /* not fcntl */
23#define O_NOCTTY 0x0800 /* not fcntl */
24#define FASYNC 0x1000 /* fcntl, for BSD compatibility */
25#define O_LARGEFILE 0x2000 /* allow large file opens */
26#define O_DIRECT 0x8000 /* direct disk access hint */
27#define O_DIRECTORY 0x10000 /* must be a directory */
28#define O_NOFOLLOW 0x20000 /* don't follow links */
29#define O_NOATIME 0x40000
30
31#define O_NDELAY O_NONBLOCK
32
33#define F_DUPFD 0 /* dup */
34#define F_GETFD 1 /* get close_on_exec */
35#define F_SETFD 2 /* set/clear close_on_exec */
36#define F_GETFL 3 /* get file->f_flags */
37#define F_SETFL 4 /* set file->f_flags */
38#define F_GETLK 14
39#define F_SETLK 6
40#define F_SETLKW 7
41
42#define F_SETOWN 24 /* for sockets. */
43#define F_GETOWN 23 /* for sockets. */
44#define F_SETSIG 10 /* for sockets. */
45#define F_GETSIG 11 /* for sockets. */
46
47#ifndef __mips64
48#define F_GETLK64 33 /* using 'struct flock64' */
49#define F_SETLK64 34
50#define F_SETLKW64 35
51#endif
52
53/* for F_[GET|SET]FL */
54#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
55
56/* for posix fcntl() and lockf() */
57#define F_RDLCK 0
58#define F_WRLCK 1
59#define F_UNLCK 2
60
61/* for old implementation of bsd flock () */
62#define F_EXLCK 4 /* or 3 */
63#define F_SHLCK 8 /* or 4 */
64
65/* for leases */
66#define F_INPROGRESS 16
67
68/* operations for bsd flock(), also used by the kernel implementation */
69#define LOCK_SH 1 /* shared lock */
70#define LOCK_EX 2 /* exclusive lock */
71#define LOCK_NB 4 /* or'd with one of the above to prevent
72 blocking */
73#define LOCK_UN 8 /* remove lock */
74
75#define LOCK_MAND 32 /* This is a mandatory flock */
76#define LOCK_READ 64 /* ... Which allows concurrent read operations */
77#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
78#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
79
80/*
81 * The flavours of struct flock. "struct flock" is the ABI compliant
82 * variant. Finally struct flock64 is the LFS variant of struct flock. As
83 * a historic accident and inconsistence with the ABI definition it doesn't
84 * contain all the same fields as struct flock.
85 */
86
87#ifndef __mips64
88
89typedef struct flock {
90 short l_type;
91 short l_whence;
92 __kernel_off_t l_start;
93 __kernel_off_t l_len;
94 long l_sysid;
95 __kernel_pid_t l_pid;
96 long pad[4];
97} flock_t;
98
99typedef struct flock64 {
100 short l_type;
101 short l_whence;
102 loff_t l_start;
103 loff_t l_len;
104 pid_t l_pid;
105} flock64_t;
106
107#else /* 64-bit definitions */
108
109typedef struct flock {
110 short l_type;
111 short l_whence;
112 __kernel_off_t l_start;
113 __kernel_off_t l_len;
114 __kernel_pid_t l_pid;
115} flock_t;
116
117#ifdef __KERNEL__
118#define flock64 flock
119#endif
120
121#endif
122
123#define F_LINUX_SPECIFIC_BASE 1024
124
125#endif /* _ASM_FCNTL_H */
diff --git a/include/asm-mips/fixmap.h b/include/asm-mips/fixmap.h
new file mode 100644
index 000000000000..26b6a90a690b
--- /dev/null
+++ b/include/asm-mips/fixmap.h
@@ -0,0 +1,110 @@
1/*
2 * fixmap.h: compile-time virtual memory allocation
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1998 Ingo Molnar
9 *
10 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
11 */
12
13#ifndef _ASM_FIXMAP_H
14#define _ASM_FIXMAP_H
15
16#include <linux/config.h>
17#include <asm/page.h>
18#ifdef CONFIG_HIGHMEM
19#include <linux/threads.h>
20#include <asm/kmap_types.h>
21#endif
22
23/*
24 * Here we define all the compile-time 'special' virtual
25 * addresses. The point is to have a constant address at
26 * compile time, but to set the physical address only
27 * in the boot process. We allocate these special addresses
28 * from the end of virtual memory (0xfffff000) backwards.
29 * Also this lets us do fail-safe vmalloc(), we
30 * can guarantee that these special addresses and
31 * vmalloc()-ed addresses never overlap.
32 *
33 * these 'compile-time allocated' memory buffers are
34 * fixed-size 4k pages. (or larger if used with an increment
35 * highger than 1) use fixmap_set(idx,phys) to associate
36 * physical memory with fixmap indices.
37 *
38 * TLB entries of such buffers will not be flushed across
39 * task switches.
40 */
41
42/*
43 * on UP currently we will have no trace of the fixmap mechanizm,
44 * no page table allocations, etc. This might change in the
45 * future, say framebuffers for the console driver(s) could be
46 * fix-mapped?
47 */
48enum fixed_addresses {
49#ifdef CONFIG_HIGHMEM
50 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
51 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
52#endif
53 __end_of_fixed_addresses
54};
55
56extern void __set_fixmap (enum fixed_addresses idx,
57 unsigned long phys, pgprot_t flags);
58
59#define set_fixmap(idx, phys) \
60 __set_fixmap(idx, phys, PAGE_KERNEL)
61/*
62 * Some hardware wants to get fixmapped without caching.
63 */
64#define set_fixmap_nocache(idx, phys) \
65 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
66/*
67 * used by vmalloc.c.
68 *
69 * Leave one empty page between vmalloc'ed areas and
70 * the start of the fixmap, and leave one page empty
71 * at the top of mem..
72 */
73#define FIXADDR_TOP (0xffffe000UL)
74#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
75#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
76
77#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
78#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
79
80extern void __this_fixmap_does_not_exist(void);
81
82/*
83 * 'index to address' translation. If anyone tries to use the idx
84 * directly without tranlation, we catch the bug with a NULL-deference
85 * kernel oops. Illegal ranges of incoming indices are caught too.
86 */
87static inline unsigned long fix_to_virt(const unsigned int idx)
88{
89 /*
90 * this branch gets completely eliminated after inlining,
91 * except when someone tries to use fixaddr indices in an
92 * illegal way. (such as mixing up address types or using
93 * out-of-range indices).
94 *
95 * If it doesn't get removed, the linker will complain
96 * loudly with a reasonably clear error message..
97 */
98 if (idx >= __end_of_fixed_addresses)
99 __this_fixmap_does_not_exist();
100
101 return __fix_to_virt(idx);
102}
103
104static inline unsigned long virt_to_fix(const unsigned long vaddr)
105{
106 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
107 return __virt_to_fix(vaddr);
108}
109
110#endif
diff --git a/include/asm-mips/floppy.h b/include/asm-mips/floppy.h
new file mode 100644
index 000000000000..aa1ef8b352cc
--- /dev/null
+++ b/include/asm-mips/floppy.h
@@ -0,0 +1,56 @@
1/*
2 * Architecture specific parts of the Floppy driver
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995 - 2000 Ralf Baechle
9 */
10#ifndef _ASM_FLOPPY_H
11#define _ASM_FLOPPY_H
12
13static inline void fd_cacheflush(char * addr, long size)
14{
15 dma_cache_wback_inv((unsigned long)addr,size);
16}
17
18#define MAX_BUFFER_SECTORS 24
19
20
21/*
22 * And on Mips's the CMOS info fails also ...
23 *
24 * FIXME: This information should come from the ARC configuration tree
25 * or whereever a particular machine has stored this ...
26 */
27#define FLOPPY0_TYPE fd_drive_type(0)
28#define FLOPPY1_TYPE fd_drive_type(1)
29
30#define FDC1 fd_getfdaddr1();
31
32#define N_FDC 1 /* do you *really* want a second controller? */
33#define N_DRIVE 8
34
35#define FLOPPY_MOTOR_MASK 0xf0
36
37/*
38 * The DMA channel used by the floppy controller cannot access data at
39 * addresses >= 16MB
40 *
41 * Went back to the 1MB limit, as some people had problems with the floppy
42 * driver otherwise. It doesn't matter much for performance anyway, as most
43 * floppy accesses go through the track buffer.
44 *
45 * On MIPSes using vdma, this actually means that *all* transfers go thru
46 * the * track buffer since 0x1000000 is always smaller than KSEG0/1.
47 * Actually this needs to be a bit more complicated since the so much different
48 * hardware available with MIPS CPUs ...
49 */
50#define CROSS_64KB(a,s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)
51
52#define EXTRA_FLOPPY_PARAMS
53
54#include <floppy.h>
55
56#endif /* _ASM_FLOPPY_H */
diff --git a/include/asm-mips/fpregdef.h b/include/asm-mips/fpregdef.h
new file mode 100644
index 000000000000..1d9aa0979181
--- /dev/null
+++ b/include/asm-mips/fpregdef.h
@@ -0,0 +1,99 @@
1/*
2 * Definitions for the FPU register names
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995, 1999 Ralf Baechle
9 * Copyright (C) 1985 MIPS Computer Systems, Inc.
10 * Copyright (C) 1990 - 1992, 1999 Silicon Graphics, Inc.
11 */
12#ifndef _ASM_FPREGDEF_H
13#define _ASM_FPREGDEF_H
14
15#include <asm/sgidefs.h>
16
17#if _MIPS_SIM == _MIPS_SIM_ABI32
18
19/*
20 * These definitions only cover the R3000-ish 16/32 register model.
21 * But we're trying to be R3000 friendly anyway ...
22 */
23#define fv0 $f0 /* return value */
24#define fv0f $f1
25#define fv1 $f2
26#define fv1f $f3
27#define fa0 $f12 /* argument registers */
28#define fa0f $f13
29#define fa1 $f14
30#define fa1f $f15
31#define ft0 $f4 /* caller saved */
32#define ft0f $f5
33#define ft1 $f6
34#define ft1f $f7
35#define ft2 $f8
36#define ft2f $f9
37#define ft3 $f10
38#define ft3f $f11
39#define ft4 $f16
40#define ft4f $f17
41#define ft5 $f18
42#define ft5f $f19
43#define fs0 $f20 /* callee saved */
44#define fs0f $f21
45#define fs1 $f22
46#define fs1f $f23
47#define fs2 $f24
48#define fs2f $f25
49#define fs3 $f26
50#define fs3f $f27
51#define fs4 $f28
52#define fs4f $f29
53#define fs5 $f30
54#define fs5f $f31
55
56#define fcr31 $31 /* FPU status register */
57
58#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
59
60#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
61
62#define fv0 $f0 /* return value */
63#define fv1 $f2
64#define fa0 $f12 /* argument registers */
65#define fa1 $f13
66#define fa2 $f14
67#define fa3 $f15
68#define fa4 $f16
69#define fa5 $f17
70#define fa6 $f18
71#define fa7 $f19
72#define ft0 $f4 /* caller saved */
73#define ft1 $f5
74#define ft2 $f6
75#define ft3 $f7
76#define ft4 $f8
77#define ft5 $f9
78#define ft6 $f10
79#define ft7 $f11
80#define ft8 $f20
81#define ft9 $f21
82#define ft10 $f22
83#define ft11 $f23
84#define ft12 $f1
85#define ft13 $f3
86#define fs0 $f24 /* callee saved */
87#define fs1 $f25
88#define fs2 $f26
89#define fs3 $f27
90#define fs4 $f28
91#define fs5 $f29
92#define fs6 $f30
93#define fs7 $f31
94
95#define fcr31 $31
96
97#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
98
99#endif /* _ASM_FPREGDEF_H */
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
new file mode 100644
index 000000000000..6cb38d5c0407
--- /dev/null
+++ b/include/asm-mips/fpu.h
@@ -0,0 +1,138 @@
1/*
2 * Copyright (C) 2002 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#ifndef _ASM_FPU_H
11#define _ASM_FPU_H
12
13#include <linux/config.h>
14#include <linux/sched.h>
15#include <linux/thread_info.h>
16
17#include <asm/mipsregs.h>
18#include <asm/cpu.h>
19#include <asm/cpu-features.h>
20#include <asm/bitops.h>
21#include <asm/processor.h>
22#include <asm/current.h>
23
24struct sigcontext;
25struct sigcontext32;
26
27extern asmlinkage int (*save_fp_context)(struct sigcontext *sc);
28extern asmlinkage int (*restore_fp_context)(struct sigcontext *sc);
29
30extern asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc);
31extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc);
32
33extern void fpu_emulator_init_fpu(void);
34extern void _init_fpu(void);
35extern void _save_fp(struct task_struct *);
36extern void _restore_fp(struct task_struct *);
37
38#if defined(CONFIG_CPU_SB1)
39#define __enable_fpu_hazard() \
40do { \
41 asm(".set push \n\t" \
42 ".set mips64 \n\t" \
43 ".set noreorder \n\t" \
44 "ssnop \n\t" \
45 "bnezl $0, .+4 \n\t" \
46 "ssnop \n\t" \
47 ".set pop"); \
48} while (0)
49#else
50#define __enable_fpu_hazard() \
51do { \
52 asm("nop;nop;nop;nop"); /* max. hazard */ \
53} while (0)
54#endif
55
56#define __enable_fpu() \
57do { \
58 set_c0_status(ST0_CU1); \
59 __enable_fpu_hazard(); \
60} while (0)
61
62#define __disable_fpu() \
63do { \
64 clear_c0_status(ST0_CU1); \
65 /* We don't care about the c0 hazard here */ \
66} while (0)
67
68#define enable_fpu() \
69do { \
70 if (cpu_has_fpu) \
71 __enable_fpu(); \
72} while (0)
73
74#define disable_fpu() \
75do { \
76 if (cpu_has_fpu) \
77 __disable_fpu(); \
78} while (0)
79
80
81#define clear_fpu_owner() clear_thread_flag(TIF_USEDFPU)
82
83static inline int is_fpu_owner(void)
84{
85 return cpu_has_fpu && test_thread_flag(TIF_USEDFPU);
86}
87
88static inline void own_fpu(void)
89{
90 if (cpu_has_fpu) {
91 __enable_fpu();
92 KSTK_STATUS(current) |= ST0_CU1;
93 set_thread_flag(TIF_USEDFPU);
94 }
95}
96
97static inline void lose_fpu(void)
98{
99 if (cpu_has_fpu) {
100 KSTK_STATUS(current) &= ~ST0_CU1;
101 clear_thread_flag(TIF_USEDFPU);
102 __disable_fpu();
103 }
104}
105
106static inline void init_fpu(void)
107{
108 if (cpu_has_fpu) {
109 _init_fpu();
110 } else {
111 fpu_emulator_init_fpu();
112 }
113}
114
115static inline void save_fp(struct task_struct *tsk)
116{
117 if (cpu_has_fpu)
118 _save_fp(tsk);
119}
120
121static inline void restore_fp(struct task_struct *tsk)
122{
123 if (cpu_has_fpu)
124 _restore_fp(tsk);
125}
126
127static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
128{
129 if (cpu_has_fpu) {
130 if ((tsk == current) && is_fpu_owner())
131 _save_fp(current);
132 return tsk->thread.fpu.hard.fpr;
133 }
134
135 return tsk->thread.fpu.soft.fpr;
136}
137
138#endif /* _ASM_FPU_H */
diff --git a/include/asm-mips/fpu_emulator.h b/include/asm-mips/fpu_emulator.h
new file mode 100644
index 000000000000..46972ae2b95d
--- /dev/null
+++ b/include/asm-mips/fpu_emulator.h
@@ -0,0 +1,38 @@
1/*
2 * This program is free software; you can distribute it and/or modify it
3 * under the terms of the GNU General Public License (Version 2) as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope it will be useful, but WITHOUT
7 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9 * for more details.
10 *
11 * You should have received a copy of the GNU General Public License along
12 * with this program; if not, write to the Free Software Foundation, Inc.,
13 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
14 *
15 * Further private data for which no space exists in mips_fpu_soft_struct.
16 * This should be subsumed into the mips_fpu_soft_struct structure as
17 * defined in processor.h as soon as the absurd wired absolute assembler
18 * offsets become dynamic at compile time.
19 *
20 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
21 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
22 */
23#ifndef _ASM_FPU_EMULATOR_H
24#define _ASM_FPU_EMULATOR_H
25
26struct mips_fpu_emulator_private {
27 unsigned int eir;
28 struct {
29 unsigned int emulated;
30 unsigned int loads;
31 unsigned int stores;
32 unsigned int cp1ops;
33 unsigned int cp1xops;
34 unsigned int errors;
35 } stats;
36};
37
38#endif /* _ASM_FPU_EMULATOR_H */
diff --git a/include/asm-mips/galileo-boards/ev96100.h b/include/asm-mips/galileo-boards/ev96100.h
new file mode 100644
index 000000000000..070dfd84a8e8
--- /dev/null
+++ b/include/asm-mips/galileo-boards/ev96100.h
@@ -0,0 +1,55 @@
1/*
2 *
3 */
4#ifndef _MIPS_EV96100_H
5#define _MIPS_EV96100_H
6
7#include <asm/addrspace.h>
8
9/*
10 * GT64120 config space base address
11 */
12#define GT64120_BASE (KSEG1ADDR(0x14000000))
13#define MIPS_GT_BASE GT64120_BASE
14
15/*
16 * PCI Bus allocation
17 */
18#define GT_PCI_MEM_BASE 0x12000000UL
19#define GT_PCI_MEM_SIZE 0x02000000UL
20#define GT_PCI_IO_BASE 0x10000000UL
21#define GT_PCI_IO_SIZE 0x02000000UL
22#define GT_ISA_IO_BASE PCI_IO_BASE
23
24/*
25 * Duart I/O ports.
26 */
27#define EV96100_COM1_BASE_ADDR (0xBD000000 + 0x20)
28#define EV96100_COM2_BASE_ADDR (0xBD000000 + 0x00)
29
30
31/*
32 * EV96100 interrupt controller register base.
33 */
34#define EV96100_ICTRL_REGS_BASE (KSEG1ADDR(0x1f000000))
35
36/*
37 * EV96100 UART register base.
38 */
39#define EV96100_UART0_REGS_BASE EV96100_COM1_BASE_ADDR
40#define EV96100_UART1_REGS_BASE EV96100_COM2_BASE_ADDR
41#define EV96100_BASE_BAUD ( 3686400 / 16 )
42
43
44/*
45 * Because of an error/peculiarity in the Galileo chip, we need to swap the
46 * bytes when running bigendian.
47 */
48#define __GT_READ(ofs) \
49 (*(volatile u32 *)(GT64120_BASE+(ofs)))
50#define __GT_WRITE(ofs, data) \
51 do { *(volatile u32 *)(GT64120_BASE+(ofs)) = (data); } while (0)
52#define GT_READ(ofs) le32_to_cpu(__GT_READ(ofs))
53#define GT_WRITE(ofs, data) __GT_WRITE(ofs, cpu_to_le32(data))
54
55#endif /* !(_MIPS_EV96100_H) */
diff --git a/include/asm-mips/galileo-boards/ev96100int.h b/include/asm-mips/galileo-boards/ev96100int.h
new file mode 100644
index 000000000000..c58b16d06d6e
--- /dev/null
+++ b/include/asm-mips/galileo-boards/ev96100int.h
@@ -0,0 +1,12 @@
1/*
2 *
3 */
4#ifndef _MIPS_EV96100INT_H
5#define _MIPS_EV96100INT_H
6
7#define EV96100INT_UART_0 6 /* IP 6 */
8#define EV96100INT_TIMER 7 /* IP 7 */
9
10extern void ev96100int_init(void);
11
12#endif /* !(_MIPS_EV96100_H) */
diff --git a/include/asm-mips/galileo-boards/gt96100.h b/include/asm-mips/galileo-boards/gt96100.h
new file mode 100644
index 000000000000..aabd1b629c19
--- /dev/null
+++ b/include/asm-mips/galileo-boards/gt96100.h
@@ -0,0 +1,427 @@
1/*
2 * Copyright 2000 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * stevel@mvista.com or source@mvista.com
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 *
19 * Register offsets of the MIPS GT96100 Advanced Communication Controller.
20 */
21#ifndef _GT96100_H
22#define _GT96100_H
23
24/*
25 * Galileo GT96100 internal register base.
26 */
27#define MIPS_GT96100_BASE (KSEG1ADDR(0x14000000))
28
29#define GT96100_WRITE(ofs, data) \
30 *(volatile u32 *)(MIPS_GT96100_BASE+ofs) = cpu_to_le32(data)
31#define GT96100_READ(ofs) \
32 le32_to_cpu(*(volatile u32 *)(MIPS_GT96100_BASE+ofs))
33
34#define GT96100_ETH_IO_SIZE 0x4000
35
36/************************************************************************
37 * Register offset addresses follow
38 ************************************************************************/
39
40/* CPU Interface Control Registers */
41#define GT96100_CPU_INTERF_CONFIG 0x000000
42
43/* Ethernet Ports */
44#define GT96100_ETH_PHY_ADDR_REG 0x080800
45#define GT96100_ETH_SMI_REG 0x080810
46/*
47 These are offsets to port 0 registers. Add GT96100_ETH_IO_SIZE to
48 get offsets to port 1 registers.
49*/
50#define GT96100_ETH_PORT_CONFIG 0x084800
51#define GT96100_ETH_PORT_CONFIG_EXT 0x084808
52#define GT96100_ETH_PORT_COMM 0x084810
53#define GT96100_ETH_PORT_STATUS 0x084818
54#define GT96100_ETH_SER_PARAM 0x084820
55#define GT96100_ETH_HASH_TBL_PTR 0x084828
56#define GT96100_ETH_FLOW_CNTRL_SRC_ADDR_L 0x084830
57#define GT96100_ETH_FLOW_CNTRL_SRC_ADDR_H 0x084838
58#define GT96100_ETH_SDMA_CONFIG 0x084840
59#define GT96100_ETH_SDMA_COMM 0x084848
60#define GT96100_ETH_INT_CAUSE 0x084850
61#define GT96100_ETH_INT_MASK 0x084858
62#define GT96100_ETH_1ST_RX_DESC_PTR0 0x084880
63#define GT96100_ETH_1ST_RX_DESC_PTR1 0x084884
64#define GT96100_ETH_1ST_RX_DESC_PTR2 0x084888
65#define GT96100_ETH_1ST_RX_DESC_PTR3 0x08488C
66#define GT96100_ETH_CURR_RX_DESC_PTR0 0x0848A0
67#define GT96100_ETH_CURR_RX_DESC_PTR1 0x0848A4
68#define GT96100_ETH_CURR_RX_DESC_PTR2 0x0848A8
69#define GT96100_ETH_CURR_RX_DESC_PTR3 0x0848AC
70#define GT96100_ETH_CURR_TX_DESC_PTR0 0x0848E0
71#define GT96100_ETH_CURR_TX_DESC_PTR1 0x0848E4
72#define GT96100_ETH_MIB_COUNT_BASE 0x085800
73
74/* SDMAs */
75#define GT96100_SDMA_GROUP_CONFIG 0x101AF0
76/* SDMA Group 0 */
77#define GT96100_SDMA_G0_CHAN0_CONFIG 0x000900
78#define GT96100_SDMA_G0_CHAN0_COMM 0x000908
79#define GT96100_SDMA_G0_CHAN0_RX_DESC_BASE 0x008900
80#define GT96100_SDMA_G0_CHAN0_CURR_RX_DESC_PTR 0x008910
81#define GT96100_SDMA_G0_CHAN0_TX_DESC_BASE 0x00C900
82#define GT96100_SDMA_G0_CHAN0_CURR_TX_DESC_PTR 0x00C910
83#define GT96100_SDMA_G0_CHAN0_1ST_TX_DESC_PTR 0x00C914
84#define GT96100_SDMA_G0_CHAN1_CONFIG 0x010900
85#define GT96100_SDMA_G0_CHAN1_COMM 0x010908
86#define GT96100_SDMA_G0_CHAN1_RX_DESC_BASE 0x018900
87#define GT96100_SDMA_G0_CHAN1_CURR_RX_DESC_PTR 0x018910
88#define GT96100_SDMA_G0_CHAN1_TX_DESC_BASE 0x01C900
89#define GT96100_SDMA_G0_CHAN1_CURR_TX_DESC_PTR 0x01C910
90#define GT96100_SDMA_G0_CHAN1_1ST_TX_DESC_PTR 0x01C914
91#define GT96100_SDMA_G0_CHAN2_CONFIG 0x020900
92#define GT96100_SDMA_G0_CHAN2_COMM 0x020908
93#define GT96100_SDMA_G0_CHAN2_RX_DESC_BASE 0x028900
94#define GT96100_SDMA_G0_CHAN2_CURR_RX_DESC_PTR 0x028910
95#define GT96100_SDMA_G0_CHAN2_TX_DESC_BASE 0x02C900
96#define GT96100_SDMA_G0_CHAN2_CURR_TX_DESC_PTR 0x02C910
97#define GT96100_SDMA_G0_CHAN2_1ST_TX_DESC_PTR 0x02C914
98#define GT96100_SDMA_G0_CHAN3_CONFIG 0x030900
99#define GT96100_SDMA_G0_CHAN3_COMM 0x030908
100#define GT96100_SDMA_G0_CHAN3_RX_DESC_BASE 0x038900
101#define GT96100_SDMA_G0_CHAN3_CURR_RX_DESC_PTR 0x038910
102#define GT96100_SDMA_G0_CHAN3_TX_DESC_BASE 0x03C900
103#define GT96100_SDMA_G0_CHAN3_CURR_TX_DESC_PTR 0x03C910
104#define GT96100_SDMA_G0_CHAN3_1ST_TX_DESC_PTR 0x03C914
105#define GT96100_SDMA_G0_CHAN4_CONFIG 0x040900
106#define GT96100_SDMA_G0_CHAN4_COMM 0x040908
107#define GT96100_SDMA_G0_CHAN4_RX_DESC_BASE 0x048900
108#define GT96100_SDMA_G0_CHAN4_CURR_RX_DESC_PTR 0x048910
109#define GT96100_SDMA_G0_CHAN4_TX_DESC_BASE 0x04C900
110#define GT96100_SDMA_G0_CHAN4_CURR_TX_DESC_PTR 0x04C910
111#define GT96100_SDMA_G0_CHAN4_1ST_TX_DESC_PTR 0x04C914
112#define GT96100_SDMA_G0_CHAN5_CONFIG 0x050900
113#define GT96100_SDMA_G0_CHAN5_COMM 0x050908
114#define GT96100_SDMA_G0_CHAN5_RX_DESC_BASE 0x058900
115#define GT96100_SDMA_G0_CHAN5_CURR_RX_DESC_PTR 0x058910
116#define GT96100_SDMA_G0_CHAN5_TX_DESC_BASE 0x05C900
117#define GT96100_SDMA_G0_CHAN5_CURR_TX_DESC_PTR 0x05C910
118#define GT96100_SDMA_G0_CHAN5_1ST_TX_DESC_PTR 0x05C914
119#define GT96100_SDMA_G0_CHAN6_CONFIG 0x060900
120#define GT96100_SDMA_G0_CHAN6_COMM 0x060908
121#define GT96100_SDMA_G0_CHAN6_RX_DESC_BASE 0x068900
122#define GT96100_SDMA_G0_CHAN6_CURR_RX_DESC_PTR 0x068910
123#define GT96100_SDMA_G0_CHAN6_TX_DESC_BASE 0x06C900
124#define GT96100_SDMA_G0_CHAN6_CURR_TX_DESC_PTR 0x06C910
125#define GT96100_SDMA_G0_CHAN6_1ST_TX_DESC_PTR 0x06C914
126#define GT96100_SDMA_G0_CHAN7_CONFIG 0x070900
127#define GT96100_SDMA_G0_CHAN7_COMM 0x070908
128#define GT96100_SDMA_G0_CHAN7_RX_DESC_BASE 0x078900
129#define GT96100_SDMA_G0_CHAN7_CURR_RX_DESC_PTR 0x078910
130#define GT96100_SDMA_G0_CHAN7_TX_DESC_BASE 0x07C900
131#define GT96100_SDMA_G0_CHAN7_CURR_TX_DESC_PTR 0x07C910
132#define GT96100_SDMA_G0_CHAN7_1ST_TX_DESC_PTR 0x07C914
133/* SDMA Group 1 */
134#define GT96100_SDMA_G1_CHAN0_CONFIG 0x100900
135#define GT96100_SDMA_G1_CHAN0_COMM 0x100908
136#define GT96100_SDMA_G1_CHAN0_RX_DESC_BASE 0x108900
137#define GT96100_SDMA_G1_CHAN0_CURR_RX_DESC_PTR 0x108910
138#define GT96100_SDMA_G1_CHAN0_TX_DESC_BASE 0x10C900
139#define GT96100_SDMA_G1_CHAN0_CURR_TX_DESC_PTR 0x10C910
140#define GT96100_SDMA_G1_CHAN0_1ST_TX_DESC_PTR 0x10C914
141#define GT96100_SDMA_G1_CHAN1_CONFIG 0x110900
142#define GT96100_SDMA_G1_CHAN1_COMM 0x110908
143#define GT96100_SDMA_G1_CHAN1_RX_DESC_BASE 0x118900
144#define GT96100_SDMA_G1_CHAN1_CURR_RX_DESC_PTR 0x118910
145#define GT96100_SDMA_G1_CHAN1_TX_DESC_BASE 0x11C900
146#define GT96100_SDMA_G1_CHAN1_CURR_TX_DESC_PTR 0x11C910
147#define GT96100_SDMA_G1_CHAN1_1ST_TX_DESC_PTR 0x11C914
148#define GT96100_SDMA_G1_CHAN2_CONFIG 0x120900
149#define GT96100_SDMA_G1_CHAN2_COMM 0x120908
150#define GT96100_SDMA_G1_CHAN2_RX_DESC_BASE 0x128900
151#define GT96100_SDMA_G1_CHAN2_CURR_RX_DESC_PTR 0x128910
152#define GT96100_SDMA_G1_CHAN2_TX_DESC_BASE 0x12C900
153#define GT96100_SDMA_G1_CHAN2_CURR_TX_DESC_PTR 0x12C910
154#define GT96100_SDMA_G1_CHAN2_1ST_TX_DESC_PTR 0x12C914
155#define GT96100_SDMA_G1_CHAN3_CONFIG 0x130900
156#define GT96100_SDMA_G1_CHAN3_COMM 0x130908
157#define GT96100_SDMA_G1_CHAN3_RX_DESC_BASE 0x138900
158#define GT96100_SDMA_G1_CHAN3_CURR_RX_DESC_PTR 0x138910
159#define GT96100_SDMA_G1_CHAN3_TX_DESC_BASE 0x13C900
160#define GT96100_SDMA_G1_CHAN3_CURR_TX_DESC_PTR 0x13C910
161#define GT96100_SDMA_G1_CHAN3_1ST_TX_DESC_PTR 0x13C914
162#define GT96100_SDMA_G1_CHAN4_CONFIG 0x140900
163#define GT96100_SDMA_G1_CHAN4_COMM 0x140908
164#define GT96100_SDMA_G1_CHAN4_RX_DESC_BASE 0x148900
165#define GT96100_SDMA_G1_CHAN4_CURR_RX_DESC_PTR 0x148910
166#define GT96100_SDMA_G1_CHAN4_TX_DESC_BASE 0x14C900
167#define GT96100_SDMA_G1_CHAN4_CURR_TX_DESC_PTR 0x14C910
168#define GT96100_SDMA_G1_CHAN4_1ST_TX_DESC_PTR 0x14C914
169#define GT96100_SDMA_G1_CHAN5_CONFIG 0x150900
170#define GT96100_SDMA_G1_CHAN5_COMM 0x150908
171#define GT96100_SDMA_G1_CHAN5_RX_DESC_BASE 0x158900
172#define GT96100_SDMA_G1_CHAN5_CURR_RX_DESC_PTR 0x158910
173#define GT96100_SDMA_G1_CHAN5_TX_DESC_BASE 0x15C900
174#define GT96100_SDMA_G1_CHAN5_CURR_TX_DESC_PTR 0x15C910
175#define GT96100_SDMA_G1_CHAN5_1ST_TX_DESC_PTR 0x15C914
176#define GT96100_SDMA_G1_CHAN6_CONFIG 0x160900
177#define GT96100_SDMA_G1_CHAN6_COMM 0x160908
178#define GT96100_SDMA_G1_CHAN6_RX_DESC_BASE 0x168900
179#define GT96100_SDMA_G1_CHAN6_CURR_RX_DESC_PTR 0x168910
180#define GT96100_SDMA_G1_CHAN6_TX_DESC_BASE 0x16C900
181#define GT96100_SDMA_G1_CHAN6_CURR_TX_DESC_PTR 0x16C910
182#define GT96100_SDMA_G1_CHAN6_1ST_TX_DESC_PTR 0x16C914
183#define GT96100_SDMA_G1_CHAN7_CONFIG 0x170900
184#define GT96100_SDMA_G1_CHAN7_COMM 0x170908
185#define GT96100_SDMA_G1_CHAN7_RX_DESC_BASE 0x178900
186#define GT96100_SDMA_G1_CHAN7_CURR_RX_DESC_PTR 0x178910
187#define GT96100_SDMA_G1_CHAN7_TX_DESC_BASE 0x17C900
188#define GT96100_SDMA_G1_CHAN7_CURR_TX_DESC_PTR 0x17C910
189#define GT96100_SDMA_G1_CHAN7_1ST_TX_DESC_PTR 0x17C914
190/* MPSCs */
191#define GT96100_MPSC0_MAIN_CONFIG_LOW 0x000A00
192#define GT96100_MPSC0_MAIN_CONFIG_HIGH 0x000A04
193#define GT96100_MPSC0_PROTOCOL_CONFIG 0x000A08
194#define GT96100_MPSC_CHAN0_REG1 0x000A0C
195#define GT96100_MPSC_CHAN0_REG2 0x000A10
196#define GT96100_MPSC_CHAN0_REG3 0x000A14
197#define GT96100_MPSC_CHAN0_REG4 0x000A18
198#define GT96100_MPSC_CHAN0_REG5 0x000A1C
199#define GT96100_MPSC_CHAN0_REG6 0x000A20
200#define GT96100_MPSC_CHAN0_REG7 0x000A24
201#define GT96100_MPSC_CHAN0_REG8 0x000A28
202#define GT96100_MPSC_CHAN0_REG9 0x000A2C
203#define GT96100_MPSC_CHAN0_REG10 0x000A30
204#define GT96100_MPSC_CHAN0_REG11 0x000A34
205#define GT96100_MPSC1_MAIN_CONFIG_LOW 0x008A00
206#define GT96100_MPSC1_MAIN_CONFIG_HIGH 0x008A04
207#define GT96100_MPSC1_PROTOCOL_CONFIG 0x008A08
208#define GT96100_MPSC_CHAN1_REG1 0x008A0C
209#define GT96100_MPSC_CHAN1_REG2 0x008A10
210#define GT96100_MPSC_CHAN1_REG3 0x008A14
211#define GT96100_MPSC_CHAN1_REG4 0x008A18
212#define GT96100_MPSC_CHAN1_REG5 0x008A1C
213#define GT96100_MPSC_CHAN1_REG6 0x008A20
214#define GT96100_MPSC_CHAN1_REG7 0x008A24
215#define GT96100_MPSC_CHAN1_REG8 0x008A28
216#define GT96100_MPSC_CHAN1_REG9 0x008A2C
217#define GT96100_MPSC_CHAN1_REG10 0x008A30
218#define GT96100_MPSC_CHAN1_REG11 0x008A34
219#define GT96100_MPSC2_MAIN_CONFIG_LOW 0x010A00
220#define GT96100_MPSC2_MAIN_CONFIG_HIGH 0x010A04
221#define GT96100_MPSC2_PROTOCOL_CONFIG 0x010A08
222#define GT96100_MPSC_CHAN2_REG1 0x010A0C
223#define GT96100_MPSC_CHAN2_REG2 0x010A10
224#define GT96100_MPSC_CHAN2_REG3 0x010A14
225#define GT96100_MPSC_CHAN2_REG4 0x010A18
226#define GT96100_MPSC_CHAN2_REG5 0x010A1C
227#define GT96100_MPSC_CHAN2_REG6 0x010A20
228#define GT96100_MPSC_CHAN2_REG7 0x010A24
229#define GT96100_MPSC_CHAN2_REG8 0x010A28
230#define GT96100_MPSC_CHAN2_REG9 0x010A2C
231#define GT96100_MPSC_CHAN2_REG10 0x010A30
232#define GT96100_MPSC_CHAN2_REG11 0x010A34
233#define GT96100_MPSC3_MAIN_CONFIG_LOW 0x018A00
234#define GT96100_MPSC3_MAIN_CONFIG_HIGH 0x018A04
235#define GT96100_MPSC3_PROTOCOL_CONFIG 0x018A08
236#define GT96100_MPSC_CHAN3_REG1 0x018A0C
237#define GT96100_MPSC_CHAN3_REG2 0x018A10
238#define GT96100_MPSC_CHAN3_REG3 0x018A14
239#define GT96100_MPSC_CHAN3_REG4 0x018A18
240#define GT96100_MPSC_CHAN3_REG5 0x018A1C
241#define GT96100_MPSC_CHAN3_REG6 0x018A20
242#define GT96100_MPSC_CHAN3_REG7 0x018A24
243#define GT96100_MPSC_CHAN3_REG8 0x018A28
244#define GT96100_MPSC_CHAN3_REG9 0x018A2C
245#define GT96100_MPSC_CHAN3_REG10 0x018A30
246#define GT96100_MPSC_CHAN3_REG11 0x018A34
247#define GT96100_MPSC4_MAIN_CONFIG_LOW 0x020A00
248#define GT96100_MPSC4_MAIN_CONFIG_HIGH 0x020A04
249#define GT96100_MPSC4_PROTOCOL_CONFIG 0x020A08
250#define GT96100_MPSC_CHAN4_REG1 0x020A0C
251#define GT96100_MPSC_CHAN4_REG2 0x020A10
252#define GT96100_MPSC_CHAN4_REG3 0x020A14
253#define GT96100_MPSC_CHAN4_REG4 0x020A18
254#define GT96100_MPSC_CHAN4_REG5 0x020A1C
255#define GT96100_MPSC_CHAN4_REG6 0x020A20
256#define GT96100_MPSC_CHAN4_REG7 0x020A24
257#define GT96100_MPSC_CHAN4_REG8 0x020A28
258#define GT96100_MPSC_CHAN4_REG9 0x020A2C
259#define GT96100_MPSC_CHAN4_REG10 0x020A30
260#define GT96100_MPSC_CHAN4_REG11 0x020A34
261#define GT96100_MPSC5_MAIN_CONFIG_LOW 0x028A00
262#define GT96100_MPSC5_MAIN_CONFIG_HIGH 0x028A04
263#define GT96100_MPSC5_PROTOCOL_CONFIG 0x028A08
264#define GT96100_MPSC_CHAN5_REG1 0x028A0C
265#define GT96100_MPSC_CHAN5_REG2 0x028A10
266#define GT96100_MPSC_CHAN5_REG3 0x028A14
267#define GT96100_MPSC_CHAN5_REG4 0x028A18
268#define GT96100_MPSC_CHAN5_REG5 0x028A1C
269#define GT96100_MPSC_CHAN5_REG6 0x028A20
270#define GT96100_MPSC_CHAN5_REG7 0x028A24
271#define GT96100_MPSC_CHAN5_REG8 0x028A28
272#define GT96100_MPSC_CHAN5_REG9 0x028A2C
273#define GT96100_MPSC_CHAN5_REG10 0x028A30
274#define GT96100_MPSC_CHAN5_REG11 0x028A34
275#define GT96100_MPSC6_MAIN_CONFIG_LOW 0x030A00
276#define GT96100_MPSC6_MAIN_CONFIG_HIGH 0x030A04
277#define GT96100_MPSC6_PROTOCOL_CONFIG 0x030A08
278#define GT96100_MPSC_CHAN6_REG1 0x030A0C
279#define GT96100_MPSC_CHAN6_REG2 0x030A10
280#define GT96100_MPSC_CHAN6_REG3 0x030A14
281#define GT96100_MPSC_CHAN6_REG4 0x030A18
282#define GT96100_MPSC_CHAN6_REG5 0x030A1C
283#define GT96100_MPSC_CHAN6_REG6 0x030A20
284#define GT96100_MPSC_CHAN6_REG7 0x030A24
285#define GT96100_MPSC_CHAN6_REG8 0x030A28
286#define GT96100_MPSC_CHAN6_REG9 0x030A2C
287#define GT96100_MPSC_CHAN6_REG10 0x030A30
288#define GT96100_MPSC_CHAN6_REG11 0x030A34
289#define GT96100_MPSC7_MAIN_CONFIG_LOW 0x038A00
290#define GT96100_MPSC7_MAIN_CONFIG_HIGH 0x038A04
291#define GT96100_MPSC7_PROTOCOL_CONFIG 0x038A08
292#define GT96100_MPSC_CHAN7_REG1 0x038A0C
293#define GT96100_MPSC_CHAN7_REG2 0x038A10
294#define GT96100_MPSC_CHAN7_REG3 0x038A14
295#define GT96100_MPSC_CHAN7_REG4 0x038A18
296#define GT96100_MPSC_CHAN7_REG5 0x038A1C
297#define GT96100_MPSC_CHAN7_REG6 0x038A20
298#define GT96100_MPSC_CHAN7_REG7 0x038A24
299#define GT96100_MPSC_CHAN7_REG8 0x038A28
300#define GT96100_MPSC_CHAN7_REG9 0x038A2C
301#define GT96100_MPSC_CHAN7_REG10 0x038A30
302#define GT96100_MPSC_CHAN7_REG11 0x038A34
303/* FlexTDMs */
304/* TDPR0 - Transmit Dual Port RAM. block size 0xff */
305#define GT96100_FXTDM0_TDPR0_BLK0_BASE 0x000B00
306#define GT96100_FXTDM0_TDPR0_BLK1_BASE 0x001B00
307#define GT96100_FXTDM0_TDPR0_BLK2_BASE 0x002B00
308#define GT96100_FXTDM0_TDPR0_BLK3_BASE 0x003B00
309/* RDPR0 - Receive Dual Port RAM. block size 0xff */
310#define GT96100_FXTDM0_RDPR0_BLK0_BASE 0x004B00
311#define GT96100_FXTDM0_RDPR0_BLK1_BASE 0x005B00
312#define GT96100_FXTDM0_RDPR0_BLK2_BASE 0x006B00
313#define GT96100_FXTDM0_RDPR0_BLK3_BASE 0x007B00
314#define GT96100_FXTDM0_TX_READ_PTR 0x008B00
315#define GT96100_FXTDM0_RX_READ_PTR 0x008B04
316#define GT96100_FXTDM0_CONFIG 0x008B08
317#define GT96100_FXTDM0_AUX_CHANA_TX 0x008B0C
318#define GT96100_FXTDM0_AUX_CHANA_RX 0x008B10
319#define GT96100_FXTDM0_AUX_CHANB_TX 0x008B14
320#define GT96100_FXTDM0_AUX_CHANB_RX 0x008B18
321#define GT96100_FXTDM1_TDPR1_BLK0_BASE 0x010B00
322#define GT96100_FXTDM1_TDPR1_BLK1_BASE 0x011B00
323#define GT96100_FXTDM1_TDPR1_BLK2_BASE 0x012B00
324#define GT96100_FXTDM1_TDPR1_BLK3_BASE 0x013B00
325#define GT96100_FXTDM1_RDPR1_BLK0_BASE 0x014B00
326#define GT96100_FXTDM1_RDPR1_BLK1_BASE 0x015B00
327#define GT96100_FXTDM1_RDPR1_BLK2_BASE 0x016B00
328#define GT96100_FXTDM1_RDPR1_BLK3_BASE 0x017B00
329#define GT96100_FXTDM1_TX_READ_PTR 0x018B00
330#define GT96100_FXTDM1_RX_READ_PTR 0x018B04
331#define GT96100_FXTDM1_CONFIG 0x018B08
332#define GT96100_FXTDM1_AUX_CHANA_TX 0x018B0C
333#define GT96100_FXTDM1_AUX_CHANA_RX 0x018B10
334#define GT96100_FLTDM1_AUX_CHANB_TX 0x018B14
335#define GT96100_FLTDM1_AUX_CHANB_RX 0x018B18
336#define GT96100_FLTDM2_TDPR2_BLK0_BASE 0x020B00
337#define GT96100_FLTDM2_TDPR2_BLK1_BASE 0x021B00
338#define GT96100_FLTDM2_TDPR2_BLK2_BASE 0x022B00
339#define GT96100_FLTDM2_TDPR2_BLK3_BASE 0x023B00
340#define GT96100_FLTDM2_RDPR2_BLK0_BASE 0x024B00
341#define GT96100_FLTDM2_RDPR2_BLK1_BASE 0x025B00
342#define GT96100_FLTDM2_RDPR2_BLK2_BASE 0x026B00
343#define GT96100_FLTDM2_RDPR2_BLK3_BASE 0x027B00
344#define GT96100_FLTDM2_TX_READ_PTR 0x028B00
345#define GT96100_FLTDM2_RX_READ_PTR 0x028B04
346#define GT96100_FLTDM2_CONFIG 0x028B08
347#define GT96100_FLTDM2_AUX_CHANA_TX 0x028B0C
348#define GT96100_FLTDM2_AUX_CHANA_RX 0x028B10
349#define GT96100_FLTDM2_AUX_CHANB_TX 0x028B14
350#define GT96100_FLTDM2_AUX_CHANB_RX 0x028B18
351#define GT96100_FLTDM3_TDPR3_BLK0_BASE 0x030B00
352#define GT96100_FLTDM3_TDPR3_BLK1_BASE 0x031B00
353#define GT96100_FLTDM3_TDPR3_BLK2_BASE 0x032B00
354#define GT96100_FLTDM3_TDPR3_BLK3_BASE 0x033B00
355#define GT96100_FXTDM3_RDPR3_BLK0_BASE 0x034B00
356#define GT96100_FXTDM3_RDPR3_BLK1_BASE 0x035B00
357#define GT96100_FXTDM3_RDPR3_BLK2_BASE 0x036B00
358#define GT96100_FXTDM3_RDPR3_BLK3_BASE 0x037B00
359#define GT96100_FXTDM3_TX_READ_PTR 0x038B00
360#define GT96100_FXTDM3_RX_READ_PTR 0x038B04
361#define GT96100_FXTDM3_CONFIG 0x038B08
362#define GT96100_FXTDM3_AUX_CHANA_TX 0x038B0C
363#define GT96100_FXTDM3_AUX_CHANA_RX 0x038B10
364#define GT96100_FXTDM3_AUX_CHANB_TX 0x038B14
365#define GT96100_FXTDM3_AUX_CHANB_RX 0x038B18
366/* Baud Rate Generators */
367#define GT96100_BRG0_CONFIG 0x102A00
368#define GT96100_BRG0_BAUD_TUNE 0x102A04
369#define GT96100_BRG1_CONFIG 0x102A08
370#define GT96100_BRG1_BAUD_TUNE 0x102A0C
371#define GT96100_BRG2_CONFIG 0x102A10
372#define GT96100_BRG2_BAUD_TUNE 0x102A14
373#define GT96100_BRG3_CONFIG 0x102A18
374#define GT96100_BRG3_BAUD_TUNE 0x102A1C
375#define GT96100_BRG4_CONFIG 0x102A20
376#define GT96100_BRG4_BAUD_TUNE 0x102A24
377#define GT96100_BRG5_CONFIG 0x102A28
378#define GT96100_BRG5_BAUD_TUNE 0x102A2C
379#define GT96100_BRG6_CONFIG 0x102A30
380#define GT96100_BRG6_BAUD_TUNE 0x102A34
381#define GT96100_BRG7_CONFIG 0x102A38
382#define GT96100_BRG7_BAUD_TUNE 0x102A3C
383/* Routing Registers */
384#define GT96100_ROUTE_MAIN 0x101A00
385#define GT96100_ROUTE_RX_CLOCK 0x101A10
386#define GT96100_ROUTE_TX_CLOCK 0x101A20
387/* General Purpose Ports */
388#define GT96100_GPP_CONFIG0 0x100A00
389#define GT96100_GPP_CONFIG1 0x100A04
390#define GT96100_GPP_CONFIG2 0x100A08
391#define GT96100_GPP_CONFIG3 0x100A0C
392#define GT96100_GPP_IO0 0x100A20
393#define GT96100_GPP_IO1 0x100A24
394#define GT96100_GPP_IO2 0x100A28
395#define GT96100_GPP_IO3 0x100A2C
396#define GT96100_GPP_DATA0 0x100A40
397#define GT96100_GPP_DATA1 0x100A44
398#define GT96100_GPP_DATA2 0x100A48
399#define GT96100_GPP_DATA3 0x100A4C
400#define GT96100_GPP_LEVEL0 0x100A60
401#define GT96100_GPP_LEVEL1 0x100A64
402#define GT96100_GPP_LEVEL2 0x100A68
403#define GT96100_GPP_LEVEL3 0x100A6C
404/* Watchdog */
405#define GT96100_WD_CONFIG 0x101A80
406#define GT96100_WD_VALUE 0x101A84
407/* Communication Unit Arbiter */
408#define GT96100_COMM_UNIT_ARBTR_CONFIG 0x101AC0
409/* PCI Arbiters */
410#define GT96100_PCI0_ARBTR_CONFIG 0x101AE0
411#define GT96100_PCI1_ARBTR_CONFIG 0x101AE4
412/* CIU Arbiter */
413#define GT96100_CIU_ARBITER_CONFIG 0x101AC0
414/* Interrupt Controller */
415#define GT96100_MAIN_CAUSE 0x000C18
416#define GT96100_INT0_MAIN_MASK 0x000C1C
417#define GT96100_INT1_MAIN_MASK 0x000C24
418#define GT96100_HIGH_CAUSE 0x000C98
419#define GT96100_INT0_HIGH_MASK 0x000C9C
420#define GT96100_INT1_HIGH_MASK 0x000CA4
421#define GT96100_INT0_SELECT 0x000C70
422#define GT96100_INT1_SELECT 0x000C74
423#define GT96100_SERIAL_CAUSE 0x103A00
424#define GT96100_SERINT0_MASK 0x103A80
425#define GT96100_SERINT1_MASK 0x103A88
426
427#endif /* _GT96100_H */
diff --git a/include/asm-mips/gcc/sgidefs.h b/include/asm-mips/gcc/sgidefs.h
new file mode 100644
index 000000000000..05994371a2af
--- /dev/null
+++ b/include/asm-mips/gcc/sgidefs.h
@@ -0,0 +1,17 @@
1/*
2 * include/sgidefs.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996 by Ralf Baechle
9 *
10 * This file is here to satisfy GCC's expectations.
11 */
12#ifndef __SGIDEFS_H
13#define __SGIDEFS_H
14
15#include <asm/sgidefs.h>
16
17#endif /* __SGIDEFS_H */
diff --git a/include/asm-mips/gdb-stub.h b/include/asm-mips/gdb-stub.h
new file mode 100644
index 000000000000..22f67d4a71ab
--- /dev/null
+++ b/include/asm-mips/gdb-stub.h
@@ -0,0 +1,215 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995 Andreas Busse
7 * Copyright (C) 2003 Ralf Baechle
8 */
9#ifndef _ASM_GDB_STUB_H
10#define _ASM_GDB_STUB_H
11
12
13/*
14 * important register numbers
15 */
16
17#define REG_EPC 37
18#define REG_FP 72
19#define REG_SP 29
20
21/*
22 * Stack layout for the GDB exception handler
23 * Derived from the stack layout described in asm-mips/stackframe.h
24 *
25 * The first PTRSIZE*6 bytes are argument save space for C subroutines.
26 */
27#define NUMREGS 90
28
29#define GDB_FR_REG0 (PTRSIZE*6) /* 0 */
30#define GDB_FR_REG1 ((GDB_FR_REG0) + LONGSIZE) /* 1 */
31#define GDB_FR_REG2 ((GDB_FR_REG1) + LONGSIZE) /* 2 */
32#define GDB_FR_REG3 ((GDB_FR_REG2) + LONGSIZE) /* 3 */
33#define GDB_FR_REG4 ((GDB_FR_REG3) + LONGSIZE) /* 4 */
34#define GDB_FR_REG5 ((GDB_FR_REG4) + LONGSIZE) /* 5 */
35#define GDB_FR_REG6 ((GDB_FR_REG5) + LONGSIZE) /* 6 */
36#define GDB_FR_REG7 ((GDB_FR_REG6) + LONGSIZE) /* 7 */
37#define GDB_FR_REG8 ((GDB_FR_REG7) + LONGSIZE) /* 8 */
38#define GDB_FR_REG9 ((GDB_FR_REG8) + LONGSIZE) /* 9 */
39#define GDB_FR_REG10 ((GDB_FR_REG9) + LONGSIZE) /* 10 */
40#define GDB_FR_REG11 ((GDB_FR_REG10) + LONGSIZE) /* 11 */
41#define GDB_FR_REG12 ((GDB_FR_REG11) + LONGSIZE) /* 12 */
42#define GDB_FR_REG13 ((GDB_FR_REG12) + LONGSIZE) /* 13 */
43#define GDB_FR_REG14 ((GDB_FR_REG13) + LONGSIZE) /* 14 */
44#define GDB_FR_REG15 ((GDB_FR_REG14) + LONGSIZE) /* 15 */
45#define GDB_FR_REG16 ((GDB_FR_REG15) + LONGSIZE) /* 16 */
46#define GDB_FR_REG17 ((GDB_FR_REG16) + LONGSIZE) /* 17 */
47#define GDB_FR_REG18 ((GDB_FR_REG17) + LONGSIZE) /* 18 */
48#define GDB_FR_REG19 ((GDB_FR_REG18) + LONGSIZE) /* 19 */
49#define GDB_FR_REG20 ((GDB_FR_REG19) + LONGSIZE) /* 20 */
50#define GDB_FR_REG21 ((GDB_FR_REG20) + LONGSIZE) /* 21 */
51#define GDB_FR_REG22 ((GDB_FR_REG21) + LONGSIZE) /* 22 */
52#define GDB_FR_REG23 ((GDB_FR_REG22) + LONGSIZE) /* 23 */
53#define GDB_FR_REG24 ((GDB_FR_REG23) + LONGSIZE) /* 24 */
54#define GDB_FR_REG25 ((GDB_FR_REG24) + LONGSIZE) /* 25 */
55#define GDB_FR_REG26 ((GDB_FR_REG25) + LONGSIZE) /* 26 */
56#define GDB_FR_REG27 ((GDB_FR_REG26) + LONGSIZE) /* 27 */
57#define GDB_FR_REG28 ((GDB_FR_REG27) + LONGSIZE) /* 28 */
58#define GDB_FR_REG29 ((GDB_FR_REG28) + LONGSIZE) /* 29 */
59#define GDB_FR_REG30 ((GDB_FR_REG29) + LONGSIZE) /* 30 */
60#define GDB_FR_REG31 ((GDB_FR_REG30) + LONGSIZE) /* 31 */
61
62/*
63 * Saved special registers
64 */
65#define GDB_FR_STATUS ((GDB_FR_REG31) + LONGSIZE) /* 32 */
66#define GDB_FR_LO ((GDB_FR_STATUS) + LONGSIZE) /* 33 */
67#define GDB_FR_HI ((GDB_FR_LO) + LONGSIZE) /* 34 */
68#define GDB_FR_BADVADDR ((GDB_FR_HI) + LONGSIZE) /* 35 */
69#define GDB_FR_CAUSE ((GDB_FR_BADVADDR) + LONGSIZE) /* 36 */
70#define GDB_FR_EPC ((GDB_FR_CAUSE) + LONGSIZE) /* 37 */
71
72/*
73 * Saved floating point registers
74 */
75#define GDB_FR_FPR0 ((GDB_FR_EPC) + LONGSIZE) /* 38 */
76#define GDB_FR_FPR1 ((GDB_FR_FPR0) + LONGSIZE) /* 39 */
77#define GDB_FR_FPR2 ((GDB_FR_FPR1) + LONGSIZE) /* 40 */
78#define GDB_FR_FPR3 ((GDB_FR_FPR2) + LONGSIZE) /* 41 */
79#define GDB_FR_FPR4 ((GDB_FR_FPR3) + LONGSIZE) /* 42 */
80#define GDB_FR_FPR5 ((GDB_FR_FPR4) + LONGSIZE) /* 43 */
81#define GDB_FR_FPR6 ((GDB_FR_FPR5) + LONGSIZE) /* 44 */
82#define GDB_FR_FPR7 ((GDB_FR_FPR6) + LONGSIZE) /* 45 */
83#define GDB_FR_FPR8 ((GDB_FR_FPR7) + LONGSIZE) /* 46 */
84#define GDB_FR_FPR9 ((GDB_FR_FPR8) + LONGSIZE) /* 47 */
85#define GDB_FR_FPR10 ((GDB_FR_FPR9) + LONGSIZE) /* 48 */
86#define GDB_FR_FPR11 ((GDB_FR_FPR10) + LONGSIZE) /* 49 */
87#define GDB_FR_FPR12 ((GDB_FR_FPR11) + LONGSIZE) /* 50 */
88#define GDB_FR_FPR13 ((GDB_FR_FPR12) + LONGSIZE) /* 51 */
89#define GDB_FR_FPR14 ((GDB_FR_FPR13) + LONGSIZE) /* 52 */
90#define GDB_FR_FPR15 ((GDB_FR_FPR14) + LONGSIZE) /* 53 */
91#define GDB_FR_FPR16 ((GDB_FR_FPR15) + LONGSIZE) /* 54 */
92#define GDB_FR_FPR17 ((GDB_FR_FPR16) + LONGSIZE) /* 55 */
93#define GDB_FR_FPR18 ((GDB_FR_FPR17) + LONGSIZE) /* 56 */
94#define GDB_FR_FPR19 ((GDB_FR_FPR18) + LONGSIZE) /* 57 */
95#define GDB_FR_FPR20 ((GDB_FR_FPR19) + LONGSIZE) /* 58 */
96#define GDB_FR_FPR21 ((GDB_FR_FPR20) + LONGSIZE) /* 59 */
97#define GDB_FR_FPR22 ((GDB_FR_FPR21) + LONGSIZE) /* 60 */
98#define GDB_FR_FPR23 ((GDB_FR_FPR22) + LONGSIZE) /* 61 */
99#define GDB_FR_FPR24 ((GDB_FR_FPR23) + LONGSIZE) /* 62 */
100#define GDB_FR_FPR25 ((GDB_FR_FPR24) + LONGSIZE) /* 63 */
101#define GDB_FR_FPR26 ((GDB_FR_FPR25) + LONGSIZE) /* 64 */
102#define GDB_FR_FPR27 ((GDB_FR_FPR26) + LONGSIZE) /* 65 */
103#define GDB_FR_FPR28 ((GDB_FR_FPR27) + LONGSIZE) /* 66 */
104#define GDB_FR_FPR29 ((GDB_FR_FPR28) + LONGSIZE) /* 67 */
105#define GDB_FR_FPR30 ((GDB_FR_FPR29) + LONGSIZE) /* 68 */
106#define GDB_FR_FPR31 ((GDB_FR_FPR30) + LONGSIZE) /* 69 */
107
108#define GDB_FR_FSR ((GDB_FR_FPR31) + LONGSIZE) /* 70 */
109#define GDB_FR_FIR ((GDB_FR_FSR) + LONGSIZE) /* 71 */
110#define GDB_FR_FRP ((GDB_FR_FIR) + LONGSIZE) /* 72 */
111
112#define GDB_FR_DUMMY ((GDB_FR_FRP) + LONGSIZE) /* 73, unused ??? */
113
114/*
115 * Again, CP0 registers
116 */
117#define GDB_FR_CP0_INDEX ((GDB_FR_DUMMY) + LONGSIZE) /* 74 */
118#define GDB_FR_CP0_RANDOM ((GDB_FR_CP0_INDEX) + LONGSIZE) /* 75 */
119#define GDB_FR_CP0_ENTRYLO0 ((GDB_FR_CP0_RANDOM) + LONGSIZE)/* 76 */
120#define GDB_FR_CP0_ENTRYLO1 ((GDB_FR_CP0_ENTRYLO0) + LONGSIZE)/* 77 */
121#define GDB_FR_CP0_CONTEXT ((GDB_FR_CP0_ENTRYLO1) + LONGSIZE)/* 78 */
122#define GDB_FR_CP0_PAGEMASK ((GDB_FR_CP0_CONTEXT) + LONGSIZE)/* 79 */
123#define GDB_FR_CP0_WIRED ((GDB_FR_CP0_PAGEMASK) + LONGSIZE)/* 80 */
124#define GDB_FR_CP0_REG7 ((GDB_FR_CP0_WIRED) + LONGSIZE) /* 81 */
125#define GDB_FR_CP0_REG8 ((GDB_FR_CP0_REG7) + LONGSIZE) /* 82 */
126#define GDB_FR_CP0_REG9 ((GDB_FR_CP0_REG8) + LONGSIZE) /* 83 */
127#define GDB_FR_CP0_ENTRYHI ((GDB_FR_CP0_REG9) + LONGSIZE) /* 84 */
128#define GDB_FR_CP0_REG11 ((GDB_FR_CP0_ENTRYHI) + LONGSIZE)/* 85 */
129#define GDB_FR_CP0_REG12 ((GDB_FR_CP0_REG11) + LONGSIZE) /* 86 */
130#define GDB_FR_CP0_REG13 ((GDB_FR_CP0_REG12) + LONGSIZE) /* 87 */
131#define GDB_FR_CP0_REG14 ((GDB_FR_CP0_REG13) + LONGSIZE) /* 88 */
132#define GDB_FR_CP0_PRID ((GDB_FR_CP0_REG14) + LONGSIZE) /* 89 */
133
134#define GDB_FR_SIZE ((((GDB_FR_CP0_PRID) + LONGSIZE) + (PTRSIZE-1)) & ~(PTRSIZE-1))
135
136#ifndef __ASSEMBLY__
137
138/*
139 * This is the same as above, but for the high-level
140 * part of the GDB stub.
141 */
142
143struct gdb_regs {
144 /*
145 * Pad bytes for argument save space on the stack
146 * 24/48 Bytes for 32/64 bit code
147 */
148 unsigned long pad0[6];
149
150 /*
151 * saved main processor registers
152 */
153 long reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7;
154 long reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15;
155 long reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23;
156 long reg24, reg25, reg26, reg27, reg28, reg29, reg30, reg31;
157
158 /*
159 * Saved special registers
160 */
161 long cp0_status;
162 long lo;
163 long hi;
164 long cp0_badvaddr;
165 long cp0_cause;
166 long cp0_epc;
167
168 /*
169 * Saved floating point registers
170 */
171 long fpr0, fpr1, fpr2, fpr3, fpr4, fpr5, fpr6, fpr7;
172 long fpr8, fpr9, fpr10, fpr11, fpr12, fpr13, fpr14, fpr15;
173 long fpr16, fpr17, fpr18, fpr19, fpr20, fpr21, fpr22, fpr23;
174 long fpr24, fpr25, fpr26, fpr27, fpr28, fpr29, fpr30, fpr31;
175
176 long cp1_fsr;
177 long cp1_fir;
178
179 /*
180 * Frame pointer
181 */
182 long frame_ptr;
183 long dummy; /* unused */
184
185 /*
186 * saved cp0 registers
187 */
188 long cp0_index;
189 long cp0_random;
190 long cp0_entrylo0;
191 long cp0_entrylo1;
192 long cp0_context;
193 long cp0_pagemask;
194 long cp0_wired;
195 long cp0_reg7;
196 long cp0_reg8;
197 long cp0_reg9;
198 long cp0_entryhi;
199 long cp0_reg11;
200 long cp0_reg12;
201 long cp0_reg13;
202 long cp0_reg14;
203 long cp0_prid;
204};
205
206/*
207 * Prototypes
208 */
209
210extern int kgdb_enabled;
211void set_debug_traps(void);
212void set_async_breakpoint(unsigned long *epc);
213
214#endif /* !__ASSEMBLY__ */
215#endif /* _ASM_GDB_STUB_H */
diff --git a/include/asm-mips/gfx.h b/include/asm-mips/gfx.h
new file mode 100644
index 000000000000..37235e41a6fd
--- /dev/null
+++ b/include/asm-mips/gfx.h
@@ -0,0 +1,55 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * This is the user-visible SGI GFX interface.
7 *
8 * This must be used verbatim into the GNU libc. It does not include
9 * any kernel-only bits on it.
10 *
11 * miguel@nuclecu.unam.mx
12 */
13#ifndef _ASM_GFX_H
14#define _ASM_GFX_H
15
16/* The iocls, yes, they do not make sense, but such is life */
17#define GFX_BASE 100
18#define GFX_GETNUM_BOARDS (GFX_BASE + 1)
19#define GFX_GETBOARD_INFO (GFX_BASE + 2)
20#define GFX_ATTACH_BOARD (GFX_BASE + 3)
21#define GFX_DETACH_BOARD (GFX_BASE + 4)
22#define GFX_IS_MANAGED (GFX_BASE + 5)
23
24#define GFX_MAPALL (GFX_BASE + 10)
25#define GFX_LABEL (GFX_BASE + 11)
26
27#define GFX_INFO_NAME_SIZE 16
28#define GFX_INFO_LABEL_SIZE 16
29
30struct gfx_info {
31 char name [GFX_INFO_NAME_SIZE]; /* board name */
32 char label [GFX_INFO_LABEL_SIZE]; /* label name */
33 unsigned short int xpmax, ypmax; /* screen resolution */
34 unsigned int lenght; /* size of a complete gfx_info for this board */
35};
36
37struct gfx_getboardinfo_args {
38 unsigned int board; /* board number. starting from zero */
39 void *buf; /* pointer to gfx_info */
40 unsigned int len; /* buffer size of buf */
41};
42
43struct gfx_attach_board_args {
44 unsigned int board; /* board number, starting from zero */
45 void *vaddr; /* address where the board registers should be mapped */
46};
47
48#ifdef __KERNEL__
49/* umap.c */
50extern void remove_mapping (struct vm_area_struct *vma, struct task_struct *, unsigned long, unsigned long);
51extern void *vmalloc_uncached (unsigned long size);
52extern int vmap_page_range (struct vm_area_struct *vma, unsigned long from, unsigned long size, unsigned long vaddr);
53#endif
54
55#endif /* _ASM_GFX_H */
diff --git a/include/asm-mips/gt64120.h b/include/asm-mips/gt64120.h
new file mode 100644
index 000000000000..2edd171bb6cd
--- /dev/null
+++ b/include/asm-mips/gt64120.h
@@ -0,0 +1,561 @@
1/*
2 * Copyright (C) 2000, 2004, 2005 MIPS Technologies, Inc.
3 * All rights reserved.
4 * Authors: Carsten Langgaard <carstenl@mips.com>
5 * Maciej W. Rozycki <macro@mips.com>
6 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 */
21#ifndef _ASM_GT64120_H
22#define _ASM_GT64120_H
23
24#include <asm/addrspace.h>
25#include <asm/byteorder.h>
26
27#define MSK(n) ((1 << (n)) - 1)
28
29/*
30 * Register offset addresses
31 */
32/* CPU Configuration. */
33#define GT_CPU_OFS 0x000
34
35#define GT_MULTI_OFS 0x120
36
37/* CPU Address Decode. */
38#define GT_SCS10LD_OFS 0x008
39#define GT_SCS10HD_OFS 0x010
40#define GT_SCS32LD_OFS 0x018
41#define GT_SCS32HD_OFS 0x020
42#define GT_CS20LD_OFS 0x028
43#define GT_CS20HD_OFS 0x030
44#define GT_CS3BOOTLD_OFS 0x038
45#define GT_CS3BOOTHD_OFS 0x040
46#define GT_PCI0IOLD_OFS 0x048
47#define GT_PCI0IOHD_OFS 0x050
48#define GT_PCI0M0LD_OFS 0x058
49#define GT_PCI0M0HD_OFS 0x060
50#define GT_ISD_OFS 0x068
51
52#define GT_PCI0M1LD_OFS 0x080
53#define GT_PCI0M1HD_OFS 0x088
54#define GT_PCI1IOLD_OFS 0x090
55#define GT_PCI1IOHD_OFS 0x098
56#define GT_PCI1M0LD_OFS 0x0a0
57#define GT_PCI1M0HD_OFS 0x0a8
58#define GT_PCI1M1LD_OFS 0x0b0
59#define GT_PCI1M1HD_OFS 0x0b8
60#define GT_PCI1M1LD_OFS 0x0b0
61#define GT_PCI1M1HD_OFS 0x0b8
62
63#define GT_SCS10AR_OFS 0x0d0
64#define GT_SCS32AR_OFS 0x0d8
65#define GT_CS20R_OFS 0x0e0
66#define GT_CS3BOOTR_OFS 0x0e8
67
68#define GT_PCI0IOREMAP_OFS 0x0f0
69#define GT_PCI0M0REMAP_OFS 0x0f8
70#define GT_PCI0M1REMAP_OFS 0x100
71#define GT_PCI1IOREMAP_OFS 0x108
72#define GT_PCI1M0REMAP_OFS 0x110
73#define GT_PCI1M1REMAP_OFS 0x118
74
75/* CPU Error Report. */
76#define GT_CPUERR_ADDRLO_OFS 0x070
77#define GT_CPUERR_ADDRHI_OFS 0x078
78
79#define GT_CPUERR_DATALO_OFS 0x128 /* GT-64120A only */
80#define GT_CPUERR_DATAHI_OFS 0x130 /* GT-64120A only */
81#define GT_CPUERR_PARITY_OFS 0x138 /* GT-64120A only */
82
83/* CPU Sync Barrier. */
84#define GT_PCI0SYNC_OFS 0x0c0
85#define GT_PCI1SYNC_OFS 0x0c8
86
87/* SDRAM and Device Address Decode. */
88#define GT_SCS0LD_OFS 0x400
89#define GT_SCS0HD_OFS 0x404
90#define GT_SCS1LD_OFS 0x408
91#define GT_SCS1HD_OFS 0x40c
92#define GT_SCS2LD_OFS 0x410
93#define GT_SCS2HD_OFS 0x414
94#define GT_SCS3LD_OFS 0x418
95#define GT_SCS3HD_OFS 0x41c
96#define GT_CS0LD_OFS 0x420
97#define GT_CS0HD_OFS 0x424
98#define GT_CS1LD_OFS 0x428
99#define GT_CS1HD_OFS 0x42c
100#define GT_CS2LD_OFS 0x430
101#define GT_CS2HD_OFS 0x434
102#define GT_CS3LD_OFS 0x438
103#define GT_CS3HD_OFS 0x43c
104#define GT_BOOTLD_OFS 0x440
105#define GT_BOOTHD_OFS 0x444
106
107#define GT_ADERR_OFS 0x470
108
109/* SDRAM Configuration. */
110#define GT_SDRAM_CFG_OFS 0x448
111
112#define GT_SDRAM_OPMODE_OFS 0x474
113#define GT_SDRAM_BM_OFS 0x478
114#define GT_SDRAM_ADDRDECODE_OFS 0x47c
115
116/* SDRAM Parameters. */
117#define GT_SDRAM_B0_OFS 0x44c
118#define GT_SDRAM_B1_OFS 0x450
119#define GT_SDRAM_B2_OFS 0x454
120#define GT_SDRAM_B3_OFS 0x458
121
122/* Device Parameters. */
123#define GT_DEV_B0_OFS 0x45c
124#define GT_DEV_B1_OFS 0x460
125#define GT_DEV_B2_OFS 0x464
126#define GT_DEV_B3_OFS 0x468
127#define GT_DEV_BOOT_OFS 0x46c
128
129/* ECC. */
130#define GT_ECC_ERRDATALO 0x480 /* GT-64120A only */
131#define GT_ECC_ERRDATAHI 0x484 /* GT-64120A only */
132#define GT_ECC_MEM 0x488 /* GT-64120A only */
133#define GT_ECC_CALC 0x48c /* GT-64120A only */
134#define GT_ECC_ERRADDR 0x490 /* GT-64120A only */
135
136/* DMA Record. */
137#define GT_DMA0_CNT_OFS 0x800
138#define GT_DMA1_CNT_OFS 0x804
139#define GT_DMA2_CNT_OFS 0x808
140#define GT_DMA3_CNT_OFS 0x80c
141#define GT_DMA0_SA_OFS 0x810
142#define GT_DMA1_SA_OFS 0x814
143#define GT_DMA2_SA_OFS 0x818
144#define GT_DMA3_SA_OFS 0x81c
145#define GT_DMA0_DA_OFS 0x820
146#define GT_DMA1_DA_OFS 0x824
147#define GT_DMA2_DA_OFS 0x828
148#define GT_DMA3_DA_OFS 0x82c
149#define GT_DMA0_NEXT_OFS 0x830
150#define GT_DMA1_NEXT_OFS 0x834
151#define GT_DMA2_NEXT_OFS 0x838
152#define GT_DMA3_NEXT_OFS 0x83c
153
154#define GT_DMA0_CUR_OFS 0x870
155#define GT_DMA1_CUR_OFS 0x874
156#define GT_DMA2_CUR_OFS 0x878
157#define GT_DMA3_CUR_OFS 0x87c
158
159/* DMA Channel Control. */
160#define GT_DMA0_CTRL_OFS 0x840
161#define GT_DMA1_CTRL_OFS 0x844
162#define GT_DMA2_CTRL_OFS 0x848
163#define GT_DMA3_CTRL_OFS 0x84c
164
165/* DMA Arbiter. */
166#define GT_DMA_ARB_OFS 0x860
167
168/* Timer/Counter. */
169#define GT_TC0_OFS 0x850
170#define GT_TC1_OFS 0x854
171#define GT_TC2_OFS 0x858
172#define GT_TC3_OFS 0x85c
173
174#define GT_TC_CONTROL_OFS 0x864
175
176/* PCI Internal. */
177#define GT_PCI0_CMD_OFS 0xc00
178#define GT_PCI0_TOR_OFS 0xc04
179#define GT_PCI0_BS_SCS10_OFS 0xc08
180#define GT_PCI0_BS_SCS32_OFS 0xc0c
181#define GT_PCI0_BS_CS20_OFS 0xc10
182#define GT_PCI0_BS_CS3BT_OFS 0xc14
183
184#define GT_PCI1_IACK_OFS 0xc30
185#define GT_PCI0_IACK_OFS 0xc34
186
187#define GT_PCI0_BARE_OFS 0xc3c
188#define GT_PCI0_PREFMBR_OFS 0xc40
189
190#define GT_PCI0_SCS10_BAR_OFS 0xc48
191#define GT_PCI0_SCS32_BAR_OFS 0xc4c
192#define GT_PCI0_CS20_BAR_OFS 0xc50
193#define GT_PCI0_CS3BT_BAR_OFS 0xc54
194#define GT_PCI0_SSCS10_BAR_OFS 0xc58
195#define GT_PCI0_SSCS32_BAR_OFS 0xc5c
196
197#define GT_PCI0_SCS3BT_BAR_OFS 0xc64
198
199#define GT_PCI1_CMD_OFS 0xc80
200#define GT_PCI1_TOR_OFS 0xc84
201#define GT_PCI1_BS_SCS10_OFS 0xc88
202#define GT_PCI1_BS_SCS32_OFS 0xc8c
203#define GT_PCI1_BS_CS20_OFS 0xc90
204#define GT_PCI1_BS_CS3BT_OFS 0xc94
205
206#define GT_PCI1_BARE_OFS 0xcbc
207#define GT_PCI1_PREFMBR_OFS 0xcc0
208
209#define GT_PCI1_SCS10_BAR_OFS 0xcc8
210#define GT_PCI1_SCS32_BAR_OFS 0xccc
211#define GT_PCI1_CS20_BAR_OFS 0xcd0
212#define GT_PCI1_CS3BT_BAR_OFS 0xcd4
213#define GT_PCI1_SSCS10_BAR_OFS 0xcd8
214#define GT_PCI1_SSCS32_BAR_OFS 0xcdc
215
216#define GT_PCI1_SCS3BT_BAR_OFS 0xce4
217
218#define GT_PCI1_CFGADDR_OFS 0xcf0
219#define GT_PCI1_CFGDATA_OFS 0xcf4
220#define GT_PCI0_CFGADDR_OFS 0xcf8
221#define GT_PCI0_CFGDATA_OFS 0xcfc
222
223/* Interrupts. */
224#define GT_INTRCAUSE_OFS 0xc18
225#define GT_INTRMASK_OFS 0xc1c
226
227#define GT_PCI0_ICMASK_OFS 0xc24
228#define GT_PCI0_SERR0MASK_OFS 0xc28
229
230#define GT_CPU_INTSEL_OFS 0xc70
231#define GT_PCI0_INTSEL_OFS 0xc74
232
233#define GT_HINTRCAUSE_OFS 0xc98
234#define GT_HINTRMASK_OFS 0xc9c
235
236#define GT_PCI0_HICMASK_OFS 0xca4
237#define GT_PCI1_SERR1MASK_OFS 0xca8
238
239
240/*
241 * I2O Support Registers
242 */
243#define INBOUND_MESSAGE_REGISTER0_PCI_SIDE 0x010
244#define INBOUND_MESSAGE_REGISTER1_PCI_SIDE 0x014
245#define OUTBOUND_MESSAGE_REGISTER0_PCI_SIDE 0x018
246#define OUTBOUND_MESSAGE_REGISTER1_PCI_SIDE 0x01c
247#define INBOUND_DOORBELL_REGISTER_PCI_SIDE 0x020
248#define INBOUND_INTERRUPT_CAUSE_REGISTER_PCI_SIDE 0x024
249#define INBOUND_INTERRUPT_MASK_REGISTER_PCI_SIDE 0x028
250#define OUTBOUND_DOORBELL_REGISTER_PCI_SIDE 0x02c
251#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_PCI_SIDE 0x030
252#define OUTBOUND_INTERRUPT_MASK_REGISTER_PCI_SIDE 0x034
253#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI_SIDE 0x040
254#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI_SIDE 0x044
255#define QUEUE_CONTROL_REGISTER_PCI_SIDE 0x050
256#define QUEUE_BASE_ADDRESS_REGISTER_PCI_SIDE 0x054
257#define INBOUND_FREE_HEAD_POINTER_REGISTER_PCI_SIDE 0x060
258#define INBOUND_FREE_TAIL_POINTER_REGISTER_PCI_SIDE 0x064
259#define INBOUND_POST_HEAD_POINTER_REGISTER_PCI_SIDE 0x068
260#define INBOUND_POST_TAIL_POINTER_REGISTER_PCI_SIDE 0x06c
261#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_PCI_SIDE 0x070
262#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_PCI_SIDE 0x074
263#define OUTBOUND_POST_HEAD_POINTER_REGISTER_PCI_SIDE 0x078
264#define OUTBOUND_POST_TAIL_POINTER_REGISTER_PCI_SIDE 0x07c
265
266#define INBOUND_MESSAGE_REGISTER0_CPU_SIDE 0x1c10
267#define INBOUND_MESSAGE_REGISTER1_CPU_SIDE 0x1c14
268#define OUTBOUND_MESSAGE_REGISTER0_CPU_SIDE 0x1c18
269#define OUTBOUND_MESSAGE_REGISTER1_CPU_SIDE 0x1c1c
270#define INBOUND_DOORBELL_REGISTER_CPU_SIDE 0x1c20
271#define INBOUND_INTERRUPT_CAUSE_REGISTER_CPU_SIDE 0x1c24
272#define INBOUND_INTERRUPT_MASK_REGISTER_CPU_SIDE 0x1c28
273#define OUTBOUND_DOORBELL_REGISTER_CPU_SIDE 0x1c2c
274#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_CPU_SIDE 0x1c30
275#define OUTBOUND_INTERRUPT_MASK_REGISTER_CPU_SIDE 0x1c34
276#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU_SIDE 0x1c40
277#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU_SIDE 0x1c44
278#define QUEUE_CONTROL_REGISTER_CPU_SIDE 0x1c50
279#define QUEUE_BASE_ADDRESS_REGISTER_CPU_SIDE 0x1c54
280#define INBOUND_FREE_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c60
281#define INBOUND_FREE_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c64
282#define INBOUND_POST_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c68
283#define INBOUND_POST_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c6c
284#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c70
285#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c74
286#define OUTBOUND_POST_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c78
287#define OUTBOUND_POST_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c7c
288
289/*
290 * Register encodings
291 */
292#define GT_CPU_ENDIAN_SHF 12
293#define GT_CPU_ENDIAN_MSK (MSK(1) << GT_CPU_ENDIAN_SHF)
294#define GT_CPU_ENDIAN_BIT GT_CPU_ENDIAN_MSK
295#define GT_CPU_WR_SHF 16
296#define GT_CPU_WR_MSK (MSK(1) << GT_CPU_WR_SHF)
297#define GT_CPU_WR_BIT GT_CPU_WR_MSK
298#define GT_CPU_WR_DXDXDXDX 0
299#define GT_CPU_WR_DDDD 1
300
301
302#define GT_PCI_DCRM_SHF 21
303#define GT_PCI_LD_SHF 0
304#define GT_PCI_LD_MSK (MSK(15) << GT_PCI_LD_SHF)
305#define GT_PCI_HD_SHF 0
306#define GT_PCI_HD_MSK (MSK(7) << GT_PCI_HD_SHF)
307#define GT_PCI_REMAP_SHF 0
308#define GT_PCI_REMAP_MSK (MSK(11) << GT_PCI_REMAP_SHF)
309
310
311#define GT_CFGADDR_CFGEN_SHF 31
312#define GT_CFGADDR_CFGEN_MSK (MSK(1) << GT_CFGADDR_CFGEN_SHF)
313#define GT_CFGADDR_CFGEN_BIT GT_CFGADDR_CFGEN_MSK
314
315#define GT_CFGADDR_BUSNUM_SHF 16
316#define GT_CFGADDR_BUSNUM_MSK (MSK(8) << GT_CFGADDR_BUSNUM_SHF)
317
318#define GT_CFGADDR_DEVNUM_SHF 11
319#define GT_CFGADDR_DEVNUM_MSK (MSK(5) << GT_CFGADDR_DEVNUM_SHF)
320
321#define GT_CFGADDR_FUNCNUM_SHF 8
322#define GT_CFGADDR_FUNCNUM_MSK (MSK(3) << GT_CFGADDR_FUNCNUM_SHF)
323
324#define GT_CFGADDR_REGNUM_SHF 2
325#define GT_CFGADDR_REGNUM_MSK (MSK(6) << GT_CFGADDR_REGNUM_SHF)
326
327
328#define GT_SDRAM_BM_ORDER_SHF 2
329#define GT_SDRAM_BM_ORDER_MSK (MSK(1) << GT_SDRAM_BM_ORDER_SHF)
330#define GT_SDRAM_BM_ORDER_BIT GT_SDRAM_BM_ORDER_MSK
331#define GT_SDRAM_BM_ORDER_SUB 1
332#define GT_SDRAM_BM_ORDER_LIN 0
333
334#define GT_SDRAM_BM_RSVD_ALL1 0xffb
335
336
337#define GT_SDRAM_ADDRDECODE_ADDR_SHF 0
338#define GT_SDRAM_ADDRDECODE_ADDR_MSK (MSK(3) << GT_SDRAM_ADDRDECODE_ADDR_SHF)
339#define GT_SDRAM_ADDRDECODE_ADDR_0 0
340#define GT_SDRAM_ADDRDECODE_ADDR_1 1
341#define GT_SDRAM_ADDRDECODE_ADDR_2 2
342#define GT_SDRAM_ADDRDECODE_ADDR_3 3
343#define GT_SDRAM_ADDRDECODE_ADDR_4 4
344#define GT_SDRAM_ADDRDECODE_ADDR_5 5
345#define GT_SDRAM_ADDRDECODE_ADDR_6 6
346#define GT_SDRAM_ADDRDECODE_ADDR_7 7
347
348
349#define GT_SDRAM_B0_CASLAT_SHF 0
350#define GT_SDRAM_B0_CASLAT_MSK (MSK(2) << GT_SDRAM_B0__SHF)
351#define GT_SDRAM_B0_CASLAT_2 1
352#define GT_SDRAM_B0_CASLAT_3 2
353
354#define GT_SDRAM_B0_FTDIS_SHF 2
355#define GT_SDRAM_B0_FTDIS_MSK (MSK(1) << GT_SDRAM_B0_FTDIS_SHF)
356#define GT_SDRAM_B0_FTDIS_BIT GT_SDRAM_B0_FTDIS_MSK
357
358#define GT_SDRAM_B0_SRASPRCHG_SHF 3
359#define GT_SDRAM_B0_SRASPRCHG_MSK (MSK(1) << GT_SDRAM_B0_SRASPRCHG_SHF)
360#define GT_SDRAM_B0_SRASPRCHG_BIT GT_SDRAM_B0_SRASPRCHG_MSK
361#define GT_SDRAM_B0_SRASPRCHG_2 0
362#define GT_SDRAM_B0_SRASPRCHG_3 1
363
364#define GT_SDRAM_B0_B0COMPAB_SHF 4
365#define GT_SDRAM_B0_B0COMPAB_MSK (MSK(1) << GT_SDRAM_B0_B0COMPAB_SHF)
366#define GT_SDRAM_B0_B0COMPAB_BIT GT_SDRAM_B0_B0COMPAB_MSK
367
368#define GT_SDRAM_B0_64BITINT_SHF 5
369#define GT_SDRAM_B0_64BITINT_MSK (MSK(1) << GT_SDRAM_B0_64BITINT_SHF)
370#define GT_SDRAM_B0_64BITINT_BIT GT_SDRAM_B0_64BITINT_MSK
371#define GT_SDRAM_B0_64BITINT_2 0
372#define GT_SDRAM_B0_64BITINT_4 1
373
374#define GT_SDRAM_B0_BW_SHF 6
375#define GT_SDRAM_B0_BW_MSK (MSK(1) << GT_SDRAM_B0_BW_SHF)
376#define GT_SDRAM_B0_BW_BIT GT_SDRAM_B0_BW_MSK
377#define GT_SDRAM_B0_BW_32 0
378#define GT_SDRAM_B0_BW_64 1
379
380#define GT_SDRAM_B0_BLODD_SHF 7
381#define GT_SDRAM_B0_BLODD_MSK (MSK(1) << GT_SDRAM_B0_BLODD_SHF)
382#define GT_SDRAM_B0_BLODD_BIT GT_SDRAM_B0_BLODD_MSK
383
384#define GT_SDRAM_B0_PAR_SHF 8
385#define GT_SDRAM_B0_PAR_MSK (MSK(1) << GT_SDRAM_B0_PAR_SHF)
386#define GT_SDRAM_B0_PAR_BIT GT_SDRAM_B0_PAR_MSK
387
388#define GT_SDRAM_B0_BYPASS_SHF 9
389#define GT_SDRAM_B0_BYPASS_MSK (MSK(1) << GT_SDRAM_B0_BYPASS_SHF)
390#define GT_SDRAM_B0_BYPASS_BIT GT_SDRAM_B0_BYPASS_MSK
391
392#define GT_SDRAM_B0_SRAS2SCAS_SHF 10
393#define GT_SDRAM_B0_SRAS2SCAS_MSK (MSK(1) << GT_SDRAM_B0_SRAS2SCAS_SHF)
394#define GT_SDRAM_B0_SRAS2SCAS_BIT GT_SDRAM_B0_SRAS2SCAS_MSK
395#define GT_SDRAM_B0_SRAS2SCAS_2 0
396#define GT_SDRAM_B0_SRAS2SCAS_3 1
397
398#define GT_SDRAM_B0_SIZE_SHF 11
399#define GT_SDRAM_B0_SIZE_MSK (MSK(1) << GT_SDRAM_B0_SIZE_SHF)
400#define GT_SDRAM_B0_SIZE_BIT GT_SDRAM_B0_SIZE_MSK
401#define GT_SDRAM_B0_SIZE_16M 0
402#define GT_SDRAM_B0_SIZE_64M 1
403
404#define GT_SDRAM_B0_EXTPAR_SHF 12
405#define GT_SDRAM_B0_EXTPAR_MSK (MSK(1) << GT_SDRAM_B0_EXTPAR_SHF)
406#define GT_SDRAM_B0_EXTPAR_BIT GT_SDRAM_B0_EXTPAR_MSK
407
408#define GT_SDRAM_B0_BLEN_SHF 13
409#define GT_SDRAM_B0_BLEN_MSK (MSK(1) << GT_SDRAM_B0_BLEN_SHF)
410#define GT_SDRAM_B0_BLEN_BIT GT_SDRAM_B0_BLEN_MSK
411#define GT_SDRAM_B0_BLEN_8 0
412#define GT_SDRAM_B0_BLEN_4 1
413
414
415#define GT_SDRAM_CFG_REFINT_SHF 0
416#define GT_SDRAM_CFG_REFINT_MSK (MSK(14) << GT_SDRAM_CFG_REFINT_SHF)
417
418#define GT_SDRAM_CFG_NINTERLEAVE_SHF 14
419#define GT_SDRAM_CFG_NINTERLEAVE_MSK (MSK(1) << GT_SDRAM_CFG_NINTERLEAVE_SHF)
420#define GT_SDRAM_CFG_NINTERLEAVE_BIT GT_SDRAM_CFG_NINTERLEAVE_MSK
421
422#define GT_SDRAM_CFG_RMW_SHF 15
423#define GT_SDRAM_CFG_RMW_MSK (MSK(1) << GT_SDRAM_CFG_RMW_SHF)
424#define GT_SDRAM_CFG_RMW_BIT GT_SDRAM_CFG_RMW_MSK
425
426#define GT_SDRAM_CFG_NONSTAGREF_SHF 16
427#define GT_SDRAM_CFG_NONSTAGREF_MSK (MSK(1) << GT_SDRAM_CFG_NONSTAGREF_SHF)
428#define GT_SDRAM_CFG_NONSTAGREF_BIT GT_SDRAM_CFG_NONSTAGREF_MSK
429
430#define GT_SDRAM_CFG_DUPCNTL_SHF 19
431#define GT_SDRAM_CFG_DUPCNTL_MSK (MSK(1) << GT_SDRAM_CFG_DUPCNTL_SHF)
432#define GT_SDRAM_CFG_DUPCNTL_BIT GT_SDRAM_CFG_DUPCNTL_MSK
433
434#define GT_SDRAM_CFG_DUPBA_SHF 20
435#define GT_SDRAM_CFG_DUPBA_MSK (MSK(1) << GT_SDRAM_CFG_DUPBA_SHF)
436#define GT_SDRAM_CFG_DUPBA_BIT GT_SDRAM_CFG_DUPBA_MSK
437
438#define GT_SDRAM_CFG_DUPEOT0_SHF 21
439#define GT_SDRAM_CFG_DUPEOT0_MSK (MSK(1) << GT_SDRAM_CFG_DUPEOT0_SHF)
440#define GT_SDRAM_CFG_DUPEOT0_BIT GT_SDRAM_CFG_DUPEOT0_MSK
441
442#define GT_SDRAM_CFG_DUPEOT1_SHF 22
443#define GT_SDRAM_CFG_DUPEOT1_MSK (MSK(1) << GT_SDRAM_CFG_DUPEOT1_SHF)
444#define GT_SDRAM_CFG_DUPEOT1_BIT GT_SDRAM_CFG_DUPEOT1_MSK
445
446#define GT_SDRAM_OPMODE_OP_SHF 0
447#define GT_SDRAM_OPMODE_OP_MSK (MSK(3) << GT_SDRAM_OPMODE_OP_SHF)
448#define GT_SDRAM_OPMODE_OP_NORMAL 0
449#define GT_SDRAM_OPMODE_OP_NOP 1
450#define GT_SDRAM_OPMODE_OP_PRCHG 2
451#define GT_SDRAM_OPMODE_OP_MODE 3
452#define GT_SDRAM_OPMODE_OP_CBR 4
453
454
455#define GT_PCI0_BARE_SWSCS3BOOTDIS_SHF 0
456#define GT_PCI0_BARE_SWSCS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS3BOOTDIS_SHF)
457#define GT_PCI0_BARE_SWSCS3BOOTDIS_BIT GT_PCI0_BARE_SWSCS3BOOTDIS_MSK
458
459#define GT_PCI0_BARE_SWSCS32DIS_SHF 1
460#define GT_PCI0_BARE_SWSCS32DIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS32DIS_SHF)
461#define GT_PCI0_BARE_SWSCS32DIS_BIT GT_PCI0_BARE_SWSCS32DIS_MSK
462
463#define GT_PCI0_BARE_SWSCS10DIS_SHF 2
464#define GT_PCI0_BARE_SWSCS10DIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS10DIS_SHF)
465#define GT_PCI0_BARE_SWSCS10DIS_BIT GT_PCI0_BARE_SWSCS10DIS_MSK
466
467#define GT_PCI0_BARE_INTIODIS_SHF 3
468#define GT_PCI0_BARE_INTIODIS_MSK (MSK(1) << GT_PCI0_BARE_INTIODIS_SHF)
469#define GT_PCI0_BARE_INTIODIS_BIT GT_PCI0_BARE_INTIODIS_MSK
470
471#define GT_PCI0_BARE_INTMEMDIS_SHF 4
472#define GT_PCI0_BARE_INTMEMDIS_MSK (MSK(1) << GT_PCI0_BARE_INTMEMDIS_SHF)
473#define GT_PCI0_BARE_INTMEMDIS_BIT GT_PCI0_BARE_INTMEMDIS_MSK
474
475#define GT_PCI0_BARE_CS3BOOTDIS_SHF 5
476#define GT_PCI0_BARE_CS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_CS3BOOTDIS_SHF)
477#define GT_PCI0_BARE_CS3BOOTDIS_BIT GT_PCI0_BARE_CS3BOOTDIS_MSK
478
479#define GT_PCI0_BARE_CS20DIS_SHF 6
480#define GT_PCI0_BARE_CS20DIS_MSK (MSK(1) << GT_PCI0_BARE_CS20DIS_SHF)
481#define GT_PCI0_BARE_CS20DIS_BIT GT_PCI0_BARE_CS20DIS_MSK
482
483#define GT_PCI0_BARE_SCS32DIS_SHF 7
484#define GT_PCI0_BARE_SCS32DIS_MSK (MSK(1) << GT_PCI0_BARE_SCS32DIS_SHF)
485#define GT_PCI0_BARE_SCS32DIS_BIT GT_PCI0_BARE_SCS32DIS_MSK
486
487#define GT_PCI0_BARE_SCS10DIS_SHF 8
488#define GT_PCI0_BARE_SCS10DIS_MSK (MSK(1) << GT_PCI0_BARE_SCS10DIS_SHF)
489#define GT_PCI0_BARE_SCS10DIS_BIT GT_PCI0_BARE_SCS10DIS_MSK
490
491
492#define GT_INTRCAUSE_MASABORT0_SHF 18
493#define GT_INTRCAUSE_MASABORT0_MSK (MSK(1) << GT_INTRCAUSE_MASABORT0_SHF)
494#define GT_INTRCAUSE_MASABORT0_BIT GT_INTRCAUSE_MASABORT0_MSK
495
496#define GT_INTRCAUSE_TARABORT0_SHF 19
497#define GT_INTRCAUSE_TARABORT0_MSK (MSK(1) << GT_INTRCAUSE_TARABORT0_SHF)
498#define GT_INTRCAUSE_TARABORT0_BIT GT_INTRCAUSE_TARABORT0_MSK
499
500
501#define GT_PCI0_CFGADDR_REGNUM_SHF 2
502#define GT_PCI0_CFGADDR_REGNUM_MSK (MSK(6) << GT_PCI0_CFGADDR_REGNUM_SHF)
503#define GT_PCI0_CFGADDR_FUNCTNUM_SHF 8
504#define GT_PCI0_CFGADDR_FUNCTNUM_MSK (MSK(3) << GT_PCI0_CFGADDR_FUNCTNUM_SHF)
505#define GT_PCI0_CFGADDR_DEVNUM_SHF 11
506#define GT_PCI0_CFGADDR_DEVNUM_MSK (MSK(5) << GT_PCI0_CFGADDR_DEVNUM_SHF)
507#define GT_PCI0_CFGADDR_BUSNUM_SHF 16
508#define GT_PCI0_CFGADDR_BUSNUM_MSK (MSK(8) << GT_PCI0_CFGADDR_BUSNUM_SHF)
509#define GT_PCI0_CFGADDR_CONFIGEN_SHF 31
510#define GT_PCI0_CFGADDR_CONFIGEN_MSK (MSK(1) << GT_PCI0_CFGADDR_CONFIGEN_SHF)
511#define GT_PCI0_CFGADDR_CONFIGEN_BIT GT_PCI0_CFGADDR_CONFIGEN_MSK
512
513#define GT_PCI0_CMD_MBYTESWAP_SHF 0
514#define GT_PCI0_CMD_MBYTESWAP_MSK (MSK(1) << GT_PCI0_CMD_MBYTESWAP_SHF)
515#define GT_PCI0_CMD_MBYTESWAP_BIT GT_PCI0_CMD_MBYTESWAP_MSK
516#define GT_PCI0_CMD_MWORDSWAP_SHF 10
517#define GT_PCI0_CMD_MWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_MWORDSWAP_SHF)
518#define GT_PCI0_CMD_MWORDSWAP_BIT GT_PCI0_CMD_MWORDSWAP_MSK
519#define GT_PCI0_CMD_SBYTESWAP_SHF 16
520#define GT_PCI0_CMD_SBYTESWAP_MSK (MSK(1) << GT_PCI0_CMD_SBYTESWAP_SHF)
521#define GT_PCI0_CMD_SBYTESWAP_BIT GT_PCI0_CMD_SBYTESWAP_MSK
522#define GT_PCI0_CMD_SWORDSWAP_SHF 11
523#define GT_PCI0_CMD_SWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_SWORDSWAP_SHF)
524#define GT_PCI0_CMD_SWORDSWAP_BIT GT_PCI0_CMD_SWORDSWAP_MSK
525
526/*
527 * Misc
528 */
529#define GT_DEF_PCI0_IO_BASE 0x10000000UL
530#define GT_DEF_PCI0_IO_SIZE 0x02000000UL
531#define GT_DEF_PCI0_MEM0_BASE 0x12000000UL
532#define GT_DEF_PCI0_MEM0_SIZE 0x02000000UL
533#define GT_DEF_BASE 0x14000000UL
534
535#define GT_MAX_BANKSIZE (256 * 1024 * 1024) /* Max 256MB bank */
536#define GT_LATTIM_MIN 6 /* Minimum lat */
537
538/*
539 * The gt64120_dep.h file must define the following macros
540 *
541 * GT_READ(ofs, data_pointer)
542 * GT_WRITE(ofs, data) - read/write GT64120 registers in 32bit
543 *
544 * TIMER - gt64120 timer irq, temporary solution until
545 * full gt64120 cascade interrupt support is in place
546 */
547
548#include <mach-gt64120.h>
549
550/*
551 * Because of an error/peculiarity in the Galileo chip, we need to swap the
552 * bytes when running bigendian. We also provide non-swapping versions.
553 */
554#define __GT_READ(ofs) \
555 (*(volatile u32 *)(GT64120_BASE+(ofs)))
556#define __GT_WRITE(ofs, data) \
557 do { *(volatile u32 *)(GT64120_BASE+(ofs)) = (data); } while (0)
558#define GT_READ(ofs) le32_to_cpu(__GT_READ(ofs))
559#define GT_WRITE(ofs, data) __GT_WRITE(ofs, cpu_to_le32(data))
560
561#endif /* _ASM_GT64120_H */
diff --git a/include/asm-mips/gt64240.h b/include/asm-mips/gt64240.h
new file mode 100644
index 000000000000..8f9bd341ed49
--- /dev/null
+++ b/include/asm-mips/gt64240.h
@@ -0,0 +1,1235 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright - Galileo technology.
7 * Copyright (C) 2004 by Ralf Baechle
8 */
9#ifndef __ASM_MIPS_MV64240_H
10#define __ASM_MIPS_MV64240_H
11
12#include <asm/addrspace.h>
13#include <asm/marvell.h>
14
15/*
16 * CPU Control Registers
17 */
18
19#define CPU_CONFIGURATION 0x000
20#define CPU_MODE 0x120
21#define CPU_READ_RESPONSE_CROSSBAR_LOW 0x170
22#define CPU_READ_RESPONSE_CROSSBAR_HIGH 0x178
23
24/*
25 * Processor Address Space
26 */
27
28/* Sdram's BAR'S */
29#define SCS_0_LOW_DECODE_ADDRESS 0x008
30#define SCS_0_HIGH_DECODE_ADDRESS 0x010
31#define SCS_1_LOW_DECODE_ADDRESS 0x208
32#define SCS_1_HIGH_DECODE_ADDRESS 0x210
33#define SCS_2_LOW_DECODE_ADDRESS 0x018
34#define SCS_2_HIGH_DECODE_ADDRESS 0x020
35#define SCS_3_LOW_DECODE_ADDRESS 0x218
36#define SCS_3_HIGH_DECODE_ADDRESS 0x220
37/* Devices BAR'S */
38#define CS_0_LOW_DECODE_ADDRESS 0x028
39#define CS_0_HIGH_DECODE_ADDRESS 0x030
40#define CS_1_LOW_DECODE_ADDRESS 0x228
41#define CS_1_HIGH_DECODE_ADDRESS 0x230
42#define CS_2_LOW_DECODE_ADDRESS 0x248
43#define CS_2_HIGH_DECODE_ADDRESS 0x250
44#define CS_3_LOW_DECODE_ADDRESS 0x038
45#define CS_3_HIGH_DECODE_ADDRESS 0x040
46#define BOOTCS_LOW_DECODE_ADDRESS 0x238
47#define BOOTCS_HIGH_DECODE_ADDRESS 0x240
48
49#define PCI_0I_O_LOW_DECODE_ADDRESS 0x048
50#define PCI_0I_O_HIGH_DECODE_ADDRESS 0x050
51#define PCI_0MEMORY0_LOW_DECODE_ADDRESS 0x058
52#define PCI_0MEMORY0_HIGH_DECODE_ADDRESS 0x060
53#define PCI_0MEMORY1_LOW_DECODE_ADDRESS 0x080
54#define PCI_0MEMORY1_HIGH_DECODE_ADDRESS 0x088
55#define PCI_0MEMORY2_LOW_DECODE_ADDRESS 0x258
56#define PCI_0MEMORY2_HIGH_DECODE_ADDRESS 0x260
57#define PCI_0MEMORY3_LOW_DECODE_ADDRESS 0x280
58#define PCI_0MEMORY3_HIGH_DECODE_ADDRESS 0x288
59
60#define PCI_1I_O_LOW_DECODE_ADDRESS 0x090
61#define PCI_1I_O_HIGH_DECODE_ADDRESS 0x098
62#define PCI_1MEMORY0_LOW_DECODE_ADDRESS 0x0a0
63#define PCI_1MEMORY0_HIGH_DECODE_ADDRESS 0x0a8
64#define PCI_1MEMORY1_LOW_DECODE_ADDRESS 0x0b0
65#define PCI_1MEMORY1_HIGH_DECODE_ADDRESS 0x0b8
66#define PCI_1MEMORY2_LOW_DECODE_ADDRESS 0x2a0
67#define PCI_1MEMORY2_HIGH_DECODE_ADDRESS 0x2a8
68#define PCI_1MEMORY3_LOW_DECODE_ADDRESS 0x2b0
69#define PCI_1MEMORY3_HIGH_DECODE_ADDRESS 0x2b8
70
71#define INTERNAL_SPACE_DECODE 0x068
72
73#define CPU_0_LOW_DECODE_ADDRESS 0x290
74#define CPU_0_HIGH_DECODE_ADDRESS 0x298
75#define CPU_1_LOW_DECODE_ADDRESS 0x2c0
76#define CPU_1_HIGH_DECODE_ADDRESS 0x2c8
77
78#define PCI_0I_O_ADDRESS_REMAP 0x0f0
79#define PCI_0MEMORY0_ADDRESS_REMAP 0x0f8
80#define PCI_0MEMORY0_HIGH_ADDRESS_REMAP 0x320
81#define PCI_0MEMORY1_ADDRESS_REMAP 0x100
82#define PCI_0MEMORY1_HIGH_ADDRESS_REMAP 0x328
83#define PCI_0MEMORY2_ADDRESS_REMAP 0x2f8
84#define PCI_0MEMORY2_HIGH_ADDRESS_REMAP 0x330
85#define PCI_0MEMORY3_ADDRESS_REMAP 0x300
86#define PCI_0MEMORY3_HIGH_ADDRESS_REMAP 0x338
87
88#define PCI_1I_O_ADDRESS_REMAP 0x108
89#define PCI_1MEMORY0_ADDRESS_REMAP 0x110
90#define PCI_1MEMORY0_HIGH_ADDRESS_REMAP 0x340
91#define PCI_1MEMORY1_ADDRESS_REMAP 0x118
92#define PCI_1MEMORY1_HIGH_ADDRESS_REMAP 0x348
93#define PCI_1MEMORY2_ADDRESS_REMAP 0x310
94#define PCI_1MEMORY2_HIGH_ADDRESS_REMAP 0x350
95#define PCI_1MEMORY3_ADDRESS_REMAP 0x318
96#define PCI_1MEMORY3_HIGH_ADDRESS_REMAP 0x358
97
98/*
99 * CPU Sync Barrier
100 */
101
102#define PCI_0SYNC_BARIER_VIRTUAL_REGISTER 0x0c0
103#define PCI_1SYNC_BARIER_VIRTUAL_REGISTER 0x0c8
104
105
106/*
107 * CPU Access Protect
108 */
109
110#define CPU_LOW_PROTECT_ADDRESS_0 0X180
111#define CPU_HIGH_PROTECT_ADDRESS_0 0X188
112#define CPU_LOW_PROTECT_ADDRESS_1 0X190
113#define CPU_HIGH_PROTECT_ADDRESS_1 0X198
114#define CPU_LOW_PROTECT_ADDRESS_2 0X1a0
115#define CPU_HIGH_PROTECT_ADDRESS_2 0X1a8
116#define CPU_LOW_PROTECT_ADDRESS_3 0X1b0
117#define CPU_HIGH_PROTECT_ADDRESS_3 0X1b8
118#define CPU_LOW_PROTECT_ADDRESS_4 0X1c0
119#define CPU_HIGH_PROTECT_ADDRESS_4 0X1c8
120#define CPU_LOW_PROTECT_ADDRESS_5 0X1d0
121#define CPU_HIGH_PROTECT_ADDRESS_5 0X1d8
122#define CPU_LOW_PROTECT_ADDRESS_6 0X1e0
123#define CPU_HIGH_PROTECT_ADDRESS_6 0X1e8
124#define CPU_LOW_PROTECT_ADDRESS_7 0X1f0
125#define CPU_HIGH_PROTECT_ADDRESS_7 0X1f8
126
127
128/*
129 * Snoop Control
130 */
131
132#define SNOOP_BASE_ADDRESS_0 0x380
133#define SNOOP_TOP_ADDRESS_0 0x388
134#define SNOOP_BASE_ADDRESS_1 0x390
135#define SNOOP_TOP_ADDRESS_1 0x398
136#define SNOOP_BASE_ADDRESS_2 0x3a0
137#define SNOOP_TOP_ADDRESS_2 0x3a8
138#define SNOOP_BASE_ADDRESS_3 0x3b0
139#define SNOOP_TOP_ADDRESS_3 0x3b8
140
141/*
142 * CPU Error Report
143 */
144
145#define CPU_ERROR_ADDRESS_LOW 0x070
146#define CPU_ERROR_ADDRESS_HIGH 0x078
147#define CPU_ERROR_DATA_LOW 0x128
148#define CPU_ERROR_DATA_HIGH 0x130
149#define CPU_ERROR_PARITY 0x138
150#define CPU_ERROR_CAUSE 0x140
151#define CPU_ERROR_MASK 0x148
152
153/*
154 * Pslave Debug
155 */
156
157#define X_0_ADDRESS 0x360
158#define X_0_COMMAND_ID 0x368
159#define X_1_ADDRESS 0x370
160#define X_1_COMMAND_ID 0x378
161#define WRITE_DATA_LOW 0x3c0
162#define WRITE_DATA_HIGH 0x3c8
163#define WRITE_BYTE_ENABLE 0X3e0
164#define READ_DATA_LOW 0x3d0
165#define READ_DATA_HIGH 0x3d8
166#define READ_ID 0x3e8
167
168
169/*
170 * SDRAM and Device Address Space
171 */
172
173
174/*
175 * SDRAM Configuration
176 */
177
178#define SDRAM_CONFIGURATION 0x448
179#define SDRAM_OPERATION_MODE 0x474
180#define SDRAM_ADDRESS_DECODE 0x47C
181#define SDRAM_TIMING_PARAMETERS 0x4b4
182#define SDRAM_UMA_CONTROL 0x4a4
183#define SDRAM_CROSS_BAR_CONTROL_LOW 0x4a8
184#define SDRAM_CROSS_BAR_CONTROL_HIGH 0x4ac
185#define SDRAM_CROSS_BAR_TIMEOUT 0x4b0
186
187
188/*
189 * SDRAM Parameters
190 */
191
192#define SDRAM_BANK0PARAMETERS 0x44C
193#define SDRAM_BANK1PARAMETERS 0x450
194#define SDRAM_BANK2PARAMETERS 0x454
195#define SDRAM_BANK3PARAMETERS 0x458
196
197
198/*
199 * SDRAM Error Report
200 */
201
202#define SDRAM_ERROR_DATA_LOW 0x484
203#define SDRAM_ERROR_DATA_HIGH 0x480
204#define SDRAM_AND_DEVICE_ERROR_ADDRESS 0x490
205#define SDRAM_RECEIVED_ECC 0x488
206#define SDRAM_CALCULATED_ECC 0x48c
207#define SDRAM_ECC_CONTROL 0x494
208#define SDRAM_ECC_ERROR_COUNTER 0x498
209
210
211/*
212 * SDunit Debug (for internal use)
213 */
214
215#define X0_ADDRESS 0x500
216#define X0_COMMAND_AND_ID 0x504
217#define X0_WRITE_DATA_LOW 0x508
218#define X0_WRITE_DATA_HIGH 0x50c
219#define X0_WRITE_BYTE_ENABLE 0x518
220#define X0_READ_DATA_LOW 0x510
221#define X0_READ_DATA_HIGH 0x514
222#define X0_READ_ID 0x51c
223#define X1_ADDRESS 0x520
224#define X1_COMMAND_AND_ID 0x524
225#define X1_WRITE_DATA_LOW 0x528
226#define X1_WRITE_DATA_HIGH 0x52c
227#define X1_WRITE_BYTE_ENABLE 0x538
228#define X1_READ_DATA_LOW 0x530
229#define X1_READ_DATA_HIGH 0x534
230#define X1_READ_ID 0x53c
231#define X0_SNOOP_ADDRESS 0x540
232#define X0_SNOOP_COMMAND 0x544
233#define X1_SNOOP_ADDRESS 0x548
234#define X1_SNOOP_COMMAND 0x54c
235
236
237/*
238 * Device Parameters
239 */
240
241#define DEVICE_BANK0PARAMETERS 0x45c
242#define DEVICE_BANK1PARAMETERS 0x460
243#define DEVICE_BANK2PARAMETERS 0x464
244#define DEVICE_BANK3PARAMETERS 0x468
245#define DEVICE_BOOT_BANK_PARAMETERS 0x46c
246#define DEVICE_CONTROL 0x4c0
247#define DEVICE_CROSS_BAR_CONTROL_LOW 0x4c8
248#define DEVICE_CROSS_BAR_CONTROL_HIGH 0x4cc
249#define DEVICE_CROSS_BAR_TIMEOUT 0x4c4
250
251
252/*
253 * Device Interrupt
254 */
255
256#define DEVICE_INTERRUPT_CAUSE 0x4d0
257#define DEVICE_INTERRUPT_MASK 0x4d4
258#define DEVICE_ERROR_ADDRESS 0x4d8
259
260/*
261 * DMA Record
262 */
263
264#define CHANNEL0_DMA_BYTE_COUNT 0x800
265#define CHANNEL1_DMA_BYTE_COUNT 0x804
266#define CHANNEL2_DMA_BYTE_COUNT 0x808
267#define CHANNEL3_DMA_BYTE_COUNT 0x80C
268#define CHANNEL4_DMA_BYTE_COUNT 0x900
269#define CHANNEL5_DMA_BYTE_COUNT 0x904
270#define CHANNEL6_DMA_BYTE_COUNT 0x908
271#define CHANNEL7_DMA_BYTE_COUNT 0x90C
272#define CHANNEL0_DMA_SOURCE_ADDRESS 0x810
273#define CHANNEL1_DMA_SOURCE_ADDRESS 0x814
274#define CHANNEL2_DMA_SOURCE_ADDRESS 0x818
275#define CHANNEL3_DMA_SOURCE_ADDRESS 0x81C
276#define CHANNEL4_DMA_SOURCE_ADDRESS 0x910
277#define CHANNEL5_DMA_SOURCE_ADDRESS 0x914
278#define CHANNEL6_DMA_SOURCE_ADDRESS 0x918
279#define CHANNEL7_DMA_SOURCE_ADDRESS 0x91C
280#define CHANNEL0_DMA_DESTINATION_ADDRESS 0x820
281#define CHANNEL1_DMA_DESTINATION_ADDRESS 0x824
282#define CHANNEL2_DMA_DESTINATION_ADDRESS 0x828
283#define CHANNEL3_DMA_DESTINATION_ADDRESS 0x82C
284#define CHANNEL4_DMA_DESTINATION_ADDRESS 0x920
285#define CHANNEL5_DMA_DESTINATION_ADDRESS 0x924
286#define CHANNEL6_DMA_DESTINATION_ADDRESS 0x928
287#define CHANNEL7_DMA_DESTINATION_ADDRESS 0x92C
288#define CHANNEL0NEXT_RECORD_POINTER 0x830
289#define CHANNEL1NEXT_RECORD_POINTER 0x834
290#define CHANNEL2NEXT_RECORD_POINTER 0x838
291#define CHANNEL3NEXT_RECORD_POINTER 0x83C
292#define CHANNEL4NEXT_RECORD_POINTER 0x930
293#define CHANNEL5NEXT_RECORD_POINTER 0x934
294#define CHANNEL6NEXT_RECORD_POINTER 0x938
295#define CHANNEL7NEXT_RECORD_POINTER 0x93C
296#define CHANNEL0CURRENT_DESCRIPTOR_POINTER 0x870
297#define CHANNEL1CURRENT_DESCRIPTOR_POINTER 0x874
298#define CHANNEL2CURRENT_DESCRIPTOR_POINTER 0x878
299#define CHANNEL3CURRENT_DESCRIPTOR_POINTER 0x87C
300#define CHANNEL4CURRENT_DESCRIPTOR_POINTER 0x970
301#define CHANNEL5CURRENT_DESCRIPTOR_POINTER 0x974
302#define CHANNEL6CURRENT_DESCRIPTOR_POINTER 0x978
303#define CHANNEL7CURRENT_DESCRIPTOR_POINTER 0x97C
304#define CHANNEL0_DMA_SOURCE_HIGH_PCI_ADDRESS 0x890
305#define CHANNEL1_DMA_SOURCE_HIGH_PCI_ADDRESS 0x894
306#define CHANNEL2_DMA_SOURCE_HIGH_PCI_ADDRESS 0x898
307#define CHANNEL3_DMA_SOURCE_HIGH_PCI_ADDRESS 0x89c
308#define CHANNEL4_DMA_SOURCE_HIGH_PCI_ADDRESS 0x990
309#define CHANNEL5_DMA_SOURCE_HIGH_PCI_ADDRESS 0x994
310#define CHANNEL6_DMA_SOURCE_HIGH_PCI_ADDRESS 0x998
311#define CHANNEL7_DMA_SOURCE_HIGH_PCI_ADDRESS 0x99c
312#define CHANNEL0_DMA_DESTINATION_HIGH_PCI_ADDRESS 0x8a0
313#define CHANNEL1_DMA_DESTINATION_HIGH_PCI_ADDRESS 0x8a4
314#define CHANNEL2_DMA_DESTINATION_HIGH_PCI_ADDRESS 0x8a8
315#define CHANNEL3_DMA_DESTINATION_HIGH_PCI_ADDRESS 0x8ac
316#define CHANNEL4_DMA_DESTINATION_HIGH_PCI_ADDRESS 0x9a0
317#define CHANNEL5_DMA_DESTINATION_HIGH_PCI_ADDRESS 0x9a4
318#define CHANNEL6_DMA_DESTINATION_HIGH_PCI_ADDRESS 0x9a8
319#define CHANNEL7_DMA_DESTINATION_HIGH_PCI_ADDRESS 0x9ac
320#define CHANNEL0_DMA_NEXT_RECORD_POINTER_HIGH_PCI_ADDRESS 0x8b0
321#define CHANNEL1_DMA_NEXT_RECORD_POINTER_HIGH_PCI_ADDRESS 0x8b4
322#define CHANNEL2_DMA_NEXT_RECORD_POINTER_HIGH_PCI_ADDRESS 0x8b8
323#define CHANNEL3_DMA_NEXT_RECORD_POINTER_HIGH_PCI_ADDRESS 0x8bc
324#define CHANNEL4_DMA_NEXT_RECORD_POINTER_HIGH_PCI_ADDRESS 0x9b0
325#define CHANNEL5_DMA_NEXT_RECORD_POINTER_HIGH_PCI_ADDRESS 0x9b4
326#define CHANNEL6_DMA_NEXT_RECORD_POINTER_HIGH_PCI_ADDRESS 0x9b8
327#define CHANNEL7_DMA_NEXT_RECORD_POINTER_HIGH_PCI_ADDRESS 0x9bc
328
329/*
330 * DMA Channel Control
331 */
332
333#define CHANNEL0CONTROL 0x840
334#define CHANNEL0CONTROL_HIGH 0x880
335
336#define CHANNEL1CONTROL 0x844
337#define CHANNEL1CONTROL_HIGH 0x884
338
339#define CHANNEL2CONTROL 0x848
340#define CHANNEL2CONTROL_HIGH 0x888
341
342#define CHANNEL3CONTROL 0x84C
343#define CHANNEL3CONTROL_HIGH 0x88C
344
345#define CHANNEL4CONTROL 0x940
346#define CHANNEL4CONTROL_HIGH 0x980
347
348#define CHANNEL5CONTROL 0x944
349#define CHANNEL5CONTROL_HIGH 0x984
350
351#define CHANNEL6CONTROL 0x948
352#define CHANNEL6CONTROL_HIGH 0x988
353
354#define CHANNEL7CONTROL 0x94C
355#define CHANNEL7CONTROL_HIGH 0x98C
356
357
358/*
359 * DMA Arbiter
360 */
361
362#define ARBITER_CONTROL_0_3 0x860
363#define ARBITER_CONTROL_4_7 0x960
364
365
366/*
367 * DMA Interrupt
368 */
369
370#define CHANELS0_3_INTERRUPT_CAUSE 0x8c0
371#define CHANELS0_3_INTERRUPT_MASK 0x8c4
372#define CHANELS0_3_ERROR_ADDRESS 0x8c8
373#define CHANELS0_3_ERROR_SELECT 0x8cc
374#define CHANELS4_7_INTERRUPT_CAUSE 0x9c0
375#define CHANELS4_7_INTERRUPT_MASK 0x9c4
376#define CHANELS4_7_ERROR_ADDRESS 0x9c8
377#define CHANELS4_7_ERROR_SELECT 0x9cc
378
379
380/*
381 * DMA Debug (for internal use)
382 */
383
384#define DMA_X0_ADDRESS 0x8e0
385#define DMA_X0_COMMAND_AND_ID 0x8e4
386#define DMA_X0_WRITE_DATA_LOW 0x8e8
387#define DMA_X0_WRITE_DATA_HIGH 0x8ec
388#define DMA_X0_WRITE_BYTE_ENABLE 0x8f8
389#define DMA_X0_READ_DATA_LOW 0x8f0
390#define DMA_X0_READ_DATA_HIGH 0x8f4
391#define DMA_X0_READ_ID 0x8fc
392#define DMA_X1_ADDRESS 0x9e0
393#define DMA_X1_COMMAND_AND_ID 0x9e4
394#define DMA_X1_WRITE_DATA_LOW 0x9e8
395#define DMA_X1_WRITE_DATA_HIGH 0x9ec
396#define DMA_X1_WRITE_BYTE_ENABLE 0x9f8
397#define DMA_X1_READ_DATA_LOW 0x9f0
398#define DMA_X1_READ_DATA_HIGH 0x9f4
399#define DMA_X1_READ_ID 0x9fc
400
401/*
402 * Timer_Counter
403 */
404
405#define TIMER_COUNTER0 0x850
406#define TIMER_COUNTER1 0x854
407#define TIMER_COUNTER2 0x858
408#define TIMER_COUNTER3 0x85C
409#define TIMER_COUNTER_0_3_CONTROL 0x864
410#define TIMER_COUNTER_0_3_INTERRUPT_CAUSE 0x868
411#define TIMER_COUNTER_0_3_INTERRUPT_MASK 0x86c
412#define TIMER_COUNTER4 0x950
413#define TIMER_COUNTER5 0x954
414#define TIMER_COUNTER6 0x958
415#define TIMER_COUNTER7 0x95C
416#define TIMER_COUNTER_4_7_CONTROL 0x964
417#define TIMER_COUNTER_4_7_INTERRUPT_CAUSE 0x968
418#define TIMER_COUNTER_4_7_INTERRUPT_MASK 0x96c
419
420/*
421 * PCI Slave Address Decoding
422 */
423
424#define PCI_0SCS_0_BANK_SIZE 0xc08
425#define PCI_1SCS_0_BANK_SIZE 0xc88
426#define PCI_0SCS_1_BANK_SIZE 0xd08
427#define PCI_1SCS_1_BANK_SIZE 0xd88
428#define PCI_0SCS_2_BANK_SIZE 0xc0c
429#define PCI_1SCS_2_BANK_SIZE 0xc8c
430#define PCI_0SCS_3_BANK_SIZE 0xd0c
431#define PCI_1SCS_3_BANK_SIZE 0xd8c
432#define PCI_0CS_0_BANK_SIZE 0xc10
433#define PCI_1CS_0_BANK_SIZE 0xc90
434#define PCI_0CS_1_BANK_SIZE 0xd10
435#define PCI_1CS_1_BANK_SIZE 0xd90
436#define PCI_0CS_2_BANK_SIZE 0xd18
437#define PCI_1CS_2_BANK_SIZE 0xd98
438#define PCI_0CS_3_BANK_SIZE 0xc14
439#define PCI_1CS_3_BANK_SIZE 0xc94
440#define PCI_0CS_BOOT_BANK_SIZE 0xd14
441#define PCI_1CS_BOOT_BANK_SIZE 0xd94
442#define PCI_0P2P_MEM0_BAR_SIZE 0xd1c
443#define PCI_1P2P_MEM0_BAR_SIZE 0xd9c
444#define PCI_0P2P_MEM1_BAR_SIZE 0xd20
445#define PCI_1P2P_MEM1_BAR_SIZE 0xda0
446#define PCI_0P2P_I_O_BAR_SIZE 0xd24
447#define PCI_1P2P_I_O_BAR_SIZE 0xda4
448#define PCI_0CPU_BAR_SIZE 0xd28
449#define PCI_1CPU_BAR_SIZE 0xda8
450#define PCI_0DAC_SCS_0_BANK_SIZE 0xe00
451#define PCI_1DAC_SCS_0_BANK_SIZE 0xe80
452#define PCI_0DAC_SCS_1_BANK_SIZE 0xe04
453#define PCI_1DAC_SCS_1_BANK_SIZE 0xe84
454#define PCI_0DAC_SCS_2_BANK_SIZE 0xe08
455#define PCI_1DAC_SCS_2_BANK_SIZE 0xe88
456#define PCI_0DAC_SCS_3_BANK_SIZE 0xe0c
457#define PCI_1DAC_SCS_3_BANK_SIZE 0xe8c
458#define PCI_0DAC_CS_0_BANK_SIZE 0xe10
459#define PCI_1DAC_CS_0_BANK_SIZE 0xe90
460#define PCI_0DAC_CS_1_BANK_SIZE 0xe14
461#define PCI_1DAC_CS_1_BANK_SIZE 0xe94
462#define PCI_0DAC_CS_2_BANK_SIZE 0xe18
463#define PCI_1DAC_CS_2_BANK_SIZE 0xe98
464#define PCI_0DAC_CS_3_BANK_SIZE 0xe1c
465#define PCI_1DAC_CS_3_BANK_SIZE 0xe9c
466#define PCI_0DAC_BOOTCS_BANK_SIZE 0xe20
467#define PCI_1DAC_BOOTCS_BANK_SIZE 0xea0
468#define PCI_0DAC_P2P_MEM0_BAR_SIZE 0xe24
469#define PCI_1DAC_P2P_MEM0_BAR_SIZE 0xea4
470#define PCI_0DAC_P2P_MEM1_BAR_SIZE 0xe28
471#define PCI_1DAC_P2P_MEM1_BAR_SIZE 0xea8
472#define PCI_0DAC_CPU_BAR_SIZE 0xe2c
473#define PCI_1DAC_CPU_BAR_SIZE 0xeac
474#define PCI_0EXPANSION_ROM_BAR_SIZE 0xd2c
475#define PCI_1EXPANSION_ROM_BAR_SIZE 0xdac
476#define PCI_0BASE_ADDRESS_REGISTERS_ENABLE 0xc3c
477#define PCI_1BASE_ADDRESS_REGISTERS_ENABLE 0xcbc
478#define PCI_0SCS_0_BASE_ADDRESS_REMAP 0xc48
479#define PCI_1SCS_0_BASE_ADDRESS_REMAP 0xcc8
480#define PCI_0SCS_1_BASE_ADDRESS_REMAP 0xd48
481#define PCI_1SCS_1_BASE_ADDRESS_REMAP 0xdc8
482#define PCI_0SCS_2_BASE_ADDRESS_REMAP 0xc4c
483#define PCI_1SCS_2_BASE_ADDRESS_REMAP 0xccc
484#define PCI_0SCS_3_BASE_ADDRESS_REMAP 0xd4c
485#define PCI_1SCS_3_BASE_ADDRESS_REMAP 0xdcc
486#define PCI_0CS_0_BASE_ADDRESS_REMAP 0xc50
487#define PCI_1CS_0_BASE_ADDRESS_REMAP 0xcd0
488#define PCI_0CS_1_BASE_ADDRESS_REMAP 0xd50
489#define PCI_1CS_1_BASE_ADDRESS_REMAP 0xdd0
490#define PCI_0CS_2_BASE_ADDRESS_REMAP 0xd58
491#define PCI_1CS_2_BASE_ADDRESS_REMAP 0xdd8
492#define PCI_0CS_3_BASE_ADDRESS_REMAP 0xc54
493#define PCI_1CS_3_BASE_ADDRESS_REMAP 0xcd4
494#define PCI_0CS_BOOTCS_BASE_ADDRESS_REMAP 0xd54
495#define PCI_1CS_BOOTCS_BASE_ADDRESS_REMAP 0xdd4
496#define PCI_0P2P_MEM0_BASE_ADDRESS_REMAP_LOW 0xd5c
497#define PCI_1P2P_MEM0_BASE_ADDRESS_REMAP_LOW 0xddc
498#define PCI_0P2P_MEM0_BASE_ADDRESS_REMAP_HIGH 0xd60
499#define PCI_1P2P_MEM0_BASE_ADDRESS_REMAP_HIGH 0xde0
500#define PCI_0P2P_MEM1_BASE_ADDRESS_REMAP_LOW 0xd64
501#define PCI_1P2P_MEM1_BASE_ADDRESS_REMAP_LOW 0xde4
502#define PCI_0P2P_MEM1_BASE_ADDRESS_REMAP_HIGH 0xd68
503#define PCI_1P2P_MEM1_BASE_ADDRESS_REMAP_HIGH 0xde8
504#define PCI_0P2P_I_O_BASE_ADDRESS_REMAP 0xd6c
505#define PCI_1P2P_I_O_BASE_ADDRESS_REMAP 0xdec
506#define PCI_0CPU_BASE_ADDRESS_REMAP 0xd70
507#define PCI_1CPU_BASE_ADDRESS_REMAP 0xdf0
508#define PCI_0DAC_SCS_0_BASE_ADDRESS_REMAP 0xf00
509#define PCI_1DAC_SCS_0_BASE_ADDRESS_REMAP 0xff0
510#define PCI_0DAC_SCS_1_BASE_ADDRESS_REMAP 0xf04
511#define PCI_1DAC_SCS_1_BASE_ADDRESS_REMAP 0xf84
512#define PCI_0DAC_SCS_2_BASE_ADDRESS_REMAP 0xf08
513#define PCI_1DAC_SCS_2_BASE_ADDRESS_REMAP 0xf88
514#define PCI_0DAC_SCS_3_BASE_ADDRESS_REMAP 0xf0c
515#define PCI_1DAC_SCS_3_BASE_ADDRESS_REMAP 0xf8c
516#define PCI_0DAC_CS_0_BASE_ADDRESS_REMAP 0xf10
517#define PCI_1DAC_CS_0_BASE_ADDRESS_REMAP 0xf90
518#define PCI_0DAC_CS_1_BASE_ADDRESS_REMAP 0xf14
519#define PCI_1DAC_CS_1_BASE_ADDRESS_REMAP 0xf94
520#define PCI_0DAC_CS_2_BASE_ADDRESS_REMAP 0xf18
521#define PCI_1DAC_CS_2_BASE_ADDRESS_REMAP 0xf98
522#define PCI_0DAC_CS_3_BASE_ADDRESS_REMAP 0xf1c
523#define PCI_1DAC_CS_3_BASE_ADDRESS_REMAP 0xf9c
524#define PCI_0DAC_BOOTCS_BASE_ADDRESS_REMAP 0xf20
525#define PCI_1DAC_BOOTCS_BASE_ADDRESS_REMAP 0xfa0
526#define PCI_0DAC_P2P_MEM0_BASE_ADDRESS_REMAP_LOW 0xf24
527#define PCI_1DAC_P2P_MEM0_BASE_ADDRESS_REMAP_LOW 0xfa4
528#define PCI_0DAC_P2P_MEM0_BASE_ADDRESS_REMAP_HIGH 0xf28
529#define PCI_1DAC_P2P_MEM0_BASE_ADDRESS_REMAP_HIGH 0xfa8
530#define PCI_0DAC_P2P_MEM1_BASE_ADDRESS_REMAP_LOW 0xf2c
531#define PCI_1DAC_P2P_MEM1_BASE_ADDRESS_REMAP_LOW 0xfac
532#define PCI_0DAC_P2P_MEM1_BASE_ADDRESS_REMAP_HIGH 0xf30
533#define PCI_1DAC_P2P_MEM1_BASE_ADDRESS_REMAP_HIGH 0xfb0
534#define PCI_0DAC_CPU_BASE_ADDRESS_REMAP 0xf34
535#define PCI_1DAC_CPU_BASE_ADDRESS_REMAP 0xfb4
536#define PCI_0EXPANSION_ROM_BASE_ADDRESS_REMAP 0xf38
537#define PCI_1EXPANSION_ROM_BASE_ADDRESS_REMAP 0xfb8
538#define PCI_0ADDRESS_DECODE_CONTROL 0xd3c
539#define PCI_1ADDRESS_DECODE_CONTROL 0xdbc
540
541/*
542 * PCI Control
543 */
544
545#define PCI_0COMMAND 0xc00
546#define PCI_1COMMAND 0xc80
547#define PCI_0MODE 0xd00
548#define PCI_1MODE 0xd80
549#define PCI_0TIMEOUT_RETRY 0xc04
550#define PCI_1TIMEOUT_RETRY 0xc84
551#define PCI_0READ_BUFFER_DISCARD_TIMER 0xd04
552#define PCI_1READ_BUFFER_DISCARD_TIMER 0xd84
553#define MSI_0TRIGGER_TIMER 0xc38
554#define MSI_1TRIGGER_TIMER 0xcb8
555#define PCI_0ARBITER_CONTROL 0x1d00
556#define PCI_1ARBITER_CONTROL 0x1d80
557/* changing untill here */
558#define PCI_0CROSS_BAR_CONTROL_LOW 0x1d08
559#define PCI_0CROSS_BAR_CONTROL_HIGH 0x1d0c
560#define PCI_0CROSS_BAR_TIMEOUT 0x1d04
561#define PCI_0READ_RESPONSE_CROSS_BAR_CONTROL_LOW 0x1d18
562#define PCI_0READ_RESPONSE_CROSS_BAR_CONTROL_HIGH 0x1d1c
563#define PCI_0SYNC_BARRIER_VIRTUAL_REGISTER 0x1d10
564#define PCI_0P2P_CONFIGURATION 0x1d14
565#define PCI_0ACCESS_CONTROL_BASE_0_LOW 0x1e00
566#define PCI_0ACCESS_CONTROL_BASE_0_HIGH 0x1e04
567#define PCI_0ACCESS_CONTROL_TOP_0 0x1e08
568#define PCI_0ACCESS_CONTROL_BASE_1_LOW 0c1e10
569#define PCI_0ACCESS_CONTROL_BASE_1_HIGH 0x1e14
570#define PCI_0ACCESS_CONTROL_TOP_1 0x1e18
571#define PCI_0ACCESS_CONTROL_BASE_2_LOW 0c1e20
572#define PCI_0ACCESS_CONTROL_BASE_2_HIGH 0x1e24
573#define PCI_0ACCESS_CONTROL_TOP_2 0x1e28
574#define PCI_0ACCESS_CONTROL_BASE_3_LOW 0c1e30
575#define PCI_0ACCESS_CONTROL_BASE_3_HIGH 0x1e34
576#define PCI_0ACCESS_CONTROL_TOP_3 0x1e38
577#define PCI_0ACCESS_CONTROL_BASE_4_LOW 0c1e40
578#define PCI_0ACCESS_CONTROL_BASE_4_HIGH 0x1e44
579#define PCI_0ACCESS_CONTROL_TOP_4 0x1e48
580#define PCI_0ACCESS_CONTROL_BASE_5_LOW 0c1e50
581#define PCI_0ACCESS_CONTROL_BASE_5_HIGH 0x1e54
582#define PCI_0ACCESS_CONTROL_TOP_5 0x1e58
583#define PCI_0ACCESS_CONTROL_BASE_6_LOW 0c1e60
584#define PCI_0ACCESS_CONTROL_BASE_6_HIGH 0x1e64
585#define PCI_0ACCESS_CONTROL_TOP_6 0x1e68
586#define PCI_0ACCESS_CONTROL_BASE_7_LOW 0c1e70
587#define PCI_0ACCESS_CONTROL_BASE_7_HIGH 0x1e74
588#define PCI_0ACCESS_CONTROL_TOP_7 0x1e78
589#define PCI_1CROSS_BAR_CONTROL_LOW 0x1d88
590#define PCI_1CROSS_BAR_CONTROL_HIGH 0x1d8c
591#define PCI_1CROSS_BAR_TIMEOUT 0x1d84
592#define PCI_1READ_RESPONSE_CROSS_BAR_CONTROL_LOW 0x1d98
593#define PCI_1READ_RESPONSE_CROSS_BAR_CONTROL_HIGH 0x1d9c
594#define PCI_1SYNC_BARRIER_VIRTUAL_REGISTER 0x1d90
595#define PCI_1P2P_CONFIGURATION 0x1d94
596#define PCI_1ACCESS_CONTROL_BASE_0_LOW 0x1e80
597#define PCI_1ACCESS_CONTROL_BASE_0_HIGH 0x1e84
598#define PCI_1ACCESS_CONTROL_TOP_0 0x1e88
599#define PCI_1ACCESS_CONTROL_BASE_1_LOW 0c1e90
600#define PCI_1ACCESS_CONTROL_BASE_1_HIGH 0x1e94
601#define PCI_1ACCESS_CONTROL_TOP_1 0x1e98
602#define PCI_1ACCESS_CONTROL_BASE_2_LOW 0c1ea0
603#define PCI_1ACCESS_CONTROL_BASE_2_HIGH 0x1ea4
604#define PCI_1ACCESS_CONTROL_TOP_2 0x1ea8
605#define PCI_1ACCESS_CONTROL_BASE_3_LOW 0c1eb0
606#define PCI_1ACCESS_CONTROL_BASE_3_HIGH 0x1eb4
607#define PCI_1ACCESS_CONTROL_TOP_3 0x1eb8
608#define PCI_1ACCESS_CONTROL_BASE_4_LOW 0c1ec0
609#define PCI_1ACCESS_CONTROL_BASE_4_HIGH 0x1ec4
610#define PCI_1ACCESS_CONTROL_TOP_4 0x1ec8
611#define PCI_1ACCESS_CONTROL_BASE_5_LOW 0c1ed0
612#define PCI_1ACCESS_CONTROL_BASE_5_HIGH 0x1ed4
613#define PCI_1ACCESS_CONTROL_TOP_5 0x1ed8
614#define PCI_1ACCESS_CONTROL_BASE_6_LOW 0c1ee0
615#define PCI_1ACCESS_CONTROL_BASE_6_HIGH 0x1ee4
616#define PCI_1ACCESS_CONTROL_TOP_6 0x1ee8
617#define PCI_1ACCESS_CONTROL_BASE_7_LOW 0c1ef0
618#define PCI_1ACCESS_CONTROL_BASE_7_HIGH 0x1ef4
619#define PCI_1ACCESS_CONTROL_TOP_7 0x1ef8
620
621/*
622 * PCI Snoop Control
623 */
624
625#define PCI_0SNOOP_CONTROL_BASE_0_LOW 0x1f00
626#define PCI_0SNOOP_CONTROL_BASE_0_HIGH 0x1f04
627#define PCI_0SNOOP_CONTROL_TOP_0 0x1f08
628#define PCI_0SNOOP_CONTROL_BASE_1_0_LOW 0x1f10
629#define PCI_0SNOOP_CONTROL_BASE_1_0_HIGH 0x1f14
630#define PCI_0SNOOP_CONTROL_TOP_1 0x1f18
631#define PCI_0SNOOP_CONTROL_BASE_2_0_LOW 0x1f20
632#define PCI_0SNOOP_CONTROL_BASE_2_0_HIGH 0x1f24
633#define PCI_0SNOOP_CONTROL_TOP_2 0x1f28
634#define PCI_0SNOOP_CONTROL_BASE_3_0_LOW 0x1f30
635#define PCI_0SNOOP_CONTROL_BASE_3_0_HIGH 0x1f34
636#define PCI_0SNOOP_CONTROL_TOP_3 0x1f38
637#define PCI_1SNOOP_CONTROL_BASE_0_LOW 0x1f80
638#define PCI_1SNOOP_CONTROL_BASE_0_HIGH 0x1f84
639#define PCI_1SNOOP_CONTROL_TOP_0 0x1f88
640#define PCI_1SNOOP_CONTROL_BASE_1_0_LOW 0x1f90
641#define PCI_1SNOOP_CONTROL_BASE_1_0_HIGH 0x1f94
642#define PCI_1SNOOP_CONTROL_TOP_1 0x1f98
643#define PCI_1SNOOP_CONTROL_BASE_2_0_LOW 0x1fa0
644#define PCI_1SNOOP_CONTROL_BASE_2_0_HIGH 0x1fa4
645#define PCI_1SNOOP_CONTROL_TOP_2 0x1fa8
646#define PCI_1SNOOP_CONTROL_BASE_3_0_LOW 0x1fb0
647#define PCI_1SNOOP_CONTROL_BASE_3_0_HIGH 0x1fb4
648#define PCI_1SNOOP_CONTROL_TOP_3 0x1fb8
649
650/*
651 * PCI Configuration Address
652 */
653
654#define PCI_0CONFIGURATION_ADDRESS 0xcf8
655#define PCI_0CONFIGURATION_DATA_VIRTUAL_REGISTER 0xcfc
656#define PCI_1CONFIGURATION_ADDRESS 0xc78
657#define PCI_1CONFIGURATION_DATA_VIRTUAL_REGISTER 0xc7c
658#define PCI_0INTERRUPT_ACKNOWLEDGE_VIRTUAL_REGISTER 0xc34
659#define PCI_1INTERRUPT_ACKNOWLEDGE_VIRTUAL_REGISTER 0xcb4
660
661/*
662 * PCI Error Report
663 */
664
665#define PCI_0SERR_MASK 0xc28
666#define PCI_0ERROR_ADDRESS_LOW 0x1d40
667#define PCI_0ERROR_ADDRESS_HIGH 0x1d44
668#define PCI_0ERROR_DATA_LOW 0x1d48
669#define PCI_0ERROR_DATA_HIGH 0x1d4c
670#define PCI_0ERROR_COMMAND 0x1d50
671#define PCI_0ERROR_CAUSE 0x1d58
672#define PCI_0ERROR_MASK 0x1d5c
673
674#define PCI_1SERR_MASK 0xca8
675#define PCI_1ERROR_ADDRESS_LOW 0x1dc0
676#define PCI_1ERROR_ADDRESS_HIGH 0x1dc4
677#define PCI_1ERROR_DATA_LOW 0x1dc8
678#define PCI_1ERROR_DATA_HIGH 0x1dcc
679#define PCI_1ERROR_COMMAND 0x1dd0
680#define PCI_1ERROR_CAUSE 0x1dd8
681#define PCI_1ERROR_MASK 0x1ddc
682
683
684/*
685 * Lslave Debug (for internal use)
686 */
687
688#define L_SLAVE_X0_ADDRESS 0x1d20
689#define L_SLAVE_X0_COMMAND_AND_ID 0x1d24
690#define L_SLAVE_X1_ADDRESS 0x1d28
691#define L_SLAVE_X1_COMMAND_AND_ID 0x1d2c
692#define L_SLAVE_WRITE_DATA_LOW 0x1d30
693#define L_SLAVE_WRITE_DATA_HIGH 0x1d34
694#define L_SLAVE_WRITE_BYTE_ENABLE 0x1d60
695#define L_SLAVE_READ_DATA_LOW 0x1d38
696#define L_SLAVE_READ_DATA_HIGH 0x1d3c
697#define L_SLAVE_READ_ID 0x1d64
698
699#if 0 /* Disabled because PCI_* namespace belongs to PCI subsystem ... */
700
701/*
702 * PCI Configuration Function 0
703 */
704
705#define PCI_DEVICE_AND_VENDOR_ID 0x000
706#define PCI_STATUS_AND_COMMAND 0x004
707#define PCI_CLASS_CODE_AND_REVISION_ID 0x008
708#define PCI_BIST_HEADER_TYPE_LATENCY_TIMER_CACHE_LINE 0x00C
709#define PCI_SCS_0_BASE_ADDRESS 0x010
710#define PCI_SCS_1_BASE_ADDRESS 0x014
711#define PCI_SCS_2_BASE_ADDRESS 0x018
712#define PCI_SCS_3_BASE_ADDRESS 0x01C
713#define PCI_INTERNAL_REGISTERS_MEMORY_MAPPED_BASE_ADDRESS 0x020
714#define PCI_INTERNAL_REGISTERS_I_OMAPPED_BASE_ADDRESS 0x024
715#define PCI_SUBSYSTEM_ID_AND_SUBSYSTEM_VENDOR_ID 0x02C
716#define PCI_EXPANSION_ROM_BASE_ADDRESS_REGISTER 0x030
717#define PCI_CAPABILTY_LIST_POINTER 0x034
718#define PCI_INTERRUPT_PIN_AND_LINE 0x03C
719#define PCI_POWER_MANAGEMENT_CAPABILITY 0x040
720#define PCI_POWER_MANAGEMENT_STATUS_AND_CONTROL 0x044
721#define PCI_VPD_ADDRESS 0x048
722#define PCI_VPD_DATA 0X04c
723#define PCI_MSI_MESSAGE_CONTROL 0x050
724#define PCI_MSI_MESSAGE_ADDRESS 0x054
725#define PCI_MSI_MESSAGE_UPPER_ADDRESS 0x058
726#define PCI_MSI_MESSAGE_DATA 0x05c
727#define PCI_COMPACT_PCI_HOT_SWAP_CAPABILITY 0x058
728
729/*
730 * PCI Configuration Function 1
731 */
732
733#define PCI_CS_0_BASE_ADDRESS 0x110
734#define PCI_CS_1_BASE_ADDRESS 0x114
735#define PCI_CS_2_BASE_ADDRESS 0x118
736#define PCI_CS_3_BASE_ADDRESS 0x11c
737#define PCI_BOOTCS_BASE_ADDRESS 0x120
738
739/*
740 * PCI Configuration Function 2
741 */
742
743#define PCI_P2P_MEM0_BASE_ADDRESS 0x210
744#define PCI_P2P_MEM1_BASE_ADDRESS 0x214
745#define PCI_P2P_I_O_BASE_ADDRESS 0x218
746#define PCI_CPU_BASE_ADDRESS 0x21c
747
748/*
749 * PCI Configuration Function 4
750 */
751
752#define PCI_DAC_SCS_0_BASE_ADDRESS_LOW 0x410
753#define PCI_DAC_SCS_0_BASE_ADDRESS_HIGH 0x414
754#define PCI_DAC_SCS_1_BASE_ADDRESS_LOW 0x418
755#define PCI_DAC_SCS_1_BASE_ADDRESS_HIGH 0x41c
756#define PCI_DAC_P2P_MEM0_BASE_ADDRESS_LOW 0x420
757#define PCI_DAC_P2P_MEM0_BASE_ADDRESS_HIGH 0x424
758
759
760/*
761 * PCI Configuration Function 5
762 */
763
764#define PCI_DAC_SCS_2_BASE_ADDRESS_LOW 0x510
765#define PCI_DAC_SCS_2_BASE_ADDRESS_HIGH 0x514
766#define PCI_DAC_SCS_3_BASE_ADDRESS_LOW 0x518
767#define PCI_DAC_SCS_3_BASE_ADDRESS_HIGH 0x51c
768#define PCI_DAC_P2P_MEM1_BASE_ADDRESS_LOW 0x520
769#define PCI_DAC_P2P_MEM1_BASE_ADDRESS_HIGH 0x524
770
771
772/*
773 * PCI Configuration Function 6
774 */
775
776#define PCI_DAC_CS_0_BASE_ADDRESS_LOW 0x610
777#define PCI_DAC_CS_0_BASE_ADDRESS_HIGH 0x614
778#define PCI_DAC_CS_1_BASE_ADDRESS_LOW 0x618
779#define PCI_DAC_CS_1_BASE_ADDRESS_HIGH 0x61c
780#define PCI_DAC_CS_2_BASE_ADDRESS_LOW 0x620
781#define PCI_DAC_CS_2_BASE_ADDRESS_HIGH 0x624
782
783/*
784 * PCI Configuration Function 7
785 */
786
787#define PCI_DAC_CS_3_BASE_ADDRESS_LOW 0x710
788#define PCI_DAC_CS_3_BASE_ADDRESS_HIGH 0x714
789#define PCI_DAC_BOOTCS_BASE_ADDRESS_LOW 0x718
790#define PCI_DAC_BOOTCS_BASE_ADDRESS_HIGH 0x71c
791#define PCI_DAC_CPU_BASE_ADDRESS_LOW 0x720
792#define PCI_DAC_CPU_BASE_ADDRESS_HIGH 0x724
793#endif
794
795/*
796 * Interrupts
797 */
798
799#define LOW_INTERRUPT_CAUSE_REGISTER 0xc18
800#define HIGH_INTERRUPT_CAUSE_REGISTER 0xc68
801#define CPU_INTERRUPT_MASK_REGISTER_LOW 0xc1c
802#define CPU_INTERRUPT_MASK_REGISTER_HIGH 0xc6c
803#define CPU_SELECT_CAUSE_REGISTER 0xc70
804#define PCI_0INTERRUPT_CAUSE_MASK_REGISTER_LOW 0xc24
805#define PCI_0INTERRUPT_CAUSE_MASK_REGISTER_HIGH 0xc64
806#define PCI_0SELECT_CAUSE 0xc74
807#define PCI_1INTERRUPT_CAUSE_MASK_REGISTER_LOW 0xca4
808#define PCI_1INTERRUPT_CAUSE_MASK_REGISTER_HIGH 0xce4
809#define PCI_1SELECT_CAUSE 0xcf4
810#define CPU_INT_0_MASK 0xe60
811#define CPU_INT_1_MASK 0xe64
812#define CPU_INT_2_MASK 0xe68
813#define CPU_INT_3_MASK 0xe6c
814
815/*
816 * I20 Support registers
817 */
818
819#define INBOUND_MESSAGE_REGISTER0_PCI0_SIDE 0x010
820#define INBOUND_MESSAGE_REGISTER1_PCI0_SIDE 0x014
821#define OUTBOUND_MESSAGE_REGISTER0_PCI0_SIDE 0x018
822#define OUTBOUND_MESSAGE_REGISTER1_PCI0_SIDE 0x01C
823#define INBOUND_DOORBELL_REGISTER_PCI0_SIDE 0x020
824#define INBOUND_INTERRUPT_CAUSE_REGISTER_PCI0_SIDE 0x024
825#define INBOUND_INTERRUPT_MASK_REGISTER_PCI0_SIDE 0x028
826#define OUTBOUND_DOORBELL_REGISTER_PCI0_SIDE 0x02C
827#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_PCI0_SIDE 0x030
828#define OUTBOUND_INTERRUPT_MASK_REGISTER_PCI0_SIDE 0x034
829#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI0_SIDE 0x040
830#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI0_SIDE 0x044
831#define QUEUE_CONTROL_REGISTER_PCI0_SIDE 0x050
832#define QUEUE_BASE_ADDRESS_REGISTER_PCI0_SIDE 0x054
833#define INBOUND_FREE_HEAD_POINTER_REGISTER_PCI0_SIDE 0x060
834#define INBOUND_FREE_TAIL_POINTER_REGISTER_PCI0_SIDE 0x064
835#define INBOUND_POST_HEAD_POINTER_REGISTER_PCI0_SIDE 0x068
836#define INBOUND_POST_TAIL_POINTER_REGISTER_PCI0_SIDE 0x06C
837#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_PCI0_SIDE 0x070
838#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_PCI0_SIDE 0x074
839#define OUTBOUND_POST_HEAD_POINTER_REGISTER_PCI0_SIDE 0x0F8
840#define OUTBOUND_POST_TAIL_POINTER_REGISTER_PCI0_SIDE 0x0FC
841
842#define INBOUND_MESSAGE_REGISTER0_PCI1_SIDE 0x090
843#define INBOUND_MESSAGE_REGISTER1_PCI1_SIDE 0x094
844#define OUTBOUND_MESSAGE_REGISTER0_PCI1_SIDE 0x098
845#define OUTBOUND_MESSAGE_REGISTER1_PCI1_SIDE 0x09C
846#define INBOUND_DOORBELL_REGISTER_PCI1_SIDE 0x0A0
847#define INBOUND_INTERRUPT_CAUSE_REGISTER_PCI1_SIDE 0x0A4
848#define INBOUND_INTERRUPT_MASK_REGISTER_PCI1_SIDE 0x0A8
849#define OUTBOUND_DOORBELL_REGISTER_PCI1_SIDE 0x0AC
850#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_PCI1_SIDE 0x0B0
851#define OUTBOUND_INTERRUPT_MASK_REGISTER_PCI1_SIDE 0x0B4
852#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI1_SIDE 0x0C0
853#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI1_SIDE 0x0C4
854#define QUEUE_CONTROL_REGISTER_PCI1_SIDE 0x0D0
855#define QUEUE_BASE_ADDRESS_REGISTER_PCI1_SIDE 0x0D4
856#define INBOUND_FREE_HEAD_POINTER_REGISTER_PCI1_SIDE 0x0E0
857#define INBOUND_FREE_TAIL_POINTER_REGISTER_PCI1_SIDE 0x0E4
858#define INBOUND_POST_HEAD_POINTER_REGISTER_PCI1_SIDE 0x0E8
859#define INBOUND_POST_TAIL_POINTER_REGISTER_PCI1_SIDE 0x0EC
860#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_PCI1_SIDE 0x0F0
861#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_PCI1_SIDE 0x0F4
862#define OUTBOUND_POST_HEAD_POINTER_REGISTER_PCI1_SIDE 0x078
863#define OUTBOUND_POST_TAIL_POINTER_REGISTER_PCI1_SIDE 0x07C
864
865#define INBOUND_MESSAGE_REGISTER0_CPU0_SIDE 0X1C10
866#define INBOUND_MESSAGE_REGISTER1_CPU0_SIDE 0X1C14
867#define OUTBOUND_MESSAGE_REGISTER0_CPU0_SIDE 0X1C18
868#define OUTBOUND_MESSAGE_REGISTER1_CPU0_SIDE 0X1C1C
869#define INBOUND_DOORBELL_REGISTER_CPU0_SIDE 0X1C20
870#define INBOUND_INTERRUPT_CAUSE_REGISTER_CPU0_SIDE 0X1C24
871#define INBOUND_INTERRUPT_MASK_REGISTER_CPU0_SIDE 0X1C28
872#define OUTBOUND_DOORBELL_REGISTER_CPU0_SIDE 0X1C2C
873#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_CPU0_SIDE 0X1C30
874#define OUTBOUND_INTERRUPT_MASK_REGISTER_CPU0_SIDE 0X1C34
875#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU0_SIDE 0X1C40
876#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU0_SIDE 0X1C44
877#define QUEUE_CONTROL_REGISTER_CPU0_SIDE 0X1C50
878#define QUEUE_BASE_ADDRESS_REGISTER_CPU0_SIDE 0X1C54
879#define INBOUND_FREE_HEAD_POINTER_REGISTER_CPU0_SIDE 0X1C60
880#define INBOUND_FREE_TAIL_POINTER_REGISTER_CPU0_SIDE 0X1C64
881#define INBOUND_POST_HEAD_POINTER_REGISTER_CPU0_SIDE 0X1C68
882#define INBOUND_POST_TAIL_POINTER_REGISTER_CPU0_SIDE 0X1C6C
883#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_CPU0_SIDE 0X1C70
884#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_CPU0_SIDE 0X1C74
885#define OUTBOUND_POST_HEAD_POINTER_REGISTER_CPU0_SIDE 0X1CF8
886#define OUTBOUND_POST_TAIL_POINTER_REGISTER_CPU0_SIDE 0X1CFC
887
888#define INBOUND_MESSAGE_REGISTER0_CPU1_SIDE 0X1C90
889#define INBOUND_MESSAGE_REGISTER1_CPU1_SIDE 0X1C94
890#define OUTBOUND_MESSAGE_REGISTER0_CPU1_SIDE 0X1C98
891#define OUTBOUND_MESSAGE_REGISTER1_CPU1_SIDE 0X1C9C
892#define INBOUND_DOORBELL_REGISTER_CPU1_SIDE 0X1CA0
893#define INBOUND_INTERRUPT_CAUSE_REGISTER_CPU1_SIDE 0X1CA4
894#define INBOUND_INTERRUPT_MASK_REGISTER_CPU1_SIDE 0X1CA8
895#define OUTBOUND_DOORBELL_REGISTER_CPU1_SIDE 0X1CAC
896#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_CPU1_SIDE 0X1CB0
897#define OUTBOUND_INTERRUPT_MASK_REGISTER_CPU1_SIDE 0X1CB4
898#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU1_SIDE 0X1CC0
899#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU1_SIDE 0X1CC4
900#define QUEUE_CONTROL_REGISTER_CPU1_SIDE 0X1CD0
901#define QUEUE_BASE_ADDRESS_REGISTER_CPU1_SIDE 0X1CD4
902#define INBOUND_FREE_HEAD_POINTER_REGISTER_CPU1_SIDE 0X1CE0
903#define INBOUND_FREE_TAIL_POINTER_REGISTER_CPU1_SIDE 0X1CE4
904#define INBOUND_POST_HEAD_POINTER_REGISTER_CPU1_SIDE 0X1CE8
905#define INBOUND_POST_TAIL_POINTER_REGISTER_CPU1_SIDE 0X1CEC
906#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_CPU1_SIDE 0X1CF0
907#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_CPU1_SIDE 0X1CF4
908#define OUTBOUND_POST_HEAD_POINTER_REGISTER_CPU1_SIDE 0X1C78
909#define OUTBOUND_POST_TAIL_POINTER_REGISTER_CPU1_SIDE 0X1C7C
910
911/*
912 * Communication Unit Registers
913 */
914
915#define ETHERNET_0_ADDRESS_CONTROL_LOW
916#define ETHERNET_0_ADDRESS_CONTROL_HIGH 0xf204
917#define ETHERNET_0_RECEIVE_BUFFER_PCI_HIGH_ADDRESS 0xf208
918#define ETHERNET_0_TRANSMIT_BUFFER_PCI_HIGH_ADDRESS 0xf20c
919#define ETHERNET_0_RECEIVE_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf210
920#define ETHERNET_0_TRANSMIT_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf214
921#define ETHERNET_0_HASH_TABLE_PCI_HIGH_ADDRESS 0xf218
922#define ETHERNET_1_ADDRESS_CONTROL_LOW 0xf220
923#define ETHERNET_1_ADDRESS_CONTROL_HIGH 0xf224
924#define ETHERNET_1_RECEIVE_BUFFER_PCI_HIGH_ADDRESS 0xf228
925#define ETHERNET_1_TRANSMIT_BUFFER_PCI_HIGH_ADDRESS 0xf22c
926#define ETHERNET_1_RECEIVE_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf230
927#define ETHERNET_1_TRANSMIT_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf234
928#define ETHERNET_1_HASH_TABLE_PCI_HIGH_ADDRESS 0xf238
929#define ETHERNET_2_ADDRESS_CONTROL_LOW 0xf240
930#define ETHERNET_2_ADDRESS_CONTROL_HIGH 0xf244
931#define ETHERNET_2_RECEIVE_BUFFER_PCI_HIGH_ADDRESS 0xf248
932#define ETHERNET_2_TRANSMIT_BUFFER_PCI_HIGH_ADDRESS 0xf24c
933#define ETHERNET_2_RECEIVE_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf250
934#define ETHERNET_2_TRANSMIT_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf254
935#define ETHERNET_2_HASH_TABLE_PCI_HIGH_ADDRESS 0xf258
936#define MPSC_0_ADDRESS_CONTROL_LOW 0xf280
937#define MPSC_0_ADDRESS_CONTROL_HIGH 0xf284
938#define MPSC_0_RECEIVE_BUFFER_PCI_HIGH_ADDRESS 0xf288
939#define MPSC_0_TRANSMIT_BUFFER_PCI_HIGH_ADDRESS 0xf28c
940#define MPSC_0_RECEIVE_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf290
941#define MPSC_0_TRANSMIT_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf294
942#define MPSC_1_ADDRESS_CONTROL_LOW 0xf2a0
943#define MPSC_1_ADDRESS_CONTROL_HIGH 0xf2a4
944#define MPSC_1_RECEIVE_BUFFER_PCI_HIGH_ADDRESS 0xf2a8
945#define MPSC_1_TRANSMIT_BUFFER_PCI_HIGH_ADDRESS 0xf2ac
946#define MPSC_1_RECEIVE_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf2b0
947#define MPSC_1_TRANSMIT_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf2b4
948#define MPSC_2_ADDRESS_CONTROL_LOW 0xf2c0
949#define MPSC_2_ADDRESS_CONTROL_HIGH 0xf2c4
950#define MPSC_2_RECEIVE_BUFFER_PCI_HIGH_ADDRESS 0xf2c8
951#define MPSC_2_TRANSMIT_BUFFER_PCI_HIGH_ADDRESS 0xf2cc
952#define MPSC_2_RECEIVE_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf2d0
953#define MPSC_2_TRANSMIT_DESCRIPTOR_PCI_HIGH_ADDRESS 0xf2d4
954#define SERIAL_INIT_PCI_HIGH_ADDRESS 0xf320
955#define SERIAL_INIT_LAST_DATA 0xf324
956#define SERIAL_INIT_STATUS_AND_CONTROL 0xf328
957#define COMM_UNIT_ARBITER_CONTROL 0xf300
958#define COMM_UNIT_CROSS_BAR_TIMEOUT 0xf304
959#define COMM_UNIT_INTERRUPT_CAUSE 0xf310
960#define COMM_UNIT_INTERRUPT_MASK 0xf314
961#define COMM_UNIT_ERROR_ADDRESS 0xf314
962
963/*
964 * Cunit Debug (for internal use)
965 */
966
967#define CUNIT_ADDRESS 0xf340
968#define CUNIT_COMMAND_AND_ID 0xf344
969#define CUNIT_WRITE_DATA_LOW 0xf348
970#define CUNIT_WRITE_DATA_HIGH 0xf34c
971#define CUNIT_WRITE_BYTE_ENABLE 0xf358
972#define CUNIT_READ_DATA_LOW 0xf350
973#define CUNIT_READ_DATA_HIGH 0xf354
974#define CUNIT_READ_ID 0xf35c
975
976/*
977 * Fast Ethernet Unit Registers
978 */
979
980/* Ethernet */
981
982#define ETHERNET_PHY_ADDRESS_REGISTER 0x2000
983#define ETHERNET_SMI_REGISTER 0x2010
984
985/* Ethernet 0 */
986
987#define ETHERNET0_PORT_CONFIGURATION_REGISTER 0x2400
988#define ETHERNET0_PORT_CONFIGURATION_EXTEND_REGISTER 0x2408
989#define ETHERNET0_PORT_COMMAND_REGISTER 0x2410
990#define ETHERNET0_PORT_STATUS_REGISTER 0x2418
991#define ETHERNET0_SERIAL_PARAMETRS_REGISTER 0x2420
992#define ETHERNET0_HASH_TABLE_POINTER_REGISTER 0x2428
993#define ETHERNET0_FLOW_CONTROL_SOURCE_ADDRESS_LOW 0x2430
994#define ETHERNET0_FLOW_CONTROL_SOURCE_ADDRESS_HIGH 0x2438
995#define ETHERNET0_SDMA_CONFIGURATION_REGISTER 0x2440
996#define ETHERNET0_SDMA_COMMAND_REGISTER 0x2448
997#define ETHERNET0_INTERRUPT_CAUSE_REGISTER 0x2450
998#define ETHERNET0_INTERRUPT_MASK_REGISTER 0x2458
999#define ETHERNET0_FIRST_RX_DESCRIPTOR_POINTER0 0x2480
1000#define ETHERNET0_FIRST_RX_DESCRIPTOR_POINTER1 0x2484
1001#define ETHERNET0_FIRST_RX_DESCRIPTOR_POINTER2 0x2488
1002#define ETHERNET0_FIRST_RX_DESCRIPTOR_POINTER3 0x248c
1003#define ETHERNET0_CURRENT_RX_DESCRIPTOR_POINTER0 0x24a0
1004#define ETHERNET0_CURRENT_RX_DESCRIPTOR_POINTER1 0x24a4
1005#define ETHERNET0_CURRENT_RX_DESCRIPTOR_POINTER2 0x24a8
1006#define ETHERNET0_CURRENT_RX_DESCRIPTOR_POINTER3 0x24ac
1007#define ETHERNET0_CURRENT_TX_DESCRIPTOR_POINTER0 0x24e0
1008#define ETHERNET0_CURRENT_TX_DESCRIPTOR_POINTER1 0x24e4
1009#define ETHERNET0_MIB_COUNTER_BASE 0x2500
1010
1011/* Ethernet 1 */
1012
1013#define ETHERNET1_PORT_CONFIGURATION_REGISTER 0x2800
1014#define ETHERNET1_PORT_CONFIGURATION_EXTEND_REGISTER 0x2808
1015#define ETHERNET1_PORT_COMMAND_REGISTER 0x2810
1016#define ETHERNET1_PORT_STATUS_REGISTER 0x2818
1017#define ETHERNET1_SERIAL_PARAMETRS_REGISTER 0x2820
1018#define ETHERNET1_HASH_TABLE_POINTER_REGISTER 0x2828
1019#define ETHERNET1_FLOW_CONTROL_SOURCE_ADDRESS_LOW 0x2830
1020#define ETHERNET1_FLOW_CONTROL_SOURCE_ADDRESS_HIGH 0x2838
1021#define ETHERNET1_SDMA_CONFIGURATION_REGISTER 0x2840
1022#define ETHERNET1_SDMA_COMMAND_REGISTER 0x2848
1023#define ETHERNET1_INTERRUPT_CAUSE_REGISTER 0x2850
1024#define ETHERNET1_INTERRUPT_MASK_REGISTER 0x2858
1025#define ETHERNET1_FIRST_RX_DESCRIPTOR_POINTER0 0x2880
1026#define ETHERNET1_FIRST_RX_DESCRIPTOR_POINTER1 0x2884
1027#define ETHERNET1_FIRST_RX_DESCRIPTOR_POINTER2 0x2888
1028#define ETHERNET1_FIRST_RX_DESCRIPTOR_POINTER3 0x288c
1029#define ETHERNET1_CURRENT_RX_DESCRIPTOR_POINTER0 0x28a0
1030#define ETHERNET1_CURRENT_RX_DESCRIPTOR_POINTER1 0x28a4
1031#define ETHERNET1_CURRENT_RX_DESCRIPTOR_POINTER2 0x28a8
1032#define ETHERNET1_CURRENT_RX_DESCRIPTOR_POINTER3 0x28ac
1033#define ETHERNET1_CURRENT_TX_DESCRIPTOR_POINTER0 0x28e0
1034#define ETHERNET1_CURRENT_TX_DESCRIPTOR_POINTER1 0x28e4
1035#define ETHERNET1_MIB_COUNTER_BASE 0x2900
1036
1037/* Ethernet 2 */
1038
1039#define ETHERNET2_PORT_CONFIGURATION_REGISTER 0x2c00
1040#define ETHERNET2_PORT_CONFIGURATION_EXTEND_REGISTER 0x2c08
1041#define ETHERNET2_PORT_COMMAND_REGISTER 0x2c10
1042#define ETHERNET2_PORT_STATUS_REGISTER 0x2c18
1043#define ETHERNET2_SERIAL_PARAMETRS_REGISTER 0x2c20
1044#define ETHERNET2_HASH_TABLE_POINTER_REGISTER 0x2c28
1045#define ETHERNET2_FLOW_CONTROL_SOURCE_ADDRESS_LOW 0x2c30
1046#define ETHERNET2_FLOW_CONTROL_SOURCE_ADDRESS_HIGH 0x2c38
1047#define ETHERNET2_SDMA_CONFIGURATION_REGISTER 0x2c40
1048#define ETHERNET2_SDMA_COMMAND_REGISTER 0x2c48
1049#define ETHERNET2_INTERRUPT_CAUSE_REGISTER 0x2c50
1050#define ETHERNET2_INTERRUPT_MASK_REGISTER 0x2c58
1051#define ETHERNET2_FIRST_RX_DESCRIPTOR_POINTER0 0x2c80
1052#define ETHERNET2_FIRST_RX_DESCRIPTOR_POINTER1 0x2c84
1053#define ETHERNET2_FIRST_RX_DESCRIPTOR_POINTER2 0x2c88
1054#define ETHERNET2_FIRST_RX_DESCRIPTOR_POINTER3 0x2c8c
1055#define ETHERNET2_CURRENT_RX_DESCRIPTOR_POINTER0 0x2ca0
1056#define ETHERNET2_CURRENT_RX_DESCRIPTOR_POINTER1 0x2ca4
1057#define ETHERNET2_CURRENT_RX_DESCRIPTOR_POINTER2 0x2ca8
1058#define ETHERNET2_CURRENT_RX_DESCRIPTOR_POINTER3 0x2cac
1059#define ETHERNET2_CURRENT_TX_DESCRIPTOR_POINTER0 0x2ce0
1060#define ETHERNET2_CURRENT_TX_DESCRIPTOR_POINTER1 0x2ce4
1061#define ETHERNET2_MIB_COUNTER_BASE 0x2d00
1062
1063/*
1064 * SDMA Registers
1065 */
1066
1067#define SDMA_GROUP_CONFIGURATION_REGISTER 0xb1f0
1068#define CHANNEL0_CONFIGURATION_REGISTER 0x4000
1069#define CHANNEL0_COMMAND_REGISTER 0x4008
1070#define CHANNEL0_RX_CMD_STATUS 0x4800
1071#define CHANNEL0_RX_PACKET_AND_BUFFER_SIZES 0x4804
1072#define CHANNEL0_RX_BUFFER_POINTER 0x4808
1073#define CHANNEL0_RX_NEXT_POINTER 0x480c
1074#define CHANNEL0_CURRENT_RX_DESCRIPTOR_POINTER 0x4810
1075#define CHANNEL0_TX_CMD_STATUS 0x4C00
1076#define CHANNEL0_TX_PACKET_SIZE 0x4C04
1077#define CHANNEL0_TX_BUFFER_POINTER 0x4C08
1078#define CHANNEL0_TX_NEXT_POINTER 0x4C0c
1079#define CHANNEL0_CURRENT_TX_DESCRIPTOR_POINTER 0x4c10
1080#define CHANNEL0_FIRST_TX_DESCRIPTOR_POINTER 0x4c14
1081#define CHANNEL1_CONFIGURATION_REGISTER 0x6000
1082#define CHANNEL1_COMMAND_REGISTER 0x6008
1083#define CHANNEL1_RX_CMD_STATUS 0x6800
1084#define CHANNEL1_RX_PACKET_AND_BUFFER_SIZES 0x6804
1085#define CHANNEL1_RX_BUFFER_POINTER 0x6808
1086#define CHANNEL1_RX_NEXT_POINTER 0x680c
1087#define CHANNEL1_CURRENT_RX_DESCRIPTOR_POINTER 0x6810
1088#define CHANNEL1_TX_CMD_STATUS 0x6C00
1089#define CHANNEL1_TX_PACKET_SIZE 0x6C04
1090#define CHANNEL1_TX_BUFFER_POINTER 0x6C08
1091#define CHANNEL1_TX_NEXT_POINTER 0x6C0c
1092#define CHANNEL1_CURRENT_RX_DESCRIPTOR_POINTER 0x6810
1093#define CHANNEL1_CURRENT_TX_DESCRIPTOR_POINTER 0x6c10
1094#define CHANNEL1_FIRST_TX_DESCRIPTOR_POINTER 0x6c14
1095
1096/* SDMA Interrupt */
1097
1098#define SDMA_CAUSE 0xb820
1099#define SDMA_MASK 0xb8a0
1100
1101
1102/*
1103 * Baude Rate Generators Registers
1104 */
1105
1106/* BRG 0 */
1107
1108#define BRG0_CONFIGURATION_REGISTER 0xb200
1109#define BRG0_BAUDE_TUNING_REGISTER 0xb204
1110
1111/* BRG 1 */
1112
1113#define BRG1_CONFIGURATION_REGISTER 0xb208
1114#define BRG1_BAUDE_TUNING_REGISTER 0xb20c
1115
1116/* BRG 2 */
1117
1118#define BRG2_CONFIGURATION_REGISTER 0xb210
1119#define BRG2_BAUDE_TUNING_REGISTER 0xb214
1120
1121/* BRG Interrupts */
1122
1123#define BRG_CAUSE_REGISTER 0xb834
1124#define BRG_MASK_REGISTER 0xb8b4
1125
1126/* MISC */
1127
1128#define MAIN_ROUTING_REGISTER 0xb400
1129#define RECEIVE_CLOCK_ROUTING_REGISTER 0xb404
1130#define TRANSMIT_CLOCK_ROUTING_REGISTER 0xb408
1131#define COMM_UNIT_ARBITER_CONFIGURATION_REGISTER 0xb40c
1132#define WATCHDOG_CONFIGURATION_REGISTER 0xb410
1133#define WATCHDOG_VALUE_REGISTER 0xb414
1134
1135
1136/*
1137 * Flex TDM Registers
1138 */
1139
1140/* FTDM Port */
1141
1142#define FLEXTDM_TRANSMIT_READ_POINTER 0xa800
1143#define FLEXTDM_RECEIVE_READ_POINTER 0xa804
1144#define FLEXTDM_CONFIGURATION_REGISTER 0xa808
1145#define FLEXTDM_AUX_CHANNELA_TX_REGISTER 0xa80c
1146#define FLEXTDM_AUX_CHANNELA_RX_REGISTER 0xa810
1147#define FLEXTDM_AUX_CHANNELB_TX_REGISTER 0xa814
1148#define FLEXTDM_AUX_CHANNELB_RX_REGISTER 0xa818
1149
1150/* FTDM Interrupts */
1151
1152#define FTDM_CAUSE_REGISTER 0xb830
1153#define FTDM_MASK_REGISTER 0xb8b0
1154
1155
1156/*
1157 * GPP Interface Registers
1158 */
1159
1160#define GPP_IO_CONTROL 0xf100
1161#define GPP_LEVEL_CONTROL 0xf110
1162#define GPP_VALUE 0xf104
1163#define GPP_INTERRUPT_CAUSE 0xf108
1164#define GPP_INTERRUPT_MASK 0xf10c
1165
1166#define MPP_CONTROL0 0xf000
1167#define MPP_CONTROL1 0xf004
1168#define MPP_CONTROL2 0xf008
1169#define MPP_CONTROL3 0xf00c
1170#define DEBUG_PORT_MULTIPLEX 0xf014
1171#define SERIAL_PORT_MULTIPLEX 0xf010
1172
1173/*
1174 * I2C Registers
1175 */
1176
1177#define I2C_SLAVE_ADDRESS 0xc000
1178#define I2C_EXTENDED_SLAVE_ADDRESS 0xc040
1179#define I2C_DATA 0xc004
1180#define I2C_CONTROL 0xc008
1181#define I2C_STATUS_BAUDE_RATE 0xc00C
1182#define I2C_SOFT_RESET 0xc01c
1183
1184/*
1185 * MPSC Registers
1186 */
1187
1188/*
1189 * MPSC0
1190 */
1191
1192#define MPSC0_MAIN_CONFIGURATION_LOW 0x8000
1193#define MPSC0_MAIN_CONFIGURATION_HIGH 0x8004
1194#define MPSC0_PROTOCOL_CONFIGURATION 0x8008
1195#define CHANNEL0_REGISTER1 0x800c
1196#define CHANNEL0_REGISTER2 0x8010
1197#define CHANNEL0_REGISTER3 0x8014
1198#define CHANNEL0_REGISTER4 0x8018
1199#define CHANNEL0_REGISTER5 0x801c
1200#define CHANNEL0_REGISTER6 0x8020
1201#define CHANNEL0_REGISTER7 0x8024
1202#define CHANNEL0_REGISTER8 0x8028
1203#define CHANNEL0_REGISTER9 0x802c
1204#define CHANNEL0_REGISTER10 0x8030
1205#define CHANNEL0_REGISTER11 0x8034
1206
1207/*
1208 * MPSC1
1209 */
1210
1211#define MPSC1_MAIN_CONFIGURATION_LOW 0x9000
1212#define MPSC1_MAIN_CONFIGURATION_HIGH 0x9004
1213#define MPSC1_PROTOCOL_CONFIGURATION 0x9008
1214#define CHANNEL1_REGISTER1 0x900c
1215#define CHANNEL1_REGISTER2 0x9010
1216#define CHANNEL1_REGISTER3 0x9014
1217#define CHANNEL1_REGISTER4 0x9018
1218#define CHANNEL1_REGISTER5 0x901c
1219#define CHANNEL1_REGISTER6 0x9020
1220#define CHANNEL1_REGISTER7 0x9024
1221#define CHANNEL1_REGISTER8 0x9028
1222#define CHANNEL1_REGISTER9 0x902c
1223#define CHANNEL1_REGISTER10 0x9030
1224#define CHANNEL1_REGISTER11 0x9034
1225
1226/*
1227 * MPSCs Interupts
1228 */
1229
1230#define MPSC0_CAUSE 0xb804
1231#define MPSC0_MASK 0xb884
1232#define MPSC1_CAUSE 0xb80c
1233#define MPSC1_MASK 0xb88c
1234
1235#endif /* __ASM_MIPS_MV64240_H */
diff --git a/include/asm-mips/hardirq.h b/include/asm-mips/hardirq.h
new file mode 100644
index 000000000000..90bf399e6dd9
--- /dev/null
+++ b/include/asm-mips/hardirq.h
@@ -0,0 +1,24 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1997, 98, 99, 2000, 01, 05 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#ifndef _ASM_HARDIRQ_H
11#define _ASM_HARDIRQ_H
12
13#include <linux/threads.h>
14#include <linux/irq.h>
15
16typedef struct {
17 unsigned int __softirq_pending;
18} ____cacheline_aligned irq_cpustat_t;
19
20#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
21
22extern void ack_bad_irq(unsigned int irq);
23
24#endif /* _ASM_HARDIRQ_H */
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
new file mode 100644
index 000000000000..f524eaccd5f1
--- /dev/null
+++ b/include/asm-mips/hazards.h
@@ -0,0 +1,217 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle
7 */
8#ifndef _ASM_HAZARDS_H
9#define _ASM_HAZARDS_H
10
11#include <linux/config.h>
12
13#ifdef __ASSEMBLY__
14
15 .macro _ssnop
16 sll $0, $0, 1
17 .endm
18
19 .macro _ehb
20 sll $0, $0, 3
21 .endm
22
23/*
24 * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent
25 * use of the JTLB for instructions should not occur for 4 cpu cycles and use
26 * for data translations should not occur for 3 cpu cycles.
27 */
28#ifdef CONFIG_CPU_RM9000
29
30 .macro mtc0_tlbw_hazard
31 .set push
32 .set mips32
33 _ssnop; _ssnop; _ssnop; _ssnop
34 .set pop
35 .endm
36
37 .macro tlbw_eret_hazard
38 .set push
39 .set mips32
40 _ssnop; _ssnop; _ssnop; _ssnop
41 .set pop
42 .endm
43
44#else
45
46/*
47 * The taken branch will result in a two cycle penalty for the two killed
48 * instructions on R4000 / R4400. Other processors only have a single cycle
49 * hazard so this is nice trick to have an optimal code for a range of
50 * processors.
51 */
52 .macro mtc0_tlbw_hazard
53 b . + 8
54 .endm
55
56 .macro tlbw_eret_hazard
57 .endm
58#endif
59
60/*
61 * mtc0->mfc0 hazard
62 * The 24K has a 2 cycle mtc0/mfc0 execution hazard.
63 * It is a MIPS32R2 processor so ehb will clear the hazard.
64 */
65
66#ifdef CONFIG_CPU_MIPSR2
67/*
68 * Use a macro for ehb unless explicit support for MIPSR2 is enabled
69 */
70
71#define irq_enable_hazard
72 _ehb
73
74#define irq_disable_hazard
75 _ehb
76
77#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000)
78
79/*
80 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
81 */
82
83#define irq_enable_hazard
84
85#define irq_disable_hazard
86
87#else
88
89/*
90 * Classic MIPS needs 1 - 3 nops or ssnops
91 */
92#define irq_enable_hazard
93#define irq_disable_hazard \
94 _ssnop; _ssnop; _ssnop
95
96#endif
97
98#else /* __ASSEMBLY__ */
99
100__asm__(
101 " .macro _ssnop \n\t"
102 " sll $0, $2, 1 \n\t"
103 " .endm \n\t"
104 " \n\t"
105 " .macro _ehb \n\t"
106 " sll $0, $0, 3 \n\t"
107 " .endm \n\t");
108
109#ifdef CONFIG_CPU_RM9000
110/*
111 * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent
112 * use of the JTLB for instructions should not occur for 4 cpu cycles and use
113 * for data translations should not occur for 3 cpu cycles.
114 */
115
116#define mtc0_tlbw_hazard() \
117 __asm__ __volatile__( \
118 ".set\tmips32\n\t" \
119 "_ssnop; _ssnop; _ssnop; _ssnop\n\t" \
120 ".set\tmips0")
121
122#define tlbw_use_hazard() \
123 __asm__ __volatile__( \
124 ".set\tmips32\n\t" \
125 "_ssnop; _ssnop; _ssnop; _ssnop\n\t" \
126 ".set\tmips0")
127#else
128
129/*
130 * Overkill warning ...
131 */
132#define mtc0_tlbw_hazard() \
133 __asm__ __volatile__( \
134 ".set noreorder\n\t" \
135 "nop; nop; nop; nop; nop; nop;\n\t" \
136 ".set reorder\n\t")
137
138#define tlbw_use_hazard() \
139 __asm__ __volatile__( \
140 ".set noreorder\n\t" \
141 "nop; nop; nop; nop; nop; nop;\n\t" \
142 ".set reorder\n\t")
143
144#endif
145
146/*
147 * mtc0->mfc0 hazard
148 * The 24K has a 2 cycle mtc0/mfc0 execution hazard.
149 * It is a MIPS32R2 processor so ehb will clear the hazard.
150 */
151
152#ifdef CONFIG_CPU_MIPSR2
153/*
154 * Use a macro for ehb unless explicit support for MIPSR2 is enabled
155 */
156__asm__(
157 " .macro\tirq_enable_hazard \n\t"
158 " _ehb \n\t"
159 " .endm \n\t"
160 " \n\t"
161 " .macro\tirq_disable_hazard \n\t"
162 " _ehb \n\t"
163 " .endm");
164
165#define irq_enable_hazard() \
166 __asm__ __volatile__( \
167 "_ehb\t\t\t\t# irq_enable_hazard")
168
169#define irq_disable_hazard() \
170 __asm__ __volatile__( \
171 "_ehb\t\t\t\t# irq_disable_hazard")
172
173#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000)
174
175/*
176 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
177 */
178
179__asm__(
180 " .macro\tirq_enable_hazard \n\t"
181 " .endm \n\t"
182 " \n\t"
183 " .macro\tirq_disable_hazard \n\t"
184 " .endm");
185
186#define irq_enable_hazard() do { } while (0)
187#define irq_disable_hazard() do { } while (0)
188
189#else
190
191/*
192 * Default for classic MIPS processors. Assume worst case hazards but don't
193 * care about the irq_enable_hazard - sooner or later the hardware will
194 * enable it and we don't care when exactly.
195 */
196
197__asm__(
198 " # \n\t"
199 " # There is a hazard but we do not care \n\t"
200 " # \n\t"
201 " .macro\tirq_enable_hazard \n\t"
202 " .endm \n\t"
203 " \n\t"
204 " .macro\tirq_disable_hazard \n\t"
205 " _ssnop; _ssnop; _ssnop \n\t"
206 " .endm");
207
208#define irq_enable_hazard() do { } while (0)
209#define irq_disable_hazard() \
210 __asm__ __volatile__( \
211 "_ssnop; _ssnop; _ssnop;\t\t# irq_disable_hazard")
212
213#endif
214
215#endif /* __ASSEMBLY__ */
216
217#endif /* _ASM_HAZARDS_H */
diff --git a/include/asm-mips/hdreg.h b/include/asm-mips/hdreg.h
new file mode 100644
index 000000000000..5989bbc97cbf
--- /dev/null
+++ b/include/asm-mips/hdreg.h
@@ -0,0 +1 @@
#warning this file is obsolete, please do not use it
diff --git a/include/asm-mips/highmem.h b/include/asm-mips/highmem.h
new file mode 100644
index 000000000000..f49930d947d4
--- /dev/null
+++ b/include/asm-mips/highmem.h
@@ -0,0 +1,103 @@
1/*
2 * highmem.h: virtual kernel memory mappings for high memory
3 *
4 * Used in CONFIG_HIGHMEM systems for memory pages which
5 * are not addressable by direct kernel virtual addresses.
6 *
7 * Copyright (C) 1999 Gerhard Wichert, Siemens AG
8 * Gerhard.Wichert@pdb.siemens.de
9 *
10 *
11 * Redesigned the x86 32-bit VM architecture to deal with
12 * up to 16 Terabyte physical memory. With current x86 CPUs
13 * we now support up to 64 Gigabytes physical RAM.
14 *
15 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
16 */
17#ifndef _ASM_HIGHMEM_H
18#define _ASM_HIGHMEM_H
19
20#ifdef __KERNEL__
21
22#include <linux/config.h>
23#include <linux/init.h>
24#include <linux/interrupt.h>
25#include <asm/kmap_types.h>
26
27/* undef for production */
28#define HIGHMEM_DEBUG 1
29
30/* declarations for highmem.c */
31extern unsigned long highstart_pfn, highend_pfn;
32
33extern pte_t *kmap_pte;
34extern pgprot_t kmap_prot;
35extern pte_t *pkmap_page_table;
36
37/*
38 * Right now we initialize only a single pte table. It can be extended
39 * easily, subsequent pte tables have to be allocated in one physical
40 * chunk of RAM.
41 */
42#define PKMAP_BASE (0xfe000000UL)
43#define LAST_PKMAP 1024
44#define LAST_PKMAP_MASK (LAST_PKMAP-1)
45#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
46#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
47
48extern void * kmap_high(struct page *page);
49extern void kunmap_high(struct page *page);
50
51/*
52 * CONFIG_LIMITED_DMA is for systems with DMA limitations such as Momentum's
53 * Jaguar ATX. This option exploits the highmem code in the kernel so is
54 * always enabled together with CONFIG_HIGHMEM but at this time doesn't
55 * actually add highmem functionality.
56 */
57
58#ifdef CONFIG_LIMITED_DMA
59
60/*
61 * These are the default functions for the no-highmem case from
62 * <linux/highmem.h>
63 */
64static inline void *kmap(struct page *page)
65{
66 might_sleep();
67 return page_address(page);
68}
69
70#define kunmap(page) do { (void) (page); } while (0)
71
72static inline void *kmap_atomic(struct page *page, enum km_type type)
73{
74 return page_address(page);
75}
76
77static inline void kunmap_atomic(void *kvaddr, enum km_type type) { }
78
79#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
80
81#define flush_cache_kmaps() do { } while (0)
82
83#else /* LIMITED_DMA */
84
85extern void *__kmap(struct page *page);
86extern void __kunmap(struct page *page);
87extern void *__kmap_atomic(struct page *page, enum km_type type);
88extern void __kunmap_atomic(void *kvaddr, enum km_type type);
89extern struct page *__kmap_atomic_to_page(void *ptr);
90
91#define kmap __kmap
92#define kunmap __kunmap
93#define kmap_atomic __kmap_atomic
94#define kunmap_atomic __kunmap_atomic
95#define kmap_atomic_to_page __kmap_atomic_to_page
96
97#define flush_cache_kmaps() flush_cache_all()
98
99#endif /* LIMITED_DMA */
100
101#endif /* __KERNEL__ */
102
103#endif /* _ASM_HIGHMEM_H */
diff --git a/include/asm-mips/hp-lj/asic.h b/include/asm-mips/hp-lj/asic.h
new file mode 100644
index 000000000000..fc2ca656da00
--- /dev/null
+++ b/include/asm-mips/hp-lj/asic.h
@@ -0,0 +1,7 @@
1
2typedef enum { IllegalAsic, UnknownAsic, AndrosAsic, HarmonyAsic } AsicId;
3
4AsicId GetAsicId(void);
5
6const char* const GetAsicName(void);
7
diff --git a/include/asm-mips/hw_irq.h b/include/asm-mips/hw_irq.h
new file mode 100644
index 000000000000..c854d017c0e5
--- /dev/null
+++ b/include/asm-mips/hw_irq.h
@@ -0,0 +1,27 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000, 2001, 2002 by Ralf Baechle
7 */
8#ifndef __ASM_HW_IRQ_H
9#define __ASM_HW_IRQ_H
10
11#include <linux/profile.h>
12#include <asm/atomic.h>
13
14extern void disable_8259A_irq(unsigned int irq);
15extern void enable_8259A_irq(unsigned int irq);
16extern int i8259A_irq_pending(unsigned int irq);
17extern void make_8259A_irq(unsigned int irq);
18extern void init_8259A(int aeoi);
19
20extern atomic_t irq_err_count;
21
22/* This may not be apropriate for all machines, we'll see ... */
23static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
24{
25}
26
27#endif /* __ASM_HW_IRQ_H */
diff --git a/include/asm-mips/i8259.h b/include/asm-mips/i8259.h
new file mode 100644
index 000000000000..0214abe3f0af
--- /dev/null
+++ b/include/asm-mips/i8259.h
@@ -0,0 +1,67 @@
1/*
2 * include/asm-mips/i8259.h
3 *
4 * i8259A interrupt definitions.
5 *
6 * Copyright (C) 2003 Maciej W. Rozycki
7 * Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14#ifndef _ASM_I8259_H
15#define _ASM_I8259_H
16
17#include <linux/compiler.h>
18#include <linux/spinlock.h>
19
20#include <asm/io.h>
21
22extern spinlock_t i8259A_lock;
23
24extern void init_i8259_irqs(void);
25
26/*
27 * Do the traditional i8259 interrupt polling thing. This is for the few
28 * cases where no better interrupt acknowledge method is available and we
29 * absolutely must touch the i8259.
30 */
31static inline int i8259_irq(void)
32{
33 int irq;
34
35 spin_lock(&i8259A_lock);
36
37 /* Perform an interrupt acknowledge cycle on controller 1. */
38 outb(0x0C, 0x20); /* prepare for poll */
39 irq = inb(0x20) & 7;
40 if (irq == 2) {
41 /*
42 * Interrupt is cascaded so perform interrupt
43 * acknowledge on controller 2.
44 */
45 outb(0x0C, 0xA0); /* prepare for poll */
46 irq = (inb(0xA0) & 7) + 8;
47 }
48
49 if (unlikely(irq == 7)) {
50 /*
51 * This may be a spurious interrupt.
52 *
53 * Read the interrupt status register (ISR). If the most
54 * significant bit is not set then there is no valid
55 * interrupt.
56 */
57 outb(0x0B, 0x20); /* ISR register */
58 if(~inb(0x20) & 0x80)
59 irq = -1;
60 }
61
62 spin_unlock(&i8259A_lock);
63
64 return irq;
65}
66
67#endif /* _ASM_I8259_H */
diff --git a/include/asm-mips/ide.h b/include/asm-mips/ide.h
new file mode 100644
index 000000000000..bb674c3b0303
--- /dev/null
+++ b/include/asm-mips/ide.h
@@ -0,0 +1,13 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * This file contains the MIPS architecture specific IDE code.
7 */
8#ifndef __ASM_IDE_H
9#define __ASM_IDE_H
10
11#include <ide.h>
12
13#endif /* __ASM_IDE_H */
diff --git a/include/asm-mips/inst.h b/include/asm-mips/inst.h
new file mode 100644
index 000000000000..6ad517241768
--- /dev/null
+++ b/include/asm-mips/inst.h
@@ -0,0 +1,371 @@
1/*
2 * Format of an instruction in memory.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 2000 by Ralf Baechle
9 */
10#ifndef _ASM_INST_H
11#define _ASM_INST_H
12
13/*
14 * Major opcodes; before MIPS IV cop1x was called cop3.
15 */
16enum major_op {
17 spec_op, bcond_op, j_op, jal_op,
18 beq_op, bne_op, blez_op, bgtz_op,
19 addi_op, addiu_op, slti_op, sltiu_op,
20 andi_op, ori_op, xori_op, lui_op,
21 cop0_op, cop1_op, cop2_op, cop1x_op,
22 beql_op, bnel_op, blezl_op, bgtzl_op,
23 daddi_op, daddiu_op, ldl_op, ldr_op,
24 major_1c_op, jalx_op, major_1e_op, major_1f_op,
25 lb_op, lh_op, lwl_op, lw_op,
26 lbu_op, lhu_op, lwr_op, lwu_op,
27 sb_op, sh_op, swl_op, sw_op,
28 sdl_op, sdr_op, swr_op, cache_op,
29 ll_op, lwc1_op, lwc2_op, pref_op,
30 lld_op, ldc1_op, ldc2_op, ld_op,
31 sc_op, swc1_op, swc2_op, major_3b_op, /* Opcode 0x3b is unused */
32 scd_op, sdc1_op, sdc2_op, sd_op
33};
34
35/*
36 * func field of spec opcode.
37 */
38enum spec_op {
39 sll_op, movc_op, srl_op, sra_op,
40 sllv_op, srlv_op, srav_op, spec1_unused_op, /* Opcode 0x07 is unused */
41 jr_op, jalr_op, movz_op, movn_op,
42 syscall_op, break_op, spim_op, sync_op,
43 mfhi_op, mthi_op, mflo_op, mtlo_op,
44 dsllv_op, spec2_unused_op, dsrlv_op, dsrav_op,
45 mult_op, multu_op, div_op, divu_op,
46 dmult_op, dmultu_op, ddiv_op, ddivu_op,
47 add_op, addu_op, sub_op, subu_op,
48 and_op, or_op, xor_op, nor_op,
49 spec3_unused_op, spec4_unused_op, slt_op, sltu_op,
50 dadd_op, daddu_op, dsub_op, dsubu_op,
51 tge_op, tgeu_op, tlt_op, tltu_op,
52 teq_op, spec5_unused_op, tne_op, spec6_unused_op,
53 dsll_op, spec7_unused_op, dsrl_op, dsra_op,
54 dsll32_op, spec8_unused_op, dsrl32_op, dsra32_op
55};
56
57/*
58 * rt field of bcond opcodes.
59 */
60enum rt_op {
61 bltz_op, bgez_op, bltzl_op, bgezl_op,
62 spimi_op, unused_rt_op_0x05, unused_rt_op_0x06, unused_rt_op_0x07,
63 tgei_op, tgeiu_op, tlti_op, tltiu_op,
64 teqi_op, unused_0x0d_rt_op, tnei_op, unused_0x0f_rt_op,
65 bltzal_op, bgezal_op, bltzall_op, bgezall_op
66 /*
67 * The others (0x14 - 0x1f) are unused.
68 */
69};
70
71/*
72 * rs field of cop opcodes.
73 */
74enum cop_op {
75 mfc_op = 0x00, dmfc_op = 0x01,
76 cfc_op = 0x02, mtc_op = 0x04,
77 dmtc_op = 0x05, ctc_op = 0x06,
78 bc_op = 0x08, cop_op = 0x10,
79 copm_op = 0x18
80};
81
82/*
83 * rt field of cop.bc_op opcodes
84 */
85enum bcop_op {
86 bcf_op, bct_op, bcfl_op, bctl_op
87};
88
89/*
90 * func field of cop0 coi opcodes.
91 */
92enum cop0_coi_func {
93 tlbr_op = 0x01, tlbwi_op = 0x02,
94 tlbwr_op = 0x06, tlbp_op = 0x08,
95 rfe_op = 0x10, eret_op = 0x18
96};
97
98/*
99 * func field of cop0 com opcodes.
100 */
101enum cop0_com_func {
102 tlbr1_op = 0x01, tlbw_op = 0x02,
103 tlbp1_op = 0x08, dctr_op = 0x09,
104 dctw_op = 0x0a
105};
106
107/*
108 * fmt field of cop1 opcodes.
109 */
110enum cop1_fmt {
111 s_fmt, d_fmt, e_fmt, q_fmt,
112 w_fmt, l_fmt
113};
114
115/*
116 * func field of cop1 instructions using d, s or w format.
117 */
118enum cop1_sdw_func {
119 fadd_op = 0x00, fsub_op = 0x01,
120 fmul_op = 0x02, fdiv_op = 0x03,
121 fsqrt_op = 0x04, fabs_op = 0x05,
122 fmov_op = 0x06, fneg_op = 0x07,
123 froundl_op = 0x08, ftruncl_op = 0x09,
124 fceill_op = 0x0a, ffloorl_op = 0x0b,
125 fround_op = 0x0c, ftrunc_op = 0x0d,
126 fceil_op = 0x0e, ffloor_op = 0x0f,
127 fmovc_op = 0x11, fmovz_op = 0x12,
128 fmovn_op = 0x13, frecip_op = 0x15,
129 frsqrt_op = 0x16, fcvts_op = 0x20,
130 fcvtd_op = 0x21, fcvte_op = 0x22,
131 fcvtw_op = 0x24, fcvtl_op = 0x25,
132 fcmp_op = 0x30
133};
134
135/*
136 * func field of cop1x opcodes (MIPS IV).
137 */
138enum cop1x_func {
139 lwxc1_op = 0x00, ldxc1_op = 0x01,
140 pfetch_op = 0x07, swxc1_op = 0x08,
141 sdxc1_op = 0x09, madd_s_op = 0x20,
142 madd_d_op = 0x21, madd_e_op = 0x22,
143 msub_s_op = 0x28, msub_d_op = 0x29,
144 msub_e_op = 0x2a, nmadd_s_op = 0x30,
145 nmadd_d_op = 0x31, nmadd_e_op = 0x32,
146 nmsub_s_op = 0x38, nmsub_d_op = 0x39,
147 nmsub_e_op = 0x3a
148};
149
150/*
151 * func field for mad opcodes (MIPS IV).
152 */
153enum mad_func {
154 madd_op = 0x08, msub_op = 0x0a,
155 nmadd_op = 0x0c, nmsub_op = 0x0e
156};
157
158/*
159 * Damn ... bitfields depend from byteorder :-(
160 */
161#ifdef __MIPSEB__
162struct j_format { /* Jump format */
163 unsigned int opcode : 6;
164 unsigned int target : 26;
165};
166
167struct i_format { /* Immediate format (addi, lw, ...) */
168 unsigned int opcode : 6;
169 unsigned int rs : 5;
170 unsigned int rt : 5;
171 signed int simmediate : 16;
172};
173
174struct u_format { /* Unsigned immediate format (ori, xori, ...) */
175 unsigned int opcode : 6;
176 unsigned int rs : 5;
177 unsigned int rt : 5;
178 unsigned int uimmediate : 16;
179};
180
181struct c_format { /* Cache (>= R6000) format */
182 unsigned int opcode : 6;
183 unsigned int rs : 5;
184 unsigned int c_op : 3;
185 unsigned int cache : 2;
186 unsigned int simmediate : 16;
187};
188
189struct r_format { /* Register format */
190 unsigned int opcode : 6;
191 unsigned int rs : 5;
192 unsigned int rt : 5;
193 unsigned int rd : 5;
194 unsigned int re : 5;
195 unsigned int func : 6;
196};
197
198struct p_format { /* Performance counter format (R10000) */
199 unsigned int opcode : 6;
200 unsigned int rs : 5;
201 unsigned int rt : 5;
202 unsigned int rd : 5;
203 unsigned int re : 5;
204 unsigned int func : 6;
205};
206
207struct f_format { /* FPU register format */
208 unsigned int opcode : 6;
209 unsigned int : 1;
210 unsigned int fmt : 4;
211 unsigned int rt : 5;
212 unsigned int rd : 5;
213 unsigned int re : 5;
214 unsigned int func : 6;
215};
216
217struct ma_format { /* FPU multipy and add format (MIPS IV) */
218 unsigned int opcode : 6;
219 unsigned int fr : 5;
220 unsigned int ft : 5;
221 unsigned int fs : 5;
222 unsigned int fd : 5;
223 unsigned int func : 4;
224 unsigned int fmt : 2;
225};
226
227#elif defined(__MIPSEL__)
228
229struct j_format { /* Jump format */
230 unsigned int target : 26;
231 unsigned int opcode : 6;
232};
233
234struct i_format { /* Immediate format */
235 signed int simmediate : 16;
236 unsigned int rt : 5;
237 unsigned int rs : 5;
238 unsigned int opcode : 6;
239};
240
241struct u_format { /* Unsigned immediate format */
242 unsigned int uimmediate : 16;
243 unsigned int rt : 5;
244 unsigned int rs : 5;
245 unsigned int opcode : 6;
246};
247
248struct c_format { /* Cache (>= R6000) format */
249 unsigned int simmediate : 16;
250 unsigned int cache : 2;
251 unsigned int c_op : 3;
252 unsigned int rs : 5;
253 unsigned int opcode : 6;
254};
255
256struct r_format { /* Register format */
257 unsigned int func : 6;
258 unsigned int re : 5;
259 unsigned int rd : 5;
260 unsigned int rt : 5;
261 unsigned int rs : 5;
262 unsigned int opcode : 6;
263};
264
265struct p_format { /* Performance counter format (R10000) */
266 unsigned int func : 6;
267 unsigned int re : 5;
268 unsigned int rd : 5;
269 unsigned int rt : 5;
270 unsigned int rs : 5;
271 unsigned int opcode : 6;
272};
273
274struct f_format { /* FPU register format */
275 unsigned int func : 6;
276 unsigned int re : 5;
277 unsigned int rd : 5;
278 unsigned int rt : 5;
279 unsigned int fmt : 4;
280 unsigned int : 1;
281 unsigned int opcode : 6;
282};
283
284struct ma_format { /* FPU multipy and add format (MIPS IV) */
285 unsigned int fmt : 2;
286 unsigned int func : 4;
287 unsigned int fd : 5;
288 unsigned int fs : 5;
289 unsigned int ft : 5;
290 unsigned int fr : 5;
291 unsigned int opcode : 6;
292};
293
294#else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */
295#error "MIPS but neither __MIPSEL__ nor __MIPSEB__?"
296#endif
297
298union mips_instruction {
299 unsigned int word;
300 unsigned short halfword[2];
301 unsigned char byte[4];
302 struct j_format j_format;
303 struct i_format i_format;
304 struct u_format u_format;
305 struct c_format c_format;
306 struct r_format r_format;
307 struct f_format f_format;
308 struct ma_format ma_format;
309};
310
311/* HACHACHAHCAHC ... */
312
313/* In case some other massaging is needed, keep MIPSInst as wrapper */
314
315#define MIPSInst(x) x
316
317#define I_OPCODE_SFT 26
318#define MIPSInst_OPCODE(x) (MIPSInst(x) >> I_OPCODE_SFT)
319
320#define I_JTARGET_SFT 0
321#define MIPSInst_JTARGET(x) (MIPSInst(x) & 0x03ffffff)
322
323#define I_RS_SFT 21
324#define MIPSInst_RS(x) ((MIPSInst(x) & 0x03e00000) >> I_RS_SFT)
325
326#define I_RT_SFT 16
327#define MIPSInst_RT(x) ((MIPSInst(x) & 0x001f0000) >> I_RT_SFT)
328
329#define I_IMM_SFT 0
330#define MIPSInst_SIMM(x) ((int)((short)(MIPSInst(x) & 0xffff)))
331#define MIPSInst_UIMM(x) (MIPSInst(x) & 0xffff)
332
333#define I_CACHEOP_SFT 18
334#define MIPSInst_CACHEOP(x) ((MIPSInst(x) & 0x001c0000) >> I_CACHEOP_SFT)
335
336#define I_CACHESEL_SFT 16
337#define MIPSInst_CACHESEL(x) ((MIPSInst(x) & 0x00030000) >> I_CACHESEL_SFT)
338
339#define I_RD_SFT 11
340#define MIPSInst_RD(x) ((MIPSInst(x) & 0x0000f800) >> I_RD_SFT)
341
342#define I_RE_SFT 6
343#define MIPSInst_RE(x) ((MIPSInst(x) & 0x000007c0) >> I_RE_SFT)
344
345#define I_FUNC_SFT 0
346#define MIPSInst_FUNC(x) (MIPSInst(x) & 0x0000003f)
347
348#define I_FFMT_SFT 21
349#define MIPSInst_FFMT(x) ((MIPSInst(x) & 0x01e00000) >> I_FFMT_SFT)
350
351#define I_FT_SFT 16
352#define MIPSInst_FT(x) ((MIPSInst(x) & 0x001f0000) >> I_FT_SFT)
353
354#define I_FS_SFT 11
355#define MIPSInst_FS(x) ((MIPSInst(x) & 0x0000f800) >> I_FS_SFT)
356
357#define I_FD_SFT 6
358#define MIPSInst_FD(x) ((MIPSInst(x) & 0x000007c0) >> I_FD_SFT)
359
360#define I_FR_SFT 21
361#define MIPSInst_FR(x) ((MIPSInst(x) & 0x03e00000) >> I_FR_SFT)
362
363#define I_FMA_FUNC_SFT 2
364#define MIPSInst_FMA_FUNC(x) ((MIPSInst(x) & 0x0000003c) >> I_FMA_FUNC_SFT)
365
366#define I_FMA_FFMT_SFT 0
367#define MIPSInst_FMA_FFMT(x) (MIPSInst(x) & 0x00000003)
368
369typedef unsigned int mips_instruction;
370
371#endif /* _ASM_INST_H */
diff --git a/include/asm-mips/interrupt.h b/include/asm-mips/interrupt.h
new file mode 100644
index 000000000000..e8357f5379fa
--- /dev/null
+++ b/include/asm-mips/interrupt.h
@@ -0,0 +1,134 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics
9 * Copyright (C) 2000 MIPS Technologies, Inc.
10 */
11#ifndef _ASM_INTERRUPT_H
12#define _ASM_INTERRUPT_H
13
14#include <asm/hazards.h>
15
16__asm__ (
17 ".macro\tlocal_irq_enable\n\t"
18 ".set\tpush\n\t"
19 ".set\treorder\n\t"
20 ".set\tnoat\n\t"
21 "mfc0\t$1,$12\n\t"
22 "ori\t$1,0x1f\n\t"
23 "xori\t$1,0x1e\n\t"
24 "mtc0\t$1,$12\n\t"
25 "irq_enable_hazard\n\t"
26 ".set\tpop\n\t"
27 ".endm");
28
29static inline void local_irq_enable(void)
30{
31 __asm__ __volatile__(
32 "local_irq_enable"
33 : /* no outputs */
34 : /* no inputs */
35 : "memory");
36}
37
38/*
39 * For cli() we have to insert nops to make sure that the new value
40 * has actually arrived in the status register before the end of this
41 * macro.
42 * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
43 * no nops at all.
44 */
45__asm__ (
46 ".macro\tlocal_irq_disable\n\t"
47 ".set\tpush\n\t"
48 ".set\tnoat\n\t"
49 "mfc0\t$1,$12\n\t"
50 "ori\t$1,1\n\t"
51 "xori\t$1,1\n\t"
52 ".set\tnoreorder\n\t"
53 "mtc0\t$1,$12\n\t"
54 "irq_disable_hazard\n\t"
55 ".set\tpop\n\t"
56 ".endm");
57
58static inline void local_irq_disable(void)
59{
60 __asm__ __volatile__(
61 "local_irq_disable"
62 : /* no outputs */
63 : /* no inputs */
64 : "memory");
65}
66
67__asm__ (
68 ".macro\tlocal_save_flags flags\n\t"
69 ".set\tpush\n\t"
70 ".set\treorder\n\t"
71 "mfc0\t\\flags, $12\n\t"
72 ".set\tpop\n\t"
73 ".endm");
74
75#define local_save_flags(x) \
76__asm__ __volatile__( \
77 "local_save_flags %0" \
78 : "=r" (x))
79
80__asm__ (
81 ".macro\tlocal_irq_save result\n\t"
82 ".set\tpush\n\t"
83 ".set\treorder\n\t"
84 ".set\tnoat\n\t"
85 "mfc0\t\\result, $12\n\t"
86 "ori\t$1, \\result, 1\n\t"
87 "xori\t$1, 1\n\t"
88 ".set\tnoreorder\n\t"
89 "mtc0\t$1, $12\n\t"
90 "irq_disable_hazard\n\t"
91 ".set\tpop\n\t"
92 ".endm");
93
94#define local_irq_save(x) \
95__asm__ __volatile__( \
96 "local_irq_save\t%0" \
97 : "=r" (x) \
98 : /* no inputs */ \
99 : "memory")
100
101__asm__ (
102 ".macro\tlocal_irq_restore flags\n\t"
103 ".set\tnoreorder\n\t"
104 ".set\tnoat\n\t"
105 "mfc0\t$1, $12\n\t"
106 "andi\t\\flags, 1\n\t"
107 "ori\t$1, 1\n\t"
108 "xori\t$1, 1\n\t"
109 "or\t\\flags, $1\n\t"
110 "mtc0\t\\flags, $12\n\t"
111 "irq_disable_hazard\n\t"
112 ".set\tat\n\t"
113 ".set\treorder\n\t"
114 ".endm");
115
116#define local_irq_restore(flags) \
117do { \
118 unsigned long __tmp1; \
119 \
120 __asm__ __volatile__( \
121 "local_irq_restore\t%0" \
122 : "=r" (__tmp1) \
123 : "0" (flags) \
124 : "memory"); \
125} while(0)
126
127#define irqs_disabled() \
128({ \
129 unsigned long flags; \
130 local_save_flags(flags); \
131 !(flags & 1); \
132})
133
134#endif /* _ASM_INTERRUPT_H */
diff --git a/include/asm-mips/inventory.h b/include/asm-mips/inventory.h
new file mode 100644
index 000000000000..4cd36fe98173
--- /dev/null
+++ b/include/asm-mips/inventory.h
@@ -0,0 +1,20 @@
1/*
2 * Miguel de Icaza
3 */
4#ifndef __ASM_INVENTORY_H
5#define __ASM_INVENTORY_H
6
7typedef struct inventory_s {
8 struct inventory_s *inv_next;
9 int inv_class;
10 int inv_type;
11 int inv_controller;
12 int inv_unit;
13 int inv_state;
14} inventory_t;
15
16extern int inventory_items;
17void add_to_inventory (int class, int type, int controller, int unit, int state);
18int dump_inventory_to_user (void *userbuf, int size);
19
20#endif /* __ASM_INVENTORY_H */
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
new file mode 100644
index 000000000000..039845f2e6b0
--- /dev/null
+++ b/include/asm-mips/io.h
@@ -0,0 +1,630 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 1995 Waldorf GmbH
7 * Copyright (C) 1994 - 2000 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
10 * Author: Maciej W. Rozycki <macro@mips.com>
11 */
12#ifndef _ASM_IO_H
13#define _ASM_IO_H
14
15#include <linux/config.h>
16#include <linux/compiler.h>
17#include <linux/kernel.h>
18#include <linux/types.h>
19
20#include <asm/addrspace.h>
21#include <asm/bug.h>
22#include <asm/byteorder.h>
23#include <asm/cpu.h>
24#include <asm/cpu-features.h>
25#include <asm/page.h>
26#include <asm/pgtable-bits.h>
27#include <asm/processor.h>
28
29#include <mangle-port.h>
30
31/*
32 * Slowdown I/O port space accesses for antique hardware.
33 */
34#undef CONF_SLOWDOWN_IO
35
36/*
37 * Raw operations are never swapped in software. Otoh values that raw
38 * operations are working on may or may not have been swapped by the bus
39 * hardware. An example use would be for flash memory that's used for
40 * execute in place.
41 */
42# define __raw_ioswabb(x) (x)
43# define __raw_ioswabw(x) (x)
44# define __raw_ioswabl(x) (x)
45# define __raw_ioswabq(x) (x)
46
47/*
48 * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
49 * less sane hardware forces software to fiddle with this...
50 */
51#if defined(CONFIG_SWAP_IO_SPACE)
52
53# define ioswabb(x) (x)
54# ifdef CONFIG_SGI_IP22
55/*
56 * IP22 seems braindead enough to swap 16bits values in hardware, but
57 * not 32bits. Go figure... Can't tell without documentation.
58 */
59# define ioswabw(x) (x)
60# else
61# define ioswabw(x) le16_to_cpu(x)
62# endif
63# define ioswabl(x) le32_to_cpu(x)
64# define ioswabq(x) le64_to_cpu(x)
65
66#else
67
68# define ioswabb(x) (x)
69# define ioswabw(x) (x)
70# define ioswabl(x) (x)
71# define ioswabq(x) (x)
72
73#endif
74
75/*
76 * Native bus accesses never swapped.
77 */
78#define bus_ioswabb(x) (x)
79#define bus_ioswabw(x) (x)
80#define bus_ioswabl(x) (x)
81#define bus_ioswabq(x) (x)
82
83#define __bus_ioswabq bus_ioswabq
84
85#define IO_SPACE_LIMIT 0xffff
86
87/*
88 * On MIPS I/O ports are memory mapped, so we access them using normal
89 * load/store instructions. mips_io_port_base is the virtual address to
90 * which all ports are being mapped. For sake of efficiency some code
91 * assumes that this is an address that can be loaded with a single lui
92 * instruction, so the lower 16 bits must be zero. Should be true on
93 * on any sane architecture; generic code does not use this assumption.
94 */
95extern const unsigned long mips_io_port_base;
96
97#define set_io_port_base(base) \
98 do { * (unsigned long *) &mips_io_port_base = (base); } while (0)
99
100/*
101 * Thanks to James van Artsdalen for a better timing-fix than
102 * the two short jumps: using outb's to a nonexistent port seems
103 * to guarantee better timings even on fast machines.
104 *
105 * On the other hand, I'd like to be sure of a non-existent port:
106 * I feel a bit unsafe about using 0x80 (should be safe, though)
107 *
108 * Linus
109 *
110 */
111
112#define __SLOW_DOWN_IO \
113 __asm__ __volatile__( \
114 "sb\t$0,0x80(%0)" \
115 : : "r" (mips_io_port_base));
116
117#ifdef CONF_SLOWDOWN_IO
118#ifdef REALLY_SLOW_IO
119#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
120#else
121#define SLOW_DOWN_IO __SLOW_DOWN_IO
122#endif
123#else
124#define SLOW_DOWN_IO
125#endif
126
127/*
128 * virt_to_phys - map virtual addresses to physical
129 * @address: address to remap
130 *
131 * The returned physical address is the physical (CPU) mapping for
132 * the memory address given. It is only valid to use this function on
133 * addresses directly mapped or allocated via kmalloc.
134 *
135 * This function does not give bus mappings for DMA transfers. In
136 * almost all conceivable cases a device driver should not be using
137 * this function
138 */
139static inline unsigned long virt_to_phys(volatile void * address)
140{
141 return (unsigned long)address - PAGE_OFFSET;
142}
143
144/*
145 * phys_to_virt - map physical address to virtual
146 * @address: address to remap
147 *
148 * The returned virtual address is a current CPU mapping for
149 * the memory address given. It is only valid to use this function on
150 * addresses that have a kernel mapping
151 *
152 * This function does not handle bus mappings for DMA transfers. In
153 * almost all conceivable cases a device driver should not be using
154 * this function
155 */
156static inline void * phys_to_virt(unsigned long address)
157{
158 return (void *)(address + PAGE_OFFSET);
159}
160
161/*
162 * ISA I/O bus memory addresses are 1:1 with the physical address.
163 */
164static inline unsigned long isa_virt_to_bus(volatile void * address)
165{
166 return (unsigned long)address - PAGE_OFFSET;
167}
168
169static inline void * isa_bus_to_virt(unsigned long address)
170{
171 return (void *)(address + PAGE_OFFSET);
172}
173
174#define isa_page_to_bus page_to_phys
175
176/*
177 * However PCI ones are not necessarily 1:1 and therefore these interfaces
178 * are forbidden in portable PCI drivers.
179 *
180 * Allow them for x86 for legacy drivers, though.
181 */
182#define virt_to_bus virt_to_phys
183#define bus_to_virt phys_to_virt
184
185/*
186 * isa_slot_offset is the address where E(ISA) busaddress 0 is mapped
187 * for the processor. This implies the assumption that there is only
188 * one of these busses.
189 */
190extern unsigned long isa_slot_offset;
191
192/*
193 * Change "struct page" to physical address.
194 */
195#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
196
197extern void * __ioremap(phys_t offset, phys_t size, unsigned long flags);
198extern void __iounmap(volatile void __iomem *addr);
199
200static inline void * __ioremap_mode(phys_t offset, unsigned long size,
201 unsigned long flags)
202{
203 if (cpu_has_64bit_addresses) {
204 u64 base = UNCAC_BASE;
205
206 /*
207 * R10000 supports a 2 bit uncached attribute therefore
208 * UNCAC_BASE may not equal IO_BASE.
209 */
210 if (flags == _CACHE_UNCACHED)
211 base = (u64) IO_BASE;
212 return (void *) (unsigned long) (base + offset);
213 }
214
215 return __ioremap(offset, size, flags);
216}
217
218/*
219 * ioremap - map bus memory into CPU space
220 * @offset: bus address of the memory
221 * @size: size of the resource to map
222 *
223 * ioremap performs a platform specific sequence of operations to
224 * make bus memory CPU accessible via the readb/readw/readl/writeb/
225 * writew/writel functions and the other mmio helpers. The returned
226 * address is not guaranteed to be usable directly as a virtual
227 * address.
228 */
229#define ioremap(offset, size) \
230 __ioremap_mode((offset), (size), _CACHE_UNCACHED)
231
232/*
233 * ioremap_nocache - map bus memory into CPU space
234 * @offset: bus address of the memory
235 * @size: size of the resource to map
236 *
237 * ioremap_nocache performs a platform specific sequence of operations to
238 * make bus memory CPU accessible via the readb/readw/readl/writeb/
239 * writew/writel functions and the other mmio helpers. The returned
240 * address is not guaranteed to be usable directly as a virtual
241 * address.
242 *
243 * This version of ioremap ensures that the memory is marked uncachable
244 * on the CPU as well as honouring existing caching rules from things like
245 * the PCI bus. Note that there are other caches and buffers on many
246 * busses. In paticular driver authors should read up on PCI writes
247 *
248 * It's useful if some control registers are in such an area and
249 * write combining or read caching is not desirable:
250 */
251#define ioremap_nocache(offset, size) \
252 __ioremap_mode((offset), (size), _CACHE_UNCACHED)
253
254/*
255 * These two are MIPS specific ioremap variant. ioremap_cacheable_cow
256 * requests a cachable mapping, ioremap_uncached_accelerated requests a
257 * mapping using the uncached accelerated mode which isn't supported on
258 * all processors.
259 */
260#define ioremap_cacheable_cow(offset, size) \
261 __ioremap_mode((offset), (size), _CACHE_CACHABLE_COW)
262#define ioremap_uncached_accelerated(offset, size) \
263 __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED)
264
265static inline void iounmap(volatile void __iomem *addr)
266{
267 if (cpu_has_64bit_addresses)
268 return;
269
270 __iounmap(addr);
271}
272
273
274#define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq) \
275 \
276static inline void pfx##write##bwlq(type val, \
277 volatile void __iomem *mem) \
278{ \
279 volatile type *__mem; \
280 type __val; \
281 \
282 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
283 \
284 __val = pfx##ioswab##bwlq(val); \
285 \
286 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
287 *__mem = __val; \
288 else if (cpu_has_64bits) { \
289 unsigned long __flags; \
290 type __tmp; \
291 \
292 if (irq) \
293 local_irq_save(__flags); \
294 __asm__ __volatile__( \
295 ".set mips3" "\t\t# __writeq""\n\t" \
296 "dsll32 %L0, %L0, 0" "\n\t" \
297 "dsrl32 %L0, %L0, 0" "\n\t" \
298 "dsll32 %M0, %M0, 0" "\n\t" \
299 "or %L0, %L0, %M0" "\n\t" \
300 "sd %L0, %2" "\n\t" \
301 ".set mips0" "\n" \
302 : "=r" (__tmp) \
303 : "0" (__val), "m" (*__mem)); \
304 if (irq) \
305 local_irq_restore(__flags); \
306 } else \
307 BUG(); \
308} \
309 \
310static inline type pfx##read##bwlq(volatile void __iomem *mem) \
311{ \
312 volatile type *__mem; \
313 type __val; \
314 \
315 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
316 \
317 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
318 __val = *__mem; \
319 else if (cpu_has_64bits) { \
320 unsigned long __flags; \
321 \
322 local_irq_save(__flags); \
323 __asm__ __volatile__( \
324 ".set mips3" "\t\t# __readq" "\n\t" \
325 "ld %L0, %1" "\n\t" \
326 "dsra32 %M0, %L0, 0" "\n\t" \
327 "sll %L0, %L0, 0" "\n\t" \
328 ".set mips0" "\n" \
329 : "=r" (__val) \
330 : "m" (*__mem)); \
331 local_irq_restore(__flags); \
332 } else { \
333 __val = 0; \
334 BUG(); \
335 } \
336 \
337 return pfx##ioswab##bwlq(__val); \
338}
339
340#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow) \
341 \
342static inline void pfx##out##bwlq##p(type val, unsigned long port) \
343{ \
344 volatile type *__addr; \
345 type __val; \
346 \
347 port = __swizzle_addr_##bwlq(port); \
348 __addr = (void *)(mips_io_port_base + port); \
349 \
350 __val = pfx##ioswab##bwlq(val); \
351 \
352 if (sizeof(type) != sizeof(u64)) { \
353 *__addr = __val; \
354 slow; \
355 } else \
356 BUILD_BUG(); \
357} \
358 \
359static inline type pfx##in##bwlq##p(unsigned long port) \
360{ \
361 volatile type *__addr; \
362 type __val; \
363 \
364 port = __swizzle_addr_##bwlq(port); \
365 __addr = (void *)(mips_io_port_base + port); \
366 \
367 if (sizeof(type) != sizeof(u64)) { \
368 __val = *__addr; \
369 slow; \
370 } else { \
371 __val = 0; \
372 BUILD_BUG(); \
373 } \
374 \
375 return pfx##ioswab##bwlq(__val); \
376}
377
378#define __BUILD_MEMORY_PFX(bus, bwlq, type) \
379 \
380__BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
381
382#define __BUILD_IOPORT_PFX(bus, bwlq, type) \
383 \
384__BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \
385__BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
386
387#define BUILDIO(bwlq, type) \
388 \
389__BUILD_MEMORY_PFX(, bwlq, type) \
390__BUILD_MEMORY_PFX(__raw_, bwlq, type) \
391__BUILD_MEMORY_PFX(bus_, bwlq, type) \
392__BUILD_IOPORT_PFX(, bwlq, type) \
393__BUILD_IOPORT_PFX(__raw_, bwlq, type)
394
395#define __BUILDIO(bwlq, type) \
396 \
397__BUILD_MEMORY_SINGLE(__bus_, bwlq, type, 0)
398
399BUILDIO(b, u8)
400BUILDIO(w, u16)
401BUILDIO(l, u32)
402BUILDIO(q, u64)
403
404__BUILDIO(q, u64)
405
406#define readb_relaxed readb
407#define readw_relaxed readw
408#define readl_relaxed readl
409#define readq_relaxed readq
410
411/*
412 * Some code tests for these symbols
413 */
414#define readq readq
415#define writeq writeq
416
417#define __BUILD_MEMORY_STRING(bwlq, type) \
418 \
419static inline void writes##bwlq(volatile void __iomem *mem, void *addr, \
420 unsigned int count) \
421{ \
422 volatile type *__addr = addr; \
423 \
424 while (count--) { \
425 __raw_write##bwlq(*__addr, mem); \
426 __addr++; \
427 } \
428} \
429 \
430static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
431 unsigned int count) \
432{ \
433 volatile type *__addr = addr; \
434 \
435 while (count--) { \
436 *__addr = __raw_read##bwlq(mem); \
437 __addr++; \
438 } \
439}
440
441#define __BUILD_IOPORT_STRING(bwlq, type) \
442 \
443static inline void outs##bwlq(unsigned long port, void *addr, \
444 unsigned int count) \
445{ \
446 volatile type *__addr = addr; \
447 \
448 while (count--) { \
449 __raw_out##bwlq(*__addr, port); \
450 __addr++; \
451 } \
452} \
453 \
454static inline void ins##bwlq(unsigned long port, void *addr, \
455 unsigned int count) \
456{ \
457 volatile type *__addr = addr; \
458 \
459 while (count--) { \
460 *__addr = __raw_in##bwlq(port); \
461 __addr++; \
462 } \
463}
464
465#define BUILDSTRING(bwlq, type) \
466 \
467__BUILD_MEMORY_STRING(bwlq, type) \
468__BUILD_IOPORT_STRING(bwlq, type)
469
470BUILDSTRING(b, u8)
471BUILDSTRING(w, u16)
472BUILDSTRING(l, u32)
473BUILDSTRING(q, u64)
474
475
476/* Depends on MIPS II instruction set */
477#define mmiowb() asm volatile ("sync" ::: "memory")
478
479#define memset_io(a,b,c) memset((void *)(a),(b),(c))
480#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
481#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
482
483/*
484 * Memory Mapped I/O
485 */
486#define ioread8(addr) readb(addr)
487#define ioread16(addr) readw(addr)
488#define ioread32(addr) readl(addr)
489
490#define iowrite8(b,addr) writeb(b,addr)
491#define iowrite16(w,addr) writew(w,addr)
492#define iowrite32(l,addr) writel(l,addr)
493
494#define ioread8_rep(a,b,c) readsb(a,b,c)
495#define ioread16_rep(a,b,c) readsw(a,b,c)
496#define ioread32_rep(a,b,c) readsl(a,b,c)
497
498#define iowrite8_rep(a,b,c) writesb(a,b,c)
499#define iowrite16_rep(a,b,c) writesw(a,b,c)
500#define iowrite32_rep(a,b,c) writesl(a,b,c)
501
502/* Create a virtual mapping cookie for an IO port range */
503extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
504extern void ioport_unmap(void __iomem *);
505
506/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
507struct pci_dev;
508extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
509extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
510
511/*
512 * ISA space is 'always mapped' on currently supported MIPS systems, no need
513 * to explicitly ioremap() it. The fact that the ISA IO space is mapped
514 * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
515 * are physical addresses. The following constant pointer can be
516 * used as the IO-area pointer (it can be iounmapped as well, so the
517 * analogy with PCI is quite large):
518 */
519#define __ISA_IO_base ((char *)(isa_slot_offset))
520
521#define isa_readb(a) readb(__ISA_IO_base + (a))
522#define isa_readw(a) readw(__ISA_IO_base + (a))
523#define isa_readl(a) readl(__ISA_IO_base + (a))
524#define isa_readq(a) readq(__ISA_IO_base + (a))
525#define isa_writeb(b,a) writeb(b,__ISA_IO_base + (a))
526#define isa_writew(w,a) writew(w,__ISA_IO_base + (a))
527#define isa_writel(l,a) writel(l,__ISA_IO_base + (a))
528#define isa_writeq(q,a) writeq(q,__ISA_IO_base + (a))
529#define isa_memset_io(a,b,c) memset_io(__ISA_IO_base + (a),(b),(c))
530#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),__ISA_IO_base + (b),(c))
531#define isa_memcpy_toio(a,b,c) memcpy_toio(__ISA_IO_base + (a),(b),(c))
532
533/*
534 * We don't have csum_partial_copy_fromio() yet, so we cheat here and
535 * just copy it. The net code will then do the checksum later.
536 */
537#define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len))
538#define isa_eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(b),(c),(d))
539
540/*
541 * check_signature - find BIOS signatures
542 * @io_addr: mmio address to check
543 * @signature: signature block
544 * @length: length of signature
545 *
546 * Perform a signature comparison with the mmio address io_addr. This
547 * address should have been obtained by ioremap.
548 * Returns 1 on a match.
549 */
550static inline int check_signature(char __iomem *io_addr,
551 const unsigned char *signature, int length)
552{
553 int retval = 0;
554 do {
555 if (readb(io_addr) != *signature)
556 goto out;
557 io_addr++;
558 signature++;
559 length--;
560 } while (length);
561 retval = 1;
562out:
563 return retval;
564}
565
566/*
567 * The caches on some architectures aren't dma-coherent and have need to
568 * handle this in software. There are three types of operations that
569 * can be applied to dma buffers.
570 *
571 * - dma_cache_wback_inv(start, size) makes caches and coherent by
572 * writing the content of the caches back to memory, if necessary.
573 * The function also invalidates the affected part of the caches as
574 * necessary before DMA transfers from outside to memory.
575 * - dma_cache_wback(start, size) makes caches and coherent by
576 * writing the content of the caches back to memory, if necessary.
577 * The function also invalidates the affected part of the caches as
578 * necessary before DMA transfers from outside to memory.
579 * - dma_cache_inv(start, size) invalidates the affected parts of the
580 * caches. Dirty lines of the caches may be written back or simply
581 * be discarded. This operation is necessary before dma operations
582 * to the memory.
583 */
584#ifdef CONFIG_DMA_NONCOHERENT
585
586extern void (*_dma_cache_wback_inv)(unsigned long start, unsigned long size);
587extern void (*_dma_cache_wback)(unsigned long start, unsigned long size);
588extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);
589
590#define dma_cache_wback_inv(start, size) _dma_cache_wback_inv(start,size)
591#define dma_cache_wback(start, size) _dma_cache_wback(start,size)
592#define dma_cache_inv(start, size) _dma_cache_inv(start,size)
593
594#else /* Sane hardware */
595
596#define dma_cache_wback_inv(start,size) \
597 do { (void) (start); (void) (size); } while (0)
598#define dma_cache_wback(start,size) \
599 do { (void) (start); (void) (size); } while (0)
600#define dma_cache_inv(start,size) \
601 do { (void) (start); (void) (size); } while (0)
602
603#endif /* CONFIG_DMA_NONCOHERENT */
604
605/*
606 * Read a 32-bit register that requires a 64-bit read cycle on the bus.
607 * Avoid interrupt mucking, just adjust the address for 4-byte access.
608 * Assume the addresses are 8-byte aligned.
609 */
610#ifdef __MIPSEB__
611#define __CSR_32_ADJUST 4
612#else
613#define __CSR_32_ADJUST 0
614#endif
615
616#define csr_out32(v,a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v))
617#define csr_in32(a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST))
618
619/*
620 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
621 * access
622 */
623#define xlate_dev_mem_ptr(p) __va(p)
624
625/*
626 * Convert a virtual cached pointer to an uncached pointer
627 */
628#define xlate_dev_kmem_ptr(p) p
629
630#endif /* _ASM_IO_H */
diff --git a/include/asm-mips/ioctl.h b/include/asm-mips/ioctl.h
new file mode 100644
index 000000000000..cba641a6ce09
--- /dev/null
+++ b/include/asm-mips/ioctl.h
@@ -0,0 +1,99 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 96, 99, 2001 Ralf Baechle
7 */
8#ifndef _ASM_IOCTL_H
9#define _ASM_IOCTL_H
10
11/*
12 * The original linux ioctl numbering scheme was just a general
13 * "anything goes" setup, where more or less random numbers were
14 * assigned. Sorry, I was clueless when I started out on this.
15 *
16 * On the alpha, we'll try to clean it up a bit, using a more sane
17 * ioctl numbering, and also trying to be compatible with OSF/1 in
18 * the process. I'd like to clean it up for the i386 as well, but
19 * it's so painful recognizing both the new and the old numbers..
20 *
21 * The same applies for for the MIPS ABI; in fact even the macros
22 * from Linux/Alpha fit almost perfectly.
23 */
24
25#define _IOC_NRBITS 8
26#define _IOC_TYPEBITS 8
27#define _IOC_SIZEBITS 13
28#define _IOC_DIRBITS 3
29
30#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
31#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
32#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
33#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
34
35#define _IOC_NRSHIFT 0
36#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
37#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
38#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
39
40/*
41 * We to additionally limit parameters to a maximum 255 bytes.
42 */
43#define _IOC_SLMASK 0xff
44
45/*
46 * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
47 * And this turns out useful to catch old ioctl numbers in header
48 * files for us.
49 */
50#define _IOC_NONE 1U
51#define _IOC_READ 2U
52#define _IOC_WRITE 4U
53
54/*
55 * The following are included for compatibility
56 */
57#define _IOC_VOID 0x20000000
58#define _IOC_OUT 0x40000000
59#define _IOC_IN 0x80000000
60#define _IOC_INOUT (IOC_IN|IOC_OUT)
61
62#define _IOC(dir,type,nr,size) \
63 (((dir) << _IOC_DIRSHIFT) | \
64 ((type) << _IOC_TYPESHIFT) | \
65 ((nr) << _IOC_NRSHIFT) | \
66 ((size) << _IOC_SIZESHIFT))
67
68/* provoke compile error for invalid uses of size argument */
69extern unsigned int __invalid_size_argument_for_IOC;
70#define _IOC_TYPECHECK(t) \
71 ((sizeof(t) == sizeof(t[1]) && \
72 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
73 sizeof(t) : __invalid_size_argument_for_IOC)
74
75/* used to create numbers */
76#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
77#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
78#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
79#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
80#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
81#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
82#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
83
84
85/* used to decode them.. */
86#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
87#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
88#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
89#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
90
91/* ...and for the drivers/sound files... */
92
93#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
94#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
95#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
96#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
97#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
98
99#endif /* _ASM_IOCTL_H */
diff --git a/include/asm-mips/ioctls.h b/include/asm-mips/ioctls.h
new file mode 100644
index 000000000000..92f6c36aac4d
--- /dev/null
+++ b/include/asm-mips/ioctls.h
@@ -0,0 +1,105 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1996, 2001 Ralf Baechle
7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 */
9#ifndef __ASM_IOCTLS_H
10#define __ASM_IOCTLS_H
11
12#include <asm/ioctl.h>
13
14#define TCGETA 0x5401
15#define TCSETA 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
16#define TCSETAW 0x5403
17#define TCSETAF 0x5404
18
19#define TCSBRK 0x5405
20#define TCXONC 0x5406
21#define TCFLSH 0x5407
22
23#define TCGETS 0x540d
24#define TCSETS 0x540e
25#define TCSETSW 0x540f
26#define TCSETSF 0x5410
27
28#define TIOCEXCL 0x740d /* set exclusive use of tty */
29#define TIOCNXCL 0x740e /* reset exclusive use of tty */
30#define TIOCOUTQ 0x7472 /* output queue size */
31#define TIOCSTI 0x5472 /* simulate terminal input */
32#define TIOCMGET 0x741d /* get all modem bits */
33#define TIOCMBIS 0x741b /* bis modem bits */
34#define TIOCMBIC 0x741c /* bic modem bits */
35#define TIOCMSET 0x741a /* set all modem bits */
36#define TIOCPKT 0x5470 /* pty: set/clear packet mode */
37#define TIOCPKT_DATA 0x00 /* data packet */
38#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
39#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
40#define TIOCPKT_STOP 0x04 /* stop output */
41#define TIOCPKT_START 0x08 /* start output */
42#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
43#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
44/* #define TIOCPKT_IOCTL 0x40 state change of pty driver */
45#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
46#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
47#define TIOCNOTTY 0x5471 /* void tty association */
48#define TIOCSETD 0x7401
49#define TIOCGETD 0x7400
50
51#define FIOCLEX 0x6601
52#define FIONCLEX 0x6602
53#define FIOASYNC 0x667d
54#define FIONBIO 0x667e
55#define FIOQSIZE 0x667f
56
57#define TIOCGLTC 0x7474 /* get special local chars */
58#define TIOCSLTC 0x7475 /* set special local chars */
59#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
60#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
61#define TIOCCONS _IOW('t', 120, int) /* become virtual console */
62
63#define FIONREAD 0x467f
64#define TIOCINQ FIONREAD
65
66#define TIOCGETP 0x7408
67#define TIOCSETP 0x7409
68#define TIOCSETN 0x740a /* TIOCSETP wo flush */
69
70/* #define TIOCSETA _IOW('t', 20, struct termios) set termios struct */
71/* #define TIOCSETAW _IOW('t', 21, struct termios) drain output, set */
72/* #define TIOCSETAF _IOW('t', 22, struct termios) drn out, fls in, set */
73/* #define TIOCGETD _IOR('t', 26, int) get line discipline */
74/* #define TIOCSETD _IOW('t', 27, int) set line discipline */
75 /* 127-124 compat */
76
77#define TIOCSBRK 0x5427 /* BSD compatibility */
78#define TIOCCBRK 0x5428 /* BSD compatibility */
79#define TIOCGSID 0x7416 /* Return the session ID of FD */
80#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
81#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
82
83/* I hope the range from 0x5480 on is free ... */
84#define TIOCSCTTY 0x5480 /* become controlling tty */
85#define TIOCGSOFTCAR 0x5481
86#define TIOCSSOFTCAR 0x5482
87#define TIOCLINUX 0x5483
88#define TIOCGSERIAL 0x5484
89#define TIOCSSERIAL 0x5485
90#define TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */
91#define TIOCSERCONFIG 0x5488
92#define TIOCSERGWILD 0x5489
93#define TIOCSERSWILD 0x548a
94#define TIOCGLCKTRMIOS 0x548b
95#define TIOCSLCKTRMIOS 0x548c
96#define TIOCSERGSTRUCT 0x548d /* For debugging only */
97#define TIOCSERGETLSR 0x548e /* Get line status register */
98#define TIOCSERGETMULTI 0x548f /* Get multiport config */
99#define TIOCSERSETMULTI 0x5490 /* Set multiport config */
100#define TIOCMIWAIT 0x5491 /* wait for a change on serial input line(s) */
101#define TIOCGICOUNT 0x5492 /* read serial port inline interrupt counts */
102#define TIOCGHAYESESP 0x5493 /* Get Hayes ESP configuration */
103#define TIOCSHAYESESP 0x5494 /* Set Hayes ESP configuration */
104
105#endif /* __ASM_IOCTLS_H */
diff --git a/include/asm-mips/ip32/crime.h b/include/asm-mips/ip32/crime.h
new file mode 100644
index 000000000000..152879bae20f
--- /dev/null
+++ b/include/asm-mips/ip32/crime.h
@@ -0,0 +1,161 @@
1/*
2 * Definitions for the SGI CRIME (CPU, Rendering, Interconnect and Memory
3 * Engine)
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *
9 * Copyright (C) 2000 Harald Koerfgen
10 */
11
12#ifndef __ASM_CRIME_H__
13#define __ASM_CRIME_H__
14
15/*
16 * Address map
17 */
18#define CRIME_BASE 0x14000000 /* physical */
19
20#undef BIT
21#define BIT(x) (1UL << (x))
22
23struct sgi_crime {
24 volatile unsigned long id;
25#define CRIME_ID_MASK 0xff
26#define CRIME_ID_IDBITS 0xf0
27#define CRIME_ID_IDVALUE 0xa0
28#define CRIME_ID_REV 0x0f
29#define CRIME_REV_PETTY 0x00
30#define CRIME_REV_11 0x11
31#define CRIME_REV_13 0x13
32#define CRIME_REV_14 0x14
33
34 volatile unsigned long control;
35#define CRIME_CONTROL_MASK 0x3fff
36#define CRIME_CONTROL_TRITON_SYSADC 0x2000
37#define CRIME_CONTROL_CRIME_SYSADC 0x1000
38#define CRIME_CONTROL_HARD_RESET 0x0800
39#define CRIME_CONTROL_SOFT_RESET 0x0400
40#define CRIME_CONTROL_DOG_ENA 0x0200
41#define CRIME_CONTROL_ENDIANESS 0x0100
42#define CRIME_CONTROL_ENDIAN_BIG 0x0100
43#define CRIME_CONTROL_ENDIAN_LITTLE 0x0000
44#define CRIME_CONTROL_CQUEUE_HWM 0x000f
45#define CRIME_CONTROL_CQUEUE_SHFT 0
46#define CRIME_CONTROL_WBUF_HWM 0x00f0
47#define CRIME_CONTROL_WBUF_SHFT 8
48
49 volatile unsigned long istat;
50 volatile unsigned long imask;
51 volatile unsigned long soft_int;
52 volatile unsigned long hard_int;
53#define MACE_VID_IN1_INT BIT(0)
54#define MACE_VID_IN2_INT BIT(1)
55#define MACE_VID_OUT_INT BIT(2)
56#define MACE_ETHERNET_INT BIT(3)
57#define MACE_SUPERIO_INT BIT(4)
58#define MACE_MISC_INT BIT(5)
59#define MACE_AUDIO_INT BIT(6)
60#define MACE_PCI_BRIDGE_INT BIT(7)
61#define MACEPCI_SCSI0_INT BIT(8)
62#define MACEPCI_SCSI1_INT BIT(9)
63#define MACEPCI_SLOT0_INT BIT(10)
64#define MACEPCI_SLOT1_INT BIT(11)
65#define MACEPCI_SLOT2_INT BIT(12)
66#define MACEPCI_SHARED0_INT BIT(13)
67#define MACEPCI_SHARED1_INT BIT(14)
68#define MACEPCI_SHARED2_INT BIT(15)
69#define CRIME_GBE0_INT BIT(16)
70#define CRIME_GBE1_INT BIT(17)
71#define CRIME_GBE2_INT BIT(18)
72#define CRIME_GBE3_INT BIT(19)
73#define CRIME_CPUERR_INT BIT(20)
74#define CRIME_MEMERR_INT BIT(21)
75#define CRIME_RE_EMPTY_E_INT BIT(22)
76#define CRIME_RE_FULL_E_INT BIT(23)
77#define CRIME_RE_IDLE_E_INT BIT(24)
78#define CRIME_RE_EMPTY_L_INT BIT(25)
79#define CRIME_RE_FULL_L_INT BIT(26)
80#define CRIME_RE_IDLE_L_INT BIT(27)
81#define CRIME_SOFT0_INT BIT(28)
82#define CRIME_SOFT1_INT BIT(29)
83#define CRIME_SOFT2_INT BIT(30)
84#define CRIME_SYSCORERR_INT CRIME_SOFT2_INT
85#define CRIME_VICE_INT BIT(31)
86/* Masks for deciding who handles the interrupt */
87#define CRIME_MACE_INT_MASK 0x8f
88#define CRIME_MACEISA_INT_MASK 0x70
89#define CRIME_MACEPCI_INT_MASK 0xff00
90#define CRIME_CRIME_INT_MASK 0xffff0000
91
92 volatile unsigned long watchdog;
93#define CRIME_DOG_POWER_ON_RESET 0x00010000
94#define CRIME_DOG_WARM_RESET 0x00080000
95#define CRIME_DOG_TIMEOUT (CRIME_DOG_POWER_ON_RESET|CRIME_DOG_WARM_RESET)
96#define CRIME_DOG_VALUE 0x00007fff
97
98 volatile unsigned long timer;
99#define CRIME_MASTER_FREQ 66666500 /* Crime upcounter frequency */
100#define CRIME_NS_PER_TICK 15 /* for delay_calibrate */
101
102 volatile unsigned long cpu_error_addr;
103#define CRIME_CPU_ERROR_ADDR_MASK 0x3ffffffff
104
105 volatile unsigned long cpu_error_stat;
106#define CRIME_CPU_ERROR_MASK 0x7 /* cpu error stat is 3 bits */
107#define CRIME_CPU_ERROR_CPU_ILL_ADDR 0x4
108#define CRIME_CPU_ERROR_VICE_WRT_PRTY 0x2
109#define CRIME_CPU_ERROR_CPU_WRT_PRTY 0x1
110
111 unsigned long _pad0[54];
112
113 volatile unsigned long mc_ctrl;
114 volatile unsigned long bank_ctrl[8];
115#define CRIME_MEM_BANK_CONTROL_MASK 0x11f /* 9 bits 7:5 reserved */
116#define CRIME_MEM_BANK_CONTROL_ADDR 0x01f
117#define CRIME_MEM_BANK_CONTROL_SDRAM_SIZE 0x100
118#define CRIME_MAXBANKS 8
119
120 volatile unsigned long mem_ref_counter;
121#define CRIME_MEM_REF_COUNTER_MASK 0x3ff /* 10bit */
122
123 volatile unsigned long mem_error_stat;
124#define CRIME_MEM_ERROR_STAT_MASK 0x0ff7ffff /* 28-bit register */
125#define CRIME_MEM_ERROR_MACE_ID 0x0000007f
126#define CRIME_MEM_ERROR_MACE_ACCESS 0x00000080
127#define CRIME_MEM_ERROR_RE_ID 0x00007f00
128#define CRIME_MEM_ERROR_RE_ACCESS 0x00008000
129#define CRIME_MEM_ERROR_GBE_ACCESS 0x00010000
130#define CRIME_MEM_ERROR_VICE_ACCESS 0x00020000
131#define CRIME_MEM_ERROR_CPU_ACCESS 0x00040000
132#define CRIME_MEM_ERROR_RESERVED 0x00080000
133#define CRIME_MEM_ERROR_SOFT_ERR 0x00100000
134#define CRIME_MEM_ERROR_HARD_ERR 0x00200000
135#define CRIME_MEM_ERROR_MULTIPLE 0x00400000
136#define CRIME_MEM_ERROR_ECC 0x01800000
137#define CRIME_MEM_ERROR_MEM_ECC_RD 0x00800000
138#define CRIME_MEM_ERROR_MEM_ECC_RMW 0x01000000
139#define CRIME_MEM_ERROR_INV 0x0e000000
140#define CRIME_MEM_ERROR_INV_MEM_ADDR_RD 0x02000000
141#define CRIME_MEM_ERROR_INV_MEM_ADDR_WR 0x04000000
142#define CRIME_MEM_ERROR_INV_MEM_ADDR_RMW 0x08000000
143
144 volatile unsigned long mem_error_addr;
145#define CRIME_MEM_ERROR_ADDR_MASK 0x3fffffff
146
147 volatile unsigned long mem_ecc_syn;
148#define CRIME_MEM_ERROR_ECC_SYN_MASK 0xffffffff
149
150 volatile unsigned long mem_ecc_chk;
151#define CRIME_MEM_ERROR_ECC_CHK_MASK 0xffffffff
152
153 volatile unsigned long mem_ecc_repl;
154#define CRIME_MEM_ERROR_ECC_REPL_MASK 0xffffffff
155};
156
157extern struct sgi_crime *crime;
158
159#define CRIME_HI_MEM_BASE 0x40000000 /* this is where whole 1G of RAM is mapped */
160
161#endif /* __ASM_CRIME_H__ */
diff --git a/include/asm-mips/ip32/ip32_ints.h b/include/asm-mips/ip32/ip32_ints.h
new file mode 100644
index 000000000000..c3c280e3d591
--- /dev/null
+++ b/include/asm-mips/ip32/ip32_ints.h
@@ -0,0 +1,94 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000 Harald Koerfgen
7 */
8
9#ifndef __ASM_IP32_INTS_H
10#define __ASM_IP32_INTS_H
11
12/*
13 * This list reflects the assignment of interrupt numbers to
14 * interrupting events. Order is fairly irrelevant to handling
15 * priority. This differs from irix.
16 */
17
18/* CPU */
19#define IP32_R4K_TIMER_IRQ 0
20
21/* MACE */
22#define MACE_VID_IN1_IRQ 1
23#define MACE_VID_IN2_IRQ 2
24#define MACE_VID_OUT_IRQ 3
25#define MACE_ETHERNET_IRQ 4
26/* SUPERIO, MISC, and AUDIO are MACEISA */
27#define MACE_PCI_BRIDGE_IRQ 8
28
29/* MACEPCI */
30#define MACEPCI_SCSI0_IRQ 9
31#define MACEPCI_SCSI1_IRQ 10
32#define MACEPCI_SLOT0_IRQ 11
33#define MACEPCI_SLOT1_IRQ 12
34#define MACEPCI_SLOT2_IRQ 13
35#define MACEPCI_SHARED0_IRQ 14
36#define MACEPCI_SHARED1_IRQ 15
37#define MACEPCI_SHARED2_IRQ 16
38
39/* CRIME */
40#define CRIME_GBE0_IRQ 17
41#define CRIME_GBE1_IRQ 18
42#define CRIME_GBE2_IRQ 19
43#define CRIME_GBE3_IRQ 20
44#define CRIME_CPUERR_IRQ 21
45#define CRIME_MEMERR_IRQ 22
46#define CRIME_RE_EMPTY_E_IRQ 23
47#define CRIME_RE_FULL_E_IRQ 24
48#define CRIME_RE_IDLE_E_IRQ 25
49#define CRIME_RE_EMPTY_L_IRQ 26
50#define CRIME_RE_FULL_L_IRQ 27
51#define CRIME_RE_IDLE_L_IRQ 28
52#define CRIME_SOFT0_IRQ 29
53#define CRIME_SOFT1_IRQ 30
54#define CRIME_SOFT2_IRQ 31
55#define CRIME_SYSCORERR_IRQ CRIME_SOFT2_IRQ
56#define CRIME_VICE_IRQ 32
57
58/* MACEISA */
59#define MACEISA_AUDIO_SW_IRQ 33
60#define MACEISA_AUDIO_SC_IRQ 34
61#define MACEISA_AUDIO1_DMAT_IRQ 35
62#define MACEISA_AUDIO1_OF_IRQ 36
63#define MACEISA_AUDIO2_DMAT_IRQ 37
64#define MACEISA_AUDIO2_MERR_IRQ 38
65#define MACEISA_AUDIO3_DMAT_IRQ 39
66#define MACEISA_AUDIO3_MERR_IRQ 40
67#define MACEISA_RTC_IRQ 41
68#define MACEISA_KEYB_IRQ 42
69/* MACEISA_KEYB_POLL is not an IRQ */
70#define MACEISA_MOUSE_IRQ 44
71/* MACEISA_MOUSE_POLL is not an IRQ */
72#define MACEISA_TIMER0_IRQ 46
73#define MACEISA_TIMER1_IRQ 47
74#define MACEISA_TIMER2_IRQ 48
75#define MACEISA_PARALLEL_IRQ 49
76#define MACEISA_PAR_CTXA_IRQ 50
77#define MACEISA_PAR_CTXB_IRQ 51
78#define MACEISA_PAR_MERR_IRQ 52
79#define MACEISA_SERIAL1_IRQ 53
80#define MACEISA_SERIAL1_TDMAT_IRQ 54
81#define MACEISA_SERIAL1_TDMAPR_IRQ 55
82#define MACEISA_SERIAL1_TDMAME_IRQ 56
83#define MACEISA_SERIAL1_RDMAT_IRQ 57
84#define MACEISA_SERIAL1_RDMAOR_IRQ 58
85#define MACEISA_SERIAL2_IRQ 59
86#define MACEISA_SERIAL2_TDMAT_IRQ 60
87#define MACEISA_SERIAL2_TDMAPR_IRQ 61
88#define MACEISA_SERIAL2_TDMAME_IRQ 62
89#define MACEISA_SERIAL2_RDMAT_IRQ 63
90#define MACEISA_SERIAL2_RDMAOR_IRQ 64
91
92#define IP32_IRQ_MAX MACEISA_SERIAL2_RDMAOR_IRQ
93
94#endif /* __ASM_IP32_INTS_H */
diff --git a/include/asm-mips/ip32/mace.h b/include/asm-mips/ip32/mace.h
new file mode 100644
index 000000000000..2b7b0fdeac19
--- /dev/null
+++ b/include/asm-mips/ip32/mace.h
@@ -0,0 +1,334 @@
1/*
2 * Definitions for the SGI MACE (Multimedia, Audio and Communications Engine)
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2000 Harald Koerfgen
9 * Copyright (C) 2004 Ladislav Michl
10 */
11
12#ifndef __ASM_MACE_H__
13#define __ASM_MACE_H__
14
15/*
16 * Address map
17 */
18#define MACE_BASE 0x1f000000 /* physical */
19
20#undef BIT
21#define BIT(x) (1UL << (x))
22
23/*
24 * PCI interface
25 */
26struct mace_pci {
27 volatile unsigned int error_addr;
28 volatile unsigned int error;
29#define MACEPCI_ERROR_MASTER_ABORT BIT(31)
30#define MACEPCI_ERROR_TARGET_ABORT BIT(30)
31#define MACEPCI_ERROR_DATA_PARITY_ERR BIT(29)
32#define MACEPCI_ERROR_RETRY_ERR BIT(28)
33#define MACEPCI_ERROR_ILLEGAL_CMD BIT(27)
34#define MACEPCI_ERROR_SYSTEM_ERR BIT(26)
35#define MACEPCI_ERROR_INTERRUPT_TEST BIT(25)
36#define MACEPCI_ERROR_PARITY_ERR BIT(24)
37#define MACEPCI_ERROR_OVERRUN BIT(23)
38#define MACEPCI_ERROR_RSVD BIT(22)
39#define MACEPCI_ERROR_MEMORY_ADDR BIT(21)
40#define MACEPCI_ERROR_CONFIG_ADDR BIT(20)
41#define MACEPCI_ERROR_MASTER_ABORT_ADDR_VALID BIT(19)
42#define MACEPCI_ERROR_TARGET_ABORT_ADDR_VALID BIT(18)
43#define MACEPCI_ERROR_DATA_PARITY_ADDR_VALID BIT(17)
44#define MACEPCI_ERROR_RETRY_ADDR_VALID BIT(16)
45#define MACEPCI_ERROR_SIG_TABORT BIT(4)
46#define MACEPCI_ERROR_DEVSEL_MASK 0xc0
47#define MACEPCI_ERROR_DEVSEL_FAST 0
48#define MACEPCI_ERROR_DEVSEL_MED 0x40
49#define MACEPCI_ERROR_DEVSEL_SLOW 0x80
50#define MACEPCI_ERROR_FBB BIT(1)
51#define MACEPCI_ERROR_66MHZ BIT(0)
52 volatile unsigned int control;
53#define MACEPCI_CONTROL_INT(x) BIT(x)
54#define MACEPCI_CONTROL_INT_MASK 0xff
55#define MACEPCI_CONTROL_SERR_ENA BIT(8)
56#define MACEPCI_CONTROL_ARB_N6 BIT(9)
57#define MACEPCI_CONTROL_PARITY_ERR BIT(10)
58#define MACEPCI_CONTROL_MRMRA_ENA BIT(11)
59#define MACEPCI_CONTROL_ARB_N3 BIT(12)
60#define MACEPCI_CONTROL_ARB_N4 BIT(13)
61#define MACEPCI_CONTROL_ARB_N5 BIT(14)
62#define MACEPCI_CONTROL_PARK_LIU BIT(15)
63#define MACEPCI_CONTROL_INV_INT(x) BIT(16+x)
64#define MACEPCI_CONTROL_INV_INT_MASK 0x00ff0000
65#define MACEPCI_CONTROL_OVERRUN_INT BIT(24)
66#define MACEPCI_CONTROL_PARITY_INT BIT(25)
67#define MACEPCI_CONTROL_SERR_INT BIT(26)
68#define MACEPCI_CONTROL_IT_INT BIT(27)
69#define MACEPCI_CONTROL_RE_INT BIT(28)
70#define MACEPCI_CONTROL_DPED_INT BIT(29)
71#define MACEPCI_CONTROL_TAR_INT BIT(30)
72#define MACEPCI_CONTROL_MAR_INT BIT(31)
73 volatile unsigned int rev;
74 unsigned int _pad[0xcf8/4 - 4];
75 volatile unsigned int config_addr;
76 union {
77 volatile unsigned char b[4];
78 volatile unsigned short w[2];
79 volatile unsigned int l;
80 } config_data;
81};
82#define MACEPCI_LOW_MEMORY 0x1a000000
83#define MACEPCI_LOW_IO 0x18000000
84#define MACEPCI_SWAPPED_VIEW 0
85#define MACEPCI_NATIVE_VIEW 0x40000000
86#define MACEPCI_IO 0x80000000
87#define MACEPCI_HI_MEMORY 0x280000000
88#define MACEPCI_HI_IO 0x100000000
89
90/*
91 * Video interface
92 */
93struct mace_video {
94 unsigned long xxx; /* later... */
95};
96
97/*
98 * Ethernet interface
99 */
100struct mace_ethernet {
101 volatile unsigned long mac_ctrl;
102 volatile unsigned long int_stat;
103 volatile unsigned long dma_ctrl;
104 volatile unsigned long timer;
105 volatile unsigned long tx_int_al;
106 volatile unsigned long rx_int_al;
107 volatile unsigned long tx_info;
108 volatile unsigned long tx_info_al;
109 volatile unsigned long rx_buff;
110 volatile unsigned long rx_buff_al1;
111 volatile unsigned long rx_buff_al2;
112 volatile unsigned long diag;
113 volatile unsigned long phy_data;
114 volatile unsigned long phy_regs;
115 volatile unsigned long phy_trans_go;
116 volatile unsigned long backoff_seed;
117 /*===================================*/
118 volatile unsigned long imq_reserved[4];
119 volatile unsigned long mac_addr;
120 volatile unsigned long mac_addr2;
121 volatile unsigned long mcast_filter;
122 volatile unsigned long tx_ring_base;
123 /* Following are read-only registers for debugging */
124 volatile unsigned long tx_pkt1_hdr;
125 volatile unsigned long tx_pkt1_ptr[3];
126 volatile unsigned long tx_pkt2_hdr;
127 volatile unsigned long tx_pkt2_ptr[3];
128 /*===================================*/
129 volatile unsigned long rx_fifo;
130};
131
132/*
133 * Peripherals
134 */
135
136/* Audio registers */
137struct mace_audio {
138 volatile unsigned long control;
139 volatile unsigned long codec_control; /* codec status control */
140 volatile unsigned long codec_mask; /* codec status input mask */
141 volatile unsigned long codec_read; /* codec status read data */
142 struct {
143 volatile unsigned long control; /* channel control */
144 volatile unsigned long read_ptr; /* channel read pointer */
145 volatile unsigned long write_ptr; /* channel write pointer */
146 volatile unsigned long depth; /* channel depth */
147 } chan[3];
148};
149
150/* ISA Control and DMA registers */
151struct mace_isactrl {
152 volatile unsigned long ringbase;
153#define MACEISA_RINGBUFFERS_SIZE (8 * 4096)
154
155 volatile unsigned long misc;
156#define MACEISA_FLASH_WE BIT(0) /* 1=> Enable FLASH writes */
157#define MACEISA_PWD_CLEAR BIT(1) /* 1=> PWD CLEAR jumper detected */
158#define MACEISA_NIC_DEASSERT BIT(2)
159#define MACEISA_NIC_DATA BIT(3)
160#define MACEISA_LED_RED BIT(4) /* 0=> Illuminate red LED */
161#define MACEISA_LED_GREEN BIT(5) /* 0=> Illuminate green LED */
162#define MACEISA_DP_RAM_ENABLE BIT(6)
163
164 volatile unsigned long istat;
165 volatile unsigned long imask;
166#define MACEISA_AUDIO_SW_INT BIT(0)
167#define MACEISA_AUDIO_SC_INT BIT(1)
168#define MACEISA_AUDIO1_DMAT_INT BIT(2)
169#define MACEISA_AUDIO1_OF_INT BIT(3)
170#define MACEISA_AUDIO2_DMAT_INT BIT(4)
171#define MACEISA_AUDIO2_MERR_INT BIT(5)
172#define MACEISA_AUDIO3_DMAT_INT BIT(6)
173#define MACEISA_AUDIO3_MERR_INT BIT(7)
174#define MACEISA_RTC_INT BIT(8)
175#define MACEISA_KEYB_INT BIT(9)
176#define MACEISA_KEYB_POLL_INT BIT(10)
177#define MACEISA_MOUSE_INT BIT(11)
178#define MACEISA_MOUSE_POLL_INT BIT(12)
179#define MACEISA_TIMER0_INT BIT(13)
180#define MACEISA_TIMER1_INT BIT(14)
181#define MACEISA_TIMER2_INT BIT(15)
182#define MACEISA_PARALLEL_INT BIT(16)
183#define MACEISA_PAR_CTXA_INT BIT(17)
184#define MACEISA_PAR_CTXB_INT BIT(18)
185#define MACEISA_PAR_MERR_INT BIT(19)
186#define MACEISA_SERIAL1_INT BIT(20)
187#define MACEISA_SERIAL1_TDMAT_INT BIT(21)
188#define MACEISA_SERIAL1_TDMAPR_INT BIT(22)
189#define MACEISA_SERIAL1_TDMAME_INT BIT(23)
190#define MACEISA_SERIAL1_RDMAT_INT BIT(24)
191#define MACEISA_SERIAL1_RDMAOR_INT BIT(25)
192#define MACEISA_SERIAL2_INT BIT(26)
193#define MACEISA_SERIAL2_TDMAT_INT BIT(27)
194#define MACEISA_SERIAL2_TDMAPR_INT BIT(28)
195#define MACEISA_SERIAL2_TDMAME_INT BIT(29)
196#define MACEISA_SERIAL2_RDMAT_INT BIT(30)
197#define MACEISA_SERIAL2_RDMAOR_INT BIT(31)
198
199 volatile unsigned long _pad[0x2000/8 - 4];
200
201 volatile unsigned long dp_ram[0x400];
202};
203
204/* Keyboard & Mouse registers
205 * -> drivers/input/serio/maceps2.c */
206struct mace_ps2port {
207 volatile unsigned long tx;
208 volatile unsigned long rx;
209 volatile unsigned long control;
210 volatile unsigned long status;
211};
212
213struct mace_ps2 {
214 struct mace_ps2port keyb;
215 struct mace_ps2port mouse;
216};
217
218/* I2C registers
219 * -> drivers/i2c/algos/i2c-algo-sgi.c */
220struct mace_i2c {
221 volatile unsigned long config;
222#define MACEI2C_RESET BIT(0)
223#define MACEI2C_FAST BIT(1)
224#define MACEI2C_DATA_OVERRIDE BIT(2)
225#define MACEI2C_CLOCK_OVERRIDE BIT(3)
226#define MACEI2C_DATA_STATUS BIT(4)
227#define MACEI2C_CLOCK_STATUS BIT(5)
228 volatile unsigned long control;
229 volatile unsigned long data;
230};
231
232/* Timer registers */
233typedef union {
234 volatile unsigned long ust_msc;
235 struct reg {
236 volatile unsigned int ust;
237 volatile unsigned int msc;
238 } reg;
239} timer_reg;
240
241struct mace_timers {
242 volatile unsigned long ust;
243#define MACE_UST_PERIOD_NS 960
244
245 volatile unsigned long compare1;
246 volatile unsigned long compare2;
247 volatile unsigned long compare3;
248
249 timer_reg audio_in;
250 timer_reg audio_out1;
251 timer_reg audio_out2;
252 timer_reg video_in1;
253 timer_reg video_in2;
254 timer_reg video_out;
255};
256
257struct mace_perif {
258 struct mace_audio audio;
259 char _pad0[0x10000 - sizeof(struct mace_audio)];
260
261 struct mace_isactrl ctrl;
262 char _pad1[0x10000 - sizeof(struct mace_isactrl)];
263
264 struct mace_ps2 ps2;
265 char _pad2[0x10000 - sizeof(struct mace_ps2)];
266
267 struct mace_i2c i2c;
268 char _pad3[0x10000 - sizeof(struct mace_i2c)];
269
270 struct mace_timers timers;
271 char _pad4[0x10000 - sizeof(struct mace_timers)];
272};
273
274
275/*
276 * ISA peripherals
277 */
278
279/* Parallel port */
280struct mace_parallel { /* later... */
281};
282
283struct mace_ecp1284 { /* later... */
284};
285
286/* Serial port */
287struct mace_serial {
288 volatile unsigned long xxx; /* later... */
289};
290
291struct mace_isa {
292 struct mace_parallel parallel;
293 char _pad1[0x8000 - sizeof(struct mace_parallel)];
294
295 struct mace_ecp1284 ecp1284;
296 char _pad2[0x8000 - sizeof(struct mace_ecp1284)];
297
298 struct mace_serial serial1;
299 char _pad3[0x8000 - sizeof(struct mace_serial)];
300
301 struct mace_serial serial2;
302 char _pad4[0x8000 - sizeof(struct mace_serial)];
303
304 volatile unsigned char rtc[0x10000];
305};
306
307struct sgi_mace {
308 char _reserved[0x80000];
309
310 struct mace_pci pci;
311 char _pad0[0x80000 - sizeof(struct mace_pci)];
312
313 struct mace_video video_in1;
314 char _pad1[0x80000 - sizeof(struct mace_video)];
315
316 struct mace_video video_in2;
317 char _pad2[0x80000 - sizeof(struct mace_video)];
318
319 struct mace_video video_out;
320 char _pad3[0x80000 - sizeof(struct mace_video)];
321
322 struct mace_ethernet eth;
323 char _pad4[0x80000 - sizeof(struct mace_ethernet)];
324
325 struct mace_perif perif;
326 char _pad5[0x80000 - sizeof(struct mace_perif)];
327
328 struct mace_isa isa;
329 char _pad6[0x80000 - sizeof(struct mace_isa)];
330};
331
332extern struct sgi_mace *mace;
333
334#endif /* __ASM_MACE_H__ */
diff --git a/include/asm-mips/ip32/machine.h b/include/asm-mips/ip32/machine.h
new file mode 100644
index 000000000000..e440fdf4b232
--- /dev/null
+++ b/include/asm-mips/ip32/machine.h
@@ -0,0 +1,21 @@
1/*
2 * machine.h -- Machine/group probing for ip32
3 *
4 * Copyright (C) 2001 Keith M Wesolowski
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10#ifndef _ASM_IP32_MACHINE_H
11#define _ASM_IP32_MACHINE_H
12
13#include <linux/config.h>
14
15#ifdef CONFIG_SGI_IP32
16
17#define SGI_MACH_O2 0x3201
18
19#endif /* CONFIG_SGI_IP32 */
20
21#endif /* _ASM_SGI_MACHINE_H */
diff --git a/include/asm-mips/ipc.h b/include/asm-mips/ipc.h
new file mode 100644
index 000000000000..a46e3d9c2a3f
--- /dev/null
+++ b/include/asm-mips/ipc.h
@@ -0,0 +1 @@
#include <asm-generic/ipc.h>
diff --git a/include/asm-mips/ipcbuf.h b/include/asm-mips/ipcbuf.h
new file mode 100644
index 000000000000..d47d08f264e7
--- /dev/null
+++ b/include/asm-mips/ipcbuf.h
@@ -0,0 +1,28 @@
1#ifndef _ASM_IPCBUF_H
2#define _ASM_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for alpha architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit seq
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid_t uid;
18 __kernel_gid_t gid;
19 __kernel_uid_t cuid;
20 __kernel_gid_t cgid;
21 __kernel_mode_t mode;
22 unsigned short seq;
23 unsigned short __pad1;
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _ASM_IPCBUF_H */
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
new file mode 100644
index 000000000000..b90b11d0b886
--- /dev/null
+++ b/include/asm-mips/irq.h
@@ -0,0 +1,55 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 by Waldorf GMBH, written by Ralf Baechle
7 * Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02, 03 by Ralf Baechle
8 */
9#ifndef _ASM_IRQ_H
10#define _ASM_IRQ_H
11
12#include <linux/config.h>
13#include <linux/linkage.h>
14#include <irq.h>
15
16#ifdef CONFIG_I8259
17static inline int irq_canonicalize(int irq)
18{
19 return ((irq == 2) ? 9 : irq);
20}
21#else
22#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
23#endif
24
25struct pt_regs;
26
27#ifdef CONFIG_PREEMPT
28
29extern asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs);
30
31#else
32
33/*
34 * do_IRQ handles all normal device IRQ's (the special
35 * SMP cross-CPU interrupts have their own specific
36 * handlers).
37 *
38 * Ideally there should be away to get this into kernel/irq/handle.c to
39 * avoid the overhead of a call for just a tiny function ...
40 */
41#define do_IRQ(irq, regs) \
42do { \
43 irq_enter(); \
44 __do_IRQ((irq), (regs)); \
45 irq_exit(); \
46} while (0)
47
48#endif
49
50extern void arch_init_irq(void);
51
52struct irqaction;
53int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
54
55#endif /* _ASM_IRQ_H */
diff --git a/include/asm-mips/irq_cpu.h b/include/asm-mips/irq_cpu.h
new file mode 100644
index 000000000000..ed3d1e3d09ec
--- /dev/null
+++ b/include/asm-mips/irq_cpu.h
@@ -0,0 +1,20 @@
1/*
2 * include/asm-mips/irq_cpu.h
3 *
4 * MIPS CPU interrupt definitions.
5 *
6 * Copyright (C) 2002 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef _ASM_IRQ_CPU_H
14#define _ASM_IRQ_CPU_H
15
16extern void mips_cpu_irq_init(int irq_base);
17extern void rm7k_cpu_irq_init(int irq_base);
18extern void rm9k_cpu_irq_init(int irq_base);
19
20#endif /* _ASM_IRQ_CPU_H */
diff --git a/include/asm-mips/isadep.h b/include/asm-mips/isadep.h
new file mode 100644
index 000000000000..7bb003511d9e
--- /dev/null
+++ b/include/asm-mips/isadep.h
@@ -0,0 +1,35 @@
1/*
2 * Various ISA level dependent constants.
3 * Most of the following constants reflect the different layout
4 * of Coprocessor 0 registers.
5 *
6 * Copyright (c) 1998 Harald Koerfgen
7 */
8#include <linux/config.h>
9
10#ifndef __ASM_ISADEP_H
11#define __ASM_ISADEP_H
12
13#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
14/*
15 * R2000 or R3000
16 */
17
18/*
19 * kernel or user mode? (CP0_STATUS)
20 */
21#define KU_MASK 0x08
22#define KU_USER 0x08
23#define KU_KERN 0x00
24
25#else
26/*
27 * kernel or user mode?
28 */
29#define KU_MASK 0x18
30#define KU_USER 0x10
31#define KU_KERN 0x00
32
33#endif
34
35#endif /* __ASM_ISADEP_H */
diff --git a/include/asm-mips/it8172/it8172.h b/include/asm-mips/it8172/it8172.h
new file mode 100644
index 000000000000..8f23af0a1ee8
--- /dev/null
+++ b/include/asm-mips/it8172/it8172.h
@@ -0,0 +1,348 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 system controller defines.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#ifndef __IT8172__H__
32#define __IT8172__H__
33
34#include <asm/addrspace.h>
35
36#define IT8172_BASE 0x18000000
37#define IT8172_PCI_IO_BASE 0x14000000
38#define IT8172_PCI_MEM_BASE 0x10000000
39
40// System registers offsets from IT8172_BASE
41#define IT_CMFPCR 0x0
42#define IT_DSRR 0x2
43#define IT_PCDCR 0x4
44#define IT_SPLLCR 0x6
45#define IT_CIDR 0x10
46#define IT_CRNR 0x12
47#define IT_CPUTR 0x14
48#define IT_CTCR 0x16
49#define IT_SDPR 0xF0
50
51// Power management register offset from IT8172_PCI_IO_BASE
52// Power Management Device Standby Register
53#define IT_PM_DSR 0x15800
54
55#define IT_PM_DSR_TMR0SB 0x0001
56#define IT_PM_DSR_TMR1SB 0x0002
57#define IT_PM_DSR_CIR0SB 0x0004
58#define IT_PM_DSR_CIR1SB 0x0008
59#define IT_PM_DSR_SCR0SB 0x0010
60#define IT_PM_DSR_SCR1SB 0x0020
61#define IT_PM_DSR_PPSB 0x0040
62#define IT_PM_DSR_I2CSB 0x0080
63#define IT_PM_DSR_UARTSB 0x0100
64#define IT_PM_DSR_IDESB 0x0200
65#define IT_PM_DSR_ACSB 0x0400
66#define IT_PM_DSR_M68KSB 0x0800
67
68// Power Management PCI Device Software Reset Register
69#define IT_PM_PCISR 0x15802
70
71#define IT_PM_PCISR_IDESR 0x0001
72#define IT_PM_PCISR_CDMASR 0x0002
73#define IT_PM_PCISR_USBSR 0x0004
74#define IT_PM_PCISR_DMASR 0x0008
75#define IT_PM_PCISR_ACSR 0x0010
76#define IT_PM_PCISR_MEMSR 0x0020
77#define IT_PM_PCISR_68KSR 0x0040
78
79
80// PCI Configuration address and data register offsets
81// from IT8172_BASE
82#define IT_CONFADDR 0x4000
83#define IT_BUSNUM_SHF 16
84#define IT_DEVNUM_SHF 11
85#define IT_FUNCNUM_SHF 8
86#define IT_REGNUM_SHF 2
87
88#define IT_CONFDATA 0x4004
89
90// PCI configuration header common register offsets
91#define IT_VID 0x00
92#define IT_DID 0x02
93#define IT_PCICMD 0x04
94#define IT_PCISTS 0x06
95#define IT_RID 0x08
96#define IT_CLASSC 0x09
97#define IT_HEADT 0x0E
98#define IT_SERIRQC 0x49
99
100// PCI to Internal/LPC Bus Bridge configuration header register offset
101#define IT_P2I_BCR 0x4C
102#define IT_P2I_D0IOSC 0x50
103#define IT_P2I_D1IOSC 0x54
104#define IT_P2I_D2IOSC 0x58
105#define IT_P2I_D3IOSC 0x5C
106#define IT_P2I_D4IOSC 0x60
107#define IT_P2I_D5IOSC 0x64
108#define IT_P2I_D6IOSC 0x68
109#define IT_P2I_D7IOSC 0x6C
110#define IT_P2I_D8IOSC 0x70
111#define IT_P2I_D9IOSC 0x74
112#define IT_P2I_D10IOSC 0x78
113#define IT_P2I_D11IOSC 0x7C
114
115// Memory controller register offsets from IT8172_BASE
116#define IT_MC_SDRMR 0x1000
117#define IT_MC_SDRTR 0x1004
118#define IT_MC_MCR 0x1008
119#define IT_MC_SDTYPE 0x100C
120#define IT_MC_WPBA 0x1010
121#define IT_MC_WPTA 0x1014
122#define IT_MC_HATR 0x1018
123#define IT_MC_PCICR 0x101C
124
125// Flash/ROM control register offsets from IT8172_BASE
126#define IT_FC_BRCR 0x2000
127#define IT_FC_FCR 0x2004
128#define IT_FC_DCR 0x2008
129
130// M68K interface bridge configuration header register offset
131#define IT_M68K_MBCSR 0x54
132#define IT_M68K_TMR 0x58
133#define IT_M68K_BCR 0x5C
134#define IT_M68K_BSR 0x5D
135#define IT_M68K_DTR 0x5F
136
137// Register offset from IT8172_PCI_IO_BASE
138// These registers are accessible through 8172 PCI IO window.
139
140// INTC
141#define IT_INTC_BASE 0x10000
142#define IT_INTC_LBDNIRR 0x10000
143#define IT_INTC_LBDNIMR 0x10002
144#define IT_INTC_LBDNITR 0x10004
145#define IT_INTC_LBDNIAR 0x10006
146#define IT_INTC_LPCNIRR 0x10010
147#define IT_INTC_LPCNIMR 0x10012
148#define IT_INTC_LPCNITR 0x10014
149#define IT_INTC_LPCNIAR 0x10016
150#define IT_INTC_PDNIRR 0x10020
151#define IT_INTC_PDNIMR 0x10022
152#define IT_INTC_PDNITR 0x10024
153#define IT_INTC_PDNIAR 0x10026
154#define IT_INTC_UMNIRR 0x10030
155#define IT_INTC_UMNITR 0x10034
156#define IT_INTC_UMNIAR 0x10036
157#define IT_INTC_TYPER 0x107FE
158
159// IT8172 PCI device number
160#define IT_C2P_DEVICE 0
161#define IT_AUDIO_DEVICE 1
162#define IT_DMAC_DEVICE 1
163#define IT_CDMAC_DEVICE 1
164#define IT_USB_DEVICE 1
165#define IT_P2I_DEVICE 1
166#define IT_IDE_DEVICE 1
167#define IT_M68K_DEVICE 1
168
169// IT8172 PCI function number
170#define IT_C2P_FUNCION 0
171#define IT_AUDIO_FUNCTION 0
172#define IT_DMAC_FUNCTION 1
173#define IT_CDMAC_FUNCTION 2
174#define IT_USB_FUNCTION 3
175#define IT_P2I_FUNCTION 4
176#define IT_IDE_FUNCTION 5
177#define IT_M68K_FUNCTION 6
178
179// IT8172 GPIO
180#define IT_GPADR 0x13800
181#define IT_GPBDR 0x13808
182#define IT_GPCDR 0x13810
183#define IT_GPACR 0x13802
184#define IT_GPBCR 0x1380A
185#define IT_GPCCR 0x13812
186#define IT_GPAICR 0x13804
187#define IT_GPBICR 0x1380C
188#define IT_GPCICR 0x13814
189#define IT_GPAISR 0x13806
190#define IT_GPBISR 0x1380E
191#define IT_GPCISR 0x13816
192#define IT_GCR 0x13818
193
194// IT8172 RTC
195#define IT_RTC_BASE 0x14800
196#define IT_RTC_CENTURY 0x14808
197
198#define IT_RTC_RIR0 0x00
199#define IT_RTC_RTR0 0x01
200#define IT_RTC_RIR1 0x02
201#define IT_RTC_RTR1 0x03
202#define IT_RTC_RIR2 0x04
203#define IT_RTC_RTR2 0x05
204#define IT_RTC_RCTR 0x08
205#define IT_RTC_RA 0x0A
206#define IT_RTC_RB 0x0B
207#define IT_RTC_RC 0x0C
208#define IT_RTC_RD 0x0D
209
210#define RTC_SEC_INDEX 0x00
211#define RTC_MIN_INDEX 0x02
212#define RTC_HOUR_INDEX 0x04
213#define RTC_DAY_INDEX 0x06
214#define RTC_DATE_INDEX 0x07
215#define RTC_MONTH_INDEX 0x08
216#define RTC_YEAR_INDEX 0x09
217
218// IT8172 internal device registers
219#define IT_TIMER_BASE 0x10800
220#define IT_CIR0_BASE 0x11000
221#define IT_UART_BASE 0x11800
222#define IT_SCR0_BASE 0x12000
223#define IT_SCR1_BASE 0x12800
224#define IT_PP_BASE 0x13000
225#define IT_I2C_BASE 0x14000
226#define IT_CIR1_BASE 0x15000
227
228// IT8172 Smart Card Reader offsets from IT_SCR*_BASE
229#define IT_SCR_SFR 0x08
230#define IT_SCR_SCDR 0x09
231
232// IT8172 IT_SCR_SFR bit definition & mask
233#define IT_SCR_SFR_GATE_UART 0x40
234#define IT_SCR_SFR_GATE_UART_BIT 6
235#define IT_SCR_SFR_GATE_UART_OFF 0
236#define IT_SCR_SFR_GATE_UART_ON 1
237#define IT_SCR_SFR_FET_CHARGE 0x30
238#define IT_SCR_SFR_FET_CHARGE_BIT 4
239#define IT_SCR_SFR_FET_CHARGE_3_3_US 3
240#define IT_SCR_SFR_FET_CHARGE_13_US 2
241#define IT_SCR_SFR_FET_CHARGE_53_US 1
242#define IT_SCR_SFR_FET_CHARGE_213_US 0
243#define IT_SCR_SFR_CARD_FREQ 0x0C
244#define IT_SCR_SFR_CARD_FREQ_BIT 2
245#define IT_SCR_SFR_CARD_FREQ_STOP 3
246#define IT_SCR_SFR_CARD_FREQ_3_5_MHZ 0
247#define IT_SCR_SFR_CARD_FREQ_7_1_MHZ 2
248#define IT_SCR_SFR_CARD_FREQ_96_DIV_MHZ 1
249#define IT_SCR_SFR_FET_ACTIVE 0x02
250#define IT_SCR_SFR_FET_ACTIVE_BIT 1
251#define IT_SCR_SFR_FET_ACTIVE_INVERT 0
252#define IT_SCR_SFR_FET_ACTIVE_NONINVERT 1
253#define IT_SCR_SFR_ENABLE 0x01
254#define IT_SCR_SFR_ENABLE_BIT 0
255#define IT_SCR_SFR_ENABLE_OFF 0
256#define IT_SCR_SFR_ENABLE_ON 1
257
258// IT8172 IT_SCR_SCDR bit definition & mask
259#define IT_SCR_SCDR_RESET_MODE 0x80
260#define IT_SCR_SCDR_RESET_MODE_BIT 7
261#define IT_SCR_SCDR_RESET_MODE_ASYNC 0
262#define IT_SCR_SCDR_RESET_MODE_SYNC 1
263#define IT_SCR_SCDR_DIVISOR 0x7F
264#define IT_SCR_SCDR_DIVISOR_BIT 0
265#define IT_SCR_SCDR_DIVISOR_STOP_VAL_1 0x00
266#define IT_SCR_SCDR_DIVISOR_STOP_VAL_2 0x01
267#define IT_SCR_SCDR_DIVISOR_STOP_VAL_3 0x7F
268
269// IT8172 DMA
270#define IT_DMAC_BASE 0x16000
271#define IT_DMAC_BCAR0 0x00
272#define IT_DMAC_BCAR1 0x04
273#define IT_DMAC_BCAR2 0x08
274#define IT_DMAC_BCAR3 0x0C
275#define IT_DMAC_BCCR0 0x02
276#define IT_DMAC_BCCR1 0x06
277#define IT_DMAC_BCCR2 0x0a
278#define IT_DMAC_BCCR3 0x0e
279#define IT_DMAC_CR 0x10
280#define IT_DMAC_SR 0x12
281#define IT_DMAC_ESR 0x13
282#define IT_DMAC_RQR 0x14
283#define IT_DMAC_MR 0x16
284#define IT_DMAC_EMR 0x17
285#define IT_DMAC_MKR 0x18
286#define IT_DMAC_PAR0 0x20
287#define IT_DMAC_PAR1 0x22
288#define IT_DMAC_PAR2 0x24
289#define IT_DMAC_PAR3 0x26
290
291// IT8172 IDE
292#define IT_IDE_BASE 0x17800
293#define IT_IDE_STATUS 0x1F7
294
295// IT8172 Audio Controller
296#define IT_AC_BASE 0x17000
297#define IT_AC_PCMOV 0x00
298#define IT_AC_FMOV 0x02
299#define IT_AC_I2SV 0x04
300#define IT_AC_DRSS 0x06
301#define IT_AC_PCC 0x08
302#define IT_AC_PCDL 0x0A
303#define IT_AC_PCB1STA 0x0C
304#define IT_AC_PCB2STA 0x10
305#define IT_AC_CAPCC 0x14
306#define IT_AC_CAPCDL 0x16
307#define IT_AC_CAPB1STA 0x18
308#define IT_AC_CAPB2STA 0x1C
309#define IT_AC_CODECC 0x22
310#define IT_AC_I2SMC 0x24
311#define IT_AC_VS 0x26
312#define IT_AC_SRCS 0x28
313#define IT_AC_CIRCP 0x2A
314#define IT_AC_CIRDP 0x2C
315#define IT_AC_TM 0x4A
316#define IT_AC_PFDP 0x4C
317#define IT_AC_GC 0x54
318#define IT_AC_IMC 0x56
319#define IT_AC_ISC 0x5B
320#define IT_AC_OPL3SR 0x68
321#define IT_AC_OPL3DWDR 0x69
322#define IT_AC_OPL3AB1W 0x6A
323#define IT_AC_OPL3DW 0x6B
324#define IT_AC_BPDC 0x70
325
326
327// IT8172 Timer
328#define IT_TIMER_BASE 0x10800
329#define TIMER_TCVR0 0x00
330#define TIMER_TRVR0 0x02
331#define TIMER_TCR0 0x04
332#define TIMER_TIRR 0x06
333#define TIMER_TCVR1 0x08
334#define TIMER_TRVR1 0x0A
335#define TIMER_TCR1 0x0C
336#define TIMER_TIDR 0x0E
337
338
339#define IT_WRITE(ofs, data) *(volatile u32 *)KSEG1ADDR((IT8172_BASE+ofs)) = data
340#define IT_READ(ofs, data) data = *(volatile u32 *)KSEG1ADDR((IT8172_BASE+ofs))
341
342#define IT_IO_WRITE(ofs, data) *(volatile u32 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs)) = data
343#define IT_IO_READ(ofs, data) data = *(volatile u32 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs))
344
345#define IT_IO_WRITE16(ofs, data) *(volatile u16 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs)) = data
346#define IT_IO_READ16(ofs, data) data = *(volatile u16 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs))
347
348#endif
diff --git a/include/asm-mips/it8172/it8172_cir.h b/include/asm-mips/it8172/it8172_cir.h
new file mode 100644
index 000000000000..6a1dbd29f6d1
--- /dev/null
+++ b/include/asm-mips/it8172/it8172_cir.h
@@ -0,0 +1,140 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 Consumer IR port defines.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#define NUM_CIR_PORTS 2
32
33/* Master Control Register */
34#define CIR_RESET 0x1
35#define CIR_FIFO_CLEAR 0x2
36#define CIR_SET_FIFO_TL(x) (((x)&0x3)<<2)
37#define CIR_ILE 0x10
38#define CIR_ILSEL 0x20
39
40/* Interrupt Enable Register */
41#define CIR_TLDLIE 0x1
42#define CIR_RDAIE 0x2
43#define CIR_RFOIE 0x4
44#define CIR_IEC 0x80
45
46/* Interrupt Identification Register */
47#define CIR_TLDLI 0x1
48#define CIR_RDAI 0x2
49#define CIR_RFOI 0x4
50#define CIR_NIP 0x80
51
52/* Carrier Frequency Register */
53#define CIR_SET_CF(x) ((x)&0x1f)
54 #define CFQ_38_480 0xB /* 38 KHz low, 480 KHz high */
55#define CIR_HCFS 0x20
56 #define CIR_SET_HS(x) (((x)&0x1)<<5)
57
58
59/* Receiver Control Register */
60#define CIR_SET_RXDCR(x) ((x)&0x7)
61#define CIR_RXACT 0x8
62#define CIR_RXEND 0x10
63#define CIR_RDWOS 0x20
64 #define CIR_SET_RDWOS(x) (((x)&0x1)<<5)
65#define CIR_RXEN 0x80
66
67/* Transmitter Control Register */
68#define CIR_SET_TXMPW(x) ((x)&0x7)
69#define CIR_SET_TXMPM(x) (((x)&0x3)<<3)
70#define CIR_TXENDF 0x20
71#define CIR_TXRLE 0x40
72
73/* Receiver FIFO Status Register */
74#define CIR_RXFBC_MASK 0x3f
75#define CIR_RXFTO 0x80
76
77/* Wakeup Code Length Register */
78#define CIR_SET_WCL ((x)&0x3f)
79#define CIR_WCL_MASK(x) ((x)&0x3f)
80
81/* Wakeup Power Control/Status Register */
82#define CIR_BTMON 0x2
83#define CIR_CIRON 0x4
84#define CIR_RCRST 0x10
85#define CIR_WCRST 0x20
86
87struct cir_port {
88 int port;
89 unsigned short baud_rate;
90 unsigned char fifo_tl;
91 unsigned char cfq;
92 unsigned char hcfs;
93 unsigned char rdwos;
94 unsigned char rxdcr;
95};
96
97struct it8172_cir_regs {
98 unsigned char dr; /* data */
99 char pad;
100 unsigned char mstcr; /* master control */
101 char pad1;
102 unsigned char ier; /* interrupt enable */
103 char pad2;
104 unsigned char iir; /* interrupt identification */
105 char pad3;
106 unsigned char cfr; /* carrier frequency */
107 char pad4;
108 unsigned char rcr; /* receiver control */
109 char pad5;
110 unsigned char tcr; /* transmitter control */
111 char pad6;
112 char pad7;
113 char pad8;
114 unsigned char bdlr; /* baud rate divisor low byte */
115 char pad9;
116 unsigned char bdhr; /* baud rate divisor high byte */
117 char pad10;
118 unsigned char tfsr; /* tx fifo byte count */
119 char pad11;
120 unsigned char rfsr; /* rx fifo status */
121 char pad12;
122 unsigned char wcl; /* wakeup code length */
123 char pad13;
124 unsigned char wcr; /* wakeup code read/write */
125 char pad14;
126 unsigned char wps; /* wakeup power control/status */
127};
128
129int cir_port_init(struct cir_port *cir);
130extern void clear_fifo(struct cir_port *cir);
131extern void enable_receiver(struct cir_port *cir);
132extern void disable_receiver(struct cir_port *cir);
133extern void enable_rx_demodulation(struct cir_port *cir);
134extern void disable_rx_demodulation(struct cir_port *cir);
135extern void set_rx_active(struct cir_port *cir);
136extern void int_enable(struct cir_port *cir);
137extern void rx_int_enable(struct cir_port *cir);
138extern char get_int_status(struct cir_port *cir);
139extern int cir_get_rx_count(struct cir_port *cir);
140extern char cir_read_data(struct cir_port *cir);
diff --git a/include/asm-mips/it8172/it8172_dbg.h b/include/asm-mips/it8172/it8172_dbg.h
new file mode 100644
index 000000000000..f404ec7c03ac
--- /dev/null
+++ b/include/asm-mips/it8172/it8172_dbg.h
@@ -0,0 +1,38 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Function prototypes for low level uart routines to
5 * directly access a 16550 uart.
6 *
7 * Copyright 2000 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc.
9 * ppopov@mvista.com or source@mvista.com
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31
32#include <linux/types.h>
33
34extern void putch(const unsigned char c);
35extern void puts(unsigned char *cp);
36extern void fputs(unsigned char *cp);
37extern void put64(uint64_t ul);
38extern void put32(unsigned u);
diff --git a/include/asm-mips/it8172/it8172_int.h b/include/asm-mips/it8172/it8172_int.h
new file mode 100644
index 000000000000..837e83ac25f5
--- /dev/null
+++ b/include/asm-mips/it8172/it8172_int.h
@@ -0,0 +1,144 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * ITE 8172 Interrupt Numbering
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#ifndef _MIPS_ITEINT_H
32#define _MIPS_ITEINT_H
33
34/*
35 * Here's the "strategy":
36 * We number the LPC serial irqs from 0 to 15,
37 * the local bus irqs from 16 to 31,
38 * the pci dev register interrupts from 32 to 47,
39 * and the non-maskable ints from 48 to 53.
40 */
41
42#define IT8172_LPC_IRQ_BASE 0 /* first LPC int number */
43#define IT8172_SERIRQ_0 (IT8172_LPC_IRQ_BASE + 0)
44#define IT8172_SERIRQ_1 (IT8172_LPC_IRQ_BASE + 1)
45#define IT8172_SERIRQ_2 (IT8172_LPC_IRQ_BASE + 2)
46#define IT8172_SERIRQ_3 (IT8172_LPC_IRQ_BASE + 3)
47#define IT8172_SERIRQ_4 (IT8172_LPC_IRQ_BASE + 4)
48#define IT8172_SERIRQ_5 (IT8172_LPC_IRQ_BASE + 5)
49#define IT8172_SERIRQ_6 (IT8172_LPC_IRQ_BASE + 6)
50#define IT8172_SERIRQ_7 (IT8172_LPC_IRQ_BASE + 7)
51#define IT8172_SERIRQ_8 (IT8172_LPC_IRQ_BASE + 8)
52#define IT8172_SERIRQ_9 (IT8172_LPC_IRQ_BASE + 9)
53#define IT8172_SERIRQ_10 (IT8172_LPC_IRQ_BASE + 10)
54#define IT8172_SERIRQ_11 (IT8172_LPC_IRQ_BASE + 11)
55#define IT8172_SERIRQ_12 (IT8172_LPC_IRQ_BASE + 12)
56#define IT8172_SERIRQ_13 (IT8172_LPC_IRQ_BASE + 13)
57#define IT8172_SERIRQ_14 (IT8172_LPC_IRQ_BASE + 14)
58#define IT8172_SERIRQ_15 (IT8172_LPC_IRQ_BASE + 15)
59
60#define IT8172_LB_IRQ_BASE 16 /* first local bus int number */
61#define IT8172_PPR_IRQ (IT8172_LB_IRQ_BASE + 0) /* parallel port */
62#define IT8172_TIMER0_IRQ (IT8172_LB_IRQ_BASE + 1)
63#define IT8172_TIMER1_IRQ (IT8172_LB_IRQ_BASE + 2)
64#define IT8172_I2C_IRQ (IT8172_LB_IRQ_BASE + 3)
65#define IT8172_GPIO_IRQ (IT8172_LB_IRQ_BASE + 4)
66#define IT8172_CIR0_IRQ (IT8172_LB_IRQ_BASE + 5)
67#define IT8172_CIR1_IRQ (IT8172_LB_IRQ_BASE + 6)
68#define IT8172_UART_IRQ (IT8172_LB_IRQ_BASE + 7)
69#define IT8172_SCR0_IRQ (IT8172_LB_IRQ_BASE + 8)
70#define IT8172_SCR1_IRQ (IT8172_LB_IRQ_BASE + 9)
71#define IT8172_RTC_IRQ (IT8172_LB_IRQ_BASE + 10)
72#define IT8172_IOCHK_IRQ (IT8172_LB_IRQ_BASE + 11)
73/* 12 - 15 reserved */
74
75/*
76 * Note here that the pci dev registers includes bits for more than
77 * just the pci devices.
78 */
79#define IT8172_PCI_DEV_IRQ_BASE 32 /* first pci dev irq */
80#define IT8172_AC97_IRQ (IT8172_PCI_DEV_IRQ_BASE + 0)
81#define IT8172_MC68K_IRQ (IT8172_PCI_DEV_IRQ_BASE + 1)
82#define IT8172_IDE_IRQ (IT8172_PCI_DEV_IRQ_BASE + 2)
83#define IT8172_USB_IRQ (IT8172_PCI_DEV_IRQ_BASE + 3)
84#define IT8172_BRIDGE_MASTER_IRQ (IT8172_PCI_DEV_IRQ_BASE + 4)
85#define IT8172_BRIDGE_TARGET_IRQ (IT8172_PCI_DEV_IRQ_BASE + 5)
86#define IT8172_PCI_INTA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 6)
87#define IT8172_PCI_INTB_IRQ (IT8172_PCI_DEV_IRQ_BASE + 7)
88#define IT8172_PCI_INTC_IRQ (IT8172_PCI_DEV_IRQ_BASE + 8)
89#define IT8172_PCI_INTD_IRQ (IT8172_PCI_DEV_IRQ_BASE + 9)
90#define IT8172_S_INTA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 10)
91#define IT8172_S_INTB_IRQ (IT8172_PCI_DEV_IRQ_BASE + 11)
92#define IT8172_S_INTC_IRQ (IT8172_PCI_DEV_IRQ_BASE + 12)
93#define IT8172_S_INTD_IRQ (IT8172_PCI_DEV_IRQ_BASE + 13)
94#define IT8172_CDMA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 14)
95#define IT8172_DMA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 15)
96
97#define IT8172_NMI_IRQ_BASE 48
98#define IT8172_SER_NMI_IRQ (IT8172_NMI_IRQ_BASE + 0)
99#define IT8172_PCI_NMI_IRQ (IT8172_NMI_IRQ_BASE + 1)
100#define IT8172_RTC_NMI_IRQ (IT8172_NMI_IRQ_BASE + 2)
101#define IT8172_CPUIF_NMI_IRQ (IT8172_NMI_IRQ_BASE + 3)
102#define IT8172_PMER_NMI_IRQ (IT8172_NMI_IRQ_BASE + 4)
103#define IT8172_POWER_NMI_IRQ (IT8172_NMI_IRQ_BASE + 5)
104
105#define IT8172_LAST_IRQ (IT8172_POWER_NMI_IRQ)
106/* Finally, let's move over here the mips cpu timer interrupt.
107 */
108#define MIPS_CPU_TIMER_IRQ (NR_IRQS-1)
109
110/*
111 * IT8172 Interrupt Controller Registers
112 */
113struct it8172_intc_regs {
114 volatile unsigned short lb_req; /* offset 0 */
115 volatile unsigned short lb_mask;
116 volatile unsigned short lb_trigger;
117 volatile unsigned short lb_level;
118 unsigned char pad0[8];
119
120 volatile unsigned short lpc_req; /* offset 0x10 */
121 volatile unsigned short lpc_mask;
122 volatile unsigned short lpc_trigger;
123 volatile unsigned short lpc_level;
124 unsigned char pad1[8];
125
126 volatile unsigned short pci_req; /* offset 0x20 */
127 volatile unsigned short pci_mask;
128 volatile unsigned short pci_trigger;
129 volatile unsigned short pci_level;
130 unsigned char pad2[8];
131
132 volatile unsigned short nmi_req; /* offset 0x30 */
133 volatile unsigned short nmi_mask;
134 volatile unsigned short nmi_trigger;
135 volatile unsigned short nmi_level;
136 unsigned char pad3[6];
137
138 volatile unsigned short nmi_redir; /* offset 0x3E */
139 unsigned char pad4[0xBE];
140
141 volatile unsigned short intstatus; /* offset 0xFE */
142};
143
144#endif /* _MIPS_ITEINT_H */
diff --git a/include/asm-mips/it8172/it8172_pci.h b/include/asm-mips/it8172/it8172_pci.h
new file mode 100644
index 000000000000..42c61f56eeba
--- /dev/null
+++ b/include/asm-mips/it8172/it8172_pci.h
@@ -0,0 +1,108 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 system controller specific pci defines.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#ifndef _8172PCI_H_
32#define _8172PCI_H_
33
34// PCI configuration space Type0
35#define PCI_IDREG 0x00
36#define PCI_CMDSTSREG 0x04
37#define PCI_CLASSREG 0x08
38#define PCI_BHLCREG 0x0C
39#define PCI_BASE1REG 0x10
40#define PCI_BASE2REG 0x14
41#define PCI_BASE3REG 0x18
42#define PCI_BASE4REG 0x1C
43#define PCI_BASE5REG 0x20
44#define PCI_BASE6REG 0x24
45#define PCI_ROMBASEREG 0x30
46#define PCI_INTRREG 0x3C
47
48// PCI configuration space Type1
49#define PCI_BUSNOREG 0x18
50
51#define IT_PCI_VENDORID(x) ((x) & 0xFFFF)
52#define IT_PCI_DEVICEID(x) (((x)>>16) & 0xFFFF)
53
54// Command register
55#define PCI_CMD_IOEN 0x00000001
56#define PCI_CMD_MEMEN 0x00000002
57#define PCI_CMD_BUSMASTER 0x00000004
58#define PCI_CMD_SPCYCLE 0x00000008
59#define PCI_CMD_WRINV 0x00000010
60#define PCI_CMD_VGASNOOP 0x00000020
61#define PCI_CMD_PERR 0x00000040
62#define PCI_CMD_WAITCTRL 0x00000080
63#define PCI_CMD_SERR 0x00000100
64#define PCI_CMD_FAST_BACKTOBACK 0x00000200
65
66// Status register
67#define PCI_STS_66MHZ 0x00200000
68#define PCI_STS_SUPPORT_UDF 0x00400000
69#define PCI_STS_FAST_BACKTOBACK 0x00800000
70#define PCI_STS_DATA_PERR 0x01000000
71#define PCI_STS_DEVSEL0 0x02000000
72#define PCI_STS_DEVSEL1 0x04000000
73#define PCI_STS_SIG_TGTABORT 0x08000000
74#define PCI_STS_RCV_TGTABORT 0x10000000
75#define PCI_STS_RCV_MSTABORT 0x20000000
76#define PCI_STS_SYSERR 0x40000000
77#define PCI_STS_DETCT_PERR 0x80000000
78
79#define IT_PCI_CLASS(x) (((x)>>24) & 0xFF)
80#define IT_PCI_SUBCLASS(x) (((x)>>16) & 0xFF)
81#define IT_PCI_INTERFACE(x) (((x)>>8) & 0xFF)
82#define IT_PCI_REVISION(x) ((x) & 0xFF)
83
84// PCI class code
85#define PCI_CLASS_BRIDGE 0x06
86
87// bridge subclass
88#define PCI_SUBCLASS_BRIDGE_HOST 0x00
89#define PCI_SUBCLASS_BRIDGE_PCI 0x04
90
91// BHLCREG
92#define IT_PCI_BIST(x) (((x)>>24) & 0xFF)
93#define IT_PCI_HEADERTYPE(x) (((x)>>16) & 0xFF)
94#define IT_PCI_LATENCYTIMER(x) (((x)>>8) & 0xFF)
95#define IT_PCI_CACHELINESIZE(x) ((x) & 0xFF)
96
97#define PCI_MULTIFUNC 0x80
98
99// INTRREG
100#define IT_PCI_MAXLAT(x) (((x)>>24) & 0xFF)
101#define IT_PCI_MINGNT(x) (((x)>>16) & 0xFF)
102#define IT_PCI_INTRPIN(x) (((x)>>8) & 0xFF)
103#define IT_PCI_INTRLINE(x) ((x) & 0xFF)
104
105#define PCI_VENDOR_NEC 0x1033
106#define PCI_VENDOR_DEC 0x1101
107
108#endif // _8172PCI_H_
diff --git a/include/asm-mips/it8712.h b/include/asm-mips/it8712.h
new file mode 100644
index 000000000000..ca2dee02a011
--- /dev/null
+++ b/include/asm-mips/it8712.h
@@ -0,0 +1,28 @@
1
2#ifndef __IT8712_H__
3#define __IT8712_H__
4
5#define LPC_BASE_ADDR 0x14000000
6
7// MB PnP configuration register
8#define LPC_KEY_ADDR 0x1400002E
9#define LPC_DATA_ADDR 0x1400002F
10
11// Device LDN
12#define LDN_SERIAL1 0x01
13#define LDN_SERIAL2 0x02
14#define LDN_PARALLEL 0x03
15#define LDN_KEYBOARD 0x05
16#define LDN_MOUSE 0x06
17
18#define IT8712_UART1_PORT 0x3F8
19#define IT8712_UART2_PORT 0x2F8
20
21#ifndef ASM_ONLY
22
23void LPCSetConfig(char LdnNumber, char Index, char data);
24char LPCGetConfig(char LdnNumber, char Index);
25
26#endif
27
28#endif
diff --git a/include/asm-mips/jazz.h b/include/asm-mips/jazz.h
new file mode 100644
index 000000000000..81cbf004fd13
--- /dev/null
+++ b/include/asm-mips/jazz.h
@@ -0,0 +1,322 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995 - 1998 by Andreas Busse and Ralf Baechle
7 */
8#ifndef __ASM_JAZZ_H
9#define __ASM_JAZZ_H
10
11/*
12 * The addresses below are virtual address. The mappings are
13 * created on startup via wired entries in the tlb. The Mips
14 * Magnum R3000 and R4000 machines are similar in many aspects,
15 * but many hardware register are accessible at 0xb9000000 in
16 * instead of 0xe0000000.
17 */
18
19#define JAZZ_LOCAL_IO_SPACE 0xe0000000
20
21/*
22 * Revision numbers in PICA_ASIC_REVISION
23 *
24 * 0xf0000000 - Rev1
25 * 0xf0000001 - Rev2
26 * 0xf0000002 - Rev3
27 */
28#define PICA_ASIC_REVISION 0xe0000008
29
30/*
31 * The segments of the seven segment LED are mapped
32 * to the control bits as follows:
33 *
34 * (7)
35 * ---------
36 * | |
37 * (2) | | (6)
38 * | (1) |
39 * ---------
40 * | |
41 * (3) | | (5)
42 * | (4) |
43 * --------- . (0)
44 */
45#define PICA_LED 0xe000f000
46
47/*
48 * Some characters for the LED control registers
49 * The original Mips machines seem to have a LED display
50 * with integrated decoder while the Acer machines can
51 * control each of the seven segments and the dot independently.
52 * It's only a toy, anyway...
53 */
54#define LED_DOT 0x01
55#define LED_SPACE 0x00
56#define LED_0 0xfc
57#define LED_1 0x60
58#define LED_2 0xda
59#define LED_3 0xf2
60#define LED_4 0x66
61#define LED_5 0xb6
62#define LED_6 0xbe
63#define LED_7 0xe0
64#define LED_8 0xfe
65#define LED_9 0xf6
66#define LED_A 0xee
67#define LED_b 0x3e
68#define LED_C 0x9c
69#define LED_d 0x7a
70#define LED_E 0x9e
71#define LED_F 0x8e
72
73#ifndef __ASSEMBLY__
74
75static __inline__ void pica_set_led(unsigned int bits)
76{
77 volatile unsigned int *led_register = (unsigned int *) PICA_LED;
78
79 *led_register = bits;
80}
81
82#endif /* !__ASSEMBLY__ */
83
84/*
85 * Base address of the Sonic Ethernet adapter in Jazz machines.
86 */
87#define JAZZ_ETHERNET_BASE 0xe0001000
88
89/*
90 * Base address of the 53C94 SCSI hostadapter in Jazz machines.
91 */
92#define JAZZ_SCSI_BASE 0xe0002000
93
94/*
95 * i8042 keyboard controller for JAZZ and PICA chipsets.
96 * This address is just a guess and seems to differ from
97 * other mips machines such as RC3xxx...
98 */
99#define JAZZ_KEYBOARD_ADDRESS 0xe0005000
100#define JAZZ_KEYBOARD_DATA 0xe0005000
101#define JAZZ_KEYBOARD_COMMAND 0xe0005001
102
103#ifndef __ASSEMBLY__
104
105typedef struct {
106 unsigned char data;
107 unsigned char command;
108} jazz_keyboard_hardware;
109
110#define jazz_kh ((keyboard_hardware *) JAZZ_KEYBOARD_ADDRESS)
111
112typedef struct {
113 unsigned char pad0[3];
114 unsigned char data;
115 unsigned char pad1[3];
116 unsigned char command;
117} mips_keyboard_hardware;
118
119/*
120 * For now. Needs to be changed for RC3xxx support. See below.
121 */
122#define keyboard_hardware jazz_keyboard_hardware
123
124#endif /* !__ASSEMBLY__ */
125
126/*
127 * i8042 keyboard controller for most other Mips machines.
128 */
129#define MIPS_KEYBOARD_ADDRESS 0xb9005000
130#define MIPS_KEYBOARD_DATA 0xb9005003
131#define MIPS_KEYBOARD_COMMAND 0xb9005007
132
133/*
134 * Serial and parallel ports (WD 16C552) on the Mips JAZZ
135 */
136#define JAZZ_SERIAL1_BASE (unsigned int)0xe0006000
137#define JAZZ_SERIAL2_BASE (unsigned int)0xe0007000
138#define JAZZ_PARALLEL_BASE (unsigned int)0xe0008000
139
140/*
141 * Dummy Device Address. Used in jazzdma.c
142 */
143#define JAZZ_DUMMY_DEVICE 0xe000d000
144
145/*
146 * JAZZ timer registers and interrupt no.
147 * Note that the hardware timer interrupt is actually on
148 * cpu level 6, but to keep compatibility with PC stuff
149 * it is remapped to vector 0. See arch/mips/kernel/entry.S.
150 */
151#define JAZZ_TIMER_INTERVAL 0xe0000228
152#define JAZZ_TIMER_REGISTER 0xe0000230
153
154/*
155 * DRAM configuration register
156 */
157#ifndef __ASSEMBLY__
158#ifdef __MIPSEL__
159typedef struct {
160 unsigned int bank2 : 3;
161 unsigned int bank1 : 3;
162 unsigned int mem_bus_width : 1;
163 unsigned int reserved2 : 1;
164 unsigned int page_mode : 1;
165 unsigned int reserved1 : 23;
166} dram_configuration;
167#else /* defined (__MIPSEB__) */
168typedef struct {
169 unsigned int reserved1 : 23;
170 unsigned int page_mode : 1;
171 unsigned int reserved2 : 1;
172 unsigned int mem_bus_width : 1;
173 unsigned int bank1 : 3;
174 unsigned int bank2 : 3;
175} dram_configuration;
176#endif
177#endif /* !__ASSEMBLY__ */
178
179#define PICA_DRAM_CONFIG 0xe00fffe0
180
181/*
182 * JAZZ interrupt control registers
183 */
184#define JAZZ_IO_IRQ_SOURCE 0xe0010000
185#define JAZZ_IO_IRQ_ENABLE 0xe0010002
186
187/*
188 * JAZZ interrupt enable bits
189 */
190#define JAZZ_IE_PARALLEL (1 << 0)
191#define JAZZ_IE_FLOPPY (1 << 1)
192#define JAZZ_IE_SOUND (1 << 2)
193#define JAZZ_IE_VIDEO (1 << 3)
194#define JAZZ_IE_ETHERNET (1 << 4)
195#define JAZZ_IE_SCSI (1 << 5)
196#define JAZZ_IE_KEYBOARD (1 << 6)
197#define JAZZ_IE_MOUSE (1 << 7)
198#define JAZZ_IE_SERIAL1 (1 << 8)
199#define JAZZ_IE_SERIAL2 (1 << 9)
200
201/*
202 * JAZZ Interrupt Level definitions
203 *
204 * This is somewhat broken. For reasons which nobody can remember anymore
205 * we remap the Jazz interrupts to the usual ISA style interrupt numbers.
206 */
207#define JAZZ_PARALLEL_IRQ 16
208#define JAZZ_FLOPPY_IRQ 17
209#define JAZZ_SOUND_IRQ 18
210#define JAZZ_VIDEO_IRQ 19
211#define JAZZ_ETHERNET_IRQ 20
212#define JAZZ_SCSI_IRQ 21
213#define JAZZ_KEYBOARD_IRQ 22
214#define JAZZ_MOUSE_IRQ 23
215#define JAZZ_SERIAL1_IRQ 24
216#define JAZZ_SERIAL2_IRQ 25
217
218#define JAZZ_TIMER_IRQ 31
219
220
221/*
222 * JAZZ DMA Channels
223 * Note: Channels 4...7 are not used with respect to the Acer PICA-61
224 * chipset which does not provide these DMA channels.
225 */
226#define JAZZ_SCSI_DMA 0 /* SCSI */
227#define JAZZ_FLOPPY_DMA 1 /* FLOPPY */
228#define JAZZ_AUDIOL_DMA 2 /* AUDIO L */
229#define JAZZ_AUDIOR_DMA 3 /* AUDIO R */
230
231/*
232 * JAZZ R4030 MCT_ADR chip (DMA controller)
233 * Note: Virtual Addresses !
234 */
235#define JAZZ_R4030_CONFIG 0xE0000000 /* R4030 config register */
236#define JAZZ_R4030_REVISION 0xE0000008 /* same as PICA_ASIC_REVISION */
237#define JAZZ_R4030_INV_ADDR 0xE0000010 /* Invalid Address register */
238
239#define JAZZ_R4030_TRSTBL_BASE 0xE0000018 /* Translation Table Base */
240#define JAZZ_R4030_TRSTBL_LIM 0xE0000020 /* Translation Table Limit */
241#define JAZZ_R4030_TRSTBL_INV 0xE0000028 /* Translation Table Invalidate */
242
243#define JAZZ_R4030_CACHE_MTNC 0xE0000030 /* Cache Maintenance */
244#define JAZZ_R4030_R_FAIL_ADDR 0xE0000038 /* Remote Failed Address */
245#define JAZZ_R4030_M_FAIL_ADDR 0xE0000040 /* Memory Failed Address */
246
247#define JAZZ_R4030_CACHE_PTAG 0xE0000048 /* I/O Cache Physical Tag */
248#define JAZZ_R4030_CACHE_LTAG 0xE0000050 /* I/O Cache Logical Tag */
249#define JAZZ_R4030_CACHE_BMASK 0xE0000058 /* I/O Cache Byte Mask */
250#define JAZZ_R4030_CACHE_BWIN 0xE0000060 /* I/O Cache Buffer Window */
251
252/*
253 * Remote Speed Registers.
254 *
255 * 0: free, 1: Ethernet, 2: SCSI, 3: Floppy,
256 * 4: RTC, 5: Kb./Mouse 6: serial 1, 7: serial 2,
257 * 8: parallel, 9: NVRAM, 10: CPU, 11: PROM,
258 * 12: reserved, 13: free, 14: 7seg LED, 15: ???
259 */
260#define JAZZ_R4030_REM_SPEED 0xE0000070 /* 16 Remote Speed Registers */
261 /* 0xE0000070,78,80... 0xE00000E8 */
262#define JAZZ_R4030_IRQ_ENABLE 0xE00000E8 /* Internal Interrupt Enable */
263#define JAZZ_R4030_INVAL_ADDR 0xE0000010 /* Invalid address Register */
264#define JAZZ_R4030_IRQ_SOURCE 0xE0000200 /* Interrupt Source Register */
265#define JAZZ_R4030_I386_ERROR 0xE0000208 /* i386/EISA Bus Error */
266
267/*
268 * Virtual (E)ISA controller address
269 */
270#define JAZZ_EISA_IRQ_ACK 0xE0000238 /* EISA interrupt acknowledge */
271
272/*
273 * Access the R4030 DMA and I/O Controller
274 */
275#ifndef __ASSEMBLY__
276
277static inline void r4030_delay(void)
278{
279__asm__ __volatile__(
280 ".set\tnoreorder\n\t"
281 "nop\n\t"
282 "nop\n\t"
283 "nop\n\t"
284 "nop\n\t"
285 ".set\treorder");
286}
287
288static inline unsigned short r4030_read_reg16(unsigned long addr)
289{
290 unsigned short ret = *((volatile unsigned short *)addr);
291 r4030_delay();
292 return ret;
293}
294
295static inline unsigned int r4030_read_reg32(unsigned long addr)
296{
297 unsigned int ret = *((volatile unsigned int *)addr);
298 r4030_delay();
299 return ret;
300}
301
302static inline void r4030_write_reg16(unsigned long addr, unsigned val)
303{
304 *((volatile unsigned short *)addr) = val;
305 r4030_delay();
306}
307
308static inline void r4030_write_reg32(unsigned long addr, unsigned val)
309{
310 *((volatile unsigned int *)addr) = val;
311 r4030_delay();
312}
313
314#endif /* !__ASSEMBLY__ */
315
316#define JAZZ_FDC_BASE 0xe0003000
317#define JAZZ_RTC_BASE 0xe0004000
318#define JAZZ_PORT_BASE 0xe2000000
319
320#define JAZZ_EISA_BASE 0xe3000000
321
322#endif /* __ASM_JAZZ_H */
diff --git a/include/asm-mips/jazzdma.h b/include/asm-mips/jazzdma.h
new file mode 100644
index 000000000000..0a205b77e505
--- /dev/null
+++ b/include/asm-mips/jazzdma.h
@@ -0,0 +1,96 @@
1/*
2 * Helpfile for jazzdma.c -- Mips Jazz R4030 DMA controller support
3 */
4#ifndef _ASM_JAZZDMA_H
5#define _ASM_JAZZDMA_H
6
7/*
8 * Prototypes and macros
9 */
10extern void vdma_init(void);
11extern unsigned long vdma_alloc(unsigned long paddr, unsigned long size);
12extern int vdma_free(unsigned long laddr);
13extern int vdma_remap(unsigned long laddr, unsigned long paddr,
14 unsigned long size);
15extern unsigned long vdma_phys2log(unsigned long paddr);
16extern unsigned long vdma_log2phys(unsigned long laddr);
17extern void vdma_stats(void); /* for debugging only */
18
19extern void vdma_enable(int channel);
20extern void vdma_disable(int channel);
21extern void vdma_set_mode(int channel, int mode);
22extern void vdma_set_addr(int channel, long addr);
23extern void vdma_set_count(int channel, int count);
24extern int vdma_get_residue(int channel);
25extern int vdma_get_enable(int channel);
26
27/*
28 * some definitions used by the driver functions
29 */
30#define VDMA_PAGESIZE 4096
31#define VDMA_PGTBL_ENTRIES 4096
32#define VDMA_PGTBL_SIZE (sizeof(VDMA_PGTBL_ENTRY) * VDMA_PGTBL_ENTRIES)
33#define VDMA_PAGE_EMPTY 0xff000000
34
35/*
36 * Macros to get page no. and offset of a given address
37 * Note that VDMA_PAGE() works for physical addresses only
38 */
39#define VDMA_PAGE(a) ((unsigned int)(a) >> 12)
40#define VDMA_OFFSET(a) ((unsigned int)(a) & (VDMA_PAGESIZE-1))
41
42/*
43 * error code returned by vdma_alloc()
44 * (See also arch/mips/kernel/jazzdma.c)
45 */
46#define VDMA_ERROR 0xffffffff
47
48/*
49 * VDMA pagetable entry description
50 */
51typedef volatile struct VDMA_PGTBL_ENTRY {
52 unsigned int frame; /* physical frame no. */
53 unsigned int owner; /* owner of this entry (0=free) */
54} VDMA_PGTBL_ENTRY;
55
56
57/*
58 * DMA channel control registers
59 * in the R4030 MCT_ADR chip
60 */
61#define JAZZ_R4030_CHNL_MODE 0xE0000100 /* 8 DMA Channel Mode Registers, */
62 /* 0xE0000100,120,140... */
63#define JAZZ_R4030_CHNL_ENABLE 0xE0000108 /* 8 DMA Channel Enable Regs, */
64 /* 0xE0000108,128,148... */
65#define JAZZ_R4030_CHNL_COUNT 0xE0000110 /* 8 DMA Channel Byte Cnt Regs, */
66 /* 0xE0000110,130,150... */
67#define JAZZ_R4030_CHNL_ADDR 0xE0000118 /* 8 DMA Channel Address Regs, */
68 /* 0xE0000118,138,158... */
69
70/* channel enable register bits */
71
72#define R4030_CHNL_ENABLE (1<<0)
73#define R4030_CHNL_WRITE (1<<1)
74#define R4030_TC_INTR (1<<8)
75#define R4030_MEM_INTR (1<<9)
76#define R4030_ADDR_INTR (1<<10)
77
78/*
79 * Channel mode register bits
80 */
81#define R4030_MODE_ATIME_40 (0) /* device access time on remote bus */
82#define R4030_MODE_ATIME_80 (1)
83#define R4030_MODE_ATIME_120 (2)
84#define R4030_MODE_ATIME_160 (3)
85#define R4030_MODE_ATIME_200 (4)
86#define R4030_MODE_ATIME_240 (5)
87#define R4030_MODE_ATIME_280 (6)
88#define R4030_MODE_ATIME_320 (7)
89#define R4030_MODE_WIDTH_8 (1<<3) /* device data bus width */
90#define R4030_MODE_WIDTH_16 (2<<3)
91#define R4030_MODE_WIDTH_32 (3<<3)
92#define R4030_MODE_INTR_EN (1<<5)
93#define R4030_MODE_BURST (1<<6) /* Rev. 2 only */
94#define R4030_MODE_FAST_ACK (1<<7) /* Rev. 2 only */
95
96#endif /* _ASM_JAZZDMA_H */
diff --git a/include/asm-mips/jmr3927/irq.h b/include/asm-mips/jmr3927/irq.h
new file mode 100644
index 000000000000..b0c325a22343
--- /dev/null
+++ b/include/asm-mips/jmr3927/irq.h
@@ -0,0 +1,62 @@
1/*
2 * linux/include/asm-mips/tx3927/irq.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 Toshiba Corporation
9 */
10#ifndef __ASM_TX3927_IRQ_H
11#define __ASM_TX3927_IRQ_H
12
13#ifndef __ASSEMBLY__
14
15#include <linux/config.h>
16#include <asm/irq.h>
17
18struct tb_irq_space {
19 struct tb_irq_space* next;
20 int start_irqno;
21 int nr_irqs;
22 void (*mask_func)(int irq_nr, int space_id);
23 void (*unmask_func)(int irq_no, int space_id);
24 const char *name;
25 int space_id;
26 int can_share;
27};
28extern struct tb_irq_space* tb_irq_spaces;
29
30static __inline__ void add_tb_irq_space(struct tb_irq_space* sp)
31{
32 sp->next = tb_irq_spaces;
33 tb_irq_spaces = sp;
34}
35
36
37struct pt_regs;
38extern void
39toshibaboards_spurious(struct pt_regs *regs, int irq);
40extern void
41toshibaboards_irqdispatch(struct pt_regs *regs, int irq);
42
43extern struct irqaction *
44toshibaboards_get_irq_action(int irq);
45extern int
46toshibaboards_setup_irq(int irq, struct irqaction * new);
47
48
49#ifdef CONFIG_TX_BRANCH_LIKELY_BUG_WORKAROUND
50extern void tx_branch_likely_bug_fixup(struct pt_regs *regs);
51#endif
52
53extern int (*toshibaboards_gen_iack)(void);
54
55#endif /* !__ASSEMBLY__ */
56
57#define NR_ISA_IRQS 16
58#define TB_IRQ_IS_ISA(irq) \
59 (0 <= (irq) && (irq) < NR_ISA_IRQS)
60#define TB_IRQ_TO_ISA_IRQ(irq) (irq)
61
62#endif /* __ASM_TX3927_IRQ_H */
diff --git a/include/asm-mips/jmr3927/jmr3927.h b/include/asm-mips/jmr3927/jmr3927.h
new file mode 100644
index 000000000000..86df317b4078
--- /dev/null
+++ b/include/asm-mips/jmr3927/jmr3927.h
@@ -0,0 +1,325 @@
1/*
2 * Defines for the TJSYS JMR-TX3927/JMI-3927IO2/JMY-1394IF.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2000-2001 Toshiba Corporation
9 */
10#ifndef __ASM_TX3927_JMR3927_H
11#define __ASM_TX3927_JMR3927_H
12
13#include <asm/jmr3927/tx3927.h>
14#include <asm/addrspace.h>
15#include <asm/jmr3927/irq.h>
16#ifndef __ASSEMBLY__
17#include <asm/system.h>
18#endif
19
20/* CS */
21#define JMR3927_ROMCE0 0x1fc00000 /* 4M */
22#define JMR3927_ROMCE1 0x1e000000 /* 4M */
23#define JMR3927_ROMCE2 0x14000000 /* 16M */
24#define JMR3927_ROMCE3 0x10000000 /* 64M */
25#define JMR3927_ROMCE5 0x1d000000 /* 4M */
26#define JMR3927_SDCS0 0x00000000 /* 32M */
27#define JMR3927_SDCS1 0x02000000 /* 32M */
28/* PCI Direct Mappings */
29
30#define JMR3927_PCIMEM 0x08000000
31#define JMR3927_PCIMEM_SIZE 0x08000000 /* 128M */
32#define JMR3927_PCIIO 0x15000000
33#define JMR3927_PCIIO_SIZE 0x01000000 /* 16M */
34
35#define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */
36#define JMR3927_PORT_BASE KSEG1
37
38/* select indirect initiator access per errata */
39#define JMR3927_INIT_INDIRECT_PCI
40#define PCI_ISTAT_IDICC 0x1000
41#define PCI_IPCIBE_IBE_LONG 0
42#define PCI_IPCIBE_ICMD_IOREAD 2
43#define PCI_IPCIBE_ICMD_IOWRITE 3
44#define PCI_IPCIBE_ICMD_MEMREAD 6
45#define PCI_IPCIBE_ICMD_MEMWRITE 7
46#define PCI_IPCIBE_ICMD_SHIFT 4
47
48/* Address map (virtual address) */
49#define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0)
50#define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1)
51#define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2)
52#define JMR3927_IOB_BASE (KSEG1 + JMR3927_ROMCE3)
53#define JMR3927_ISAMEM_BASE (JMR3927_IOB_BASE)
54#define JMR3927_ISAIO_BASE (JMR3927_IOB_BASE + 0x01000000)
55#define JMR3927_ISAC_BASE (JMR3927_IOB_BASE + 0x02000000)
56#define JMR3927_LCDVGA_REG_BASE (JMR3927_IOB_BASE + 0x03000000)
57#define JMR3927_LCDVGA_MEM_BASE (JMR3927_IOB_BASE + 0x03800000)
58#define JMR3927_JMY1394_BASE (KSEG1 + JMR3927_ROMCE5)
59#define JMR3927_PREMIER3_BASE (JMR3927_JMY1394_BASE + 0x00100000)
60#define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM)
61#define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO)
62
63#define JMR3927_IOC_REV_ADDR (JMR3927_IOC_BASE + 0x00000000)
64#define JMR3927_IOC_NVRAMB_ADDR (JMR3927_IOC_BASE + 0x00010000)
65#define JMR3927_IOC_LED_ADDR (JMR3927_IOC_BASE + 0x00020000)
66#define JMR3927_IOC_DIPSW_ADDR (JMR3927_IOC_BASE + 0x00030000)
67#define JMR3927_IOC_BREV_ADDR (JMR3927_IOC_BASE + 0x00040000)
68#define JMR3927_IOC_DTR_ADDR (JMR3927_IOC_BASE + 0x00050000)
69#define JMR3927_IOC_INTS1_ADDR (JMR3927_IOC_BASE + 0x00080000)
70#define JMR3927_IOC_INTS2_ADDR (JMR3927_IOC_BASE + 0x00090000)
71#define JMR3927_IOC_INTM_ADDR (JMR3927_IOC_BASE + 0x000a0000)
72#define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000)
73#define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000)
74
75#define JMR3927_ISAC_REV_ADDR (JMR3927_ISAC_BASE + 0x00000000)
76#define JMR3927_ISAC_EINTS_ADDR (JMR3927_ISAC_BASE + 0x00200000)
77#define JMR3927_ISAC_EINTM_ADDR (JMR3927_ISAC_BASE + 0x00300000)
78#define JMR3927_ISAC_NMI_ADDR (JMR3927_ISAC_BASE + 0x00400000)
79#define JMR3927_ISAC_LED_ADDR (JMR3927_ISAC_BASE + 0x00500000)
80#define JMR3927_ISAC_INTP_ADDR (JMR3927_ISAC_BASE + 0x00800000)
81#define JMR3927_ISAC_INTS1_ADDR (JMR3927_ISAC_BASE + 0x00900000)
82#define JMR3927_ISAC_INTS2_ADDR (JMR3927_ISAC_BASE + 0x00a00000)
83#define JMR3927_ISAC_INTM_ADDR (JMR3927_ISAC_BASE + 0x00b00000)
84
85/* Flash ROM */
86#define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE)
87#define JMR3927_FLASH_SIZE 0x00400000
88
89/* bits for IOC_REV/IOC_BREV/ISAC_REV (high byte) */
90#define JMR3927_IDT_MASK 0xfc
91#define JMR3927_REV_MASK 0x03
92#define JMR3927_IOC_IDT 0xe0
93#define JMR3927_ISAC_IDT 0x20
94
95/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */
96#define JMR3927_IOC_INTB_PCIA 0
97#define JMR3927_IOC_INTB_PCIB 1
98#define JMR3927_IOC_INTB_PCIC 2
99#define JMR3927_IOC_INTB_PCID 3
100#define JMR3927_IOC_INTB_MODEM 4
101#define JMR3927_IOC_INTB_INT6 5
102#define JMR3927_IOC_INTB_INT7 6
103#define JMR3927_IOC_INTB_SOFT 7
104#define JMR3927_IOC_INTF_PCIA (1 << JMR3927_IOC_INTF_PCIA)
105#define JMR3927_IOC_INTF_PCIB (1 << JMR3927_IOC_INTB_PCIB)
106#define JMR3927_IOC_INTF_PCIC (1 << JMR3927_IOC_INTB_PCIC)
107#define JMR3927_IOC_INTF_PCID (1 << JMR3927_IOC_INTB_PCID)
108#define JMR3927_IOC_INTF_MODEM (1 << JMR3927_IOC_INTB_MODEM)
109#define JMR3927_IOC_INTF_INT6 (1 << JMR3927_IOC_INTB_INT6)
110#define JMR3927_IOC_INTF_INT7 (1 << JMR3927_IOC_INTB_INT7)
111#define JMR3927_IOC_INTF_SOFT (1 << JMR3927_IOC_INTB_SOFT)
112
113/* bits for IOC_RESET (high byte) */
114#define JMR3927_IOC_RESET_CPU 1
115#define JMR3927_IOC_RESET_PCI 2
116
117/* bits for ISAC_EINTS/ISAC_EINTM (high byte) */
118#define JMR3927_ISAC_EINTB_IOCHK 2
119#define JMR3927_ISAC_EINTB_BWTH 4
120#define JMR3927_ISAC_EINTF_IOCHK (1 << JMR3927_ISAC_EINTB_IOCHK)
121#define JMR3927_ISAC_EINTF_BWTH (1 << JMR3927_ISAC_EINTB_BWTH)
122
123/* bits for ISAC_LED (high byte) */
124#define JMR3927_ISAC_LED_ISALED 0x01
125#define JMR3927_ISAC_LED_USRLED 0x02
126
127/* bits for ISAC_INTS/ISAC_INTM/ISAC_INTP (high byte) */
128#define JMR3927_ISAC_INTB_IRQ5 0
129#define JMR3927_ISAC_INTB_IRQKB 1
130#define JMR3927_ISAC_INTB_IRQMOUSE 2
131#define JMR3927_ISAC_INTB_IRQ4 3
132#define JMR3927_ISAC_INTB_IRQ12 4
133#define JMR3927_ISAC_INTB_IRQ3 5
134#define JMR3927_ISAC_INTB_IRQ10 6
135#define JMR3927_ISAC_INTB_ISAER 7
136#define JMR3927_ISAC_INTF_IRQ5 (1 << JMR3927_ISAC_INTB_IRQ5)
137#define JMR3927_ISAC_INTF_IRQKB (1 << JMR3927_ISAC_INTB_IRQKB)
138#define JMR3927_ISAC_INTF_IRQMOUSE (1 << JMR3927_ISAC_INTB_IRQMOUSE)
139#define JMR3927_ISAC_INTF_IRQ4 (1 << JMR3927_ISAC_INTB_IRQ4)
140#define JMR3927_ISAC_INTF_IRQ12 (1 << JMR3927_ISAC_INTB_IRQ12)
141#define JMR3927_ISAC_INTF_IRQ3 (1 << JMR3927_ISAC_INTB_IRQ3)
142#define JMR3927_ISAC_INTF_IRQ10 (1 << JMR3927_ISAC_INTB_IRQ10)
143#define JMR3927_ISAC_INTF_ISAER (1 << JMR3927_ISAC_INTB_ISAER)
144
145#ifndef __ASSEMBLY__
146
147#if 0
148#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned short *)(a)) = (d) << 8)
149#define jmr3927_ioc_reg_in(a) (((*(volatile unsigned short *)(a)) >> 8) & 0xff)
150#else
151#if defined(__BIG_ENDIAN)
152#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
153#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a))
154#elif defined(__LITTLE_ENDIAN)
155#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)((a)^1)) = (d))
156#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)((a)^1))
157#else
158#error "No Endian"
159#endif
160#endif
161#define jmr3927_isac_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
162#define jmr3927_isac_reg_in(a) (*(volatile unsigned char *)(a))
163
164static inline int jmr3927_have_isac(void)
165{
166 unsigned char idt;
167 unsigned long flags;
168 unsigned long romcr3;
169
170 local_irq_save(flags);
171 romcr3 = tx3927_romcptr->cr[3];
172 tx3927_romcptr->cr[3] &= 0xffffefff; /* do not wait infinitely */
173 idt = jmr3927_isac_reg_in(JMR3927_ISAC_REV_ADDR) & JMR3927_IDT_MASK;
174 tx3927_romcptr->cr[3] = romcr3;
175 local_irq_restore(flags);
176
177 return idt == JMR3927_ISAC_IDT;
178}
179#define jmr3927_have_nvram() \
180 ((jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_IDT_MASK) == JMR3927_IOC_IDT)
181
182/* NVRAM macro */
183#define jmr3927_nvram_in(ofs) \
184 jmr3927_ioc_reg_in(JMR3927_IOC_NVRAMB_ADDR + ((ofs) << 1))
185#define jmr3927_nvram_out(d, ofs) \
186 jmr3927_ioc_reg_out(d, JMR3927_IOC_NVRAMB_ADDR + ((ofs) << 1))
187
188/* LED macro */
189#define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR)
190#define jmr3927_io_led_set(n/*0-3*/) jmr3927_isac_reg_out((n), JMR3927_ISAC_LED_ADDR)
191
192#define jmr3927_led_and_set(n/*0-16*/) jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR)
193
194/* DIPSW4 macro */
195#define jmr3927_dipsw1() ((tx3927_pioptr->din & (1 << 11)) == 0)
196#define jmr3927_dipsw2() ((tx3927_pioptr->din & (1 << 10)) == 0)
197#define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0)
198#define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0)
199#define jmr3927_io_dipsw() (jmr3927_isac_reg_in(JMR3927_ISAC_LED_ADDR) >> 4)
200
201
202#endif /* !__ASSEMBLY__ */
203
204/*
205 * UART defines for serial.h
206 */
207
208/* use Pre-scaler T0 (1/2) */
209#define JMR3927_BASE_BAUD (JMR3927_IMCLK / 2 / 16)
210
211#define UART0_ADDR 0xfffef300
212#define UART1_ADDR 0xfffef400
213#define UART0_INT JMR3927_IRQ_IRC_SIO0
214#define UART1_INT JMR3927_IRQ_IRC_SIO1
215#define UART0_FLAGS ASYNC_BOOT_AUTOCONF
216#define UART1_FLAGS 0
217
218/*
219 * IRQ mappings
220 */
221
222/* These are the virtual IRQ numbers, we divide all IRQ's into
223 * 'spaces', the 'space' determines where and how to enable/disable
224 * that particular IRQ on an JMR machine. Add new 'spaces' as new
225 * IRQ hardware is supported.
226 */
227#define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */
228#define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */
229#define JMR3927_NR_IRQ_ISAC 8 /* ISA */
230
231
232#define JMR3927_IRQ_IRC NR_ISA_IRQS
233#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC)
234#define JMR3927_IRQ_ISAC (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC)
235#define JMR3927_IRQ_END (JMR3927_IRQ_ISAC + JMR3927_NR_IRQ_ISAC)
236#define JMR3927_IRQ_IS_IRC(irq) (JMR3927_IRQ_IRC <= (irq) && (irq) < JMR3927_IRQ_IOC)
237#define JMR3927_IRQ_IS_IOC(irq) (JMR3927_IRQ_IOC <= (irq) && (irq) < JMR3927_IRQ_ISAC)
238#define JMR3927_IRQ_IS_ISAC(irq) (JMR3927_IRQ_ISAC <= (irq) && (irq) < JMR3927_IRQ_END)
239
240#define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0)
241#define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1)
242#define JMR3927_IRQ_IRC_INT2 (JMR3927_IRQ_IRC + TX3927_IR_INT2)
243#define JMR3927_IRQ_IRC_INT3 (JMR3927_IRQ_IRC + TX3927_IR_INT3)
244#define JMR3927_IRQ_IRC_INT4 (JMR3927_IRQ_IRC + TX3927_IR_INT4)
245#define JMR3927_IRQ_IRC_INT5 (JMR3927_IRQ_IRC + TX3927_IR_INT5)
246#define JMR3927_IRQ_IRC_SIO0 (JMR3927_IRQ_IRC + TX3927_IR_SIO0)
247#define JMR3927_IRQ_IRC_SIO1 (JMR3927_IRQ_IRC + TX3927_IR_SIO1)
248#define JMR3927_IRQ_IRC_SIO(ch) (JMR3927_IRQ_IRC + TX3927_IR_SIO(ch))
249#define JMR3927_IRQ_IRC_DMA (JMR3927_IRQ_IRC + TX3927_IR_DMA)
250#define JMR3927_IRQ_IRC_PIO (JMR3927_IRQ_IRC + TX3927_IR_PIO)
251#define JMR3927_IRQ_IRC_PCI (JMR3927_IRQ_IRC + TX3927_IR_PCI)
252#define JMR3927_IRQ_IRC_TMR0 (JMR3927_IRQ_IRC + TX3927_IR_TMR0)
253#define JMR3927_IRQ_IRC_TMR1 (JMR3927_IRQ_IRC + TX3927_IR_TMR1)
254#define JMR3927_IRQ_IRC_TMR2 (JMR3927_IRQ_IRC + TX3927_IR_TMR2)
255#define JMR3927_IRQ_IOC_PCIA (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIA)
256#define JMR3927_IRQ_IOC_PCIB (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIB)
257#define JMR3927_IRQ_IOC_PCIC (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIC)
258#define JMR3927_IRQ_IOC_PCID (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCID)
259#define JMR3927_IRQ_IOC_MODEM (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_MODEM)
260#define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6)
261#define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7)
262#define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT)
263#define JMR3927_IRQ_ISAC_IRQ5 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ5)
264#define JMR3927_IRQ_ISAC_IRQKB (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQKB)
265#define JMR3927_IRQ_ISAC_IRQMOUSE (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQMOUSE)
266#define JMR3927_IRQ_ISAC_IRQ4 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ4)
267#define JMR3927_IRQ_ISAC_IRQ12 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ12)
268#define JMR3927_IRQ_ISAC_IRQ3 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ3)
269#define JMR3927_IRQ_ISAC_IRQ10 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ10)
270#define JMR3927_IRQ_ISAC_ISAER (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_ISAER)
271
272#if 0 /* auto detect */
273/* RTL8019AS 10M Ether (JMI-3927IO2:JPW2:1-2 Short) */
274#define JMR3927_IRQ_ETHER1 JMR3927_IRQ_IRC_INT0
275#endif
276/* IOC (PCI, MODEM) */
277#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1
278/* ISAC (ISA, PCMCIA, KEYBOARD, MOUSE) */
279#define JMR3927_IRQ_ISACINT JMR3927_IRQ_IRC_INT2
280/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */
281#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3
282/* Clock Tick (10ms) */
283#define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0
284#define JMR3927_IRQ_IDE JMR3927_IRQ_ISAC_IRQ12
285
286/* IEEE1394 (Note that this may conflicts with RTL8019AS 10M Ether...) */
287#define JMR3927_IRQ_PREMIER3 JMR3927_IRQ_IRC_INT0
288
289/* I/O Ports */
290/* RTL8019AS 10M Ether */
291#define JMR3927_ETHER1_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x280)
292#define JMR3927_KBD_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x00800060)
293#define JMR3927_IDE_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x001001f0)
294
295/* Clocks */
296#define JMR3927_CORECLK 132710400 /* 132.7MHz */
297#define JMR3927_GBUSCLK (JMR3927_CORECLK / 2) /* 66.35MHz */
298#define JMR3927_IMCLK (JMR3927_CORECLK / 4) /* 33.17MHz */
299
300#define jmr3927_tmrptr tx3927_tmrptr(0) /* TMR0 */
301
302
303/*
304 * TX3927 Pin Configuration:
305 *
306 * PCFG bits Avail Dead
307 * SELSIO[1:0]:11 RXD[1:0], TXD[1:0] PIO[6:3]
308 * SELSIOC[0]:1 CTS[0], RTS[0] INT[5:4]
309 * SELSIOC[1]:0,SELDSF:0, GSDAO[0],GPCST[3] CTS[1], RTS[1],DSF,
310 * GDBGE* PIO[2:1]
311 * SELDMA[2]:1 DMAREQ[2],DMAACK[2] PIO[13:12]
312 * SELTMR[2:0]:000 TIMER[1:0]
313 * SELCS:0,SELDMA[1]:0 PIO[11;10] SDCS_CE[7:6],
314 * DMAREQ[1],DMAACK[1]
315 * SELDMA[0]:1 DMAREQ[0],DMAACK[0] PIO[9:8]
316 * SELDMA[3]:1 DMAREQ[3],DMAACK[3] PIO[15:14]
317 * SELDONE:1 DMADONE PIO[7]
318 *
319 * Usable pins are:
320 * RXD[1;0],TXD[1:0],CTS[0],RTS[0],
321 * DMAREQ[0,2,3],DMAACK[0,2,3],DMADONE,PIO[0,10,11]
322 * INT[3:0]
323 */
324
325#endif /* __ASM_TX3927_JMR3927_H */
diff --git a/include/asm-mips/jmr3927/tx3927.h b/include/asm-mips/jmr3927/tx3927.h
new file mode 100644
index 000000000000..b3d67c75d9ac
--- /dev/null
+++ b/include/asm-mips/jmr3927/tx3927.h
@@ -0,0 +1,365 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000 Toshiba Corporation
7 */
8#ifndef __ASM_TX3927_H
9#define __ASM_TX3927_H
10
11#include <asm/jmr3927/txx927.h>
12
13#define TX3927_SDRAMC_REG 0xfffe8000
14#define TX3927_ROMC_REG 0xfffe9000
15#define TX3927_DMA_REG 0xfffeb000
16#define TX3927_IRC_REG 0xfffec000
17#define TX3927_PCIC_REG 0xfffed000
18#define TX3927_CCFG_REG 0xfffee000
19#define TX3927_NR_TMR 3
20#define TX3927_TMR_REG(ch) (0xfffef000 + (ch) * 0x100)
21#define TX3927_NR_SIO 2
22#define TX3927_SIO_REG(ch) (0xfffef300 + (ch) * 0x100)
23#define TX3927_PIO_REG 0xfffef500
24
25#ifndef __ASSEMBLY__
26
27struct tx3927_sdramc_reg {
28 volatile unsigned long cr[8];
29 volatile unsigned long tr[3];
30 volatile unsigned long cmd;
31 volatile unsigned long smrs[2];
32};
33
34struct tx3927_romc_reg {
35 volatile unsigned long cr[8];
36};
37
38struct tx3927_dma_reg {
39 struct tx3927_dma_ch_reg {
40 volatile unsigned long cha;
41 volatile unsigned long sar;
42 volatile unsigned long dar;
43 volatile unsigned long cntr;
44 volatile unsigned long sair;
45 volatile unsigned long dair;
46 volatile unsigned long ccr;
47 volatile unsigned long csr;
48 } ch[4];
49 volatile unsigned long dbr[8];
50 volatile unsigned long tdhr;
51 volatile unsigned long mcr;
52 volatile unsigned long unused0;
53};
54
55struct tx3927_irc_reg {
56 volatile unsigned long cer;
57 volatile unsigned long cr[2];
58 volatile unsigned long unused0;
59 volatile unsigned long ilr[8];
60 volatile unsigned long unused1[4];
61 volatile unsigned long imr;
62 volatile unsigned long unused2[7];
63 volatile unsigned long scr;
64 volatile unsigned long unused3[7];
65 volatile unsigned long ssr;
66 volatile unsigned long unused4[7];
67 volatile unsigned long csr;
68};
69
70#include <asm/byteorder.h>
71
72#ifdef __BIG_ENDIAN
73#define endian_def_s2(e1,e2) \
74 volatile unsigned short e1,e2
75#define endian_def_sb2(e1,e2,e3) \
76 volatile unsigned short e1;volatile unsigned char e2,e3
77#define endian_def_b2s(e1,e2,e3) \
78 volatile unsigned char e1,e2;volatile unsigned short e3
79#define endian_def_b4(e1,e2,e3,e4) \
80 volatile unsigned char e1,e2,e3,e4
81#else
82#define endian_def_s2(e1,e2) \
83 volatile unsigned short e2,e1
84#define endian_def_sb2(e1,e2,e3) \
85 volatile unsigned char e3,e2;volatile unsigned short e1
86#define endian_def_b2s(e1,e2,e3) \
87 volatile unsigned short e3;volatile unsigned char e2,e1
88#define endian_def_b4(e1,e2,e3,e4) \
89 volatile unsigned char e4,e3,e2,e1
90#endif
91
92struct tx3927_pcic_reg {
93 endian_def_s2(did, vid);
94 endian_def_s2(pcistat, pcicmd);
95 endian_def_b4(cc, scc, rpli, rid);
96 endian_def_b4(unused0, ht, mlt, cls);
97 volatile unsigned long ioba; /* +10 */
98 volatile unsigned long mba;
99 volatile unsigned long unused1[5];
100 endian_def_s2(svid, ssvid);
101 volatile unsigned long unused2; /* +30 */
102 endian_def_sb2(unused3, unused4, capptr);
103 volatile unsigned long unused5;
104 endian_def_b4(ml, mg, ip, il);
105 volatile unsigned long unused6; /* +40 */
106 volatile unsigned long istat;
107 volatile unsigned long iim;
108 volatile unsigned long rrt;
109 volatile unsigned long unused7[3]; /* +50 */
110 volatile unsigned long ipbmma;
111 volatile unsigned long ipbioma; /* +60 */
112 volatile unsigned long ilbmma;
113 volatile unsigned long ilbioma;
114 volatile unsigned long unused8[9];
115 volatile unsigned long tc; /* +90 */
116 volatile unsigned long tstat;
117 volatile unsigned long tim;
118 volatile unsigned long tccmd;
119 volatile unsigned long pcirrt; /* +a0 */
120 volatile unsigned long pcirrt_cmd;
121 volatile unsigned long pcirrdt;
122 volatile unsigned long unused9[3];
123 volatile unsigned long tlboap;
124 volatile unsigned long tlbiap;
125 volatile unsigned long tlbmma; /* +c0 */
126 volatile unsigned long tlbioma;
127 volatile unsigned long sc_msg;
128 volatile unsigned long sc_be;
129 volatile unsigned long tbl; /* +d0 */
130 volatile unsigned long unused10[3];
131 volatile unsigned long pwmng; /* +e0 */
132 volatile unsigned long pwmngs;
133 volatile unsigned long unused11[6];
134 volatile unsigned long req_trace; /* +100 */
135 volatile unsigned long pbapmc;
136 volatile unsigned long pbapms;
137 volatile unsigned long pbapmim;
138 volatile unsigned long bm; /* +110 */
139 volatile unsigned long cpcibrs;
140 volatile unsigned long cpcibgs;
141 volatile unsigned long pbacs;
142 volatile unsigned long iobas; /* +120 */
143 volatile unsigned long mbas;
144 volatile unsigned long lbc;
145 volatile unsigned long lbstat;
146 volatile unsigned long lbim; /* +130 */
147 volatile unsigned long pcistatim;
148 volatile unsigned long ica;
149 volatile unsigned long icd;
150 volatile unsigned long iiadp; /* +140 */
151 volatile unsigned long iscdp;
152 volatile unsigned long mmas;
153 volatile unsigned long iomas;
154 volatile unsigned long ipciaddr; /* +150 */
155 volatile unsigned long ipcidata;
156 volatile unsigned long ipcibe;
157};
158
159struct tx3927_ccfg_reg {
160 volatile unsigned long ccfg;
161 volatile unsigned long crir;
162 volatile unsigned long pcfg;
163 volatile unsigned long tear;
164 volatile unsigned long pdcr;
165};
166
167#endif /* !__ASSEMBLY__ */
168
169/*
170 * SDRAMC
171 */
172
173/*
174 * ROMC
175 */
176
177/*
178 * DMA
179 */
180/* bits for MCR */
181#define TX3927_DMA_MCR_EIS(ch) (0x10000000<<(ch))
182#define TX3927_DMA_MCR_DIS(ch) (0x01000000<<(ch))
183#define TX3927_DMA_MCR_RSFIF 0x00000080
184#define TX3927_DMA_MCR_FIFUM(ch) (0x00000008<<(ch))
185#define TX3927_DMA_MCR_LE 0x00000004
186#define TX3927_DMA_MCR_RPRT 0x00000002
187#define TX3927_DMA_MCR_MSTEN 0x00000001
188
189/* bits for CCRn */
190#define TX3927_DMA_CCR_DBINH 0x04000000
191#define TX3927_DMA_CCR_SBINH 0x02000000
192#define TX3927_DMA_CCR_CHRST 0x01000000
193#define TX3927_DMA_CCR_RVBYTE 0x00800000
194#define TX3927_DMA_CCR_ACKPOL 0x00400000
195#define TX3927_DMA_CCR_REQPL 0x00200000
196#define TX3927_DMA_CCR_EGREQ 0x00100000
197#define TX3927_DMA_CCR_CHDN 0x00080000
198#define TX3927_DMA_CCR_DNCTL 0x00060000
199#define TX3927_DMA_CCR_EXTRQ 0x00010000
200#define TX3927_DMA_CCR_INTRQD 0x0000e000
201#define TX3927_DMA_CCR_INTENE 0x00001000
202#define TX3927_DMA_CCR_INTENC 0x00000800
203#define TX3927_DMA_CCR_INTENT 0x00000400
204#define TX3927_DMA_CCR_CHNEN 0x00000200
205#define TX3927_DMA_CCR_XFACT 0x00000100
206#define TX3927_DMA_CCR_SNOP 0x00000080
207#define TX3927_DMA_CCR_DSTINC 0x00000040
208#define TX3927_DMA_CCR_SRCINC 0x00000020
209#define TX3927_DMA_CCR_XFSZ(order) (((order) << 2) & 0x0000001c)
210#define TX3927_DMA_CCR_XFSZ_1W TX3927_DMA_CCR_XFSZ(2)
211#define TX3927_DMA_CCR_XFSZ_4W TX3927_DMA_CCR_XFSZ(4)
212#define TX3927_DMA_CCR_XFSZ_8W TX3927_DMA_CCR_XFSZ(5)
213#define TX3927_DMA_CCR_XFSZ_16W TX3927_DMA_CCR_XFSZ(6)
214#define TX3927_DMA_CCR_XFSZ_32W TX3927_DMA_CCR_XFSZ(7)
215#define TX3927_DMA_CCR_MEMIO 0x00000002
216#define TX3927_DMA_CCR_ONEAD 0x00000001
217
218/* bits for CSRn */
219#define TX3927_DMA_CSR_CHNACT 0x00000100
220#define TX3927_DMA_CSR_ABCHC 0x00000080
221#define TX3927_DMA_CSR_NCHNC 0x00000040
222#define TX3927_DMA_CSR_NTRNFC 0x00000020
223#define TX3927_DMA_CSR_EXTDN 0x00000010
224#define TX3927_DMA_CSR_CFERR 0x00000008
225#define TX3927_DMA_CSR_CHERR 0x00000004
226#define TX3927_DMA_CSR_DESERR 0x00000002
227#define TX3927_DMA_CSR_SORERR 0x00000001
228
229/*
230 * IRC
231 */
232#define TX3927_IR_MAX_LEVEL 7
233
234/* IRCER : Int. Control Enable */
235#define TX3927_IRCER_ICE 0x00000001
236
237/* IRCR : Int. Control */
238#define TX3927_IRCR_LOW 0x00000000
239#define TX3927_IRCR_HIGH 0x00000001
240#define TX3927_IRCR_DOWN 0x00000002
241#define TX3927_IRCR_UP 0x00000003
242
243/* IRSCR : Int. Status Control */
244#define TX3927_IRSCR_EIClrE 0x00000100
245#define TX3927_IRSCR_EIClr_MASK 0x0000000f
246
247/* IRCSR : Int. Current Status */
248#define TX3927_IRCSR_IF 0x00010000
249#define TX3927_IRCSR_ILV_MASK 0x00000700
250#define TX3927_IRCSR_IVL_MASK 0x0000001f
251
252#define TX3927_IR_INT0 0
253#define TX3927_IR_INT1 1
254#define TX3927_IR_INT2 2
255#define TX3927_IR_INT3 3
256#define TX3927_IR_INT4 4
257#define TX3927_IR_INT5 5
258#define TX3927_IR_SIO0 6
259#define TX3927_IR_SIO1 7
260#define TX3927_IR_SIO(ch) (6 + (ch))
261#define TX3927_IR_DMA 8
262#define TX3927_IR_PIO 9
263#define TX3927_IR_PCI 10
264#define TX3927_IR_TMR0 13
265#define TX3927_IR_TMR1 14
266#define TX3927_IR_TMR2 15
267#define TX3927_NUM_IR 16
268
269/*
270 * PCIC
271 */
272/* bits for PCICMD */
273/* see PCI_COMMAND_XXX in linux/pci.h */
274
275/* bits for PCISTAT */
276/* see PCI_STATUS_XXX in linux/pci.h */
277#define PCI_STATUS_NEW_CAP 0x0010
278
279/* bits for TC */
280#define TX3927_PCIC_TC_OF16E 0x00000020
281#define TX3927_PCIC_TC_IF8E 0x00000010
282#define TX3927_PCIC_TC_OF8E 0x00000008
283
284/* bits for IOBA/MBA */
285/* see PCI_BASE_ADDRESS_XXX in linux/pci.h */
286
287/* bits for PBAPMC */
288#define TX3927_PCIC_PBAPMC_RPBA 0x00000004
289#define TX3927_PCIC_PBAPMC_PBAEN 0x00000002
290#define TX3927_PCIC_PBAPMC_BMCEN 0x00000001
291
292/* bits for LBSTAT/LBIM */
293#define TX3927_PCIC_LBIM_ALL 0x0000003e
294
295/* bits for PCISTATIM (see also PCI_STATUS_XXX in linux/pci.h */
296#define TX3927_PCIC_PCISTATIM_ALL 0x0000f900
297
298/* bits for LBC */
299#define TX3927_PCIC_LBC_IBSE 0x00004000
300#define TX3927_PCIC_LBC_TIBSE 0x00002000
301#define TX3927_PCIC_LBC_TMFBSE 0x00001000
302#define TX3927_PCIC_LBC_HRST 0x00000800
303#define TX3927_PCIC_LBC_SRST 0x00000400
304#define TX3927_PCIC_LBC_EPCAD 0x00000200
305#define TX3927_PCIC_LBC_MSDSE 0x00000100
306#define TX3927_PCIC_LBC_CRR 0x00000080
307#define TX3927_PCIC_LBC_ILMDE 0x00000040
308#define TX3927_PCIC_LBC_ILIDE 0x00000020
309
310#define TX3927_PCIC_IDSEL_AD_TO_SLOT(ad) ((ad) - 11)
311#define TX3927_PCIC_MAX_DEVNU TX3927_PCIC_IDSEL_AD_TO_SLOT(32)
312
313/*
314 * CCFG
315 */
316/* CCFG : Chip Configuration */
317#define TX3927_CCFG_TLBOFF 0x00020000
318#define TX3927_CCFG_BEOW 0x00010000
319#define TX3927_CCFG_WR 0x00008000
320#define TX3927_CCFG_TOE 0x00004000
321#define TX3927_CCFG_PCIXARB 0x00002000
322#define TX3927_CCFG_PCI3 0x00001000
323#define TX3927_CCFG_PSNP 0x00000800
324#define TX3927_CCFG_PPRI 0x00000400
325#define TX3927_CCFG_PLLM 0x00000030
326#define TX3927_CCFG_ENDIAN 0x00000004
327#define TX3927_CCFG_HALT 0x00000002
328#define TX3927_CCFG_ACEHOLD 0x00000001
329
330/* PCFG : Pin Configuration */
331#define TX3927_PCFG_SYSCLKEN 0x08000000
332#define TX3927_PCFG_SDRCLKEN_ALL 0x07c00000
333#define TX3927_PCFG_SDRCLKEN(ch) (0x00400000<<(ch))
334#define TX3927_PCFG_PCICLKEN_ALL 0x003c0000
335#define TX3927_PCFG_PCICLKEN(ch) (0x00040000<<(ch))
336#define TX3927_PCFG_SELALL 0x0003ffff
337#define TX3927_PCFG_SELCS 0x00020000
338#define TX3927_PCFG_SELDSF 0x00010000
339#define TX3927_PCFG_SELSIOC_ALL 0x0000c000
340#define TX3927_PCFG_SELSIOC(ch) (0x00004000<<(ch))
341#define TX3927_PCFG_SELSIO_ALL 0x00003000
342#define TX3927_PCFG_SELSIO(ch) (0x00001000<<(ch))
343#define TX3927_PCFG_SELTMR_ALL 0x00000e00
344#define TX3927_PCFG_SELTMR(ch) (0x00000200<<(ch))
345#define TX3927_PCFG_SELDONE 0x00000100
346#define TX3927_PCFG_INTDMA_ALL 0x000000f0
347#define TX3927_PCFG_INTDMA(ch) (0x00000010<<(ch))
348#define TX3927_PCFG_SELDMA_ALL 0x0000000f
349#define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch))
350
351#ifndef __ASSEMBLY__
352
353#define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG)
354#define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG)
355#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG)
356#define tx3927_ircptr ((struct tx3927_irc_reg *)TX3927_IRC_REG)
357#define tx3927_pcicptr ((struct tx3927_pcic_reg *)TX3927_PCIC_REG)
358#define tx3927_ccfgptr ((struct tx3927_ccfg_reg *)TX3927_CCFG_REG)
359#define tx3927_tmrptr(ch) ((struct txx927_tmr_reg *)TX3927_TMR_REG(ch))
360#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch))
361#define tx3927_pioptr ((struct txx927_pio_reg *)TX3927_PIO_REG)
362
363#endif /* !__ASSEMBLY__ */
364
365#endif /* __ASM_TX3927_H */
diff --git a/include/asm-mips/jmr3927/txx927.h b/include/asm-mips/jmr3927/txx927.h
new file mode 100644
index 000000000000..9d5792eab452
--- /dev/null
+++ b/include/asm-mips/jmr3927/txx927.h
@@ -0,0 +1,175 @@
1/*
2 * Common definitions for TX3927/TX4927
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2000 Toshiba Corporation
9 */
10#ifndef __ASM_TXX927_H
11#define __ASM_TXX927_H
12
13#ifndef __ASSEMBLY__
14
15struct txx927_tmr_reg {
16 volatile unsigned long tcr;
17 volatile unsigned long tisr;
18 volatile unsigned long cpra;
19 volatile unsigned long cprb;
20 volatile unsigned long itmr;
21 volatile unsigned long unused0[3];
22 volatile unsigned long ccdr;
23 volatile unsigned long unused1[3];
24 volatile unsigned long pgmr;
25 volatile unsigned long unused2[3];
26 volatile unsigned long wtmr;
27 volatile unsigned long unused3[43];
28 volatile unsigned long trr;
29};
30
31struct txx927_sio_reg {
32 volatile unsigned long lcr;
33 volatile unsigned long dicr;
34 volatile unsigned long disr;
35 volatile unsigned long cisr;
36 volatile unsigned long fcr;
37 volatile unsigned long flcr;
38 volatile unsigned long bgr;
39 volatile unsigned long tfifo;
40 volatile unsigned long rfifo;
41};
42
43struct txx927_pio_reg {
44 volatile unsigned long dout;
45 volatile unsigned long din;
46 volatile unsigned long dir;
47 volatile unsigned long od;
48 volatile unsigned long flag[2];
49 volatile unsigned long pol;
50 volatile unsigned long intc;
51 volatile unsigned long maskcpu;
52 volatile unsigned long maskext;
53};
54
55#endif /* !__ASSEMBLY__ */
56
57
58/*
59 * TMR
60 */
61/* TMTCR : Timer Control */
62#define TXx927_TMTCR_TCE 0x00000080
63#define TXx927_TMTCR_CCDE 0x00000040
64#define TXx927_TMTCR_CRE 0x00000020
65#define TXx927_TMTCR_ECES 0x00000008
66#define TXx927_TMTCR_CCS 0x00000004
67#define TXx927_TMTCR_TMODE_MASK 0x00000003
68#define TXx927_TMTCR_TMODE_ITVL 0x00000000
69
70/* TMTISR : Timer Int. Status */
71#define TXx927_TMTISR_TPIBS 0x00000004
72#define TXx927_TMTISR_TPIAS 0x00000002
73#define TXx927_TMTISR_TIIS 0x00000001
74
75/* TMTITMR : Interval Timer Mode */
76#define TXx927_TMTITMR_TIIE 0x00008000
77#define TXx927_TMTITMR_TZCE 0x00000001
78
79/*
80 * SIO
81 */
82/* SILCR : Line Control */
83#define TXx927_SILCR_SCS_MASK 0x00000060
84#define TXx927_SILCR_SCS_IMCLK 0x00000000
85#define TXx927_SILCR_SCS_IMCLK_BG 0x00000020
86#define TXx927_SILCR_SCS_SCLK 0x00000040
87#define TXx927_SILCR_SCS_SCLK_BG 0x00000060
88#define TXx927_SILCR_UEPS 0x00000010
89#define TXx927_SILCR_UPEN 0x00000008
90#define TXx927_SILCR_USBL_MASK 0x00000004
91#define TXx927_SILCR_USBL_1BIT 0x00000004
92#define TXx927_SILCR_USBL_2BIT 0x00000000
93#define TXx927_SILCR_UMODE_MASK 0x00000003
94#define TXx927_SILCR_UMODE_8BIT 0x00000000
95#define TXx927_SILCR_UMODE_7BIT 0x00000001
96
97/* SIDICR : DMA/Int. Control */
98#define TXx927_SIDICR_TDE 0x00008000
99#define TXx927_SIDICR_RDE 0x00004000
100#define TXx927_SIDICR_TIE 0x00002000
101#define TXx927_SIDICR_RIE 0x00001000
102#define TXx927_SIDICR_SPIE 0x00000800
103#define TXx927_SIDICR_CTSAC 0x00000600
104#define TXx927_SIDICR_STIE_MASK 0x0000003f
105#define TXx927_SIDICR_STIE_OERS 0x00000020
106#define TXx927_SIDICR_STIE_CTSS 0x00000010
107#define TXx927_SIDICR_STIE_RBRKD 0x00000008
108#define TXx927_SIDICR_STIE_TRDY 0x00000004
109#define TXx927_SIDICR_STIE_TXALS 0x00000002
110#define TXx927_SIDICR_STIE_UBRKD 0x00000001
111
112/* SIDISR : DMA/Int. Status */
113#define TXx927_SIDISR_UBRK 0x00008000
114#define TXx927_SIDISR_UVALID 0x00004000
115#define TXx927_SIDISR_UFER 0x00002000
116#define TXx927_SIDISR_UPER 0x00001000
117#define TXx927_SIDISR_UOER 0x00000800
118#define TXx927_SIDISR_ERI 0x00000400
119#define TXx927_SIDISR_TOUT 0x00000200
120#define TXx927_SIDISR_TDIS 0x00000100
121#define TXx927_SIDISR_RDIS 0x00000080
122#define TXx927_SIDISR_STIS 0x00000040
123#define TXx927_SIDISR_RFDN_MASK 0x0000001f
124
125/* SICISR : Change Int. Status */
126#define TXx927_SICISR_OERS 0x00000020
127#define TXx927_SICISR_CTSS 0x00000010
128#define TXx927_SICISR_RBRKD 0x00000008
129#define TXx927_SICISR_TRDY 0x00000004
130#define TXx927_SICISR_TXALS 0x00000002
131#define TXx927_SICISR_UBRKD 0x00000001
132
133/* SIFCR : FIFO Control */
134#define TXx927_SIFCR_SWRST 0x00008000
135#define TXx927_SIFCR_RDIL_MASK 0x00000180
136#define TXx927_SIFCR_RDIL_1 0x00000000
137#define TXx927_SIFCR_RDIL_4 0x00000080
138#define TXx927_SIFCR_RDIL_8 0x00000100
139#define TXx927_SIFCR_RDIL_12 0x00000180
140#define TXx927_SIFCR_RDIL_MAX 0x00000180
141#define TXx927_SIFCR_TDIL_MASK 0x00000018
142#define TXx927_SIFCR_TDIL_MASK 0x00000018
143#define TXx927_SIFCR_TDIL_1 0x00000000
144#define TXx927_SIFCR_TDIL_4 0x00000001
145#define TXx927_SIFCR_TDIL_8 0x00000010
146#define TXx927_SIFCR_TDIL_MAX 0x00000010
147#define TXx927_SIFCR_TFRST 0x00000004
148#define TXx927_SIFCR_RFRST 0x00000002
149#define TXx927_SIFCR_FRSTE 0x00000001
150#define TXx927_SIO_TX_FIFO 8
151#define TXx927_SIO_RX_FIFO 16
152
153/* SIFLCR : Flow Control */
154#define TXx927_SIFLCR_RCS 0x00001000
155#define TXx927_SIFLCR_TES 0x00000800
156#define TXx927_SIFLCR_RTSSC 0x00000200
157#define TXx927_SIFLCR_RSDE 0x00000100
158#define TXx927_SIFLCR_TSDE 0x00000080
159#define TXx927_SIFLCR_RTSTL_MASK 0x0000001e
160#define TXx927_SIFLCR_RTSTL_MAX 0x0000001e
161#define TXx927_SIFLCR_TBRK 0x00000001
162
163/* SIBGR : Baudrate Control */
164#define TXx927_SIBGR_BCLK_MASK 0x00000300
165#define TXx927_SIBGR_BCLK_T0 0x00000000
166#define TXx927_SIBGR_BCLK_T2 0x00000100
167#define TXx927_SIBGR_BCLK_T4 0x00000200
168#define TXx927_SIBGR_BCLK_T6 0x00000300
169#define TXx927_SIBGR_BRD_MASK 0x000000ff
170
171/*
172 * PIO
173 */
174
175#endif /* __ASM_TXX927_H */
diff --git a/include/asm-mips/kmap_types.h b/include/asm-mips/kmap_types.h
new file mode 100644
index 000000000000..6886a0c3fedf
--- /dev/null
+++ b/include/asm-mips/kmap_types.h
@@ -0,0 +1,31 @@
1#ifndef _ASM_KMAP_TYPES_H
2#define _ASM_KMAP_TYPES_H
3
4#include <linux/config.h>
5
6#ifdef CONFIG_DEBUG_HIGHMEM
7# define D(n) __KM_FENCE_##n ,
8#else
9# define D(n)
10#endif
11
12enum km_type {
13D(0) KM_BOUNCE_READ,
14D(1) KM_SKB_SUNRPC_DATA,
15D(2) KM_SKB_DATA_SOFTIRQ,
16D(3) KM_USER0,
17D(4) KM_USER1,
18D(5) KM_BIO_SRC_IRQ,
19D(6) KM_BIO_DST_IRQ,
20D(7) KM_PTE0,
21D(8) KM_PTE1,
22D(9) KM_IRQ0,
23D(10) KM_IRQ1,
24D(11) KM_SOFTIRQ0,
25D(12) KM_SOFTIRQ1,
26D(13) KM_TYPE_NR
27};
28
29#undef D
30
31#endif
diff --git a/include/asm-mips/lasat/ds1603.h b/include/asm-mips/lasat/ds1603.h
new file mode 100644
index 000000000000..edcd7544b358
--- /dev/null
+++ b/include/asm-mips/lasat/ds1603.h
@@ -0,0 +1,18 @@
1#include <asm/addrspace.h>
2
3/* Lasat 100 */
4#define DS1603_REG_100 (KSEG1ADDR(0x1c810000))
5#define DS1603_RST_100 (1 << 2)
6#define DS1603_CLK_100 (1 << 0)
7#define DS1603_DATA_SHIFT_100 1
8#define DS1603_DATA_100 (1 << DS1603_DATA_SHIFT_100)
9
10/* Lasat 200 */
11#define DS1603_REG_200 (KSEG1ADDR(0x11000000))
12#define DS1603_RST_200 (1 << 3)
13#define DS1603_CLK_200 (1 << 4)
14#define DS1603_DATA_200 (1 << 5)
15
16#define DS1603_DATA_REG_200 (DS1603_REG_200 + 0x10000)
17#define DS1603_DATA_READ_SHIFT_200 9
18#define DS1603_DATA_READ_200 (1 << DS1603_DATA_READ_SHIFT_200)
diff --git a/include/asm-mips/lasat/eeprom.h b/include/asm-mips/lasat/eeprom.h
new file mode 100644
index 000000000000..7b53edd5cd5f
--- /dev/null
+++ b/include/asm-mips/lasat/eeprom.h
@@ -0,0 +1,17 @@
1#include <asm/addrspace.h>
2
3/* lasat 100 */
4#define AT93C_REG_100 KSEG1ADDR(0x1c810000)
5#define AT93C_RDATA_REG_100 AT93C_REG_100
6#define AT93C_RDATA_SHIFT_100 4
7#define AT93C_WDATA_SHIFT_100 4
8#define AT93C_CS_M_100 ( 1 << 5 )
9#define AT93C_CLK_M_100 ( 1 << 3 )
10
11/* lasat 200 */
12#define AT93C_REG_200 KSEG1ADDR(0x11000000)
13#define AT93C_RDATA_REG_200 (AT93C_REG_200+0x10000)
14#define AT93C_RDATA_SHIFT_200 8
15#define AT93C_WDATA_SHIFT_200 2
16#define AT93C_CS_M_200 ( 1 << 0 )
17#define AT93C_CLK_M_200 ( 1 << 1 )
diff --git a/include/asm-mips/lasat/head.h b/include/asm-mips/lasat/head.h
new file mode 100644
index 000000000000..f5589f31a197
--- /dev/null
+++ b/include/asm-mips/lasat/head.h
@@ -0,0 +1,22 @@
1/*
2 * Image header stuff
3 */
4#ifndef _HEAD_H
5#define _HEAD_H
6
7#define LASAT_K_MAGIC0_VAL 0xfedeabba
8#define LASAT_K_MAGIC1_VAL 0x00bedead
9
10#ifndef _LANGUAGE_ASSEMBLY
11#include <linux/types.h>
12struct bootloader_header {
13 u32 magic[2];
14 u32 version;
15 u32 image_start;
16 u32 image_size;
17 u32 kernel_start;
18 u32 kernel_entry;
19};
20#endif
21
22#endif /* _HEAD_H */
diff --git a/include/asm-mips/lasat/lasat.h b/include/asm-mips/lasat/lasat.h
new file mode 100644
index 000000000000..181afc5c0f1d
--- /dev/null
+++ b/include/asm-mips/lasat/lasat.h
@@ -0,0 +1,255 @@
1/*
2 * lasat.h
3 *
4 * Thomas Horsten <thh@lasat.com>
5 * Copyright (C) 2000 LASAT Networks A/S.
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * Configuration for LASAT boards, loads the appropriate include files.
21 */
22#ifndef _LASAT_H
23#define _LASAT_H
24
25#ifndef _LANGUAGE_ASSEMBLY
26
27extern struct lasat_misc {
28 volatile u32 *reset_reg;
29 volatile u32 *flash_wp_reg;
30 u32 flash_wp_bit;
31} *lasat_misc;
32
33enum lasat_mtdparts {
34 LASAT_MTD_BOOTLOADER,
35 LASAT_MTD_SERVICE,
36 LASAT_MTD_NORMAL,
37 LASAT_MTD_CONFIG,
38 LASAT_MTD_FS,
39 LASAT_MTD_LAST
40};
41
42/*
43 * The format of the data record in the EEPROM.
44 * See Documentation/LASAT/eeprom.txt for a detailed description
45 * of the fields in this struct, and the LASAT Hardware Configuration
46 * field specification for a detailed description of the config
47 * field.
48 */
49#include <linux/types.h>
50
51#define LASAT_EEPROM_VERSION 7
52struct lasat_eeprom_struct {
53 unsigned int version;
54 unsigned int cfg[3];
55 unsigned char hwaddr[6];
56 unsigned char print_partno[12];
57 unsigned char term0;
58 unsigned char print_serial[14];
59 unsigned char term1;
60 unsigned char prod_partno[12];
61 unsigned char term2;
62 unsigned char prod_serial[14];
63 unsigned char term3;
64 unsigned char passwd_hash[16];
65 unsigned char pwdnull;
66 unsigned char vendid;
67 unsigned char ts_ref;
68 unsigned char ts_signoff;
69 unsigned char reserved[11];
70 unsigned char debugaccess;
71 unsigned short prid;
72 unsigned int serviceflag;
73 unsigned int ipaddr;
74 unsigned int netmask;
75 unsigned int crc32;
76};
77
78struct lasat_eeprom_struct_pre7 {
79 unsigned int version;
80 unsigned int flags[3];
81 unsigned char hwaddr0[6];
82 unsigned char hwaddr1[6];
83 unsigned char print_partno[9];
84 unsigned char term0;
85 unsigned char print_serial[14];
86 unsigned char term1;
87 unsigned char prod_partno[9];
88 unsigned char term2;
89 unsigned char prod_serial[14];
90 unsigned char term3;
91 unsigned char passwd_hash[24];
92 unsigned char pwdnull;
93 unsigned char vendor;
94 unsigned char ts_ref;
95 unsigned char ts_signoff;
96 unsigned char reserved[6];
97 unsigned int writecount;
98 unsigned int ipaddr;
99 unsigned int netmask;
100 unsigned int crc32;
101};
102
103/* Configuration descriptor encoding - see the doc for details */
104
105#define LASAT_W0_DSCTYPE(v) ( ( (v) ) & 0xf )
106#define LASAT_W0_BMID(v) ( ( (v) >> 0x04 ) & 0xf )
107#define LASAT_W0_CPUTYPE(v) ( ( (v) >> 0x08 ) & 0xf )
108#define LASAT_W0_BUSSPEED(v) ( ( (v) >> 0x0c ) & 0xf )
109#define LASAT_W0_CPUCLK(v) ( ( (v) >> 0x10 ) & 0xf )
110#define LASAT_W0_SDRAMBANKSZ(v) ( ( (v) >> 0x14 ) & 0xf )
111#define LASAT_W0_SDRAMBANKS(v) ( ( (v) >> 0x18 ) & 0xf )
112#define LASAT_W0_L2CACHE(v) ( ( (v) >> 0x1c ) & 0xf )
113
114#define LASAT_W1_EDHAC(v) ( ( (v) ) & 0xf )
115#define LASAT_W1_HIFN(v) ( ( (v) >> 0x04 ) & 0x1 )
116#define LASAT_W1_ISDN(v) ( ( (v) >> 0x05 ) & 0x1 )
117#define LASAT_W1_IDE(v) ( ( (v) >> 0x06 ) & 0x1 )
118#define LASAT_W1_HDLC(v) ( ( (v) >> 0x07 ) & 0x1 )
119#define LASAT_W1_USVERSION(v) ( ( (v) >> 0x08 ) & 0x1 )
120#define LASAT_W1_4MACS(v) ( ( (v) >> 0x09 ) & 0x1 )
121#define LASAT_W1_EXTSERIAL(v) ( ( (v) >> 0x0a ) & 0x1 )
122#define LASAT_W1_FLASHSIZE(v) ( ( (v) >> 0x0c ) & 0xf )
123#define LASAT_W1_PCISLOTS(v) ( ( (v) >> 0x10 ) & 0xf )
124#define LASAT_W1_PCI1OPT(v) ( ( (v) >> 0x14 ) & 0xf )
125#define LASAT_W1_PCI2OPT(v) ( ( (v) >> 0x18 ) & 0xf )
126#define LASAT_W1_PCI3OPT(v) ( ( (v) >> 0x1c ) & 0xf )
127
128/* Routines specific to LASAT boards */
129
130#define LASAT_BMID_MASQUERADE2 0
131#define LASAT_BMID_MASQUERADEPRO 1
132#define LASAT_BMID_SAFEPIPE25 2
133#define LASAT_BMID_SAFEPIPE50 3
134#define LASAT_BMID_SAFEPIPE100 4
135#define LASAT_BMID_SAFEPIPE5000 5
136#define LASAT_BMID_SAFEPIPE7000 6
137#define LASAT_BMID_SAFEPIPE1000 7
138//#define LASAT_BMID_SAFEPIPE30 7
139//#define LASAT_BMID_SAFEPIPE5100 8
140//#define LASAT_BMID_SAFEPIPE7100 9
141#define LASAT_BMID_UNKNOWN 0xf
142#define LASAT_MAX_BMID_NAMES 9 // no larger than 15!
143
144#define LASAT_HAS_EDHAC ( 1 << 0 )
145#define LASAT_EDHAC_FAST ( 1 << 1 )
146#define LASAT_HAS_EADI ( 1 << 2 )
147#define LASAT_HAS_HIFN ( 1 << 3 )
148#define LASAT_HAS_ISDN ( 1 << 4 )
149#define LASAT_HAS_LEASEDLINE_IF ( 1 << 5 )
150#define LASAT_HAS_HDC ( 1 << 6 )
151
152#define LASAT_PRID_MASQUERADE2 0
153#define LASAT_PRID_MASQUERADEPRO 1
154#define LASAT_PRID_SAFEPIPE25 2
155#define LASAT_PRID_SAFEPIPE50 3
156#define LASAT_PRID_SAFEPIPE100 4
157#define LASAT_PRID_SAFEPIPE5000 5
158#define LASAT_PRID_SAFEPIPE7000 6
159#define LASAT_PRID_SAFEPIPE30 7
160#define LASAT_PRID_SAFEPIPE5100 8
161#define LASAT_PRID_SAFEPIPE7100 9
162
163#define LASAT_PRID_SAFEPIPE1110 10
164#define LASAT_PRID_SAFEPIPE3020 11
165#define LASAT_PRID_SAFEPIPE3030 12
166#define LASAT_PRID_SAFEPIPE5020 13
167#define LASAT_PRID_SAFEPIPE5030 14
168#define LASAT_PRID_SAFEPIPE1120 15
169#define LASAT_PRID_SAFEPIPE1130 16
170#define LASAT_PRID_SAFEPIPE6010 17
171#define LASAT_PRID_SAFEPIPE6110 18
172#define LASAT_PRID_SAFEPIPE6210 19
173#define LASAT_PRID_SAFEPIPE1020 20
174#define LASAT_PRID_SAFEPIPE1040 21
175#define LASAT_PRID_SAFEPIPE1060 22
176
177struct lasat_info {
178 unsigned int li_cpu_hz;
179 unsigned int li_bus_hz;
180 unsigned int li_bmid;
181 unsigned int li_memsize;
182 unsigned int li_flash_size;
183 unsigned int li_prid;
184 unsigned char li_bmstr[16];
185 unsigned char li_namestr[32];
186 unsigned char li_typestr[16];
187 /* Info on the Flash layout */
188 unsigned int li_flash_base;
189 unsigned long li_flashpart_base[LASAT_MTD_LAST];
190 unsigned long li_flashpart_size[LASAT_MTD_LAST];
191 struct lasat_eeprom_struct li_eeprom_info;
192 unsigned int li_eeprom_upgrade_version;
193 unsigned int li_debugaccess;
194};
195
196extern struct lasat_info lasat_board_info;
197
198static inline unsigned long lasat_flash_partition_start(int partno)
199{
200 if (partno < 0 || partno >= LASAT_MTD_LAST)
201 return 0;
202
203 return lasat_board_info.li_flashpart_base[partno];
204}
205
206static inline unsigned long lasat_flash_partition_size(int partno)
207{
208 if (partno < 0 || partno >= LASAT_MTD_LAST)
209 return 0;
210
211 return lasat_board_info.li_flashpart_size[partno];
212}
213
214/* Called from setup() to initialize the global board_info struct */
215extern int lasat_init_board_info(void);
216
217/* Write the modified EEPROM info struct */
218extern void lasat_write_eeprom_info(void);
219
220#define N_MACHTYPES 2
221/* for calibration of delays */
222
223/* the lasat_ndelay function is necessary because it is used at an
224 * early stage of the boot process where ndelay is not calibrated.
225 * It is used for the bit-banging rtc and eeprom drivers */
226
227#include <asm/delay.h>
228/* calculating with the slowest board with 100 MHz clock */
229#define LASAT_100_DIVIDER 20
230/* All 200's run at 250 MHz clock */
231#define LASAT_200_DIVIDER 8
232
233extern unsigned int lasat_ndelay_divider;
234
235static inline void lasat_ndelay(unsigned int ns)
236{
237 __delay(ns / lasat_ndelay_divider);
238}
239
240extern void (* prom_printf)(const char *fmt, ...);
241
242#endif /* !defined (_LANGUAGE_ASSEMBLY) */
243
244#define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef
245#define LASAT_SERVICEMODE_MAGIC_2 0xfedeabba
246
247/* Lasat 100 boards */
248#define LASAT_GT_BASE (KSEG1ADDR(0x14000000))
249
250/* Lasat 200 boards */
251#define Vrc5074_PHYS_BASE 0x1fa00000
252#define Vrc5074_BASE (KSEG1ADDR(Vrc5074_PHYS_BASE))
253#define PCI_WINDOW1 0x1a000000
254
255#endif /* _LASAT_H */
diff --git a/include/asm-mips/lasat/lasatint.h b/include/asm-mips/lasat/lasatint.h
new file mode 100644
index 000000000000..065474feeccc
--- /dev/null
+++ b/include/asm-mips/lasat/lasatint.h
@@ -0,0 +1,12 @@
1#define LASATINT_END 16
2
3/* lasat 100 */
4#define LASAT_INT_STATUS_REG_100 (KSEG1ADDR(0x1c880000))
5#define LASAT_INT_MASK_REG_100 (KSEG1ADDR(0x1c890000))
6#define LASATINT_MASK_SHIFT_100 0
7
8/* lasat 200 */
9#define LASAT_INT_STATUS_REG_200 (KSEG1ADDR(0x1104003c))
10#define LASAT_INT_MASK_REG_200 (KSEG1ADDR(0x1104003c))
11#define LASATINT_MASK_SHIFT_200 16
12
diff --git a/include/asm-mips/lasat/picvue.h b/include/asm-mips/lasat/picvue.h
new file mode 100644
index 000000000000..42a492edc40e
--- /dev/null
+++ b/include/asm-mips/lasat/picvue.h
@@ -0,0 +1,15 @@
1/* Lasat 100 */
2#define PVC_REG_100 KSEG1ADDR(0x1c820000)
3#define PVC_DATA_SHIFT_100 0
4#define PVC_DATA_M_100 0xFF
5#define PVC_E_100 (1 << 8)
6#define PVC_RW_100 (1 << 9)
7#define PVC_RS_100 (1 << 10)
8
9/* Lasat 200 */
10#define PVC_REG_200 KSEG1ADDR(0x11000000)
11#define PVC_DATA_SHIFT_200 24
12#define PVC_DATA_M_200 (0xFF << PVC_DATA_SHIFT_200)
13#define PVC_E_200 (1 << 16)
14#define PVC_RW_200 (1 << 17)
15#define PVC_RS_200 (1 << 18)
diff --git a/include/asm-mips/lasat/serial.h b/include/asm-mips/lasat/serial.h
new file mode 100644
index 000000000000..21d0fb7cee64
--- /dev/null
+++ b/include/asm-mips/lasat/serial.h
@@ -0,0 +1,13 @@
1#include <asm/lasat/lasat.h>
2
3/* Lasat 100 boards serial configuration */
4#define LASAT_BASE_BAUD_100 ( 7372800 / 16 )
5#define LASAT_UART_REGS_BASE_100 0x1c8b0000
6#define LASAT_UART_REGS_SHIFT_100 2
7#define LASATINT_UART_100 8
8
9/* * LASAT 200 boards serial configuration */
10#define LASAT_BASE_BAUD_200 (100000000 / 16 / 12)
11#define LASAT_UART_REGS_BASE_200 (Vrc5074_PHYS_BASE + 0x0300)
12#define LASAT_UART_REGS_SHIFT_200 3
13#define LASATINT_UART_200 13
diff --git a/include/asm-mips/linkage.h b/include/asm-mips/linkage.h
new file mode 100644
index 000000000000..291c2d01c44f
--- /dev/null
+++ b/include/asm-mips/linkage.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4/* Nothing to see here... */
5
6#endif
diff --git a/include/asm-mips/local.h b/include/asm-mips/local.h
new file mode 100644
index 000000000000..7eb6bf661b80
--- /dev/null
+++ b/include/asm-mips/local.h
@@ -0,0 +1,61 @@
1#ifndef _ASM_LOCAL_H
2#define _ASM_LOCAL_H
3
4#include <linux/config.h>
5#include <linux/percpu.h>
6#include <asm/atomic.h>
7
8#ifdef CONFIG_MIPS32
9
10typedef atomic_t local_t;
11
12#define LOCAL_INIT(i) ATOMIC_INIT(i)
13#define local_read(v) atomic_read(v)
14#define local_set(v,i) atomic_set(v,i)
15
16#define local_inc(v) atomic_inc(v)
17#define local_dec(v) atomic_dec(v)
18#define local_add(i, v) atomic_add(i, v)
19#define local_sub(i, v) atomic_sub(i, v)
20
21#endif
22
23#ifdef CONFIG_MIPS64
24
25typedef atomic64_t local_t;
26
27#define LOCAL_INIT(i) ATOMIC64_INIT(i)
28#define local_read(v) atomic64_read(v)
29#define local_set(v,i) atomic64_set(v,i)
30
31#define local_inc(v) atomic64_inc(v)
32#define local_dec(v) atomic64_dec(v)
33#define local_add(i, v) atomic64_add(i, v)
34#define local_sub(i, v) atomic64_sub(i, v)
35
36#endif
37
38#define __local_inc(v) ((v)->counter++)
39#define __local_dec(v) ((v)->counter--)
40#define __local_add(i,v) ((v)->counter+=(i))
41#define __local_sub(i,v) ((v)->counter-=(i))
42
43/*
44 * Use these for per-cpu local_t variables: on some archs they are
45 * much more efficient than these naive implementations. Note they take
46 * a variable, not an address.
47 */
48#define cpu_local_read(v) local_read(&__get_cpu_var(v))
49#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i))
50
51#define cpu_local_inc(v) local_inc(&__get_cpu_var(v))
52#define cpu_local_dec(v) local_dec(&__get_cpu_var(v))
53#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v))
54#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v))
55
56#define __cpu_local_inc(v) __local_inc(&__get_cpu_var(v))
57#define __cpu_local_dec(v) __local_dec(&__get_cpu_var(v))
58#define __cpu_local_add(i, v) __local_add((i), &__get_cpu_var(v))
59#define __cpu_local_sub(i, v) __local_sub((i), &__get_cpu_var(v))
60
61#endif /* _ASM_LOCAL_H */
diff --git a/include/asm-mips/m48t35.h b/include/asm-mips/m48t35.h
new file mode 100644
index 000000000000..f44852e9a96d
--- /dev/null
+++ b/include/asm-mips/m48t35.h
@@ -0,0 +1,27 @@
1/*
2 * Registers for the SGS-Thomson M48T35 Timekeeper RAM chip
3 */
4#ifndef _ASM_M48T35_H
5#define _ASM_M48T35_H
6
7#include <linux/spinlock.h>
8
9extern spinlock_t rtc_lock;
10
11struct m48t35_rtc {
12 volatile u8 pad[0x7ff8]; /* starts at 0x7ff8 */
13 volatile u8 control;
14 volatile u8 sec;
15 volatile u8 min;
16 volatile u8 hour;
17 volatile u8 day;
18 volatile u8 date;
19 volatile u8 month;
20 volatile u8 year;
21};
22
23#define M48T35_RTC_SET 0x80
24#define M48T35_RTC_STOPPED 0x80
25#define M48T35_RTC_READ 0x40
26
27#endif /* _ASM_M48T35_H */
diff --git a/include/asm-mips/m48t37.h b/include/asm-mips/m48t37.h
new file mode 100644
index 000000000000..cabf86264f36
--- /dev/null
+++ b/include/asm-mips/m48t37.h
@@ -0,0 +1,35 @@
1/*
2 * Registers for the SGS-Thomson M48T37 Timekeeper RAM chip
3 */
4#ifndef _ASM_M48T37_H
5#define _ASM_M48T37_H
6
7#include <linux/spinlock.h>
8
9extern spinlock_t rtc_lock;
10
11struct m48t37_rtc {
12 volatile u8 pad[0x7ff0]; /* NVRAM */
13 volatile u8 flags;
14 volatile u8 century;
15 volatile u8 alarm_sec;
16 volatile u8 alarm_min;
17 volatile u8 alarm_hour;
18 volatile u8 alarm_data;
19 volatile u8 interrupts;
20 volatile u8 watchdog;
21 volatile u8 control;
22 volatile u8 sec;
23 volatile u8 min;
24 volatile u8 hour;
25 volatile u8 day;
26 volatile u8 date;
27 volatile u8 month;
28 volatile u8 year;
29};
30
31#define M48T37_RTC_SET 0x80
32#define M48T37_RTC_STOPPED 0x80
33#define M48T37_RTC_READ 0x40
34
35#endif /* _ASM_M48T37_H */
diff --git a/include/asm-mips/mach-atlas/mc146818rtc.h b/include/asm-mips/mach-atlas/mc146818rtc.h
new file mode 100644
index 000000000000..397522ea5565
--- /dev/null
+++ b/include/asm-mips/mach-atlas/mc146818rtc.h
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 1999, 2000, 2005 MIPS Technologies, Inc.
3 * All rights reserved.
4 * Authors: Carsten Langgaard <carstenl@mips.com>
5 * Maciej W. Rozycki <macro@mips.com>
6 * Copyright (C) 2003, 05 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 */
21#ifndef __ASM_MACH_ATLAS_MC146818RTC_H
22#define __ASM_MACH_ATLAS_MC146818RTC_H
23
24#include <linux/types.h>
25
26#include <asm/addrspace.h>
27
28#include <asm/mips-boards/atlas.h>
29#include <asm/mips-boards/atlasint.h>
30
31#define RTC_PORT(x) (ATLAS_RTC_ADR_REG + (x) * 8)
32#define RTC_IO_EXTENT 0x100
33#define RTC_IOMAPPED 0
34#define RTC_IRQ ATLASINT_RTC
35
36static inline unsigned char CMOS_READ(unsigned long addr)
37{
38 volatile u32 *ireg = (void *)CKSEG1ADDR(RTC_PORT(0));
39 volatile u32 *dreg = (void *)CKSEG1ADDR(RTC_PORT(1));
40
41 *ireg = addr;
42 return *dreg;
43}
44
45static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
46{
47 volatile u32 *ireg = (void *)CKSEG1ADDR(RTC_PORT(0));
48 volatile u32 *dreg = (void *)CKSEG1ADDR(RTC_PORT(1));
49
50 *ireg = addr;
51 *dreg = data;
52}
53
54#define RTC_ALWAYS_BCD 0
55
56#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970)
57
58#endif /* __ASM_MACH_ATLAS_MC146818RTC_H */
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
new file mode 100644
index 000000000000..2b36ea346910
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1000.h
@@ -0,0 +1,1408 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Include file for Alchemy Semiconductor's Au1k CPU.
5 *
6 * Copyright 2000,2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31 /*
32 * some definitions add by takuzo@sm.sony.co.jp and sato@sm.sony.co.jp
33 */
34
35#ifndef _AU1000_H_
36#define _AU1000_H_
37
38#include <linux/config.h>
39
40#ifndef _LANGUAGE_ASSEMBLY
41
42#include <linux/delay.h>
43#include <asm/io.h>
44
45/* cpu pipeline flush */
46void static inline au_sync(void)
47{
48 __asm__ volatile ("sync");
49}
50
51void static inline au_sync_udelay(int us)
52{
53 __asm__ volatile ("sync");
54 udelay(us);
55}
56
57void static inline au_sync_delay(int ms)
58{
59 __asm__ volatile ("sync");
60 mdelay(ms);
61}
62
63void static inline au_writeb(u8 val, int reg)
64{
65 *(volatile u8 *)(reg) = val;
66}
67
68void static inline au_writew(u16 val, int reg)
69{
70 *(volatile u16 *)(reg) = val;
71}
72
73void static inline au_writel(u32 val, int reg)
74{
75 *(volatile u32 *)(reg) = val;
76}
77
78static inline u8 au_readb(unsigned long port)
79{
80 return (*(volatile u8 *)port);
81}
82
83static inline u16 au_readw(unsigned long port)
84{
85 return (*(volatile u16 *)port);
86}
87
88static inline u32 au_readl(unsigned long port)
89{
90 return (*(volatile u32 *)port);
91}
92
93/* These next three functions should be a generic part of the MIPS
94 * kernel (with the 'au_' removed from the name) and selected for
95 * processors that support the instructions.
96 * Taken from PPC tree. -- Dan
97 */
98/* Return the bit position of the most significant 1 bit in a word */
99static __inline__ int __ilog2(unsigned int x)
100{
101 int lz;
102
103 asm volatile (
104 ".set\tnoreorder\n\t"
105 ".set\tnoat\n\t"
106 ".set\tmips32\n\t"
107 "clz\t%0,%1\n\t"
108 ".set\tmips0\n\t"
109 ".set\tat\n\t"
110 ".set\treorder"
111 : "=r" (lz)
112 : "r" (x));
113
114 return 31 - lz;
115}
116
117static __inline__ int au_ffz(unsigned int x)
118{
119 if ((x = ~x) == 0)
120 return 32;
121 return __ilog2(x & -x);
122}
123
124/*
125 * ffs: find first bit set. This is defined the same way as
126 * the libc and compiler builtin ffs routines, therefore
127 * differs in spirit from the above ffz (man ffs).
128 */
129static __inline__ int au_ffs(int x)
130{
131 return __ilog2(x & -x) + 1;
132}
133
134/* arch/mips/au1000/common/clocks.c */
135extern void set_au1x00_speed(unsigned int new_freq);
136extern unsigned int get_au1x00_speed(void);
137extern void set_au1x00_uart_baud_base(unsigned long new_baud_base);
138extern unsigned long get_au1x00_uart_baud_base(void);
139extern void set_au1x00_lcd_clock(void);
140extern unsigned int get_au1x00_lcd_clock(void);
141
142/*
143 * Every board describes its IRQ mapping with this table.
144 */
145typedef struct au1xxx_irqmap {
146 int im_irq;
147 int im_type;
148 int im_request;
149} au1xxx_irq_map_t;
150
151/*
152 * init_IRQ looks for a table with this name.
153 */
154extern au1xxx_irq_map_t au1xxx_irq_map[];
155
156#endif /* !defined (_LANGUAGE_ASSEMBLY) */
157
158#ifdef CONFIG_PM
159/* no CP0 timer irq */
160#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
161#else
162#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
163#endif
164
165/* SDRAM Controller */
166#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100)
167#define MEM_SDMODE0 0xB4000000
168#define MEM_SDMODE1 0xB4000004
169#define MEM_SDMODE2 0xB4000008
170
171#define MEM_SDADDR0 0xB400000C
172#define MEM_SDADDR1 0xB4000010
173#define MEM_SDADDR2 0xB4000014
174
175#define MEM_SDREFCFG 0xB4000018
176#define MEM_SDPRECMD 0xB400001C
177#define MEM_SDAUTOREF 0xB4000020
178
179#define MEM_SDWRMD0 0xB4000024
180#define MEM_SDWRMD1 0xB4000028
181#define MEM_SDWRMD2 0xB400002C
182
183#define MEM_SDSLEEP 0xB4000030
184#define MEM_SDSMCKE 0xB4000034
185#endif
186
187/* Static Bus Controller */
188#define MEM_STCFG0 0xB4001000
189#define MEM_STTIME0 0xB4001004
190#define MEM_STADDR0 0xB4001008
191
192#define MEM_STCFG1 0xB4001010
193#define MEM_STTIME1 0xB4001014
194#define MEM_STADDR1 0xB4001018
195
196#define MEM_STCFG2 0xB4001020
197#define MEM_STTIME2 0xB4001024
198#define MEM_STADDR2 0xB4001028
199
200#define MEM_STCFG3 0xB4001030
201#define MEM_STTIME3 0xB4001034
202#define MEM_STADDR3 0xB4001038
203
204#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
205#define MEM_STNDCTL 0xB4001100
206#define MEM_STSTAT 0xB4001104
207
208#define MEM_STNAND_CMD (0x0)
209#define MEM_STNAND_ADDR (0x4)
210#define MEM_STNAND_DATA (0x20)
211#endif
212
213/* Interrupt Controller 0 */
214#define IC0_CFG0RD 0xB0400040
215#define IC0_CFG0SET 0xB0400040
216#define IC0_CFG0CLR 0xB0400044
217
218#define IC0_CFG1RD 0xB0400048
219#define IC0_CFG1SET 0xB0400048
220#define IC0_CFG1CLR 0xB040004C
221
222#define IC0_CFG2RD 0xB0400050
223#define IC0_CFG2SET 0xB0400050
224#define IC0_CFG2CLR 0xB0400054
225
226#define IC0_REQ0INT 0xB0400054
227#define IC0_SRCRD 0xB0400058
228#define IC0_SRCSET 0xB0400058
229#define IC0_SRCCLR 0xB040005C
230#define IC0_REQ1INT 0xB040005C
231
232#define IC0_ASSIGNRD 0xB0400060
233#define IC0_ASSIGNSET 0xB0400060
234#define IC0_ASSIGNCLR 0xB0400064
235
236#define IC0_WAKERD 0xB0400068
237#define IC0_WAKESET 0xB0400068
238#define IC0_WAKECLR 0xB040006C
239
240#define IC0_MASKRD 0xB0400070
241#define IC0_MASKSET 0xB0400070
242#define IC0_MASKCLR 0xB0400074
243
244#define IC0_RISINGRD 0xB0400078
245#define IC0_RISINGCLR 0xB0400078
246#define IC0_FALLINGRD 0xB040007C
247#define IC0_FALLINGCLR 0xB040007C
248
249#define IC0_TESTBIT 0xB0400080
250
251/* Interrupt Controller 1 */
252#define IC1_CFG0RD 0xB1800040
253#define IC1_CFG0SET 0xB1800040
254#define IC1_CFG0CLR 0xB1800044
255
256#define IC1_CFG1RD 0xB1800048
257#define IC1_CFG1SET 0xB1800048
258#define IC1_CFG1CLR 0xB180004C
259
260#define IC1_CFG2RD 0xB1800050
261#define IC1_CFG2SET 0xB1800050
262#define IC1_CFG2CLR 0xB1800054
263
264#define IC1_REQ0INT 0xB1800054
265#define IC1_SRCRD 0xB1800058
266#define IC1_SRCSET 0xB1800058
267#define IC1_SRCCLR 0xB180005C
268#define IC1_REQ1INT 0xB180005C
269
270#define IC1_ASSIGNRD 0xB1800060
271#define IC1_ASSIGNSET 0xB1800060
272#define IC1_ASSIGNCLR 0xB1800064
273
274#define IC1_WAKERD 0xB1800068
275#define IC1_WAKESET 0xB1800068
276#define IC1_WAKECLR 0xB180006C
277
278#define IC1_MASKRD 0xB1800070
279#define IC1_MASKSET 0xB1800070
280#define IC1_MASKCLR 0xB1800074
281
282#define IC1_RISINGRD 0xB1800078
283#define IC1_RISINGCLR 0xB1800078
284#define IC1_FALLINGRD 0xB180007C
285#define IC1_FALLINGCLR 0xB180007C
286
287#define IC1_TESTBIT 0xB1800080
288
289/* Interrupt Configuration Modes */
290#define INTC_INT_DISABLED 0
291#define INTC_INT_RISE_EDGE 0x1
292#define INTC_INT_FALL_EDGE 0x2
293#define INTC_INT_RISE_AND_FALL_EDGE 0x3
294#define INTC_INT_HIGH_LEVEL 0x5
295#define INTC_INT_LOW_LEVEL 0x6
296#define INTC_INT_HIGH_AND_LOW_LEVEL 0x7
297
298/* Interrupt Numbers */
299/* Au1000 */
300#ifdef CONFIG_SOC_AU1000
301#define AU1000_UART0_INT 0
302#define AU1000_UART1_INT 1 /* au1000 */
303#define AU1000_UART2_INT 2 /* au1000 */
304#define AU1000_UART3_INT 3
305#define AU1000_SSI0_INT 4 /* au1000 */
306#define AU1000_SSI1_INT 5 /* au1000 */
307#define AU1000_DMA_INT_BASE 6
308#define AU1000_TOY_INT 14
309#define AU1000_TOY_MATCH0_INT 15
310#define AU1000_TOY_MATCH1_INT 16
311#define AU1000_TOY_MATCH2_INT 17
312#define AU1000_RTC_INT 18
313#define AU1000_RTC_MATCH0_INT 19
314#define AU1000_RTC_MATCH1_INT 20
315#define AU1000_RTC_MATCH2_INT 21
316#define AU1000_IRDA_TX_INT 22 /* au1000 */
317#define AU1000_IRDA_RX_INT 23 /* au1000 */
318#define AU1000_USB_DEV_REQ_INT 24
319#define AU1000_USB_DEV_SUS_INT 25
320#define AU1000_USB_HOST_INT 26
321#define AU1000_ACSYNC_INT 27
322#define AU1000_MAC0_DMA_INT 28
323#define AU1000_MAC1_DMA_INT 29
324#define AU1000_I2S_UO_INT 30 /* au1000 */
325#define AU1000_AC97C_INT 31
326#define AU1000_GPIO_0 32
327#define AU1000_GPIO_1 33
328#define AU1000_GPIO_2 34
329#define AU1000_GPIO_3 35
330#define AU1000_GPIO_4 36
331#define AU1000_GPIO_5 37
332#define AU1000_GPIO_6 38
333#define AU1000_GPIO_7 39
334#define AU1000_GPIO_8 40
335#define AU1000_GPIO_9 41
336#define AU1000_GPIO_10 42
337#define AU1000_GPIO_11 43
338#define AU1000_GPIO_12 44
339#define AU1000_GPIO_13 45
340#define AU1000_GPIO_14 46
341#define AU1000_GPIO_15 47
342#define AU1000_GPIO_16 48
343#define AU1000_GPIO_17 49
344#define AU1000_GPIO_18 50
345#define AU1000_GPIO_19 51
346#define AU1000_GPIO_20 52
347#define AU1000_GPIO_21 53
348#define AU1000_GPIO_22 54
349#define AU1000_GPIO_23 55
350#define AU1000_GPIO_24 56
351#define AU1000_GPIO_25 57
352#define AU1000_GPIO_26 58
353#define AU1000_GPIO_27 59
354#define AU1000_GPIO_28 60
355#define AU1000_GPIO_29 61
356#define AU1000_GPIO_30 62
357#define AU1000_GPIO_31 63
358
359#define UART0_ADDR 0xB1100000
360#define UART1_ADDR 0xB1200000
361#define UART2_ADDR 0xB1300000
362#define UART3_ADDR 0xB1400000
363
364#define USB_OHCI_BASE 0x10100000 // phys addr for ioremap
365#define USB_HOST_CONFIG 0xB017fffc
366
367#define AU1000_ETH0_BASE 0xB0500000
368#define AU1000_ETH1_BASE 0xB0510000
369#define AU1000_MAC0_ENABLE 0xB0520000
370#define AU1000_MAC1_ENABLE 0xB0520004
371#define NUM_ETH_INTERFACES 2
372#endif // CONFIG_SOC_AU1000
373
374/* Au1500 */
375#ifdef CONFIG_SOC_AU1500
376#define AU1500_UART0_INT 0
377#define AU1000_PCI_INTA 1 /* au1500 */
378#define AU1000_PCI_INTB 2 /* au1500 */
379#define AU1500_UART3_INT 3
380#define AU1000_PCI_INTC 4 /* au1500 */
381#define AU1000_PCI_INTD 5 /* au1500 */
382#define AU1000_DMA_INT_BASE 6
383#define AU1000_TOY_INT 14
384#define AU1000_TOY_MATCH0_INT 15
385#define AU1000_TOY_MATCH1_INT 16
386#define AU1000_TOY_MATCH2_INT 17
387#define AU1000_RTC_INT 18
388#define AU1000_RTC_MATCH0_INT 19
389#define AU1000_RTC_MATCH1_INT 20
390#define AU1000_RTC_MATCH2_INT 21
391#define AU1500_PCI_ERR_INT 22
392#define AU1000_USB_DEV_REQ_INT 24
393#define AU1000_USB_DEV_SUS_INT 25
394#define AU1000_USB_HOST_INT 26
395#define AU1000_ACSYNC_INT 27
396#define AU1500_MAC0_DMA_INT 28
397#define AU1500_MAC1_DMA_INT 29
398#define AU1000_AC97C_INT 31
399#define AU1000_GPIO_0 32
400#define AU1000_GPIO_1 33
401#define AU1000_GPIO_2 34
402#define AU1000_GPIO_3 35
403#define AU1000_GPIO_4 36
404#define AU1000_GPIO_5 37
405#define AU1000_GPIO_6 38
406#define AU1000_GPIO_7 39
407#define AU1000_GPIO_8 40
408#define AU1000_GPIO_9 41
409#define AU1000_GPIO_10 42
410#define AU1000_GPIO_11 43
411#define AU1000_GPIO_12 44
412#define AU1000_GPIO_13 45
413#define AU1000_GPIO_14 46
414#define AU1000_GPIO_15 47
415#define AU1500_GPIO_200 48
416#define AU1500_GPIO_201 49
417#define AU1500_GPIO_202 50
418#define AU1500_GPIO_203 51
419#define AU1500_GPIO_20 52
420#define AU1500_GPIO_204 53
421#define AU1500_GPIO_205 54
422#define AU1500_GPIO_23 55
423#define AU1500_GPIO_24 56
424#define AU1500_GPIO_25 57
425#define AU1500_GPIO_26 58
426#define AU1500_GPIO_27 59
427#define AU1500_GPIO_28 60
428#define AU1500_GPIO_206 61
429#define AU1500_GPIO_207 62
430#define AU1500_GPIO_208_215 63
431
432#define UART0_ADDR 0xB1100000
433#define UART3_ADDR 0xB1400000
434
435#define USB_OHCI_BASE 0x10100000 // phys addr for ioremap
436#define USB_HOST_CONFIG 0xB017fffc
437
438#define AU1500_ETH0_BASE 0xB1500000
439#define AU1500_ETH1_BASE 0xB1510000
440#define AU1500_MAC0_ENABLE 0xB1520000
441#define AU1500_MAC1_ENABLE 0xB1520004
442#define NUM_ETH_INTERFACES 2
443#endif // CONFIG_SOC_AU1500
444
445/* Au1100 */
446#ifdef CONFIG_SOC_AU1100
447#define AU1100_UART0_INT 0
448#define AU1100_UART1_INT 1
449#define AU1100_SD_INT 2
450#define AU1100_UART3_INT 3
451#define AU1000_SSI0_INT 4
452#define AU1000_SSI1_INT 5
453#define AU1000_DMA_INT_BASE 6
454#define AU1000_TOY_INT 14
455#define AU1000_TOY_MATCH0_INT 15
456#define AU1000_TOY_MATCH1_INT 16
457#define AU1000_TOY_MATCH2_INT 17
458#define AU1000_RTC_INT 18
459#define AU1000_RTC_MATCH0_INT 19
460#define AU1000_RTC_MATCH1_INT 20
461#define AU1000_RTC_MATCH2_INT 21
462#define AU1000_IRDA_TX_INT 22
463#define AU1000_IRDA_RX_INT 23
464#define AU1000_USB_DEV_REQ_INT 24
465#define AU1000_USB_DEV_SUS_INT 25
466#define AU1000_USB_HOST_INT 26
467#define AU1000_ACSYNC_INT 27
468#define AU1100_MAC0_DMA_INT 28
469#define AU1100_GPIO_208_215 29
470#define AU1100_LCD_INT 30
471#define AU1000_AC97C_INT 31
472#define AU1000_GPIO_0 32
473#define AU1000_GPIO_1 33
474#define AU1000_GPIO_2 34
475#define AU1000_GPIO_3 35
476#define AU1000_GPIO_4 36
477#define AU1000_GPIO_5 37
478#define AU1000_GPIO_6 38
479#define AU1000_GPIO_7 39
480#define AU1000_GPIO_8 40
481#define AU1000_GPIO_9 41
482#define AU1000_GPIO_10 42
483#define AU1000_GPIO_11 43
484#define AU1000_GPIO_12 44
485#define AU1000_GPIO_13 45
486#define AU1000_GPIO_14 46
487#define AU1000_GPIO_15 47
488
489#define UART0_ADDR 0xB1100000
490#define UART1_ADDR 0xB1200000
491#define UART3_ADDR 0xB1400000
492
493#define USB_OHCI_BASE 0x10100000 // phys addr for ioremap
494#define USB_HOST_CONFIG 0xB017fffc
495
496#define AU1100_ETH0_BASE 0xB0500000
497#define AU1100_MAC0_ENABLE 0xB0520000
498#define NUM_ETH_INTERFACES 1
499#endif // CONFIG_SOC_AU1100
500
501#ifdef CONFIG_SOC_AU1550
502#define AU1550_UART0_INT 0
503#define AU1550_PCI_INTA 1
504#define AU1550_PCI_INTB 2
505#define AU1550_DDMA_INT 3
506#define AU1550_CRYPTO_INT 4
507#define AU1550_PCI_INTC 5
508#define AU1550_PCI_INTD 6
509#define AU1550_PCI_RST_INT 7
510#define AU1550_UART1_INT 8
511#define AU1550_UART3_INT 9
512#define AU1550_PSC0_INT 10
513#define AU1550_PSC1_INT 11
514#define AU1550_PSC2_INT 12
515#define AU1550_PSC3_INT 13
516#define AU1550_TOY_INT 14
517#define AU1550_TOY_MATCH0_INT 15
518#define AU1550_TOY_MATCH1_INT 16
519#define AU1550_TOY_MATCH2_INT 17
520#define AU1550_RTC_INT 18
521#define AU1550_RTC_MATCH0_INT 19
522#define AU1550_RTC_MATCH1_INT 20
523#define AU1550_RTC_MATCH2_INT 21
524#define AU1550_NAND_INT 23
525#define AU1550_USB_DEV_REQ_INT 24
526#define AU1550_USB_DEV_SUS_INT 25
527#define AU1550_USB_HOST_INT 26
528#define AU1000_USB_DEV_REQ_INT AU1550_USB_DEV_REQ_INT
529#define AU1000_USB_DEV_SUS_INT AU1550_USB_DEV_SUS_INT
530#define AU1000_USB_HOST_INT AU1550_USB_HOST_INT
531#define AU1550_MAC0_DMA_INT 27
532#define AU1550_MAC1_DMA_INT 28
533#define AU1000_GPIO_0 32
534#define AU1000_GPIO_1 33
535#define AU1000_GPIO_2 34
536#define AU1000_GPIO_3 35
537#define AU1000_GPIO_4 36
538#define AU1000_GPIO_5 37
539#define AU1000_GPIO_6 38
540#define AU1000_GPIO_7 39
541#define AU1000_GPIO_8 40
542#define AU1000_GPIO_9 41
543#define AU1000_GPIO_10 42
544#define AU1000_GPIO_11 43
545#define AU1000_GPIO_12 44
546#define AU1000_GPIO_13 45
547#define AU1000_GPIO_14 46
548#define AU1000_GPIO_15 47
549#define AU1550_GPIO_200 48
550#define AU1500_GPIO_201_205 49 // Logical or of GPIO201:205
551#define AU1500_GPIO_16 50
552#define AU1500_GPIO_17 51
553#define AU1500_GPIO_20 52
554#define AU1500_GPIO_21 53
555#define AU1500_GPIO_22 54
556#define AU1500_GPIO_23 55
557#define AU1500_GPIO_24 56
558#define AU1500_GPIO_25 57
559#define AU1500_GPIO_26 58
560#define AU1500_GPIO_27 59
561#define AU1500_GPIO_28 60
562#define AU1500_GPIO_206 61
563#define AU1500_GPIO_207 62
564#define AU1500_GPIO_208_218 63 // Logical or of GPIO208:218
565
566#define UART0_ADDR 0xB1100000
567#define UART1_ADDR 0xB1200000
568#define UART3_ADDR 0xB1400000
569
570#define USB_OHCI_BASE 0x14020000 // phys addr for ioremap
571#define USB_HOST_CONFIG 0xB4027ffc
572
573#define AU1550_ETH0_BASE 0xB0500000
574#define AU1550_ETH1_BASE 0xB0510000
575#define AU1550_MAC0_ENABLE 0xB0520000
576#define AU1550_MAC1_ENABLE 0xB0520004
577#define NUM_ETH_INTERFACES 2
578#endif // CONFIG_SOC_AU1550
579
580#ifdef CONFIG_SOC_AU1200
581#define AU1200_UART0_INT 0
582#define AU1200_SWT_INT 1
583#define AU1200_SD_INT 2
584#define AU1200_DDMA_INT 3
585#define AU1200_MAE_BE_INT 4
586#define AU1200_GPIO_200 5
587#define AU1200_GPIO_201 6
588#define AU1200_GPIO_202 7
589#define AU1200_UART1_INT 8
590#define AU1200_MAE_FE_INT 9
591#define AU1200_PSC0_INT 10
592#define AU1200_PSC1_INT 11
593#define AU1200_AES_INT 12
594#define AU1200_CAMERA_INT 13
595#define AU1200_TOY_INT 14
596#define AU1200_TOY_MATCH0_INT 15
597#define AU1200_TOY_MATCH1_INT 16
598#define AU1200_TOY_MATCH2_INT 17
599#define AU1200_RTC_INT 18
600#define AU1200_RTC_MATCH0_INT 19
601#define AU1200_RTC_MATCH1_INT 20
602#define AU1200_RTC_MATCH2_INT 21
603#define AU1200_NAND_INT 23
604#define AU1200_GPIO_204 24
605#define AU1200_GPIO_205 25
606#define AU1200_GPIO_206 26
607#define AU1200_GPIO_207 27
608#define AU1200_GPIO_208_215 28 // Logical OR of 208:215
609#define AU1200_USB_INT 29
610#define AU1200_LCD_INT 30
611#define AU1200_MAE_BOTH_INT 31
612#define AU1000_GPIO_0 32
613#define AU1000_GPIO_1 33
614#define AU1000_GPIO_2 34
615#define AU1000_GPIO_3 35
616#define AU1000_GPIO_4 36
617#define AU1000_GPIO_5 37
618#define AU1000_GPIO_6 38
619#define AU1000_GPIO_7 39
620#define AU1000_GPIO_8 40
621#define AU1000_GPIO_9 41
622#define AU1000_GPIO_10 42
623#define AU1000_GPIO_11 43
624#define AU1000_GPIO_12 44
625#define AU1000_GPIO_13 45
626#define AU1000_GPIO_14 46
627#define AU1000_GPIO_15 47
628#define AU1000_GPIO_16 48
629#define AU1000_GPIO_17 49
630#define AU1000_GPIO_18 50
631#define AU1000_GPIO_19 51
632#define AU1000_GPIO_20 52
633#define AU1000_GPIO_21 53
634#define AU1000_GPIO_22 54
635#define AU1000_GPIO_23 55
636#define AU1000_GPIO_24 56
637#define AU1000_GPIO_25 57
638#define AU1000_GPIO_26 58
639#define AU1000_GPIO_27 59
640#define AU1000_GPIO_28 60
641#define AU1000_GPIO_29 61
642#define AU1000_GPIO_30 62
643#define AU1000_GPIO_31 63
644
645#define UART0_ADDR 0xB1100000
646#define UART1_ADDR 0xB1200000
647
648#define USB_OHCI_BASE 0x14020000 // phys addr for ioremap
649#define USB_HOST_CONFIG 0xB4027ffc
650
651// these are here for prototyping on au1550 (do not exist on au1200)
652#define AU1200_ETH0_BASE 0xB0500000
653#define AU1200_ETH1_BASE 0xB0510000
654#define AU1200_MAC0_ENABLE 0xB0520000
655#define AU1200_MAC1_ENABLE 0xB0520004
656#define NUM_ETH_INTERFACES 2
657#endif // CONFIG_SOC_AU1200
658
659#define AU1000_LAST_INTC0_INT 31
660#define AU1000_MAX_INTR 63
661
662
663/* Programmable Counters 0 and 1 */
664#define SYS_BASE 0xB1900000
665#define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
666 #define SYS_CNTRL_E1S (1<<23)
667 #define SYS_CNTRL_T1S (1<<20)
668 #define SYS_CNTRL_M21 (1<<19)
669 #define SYS_CNTRL_M11 (1<<18)
670 #define SYS_CNTRL_M01 (1<<17)
671 #define SYS_CNTRL_C1S (1<<16)
672 #define SYS_CNTRL_BP (1<<14)
673 #define SYS_CNTRL_EN1 (1<<13)
674 #define SYS_CNTRL_BT1 (1<<12)
675 #define SYS_CNTRL_EN0 (1<<11)
676 #define SYS_CNTRL_BT0 (1<<10)
677 #define SYS_CNTRL_E0 (1<<8)
678 #define SYS_CNTRL_E0S (1<<7)
679 #define SYS_CNTRL_32S (1<<5)
680 #define SYS_CNTRL_T0S (1<<4)
681 #define SYS_CNTRL_M20 (1<<3)
682 #define SYS_CNTRL_M10 (1<<2)
683 #define SYS_CNTRL_M00 (1<<1)
684 #define SYS_CNTRL_C0S (1<<0)
685
686/* Programmable Counter 0 Registers */
687#define SYS_TOYTRIM (SYS_BASE + 0)
688#define SYS_TOYWRITE (SYS_BASE + 4)
689#define SYS_TOYMATCH0 (SYS_BASE + 8)
690#define SYS_TOYMATCH1 (SYS_BASE + 0xC)
691#define SYS_TOYMATCH2 (SYS_BASE + 0x10)
692#define SYS_TOYREAD (SYS_BASE + 0x40)
693
694/* Programmable Counter 1 Registers */
695#define SYS_RTCTRIM (SYS_BASE + 0x44)
696#define SYS_RTCWRITE (SYS_BASE + 0x48)
697#define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
698#define SYS_RTCMATCH1 (SYS_BASE + 0x50)
699#define SYS_RTCMATCH2 (SYS_BASE + 0x54)
700#define SYS_RTCREAD (SYS_BASE + 0x58)
701
702/* I2S Controller */
703#define I2S_DATA 0xB1000000
704 #define I2S_DATA_MASK (0xffffff)
705#define I2S_CONFIG 0xB1000004
706 #define I2S_CONFIG_XU (1<<25)
707 #define I2S_CONFIG_XO (1<<24)
708 #define I2S_CONFIG_RU (1<<23)
709 #define I2S_CONFIG_RO (1<<22)
710 #define I2S_CONFIG_TR (1<<21)
711 #define I2S_CONFIG_TE (1<<20)
712 #define I2S_CONFIG_TF (1<<19)
713 #define I2S_CONFIG_RR (1<<18)
714 #define I2S_CONFIG_RE (1<<17)
715 #define I2S_CONFIG_RF (1<<16)
716 #define I2S_CONFIG_PD (1<<11)
717 #define I2S_CONFIG_LB (1<<10)
718 #define I2S_CONFIG_IC (1<<9)
719 #define I2S_CONFIG_FM_BIT 7
720 #define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
721 #define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
722 #define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
723 #define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
724 #define I2S_CONFIG_TN (1<<6)
725 #define I2S_CONFIG_RN (1<<5)
726 #define I2S_CONFIG_SZ_BIT 0
727 #define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
728
729#define I2S_CONTROL 0xB1000008
730 #define I2S_CONTROL_D (1<<1)
731 #define I2S_CONTROL_CE (1<<0)
732
733/* USB Host Controller */
734#define USB_OHCI_LEN 0x00100000
735
736/* USB Device Controller */
737#define USBD_EP0RD 0xB0200000
738#define USBD_EP0WR 0xB0200004
739#define USBD_EP2WR 0xB0200008
740#define USBD_EP3WR 0xB020000C
741#define USBD_EP4RD 0xB0200010
742#define USBD_EP5RD 0xB0200014
743#define USBD_INTEN 0xB0200018
744#define USBD_INTSTAT 0xB020001C
745 #define USBDEV_INT_SOF (1<<12)
746 #define USBDEV_INT_HF_BIT 6
747 #define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT)
748 #define USBDEV_INT_CMPLT_BIT 0
749 #define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
750#define USBD_CONFIG 0xB0200020
751#define USBD_EP0CS 0xB0200024
752#define USBD_EP2CS 0xB0200028
753#define USBD_EP3CS 0xB020002C
754#define USBD_EP4CS 0xB0200030
755#define USBD_EP5CS 0xB0200034
756 #define USBDEV_CS_SU (1<<14)
757 #define USBDEV_CS_NAK (1<<13)
758 #define USBDEV_CS_ACK (1<<12)
759 #define USBDEV_CS_BUSY (1<<11)
760 #define USBDEV_CS_TSIZE_BIT 1
761 #define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
762 #define USBDEV_CS_STALL (1<<0)
763#define USBD_EP0RDSTAT 0xB0200040
764#define USBD_EP0WRSTAT 0xB0200044
765#define USBD_EP2WRSTAT 0xB0200048
766#define USBD_EP3WRSTAT 0xB020004C
767#define USBD_EP4RDSTAT 0xB0200050
768#define USBD_EP5RDSTAT 0xB0200054
769 #define USBDEV_FSTAT_FLUSH (1<<6)
770 #define USBDEV_FSTAT_UF (1<<5)
771 #define USBDEV_FSTAT_OF (1<<4)
772 #define USBDEV_FSTAT_FCNT_BIT 0
773 #define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
774#define USBD_ENABLE 0xB0200058
775 #define USBDEV_ENABLE (1<<1)
776 #define USBDEV_CE (1<<0)
777
778/* Ethernet Controllers */
779
780/* 4 byte offsets from AU1000_ETH_BASE */
781#define MAC_CONTROL 0x0
782 #define MAC_RX_ENABLE (1<<2)
783 #define MAC_TX_ENABLE (1<<3)
784 #define MAC_DEF_CHECK (1<<5)
785 #define MAC_SET_BL(X) (((X)&0x3)<<6)
786 #define MAC_AUTO_PAD (1<<8)
787 #define MAC_DISABLE_RETRY (1<<10)
788 #define MAC_DISABLE_BCAST (1<<11)
789 #define MAC_LATE_COL (1<<12)
790 #define MAC_HASH_MODE (1<<13)
791 #define MAC_HASH_ONLY (1<<15)
792 #define MAC_PASS_ALL (1<<16)
793 #define MAC_INVERSE_FILTER (1<<17)
794 #define MAC_PROMISCUOUS (1<<18)
795 #define MAC_PASS_ALL_MULTI (1<<19)
796 #define MAC_FULL_DUPLEX (1<<20)
797 #define MAC_NORMAL_MODE 0
798 #define MAC_INT_LOOPBACK (1<<21)
799 #define MAC_EXT_LOOPBACK (1<<22)
800 #define MAC_DISABLE_RX_OWN (1<<23)
801 #define MAC_BIG_ENDIAN (1<<30)
802 #define MAC_RX_ALL (1<<31)
803#define MAC_ADDRESS_HIGH 0x4
804#define MAC_ADDRESS_LOW 0x8
805#define MAC_MCAST_HIGH 0xC
806#define MAC_MCAST_LOW 0x10
807#define MAC_MII_CNTRL 0x14
808 #define MAC_MII_BUSY (1<<0)
809 #define MAC_MII_READ 0
810 #define MAC_MII_WRITE (1<<1)
811 #define MAC_SET_MII_SELECT_REG(X) (((X)&0x1f)<<6)
812 #define MAC_SET_MII_SELECT_PHY(X) (((X)&0x1f)<<11)
813#define MAC_MII_DATA 0x18
814#define MAC_FLOW_CNTRL 0x1C
815 #define MAC_FLOW_CNTRL_BUSY (1<<0)
816 #define MAC_FLOW_CNTRL_ENABLE (1<<1)
817 #define MAC_PASS_CONTROL (1<<2)
818 #define MAC_SET_PAUSE(X) (((X)&0xffff)<<16)
819#define MAC_VLAN1_TAG 0x20
820#define MAC_VLAN2_TAG 0x24
821
822/* Ethernet Controller Enable */
823
824 #define MAC_EN_CLOCK_ENABLE (1<<0)
825 #define MAC_EN_RESET0 (1<<1)
826 #define MAC_EN_TOSS (0<<2)
827 #define MAC_EN_CACHEABLE (1<<3)
828 #define MAC_EN_RESET1 (1<<4)
829 #define MAC_EN_RESET2 (1<<5)
830 #define MAC_DMA_RESET (1<<6)
831
832/* Ethernet Controller DMA Channels */
833
834#define MAC0_TX_DMA_ADDR 0xB4004000
835#define MAC1_TX_DMA_ADDR 0xB4004200
836/* offsets from MAC_TX_RING_ADDR address */
837#define MAC_TX_BUFF0_STATUS 0x0
838 #define TX_FRAME_ABORTED (1<<0)
839 #define TX_JAB_TIMEOUT (1<<1)
840 #define TX_NO_CARRIER (1<<2)
841 #define TX_LOSS_CARRIER (1<<3)
842 #define TX_EXC_DEF (1<<4)
843 #define TX_LATE_COLL_ABORT (1<<5)
844 #define TX_EXC_COLL (1<<6)
845 #define TX_UNDERRUN (1<<7)
846 #define TX_DEFERRED (1<<8)
847 #define TX_LATE_COLL (1<<9)
848 #define TX_COLL_CNT_MASK (0xF<<10)
849 #define TX_PKT_RETRY (1<<31)
850#define MAC_TX_BUFF0_ADDR 0x4
851 #define TX_DMA_ENABLE (1<<0)
852 #define TX_T_DONE (1<<1)
853 #define TX_GET_DMA_BUFFER(X) (((X)>>2)&0x3)
854#define MAC_TX_BUFF0_LEN 0x8
855#define MAC_TX_BUFF1_STATUS 0x10
856#define MAC_TX_BUFF1_ADDR 0x14
857#define MAC_TX_BUFF1_LEN 0x18
858#define MAC_TX_BUFF2_STATUS 0x20
859#define MAC_TX_BUFF2_ADDR 0x24
860#define MAC_TX_BUFF2_LEN 0x28
861#define MAC_TX_BUFF3_STATUS 0x30
862#define MAC_TX_BUFF3_ADDR 0x34
863#define MAC_TX_BUFF3_LEN 0x38
864
865#define MAC0_RX_DMA_ADDR 0xB4004100
866#define MAC1_RX_DMA_ADDR 0xB4004300
867/* offsets from MAC_RX_RING_ADDR */
868#define MAC_RX_BUFF0_STATUS 0x0
869 #define RX_FRAME_LEN_MASK 0x3fff
870 #define RX_WDOG_TIMER (1<<14)
871 #define RX_RUNT (1<<15)
872 #define RX_OVERLEN (1<<16)
873 #define RX_COLL (1<<17)
874 #define RX_ETHER (1<<18)
875 #define RX_MII_ERROR (1<<19)
876 #define RX_DRIBBLING (1<<20)
877 #define RX_CRC_ERROR (1<<21)
878 #define RX_VLAN1 (1<<22)
879 #define RX_VLAN2 (1<<23)
880 #define RX_LEN_ERROR (1<<24)
881 #define RX_CNTRL_FRAME (1<<25)
882 #define RX_U_CNTRL_FRAME (1<<26)
883 #define RX_MCAST_FRAME (1<<27)
884 #define RX_BCAST_FRAME (1<<28)
885 #define RX_FILTER_FAIL (1<<29)
886 #define RX_PACKET_FILTER (1<<30)
887 #define RX_MISSED_FRAME (1<<31)
888
889 #define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
890 RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
891 RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
892#define MAC_RX_BUFF0_ADDR 0x4
893 #define RX_DMA_ENABLE (1<<0)
894 #define RX_T_DONE (1<<1)
895 #define RX_GET_DMA_BUFFER(X) (((X)>>2)&0x3)
896 #define RX_SET_BUFF_ADDR(X) ((X)&0xffffffc0)
897#define MAC_RX_BUFF1_STATUS 0x10
898#define MAC_RX_BUFF1_ADDR 0x14
899#define MAC_RX_BUFF2_STATUS 0x20
900#define MAC_RX_BUFF2_ADDR 0x24
901#define MAC_RX_BUFF3_STATUS 0x30
902#define MAC_RX_BUFF3_ADDR 0x34
903
904
905/* UARTS 0-3 */
906#define UART_BASE UART0_ADDR
907#define UART_DEBUG_BASE UART3_ADDR
908
909#define UART_RX 0 /* Receive buffer */
910#define UART_TX 4 /* Transmit buffer */
911#define UART_IER 8 /* Interrupt Enable Register */
912#define UART_IIR 0xC /* Interrupt ID Register */
913#define UART_FCR 0x10 /* FIFO Control Register */
914#define UART_LCR 0x14 /* Line Control Register */
915#define UART_MCR 0x18 /* Modem Control Register */
916#define UART_LSR 0x1C /* Line Status Register */
917#define UART_MSR 0x20 /* Modem Status Register */
918#define UART_CLK 0x28 /* Baud Rate Clock Divider */
919#define UART_MOD_CNTRL 0x100 /* Module Control */
920
921#define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */
922#define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */
923#define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */
924#define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */
925#define UART_FCR_TRIGGER_MASK 0xF0 /* Mask for the FIFO trigger range */
926#define UART_FCR_R_TRIGGER_1 0x00 /* Mask for receive trigger set at 1 */
927#define UART_FCR_R_TRIGGER_4 0x40 /* Mask for receive trigger set at 4 */
928#define UART_FCR_R_TRIGGER_8 0x80 /* Mask for receive trigger set at 8 */
929#define UART_FCR_R_TRIGGER_14 0xA0 /* Mask for receive trigger set at 14 */
930#define UART_FCR_T_TRIGGER_0 0x00 /* Mask for transmit trigger set at 0 */
931#define UART_FCR_T_TRIGGER_4 0x10 /* Mask for transmit trigger set at 4 */
932#define UART_FCR_T_TRIGGER_8 0x20 /* Mask for transmit trigger set at 8 */
933#define UART_FCR_T_TRIGGER_12 0x30 /* Mask for transmit trigger set at 12 */
934
935/*
936 * These are the definitions for the Line Control Register
937 */
938#define UART_LCR_SBC 0x40 /* Set break control */
939#define UART_LCR_SPAR 0x20 /* Stick parity (?) */
940#define UART_LCR_EPAR 0x10 /* Even parity select */
941#define UART_LCR_PARITY 0x08 /* Parity Enable */
942#define UART_LCR_STOP 0x04 /* Stop bits: 0=1 stop bit, 1= 2 stop bits */
943#define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */
944#define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */
945#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */
946#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */
947
948/*
949 * These are the definitions for the Line Status Register
950 */
951#define UART_LSR_TEMT 0x40 /* Transmitter empty */
952#define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */
953#define UART_LSR_BI 0x10 /* Break interrupt indicator */
954#define UART_LSR_FE 0x08 /* Frame error indicator */
955#define UART_LSR_PE 0x04 /* Parity error indicator */
956#define UART_LSR_OE 0x02 /* Overrun error indicator */
957#define UART_LSR_DR 0x01 /* Receiver data ready */
958
959/*
960 * These are the definitions for the Interrupt Identification Register
961 */
962#define UART_IIR_NO_INT 0x01 /* No interrupts pending */
963#define UART_IIR_ID 0x06 /* Mask for the interrupt ID */
964#define UART_IIR_MSI 0x00 /* Modem status interrupt */
965#define UART_IIR_THRI 0x02 /* Transmitter holding register empty */
966#define UART_IIR_RDI 0x04 /* Receiver data interrupt */
967#define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */
968
969/*
970 * These are the definitions for the Interrupt Enable Register
971 */
972#define UART_IER_MSI 0x08 /* Enable Modem status interrupt */
973#define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */
974#define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */
975#define UART_IER_RDI 0x01 /* Enable receiver data interrupt */
976
977/*
978 * These are the definitions for the Modem Control Register
979 */
980#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
981#define UART_MCR_OUT2 0x08 /* Out2 complement */
982#define UART_MCR_OUT1 0x04 /* Out1 complement */
983#define UART_MCR_RTS 0x02 /* RTS complement */
984#define UART_MCR_DTR 0x01 /* DTR complement */
985
986/*
987 * These are the definitions for the Modem Status Register
988 */
989#define UART_MSR_DCD 0x80 /* Data Carrier Detect */
990#define UART_MSR_RI 0x40 /* Ring Indicator */
991#define UART_MSR_DSR 0x20 /* Data Set Ready */
992#define UART_MSR_CTS 0x10 /* Clear to Send */
993#define UART_MSR_DDCD 0x08 /* Delta DCD */
994#define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */
995#define UART_MSR_DDSR 0x02 /* Delta DSR */
996#define UART_MSR_DCTS 0x01 /* Delta CTS */
997#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
998
999
1000
1001/* SSIO */
1002#define SSI0_STATUS 0xB1600000
1003 #define SSI_STATUS_BF (1<<4)
1004 #define SSI_STATUS_OF (1<<3)
1005 #define SSI_STATUS_UF (1<<2)
1006 #define SSI_STATUS_D (1<<1)
1007 #define SSI_STATUS_B (1<<0)
1008#define SSI0_INT 0xB1600004
1009 #define SSI_INT_OI (1<<3)
1010 #define SSI_INT_UI (1<<2)
1011 #define SSI_INT_DI (1<<1)
1012#define SSI0_INT_ENABLE 0xB1600008
1013 #define SSI_INTE_OIE (1<<3)
1014 #define SSI_INTE_UIE (1<<2)
1015 #define SSI_INTE_DIE (1<<1)
1016#define SSI0_CONFIG 0xB1600020
1017 #define SSI_CONFIG_AO (1<<24)
1018 #define SSI_CONFIG_DO (1<<23)
1019 #define SSI_CONFIG_ALEN_BIT 20
1020 #define SSI_CONFIG_ALEN_MASK (0x7<<20)
1021 #define SSI_CONFIG_DLEN_BIT 16
1022 #define SSI_CONFIG_DLEN_MASK (0x7<<16)
1023 #define SSI_CONFIG_DD (1<<11)
1024 #define SSI_CONFIG_AD (1<<10)
1025 #define SSI_CONFIG_BM_BIT 8
1026 #define SSI_CONFIG_BM_MASK (0x3<<8)
1027 #define SSI_CONFIG_CE (1<<7)
1028 #define SSI_CONFIG_DP (1<<6)
1029 #define SSI_CONFIG_DL (1<<5)
1030 #define SSI_CONFIG_EP (1<<4)
1031#define SSI0_ADATA 0xB1600024
1032 #define SSI_AD_D (1<<24)
1033 #define SSI_AD_ADDR_BIT 16
1034 #define SSI_AD_ADDR_MASK (0xff<<16)
1035 #define SSI_AD_DATA_BIT 0
1036 #define SSI_AD_DATA_MASK (0xfff<<0)
1037#define SSI0_CLKDIV 0xB1600028
1038#define SSI0_CONTROL 0xB1600100
1039 #define SSI_CONTROL_CD (1<<1)
1040 #define SSI_CONTROL_E (1<<0)
1041
1042/* SSI1 */
1043#define SSI1_STATUS 0xB1680000
1044#define SSI1_INT 0xB1680004
1045#define SSI1_INT_ENABLE 0xB1680008
1046#define SSI1_CONFIG 0xB1680020
1047#define SSI1_ADATA 0xB1680024
1048#define SSI1_CLKDIV 0xB1680028
1049#define SSI1_ENABLE 0xB1680100
1050
1051/*
1052 * Register content definitions
1053 */
1054#define SSI_STATUS_BF (1<<4)
1055#define SSI_STATUS_OF (1<<3)
1056#define SSI_STATUS_UF (1<<2)
1057#define SSI_STATUS_D (1<<1)
1058#define SSI_STATUS_B (1<<0)
1059
1060/* SSI_INT */
1061#define SSI_INT_OI (1<<3)
1062#define SSI_INT_UI (1<<2)
1063#define SSI_INT_DI (1<<1)
1064
1065/* SSI_INTEN */
1066#define SSI_INTEN_OIE (1<<3)
1067#define SSI_INTEN_UIE (1<<2)
1068#define SSI_INTEN_DIE (1<<1)
1069
1070#define SSI_CONFIG_AO (1<<24)
1071#define SSI_CONFIG_DO (1<<23)
1072#define SSI_CONFIG_ALEN (7<<20)
1073#define SSI_CONFIG_DLEN (15<<16)
1074#define SSI_CONFIG_DD (1<<11)
1075#define SSI_CONFIG_AD (1<<10)
1076#define SSI_CONFIG_BM (3<<8)
1077#define SSI_CONFIG_CE (1<<7)
1078#define SSI_CONFIG_DP (1<<6)
1079#define SSI_CONFIG_DL (1<<5)
1080#define SSI_CONFIG_EP (1<<4)
1081#define SSI_CONFIG_ALEN_N(N) ((N-1)<<20)
1082#define SSI_CONFIG_DLEN_N(N) ((N-1)<<16)
1083#define SSI_CONFIG_BM_HI (0<<8)
1084#define SSI_CONFIG_BM_LO (1<<8)
1085#define SSI_CONFIG_BM_CY (2<<8)
1086
1087#define SSI_ADATA_D (1<<24)
1088#define SSI_ADATA_ADDR (0xFF<<16)
1089#define SSI_ADATA_DATA (0x0FFF)
1090#define SSI_ADATA_ADDR_N(N) (N<<16)
1091
1092#define SSI_ENABLE_CD (1<<1)
1093#define SSI_ENABLE_E (1<<0)
1094
1095
1096/* IrDA Controller */
1097#define IRDA_BASE 0xB0300000
1098#define IR_RING_PTR_STATUS (IRDA_BASE+0x00)
1099#define IR_RING_BASE_ADDR_H (IRDA_BASE+0x04)
1100#define IR_RING_BASE_ADDR_L (IRDA_BASE+0x08)
1101#define IR_RING_SIZE (IRDA_BASE+0x0C)
1102#define IR_RING_PROMPT (IRDA_BASE+0x10)
1103#define IR_RING_ADDR_CMPR (IRDA_BASE+0x14)
1104#define IR_INT_CLEAR (IRDA_BASE+0x18)
1105#define IR_CONFIG_1 (IRDA_BASE+0x20)
1106 #define IR_RX_INVERT_LED (1<<0)
1107 #define IR_TX_INVERT_LED (1<<1)
1108 #define IR_ST (1<<2)
1109 #define IR_SF (1<<3)
1110 #define IR_SIR (1<<4)
1111 #define IR_MIR (1<<5)
1112 #define IR_FIR (1<<6)
1113 #define IR_16CRC (1<<7)
1114 #define IR_TD (1<<8)
1115 #define IR_RX_ALL (1<<9)
1116 #define IR_DMA_ENABLE (1<<10)
1117 #define IR_RX_ENABLE (1<<11)
1118 #define IR_TX_ENABLE (1<<12)
1119 #define IR_LOOPBACK (1<<14)
1120 #define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \
1121 IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
1122#define IR_SIR_FLAGS (IRDA_BASE+0x24)
1123#define IR_ENABLE (IRDA_BASE+0x28)
1124 #define IR_RX_STATUS (1<<9)
1125 #define IR_TX_STATUS (1<<10)
1126#define IR_READ_PHY_CONFIG (IRDA_BASE+0x2C)
1127#define IR_WRITE_PHY_CONFIG (IRDA_BASE+0x30)
1128#define IR_MAX_PKT_LEN (IRDA_BASE+0x34)
1129#define IR_RX_BYTE_CNT (IRDA_BASE+0x38)
1130#define IR_CONFIG_2 (IRDA_BASE+0x3C)
1131 #define IR_MODE_INV (1<<0)
1132 #define IR_ONE_PIN (1<<1)
1133#define IR_INTERFACE_CONFIG (IRDA_BASE+0x40)
1134
1135/* GPIO */
1136#define SYS_PINFUNC 0xB190002C
1137 #define SYS_PF_USB (1<<15) /* 2nd USB device/host */
1138 #define SYS_PF_U3 (1<<14) /* GPIO23/U3TXD */
1139 #define SYS_PF_U2 (1<<13) /* GPIO22/U2TXD */
1140 #define SYS_PF_U1 (1<<12) /* GPIO21/U1TXD */
1141 #define SYS_PF_SRC (1<<11) /* GPIO6/SROMCKE */
1142 #define SYS_PF_CK5 (1<<10) /* GPIO3/CLK5 */
1143 #define SYS_PF_CK4 (1<<9) /* GPIO2/CLK4 */
1144 #define SYS_PF_IRF (1<<8) /* GPIO15/IRFIRSEL */
1145 #define SYS_PF_UR3 (1<<7) /* GPIO[14:9]/UART3 */
1146 #define SYS_PF_I2D (1<<6) /* GPIO8/I2SDI */
1147 #define SYS_PF_I2S (1<<5) /* I2S/GPIO[29:31] */
1148 #define SYS_PF_NI2 (1<<4) /* NI2/GPIO[24:28] */
1149 #define SYS_PF_U0 (1<<3) /* U0TXD/GPIO20 */
1150 #define SYS_PF_RD (1<<2) /* IRTXD/GPIO19 */
1151 #define SYS_PF_A97 (1<<1) /* AC97/SSL1 */
1152 #define SYS_PF_S0 (1<<0) /* SSI_0/GPIO[16:18] */
1153
1154/* Au1100 Only */
1155 #define SYS_PF_PC (1<<18) /* PCMCIA/GPIO[207:204] */
1156 #define SYS_PF_LCD (1<<17) /* extern lcd/GPIO[203:200] */
1157 #define SYS_PF_CS (1<<16) /* EXTCLK0/32khz to gpio2 */
1158 #define SYS_PF_EX0 (1<<9) /* gpio2/clock */
1159
1160/* Au1550 Only. Redefines lots of pins */
1161 #define SYS_PF_PSC2_MASK (7 << 17)
1162 #define SYS_PF_PSC2_AC97 (0)
1163 #define SYS_PF_PSC2_SPI (0)
1164 #define SYS_PF_PSC2_I2S (1 << 17)
1165 #define SYS_PF_PSC2_SMBUS (3 << 17)
1166 #define SYS_PF_PSC2_GPIO (7 << 17)
1167 #define SYS_PF_PSC3_MASK (7 << 20)
1168 #define SYS_PF_PSC3_AC97 (0)
1169 #define SYS_PF_PSC3_SPI (0)
1170 #define SYS_PF_PSC3_I2S (1 << 20)
1171 #define SYS_PF_PSC3_SMBUS (3 << 20)
1172 #define SYS_PF_PSC3_GPIO (7 << 20)
1173 #define SYS_PF_PSC1_S1 (1 << 1)
1174 #define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
1175
1176#define SYS_TRIOUTRD 0xB1900100
1177#define SYS_TRIOUTCLR 0xB1900100
1178#define SYS_OUTPUTRD 0xB1900108
1179#define SYS_OUTPUTSET 0xB1900108
1180#define SYS_OUTPUTCLR 0xB190010C
1181#define SYS_PINSTATERD 0xB1900110
1182#define SYS_PININPUTEN 0xB1900110
1183
1184/* GPIO2, Au1500, Au1550 only */
1185#define GPIO2_BASE 0xB1700000
1186#define GPIO2_DIR (GPIO2_BASE + 0)
1187#define GPIO2_OUTPUT (GPIO2_BASE + 8)
1188#define GPIO2_PINSTATE (GPIO2_BASE + 0xC)
1189#define GPIO2_INTENABLE (GPIO2_BASE + 0x10)
1190#define GPIO2_ENABLE (GPIO2_BASE + 0x14)
1191
1192/* Power Management */
1193#define SYS_SCRATCH0 0xB1900018
1194#define SYS_SCRATCH1 0xB190001C
1195#define SYS_WAKEMSK 0xB1900034
1196#define SYS_ENDIAN 0xB1900038
1197#define SYS_POWERCTRL 0xB190003C
1198#define SYS_WAKESRC 0xB190005C
1199#define SYS_SLPPWR 0xB1900078
1200#define SYS_SLEEP 0xB190007C
1201
1202/* Clock Controller */
1203#define SYS_FREQCTRL0 0xB1900020
1204 #define SYS_FC_FRDIV2_BIT 22
1205 #define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT)
1206 #define SYS_FC_FE2 (1<<21)
1207 #define SYS_FC_FS2 (1<<20)
1208 #define SYS_FC_FRDIV1_BIT 12
1209 #define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT)
1210 #define SYS_FC_FE1 (1<<11)
1211 #define SYS_FC_FS1 (1<<10)
1212 #define SYS_FC_FRDIV0_BIT 2
1213 #define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT)
1214 #define SYS_FC_FE0 (1<<1)
1215 #define SYS_FC_FS0 (1<<0)
1216#define SYS_FREQCTRL1 0xB1900024
1217 #define SYS_FC_FRDIV5_BIT 22
1218 #define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT)
1219 #define SYS_FC_FE5 (1<<21)
1220 #define SYS_FC_FS5 (1<<20)
1221 #define SYS_FC_FRDIV4_BIT 12
1222 #define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT)
1223 #define SYS_FC_FE4 (1<<11)
1224 #define SYS_FC_FS4 (1<<10)
1225 #define SYS_FC_FRDIV3_BIT 2
1226 #define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT)
1227 #define SYS_FC_FE3 (1<<1)
1228 #define SYS_FC_FS3 (1<<0)
1229#define SYS_CLKSRC 0xB1900028
1230 #define SYS_CS_ME1_BIT 27
1231 #define SYS_CS_ME1_MASK (0x7<<SYS_CS_ME1_BIT)
1232 #define SYS_CS_DE1 (1<<26)
1233 #define SYS_CS_CE1 (1<<25)
1234 #define SYS_CS_ME0_BIT 22
1235 #define SYS_CS_ME0_MASK (0x7<<SYS_CS_ME0_BIT)
1236 #define SYS_CS_DE0 (1<<21)
1237 #define SYS_CS_CE0 (1<<20)
1238 #define SYS_CS_MI2_BIT 17
1239 #define SYS_CS_MI2_MASK (0x7<<SYS_CS_MI2_BIT)
1240 #define SYS_CS_DI2 (1<<16)
1241 #define SYS_CS_CI2 (1<<15)
1242 #define SYS_CS_MUH_BIT 12
1243 #define SYS_CS_MUH_MASK (0x7<<SYS_CS_MUH_BIT)
1244 #define SYS_CS_DUH (1<<11)
1245 #define SYS_CS_CUH (1<<10)
1246 #define SYS_CS_MUD_BIT 7
1247 #define SYS_CS_MUD_MASK (0x7<<SYS_CS_MUD_BIT)
1248 #define SYS_CS_DUD (1<<6)
1249 #define SYS_CS_CUD (1<<5)
1250 #define SYS_CS_MIR_BIT 2
1251 #define SYS_CS_MIR_MASK (0x7<<SYS_CS_MIR_BIT)
1252 #define SYS_CS_DIR (1<<1)
1253 #define SYS_CS_CIR (1<<0)
1254
1255 #define SYS_CS_MUX_AUX 0x1
1256 #define SYS_CS_MUX_FQ0 0x2
1257 #define SYS_CS_MUX_FQ1 0x3
1258 #define SYS_CS_MUX_FQ2 0x4
1259 #define SYS_CS_MUX_FQ3 0x5
1260 #define SYS_CS_MUX_FQ4 0x6
1261 #define SYS_CS_MUX_FQ5 0x7
1262#define SYS_CPUPLL 0xB1900060
1263#define SYS_AUXPLL 0xB1900064
1264
1265/* AC97 Controller */
1266#define AC97C_CONFIG 0xB0000000
1267 #define AC97C_RECV_SLOTS_BIT 13
1268 #define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
1269 #define AC97C_XMIT_SLOTS_BIT 3
1270 #define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
1271 #define AC97C_SG (1<<2)
1272 #define AC97C_SYNC (1<<1)
1273 #define AC97C_RESET (1<<0)
1274#define AC97C_STATUS 0xB0000004
1275 #define AC97C_XU (1<<11)
1276 #define AC97C_XO (1<<10)
1277 #define AC97C_RU (1<<9)
1278 #define AC97C_RO (1<<8)
1279 #define AC97C_READY (1<<7)
1280 #define AC97C_CP (1<<6)
1281 #define AC97C_TR (1<<5)
1282 #define AC97C_TE (1<<4)
1283 #define AC97C_TF (1<<3)
1284 #define AC97C_RR (1<<2)
1285 #define AC97C_RE (1<<1)
1286 #define AC97C_RF (1<<0)
1287#define AC97C_DATA 0xB0000008
1288#define AC97C_CMD 0xB000000C
1289 #define AC97C_WD_BIT 16
1290 #define AC97C_READ (1<<7)
1291 #define AC97C_INDEX_MASK 0x7f
1292#define AC97C_CNTRL 0xB0000010
1293 #define AC97C_RS (1<<1)
1294 #define AC97C_CE (1<<0)
1295
1296
1297/* Secure Digital (SD) Controller */
1298#define SD0_XMIT_FIFO 0xB0600000
1299#define SD0_RECV_FIFO 0xB0600004
1300#define SD1_XMIT_FIFO 0xB0680000
1301#define SD1_RECV_FIFO 0xB0680004
1302
1303
1304#if defined (CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
1305/* Au1500 PCI Controller */
1306#define Au1500_CFG_BASE 0xB4005000 // virtual, kseg0 addr
1307#define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0)
1308#define Au1500_PCI_CFG (Au1500_CFG_BASE + 4)
1309 #define PCI_ERROR ((1<<22) | (1<<23) | (1<<24) | (1<<25) | (1<<26) | (1<<27))
1310#define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8)
1311#define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC)
1312#define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10)
1313#define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14)
1314#define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18)
1315#define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C)
1316#define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20)
1317#define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100)
1318#define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104)
1319#define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108)
1320#define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C)
1321#define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110)
1322
1323#define Au1500_PCI_HDR 0xB4005100 // virtual, kseg0 addr
1324
1325/* All of our structures, like pci resource, have 32 bit members.
1326 * Drivers are expected to do an ioremap on the PCI MEM resource, but it's
1327 * hard to store 0x4 0000 0000 in a 32 bit type. We require a small patch
1328 * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and
1329 * (u32)Au1500_PCI_MEM_END and change those to the full 36 bit PCI MEM
1330 * addresses. For PCI IO, it's simpler because we get to do the ioremap
1331 * ourselves and then adjust the device's resources.
1332 */
1333#define Au1500_EXT_CFG 0x600000000ULL
1334#define Au1500_EXT_CFG_TYPE1 0x680000000ULL
1335#define Au1500_PCI_IO_START 0x500000000ULL
1336#define Au1500_PCI_IO_END 0x5000FFFFFULL
1337#define Au1500_PCI_MEM_START 0x440000000ULL
1338#define Au1500_PCI_MEM_END 0x44FFFFFFFULL
1339
1340#define PCI_IO_START (Au1500_PCI_IO_START + 0x1000)
1341#define PCI_IO_END (Au1500_PCI_IO_END)
1342#define PCI_MEM_START (Au1500_PCI_MEM_START)
1343#define PCI_MEM_END (Au1500_PCI_MEM_END)
1344#define PCI_FIRST_DEVFN (0<<3)
1345#define PCI_LAST_DEVFN (19<<3)
1346
1347#define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
1348#define IOPORT_RESOURCE_END 0xffffffff
1349#define IOMEM_RESOURCE_START 0x10000000
1350#define IOMEM_RESOURCE_END 0xffffffff
1351
1352 /*
1353 * Borrowed from the PPC arch:
1354 * The following macro is used to lookup irqs in a standard table
1355 * format for those PPC systems that do not already have PCI
1356 * interrupts properly routed.
1357 */
1358 /* FIXME - double check this from asm-ppc/pci-bridge.h */
1359#define PCI_IRQ_TABLE_LOOKUP \
1360 ({ long _ctl_ = -1; \
1361 if (idsel >= min_idsel && idsel <= max_idsel && pin <= irqs_per_slot) \
1362 _ctl_ = pci_irq_table[idsel - min_idsel][pin-1]; \
1363 _ctl_; })
1364
1365
1366#else /* Au1000 and Au1100 */
1367
1368/* don't allow any legacy ports probing */
1369#define IOPORT_RESOURCE_START 0x10000000;
1370#define IOPORT_RESOURCE_END 0xffffffff
1371#define IOMEM_RESOURCE_START 0x10000000
1372#define IOMEM_RESOURCE_END 0xffffffff
1373
1374#ifdef CONFIG_MIPS_PB1000
1375#define PCI_IO_START 0x10000000
1376#define PCI_IO_END 0x1000ffff
1377#define PCI_MEM_START 0x18000000
1378#define PCI_MEM_END 0x18ffffff
1379#define PCI_FIRST_DEVFN 0
1380#define PCI_LAST_DEVFN 1
1381#else
1382/* no PCI bus controller */
1383#define PCI_IO_START 0
1384#define PCI_IO_END 0
1385#define PCI_MEM_START 0
1386#define PCI_MEM_END 0
1387#define PCI_FIRST_DEVFN 0
1388#define PCI_LAST_DEVFN 0
1389#endif
1390
1391#endif
1392
1393/* Processor information base on prid.
1394 * Copied from PowerPC.
1395 */
1396struct cpu_spec {
1397 /* CPU is matched via (PRID & prid_mask) == prid_value */
1398 unsigned int prid_mask;
1399 unsigned int prid_value;
1400
1401 char *cpu_name;
1402 unsigned char cpu_od; /* Set Config[OD] */
1403 unsigned char cpu_bclk; /* Enable BCLK switching */
1404};
1405
1406extern struct cpu_spec cpu_specs[];
1407extern struct cpu_spec *cur_cpu_spec[];
1408#endif
diff --git a/include/asm-mips/mach-au1x00/au1000_dma.h b/include/asm-mips/mach-au1x00/au1000_dma.h
new file mode 100644
index 000000000000..810f2fa33444
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1000_dma.h
@@ -0,0 +1,446 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Defines for using and allocating dma channels on the Alchemy
4 * Au1000 mips processor.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * stevel@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 *
30 */
31#ifndef __ASM_AU1000_DMA_H
32#define __ASM_AU1000_DMA_H
33
34#include <asm/io.h> /* need byte IO */
35#include <linux/spinlock.h> /* And spinlocks */
36#include <linux/delay.h>
37#include <asm/system.h>
38
39#define NUM_AU1000_DMA_CHANNELS 8
40
41/* DMA Channel Base Addresses */
42#define DMA_CHANNEL_BASE 0xB4002000
43#define DMA_CHANNEL_LEN 0x00000100
44
45/* DMA Channel Register Offsets */
46#define DMA_MODE_SET 0x00000000
47#define DMA_MODE_READ DMA_MODE_SET
48#define DMA_MODE_CLEAR 0x00000004
49/* DMA Mode register bits follow */
50#define DMA_DAH_MASK (0x0f << 20)
51#define DMA_DID_BIT 16
52#define DMA_DID_MASK (0x0f << DMA_DID_BIT)
53#define DMA_DS (1<<15)
54#define DMA_BE (1<<13)
55#define DMA_DR (1<<12)
56#define DMA_TS8 (1<<11)
57#define DMA_DW_BIT 9
58#define DMA_DW_MASK (0x03 << DMA_DW_BIT)
59#define DMA_DW8 (0 << DMA_DW_BIT)
60#define DMA_DW16 (1 << DMA_DW_BIT)
61#define DMA_DW32 (2 << DMA_DW_BIT)
62#define DMA_NC (1<<8)
63#define DMA_IE (1<<7)
64#define DMA_HALT (1<<6)
65#define DMA_GO (1<<5)
66#define DMA_AB (1<<4)
67#define DMA_D1 (1<<3)
68#define DMA_BE1 (1<<2)
69#define DMA_D0 (1<<1)
70#define DMA_BE0 (1<<0)
71
72#define DMA_PERIPHERAL_ADDR 0x00000008
73#define DMA_BUFFER0_START 0x0000000C
74#define DMA_BUFFER1_START 0x00000014
75#define DMA_BUFFER0_COUNT 0x00000010
76#define DMA_BUFFER1_COUNT 0x00000018
77#define DMA_BAH_BIT 16
78#define DMA_BAH_MASK (0x0f << DMA_BAH_BIT)
79#define DMA_COUNT_BIT 0
80#define DMA_COUNT_MASK (0xffff << DMA_COUNT_BIT)
81
82/* DMA Device ID's follow */
83enum {
84 DMA_ID_UART0_TX = 0,
85 DMA_ID_UART0_RX,
86 DMA_ID_GP04,
87 DMA_ID_GP05,
88 DMA_ID_AC97C_TX,
89 DMA_ID_AC97C_RX,
90 DMA_ID_UART3_TX,
91 DMA_ID_UART3_RX,
92 DMA_ID_USBDEV_EP0_RX,
93 DMA_ID_USBDEV_EP0_TX,
94 DMA_ID_USBDEV_EP2_TX,
95 DMA_ID_USBDEV_EP3_TX,
96 DMA_ID_USBDEV_EP4_RX,
97 DMA_ID_USBDEV_EP5_RX,
98 DMA_ID_I2S_TX,
99 DMA_ID_I2S_RX,
100 DMA_NUM_DEV
101};
102
103/* DMA Device ID's for 2nd bank (AU1100) follow */
104enum {
105 DMA_ID_SD0_TX = 0,
106 DMA_ID_SD0_RX,
107 DMA_ID_SD1_TX,
108 DMA_ID_SD1_RX,
109 DMA_NUM_DEV_BANK2
110};
111
112struct dma_chan {
113 int dev_id; // this channel is allocated if >=0, free otherwise
114 unsigned int io;
115 const char *dev_str;
116 int irq;
117 void *irq_dev;
118 unsigned int fifo_addr;
119 unsigned int mode;
120};
121
122/* These are in arch/mips/au1000/common/dma.c */
123extern struct dma_chan au1000_dma_table[];
124extern int request_au1000_dma(int dev_id,
125 const char *dev_str,
126 irqreturn_t (*irqhandler)(int, void *,
127 struct pt_regs *),
128 unsigned long irqflags,
129 void *irq_dev_id);
130extern void free_au1000_dma(unsigned int dmanr);
131extern int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
132 int length, int *eof, void *data);
133extern void dump_au1000_dma_channel(unsigned int dmanr);
134extern spinlock_t au1000_dma_spin_lock;
135
136
137static __inline__ struct dma_chan *get_dma_chan(unsigned int dmanr)
138{
139 if (dmanr >= NUM_AU1000_DMA_CHANNELS
140 || au1000_dma_table[dmanr].dev_id < 0)
141 return NULL;
142 return &au1000_dma_table[dmanr];
143}
144
145static __inline__ unsigned long claim_dma_lock(void)
146{
147 unsigned long flags;
148 spin_lock_irqsave(&au1000_dma_spin_lock, flags);
149 return flags;
150}
151
152static __inline__ void release_dma_lock(unsigned long flags)
153{
154 spin_unlock_irqrestore(&au1000_dma_spin_lock, flags);
155}
156
157/*
158 * Set the DMA buffer enable bits in the mode register.
159 */
160static __inline__ void enable_dma_buffer0(unsigned int dmanr)
161{
162 struct dma_chan *chan = get_dma_chan(dmanr);
163 if (!chan)
164 return;
165 au_writel(DMA_BE0, chan->io + DMA_MODE_SET);
166}
167static __inline__ void enable_dma_buffer1(unsigned int dmanr)
168{
169 struct dma_chan *chan = get_dma_chan(dmanr);
170 if (!chan)
171 return;
172 au_writel(DMA_BE1, chan->io + DMA_MODE_SET);
173}
174static __inline__ void enable_dma_buffers(unsigned int dmanr)
175{
176 struct dma_chan *chan = get_dma_chan(dmanr);
177 if (!chan)
178 return;
179 au_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET);
180}
181
182static __inline__ void start_dma(unsigned int dmanr)
183{
184 struct dma_chan *chan = get_dma_chan(dmanr);
185 if (!chan)
186 return;
187
188 au_writel(DMA_GO, chan->io + DMA_MODE_SET);
189}
190
191#define DMA_HALT_POLL 0x5000
192
193static __inline__ void halt_dma(unsigned int dmanr)
194{
195 struct dma_chan *chan = get_dma_chan(dmanr);
196 int i;
197 if (!chan)
198 return;
199
200 au_writel(DMA_GO, chan->io + DMA_MODE_CLEAR);
201 // poll the halt bit
202 for (i = 0; i < DMA_HALT_POLL; i++)
203 if (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT)
204 break;
205 if (i == DMA_HALT_POLL)
206 printk(KERN_INFO "halt_dma: HALT poll expired!\n");
207}
208
209
210static __inline__ void disable_dma(unsigned int dmanr)
211{
212 struct dma_chan *chan = get_dma_chan(dmanr);
213 if (!chan)
214 return;
215
216 halt_dma(dmanr);
217
218 // now we can disable the buffers
219 au_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR);
220}
221
222static __inline__ int dma_halted(unsigned int dmanr)
223{
224 struct dma_chan *chan = get_dma_chan(dmanr);
225 if (!chan)
226 return 1;
227 return (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) ? 1 : 0;
228}
229
230/* initialize a DMA channel */
231static __inline__ void init_dma(unsigned int dmanr)
232{
233 struct dma_chan *chan = get_dma_chan(dmanr);
234 u32 mode;
235 if (!chan)
236 return;
237
238 disable_dma(dmanr);
239
240 // set device FIFO address
241 au_writel(CPHYSADDR(chan->fifo_addr),
242 chan->io + DMA_PERIPHERAL_ADDR);
243
244 mode = chan->mode | (chan->dev_id << DMA_DID_BIT);
245 if (chan->irq)
246 mode |= DMA_IE;
247
248 au_writel(~mode, chan->io + DMA_MODE_CLEAR);
249 au_writel(mode, chan->io + DMA_MODE_SET);
250}
251
252/*
253 * set mode for a specific DMA channel
254 */
255static __inline__ void set_dma_mode(unsigned int dmanr, unsigned int mode)
256{
257 struct dma_chan *chan = get_dma_chan(dmanr);
258 if (!chan)
259 return;
260 /*
261 * set_dma_mode is only allowed to change endianess, direction,
262 * transfer size, device FIFO width, and coherency settings.
263 * Make sure anything else is masked off.
264 */
265 mode &= (DMA_BE | DMA_DR | DMA_TS8 | DMA_DW_MASK | DMA_NC);
266 chan->mode &= ~(DMA_BE | DMA_DR | DMA_TS8 | DMA_DW_MASK | DMA_NC);
267 chan->mode |= mode;
268}
269
270static __inline__ unsigned int get_dma_mode(unsigned int dmanr)
271{
272 struct dma_chan *chan = get_dma_chan(dmanr);
273 if (!chan)
274 return 0;
275 return chan->mode;
276}
277
278static __inline__ int get_dma_active_buffer(unsigned int dmanr)
279{
280 struct dma_chan *chan = get_dma_chan(dmanr);
281 if (!chan)
282 return -1;
283 return (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0;
284}
285
286
287/*
288 * set the device FIFO address for a specific DMA channel - only
289 * applicable to GPO4 and GPO5. All the other devices have fixed
290 * FIFO addresses.
291 */
292static __inline__ void set_dma_fifo_addr(unsigned int dmanr,
293 unsigned int a)
294{
295 struct dma_chan *chan = get_dma_chan(dmanr);
296 if (!chan)
297 return;
298
299 if (chan->mode & DMA_DS) /* second bank of device ids */
300 return;
301
302 if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05)
303 return;
304
305 au_writel(CPHYSADDR(a), chan->io + DMA_PERIPHERAL_ADDR);
306}
307
308/*
309 * Clear the DMA buffer done bits in the mode register.
310 */
311static __inline__ void clear_dma_done0(unsigned int dmanr)
312{
313 struct dma_chan *chan = get_dma_chan(dmanr);
314 if (!chan)
315 return;
316 au_writel(DMA_D0, chan->io + DMA_MODE_CLEAR);
317}
318static __inline__ void clear_dma_done1(unsigned int dmanr)
319{
320 struct dma_chan *chan = get_dma_chan(dmanr);
321 if (!chan)
322 return;
323 au_writel(DMA_D1, chan->io + DMA_MODE_CLEAR);
324}
325
326/*
327 * This does nothing - not applicable to Au1000 DMA.
328 */
329static __inline__ void set_dma_page(unsigned int dmanr, char pagenr)
330{
331}
332
333/*
334 * Set Buffer 0 transfer address for specific DMA channel.
335 */
336static __inline__ void set_dma_addr0(unsigned int dmanr, unsigned int a)
337{
338 struct dma_chan *chan = get_dma_chan(dmanr);
339 if (!chan)
340 return;
341 au_writel(a, chan->io + DMA_BUFFER0_START);
342}
343
344/*
345 * Set Buffer 1 transfer address for specific DMA channel.
346 */
347static __inline__ void set_dma_addr1(unsigned int dmanr, unsigned int a)
348{
349 struct dma_chan *chan = get_dma_chan(dmanr);
350 if (!chan)
351 return;
352 au_writel(a, chan->io + DMA_BUFFER1_START);
353}
354
355
356/*
357 * Set Buffer 0 transfer size (max 64k) for a specific DMA channel.
358 */
359static __inline__ void set_dma_count0(unsigned int dmanr,
360 unsigned int count)
361{
362 struct dma_chan *chan = get_dma_chan(dmanr);
363 if (!chan)
364 return;
365 count &= DMA_COUNT_MASK;
366 au_writel(count, chan->io + DMA_BUFFER0_COUNT);
367}
368
369/*
370 * Set Buffer 1 transfer size (max 64k) for a specific DMA channel.
371 */
372static __inline__ void set_dma_count1(unsigned int dmanr,
373 unsigned int count)
374{
375 struct dma_chan *chan = get_dma_chan(dmanr);
376 if (!chan)
377 return;
378 count &= DMA_COUNT_MASK;
379 au_writel(count, chan->io + DMA_BUFFER1_COUNT);
380}
381
382/*
383 * Set both buffer transfer sizes (max 64k) for a specific DMA channel.
384 */
385static __inline__ void set_dma_count(unsigned int dmanr,
386 unsigned int count)
387{
388 struct dma_chan *chan = get_dma_chan(dmanr);
389 if (!chan)
390 return;
391 count &= DMA_COUNT_MASK;
392 au_writel(count, chan->io + DMA_BUFFER0_COUNT);
393 au_writel(count, chan->io + DMA_BUFFER1_COUNT);
394}
395
396/*
397 * Returns which buffer has its done bit set in the mode register.
398 * Returns -1 if neither or both done bits set.
399 */
400static __inline__ unsigned int get_dma_buffer_done(unsigned int dmanr)
401{
402 struct dma_chan *chan = get_dma_chan(dmanr);
403 if (!chan)
404 return 0;
405
406 return au_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1);
407}
408
409
410/*
411 * Returns the DMA channel's Buffer Done IRQ number.
412 */
413static __inline__ int get_dma_done_irq(unsigned int dmanr)
414{
415 struct dma_chan *chan = get_dma_chan(dmanr);
416 if (!chan)
417 return -1;
418
419 return chan->irq;
420}
421
422/*
423 * Get DMA residue count. Returns the number of _bytes_ left to transfer.
424 */
425static __inline__ int get_dma_residue(unsigned int dmanr)
426{
427 int curBufCntReg, count;
428 struct dma_chan *chan = get_dma_chan(dmanr);
429 if (!chan)
430 return 0;
431
432 curBufCntReg = (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ?
433 DMA_BUFFER1_COUNT : DMA_BUFFER0_COUNT;
434
435 count = au_readl(chan->io + curBufCntReg) & DMA_COUNT_MASK;
436
437 if ((chan->mode & DMA_DW_MASK) == DMA_DW16)
438 count <<= 1;
439 else if ((chan->mode & DMA_DW_MASK) == DMA_DW32)
440 count <<= 2;
441
442 return count;
443}
444
445#endif /* __ASM_AU1000_DMA_H */
446
diff --git a/include/asm-mips/mach-au1x00/au1000_gpio.h b/include/asm-mips/mach-au1x00/au1000_gpio.h
new file mode 100644
index 000000000000..298f92012e8e
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1000_gpio.h
@@ -0,0 +1,56 @@
1/*
2 * FILE NAME au1000_gpio.h
3 *
4 * BRIEF MODULE DESCRIPTION
5 * API to Alchemy Au1000 GPIO device.
6 *
7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * Steve Longerbeam <stevel@mvista.com>
9 *
10 * Copyright 2001 MontaVista Software Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33#ifndef __AU1000_GPIO_H
34#define __AU1000_GPIO_H
35
36#include <linux/ioctl.h>
37
38#define AU1000GPIO_IOC_MAGIC 'A'
39
40#define AU1000GPIO_IN _IOR (AU1000GPIO_IOC_MAGIC, 0, int)
41#define AU1000GPIO_SET _IOW (AU1000GPIO_IOC_MAGIC, 1, int)
42#define AU1000GPIO_CLEAR _IOW (AU1000GPIO_IOC_MAGIC, 2, int)
43#define AU1000GPIO_OUT _IOW (AU1000GPIO_IOC_MAGIC, 3, int)
44#define AU1000GPIO_TRISTATE _IOW (AU1000GPIO_IOC_MAGIC, 4, int)
45#define AU1000GPIO_AVAIL_MASK _IOR (AU1000GPIO_IOC_MAGIC, 5, int)
46
47#ifdef __KERNEL__
48extern u32 get_au1000_avail_gpio_mask(void);
49extern int au1000gpio_tristate(u32 data);
50extern int au1000gpio_in(u32 *data);
51extern int au1000gpio_set(u32 data);
52extern int au1000gpio_clear(u32 data);
53extern int au1000gpio_out(u32 data);
54#endif
55
56#endif
diff --git a/include/asm-mips/mach-au1x00/au1000_usbdev.h b/include/asm-mips/mach-au1x00/au1000_usbdev.h
new file mode 100644
index 000000000000..05bc74bed0b1
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1000_usbdev.h
@@ -0,0 +1,73 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1000 USB Device-Side Driver
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * stevel@mvista.com or source@mvista.com
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30#define USBDEV_REV 0x0110 // BCD
31#define USBDEV_EP0_MAX_PACKET_SIZE 64
32
33typedef enum {
34 ATTACHED = 0,
35 POWERED,
36 DEFAULT,
37 ADDRESS,
38 CONFIGURED
39} usbdev_state_t;
40
41typedef enum {
42 CB_NEW_STATE = 0,
43 CB_PKT_COMPLETE
44} usbdev_cb_type_t;
45
46
47typedef struct usbdev_pkt {
48 int ep_addr; // ep addr this packet routed to
49 int size; // size of payload in bytes
50 unsigned status; // packet status
51 struct usbdev_pkt* next; // function layer can't touch this
52 u8 payload[0]; // the payload
53} usbdev_pkt_t;
54
55#define PKT_STATUS_ACK (1<<0)
56#define PKT_STATUS_NAK (1<<1)
57#define PKT_STATUS_SU (1<<2)
58
59extern int usbdev_init(struct usb_device_descriptor* dev_desc,
60 struct usb_config_descriptor* config_desc,
61 struct usb_interface_descriptor* if_desc,
62 struct usb_endpoint_descriptor* ep_desc,
63 struct usb_string_descriptor* str_desc[],
64 void (*cb)(usbdev_cb_type_t, unsigned long, void *),
65 void* cb_data);
66
67extern void usbdev_exit(void);
68
69extern int usbdev_alloc_packet (int ep_addr, int data_size,
70 usbdev_pkt_t** pkt);
71extern int usbdev_send_packet (int ep_addr, usbdev_pkt_t* pkt);
72extern int usbdev_receive_packet(int ep_addr, usbdev_pkt_t** pkt);
73extern int usbdev_get_byte_count(int ep_addr);
diff --git a/include/asm-mips/mach-au1x00/au1100_mmc.h b/include/asm-mips/mach-au1x00/au1100_mmc.h
new file mode 100644
index 000000000000..9e7d1ba21b55
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1100_mmc.h
@@ -0,0 +1,205 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Defines for using the MMC/SD controllers on the
4 * Alchemy Au1100 mips processor.
5 *
6 * Copyright (c) 2003 Embedded Edge, LLC.
7 * Author: Embedded Edge, LLC.
8 * dan@embeddededge.com or tim@embeddededge.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 *
30 */
31/*
32 * AU1100 MMC/SD definitions.
33 *
34 * From "AMD Alchemy Solutions Au1100 Processor Data Book - Preliminary"
35 * June, 2003
36 */
37
38#ifndef __ASM_AU1100_MMC_H
39#define __ASM_AU1100_MMC_H
40
41
42#define NUM_AU1100_MMC_CONTROLLERS 2
43
44
45#define AU1100_SD_IRQ 2
46
47
48#define SD0_BASE 0xB0600000
49#define SD1_BASE 0xB0680000
50
51
52/*
53 * Register offsets.
54 */
55#define SD_TXPORT (0x0000)
56#define SD_RXPORT (0x0004)
57#define SD_CONFIG (0x0008)
58#define SD_ENABLE (0x000C)
59#define SD_CONFIG2 (0x0010)
60#define SD_BLKSIZE (0x0014)
61#define SD_STATUS (0x0018)
62#define SD_DEBUG (0x001C)
63#define SD_CMD (0x0020)
64#define SD_CMDARG (0x0024)
65#define SD_RESP3 (0x0028)
66#define SD_RESP2 (0x002C)
67#define SD_RESP1 (0x0030)
68#define SD_RESP0 (0x0034)
69#define SD_TIMEOUT (0x0038)
70
71
72/*
73 * SD_TXPORT bit definitions.
74 */
75#define SD_TXPORT_TXD (0x000000ff)
76
77
78/*
79 * SD_RXPORT bit definitions.
80 */
81#define SD_RXPORT_RXD (0x000000ff)
82
83
84/*
85 * SD_CONFIG bit definitions.
86 */
87#define SD_CONFIG_DIV (0x000001ff)
88#define SD_CONFIG_DE (0x00000200)
89#define SD_CONFIG_NE (0x00000400)
90#define SD_CONFIG_TU (0x00000800)
91#define SD_CONFIG_TO (0x00001000)
92#define SD_CONFIG_RU (0x00002000)
93#define SD_CONFIG_RO (0x00004000)
94#define SD_CONFIG_I (0x00008000)
95#define SD_CONFIG_CR (0x00010000)
96#define SD_CONFIG_RAT (0x00020000)
97#define SD_CONFIG_DD (0x00040000)
98#define SD_CONFIG_DT (0x00080000)
99#define SD_CONFIG_SC (0x00100000)
100#define SD_CONFIG_RC (0x00200000)
101#define SD_CONFIG_WC (0x00400000)
102#define SD_CONFIG_xxx (0x00800000)
103#define SD_CONFIG_TH (0x01000000)
104#define SD_CONFIG_TE (0x02000000)
105#define SD_CONFIG_TA (0x04000000)
106#define SD_CONFIG_RH (0x08000000)
107#define SD_CONFIG_RA (0x10000000)
108#define SD_CONFIG_RF (0x20000000)
109#define SD_CONFIG_CD (0x40000000)
110#define SD_CONFIG_SI (0x80000000)
111
112
113/*
114 * SD_ENABLE bit definitions.
115 */
116#define SD_ENABLE_CE (0x00000001)
117#define SD_ENABLE_R (0x00000002)
118
119
120/*
121 * SD_CONFIG2 bit definitions.
122 */
123#define SD_CONFIG2_EN (0x00000001)
124#define SD_CONFIG2_FF (0x00000002)
125#define SD_CONFIG2_xx1 (0x00000004)
126#define SD_CONFIG2_DF (0x00000008)
127#define SD_CONFIG2_DC (0x00000010)
128#define SD_CONFIG2_xx2 (0x000000e0)
129#define SD_CONFIG2_WB (0x00000100)
130#define SD_CONFIG2_RW (0x00000200)
131
132
133/*
134 * SD_BLKSIZE bit definitions.
135 */
136#define SD_BLKSIZE_BS (0x000007ff)
137#define SD_BLKSIZE_BS_SHIFT (0)
138#define SD_BLKSIZE_BC (0x01ff0000)
139#define SD_BLKSIZE_BC_SHIFT (16)
140
141
142/*
143 * SD_STATUS bit definitions.
144 */
145#define SD_STATUS_DCRCW (0x00000007)
146#define SD_STATUS_xx1 (0x00000008)
147#define SD_STATUS_CB (0x00000010)
148#define SD_STATUS_DB (0x00000020)
149#define SD_STATUS_CF (0x00000040)
150#define SD_STATUS_D3 (0x00000080)
151#define SD_STATUS_xx2 (0x00000300)
152#define SD_STATUS_NE (0x00000400)
153#define SD_STATUS_TU (0x00000800)
154#define SD_STATUS_TO (0x00001000)
155#define SD_STATUS_RU (0x00002000)
156#define SD_STATUS_RO (0x00004000)
157#define SD_STATUS_I (0x00008000)
158#define SD_STATUS_CR (0x00010000)
159#define SD_STATUS_RAT (0x00020000)
160#define SD_STATUS_DD (0x00040000)
161#define SD_STATUS_DT (0x00080000)
162#define SD_STATUS_SC (0x00100000)
163#define SD_STATUS_RC (0x00200000)
164#define SD_STATUS_WC (0x00400000)
165#define SD_STATUS_xx3 (0x00800000)
166#define SD_STATUS_TH (0x01000000)
167#define SD_STATUS_TE (0x02000000)
168#define SD_STATUS_TA (0x04000000)
169#define SD_STATUS_RH (0x08000000)
170#define SD_STATUS_RA (0x10000000)
171#define SD_STATUS_RF (0x20000000)
172#define SD_STATUS_CD (0x40000000)
173#define SD_STATUS_SI (0x80000000)
174
175
176/*
177 * SD_CMD bit definitions.
178 */
179#define SD_CMD_GO (0x00000001)
180#define SD_CMD_RY (0x00000002)
181#define SD_CMD_xx1 (0x0000000c)
182#define SD_CMD_CT_MASK (0x000000f0)
183#define SD_CMD_CT_0 (0x00000000)
184#define SD_CMD_CT_1 (0x00000010)
185#define SD_CMD_CT_2 (0x00000020)
186#define SD_CMD_CT_3 (0x00000030)
187#define SD_CMD_CT_4 (0x00000040)
188#define SD_CMD_CT_5 (0x00000050)
189#define SD_CMD_CT_6 (0x00000060)
190#define SD_CMD_CT_7 (0x00000070)
191#define SD_CMD_CI (0x0000ff00)
192#define SD_CMD_CI_SHIFT (8)
193#define SD_CMD_RT_MASK (0x00ff0000)
194#define SD_CMD_RT_0 (0x00000000)
195#define SD_CMD_RT_1 (0x00010000)
196#define SD_CMD_RT_2 (0x00020000)
197#define SD_CMD_RT_3 (0x00030000)
198#define SD_CMD_RT_4 (0x00040000)
199#define SD_CMD_RT_5 (0x00050000)
200#define SD_CMD_RT_6 (0x00060000)
201#define SD_CMD_RT_1B (0x00810000)
202
203
204#endif /* __ASM_AU1100_MMC_H */
205
diff --git a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
new file mode 100644
index 000000000000..d5eb88cd7d51
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
@@ -0,0 +1,299 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Include file for Alchemy Semiconductor's Au1550 Descriptor
5 * Based DMA Controller.
6 *
7 * Copyright 2004 Embedded Edge, LLC
8 * dan@embeddededge.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31/* Specifics for the Au1xxx Descriptor-Based DMA Controllers, first
32 * seen in the AU1550 part.
33 */
34#ifndef _AU1000_DBDMA_H_
35#define _AU1000_DBDMA_H_
36
37#include <linux/config.h>
38
39#ifndef _LANGUAGE_ASSEMBLY
40
41/* The DMA base addresses.
42 * The Channels are every 256 bytes (0x0100) from the channel 0 base.
43 * Interrupt status/enable is bits 15:0 for channels 15 to zero.
44 */
45#define DDMA_GLOBAL_BASE 0xb4003000
46#define DDMA_CHANNEL_BASE 0xb4002000
47
48typedef struct dbdma_global {
49 u32 ddma_config;
50 u32 ddma_intstat;
51 u32 ddma_throttle;
52 u32 ddma_inten;
53} dbdma_global_t;
54
55/* General Configuration.
56*/
57#define DDMA_CONFIG_AF (1 << 2)
58#define DDMA_CONFIG_AH (1 << 1)
59#define DDMA_CONFIG_AL (1 << 0)
60
61#define DDMA_THROTTLE_EN (1 << 31)
62
63/* The structure of a DMA Channel.
64*/
65typedef struct au1xxx_dma_channel {
66 u32 ddma_cfg; /* See below */
67 u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */
68 u32 ddma_statptr; /* word aligned pointer to status word */
69 u32 ddma_dbell; /* A write activates channel operation */
70 u32 ddma_irq; /* If bit 0 set, interrupt pending */
71 u32 ddma_stat; /* See below */
72 u32 ddma_bytecnt; /* Byte count, valid only when chan idle */
73 /* Remainder, up to the 256 byte boundary, is reserved.
74 */
75} au1x_dma_chan_t;
76
77#define DDMA_CFG_SED (1 << 9) /* source DMA level/edge detect */
78#define DDMA_CFG_SP (1 << 8) /* source DMA polarity */
79#define DDMA_CFG_DED (1 << 7) /* destination DMA level/edge detect */
80#define DDMA_CFG_DP (1 << 6) /* destination DMA polarity */
81#define DDMA_CFG_SYNC (1 << 5) /* Sync static bus controller */
82#define DDMA_CFG_PPR (1 << 4) /* PCI posted read/write control */
83#define DDMA_CFG_DFN (1 << 3) /* Descriptor fetch non-coherent */
84#define DDMA_CFG_SBE (1 << 2) /* Source big endian */
85#define DDMA_CFG_DBE (1 << 1) /* Destination big endian */
86#define DDMA_CFG_EN (1 << 0) /* Channel enable */
87
88/* Always set when descriptor processing done, regardless of
89 * interrupt enable state. Reflected in global intstat, don't
90 * clear this until global intstat is read/used.
91 */
92#define DDMA_IRQ_IN (1 << 0)
93
94#define DDMA_STAT_DB (1 << 2) /* Doorbell pushed */
95#define DDMA_STAT_V (1 << 1) /* Descriptor valid */
96#define DDMA_STAT_H (1 << 0) /* Channel Halted */
97
98/* "Standard" DDMA Descriptor.
99 * Must be 32-byte aligned.
100 */
101typedef struct au1xxx_ddma_desc {
102 u32 dscr_cmd0; /* See below */
103 u32 dscr_cmd1; /* See below */
104 u32 dscr_source0; /* source phys address */
105 u32 dscr_source1; /* See below */
106 u32 dscr_dest0; /* Destination address */
107 u32 dscr_dest1; /* See below */
108 u32 dscr_stat; /* completion status */
109 u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */
110} au1x_ddma_desc_t;
111
112#define DSCR_CMD0_V (1 << 31) /* Descriptor valid */
113#define DSCR_CMD0_MEM (1 << 30) /* mem-mem transfer */
114#define DSCR_CMD0_SID_MASK (0x1f << 25) /* Source ID */
115#define DSCR_CMD0_DID_MASK (0x1f << 20) /* Destination ID */
116#define DSCR_CMD0_SW_MASK (0x3 << 18) /* Source Width */
117#define DSCR_CMD0_DW_MASK (0x3 << 16) /* Destination Width */
118#define DSCR_CMD0_ARB (0x1 << 15) /* Set for Hi Pri */
119#define DSCR_CMD0_DT_MASK (0x3 << 13) /* Descriptor Type */
120#define DSCR_CMD0_SN (0x1 << 12) /* Source non-coherent */
121#define DSCR_CMD0_DN (0x1 << 11) /* Destination non-coherent */
122#define DSCR_CMD0_SM (0x1 << 10) /* Stride mode */
123#define DSCR_CMD0_IE (0x1 << 8) /* Interrupt Enable */
124#define DSCR_CMD0_SP (0x1 << 4) /* Status pointer select */
125#define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */
126#define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */
127
128/* Command 0 device IDs.
129*/
130#define DSCR_CMD0_UART0_TX 0
131#define DSCR_CMD0_UART0_RX 1
132#define DSCR_CMD0_UART3_TX 2
133#define DSCR_CMD0_UART3_RX 3
134#define DSCR_CMD0_DMA_REQ0 4
135#define DSCR_CMD0_DMA_REQ1 5
136#define DSCR_CMD0_DMA_REQ2 6
137#define DSCR_CMD0_DMA_REQ3 7
138#define DSCR_CMD0_USBDEV_RX0 8
139#define DSCR_CMD0_USBDEV_TX0 9
140#define DSCR_CMD0_USBDEV_TX1 10
141#define DSCR_CMD0_USBDEV_TX2 11
142#define DSCR_CMD0_USBDEV_RX3 12
143#define DSCR_CMD0_USBDEV_RX4 13
144#define DSCR_CMD0_PSC0_TX 14
145#define DSCR_CMD0_PSC0_RX 15
146#define DSCR_CMD0_PSC1_TX 16
147#define DSCR_CMD0_PSC1_RX 17
148#define DSCR_CMD0_PSC2_TX 18
149#define DSCR_CMD0_PSC2_RX 19
150#define DSCR_CMD0_PSC3_TX 20
151#define DSCR_CMD0_PSC3_RX 21
152#define DSCR_CMD0_PCI_WRITE 22
153#define DSCR_CMD0_NAND_FLASH 23
154#define DSCR_CMD0_MAC0_RX 24
155#define DSCR_CMD0_MAC0_TX 25
156#define DSCR_CMD0_MAC1_RX 26
157#define DSCR_CMD0_MAC1_TX 27
158#define DSCR_CMD0_THROTTLE 30
159#define DSCR_CMD0_ALWAYS 31
160#define DSCR_NDEV_IDS 32
161
162#define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25)
163#define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20)
164
165/* Source/Destination transfer width.
166*/
167#define DSCR_CMD0_BYTE 0
168#define DSCR_CMD0_HALFWORD 1
169#define DSCR_CMD0_WORD 2
170
171#define DSCR_CMD0_SW(x) (((x) & 0x3) << 18)
172#define DSCR_CMD0_DW(x) (((x) & 0x3) << 16)
173
174/* DDMA Descriptor Type.
175*/
176#define DSCR_CMD0_STANDARD 0
177#define DSCR_CMD0_LITERAL 1
178#define DSCR_CMD0_CMP_BRANCH 2
179
180#define DSCR_CMD0_DT(x) (((x) & 0x3) << 13)
181
182/* Status Instruction.
183*/
184#define DSCR_CMD0_ST_NOCHANGE 0 /* Don't change */
185#define DSCR_CMD0_ST_CURRENT 1 /* Write current status */
186#define DSCR_CMD0_ST_CMD0 2 /* Write cmd0 with V cleared */
187#define DSCR_CMD0_ST_BYTECNT 3 /* Write remaining byte count */
188
189#define DSCR_CMD0_ST(x) (((x) & 0x3) << 0)
190
191/* Descriptor Command 1
192*/
193#define DSCR_CMD1_SUPTR_MASK (0xf << 28) /* upper 4 bits of src addr */
194#define DSCR_CMD1_DUPTR_MASK (0xf << 24) /* upper 4 bits of dest addr */
195#define DSCR_CMD1_FL_MASK (0x3 << 22) /* Flag bits */
196#define DSCR_CMD1_BC_MASK (0x3fffff) /* Byte count */
197
198/* Flag description.
199*/
200#define DSCR_CMD1_FL_MEM_STRIDE0 0
201#define DSCR_CMD1_FL_MEM_STRIDE1 1
202#define DSCR_CMD1_FL_MEM_STRIDE2 2
203
204#define DSCR_CMD1_FL(x) (((x) & 0x3) << 22)
205
206/* Source1, 1-dimensional stride.
207*/
208#define DSCR_SRC1_STS_MASK (3 << 30) /* Src xfer size */
209#define DSCR_SRC1_SAM_MASK (3 << 28) /* Src xfer movement */
210#define DSCR_SRC1_SB_MASK (0x3fff << 14) /* Block size */
211#define DSCR_SRC1_SB(x) (((x) & 0x3fff) << 14)
212#define DSCR_SRC1_SS_MASK (0x3fff << 0) /* Stride */
213#define DSCR_SRC1_SS(x) (((x) & 0x3fff) << 0)
214
215/* Dest1, 1-dimensional stride.
216*/
217#define DSCR_DEST1_DTS_MASK (3 << 30) /* Dest xfer size */
218#define DSCR_DEST1_DAM_MASK (3 << 28) /* Dest xfer movement */
219#define DSCR_DEST1_DB_MASK (0x3fff << 14) /* Block size */
220#define DSCR_DEST1_DB(x) (((x) & 0x3fff) << 14)
221#define DSCR_DEST1_DS_MASK (0x3fff << 0) /* Stride */
222#define DSCR_DEST1_DS(x) (((x) & 0x3fff) << 0)
223
224#define DSCR_xTS_SIZE1 0
225#define DSCR_xTS_SIZE2 1
226#define DSCR_xTS_SIZE4 2
227#define DSCR_xTS_SIZE8 3
228#define DSCR_SRC1_STS(x) (((x) & 3) << 30)
229#define DSCR_DEST1_DTS(x) (((x) & 3) << 30)
230
231#define DSCR_xAM_INCREMENT 0
232#define DSCR_xAM_DECREMENT 1
233#define DSCR_xAM_STATIC 2
234#define DSCR_xAM_BURST 3
235#define DSCR_SRC1_SAM(x) (((x) & 3) << 28)
236#define DSCR_DEST1_DAM(x) (((x) & 3) << 28)
237
238/* The next descriptor pointer.
239*/
240#define DSCR_NXTPTR_MASK (0x07ffffff)
241#define DSCR_NXTPTR(x) ((x) >> 5)
242#define DSCR_GET_NXTPTR(x) ((x) << 5)
243#define DSCR_NXTPTR_MS (1 << 27)
244
245/* The number of DBDMA channels.
246*/
247#define NUM_DBDMA_CHANS 16
248
249/* External functions for drivers to use.
250*/
251/* Use this to allocate a dbdma channel. The device ids are one of the
252 * DSCR_CMD0 devices IDs, which is usually redefined to a more
253 * meaningful name. The 'callback' is called during dma completion
254 * interrupt.
255 */
256u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
257 void (*callback)(int, void *, struct pt_regs *), void *callparam);
258
259#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS
260
261/* ACK! These should be in a board specific description file.
262*/
263#ifdef CONFIG_MIPS_PB1550
264#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
265#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
266#endif
267#ifdef CONFIG_MIPS_DB1550
268#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
269#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
270#endif
271
272
273/* Set the device width of a in/out fifo.
274*/
275u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits);
276
277/* Allocate a ring of descriptors for dbdma.
278*/
279u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries);
280
281/* Put buffers on source/destination descriptors.
282*/
283u32 au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes);
284u32 au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes);
285
286/* Get a buffer from the destination descriptor.
287*/
288u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes);
289
290void au1xxx_dbdma_stop(u32 chanid);
291void au1xxx_dbdma_start(u32 chanid);
292void au1xxx_dbdma_reset(u32 chanid);
293u32 au1xxx_get_dma_residue(u32 chanid);
294
295void au1xxx_dbdma_chan_free(u32 chanid);
296void au1xxx_dbdma_dump(u32 chanid);
297
298#endif /* _LANGUAGE_ASSEMBLY */
299#endif /* _AU1000_DBDMA_H_ */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_psc.h b/include/asm-mips/mach-au1x00/au1xxx_psc.h
new file mode 100644
index 000000000000..283519dfdec4
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/au1xxx_psc.h
@@ -0,0 +1,522 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Include file for Alchemy Semiconductor's Au1k CPU.
5 *
6 * Copyright 2004 Embedded Edge, LLC
7 * dan@embeddededge.com
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30/* Specifics for the Au1xxx Programmable Serial Controllers, first
31 * seen in the AU1550 part.
32 */
33#ifndef _AU1000_PSC_H_
34#define _AU1000_PSC_H_
35
36/* The PSC base addresses. */
37#ifdef CONFIG_SOC_AU1550
38#define PSC0_BASE_ADDR 0xb1a00000
39#define PSC1_BASE_ADDR 0xb1b00000
40#define PSC2_BASE_ADDR 0xb0a00000
41#define PSC3_BASE_ADDR 0xb0d00000
42#endif
43
44/* The PSC select and control registers are common to
45 * all protocols.
46 */
47#define PSC_SEL_OFFSET 0x00000000
48#define PSC_CTRL_OFFSET 0x00000004
49
50#define PSC_SEL_CLK_MASK (3 << 4)
51#define PSC_SEL_CLK_INTCLK (0 << 4)
52#define PSC_SEL_CLK_EXTCLK (1 << 4)
53#define PSC_SEL_CLK_SERCLK (2 << 4)
54
55#define PSC_SEL_PS_MASK 0x00000007
56#define PSC_SEL_PS_DISABLED (0)
57#define PSC_SEL_PS_SPIMODE (2)
58#define PSC_SEL_PS_I2SMODE (3)
59#define PSC_SEL_PS_AC97MODE (4)
60#define PSC_SEL_PS_SMBUSMODE (5)
61
62#define PSC_CTRL_DISABLE (0)
63#define PSC_CTRL_SUSPEND (2)
64#define PSC_CTRL_ENABLE (3)
65
66/* AC97 Registers.
67*/
68#define PSC_AC97CFG_OFFSET 0x00000008
69#define PSC_AC97MSK_OFFSET 0x0000000c
70#define PSC_AC97PCR_OFFSET 0x00000010
71#define PSC_AC97STAT_OFFSET 0x00000014
72#define PSC_AC97EVNT_OFFSET 0x00000018
73#define PSC_AC97TXRX_OFFSET 0x0000001c
74#define PSC_AC97CDC_OFFSET 0x00000020
75#define PSC_AC97RST_OFFSET 0x00000024
76#define PSC_AC97GPO_OFFSET 0x00000028
77#define PSC_AC97GPI_OFFSET 0x0000002c
78
79#define AC97_PSC_SEL (AC97_PSC_BASE + PSC_SEL_OFFSET)
80#define AC97_PSC_CTRL (AC97_PSC_BASE + PSC_CTRL_OFFSET)
81#define PSC_AC97CFG (AC97_PSC_BASE + PSC_AC97CFG_OFFSET)
82#define PSC_AC97MSK (AC97_PSC_BASE + PSC_AC97MSK_OFFSET)
83#define PSC_AC97PCR (AC97_PSC_BASE + PSC_AC97PCR_OFFSET)
84#define PSC_AC97STAT (AC97_PSC_BASE + PSC_AC97STAT_OFFSET)
85#define PSC_AC97EVNT (AC97_PSC_BASE + PSC_AC97EVNT_OFFSET)
86#define PSC_AC97TXRX (AC97_PSC_BASE + PSC_AC97TXRX_OFFSET)
87#define PSC_AC97CDC (AC97_PSC_BASE + PSC_AC97CDC_OFFSET)
88#define PSC_AC97RST (AC97_PSC_BASE + PSC_AC97RST_OFFSET)
89#define PSC_AC97GPO (AC97_PSC_BASE + PSC_AC97GPO_OFFSET)
90#define PSC_AC97GPI (AC97_PSC_BASE + PSC_AC97GPI_OFFSET)
91
92/* AC97 Config Register.
93*/
94#define PSC_AC97CFG_RT_MASK (3 << 30)
95#define PSC_AC97CFG_RT_FIFO1 (0 << 30)
96#define PSC_AC97CFG_RT_FIFO2 (1 << 30)
97#define PSC_AC97CFG_RT_FIFO4 (2 << 30)
98#define PSC_AC97CFG_RT_FIFO8 (3 << 30)
99
100#define PSC_AC97CFG_TT_MASK (3 << 28)
101#define PSC_AC97CFG_TT_FIFO1 (0 << 28)
102#define PSC_AC97CFG_TT_FIFO2 (1 << 28)
103#define PSC_AC97CFG_TT_FIFO4 (2 << 28)
104#define PSC_AC97CFG_TT_FIFO8 (3 << 28)
105
106#define PSC_AC97CFG_DD_DISABLE (1 << 27)
107#define PSC_AC97CFG_DE_ENABLE (1 << 26)
108#define PSC_AC97CFG_SE_ENABLE (1 << 25)
109
110#define PSC_AC97CFG_LEN_MASK (0xf << 21)
111#define PSC_AC97CFG_TXSLOT_MASK (0x3ff << 11)
112#define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1)
113#define PSC_AC97CFG_GE_ENABLE (1)
114
115/* Enable slots 3-12.
116*/
117#define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11))
118#define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1))
119
120/* The word length equation is ((x) * 2) + 2, so choose 'x' appropriately.
121 * The only sensible numbers are 7, 9, or possibly 11. Nah, just do the
122 * arithmetic in the macro.
123 */
124#define PSC_AC97CFG_SET_LEN(x) (((((x)-2)/2) & 0xf) << 21)
125#define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2)
126
127/* AC97 Mask Register.
128*/
129#define PSC_AC97MSK_GR (1 << 25)
130#define PSC_AC97MSK_CD (1 << 24)
131#define PSC_AC97MSK_RR (1 << 13)
132#define PSC_AC97MSK_RO (1 << 12)
133#define PSC_AC97MSK_RU (1 << 11)
134#define PSC_AC97MSK_TR (1 << 10)
135#define PSC_AC97MSK_TO (1 << 9)
136#define PSC_AC97MSK_TU (1 << 8)
137#define PSC_AC97MSK_RD (1 << 5)
138#define PSC_AC97MSK_TD (1 << 4)
139#define PSC_AC97MSK_ALLMASK (PSC_AC97MSK_GR | PSC_AC97MSK_CD | \
140 PSC_AC97MSK_RR | PSC_AC97MSK_RO | \
141 PSC_AC97MSK_RU | PSC_AC97MSK_TR | \
142 PSC_AC97MSK_TO | PSC_AC97MSK_TU | \
143 PSC_AC97MSK_RD | PSC_AC97MSK_TD)
144
145/* AC97 Protocol Control Register.
146*/
147#define PSC_AC97PCR_RC (1 << 6)
148#define PSC_AC97PCR_RP (1 << 5)
149#define PSC_AC97PCR_RS (1 << 4)
150#define PSC_AC97PCR_TC (1 << 2)
151#define PSC_AC97PCR_TP (1 << 1)
152#define PSC_AC97PCR_TS (1 << 0)
153
154/* AC97 Status register (read only).
155*/
156#define PSC_AC97STAT_CB (1 << 26)
157#define PSC_AC97STAT_CP (1 << 25)
158#define PSC_AC97STAT_CR (1 << 24)
159#define PSC_AC97STAT_RF (1 << 13)
160#define PSC_AC97STAT_RE (1 << 12)
161#define PSC_AC97STAT_RR (1 << 11)
162#define PSC_AC97STAT_TF (1 << 10)
163#define PSC_AC97STAT_TE (1 << 9)
164#define PSC_AC97STAT_TR (1 << 8)
165#define PSC_AC97STAT_RB (1 << 5)
166#define PSC_AC97STAT_TB (1 << 4)
167#define PSC_AC97STAT_DI (1 << 2)
168#define PSC_AC97STAT_DR (1 << 1)
169#define PSC_AC97STAT_SR (1 << 0)
170
171/* AC97 Event Register.
172*/
173#define PSC_AC97EVNT_GR (1 << 25)
174#define PSC_AC97EVNT_CD (1 << 24)
175#define PSC_AC97EVNT_RR (1 << 13)
176#define PSC_AC97EVNT_RO (1 << 12)
177#define PSC_AC97EVNT_RU (1 << 11)
178#define PSC_AC97EVNT_TR (1 << 10)
179#define PSC_AC97EVNT_TO (1 << 9)
180#define PSC_AC97EVNT_TU (1 << 8)
181#define PSC_AC97EVNT_RD (1 << 5)
182#define PSC_AC97EVNT_TD (1 << 4)
183
184/* CODEC Command Register.
185*/
186#define PSC_AC97CDC_RD (1 << 25)
187#define PSC_AC97CDC_ID_MASK (3 << 23)
188#define PSC_AC97CDC_INDX_MASK (0x7f << 16)
189#define PSC_AC97CDC_ID(x) (((x) & 0x3) << 23)
190#define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16)
191
192/* AC97 Reset Control Register.
193*/
194#define PSC_AC97RST_RST (1 << 1)
195#define PSC_AC97RST_SNC (1 << 0)
196
197
198/* PSC in I2S Mode.
199*/
200typedef struct psc_i2s {
201 u32 psc_sel;
202 u32 psc_ctrl;
203 u32 psc_i2scfg;
204 u32 psc_i2smsk;
205 u32 psc_i2spcr;
206 u32 psc_i2sstat;
207 u32 psc_i2sevent;
208 u32 psc_i2stxrx;
209 u32 psc_i2sudf;
210} psc_i2s_t;
211
212/* I2S Config Register.
213*/
214#define PSC_I2SCFG_RT_MASK (3 << 30)
215#define PSC_I2SCFG_RT_FIFO1 (0 << 30)
216#define PSC_I2SCFG_RT_FIFO2 (1 << 30)
217#define PSC_I2SCFG_RT_FIFO4 (2 << 30)
218#define PSC_I2SCFG_RT_FIFO8 (3 << 30)
219
220#define PSC_I2SCFG_TT_MASK (3 << 28)
221#define PSC_I2SCFG_TT_FIFO1 (0 << 28)
222#define PSC_I2SCFG_TT_FIFO2 (1 << 28)
223#define PSC_I2SCFG_TT_FIFO4 (2 << 28)
224#define PSC_I2SCFG_TT_FIFO8 (3 << 28)
225
226#define PSC_I2SCFG_DD_DISABLE (1 << 27)
227#define PSC_I2SCFG_DE_ENABLE (1 << 26)
228#define PSC_I2SCFG_SET_WS(x) (((((x) / 2) - 1) & 0x7f) << 16)
229#define PSC_I2SCFG_WI (1 << 15)
230
231#define PSC_I2SCFG_DIV_MASK (3 << 13)
232#define PSC_I2SCFG_DIV2 (0 << 13)
233#define PSC_I2SCFG_DIV4 (1 << 13)
234#define PSC_I2SCFG_DIV8 (2 << 13)
235#define PSC_I2SCFG_DIV16 (3 << 13)
236
237#define PSC_I2SCFG_BI (1 << 12)
238#define PSC_I2SCFG_BUF (1 << 11)
239#define PSC_I2SCFG_MLJ (1 << 10)
240#define PSC_I2SCFG_XM (1 << 9)
241
242/* The word length equation is simply LEN+1.
243 */
244#define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4)
245#define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1)
246
247#define PSC_I2SCFG_LB (1 << 2)
248#define PSC_I2SCFG_MLF (1 << 1)
249#define PSC_I2SCFG_MS (1 << 0)
250
251/* I2S Mask Register.
252*/
253#define PSC_I2SMSK_RR (1 << 13)
254#define PSC_I2SMSK_RO (1 << 12)
255#define PSC_I2SMSK_RU (1 << 11)
256#define PSC_I2SMSK_TR (1 << 10)
257#define PSC_I2SMSK_TO (1 << 9)
258#define PSC_I2SMSK_TU (1 << 8)
259#define PSC_I2SMSK_RD (1 << 5)
260#define PSC_I2SMSK_TD (1 << 4)
261#define PSC_I2SMSK_ALLMASK (PSC_I2SMSK_RR | PSC_I2SMSK_RO | \
262 PSC_I2SMSK_RU | PSC_I2SMSK_TR | \
263 PSC_I2SMSK_TO | PSC_I2SMSK_TU | \
264 PSC_I2SMSK_RD | PSC_I2SMSK_TD)
265
266/* I2S Protocol Control Register.
267*/
268#define PSC_I2SPCR_RC (1 << 6)
269#define PSC_I2SPCR_RP (1 << 5)
270#define PSC_I2SPCR_RS (1 << 4)
271#define PSC_I2SPCR_TC (1 << 2)
272#define PSC_I2SPCR_TP (1 << 1)
273#define PSC_I2SPCR_TS (1 << 0)
274
275/* I2S Status register (read only).
276*/
277#define PSC_I2SSTAT_RF (1 << 13)
278#define PSC_I2SSTAT_RE (1 << 12)
279#define PSC_I2SSTAT_RR (1 << 11)
280#define PSC_I2SSTAT_TF (1 << 10)
281#define PSC_I2SSTAT_TE (1 << 9)
282#define PSC_I2SSTAT_TR (1 << 8)
283#define PSC_I2SSTAT_RB (1 << 5)
284#define PSC_I2SSTAT_TB (1 << 4)
285#define PSC_I2SSTAT_DI (1 << 2)
286#define PSC_I2SSTAT_DR (1 << 1)
287#define PSC_I2SSTAT_SR (1 << 0)
288
289/* I2S Event Register.
290*/
291#define PSC_I2SEVNT_RR (1 << 13)
292#define PSC_I2SEVNT_RO (1 << 12)
293#define PSC_I2SEVNT_RU (1 << 11)
294#define PSC_I2SEVNT_TR (1 << 10)
295#define PSC_I2SEVNT_TO (1 << 9)
296#define PSC_I2SEVNT_TU (1 << 8)
297#define PSC_I2SEVNT_RD (1 << 5)
298#define PSC_I2SEVNT_TD (1 << 4)
299
300/* PSC in SPI Mode.
301*/
302typedef struct psc_spi {
303 u32 psc_sel;
304 u32 psc_ctrl;
305 u32 psc_spicfg;
306 u32 psc_spimsk;
307 u32 psc_spipcr;
308 u32 psc_spistat;
309 u32 psc_spievent;
310 u32 psc_spitxrx;
311} psc_spi_t;
312
313/* SPI Config Register.
314*/
315#define PSC_SPICFG_RT_MASK (3 << 30)
316#define PSC_SPICFG_RT_FIFO1 (0 << 30)
317#define PSC_SPICFG_RT_FIFO2 (1 << 30)
318#define PSC_SPICFG_RT_FIFO4 (2 << 30)
319#define PSC_SPICFG_RT_FIFO8 (3 << 30)
320
321#define PSC_SPICFG_TT_MASK (3 << 28)
322#define PSC_SPICFG_TT_FIFO1 (0 << 28)
323#define PSC_SPICFG_TT_FIFO2 (1 << 28)
324#define PSC_SPICFG_TT_FIFO4 (2 << 28)
325#define PSC_SPICFG_TT_FIFO8 (3 << 28)
326
327#define PSC_SPICFG_DD_DISABLE (1 << 27)
328#define PSC_SPICFG_DE_ENABLE (1 << 26)
329#define PSC_SPICFG_CLR_BAUD(x) ((x) & ~((0x3f) << 15))
330#define PSC_SPICFG_SET_BAUD(x) (((x) & 0x3f) << 15)
331
332#define PSC_SPICFG_SET_DIV(x) (((x) & 0x03) << 13)
333#define PSC_SPICFG_DIV2 0
334#define PSC_SPICFG_DIV4 1
335#define PSC_SPICFG_DIV8 2
336#define PSC_SPICFG_DIV16 3
337
338#define PSC_SPICFG_BI (1 << 12)
339#define PSC_SPICFG_PSE (1 << 11)
340#define PSC_SPICFG_CGE (1 << 10)
341#define PSC_SPICFG_CDE (1 << 9)
342
343#define PSC_SPICFG_CLR_LEN(x) ((x) & ~((0x1f) << 4))
344#define PSC_SPICFG_SET_LEN(x) (((x-1) & 0x1f) << 4)
345
346#define PSC_SPICFG_LB (1 << 3)
347#define PSC_SPICFG_MLF (1 << 1)
348#define PSC_SPICFG_MO (1 << 0)
349
350/* SPI Mask Register.
351*/
352#define PSC_SPIMSK_MM (1 << 16)
353#define PSC_SPIMSK_RR (1 << 13)
354#define PSC_SPIMSK_RO (1 << 12)
355#define PSC_SPIMSK_RU (1 << 11)
356#define PSC_SPIMSK_TR (1 << 10)
357#define PSC_SPIMSK_TO (1 << 9)
358#define PSC_SPIMSK_TU (1 << 8)
359#define PSC_SPIMSK_SD (1 << 5)
360#define PSC_SPIMSK_MD (1 << 4)
361#define PSC_SPIMSK_ALLMASK (PSC_SPIMSK_MM | PSC_SPIMSK_RR | \
362 PSC_SPIMSK_RO | PSC_SPIMSK_TO | \
363 PSC_SPIMSK_TU | PSC_SPIMSK_SD | \
364 PSC_SPIMSK_MD)
365
366/* SPI Protocol Control Register.
367*/
368#define PSC_SPIPCR_RC (1 << 6)
369#define PSC_SPIPCR_SP (1 << 5)
370#define PSC_SPIPCR_SS (1 << 4)
371#define PSC_SPIPCR_TC (1 << 2)
372#define PSC_SPIPCR_MS (1 << 0)
373
374/* SPI Status register (read only).
375*/
376#define PSC_SPISTAT_RF (1 << 13)
377#define PSC_SPISTAT_RE (1 << 12)
378#define PSC_SPISTAT_RR (1 << 11)
379#define PSC_SPISTAT_TF (1 << 10)
380#define PSC_SPISTAT_TE (1 << 9)
381#define PSC_SPISTAT_TR (1 << 8)
382#define PSC_SPISTAT_SB (1 << 5)
383#define PSC_SPISTAT_MB (1 << 4)
384#define PSC_SPISTAT_DI (1 << 2)
385#define PSC_SPISTAT_DR (1 << 1)
386#define PSC_SPISTAT_SR (1 << 0)
387
388/* SPI Event Register.
389*/
390#define PSC_SPIEVNT_MM (1 << 16)
391#define PSC_SPIEVNT_RR (1 << 13)
392#define PSC_SPIEVNT_RO (1 << 12)
393#define PSC_SPIEVNT_RU (1 << 11)
394#define PSC_SPIEVNT_TR (1 << 10)
395#define PSC_SPIEVNT_TO (1 << 9)
396#define PSC_SPIEVNT_TU (1 << 8)
397#define PSC_SPIEVNT_SD (1 << 5)
398#define PSC_SPIEVNT_MD (1 << 4)
399
400/* Transmit register control.
401*/
402#define PSC_SPITXRX_LC (1 << 29)
403#define PSC_SPITXRX_SR (1 << 28)
404
405/* PSC in SMBus (I2C) Mode.
406*/
407typedef struct psc_smb {
408 u32 psc_sel;
409 u32 psc_ctrl;
410 u32 psc_smbcfg;
411 u32 psc_smbmsk;
412 u32 psc_smbpcr;
413 u32 psc_smbstat;
414 u32 psc_smbevnt;
415 u32 psc_smbtxrx;
416 u32 psc_smbtmr;
417} psc_smb_t;
418
419/* SMBus Config Register.
420*/
421#define PSC_SMBCFG_RT_MASK (3 << 30)
422#define PSC_SMBCFG_RT_FIFO1 (0 << 30)
423#define PSC_SMBCFG_RT_FIFO2 (1 << 30)
424#define PSC_SMBCFG_RT_FIFO4 (2 << 30)
425#define PSC_SMBCFG_RT_FIFO8 (3 << 30)
426
427#define PSC_SMBCFG_TT_MASK (3 << 28)
428#define PSC_SMBCFG_TT_FIFO1 (0 << 28)
429#define PSC_SMBCFG_TT_FIFO2 (1 << 28)
430#define PSC_SMBCFG_TT_FIFO4 (2 << 28)
431#define PSC_SMBCFG_TT_FIFO8 (3 << 28)
432
433#define PSC_SMBCFG_DD_DISABLE (1 << 27)
434#define PSC_SMBCFG_DE_ENABLE (1 << 26)
435
436#define PSC_SMBCFG_SET_DIV(x) (((x) & 0x03) << 13)
437#define PSC_SMBCFG_DIV2 0
438#define PSC_SMBCFG_DIV4 1
439#define PSC_SMBCFG_DIV8 2
440#define PSC_SMBCFG_DIV16 3
441
442#define PSC_SMBCFG_GCE (1 << 9)
443#define PSC_SMBCFG_SFM (1 << 8)
444
445#define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1)
446
447/* SMBus Mask Register.
448*/
449#define PSC_SMBMSK_DN (1 << 30)
450#define PSC_SMBMSK_AN (1 << 29)
451#define PSC_SMBMSK_AL (1 << 28)
452#define PSC_SMBMSK_RR (1 << 13)
453#define PSC_SMBMSK_RO (1 << 12)
454#define PSC_SMBMSK_RU (1 << 11)
455#define PSC_SMBMSK_TR (1 << 10)
456#define PSC_SMBMSK_TO (1 << 9)
457#define PSC_SMBMSK_TU (1 << 8)
458#define PSC_SMBMSK_SD (1 << 5)
459#define PSC_SMBMSK_MD (1 << 4)
460#define PSC_SMBMSK_ALLMASK (PSC_SMBMSK_DN | PSC_SMBMSK_AN | \
461 PSC_SMBMSK_AL | PSC_SMBMSK_RR | \
462 PSC_SMBMSK_RO | PSC_SMBMSK_TO | \
463 PSC_SMBMSK_TU | PSC_SMBMSK_SD | \
464 PSC_SMBMSK_MD)
465
466/* SMBus Protocol Control Register.
467*/
468#define PSC_SMBPCR_DC (1 << 2)
469#define PSC_SMBPCR_MS (1 << 0)
470
471/* SMBus Status register (read only).
472*/
473#define PSC_SMBSTAT_BB (1 << 28)
474#define PSC_SMBSTAT_RF (1 << 13)
475#define PSC_SMBSTAT_RE (1 << 12)
476#define PSC_SMBSTAT_RR (1 << 11)
477#define PSC_SMBSTAT_TF (1 << 10)
478#define PSC_SMBSTAT_TE (1 << 9)
479#define PSC_SMBSTAT_TR (1 << 8)
480#define PSC_SMBSTAT_SB (1 << 5)
481#define PSC_SMBSTAT_MB (1 << 4)
482#define PSC_SMBSTAT_DI (1 << 2)
483#define PSC_SMBSTAT_DR (1 << 1)
484#define PSC_SMBSTAT_SR (1 << 0)
485
486/* SMBus Event Register.
487*/
488#define PSC_SMBEVNT_DN (1 << 30)
489#define PSC_SMBEVNT_AN (1 << 29)
490#define PSC_SMBEVNT_AL (1 << 28)
491#define PSC_SMBEVNT_RR (1 << 13)
492#define PSC_SMBEVNT_RO (1 << 12)
493#define PSC_SMBEVNT_RU (1 << 11)
494#define PSC_SMBEVNT_TR (1 << 10)
495#define PSC_SMBEVNT_TO (1 << 9)
496#define PSC_SMBEVNT_TU (1 << 8)
497#define PSC_SMBEVNT_SD (1 << 5)
498#define PSC_SMBEVNT_MD (1 << 4)
499#define PSC_SMBEVNT_ALLCLR (PSC_SMBEVNT_DN | PSC_SMBEVNT_AN | \
500 PSC_SMBEVNT_AL | PSC_SMBEVNT_RR | \
501 PSC_SMBEVNT_RO | PSC_SMBEVNT_TO | \
502 PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \
503 PSC_SMBEVNT_MD)
504
505/* Transmit register control.
506*/
507#define PSC_SMBTXRX_RSR (1 << 30)
508#define PSC_SMBTXRX_STP (1 << 29)
509#define PSC_SMBTXRX_DATAMASK (0xff)
510
511/* SMBus protocol timers register.
512*/
513#define PSC_SMBTMR_SET_TH(x) (((x) & 0x3) << 30)
514#define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25)
515#define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20)
516#define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15)
517#define PSC_SMBTMR_SET_SU(x) (((x) & 0x1f) << 10)
518#define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5)
519#define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0)
520
521
522#endif /* _AU1000_PSC_H_ */
diff --git a/include/asm-mips/mach-au1x00/timex.h b/include/asm-mips/mach-au1x00/timex.h
new file mode 100644
index 000000000000..e3ada66cb636
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/timex.h
@@ -0,0 +1,13 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_AU1X00_TIMEX_H
9#define __ASM_MACH_AU1X00_TIMEX_H
10
11#define CLOCK_TICK_RATE ((HZ * 100000UL) / 2)
12
13#endif /* __ASM_MACH_AU1X00_TIMEX_H */
diff --git a/include/asm-mips/mach-db1x00/db1x00.h b/include/asm-mips/mach-db1x00/db1x00.h
new file mode 100644
index 000000000000..4691398a414f
--- /dev/null
+++ b/include/asm-mips/mach-db1x00/db1x00.h
@@ -0,0 +1,205 @@
1/*
2 * AMD Alchemy DB1x00 Reference Boards
3 *
4 * Copyright 2001 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc.
6 * ppopov@mvista.com or source@mvista.com
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 *
26 *
27 */
28#ifndef __ASM_DB1X00_H
29#define __ASM_DB1X00_H
30
31#include <linux/config.h>
32
33#ifdef CONFIG_MIPS_DB1550
34#define BCSR_KSEG1_ADDR 0xAF000000
35#define NAND_PHYS_ADDR 0x20000000
36#else
37#define BCSR_KSEG1_ADDR 0xAE000000
38#endif
39
40/*
41 * Overlay data structure of the Db1x00 board registers.
42 * Registers located at physical 0E0000xx, KSEG1 0xAE0000xx
43 */
44typedef volatile struct
45{
46 /*00*/ unsigned short whoami;
47 unsigned short reserved0;
48 /*04*/ unsigned short status;
49 unsigned short reserved1;
50 /*08*/ unsigned short switches;
51 unsigned short reserved2;
52 /*0C*/ unsigned short resets;
53 unsigned short reserved3;
54 /*10*/ unsigned short pcmcia;
55 unsigned short reserved4;
56 /*14*/ unsigned short specific;
57 unsigned short reserved5;
58 /*18*/ unsigned short leds;
59 unsigned short reserved6;
60 /*1C*/ unsigned short swreset;
61 unsigned short reserved7;
62
63} BCSR;
64
65
66/*
67 * Register/mask bit definitions for the BCSRs
68 */
69#define BCSR_WHOAMI_DCID 0x000F
70#define BCSR_WHOAMI_CPLD 0x00F0
71#define BCSR_WHOAMI_BOARD 0x0F00
72
73#define BCSR_STATUS_PC0VS 0x0003
74#define BCSR_STATUS_PC1VS 0x000C
75#define BCSR_STATUS_PC0FI 0x0010
76#define BCSR_STATUS_PC1FI 0x0020
77#define BCSR_STATUS_FLASHBUSY 0x0100
78#define BCSR_STATUS_ROMBUSY 0x0400
79#define BCSR_STATUS_SWAPBOOT 0x2000
80#define BCSR_STATUS_FLASHDEN 0xC000
81
82#define BCSR_SWITCHES_DIP 0x00FF
83#define BCSR_SWITCHES_DIP_1 0x0080
84#define BCSR_SWITCHES_DIP_2 0x0040
85#define BCSR_SWITCHES_DIP_3 0x0020
86#define BCSR_SWITCHES_DIP_4 0x0010
87#define BCSR_SWITCHES_DIP_5 0x0008
88#define BCSR_SWITCHES_DIP_6 0x0004
89#define BCSR_SWITCHES_DIP_7 0x0002
90#define BCSR_SWITCHES_DIP_8 0x0001
91#define BCSR_SWITCHES_ROTARY 0x0F00
92
93#define BCSR_RESETS_PHY0 0x0001
94#define BCSR_RESETS_PHY1 0x0002
95#define BCSR_RESETS_DC 0x0004
96#define BCSR_RESETS_FIR_SEL 0x2000
97#define BCSR_RESETS_IRDA_MODE_MASK 0xC000
98#define BCSR_RESETS_IRDA_MODE_FULL 0x0000
99#define BCSR_RESETS_IRDA_MODE_OFF 0x4000
100#define BCSR_RESETS_IRDA_MODE_2_3 0x8000
101#define BCSR_RESETS_IRDA_MODE_1_3 0xC000
102
103#define BCSR_PCMCIA_PC0VPP 0x0003
104#define BCSR_PCMCIA_PC0VCC 0x000C
105#define BCSR_PCMCIA_PC0DRVEN 0x0010
106#define BCSR_PCMCIA_PC0RST 0x0080
107#define BCSR_PCMCIA_PC1VPP 0x0300
108#define BCSR_PCMCIA_PC1VCC 0x0C00
109#define BCSR_PCMCIA_PC1DRVEN 0x1000
110#define BCSR_PCMCIA_PC1RST 0x8000
111
112#define BCSR_BOARD_PCIM66EN 0x0001
113#define BCSR_BOARD_SD0_PWR 0x0040
114#define BCSR_BOARD_SD1_PWR 0x0080
115#define BCSR_BOARD_PCIM33 0x0100
116#define BCSR_BOARD_GPIO200RST 0x0400
117#define BCSR_BOARD_PCICFG 0x1000
118#define BCSR_BOARD_SD0_WP 0x4000
119#define BCSR_BOARD_SD1_WP 0x8000
120
121#define BCSR_LEDS_DECIMALS 0x0003
122#define BCSR_LEDS_LED0 0x0100
123#define BCSR_LEDS_LED1 0x0200
124#define BCSR_LEDS_LED2 0x0400
125#define BCSR_LEDS_LED3 0x0800
126
127#define BCSR_SWRESET_RESET 0x0080
128
129/* PCMCIA Db1x00 specific defines */
130#define PCMCIA_MAX_SOCK 1
131#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
132
133/* VPP/VCC */
134#define SET_VCC_VPP(VCC, VPP, SLOT)\
135 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
136
137/* SD controller macros */
138/*
139 * Detect card.
140 */
141#define mmc_card_inserted(_n_, _res_) \
142 do { \
143 BCSR * const bcsr = (BCSR *)0xAE000000; \
144 unsigned long mmc_wp, board_specific; \
145 if ((_n_)) { \
146 mmc_wp = BCSR_BOARD_SD1_WP; \
147 } else { \
148 mmc_wp = BCSR_BOARD_SD0_WP; \
149 } \
150 board_specific = au_readl((unsigned long)(&bcsr->specific)); \
151 if (!(board_specific & mmc_wp)) {/* low means card present */ \
152 *(int *)(_res_) = 1; \
153 } else { \
154 *(int *)(_res_) = 0; \
155 } \
156 } while (0)
157
158/*
159 * Apply power to card slot(s).
160 */
161#define mmc_power_on(_n_) \
162 do { \
163 BCSR * const bcsr = (BCSR *)0xAE000000; \
164 unsigned long mmc_pwr, mmc_wp, board_specific; \
165 if ((_n_)) { \
166 mmc_pwr = BCSR_BOARD_SD1_PWR; \
167 mmc_wp = BCSR_BOARD_SD1_WP; \
168 } else { \
169 mmc_pwr = BCSR_BOARD_SD0_PWR; \
170 mmc_wp = BCSR_BOARD_SD0_WP; \
171 } \
172 board_specific = au_readl((unsigned long)(&bcsr->specific)); \
173 if (!(board_specific & mmc_wp)) {/* low means card present */ \
174 board_specific |= mmc_pwr; \
175 au_writel(board_specific, (int)(&bcsr->specific)); \
176 au_sync(); \
177 } \
178 } while (0)
179
180
181/* NAND defines */
182/* Timing values as described in databook, * ns value stripped of
183 * lower 2 bits.
184 * These defines are here rather than an SOC1550 generic file because
185 * the parts chosen on another board may be different and may require
186 * different timings.
187 */
188#define NAND_T_H (18 >> 2)
189#define NAND_T_PUL (30 >> 2)
190#define NAND_T_SU (30 >> 2)
191#define NAND_T_WH (30 >> 2)
192
193/* Bitfield shift amounts */
194#define NAND_T_H_SHIFT 0
195#define NAND_T_PUL_SHIFT 4
196#define NAND_T_SU_SHIFT 8
197#define NAND_T_WH_SHIFT 12
198
199#define NAND_TIMING ((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
200 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
201 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
202 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT)
203
204#endif /* __ASM_DB1X00_H */
205
diff --git a/include/asm-mips/mach-ddb5074/mc146818rtc.h b/include/asm-mips/mach-ddb5074/mc146818rtc.h
new file mode 100644
index 000000000000..2eb9acb10a5a
--- /dev/null
+++ b/include/asm-mips/mach-ddb5074/mc146818rtc.h
@@ -0,0 +1,31 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_DDB5074_MC146818RTC_H
11#define __ASM_MACH_DDB5074_MC146818RTC_H
12
13#include <asm/ddb5xxx/ddb5074.h>
14#include <asm/ddb5xxx/ddb5xxx.h>
15
16#define RTC_PORT(x) (0x70 + (x))
17#define RTC_IRQ 8
18
19static inline unsigned char CMOS_READ(unsigned long addr)
20{
21 return *(volatile unsigned char *)(KSEG1ADDR(DDB_PCI_MEM_BASE)+addr);
22}
23
24static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
25{
26 *(volatile unsigned char *)(KSEG1ADDR(DDB_PCI_MEM_BASE)+addr) = data;
27}
28
29#define RTC_ALWAYS_BCD 1
30
31#endif /* __ASM_MACH_DDB5074_MC146818RTC_H */
diff --git a/include/asm-mips/mach-dec/mc146818rtc.h b/include/asm-mips/mach-dec/mc146818rtc.h
new file mode 100644
index 000000000000..a326f451253b
--- /dev/null
+++ b/include/asm-mips/mach-dec/mc146818rtc.h
@@ -0,0 +1,46 @@
1/*
2 * RTC definitions for DECstation style attached Dallas DS1287 chip.
3 *
4 * Copyright (C) 1998, 2001 by Ralf Baechle
5 * Copyright (C) 1998 by Harald Koerfgen
6 * Copyright (C) 2002 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef __ASM_MIPS_DEC_RTC_DEC_H
14#define __ASM_MIPS_DEC_RTC_DEC_H
15
16#include <linux/types.h>
17
18#include <asm/addrspace.h>
19
20extern volatile u8 *dec_rtc_base;
21extern unsigned long dec_kn_slot_size;
22
23#define RTC_PORT(x) CPHYSADDR(dec_rtc_base)
24#define RTC_IO_EXTENT dec_kn_slot_size
25#define RTC_IOMAPPED 0
26#undef RTC_IRQ
27
28#define RTC_DEC_YEAR 0x3f /* Where we store the real year on DECs. */
29
30#include <linux/mc146818rtc.h>
31#include <linux/module.h>
32#include <linux/types.h>
33
34static inline unsigned char CMOS_READ(unsigned long addr)
35{
36 return dec_rtc_base[addr * 4];
37}
38
39static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
40{
41 dec_rtc_base[addr * 4] = data;
42}
43
44#define RTC_ALWAYS_BCD 0
45
46#endif /* __ASM_MIPS_DEC_RTC_DEC_H */
diff --git a/include/asm-mips/mach-dec/param.h b/include/asm-mips/mach-dec/param.h
new file mode 100644
index 000000000000..3e4f0e390847
--- /dev/null
+++ b/include/asm-mips/mach-dec/param.h
@@ -0,0 +1,18 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_DEC_PARAM_H
9#define __ASM_MACH_DEC_PARAM_H
10
11/*
12 * log2(HZ), change this here if you want another HZ value. This is also
13 * used in dec_time_init. Minimum is 1, Maximum is 15.
14 */
15#define LOG_2_HZ 7
16#define HZ (1 << LOG_2_HZ)
17
18#endif /* __ASM_MACH_DEC_PARAM_H */
diff --git a/include/asm-mips/mach-ev64120/mach-gt64120.h b/include/asm-mips/mach-ev64120/mach-gt64120.h
new file mode 100644
index 000000000000..13b1443a7a65
--- /dev/null
+++ b/include/asm-mips/mach-ev64120/mach-gt64120.h
@@ -0,0 +1,61 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef __ASM_GALILEO_BOARDS_MIPS_EV64120_H
9#define __ASM_GALILEO_BOARDS_MIPS_EV64120_H
10
11/*
12 * GT64120 config space base address
13 */
14extern unsigned long gt64120_base;
15
16#define GT64120_BASE (gt64120_base)
17
18/*
19 * PCI Bus allocation
20 */
21#define GT_PCI_MEM_BASE 0x12000000UL
22#define GT_PCI_MEM_SIZE 0x02000000UL
23#define GT_PCI_IO_BASE 0x10000000UL
24#define GT_PCI_IO_SIZE 0x02000000UL
25#define GT_ISA_IO_BASE PCI_IO_BASE
26
27/*
28 * Duart I/O ports.
29 */
30#define EV64120_COM1_BASE_ADDR (0x1d000000 + 0x20)
31#define EV64120_COM2_BASE_ADDR (0x1d000000 + 0x00)
32
33
34/*
35 * EV64120 interrupt controller register base.
36 */
37#define EV64120_ICTRL_REGS_BASE (KSEG1ADDR(0x1f000000))
38
39/*
40 * EV64120 UART register base.
41 */
42#define EV64120_UART0_REGS_BASE (KSEG1ADDR(EV64120_COM1_BASE_ADDR))
43#define EV64120_UART1_REGS_BASE (KSEG1ADDR(EV64120_COM2_BASE_ADDR))
44#define EV64120_BASE_BAUD ( 3686400 / 16 )
45
46/*
47 * PCI interrupts will come in on either the INTA or INTD interrups lines,
48 * which are mapped to the #2 and #5 interrupt pins of the MIPS. On our
49 * boards, they all either come in on IntD or they all come in on IntA, they
50 * aren't mixed. There can be numerous PCI interrupts, so we keep a list of the
51 * "requested" interrupt numbers and go through the list whenever we get an
52 * IntA/D.
53 *
54 * Interrupts < 8 are directly wired to the processor; PCI INTA is 8 and
55 * INTD is 11.
56 */
57#define GT_TIMER 4
58#define GT_INTA 2
59#define GT_INTD 5
60
61#endif /* __ASM_GALILEO_BOARDS_MIPS_EV64120_H */
diff --git a/include/asm-mips/mach-ev96100/mach-gt64120.h b/include/asm-mips/mach-ev96100/mach-gt64120.h
new file mode 100644
index 000000000000..0ef1e6c25acf
--- /dev/null
+++ b/include/asm-mips/mach-ev96100/mach-gt64120.h
@@ -0,0 +1,46 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef _ASM_GT64120_EV96100_GT64120_DEP_H
9#define _ASM_GT64120_EV96100_GT64120_DEP_H
10
11/*
12 * GT96100 config space base address
13 */
14#define GT64120_BASE (KSEG1ADDR(0x14000000))
15
16/*
17 * PCI Bus allocation
18 *
19 * (Guessing ...)
20 */
21#define GT_PCI_MEM_BASE 0x12000000UL
22#define GT_PCI_MEM_SIZE 0x02000000UL
23#define GT_PCI_IO_BASE 0x10000000UL
24#define GT_PCI_IO_SIZE 0x02000000UL
25#define GT_ISA_IO_BASE PCI_IO_BASE
26
27/*
28 * Duart I/O ports.
29 */
30#define EV96100_COM1_BASE_ADDR (0xBD000000 + 0x20)
31#define EV96100_COM2_BASE_ADDR (0xBD000000 + 0x00)
32
33
34/*
35 * EV96100 interrupt controller register base.
36 */
37#define EV96100_ICTRL_REGS_BASE (KSEG1ADDR(0x1f000000))
38
39/*
40 * EV96100 UART register base.
41 */
42#define EV96100_UART0_REGS_BASE EV96100_COM1_BASE_ADDR
43#define EV96100_UART1_REGS_BASE EV96100_COM2_BASE_ADDR
44#define EV96100_BASE_BAUD ( 3686400 / 16 )
45
46#endif /* _ASM_GT64120_EV96100_GT64120_DEP_H */
diff --git a/include/asm-mips/mach-generic/cpu-feature-overrides.h b/include/asm-mips/mach-generic/cpu-feature-overrides.h
new file mode 100644
index 000000000000..0aecfd08e39a
--- /dev/null
+++ b/include/asm-mips/mach-generic/cpu-feature-overrides.h
@@ -0,0 +1,13 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H
10
11/* Intensionally empty file ... */
12
13#endif /* __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-generic/floppy.h b/include/asm-mips/mach-generic/floppy.h
new file mode 100644
index 000000000000..682a5858f8d7
--- /dev/null
+++ b/include/asm-mips/mach-generic/floppy.h
@@ -0,0 +1,139 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 1997, 1998, 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_FLOPPY_H
9#define __ASM_MACH_GENERIC_FLOPPY_H
10
11#include <linux/delay.h>
12#include <linux/init.h>
13#include <linux/ioport.h>
14#include <linux/sched.h>
15#include <linux/linkage.h>
16#include <linux/types.h>
17#include <linux/mm.h>
18
19#include <asm/bootinfo.h>
20#include <asm/cachectl.h>
21#include <asm/dma.h>
22#include <asm/floppy.h>
23#include <asm/io.h>
24#include <asm/irq.h>
25#include <asm/pgtable.h>
26
27/*
28 * How to access the FDC's registers.
29 */
30static inline unsigned char fd_inb(unsigned int port)
31{
32 return inb_p(port);
33}
34
35static inline void fd_outb(unsigned char value, unsigned int port)
36{
37 outb_p(value, port);
38}
39
40/*
41 * How to access the floppy DMA functions.
42 */
43static inline void fd_enable_dma(void)
44{
45 enable_dma(FLOPPY_DMA);
46}
47
48static inline void fd_disable_dma(void)
49{
50 disable_dma(FLOPPY_DMA);
51}
52
53static inline int fd_request_dma(void)
54{
55 return request_dma(FLOPPY_DMA, "floppy");
56}
57
58static inline void fd_free_dma(void)
59{
60 free_dma(FLOPPY_DMA);
61}
62
63static inline void fd_clear_dma_ff(void)
64{
65 clear_dma_ff(FLOPPY_DMA);
66}
67
68static inline void fd_set_dma_mode(char mode)
69{
70 set_dma_mode(FLOPPY_DMA, mode);
71}
72
73static inline void fd_set_dma_addr(char *addr)
74{
75 set_dma_addr(FLOPPY_DMA, (unsigned long) addr);
76}
77
78static inline void fd_set_dma_count(unsigned int count)
79{
80 set_dma_count(FLOPPY_DMA, count);
81}
82
83static inline int fd_get_dma_residue(void)
84{
85 return get_dma_residue(FLOPPY_DMA);
86}
87
88static inline void fd_enable_irq(void)
89{
90 enable_irq(FLOPPY_IRQ);
91}
92
93static inline void fd_disable_irq(void)
94{
95 disable_irq(FLOPPY_IRQ);
96}
97
98static inline int fd_request_irq(void)
99{
100 return request_irq(FLOPPY_IRQ, floppy_interrupt,
101 SA_INTERRUPT | SA_SAMPLE_RANDOM, "floppy", NULL);
102}
103
104static inline void fd_free_irq(void)
105{
106 free_irq(FLOPPY_IRQ, NULL);
107}
108
109#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
110
111
112static inline unsigned long fd_getfdaddr1(void)
113{
114 return 0x3f0;
115}
116
117static inline unsigned long fd_dma_mem_alloc(unsigned long size)
118{
119 unsigned long mem;
120
121 mem = __get_dma_pages(GFP_KERNEL, get_order(size));
122
123 return mem;
124}
125
126static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
127{
128 free_pages(addr, get_order(size));
129}
130
131static inline unsigned long fd_drive_type(unsigned long n)
132{
133 if (n == 0)
134 return 4; /* 3,5", 1.44mb */
135
136 return 0;
137}
138
139#endif /* __ASM_MACH_GENERIC_FLOPPY_H */
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
new file mode 100644
index 000000000000..cb2edd018ad6
--- /dev/null
+++ b/include/asm-mips/mach-generic/ide.h
@@ -0,0 +1,119 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994-1996 Linus Torvalds & authors
7 *
8 * Copied from i386; many of the especially older MIPS or ISA-based platforms
9 * are basically identical. Using this file probably implies i8259 PIC
10 * support in a system but the very least interrupt numbers 0 - 15 need to
11 * be put aside for legacy devices.
12 */
13#ifndef __ASM_MACH_GENERIC_IDE_H
14#define __ASM_MACH_GENERIC_IDE_H
15
16#ifdef __KERNEL__
17
18#include <linux/config.h>
19#include <linux/pci.h>
20#include <linux/stddef.h>
21
22#ifndef MAX_HWIFS
23# ifdef CONFIG_BLK_DEV_IDEPCI
24#define MAX_HWIFS 10
25# else
26#define MAX_HWIFS 6
27# endif
28#endif
29
30#define IDE_ARCH_OBSOLETE_DEFAULTS
31
32static __inline__ int ide_probe_legacy(void)
33{
34#ifdef CONFIG_PCI
35 struct pci_dev *dev;
36 if ((dev = pci_get_class(PCI_CLASS_BRIDGE_EISA << 8, NULL)) != NULL ||
37 (dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL)) != NULL) {
38 pci_dev_put(dev);
39
40 return 1;
41 }
42 return 0;
43#elif defined(CONFIG_EISA) || defined(CONFIG_ISA)
44 return 1;
45#else
46 return 0;
47#endif
48}
49
50static __inline__ int ide_default_irq(unsigned long base)
51{
52 if (ide_probe_legacy())
53 switch (base) {
54 case 0x1f0:
55 return 14;
56 case 0x170:
57 return 15;
58 case 0x1e8:
59 return 11;
60 case 0x168:
61 return 10;
62 case 0x1e0:
63 return 8;
64 case 0x160:
65 return 12;
66 default:
67 return 0;
68 }
69 else
70 return 0;
71}
72
73static __inline__ unsigned long ide_default_io_base(int index)
74{
75 if (ide_probe_legacy())
76 switch (index) {
77 case 0:
78 return 0x1f0;
79 case 1:
80 return 0x170;
81 case 2:
82 return 0x1e8;
83 case 3:
84 return 0x168;
85 case 4:
86 return 0x1e0;
87 case 5:
88 return 0x160;
89 default:
90 return 0;
91 }
92 else
93 return 0;
94}
95
96#define IDE_ARCH_OBSOLETE_INIT
97#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
98
99#ifdef CONFIG_BLK_DEV_IDEPCI
100#define ide_init_default_irq(base) (0)
101#else
102#define ide_init_default_irq(base) ide_default_irq(base)
103#endif
104
105/* MIPS port and memory-mapped I/O string operations. */
106
107#define __ide_insw insw
108#define __ide_insl insl
109#define __ide_outsw outsw
110#define __ide_outsl outsl
111
112#define __ide_mm_insw readsw
113#define __ide_mm_insl readsl
114#define __ide_mm_outsw writesw
115#define __ide_mm_outsl writesl
116
117#endif /* __KERNEL__ */
118
119#endif /* __ASM_MACH_GENERIC_IDE_H */
diff --git a/include/asm-mips/mach-generic/irq.h b/include/asm-mips/mach-generic/irq.h
new file mode 100644
index 000000000000..500e10ff24de
--- /dev/null
+++ b/include/asm-mips/mach-generic/irq.h
@@ -0,0 +1,13 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_IRQ_H
9#define __ASM_MACH_GENERIC_IRQ_H
10
11#define NR_IRQS 128
12
13#endif /* __ASM_MACH_GENERIC_IRQ_H */
diff --git a/include/asm-mips/mach-generic/mangle-port.h b/include/asm-mips/mach-generic/mangle-port.h
new file mode 100644
index 000000000000..4a98d83b8ec7
--- /dev/null
+++ b/include/asm-mips/mach-generic/mangle-port.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
9#define __ASM_MACH_GENERIC_MANGLE_PORT_H
10
11#define __swizzle_addr_b(port) (port)
12#define __swizzle_addr_w(port) (port)
13#define __swizzle_addr_l(port) (port)
14#define __swizzle_addr_q(port) (port)
15
16#endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-generic/mc146818rtc.h b/include/asm-mips/mach-generic/mc146818rtc.h
new file mode 100644
index 000000000000..90c2e6f77faa
--- /dev/null
+++ b/include/asm-mips/mach-generic/mc146818rtc.h
@@ -0,0 +1,36 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_GENERIC_MC146818RTC_H
11#define __ASM_MACH_GENERIC_MC146818RTC_H
12
13#include <asm/io.h>
14
15#define RTC_PORT(x) (0x70 + (x))
16#define RTC_IRQ 8
17
18static inline unsigned char CMOS_READ(unsigned long addr)
19{
20 outb_p(addr, RTC_PORT(0));
21 return inb_p(RTC_PORT(1));
22}
23
24static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
25{
26 outb_p(addr, RTC_PORT(0));
27 outb_p(data, RTC_PORT(1));
28}
29
30#define RTC_ALWAYS_BCD 1
31
32#ifndef mc146818_decode_year
33#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970)
34#endif
35
36#endif /* __ASM_MACH_GENERIC_MC146818RTC_H */
diff --git a/include/asm-mips/mach-generic/param.h b/include/asm-mips/mach-generic/param.h
new file mode 100644
index 000000000000..a0d12f964e4f
--- /dev/null
+++ b/include/asm-mips/mach-generic/param.h
@@ -0,0 +1,13 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_PARAM_H
9#define __ASM_MACH_GENERIC_PARAM_H
10
11#define HZ 1000 /* Internal kernel timer frequency */
12
13#endif /* __ASM_MACH_GENERIC_PARAM_H */
diff --git a/include/asm-mips/mach-generic/spaces.h b/include/asm-mips/mach-generic/spaces.h
new file mode 100644
index 000000000000..63c0a81c7832
--- /dev/null
+++ b/include/asm-mips/mach-generic/spaces.h
@@ -0,0 +1,72 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_MACH_GENERIC_SPACES_H
11#define _ASM_MACH_GENERIC_SPACES_H
12
13#include <linux/config.h>
14
15#ifdef CONFIG_MIPS32
16
17#define CAC_BASE 0x80000000
18#define IO_BASE 0xa0000000
19#define UNCAC_BASE 0xa0000000
20#define MAP_BASE 0xc0000000
21
22/*
23 * This handles the memory map.
24 * We handle pages at KSEG0 for kernels with 32 bit address space.
25 */
26#define PAGE_OFFSET 0x80000000UL
27
28/*
29 * Memory above this physical address will be considered highmem.
30 */
31#ifndef HIGHMEM_START
32#define HIGHMEM_START 0x20000000UL
33#endif
34
35#endif /* CONFIG_MIPS32 */
36
37#ifdef CONFIG_MIPS64
38
39/*
40 * This handles the memory map.
41 */
42#ifdef CONFIG_DMA_NONCOHERENT
43#define PAGE_OFFSET 0x9800000000000000UL
44#else
45#define PAGE_OFFSET 0xa800000000000000UL
46#endif
47
48/*
49 * Memory above this physical address will be considered highmem.
50 * Fixme: 59 bits is a fictive number and makes assumptions about processors
51 * in the distant future. Nobody will care for a few years :-)
52 */
53#ifndef HIGHMEM_START
54#define HIGHMEM_START (1UL << 59UL)
55#endif
56
57#ifdef CONFIG_DMA_NONCOHERENT
58#define CAC_BASE 0x9800000000000000
59#else
60#define CAC_BASE 0xa800000000000000
61#endif
62#define IO_BASE 0x9000000000000000
63#define UNCAC_BASE 0x9000000000000000
64#define MAP_BASE 0xc000000000000000
65
66#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
67#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
68#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
69
70#endif /* CONFIG_MIPS64 */
71
72#endif /* __ASM_MACH_GENERIC_SPACES_H */
diff --git a/include/asm-mips/mach-generic/timex.h b/include/asm-mips/mach-generic/timex.h
new file mode 100644
index 000000000000..c6a2e5f0574a
--- /dev/null
+++ b/include/asm-mips/mach-generic/timex.h
@@ -0,0 +1,22 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_TIMEX_H
9#define __ASM_MACH_GENERIC_TIMEX_H
10
11#include <linux/config.h>
12
13/*
14 * Last remaining user of the i8254 PIC, will be converted, too ...
15 */
16#ifdef CONFIG_SNI_RM200_PCI
17#define CLOCK_TICK_RATE 1193182
18#else
19#define CLOCK_TICK_RATE 500000
20#endif
21
22#endif /* __ASM_MACH_GENERIC_TIMEX_H */
diff --git a/include/asm-mips/mach-generic/topology.h b/include/asm-mips/mach-generic/topology.h
new file mode 100644
index 000000000000..5428f333a02c
--- /dev/null
+++ b/include/asm-mips/mach-generic/topology.h
@@ -0,0 +1 @@
#include <asm-generic/topology.h>
diff --git a/include/asm-mips/mach-ip22/cpu-feature-overrides.h b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
new file mode 100644
index 000000000000..3c8896d9b133
--- /dev/null
+++ b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
@@ -0,0 +1,29 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 Ralf Baechle
7 */
8#ifndef __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * IP22 with a variety of processors so we can't use defaults for everything.
13 */
14#define cpu_has_mips16 0
15#define cpu_has_divec 0
16#define cpu_has_cache_cdex_p 1
17#define cpu_has_prefetch 0
18#define cpu_has_mcheck 0
19#define cpu_has_ejtag 0
20
21#define cpu_has_llsc 1
22#define cpu_has_vtag_icache 0 /* Needs to change for R8000 */
23#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
24#define cpu_has_ic_fills_f_dc 0
25
26#define cpu_has_nofpuex 0
27#define cpu_has_64bits 1
28
29#endif /* __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip22/ds1286.h b/include/asm-mips/mach-ip22/ds1286.h
new file mode 100644
index 000000000000..f19f1eafbc71
--- /dev/null
+++ b/include/asm-mips/mach-ip22/ds1286.h
@@ -0,0 +1,18 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_IP22_DS1286_H
11#define __ASM_MACH_IP22_DS1286_H
12
13#include <asm/sgi/hpc3.h>
14
15#define rtc_read(reg) (hpc3c0->rtcregs[(reg)] & 0xff)
16#define rtc_write(data, reg) do { hpc3c0->rtcregs[(reg)] = (data); } while(0)
17
18#endif /* __ASM_MACH_IP22_DS1286_H */
diff --git a/include/asm-mips/mach-ip22/spaces.h b/include/asm-mips/mach-ip22/spaces.h
new file mode 100644
index 000000000000..30d42fcafe3d
--- /dev/null
+++ b/include/asm-mips/mach-ip22/spaces.h
@@ -0,0 +1,55 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_MACH_IP22_SPACES_H
11#define _ASM_MACH_IP22_SPACES_H
12
13#include <linux/config.h>
14
15#ifdef CONFIG_MIPS32
16
17#define CAC_BASE 0x80000000
18#define IO_BASE 0xa0000000
19#define UNCAC_BASE 0xa0000000
20#define MAP_BASE 0xc0000000
21
22/*
23 * This handles the memory map.
24 * We handle pages at KSEG0 for kernels with 32 bit address space.
25 */
26#define PAGE_OFFSET 0x80000000UL
27
28/*
29 * Memory above this physical address will be considered highmem.
30 */
31#ifndef HIGHMEM_START
32#define HIGHMEM_START 0x20000000UL
33#endif
34
35#endif /* CONFIG_MIPS32 */
36
37#ifdef CONFIG_MIPS64
38#define PAGE_OFFSET 0xffffffff80000000UL
39
40#ifndef HIGHMEM_START
41#define HIGHMEM_START (1UL << 59UL)
42#endif
43
44#define CAC_BASE 0xffffffff80000000
45#define IO_BASE 0xffffffffa0000000
46#define UNCAC_BASE 0xffffffffa0000000
47#define MAP_BASE 0xffffffffc0000000
48
49#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
50#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
51#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
52
53#endif /* CONFIG_MIPS64 */
54
55#endif /* __ASM_MACH_IP22_SPACES_H */
diff --git a/include/asm-mips/mach-ip27/cpu-feature-overrides.h b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
new file mode 100644
index 000000000000..fe96d7358517
--- /dev/null
+++ b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
@@ -0,0 +1,39 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 Ralf Baechle
7 */
8#ifndef __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * IP27 only comes with R10000 family processors all using the same config
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 0
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 0
22#define cpu_has_ejtag 0
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_icache_snoops_remote_store 1
29
30#define cpu_has_nofpuex 0
31#define cpu_has_64bits 1
32
33#define cpu_has_subset_pcaches 1
34
35#define cpu_dcache_line_size() 32
36#define cpu_icache_line_size() 64
37#define cpu_scache_line_size() 128
38
39#endif /* __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip27/irq.h b/include/asm-mips/mach-ip27/irq.h
new file mode 100644
index 000000000000..806213ce31b6
--- /dev/null
+++ b/include/asm-mips/mach-ip27/irq.h
@@ -0,0 +1,22 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999, 2000, 01, 02, 03 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 Kanoj Sarcar
9 */
10#ifndef __ASM_MACH_IP27_IRQ_H
11#define __ASM_MACH_IP27_IRQ_H
12
13#include <asm/sn/arch.h>
14
15/*
16 * A hardwired interrupt number is completly stupid for this system - a
17 * large configuration might have thousands if not tenthousands of
18 * interrupts.
19 */
20#define NR_IRQS 256
21
22#endif /* __ASM_MACH_IP27_IRQ_H */
diff --git a/include/asm-mips/mach-ip27/mangle-port.h b/include/asm-mips/mach-ip27/mangle-port.h
new file mode 100644
index 000000000000..f76c44880451
--- /dev/null
+++ b/include/asm-mips/mach-ip27/mangle-port.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle
7 */
8#ifndef __ASM_MACH_IP27_MANGLE_PORT_H
9#define __ASM_MACH_IP27_MANGLE_PORT_H
10
11#define __swizzle_addr_b(port) (port)
12#define __swizzle_addr_w(port) ((port) ^ 2)
13#define __swizzle_addr_l(port) (port)
14#define __swizzle_addr_q(port) (port)
15
16#endif /* __ASM_MACH_IP27_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-ip27/mmzone.h b/include/asm-mips/mach-ip27/mmzone.h
new file mode 100644
index 000000000000..d3f566362e9d
--- /dev/null
+++ b/include/asm-mips/mach-ip27/mmzone.h
@@ -0,0 +1,36 @@
1#ifndef _ASM_MACH_MMZONE_H
2#define _ASM_MACH_MMZONE_H
3
4#include <asm/sn/addrs.h>
5#include <asm/sn/arch.h>
6#include <asm/sn/hub.h>
7
8#define pa_to_nid(addr) NASID_TO_COMPACT_NODEID(NASID_GET(addr))
9
10#define LEVELS_PER_SLICE 128
11
12struct slice_data {
13 unsigned long irq_alloc_mask[2];
14 unsigned long irq_enable_mask[2];
15 int level_to_irq[LEVELS_PER_SLICE];
16};
17
18struct hub_data {
19 kern_vars_t kern_vars;
20 DECLARE_BITMAP(h_bigwin_used, HUB_NUM_BIG_WINDOW);
21 cpumask_t h_cpus;
22 unsigned long slice_map;
23 struct slice_data slice[2];
24};
25
26struct node_data {
27 struct pglist_data pglist;
28 struct hub_data hub;
29};
30
31extern struct node_data *__node_data[];
32
33#define NODE_DATA(n) (&__node_data[(n)]->pglist)
34#define hub_data(n) (&__node_data[(n)]->hub)
35
36#endif /* _ASM_MACH_MMZONE_H */
diff --git a/include/asm-mips/mach-ip27/spaces.h b/include/asm-mips/mach-ip27/spaces.h
new file mode 100644
index 000000000000..e3b3fe32eeb1
--- /dev/null
+++ b/include/asm-mips/mach-ip27/spaces.h
@@ -0,0 +1,34 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 99 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999 by Silicon Graphics, Inc.
9 */
10#ifndef _ASM_MACH_IP27_SPACES_H
11#define _ASM_MACH_IP27_SPACES_H
12
13/*
14 * IP27 uses the R10000's uncached attribute feature. Attribute 3 selects
15 * uncached memory addressing.
16 */
17#define CAC_BASE 0xa800000000000000
18
19#define HSPEC_BASE 0x9000000000000000
20#define IO_BASE 0x9200000000000000
21#define MSPEC_BASE 0x9400000000000000
22#define UNCAC_BASE 0x9600000000000000
23
24#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
25#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
26#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
27#define TO_MSPEC(x) (MSPEC_BASE | ((x) & TO_PHYS_MASK))
28#define TO_HSPEC(x) (HSPEC_BASE | ((x) & TO_PHYS_MASK))
29
30#define PAGE_OFFSET CAC_BASE
31
32#define HIGHMEM_START (~0UL)
33
34#endif /* _ASM_MACH_IP27_SPACES_H */
diff --git a/include/asm-mips/mach-ip27/topology.h b/include/asm-mips/mach-ip27/topology.h
new file mode 100644
index 000000000000..a70a81257c3d
--- /dev/null
+++ b/include/asm-mips/mach-ip27/topology.h
@@ -0,0 +1,38 @@
1#ifndef _ASM_MACH_TOPOLOGY_H
2#define _ASM_MACH_TOPOLOGY_H 1
3
4#include <asm/sn/arch.h>
5#include <asm/sn/hub.h>
6#include <asm/mmzone.h>
7
8#define cpu_to_node(cpu) (cpu_data[(cpu)].p_nodeid)
9#define parent_node(node) (node)
10#define node_to_cpumask(node) (hub_data(node)->h_cpus)
11#define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node)))
12#define pcibus_to_cpumask(bus) (cpu_online_map)
13
14extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
15
16#define node_distance(from, to) (__node_distances[(from)][(to)])
17
18/* sched_domains SD_NODE_INIT for SGI IP27 machines */
19#define SD_NODE_INIT (struct sched_domain) { \
20 .span = CPU_MASK_NONE, \
21 .parent = NULL, \
22 .groups = NULL, \
23 .min_interval = 8, \
24 .max_interval = 32, \
25 .busy_factor = 32, \
26 .imbalance_pct = 125, \
27 .cache_hot_time = (10*1000), \
28 .cache_nice_tries = 1, \
29 .per_cpu_gain = 100, \
30 .flags = SD_LOAD_BALANCE \
31 | SD_BALANCE_EXEC \
32 | SD_WAKE_BALANCE, \
33 .last_balance = jiffies, \
34 .balance_interval = 1, \
35 .nr_balance_failed = 0, \
36}
37
38#endif /* _ASM_MACH_TOPOLOGY_H */
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
new file mode 100644
index 000000000000..b932237f2193
--- /dev/null
+++ b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
@@ -0,0 +1,41 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 Ilya A. Volynets-Evenbakh
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H
11
12#include <linux/config.h>
13
14/*
15 * R5000 has an interesting "restriction": ll(d)/sc(d)
16 * instructions to XKPHYS region simply do uncached bus
17 * requests. This breaks all the atomic bitops functions.
18 * so, for 64bit IP32 kernel we just don't use ll/sc.
19 * This does not affect luserland.
20 */
21#if defined(CONFIG_CPU_R5000) && defined(CONFIG_MIPS64)
22#define cpu_has_llsc 0
23#else
24#define cpu_has_llsc 1
25#endif
26
27/* Settings which are common for all ip32 CPUs */
28#define cpu_has_tlb 1
29#define cpu_has_4kex 1
30#define cpu_has_fpu 1
31#define cpu_has_32fpr 1
32#define cpu_has_counter 1
33#define cpu_has_mips16 0
34#define cpu_has_vce 0
35#define cpu_has_cache_cdex_s 0
36#define cpu_has_mcheck 0
37#define cpu_has_ejtag 0
38#define cpu_has_vtag_icache 0
39#define cpu_has_ic_fills_f_dc 0
40
41#endif /* __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip32/mangle-port.h b/include/asm-mips/mach-ip32/mangle-port.h
new file mode 100644
index 000000000000..6e25b52ed8f2
--- /dev/null
+++ b/include/asm-mips/mach-ip32/mangle-port.h
@@ -0,0 +1,17 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 Ladislav Michl
7 * Copyright (C) 2004 Ralf Baechle
8 */
9#ifndef __ASM_MACH_IP32_MANGLE_PORT_H
10#define __ASM_MACH_IP32_MANGLE_PORT_H
11
12#define __swizzle_addr_b(port) ((port) ^ 3)
13#define __swizzle_addr_w(port) ((port) ^ 2)
14#define __swizzle_addr_l(port) (port)
15#define __swizzle_addr_q(port) (port)
16
17#endif /* __ASM_MACH_IP32_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-ip32/mc146818rtc.h b/include/asm-mips/mach-ip32/mc146818rtc.h
new file mode 100644
index 000000000000..f5d780ff843f
--- /dev/null
+++ b/include/asm-mips/mach-ip32/mc146818rtc.h
@@ -0,0 +1,35 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7 * Copyright (C) 2000 Harald Koerfgen
8 *
9 * RTC routines for IP32 style attached Dallas chip.
10 */
11#ifndef __ASM_MACH_IP32_MC146818RTC_H
12#define __ASM_MACH_IP32_MC146818RTC_H
13
14#include <asm/io.h>
15#include <asm/ip32/mace.h>
16
17#define RTC_PORT(x) (0x70 + (x))
18
19static unsigned char CMOS_READ(unsigned long addr)
20{
21 return mace->isa.rtc[addr << 8];
22}
23
24static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
25{
26 mace->isa.rtc[addr << 8] = data;
27}
28
29/* FIXME: Do it right. For now just assume that noone lives in 20th century
30 * and no O2 user in 22th century ;-) */
31#define mc146818_decode_year(year) ((year) + 2000)
32
33#define RTC_ALWAYS_BCD 0
34
35#endif /* __ASM_MACH_IP32_MC146818RTC_H */
diff --git a/include/asm-mips/mach-ip32/spaces.h b/include/asm-mips/mach-ip32/spaces.h
new file mode 100644
index 000000000000..c7839f85c68d
--- /dev/null
+++ b/include/asm-mips/mach-ip32/spaces.h
@@ -0,0 +1,36 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 03, 04, 05 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_MACH_IP32_SPACES_H
11#define _ASM_MACH_IP32_SPACES_H
12
13/*
14 * Memory above this physical address will be considered highmem.
15 * Fixme: 59 bits is a fictive number and makes assumptions about processors
16 * in the distant future. Nobody will care for a few years :-)
17 */
18#ifndef HIGHMEM_START
19#define HIGHMEM_START (1UL << 59UL)
20#endif
21
22#define CAC_BASE 0x9800000000000000
23#define IO_BASE 0x9000000000000000
24#define UNCAC_BASE 0x9000000000000000
25#define MAP_BASE 0xc000000000000000
26
27#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
28#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
29#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
30
31/*
32 * This handles the memory map.
33 */
34#define PAGE_OFFSET CAC_BASE
35
36#endif /* __ASM_MACH_IP32_SPACES_H */
diff --git a/include/asm-mips/mach-ja/cpu-feature-overrides.h b/include/asm-mips/mach-ja/cpu-feature-overrides.h
new file mode 100644
index 000000000000..ca57e7db98bb
--- /dev/null
+++ b/include/asm-mips/mach-ja/cpu-feature-overrides.h
@@ -0,0 +1,45 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle
7 */
8#ifndef __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * Momentum Jaguar ATX always has the RM9000 processor.
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 0
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 0
22#define cpu_has_ejtag 0
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_icache_snoops_remote_store 0
29
30#define cpu_has_nofpuex 0
31#define cpu_has_64bits 1
32
33#define cpu_has_subset_pcaches 0
34
35#define cpu_dcache_line_size() 32
36#define cpu_icache_line_size() 32
37#define cpu_scache_line_size() 32
38
39/*
40 * On the RM9000 we need to ensure that I-cache lines being fetches only
41 * contain valid instructions are funny things will happen.
42 */
43#define PLAT_TRAMPOLINE_STUFF_LINE 32UL
44
45#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ja/spaces.h b/include/asm-mips/mach-ja/spaces.h
new file mode 100644
index 000000000000..8466a0e69c79
--- /dev/null
+++ b/include/asm-mips/mach-ja/spaces.h
@@ -0,0 +1,20 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef __ASM_MACH_JA_SPACES_H
11#define __ASM_MACH_JA_SPACES_H
12
13/*
14 * Memory above this physical address will be considered highmem.
15 */
16#define HIGHMEM_START 0x08000000UL
17
18#include_next <spaces.h>
19
20#endif /* __ASM_MACH_JA_SPACES_H */
diff --git a/include/asm-mips/mach-jazz/floppy.h b/include/asm-mips/mach-jazz/floppy.h
new file mode 100644
index 000000000000..8cf0d042c864
--- /dev/null
+++ b/include/asm-mips/mach-jazz/floppy.h
@@ -0,0 +1,135 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_JAZZ_FLOPPY_H
9#define __ASM_MACH_JAZZ_FLOPPY_H
10
11#include <linux/delay.h>
12#include <linux/init.h>
13#include <linux/linkage.h>
14#include <linux/types.h>
15#include <linux/mm.h>
16#include <asm/addrspace.h>
17#include <asm/jazz.h>
18#include <asm/jazzdma.h>
19#include <asm/pgtable.h>
20
21static inline unsigned char fd_inb(unsigned int port)
22{
23 unsigned char c;
24
25 c = *(volatile unsigned char *) port;
26 udelay(1);
27
28 return c;
29}
30
31static inline void fd_outb(unsigned char value, unsigned int port)
32{
33 *(volatile unsigned char *) port = value;
34}
35
36/*
37 * How to access the floppy DMA functions.
38 */
39static inline void fd_enable_dma(void)
40{
41 vdma_enable(JAZZ_FLOPPY_DMA);
42}
43
44static inline void fd_disable_dma(void)
45{
46 vdma_disable(JAZZ_FLOPPY_DMA);
47}
48
49static inline int fd_request_dma(void)
50{
51 return 0;
52}
53
54static inline void fd_free_dma(void)
55{
56}
57
58static inline void fd_clear_dma_ff(void)
59{
60}
61
62static inline void fd_set_dma_mode(char mode)
63{
64 vdma_set_mode(JAZZ_FLOPPY_DMA, mode);
65}
66
67static inline void fd_set_dma_addr(char *a)
68{
69 vdma_set_addr(JAZZ_FLOPPY_DMA, vdma_phys2log(CPHYSADDR((unsigned long)a)));
70}
71
72static inline void fd_set_dma_count(unsigned int count)
73{
74 vdma_set_count(JAZZ_FLOPPY_DMA, count);
75}
76
77static inline int fd_get_dma_residue(void)
78{
79 return vdma_get_residue(JAZZ_FLOPPY_DMA);
80}
81
82static inline void fd_enable_irq(void)
83{
84}
85
86static inline void fd_disable_irq(void)
87{
88}
89
90static inline int fd_request_irq(void)
91{
92 return request_irq(FLOPPY_IRQ, floppy_interrupt,
93 SA_INTERRUPT | SA_SAMPLE_RANDOM, "floppy", NULL);
94}
95
96static inline void fd_free_irq(void)
97{
98 free_irq(FLOPPY_IRQ, NULL);
99}
100
101static inline unsigned long fd_getfdaddr1(void)
102{
103 return JAZZ_FDC_BASE;
104}
105
106static inline unsigned long fd_dma_mem_alloc(unsigned long size)
107{
108 unsigned long mem;
109
110 mem = __get_dma_pages(GFP_KERNEL, get_order(size));
111 if(!mem)
112 return 0;
113 vdma_alloc(CPHYSADDR(mem), size); /* XXX error checking */
114
115 return mem;
116}
117
118static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
119{
120 vdma_free(vdma_phys2log(CPHYSADDR(addr)));
121 free_pages(addr, get_order(size));
122}
123
124static inline unsigned long fd_drive_type(unsigned long n)
125{
126 /* XXX This is wrong for machines with ED 2.88mb disk drives like the
127 Olivetti M700. Anyway, we should suck this from the ARC
128 firmware. */
129 if (n == 0)
130 return 4; /* 3,5", 1.44mb */
131
132 return 0;
133}
134
135#endif /* __ASM_MACH_JAZZ_FLOPPY_H */
diff --git a/include/asm-mips/mach-jazz/mc146818rtc.h b/include/asm-mips/mach-jazz/mc146818rtc.h
new file mode 100644
index 000000000000..f44fdba1998b
--- /dev/null
+++ b/include/asm-mips/mach-jazz/mc146818rtc.h
@@ -0,0 +1,34 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for Jazz style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_JAZZ_MC146818RTC_H
11#define __ASM_MACH_JAZZ_MC146818RTC_H
12
13#include <asm/io.h>
14#include <asm/jazz.h>
15
16#define RTC_PORT(x) (0x70 + (x))
17#define RTC_IRQ 8
18
19static inline unsigned char CMOS_READ(unsigned long addr)
20{
21 outb_p(addr, RTC_PORT(0));
22
23 return *(char *)JAZZ_RTC_BASE;
24}
25
26static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
27{
28 outb_p(addr, RTC_PORT(0));
29 *(char *)JAZZ_RTC_BASE = data;
30}
31
32#define RTC_ALWAYS_BCD 0
33
34#endif /* __ASM_MACH_JAZZ_MC146818RTC_H */
diff --git a/include/asm-mips/mach-jazz/param.h b/include/asm-mips/mach-jazz/param.h
new file mode 100644
index 000000000000..639763a517bc
--- /dev/null
+++ b/include/asm-mips/mach-jazz/param.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_JAZZ_PARAM_H
9#define __ASM_MACH_JAZZ_PARAM_H
10
11/*
12 * Jazz is currently using the internal 100Hz timer of the R4030
13 */
14#define HZ 100 /* Internal kernel timer frequency */
15
16#endif /* __ASM_MACH_JAZZ_PARAM_H */
diff --git a/include/asm-mips/mach-jazz/timex.h b/include/asm-mips/mach-jazz/timex.h
new file mode 100644
index 000000000000..93affa33dfa8
--- /dev/null
+++ b/include/asm-mips/mach-jazz/timex.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_JAZZ_TIMEX_H
9#define __ASM_MACH_JAZZ_TIMEX_H
10
11/*
12 * Jazz is still using the R4030 100Hz counter
13 */
14#define CLOCK_TICK_RATE 100
15
16#endif /* __ASM_MACH_JAZZ_TIMEX_H */
diff --git a/include/asm-mips/mach-jmr3927/asm/ds1742.h b/include/asm-mips/mach-jmr3927/asm/ds1742.h
new file mode 100644
index 000000000000..134a4b6c334a
--- /dev/null
+++ b/include/asm-mips/mach-jmr3927/asm/ds1742.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_JMR3927_ASM_DS1742_H
9#define __ASM_MACH_JMR3927_ASM_DS1742_H
10
11#include <asm/jmr3927/jmr3927.h>
12
13#define rtc_read(reg) (jmr3927_nvram_in(addr))
14#define rtc_write(data, reg) (jmr3927_nvram_out((data),(reg)))
15
16#endif /* __ASM_MACH_JMR3927_ASM_DS1742_H */
diff --git a/include/asm-mips/mach-lasat/mach-gt64120.h b/include/asm-mips/mach-lasat/mach-gt64120.h
new file mode 100644
index 000000000000..1a9ad45cc135
--- /dev/null
+++ b/include/asm-mips/mach-lasat/mach-gt64120.h
@@ -0,0 +1,27 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef _ASM_GT64120_LASAT_GT64120_DEP_H
9#define _ASM_GT64120_LASAT_GT64120_DEP_H
10
11/*
12 * GT64120 config space base address on Lasat 100
13 */
14#define GT64120_BASE (KSEG1ADDR(0x14000000))
15
16/*
17 * PCI Bus allocation
18 *
19 * (Guessing ...)
20 */
21#define GT_PCI_MEM_BASE 0x12000000UL
22#define GT_PCI_MEM_SIZE 0x02000000UL
23#define GT_PCI_IO_BASE 0x10000000UL
24#define GT_PCI_IO_SIZE 0x02000000UL
25#define GT_ISA_IO_BASE PCI_IO_BASE
26
27#endif /* _ASM_GT64120_LASAT_GT64120_DEP_H */
diff --git a/include/asm-mips/mach-mips/cpu-feature-overrides.h b/include/asm-mips/mach-mips/cpu-feature-overrides.h
new file mode 100644
index 000000000000..6f51be571bf0
--- /dev/null
+++ b/include/asm-mips/mach-mips/cpu-feature-overrides.h
@@ -0,0 +1,67 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Chris Dearman
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H
11
12#include <linux/config.h>
13
14/*
15 * CPU feature overrides for MIPS boards
16 */
17#ifdef CONFIG_CPU_MIPS32
18#define cpu_has_tlb 1
19#define cpu_has_4kex 1
20#define cpu_has_4ktlb 1
21/* #define cpu_has_fpu ? */
22/* #define cpu_has_32fpr ? */
23#define cpu_has_counter 1
24/* #define cpu_has_watch ? */
25#define cpu_has_divec 1
26#define cpu_has_vce 0
27/* #define cpu_has_cache_cdex_p ? */
28/* #define cpu_has_cache_cdex_s ? */
29/* #define cpu_has_prefetch ? */
30#define cpu_has_mcheck 1
31/* #define cpu_has_ejtag ? */
32#define cpu_has_llsc 1
33/* #define cpu_has_vtag_icache ? */
34/* #define cpu_has_dc_aliases ? */
35/* #define cpu_has_ic_fills_f_dc ? */
36#define cpu_has_nofpuex 0
37/* #define cpu_has_64bits ? */
38/* #define cpu_has_64bit_zero_reg ? */
39/* #define cpu_has_subset_pcaches ? */
40#endif
41
42#ifdef CONFIG_CPU_MIPS64
43#define cpu_has_tlb 1
44#define cpu_has_4kex 1
45#define cpu_has_4ktlb 1
46/* #define cpu_has_fpu ? */
47/* #define cpu_has_32fpr ? */
48#define cpu_has_counter 1
49/* #define cpu_has_watch ? */
50#define cpu_has_divec 1
51#define cpu_has_vce 0
52/* #define cpu_has_cache_cdex_p ? */
53/* #define cpu_has_cache_cdex_s ? */
54/* #define cpu_has_prefetch ? */
55#define cpu_has_mcheck 1
56/* #define cpu_has_ejtag ? */
57#define cpu_has_llsc 1
58/* #define cpu_has_vtag_icache ? */
59/* #define cpu_has_dc_aliases ? */
60/* #define cpu_has_ic_fills_f_dc ? */
61#define cpu_has_nofpuex 0
62/* #define cpu_has_64bits ? */
63/* #define cpu_has_64bit_zero_reg ? */
64/* #define cpu_has_subset_pcaches ? */
65#endif
66
67#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-mips/mach-gt64120.h b/include/asm-mips/mach-mips/mach-gt64120.h
new file mode 100644
index 000000000000..511f7cf3a6be
--- /dev/null
+++ b/include/asm-mips/mach-mips/mach-gt64120.h
@@ -0,0 +1,28 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef _ASM_MACH_MIPS_MACH_GT64120_DEP_H
9#define _ASM_MACH_MIPS_MACH_GT64120_DEP_H
10
11#define MIPS_GT_BASE 0x1be00000
12
13extern unsigned long _pcictrl_gt64120;
14/*
15 * GT64120 config space base address
16 */
17#define GT64120_BASE _pcictrl_gt64120
18
19/*
20 * PCI Bus allocation
21 */
22#define GT_PCI_MEM_BASE 0x12000000UL
23#define GT_PCI_MEM_SIZE 0x02000000UL
24#define GT_PCI_IO_BASE 0x10000000UL
25#define GT_PCI_IO_SIZE 0x02000000UL
26#define GT_ISA_IO_BASE PCI_IO_BASE
27
28#endif /* _ASM_MACH_MIPS_MACH_GT64120_DEP_H */
diff --git a/include/asm-mips/mach-mips/mc146818rtc.h b/include/asm-mips/mach-mips/mc146818rtc.h
new file mode 100644
index 000000000000..6730ba066576
--- /dev/null
+++ b/include/asm-mips/mach-mips/mc146818rtc.h
@@ -0,0 +1,48 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 * Copyright (C) 2003 by Ralf Baechle
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 *
19 * RTC routines for Malta style attached PIIX4 device, which contains a
20 * Motorola MC146818A-compatible Real Time Clock.
21 */
22#ifndef __ASM_MACH_MALTA_MC146818RTC_H
23#define __ASM_MACH_MALTA_MC146818RTC_H
24
25#include <asm/io.h>
26#include <asm/mips-boards/generic.h>
27#include <asm/mips-boards/malta.h>
28
29#define RTC_PORT(x) (0x70 + (x))
30#define RTC_IRQ 8
31
32static inline unsigned char CMOS_READ(unsigned long addr)
33{
34 outb(addr, MALTA_RTC_ADR_REG);
35 return inb(MALTA_RTC_DAT_REG);
36}
37
38static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
39{
40 outb(addr, MALTA_RTC_ADR_REG);
41 outb(data, MALTA_RTC_DAT_REG);
42}
43
44#define RTC_ALWAYS_BCD 0
45
46#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970)
47
48#endif /* __ASM_MACH_MALTA_MC146818RTC_H */
diff --git a/include/asm-mips/mach-ocelot/mach-gt64120.h b/include/asm-mips/mach-ocelot/mach-gt64120.h
new file mode 100644
index 000000000000..a62ecb53c751
--- /dev/null
+++ b/include/asm-mips/mach-ocelot/mach-gt64120.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#ifndef _ASM_GT64120_MOMENCO_OCELOT_GT64120_DEP_H
11#define _ASM_GT64120_MOMENCO_OCELOT_GT64120_DEP_H
12
13/*
14 * PCI address allocation
15 */
16#define GT_PCI_MEM_BASE (0x22000000UL)
17#define GT_PCI_MEM_SIZE GT_DEF_PCI0_MEM0_SIZE
18#define GT_PCI_IO_BASE (0x20000000UL)
19#define GT_PCI_IO_SIZE GT_DEF_PCI0_IO_SIZE
20
21extern unsigned long gt64120_base;
22
23#define GT64120_BASE (gt64120_base)
24
25/*
26 * GT timer irq
27 */
28#define GT_TIMER 6
29
30#endif /* _ASM_GT64120_MOMENCO_OCELOT_GT64120_DEP_H */
diff --git a/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h b/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
new file mode 100644
index 000000000000..7473512384bc
--- /dev/null
+++ b/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
@@ -0,0 +1,48 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004 MontaVista Software Inc.
7 * Author: Manish Lachwani, mlachwani@mvista.com
8 * Copyright (C) 2004 Ralf Baechle
9 */
10#ifndef __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H
11#define __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H
12
13/*
14 * Momentum Ocelot-3 is based on Rm7900 processor which
15 * is based on the E9000 core.
16 */
17#define cpu_has_watch 1
18#define cpu_has_mips16 0
19#define cpu_has_divec 0
20#define cpu_has_vce 0
21#define cpu_has_cache_cdex_p 0
22#define cpu_has_cache_cdex_s 0
23#define cpu_has_prefetch 1
24#define cpu_has_mcheck 0
25#define cpu_has_ejtag 0
26
27#define cpu_has_llsc 1
28#define cpu_has_vtag_icache 0
29#define cpu_has_dc_aliases 0
30#define cpu_has_ic_fills_f_dc 0
31#define cpu_icache_snoops_remote_store 0
32
33#define cpu_has_nofpuex 0
34#define cpu_has_64bits 1
35
36#define cpu_has_subset_pcaches 0
37
38#define cpu_dcache_line_size() 32
39#define cpu_icache_line_size() 32
40#define cpu_scache_line_size() 32
41
42/*
43 * On the RM9000 we need to ensure that I-cache lines being fetches only
44 * contain valid instructions are funny things will happen.
45 */
46#define PLAT_TRAMPOLINE_STUFF_LINE 32UL
47
48#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-pb1x00/mc146818rtc.h b/include/asm-mips/mach-pb1x00/mc146818rtc.h
new file mode 100644
index 000000000000..622c58710e5b
--- /dev/null
+++ b/include/asm-mips/mach-pb1x00/mc146818rtc.h
@@ -0,0 +1,34 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_AU1XX_MC146818RTC_H
11#define __ASM_MACH_AU1XX_MC146818RTC_H
12
13#include <asm/io.h>
14#include <asm/mach-au1x00/au1000.h>
15
16#define RTC_PORT(x) (0x0c000000 + (x))
17#define RTC_IRQ 8
18#define PB1500_RTC_ADDR 0x0c000000
19
20static inline unsigned char CMOS_READ(unsigned long offset)
21{
22 offset <<= 2;
23 return (u8)(au_readl(offset + PB1500_RTC_ADDR) & 0xff);
24}
25
26static inline void CMOS_WRITE(unsigned char data, unsigned long offset)
27{
28 offset <<= 2;
29 au_writel(data, offset + PB1500_RTC_ADDR);
30}
31
32#define RTC_ALWAYS_BCD 1
33
34#endif /* __ASM_MACH_AU1XX_MC146818RTC_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1000.h b/include/asm-mips/mach-pb1x00/pb1000.h
new file mode 100644
index 000000000000..50c1e413a688
--- /dev/null
+++ b/include/asm-mips/mach-pb1x00/pb1000.h
@@ -0,0 +1,172 @@
1/*
2 * Alchemy Semi PB1000 Referrence Board
3 *
4 * Copyright 2001 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc.
6 * ppopov@mvista.com or source@mvista.com
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 *
25 *
26 */
27#ifndef __ASM_PB1000_H
28#define __ASM_PB1000_H
29
30/* PCMCIA PB1000 specific defines */
31#define PCMCIA_MAX_SOCK 1
32#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
33
34#define PB1000_PCR 0xBE000000
35 #define PCR_SLOT_0_VPP0 (1<<0)
36 #define PCR_SLOT_0_VPP1 (1<<1)
37 #define PCR_SLOT_0_VCC0 (1<<2)
38 #define PCR_SLOT_0_VCC1 (1<<3)
39 #define PCR_SLOT_0_RST (1<<4)
40
41 #define PCR_SLOT_1_VPP0 (1<<8)
42 #define PCR_SLOT_1_VPP1 (1<<9)
43 #define PCR_SLOT_1_VCC0 (1<<10)
44 #define PCR_SLOT_1_VCC1 (1<<11)
45 #define PCR_SLOT_1_RST (1<<12)
46
47#define PB1000_MDR 0xBE000004
48 #define MDR_PI (1<<5) /* pcmcia int latch */
49 #define MDR_EPI (1<<14) /* enable pcmcia int */
50 #define MDR_CPI (1<<15) /* clear pcmcia int */
51
52#define PB1000_ACR1 0xBE000008
53 #define ACR1_SLOT_0_CD1 (1<<0) /* card detect 1 */
54 #define ACR1_SLOT_0_CD2 (1<<1) /* card detect 2 */
55 #define ACR1_SLOT_0_READY (1<<2) /* ready */
56 #define ACR1_SLOT_0_STATUS (1<<3) /* status change */
57 #define ACR1_SLOT_0_VS1 (1<<4) /* voltage sense 1 */
58 #define ACR1_SLOT_0_VS2 (1<<5) /* voltage sense 2 */
59 #define ACR1_SLOT_0_INPACK (1<<6) /* inpack pin status */
60 #define ACR1_SLOT_1_CD1 (1<<8) /* card detect 1 */
61 #define ACR1_SLOT_1_CD2 (1<<9) /* card detect 2 */
62 #define ACR1_SLOT_1_READY (1<<10) /* ready */
63 #define ACR1_SLOT_1_STATUS (1<<11) /* status change */
64 #define ACR1_SLOT_1_VS1 (1<<12) /* voltage sense 1 */
65 #define ACR1_SLOT_1_VS2 (1<<13) /* voltage sense 2 */
66 #define ACR1_SLOT_1_INPACK (1<<14) /* inpack pin status */
67
68#define CPLD_AUX0 0xBE00000C
69#define CPLD_AUX1 0xBE000010
70#define CPLD_AUX2 0xBE000014
71
72/* Voltage levels */
73
74/* VPPEN1 - VPPEN0 */
75#define VPP_GND ((0<<1) | (0<<0))
76#define VPP_5V ((1<<1) | (0<<0))
77#define VPP_3V ((0<<1) | (1<<0))
78#define VPP_12V ((0<<1) | (1<<0))
79#define VPP_HIZ ((1<<1) | (1<<0))
80
81/* VCCEN1 - VCCEN0 */
82#define VCC_3V ((0<<1) | (1<<0))
83#define VCC_5V ((1<<1) | (0<<0))
84#define VCC_HIZ ((0<<1) | (0<<0))
85
86/* VPP/VCC */
87#define SET_VCC_VPP(VCC, VPP, SLOT)\
88 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
89
90
91/* PCI PB1000 specific defines */
92/* The reason these defines are here instead of au1000.h is because
93 * the Au1000 does not have a PCI bus controller so the PCI implementation
94 * on the some of the older Pb1000 boards was very board specific.
95 */
96#define PCI_CONFIG_BASE 0xBA020000 /* the only external slot */
97
98#define SDRAM_DEVID 0xBA010000
99#define SDRAM_CMD 0xBA010004
100#define SDRAM_CLASS 0xBA010008
101#define SDRAM_MISC 0xBA01000C
102#define SDRAM_MBAR 0xBA010010
103
104#define PCI_IO_DATA_PORT 0xBA800000
105
106#define PCI_IO_ADDR 0xBE00001C
107#define PCI_INT_ACK 0xBBC00000
108#define PCI_IO_READ 0xBBC00020
109#define PCI_IO_WRITE 0xBBC00030
110
111#define PCI_BRIDGE_CONFIG 0xBE000018
112
113#define PCI_IO_START 0x10000000
114#define PCI_IO_END 0x1000ffff
115#define PCI_MEM_START 0x18000000
116#define PCI_MEM_END 0x18ffffff
117
118#define PCI_FIRST_DEVFN 0
119#define PCI_LAST_DEVFN 1
120
121static inline u8 au_pci_io_readb(u32 addr)
122{
123 writel(addr, PCI_IO_ADDR);
124 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<12), PCI_BRIDGE_CONFIG);
125 return (readl(PCI_IO_DATA_PORT) & 0xff);
126}
127
128static inline u16 au_pci_io_readw(u32 addr)
129{
130 writel(addr, PCI_IO_ADDR);
131 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<13), PCI_BRIDGE_CONFIG);
132 return (readl(PCI_IO_DATA_PORT) & 0xffff);
133}
134
135static inline u32 au_pci_io_readl(u32 addr)
136{
137 writel(addr, PCI_IO_ADDR);
138 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff), PCI_BRIDGE_CONFIG);
139 return readl(PCI_IO_DATA_PORT);
140}
141
142static inline void au_pci_io_writeb(u8 val, u32 addr)
143{
144 writel(addr, PCI_IO_ADDR);
145 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<12), PCI_BRIDGE_CONFIG);
146 writel(val, PCI_IO_DATA_PORT);
147}
148
149static inline void au_pci_io_writew(u16 val, u32 addr)
150{
151 writel(addr, PCI_IO_ADDR);
152 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<13), PCI_BRIDGE_CONFIG);
153 writel(val, PCI_IO_DATA_PORT);
154}
155
156static inline void au_pci_io_writel(u32 val, u32 addr)
157{
158 writel(addr, PCI_IO_ADDR);
159 writel(readl(PCI_BRIDGE_CONFIG) & 0xffffcfff, PCI_BRIDGE_CONFIG);
160 writel(val, PCI_IO_DATA_PORT);
161}
162
163static inline void set_sdram_extbyte(void)
164{
165 writel(readl(PCI_BRIDGE_CONFIG) & 0xffffff00, PCI_BRIDGE_CONFIG);
166}
167
168static inline void set_slot_extbyte(void)
169{
170 writel((readl(PCI_BRIDGE_CONFIG) & 0xffffbf00) | 0x18, PCI_BRIDGE_CONFIG);
171}
172#endif /* __ASM_PB1000_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1100.h b/include/asm-mips/mach-pb1x00/pb1100.h
new file mode 100644
index 000000000000..4c5a1cd01841
--- /dev/null
+++ b/include/asm-mips/mach-pb1x00/pb1100.h
@@ -0,0 +1,85 @@
1/*
2 * Alchemy Semi PB1100 Referrence Board
3 *
4 * Copyright 2001 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc.
6 * ppopov@mvista.com or source@mvista.com
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 *
25 *
26 */
27#ifndef __ASM_PB1100_H
28#define __ASM_PB1100_H
29
30#define PB1100_IDENT 0xAE000000
31#define BOARD_STATUS_REG 0xAE000004
32 #define PB1100_ROM_SEL (1<<15)
33 #define PB1100_ROM_SIZ (1<<14)
34 #define PB1100_SWAP_BOOT (1<<13)
35 #define PB1100_FLASH_WP (1<<12)
36 #define PB1100_ROM_H_STS (1<<11)
37 #define PB1100_ROM_L_STS (1<<10)
38 #define PB1100_FLASH_H_STS (1<<9)
39 #define PB1100_FLASH_L_STS (1<<8)
40 #define PB1100_SRAM_SIZ (1<<7)
41 #define PB1100_TSC_BUSY (1<<6)
42 #define PB1100_PCMCIA_VS_MASK (3<<4)
43 #define PB1100_RS232_CD (1<<3)
44 #define PB1100_RS232_CTS (1<<2)
45 #define PB1100_RS232_DSR (1<<1)
46 #define PB1100_RS232_RI (1<<0)
47
48#define PB1100_IRDA_RS232 0xAE00000C
49 #define PB1100_IRDA_FULL (0<<14) /* full power */
50 #define PB1100_IRDA_SHUTDOWN (1<<14)
51 #define PB1100_IRDA_TT (2<<14) /* 2/3 power */
52 #define PB1100_IRDA_OT (3<<14) /* 1/3 power */
53 #define PB1100_IRDA_FIR (1<<13)
54
55#define PCMCIA_BOARD_REG 0xAE000010
56 #define PB1100_SD_WP1_RO (1<<15) /* read only */
57 #define PB1100_SD_WP0_RO (1<<14) /* read only */
58 #define PB1100_SD_PWR1 (1<<11) /* applies power to SD1 */
59 #define PB1100_SD_PWR0 (1<<10) /* applies power to SD0 */
60 #define PB1100_SEL_SD_CONN1 (1<<9)
61 #define PB1100_SEL_SD_CONN0 (1<<8)
62 #define PC_DEASSERT_RST (1<<7)
63 #define PC_DRV_EN (1<<4)
64
65#define PB1100_G_CONTROL 0xAE000014 /* graphics control */
66
67#define PB1100_RST_VDDI 0xAE00001C
68 #define PB1100_SOFT_RESET (1<<15) /* clear to reset the board */
69 #define PB1100_VDDI_MASK (0x1F)
70
71#define PB1100_LEDS 0xAE000018
72
73/* 11:8 is 4 discreet LEDs. Clearing a bit illuminates the LED.
74 * 7:0 is the LED Display's decimal points.
75 */
76#define PB1100_HEX_LED 0xAE000018
77
78/* PCMCIA PB1100 specific defines */
79#define PCMCIA_MAX_SOCK 0
80#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
81
82/* VPP/VCC */
83#define SET_VCC_VPP(VCC, VPP) (((VCC)<<2) | ((VPP)<<0))
84
85#endif /* __ASM_PB1100_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1500.h b/include/asm-mips/mach-pb1x00/pb1500.h
new file mode 100644
index 000000000000..d6c779747b3c
--- /dev/null
+++ b/include/asm-mips/mach-pb1x00/pb1500.h
@@ -0,0 +1,51 @@
1/*
2 * Alchemy Semi PB1500 Referrence Board
3 *
4 * Copyright 2001 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc.
6 * ppopov@mvista.com or source@mvista.com
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 *
25 *
26 */
27#ifndef __ASM_PB1500_H
28#define __ASM_PB1500_H
29
30
31#define IDENT_BOARD_REG 0xAE000000
32#define BOARD_STATUS_REG 0xAE000004
33#define PCI_BOARD_REG 0xAE000010
34#define PCMCIA_BOARD_REG 0xAE000010
35 #define PC_DEASSERT_RST 0x80
36 #define PC_DRV_EN 0x10
37#define PB1500_G_CONTROL 0xAE000014
38#define PB1500_RST_VDDI 0xAE00001C
39#define PB1500_LEDS 0xAE000018
40
41#define PB1500_HEX_LED 0xAF000004
42#define PB1500_HEX_LED_BLANK 0xAF000008
43
44/* PCMCIA PB1500 specific defines */
45#define PCMCIA_MAX_SOCK 0
46#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
47
48/* VPP/VCC */
49#define SET_VCC_VPP(VCC, VPP) (((VCC)<<2) | ((VPP)<<0))
50
51#endif /* __ASM_PB1500_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1550.h b/include/asm-mips/mach-pb1x00/pb1550.h
new file mode 100644
index 000000000000..431d6088ea96
--- /dev/null
+++ b/include/asm-mips/mach-pb1x00/pb1550.h
@@ -0,0 +1,169 @@
1/*
2 * AMD Alchemy Semi PB1550 Referrence Board
3 * Board Registers defines.
4 *
5 * Copyright 2004 Embedded Edge LLC.
6 * Copyright 2005 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 *
25 *
26 */
27#ifndef __ASM_PB1550_H
28#define __ASM_PB1550_H
29
30#include <linux/config.h>
31#include <linux/types.h>
32
33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX
36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX
37
38#define SPI_PSC_BASE PSC0_BASE_ADDR
39#define AC97_PSC_BASE PSC1_BASE_ADDR
40#define SMBUS_PSC_BASE PSC2_BASE_ADDR
41#define I2S_PSC_BASE PSC3_BASE_ADDR
42
43#define BCSR_PHYS_ADDR 0xAF000000
44
45typedef volatile struct
46{
47 /*00*/ u16 whoami;
48 u16 reserved0;
49 /*04*/ u16 status;
50 u16 reserved1;
51 /*08*/ u16 switches;
52 u16 reserved2;
53 /*0C*/ u16 resets;
54 u16 reserved3;
55 /*10*/ u16 pcmcia;
56 u16 reserved4;
57 /*14*/ u16 pci;
58 u16 reserved5;
59 /*18*/ u16 leds;
60 u16 reserved6;
61 /*1C*/ u16 system;
62 u16 reserved7;
63
64} BCSR;
65
66static BCSR * const bcsr = (BCSR *)BCSR_PHYS_ADDR;
67
68/*
69 * Register bit definitions for the BCSRs
70 */
71#define BCSR_WHOAMI_DCID 0x000F
72#define BCSR_WHOAMI_CPLD 0x00F0
73#define BCSR_WHOAMI_BOARD 0x0F00
74
75#define BCSR_STATUS_PCMCIA0VS 0x0003
76#define BCSR_STATUS_PCMCIA1VS 0x000C
77#define BCSR_STATUS_PCMCIA0FI 0x0010
78#define BCSR_STATUS_PCMCIA1FI 0x0020
79#define BCSR_STATUS_SWAPBOOT 0x0040
80#define BCSR_STATUS_SRAMWIDTH 0x0080
81#define BCSR_STATUS_FLASHBUSY 0x0100
82#define BCSR_STATUS_ROMBUSY 0x0200
83#define BCSR_STATUS_USBOTGID 0x0800
84#define BCSR_STATUS_U0RXD 0x1000
85#define BCSR_STATUS_U1RXD 0x2000
86#define BCSR_STATUS_U3RXD 0x8000
87
88#define BCSR_SWITCHES_OCTAL 0x00FF
89#define BCSR_SWITCHES_DIP_1 0x0080
90#define BCSR_SWITCHES_DIP_2 0x0040
91#define BCSR_SWITCHES_DIP_3 0x0020
92#define BCSR_SWITCHES_DIP_4 0x0010
93#define BCSR_SWITCHES_DIP_5 0x0008
94#define BCSR_SWITCHES_DIP_6 0x0004
95#define BCSR_SWITCHES_DIP_7 0x0002
96#define BCSR_SWITCHES_DIP_8 0x0001
97#define BCSR_SWITCHES_ROTARY 0x0F00
98
99#define BCSR_RESETS_PHY0 0x0001
100#define BCSR_RESETS_PHY1 0x0002
101#define BCSR_RESETS_DC 0x0004
102#define BCSR_RESETS_WSC 0x2000
103#define BCSR_RESETS_SPISEL 0x4000
104#define BCSR_RESETS_DMAREQ 0x8000
105
106#define BCSR_PCMCIA_PC0VPP 0x0003
107#define BCSR_PCMCIA_PC0VCC 0x000C
108#define BCSR_PCMCIA_PC0DRVEN 0x0010
109#define BCSR_PCMCIA_PC0RST 0x0080
110#define BCSR_PCMCIA_PC1VPP 0x0300
111#define BCSR_PCMCIA_PC1VCC 0x0C00
112#define BCSR_PCMCIA_PC1DRVEN 0x1000
113#define BCSR_PCMCIA_PC1RST 0x8000
114
115#define BCSR_PCI_M66EN 0x0001
116#define BCSR_PCI_M33 0x0100
117#define BCSR_PCI_EXTERNARB 0x0200
118#define BCSR_PCI_GPIO200RST 0x0400
119#define BCSR_PCI_CLKOUT 0x0800
120#define BCSR_PCI_CFGHOST 0x1000
121
122#define BCSR_LEDS_DECIMALS 0x00FF
123#define BCSR_LEDS_LED0 0x0100
124#define BCSR_LEDS_LED1 0x0200
125#define BCSR_LEDS_LED2 0x0400
126#define BCSR_LEDS_LED3 0x0800
127
128#define BCSR_SYSTEM_VDDI 0x001F
129#define BCSR_SYSTEM_POWEROFF 0x4000
130#define BCSR_SYSTEM_RESET 0x8000
131
132#define PCMCIA_MAX_SOCK 1
133#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
134
135/* VPP/VCC */
136#define SET_VCC_VPP(VCC, VPP, SLOT)\
137 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
138
139#if defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
140#define PB1550_BOTH_BANKS
141#elif defined(CONFIG_MTD_PB1550_BOOT) && !defined(CONFIG_MTD_PB1550_USER)
142#define PB1550_BOOT_ONLY
143#elif !defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
144#define PB1550_USER_ONLY
145#endif
146
147/* Timing values as described in databook, * ns value stripped of
148 * lower 2 bits.
149 * These defines are here rather than an SOC1550 generic file because
150 * the parts chosen on another board may be different and may require
151 * different timings.
152 */
153#define NAND_T_H (18 >> 2)
154#define NAND_T_PUL (30 >> 2)
155#define NAND_T_SU (30 >> 2)
156#define NAND_T_WH (30 >> 2)
157
158/* Bitfield shift amounts */
159#define NAND_T_H_SHIFT 0
160#define NAND_T_PUL_SHIFT 4
161#define NAND_T_SU_SHIFT 8
162#define NAND_T_WH_SHIFT 12
163
164#define NAND_TIMING ((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
165 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
166 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
167 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT)
168
169#endif /* __ASM_PB1550_H */
diff --git a/include/asm-mips/mach-rm200/cpu-feature-overrides.h b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
new file mode 100644
index 000000000000..f48736032b2a
--- /dev/null
+++ b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
@@ -0,0 +1,42 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle
7 *
8 * SNI RM200 C apparently was only shipped with R4600 V2.0 and R5000 processors.
9 */
10#ifndef __ASM_MACH_RM200_CPU_FEATURE_OVERRIDES_H
11#define __ASM_MACH_RM200_CPU_FEATURE_OVERRIDES_H
12
13#include <cpu-feature-overrides.h>
14
15#define cpu_has_tlb 1
16#define cpu_has_4kex 1
17#define cpu_has_4ktlb 1
18#define cpu_has_fpu 1
19#define cpu_has_32fpr 1
20#define cpu_has_counter 1
21#define cpu_has_watch 0
22#define cpu_has_mips16 0
23#define cpu_has_divec 0
24#define cpu_has_vce 0
25#define cpu_has_cache_cdex_p 1
26#define cpu_has_cache_cdex_s 0
27#define cpu_has_prefetch 0
28#define cpu_has_mcheck 0
29#define cpu_has_ejtag 0
30#define cpu_has_llsc 1
31#define cpu_has_vtag_icache 0
32#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
33#define cpu_has_ic_fills_f_dc 0
34#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1
36
37#define cpu_has_subset_pcaches 0 /* No S-cache on R5000 I think ... */
38#define cpu_dcache_line_size() 32
39#define cpu_icache_line_size() 32
40#define cpu_scache_line_size() 0 /* No S-cache on R5000 I think ... */
41
42#endif /* __ASM_MACH_RM200_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-rm200/mc146818rtc.h b/include/asm-mips/mach-rm200/mc146818rtc.h
new file mode 100644
index 000000000000..d37ae68dc6a3
--- /dev/null
+++ b/include/asm-mips/mach-rm200/mc146818rtc.h
@@ -0,0 +1,17 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip with ARC epoch.
9 */
10#ifndef __ASM_MACH_RM200_MC146818RTC_H
11#define __ASM_MACH_RM200_MC146818RTC_H
12
13#define mc146818_decode_year(year) ((year) + 1980)
14
15#include_next <mc146818rtc.h>
16
17#endif /* __ASM_MACH_RM200_MC146818RTC_H */
diff --git a/include/asm-mips/mach-sibyte/cpu-feature-overrides.h b/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
new file mode 100644
index 000000000000..a3a2cc6014b2
--- /dev/null
+++ b/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
@@ -0,0 +1,39 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle
7 */
8#ifndef __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * Sibyte are MIPS64 processors weired to a specific configuration
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 1
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 1
22#define cpu_has_ejtag 1
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 1
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_icache_snoops_remote_store 0
29
30#define cpu_has_nofpuex 0
31#define cpu_has_64bits 1
32
33#define cpu_has_subset_pcaches 0
34
35#define cpu_dcache_line_size() 32
36#define cpu_icache_line_size() 32
37#define cpu_scache_line_size() 32
38
39#endif /* __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-vr41xx/timex.h b/include/asm-mips/mach-vr41xx/timex.h
new file mode 100644
index 000000000000..8d71485d003a
--- /dev/null
+++ b/include/asm-mips/mach-vr41xx/timex.h
@@ -0,0 +1,18 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8/*
9 * Changes:
10 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
11 * - CLOCK_TICK_RATE is changed into 32768 from 6144000.
12 */
13#ifndef __ASM_MACH_VR41XX_TIMEX_H
14#define __ASM_MACH_VR41XX_TIMEX_H
15
16#define CLOCK_TICK_RATE 32768
17
18#endif /* __ASM_MACH_VR41XX_TIMEX_H */
diff --git a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
new file mode 100644
index 000000000000..58603e3daca6
--- /dev/null
+++ b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
@@ -0,0 +1,45 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle
7 */
8#ifndef __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * Momentum Jaguar ATX always has the RM9000 processor.
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 0
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 0
22#define cpu_has_ejtag 0
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_icache_snoops_remote_store 0
29
30#define cpu_has_nofpuex 0
31#define cpu_has_64bits 1
32
33#define cpu_has_subset_pcaches 0
34
35#define cpu_dcache_line_size() 32
36#define cpu_icache_line_size() 32
37#define cpu_scache_line_size() 32
38
39/*
40 * On the RM9000 we need to ensure that I-cache lines being fetches only
41 * contain valid instructions are funny things will happen.
42 */
43#define PLAT_TRAMPOLINE_STUFF_LINE 32UL
44
45#endif /* __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/marvell.h b/include/asm-mips/marvell.h
new file mode 100644
index 000000000000..9225b3397a4f
--- /dev/null
+++ b/include/asm-mips/marvell.h
@@ -0,0 +1,56 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004 by Ralf Baechle
7 */
8#ifndef __ASM_MIPS_MARVELL_H
9#define __ASM_MIPS_MARVELL_H
10
11#include <linux/pci.h>
12
13#include <asm/byteorder.h>
14
15extern unsigned long marvell_base;
16
17/*
18 * Because of an error/peculiarity in the Galileo chip, we need to swap the
19 * bytes when running bigendian.
20 */
21#define __MV_READ(ofs) \
22 (*(volatile u32 *)(marvell_base+(ofs)))
23#define __MV_WRITE(ofs, data) \
24 do { *(volatile u32 *)(marvell_base+(ofs)) = (data); } while (0)
25
26#define MV_READ(ofs) le32_to_cpu(__MV_READ(ofs))
27#define MV_WRITE(ofs, data) __MV_WRITE(ofs, cpu_to_le32(data))
28
29#define MV_READ_16(ofs) \
30 le16_to_cpu(*(volatile u16 *)(marvell_base+(ofs)))
31#define MV_WRITE_16(ofs, data) \
32 *(volatile u16 *)(marvell_base+(ofs)) = cpu_to_le16(data)
33
34#define MV_READ_8(ofs) \
35 *(volatile u8 *)(marvell_base+(ofs))
36#define MV_WRITE_8(ofs, data) \
37 *(volatile u8 *)(marvell_base+(ofs)) = data
38
39#define MV_SET_REG_BITS(ofs, bits) \
40 (*((volatile u32 *)(marvell_base + (ofs)))) |= ((u32)cpu_to_le32(bits))
41#define MV_RESET_REG_BITS(ofs, bits) \
42 (*((volatile u32 *)(marvell_base + (ofs)))) &= ~((u32)cpu_to_le32(bits))
43
44extern struct pci_ops mv_pci_ops;
45
46struct mv_pci_controller {
47 struct pci_controller pcic;
48
49 /*
50 * GT-64240/MV-64340 specific, per host bus information
51 */
52 unsigned long config_addr;
53 unsigned long config_vreg;
54};
55
56#endif /* __ASM_MIPS_MARVELL_H */
diff --git a/include/asm-mips/mc146818-time.h b/include/asm-mips/mc146818-time.h
new file mode 100644
index 000000000000..a2c2d2c24303
--- /dev/null
+++ b/include/asm-mips/mc146818-time.h
@@ -0,0 +1,128 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Machine dependent access functions for RTC registers.
7 */
8#ifndef __ASM_MC146818_TIME_H
9#define __ASM_MC146818_TIME_H
10
11#include <linux/bcd.h>
12#include <linux/mc146818rtc.h>
13#include <linux/time.h>
14
15/*
16 * For check timing call set_rtc_mmss() 500ms; used in timer interrupt.
17 */
18#define USEC_AFTER 500000
19#define USEC_BEFORE 500000
20
21/*
22 * In order to set the CMOS clock precisely, set_rtc_mmss has to be
23 * called 500 ms after the second nowtime has started, because when
24 * nowtime is written into the registers of the CMOS clock, it will
25 * jump to the next second precisely 500 ms later. Check the Motorola
26 * MC146818A or Dallas DS12887 data sheet for details.
27 *
28 * BUG: This routine does not handle hour overflow properly; it just
29 * sets the minutes. Usually you'll only notice that after reboot!
30 */
31static inline int mc146818_set_rtc_mmss(unsigned long nowtime)
32{
33 int real_seconds, real_minutes, cmos_minutes;
34 unsigned char save_control, save_freq_select;
35 int retval = 0;
36
37 save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */
38 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
39
40 save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */
41 CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
42
43 cmos_minutes = CMOS_READ(RTC_MINUTES);
44 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
45 BCD_TO_BIN(cmos_minutes);
46
47 /*
48 * since we're only adjusting minutes and seconds,
49 * don't interfere with hour overflow. This avoids
50 * messing with unknown time zones but requires your
51 * RTC not to be off by more than 15 minutes
52 */
53 real_seconds = nowtime % 60;
54 real_minutes = nowtime / 60;
55 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
56 real_minutes += 30; /* correct for half hour time zone */
57 real_minutes %= 60;
58
59 if (abs(real_minutes - cmos_minutes) < 30) {
60 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
61 BIN_TO_BCD(real_seconds);
62 BIN_TO_BCD(real_minutes);
63 }
64 CMOS_WRITE(real_seconds,RTC_SECONDS);
65 CMOS_WRITE(real_minutes,RTC_MINUTES);
66 } else {
67 printk(KERN_WARNING
68 "set_rtc_mmss: can't update from %d to %d\n",
69 cmos_minutes, real_minutes);
70 retval = -1;
71 }
72
73 /* The following flags have to be released exactly in this order,
74 * otherwise the DS12887 (popular MC146818A clone with integrated
75 * battery and quartz) will not reset the oscillator and will not
76 * update precisely 500 ms later. You won't find this mentioned in
77 * the Dallas Semiconductor data sheets, but who believes data
78 * sheets anyway ... -- Markus Kuhn
79 */
80 CMOS_WRITE(save_control, RTC_CONTROL);
81 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
82
83 return retval;
84}
85
86static inline unsigned long mc146818_get_cmos_time(void)
87{
88 unsigned int year, mon, day, hour, min, sec;
89 int i;
90
91 /*
92 * The Linux interpretation of the CMOS clock register contents:
93 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
94 * RTC registers show the second which has precisely just started.
95 * Let's hope other operating systems interpret the RTC the same way.
96 */
97
98 /* read RTC exactly on falling edge of update flag */
99 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
100 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
101 break;
102 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
103 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
104 break;
105
106 do { /* Isn't this overkill ? UIP above should guarantee consistency */
107 sec = CMOS_READ(RTC_SECONDS);
108 min = CMOS_READ(RTC_MINUTES);
109 hour = CMOS_READ(RTC_HOURS);
110 day = CMOS_READ(RTC_DAY_OF_MONTH);
111 mon = CMOS_READ(RTC_MONTH);
112 year = CMOS_READ(RTC_YEAR);
113 } while (sec != CMOS_READ(RTC_SECONDS));
114
115 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
116 BCD_TO_BIN(sec);
117 BCD_TO_BIN(min);
118 BCD_TO_BIN(hour);
119 BCD_TO_BIN(day);
120 BCD_TO_BIN(mon);
121 BCD_TO_BIN(year);
122 }
123 year = mc146818_decode_year(year);
124
125 return mktime(year, mon, day, hour, min, sec);
126}
127
128#endif /* __ASM_MC146818_TIME_H */
diff --git a/include/asm-mips/mc146818rtc.h b/include/asm-mips/mc146818rtc.h
new file mode 100644
index 000000000000..68b4da6d520b
--- /dev/null
+++ b/include/asm-mips/mc146818rtc.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Machine dependent access functions for RTC registers.
7 *
8 * Copyright (C) 1996, 1997, 1998, 2000 Ralf Baechle
9 * Copyright (C) 2002 Maciej W. Rozycki
10 */
11#ifndef _ASM_MC146818RTC_H
12#define _ASM_MC146818RTC_H
13
14#include <mc146818rtc.h>
15
16#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-mips/mips-boards/atlas.h b/include/asm-mips/mips-boards/atlas.h
new file mode 100644
index 000000000000..0998151fb3a1
--- /dev/null
+++ b/include/asm-mips/mips-boards/atlas.h
@@ -0,0 +1,64 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Defines of the Atlas board specific address-MAP, registers, etc.
23 *
24 */
25#ifndef _MIPS_ATLAS_H
26#define _MIPS_ATLAS_H
27
28#include <asm/addrspace.h>
29
30/*
31 * Atlas RTC-device indirect register access.
32 */
33#define ATLAS_RTC_ADR_REG 0x1f000800
34#define ATLAS_RTC_DAT_REG 0x1f000808
35
36
37/*
38 * Atlas interrupt controller register base.
39 */
40#define ATLAS_ICTRL_REGS_BASE 0x1f000000
41
42/*
43 * Atlas UART register base.
44 */
45#define ATLAS_UART_REGS_BASE 0x1f000900
46#define ATLAS_BASE_BAUD ( 3686400 / 16 )
47
48/*
49 * Atlas PSU standby register.
50 */
51#define ATLAS_PSUSTBY_REG 0x1f000600
52#define ATLAS_GOSTBY 0x4d
53
54/*
55 * We make a universal assumption about the way the bootloader (YAMON)
56 * have located the Philips SAA9730 chip.
57 * This is not ideal, but is needed for setting up remote debugging as
58 * soon as possible.
59 */
60#define ATLAS_SAA9730_REG 0x10800000
61
62#define ATLAS_SAA9730_BAUDCLOCK 3692300
63
64#endif /* !(_MIPS_ATLAS_H) */
diff --git a/include/asm-mips/mips-boards/atlasint.h b/include/asm-mips/mips-boards/atlasint.h
new file mode 100644
index 000000000000..bba35c183d08
--- /dev/null
+++ b/include/asm-mips/mips-boards/atlasint.h
@@ -0,0 +1,84 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Defines for the Atlas interrupt controller.
23 *
24 */
25#ifndef _MIPS_ATLASINT_H
26#define _MIPS_ATLASINT_H
27
28#define ATLASINT_BASE 1
29#define ATLASINT_UART (ATLASINT_BASE+0)
30#define ATLASINT_TIM0 (ATLASINT_BASE+1)
31#define ATLASINT_RES2 (ATLASINT_BASE+2)
32#define ATLASINT_RES3 (ATLASINT_BASE+3)
33#define ATLASINT_RTC (ATLASINT_BASE+4)
34#define ATLASINT_COREHI (ATLASINT_BASE+5)
35#define ATLASINT_CORELO (ATLASINT_BASE+6)
36#define ATLASINT_RES7 (ATLASINT_BASE+7)
37#define ATLASINT_PCIA (ATLASINT_BASE+8)
38#define ATLASINT_PCIB (ATLASINT_BASE+9)
39#define ATLASINT_PCIC (ATLASINT_BASE+10)
40#define ATLASINT_PCID (ATLASINT_BASE+11)
41#define ATLASINT_ENUM (ATLASINT_BASE+12)
42#define ATLASINT_DEG (ATLASINT_BASE+13)
43#define ATLASINT_ATXFAIL (ATLASINT_BASE+14)
44#define ATLASINT_INTA (ATLASINT_BASE+15)
45#define ATLASINT_INTB (ATLASINT_BASE+16)
46#define ATLASINT_ETH ATLASINT_INTB
47#define ATLASINT_INTC (ATLASINT_BASE+17)
48#define ATLASINT_SCSI ATLASINT_INTC
49#define ATLASINT_INTD (ATLASINT_BASE+18)
50#define ATLASINT_SERR (ATLASINT_BASE+19)
51#define ATLASINT_RES20 (ATLASINT_BASE+20)
52#define ATLASINT_RES21 (ATLASINT_BASE+21)
53#define ATLASINT_RES22 (ATLASINT_BASE+22)
54#define ATLASINT_RES23 (ATLASINT_BASE+23)
55#define ATLASINT_RES24 (ATLASINT_BASE+24)
56#define ATLASINT_RES25 (ATLASINT_BASE+25)
57#define ATLASINT_RES26 (ATLASINT_BASE+26)
58#define ATLASINT_RES27 (ATLASINT_BASE+27)
59#define ATLASINT_RES28 (ATLASINT_BASE+28)
60#define ATLASINT_RES29 (ATLASINT_BASE+29)
61#define ATLASINT_RES30 (ATLASINT_BASE+30)
62#define ATLASINT_RES31 (ATLASINT_BASE+31)
63#define ATLASINT_END (ATLASINT_BASE+31)
64
65/*
66 * Atlas registers are memory mapped on 64-bit aligned boundaries and
67 * only word access are allowed.
68 */
69struct atlas_ictrl_regs {
70 volatile unsigned int intraw;
71 int dummy1;
72 volatile unsigned int intseten;
73 int dummy2;
74 volatile unsigned int intrsten;
75 int dummy3;
76 volatile unsigned int intenable;
77 int dummy4;
78 volatile unsigned int intstatus;
79 int dummy5;
80};
81
82extern void atlasint_init(void);
83
84#endif /* !(_MIPS_ATLASINT_H) */
diff --git a/include/asm-mips/mips-boards/bonito64.h b/include/asm-mips/mips-boards/bonito64.h
new file mode 100644
index 000000000000..cd7125610100
--- /dev/null
+++ b/include/asm-mips/mips-boards/bonito64.h
@@ -0,0 +1,431 @@
1/*
2 * Bonito Register Map
3 *
4 * This file is the original bonito.h from Algorithmics with minor changes
5 * to fit into linux.
6 *
7 * Copyright (c) 1999 Algorithmics Ltd
8 *
9 * Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2001 MIPS Technologies, Inc. All rights reserved.
11 *
12 * Algorithmics gives permission for anyone to use and modify this file
13 * without any obligation or license condition except that you retain
14 * this copyright message in any source redistribution in whole or part.
15 *
16 */
17
18/* Revision 1.48 autogenerated on 08/17/99 15:20:01 */
19/* This bonito64 version editted from bonito.h Revision 1.48 on 11/09/00 */
20
21#ifndef _ASM_MIPS_BOARDS_BONITO64_H
22#define _ASM_MIPS_BOARDS_BONITO64_H
23
24#ifdef __ASSEMBLY__
25
26/* offsets from base register */
27#define BONITO(x) (x)
28
29#else /* !__ASSEMBLY__ */
30
31/*
32 * Algorithmics Bonito64 system controller register base.
33 */
34extern unsigned long _pcictrl_bonito;
35extern unsigned long _pcictrl_bonito_pcicfg;
36
37#define BONITO(x) *(volatile u32 *)(_pcictrl_bonito + (x))
38
39#endif /* __ASSEMBLY__ */
40
41
42#define BONITO_BOOT_BASE 0x1fc00000
43#define BONITO_BOOT_SIZE 0x00100000
44#define BONITO_BOOT_TOP (BONITO_BOOT_BASE+BONITO_BOOT_SIZE-1)
45#define BONITO_FLASH_BASE 0x1c000000
46#define BONITO_FLASH_SIZE 0x03000000
47#define BONITO_FLASH_TOP (BONITO_FLASH_BASE+BONITO_FLASH_SIZE-1)
48#define BONITO_SOCKET_BASE 0x1f800000
49#define BONITO_SOCKET_SIZE 0x00400000
50#define BONITO_SOCKET_TOP (BONITO_SOCKET_BASE+BONITO_SOCKET_SIZE-1)
51#define BONITO_REG_BASE 0x1fe00000
52#define BONITO_REG_SIZE 0x00040000
53#define BONITO_REG_TOP (BONITO_REG_BASE+BONITO_REG_SIZE-1)
54#define BONITO_DEV_BASE 0x1ff00000
55#define BONITO_DEV_SIZE 0x00100000
56#define BONITO_DEV_TOP (BONITO_DEV_BASE+BONITO_DEV_SIZE-1)
57#define BONITO_PCILO_BASE 0x10000000
58#define BONITO_PCILO_SIZE 0x0c000000
59#define BONITO_PCILO_TOP (BONITO_PCILO_BASE+BONITO_PCILO_SIZE-1)
60#define BONITO_PCILO0_BASE 0x10000000
61#define BONITO_PCILO1_BASE 0x14000000
62#define BONITO_PCILO2_BASE 0x18000000
63#define BONITO_PCIHI_BASE 0x20000000
64#define BONITO_PCIHI_SIZE 0x20000000
65#define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE+BONITO_PCIHI_SIZE-1)
66#define BONITO_PCIIO_BASE 0x1fd00000
67#define BONITO_PCIIO_SIZE 0x00100000
68#define BONITO_PCIIO_TOP (BONITO_PCIIO_BASE+BONITO_PCIIO_SIZE-1)
69#define BONITO_PCICFG_BASE 0x1fe80000
70#define BONITO_PCICFG_SIZE 0x00080000
71#define BONITO_PCICFG_TOP (BONITO_PCICFG_BASE+BONITO_PCICFG_SIZE-1)
72
73
74/* Bonito Register Bases */
75
76#define BONITO_PCICONFIGBASE 0x00
77#define BONITO_REGBASE 0x100
78
79
80/* PCI Configuration Registers */
81
82#define BONITO_PCI_REG(x) BONITO(BONITO_PCICONFIGBASE + (x))
83#define BONITO_PCIDID BONITO_PCI_REG(0x00)
84#define BONITO_PCICMD BONITO_PCI_REG(0x04)
85#define BONITO_PCICLASS BONITO_PCI_REG(0x08)
86#define BONITO_PCILTIMER BONITO_PCI_REG(0x0c)
87#define BONITO_PCIBASE0 BONITO_PCI_REG(0x10)
88#define BONITO_PCIBASE1 BONITO_PCI_REG(0x14)
89#define BONITO_PCIBASE2 BONITO_PCI_REG(0x18)
90#define BONITO_PCIEXPRBASE BONITO_PCI_REG(0x30)
91#define BONITO_PCIINT BONITO_PCI_REG(0x3c)
92
93#define BONITO_PCICMD_PERR_CLR 0x80000000
94#define BONITO_PCICMD_SERR_CLR 0x40000000
95#define BONITO_PCICMD_MABORT_CLR 0x20000000
96#define BONITO_PCICMD_MTABORT_CLR 0x10000000
97#define BONITO_PCICMD_TABORT_CLR 0x08000000
98#define BONITO_PCICMD_MPERR_CLR 0x01000000
99#define BONITO_PCICMD_PERRRESPEN 0x00000040
100#define BONITO_PCICMD_ASTEPEN 0x00000080
101#define BONITO_PCICMD_SERREN 0x00000100
102#define BONITO_PCILTIMER_BUSLATENCY 0x0000ff00
103#define BONITO_PCILTIMER_BUSLATENCY_SHIFT 8
104
105
106
107
108/* 1. Bonito h/w Configuration */
109/* Power on register */
110
111#define BONITO_BONPONCFG BONITO(BONITO_REGBASE + 0x00)
112
113#define BONITO_BONPONCFG_SYSCONTROLLERRD 0x00040000
114#define BONITO_BONPONCFG_ROMCS1SAMP 0x00020000
115#define BONITO_BONPONCFG_ROMCS0SAMP 0x00010000
116#define BONITO_BONPONCFG_CPUBIGEND 0x00004000
117/* Added by RPF 11-9-00 */
118#define BONITO_BONPONCFG_BURSTORDER 0x00001000
119/* --- */
120#define BONITO_BONPONCFG_CPUPARITY 0x00002000
121#define BONITO_BONPONCFG_CPUTYPE 0x00000007
122#define BONITO_BONPONCFG_CPUTYPE_SHIFT 0
123#define BONITO_BONPONCFG_PCIRESET_OUT 0x00000008
124#define BONITO_BONPONCFG_IS_ARBITER 0x00000010
125#define BONITO_BONPONCFG_ROMBOOT 0x000000c0
126#define BONITO_BONPONCFG_ROMBOOT_SHIFT 6
127
128#define BONITO_BONPONCFG_ROMBOOT_FLASH (0x0<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
129#define BONITO_BONPONCFG_ROMBOOT_SOCKET (0x1<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
130#define BONITO_BONPONCFG_ROMBOOT_SDRAM (0x2<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
131#define BONITO_BONPONCFG_ROMBOOT_CPURESET (0x3<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
132
133#define BONITO_BONPONCFG_ROMCS0WIDTH 0x00000100
134#define BONITO_BONPONCFG_ROMCS1WIDTH 0x00000200
135#define BONITO_BONPONCFG_ROMCS0FAST 0x00000400
136#define BONITO_BONPONCFG_ROMCS1FAST 0x00000800
137#define BONITO_BONPONCFG_CONFIG_DIS 0x00000020
138
139
140/* Other Bonito configuration */
141
142#define BONITO_BONGENCFG_OFFSET 0x4
143#define BONITO_BONGENCFG BONITO(BONITO_REGBASE + BONITO_BONGENCFG_OFFSET)
144
145#define BONITO_BONGENCFG_DEBUGMODE 0x00000001
146#define BONITO_BONGENCFG_SNOOPEN 0x00000002
147#define BONITO_BONGENCFG_CPUSELFRESET 0x00000004
148
149#define BONITO_BONGENCFG_FORCE_IRQA 0x00000008
150#define BONITO_BONGENCFG_IRQA_ISOUT 0x00000010
151#define BONITO_BONGENCFG_IRQA_FROM_INT1 0x00000020
152#define BONITO_BONGENCFG_BYTESWAP 0x00000040
153
154#define BONITO_BONGENCFG_UNCACHED 0x00000080
155#define BONITO_BONGENCFG_PREFETCHEN 0x00000100
156#define BONITO_BONGENCFG_WBEHINDEN 0x00000200
157#define BONITO_BONGENCFG_CACHEALG 0x00000c00
158#define BONITO_BONGENCFG_CACHEALG_SHIFT 10
159#define BONITO_BONGENCFG_PCIQUEUE 0x00001000
160#define BONITO_BONGENCFG_CACHESTOP 0x00002000
161#define BONITO_BONGENCFG_MSTRBYTESWAP 0x00004000
162#define BONITO_BONGENCFG_BUSERREN 0x00008000
163#define BONITO_BONGENCFG_NORETRYTIMEOUT 0x00010000
164#define BONITO_BONGENCFG_SHORTCOPYTIMEOUT 0x00020000
165
166/* 2. IO & IDE configuration */
167
168#define BONITO_IODEVCFG BONITO(BONITO_REGBASE + 0x08)
169
170/* 3. IO & IDE configuration */
171
172#define BONITO_SDCFG BONITO(BONITO_REGBASE + 0x0c)
173
174/* 4. PCI address map control */
175
176#define BONITO_PCIMAP BONITO(BONITO_REGBASE + 0x10)
177#define BONITO_PCIMEMBASECFG BONITO(BONITO_REGBASE + 0x14)
178#define BONITO_PCIMAP_CFG BONITO(BONITO_REGBASE + 0x18)
179
180/* 5. ICU & GPIO regs */
181
182/* GPIO Regs - r/w */
183
184#define BONITO_GPIODATA_OFFSET 0x1c
185#define BONITO_GPIODATA BONITO(BONITO_REGBASE + BONITO_GPIODATA_OFFSET)
186#define BONITO_GPIOIE BONITO(BONITO_REGBASE + 0x20)
187
188/* ICU Configuration Regs - r/w */
189
190#define BONITO_INTEDGE BONITO(BONITO_REGBASE + 0x24)
191#define BONITO_INTSTEER BONITO(BONITO_REGBASE + 0x28)
192#define BONITO_INTPOL BONITO(BONITO_REGBASE + 0x2c)
193
194/* ICU Enable Regs - IntEn & IntISR are r/o. */
195
196#define BONITO_INTENSET BONITO(BONITO_REGBASE + 0x30)
197#define BONITO_INTENCLR BONITO(BONITO_REGBASE + 0x34)
198#define BONITO_INTEN BONITO(BONITO_REGBASE + 0x38)
199#define BONITO_INTISR BONITO(BONITO_REGBASE + 0x3c)
200
201/* PCI mail boxes */
202
203#define BONITO_PCIMAIL0_OFFSET 0x40
204#define BONITO_PCIMAIL1_OFFSET 0x44
205#define BONITO_PCIMAIL2_OFFSET 0x48
206#define BONITO_PCIMAIL3_OFFSET 0x4c
207#define BONITO_PCIMAIL0 BONITO(BONITO_REGBASE + 0x40)
208#define BONITO_PCIMAIL1 BONITO(BONITO_REGBASE + 0x44)
209#define BONITO_PCIMAIL2 BONITO(BONITO_REGBASE + 0x48)
210#define BONITO_PCIMAIL3 BONITO(BONITO_REGBASE + 0x4c)
211
212
213/* 6. PCI cache */
214
215#define BONITO_PCICACHECTRL BONITO(BONITO_REGBASE + 0x50)
216#define BONITO_PCICACHETAG BONITO(BONITO_REGBASE + 0x54)
217
218#define BONITO_PCIBADADDR BONITO(BONITO_REGBASE + 0x58)
219#define BONITO_PCIMSTAT BONITO(BONITO_REGBASE + 0x5c)
220
221
222/*
223#define BONITO_PCIRDPOST BONITO(BONITO_REGBASE + 0x60)
224#define BONITO_PCIDATA BONITO(BONITO_REGBASE + 0x64)
225*/
226
227/* 7. IDE DMA & Copier */
228
229#define BONITO_CONFIGBASE 0x000
230#define BONITO_BONITOBASE 0x100
231#define BONITO_LDMABASE 0x200
232#define BONITO_COPBASE 0x300
233#define BONITO_REG_BLOCKMASK 0x300
234
235#define BONITO_LDMACTRL BONITO(BONITO_LDMABASE + 0x0)
236#define BONITO_LDMASTAT BONITO(BONITO_LDMABASE + 0x0)
237#define BONITO_LDMAADDR BONITO(BONITO_LDMABASE + 0x4)
238#define BONITO_LDMAGO BONITO(BONITO_LDMABASE + 0x8)
239#define BONITO_LDMADATA BONITO(BONITO_LDMABASE + 0xc)
240
241#define BONITO_COPCTRL BONITO(BONITO_COPBASE + 0x0)
242#define BONITO_COPSTAT BONITO(BONITO_COPBASE + 0x0)
243#define BONITO_COPPADDR BONITO(BONITO_COPBASE + 0x4)
244#define BONITO_COPDADDR BONITO(BONITO_COPBASE + 0x8)
245#define BONITO_COPGO BONITO(BONITO_COPBASE + 0xc)
246
247
248/* ###### Bit Definitions for individual Registers #### */
249
250/* Gen DMA. */
251
252#define BONITO_IDECOPDADDR_DMA_DADDR 0x0ffffffc
253#define BONITO_IDECOPDADDR_DMA_DADDR_SHIFT 2
254#define BONITO_IDECOPPADDR_DMA_PADDR 0xfffffffc
255#define BONITO_IDECOPPADDR_DMA_PADDR_SHIFT 2
256#define BONITO_IDECOPGO_DMA_SIZE 0x0000fffe
257#define BONITO_IDECOPGO_DMA_SIZE_SHIFT 0
258#define BONITO_IDECOPGO_DMA_WRITE 0x00010000
259#define BONITO_IDECOPGO_DMAWCOUNT 0x000f0000
260#define BONITO_IDECOPGO_DMAWCOUNT_SHIFT 16
261
262#define BONITO_IDECOPCTRL_DMA_STARTBIT 0x80000000
263#define BONITO_IDECOPCTRL_DMA_RSTBIT 0x40000000
264
265/* DRAM - sdCfg */
266
267#define BONITO_SDCFG_AROWBITS 0x00000003
268#define BONITO_SDCFG_AROWBITS_SHIFT 0
269#define BONITO_SDCFG_ACOLBITS 0x0000000c
270#define BONITO_SDCFG_ACOLBITS_SHIFT 2
271#define BONITO_SDCFG_ABANKBIT 0x00000010
272#define BONITO_SDCFG_ASIDES 0x00000020
273#define BONITO_SDCFG_AABSENT 0x00000040
274#define BONITO_SDCFG_AWIDTH64 0x00000080
275
276#define BONITO_SDCFG_BROWBITS 0x00000300
277#define BONITO_SDCFG_BROWBITS_SHIFT 8
278#define BONITO_SDCFG_BCOLBITS 0x00000c00
279#define BONITO_SDCFG_BCOLBITS_SHIFT 10
280#define BONITO_SDCFG_BBANKBIT 0x00001000
281#define BONITO_SDCFG_BSIDES 0x00002000
282#define BONITO_SDCFG_BABSENT 0x00004000
283#define BONITO_SDCFG_BWIDTH64 0x00008000
284
285#define BONITO_SDCFG_EXTRDDATA 0x00010000
286#define BONITO_SDCFG_EXTRASCAS 0x00020000
287#define BONITO_SDCFG_EXTPRECH 0x00040000
288#define BONITO_SDCFG_EXTRASWIDTH 0x00180000
289#define BONITO_SDCFG_EXTRASWIDTH_SHIFT 19
290/* Changed by RPF 11-9-00 */
291#define BONITO_SDCFG_DRAMMODESET 0x00200000
292/* --- */
293#define BONITO_SDCFG_DRAMEXTREGS 0x00400000
294#define BONITO_SDCFG_DRAMPARITY 0x00800000
295/* Added by RPF 11-9-00 */
296#define BONITO_SDCFG_DRAMBURSTLEN 0x03000000
297#define BONITO_SDCFG_DRAMBURSTLEN_SHIFT 24
298#define BONITO_SDCFG_DRAMMODESET_DONE 0x80000000
299/* --- */
300
301/* PCI Cache - pciCacheCtrl */
302
303#define BONITO_PCICACHECTRL_CACHECMD 0x00000007
304#define BONITO_PCICACHECTRL_CACHECMD_SHIFT 0
305#define BONITO_PCICACHECTRL_CACHECMDLINE 0x00000018
306#define BONITO_PCICACHECTRL_CACHECMDLINE_SHIFT 3
307#define BONITO_PCICACHECTRL_CMDEXEC 0x00000020
308
309#define BONITO_PCICACHECTRL_IOBCCOH_PRES 0x00000100
310#define BONITO_PCICACHECTRL_IOBCCOH_EN 0x00000200
311#define BONITO_PCICACHECTRL_CPUCOH_PRES 0x00000400
312#define BONITO_PCICACHECTRL_CPUCOH_EN 0x00000800
313
314#define BONITO_IODEVCFG_BUFFBIT_CS0 0x00000001
315#define BONITO_IODEVCFG_SPEEDBIT_CS0 0x00000002
316#define BONITO_IODEVCFG_MOREABITS_CS0 0x00000004
317
318#define BONITO_IODEVCFG_BUFFBIT_CS1 0x00000008
319#define BONITO_IODEVCFG_SPEEDBIT_CS1 0x00000010
320#define BONITO_IODEVCFG_MOREABITS_CS1 0x00000020
321
322#define BONITO_IODEVCFG_BUFFBIT_CS2 0x00000040
323#define BONITO_IODEVCFG_SPEEDBIT_CS2 0x00000080
324#define BONITO_IODEVCFG_MOREABITS_CS2 0x00000100
325
326#define BONITO_IODEVCFG_BUFFBIT_CS3 0x00000200
327#define BONITO_IODEVCFG_SPEEDBIT_CS3 0x00000400
328#define BONITO_IODEVCFG_MOREABITS_CS3 0x00000800
329
330#define BONITO_IODEVCFG_BUFFBIT_IDE 0x00001000
331#define BONITO_IODEVCFG_SPEEDBIT_IDE 0x00002000
332#define BONITO_IODEVCFG_WORDSWAPBIT_IDE 0x00004000
333#define BONITO_IODEVCFG_MODEBIT_IDE 0x00008000
334#define BONITO_IODEVCFG_DMAON_IDE 0x001f0000
335#define BONITO_IODEVCFG_DMAON_IDE_SHIFT 16
336#define BONITO_IODEVCFG_DMAOFF_IDE 0x01e00000
337#define BONITO_IODEVCFG_DMAOFF_IDE_SHIFT 21
338#define BONITO_IODEVCFG_EPROMSPLIT 0x02000000
339/* Added by RPF 11-9-00 */
340#define BONITO_IODEVCFG_CPUCLOCKPERIOD 0xfc000000
341#define BONITO_IODEVCFG_CPUCLOCKPERIOD_SHIFT 26
342/* --- */
343
344/* gpio */
345#define BONITO_GPIO_GPIOW 0x000003ff
346#define BONITO_GPIO_GPIOW_SHIFT 0
347#define BONITO_GPIO_GPIOR 0x01ff0000
348#define BONITO_GPIO_GPIOR_SHIFT 16
349#define BONITO_GPIO_GPINR 0xfe000000
350#define BONITO_GPIO_GPINR_SHIFT 25
351#define BONITO_GPIO_IOW(N) (1<<(BONITO_GPIO_GPIOW_SHIFT+(N)))
352#define BONITO_GPIO_IOR(N) (1<<(BONITO_GPIO_GPIOR_SHIFT+(N)))
353#define BONITO_GPIO_INR(N) (1<<(BONITO_GPIO_GPINR_SHIFT+(N)))
354
355/* ICU */
356#define BONITO_ICU_MBOXES 0x0000000f
357#define BONITO_ICU_MBOXES_SHIFT 0
358#define BONITO_ICU_DMARDY 0x00000010
359#define BONITO_ICU_DMAEMPTY 0x00000020
360#define BONITO_ICU_COPYRDY 0x00000040
361#define BONITO_ICU_COPYEMPTY 0x00000080
362#define BONITO_ICU_COPYERR 0x00000100
363#define BONITO_ICU_PCIIRQ 0x00000200
364#define BONITO_ICU_MASTERERR 0x00000400
365#define BONITO_ICU_SYSTEMERR 0x00000800
366#define BONITO_ICU_DRAMPERR 0x00001000
367#define BONITO_ICU_RETRYERR 0x00002000
368#define BONITO_ICU_GPIOS 0x01ff0000
369#define BONITO_ICU_GPIOS_SHIFT 16
370#define BONITO_ICU_GPINS 0x7e000000
371#define BONITO_ICU_GPINS_SHIFT 25
372#define BONITO_ICU_MBOX(N) (1<<(BONITO_ICU_MBOXES_SHIFT+(N)))
373#define BONITO_ICU_GPIO(N) (1<<(BONITO_ICU_GPIOS_SHIFT+(N)))
374#define BONITO_ICU_GPIN(N) (1<<(BONITO_ICU_GPINS_SHIFT+(N)))
375
376/* pcimap */
377
378#define BONITO_PCIMAP_PCIMAP_LO0 0x0000003f
379#define BONITO_PCIMAP_PCIMAP_LO0_SHIFT 0
380#define BONITO_PCIMAP_PCIMAP_LO1 0x00000fc0
381#define BONITO_PCIMAP_PCIMAP_LO1_SHIFT 6
382#define BONITO_PCIMAP_PCIMAP_LO2 0x0003f000
383#define BONITO_PCIMAP_PCIMAP_LO2_SHIFT 12
384#define BONITO_PCIMAP_PCIMAP_2 0x00040000
385#define BONITO_PCIMAP_WIN(WIN,ADDR) ((((ADDR)>>26) & BONITO_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
386
387#define BONITO_PCIMAP_WINSIZE (1<<26)
388#define BONITO_PCIMAP_WINOFFSET(ADDR) ((ADDR) & (BONITO_PCIMAP_WINSIZE - 1))
389#define BONITO_PCIMAP_WINBASE(ADDR) ((ADDR) << 26)
390
391/* pcimembaseCfg */
392
393#define BONITO_PCIMEMBASECFG_MASK 0xf0000000
394#define BONITO_PCIMEMBASECFG_MEMBASE0_MASK 0x0000001f
395#define BONITO_PCIMEMBASECFG_MEMBASE0_MASK_SHIFT 0
396#define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS 0x000003e0
397#define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS_SHIFT 5
398#define BONITO_PCIMEMBASECFG_MEMBASE0_CACHED 0x00000400
399#define BONITO_PCIMEMBASECFG_MEMBASE0_IO 0x00000800
400
401#define BONITO_PCIMEMBASECFG_MEMBASE1_MASK 0x0001f000
402#define BONITO_PCIMEMBASECFG_MEMBASE1_MASK_SHIFT 12
403#define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS 0x003e0000
404#define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS_SHIFT 17
405#define BONITO_PCIMEMBASECFG_MEMBASE1_CACHED 0x00400000
406#define BONITO_PCIMEMBASECFG_MEMBASE1_IO 0x00800000
407
408#define BONITO_PCIMEMBASECFG_ASHIFT 23
409#define BONITO_PCIMEMBASECFG_AMASK 0x007fffff
410#define BONITO_PCIMEMBASECFGSIZE(WIN,SIZE) (((~((SIZE)-1))>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)
411#define BONITO_PCIMEMBASECFGBASE(WIN,BASE) (((BASE)>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS)
412
413#define BONITO_PCIMEMBASECFG_SIZE(WIN,CFG) (((((~(CFG)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)) << (BONITO_PCIMEMBASECFG_ASHIFT - BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) | BONITO_PCIMEMBASECFG_AMASK)
414
415
416#define BONITO_PCIMEMBASECFG_ADDRMASK(WIN,CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
417#define BONITO_PCIMEMBASECFG_ADDRMASK(WIN,CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
418#define BONITO_PCIMEMBASECFG_ADDRTRANS(WIN,CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
419
420#define BONITO_PCITOPHYS(WIN,ADDR,CFG) ( \
421 (((ADDR) & (~(BONITO_PCIMEMBASECFG_MASK))) & (~(BONITO_PCIMEMBASECFG_ADDRMASK(WIN,CFG)))) | \
422 (BONITO_PCIMEMBASECFG_ADDRTRANS(WIN,CFG)) \
423 )
424
425/* PCICmd */
426
427#define BONITO_PCICMD_MEMEN 0x00000002
428#define BONITO_PCICMD_MSTREN 0x00000004
429
430
431#endif /* _ASM_MIPS_BOARDS_BONITO64_H */
diff --git a/include/asm-mips/mips-boards/generic.h b/include/asm-mips/mips-boards/generic.h
new file mode 100644
index 000000000000..65d1d16eab16
--- /dev/null
+++ b/include/asm-mips/mips-boards/generic.h
@@ -0,0 +1,82 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Defines of the MIPS boards specific address-MAP, registers, etc.
19 */
20#ifndef __ASM_MIPS_BOARDS_GENERIC_H
21#define __ASM_MIPS_BOARDS_GENERIC_H
22
23#include <linux/config.h>
24#include <asm/addrspace.h>
25#include <asm/byteorder.h>
26#include <asm/mips-boards/bonito64.h>
27
28/*
29 * Display register base.
30 */
31#ifdef CONFIG_MIPS_SEAD
32#define ASCII_DISPLAY_POS_BASE 0x1f0005c0
33#else
34#define ASCII_DISPLAY_WORD_BASE 0x1f000410
35#define ASCII_DISPLAY_POS_BASE 0x1f000418
36#endif
37
38
39/*
40 * Yamon Prom print address.
41 */
42#define YAMON_PROM_PRINT_ADDR 0x1fc00504
43
44
45/*
46 * Reset register.
47 */
48#ifdef CONFIG_MIPS_SEAD
49#define SOFTRES_REG 0x1e800050
50#define GORESET 0x4d
51#else
52#define SOFTRES_REG 0x1f000500
53#define GORESET 0x42
54#endif
55
56/*
57 * Revision register.
58 */
59#define MIPS_REVISION_REG 0x1fc00010
60#define MIPS_REVISION_CORID_QED_RM5261 0
61#define MIPS_REVISION_CORID_CORE_LV 1
62#define MIPS_REVISION_CORID_BONITO64 2
63#define MIPS_REVISION_CORID_CORE_20K 3
64#define MIPS_REVISION_CORID_CORE_FPGA 4
65#define MIPS_REVISION_CORID_CORE_MSC 5
66#define MIPS_REVISION_CORID_CORE_EMUL 6
67#define MIPS_REVISION_CORID_CORE_FPGA2 7
68#define MIPS_REVISION_CORID_CORE_FPGAR2 8
69
70/**** Artificial corid defines ****/
71/*
72 * CoreEMUL with Bonito System Controller is treated like a Core20K
73 * CoreEMUL with SOC-it 101 System Controller is treated like a CoreMSC
74 */
75#define MIPS_REVISION_CORID_CORE_EMUL_BON 0x63
76#define MIPS_REVISION_CORID_CORE_EMUL_MSC 0x65
77
78#define MIPS_REVISION_CORID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 10) & 0x3f)
79
80extern unsigned int mips_revision_corid;
81
82#endif /* __ASM_MIPS_BOARDS_GENERIC_H */
diff --git a/include/asm-mips/mips-boards/malta.h b/include/asm-mips/mips-boards/malta.h
new file mode 100644
index 000000000000..b0ba3c5a921e
--- /dev/null
+++ b/include/asm-mips/mips-boards/malta.h
@@ -0,0 +1,75 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Defines of the Malta board specific address-MAP, registers, etc.
19 */
20#ifndef __ASM_MIPS_BOARDS_MALTA_H
21#define __ASM_MIPS_BOARDS_MALTA_H
22
23#include <asm/addrspace.h>
24#include <asm/io.h>
25#include <asm/mips-boards/msc01_pci.h>
26#include <asm/gt64120.h>
27
28/*
29 * Malta I/O ports base address for the Galileo GT64120 and Algorithmics
30 * Bonito system controllers.
31 */
32#define MALTA_GT_PORT_BASE get_gt_port_base(GT_PCI0IOLD_OFS)
33#define MALTA_BONITO_PORT_BASE ((unsigned long)ioremap (0x1fd00000, 0x10000))
34#define MALTA_MSC_PORT_BASE get_msc_port_base(MSC01_PCI_SC2PIOBASL)
35
36static inline unsigned long get_gt_port_base(unsigned long reg)
37{
38 unsigned long addr;
39 addr = GT_READ(reg);
40 return (unsigned long) ioremap (((addr & 0xffff) << 21), 0x10000);
41}
42
43static inline unsigned long get_msc_port_base(unsigned long reg)
44{
45 unsigned long addr;
46 MSC_READ(reg, addr);
47 return (unsigned long) ioremap(addr, 0x10000);
48}
49
50/*
51 * Malta RTC-device indirect register access.
52 */
53#define MALTA_RTC_ADR_REG 0x70
54#define MALTA_RTC_DAT_REG 0x71
55
56/*
57 * Malta SMSC FDC37M817 Super I/O Controller register.
58 */
59#define SMSC_CONFIG_REG 0x3f0
60#define SMSC_DATA_REG 0x3f1
61
62#define SMSC_CONFIG_DEVNUM 0x7
63#define SMSC_CONFIG_ACTIVATE 0x30
64#define SMSC_CONFIG_ENTER 0x55
65#define SMSC_CONFIG_EXIT 0xaa
66
67#define SMSC_CONFIG_DEVNUM_FLOPPY 0
68
69#define SMSC_CONFIG_ACTIVATE_ENABLE 1
70
71#define SMSC_WRITE(x,a) outb(x,a)
72
73#define MALTA_JMPRS_REG 0x1f000210
74
75#endif /* __ASM_MIPS_BOARDS_MALTA_H */
diff --git a/include/asm-mips/mips-boards/maltaint.h b/include/asm-mips/mips-boards/maltaint.h
new file mode 100644
index 000000000000..376181882e81
--- /dev/null
+++ b/include/asm-mips/mips-boards/maltaint.h
@@ -0,0 +1,33 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Defines for the Malta interrupt controller.
23 *
24 */
25#ifndef _MIPS_MALTAINT_H
26#define _MIPS_MALTAINT_H
27
28/* Number of IRQ supported on hw interrupt 0. */
29#define MALTAINT_END 16
30
31extern void maltaint_init(void);
32
33#endif /* !(_MIPS_MALTAINT_H) */
diff --git a/include/asm-mips/mips-boards/msc01_pci.h b/include/asm-mips/mips-boards/msc01_pci.h
new file mode 100644
index 000000000000..6b2a87a38f4b
--- /dev/null
+++ b/include/asm-mips/mips-boards/msc01_pci.h
@@ -0,0 +1,256 @@
1/*
2 * PCI Register definitions for the MIPS System Controller.
3 *
4 * Carsten Langgaard, carstenl@mips.com
5 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __ASM_MIPS_BOARDS_MSC01_PCI_H
12#define __ASM_MIPS_BOARDS_MSC01_PCI_H
13
14/*
15 * Register offset addresses
16 */
17
18#define MSC01_PCI_ID_OFS 0x0000
19#define MSC01_PCI_SC2PMBASL_OFS 0x0208
20#define MSC01_PCI_SC2PMMSKL_OFS 0x0218
21#define MSC01_PCI_SC2PMMAPL_OFS 0x0228
22#define MSC01_PCI_SC2PIOBASL_OFS 0x0248
23#define MSC01_PCI_SC2PIOMSKL_OFS 0x0258
24#define MSC01_PCI_SC2PIOMAPL_OFS 0x0268
25#define MSC01_PCI_P2SCMSKL_OFS 0x0308
26#define MSC01_PCI_P2SCMAPL_OFS 0x0318
27#define MSC01_PCI_INTCFG_OFS 0x0600
28#define MSC01_PCI_INTSTAT_OFS 0x0608
29#define MSC01_PCI_CFGADDR_OFS 0x0610
30#define MSC01_PCI_CFGDATA_OFS 0x0618
31#define MSC01_PCI_IACK_OFS 0x0620
32#define MSC01_PCI_HEAD0_OFS 0x2000 /* DevID, VendorID */
33#define MSC01_PCI_HEAD1_OFS 0x2008 /* Status, Command */
34#define MSC01_PCI_HEAD2_OFS 0x2010 /* Class code, RevID */
35#define MSC01_PCI_HEAD3_OFS 0x2018 /* bist, header, latency */
36#define MSC01_PCI_HEAD4_OFS 0x2020 /* BAR 0 */
37#define MSC01_PCI_HEAD5_OFS 0x2028 /* BAR 1 */
38#define MSC01_PCI_HEAD6_OFS 0x2030 /* BAR 2 */
39#define MSC01_PCI_HEAD7_OFS 0x2038 /* BAR 3 */
40#define MSC01_PCI_HEAD8_OFS 0x2040 /* BAR 4 */
41#define MSC01_PCI_HEAD9_OFS 0x2048 /* BAR 5 */
42#define MSC01_PCI_HEAD10_OFS 0x2050 /* CardBus CIS Ptr */
43#define MSC01_PCI_HEAD11_OFS 0x2058 /* SubSystem ID, -VendorID */
44#define MSC01_PCI_HEAD12_OFS 0x2060 /* ROM BAR */
45#define MSC01_PCI_HEAD13_OFS 0x2068 /* Capabilities ptr */
46#define MSC01_PCI_HEAD14_OFS 0x2070 /* reserved */
47#define MSC01_PCI_HEAD15_OFS 0x2078 /* Maxl, ming, intpin, int */
48#define MSC01_PCI_BAR0_OFS 0x2220
49#define MSC01_PCI_CFG_OFS 0x2380
50#define MSC01_PCI_SWAP_OFS 0x2388
51
52
53/*****************************************************************************
54 * Register encodings
55 ****************************************************************************/
56
57#define MSC01_PCI_ID_ID_SHF 16
58#define MSC01_PCI_ID_ID_MSK 0x00ff0000
59#define MSC01_PCI_ID_ID_HOSTBRIDGE 82
60#define MSC01_PCI_ID_MAR_SHF 8
61#define MSC01_PCI_ID_MAR_MSK 0x0000ff00
62#define MSC01_PCI_ID_MIR_SHF 0
63#define MSC01_PCI_ID_MIR_MSK 0x000000ff
64
65#define MSC01_PCI_SC2PMBASL_BAS_SHF 24
66#define MSC01_PCI_SC2PMBASL_BAS_MSK 0xff000000
67
68#define MSC01_PCI_SC2PMMSKL_MSK_SHF 24
69#define MSC01_PCI_SC2PMMSKL_MSK_MSK 0xff000000
70
71#define MSC01_PCI_SC2PMMAPL_MAP_SHF 24
72#define MSC01_PCI_SC2PMMAPL_MAP_MSK 0xff000000
73
74#define MSC01_PCI_SC2PIOBASL_BAS_SHF 24
75#define MSC01_PCI_SC2PIOBASL_BAS_MSK 0xff000000
76
77#define MSC01_PCI_SC2PIOMSKL_MSK_SHF 24
78#define MSC01_PCI_SC2PIOMSKL_MSK_MSK 0xff000000
79
80#define MSC01_PCI_SC2PIOMAPL_MAP_SHF 24
81#define MSC01_PCI_SC2PIOMAPL_MAP_MSK 0xff000000
82
83#define MSC01_PCI_P2SCMSKL_MSK_SHF 24
84#define MSC01_PCI_P2SCMSKL_MSK_MSK 0xff000000
85
86#define MSC01_PCI_P2SCMAPL_MAP_SHF 24
87#define MSC01_PCI_P2SCMAPL_MAP_MSK 0xff000000
88
89#define MSC01_PCI_INTCFG_RST_SHF 10
90#define MSC01_PCI_INTCFG_RST_MSK 0x00000400
91#define MSC01_PCI_INTCFG_RST_BIT 0x00000400
92#define MSC01_PCI_INTCFG_MWE_SHF 9
93#define MSC01_PCI_INTCFG_MWE_MSK 0x00000200
94#define MSC01_PCI_INTCFG_MWE_BIT 0x00000200
95#define MSC01_PCI_INTCFG_DTO_SHF 8
96#define MSC01_PCI_INTCFG_DTO_MSK 0x00000100
97#define MSC01_PCI_INTCFG_DTO_BIT 0x00000100
98#define MSC01_PCI_INTCFG_MA_SHF 7
99#define MSC01_PCI_INTCFG_MA_MSK 0x00000080
100#define MSC01_PCI_INTCFG_MA_BIT 0x00000080
101#define MSC01_PCI_INTCFG_TA_SHF 6
102#define MSC01_PCI_INTCFG_TA_MSK 0x00000040
103#define MSC01_PCI_INTCFG_TA_BIT 0x00000040
104#define MSC01_PCI_INTCFG_RTY_SHF 5
105#define MSC01_PCI_INTCFG_RTY_MSK 0x00000020
106#define MSC01_PCI_INTCFG_RTY_BIT 0x00000020
107#define MSC01_PCI_INTCFG_MWP_SHF 4
108#define MSC01_PCI_INTCFG_MWP_MSK 0x00000010
109#define MSC01_PCI_INTCFG_MWP_BIT 0x00000010
110#define MSC01_PCI_INTCFG_MRP_SHF 3
111#define MSC01_PCI_INTCFG_MRP_MSK 0x00000008
112#define MSC01_PCI_INTCFG_MRP_BIT 0x00000008
113#define MSC01_PCI_INTCFG_SWP_SHF 2
114#define MSC01_PCI_INTCFG_SWP_MSK 0x00000004
115#define MSC01_PCI_INTCFG_SWP_BIT 0x00000004
116#define MSC01_PCI_INTCFG_SRP_SHF 1
117#define MSC01_PCI_INTCFG_SRP_MSK 0x00000002
118#define MSC01_PCI_INTCFG_SRP_BIT 0x00000002
119#define MSC01_PCI_INTCFG_SE_SHF 0
120#define MSC01_PCI_INTCFG_SE_MSK 0x00000001
121#define MSC01_PCI_INTCFG_SE_BIT 0x00000001
122
123#define MSC01_PCI_INTSTAT_RST_SHF 10
124#define MSC01_PCI_INTSTAT_RST_MSK 0x00000400
125#define MSC01_PCI_INTSTAT_RST_BIT 0x00000400
126#define MSC01_PCI_INTSTAT_MWE_SHF 9
127#define MSC01_PCI_INTSTAT_MWE_MSK 0x00000200
128#define MSC01_PCI_INTSTAT_MWE_BIT 0x00000200
129#define MSC01_PCI_INTSTAT_DTO_SHF 8
130#define MSC01_PCI_INTSTAT_DTO_MSK 0x00000100
131#define MSC01_PCI_INTSTAT_DTO_BIT 0x00000100
132#define MSC01_PCI_INTSTAT_MA_SHF 7
133#define MSC01_PCI_INTSTAT_MA_MSK 0x00000080
134#define MSC01_PCI_INTSTAT_MA_BIT 0x00000080
135#define MSC01_PCI_INTSTAT_TA_SHF 6
136#define MSC01_PCI_INTSTAT_TA_MSK 0x00000040
137#define MSC01_PCI_INTSTAT_TA_BIT 0x00000040
138#define MSC01_PCI_INTSTAT_RTY_SHF 5
139#define MSC01_PCI_INTSTAT_RTY_MSK 0x00000020
140#define MSC01_PCI_INTSTAT_RTY_BIT 0x00000020
141#define MSC01_PCI_INTSTAT_MWP_SHF 4
142#define MSC01_PCI_INTSTAT_MWP_MSK 0x00000010
143#define MSC01_PCI_INTSTAT_MWP_BIT 0x00000010
144#define MSC01_PCI_INTSTAT_MRP_SHF 3
145#define MSC01_PCI_INTSTAT_MRP_MSK 0x00000008
146#define MSC01_PCI_INTSTAT_MRP_BIT 0x00000008
147#define MSC01_PCI_INTSTAT_SWP_SHF 2
148#define MSC01_PCI_INTSTAT_SWP_MSK 0x00000004
149#define MSC01_PCI_INTSTAT_SWP_BIT 0x00000004
150#define MSC01_PCI_INTSTAT_SRP_SHF 1
151#define MSC01_PCI_INTSTAT_SRP_MSK 0x00000002
152#define MSC01_PCI_INTSTAT_SRP_BIT 0x00000002
153#define MSC01_PCI_INTSTAT_SE_SHF 0
154#define MSC01_PCI_INTSTAT_SE_MSK 0x00000001
155#define MSC01_PCI_INTSTAT_SE_BIT 0x00000001
156
157#define MSC01_PCI_CFGADDR_BNUM_SHF 16
158#define MSC01_PCI_CFGADDR_BNUM_MSK 0x00ff0000
159#define MSC01_PCI_CFGADDR_DNUM_SHF 11
160#define MSC01_PCI_CFGADDR_DNUM_MSK 0x0000f800
161#define MSC01_PCI_CFGADDR_FNUM_SHF 8
162#define MSC01_PCI_CFGADDR_FNUM_MSK 0x00000700
163#define MSC01_PCI_CFGADDR_RNUM_SHF 2
164#define MSC01_PCI_CFGADDR_RNUM_MSK 0x000000fc
165
166#define MSC01_PCI_CFGDATA_DATA_SHF 0
167#define MSC01_PCI_CFGDATA_DATA_MSK 0xffffffff
168
169/* The defines below are ONLY valid for a MEM bar! */
170#define MSC01_PCI_BAR0_SIZE_SHF 4
171#define MSC01_PCI_BAR0_SIZE_MSK 0xfffffff0
172#define MSC01_PCI_BAR0_P_SHF 3
173#define MSC01_PCI_BAR0_P_MSK 0x00000008
174#define MSC01_PCI_BAR0_P_BIT MSC01_PCI_BAR0_P_MSK
175#define MSC01_PCI_BAR0_D_SHF 1
176#define MSC01_PCI_BAR0_D_MSK 0x00000006
177#define MSC01_PCI_BAR0_T_SHF 0
178#define MSC01_PCI_BAR0_T_MSK 0x00000001
179#define MSC01_PCI_BAR0_T_BIT MSC01_PCI_BAR0_T_MSK
180
181
182#define MSC01_PCI_CFG_RA_SHF 17
183#define MSC01_PCI_CFG_RA_MSK 0x00020000
184#define MSC01_PCI_CFG_RA_BIT MSC01_PCI_CFG_RA_MSK
185#define MSC01_PCI_CFG_G_SHF 16
186#define MSC01_PCI_CFG_G_MSK 0x00010000
187#define MSC01_PCI_CFG_G_BIT MSC01_PCI_CFG_G_MSK
188#define MSC01_PCI_CFG_EN_SHF 15
189#define MSC01_PCI_CFG_EN_MSK 0x00008000
190#define MSC01_PCI_CFG_EN_BIT MSC01_PCI_CFG_EN_MSK
191#define MSC01_PCI_CFG_MAXRTRY_SHF 0
192#define MSC01_PCI_CFG_MAXRTRY_MSK 0x000000ff
193
194#define MSC01_PCI_SWAP_IO_SHF 18
195#define MSC01_PCI_SWAP_IO_MSK 0x000c0000
196#define MSC01_PCI_SWAP_MEM_SHF 16
197#define MSC01_PCI_SWAP_MEM_MSK 0x00030000
198#define MSC01_PCI_SWAP_BAR0_SHF 0
199#define MSC01_PCI_SWAP_BAR0_MSK 0x00000003
200#define MSC01_PCI_SWAP_NOSWAP 0
201#define MSC01_PCI_SWAP_BYTESWAP 1
202
203/*
204 * MIPS System controller PCI register base.
205 *
206 * FIXME - are these macros specific to Malta and co or to the MSC? If the
207 * latter, they should be moved elsewhere.
208 */
209#define MIPS_MSC01_PCI_REG_BASE 0x1bd00000
210
211extern unsigned long _pcictrl_msc;
212
213#define MSC01_PCI_REG_BASE _pcictrl_msc
214
215#define MSC_WRITE(reg, data) do { *(volatile u32 *)(reg) = data; } while (0)
216#define MSC_READ(reg, data) do { data = *(volatile u32 *)(reg); } while (0)
217
218/*
219 * Registers absolute addresses
220 */
221
222#define MSC01_PCI_ID (MSC01_PCI_REG_BASE + MSC01_PCI_ID_OFS)
223#define MSC01_PCI_SC2PMBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMBASL_OFS)
224#define MSC01_PCI_SC2PMMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMSKL_OFS)
225#define MSC01_PCI_SC2PMMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMAPL_OFS)
226#define MSC01_PCI_SC2PIOBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOBASL_OFS)
227#define MSC01_PCI_SC2PIOMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMSKL_OFS)
228#define MSC01_PCI_SC2PIOMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMAPL_OFS)
229#define MSC01_PCI_P2SCMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMSKL_OFS)
230#define MSC01_PCI_P2SCMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMAPL_OFS)
231#define MSC01_PCI_INTCFG (MSC01_PCI_REG_BASE + MSC01_PCI_INTCFG_OFS)
232#define MSC01_PCI_INTSTAT (MSC01_PCI_REG_BASE + MSC01_PCI_INTSTAT_OFS)
233#define MSC01_PCI_CFGADDR (MSC01_PCI_REG_BASE + MSC01_PCI_CFGADDR_OFS)
234#define MSC01_PCI_CFGDATA (MSC01_PCI_REG_BASE + MSC01_PCI_CFGDATA_OFS)
235#define MSC01_PCI_IACK (MSC01_PCI_REG_BASE + MSC01_PCI_IACK_OFS)
236#define MSC01_PCI_HEAD0 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD0_OFS)
237#define MSC01_PCI_HEAD1 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD1_OFS)
238#define MSC01_PCI_HEAD2 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD2_OFS)
239#define MSC01_PCI_HEAD3 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD3_OFS)
240#define MSC01_PCI_HEAD4 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD4_OFS)
241#define MSC01_PCI_HEAD5 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD5_OFS)
242#define MSC01_PCI_HEAD6 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD6_OFS)
243#define MSC01_PCI_HEAD7 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD7_OFS)
244#define MSC01_PCI_HEAD8 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD8_OFS)
245#define MSC01_PCI_HEAD9 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD9_OFS)
246#define MSC01_PCI_HEAD10 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD10_OFS)
247#define MSC01_PCI_HEAD11 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
248#define MSC01_PCI_HEAD12 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
249#define MSC01_PCI_HEAD13 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
250#define MSC01_PCI_HEAD14 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
251#define MSC01_PCI_HEAD15 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
252#define MSC01_PCI_BAR0 (MSC01_PCI_REG_BASE + MSC01_PCI_BAR0_OFS)
253#define MSC01_PCI_CFG (MSC01_PCI_REG_BASE + MSC01_PCI_CFG_OFS)
254#define MSC01_PCI_SWAP (MSC01_PCI_REG_BASE + MSC01_PCI_SWAP_OFS)
255
256#endif /* __ASM_MIPS_BOARDS_MSC01_PCI_H */
diff --git a/include/asm-mips/mips-boards/piix4.h b/include/asm-mips/mips-boards/piix4.h
new file mode 100644
index 000000000000..2971d60f2e95
--- /dev/null
+++ b/include/asm-mips/mips-boards/piix4.h
@@ -0,0 +1,80 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Register definitions for Intel PIIX4 South Bridge Device.
19 */
20#ifndef __ASM_MIPS_BOARDS_PIIX4_H
21#define __ASM_MIPS_BOARDS_PIIX4_H
22
23/************************************************************************
24 * IO register offsets
25 ************************************************************************/
26#define PIIX4_ICTLR1_ICW1 0x20
27#define PIIX4_ICTLR1_ICW2 0x21
28#define PIIX4_ICTLR1_ICW3 0x21
29#define PIIX4_ICTLR1_ICW4 0x21
30#define PIIX4_ICTLR2_ICW1 0xa0
31#define PIIX4_ICTLR2_ICW2 0xa1
32#define PIIX4_ICTLR2_ICW3 0xa1
33#define PIIX4_ICTLR2_ICW4 0xa1
34#define PIIX4_ICTLR1_OCW1 0x21
35#define PIIX4_ICTLR1_OCW2 0x20
36#define PIIX4_ICTLR1_OCW3 0x20
37#define PIIX4_ICTLR1_OCW4 0x20
38#define PIIX4_ICTLR2_OCW1 0xa1
39#define PIIX4_ICTLR2_OCW2 0xa0
40#define PIIX4_ICTLR2_OCW3 0xa0
41#define PIIX4_ICTLR2_OCW4 0xa0
42
43
44/************************************************************************
45 * Register encodings.
46 ************************************************************************/
47#define PIIX4_OCW2_NSEOI (0x1 << 5)
48#define PIIX4_OCW2_SEOI (0x3 << 5)
49#define PIIX4_OCW2_RNSEOI (0x5 << 5)
50#define PIIX4_OCW2_RAEOIS (0x4 << 5)
51#define PIIX4_OCW2_RAEOIC (0x0 << 5)
52#define PIIX4_OCW2_RSEOI (0x7 << 5)
53#define PIIX4_OCW2_SP (0x6 << 5)
54#define PIIX4_OCW2_NOP (0x2 << 5)
55
56#define PIIX4_OCW2_SEL (0x0 << 3)
57
58#define PIIX4_OCW2_ILS_0 0
59#define PIIX4_OCW2_ILS_1 1
60#define PIIX4_OCW2_ILS_2 2
61#define PIIX4_OCW2_ILS_3 3
62#define PIIX4_OCW2_ILS_4 4
63#define PIIX4_OCW2_ILS_5 5
64#define PIIX4_OCW2_ILS_6 6
65#define PIIX4_OCW2_ILS_7 7
66#define PIIX4_OCW2_ILS_8 0
67#define PIIX4_OCW2_ILS_9 1
68#define PIIX4_OCW2_ILS_10 2
69#define PIIX4_OCW2_ILS_11 3
70#define PIIX4_OCW2_ILS_12 4
71#define PIIX4_OCW2_ILS_13 5
72#define PIIX4_OCW2_ILS_14 6
73#define PIIX4_OCW2_ILS_15 7
74
75#define PIIX4_OCW3_SEL (0x1 << 3)
76
77#define PIIX4_OCW3_IRR 0x2
78#define PIIX4_OCW3_ISR 0x3
79
80#endif /* __ASM_MIPS_BOARDS_PIIX4_H */
diff --git a/include/asm-mips/mips-boards/prom.h b/include/asm-mips/mips-boards/prom.h
new file mode 100644
index 000000000000..4168c7fcd43e
--- /dev/null
+++ b/include/asm-mips/mips-boards/prom.h
@@ -0,0 +1,49 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * MIPS boards bootprom interface for the Linux kernel.
23 *
24 */
25
26#ifndef _MIPS_PROM_H
27#define _MIPS_PROM_H
28
29extern char *prom_getcmdline(void);
30extern char *prom_getenv(char *name);
31extern void setup_prom_printf(int tty_no);
32extern void prom_printf(char *fmt, ...);
33extern void prom_init_cmdline(void);
34extern void prom_meminit(void);
35extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
36extern unsigned long prom_free_prom_memory (void);
37extern void mips_display_message(const char *str);
38extern void mips_display_word(unsigned int num);
39extern int get_ethernet_addr(char *ethernet_addr);
40
41/* Memory descriptor management. */
42#define PROM_MAX_PMEMBLOCKS 32
43struct prom_pmemblock {
44 unsigned long base; /* Within KSEG0. */
45 unsigned int size; /* In bytes. */
46 unsigned int type; /* free or prom memory */
47};
48
49#endif /* !(_MIPS_PROM_H) */
diff --git a/include/asm-mips/mips-boards/saa9730_uart.h b/include/asm-mips/mips-boards/saa9730_uart.h
new file mode 100644
index 000000000000..c913143d58ec
--- /dev/null
+++ b/include/asm-mips/mips-boards/saa9730_uart.h
@@ -0,0 +1,69 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Register definitions for the UART part of the Philips SAA9730 chip.
23 *
24 */
25
26#ifndef SAA9730_UART_H
27#define SAA9730_UART_H
28
29/* The SAA9730 UART register map, as seen via the PCI bus */
30
31#define SAA9730_UART_REGS_ADDR 0x21800
32
33struct uart_saa9730_regmap {
34 volatile unsigned char Thr_Rbr;
35 volatile unsigned char Ier;
36 volatile unsigned char Iir_Fcr;
37 volatile unsigned char Lcr;
38 volatile unsigned char Mcr;
39 volatile unsigned char Lsr;
40 volatile unsigned char Msr;
41 volatile unsigned char Scr;
42 volatile unsigned char BaudDivLsb;
43 volatile unsigned char BaudDivMsb;
44 volatile unsigned char Junk0;
45 volatile unsigned char Junk1;
46 volatile unsigned int Config; /* 0x2180c */
47 volatile unsigned int TxStart; /* 0x21810 */
48 volatile unsigned int TxLength; /* 0x21814 */
49 volatile unsigned int TxCounter; /* 0x21818 */
50 volatile unsigned int RxStart; /* 0x2181c */
51 volatile unsigned int RxLength; /* 0x21820 */
52 volatile unsigned int RxCounter; /* 0x21824 */
53};
54typedef volatile struct uart_saa9730_regmap t_uart_saa9730_regmap;
55
56/*
57 * Only a subset of the UART control bits are defined here,
58 * enough to make the serial debug port work.
59 */
60
61#define SAA9730_LCR_DATA8 0x03
62
63#define SAA9730_MCR_DTR 0x01
64#define SAA9730_MCR_RTS 0x02
65
66#define SAA9730_LSR_DR 0x01
67#define SAA9730_LSR_THRE 0x20
68
69#endif /* !(SAA9730_UART_H) */
diff --git a/include/asm-mips/mips-boards/sead.h b/include/asm-mips/mips-boards/sead.h
new file mode 100644
index 000000000000..68c69de0b66f
--- /dev/null
+++ b/include/asm-mips/mips-boards/sead.h
@@ -0,0 +1,36 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Defines of the SEAD board specific address-MAP, registers, etc.
23 *
24 */
25#ifndef _MIPS_SEAD_H
26#define _MIPS_SEAD_H
27
28#include <asm/addrspace.h>
29
30/*
31 * SEAD UART register base.
32 */
33#define SEAD_UART0_REGS_BASE (0x1f000800)
34#define SEAD_BASE_BAUD ( 3686400 / 16 )
35
36#endif /* !(_MIPS_SEAD_H) */
diff --git a/include/asm-mips/mips-boards/seadint.h b/include/asm-mips/mips-boards/seadint.h
new file mode 100644
index 000000000000..c3dcfcb928b6
--- /dev/null
+++ b/include/asm-mips/mips-boards/seadint.h
@@ -0,0 +1,28 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Defines for the SEAD interrupt controller.
19 */
20#ifndef _MIPS_SEADINT_H
21#define _MIPS_SEADINT_H
22
23#define SEADINT_UART0 2
24#define SEADINT_UART1 3
25
26extern void seadint_init(void);
27
28#endif /* !(_MIPS_SEADINT_H) */
diff --git a/include/asm-mips/mipsprom.h b/include/asm-mips/mipsprom.h
new file mode 100644
index 000000000000..ce7cff7f1e8e
--- /dev/null
+++ b/include/asm-mips/mipsprom.h
@@ -0,0 +1,74 @@
1#ifndef __ASM_MIPS_PROM_H
2#define __ASM_MIPS_PROM_H
3
4#define PROM_RESET 0
5#define PROM_EXEC 1
6#define PROM_RESTART 2
7#define PROM_REINIT 3
8#define PROM_REBOOT 4
9#define PROM_AUTOBOOT 5
10#define PROM_OPEN 6
11#define PROM_READ 7
12#define PROM_WRITE 8
13#define PROM_IOCTL 9
14#define PROM_CLOSE 10
15#define PROM_GETCHAR 11
16#define PROM_PUTCHAR 12
17#define PROM_SHOWCHAR 13 /* XXX */
18#define PROM_GETS 14 /* XXX */
19#define PROM_PUTS 15 /* XXX */
20#define PROM_PRINTF 16 /* XXX */
21
22/* What are these for? */
23#define PROM_INITPROTO 17 /* XXX */
24#define PROM_PROTOENABLE 18 /* XXX */
25#define PROM_PROTODISABLE 19 /* XXX */
26#define PROM_GETPKT 20 /* XXX */
27#define PROM_PUTPKT 21 /* XXX */
28
29/* More PROM shit. Probably has to do with VME RMW cycles??? */
30#define PROM_ORW_RMW 22 /* XXX */
31#define PROM_ORH_RMW 23 /* XXX */
32#define PROM_ORB_RMW 24 /* XXX */
33#define PROM_ANDW_RMW 25 /* XXX */
34#define PROM_ANDH_RMW 26 /* XXX */
35#define PROM_ANDB_RMW 27 /* XXX */
36
37/* Cache handling stuff */
38#define PROM_FLUSHCACHE 28 /* XXX */
39#define PROM_CLEARCACHE 29 /* XXX */
40
41/* Libc alike stuff */
42#define PROM_SETJMP 30 /* XXX */
43#define PROM_LONGJMP 31 /* XXX */
44#define PROM_BEVUTLB 32 /* XXX */
45#define PROM_GETENV 33 /* XXX */
46#define PROM_SETENV 34 /* XXX */
47#define PROM_ATOB 35 /* XXX */
48#define PROM_STRCMP 36 /* XXX */
49#define PROM_STRLEN 37 /* XXX */
50#define PROM_STRCPY 38 /* XXX */
51#define PROM_STRCAT 39 /* XXX */
52
53/* Misc stuff */
54#define PROM_PARSER 40 /* XXX */
55#define PROM_RANGE 41 /* XXX */
56#define PROM_ARGVIZE 42 /* XXX */
57#define PROM_HELP 43 /* XXX */
58
59/* Entry points for some PROM commands */
60#define PROM_DUMPCMD 44 /* XXX */
61#define PROM_SETENVCMD 45 /* XXX */
62#define PROM_UNSETENVCMD 46 /* XXX */
63#define PROM_PRINTENVCMD 47 /* XXX */
64#define PROM_BEVEXCEPT 48 /* XXX */
65#define PROM_ENABLECMD 49 /* XXX */
66#define PROM_DISABLECMD 50 /* XXX */
67
68#define PROM_CLEARNOFAULT 51 /* XXX */
69#define PROM_NOTIMPLEMENT 52 /* XXX */
70
71#define PROM_NV_GET 53 /* XXX */
72#define PROM_NV_SET 54 /* XXX */
73
74#endif /* __ASM_MIPS_PROM_H */
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
new file mode 100644
index 000000000000..2197aa4ce456
--- /dev/null
+++ b/include/asm-mips/mipsregs.h
@@ -0,0 +1,1018 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001 by Ralf Baechle
7 * Copyright (C) 2000 Silicon Graphics, Inc.
8 * Modified for further R[236]000 support by Paul M. Antoine, 1996.
9 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
11 * Copyright (C) 2003 Maciej W. Rozycki
12 */
13#ifndef _ASM_MIPSREGS_H
14#define _ASM_MIPSREGS_H
15
16#include <linux/config.h>
17#include <linux/linkage.h>
18#include <asm/hazards.h>
19
20/*
21 * The following macros are especially useful for __asm__
22 * inline assembler.
23 */
24#ifndef __STR
25#define __STR(x) #x
26#endif
27#ifndef STR
28#define STR(x) __STR(x)
29#endif
30
31/*
32 * Configure language
33 */
34#ifdef __ASSEMBLY__
35#define _ULCAST_
36#else
37#define _ULCAST_ (unsigned long)
38#endif
39
40/*
41 * Coprocessor 0 register names
42 */
43#define CP0_INDEX $0
44#define CP0_RANDOM $1
45#define CP0_ENTRYLO0 $2
46#define CP0_ENTRYLO1 $3
47#define CP0_CONF $3
48#define CP0_CONTEXT $4
49#define CP0_PAGEMASK $5
50#define CP0_WIRED $6
51#define CP0_INFO $7
52#define CP0_BADVADDR $8
53#define CP0_COUNT $9
54#define CP0_ENTRYHI $10
55#define CP0_COMPARE $11
56#define CP0_STATUS $12
57#define CP0_CAUSE $13
58#define CP0_EPC $14
59#define CP0_PRID $15
60#define CP0_CONFIG $16
61#define CP0_LLADDR $17
62#define CP0_WATCHLO $18
63#define CP0_WATCHHI $19
64#define CP0_XCONTEXT $20
65#define CP0_FRAMEMASK $21
66#define CP0_DIAGNOSTIC $22
67#define CP0_DEBUG $23
68#define CP0_DEPC $24
69#define CP0_PERFORMANCE $25
70#define CP0_ECC $26
71#define CP0_CACHEERR $27
72#define CP0_TAGLO $28
73#define CP0_TAGHI $29
74#define CP0_ERROREPC $30
75#define CP0_DESAVE $31
76
77/*
78 * R4640/R4650 cp0 register names. These registers are listed
79 * here only for completeness; without MMU these CPUs are not useable
80 * by Linux. A future ELKS port might take make Linux run on them
81 * though ...
82 */
83#define CP0_IBASE $0
84#define CP0_IBOUND $1
85#define CP0_DBASE $2
86#define CP0_DBOUND $3
87#define CP0_CALG $17
88#define CP0_IWATCH $18
89#define CP0_DWATCH $19
90
91/*
92 * Coprocessor 0 Set 1 register names
93 */
94#define CP0_S1_DERRADDR0 $26
95#define CP0_S1_DERRADDR1 $27
96#define CP0_S1_INTCONTROL $20
97
98/*
99 * TX39 Series
100 */
101#define CP0_TX39_CACHE $7
102
103/*
104 * Coprocessor 1 (FPU) register names
105 */
106#define CP1_REVISION $0
107#define CP1_STATUS $31
108
109/*
110 * FPU Status Register Values
111 */
112/*
113 * Status Register Values
114 */
115
116#define FPU_CSR_FLUSH 0x01000000 /* flush denormalised results to 0 */
117#define FPU_CSR_COND 0x00800000 /* $fcc0 */
118#define FPU_CSR_COND0 0x00800000 /* $fcc0 */
119#define FPU_CSR_COND1 0x02000000 /* $fcc1 */
120#define FPU_CSR_COND2 0x04000000 /* $fcc2 */
121#define FPU_CSR_COND3 0x08000000 /* $fcc3 */
122#define FPU_CSR_COND4 0x10000000 /* $fcc4 */
123#define FPU_CSR_COND5 0x20000000 /* $fcc5 */
124#define FPU_CSR_COND6 0x40000000 /* $fcc6 */
125#define FPU_CSR_COND7 0x80000000 /* $fcc7 */
126
127/*
128 * X the exception cause indicator
129 * E the exception enable
130 * S the sticky/flag bit
131*/
132#define FPU_CSR_ALL_X 0x0003f000
133#define FPU_CSR_UNI_X 0x00020000
134#define FPU_CSR_INV_X 0x00010000
135#define FPU_CSR_DIV_X 0x00008000
136#define FPU_CSR_OVF_X 0x00004000
137#define FPU_CSR_UDF_X 0x00002000
138#define FPU_CSR_INE_X 0x00001000
139
140#define FPU_CSR_ALL_E 0x00000f80
141#define FPU_CSR_INV_E 0x00000800
142#define FPU_CSR_DIV_E 0x00000400
143#define FPU_CSR_OVF_E 0x00000200
144#define FPU_CSR_UDF_E 0x00000100
145#define FPU_CSR_INE_E 0x00000080
146
147#define FPU_CSR_ALL_S 0x0000007c
148#define FPU_CSR_INV_S 0x00000040
149#define FPU_CSR_DIV_S 0x00000020
150#define FPU_CSR_OVF_S 0x00000010
151#define FPU_CSR_UDF_S 0x00000008
152#define FPU_CSR_INE_S 0x00000004
153
154/* rounding mode */
155#define FPU_CSR_RN 0x0 /* nearest */
156#define FPU_CSR_RZ 0x1 /* towards zero */
157#define FPU_CSR_RU 0x2 /* towards +Infinity */
158#define FPU_CSR_RD 0x3 /* towards -Infinity */
159
160
161/*
162 * Values for PageMask register
163 */
164#ifdef CONFIG_CPU_VR41XX
165
166/* Why doesn't stupidity hurt ... */
167
168#define PM_1K 0x00000000
169#define PM_4K 0x00001800
170#define PM_16K 0x00007800
171#define PM_64K 0x0001f800
172#define PM_256K 0x0007f800
173
174#else
175
176#define PM_4K 0x00000000
177#define PM_16K 0x00006000
178#define PM_64K 0x0001e000
179#define PM_256K 0x0007e000
180#define PM_1M 0x001fe000
181#define PM_4M 0x007fe000
182#define PM_16M 0x01ffe000
183#define PM_64M 0x07ffe000
184#define PM_256M 0x1fffe000
185
186#endif
187
188/*
189 * Default page size for a given kernel configuration
190 */
191#ifdef CONFIG_PAGE_SIZE_4KB
192#define PM_DEFAULT_MASK PM_4K
193#elif defined(CONFIG_PAGE_SIZE_16KB)
194#define PM_DEFAULT_MASK PM_16K
195#elif defined(CONFIG_PAGE_SIZE_64KB)
196#define PM_DEFAULT_MASK PM_64K
197#else
198#error Bad page size configuration!
199#endif
200
201
202/*
203 * Values used for computation of new tlb entries
204 */
205#define PL_4K 12
206#define PL_16K 14
207#define PL_64K 16
208#define PL_256K 18
209#define PL_1M 20
210#define PL_4M 22
211#define PL_16M 24
212#define PL_64M 26
213#define PL_256M 28
214
215/*
216 * R4x00 interrupt enable / cause bits
217 */
218#define IE_SW0 (_ULCAST_(1) << 8)
219#define IE_SW1 (_ULCAST_(1) << 9)
220#define IE_IRQ0 (_ULCAST_(1) << 10)
221#define IE_IRQ1 (_ULCAST_(1) << 11)
222#define IE_IRQ2 (_ULCAST_(1) << 12)
223#define IE_IRQ3 (_ULCAST_(1) << 13)
224#define IE_IRQ4 (_ULCAST_(1) << 14)
225#define IE_IRQ5 (_ULCAST_(1) << 15)
226
227/*
228 * R4x00 interrupt cause bits
229 */
230#define C_SW0 (_ULCAST_(1) << 8)
231#define C_SW1 (_ULCAST_(1) << 9)
232#define C_IRQ0 (_ULCAST_(1) << 10)
233#define C_IRQ1 (_ULCAST_(1) << 11)
234#define C_IRQ2 (_ULCAST_(1) << 12)
235#define C_IRQ3 (_ULCAST_(1) << 13)
236#define C_IRQ4 (_ULCAST_(1) << 14)
237#define C_IRQ5 (_ULCAST_(1) << 15)
238
239/*
240 * Bitfields in the R4xx0 cp0 status register
241 */
242#define ST0_IE 0x00000001
243#define ST0_EXL 0x00000002
244#define ST0_ERL 0x00000004
245#define ST0_KSU 0x00000018
246# define KSU_USER 0x00000010
247# define KSU_SUPERVISOR 0x00000008
248# define KSU_KERNEL 0x00000000
249#define ST0_UX 0x00000020
250#define ST0_SX 0x00000040
251#define ST0_KX 0x00000080
252#define ST0_DE 0x00010000
253#define ST0_CE 0x00020000
254
255/*
256 * Setting c0_status.co enables Hit_Writeback and Hit_Writeback_Invalidate
257 * cacheops in userspace. This bit exists only on RM7000 and RM9000
258 * processors.
259 */
260#define ST0_CO 0x08000000
261
262/*
263 * Bitfields in the R[23]000 cp0 status register.
264 */
265#define ST0_IEC 0x00000001
266#define ST0_KUC 0x00000002
267#define ST0_IEP 0x00000004
268#define ST0_KUP 0x00000008
269#define ST0_IEO 0x00000010
270#define ST0_KUO 0x00000020
271/* bits 6 & 7 are reserved on R[23]000 */
272#define ST0_ISC 0x00010000
273#define ST0_SWC 0x00020000
274#define ST0_CM 0x00080000
275
276/*
277 * Bits specific to the R4640/R4650
278 */
279#define ST0_UM (_ULCAST_(1) << 4)
280#define ST0_IL (_ULCAST_(1) << 23)
281#define ST0_DL (_ULCAST_(1) << 24)
282
283/*
284 * Bitfields in the TX39 family CP0 Configuration Register 3
285 */
286#define TX39_CONF_ICS_SHIFT 19
287#define TX39_CONF_ICS_MASK 0x00380000
288#define TX39_CONF_ICS_1KB 0x00000000
289#define TX39_CONF_ICS_2KB 0x00080000
290#define TX39_CONF_ICS_4KB 0x00100000
291#define TX39_CONF_ICS_8KB 0x00180000
292#define TX39_CONF_ICS_16KB 0x00200000
293
294#define TX39_CONF_DCS_SHIFT 16
295#define TX39_CONF_DCS_MASK 0x00070000
296#define TX39_CONF_DCS_1KB 0x00000000
297#define TX39_CONF_DCS_2KB 0x00010000
298#define TX39_CONF_DCS_4KB 0x00020000
299#define TX39_CONF_DCS_8KB 0x00030000
300#define TX39_CONF_DCS_16KB 0x00040000
301
302#define TX39_CONF_CWFON 0x00004000
303#define TX39_CONF_WBON 0x00002000
304#define TX39_CONF_RF_SHIFT 10
305#define TX39_CONF_RF_MASK 0x00000c00
306#define TX39_CONF_DOZE 0x00000200
307#define TX39_CONF_HALT 0x00000100
308#define TX39_CONF_LOCK 0x00000080
309#define TX39_CONF_ICE 0x00000020
310#define TX39_CONF_DCE 0x00000010
311#define TX39_CONF_IRSIZE_SHIFT 2
312#define TX39_CONF_IRSIZE_MASK 0x0000000c
313#define TX39_CONF_DRSIZE_SHIFT 0
314#define TX39_CONF_DRSIZE_MASK 0x00000003
315
316/*
317 * Status register bits available in all MIPS CPUs.
318 */
319#define ST0_IM 0x0000ff00
320#define STATUSB_IP0 8
321#define STATUSF_IP0 (_ULCAST_(1) << 8)
322#define STATUSB_IP1 9
323#define STATUSF_IP1 (_ULCAST_(1) << 9)
324#define STATUSB_IP2 10
325#define STATUSF_IP2 (_ULCAST_(1) << 10)
326#define STATUSB_IP3 11
327#define STATUSF_IP3 (_ULCAST_(1) << 11)
328#define STATUSB_IP4 12
329#define STATUSF_IP4 (_ULCAST_(1) << 12)
330#define STATUSB_IP5 13
331#define STATUSF_IP5 (_ULCAST_(1) << 13)
332#define STATUSB_IP6 14
333#define STATUSF_IP6 (_ULCAST_(1) << 14)
334#define STATUSB_IP7 15
335#define STATUSF_IP7 (_ULCAST_(1) << 15)
336#define STATUSB_IP8 0
337#define STATUSF_IP8 (_ULCAST_(1) << 0)
338#define STATUSB_IP9 1
339#define STATUSF_IP9 (_ULCAST_(1) << 1)
340#define STATUSB_IP10 2
341#define STATUSF_IP10 (_ULCAST_(1) << 2)
342#define STATUSB_IP11 3
343#define STATUSF_IP11 (_ULCAST_(1) << 3)
344#define STATUSB_IP12 4
345#define STATUSF_IP12 (_ULCAST_(1) << 4)
346#define STATUSB_IP13 5
347#define STATUSF_IP13 (_ULCAST_(1) << 5)
348#define STATUSB_IP14 6
349#define STATUSF_IP14 (_ULCAST_(1) << 6)
350#define STATUSB_IP15 7
351#define STATUSF_IP15 (_ULCAST_(1) << 7)
352#define ST0_CH 0x00040000
353#define ST0_SR 0x00100000
354#define ST0_TS 0x00200000
355#define ST0_BEV 0x00400000
356#define ST0_RE 0x02000000
357#define ST0_FR 0x04000000
358#define ST0_CU 0xf0000000
359#define ST0_CU0 0x10000000
360#define ST0_CU1 0x20000000
361#define ST0_CU2 0x40000000
362#define ST0_CU3 0x80000000
363#define ST0_XX 0x80000000 /* MIPS IV naming */
364
365/*
366 * Bitfields and bit numbers in the coprocessor 0 cause register.
367 *
368 * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
369 */
370#define CAUSEB_EXCCODE 2
371#define CAUSEF_EXCCODE (_ULCAST_(31) << 2)
372#define CAUSEB_IP 8
373#define CAUSEF_IP (_ULCAST_(255) << 8)
374#define CAUSEB_IP0 8
375#define CAUSEF_IP0 (_ULCAST_(1) << 8)
376#define CAUSEB_IP1 9
377#define CAUSEF_IP1 (_ULCAST_(1) << 9)
378#define CAUSEB_IP2 10
379#define CAUSEF_IP2 (_ULCAST_(1) << 10)
380#define CAUSEB_IP3 11
381#define CAUSEF_IP3 (_ULCAST_(1) << 11)
382#define CAUSEB_IP4 12
383#define CAUSEF_IP4 (_ULCAST_(1) << 12)
384#define CAUSEB_IP5 13
385#define CAUSEF_IP5 (_ULCAST_(1) << 13)
386#define CAUSEB_IP6 14
387#define CAUSEF_IP6 (_ULCAST_(1) << 14)
388#define CAUSEB_IP7 15
389#define CAUSEF_IP7 (_ULCAST_(1) << 15)
390#define CAUSEB_IV 23
391#define CAUSEF_IV (_ULCAST_(1) << 23)
392#define CAUSEB_CE 28
393#define CAUSEF_CE (_ULCAST_(3) << 28)
394#define CAUSEB_BD 31
395#define CAUSEF_BD (_ULCAST_(1) << 31)
396
397/*
398 * Bits in the coprocessor 0 config register.
399 */
400/* Generic bits. */
401#define CONF_CM_CACHABLE_NO_WA 0
402#define CONF_CM_CACHABLE_WA 1
403#define CONF_CM_UNCACHED 2
404#define CONF_CM_CACHABLE_NONCOHERENT 3
405#define CONF_CM_CACHABLE_CE 4
406#define CONF_CM_CACHABLE_COW 5
407#define CONF_CM_CACHABLE_CUW 6
408#define CONF_CM_CACHABLE_ACCELERATED 7
409#define CONF_CM_CMASK 7
410#define CONF_BE (_ULCAST_(1) << 15)
411
412/* Bits common to various processors. */
413#define CONF_CU (_ULCAST_(1) << 3)
414#define CONF_DB (_ULCAST_(1) << 4)
415#define CONF_IB (_ULCAST_(1) << 5)
416#define CONF_DC (_ULCAST_(7) << 6)
417#define CONF_IC (_ULCAST_(7) << 9)
418#define CONF_EB (_ULCAST_(1) << 13)
419#define CONF_EM (_ULCAST_(1) << 14)
420#define CONF_SM (_ULCAST_(1) << 16)
421#define CONF_SC (_ULCAST_(1) << 17)
422#define CONF_EW (_ULCAST_(3) << 18)
423#define CONF_EP (_ULCAST_(15)<< 24)
424#define CONF_EC (_ULCAST_(7) << 28)
425#define CONF_CM (_ULCAST_(1) << 31)
426
427/* Bits specific to the R4xx0. */
428#define R4K_CONF_SW (_ULCAST_(1) << 20)
429#define R4K_CONF_SS (_ULCAST_(1) << 21)
430#define R4K_CONF_SB (_ULCAST_(3) << 22)
431
432/* Bits specific to the R5000. */
433#define R5K_CONF_SE (_ULCAST_(1) << 12)
434#define R5K_CONF_SS (_ULCAST_(3) << 20)
435
436/* Bits specific to the R10000. */
437#define R10K_CONF_DN (_ULCAST_(3) << 3)
438#define R10K_CONF_CT (_ULCAST_(1) << 5)
439#define R10K_CONF_PE (_ULCAST_(1) << 6)
440#define R10K_CONF_PM (_ULCAST_(3) << 7)
441#define R10K_CONF_EC (_ULCAST_(15)<< 9)
442#define R10K_CONF_SB (_ULCAST_(1) << 13)
443#define R10K_CONF_SK (_ULCAST_(1) << 14)
444#define R10K_CONF_SS (_ULCAST_(7) << 16)
445#define R10K_CONF_SC (_ULCAST_(7) << 19)
446#define R10K_CONF_DC (_ULCAST_(7) << 26)
447#define R10K_CONF_IC (_ULCAST_(7) << 29)
448
449/* Bits specific to the VR41xx. */
450#define VR41_CONF_CS (_ULCAST_(1) << 12)
451#define VR41_CONF_M16 (_ULCAST_(1) << 20)
452#define VR41_CONF_AD (_ULCAST_(1) << 23)
453
454/* Bits specific to the R30xx. */
455#define R30XX_CONF_FDM (_ULCAST_(1) << 19)
456#define R30XX_CONF_REV (_ULCAST_(1) << 22)
457#define R30XX_CONF_AC (_ULCAST_(1) << 23)
458#define R30XX_CONF_RF (_ULCAST_(1) << 24)
459#define R30XX_CONF_HALT (_ULCAST_(1) << 25)
460#define R30XX_CONF_FPINT (_ULCAST_(7) << 26)
461#define R30XX_CONF_DBR (_ULCAST_(1) << 29)
462#define R30XX_CONF_SB (_ULCAST_(1) << 30)
463#define R30XX_CONF_LOCK (_ULCAST_(1) << 31)
464
465/* Bits specific to the TX49. */
466#define TX49_CONF_DC (_ULCAST_(1) << 16)
467#define TX49_CONF_IC (_ULCAST_(1) << 17) /* conflict with CONF_SC */
468#define TX49_CONF_HALT (_ULCAST_(1) << 18)
469#define TX49_CONF_CWFON (_ULCAST_(1) << 27)
470
471/* Bits specific to the MIPS32/64 PRA. */
472#define MIPS_CONF_MT (_ULCAST_(7) << 7)
473#define MIPS_CONF_AR (_ULCAST_(7) << 10)
474#define MIPS_CONF_AT (_ULCAST_(3) << 13)
475#define MIPS_CONF_M (_ULCAST_(1) << 31)
476
477/*
478 * R10000 performance counter definitions.
479 *
480 * FIXME: The R10000 performance counter opens a nice way to implement CPU
481 * time accounting with a precission of one cycle. I don't have
482 * R10000 silicon but just a manual, so ...
483 */
484
485/*
486 * Events counted by counter #0
487 */
488#define CE0_CYCLES 0
489#define CE0_INSN_ISSUED 1
490#define CE0_LPSC_ISSUED 2
491#define CE0_S_ISSUED 3
492#define CE0_SC_ISSUED 4
493#define CE0_SC_FAILED 5
494#define CE0_BRANCH_DECODED 6
495#define CE0_QW_WB_SECONDARY 7
496#define CE0_CORRECTED_ECC_ERRORS 8
497#define CE0_ICACHE_MISSES 9
498#define CE0_SCACHE_I_MISSES 10
499#define CE0_SCACHE_I_WAY_MISSPREDICTED 11
500#define CE0_EXT_INTERVENTIONS_REQ 12
501#define CE0_EXT_INVALIDATE_REQ 13
502#define CE0_VIRTUAL_COHERENCY_COND 14
503#define CE0_INSN_GRADUATED 15
504
505/*
506 * Events counted by counter #1
507 */
508#define CE1_CYCLES 0
509#define CE1_INSN_GRADUATED 1
510#define CE1_LPSC_GRADUATED 2
511#define CE1_S_GRADUATED 3
512#define CE1_SC_GRADUATED 4
513#define CE1_FP_INSN_GRADUATED 5
514#define CE1_QW_WB_PRIMARY 6
515#define CE1_TLB_REFILL 7
516#define CE1_BRANCH_MISSPREDICTED 8
517#define CE1_DCACHE_MISS 9
518#define CE1_SCACHE_D_MISSES 10
519#define CE1_SCACHE_D_WAY_MISSPREDICTED 11
520#define CE1_EXT_INTERVENTION_HITS 12
521#define CE1_EXT_INVALIDATE_REQ 13
522#define CE1_SP_HINT_TO_CEXCL_SC_BLOCKS 14
523#define CE1_SP_HINT_TO_SHARED_SC_BLOCKS 15
524
525/*
526 * These flags define in which privilege mode the counters count events
527 */
528#define CEB_USER 8 /* Count events in user mode, EXL = ERL = 0 */
529#define CEB_SUPERVISOR 4 /* Count events in supvervisor mode EXL = ERL = 0 */
530#define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */
531#define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */
532
533#ifndef __ASSEMBLY__
534
535/*
536 * Functions to access the R10000 performance counters. These are basically
537 * mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit
538 * performance counter number encoded into bits 1 ... 5 of the instruction.
539 * Only performance counters 0 to 1 actually exist, so for a non-R10000 aware
540 * disassembler these will look like an access to sel 0 or 1.
541 */
542#define read_r10k_perf_cntr(counter) \
543({ \
544 unsigned int __res; \
545 __asm__ __volatile__( \
546 "mfpc\t%0, %1" \
547 : "=r" (__res) \
548 : "i" (counter)); \
549 \
550 __res; \
551})
552
553#define write_r10k_perf_cntr(counter,val) \
554do { \
555 __asm__ __volatile__( \
556 "mtpc\t%0, %1" \
557 : \
558 : "r" (val), "i" (counter)); \
559} while (0)
560
561#define read_r10k_perf_event(counter) \
562({ \
563 unsigned int __res; \
564 __asm__ __volatile__( \
565 "mfps\t%0, %1" \
566 : "=r" (__res) \
567 : "i" (counter)); \
568 \
569 __res; \
570})
571
572#define write_r10k_perf_cntl(counter,val) \
573do { \
574 __asm__ __volatile__( \
575 "mtps\t%0, %1" \
576 : \
577 : "r" (val), "i" (counter)); \
578} while (0)
579
580
581/*
582 * Macros to access the system control coprocessor
583 */
584
585#define __read_32bit_c0_register(source, sel) \
586({ int __res; \
587 if (sel == 0) \
588 __asm__ __volatile__( \
589 "mfc0\t%0, " #source "\n\t" \
590 : "=r" (__res)); \
591 else \
592 __asm__ __volatile__( \
593 ".set\tmips32\n\t" \
594 "mfc0\t%0, " #source ", " #sel "\n\t" \
595 ".set\tmips0\n\t" \
596 : "=r" (__res)); \
597 __res; \
598})
599
600#define __read_64bit_c0_register(source, sel) \
601({ unsigned long long __res; \
602 if (sizeof(unsigned long) == 4) \
603 __res = __read_64bit_c0_split(source, sel); \
604 else if (sel == 0) \
605 __asm__ __volatile__( \
606 ".set\tmips3\n\t" \
607 "dmfc0\t%0, " #source "\n\t" \
608 ".set\tmips0" \
609 : "=r" (__res)); \
610 else \
611 __asm__ __volatile__( \
612 ".set\tmips64\n\t" \
613 "dmfc0\t%0, " #source ", " #sel "\n\t" \
614 ".set\tmips0" \
615 : "=r" (__res)); \
616 __res; \
617})
618
619#define __write_32bit_c0_register(register, sel, value) \
620do { \
621 if (sel == 0) \
622 __asm__ __volatile__( \
623 "mtc0\t%z0, " #register "\n\t" \
624 : : "Jr" ((unsigned int)value)); \
625 else \
626 __asm__ __volatile__( \
627 ".set\tmips32\n\t" \
628 "mtc0\t%z0, " #register ", " #sel "\n\t" \
629 ".set\tmips0" \
630 : : "Jr" ((unsigned int)value)); \
631} while (0)
632
633#define __write_64bit_c0_register(register, sel, value) \
634do { \
635 if (sizeof(unsigned long) == 4) \
636 __write_64bit_c0_split(register, sel, value); \
637 else if (sel == 0) \
638 __asm__ __volatile__( \
639 ".set\tmips3\n\t" \
640 "dmtc0\t%z0, " #register "\n\t" \
641 ".set\tmips0" \
642 : : "Jr" (value)); \
643 else \
644 __asm__ __volatile__( \
645 ".set\tmips64\n\t" \
646 "dmtc0\t%z0, " #register ", " #sel "\n\t" \
647 ".set\tmips0" \
648 : : "Jr" (value)); \
649} while (0)
650
651#define __read_ulong_c0_register(reg, sel) \
652 ((sizeof(unsigned long) == 4) ? \
653 (unsigned long) __read_32bit_c0_register(reg, sel) : \
654 (unsigned long) __read_64bit_c0_register(reg, sel))
655
656#define __write_ulong_c0_register(reg, sel, val) \
657do { \
658 if (sizeof(unsigned long) == 4) \
659 __write_32bit_c0_register(reg, sel, val); \
660 else \
661 __write_64bit_c0_register(reg, sel, val); \
662} while (0)
663
664/*
665 * On RM7000/RM9000 these are uses to access cop0 set 1 registers
666 */
667#define __read_32bit_c0_ctrl_register(source) \
668({ int __res; \
669 __asm__ __volatile__( \
670 "cfc0\t%0, " #source "\n\t" \
671 : "=r" (__res)); \
672 __res; \
673})
674
675#define __write_32bit_c0_ctrl_register(register, value) \
676do { \
677 __asm__ __volatile__( \
678 "ctc0\t%z0, " #register "\n\t" \
679 : : "Jr" ((unsigned int)value)); \
680} while (0)
681
682/*
683 * These versions are only needed for systems with more than 38 bits of
684 * physical address space running the 32-bit kernel. That's none atm :-)
685 */
686#define __read_64bit_c0_split(source, sel) \
687({ \
688 unsigned long long val; \
689 unsigned long flags; \
690 \
691 local_irq_save(flags); \
692 if (sel == 0) \
693 __asm__ __volatile__( \
694 ".set\tmips64\n\t" \
695 "dmfc0\t%M0, " #source "\n\t" \
696 "dsll\t%L0, %M0, 32\n\t" \
697 "dsrl\t%M0, %M0, 32\n\t" \
698 "dsrl\t%L0, %L0, 32\n\t" \
699 ".set\tmips0" \
700 : "=r" (val)); \
701 else \
702 __asm__ __volatile__( \
703 ".set\tmips64\n\t" \
704 "dmfc0\t%M0, " #source ", " #sel "\n\t" \
705 "dsll\t%L0, %M0, 32\n\t" \
706 "dsrl\t%M0, %M0, 32\n\t" \
707 "dsrl\t%L0, %L0, 32\n\t" \
708 ".set\tmips0" \
709 : "=r" (val)); \
710 local_irq_restore(flags); \
711 \
712 val; \
713})
714
715#define __write_64bit_c0_split(source, sel, val) \
716do { \
717 unsigned long flags; \
718 \
719 local_irq_save(flags); \
720 if (sel == 0) \
721 __asm__ __volatile__( \
722 ".set\tmips64\n\t" \
723 "dsll\t%L0, %L0, 32\n\t" \
724 "dsrl\t%L0, %L0, 32\n\t" \
725 "dsll\t%M0, %M0, 32\n\t" \
726 "or\t%L0, %L0, %M0\n\t" \
727 "dmtc0\t%L0, " #source "\n\t" \
728 ".set\tmips0" \
729 : : "r" (val)); \
730 else \
731 __asm__ __volatile__( \
732 ".set\tmips64\n\t" \
733 "dsll\t%L0, %L0, 32\n\t" \
734 "dsrl\t%L0, %L0, 32\n\t" \
735 "dsll\t%M0, %M0, 32\n\t" \
736 "or\t%L0, %L0, %M0\n\t" \
737 "dmtc0\t%L0, " #source ", " #sel "\n\t" \
738 ".set\tmips0" \
739 : : "r" (val)); \
740 local_irq_restore(flags); \
741} while (0)
742
743#define read_c0_index() __read_32bit_c0_register($0, 0)
744#define write_c0_index(val) __write_32bit_c0_register($0, 0, val)
745
746#define read_c0_entrylo0() __read_ulong_c0_register($2, 0)
747#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val)
748
749#define read_c0_entrylo1() __read_ulong_c0_register($3, 0)
750#define write_c0_entrylo1(val) __write_ulong_c0_register($3, 0, val)
751
752#define read_c0_conf() __read_32bit_c0_register($3, 0)
753#define write_c0_conf(val) __write_32bit_c0_register($3, 0, val)
754
755#define read_c0_context() __read_ulong_c0_register($4, 0)
756#define write_c0_context(val) __write_ulong_c0_register($4, 0, val)
757
758#define read_c0_pagemask() __read_32bit_c0_register($5, 0)
759#define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val)
760
761#define read_c0_wired() __read_32bit_c0_register($6, 0)
762#define write_c0_wired(val) __write_32bit_c0_register($6, 0, val)
763
764#define read_c0_info() __read_32bit_c0_register($7, 0)
765
766#define read_c0_cache() __read_32bit_c0_register($7, 0) /* TX39xx */
767#define write_c0_cache(val) __write_32bit_c0_register($7, 0, val)
768
769#define read_c0_count() __read_32bit_c0_register($9, 0)
770#define write_c0_count(val) __write_32bit_c0_register($9, 0, val)
771
772#define read_c0_entryhi() __read_ulong_c0_register($10, 0)
773#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val)
774
775#define read_c0_compare() __read_32bit_c0_register($11, 0)
776#define write_c0_compare(val) __write_32bit_c0_register($11, 0, val)
777
778#define read_c0_status() __read_32bit_c0_register($12, 0)
779#define write_c0_status(val) __write_32bit_c0_register($12, 0, val)
780
781#define read_c0_cause() __read_32bit_c0_register($13, 0)
782#define write_c0_cause(val) __write_32bit_c0_register($13, 0, val)
783
784#define read_c0_epc() __read_ulong_c0_register($14, 0)
785#define write_c0_epc(val) __write_ulong_c0_register($14, 0, val)
786
787#define read_c0_prid() __read_32bit_c0_register($15, 0)
788
789#define read_c0_config() __read_32bit_c0_register($16, 0)
790#define read_c0_config1() __read_32bit_c0_register($16, 1)
791#define read_c0_config2() __read_32bit_c0_register($16, 2)
792#define read_c0_config3() __read_32bit_c0_register($16, 3)
793#define write_c0_config(val) __write_32bit_c0_register($16, 0, val)
794#define write_c0_config1(val) __write_32bit_c0_register($16, 1, val)
795#define write_c0_config2(val) __write_32bit_c0_register($16, 2, val)
796#define write_c0_config3(val) __write_32bit_c0_register($16, 3, val)
797
798/*
799 * The WatchLo register. There may be upto 8 of them.
800 */
801#define read_c0_watchlo0() __read_ulong_c0_register($18, 0)
802#define read_c0_watchlo1() __read_ulong_c0_register($18, 1)
803#define read_c0_watchlo2() __read_ulong_c0_register($18, 2)
804#define read_c0_watchlo3() __read_ulong_c0_register($18, 3)
805#define read_c0_watchlo4() __read_ulong_c0_register($18, 4)
806#define read_c0_watchlo5() __read_ulong_c0_register($18, 5)
807#define read_c0_watchlo6() __read_ulong_c0_register($18, 6)
808#define read_c0_watchlo7() __read_ulong_c0_register($18, 7)
809#define write_c0_watchlo0(val) __write_ulong_c0_register($18, 0, val)
810#define write_c0_watchlo1(val) __write_ulong_c0_register($18, 1, val)
811#define write_c0_watchlo2(val) __write_ulong_c0_register($18, 2, val)
812#define write_c0_watchlo3(val) __write_ulong_c0_register($18, 3, val)
813#define write_c0_watchlo4(val) __write_ulong_c0_register($18, 4, val)
814#define write_c0_watchlo5(val) __write_ulong_c0_register($18, 5, val)
815#define write_c0_watchlo6(val) __write_ulong_c0_register($18, 6, val)
816#define write_c0_watchlo7(val) __write_ulong_c0_register($18, 7, val)
817
818/*
819 * The WatchHi register. There may be upto 8 of them.
820 */
821#define read_c0_watchhi0() __read_32bit_c0_register($19, 0)
822#define read_c0_watchhi1() __read_32bit_c0_register($19, 1)
823#define read_c0_watchhi2() __read_32bit_c0_register($19, 2)
824#define read_c0_watchhi3() __read_32bit_c0_register($19, 3)
825#define read_c0_watchhi4() __read_32bit_c0_register($19, 4)
826#define read_c0_watchhi5() __read_32bit_c0_register($19, 5)
827#define read_c0_watchhi6() __read_32bit_c0_register($19, 6)
828#define read_c0_watchhi7() __read_32bit_c0_register($19, 7)
829
830#define write_c0_watchhi0(val) __write_32bit_c0_register($19, 0, val)
831#define write_c0_watchhi1(val) __write_32bit_c0_register($19, 1, val)
832#define write_c0_watchhi2(val) __write_32bit_c0_register($19, 2, val)
833#define write_c0_watchhi3(val) __write_32bit_c0_register($19, 3, val)
834#define write_c0_watchhi4(val) __write_32bit_c0_register($19, 4, val)
835#define write_c0_watchhi5(val) __write_32bit_c0_register($19, 5, val)
836#define write_c0_watchhi6(val) __write_32bit_c0_register($19, 6, val)
837#define write_c0_watchhi7(val) __write_32bit_c0_register($19, 7, val)
838
839#define read_c0_xcontext() __read_ulong_c0_register($20, 0)
840#define write_c0_xcontext(val) __write_ulong_c0_register($20, 0, val)
841
842#define read_c0_intcontrol() __read_32bit_c0_ctrl_register($20)
843#define write_c0_intcontrol(val) __write_32bit_c0_ctrl_register($20, val)
844
845#define read_c0_framemask() __read_32bit_c0_register($21, 0)
846#define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val)
847
848/* RM9000 PerfControl performance counter control register */
849#define read_c0_perfcontrol() __read_32bit_c0_register($22, 0)
850#define write_c0_perfcontrol(val) __write_32bit_c0_register($22, 0, val)
851
852#define read_c0_diag() __read_32bit_c0_register($22, 0)
853#define write_c0_diag(val) __write_32bit_c0_register($22, 0, val)
854
855#define read_c0_diag1() __read_32bit_c0_register($22, 1)
856#define write_c0_diag1(val) __write_32bit_c0_register($22, 1, val)
857
858#define read_c0_diag2() __read_32bit_c0_register($22, 2)
859#define write_c0_diag2(val) __write_32bit_c0_register($22, 2, val)
860
861#define read_c0_diag3() __read_32bit_c0_register($22, 3)
862#define write_c0_diag3(val) __write_32bit_c0_register($22, 3, val)
863
864#define read_c0_diag4() __read_32bit_c0_register($22, 4)
865#define write_c0_diag4(val) __write_32bit_c0_register($22, 4, val)
866
867#define read_c0_diag5() __read_32bit_c0_register($22, 5)
868#define write_c0_diag5(val) __write_32bit_c0_register($22, 5, val)
869
870#define read_c0_debug() __read_32bit_c0_register($23, 0)
871#define write_c0_debug(val) __write_32bit_c0_register($23, 0, val)
872
873#define read_c0_depc() __read_ulong_c0_register($24, 0)
874#define write_c0_depc(val) __write_ulong_c0_register($24, 0, val)
875
876/*
877 * MIPS32 / MIPS64 performance counters
878 */
879#define read_c0_perfctrl0() __read_32bit_c0_register($25, 0)
880#define write_c0_perfctrl0(val) __write_32bit_c0_register($25, 0, val)
881#define read_c0_perfcntr0() __read_32bit_c0_register($25, 1)
882#define write_c0_perfcntr0(val) __write_32bit_c0_register($25, 1, val)
883#define read_c0_perfctrl1() __read_32bit_c0_register($25, 2)
884#define write_c0_perfctrl1(val) __write_32bit_c0_register($25, 2, val)
885#define read_c0_perfcntr1() __read_32bit_c0_register($25, 3)
886#define write_c0_perfcntr1(val) __write_32bit_c0_register($25, 3, val)
887#define read_c0_perfctrl2() __read_32bit_c0_register($25, 4)
888#define write_c0_perfctrl2(val) __write_32bit_c0_register($25, 4, val)
889#define read_c0_perfcntr2() __read_32bit_c0_register($25, 5)
890#define write_c0_perfcntr2(val) __write_32bit_c0_register($25, 5, val)
891#define read_c0_perfctrl3() __read_32bit_c0_register($25, 6)
892#define write_c0_perfctrl3(val) __write_32bit_c0_register($25, 6, val)
893#define read_c0_perfcntr3() __read_32bit_c0_register($25, 7)
894#define write_c0_perfcntr3(val) __write_32bit_c0_register($25, 7, val)
895
896/* RM9000 PerfCount performance counter register */
897#define read_c0_perfcount() __read_64bit_c0_register($25, 0)
898#define write_c0_perfcount(val) __write_64bit_c0_register($25, 0, val)
899
900#define read_c0_ecc() __read_32bit_c0_register($26, 0)
901#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val)
902
903#define read_c0_derraddr0() __read_ulong_c0_register($26, 1)
904#define write_c0_derraddr0(val) __write_ulong_c0_register($26, 1, val)
905
906#define read_c0_cacheerr() __read_32bit_c0_register($27, 0)
907
908#define read_c0_derraddr1() __read_ulong_c0_register($27, 1)
909#define write_c0_derraddr1(val) __write_ulong_c0_register($27, 1, val)
910
911#define read_c0_taglo() __read_32bit_c0_register($28, 0)
912#define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val)
913
914#define read_c0_taghi() __read_32bit_c0_register($29, 0)
915#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val)
916
917#define read_c0_errorepc() __read_ulong_c0_register($30, 0)
918#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val)
919
920/*
921 * Macros to access the floating point coprocessor control registers
922 */
923#define read_32bit_cp1_register(source) \
924({ int __res; \
925 __asm__ __volatile__( \
926 ".set\tpush\n\t" \
927 ".set\treorder\n\t" \
928 "cfc1\t%0,"STR(source)"\n\t" \
929 ".set\tpop" \
930 : "=r" (__res)); \
931 __res;})
932
933/*
934 * TLB operations.
935 *
936 * It is responsibility of the caller to take care of any TLB hazards.
937 */
938static inline void tlb_probe(void)
939{
940 __asm__ __volatile__(
941 ".set noreorder\n\t"
942 "tlbp\n\t"
943 ".set reorder");
944}
945
946static inline void tlb_read(void)
947{
948 __asm__ __volatile__(
949 ".set noreorder\n\t"
950 "tlbr\n\t"
951 ".set reorder");
952}
953
954static inline void tlb_write_indexed(void)
955{
956 __asm__ __volatile__(
957 ".set noreorder\n\t"
958 "tlbwi\n\t"
959 ".set reorder");
960}
961
962static inline void tlb_write_random(void)
963{
964 __asm__ __volatile__(
965 ".set noreorder\n\t"
966 "tlbwr\n\t"
967 ".set reorder");
968}
969
970/*
971 * Manipulate bits in a c0 register.
972 */
973#define __BUILD_SET_C0(name) \
974static inline unsigned int \
975set_c0_##name(unsigned int set) \
976{ \
977 unsigned int res; \
978 \
979 res = read_c0_##name(); \
980 res |= set; \
981 write_c0_##name(res); \
982 \
983 return res; \
984} \
985 \
986static inline unsigned int \
987clear_c0_##name(unsigned int clear) \
988{ \
989 unsigned int res; \
990 \
991 res = read_c0_##name(); \
992 res &= ~clear; \
993 write_c0_##name(res); \
994 \
995 return res; \
996} \
997 \
998static inline unsigned int \
999change_c0_##name(unsigned int change, unsigned int new) \
1000{ \
1001 unsigned int res; \
1002 \
1003 res = read_c0_##name(); \
1004 res &= ~change; \
1005 res |= (new & change); \
1006 write_c0_##name(res); \
1007 \
1008 return res; \
1009}
1010
1011__BUILD_SET_C0(status)
1012__BUILD_SET_C0(cause)
1013__BUILD_SET_C0(config)
1014__BUILD_SET_C0(intcontrol)
1015
1016#endif /* !__ASSEMBLY__ */
1017
1018#endif /* _ASM_MIPSREGS_H */
diff --git a/include/asm-mips/mman.h b/include/asm-mips/mman.h
new file mode 100644
index 000000000000..62060957ba93
--- /dev/null
+++ b/include/asm-mips/mman.h
@@ -0,0 +1,73 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1999, 2002 by Ralf Baechle
7 */
8#ifndef _ASM_MMAN_H
9#define _ASM_MMAN_H
10
11/*
12 * Protections are chosen from these bits, OR'd together. The
13 * implementation does not necessarily support PROT_EXEC or PROT_WRITE
14 * without PROT_READ. The only guarantees are that no writing will be
15 * allowed without PROT_WRITE and no access will be allowed for PROT_NONE.
16 */
17#define PROT_NONE 0x00 /* page can not be accessed */
18#define PROT_READ 0x01 /* page can be read */
19#define PROT_WRITE 0x02 /* page can be written */
20#define PROT_EXEC 0x04 /* page can be executed */
21/* 0x08 reserved for PROT_EXEC_NOFLUSH */
22#define PROT_SEM 0x10 /* page may be used for atomic ops */
23#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
24#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
25
26/*
27 * Flags for mmap
28 */
29#define MAP_SHARED 0x001 /* Share changes */
30#define MAP_PRIVATE 0x002 /* Changes are private */
31#define MAP_TYPE 0x00f /* Mask for type of mapping */
32#define MAP_FIXED 0x010 /* Interpret addr exactly */
33
34/* not used by linux, but here to make sure we don't clash with ABI defines */
35#define MAP_RENAME 0x020 /* Assign page to file */
36#define MAP_AUTOGROW 0x040 /* File may grow by writing */
37#define MAP_LOCAL 0x080 /* Copy on fork/sproc */
38#define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */
39
40/* These are linux-specific */
41#define MAP_NORESERVE 0x0400 /* don't check for reservations */
42#define MAP_ANONYMOUS 0x0800 /* don't use a file */
43#define MAP_GROWSDOWN 0x1000 /* stack-like segment */
44#define MAP_DENYWRITE 0x2000 /* ETXTBSY */
45#define MAP_EXECUTABLE 0x4000 /* mark it as an executable */
46#define MAP_LOCKED 0x8000 /* pages are locked */
47#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
48#define MAP_NONBLOCK 0x20000 /* do not block on IO */
49
50/*
51 * Flags for msync
52 */
53#define MS_ASYNC 0x0001 /* sync memory asynchronously */
54#define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */
55#define MS_SYNC 0x0004 /* synchronous memory sync */
56
57/*
58 * Flags for mlockall
59 */
60#define MCL_CURRENT 1 /* lock all current mappings */
61#define MCL_FUTURE 2 /* lock all future mappings */
62
63#define MADV_NORMAL 0x0 /* default page-in behavior */
64#define MADV_RANDOM 0x1 /* page-in minimum required */
65#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
66#define MADV_WILLNEED 0x3 /* pre-fault pages */
67#define MADV_DONTNEED 0x4 /* discard these pages */
68
69/* compatibility flags */
70#define MAP_ANON MAP_ANONYMOUS
71#define MAP_FILE 0
72
73#endif /* _ASM_MMAN_H */
diff --git a/include/asm-mips/mmu.h b/include/asm-mips/mmu.h
new file mode 100644
index 000000000000..4063edd79623
--- /dev/null
+++ b/include/asm-mips/mmu.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_MMU_H
2#define __ASM_MMU_H
3
4typedef unsigned long mm_context_t[NR_CPUS];
5
6#endif /* __ASM_MMU_H */
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
new file mode 100644
index 000000000000..48b77c9fb4f2
--- /dev/null
+++ b/include/asm-mips/mmu_context.h
@@ -0,0 +1,196 @@
1/*
2 * Switch a MMU context.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 1997, 1998, 1999 by Ralf Baechle
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 */
11#ifndef _ASM_MMU_CONTEXT_H
12#define _ASM_MMU_CONTEXT_H
13
14#include <linux/config.h>
15#include <linux/errno.h>
16#include <linux/sched.h>
17#include <linux/slab.h>
18#include <asm/cacheflush.h>
19#include <asm/tlbflush.h>
20
21/*
22 * For the fast tlb miss handlers, we keep a per cpu array of pointers
23 * to the current pgd for each processor. Also, the proc. id is stuffed
24 * into the context register.
25 */
26extern unsigned long pgd_current[];
27
28#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
29 pgd_current[smp_processor_id()] = (unsigned long)(pgd)
30
31#ifdef CONFIG_MIPS32
32#define TLBMISS_HANDLER_SETUP() \
33 write_c0_context((unsigned long) smp_processor_id() << 23); \
34 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
35#endif
36#if defined(CONFIG_MIPS64) && !defined(CONFIG_BUILD_ELF64)
37#define TLBMISS_HANDLER_SETUP() \
38 write_c0_context((unsigned long) &pgd_current[smp_processor_id()] << 23); \
39 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
40#endif
41#if defined(CONFIG_MIPS64) && defined(CONFIG_BUILD_ELF64)
42#define TLBMISS_HANDLER_SETUP() \
43 write_c0_context((unsigned long) smp_processor_id() << 23); \
44 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
45#endif
46
47#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
48
49#define ASID_INC 0x40
50#define ASID_MASK 0xfc0
51
52#elif defined(CONFIG_CPU_R8000)
53
54#define ASID_INC 0x10
55#define ASID_MASK 0xff0
56
57#elif defined(CONFIG_CPU_RM9000)
58
59#define ASID_INC 0x1
60#define ASID_MASK 0xfff
61
62#else /* FIXME: not correct for R6000 */
63
64#define ASID_INC 0x1
65#define ASID_MASK 0xff
66
67#endif
68
69#define cpu_context(cpu, mm) ((mm)->context[cpu])
70#define cpu_asid(cpu, mm) (cpu_context((cpu), (mm)) & ASID_MASK)
71#define asid_cache(cpu) (cpu_data[cpu].asid_cache)
72
73static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
74{
75}
76
77/*
78 * All unused by hardware upper bits will be considered
79 * as a software asid extension.
80 */
81#define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1)))
82#define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1)
83
84static inline void
85get_new_mmu_context(struct mm_struct *mm, unsigned long cpu)
86{
87 unsigned long asid = asid_cache(cpu);
88
89 if (! ((asid += ASID_INC) & ASID_MASK) ) {
90 if (cpu_has_vtag_icache)
91 flush_icache_all();
92 local_flush_tlb_all(); /* start new asid cycle */
93 if (!asid) /* fix version if needed */
94 asid = ASID_FIRST_VERSION;
95 }
96 cpu_context(cpu, mm) = asid_cache(cpu) = asid;
97}
98
99/*
100 * Initialize the context related info for a new mm_struct
101 * instance.
102 */
103static inline int
104init_new_context(struct task_struct *tsk, struct mm_struct *mm)
105{
106 int i;
107
108 for (i = 0; i < num_online_cpus(); i++)
109 cpu_context(i, mm) = 0;
110
111 return 0;
112}
113
114static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
115 struct task_struct *tsk)
116{
117 unsigned int cpu = smp_processor_id();
118 unsigned long flags;
119
120 local_irq_save(flags);
121
122 /* Check if our ASID is of an older version and thus invalid */
123 if ((cpu_context(cpu, next) ^ asid_cache(cpu)) & ASID_VERSION_MASK)
124 get_new_mmu_context(next, cpu);
125
126 write_c0_entryhi(cpu_context(cpu, next));
127 TLBMISS_HANDLER_SETUP_PGD(next->pgd);
128
129 /*
130 * Mark current->active_mm as not "active" anymore.
131 * We don't want to mislead possible IPI tlb flush routines.
132 */
133 cpu_clear(cpu, prev->cpu_vm_mask);
134 cpu_set(cpu, next->cpu_vm_mask);
135
136 local_irq_restore(flags);
137}
138
139/*
140 * Destroy context related info for an mm_struct that is about
141 * to be put to rest.
142 */
143static inline void destroy_context(struct mm_struct *mm)
144{
145}
146
147#define deactivate_mm(tsk,mm) do { } while (0)
148
149/*
150 * After we have set current->mm to a new value, this activates
151 * the context for the new mm so we see the new mappings.
152 */
153static inline void
154activate_mm(struct mm_struct *prev, struct mm_struct *next)
155{
156 unsigned long flags;
157 unsigned int cpu = smp_processor_id();
158
159 local_irq_save(flags);
160
161 /* Unconditionally get a new ASID. */
162 get_new_mmu_context(next, cpu);
163
164 write_c0_entryhi(cpu_context(cpu, next));
165 TLBMISS_HANDLER_SETUP_PGD(next->pgd);
166
167 /* mark mmu ownership change */
168 cpu_clear(cpu, prev->cpu_vm_mask);
169 cpu_set(cpu, next->cpu_vm_mask);
170
171 local_irq_restore(flags);
172}
173
174/*
175 * If mm is currently active_mm, we can't really drop it. Instead,
176 * we will get a new one for it.
177 */
178static inline void
179drop_mmu_context(struct mm_struct *mm, unsigned cpu)
180{
181 unsigned long flags;
182
183 local_irq_save(flags);
184
185 if (cpu_isset(cpu, mm->cpu_vm_mask)) {
186 get_new_mmu_context(mm, cpu);
187 write_c0_entryhi(cpu_asid(cpu, mm));
188 } else {
189 /* will get a new context next time */
190 cpu_context(cpu, mm) = 0;
191 }
192
193 local_irq_restore(flags);
194}
195
196#endif /* _ASM_MMU_CONTEXT_H */
diff --git a/include/asm-mips/mmzone.h b/include/asm-mips/mmzone.h
new file mode 100644
index 000000000000..29ee13be0b2a
--- /dev/null
+++ b/include/asm-mips/mmzone.h
@@ -0,0 +1,39 @@
1/*
2 * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99
3 * Rewritten for Linux 2.6 by Christoph Hellwig (hch@lst.de) Jan 2004
4 */
5#ifndef _ASM_MMZONE_H_
6#define _ASM_MMZONE_H_
7
8#include <asm/page.h>
9#include <mmzone.h>
10
11#define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr))
12#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT)
13
14#define pfn_valid(pfn) \
15({ \
16 unsigned long __pfn = (pfn); \
17 int __n = pfn_to_nid(__pfn); \
18 ((__n >= 0) ? (__pfn < NODE_DATA(__n)->node_start_pfn + \
19 NODE_DATA(__n)->node_spanned_pages) : 0);\
20})
21
22#define pfn_to_page(pfn) \
23({ \
24 unsigned long __pfn = (pfn); \
25 pg_data_t *__pg = NODE_DATA(pfn_to_nid(__pfn)); \
26 __pg->node_mem_map + (__pfn - __pg->node_start_pfn); \
27})
28
29#define page_to_pfn(p) \
30({ \
31 struct page *__p = (p); \
32 struct zone *__z = page_zone(__p); \
33 ((__p - __z->zone_mem_map) + __z->zone_start_pfn); \
34})
35
36/* XXX: FIXME -- wli */
37#define kern_addr_valid(addr) (0)
38
39#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-mips/module.h b/include/asm-mips/module.h
new file mode 100644
index 000000000000..90ee24aad955
--- /dev/null
+++ b/include/asm-mips/module.h
@@ -0,0 +1,56 @@
1#ifndef _ASM_MODULE_H
2#define _ASM_MODULE_H
3
4#include <linux/config.h>
5#include <linux/list.h>
6#include <asm/uaccess.h>
7
8struct mod_arch_specific {
9 /* Data Bus Error exception tables */
10 struct list_head dbe_list;
11 const struct exception_table_entry *dbe_start;
12 const struct exception_table_entry *dbe_end;
13};
14
15typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
16
17typedef struct
18{
19 Elf64_Addr r_offset; /* Address of relocation. */
20 Elf64_Word r_sym; /* Symbol index. */
21 Elf64_Byte r_ssym; /* Special symbol. */
22 Elf64_Byte r_type3; /* Third relocation. */
23 Elf64_Byte r_type2; /* Second relocation. */
24 Elf64_Byte r_type; /* First relocation. */
25 Elf64_Sxword r_addend; /* Addend. */
26} Elf64_Mips_Rela;
27
28#ifdef CONFIG_MIPS32
29
30#define Elf_Shdr Elf32_Shdr
31#define Elf_Sym Elf32_Sym
32#define Elf_Ehdr Elf32_Ehdr
33
34#endif
35
36#ifdef CONFIG_MIPS64
37
38#define Elf_Shdr Elf64_Shdr
39#define Elf_Sym Elf64_Sym
40#define Elf_Ehdr Elf64_Ehdr
41
42#endif
43
44#ifdef CONFIG_MODULES
45/* Given an address, look for it in the exception tables. */
46const struct exception_table_entry*search_module_dbetables(unsigned long addr);
47#else
48/* Given an address, look for it in the exception tables. */
49static inline const struct exception_table_entry *
50search_module_dbetables(unsigned long addr)
51{
52 return NULL;
53}
54#endif
55
56#endif /* _ASM_MODULE_H */
diff --git a/include/asm-mips/msc01_ic.h b/include/asm-mips/msc01_ic.h
new file mode 100644
index 000000000000..64f17208d602
--- /dev/null
+++ b/include/asm-mips/msc01_ic.h
@@ -0,0 +1,151 @@
1/*
2 * PCI Register definitions for the MIPS System Controller.
3 *
4 * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef __ASM_MIPS_BOARDS_MSC01_IC_H
12#define __ASM_MIPS_BOARDS_MSC01_IC_H
13
14/*****************************************************************************
15 * Register offset addresses
16 *****************************************************************************/
17
18#define MSC01_IC_RST_OFS 0x00008 /* Software reset */
19#define MSC01_IC_ENAL_OFS 0x00100 /* Int_in enable mask 31:0 */
20#define MSC01_IC_ENAH_OFS 0x00108 /* Int_in enable mask 63:32 */
21#define MSC01_IC_DISL_OFS 0x00120 /* Int_in disable mask 31:0 */
22#define MSC01_IC_DISH_OFS 0x00128 /* Int_in disable mask 63:32 */
23#define MSC01_IC_ISBL_OFS 0x00140 /* Raw int_in 31:0 */
24#define MSC01_IC_ISBH_OFS 0x00148 /* Raw int_in 63:32 */
25#define MSC01_IC_ISAL_OFS 0x00160 /* Masked int_in 31:0 */
26#define MSC01_IC_ISAH_OFS 0x00168 /* Masked int_in 63:32 */
27#define MSC01_IC_LVL_OFS 0x00180 /* Disable priority int_out */
28#define MSC01_IC_RAMW_OFS 0x00180 /* Shadow set RAM (EI) */
29#define MSC01_IC_OSB_OFS 0x00188 /* Raw int_out */
30#define MSC01_IC_OSA_OFS 0x00190 /* Masked int_out */
31#define MSC01_IC_GENA_OFS 0x00198 /* Global HW int enable */
32#define MSC01_IC_BASE_OFS 0x001a0 /* Base address of IC_VEC */
33#define MSC01_IC_VEC_OFS 0x001b0 /* Active int's vector address */
34#define MSC01_IC_EOI_OFS 0x001c0 /* Enable lower level ints */
35#define MSC01_IC_CFG_OFS 0x001c8 /* Configuration register */
36#define MSC01_IC_TRLD_OFS 0x001d0 /* Interval timer reload val */
37#define MSC01_IC_TVAL_OFS 0x001e0 /* Interval timer current val */
38#define MSC01_IC_TCFG_OFS 0x001f0 /* Interval timer config */
39#define MSC01_IC_SUP_OFS 0x00200 /* Set up int_in line 0 */
40#define MSC01_IC_ENA_OFS 0x00800 /* Int_in enable mask 63:0 */
41#define MSC01_IC_DIS_OFS 0x00820 /* Int_in disable mask 63:0 */
42#define MSC01_IC_ISB_OFS 0x00840 /* Raw int_in 63:0 */
43#define MSC01_IC_ISA_OFS 0x00860 /* Masked int_in 63:0 */
44
45/*****************************************************************************
46 * Register field encodings
47 *****************************************************************************/
48
49#define MSC01_IC_RST_RST_SHF 0
50#define MSC01_IC_RST_RST_MSK 0x00000001
51#define MSC01_IC_RST_RST_BIT MSC01_IC_RST_RST_MSK
52#define MSC01_IC_LVL_LVL_SHF 0
53#define MSC01_IC_LVL_LVL_MSK 0x000000ff
54#define MSC01_IC_LVL_SPUR_SHF 16
55#define MSC01_IC_LVL_SPUR_MSK 0x00010000
56#define MSC01_IC_LVL_SPUR_BIT MSC01_IC_LVL_SPUR_MSK
57#define MSC01_IC_RAMW_RIPL_SHF 0
58#define MSC01_IC_RAMW_RIPL_MSK 0x0000003f
59#define MSC01_IC_RAMW_DATA_SHF 6
60#define MSC01_IC_RAMW_DATA_MSK 0x00000fc0
61#define MSC01_IC_RAMW_ADDR_SHF 25
62#define MSC01_IC_RAMW_ADDR_MSK 0x7e000000
63#define MSC01_IC_RAMW_READ_SHF 31
64#define MSC01_IC_RAMW_READ_MSK 0x80000000
65#define MSC01_IC_RAMW_READ_BIT MSC01_IC_RAMW_READ_MSK
66#define MSC01_IC_OSB_OSB_SHF 0
67#define MSC01_IC_OSB_OSB_MSK 0x000000ff
68#define MSC01_IC_OSA_OSA_SHF 0
69#define MSC01_IC_OSA_OSA_MSK 0x000000ff
70#define MSC01_IC_GENA_GENA_SHF 0
71#define MSC01_IC_GENA_GENA_MSK 0x00000001
72#define MSC01_IC_GENA_GENA_BIT MSC01_IC_GENA_GENA_MSK
73#define MSC01_IC_CFG_DIS_SHF 0
74#define MSC01_IC_CFG_DIS_MSK 0x00000001
75#define MSC01_IC_CFG_DIS_BIT MSC01_IC_CFG_DIS_MSK
76#define MSC01_IC_CFG_SHFT_SHF 8
77#define MSC01_IC_CFG_SHFT_MSK 0x00000f00
78#define MSC01_IC_TCFG_ENA_SHF 0
79#define MSC01_IC_TCFG_ENA_MSK 0x00000001
80#define MSC01_IC_TCFG_ENA_BIT MSC01_IC_TCFG_ENA_MSK
81#define MSC01_IC_TCFG_INT_SHF 8
82#define MSC01_IC_TCFG_INT_MSK 0x00000100
83#define MSC01_IC_TCFG_INT_BIT MSC01_IC_TCFG_INT_MSK
84#define MSC01_IC_TCFG_EDGE_SHF 16
85#define MSC01_IC_TCFG_EDGE_MSK 0x00010000
86#define MSC01_IC_TCFG_EDGE_BIT MSC01_IC_TCFG_EDGE_MSK
87#define MSC01_IC_SUP_PRI_SHF 0
88#define MSC01_IC_SUP_PRI_MSK 0x00000007
89#define MSC01_IC_SUP_EDGE_SHF 8
90#define MSC01_IC_SUP_EDGE_MSK 0x00000100
91#define MSC01_IC_SUP_EDGE_BIT MSC01_IC_SUP_EDGE_MSK
92#define MSC01_IC_SUP_STEP 8
93
94/*
95 * MIPS System controller interrupt register base.
96 *
97 * FIXME - are these macros specific to Malta and co or to the MSC? If the
98 * latter, they should be moved elsewhere.
99 */
100#define MIPS_MSC01_IC_REG_BASE 0x1bc40000
101
102/*****************************************************************************
103 * Absolute register addresses
104 *****************************************************************************/
105
106#define MSC01_IC_RST (MSC01_IC_REG_BASE + MSC01_IC_RST_OFS)
107#define MSC01_IC_ENAL (MSC01_IC_REG_BASE + MSC01_IC_ENAL_OFS)
108#define MSC01_IC_ENAH (MSC01_IC_REG_BASE + MSC01_IC_ENAH_OFS)
109#define MSC01_IC_DISL (MSC01_IC_REG_BASE + MSC01_IC_DISL_OFS)
110#define MSC01_IC_DISH (MSC01_IC_REG_BASE + MSC01_IC_DISH_OFS)
111#define MSC01_IC_ISBL (MSC01_IC_REG_BASE + MSC01_IC_ISBL_OFS)
112#define MSC01_IC_ISBH (MSC01_IC_REG_BASE + MSC01_IC_ISBH_OFS)
113#define MSC01_IC_ISAL (MSC01_IC_REG_BASE + MSC01_IC_ISAL_OFS)
114#define MSC01_IC_ISAH (MSC01_IC_REG_BASE + MSC01_IC_ISAH_OFS)
115#define MSC01_IC_LVL (MSC01_IC_REG_BASE + MSC01_IC_LVL_OFS)
116#define MSC01_IC_RAMW (MSC01_IC_REG_BASE + MSC01_IC_RAMW_OFS)
117#define MSC01_IC_OSB (MSC01_IC_REG_BASE + MSC01_IC_OSB_OFS)
118#define MSC01_IC_OSA (MSC01_IC_REG_BASE + MSC01_IC_OSA_OFS)
119#define MSC01_IC_GENA (MSC01_IC_REG_BASE + MSC01_IC_GENA_OFS)
120#define MSC01_IC_BASE (MSC01_IC_REG_BASE + MSC01_IC_BASE_OFS)
121#define MSC01_IC_VEC (MSC01_IC_REG_BASE + MSC01_IC_VEC_OFS)
122#define MSC01_IC_EOI (MSC01_IC_REG_BASE + MSC01_IC_EOI_OFS)
123#define MSC01_IC_CFG (MSC01_IC_REG_BASE + MSC01_IC_CFG_OFS)
124#define MSC01_IC_TRLD (MSC01_IC_REG_BASE + MSC01_IC_TRLD_OFS)
125#define MSC01_IC_TVAL (MSC01_IC_REG_BASE + MSC01_IC_TVAL_OFS)
126#define MSC01_IC_TCFG (MSC01_IC_REG_BASE + MSC01_IC_TCFG_OFS)
127#define MSC01_IC_SUP (MSC01_IC_REG_BASE + MSC01_IC_SUP_OFS)
128#define MSC01_IC_ENA (MSC01_IC_REG_BASE + MSC01_IC_ENA_OFS)
129#define MSC01_IC_DIS (MSC01_IC_REG_BASE + MSC01_IC_DIS_OFS)
130#define MSC01_IC_ISB (MSC01_IC_REG_BASE + MSC01_IC_ISB_OFS)
131#define MSC01_IC_ISA (MSC01_IC_REG_BASE + MSC01_IC_ISA_OFS)
132
133/*
134 * Soc-it interrupts are configurable.
135 * Every board describes its IRQ mapping with this table.
136 */
137typedef struct msc_irqmap {
138 int im_irq;
139 int im_type;
140 int im_lvl;
141} msc_irqmap_t;
142
143/* im_type */
144#define MSC01_IRQ_LEVEL 0
145#define MSC01_IRQ_EDGE 1
146
147extern void __init init_msc_irqs(unsigned int base, msc_irqmap_t *imp, int nirq);
148extern void ll_msc_irq(struct pt_regs *regs);
149
150#endif /* __ASM_MIPS_BOARDS_MSC01_IC_H */
151
diff --git a/include/asm-mips/msgbuf.h b/include/asm-mips/msgbuf.h
new file mode 100644
index 000000000000..513b2824838b
--- /dev/null
+++ b/include/asm-mips/msgbuf.h
@@ -0,0 +1,48 @@
1#ifndef _ASM_MSGBUF_H
2#define _ASM_MSGBUF_H
3
4#include <linux/config.h>
5
6/*
7 * The msqid64_ds structure for the MIPS architecture.
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * Pad space is left for:
12 * - extension of time_t to 64-bit on 32-bitsystem to solve the y2038 problem
13 * - 2 miscellaneous unsigned long values
14 */
15
16struct msqid64_ds {
17 struct ipc64_perm msg_perm;
18#if defined(CONFIG_MIPS32) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
19 unsigned long __unused1;
20#endif
21 __kernel_time_t msg_stime; /* last msgsnd time */
22#if defined(CONFIG_MIPS32) && defined(CONFIG_CPU_LITTLE_ENDIAN)
23 unsigned long __unused1;
24#endif
25#if defined(CONFIG_MIPS32) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
26 unsigned long __unused2;
27#endif
28 __kernel_time_t msg_rtime; /* last msgrcv time */
29#if defined(CONFIG_MIPS32) && defined(CONFIG_CPU_LITTLE_ENDIAN)
30 unsigned long __unused2;
31#endif
32#if defined(CONFIG_MIPS32) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
33 unsigned long __unused3;
34#endif
35 __kernel_time_t msg_ctime; /* last change time */
36#if defined(CONFIG_MIPS32) && defined(CONFIG_CPU_LITTLE_ENDIAN)
37 unsigned long __unused3;
38#endif
39 unsigned long msg_cbytes; /* current number of bytes on queue */
40 unsigned long msg_qnum; /* number of messages in queue */
41 unsigned long msg_qbytes; /* max number of bytes on queue */
42 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
43 __kernel_pid_t msg_lrpid; /* last receive pid */
44 unsigned long __unused4;
45 unsigned long __unused5;
46};
47
48#endif /* _ASM_MSGBUF_H */
diff --git a/include/asm-mips/namei.h b/include/asm-mips/namei.h
new file mode 100644
index 000000000000..c94d12d1f868
--- /dev/null
+++ b/include/asm-mips/namei.h
@@ -0,0 +1,26 @@
1#ifndef _ASM_NAMEI_H
2#define _ASM_NAMEI_H
3
4#include <linux/personality.h>
5#include <linux/stddef.h>
6
7#define IRIX_EMUL "/usr/gnemul/irix/"
8#define RISCOS_EMUL "/usr/gnemul/riscos/"
9
10static inline char *__emul_prefix(void)
11{
12 switch (current->personality) {
13 case PER_IRIX32:
14 case PER_IRIXN32:
15 case PER_IRIX64:
16 return IRIX_EMUL;
17
18 case PER_RISCOS:
19 return RISCOS_EMUL;
20
21 default:
22 return NULL;
23 }
24}
25
26#endif /* _ASM_NAMEI_H */
diff --git a/include/asm-mips/nile4.h b/include/asm-mips/nile4.h
new file mode 100644
index 000000000000..c3ca959aa4d9
--- /dev/null
+++ b/include/asm-mips/nile4.h
@@ -0,0 +1,310 @@
1/*
2 * asm-mips/nile4.h -- NEC Vrc-5074 Nile 4 definitions
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 *
7 * This file is based on the following documentation:
8 *
9 * NEC Vrc 5074 System Controller Data Sheet, June 1998
10 */
11
12#ifndef _ASM_NILE4_H
13#define _ASM_NILE4_H
14
15#define NILE4_BASE 0xbfa00000
16#define NILE4_SIZE 0x00200000 /* 2 MB */
17
18
19 /*
20 * Physical Device Address Registers (PDARs)
21 */
22
23#define NILE4_SDRAM0 0x0000 /* SDRAM Bank 0 [R/W] */
24#define NILE4_SDRAM1 0x0008 /* SDRAM Bank 1 [R/W] */
25#define NILE4_DCS2 0x0010 /* Device Chip-Select 2 [R/W] */
26#define NILE4_DCS3 0x0018 /* Device Chip-Select 3 [R/W] */
27#define NILE4_DCS4 0x0020 /* Device Chip-Select 4 [R/W] */
28#define NILE4_DCS5 0x0028 /* Device Chip-Select 5 [R/W] */
29#define NILE4_DCS6 0x0030 /* Device Chip-Select 6 [R/W] */
30#define NILE4_DCS7 0x0038 /* Device Chip-Select 7 [R/W] */
31#define NILE4_DCS8 0x0040 /* Device Chip-Select 8 [R/W] */
32#define NILE4_PCIW0 0x0060 /* PCI Address Window 0 [R/W] */
33#define NILE4_PCIW1 0x0068 /* PCI Address Window 1 [R/W] */
34#define NILE4_INTCS 0x0070 /* Controller Internal Registers and Devices */
35 /* [R/W] */
36#define NILE4_BOOTCS 0x0078 /* Boot ROM Chip-Select [R/W] */
37
38
39 /*
40 * CPU Interface Registers
41 */
42
43#define NILE4_CPUSTAT 0x0080 /* CPU Status [R/W] */
44#define NILE4_INTCTRL 0x0088 /* Interrupt Control [R/W] */
45#define NILE4_INTSTAT0 0x0090 /* Interrupt Status 0 [R] */
46#define NILE4_INTSTAT1 0x0098 /* Interrupt Status 1 and CPU Interrupt */
47 /* Enable [R/W] */
48#define NILE4_INTCLR 0x00A0 /* Interrupt Clear [R/W] */
49#define NILE4_INTPPES 0x00A8 /* PCI Interrupt Control [R/W] */
50
51
52 /*
53 * Memory-Interface Registers
54 */
55
56#define NILE4_MEMCTRL 0x00C0 /* Memory Control */
57#define NILE4_ACSTIME 0x00C8 /* Memory Access Timing [R/W] */
58#define NILE4_CHKERR 0x00D0 /* Memory Check Error Status [R] */
59
60
61 /*
62 * PCI-Bus Registers
63 */
64
65#define NILE4_PCICTRL 0x00E0 /* PCI Control [R/W] */
66#define NILE4_PCIARB 0x00E8 /* PCI Arbiter [R/W] */
67#define NILE4_PCIINIT0 0x00F0 /* PCI Master (Initiator) 0 [R/W] */
68#define NILE4_PCIINIT1 0x00F8 /* PCI Master (Initiator) 1 [R/W] */
69#define NILE4_PCIERR 0x00B8 /* PCI Error [R/W] */
70
71
72 /*
73 * Local-Bus Registers
74 */
75
76#define NILE4_LCNFG 0x0100 /* Local Bus Configuration [R/W] */
77#define NILE4_LCST2 0x0110 /* Local Bus Chip-Select Timing 2 [R/W] */
78#define NILE4_LCST3 0x0118 /* Local Bus Chip-Select Timing 3 [R/W] */
79#define NILE4_LCST4 0x0120 /* Local Bus Chip-Select Timing 4 [R/W] */
80#define NILE4_LCST5 0x0128 /* Local Bus Chip-Select Timing 5 [R/W] */
81#define NILE4_LCST6 0x0130 /* Local Bus Chip-Select Timing 6 [R/W] */
82#define NILE4_LCST7 0x0138 /* Local Bus Chip-Select Timing 7 [R/W] */
83#define NILE4_LCST8 0x0140 /* Local Bus Chip-Select Timing 8 [R/W] */
84#define NILE4_DCSFN 0x0150 /* Device Chip-Select Muxing and Output */
85 /* Enables [R/W] */
86#define NILE4_DCSIO 0x0158 /* Device Chip-Selects As I/O Bits [R/W] */
87#define NILE4_BCST 0x0178 /* Local Boot Chip-Select Timing [R/W] */
88
89
90 /*
91 * DMA Registers
92 */
93
94#define NILE4_DMACTRL0 0x0180 /* DMA Control 0 [R/W] */
95#define NILE4_DMASRCA0 0x0188 /* DMA Source Address 0 [R/W] */
96#define NILE4_DMADESA0 0x0190 /* DMA Destination Address 0 [R/W] */
97#define NILE4_DMACTRL1 0x0198 /* DMA Control 1 [R/W] */
98#define NILE4_DMASRCA1 0x01A0 /* DMA Source Address 1 [R/W] */
99#define NILE4_DMADESA1 0x01A8 /* DMA Destination Address 1 [R/W] */
100
101
102 /*
103 * Timer Registers
104 */
105
106#define NILE4_T0CTRL 0x01C0 /* SDRAM Refresh Control [R/W] */
107#define NILE4_T0CNTR 0x01C8 /* SDRAM Refresh Counter [R/W] */
108#define NILE4_T1CTRL 0x01D0 /* CPU-Bus Read Time-Out Control [R/W] */
109#define NILE4_T1CNTR 0x01D8 /* CPU-Bus Read Time-Out Counter [R/W] */
110#define NILE4_T2CTRL 0x01E0 /* General-Purpose Timer Control [R/W] */
111#define NILE4_T2CNTR 0x01E8 /* General-Purpose Timer Counter [R/W] */
112#define NILE4_T3CTRL 0x01F0 /* Watchdog Timer Control [R/W] */
113#define NILE4_T3CNTR 0x01F8 /* Watchdog Timer Counter [R/W] */
114
115
116 /*
117 * PCI Configuration Space Registers
118 */
119
120#define NILE4_PCI_BASE 0x0200
121
122#define NILE4_VID 0x0200 /* PCI Vendor ID [R] */
123#define NILE4_DID 0x0202 /* PCI Device ID [R] */
124#define NILE4_PCICMD 0x0204 /* PCI Command [R/W] */
125#define NILE4_PCISTS 0x0206 /* PCI Status [R/W] */
126#define NILE4_REVID 0x0208 /* PCI Revision ID [R] */
127#define NILE4_CLASS 0x0209 /* PCI Class Code [R] */
128#define NILE4_CLSIZ 0x020C /* PCI Cache Line Size [R/W] */
129#define NILE4_MLTIM 0x020D /* PCI Latency Timer [R/W] */
130#define NILE4_HTYPE 0x020E /* PCI Header Type [R] */
131#define NILE4_BIST 0x020F /* BIST [R] (unimplemented) */
132#define NILE4_BARC 0x0210 /* PCI Base Address Register Control [R/W] */
133#define NILE4_BAR0 0x0218 /* PCI Base Address Register 0 [R/W] */
134#define NILE4_BAR1 0x0220 /* PCI Base Address Register 1 [R/W] */
135#define NILE4_CIS 0x0228 /* PCI Cardbus CIS Pointer [R] */
136 /* (unimplemented) */
137#define NILE4_SSVID 0x022C /* PCI Sub-System Vendor ID [R/W] */
138#define NILE4_SSID 0x022E /* PCI Sub-System ID [R/W] */
139#define NILE4_ROM 0x0230 /* Expansion ROM Base Address [R] */
140 /* (unimplemented) */
141#define NILE4_INTLIN 0x023C /* PCI Interrupt Line [R/W] */
142#define NILE4_INTPIN 0x023D /* PCI Interrupt Pin [R] */
143#define NILE4_MINGNT 0x023E /* PCI Min_Gnt [R] (unimplemented) */
144#define NILE4_MAXLAT 0x023F /* PCI Max_Lat [R] (unimplemented) */
145#define NILE4_BAR2 0x0240 /* PCI Base Address Register 2 [R/W] */
146#define NILE4_BAR3 0x0248 /* PCI Base Address Register 3 [R/W] */
147#define NILE4_BAR4 0x0250 /* PCI Base Address Register 4 [R/W] */
148#define NILE4_BAR5 0x0258 /* PCI Base Address Register 5 [R/W] */
149#define NILE4_BAR6 0x0260 /* PCI Base Address Register 6 [R/W] */
150#define NILE4_BAR7 0x0268 /* PCI Base Address Register 7 [R/W] */
151#define NILE4_BAR8 0x0270 /* PCI Base Address Register 8 [R/W] */
152#define NILE4_BARB 0x0278 /* PCI Base Address Register BOOT [R/W] */
153
154
155 /*
156 * Serial-Port Registers
157 */
158
159#define NILE4_UART_BASE 0x0300
160
161#define NILE4_UARTRBR 0x0300 /* UART Receiver Data Buffer [R] */
162#define NILE4_UARTTHR 0x0300 /* UART Transmitter Data Holding [W] */
163#define NILE4_UARTIER 0x0308 /* UART Interrupt Enable [R/W] */
164#define NILE4_UARTDLL 0x0300 /* UART Divisor Latch LSB [R/W] */
165#define NILE4_UARTDLM 0x0308 /* UART Divisor Latch MSB [R/W] */
166#define NILE4_UARTIIR 0x0310 /* UART Interrupt ID [R] */
167#define NILE4_UARTFCR 0x0310 /* UART FIFO Control [W] */
168#define NILE4_UARTLCR 0x0318 /* UART Line Control [R/W] */
169#define NILE4_UARTMCR 0x0320 /* UART Modem Control [R/W] */
170#define NILE4_UARTLSR 0x0328 /* UART Line Status [R/W] */
171#define NILE4_UARTMSR 0x0330 /* UART Modem Status [R/W] */
172#define NILE4_UARTSCR 0x0338 /* UART Scratch [R/W] */
173
174#define NILE4_UART_BASE_BAUD 520833 /* 100 MHz / 12 / 16 */
175
176
177 /*
178 * Interrupt Lines
179 */
180
181#define NILE4_INT_CPCE 0 /* CPU-Interface Parity-Error Interrupt */
182#define NILE4_INT_CNTD 1 /* CPU No-Target Decode Interrupt */
183#define NILE4_INT_MCE 2 /* Memory-Check Error Interrupt */
184#define NILE4_INT_DMA 3 /* DMA Controller Interrupt */
185#define NILE4_INT_UART 4 /* UART Interrupt */
186#define NILE4_INT_WDOG 5 /* Watchdog Timer Interrupt */
187#define NILE4_INT_GPT 6 /* General-Purpose Timer Interrupt */
188#define NILE4_INT_LBRTD 7 /* Local-Bus Ready Timer Interrupt */
189#define NILE4_INT_INTA 8 /* PCI Interrupt Signal INTA# */
190#define NILE4_INT_INTB 9 /* PCI Interrupt Signal INTB# */
191#define NILE4_INT_INTC 10 /* PCI Interrupt Signal INTC# */
192#define NILE4_INT_INTD 11 /* PCI Interrupt Signal INTD# */
193#define NILE4_INT_INTE 12 /* PCI Interrupt Signal INTE# (ISA cascade) */
194#define NILE4_INT_RESV 13 /* Reserved */
195#define NILE4_INT_PCIS 14 /* PCI SERR# Interrupt */
196#define NILE4_INT_PCIE 15 /* PCI Internal Error Interrupt */
197
198
199 /*
200 * Nile 4 Register Access
201 */
202
203static inline void nile4_sync(void)
204{
205 volatile u32 *p = (volatile u32 *)0xbfc00000;
206 (void)(*p);
207}
208
209static inline void nile4_out32(u32 offset, u32 val)
210{
211 *(volatile u32 *)(NILE4_BASE+offset) = val;
212 nile4_sync();
213}
214
215static inline u32 nile4_in32(u32 offset)
216{
217 u32 val = *(volatile u32 *)(NILE4_BASE+offset);
218 nile4_sync();
219 return val;
220}
221
222static inline void nile4_out16(u32 offset, u16 val)
223{
224 *(volatile u16 *)(NILE4_BASE+offset) = val;
225 nile4_sync();
226}
227
228static inline u16 nile4_in16(u32 offset)
229{
230 u16 val = *(volatile u16 *)(NILE4_BASE+offset);
231 nile4_sync();
232 return val;
233}
234
235static inline void nile4_out8(u32 offset, u8 val)
236{
237 *(volatile u8 *)(NILE4_BASE+offset) = val;
238 nile4_sync();
239}
240
241static inline u8 nile4_in8(u32 offset)
242{
243 u8 val = *(volatile u8 *)(NILE4_BASE+offset);
244 nile4_sync();
245 return val;
246}
247
248
249 /*
250 * Physical Device Address Registers
251 */
252
253extern void nile4_set_pdar(u32 pdar, u32 phys, u32 size, int width,
254 int on_memory_bus, int visible);
255
256
257 /*
258 * PCI Master Registers
259 */
260
261#define NILE4_PCICMD_IACK 0 /* PCI Interrupt Acknowledge */
262#define NILE4_PCICMD_IO 1 /* PCI I/O Space */
263#define NILE4_PCICMD_MEM 3 /* PCI Memory Space */
264#define NILE4_PCICMD_CFG 5 /* PCI Configuration Space */
265
266
267 /*
268 * PCI Address Spaces
269 *
270 * Note that these are multiplexed using PCIINIT[01]!
271 */
272
273#define NILE4_PCI_IO_BASE 0xa6000000
274#define NILE4_PCI_MEM_BASE 0xa8000000
275#define NILE4_PCI_CFG_BASE NILE4_PCI_MEM_BASE
276#define NILE4_PCI_IACK_BASE NILE4_PCI_IO_BASE
277
278
279extern void nile4_set_pmr(u32 pmr, u32 type, u32 addr);
280
281
282 /*
283 * Interrupt Programming
284 */
285
286#define NUM_I8259_INTERRUPTS 16
287#define NUM_NILE4_INTERRUPTS 16
288
289#define IRQ_I8259_CASCADE NILE4_INT_INTE
290#define is_i8259_irq(irq) ((irq) < NUM_I8259_INTERRUPTS)
291#define nile4_to_irq(n) ((n)+NUM_I8259_INTERRUPTS)
292#define irq_to_nile4(n) ((n)-NUM_I8259_INTERRUPTS)
293
294extern void nile4_map_irq(int nile4_irq, int cpu_irq);
295extern void nile4_map_irq_all(int cpu_irq);
296extern void nile4_enable_irq(unsigned int nile4_irq);
297extern void nile4_disable_irq(unsigned int nile4_irq);
298extern void nile4_disable_irq_all(void);
299extern u16 nile4_get_irq_stat(int cpu_irq);
300extern void nile4_enable_irq_output(int cpu_irq);
301extern void nile4_disable_irq_output(int cpu_irq);
302extern void nile4_set_pci_irq_polarity(int pci_irq, int high);
303extern void nile4_set_pci_irq_level_or_edge(int pci_irq, int level);
304extern void nile4_clear_irq(int nile4_irq);
305extern void nile4_clear_irq_mask(u32 mask);
306extern u8 nile4_i8259_iack(void);
307extern void nile4_dump_irq_status(void); /* Debug */
308
309#endif
310
diff --git a/include/asm-mips/numnodes.h b/include/asm-mips/numnodes.h
new file mode 100644
index 000000000000..4f00c16ceeb0
--- /dev/null
+++ b/include/asm-mips/numnodes.h
@@ -0,0 +1,7 @@
1#ifndef _ASM_MAX_NUMNODES_H
2#define _ASM_MAX_NUMNODES_H
3
4/* Max 128 Nodes */
5#define NODES_SHIFT 6
6
7#endif /* _ASM_MAX_NUMNODES_H */
diff --git a/include/asm-mips/paccess.h b/include/asm-mips/paccess.h
new file mode 100644
index 000000000000..36cec9e31696
--- /dev/null
+++ b/include/asm-mips/paccess.h
@@ -0,0 +1,113 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 1997, 1998, 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 *
9 * Protected memory access. Used for everything that might take revenge
10 * by sending a DBE error like accessing possibly non-existant memory or
11 * devices.
12 */
13#ifndef _ASM_PACCESS_H
14#define _ASM_PACCESS_H
15
16#include <linux/config.h>
17#include <linux/errno.h>
18
19#ifdef CONFIG_MIPS32
20#define __PA_ADDR ".word"
21#endif
22#ifdef CONFIG_MIPS64
23#define __PA_ADDR ".dword"
24#endif
25
26extern asmlinkage void handle_ibe(void);
27extern asmlinkage void handle_dbe(void);
28
29#define put_dbe(x,ptr) __put_dbe((x),(ptr),sizeof(*(ptr)))
30#define get_dbe(x,ptr) __get_dbe((x),(ptr),sizeof(*(ptr)))
31
32struct __large_pstruct { unsigned long buf[100]; };
33#define __mp(x) (*(struct __large_pstruct *)(x))
34
35#define __get_dbe(x,ptr,size) \
36({ \
37 long __gu_err; \
38 __typeof(*(ptr)) __gu_val; \
39 unsigned long __gu_addr; \
40 __asm__("":"=r" (__gu_val)); \
41 __gu_addr = (unsigned long) (ptr); \
42 __asm__("":"=r" (__gu_err)); \
43 switch (size) { \
44 case 1: __get_dbe_asm("lb"); break; \
45 case 2: __get_dbe_asm("lh"); break; \
46 case 4: __get_dbe_asm("lw"); break; \
47 case 8: __get_dbe_asm("ld"); break; \
48 default: __get_dbe_unknown(); break; \
49 } \
50 x = (__typeof__(*(ptr))) __gu_val; \
51 __gu_err; \
52})
53
54#define __get_dbe_asm(insn) \
55({ \
56 __asm__ __volatile__( \
57 "1:\t" insn "\t%1,%2\n\t" \
58 "move\t%0,$0\n" \
59 "2:\n\t" \
60 ".section\t.fixup,\"ax\"\n" \
61 "3:\tli\t%0,%3\n\t" \
62 "move\t%1,$0\n\t" \
63 "j\t2b\n\t" \
64 ".previous\n\t" \
65 ".section\t__dbe_table,\"a\"\n\t" \
66 __PA_ADDR "\t1b, 3b\n\t" \
67 ".previous" \
68 :"=r" (__gu_err), "=r" (__gu_val) \
69 :"o" (__mp(__gu_addr)), "i" (-EFAULT)); \
70})
71
72extern void __get_dbe_unknown(void);
73
74#define __put_dbe(x,ptr,size) \
75({ \
76 long __pu_err; \
77 __typeof__(*(ptr)) __pu_val; \
78 long __pu_addr; \
79 __pu_val = (x); \
80 __pu_addr = (long) (ptr); \
81 __asm__("":"=r" (__pu_err)); \
82 switch (size) { \
83 case 1: __put_dbe_asm("sb"); break; \
84 case 2: __put_dbe_asm("sh"); break; \
85 case 4: __put_dbe_asm("sw"); break; \
86 case 8: __put_dbe_asm("sd"); break; \
87 default: __put_dbe_unknown(); break; \
88 } \
89 __pu_err; \
90})
91
92#define __put_dbe_asm(insn) \
93({ \
94 __asm__ __volatile__( \
95 "1:\t" insn "\t%1,%2\n\t" \
96 "move\t%0,$0\n" \
97 "2:\n\t" \
98 ".section\t.fixup,\"ax\"\n" \
99 "3:\tli\t%0,%3\n\t" \
100 "j\t2b\n\t" \
101 ".previous\n\t" \
102 ".section\t__dbe_table,\"a\"\n\t" \
103 __PA_ADDR "\t1b, 3b\n\t" \
104 ".previous" \
105 : "=r" (__pu_err) \
106 : "r" (__pu_val), "o" (__mp(__pu_addr)), "i" (-EFAULT)); \
107})
108
109extern void __put_dbe_unknown(void);
110
111extern unsigned long search_dbe_table(unsigned long addr);
112
113#endif /* _ASM_PACCESS_H */
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
new file mode 100644
index 000000000000..d1bf8240e73b
--- /dev/null
+++ b/include/asm-mips/page.h
@@ -0,0 +1,151 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 1999, 2000, 03 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PAGE_H
10#define _ASM_PAGE_H
11
12#include <linux/config.h>
13
14#ifdef __KERNEL__
15
16#include <spaces.h>
17
18#endif
19
20/*
21 * PAGE_SHIFT determines the page size
22 */
23#ifdef CONFIG_PAGE_SIZE_4KB
24#define PAGE_SHIFT 12
25#endif
26#ifdef CONFIG_PAGE_SIZE_8KB
27#define PAGE_SHIFT 13
28#endif
29#ifdef CONFIG_PAGE_SIZE_16KB
30#define PAGE_SHIFT 14
31#endif
32#ifdef CONFIG_PAGE_SIZE_64KB
33#define PAGE_SHIFT 16
34#endif
35#define PAGE_SIZE (1UL << PAGE_SHIFT)
36#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
37
38
39#ifdef __KERNEL__
40#ifndef __ASSEMBLY__
41
42extern void clear_page(void * page);
43extern void copy_page(void * to, void * from);
44
45extern unsigned long shm_align_mask;
46
47static inline unsigned long pages_do_alias(unsigned long addr1,
48 unsigned long addr2)
49{
50 return (addr1 ^ addr2) & shm_align_mask;
51}
52
53struct page;
54
55static inline void clear_user_page(void *addr, unsigned long vaddr,
56 struct page *page)
57{
58 extern void (*flush_data_cache_page)(unsigned long addr);
59
60 clear_page(addr);
61 if (pages_do_alias((unsigned long) addr, vaddr))
62 flush_data_cache_page((unsigned long)addr);
63}
64
65static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
66 struct page *to)
67{
68 extern void (*flush_data_cache_page)(unsigned long addr);
69
70 copy_page(vto, vfrom);
71 if (pages_do_alias((unsigned long)vto, vaddr))
72 flush_data_cache_page((unsigned long)vto);
73}
74
75/*
76 * These are used to make use of C type-checking..
77 */
78#ifdef CONFIG_64BIT_PHYS_ADDR
79 #ifdef CONFIG_CPU_MIPS32
80 typedef struct { unsigned long pte_low, pte_high; } pte_t;
81 #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
82 #else
83 typedef struct { unsigned long long pte; } pte_t;
84 #define pte_val(x) ((x).pte)
85 #endif
86#else
87typedef struct { unsigned long pte; } pte_t;
88#define pte_val(x) ((x).pte)
89#endif
90
91typedef struct { unsigned long pmd; } pmd_t;
92typedef struct { unsigned long pgd; } pgd_t;
93typedef struct { unsigned long pgprot; } pgprot_t;
94
95#define pmd_val(x) ((x).pmd)
96#define pgd_val(x) ((x).pgd)
97#define pgprot_val(x) ((x).pgprot)
98
99#define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
100
101#define __pte(x) ((pte_t) { (x) } )
102#define __pmd(x) ((pmd_t) { (x) } )
103#define __pgd(x) ((pgd_t) { (x) } )
104#define __pgprot(x) ((pgprot_t) { (x) } )
105
106/* Pure 2^n version of get_order */
107static __inline__ int get_order(unsigned long size)
108{
109 int order;
110
111 size = (size-1) >> (PAGE_SHIFT-1);
112 order = -1;
113 do {
114 size >>= 1;
115 order++;
116 } while (size);
117 return order;
118}
119
120#endif /* !__ASSEMBLY__ */
121
122/* to align the pointer to the (next) page boundary */
123#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
124
125#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
126#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
127
128#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
129
130#ifndef CONFIG_DISCONTIGMEM
131#define pfn_to_page(pfn) (mem_map + (pfn))
132#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
133#define pfn_valid(pfn) ((pfn) < max_mapnr)
134#endif
135
136#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
137#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
138
139#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
140 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
141
142#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE)
143#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
144
145#endif /* defined (__KERNEL__) */
146
147#ifdef CONFIG_LIMITED_DMA
148#define WANT_PAGE_VIRTUAL
149#endif
150
151#endif /* _ASM_PAGE_H */
diff --git a/include/asm-mips/param.h b/include/asm-mips/param.h
new file mode 100644
index 000000000000..2bead8273ced
--- /dev/null
+++ b/include/asm-mips/param.h
@@ -0,0 +1,31 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright 1994 - 2000, 2002 Ralf Baechle (ralf@gnu.org)
7 * Copyright 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PARAM_H
10#define _ASM_PARAM_H
11
12#ifdef __KERNEL__
13
14# include <param.h> /* Internal kernel timer frequency */
15# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
17#endif
18
19#ifndef HZ
20#define HZ 100
21#endif
22
23#define EXEC_PAGESIZE 65536
24
25#ifndef NOGROUP
26#define NOGROUP (-1)
27#endif
28
29#define MAXHOSTNAMELEN 64 /* max length of hostname */
30
31#endif /* _ASM_PARAM_H */
diff --git a/include/asm-mips/parport.h b/include/asm-mips/parport.h
new file mode 100644
index 000000000000..a742e04e82de
--- /dev/null
+++ b/include/asm-mips/parport.h
@@ -0,0 +1,15 @@
1/*
2 * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk>
3 *
4 * This file should only be included by drivers/parport/parport_pc.c.
5 */
6#ifndef _ASM_PARPORT_H
7#define _ASM_PARPORT_H
8
9static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma);
10static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
11{
12 return parport_pc_find_isa_ports (autoirq, autodma);
13}
14
15#endif /* _ASM_PARPORT_H */
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
new file mode 100644
index 000000000000..c9c576b48556
--- /dev/null
+++ b/include/asm-mips/pci.h
@@ -0,0 +1,160 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 */
6#ifndef _ASM_PCI_H
7#define _ASM_PCI_H
8
9#include <linux/config.h>
10#include <linux/mm.h>
11
12#ifdef __KERNEL__
13
14/*
15 * This file essentially defines the interface between board
16 * specific PCI code and MIPS common PCI code. Should potentially put
17 * into include/asm/pci.h file.
18 */
19
20#include <linux/ioport.h>
21
22/*
23 * Each pci channel is a top-level PCI bus seem by CPU. A machine with
24 * multiple PCI channels may have multiple PCI host controllers or a
25 * single controller supporting multiple channels.
26 */
27struct pci_controller {
28 struct pci_controller *next;
29 struct pci_bus *bus;
30
31 struct pci_ops *pci_ops;
32 struct resource *mem_resource;
33 unsigned long mem_offset;
34 struct resource *io_resource;
35 unsigned long io_offset;
36
37 unsigned int index;
38 /* For compatibility with current (as of July 2003) pciutils
39 and XFree86. Eventually will be removed. */
40 unsigned int need_domain_info;
41
42 int iommu;
43};
44
45/*
46 * Used by boards to register their PCI busses before the actual scanning.
47 */
48extern struct pci_controller * alloc_pci_controller(void);
49extern void register_pci_controller(struct pci_controller *hose);
50
51/*
52 * board supplied pci irq fixup routine
53 */
54extern int pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
55
56
57/* Can be used to override the logic in pci_scan_bus for skipping
58 already-configured bus numbers - to be used for buggy BIOSes
59 or architectures with incomplete PCI setup by the loader */
60
61extern unsigned int pcibios_assign_all_busses(void);
62
63#define pcibios_scan_all_fns(a, b) 0
64
65extern unsigned long PCIBIOS_MIN_IO;
66extern unsigned long PCIBIOS_MIN_MEM;
67
68#define PCIBIOS_MIN_CARDBUS_IO 0x4000
69
70extern void pcibios_set_master(struct pci_dev *dev);
71
72static inline void pcibios_penalize_isa_irq(int irq)
73{
74 /* We don't do dynamic PCI IRQ allocation */
75}
76
77/*
78 * Dynamic DMA mapping stuff.
79 * MIPS has everything mapped statically.
80 */
81
82#include <linux/types.h>
83#include <linux/slab.h>
84#include <asm/scatterlist.h>
85#include <linux/string.h>
86#include <asm/io.h>
87
88struct pci_dev;
89
90/*
91 * The PCI address space does equal the physical memory address space. The
92 * networking and block device layers use this boolean for bounce buffer
93 * decisions. This is set if any hose does not have an IOMMU.
94 */
95extern unsigned int PCI_DMA_BUS_IS_PHYS;
96
97#ifdef CONFIG_MAPPED_DMA_IO
98
99/* pci_unmap_{single,page} is not a nop, thus... */
100#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
101#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
102#define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
103#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
104#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
105#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
106
107#else /* CONFIG_MAPPED_DMA_IO */
108
109/* pci_unmap_{page,single} is a nop so... */
110#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
111#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
112#define pci_unmap_addr(PTR, ADDR_NAME) (0)
113#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
114#define pci_unmap_len(PTR, LEN_NAME) (0)
115#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
116
117#endif /* CONFIG_MAPPED_DMA_IO */
118
119/* This is always fine. */
120#define pci_dac_dma_supported(pci_dev, mask) (1)
121
122extern dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
123 struct page *page, unsigned long offset, int direction);
124extern struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
125 dma64_addr_t dma_addr);
126extern unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
127 dma64_addr_t dma_addr);
128extern void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
129 dma64_addr_t dma_addr, size_t len, int direction);
130extern void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
131 dma64_addr_t dma_addr, size_t len, int direction);
132
133extern void pcibios_resource_to_bus(struct pci_dev *dev,
134 struct pci_bus_region *region, struct resource *res);
135
136#ifdef CONFIG_PCI_DOMAINS
137
138#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
139
140static inline int pci_proc_domain(struct pci_bus *bus)
141{
142 struct pci_controller *hose = bus->sysdata;
143 return hose->need_domain_info;
144}
145
146#endif /* CONFIG_PCI_DOMAINS */
147
148#endif /* __KERNEL__ */
149
150/* implement the pci_ DMA API in terms of the generic device dma_ one */
151#include <asm-generic/pci-dma-compat.h>
152
153static inline void pcibios_add_platform_entries(struct pci_dev *dev)
154{
155}
156
157/* Do platform specific device initialization at pci_enable_device() time */
158extern int pcibios_plat_dev_init(struct pci_dev *dev);
159
160#endif /* _ASM_PCI_H */
diff --git a/include/asm-mips/pci/bridge.h b/include/asm-mips/pci/bridge.h
new file mode 100644
index 000000000000..b4ee995c56e6
--- /dev/null
+++ b/include/asm-mips/pci/bridge.h
@@ -0,0 +1,851 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * bridge.h - bridge chip header file, derived from IRIX <sys/PCI/bridge.h>,
7 * revision 1.76.
8 *
9 * Copyright (C) 1996, 1999 Silcon Graphics, Inc.
10 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
11 */
12#ifndef _ASM_PCI_BRIDGE_H
13#define _ASM_PCI_BRIDGE_H
14
15#include <linux/types.h>
16#include <linux/pci.h>
17#include <asm/xtalk/xwidget.h> /* generic widget header */
18
19/* I/O page size */
20
21#define IOPFNSHIFT 12 /* 4K per mapped page */
22
23#define IOPGSIZE (1 << IOPFNSHIFT)
24#define IOPG(x) ((x) >> IOPFNSHIFT)
25#define IOPGOFF(x) ((x) & (IOPGSIZE-1))
26
27/* Bridge RAM sizes */
28
29#define BRIDGE_ATE_RAM_SIZE 0x00000400 /* 1kB ATE RAM */
30
31#define BRIDGE_CONFIG_BASE 0x20000
32#define BRIDGE_CONFIG1_BASE 0x28000
33#define BRIDGE_CONFIG_END 0x30000
34#define BRIDGE_CONFIG_SLOT_SIZE 0x1000
35
36#define BRIDGE_SSRAM_512K 0x00080000 /* 512kB */
37#define BRIDGE_SSRAM_128K 0x00020000 /* 128kB */
38#define BRIDGE_SSRAM_64K 0x00010000 /* 64kB */
39#define BRIDGE_SSRAM_0K 0x00000000 /* 0kB */
40
41/* ========================================================================
42 * Bridge address map
43 */
44
45#ifndef __ASSEMBLY__
46
47/*
48 * All accesses to bridge hardware registers must be done
49 * using 32-bit loads and stores.
50 */
51typedef u32 bridgereg_t;
52
53typedef u64 bridge_ate_t;
54
55/* pointers to bridge ATEs
56 * are always "pointer to volatile"
57 */
58typedef volatile bridge_ate_t *bridge_ate_p;
59
60/*
61 * It is generally preferred that hardware registers on the bridge
62 * are located from C code via this structure.
63 *
64 * Generated from Bridge spec dated 04oct95
65 */
66
67typedef volatile struct bridge_s {
68 /* Local Registers 0x000000-0x00FFFF */
69
70 /* standard widget configuration 0x000000-0x000057 */
71 widget_cfg_t b_widget; /* 0x000000 */
72
73 /* helper fieldnames for accessing bridge widget */
74
75#define b_wid_id b_widget.w_id
76#define b_wid_stat b_widget.w_status
77#define b_wid_err_upper b_widget.w_err_upper_addr
78#define b_wid_err_lower b_widget.w_err_lower_addr
79#define b_wid_control b_widget.w_control
80#define b_wid_req_timeout b_widget.w_req_timeout
81#define b_wid_int_upper b_widget.w_intdest_upper_addr
82#define b_wid_int_lower b_widget.w_intdest_lower_addr
83#define b_wid_err_cmdword b_widget.w_err_cmd_word
84#define b_wid_llp b_widget.w_llp_cfg
85#define b_wid_tflush b_widget.w_tflush
86
87 /* bridge-specific widget configuration 0x000058-0x00007F */
88 bridgereg_t _pad_000058;
89 bridgereg_t b_wid_aux_err; /* 0x00005C */
90 bridgereg_t _pad_000060;
91 bridgereg_t b_wid_resp_upper; /* 0x000064 */
92 bridgereg_t _pad_000068;
93 bridgereg_t b_wid_resp_lower; /* 0x00006C */
94 bridgereg_t _pad_000070;
95 bridgereg_t b_wid_tst_pin_ctrl; /* 0x000074 */
96 bridgereg_t _pad_000078[2];
97
98 /* PMU & Map 0x000080-0x00008F */
99 bridgereg_t _pad_000080;
100 bridgereg_t b_dir_map; /* 0x000084 */
101 bridgereg_t _pad_000088[2];
102
103 /* SSRAM 0x000090-0x00009F */
104 bridgereg_t _pad_000090;
105 bridgereg_t b_ram_perr; /* 0x000094 */
106 bridgereg_t _pad_000098[2];
107
108 /* Arbitration 0x0000A0-0x0000AF */
109 bridgereg_t _pad_0000A0;
110 bridgereg_t b_arb; /* 0x0000A4 */
111 bridgereg_t _pad_0000A8[2];
112
113 /* Number In A Can 0x0000B0-0x0000BF */
114 bridgereg_t _pad_0000B0;
115 bridgereg_t b_nic; /* 0x0000B4 */
116 bridgereg_t _pad_0000B8[2];
117
118 /* PCI/GIO 0x0000C0-0x0000FF */
119 bridgereg_t _pad_0000C0;
120 bridgereg_t b_bus_timeout; /* 0x0000C4 */
121#define b_pci_bus_timeout b_bus_timeout
122
123 bridgereg_t _pad_0000C8;
124 bridgereg_t b_pci_cfg; /* 0x0000CC */
125 bridgereg_t _pad_0000D0;
126 bridgereg_t b_pci_err_upper; /* 0x0000D4 */
127 bridgereg_t _pad_0000D8;
128 bridgereg_t b_pci_err_lower; /* 0x0000DC */
129 bridgereg_t _pad_0000E0[8];
130#define b_gio_err_lower b_pci_err_lower
131#define b_gio_err_upper b_pci_err_upper
132
133 /* Interrupt 0x000100-0x0001FF */
134 bridgereg_t _pad_000100;
135 bridgereg_t b_int_status; /* 0x000104 */
136 bridgereg_t _pad_000108;
137 bridgereg_t b_int_enable; /* 0x00010C */
138 bridgereg_t _pad_000110;
139 bridgereg_t b_int_rst_stat; /* 0x000114 */
140 bridgereg_t _pad_000118;
141 bridgereg_t b_int_mode; /* 0x00011C */
142 bridgereg_t _pad_000120;
143 bridgereg_t b_int_device; /* 0x000124 */
144 bridgereg_t _pad_000128;
145 bridgereg_t b_int_host_err; /* 0x00012C */
146
147 struct {
148 bridgereg_t __pad; /* 0x0001{30,,,68} */
149 bridgereg_t addr; /* 0x0001{34,,,6C} */
150 } b_int_addr[8]; /* 0x000130 */
151
152 bridgereg_t _pad_000170[36];
153
154 /* Device 0x000200-0x0003FF */
155 struct {
156 bridgereg_t __pad; /* 0x0002{00,,,38} */
157 bridgereg_t reg; /* 0x0002{04,,,3C} */
158 } b_device[8]; /* 0x000200 */
159
160 struct {
161 bridgereg_t __pad; /* 0x0002{40,,,78} */
162 bridgereg_t reg; /* 0x0002{44,,,7C} */
163 } b_wr_req_buf[8]; /* 0x000240 */
164
165 struct {
166 bridgereg_t __pad; /* 0x0002{80,,,88} */
167 bridgereg_t reg; /* 0x0002{84,,,8C} */
168 } b_rrb_map[2]; /* 0x000280 */
169#define b_even_resp b_rrb_map[0].reg /* 0x000284 */
170#define b_odd_resp b_rrb_map[1].reg /* 0x00028C */
171
172 bridgereg_t _pad_000290;
173 bridgereg_t b_resp_status; /* 0x000294 */
174 bridgereg_t _pad_000298;
175 bridgereg_t b_resp_clear; /* 0x00029C */
176
177 bridgereg_t _pad_0002A0[24];
178
179 char _pad_000300[0x10000 - 0x000300];
180
181 /* Internal Address Translation Entry RAM 0x010000-0x0103FF */
182 union {
183 bridge_ate_t wr; /* write-only */
184 struct {
185 bridgereg_t _p_pad;
186 bridgereg_t rd; /* read-only */
187 } hi;
188 } b_int_ate_ram[128];
189
190 char _pad_010400[0x11000 - 0x010400];
191
192 /* Internal Address Translation Entry RAM LOW 0x011000-0x0113FF */
193 struct {
194 bridgereg_t _p_pad;
195 bridgereg_t rd; /* read-only */
196 } b_int_ate_ram_lo[128];
197
198 char _pad_011400[0x20000 - 0x011400];
199
200 /* PCI Device Configuration Spaces 0x020000-0x027FFF */
201 union { /* make all access sizes available. */
202 u8 c[0x1000 / 1];
203 u16 s[0x1000 / 2];
204 u32 l[0x1000 / 4];
205 u64 d[0x1000 / 8];
206 union {
207 u8 c[0x100 / 1];
208 u16 s[0x100 / 2];
209 u32 l[0x100 / 4];
210 u64 d[0x100 / 8];
211 } f[8];
212 } b_type0_cfg_dev[8]; /* 0x020000 */
213
214 /* PCI Type 1 Configuration Space 0x028000-0x028FFF */
215 union { /* make all access sizes available. */
216 u8 c[0x1000 / 1];
217 u16 s[0x1000 / 2];
218 u32 l[0x1000 / 4];
219 u64 d[0x1000 / 8];
220 } b_type1_cfg; /* 0x028000-0x029000 */
221
222 char _pad_029000[0x007000]; /* 0x029000-0x030000 */
223
224 /* PCI Interrupt Acknowledge Cycle 0x030000 */
225 union {
226 u8 c[8 / 1];
227 u16 s[8 / 2];
228 u32 l[8 / 4];
229 u64 d[8 / 8];
230 } b_pci_iack; /* 0x030000 */
231
232 u8 _pad_030007[0x04fff8]; /* 0x030008-0x07FFFF */
233
234 /* External Address Translation Entry RAM 0x080000-0x0FFFFF */
235 bridge_ate_t b_ext_ate_ram[0x10000];
236
237 /* Reserved 0x100000-0x1FFFFF */
238 char _pad_100000[0x200000-0x100000];
239
240 /* PCI/GIO Device Spaces 0x200000-0xBFFFFF */
241 union { /* make all access sizes available. */
242 u8 c[0x100000 / 1];
243 u16 s[0x100000 / 2];
244 u32 l[0x100000 / 4];
245 u64 d[0x100000 / 8];
246 } b_devio_raw[10]; /* 0x200000 */
247
248 /* b_devio macro is a bit strange; it reflects the
249 * fact that the Bridge ASIC provides 2M for the
250 * first two DevIO windows and 1M for the other six.
251 */
252#define b_devio(n) b_devio_raw[((n)<2)?(n*2):(n+2)]
253
254 /* External Flash Proms 1,0 0xC00000-0xFFFFFF */
255 union { /* make all access sizes available. */
256 u8 c[0x400000 / 1]; /* read-only */
257 u16 s[0x400000 / 2]; /* read-write */
258 u32 l[0x400000 / 4]; /* read-only */
259 u64 d[0x400000 / 8]; /* read-only */
260 } b_external_flash; /* 0xC00000 */
261} bridge_t;
262
263/*
264 * Field formats for Error Command Word and Auxillary Error Command Word
265 * of bridge.
266 */
267typedef struct bridge_err_cmdword_s {
268 union {
269 u32 cmd_word;
270 struct {
271 u32 didn:4, /* Destination ID */
272 sidn:4, /* Source ID */
273 pactyp:4, /* Packet type */
274 tnum:5, /* Trans Number */
275 coh:1, /* Coh Transacti */
276 ds:2, /* Data size */
277 gbr:1, /* GBR enable */
278 vbpm:1, /* VBPM message */
279 error:1, /* Error occurred */
280 barr:1, /* Barrier op */
281 rsvd:8;
282 } berr_st;
283 } berr_un;
284} bridge_err_cmdword_t;
285
286#define berr_field berr_un.berr_st
287#endif /* !__ASSEMBLY__ */
288
289/*
290 * The values of these macros can and should be crosschecked
291 * regularly against the offsets of the like-named fields
292 * within the "bridge_t" structure above.
293 */
294
295/* Byte offset macros for Bridge internal registers */
296
297#define BRIDGE_WID_ID WIDGET_ID
298#define BRIDGE_WID_STAT WIDGET_STATUS
299#define BRIDGE_WID_ERR_UPPER WIDGET_ERR_UPPER_ADDR
300#define BRIDGE_WID_ERR_LOWER WIDGET_ERR_LOWER_ADDR
301#define BRIDGE_WID_CONTROL WIDGET_CONTROL
302#define BRIDGE_WID_REQ_TIMEOUT WIDGET_REQ_TIMEOUT
303#define BRIDGE_WID_INT_UPPER WIDGET_INTDEST_UPPER_ADDR
304#define BRIDGE_WID_INT_LOWER WIDGET_INTDEST_LOWER_ADDR
305#define BRIDGE_WID_ERR_CMDWORD WIDGET_ERR_CMD_WORD
306#define BRIDGE_WID_LLP WIDGET_LLP_CFG
307#define BRIDGE_WID_TFLUSH WIDGET_TFLUSH
308
309#define BRIDGE_WID_AUX_ERR 0x00005C /* Aux Error Command Word */
310#define BRIDGE_WID_RESP_UPPER 0x000064 /* Response Buf Upper Addr */
311#define BRIDGE_WID_RESP_LOWER 0x00006C /* Response Buf Lower Addr */
312#define BRIDGE_WID_TST_PIN_CTRL 0x000074 /* Test pin control */
313
314#define BRIDGE_DIR_MAP 0x000084 /* Direct Map reg */
315
316#define BRIDGE_RAM_PERR 0x000094 /* SSRAM Parity Error */
317
318#define BRIDGE_ARB 0x0000A4 /* Arbitration Priority reg */
319
320#define BRIDGE_NIC 0x0000B4 /* Number In A Can */
321
322#define BRIDGE_BUS_TIMEOUT 0x0000C4 /* Bus Timeout Register */
323#define BRIDGE_PCI_BUS_TIMEOUT BRIDGE_BUS_TIMEOUT
324#define BRIDGE_PCI_CFG 0x0000CC /* PCI Type 1 Config reg */
325#define BRIDGE_PCI_ERR_UPPER 0x0000D4 /* PCI error Upper Addr */
326#define BRIDGE_PCI_ERR_LOWER 0x0000DC /* PCI error Lower Addr */
327
328#define BRIDGE_INT_STATUS 0x000104 /* Interrupt Status */
329#define BRIDGE_INT_ENABLE 0x00010C /* Interrupt Enables */
330#define BRIDGE_INT_RST_STAT 0x000114 /* Reset Intr Status */
331#define BRIDGE_INT_MODE 0x00011C /* Interrupt Mode */
332#define BRIDGE_INT_DEVICE 0x000124 /* Interrupt Device */
333#define BRIDGE_INT_HOST_ERR 0x00012C /* Host Error Field */
334
335#define BRIDGE_INT_ADDR0 0x000134 /* Host Address Reg */
336#define BRIDGE_INT_ADDR_OFF 0x000008 /* Host Addr offset (1..7) */
337#define BRIDGE_INT_ADDR(x) (BRIDGE_INT_ADDR0+(x)*BRIDGE_INT_ADDR_OFF)
338
339#define BRIDGE_DEVICE0 0x000204 /* Device 0 */
340#define BRIDGE_DEVICE_OFF 0x000008 /* Device offset (1..7) */
341#define BRIDGE_DEVICE(x) (BRIDGE_DEVICE0+(x)*BRIDGE_DEVICE_OFF)
342
343#define BRIDGE_WR_REQ_BUF0 0x000244 /* Write Request Buffer 0 */
344#define BRIDGE_WR_REQ_BUF_OFF 0x000008 /* Buffer Offset (1..7) */
345#define BRIDGE_WR_REQ_BUF(x) (BRIDGE_WR_REQ_BUF0+(x)*BRIDGE_WR_REQ_BUF_OFF)
346
347#define BRIDGE_EVEN_RESP 0x000284 /* Even Device Response Buf */
348#define BRIDGE_ODD_RESP 0x00028C /* Odd Device Response Buf */
349
350#define BRIDGE_RESP_STATUS 0x000294 /* Read Response Status reg */
351#define BRIDGE_RESP_CLEAR 0x00029C /* Read Response Clear reg */
352
353/* Byte offset macros for Bridge I/O space */
354
355#define BRIDGE_ATE_RAM 0x00010000 /* Internal Addr Xlat Ram */
356
357#define BRIDGE_TYPE0_CFG_DEV0 0x00020000 /* Type 0 Cfg, Device 0 */
358#define BRIDGE_TYPE0_CFG_SLOT_OFF 0x00001000 /* Type 0 Cfg Slot Offset (1..7) */
359#define BRIDGE_TYPE0_CFG_FUNC_OFF 0x00000100 /* Type 0 Cfg Func Offset (1..7) */
360#define BRIDGE_TYPE0_CFG_DEV(s) (BRIDGE_TYPE0_CFG_DEV0+\
361 (s)*BRIDGE_TYPE0_CFG_SLOT_OFF)
362#define BRIDGE_TYPE0_CFG_DEVF(s,f) (BRIDGE_TYPE0_CFG_DEV0+\
363 (s)*BRIDGE_TYPE0_CFG_SLOT_OFF+\
364 (f)*BRIDGE_TYPE0_CFG_FUNC_OFF)
365
366#define BRIDGE_TYPE1_CFG 0x00028000 /* Type 1 Cfg space */
367
368#define BRIDGE_PCI_IACK 0x00030000 /* PCI Interrupt Ack */
369#define BRIDGE_EXT_SSRAM 0x00080000 /* Extern SSRAM (ATE) */
370
371/* Byte offset macros for Bridge device IO spaces */
372
373#define BRIDGE_DEV_CNT 8 /* Up to 8 devices per bridge */
374#define BRIDGE_DEVIO0 0x00200000 /* Device IO 0 Addr */
375#define BRIDGE_DEVIO1 0x00400000 /* Device IO 1 Addr */
376#define BRIDGE_DEVIO2 0x00600000 /* Device IO 2 Addr */
377#define BRIDGE_DEVIO_OFF 0x00100000 /* Device IO Offset (3..7) */
378
379#define BRIDGE_DEVIO_2MB 0x00200000 /* Device IO Offset (0..1) */
380#define BRIDGE_DEVIO_1MB 0x00100000 /* Device IO Offset (2..7) */
381
382#define BRIDGE_DEVIO(x) ((x)<=1 ? BRIDGE_DEVIO0+(x)*BRIDGE_DEVIO_2MB : BRIDGE_DEVIO2+((x)-2)*BRIDGE_DEVIO_1MB)
383
384#define BRIDGE_EXTERNAL_FLASH 0x00C00000 /* External Flash PROMS */
385
386/* ========================================================================
387 * Bridge register bit field definitions
388 */
389
390/* Widget part number of bridge */
391#define BRIDGE_WIDGET_PART_NUM 0xc002
392#define XBRIDGE_WIDGET_PART_NUM 0xd002
393
394/* Manufacturer of bridge */
395#define BRIDGE_WIDGET_MFGR_NUM 0x036
396#define XBRIDGE_WIDGET_MFGR_NUM 0x024
397
398/* Revision numbers for known Bridge revisions */
399#define BRIDGE_REV_A 0x1
400#define BRIDGE_REV_B 0x2
401#define BRIDGE_REV_C 0x3
402#define BRIDGE_REV_D 0x4
403
404/* Bridge widget status register bits definition */
405
406#define BRIDGE_STAT_LLP_REC_CNT (0xFFu << 24)
407#define BRIDGE_STAT_LLP_TX_CNT (0xFF << 16)
408#define BRIDGE_STAT_FLASH_SELECT (0x1 << 6)
409#define BRIDGE_STAT_PCI_GIO_N (0x1 << 5)
410#define BRIDGE_STAT_PENDING (0x1F << 0)
411
412/* Bridge widget control register bits definition */
413#define BRIDGE_CTRL_FLASH_WR_EN (0x1ul << 31)
414#define BRIDGE_CTRL_EN_CLK50 (0x1 << 30)
415#define BRIDGE_CTRL_EN_CLK40 (0x1 << 29)
416#define BRIDGE_CTRL_EN_CLK33 (0x1 << 28)
417#define BRIDGE_CTRL_RST(n) ((n) << 24)
418#define BRIDGE_CTRL_RST_MASK (BRIDGE_CTRL_RST(0xF))
419#define BRIDGE_CTRL_RST_PIN(x) (BRIDGE_CTRL_RST(0x1 << (x)))
420#define BRIDGE_CTRL_IO_SWAP (0x1 << 23)
421#define BRIDGE_CTRL_MEM_SWAP (0x1 << 22)
422#define BRIDGE_CTRL_PAGE_SIZE (0x1 << 21)
423#define BRIDGE_CTRL_SS_PAR_BAD (0x1 << 20)
424#define BRIDGE_CTRL_SS_PAR_EN (0x1 << 19)
425#define BRIDGE_CTRL_SSRAM_SIZE(n) ((n) << 17)
426#define BRIDGE_CTRL_SSRAM_SIZE_MASK (BRIDGE_CTRL_SSRAM_SIZE(0x3))
427#define BRIDGE_CTRL_SSRAM_512K (BRIDGE_CTRL_SSRAM_SIZE(0x3))
428#define BRIDGE_CTRL_SSRAM_128K (BRIDGE_CTRL_SSRAM_SIZE(0x2))
429#define BRIDGE_CTRL_SSRAM_64K (BRIDGE_CTRL_SSRAM_SIZE(0x1))
430#define BRIDGE_CTRL_SSRAM_1K (BRIDGE_CTRL_SSRAM_SIZE(0x0))
431#define BRIDGE_CTRL_F_BAD_PKT (0x1 << 16)
432#define BRIDGE_CTRL_LLP_XBAR_CRD(n) ((n) << 12)
433#define BRIDGE_CTRL_LLP_XBAR_CRD_MASK (BRIDGE_CTRL_LLP_XBAR_CRD(0xf))
434#define BRIDGE_CTRL_CLR_RLLP_CNT (0x1 << 11)
435#define BRIDGE_CTRL_CLR_TLLP_CNT (0x1 << 10)
436#define BRIDGE_CTRL_SYS_END (0x1 << 9)
437#define BRIDGE_CTRL_MAX_TRANS(n) ((n) << 4)
438#define BRIDGE_CTRL_MAX_TRANS_MASK (BRIDGE_CTRL_MAX_TRANS(0x1f))
439#define BRIDGE_CTRL_WIDGET_ID(n) ((n) << 0)
440#define BRIDGE_CTRL_WIDGET_ID_MASK (BRIDGE_CTRL_WIDGET_ID(0xf))
441
442/* Bridge Response buffer Error Upper Register bit fields definition */
443#define BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT (20)
444#define BRIDGE_RESP_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT)
445#define BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT (16)
446#define BRIDGE_RESP_ERRUPPR_BUFNUM_MASK (0xF << BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT)
447#define BRIDGE_RESP_ERRRUPPR_BUFMASK (0xFFFF)
448
449#define BRIDGE_RESP_ERRUPPR_BUFNUM(x) \
450 (((x) & BRIDGE_RESP_ERRUPPR_BUFNUM_MASK) >> \
451 BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT)
452
453#define BRIDGE_RESP_ERRUPPR_DEVICE(x) \
454 (((x) & BRIDGE_RESP_ERRUPPR_DEVNUM_MASK) >> \
455 BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT)
456
457/* Bridge direct mapping register bits definition */
458#define BRIDGE_DIRMAP_W_ID_SHFT 20
459#define BRIDGE_DIRMAP_W_ID (0xf << BRIDGE_DIRMAP_W_ID_SHFT)
460#define BRIDGE_DIRMAP_RMF_64 (0x1 << 18)
461#define BRIDGE_DIRMAP_ADD512 (0x1 << 17)
462#define BRIDGE_DIRMAP_OFF (0x1ffff << 0)
463#define BRIDGE_DIRMAP_OFF_ADDRSHFT (31) /* lsbit of DIRMAP_OFF is xtalk address bit 31 */
464
465/* Bridge Arbitration register bits definition */
466#define BRIDGE_ARB_REQ_WAIT_TICK(x) ((x) << 16)
467#define BRIDGE_ARB_REQ_WAIT_TICK_MASK BRIDGE_ARB_REQ_WAIT_TICK(0x3)
468#define BRIDGE_ARB_REQ_WAIT_EN(x) ((x) << 8)
469#define BRIDGE_ARB_REQ_WAIT_EN_MASK BRIDGE_ARB_REQ_WAIT_EN(0xff)
470#define BRIDGE_ARB_FREEZE_GNT (1 << 6)
471#define BRIDGE_ARB_HPRI_RING_B2 (1 << 5)
472#define BRIDGE_ARB_HPRI_RING_B1 (1 << 4)
473#define BRIDGE_ARB_HPRI_RING_B0 (1 << 3)
474#define BRIDGE_ARB_LPRI_RING_B2 (1 << 2)
475#define BRIDGE_ARB_LPRI_RING_B1 (1 << 1)
476#define BRIDGE_ARB_LPRI_RING_B0 (1 << 0)
477
478/* Bridge Bus time-out register bits definition */
479#define BRIDGE_BUS_PCI_RETRY_HLD(x) ((x) << 16)
480#define BRIDGE_BUS_PCI_RETRY_HLD_MASK BRIDGE_BUS_PCI_RETRY_HLD(0x1f)
481#define BRIDGE_BUS_GIO_TIMEOUT (1 << 12)
482#define BRIDGE_BUS_PCI_RETRY_CNT(x) ((x) << 0)
483#define BRIDGE_BUS_PCI_RETRY_MASK BRIDGE_BUS_PCI_RETRY_CNT(0x3ff)
484
485/* Bridge interrupt status register bits definition */
486#define BRIDGE_ISR_MULTI_ERR (0x1u << 31)
487#define BRIDGE_ISR_PMU_ESIZE_FAULT (0x1 << 30)
488#define BRIDGE_ISR_UNEXP_RESP (0x1 << 29)
489#define BRIDGE_ISR_BAD_XRESP_PKT (0x1 << 28)
490#define BRIDGE_ISR_BAD_XREQ_PKT (0x1 << 27)
491#define BRIDGE_ISR_RESP_XTLK_ERR (0x1 << 26)
492#define BRIDGE_ISR_REQ_XTLK_ERR (0x1 << 25)
493#define BRIDGE_ISR_INVLD_ADDR (0x1 << 24)
494#define BRIDGE_ISR_UNSUPPORTED_XOP (0x1 << 23)
495#define BRIDGE_ISR_XREQ_FIFO_OFLOW (0x1 << 22)
496#define BRIDGE_ISR_LLP_REC_SNERR (0x1 << 21)
497#define BRIDGE_ISR_LLP_REC_CBERR (0x1 << 20)
498#define BRIDGE_ISR_LLP_RCTY (0x1 << 19)
499#define BRIDGE_ISR_LLP_TX_RETRY (0x1 << 18)
500#define BRIDGE_ISR_LLP_TCTY (0x1 << 17)
501#define BRIDGE_ISR_SSRAM_PERR (0x1 << 16)
502#define BRIDGE_ISR_PCI_ABORT (0x1 << 15)
503#define BRIDGE_ISR_PCI_PARITY (0x1 << 14)
504#define BRIDGE_ISR_PCI_SERR (0x1 << 13)
505#define BRIDGE_ISR_PCI_PERR (0x1 << 12)
506#define BRIDGE_ISR_PCI_MST_TIMEOUT (0x1 << 11)
507#define BRIDGE_ISR_GIO_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT
508#define BRIDGE_ISR_PCI_RETRY_CNT (0x1 << 10)
509#define BRIDGE_ISR_XREAD_REQ_TIMEOUT (0x1 << 9)
510#define BRIDGE_ISR_GIO_B_ENBL_ERR (0x1 << 8)
511#define BRIDGE_ISR_INT_MSK (0xff << 0)
512#define BRIDGE_ISR_INT(x) (0x1 << (x))
513
514#define BRIDGE_ISR_LINK_ERROR \
515 (BRIDGE_ISR_LLP_REC_SNERR|BRIDGE_ISR_LLP_REC_CBERR| \
516 BRIDGE_ISR_LLP_RCTY|BRIDGE_ISR_LLP_TX_RETRY| \
517 BRIDGE_ISR_LLP_TCTY)
518
519#define BRIDGE_ISR_PCIBUS_PIOERR \
520 (BRIDGE_ISR_PCI_MST_TIMEOUT|BRIDGE_ISR_PCI_ABORT)
521
522#define BRIDGE_ISR_PCIBUS_ERROR \
523 (BRIDGE_ISR_PCIBUS_PIOERR|BRIDGE_ISR_PCI_PERR| \
524 BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_RETRY_CNT| \
525 BRIDGE_ISR_PCI_PARITY)
526
527#define BRIDGE_ISR_XTALK_ERROR \
528 (BRIDGE_ISR_XREAD_REQ_TIMEOUT|BRIDGE_ISR_XREQ_FIFO_OFLOW|\
529 BRIDGE_ISR_UNSUPPORTED_XOP|BRIDGE_ISR_INVLD_ADDR| \
530 BRIDGE_ISR_REQ_XTLK_ERR|BRIDGE_ISR_RESP_XTLK_ERR| \
531 BRIDGE_ISR_BAD_XREQ_PKT|BRIDGE_ISR_BAD_XRESP_PKT| \
532 BRIDGE_ISR_UNEXP_RESP)
533
534#define BRIDGE_ISR_ERRORS \
535 (BRIDGE_ISR_LINK_ERROR|BRIDGE_ISR_PCIBUS_ERROR| \
536 BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR| \
537 BRIDGE_ISR_PMU_ESIZE_FAULT)
538
539/*
540 * List of Errors which are fatal and kill the sytem
541 */
542#define BRIDGE_ISR_ERROR_FATAL \
543 ((BRIDGE_ISR_XTALK_ERROR & ~BRIDGE_ISR_XREAD_REQ_TIMEOUT)|\
544 BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_PARITY )
545
546#define BRIDGE_ISR_ERROR_DUMP \
547 (BRIDGE_ISR_PCIBUS_ERROR|BRIDGE_ISR_PMU_ESIZE_FAULT| \
548 BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR)
549
550/* Bridge interrupt enable register bits definition */
551#define BRIDGE_IMR_UNEXP_RESP BRIDGE_ISR_UNEXP_RESP
552#define BRIDGE_IMR_PMU_ESIZE_FAULT BRIDGE_ISR_PMU_ESIZE_FAULT
553#define BRIDGE_IMR_BAD_XRESP_PKT BRIDGE_ISR_BAD_XRESP_PKT
554#define BRIDGE_IMR_BAD_XREQ_PKT BRIDGE_ISR_BAD_XREQ_PKT
555#define BRIDGE_IMR_RESP_XTLK_ERR BRIDGE_ISR_RESP_XTLK_ERR
556#define BRIDGE_IMR_REQ_XTLK_ERR BRIDGE_ISR_REQ_XTLK_ERR
557#define BRIDGE_IMR_INVLD_ADDR BRIDGE_ISR_INVLD_ADDR
558#define BRIDGE_IMR_UNSUPPORTED_XOP BRIDGE_ISR_UNSUPPORTED_XOP
559#define BRIDGE_IMR_XREQ_FIFO_OFLOW BRIDGE_ISR_XREQ_FIFO_OFLOW
560#define BRIDGE_IMR_LLP_REC_SNERR BRIDGE_ISR_LLP_REC_SNERR
561#define BRIDGE_IMR_LLP_REC_CBERR BRIDGE_ISR_LLP_REC_CBERR
562#define BRIDGE_IMR_LLP_RCTY BRIDGE_ISR_LLP_RCTY
563#define BRIDGE_IMR_LLP_TX_RETRY BRIDGE_ISR_LLP_TX_RETRY
564#define BRIDGE_IMR_LLP_TCTY BRIDGE_ISR_LLP_TCTY
565#define BRIDGE_IMR_SSRAM_PERR BRIDGE_ISR_SSRAM_PERR
566#define BRIDGE_IMR_PCI_ABORT BRIDGE_ISR_PCI_ABORT
567#define BRIDGE_IMR_PCI_PARITY BRIDGE_ISR_PCI_PARITY
568#define BRIDGE_IMR_PCI_SERR BRIDGE_ISR_PCI_SERR
569#define BRIDGE_IMR_PCI_PERR BRIDGE_ISR_PCI_PERR
570#define BRIDGE_IMR_PCI_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT
571#define BRIDGE_IMR_GIO_MST_TIMEOUT BRIDGE_ISR_GIO_MST_TIMEOUT
572#define BRIDGE_IMR_PCI_RETRY_CNT BRIDGE_ISR_PCI_RETRY_CNT
573#define BRIDGE_IMR_XREAD_REQ_TIMEOUT BRIDGE_ISR_XREAD_REQ_TIMEOUT
574#define BRIDGE_IMR_GIO_B_ENBL_ERR BRIDGE_ISR_GIO_B_ENBL_ERR
575#define BRIDGE_IMR_INT_MSK BRIDGE_ISR_INT_MSK
576#define BRIDGE_IMR_INT(x) BRIDGE_ISR_INT(x)
577
578/* Bridge interrupt reset register bits definition */
579#define BRIDGE_IRR_MULTI_CLR (0x1 << 6)
580#define BRIDGE_IRR_CRP_GRP_CLR (0x1 << 5)
581#define BRIDGE_IRR_RESP_BUF_GRP_CLR (0x1 << 4)
582#define BRIDGE_IRR_REQ_DSP_GRP_CLR (0x1 << 3)
583#define BRIDGE_IRR_LLP_GRP_CLR (0x1 << 2)
584#define BRIDGE_IRR_SSRAM_GRP_CLR (0x1 << 1)
585#define BRIDGE_IRR_PCI_GRP_CLR (0x1 << 0)
586#define BRIDGE_IRR_GIO_GRP_CLR (0x1 << 0)
587#define BRIDGE_IRR_ALL_CLR 0x7f
588
589#define BRIDGE_IRR_CRP_GRP (BRIDGE_ISR_UNEXP_RESP | \
590 BRIDGE_ISR_XREQ_FIFO_OFLOW)
591#define BRIDGE_IRR_RESP_BUF_GRP (BRIDGE_ISR_BAD_XRESP_PKT | \
592 BRIDGE_ISR_RESP_XTLK_ERR | \
593 BRIDGE_ISR_XREAD_REQ_TIMEOUT)
594#define BRIDGE_IRR_REQ_DSP_GRP (BRIDGE_ISR_UNSUPPORTED_XOP | \
595 BRIDGE_ISR_BAD_XREQ_PKT | \
596 BRIDGE_ISR_REQ_XTLK_ERR | \
597 BRIDGE_ISR_INVLD_ADDR)
598#define BRIDGE_IRR_LLP_GRP (BRIDGE_ISR_LLP_REC_SNERR | \
599 BRIDGE_ISR_LLP_REC_CBERR | \
600 BRIDGE_ISR_LLP_RCTY | \
601 BRIDGE_ISR_LLP_TX_RETRY | \
602 BRIDGE_ISR_LLP_TCTY)
603#define BRIDGE_IRR_SSRAM_GRP (BRIDGE_ISR_SSRAM_PERR | \
604 BRIDGE_ISR_PMU_ESIZE_FAULT)
605#define BRIDGE_IRR_PCI_GRP (BRIDGE_ISR_PCI_ABORT | \
606 BRIDGE_ISR_PCI_PARITY | \
607 BRIDGE_ISR_PCI_SERR | \
608 BRIDGE_ISR_PCI_PERR | \
609 BRIDGE_ISR_PCI_MST_TIMEOUT | \
610 BRIDGE_ISR_PCI_RETRY_CNT)
611
612#define BRIDGE_IRR_GIO_GRP (BRIDGE_ISR_GIO_B_ENBL_ERR | \
613 BRIDGE_ISR_GIO_MST_TIMEOUT)
614
615/* Bridge INT_DEV register bits definition */
616#define BRIDGE_INT_DEV_SHFT(n) ((n)*3)
617#define BRIDGE_INT_DEV_MASK(n) (0x7 << BRIDGE_INT_DEV_SHFT(n))
618#define BRIDGE_INT_DEV_SET(_dev, _line) (_dev << BRIDGE_INT_DEV_SHFT(_line))
619
620/* Bridge interrupt(x) register bits definition */
621#define BRIDGE_INT_ADDR_HOST 0x0003FF00
622#define BRIDGE_INT_ADDR_FLD 0x000000FF
623
624#define BRIDGE_TMO_PCI_RETRY_HLD_MASK 0x1f0000
625#define BRIDGE_TMO_GIO_TIMEOUT_MASK 0x001000
626#define BRIDGE_TMO_PCI_RETRY_CNT_MASK 0x0003ff
627
628#define BRIDGE_TMO_PCI_RETRY_CNT_MAX 0x3ff
629
630/*
631 * The NASID should be shifted by this amount and stored into the
632 * interrupt(x) register.
633 */
634#define BRIDGE_INT_ADDR_NASID_SHFT 8
635
636/*
637 * The BRIDGE_INT_ADDR_DEST_IO bit should be set to send an interrupt to
638 * memory.
639 */
640#define BRIDGE_INT_ADDR_DEST_IO (1 << 17)
641#define BRIDGE_INT_ADDR_DEST_MEM 0
642#define BRIDGE_INT_ADDR_MASK (1 << 17)
643
644/* Bridge device(x) register bits definition */
645#define BRIDGE_DEV_ERR_LOCK_EN 0x10000000
646#define BRIDGE_DEV_PAGE_CHK_DIS 0x08000000
647#define BRIDGE_DEV_FORCE_PCI_PAR 0x04000000
648#define BRIDGE_DEV_VIRTUAL_EN 0x02000000
649#define BRIDGE_DEV_PMU_WRGA_EN 0x01000000
650#define BRIDGE_DEV_DIR_WRGA_EN 0x00800000
651#define BRIDGE_DEV_DEV_SIZE 0x00400000
652#define BRIDGE_DEV_RT 0x00200000
653#define BRIDGE_DEV_SWAP_PMU 0x00100000
654#define BRIDGE_DEV_SWAP_DIR 0x00080000
655#define BRIDGE_DEV_PREF 0x00040000
656#define BRIDGE_DEV_PRECISE 0x00020000
657#define BRIDGE_DEV_COH 0x00010000
658#define BRIDGE_DEV_BARRIER 0x00008000
659#define BRIDGE_DEV_GBR 0x00004000
660#define BRIDGE_DEV_DEV_SWAP 0x00002000
661#define BRIDGE_DEV_DEV_IO_MEM 0x00001000
662#define BRIDGE_DEV_OFF_MASK 0x00000fff
663#define BRIDGE_DEV_OFF_ADDR_SHFT 20
664
665#define BRIDGE_DEV_PMU_BITS (BRIDGE_DEV_PMU_WRGA_EN | \
666 BRIDGE_DEV_SWAP_PMU)
667#define BRIDGE_DEV_D32_BITS (BRIDGE_DEV_DIR_WRGA_EN | \
668 BRIDGE_DEV_SWAP_DIR | \
669 BRIDGE_DEV_PREF | \
670 BRIDGE_DEV_PRECISE | \
671 BRIDGE_DEV_COH | \
672 BRIDGE_DEV_BARRIER)
673#define BRIDGE_DEV_D64_BITS (BRIDGE_DEV_DIR_WRGA_EN | \
674 BRIDGE_DEV_SWAP_DIR | \
675 BRIDGE_DEV_COH | \
676 BRIDGE_DEV_BARRIER)
677
678/* Bridge Error Upper register bit field definition */
679#define BRIDGE_ERRUPPR_DEVMASTER (0x1 << 20) /* Device was master */
680#define BRIDGE_ERRUPPR_PCIVDEV (0x1 << 19) /* Virtual Req value */
681#define BRIDGE_ERRUPPR_DEVNUM_SHFT (16)
682#define BRIDGE_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_ERRUPPR_DEVNUM_SHFT)
683#define BRIDGE_ERRUPPR_DEVICE(err) (((err) >> BRIDGE_ERRUPPR_DEVNUM_SHFT) & 0x7)
684#define BRIDGE_ERRUPPR_ADDRMASK (0xFFFF)
685
686/* Bridge interrupt mode register bits definition */
687#define BRIDGE_INTMODE_CLR_PKT_EN(x) (0x1 << (x))
688
689/* this should be written to the xbow's link_control(x) register */
690#define BRIDGE_CREDIT 3
691
692/* RRB assignment register */
693#define BRIDGE_RRB_EN 0x8 /* after shifting down */
694#define BRIDGE_RRB_DEV 0x7 /* after shifting down */
695#define BRIDGE_RRB_VDEV 0x4 /* after shifting down */
696#define BRIDGE_RRB_PDEV 0x3 /* after shifting down */
697
698/* RRB status register */
699#define BRIDGE_RRB_VALID(r) (0x00010000<<(r))
700#define BRIDGE_RRB_INUSE(r) (0x00000001<<(r))
701
702/* RRB clear register */
703#define BRIDGE_RRB_CLEAR(r) (0x00000001<<(r))
704
705/* xbox system controller declarations */
706#define XBOX_BRIDGE_WID 8
707#define FLASH_PROM1_BASE 0xE00000 /* To read the xbox sysctlr status */
708#define XBOX_RPS_EXISTS 1 << 6 /* RPS bit in status register */
709#define XBOX_RPS_FAIL 1 << 4 /* RPS status bit in register */
710
711/* ========================================================================
712 */
713/*
714 * Macros for Xtalk to Bridge bus (PCI/GIO) PIO
715 * refer to section 4.2.1 of Bridge Spec for xtalk to PCI/GIO PIO mappings
716 */
717/* XTALK addresses that map into Bridge Bus addr space */
718#define BRIDGE_PIO32_XTALK_ALIAS_BASE 0x000040000000L
719#define BRIDGE_PIO32_XTALK_ALIAS_LIMIT 0x00007FFFFFFFL
720#define BRIDGE_PIO64_XTALK_ALIAS_BASE 0x000080000000L
721#define BRIDGE_PIO64_XTALK_ALIAS_LIMIT 0x0000BFFFFFFFL
722#define BRIDGE_PCIIO_XTALK_ALIAS_BASE 0x000100000000L
723#define BRIDGE_PCIIO_XTALK_ALIAS_LIMIT 0x0001FFFFFFFFL
724
725/* Ranges of PCI bus space that can be accessed via PIO from xtalk */
726#define BRIDGE_MIN_PIO_ADDR_MEM 0x00000000 /* 1G PCI memory space */
727#define BRIDGE_MAX_PIO_ADDR_MEM 0x3fffffff
728#define BRIDGE_MIN_PIO_ADDR_IO 0x00000000 /* 4G PCI IO space */
729#define BRIDGE_MAX_PIO_ADDR_IO 0xffffffff
730
731/* XTALK addresses that map into PCI addresses */
732#define BRIDGE_PCI_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE
733#define BRIDGE_PCI_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT
734#define BRIDGE_PCI_MEM64_BASE BRIDGE_PIO64_XTALK_ALIAS_BASE
735#define BRIDGE_PCI_MEM64_LIMIT BRIDGE_PIO64_XTALK_ALIAS_LIMIT
736#define BRIDGE_PCI_IO_BASE BRIDGE_PCIIO_XTALK_ALIAS_BASE
737#define BRIDGE_PCI_IO_LIMIT BRIDGE_PCIIO_XTALK_ALIAS_LIMIT
738
739/*
740 * Macros for Bridge bus (PCI/GIO) to Xtalk DMA
741 */
742/* Bridge Bus DMA addresses */
743#define BRIDGE_LOCAL_BASE 0
744#define BRIDGE_DMA_MAPPED_BASE 0x40000000
745#define BRIDGE_DMA_MAPPED_SIZE 0x40000000 /* 1G Bytes */
746#define BRIDGE_DMA_DIRECT_BASE 0x80000000
747#define BRIDGE_DMA_DIRECT_SIZE 0x80000000 /* 2G Bytes */
748
749#define PCI32_LOCAL_BASE BRIDGE_LOCAL_BASE
750
751/* PCI addresses of regions decoded by Bridge for DMA */
752#define PCI32_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE
753#define PCI32_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE
754
755#define IS_PCI32_LOCAL(x) ((ulong_t)(x) < PCI32_MAPPED_BASE)
756#define IS_PCI32_MAPPED(x) ((ulong_t)(x) < PCI32_DIRECT_BASE && \
757 (ulong_t)(x) >= PCI32_MAPPED_BASE)
758#define IS_PCI32_DIRECT(x) ((ulong_t)(x) >= PCI32_MAPPED_BASE)
759#define IS_PCI64(x) ((ulong_t)(x) >= PCI64_BASE)
760
761/*
762 * The GIO address space.
763 */
764/* Xtalk to GIO PIO */
765#define BRIDGE_GIO_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE
766#define BRIDGE_GIO_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT
767
768#define GIO_LOCAL_BASE BRIDGE_LOCAL_BASE
769
770/* GIO addresses of regions decoded by Bridge for DMA */
771#define GIO_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE
772#define GIO_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE
773
774#define IS_GIO_LOCAL(x) ((ulong_t)(x) < GIO_MAPPED_BASE)
775#define IS_GIO_MAPPED(x) ((ulong_t)(x) < GIO_DIRECT_BASE && \
776 (ulong_t)(x) >= GIO_MAPPED_BASE)
777#define IS_GIO_DIRECT(x) ((ulong_t)(x) >= GIO_MAPPED_BASE)
778
779/* PCI to xtalk mapping */
780
781/* given a DIR_OFF value and a pci/gio 32 bits direct address, determine
782 * which xtalk address is accessed
783 */
784#define BRIDGE_DIRECT_32_SEG_SIZE BRIDGE_DMA_DIRECT_SIZE
785#define BRIDGE_DIRECT_32_TO_XTALK(dir_off,adr) \
786 ((dir_off) * BRIDGE_DIRECT_32_SEG_SIZE + \
787 ((adr) & (BRIDGE_DIRECT_32_SEG_SIZE - 1)) + PHYS_RAMBASE)
788
789/* 64-bit address attribute masks */
790#define PCI64_ATTR_TARG_MASK 0xf000000000000000
791#define PCI64_ATTR_TARG_SHFT 60
792#define PCI64_ATTR_PREF 0x0800000000000000
793#define PCI64_ATTR_PREC 0x0400000000000000
794#define PCI64_ATTR_VIRTUAL 0x0200000000000000
795#define PCI64_ATTR_BAR 0x0100000000000000
796#define PCI64_ATTR_RMF_MASK 0x00ff000000000000
797#define PCI64_ATTR_RMF_SHFT 48
798
799#ifndef __ASSEMBLY__
800/* Address translation entry for mapped pci32 accesses */
801typedef union ate_u {
802 u64 ent;
803 struct ate_s {
804 u64 rmf:16;
805 u64 addr:36;
806 u64 targ:4;
807 u64 reserved:3;
808 u64 barrier:1;
809 u64 prefetch:1;
810 u64 precise:1;
811 u64 coherent:1;
812 u64 valid:1;
813 } field;
814} ate_t;
815#endif /* !__ASSEMBLY__ */
816
817#define ATE_V 0x01
818#define ATE_CO 0x02
819#define ATE_PREC 0x04
820#define ATE_PREF 0x08
821#define ATE_BAR 0x10
822
823#define ATE_PFNSHIFT 12
824#define ATE_TIDSHIFT 8
825#define ATE_RMFSHIFT 48
826
827#define mkate(xaddr, xid, attr) ((xaddr) & 0x0000fffffffff000ULL) | \
828 ((xid)<<ATE_TIDSHIFT) | \
829 (attr)
830
831#define BRIDGE_INTERNAL_ATES 128
832
833struct bridge_controller {
834 struct pci_controller pc;
835 struct resource mem;
836 struct resource io;
837 bridge_t *base;
838 nasid_t nasid;
839 unsigned int widget_id;
840 unsigned int irq_cpu;
841 dma64_addr_t baddr;
842 unsigned int pci_int[8];
843};
844
845#define BRIDGE_CONTROLLER(bus) \
846 ((struct bridge_controller *)((bus)->sysdata))
847
848extern void register_bridge_irq(unsigned int irq);
849extern int request_bridge_irq(struct bridge_controller *bc);
850
851#endif /* _ASM_PCI_BRIDGE_H */
diff --git a/include/asm-mips/percpu.h b/include/asm-mips/percpu.h
new file mode 100644
index 000000000000..844e763e9332
--- /dev/null
+++ b/include/asm-mips/percpu.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_PERCPU_H
2#define __ASM_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ASM_PERCPU_H */
diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h
new file mode 100644
index 000000000000..2d63f5ba403f
--- /dev/null
+++ b/include/asm-mips/pgalloc.h
@@ -0,0 +1,125 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 2001, 2003 by Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PGALLOC_H
10#define _ASM_PGALLOC_H
11
12#include <linux/config.h>
13#include <linux/highmem.h>
14#include <linux/mm.h>
15
16static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
17 pte_t *pte)
18{
19 set_pmd(pmd, __pmd((unsigned long)pte));
20}
21
22static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
23 struct page *pte)
24{
25 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
26}
27
28/*
29 * Initialize a new pgd / pmd table with invalid pointers.
30 */
31extern void pgd_init(unsigned long page);
32extern void pmd_init(unsigned long page, unsigned long pagetable);
33
34static inline pgd_t *pgd_alloc(struct mm_struct *mm)
35{
36 pgd_t *ret, *init;
37
38 ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER);
39 if (ret) {
40 init = pgd_offset(&init_mm, 0);
41 pgd_init((unsigned long)ret);
42 memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
43 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
44 }
45
46 return ret;
47}
48
49static inline void pgd_free(pgd_t *pgd)
50{
51 free_pages((unsigned long)pgd, PGD_ORDER);
52}
53
54static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
55 unsigned long address)
56{
57 pte_t *pte;
58
59 pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, PTE_ORDER);
60
61 return pte;
62}
63
64static inline struct page *pte_alloc_one(struct mm_struct *mm,
65 unsigned long address)
66{
67 struct page *pte;
68
69 pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER);
70 if (pte)
71 clear_highpage(pte);
72
73 return pte;
74}
75
76static inline void pte_free_kernel(pte_t *pte)
77{
78 free_pages((unsigned long)pte, PTE_ORDER);
79}
80
81static inline void pte_free(struct page *pte)
82{
83 __free_pages(pte, PTE_ORDER);
84}
85
86#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
87
88#ifdef CONFIG_MIPS32
89#define pgd_populate(mm, pmd, pte) BUG()
90
91/*
92 * allocating and freeing a pmd is trivial: the 1-entry pmd is
93 * inside the pgd, so has no extra memory associated with it.
94 */
95#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
96#define pmd_free(x) do { } while (0)
97#define __pmd_free_tlb(tlb,x) do { } while (0)
98#endif
99
100#ifdef CONFIG_MIPS64
101
102#define pgd_populate(mm, pgd, pmd) set_pgd(pgd, __pgd(pmd))
103
104static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
105{
106 pmd_t *pmd;
107
108 pmd = (pmd_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT, PMD_ORDER);
109 if (pmd)
110 pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
111 return pmd;
112}
113
114static inline void pmd_free(pmd_t *pmd)
115{
116 free_pages((unsigned long)pmd, PMD_ORDER);
117}
118
119#define __pmd_free_tlb(tlb,x) pmd_free(x)
120
121#endif
122
123#define check_pgt_cache() do { } while (0)
124
125#endif /* _ASM_PGALLOC_H */
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
new file mode 100644
index 000000000000..41a0df7d7768
--- /dev/null
+++ b/include/asm-mips/pgtable-32.h
@@ -0,0 +1,243 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PGTABLE_32_H
10#define _ASM_PGTABLE_32_H
11
12#include <linux/config.h>
13#include <asm/addrspace.h>
14#include <asm/page.h>
15
16#include <linux/linkage.h>
17#include <asm/cachectl.h>
18#include <asm/fixmap.h>
19
20/*
21 * - add_wired_entry() add a fixed TLB entry, and move wired register
22 */
23extern void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
24 unsigned long entryhi, unsigned long pagemask);
25
26/*
27 * - add_temporary_entry() add a temporary TLB entry. We use TLB entries
28 * starting at the top and working down. This is for populating the
29 * TLB before trap_init() puts the TLB miss handler in place. It
30 * should be used only for entries matching the actual page tables,
31 * to prevent inconsistencies.
32 */
33extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
34 unsigned long entryhi, unsigned long pagemask);
35
36
37/* Basically we have the same two-level (which is the logical three level
38 * Linux page table layout folded) page tables as the i386. Some day
39 * when we have proper page coloring support we can have a 1% quicker
40 * tlb refill handling mechanism, but for now it is a bit slower but
41 * works even with the cache aliasing problem the R4k and above have.
42 */
43
44/* PMD_SHIFT determines the size of the area a second-level page table can map */
45#ifdef CONFIG_64BIT_PHYS_ADDR
46#define PMD_SHIFT 21
47#else
48#define PMD_SHIFT 22
49#endif
50#define PMD_SIZE (1UL << PMD_SHIFT)
51#define PMD_MASK (~(PMD_SIZE-1))
52
53/* PGDIR_SHIFT determines what a third-level page table entry can map */
54#define PGDIR_SHIFT PMD_SHIFT
55#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
56#define PGDIR_MASK (~(PGDIR_SIZE-1))
57
58/*
59 * Entries per page directory level: we use two-level, so
60 * we don't really have any PMD directory physically.
61 */
62#ifdef CONFIG_64BIT_PHYS_ADDR
63#define PGD_ORDER 1
64#define PMD_ORDER 0
65#define PTE_ORDER 0
66#else
67#define PGD_ORDER 0
68#define PMD_ORDER 0
69#define PTE_ORDER 0
70#endif
71
72#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
73#define PTRS_PER_PMD 1
74#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
75
76#define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE)
77#define FIRST_USER_PGD_NR 0
78
79#define VMALLOC_START KSEG2
80
81#ifdef CONFIG_HIGHMEM
82# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
83#else
84# define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
85#endif
86
87#ifdef CONFIG_64BIT_PHYS_ADDR
88#define pte_ERROR(e) \
89 printk("%s:%d: bad pte %016Lx.\n", __FILE__, __LINE__, pte_val(e))
90#else
91#define pte_ERROR(e) \
92 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
93#endif
94#define pmd_ERROR(e) \
95 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
96#define pgd_ERROR(e) \
97 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
98
99extern void load_pgd(unsigned long pg_dir);
100
101extern pte_t invalid_pte_table[PAGE_SIZE/sizeof(pte_t)];
102
103/*
104 * Empty pgd/pmd entries point to the invalid_pte_table.
105 */
106static inline int pmd_none(pmd_t pmd)
107{
108 return pmd_val(pmd) == (unsigned long) invalid_pte_table;
109}
110
111#define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK)
112
113static inline int pmd_present(pmd_t pmd)
114{
115 return pmd_val(pmd) != (unsigned long) invalid_pte_table;
116}
117
118static inline void pmd_clear(pmd_t *pmdp)
119{
120 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
121}
122
123/*
124 * The "pgd_xxx()" functions here are trivial for a folded two-level
125 * setup: the pgd is never bad, and a pmd always exists (as it's folded
126 * into the pgd entry)
127 */
128static inline int pgd_none(pgd_t pgd) { return 0; }
129static inline int pgd_bad(pgd_t pgd) { return 0; }
130static inline int pgd_present(pgd_t pgd) { return 1; }
131static inline void pgd_clear(pgd_t *pgdp) { }
132
133#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
134#define pte_page(x) pfn_to_page(pte_pfn(x))
135#define pte_pfn(x) ((unsigned long)((x).pte_high >> 6))
136static inline pte_t
137pfn_pte(unsigned long pfn, pgprot_t prot)
138{
139 pte_t pte;
140 pte.pte_high = (pfn << 6) | (pgprot_val(prot) & 0x3f);
141 pte.pte_low = pgprot_val(prot);
142 return pte;
143}
144
145#else
146
147#define pte_page(x) pfn_to_page(pte_pfn(x))
148
149#ifdef CONFIG_CPU_VR41XX
150#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
151#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
152#else
153#define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT))
154#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
155#endif
156#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */
157
158#define __pgd_offset(address) pgd_index(address)
159#define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
160
161/* to find an entry in a kernel page-table-directory */
162#define pgd_offset_k(address) pgd_offset(&init_mm, address)
163
164#define pgd_index(address) ((address) >> PGDIR_SHIFT)
165
166/* to find an entry in a page-table-directory */
167#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr))
168
169/* Find an entry in the second-level page table.. */
170static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address)
171{
172 return (pmd_t *) dir;
173}
174
175/* Find an entry in the third-level page table.. */
176#define __pte_offset(address) \
177 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
178#define pte_offset(dir, address) \
179 ((pte_t *) (pmd_page_kernel(*dir)) + __pte_offset(address))
180#define pte_offset_kernel(dir, address) \
181 ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address))
182
183#define pte_offset_map(dir, address) \
184 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
185#define pte_offset_map_nested(dir, address) \
186 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
187#define pte_unmap(pte) ((void)(pte))
188#define pte_unmap_nested(pte) ((void)(pte))
189
190#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
191
192/* Swap entries must have VALID bit cleared. */
193#define __swp_type(x) (((x).val >> 10) & 0x1f)
194#define __swp_offset(x) ((x).val >> 15)
195#define __swp_entry(type,offset) \
196 ((swp_entry_t) { ((type) << 10) | ((offset) << 15) })
197
198/*
199 * Bits 0, 1, 2, 9 and 10 are taken, split up the 27 bits of offset
200 * into this range:
201 */
202#define PTE_FILE_MAX_BITS 27
203
204#define pte_to_pgoff(_pte) \
205 ((((_pte).pte >> 3) & 0x3f ) + (((_pte).pte >> 11) << 8 ))
206
207#define pgoff_to_pte(off) \
208 ((pte_t) { (((off) & 0x3f) << 3) + (((off) >> 8) << 11) + _PAGE_FILE })
209
210#else
211
212/* Swap entries must have VALID and GLOBAL bits cleared. */
213#define __swp_type(x) (((x).val >> 8) & 0x1f)
214#define __swp_offset(x) ((x).val >> 13)
215#define __swp_entry(type,offset) \
216 ((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
217
218/*
219 * Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset
220 * into this range:
221 */
222#define PTE_FILE_MAX_BITS 27
223
224#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
225 /* fixme */
226#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f))
227#define pgoff_to_pte(off) \
228 ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)})
229
230#else
231#define pte_to_pgoff(_pte) \
232 ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 ))
233
234#define pgoff_to_pte(off) \
235 ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE })
236#endif
237
238#endif
239
240#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
241#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
242
243#endif /* _ASM_PGTABLE_32_H */
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
new file mode 100644
index 000000000000..704b551f59e9
--- /dev/null
+++ b/include/asm-mips/pgtable-64.h
@@ -0,0 +1,227 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PGTABLE_64_H
10#define _ASM_PGTABLE_64_H
11
12#include <linux/config.h>
13#include <linux/linkage.h>
14
15#include <asm/addrspace.h>
16#include <asm/page.h>
17#include <asm/cachectl.h>
18
19/*
20 * Each address space has 2 4K pages as its page directory, giving 1024
21 * (== PTRS_PER_PGD) 8 byte pointers to pmd tables. Each pmd table is a
22 * pair of 4K pages, giving 1024 (== PTRS_PER_PMD) 8 byte pointers to
23 * page tables. Each page table is a single 4K page, giving 512 (==
24 * PTRS_PER_PTE) 8 byte ptes. Each pgde is initialized to point to
25 * invalid_pmd_table, each pmde is initialized to point to
26 * invalid_pte_table, each pte is initialized to 0. When memory is low,
27 * and a pmd table or a page table allocation fails, empty_bad_pmd_table
28 * and empty_bad_page_table is returned back to higher layer code, so
29 * that the failure is recognized later on. Linux does not seem to
30 * handle these failures very well though. The empty_bad_page_table has
31 * invalid pte entries in it, to force page faults.
32 *
33 * Kernel mappings: kernel mappings are held in the swapper_pg_table.
34 * The layout is identical to userspace except it's indexed with the
35 * fault address - VMALLOC_START.
36 */
37
38/* PMD_SHIFT determines the size of the area a second-level page table can map */
39#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT - 3))
40#define PMD_SIZE (1UL << PMD_SHIFT)
41#define PMD_MASK (~(PMD_SIZE-1))
42
43/* PGDIR_SHIFT determines what a third-level page table entry can map */
44#define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + 1 - 3))
45#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
46#define PGDIR_MASK (~(PGDIR_SIZE-1))
47
48/*
49 * For 4kB page size we use a 3 level page tree and a 8kB pmd and pgds which
50 * permits us mapping 40 bits of virtual address space.
51 *
52 * We used to implement 41 bits by having an order 1 pmd level but that seemed
53 * rather pointless.
54 *
55 * For 8kB page size we use a 3 level page tree which permits a total of
56 * 8TB of address space. Alternatively a 33-bit / 8GB organization using
57 * two levels would be easy to implement.
58 *
59 * For 16kB page size we use a 2 level page tree which permits a total of
60 * 36 bits of virtual address space. We could add a third leve. but it seems
61 * like at the moment there's no need for this.
62 *
63 * For 64kB page size we use a 2 level page table tree for a total of 42 bits
64 * of virtual address space.
65 */
66#ifdef CONFIG_PAGE_SIZE_4KB
67#define PGD_ORDER 1
68#define PMD_ORDER 0
69#define PTE_ORDER 0
70#endif
71#ifdef CONFIG_PAGE_SIZE_8KB
72#define PGD_ORDER 0
73#define PMD_ORDER 0
74#define PTE_ORDER 0
75#endif
76#ifdef CONFIG_PAGE_SIZE_16KB
77#define PGD_ORDER 0
78#define PMD_ORDER 0
79#define PTE_ORDER 0
80#endif
81#ifdef CONFIG_PAGE_SIZE_64KB
82#define PGD_ORDER 0
83#define PMD_ORDER 0
84#define PTE_ORDER 0
85#endif
86
87#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
88#define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t))
89#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
90
91#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
92#define FIRST_USER_PGD_NR 0
93
94#define VMALLOC_START XKSEG
95#define VMALLOC_END \
96 (VMALLOC_START + PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE)
97
98#define pte_ERROR(e) \
99 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
100#define pmd_ERROR(e) \
101 printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
102#define pgd_ERROR(e) \
103 printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
104
105extern pte_t invalid_pte_table[PAGE_SIZE/sizeof(pte_t)];
106extern pte_t empty_bad_page_table[PAGE_SIZE/sizeof(pte_t)];
107extern pmd_t invalid_pmd_table[2*PAGE_SIZE/sizeof(pmd_t)];
108extern pmd_t empty_bad_pmd_table[2*PAGE_SIZE/sizeof(pmd_t)];
109
110/*
111 * Empty pmd entries point to the invalid_pte_table.
112 */
113static inline int pmd_none(pmd_t pmd)
114{
115 return pmd_val(pmd) == (unsigned long) invalid_pte_table;
116}
117
118#define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK)
119
120static inline int pmd_present(pmd_t pmd)
121{
122 return pmd_val(pmd) != (unsigned long) invalid_pte_table;
123}
124
125static inline void pmd_clear(pmd_t *pmdp)
126{
127 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
128}
129
130/*
131 * Empty pgd entries point to the invalid_pmd_table.
132 */
133static inline int pgd_none(pgd_t pgd)
134{
135 return pgd_val(pgd) == (unsigned long) invalid_pmd_table;
136}
137
138#define pgd_bad(pgd) (pgd_val(pgd) &~ PAGE_MASK)
139
140static inline int pgd_present(pgd_t pgd)
141{
142 return pgd_val(pgd) != (unsigned long) invalid_pmd_table;
143}
144
145static inline void pgd_clear(pgd_t *pgdp)
146{
147 pgd_val(*pgdp) = ((unsigned long) invalid_pmd_table);
148}
149
150#define pte_page(x) pfn_to_page((unsigned long)((pte_val(x) >> PAGE_SHIFT)))
151#ifdef CONFIG_CPU_VR41XX
152#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
153#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
154#else
155#define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT))
156#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
157#endif
158
159#define __pgd_offset(address) pgd_index(address)
160#define page_pte(page) page_pte_prot(page, __pgprot(0))
161
162/* to find an entry in a kernel page-table-directory */
163#define pgd_offset_k(address) pgd_offset(&init_mm, 0)
164
165#define pgd_index(address) ((address) >> PGDIR_SHIFT)
166
167/* to find an entry in a page-table-directory */
168#define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr))
169
170static inline unsigned long pgd_page(pgd_t pgd)
171{
172 return pgd_val(pgd);
173}
174
175/* Find an entry in the second-level page table.. */
176static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address)
177{
178 return (pmd_t *) pgd_page(*dir) +
179 ((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1));
180}
181
182/* Find an entry in the third-level page table.. */
183#define __pte_offset(address) \
184 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
185#define pte_offset(dir, address) \
186 ((pte_t *) (pmd_page_kernel(*dir)) + __pte_offset(address))
187#define pte_offset_kernel(dir, address) \
188 ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address))
189#define pte_offset_map(dir, address) \
190 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
191#define pte_offset_map_nested(dir, address) \
192 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
193#define pte_unmap(pte) ((void)(pte))
194#define pte_unmap_nested(pte) ((void)(pte))
195
196/*
197 * Initialize a new pgd / pmd table with invalid pointers.
198 */
199extern void pgd_init(unsigned long page);
200extern void pmd_init(unsigned long page, unsigned long pagetable);
201
202/*
203 * Non-present pages: high 24 bits are offset, next 8 bits type,
204 * low 32 bits zero.
205 */
206static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
207{ pte_t pte; pte_val(pte) = (type << 32) | (offset << 40); return pte; }
208
209#define __swp_type(x) (((x).val >> 32) & 0xff)
210#define __swp_offset(x) ((x).val >> 40)
211#define __swp_entry(type,offset) ((swp_entry_t) { pte_val(mk_swap_pte((type),(offset))) })
212#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
213#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
214
215/*
216 * Bits 0, 1, 2, 7 and 8 are taken, split up the 32 bits of offset
217 * into this range:
218 */
219#define PTE_FILE_MAX_BITS 32
220
221#define pte_to_pgoff(_pte) \
222 ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 ))
223
224#define pgoff_to_pte(off) \
225 ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE })
226
227#endif /* _ASM_PGTABLE_64_H */
diff --git a/include/asm-mips/pgtable-bits.h b/include/asm-mips/pgtable-bits.h
new file mode 100644
index 000000000000..3aad751ccd5f
--- /dev/null
+++ b/include/asm-mips/pgtable-bits.h
@@ -0,0 +1,149 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 - 2002 by Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 * Copyright (C) 2002 Maciej W. Rozycki
9 */
10#ifndef _ASM_PGTABLE_BITS_H
11#define _ASM_PGTABLE_BITS_H
12
13#include <linux/config.h>
14
15/*
16 * Note that we shift the lower 32bits of each EntryLo[01] entry
17 * 6 bits to the left. That way we can convert the PFN into the
18 * physical address by a single 'and' operation and gain 6 additional
19 * bits for storing information which isn't present in a normal
20 * MIPS page table.
21 *
22 * Similar to the Alpha port, we need to keep track of the ref
23 * and mod bits in software. We have a software "yeah you can read
24 * from this page" bit, and a hardware one which actually lets the
25 * process read from the page. On the same token we have a software
26 * writable bit and the real hardware one which actually lets the
27 * process write to the page, this keeps a mod bit via the hardware
28 * dirty bit.
29 *
30 * Certain revisions of the R4000 and R5000 have a bug where if a
31 * certain sequence occurs in the last 3 instructions of an executable
32 * page, and the following page is not mapped, the cpu can do
33 * unpredictable things. The code (when it is written) to deal with
34 * this problem will be in the update_mmu_cache() code for the r4k.
35 */
36#if defined(CONFIG_CPU_MIPS32) && defined(CONFIG_64BIT_PHYS_ADDR)
37
38#define _PAGE_PRESENT (1<<6) /* implemented in software */
39#define _PAGE_READ (1<<7) /* implemented in software */
40#define _PAGE_WRITE (1<<8) /* implemented in software */
41#define _PAGE_ACCESSED (1<<9) /* implemented in software */
42#define _PAGE_MODIFIED (1<<10) /* implemented in software */
43#define _PAGE_FILE (1<<10) /* set:pagecache unset:swap */
44
45#define _PAGE_R4KBUG (1<<0) /* workaround for r4k bug */
46#define _PAGE_GLOBAL (1<<0)
47#define _PAGE_VALID (1<<1)
48#define _PAGE_SILENT_READ (1<<1) /* synonym */
49#define _PAGE_DIRTY (1<<2) /* The MIPS dirty bit */
50#define _PAGE_SILENT_WRITE (1<<2)
51#define _CACHE_MASK (7<<3)
52
53/* MIPS32 defines only values 2 and 3. The rest are implementation
54 * dependent.
55 */
56#define _CACHE_UNCACHED (2<<3)
57#define _CACHE_CACHABLE_NONCOHERENT (3<<3)
58#define _CACHE_CACHABLE_COW (3<<3) /* Au1x */
59
60#else
61
62#define _PAGE_PRESENT (1<<0) /* implemented in software */
63#define _PAGE_READ (1<<1) /* implemented in software */
64#define _PAGE_WRITE (1<<2) /* implemented in software */
65#define _PAGE_ACCESSED (1<<3) /* implemented in software */
66#define _PAGE_MODIFIED (1<<4) /* implemented in software */
67#define _PAGE_FILE (1<<4) /* set:pagecache unset:swap */
68
69#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
70
71#define _PAGE_GLOBAL (1<<8)
72#define _PAGE_VALID (1<<9)
73#define _PAGE_SILENT_READ (1<<9) /* synonym */
74#define _PAGE_DIRTY (1<<10) /* The MIPS dirty bit */
75#define _PAGE_SILENT_WRITE (1<<10)
76#define _CACHE_UNCACHED (1<<11)
77#define _CACHE_MASK (1<<11)
78#define _CACHE_CACHABLE_NONCOHERENT 0
79
80#else
81#define _PAGE_R4KBUG (1<<5) /* workaround for r4k bug */
82#define _PAGE_GLOBAL (1<<6)
83#define _PAGE_VALID (1<<7)
84#define _PAGE_SILENT_READ (1<<7) /* synonym */
85#define _PAGE_DIRTY (1<<8) /* The MIPS dirty bit */
86#define _PAGE_SILENT_WRITE (1<<8)
87#define _CACHE_MASK (7<<9)
88
89#ifdef CONFIG_CPU_SB1
90
91/* No penalty for being coherent on the SB1, so just
92 use it for "noncoherent" spaces, too. Shouldn't hurt. */
93
94#define _CACHE_UNCACHED (2<<9)
95#define _CACHE_CACHABLE_COW (5<<9)
96#define _CACHE_CACHABLE_NONCOHERENT (5<<9)
97#define _CACHE_UNCACHED_ACCELERATED (7<<9)
98
99#elif defined(CONFIG_CPU_RM9000)
100
101#define _CACHE_WT (0 << 9)
102#define _CACHE_WTWA (1 << 9)
103#define _CACHE_UC_B (2 << 9)
104#define _CACHE_WB (3 << 9)
105#define _CACHE_CWBEA (4 << 9)
106#define _CACHE_CWB (5 << 9)
107#define _CACHE_UCNB (6 << 9)
108#define _CACHE_FPC (7 << 9)
109
110#define _CACHE_UNCACHED _CACHE_UC_B
111#define _CACHE_CACHABLE_NONCOHERENT _CACHE_WB
112
113#else
114
115#define _CACHE_CACHABLE_NO_WA (0<<9) /* R4600 only */
116#define _CACHE_CACHABLE_WA (1<<9) /* R4600 only */
117#define _CACHE_UNCACHED (2<<9) /* R4[0246]00 */
118#define _CACHE_CACHABLE_NONCOHERENT (3<<9) /* R4[0246]00 */
119#define _CACHE_CACHABLE_CE (4<<9) /* R4[04]00MC only */
120#define _CACHE_CACHABLE_COW (5<<9) /* R4[04]00MC only */
121#define _CACHE_CACHABLE_CUW (6<<9) /* R4[04]00MC only */
122#define _CACHE_UNCACHED_ACCELERATED (7<<9) /* R10000 only */
123
124#endif
125#endif
126#endif /* defined(CONFIG_CPU_MIPS32) && defined(CONFIG_64BIT_PHYS_ADDR) */
127
128#define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED)
129#define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
130
131#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _CACHE_MASK)
132
133#ifdef CONFIG_MIPS_UNCACHED
134#define PAGE_CACHABLE_DEFAULT _CACHE_UNCACHED
135#elif defined(CONFIG_DMA_NONCOHERENT)
136#define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_NONCOHERENT
137#elif defined(CONFIG_CPU_RM9000)
138#define PAGE_CACHABLE_DEFAULT _CACHE_CWB
139#else
140#define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_COW
141#endif
142
143#if defined(CONFIG_CPU_MIPS32) && defined(CONFIG_64BIT_PHYS_ADDR)
144#define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 3)
145#else
146#define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 9)
147#endif
148
149#endif /* _ASM_PGTABLE_BITS_H */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
new file mode 100644
index 000000000000..878843203d67
--- /dev/null
+++ b/include/asm-mips/pgtable.h
@@ -0,0 +1,404 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 Ralf Baechle
7 */
8#ifndef _ASM_PGTABLE_H
9#define _ASM_PGTABLE_H
10
11#include <asm-generic/4level-fixup.h>
12
13#include <linux/config.h>
14#ifdef CONFIG_MIPS32
15#include <asm/pgtable-32.h>
16#endif
17#ifdef CONFIG_MIPS64
18#include <asm/pgtable-64.h>
19#endif
20
21#include <asm/pgtable-bits.h>
22
23#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
24#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
25 PAGE_CACHABLE_DEFAULT)
26#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_READ | \
27 PAGE_CACHABLE_DEFAULT)
28#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_READ | \
29 PAGE_CACHABLE_DEFAULT)
30#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
31 _PAGE_GLOBAL | PAGE_CACHABLE_DEFAULT)
32#define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
33 PAGE_CACHABLE_DEFAULT)
34#define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \
35 __WRITEABLE | _PAGE_GLOBAL | _CACHE_UNCACHED)
36
37/*
38 * MIPS can't do page protection for execute, and considers that the same like
39 * read. Also, write permissions imply read permissions. This is the closest
40 * we can get by reasonable means..
41 */
42#define __P000 PAGE_NONE
43#define __P001 PAGE_READONLY
44#define __P010 PAGE_COPY
45#define __P011 PAGE_COPY
46#define __P100 PAGE_READONLY
47#define __P101 PAGE_READONLY
48#define __P110 PAGE_COPY
49#define __P111 PAGE_COPY
50
51#define __S000 PAGE_NONE
52#define __S001 PAGE_READONLY
53#define __S010 PAGE_SHARED
54#define __S011 PAGE_SHARED
55#define __S100 PAGE_READONLY
56#define __S101 PAGE_READONLY
57#define __S110 PAGE_SHARED
58#define __S111 PAGE_SHARED
59
60/*
61 * ZERO_PAGE is a global shared page that is always zero; used
62 * for zero-mapped memory areas etc..
63 */
64
65extern unsigned long empty_zero_page;
66extern unsigned long zero_page_mask;
67
68#define ZERO_PAGE(vaddr) \
69 (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))
70
71extern void paging_init(void);
72
73/*
74 * Conversion functions: convert a page and protection to a page entry,
75 * and a page entry and page directory to the page they refer to.
76 */
77#define page_pte(page) page_pte_prot(page, __pgprot(0))
78#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET)
79#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
80#define pmd_page_kernel(pmd) pmd_val(pmd)
81
82#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
83#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
84
85#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
86static inline void set_pte(pte_t *ptep, pte_t pte)
87{
88 ptep->pte_high = pte.pte_high;
89 smp_wmb();
90 ptep->pte_low = pte.pte_low;
91 //printk("pte_high %x pte_low %x\n", ptep->pte_high, ptep->pte_low);
92
93 if (pte_val(pte) & _PAGE_GLOBAL) {
94 pte_t *buddy = ptep_buddy(ptep);
95 /*
96 * Make sure the buddy is global too (if it's !none,
97 * it better already be global)
98 */
99 if (pte_none(*buddy))
100 buddy->pte_low |= _PAGE_GLOBAL;
101 }
102}
103#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
104
105static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
106{
107 /* Preserve global status for the pair */
108 if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL)
109 set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL));
110 else
111 set_pte_at(mm, addr, ptep, __pte(0));
112}
113#else
114/*
115 * Certain architectures need to do special things when pte's
116 * within a page table are directly modified. Thus, the following
117 * hook is made available.
118 */
119static inline void set_pte(pte_t *ptep, pte_t pteval)
120{
121 *ptep = pteval;
122#if !defined(CONFIG_CPU_R3000) && !defined(CONFIG_CPU_TX39XX)
123 if (pte_val(pteval) & _PAGE_GLOBAL) {
124 pte_t *buddy = ptep_buddy(ptep);
125 /*
126 * Make sure the buddy is global too (if it's !none,
127 * it better already be global)
128 */
129 if (pte_none(*buddy))
130 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL;
131 }
132#endif
133}
134#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
135
136static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
137{
138#if !defined(CONFIG_CPU_R3000) && !defined(CONFIG_CPU_TX39XX)
139 /* Preserve global status for the pair */
140 if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL)
141 set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL));
142 else
143#endif
144 set_pte_at(mm, addr, ptep, __pte(0));
145}
146#endif
147
148/*
149 * (pmds are folded into pgds so this doesn't get actually called,
150 * but the define is needed for a generic inline function.)
151 */
152#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
153#define set_pgd(pgdptr, pgdval) do { *(pgdptr) = (pgdval); } while(0)
154
155#define PGD_T_LOG2 ffz(~sizeof(pgd_t))
156#define PMD_T_LOG2 ffz(~sizeof(pmd_t))
157#define PTE_T_LOG2 ffz(~sizeof(pte_t))
158
159extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
160
161/*
162 * The following only work if pte_present() is true.
163 * Undefined behaviour if not..
164 */
165static inline int pte_user(pte_t pte) { BUG(); return 0; }
166#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
167static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_READ; }
168static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; }
169static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; }
170static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; }
171static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; }
172static inline pte_t pte_wrprotect(pte_t pte)
173{
174 (pte).pte_low &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
175 (pte).pte_high &= ~_PAGE_SILENT_WRITE;
176 return pte;
177}
178
179static inline pte_t pte_rdprotect(pte_t pte)
180{
181 (pte).pte_low &= ~(_PAGE_READ | _PAGE_SILENT_READ);
182 (pte).pte_high &= ~_PAGE_SILENT_READ;
183 return pte;
184}
185
186static inline pte_t pte_mkclean(pte_t pte)
187{
188 (pte).pte_low &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE);
189 (pte).pte_high &= ~_PAGE_SILENT_WRITE;
190 return pte;
191}
192
193static inline pte_t pte_mkold(pte_t pte)
194{
195 (pte).pte_low &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ);
196 (pte).pte_high &= ~_PAGE_SILENT_READ;
197 return pte;
198}
199
200static inline pte_t pte_mkwrite(pte_t pte)
201{
202 (pte).pte_low |= _PAGE_WRITE;
203 if ((pte).pte_low & _PAGE_MODIFIED) {
204 (pte).pte_low |= _PAGE_SILENT_WRITE;
205 (pte).pte_high |= _PAGE_SILENT_WRITE;
206 }
207 return pte;
208}
209
210static inline pte_t pte_mkread(pte_t pte)
211{
212 (pte).pte_low |= _PAGE_READ;
213 if ((pte).pte_low & _PAGE_ACCESSED) {
214 (pte).pte_low |= _PAGE_SILENT_READ;
215 (pte).pte_high |= _PAGE_SILENT_READ;
216 }
217 return pte;
218}
219
220static inline pte_t pte_mkdirty(pte_t pte)
221{
222 (pte).pte_low |= _PAGE_MODIFIED;
223 if ((pte).pte_low & _PAGE_WRITE) {
224 (pte).pte_low |= _PAGE_SILENT_WRITE;
225 (pte).pte_high |= _PAGE_SILENT_WRITE;
226 }
227 return pte;
228}
229
230static inline pte_t pte_mkyoung(pte_t pte)
231{
232 (pte).pte_low |= _PAGE_ACCESSED;
233 if ((pte).pte_low & _PAGE_READ)
234 (pte).pte_low |= _PAGE_SILENT_READ;
235 (pte).pte_high |= _PAGE_SILENT_READ;
236 return pte;
237}
238#else
239static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
240static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
241static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
242static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
243static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
244
245static inline pte_t pte_wrprotect(pte_t pte)
246{
247 pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
248 return pte;
249}
250
251static inline pte_t pte_rdprotect(pte_t pte)
252{
253 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ);
254 return pte;
255}
256
257static inline pte_t pte_mkclean(pte_t pte)
258{
259 pte_val(pte) &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE);
260 return pte;
261}
262
263static inline pte_t pte_mkold(pte_t pte)
264{
265 pte_val(pte) &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ);
266 return pte;
267}
268
269static inline pte_t pte_mkwrite(pte_t pte)
270{
271 pte_val(pte) |= _PAGE_WRITE;
272 if (pte_val(pte) & _PAGE_MODIFIED)
273 pte_val(pte) |= _PAGE_SILENT_WRITE;
274 return pte;
275}
276
277static inline pte_t pte_mkread(pte_t pte)
278{
279 pte_val(pte) |= _PAGE_READ;
280 if (pte_val(pte) & _PAGE_ACCESSED)
281 pte_val(pte) |= _PAGE_SILENT_READ;
282 return pte;
283}
284
285static inline pte_t pte_mkdirty(pte_t pte)
286{
287 pte_val(pte) |= _PAGE_MODIFIED;
288 if (pte_val(pte) & _PAGE_WRITE)
289 pte_val(pte) |= _PAGE_SILENT_WRITE;
290 return pte;
291}
292
293static inline pte_t pte_mkyoung(pte_t pte)
294{
295 pte_val(pte) |= _PAGE_ACCESSED;
296 if (pte_val(pte) & _PAGE_READ)
297 pte_val(pte) |= _PAGE_SILENT_READ;
298 return pte;
299}
300#endif
301
302/*
303 * Macro to make mark a page protection value as "uncacheable". Note
304 * that "protection" is really a misnomer here as the protection value
305 * contains the memory attribute bits, dirty bits, and various other
306 * bits as well.
307 */
308#define pgprot_noncached pgprot_noncached
309
310static inline pgprot_t pgprot_noncached(pgprot_t _prot)
311{
312 unsigned long prot = pgprot_val(_prot);
313
314 prot = (prot & ~_CACHE_MASK) | _CACHE_UNCACHED;
315
316 return __pgprot(prot);
317}
318
319/*
320 * Conversion functions: convert a page and protection to a page entry,
321 * and a page entry and page directory to the page they refer to.
322 */
323#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
324
325#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
326static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
327{
328 pte.pte_low &= _PAGE_CHG_MASK;
329 pte.pte_low |= pgprot_val(newprot);
330 pte.pte_high |= pgprot_val(newprot) & 0x3f;
331 return pte;
332}
333#else
334static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
335{
336 return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot));
337}
338#endif
339
340
341extern void __update_tlb(struct vm_area_struct *vma, unsigned long address,
342 pte_t pte);
343extern void __update_cache(struct vm_area_struct *vma, unsigned long address,
344 pte_t pte);
345
346static inline void update_mmu_cache(struct vm_area_struct *vma,
347 unsigned long address, pte_t pte)
348{
349 __update_tlb(vma, address, pte);
350 __update_cache(vma, address, pte);
351}
352
353#ifndef CONFIG_DISCONTIGMEM
354#define kern_addr_valid(addr) (1)
355#endif
356
357#ifdef CONFIG_64BIT_PHYS_ADDR
358extern phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size);
359extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot);
360
361static inline int io_remap_page_range(struct vm_area_struct *vma,
362 unsigned long vaddr,
363 unsigned long paddr,
364 unsigned long size,
365 pgprot_t prot)
366{
367 phys_t phys_addr_high = fixup_bigphys_addr(paddr, size);
368 return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot);
369}
370
371static inline int io_remap_pfn_range(struct vm_area_struct *vma,
372 unsigned long vaddr,
373 unsigned long pfn,
374 unsigned long size,
375 pgprot_t prot)
376{
377 phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size);
378 return remap_pfn_range(vma, vaddr, pfn, size, prot);
379}
380#else
381#define io_remap_page_range(vma, vaddr, paddr, size, prot) \
382 remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot)
383#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
384 remap_pfn_range(vma, vaddr, pfn, size, prot)
385#endif
386
387#define MK_IOSPACE_PFN(space, pfn) (pfn)
388#define GET_IOSPACE(pfn) 0
389#define GET_PFN(pfn) (pfn)
390
391#include <asm-generic/pgtable.h>
392
393/*
394 * We provide our own get_unmapped area to cope with the virtual aliasing
395 * constraints placed on us by the cache architecture.
396 */
397#define HAVE_ARCH_UNMAPPED_AREA
398
399/*
400 * No page table caches to initialise
401 */
402#define pgtable_cache_init() do { } while (0)
403
404#endif /* _ASM_PGTABLE_H */
diff --git a/include/asm-mips/pmon.h b/include/asm-mips/pmon.h
new file mode 100644
index 000000000000..260f3448ccf1
--- /dev/null
+++ b/include/asm-mips/pmon.h
@@ -0,0 +1,46 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004 by Ralf Baechle
7 *
8 * The cpustart method is a PMC-Sierra's function to start the secondary CPU.
9 * Stock PMON 2000 has the smpfork, semlock and semunlock methods instead.
10 */
11#ifndef _ASM_PMON_H
12#define _ASM_PMON_H
13
14struct callvectors {
15 int (*open) (char*, int, int);
16 int (*close) (int);
17 int (*read) (int, void*, int);
18 int (*write) (int, void*, int);
19 off_t (*lseek) (int, off_t, int);
20 int (*printf) (const char*, ...);
21 void (*cacheflush) (void);
22 char* (*gets) (char*);
23 union {
24 int (*smpfork) (unsigned long cp, char *sp);
25 int (*cpustart) (long, long, long, long);
26 } _s;
27 int (*semlock) (int sem);
28 void (*semunlock) (int sem);
29};
30
31extern struct callvectors *debug_vectors;
32
33#define pmon_open(name, flags, mode) debug_vectors->open(name, flage, mode)
34#define pmon_close(fd) debug_vectors->close(fd)
35#define pmon_read(fd, buf, count) debug_vectors->read(fd, buf, count)
36#define pmon_write(fd, buf, count) debug_vectors->write(fd, buf, count)
37#define pmon_lseek(fd, off, whence) debug_vectors->lseek(fd, off, whence)
38#define pmon_printf(fmt...) debug_vectors->printf(fmt)
39#define pmon_cacheflush() debug_vectors->cacheflush()
40#define pmon_gets(s) debug_vectors->gets(s)
41#define pmon_cpustart(n, f, sp, gp) debug_vectors->_s.cpustart(n, f, sp, gp)
42#define pmon_smpfork(cp, sp) debug_vectors->_s.smpfork(cp, sp)
43#define pmon_semlock(sem) debug_vectors->semlock(sem)
44#define pmon_semunlock(sem) debug_vectors->semunlock(sem)
45
46#endif /* _ASM_PMON_H */
diff --git a/include/asm-mips/poll.h b/include/asm-mips/poll.h
new file mode 100644
index 000000000000..a000f1f789e3
--- /dev/null
+++ b/include/asm-mips/poll.h
@@ -0,0 +1,27 @@
1#ifndef __ASM_POLL_H
2#define __ASM_POLL_H
3
4#define POLLIN 0x0001
5#define POLLPRI 0x0002
6#define POLLOUT 0x0004
7
8#define POLLERR 0x0008
9#define POLLHUP 0x0010
10#define POLLNVAL 0x0020
11
12#define POLLRDNORM 0x0040
13#define POLLRDBAND 0x0080
14#define POLLWRNORM POLLOUT
15#define POLLWRBAND 0x0100
16
17/* These seem to be more or less nonstandard ... */
18#define POLLMSG 0x0400
19#define POLLREMOVE 0x1000
20
21struct pollfd {
22 int fd;
23 short events;
24 short revents;
25};
26
27#endif /* __ASM_POLL_H */
diff --git a/include/asm-mips/posix_types.h b/include/asm-mips/posix_types.h
new file mode 100644
index 000000000000..c2e8a0070daf
--- /dev/null
+++ b/include/asm-mips/posix_types.h
@@ -0,0 +1,144 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 97, 98, 99, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_POSIX_TYPES_H
10#define _ASM_POSIX_TYPES_H
11
12#include <asm/sgidefs.h>
13
14/*
15 * This file is generally used by user-level software, so you need to
16 * be a little careful about namespace pollution etc. Also, we cannot
17 * assume GCC is being used.
18 */
19
20typedef unsigned long __kernel_ino_t;
21typedef unsigned int __kernel_mode_t;
22#if (_MIPS_SZLONG == 32)
23typedef unsigned long __kernel_nlink_t;
24#endif
25#if (_MIPS_SZLONG == 64)
26typedef unsigned int __kernel_nlink_t;
27#endif
28typedef long __kernel_off_t;
29typedef int __kernel_pid_t;
30typedef int __kernel_ipc_pid_t;
31typedef unsigned int __kernel_uid_t;
32typedef unsigned int __kernel_gid_t;
33#if (_MIPS_SZLONG == 32)
34typedef unsigned int __kernel_size_t;
35typedef int __kernel_ssize_t;
36typedef int __kernel_ptrdiff_t;
37#endif
38#if (_MIPS_SZLONG == 64)
39typedef unsigned long __kernel_size_t;
40typedef long __kernel_ssize_t;
41typedef long __kernel_ptrdiff_t;
42#endif
43typedef long __kernel_time_t;
44typedef long __kernel_suseconds_t;
45typedef long __kernel_clock_t;
46typedef int __kernel_timer_t;
47typedef int __kernel_clockid_t;
48typedef long __kernel_daddr_t;
49typedef char * __kernel_caddr_t;
50
51typedef unsigned short __kernel_uid16_t;
52typedef unsigned short __kernel_gid16_t;
53typedef unsigned int __kernel_uid32_t;
54typedef unsigned int __kernel_gid32_t;
55typedef __kernel_uid_t __kernel_old_uid_t;
56typedef __kernel_gid_t __kernel_old_gid_t;
57typedef unsigned int __kernel_old_dev_t;
58
59#ifdef __GNUC__
60typedef long long __kernel_loff_t;
61#endif
62
63typedef struct {
64#if (_MIPS_SZLONG == 32)
65 long val[2];
66#endif
67#if (_MIPS_SZLONG == 64)
68 int val[2];
69#endif
70} __kernel_fsid_t;
71
72#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
73
74#undef __FD_SET
75static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
76{
77 unsigned long __tmp = __fd / __NFDBITS;
78 unsigned long __rem = __fd % __NFDBITS;
79 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
80}
81
82#undef __FD_CLR
83static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
84{
85 unsigned long __tmp = __fd / __NFDBITS;
86 unsigned long __rem = __fd % __NFDBITS;
87 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
88}
89
90#undef __FD_ISSET
91static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
92{
93 unsigned long __tmp = __fd / __NFDBITS;
94 unsigned long __rem = __fd % __NFDBITS;
95 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
96}
97
98/*
99 * This will unroll the loop for the normal constant case (8 ints,
100 * for a 256-bit fd_set)
101 */
102#undef __FD_ZERO
103static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
104{
105 unsigned long *__tmp = __p->fds_bits;
106 int __i;
107
108 if (__builtin_constant_p(__FDSET_LONGS)) {
109 switch (__FDSET_LONGS) {
110 case 16:
111 __tmp[ 0] = 0; __tmp[ 1] = 0;
112 __tmp[ 2] = 0; __tmp[ 3] = 0;
113 __tmp[ 4] = 0; __tmp[ 5] = 0;
114 __tmp[ 6] = 0; __tmp[ 7] = 0;
115 __tmp[ 8] = 0; __tmp[ 9] = 0;
116 __tmp[10] = 0; __tmp[11] = 0;
117 __tmp[12] = 0; __tmp[13] = 0;
118 __tmp[14] = 0; __tmp[15] = 0;
119 return;
120
121 case 8:
122 __tmp[ 0] = 0; __tmp[ 1] = 0;
123 __tmp[ 2] = 0; __tmp[ 3] = 0;
124 __tmp[ 4] = 0; __tmp[ 5] = 0;
125 __tmp[ 6] = 0; __tmp[ 7] = 0;
126 return;
127
128 case 4:
129 __tmp[ 0] = 0; __tmp[ 1] = 0;
130 __tmp[ 2] = 0; __tmp[ 3] = 0;
131 return;
132 }
133 }
134 __i = __FDSET_LONGS;
135 while (__i) {
136 __i--;
137 *__tmp = 0;
138 __tmp++;
139 }
140}
141
142#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
143
144#endif /* _ASM_POSIX_TYPES_H */
diff --git a/include/asm-mips/prctl.h b/include/asm-mips/prctl.h
new file mode 100644
index 000000000000..4aaaff670361
--- /dev/null
+++ b/include/asm-mips/prctl.h
@@ -0,0 +1,41 @@
1/*
2 * IRIX prctl interface
3 *
4 * The IRIX kernel maps a page at PRDA_ADDRESS with the
5 * contents of prda and fills it the bits on prda_sys.
6 */
7
8#ifndef __PRCTL_H__
9#define __PRCTL_H__
10
11#define PRDA_ADDRESS 0x200000L
12#define PRDA ((struct prda *) PRDA_ADDRESS)
13
14struct prda_sys {
15 pid_t t_pid;
16 u32 t_hint;
17 u32 t_dlactseq;
18 u32 t_fpflags;
19 u32 t_prid; /* processor type, $prid CP0 register */
20 u32 t_dlendseq;
21 u64 t_unused1[5];
22 pid_t t_rpid;
23 s32 t_resched;
24 u32 t_unused[8];
25 u32 t_cpu; /* current/last cpu */
26
27 /* FIXME: The signal information, not supported by Linux now */
28 u32 t_flags; /* if true, then the sigprocmask is in userspace */
29 u32 t_sigprocmask [1]; /* the sigprocmask */
30};
31
32struct prda {
33 char fill [0xe00];
34 struct prda_sys prda_sys;
35};
36
37#define t_sys prda_sys
38
39ptrdiff_t prctl (int op, int v1, int v2);
40
41#endif
diff --git a/include/asm-mips/prefetch.h b/include/asm-mips/prefetch.h
new file mode 100644
index 000000000000..71293ec1657c
--- /dev/null
+++ b/include/asm-mips/prefetch.h
@@ -0,0 +1,88 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_PREFETCH_H
9#define __ASM_PREFETCH_H
10
11#include <linux/config.h>
12
13/*
14 * R5000 and RM5200 implements pref and prefx instructions but they're nops, so
15 * rather than wasting time we pretend these processors don't support
16 * prefetching at all.
17 *
18 * R5432 implements Load, Store, LoadStreamed, StoreStreamed, LoadRetained,
19 * StoreRetained and WriteBackInvalidate but not Pref_PrepareForStore.
20 *
21 * Hell (and the book on my shelf I can't open ...) know what the R8000 does.
22 *
23 * RM7000 version 1.0 interprets all hints as Pref_Load; version 2.0 implements
24 * Pref_PrepareForStore also.
25 *
26 * RM9000 is MIPS IV but implements prefetching like MIPS32/MIPS64; it's
27 * Pref_WriteBackInvalidate is a nop and Pref_PrepareForStore is broken in
28 * current versions due to erratum G105.
29 *
30 * VR7701 only implements the Load prefetch.
31 *
32 * Finally MIPS32 and MIPS64 implement all of the following hints.
33 */
34
35#define Pref_Load 0
36#define Pref_Store 1
37 /* 2 and 3 are reserved */
38#define Pref_LoadStreamed 4
39#define Pref_StoreStreamed 5
40#define Pref_LoadRetained 6
41#define Pref_StoreRetained 7
42 /* 8 ... 24 are reserved */
43#define Pref_WriteBackInvalidate 25
44#define Pref_PrepareForStore 30
45
46#ifdef __ASSEMBLY__
47
48 .macro __pref hint addr
49#ifdef CONFIG_CPU_HAS_PREFETCH
50 pref \hint, \addr
51#endif
52 .endm
53
54 .macro pref_load addr
55 __pref Pref_Load, \addr
56 .endm
57
58 .macro pref_store addr
59 __pref Pref_Store, \addr
60 .endm
61
62 .macro pref_load_streamed addr
63 __pref Pref_LoadStreamed, \addr
64 .endm
65
66 .macro pref_store_streamed addr
67 __pref Pref_StoreStreamed, \addr
68 .endm
69
70 .macro pref_load_retained addr
71 __pref Pref_LoadRetained, \addr
72 .endm
73
74 .macro pref_store_retained addr
75 __pref Pref_StoreRetained, \addr
76 .endm
77
78 .macro pref_wback_inv addr
79 __pref Pref_WriteBackInvalidate, \addr
80 .endm
81
82 .macro pref_prepare_for_store addr
83 __pref Pref_PrepareForStore, \addr
84 .endm
85
86#endif
87
88#endif /* __ASM_PREFETCH_H */
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
new file mode 100644
index 000000000000..13c54d5b3b48
--- /dev/null
+++ b/include/asm-mips/processor.h
@@ -0,0 +1,220 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 Waldorf GMBH
7 * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 Ralf Baechle
8 * Copyright (C) 1996 Paul M. Antoine
9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 */
11#ifndef _ASM_PROCESSOR_H
12#define _ASM_PROCESSOR_H
13
14#include <linux/config.h>
15#include <linux/threads.h>
16
17#include <asm/cachectl.h>
18#include <asm/cpu.h>
19#include <asm/cpu-info.h>
20#include <asm/mipsregs.h>
21#include <asm/prefetch.h>
22#include <asm/system.h>
23
24/*
25 * Return current * instruction pointer ("program counter").
26 */
27#define current_text_addr() ({ __label__ _l; _l: &&_l;})
28
29/*
30 * System setup and hardware flags..
31 */
32extern void (*cpu_wait)(void);
33
34extern unsigned int vced_count, vcei_count;
35
36#ifdef CONFIG_MIPS32
37/*
38 * User space process size: 2GB. This is hardcoded into a few places,
39 * so don't change it unless you know what you are doing.
40 */
41#define TASK_SIZE 0x7fff8000UL
42
43/*
44 * This decides where the kernel will search for a free chunk of vm
45 * space during mmap's.
46 */
47#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
48#endif
49
50#ifdef CONFIG_MIPS64
51/*
52 * User space process size: 1TB. This is hardcoded into a few places,
53 * so don't change it unless you know what you are doing. TASK_SIZE
54 * is limited to 1TB by the R4000 architecture; R10000 and better can
55 * support 16TB; the architectural reserve for future expansion is
56 * 8192EB ...
57 */
58#define TASK_SIZE32 0x7fff8000UL
59#define TASK_SIZE 0x10000000000UL
60
61/*
62 * This decides where the kernel will search for a free chunk of vm
63 * space during mmap's.
64 */
65#define TASK_UNMAPPED_BASE ((current->thread.mflags & MF_32BIT_ADDR) ? \
66 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3))
67#endif
68
69#define NUM_FPU_REGS 32
70
71typedef __u64 fpureg_t;
72
73struct mips_fpu_hard_struct {
74 fpureg_t fpr[NUM_FPU_REGS];
75 unsigned int fcr31;
76};
77
78/*
79 * It would be nice to add some more fields for emulator statistics, but there
80 * are a number of fixed offsets in offset.h and elsewhere that would have to
81 * be recalculated by hand. So the additional information will be private to
82 * the FPU emulator for now. See asm-mips/fpu_emulator.h.
83 */
84
85struct mips_fpu_soft_struct {
86 fpureg_t fpr[NUM_FPU_REGS];
87 unsigned int fcr31;
88};
89
90union mips_fpu_union {
91 struct mips_fpu_hard_struct hard;
92 struct mips_fpu_soft_struct soft;
93};
94
95#define INIT_FPU { \
96 {{0,},} \
97}
98
99typedef struct {
100 unsigned long seg;
101} mm_segment_t;
102
103#define ARCH_MIN_TASKALIGN 8
104
105/*
106 * If you change thread_struct remember to change the #defines below too!
107 */
108struct thread_struct {
109 /* Saved main processor registers. */
110 unsigned long reg16;
111 unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
112 unsigned long reg29, reg30, reg31;
113
114 /* Saved cp0 stuff. */
115 unsigned long cp0_status;
116
117 /* Saved fpu/fpu emulator stuff. */
118 union mips_fpu_union fpu;
119
120 /* Other stuff associated with the thread. */
121 unsigned long cp0_badvaddr; /* Last user fault */
122 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
123 unsigned long error_code;
124 unsigned long trap_no;
125#define MF_FIXADE 1 /* Fix address errors in software */
126#define MF_LOGADE 2 /* Log address errors to syslog */
127#define MF_32BIT_REGS 4 /* also implies 16/32 fprs */
128#define MF_32BIT_ADDR 8 /* 32-bit address space (o32/n32) */
129 unsigned long mflags;
130 unsigned long irix_trampoline; /* Wheee... */
131 unsigned long irix_oldctx;
132};
133
134#define MF_ABI_MASK (MF_32BIT_REGS | MF_32BIT_ADDR)
135#define MF_O32 (MF_32BIT_REGS | MF_32BIT_ADDR)
136#define MF_N32 MF_32BIT_ADDR
137#define MF_N64 0
138
139#define INIT_THREAD { \
140 /* \
141 * saved main processor registers \
142 */ \
143 0, 0, 0, 0, 0, 0, 0, 0, \
144 0, 0, 0, \
145 /* \
146 * saved cp0 stuff \
147 */ \
148 0, \
149 /* \
150 * saved fpu/fpu emulator stuff \
151 */ \
152 INIT_FPU, \
153 /* \
154 * Other stuff associated with the process \
155 */ \
156 0, 0, 0, 0, \
157 /* \
158 * For now the default is to fix address errors \
159 */ \
160 MF_FIXADE, 0, 0 \
161}
162
163struct task_struct;
164
165/* Free all resources held by a thread. */
166#define release_thread(thread) do { } while(0)
167
168/* Prepare to copy thread state - unlazy all lazy status */
169#define prepare_to_copy(tsk) do { } while (0)
170
171extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
172
173extern unsigned long thread_saved_pc(struct task_struct *tsk);
174
175/*
176 * Do necessary setup to start up a newly executed thread.
177 */
178extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp);
179
180unsigned long get_wchan(struct task_struct *p);
181
182#define __PT_REG(reg) ((long)&((struct pt_regs *)0)->reg - sizeof(struct pt_regs))
183#define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32)
184#define KSTK_EIP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_epc)))
185#define KSTK_ESP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(regs[29])))
186#define KSTK_STATUS(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_status)))
187
188#define cpu_relax() barrier()
189
190/*
191 * Return_address is a replacement for __builtin_return_address(count)
192 * which on certain architectures cannot reasonably be implemented in GCC
193 * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386).
194 * Note that __builtin_return_address(x>=1) is forbidden because GCC
195 * aborts compilation on some CPUs. It's simply not possible to unwind
196 * some CPU's stackframes.
197 *
198 * __builtin_return_address works only for non-leaf functions. We avoid the
199 * overhead of a function call by forcing the compiler to save the return
200 * address register on the stack.
201 */
202#define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
203
204#ifdef CONFIG_CPU_HAS_PREFETCH
205
206#define ARCH_HAS_PREFETCH
207
208extern inline void prefetch(const void *addr)
209{
210 __asm__ __volatile__(
211 " .set mips4 \n"
212 " pref %0, (%1) \n"
213 " .set mips0 \n"
214 :
215 : "i" (Pref_Load), "r" (addr));
216}
217
218#endif
219
220#endif /* _ASM_PROCESSOR_H */
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
new file mode 100644
index 000000000000..d3c46d633826
--- /dev/null
+++ b/include/asm-mips/ptrace.h
@@ -0,0 +1,79 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PTRACE_H
10#define _ASM_PTRACE_H
11
12#include <linux/config.h>
13
14#include <asm/isadep.h>
15
16/* 0 - 31 are integer registers, 32 - 63 are fp registers. */
17#define FPR_BASE 32
18#define PC 64
19#define CAUSE 65
20#define BADVADDR 66
21#define MMHI 67
22#define MMLO 68
23#define FPC_CSR 69
24#define FPC_EIR 70
25
26/*
27 * This struct defines the way the registers are stored on the stack during a
28 * system call/exception. As usual the registers k0/k1 aren't being saved.
29 */
30struct pt_regs {
31#ifdef CONFIG_MIPS32
32 /* Pad bytes for argument save space on the stack. */
33 unsigned long pad0[6];
34#endif
35
36 /* Saved main processor registers. */
37 unsigned long regs[32];
38
39 /* Saved special registers. */
40 unsigned long cp0_status;
41 unsigned long lo;
42 unsigned long hi;
43 unsigned long cp0_badvaddr;
44 unsigned long cp0_cause;
45 unsigned long cp0_epc;
46};
47
48/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
49/* #define PTRACE_GETREGS 12 */
50/* #define PTRACE_SETREGS 13 */
51/* #define PTRACE_GETFPREGS 14 */
52/* #define PTRACE_SETFPREGS 15 */
53/* #define PTRACE_GETFPXREGS 18 */
54/* #define PTRACE_SETFPXREGS 19 */
55
56#define PTRACE_OLDSETOPTIONS 21
57
58#define PTRACE_GET_THREAD_AREA 25
59#define PTRACE_SET_THREAD_AREA 26
60
61#ifdef __KERNEL__
62
63#include <linux/linkage.h>
64
65/*
66 * Does the process account for user or for system time?
67 */
68#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER)
69
70#define instruction_pointer(regs) ((regs)->cp0_epc)
71#define profile_pc(regs) instruction_pointer(regs)
72
73extern void show_regs(struct pt_regs *);
74
75extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
76
77#endif
78
79#endif /* _ASM_PTRACE_H */
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
new file mode 100644
index 000000000000..da03a32c1ca7
--- /dev/null
+++ b/include/asm-mips/r4kcache.h
@@ -0,0 +1,598 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Inline assembly cache operations.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 1997 - 2002 Ralf Baechle (ralf@gnu.org)
10 * Copyright (C) 2004 Ralf Baechle (ralf@linux-mips.org)
11 */
12#ifndef _ASM_R4KCACHE_H
13#define _ASM_R4KCACHE_H
14
15#include <asm/asm.h>
16#include <asm/cacheops.h>
17
18/*
19 * This macro return a properly sign-extended address suitable as base address
20 * for indexed cache operations. Two issues here:
21 *
22 * - The MIPS32 and MIPS64 specs permit an implementation to directly derive
23 * the index bits from the virtual address. This breaks with tradition
24 * set by the R4000. To keep unpleassant surprises from happening we pick
25 * an address in KSEG0 / CKSEG0.
26 * - We need a properly sign extended address for 64-bit code. To get away
27 * without ifdefs we let the compiler do it by a type cast.
28 */
29#define INDEX_BASE CKSEG0
30
31#define cache_op(op,addr) \
32 __asm__ __volatile__( \
33 " .set noreorder \n" \
34 " .set mips3\n\t \n" \
35 " cache %0, %1 \n" \
36 " .set mips0 \n" \
37 " .set reorder" \
38 : \
39 : "i" (op), "m" (*(unsigned char *)(addr)))
40
41static inline void flush_icache_line_indexed(unsigned long addr)
42{
43 cache_op(Index_Invalidate_I, addr);
44}
45
46static inline void flush_dcache_line_indexed(unsigned long addr)
47{
48 cache_op(Index_Writeback_Inv_D, addr);
49}
50
51static inline void flush_scache_line_indexed(unsigned long addr)
52{
53 cache_op(Index_Writeback_Inv_SD, addr);
54}
55
56static inline void flush_icache_line(unsigned long addr)
57{
58 cache_op(Hit_Invalidate_I, addr);
59}
60
61static inline void flush_dcache_line(unsigned long addr)
62{
63 cache_op(Hit_Writeback_Inv_D, addr);
64}
65
66static inline void invalidate_dcache_line(unsigned long addr)
67{
68 cache_op(Hit_Invalidate_D, addr);
69}
70
71static inline void invalidate_scache_line(unsigned long addr)
72{
73 cache_op(Hit_Invalidate_SD, addr);
74}
75
76static inline void flush_scache_line(unsigned long addr)
77{
78 cache_op(Hit_Writeback_Inv_SD, addr);
79}
80
81/*
82 * The next two are for badland addresses like signal trampolines.
83 */
84static inline void protected_flush_icache_line(unsigned long addr)
85{
86 __asm__ __volatile__(
87 ".set noreorder\n\t"
88 ".set mips3\n"
89 "1:\tcache %0,(%1)\n"
90 "2:\t.set mips0\n\t"
91 ".set reorder\n\t"
92 ".section\t__ex_table,\"a\"\n\t"
93 STR(PTR)"\t1b,2b\n\t"
94 ".previous"
95 :
96 : "i" (Hit_Invalidate_I), "r" (addr));
97}
98
99/*
100 * R10000 / R12000 hazard - these processors don't support the Hit_Writeback_D
101 * cacheop so we use Hit_Writeback_Inv_D which is supported by all R4000-style
102 * caches. We're talking about one cacheline unnecessarily getting invalidated
103 * here so the penaltiy isn't overly hard.
104 */
105static inline void protected_writeback_dcache_line(unsigned long addr)
106{
107 __asm__ __volatile__(
108 ".set noreorder\n\t"
109 ".set mips3\n"
110 "1:\tcache %0,(%1)\n"
111 "2:\t.set mips0\n\t"
112 ".set reorder\n\t"
113 ".section\t__ex_table,\"a\"\n\t"
114 STR(PTR)"\t1b,2b\n\t"
115 ".previous"
116 :
117 : "i" (Hit_Writeback_Inv_D), "r" (addr));
118}
119
120static inline void protected_writeback_scache_line(unsigned long addr)
121{
122 __asm__ __volatile__(
123 ".set noreorder\n\t"
124 ".set mips3\n"
125 "1:\tcache %0,(%1)\n"
126 "2:\t.set mips0\n\t"
127 ".set reorder\n\t"
128 ".section\t__ex_table,\"a\"\n\t"
129 STR(PTR)"\t1b,2b\n\t"
130 ".previous"
131 :
132 : "i" (Hit_Writeback_Inv_SD), "r" (addr));
133}
134
135/*
136 * This one is RM7000-specific
137 */
138static inline void invalidate_tcache_page(unsigned long addr)
139{
140 cache_op(Page_Invalidate_T, addr);
141}
142
143#define cache16_unroll32(base,op) \
144 __asm__ __volatile__( \
145 " .set noreorder \n" \
146 " .set mips3 \n" \
147 " cache %1, 0x000(%0); cache %1, 0x010(%0) \n" \
148 " cache %1, 0x020(%0); cache %1, 0x030(%0) \n" \
149 " cache %1, 0x040(%0); cache %1, 0x050(%0) \n" \
150 " cache %1, 0x060(%0); cache %1, 0x070(%0) \n" \
151 " cache %1, 0x080(%0); cache %1, 0x090(%0) \n" \
152 " cache %1, 0x0a0(%0); cache %1, 0x0b0(%0) \n" \
153 " cache %1, 0x0c0(%0); cache %1, 0x0d0(%0) \n" \
154 " cache %1, 0x0e0(%0); cache %1, 0x0f0(%0) \n" \
155 " cache %1, 0x100(%0); cache %1, 0x110(%0) \n" \
156 " cache %1, 0x120(%0); cache %1, 0x130(%0) \n" \
157 " cache %1, 0x140(%0); cache %1, 0x150(%0) \n" \
158 " cache %1, 0x160(%0); cache %1, 0x170(%0) \n" \
159 " cache %1, 0x180(%0); cache %1, 0x190(%0) \n" \
160 " cache %1, 0x1a0(%0); cache %1, 0x1b0(%0) \n" \
161 " cache %1, 0x1c0(%0); cache %1, 0x1d0(%0) \n" \
162 " cache %1, 0x1e0(%0); cache %1, 0x1f0(%0) \n" \
163 " .set mips0 \n" \
164 " .set reorder \n" \
165 : \
166 : "r" (base), \
167 "i" (op));
168
169static inline void blast_dcache16(void)
170{
171 unsigned long start = INDEX_BASE;
172 unsigned long end = start + current_cpu_data.dcache.waysize;
173 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
174 unsigned long ws_end = current_cpu_data.dcache.ways <<
175 current_cpu_data.dcache.waybit;
176 unsigned long ws, addr;
177
178 for (ws = 0; ws < ws_end; ws += ws_inc)
179 for (addr = start; addr < end; addr += 0x200)
180 cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
181}
182
183static inline void blast_dcache16_page(unsigned long page)
184{
185 unsigned long start = page;
186 unsigned long end = start + PAGE_SIZE;
187
188 do {
189 cache16_unroll32(start,Hit_Writeback_Inv_D);
190 start += 0x200;
191 } while (start < end);
192}
193
194static inline void blast_dcache16_page_indexed(unsigned long page)
195{
196 unsigned long start = page;
197 unsigned long end = start + PAGE_SIZE;
198 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
199 unsigned long ws_end = current_cpu_data.dcache.ways <<
200 current_cpu_data.dcache.waybit;
201 unsigned long ws, addr;
202
203 for (ws = 0; ws < ws_end; ws += ws_inc)
204 for (addr = start; addr < end; addr += 0x200)
205 cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
206}
207
208static inline void blast_icache16(void)
209{
210 unsigned long start = INDEX_BASE;
211 unsigned long end = start + current_cpu_data.icache.waysize;
212 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
213 unsigned long ws_end = current_cpu_data.icache.ways <<
214 current_cpu_data.icache.waybit;
215 unsigned long ws, addr;
216
217 for (ws = 0; ws < ws_end; ws += ws_inc)
218 for (addr = start; addr < end; addr += 0x200)
219 cache16_unroll32(addr|ws,Index_Invalidate_I);
220}
221
222static inline void blast_icache16_page(unsigned long page)
223{
224 unsigned long start = page;
225 unsigned long end = start + PAGE_SIZE;
226
227 do {
228 cache16_unroll32(start,Hit_Invalidate_I);
229 start += 0x200;
230 } while (start < end);
231}
232
233static inline void blast_icache16_page_indexed(unsigned long page)
234{
235 unsigned long start = page;
236 unsigned long end = start + PAGE_SIZE;
237 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
238 unsigned long ws_end = current_cpu_data.icache.ways <<
239 current_cpu_data.icache.waybit;
240 unsigned long ws, addr;
241
242 for (ws = 0; ws < ws_end; ws += ws_inc)
243 for (addr = start; addr < end; addr += 0x200)
244 cache16_unroll32(addr|ws,Index_Invalidate_I);
245}
246
247static inline void blast_scache16(void)
248{
249 unsigned long start = INDEX_BASE;
250 unsigned long end = start + current_cpu_data.scache.waysize;
251 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
252 unsigned long ws_end = current_cpu_data.scache.ways <<
253 current_cpu_data.scache.waybit;
254 unsigned long ws, addr;
255
256 for (ws = 0; ws < ws_end; ws += ws_inc)
257 for (addr = start; addr < end; addr += 0x200)
258 cache16_unroll32(addr|ws,Index_Writeback_Inv_SD);
259}
260
261static inline void blast_scache16_page(unsigned long page)
262{
263 unsigned long start = page;
264 unsigned long end = page + PAGE_SIZE;
265
266 do {
267 cache16_unroll32(start,Hit_Writeback_Inv_SD);
268 start += 0x200;
269 } while (start < end);
270}
271
272static inline void blast_scache16_page_indexed(unsigned long page)
273{
274 unsigned long start = page;
275 unsigned long end = start + PAGE_SIZE;
276 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
277 unsigned long ws_end = current_cpu_data.scache.ways <<
278 current_cpu_data.scache.waybit;
279 unsigned long ws, addr;
280
281 for (ws = 0; ws < ws_end; ws += ws_inc)
282 for (addr = start; addr < end; addr += 0x200)
283 cache16_unroll32(addr|ws,Index_Writeback_Inv_SD);
284}
285
286#define cache32_unroll32(base,op) \
287 __asm__ __volatile__( \
288 " .set noreorder \n" \
289 " .set mips3 \n" \
290 " cache %1, 0x000(%0); cache %1, 0x020(%0) \n" \
291 " cache %1, 0x040(%0); cache %1, 0x060(%0) \n" \
292 " cache %1, 0x080(%0); cache %1, 0x0a0(%0) \n" \
293 " cache %1, 0x0c0(%0); cache %1, 0x0e0(%0) \n" \
294 " cache %1, 0x100(%0); cache %1, 0x120(%0) \n" \
295 " cache %1, 0x140(%0); cache %1, 0x160(%0) \n" \
296 " cache %1, 0x180(%0); cache %1, 0x1a0(%0) \n" \
297 " cache %1, 0x1c0(%0); cache %1, 0x1e0(%0) \n" \
298 " cache %1, 0x200(%0); cache %1, 0x220(%0) \n" \
299 " cache %1, 0x240(%0); cache %1, 0x260(%0) \n" \
300 " cache %1, 0x280(%0); cache %1, 0x2a0(%0) \n" \
301 " cache %1, 0x2c0(%0); cache %1, 0x2e0(%0) \n" \
302 " cache %1, 0x300(%0); cache %1, 0x320(%0) \n" \
303 " cache %1, 0x340(%0); cache %1, 0x360(%0) \n" \
304 " cache %1, 0x380(%0); cache %1, 0x3a0(%0) \n" \
305 " cache %1, 0x3c0(%0); cache %1, 0x3e0(%0) \n" \
306 " .set mips0 \n" \
307 " .set reorder \n" \
308 : \
309 : "r" (base), \
310 "i" (op));
311
312static inline void blast_dcache32(void)
313{
314 unsigned long start = INDEX_BASE;
315 unsigned long end = start + current_cpu_data.dcache.waysize;
316 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
317 unsigned long ws_end = current_cpu_data.dcache.ways <<
318 current_cpu_data.dcache.waybit;
319 unsigned long ws, addr;
320
321 for (ws = 0; ws < ws_end; ws += ws_inc)
322 for (addr = start; addr < end; addr += 0x400)
323 cache32_unroll32(addr|ws,Index_Writeback_Inv_D);
324}
325
326static inline void blast_dcache32_page(unsigned long page)
327{
328 unsigned long start = page;
329 unsigned long end = start + PAGE_SIZE;
330
331 do {
332 cache32_unroll32(start,Hit_Writeback_Inv_D);
333 start += 0x400;
334 } while (start < end);
335}
336
337static inline void blast_dcache32_page_indexed(unsigned long page)
338{
339 unsigned long start = page;
340 unsigned long end = start + PAGE_SIZE;
341 unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
342 unsigned long ws_end = current_cpu_data.dcache.ways <<
343 current_cpu_data.dcache.waybit;
344 unsigned long ws, addr;
345
346 for (ws = 0; ws < ws_end; ws += ws_inc)
347 for (addr = start; addr < end; addr += 0x400)
348 cache32_unroll32(addr|ws,Index_Writeback_Inv_D);
349}
350
351static inline void blast_icache32(void)
352{
353 unsigned long start = INDEX_BASE;
354 unsigned long end = start + current_cpu_data.icache.waysize;
355 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
356 unsigned long ws_end = current_cpu_data.icache.ways <<
357 current_cpu_data.icache.waybit;
358 unsigned long ws, addr;
359
360 for (ws = 0; ws < ws_end; ws += ws_inc)
361 for (addr = start; addr < end; addr += 0x400)
362 cache32_unroll32(addr|ws,Index_Invalidate_I);
363}
364
365static inline void blast_icache32_page(unsigned long page)
366{
367 unsigned long start = page;
368 unsigned long end = start + PAGE_SIZE;
369
370 do {
371 cache32_unroll32(start,Hit_Invalidate_I);
372 start += 0x400;
373 } while (start < end);
374}
375
376static inline void blast_icache32_page_indexed(unsigned long page)
377{
378 unsigned long start = page;
379 unsigned long end = start + PAGE_SIZE;
380 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
381 unsigned long ws_end = current_cpu_data.icache.ways <<
382 current_cpu_data.icache.waybit;
383 unsigned long ws, addr;
384
385 for (ws = 0; ws < ws_end; ws += ws_inc)
386 for (addr = start; addr < end; addr += 0x400)
387 cache32_unroll32(addr|ws,Index_Invalidate_I);
388}
389
390static inline void blast_scache32(void)
391{
392 unsigned long start = INDEX_BASE;
393 unsigned long end = start + current_cpu_data.scache.waysize;
394 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
395 unsigned long ws_end = current_cpu_data.scache.ways <<
396 current_cpu_data.scache.waybit;
397 unsigned long ws, addr;
398
399 for (ws = 0; ws < ws_end; ws += ws_inc)
400 for (addr = start; addr < end; addr += 0x400)
401 cache32_unroll32(addr|ws,Index_Writeback_Inv_SD);
402}
403
404static inline void blast_scache32_page(unsigned long page)
405{
406 unsigned long start = page;
407 unsigned long end = page + PAGE_SIZE;
408
409 do {
410 cache32_unroll32(start,Hit_Writeback_Inv_SD);
411 start += 0x400;
412 } while (start < end);
413}
414
415static inline void blast_scache32_page_indexed(unsigned long page)
416{
417 unsigned long start = page;
418 unsigned long end = start + PAGE_SIZE;
419 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
420 unsigned long ws_end = current_cpu_data.scache.ways <<
421 current_cpu_data.scache.waybit;
422 unsigned long ws, addr;
423
424 for (ws = 0; ws < ws_end; ws += ws_inc)
425 for (addr = start; addr < end; addr += 0x400)
426 cache32_unroll32(addr|ws,Index_Writeback_Inv_SD);
427}
428
429#define cache64_unroll32(base,op) \
430 __asm__ __volatile__( \
431 " .set noreorder \n" \
432 " .set mips3 \n" \
433 " cache %1, 0x000(%0); cache %1, 0x040(%0) \n" \
434 " cache %1, 0x080(%0); cache %1, 0x0c0(%0) \n" \
435 " cache %1, 0x100(%0); cache %1, 0x140(%0) \n" \
436 " cache %1, 0x180(%0); cache %1, 0x1c0(%0) \n" \
437 " cache %1, 0x200(%0); cache %1, 0x240(%0) \n" \
438 " cache %1, 0x280(%0); cache %1, 0x2c0(%0) \n" \
439 " cache %1, 0x300(%0); cache %1, 0x340(%0) \n" \
440 " cache %1, 0x380(%0); cache %1, 0x3c0(%0) \n" \
441 " cache %1, 0x400(%0); cache %1, 0x440(%0) \n" \
442 " cache %1, 0x480(%0); cache %1, 0x4c0(%0) \n" \
443 " cache %1, 0x500(%0); cache %1, 0x540(%0) \n" \
444 " cache %1, 0x580(%0); cache %1, 0x5c0(%0) \n" \
445 " cache %1, 0x600(%0); cache %1, 0x640(%0) \n" \
446 " cache %1, 0x680(%0); cache %1, 0x6c0(%0) \n" \
447 " cache %1, 0x700(%0); cache %1, 0x740(%0) \n" \
448 " cache %1, 0x780(%0); cache %1, 0x7c0(%0) \n" \
449 " .set mips0 \n" \
450 " .set reorder \n" \
451 : \
452 : "r" (base), \
453 "i" (op));
454
455static inline void blast_icache64(void)
456{
457 unsigned long start = INDEX_BASE;
458 unsigned long end = start + current_cpu_data.icache.waysize;
459 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
460 unsigned long ws_end = current_cpu_data.icache.ways <<
461 current_cpu_data.icache.waybit;
462 unsigned long ws, addr;
463
464 for (ws = 0; ws < ws_end; ws += ws_inc)
465 for (addr = start; addr < end; addr += 0x800)
466 cache64_unroll32(addr|ws,Index_Invalidate_I);
467}
468
469static inline void blast_icache64_page(unsigned long page)
470{
471 unsigned long start = page;
472 unsigned long end = start + PAGE_SIZE;
473
474 do {
475 cache64_unroll32(start,Hit_Invalidate_I);
476 start += 0x800;
477 } while (start < end);
478}
479
480static inline void blast_icache64_page_indexed(unsigned long page)
481{
482 unsigned long start = page;
483 unsigned long end = start + PAGE_SIZE;
484 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
485 unsigned long ws_end = current_cpu_data.icache.ways <<
486 current_cpu_data.icache.waybit;
487 unsigned long ws, addr;
488
489 for (ws = 0; ws < ws_end; ws += ws_inc)
490 for (addr = start; addr < end; addr += 0x800)
491 cache64_unroll32(addr|ws,Index_Invalidate_I);
492}
493
494static inline void blast_scache64(void)
495{
496 unsigned long start = INDEX_BASE;
497 unsigned long end = start + current_cpu_data.scache.waysize;
498 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
499 unsigned long ws_end = current_cpu_data.scache.ways <<
500 current_cpu_data.scache.waybit;
501 unsigned long ws, addr;
502
503 for (ws = 0; ws < ws_end; ws += ws_inc)
504 for (addr = start; addr < end; addr += 0x800)
505 cache64_unroll32(addr|ws,Index_Writeback_Inv_SD);
506}
507
508static inline void blast_scache64_page(unsigned long page)
509{
510 unsigned long start = page;
511 unsigned long end = page + PAGE_SIZE;
512
513 do {
514 cache64_unroll32(start,Hit_Writeback_Inv_SD);
515 start += 0x800;
516 } while (start < end);
517}
518
519static inline void blast_scache64_page_indexed(unsigned long page)
520{
521 unsigned long start = page;
522 unsigned long end = start + PAGE_SIZE;
523 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
524 unsigned long ws_end = current_cpu_data.scache.ways <<
525 current_cpu_data.scache.waybit;
526 unsigned long ws, addr;
527
528 for (ws = 0; ws < ws_end; ws += ws_inc)
529 for (addr = start; addr < end; addr += 0x800)
530 cache64_unroll32(addr|ws,Index_Writeback_Inv_SD);
531}
532
533#define cache128_unroll32(base,op) \
534 __asm__ __volatile__( \
535 " .set noreorder \n" \
536 " .set mips3 \n" \
537 " cache %1, 0x000(%0); cache %1, 0x080(%0) \n" \
538 " cache %1, 0x100(%0); cache %1, 0x180(%0) \n" \
539 " cache %1, 0x200(%0); cache %1, 0x280(%0) \n" \
540 " cache %1, 0x300(%0); cache %1, 0x380(%0) \n" \
541 " cache %1, 0x400(%0); cache %1, 0x480(%0) \n" \
542 " cache %1, 0x500(%0); cache %1, 0x580(%0) \n" \
543 " cache %1, 0x600(%0); cache %1, 0x680(%0) \n" \
544 " cache %1, 0x700(%0); cache %1, 0x780(%0) \n" \
545 " cache %1, 0x800(%0); cache %1, 0x880(%0) \n" \
546 " cache %1, 0x900(%0); cache %1, 0x980(%0) \n" \
547 " cache %1, 0xa00(%0); cache %1, 0xa80(%0) \n" \
548 " cache %1, 0xb00(%0); cache %1, 0xb80(%0) \n" \
549 " cache %1, 0xc00(%0); cache %1, 0xc80(%0) \n" \
550 " cache %1, 0xd00(%0); cache %1, 0xd80(%0) \n" \
551 " cache %1, 0xe00(%0); cache %1, 0xe80(%0) \n" \
552 " cache %1, 0xf00(%0); cache %1, 0xf80(%0) \n" \
553 " .set mips0 \n" \
554 " .set reorder \n" \
555 : \
556 : "r" (base), \
557 "i" (op));
558
559static inline void blast_scache128(void)
560{
561 unsigned long start = INDEX_BASE;
562 unsigned long end = start + current_cpu_data.scache.waysize;
563 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
564 unsigned long ws_end = current_cpu_data.scache.ways <<
565 current_cpu_data.scache.waybit;
566 unsigned long ws, addr;
567
568 for (ws = 0; ws < ws_end; ws += ws_inc)
569 for (addr = start; addr < end; addr += 0x1000)
570 cache128_unroll32(addr|ws,Index_Writeback_Inv_SD);
571}
572
573static inline void blast_scache128_page(unsigned long page)
574{
575 unsigned long start = page;
576 unsigned long end = page + PAGE_SIZE;
577
578 do {
579 cache128_unroll32(start,Hit_Writeback_Inv_SD);
580 start += 0x1000;
581 } while (start < end);
582}
583
584static inline void blast_scache128_page_indexed(unsigned long page)
585{
586 unsigned long start = page;
587 unsigned long end = start + PAGE_SIZE;
588 unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit;
589 unsigned long ws_end = current_cpu_data.scache.ways <<
590 current_cpu_data.scache.waybit;
591 unsigned long ws, addr;
592
593 for (ws = 0; ws < ws_end; ws += ws_inc)
594 for (addr = start; addr < end; addr += 0x1000)
595 cache128_unroll32(addr|ws,Index_Writeback_Inv_SD);
596}
597
598#endif /* _ASM_R4KCACHE_H */
diff --git a/include/asm-mips/reboot.h b/include/asm-mips/reboot.h
new file mode 100644
index 000000000000..2f10ebcbe141
--- /dev/null
+++ b/include/asm-mips/reboot.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1997, 1999, 2001 by Ralf Baechle
7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 */
9#ifndef _ASM_REBOOT_H
10#define _ASM_REBOOT_H
11
12extern void (*_machine_restart)(char *command);
13extern void (*_machine_halt)(void);
14extern void (*_machine_power_off)(void);
15
16#endif /* _ASM_REBOOT_H */
diff --git a/include/asm-mips/reg.h b/include/asm-mips/reg.h
new file mode 100644
index 000000000000..7b33bbca9585
--- /dev/null
+++ b/include/asm-mips/reg.h
@@ -0,0 +1,129 @@
1/*
2 * Various register offset definitions for debuggers, core file
3 * examiners and whatnot.
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *
9 * Copyright (C) 1995, 1999 Ralf Baechle
10 * Copyright (C) 1995, 1999 Silicon Graphics
11 */
12#ifndef __ASM_MIPS_REG_H
13#define __ASM_MIPS_REG_H
14
15#include <linux/config.h>
16
17#if defined(CONFIG_MIPS32) || defined(WANT_COMPAT_REG_H)
18
19#define EF_R0 6
20#define EF_R1 7
21#define EF_R2 8
22#define EF_R3 9
23#define EF_R4 10
24#define EF_R5 11
25#define EF_R6 12
26#define EF_R7 13
27#define EF_R8 14
28#define EF_R9 15
29#define EF_R10 16
30#define EF_R11 17
31#define EF_R12 18
32#define EF_R13 19
33#define EF_R14 20
34#define EF_R15 21
35#define EF_R16 22
36#define EF_R17 23
37#define EF_R18 24
38#define EF_R19 25
39#define EF_R20 26
40#define EF_R21 27
41#define EF_R22 28
42#define EF_R23 29
43#define EF_R24 30
44#define EF_R25 31
45
46/*
47 * k0/k1 unsaved
48 */
49#define EF_R26 32
50#define EF_R27 33
51
52#define EF_R28 34
53#define EF_R29 35
54#define EF_R30 36
55#define EF_R31 37
56
57/*
58 * Saved special registers
59 */
60#define EF_LO 38
61#define EF_HI 39
62
63#define EF_CP0_EPC 40
64#define EF_CP0_BADVADDR 41
65#define EF_CP0_STATUS 42
66#define EF_CP0_CAUSE 43
67#define EF_UNUSED0 44
68
69#define EF_SIZE 180
70
71#endif
72
73#if CONFIG_MIPS64
74
75#define EF_R0 0
76#define EF_R1 1
77#define EF_R2 2
78#define EF_R3 3
79#define EF_R4 4
80#define EF_R5 5
81#define EF_R6 6
82#define EF_R7 7
83#define EF_R8 8
84#define EF_R9 9
85#define EF_R10 10
86#define EF_R11 11
87#define EF_R12 12
88#define EF_R13 13
89#define EF_R14 14
90#define EF_R15 15
91#define EF_R16 16
92#define EF_R17 17
93#define EF_R18 18
94#define EF_R19 19
95#define EF_R20 20
96#define EF_R21 21
97#define EF_R22 22
98#define EF_R23 23
99#define EF_R24 24
100#define EF_R25 25
101
102/*
103 * k0/k1 unsaved
104 */
105#define EF_R26 26
106#define EF_R27 27
107
108
109#define EF_R28 28
110#define EF_R29 29
111#define EF_R30 30
112#define EF_R31 31
113
114/*
115 * Saved special registers
116 */
117#define EF_LO 32
118#define EF_HI 33
119
120#define EF_CP0_EPC 34
121#define EF_CP0_BADVADDR 35
122#define EF_CP0_STATUS 36
123#define EF_CP0_CAUSE 37
124
125#define EF_SIZE 304 /* size in bytes */
126
127#endif /* CONFIG_MIPS64 */
128
129#endif /* __ASM_MIPS_REG_H */
diff --git a/include/asm-mips/regdef.h b/include/asm-mips/regdef.h
new file mode 100644
index 000000000000..7c8ecb6b9c40
--- /dev/null
+++ b/include/asm-mips/regdef.h
@@ -0,0 +1,100 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1985 MIPS Computer Systems, Inc.
7 * Copyright (C) 1994, 95, 99, 2003 by Ralf Baechle
8 * Copyright (C) 1990 - 1992, 1999 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_REGDEF_H
11#define _ASM_REGDEF_H
12
13#include <asm/sgidefs.h>
14
15#if _MIPS_SIM == _MIPS_SIM_ABI32
16
17/*
18 * Symbolic register names for 32 bit ABI
19 */
20#define zero $0 /* wired zero */
21#define AT $1 /* assembler temp - uppercase because of ".set at" */
22#define v0 $2 /* return value */
23#define v1 $3
24#define a0 $4 /* argument registers */
25#define a1 $5
26#define a2 $6
27#define a3 $7
28#define t0 $8 /* caller saved */
29#define t1 $9
30#define t2 $10
31#define t3 $11
32#define t4 $12
33#define t5 $13
34#define t6 $14
35#define t7 $15
36#define s0 $16 /* callee saved */
37#define s1 $17
38#define s2 $18
39#define s3 $19
40#define s4 $20
41#define s5 $21
42#define s6 $22
43#define s7 $23
44#define t8 $24 /* caller saved */
45#define t9 $25
46#define jp $25 /* PIC jump register */
47#define k0 $26 /* kernel scratch */
48#define k1 $27
49#define gp $28 /* global pointer */
50#define sp $29 /* stack pointer */
51#define fp $30 /* frame pointer */
52#define s8 $30 /* same like fp! */
53#define ra $31 /* return address */
54
55#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
56
57#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
58
59#define zero $0 /* wired zero */
60#define AT $at /* assembler temp - uppercase because of ".set at" */
61#define v0 $2 /* return value - caller saved */
62#define v1 $3
63#define a0 $4 /* argument registers */
64#define a1 $5
65#define a2 $6
66#define a3 $7
67#define a4 $8 /* arg reg 64 bit; caller saved in 32 bit */
68#define ta0 $8
69#define a5 $9
70#define ta1 $9
71#define a6 $10
72#define ta2 $10
73#define a7 $11
74#define ta3 $11
75#define t0 $12 /* caller saved */
76#define t1 $13
77#define t2 $14
78#define t3 $15
79#define s0 $16 /* callee saved */
80#define s1 $17
81#define s2 $18
82#define s3 $19
83#define s4 $20
84#define s5 $21
85#define s6 $22
86#define s7 $23
87#define t8 $24 /* caller saved */
88#define t9 $25 /* callee address for PIC/temp */
89#define jp $25 /* PIC jump register */
90#define k0 $26 /* kernel temporary */
91#define k1 $27
92#define gp $28 /* global pointer - caller saved for PIC */
93#define sp $29 /* stack pointer */
94#define fp $30 /* frame pointer */
95#define s8 $30 /* callee saved */
96#define ra $31 /* return address */
97
98#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
99
100#endif /* _ASM_REGDEF_H */
diff --git a/include/asm-mips/resource.h b/include/asm-mips/resource.h
new file mode 100644
index 000000000000..fd3c6d17a5f6
--- /dev/null
+++ b/include/asm-mips/resource.h
@@ -0,0 +1,36 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 96, 98, 99, 2000 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_RESOURCE_H
10#define _ASM_RESOURCE_H
11
12#include <linux/config.h>
13
14/*
15 * These five resource limit IDs have a MIPS/Linux-specific ordering,
16 * the rest comes from the generic header:
17 */
18#define RLIMIT_NOFILE 5 /* max number of open files */
19#define RLIMIT_AS 6 /* address space limit */
20#define RLIMIT_RSS 7 /* max resident set size */
21#define RLIMIT_NPROC 8 /* max number of processes */
22#define RLIMIT_MEMLOCK 9 /* max locked-in-memory address space */
23
24/*
25 * SuS says limits have to be unsigned.
26 * Which makes a ton more sense anyway,
27 * but we keep the old value on MIPS32,
28 * for compatibility:
29 */
30#ifdef CONFIG_MIPS32
31# define RLIM_INFINITY 0x7fffffffUL
32#endif
33
34#include <asm-generic/resource.h>
35
36#endif /* _ASM_RESOURCE_H */
diff --git a/include/asm-mips/riscos-syscall.h b/include/asm-mips/riscos-syscall.h
new file mode 100644
index 000000000000..4d8eb15461eb
--- /dev/null
+++ b/include/asm-mips/riscos-syscall.h
@@ -0,0 +1,979 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle
7 */
8#ifndef _ASM_RISCOS_SYSCALL_H
9#define _ASM_RISCOS_SYSCALL_H
10
11/*
12 * The syscalls 0 - 3999 are reserved for a down to the root syscall
13 * compatibility with RISC/os and IRIX. We'll see how to deal with the
14 * various "real" BSD variants like Ultrix, NetBSD ...
15 */
16
17/*
18 * SVR4 syscalls are in the range from 1 to 999
19 */
20#define __NR_SVR4 0
21#define __NR_SVR4_syscall (__NR_SVR4 + 0)
22#define __NR_SVR4_exit (__NR_SVR4 + 1)
23#define __NR_SVR4_fork (__NR_SVR4 + 2)
24#define __NR_SVR4_read (__NR_SVR4 + 3)
25#define __NR_SVR4_write (__NR_SVR4 + 4)
26#define __NR_SVR4_open (__NR_SVR4 + 5)
27#define __NR_SVR4_close (__NR_SVR4 + 6)
28#define __NR_SVR4_wait (__NR_SVR4 + 7)
29#define __NR_SVR4_creat (__NR_SVR4 + 8)
30#define __NR_SVR4_link (__NR_SVR4 + 9)
31#define __NR_SVR4_unlink (__NR_SVR4 + 10)
32#define __NR_SVR4_exec (__NR_SVR4 + 11)
33#define __NR_SVR4_chdir (__NR_SVR4 + 12)
34#define __NR_SVR4_gtime (__NR_SVR4 + 13)
35#define __NR_SVR4_mknod (__NR_SVR4 + 14)
36#define __NR_SVR4_chmod (__NR_SVR4 + 15)
37#define __NR_SVR4_chown (__NR_SVR4 + 16)
38#define __NR_SVR4_sbreak (__NR_SVR4 + 17)
39#define __NR_SVR4_stat (__NR_SVR4 + 18)
40#define __NR_SVR4_lseek (__NR_SVR4 + 19)
41#define __NR_SVR4_getpid (__NR_SVR4 + 20)
42#define __NR_SVR4_mount (__NR_SVR4 + 21)
43#define __NR_SVR4_umount (__NR_SVR4 + 22)
44#define __NR_SVR4_setuid (__NR_SVR4 + 23)
45#define __NR_SVR4_getuid (__NR_SVR4 + 24)
46#define __NR_SVR4_stime (__NR_SVR4 + 25)
47#define __NR_SVR4_ptrace (__NR_SVR4 + 26)
48#define __NR_SVR4_alarm (__NR_SVR4 + 27)
49#define __NR_SVR4_fstat (__NR_SVR4 + 28)
50#define __NR_SVR4_pause (__NR_SVR4 + 29)
51#define __NR_SVR4_utime (__NR_SVR4 + 30)
52#define __NR_SVR4_stty (__NR_SVR4 + 31)
53#define __NR_SVR4_gtty (__NR_SVR4 + 32)
54#define __NR_SVR4_access (__NR_SVR4 + 33)
55#define __NR_SVR4_nice (__NR_SVR4 + 34)
56#define __NR_SVR4_statfs (__NR_SVR4 + 35)
57#define __NR_SVR4_sync (__NR_SVR4 + 36)
58#define __NR_SVR4_kill (__NR_SVR4 + 37)
59#define __NR_SVR4_fstatfs (__NR_SVR4 + 38)
60#define __NR_SVR4_setpgrp (__NR_SVR4 + 39)
61#define __NR_SVR4_cxenix (__NR_SVR4 + 40)
62#define __NR_SVR4_dup (__NR_SVR4 + 41)
63#define __NR_SVR4_pipe (__NR_SVR4 + 42)
64#define __NR_SVR4_times (__NR_SVR4 + 43)
65#define __NR_SVR4_profil (__NR_SVR4 + 44)
66#define __NR_SVR4_plock (__NR_SVR4 + 45)
67#define __NR_SVR4_setgid (__NR_SVR4 + 46)
68#define __NR_SVR4_getgid (__NR_SVR4 + 47)
69#define __NR_SVR4_sig (__NR_SVR4 + 48)
70#define __NR_SVR4_msgsys (__NR_SVR4 + 49)
71#define __NR_SVR4_sysmips (__NR_SVR4 + 50)
72#define __NR_SVR4_sysacct (__NR_SVR4 + 51)
73#define __NR_SVR4_shmsys (__NR_SVR4 + 52)
74#define __NR_SVR4_semsys (__NR_SVR4 + 53)
75#define __NR_SVR4_ioctl (__NR_SVR4 + 54)
76#define __NR_SVR4_uadmin (__NR_SVR4 + 55)
77#define __NR_SVR4_exch (__NR_SVR4 + 56)
78#define __NR_SVR4_utssys (__NR_SVR4 + 57)
79#define __NR_SVR4_fsync (__NR_SVR4 + 58)
80#define __NR_SVR4_exece (__NR_SVR4 + 59)
81#define __NR_SVR4_umask (__NR_SVR4 + 60)
82#define __NR_SVR4_chroot (__NR_SVR4 + 61)
83#define __NR_SVR4_fcntl (__NR_SVR4 + 62)
84#define __NR_SVR4_ulimit (__NR_SVR4 + 63)
85#define __NR_SVR4_reserved1 (__NR_SVR4 + 64)
86#define __NR_SVR4_reserved2 (__NR_SVR4 + 65)
87#define __NR_SVR4_reserved3 (__NR_SVR4 + 66)
88#define __NR_SVR4_reserved4 (__NR_SVR4 + 67)
89#define __NR_SVR4_reserved5 (__NR_SVR4 + 68)
90#define __NR_SVR4_reserved6 (__NR_SVR4 + 69)
91#define __NR_SVR4_advfs (__NR_SVR4 + 70)
92#define __NR_SVR4_unadvfs (__NR_SVR4 + 71)
93#define __NR_SVR4_unused1 (__NR_SVR4 + 72)
94#define __NR_SVR4_unused2 (__NR_SVR4 + 73)
95#define __NR_SVR4_rfstart (__NR_SVR4 + 74)
96#define __NR_SVR4_unused3 (__NR_SVR4 + 75)
97#define __NR_SVR4_rdebug (__NR_SVR4 + 76)
98#define __NR_SVR4_rfstop (__NR_SVR4 + 77)
99#define __NR_SVR4_rfsys (__NR_SVR4 + 78)
100#define __NR_SVR4_rmdir (__NR_SVR4 + 79)
101#define __NR_SVR4_mkdir (__NR_SVR4 + 80)
102#define __NR_SVR4_getdents (__NR_SVR4 + 81)
103#define __NR_SVR4_libattach (__NR_SVR4 + 82)
104#define __NR_SVR4_libdetach (__NR_SVR4 + 83)
105#define __NR_SVR4_sysfs (__NR_SVR4 + 84)
106#define __NR_SVR4_getmsg (__NR_SVR4 + 85)
107#define __NR_SVR4_putmsg (__NR_SVR4 + 86)
108#define __NR_SVR4_poll (__NR_SVR4 + 87)
109#define __NR_SVR4_lstat (__NR_SVR4 + 88)
110#define __NR_SVR4_symlink (__NR_SVR4 + 89)
111#define __NR_SVR4_readlink (__NR_SVR4 + 90)
112#define __NR_SVR4_setgroups (__NR_SVR4 + 91)
113#define __NR_SVR4_getgroups (__NR_SVR4 + 92)
114#define __NR_SVR4_fchmod (__NR_SVR4 + 93)
115#define __NR_SVR4_fchown (__NR_SVR4 + 94)
116#define __NR_SVR4_sigprocmask (__NR_SVR4 + 95)
117#define __NR_SVR4_sigsuspend (__NR_SVR4 + 96)
118#define __NR_SVR4_sigaltstack (__NR_SVR4 + 97)
119#define __NR_SVR4_sigaction (__NR_SVR4 + 98)
120#define __NR_SVR4_sigpending (__NR_SVR4 + 99)
121#define __NR_SVR4_setcontext (__NR_SVR4 + 100)
122#define __NR_SVR4_evsys (__NR_SVR4 + 101)
123#define __NR_SVR4_evtrapret (__NR_SVR4 + 102)
124#define __NR_SVR4_statvfs (__NR_SVR4 + 103)
125#define __NR_SVR4_fstatvfs (__NR_SVR4 + 104)
126#define __NR_SVR4_reserved7 (__NR_SVR4 + 105)
127#define __NR_SVR4_nfssys (__NR_SVR4 + 106)
128#define __NR_SVR4_waitid (__NR_SVR4 + 107)
129#define __NR_SVR4_sigsendset (__NR_SVR4 + 108)
130#define __NR_SVR4_hrtsys (__NR_SVR4 + 109)
131#define __NR_SVR4_acancel (__NR_SVR4 + 110)
132#define __NR_SVR4_async (__NR_SVR4 + 111)
133#define __NR_SVR4_priocntlset (__NR_SVR4 + 112)
134#define __NR_SVR4_pathconf (__NR_SVR4 + 113)
135#define __NR_SVR4_mincore (__NR_SVR4 + 114)
136#define __NR_SVR4_mmap (__NR_SVR4 + 115)
137#define __NR_SVR4_mprotect (__NR_SVR4 + 116)
138#define __NR_SVR4_munmap (__NR_SVR4 + 117)
139#define __NR_SVR4_fpathconf (__NR_SVR4 + 118)
140#define __NR_SVR4_vfork (__NR_SVR4 + 119)
141#define __NR_SVR4_fchdir (__NR_SVR4 + 120)
142#define __NR_SVR4_readv (__NR_SVR4 + 121)
143#define __NR_SVR4_writev (__NR_SVR4 + 122)
144#define __NR_SVR4_xstat (__NR_SVR4 + 123)
145#define __NR_SVR4_lxstat (__NR_SVR4 + 124)
146#define __NR_SVR4_fxstat (__NR_SVR4 + 125)
147#define __NR_SVR4_xmknod (__NR_SVR4 + 126)
148#define __NR_SVR4_clocal (__NR_SVR4 + 127)
149#define __NR_SVR4_setrlimit (__NR_SVR4 + 128)
150#define __NR_SVR4_getrlimit (__NR_SVR4 + 129)
151#define __NR_SVR4_lchown (__NR_SVR4 + 130)
152#define __NR_SVR4_memcntl (__NR_SVR4 + 131)
153#define __NR_SVR4_getpmsg (__NR_SVR4 + 132)
154#define __NR_SVR4_putpmsg (__NR_SVR4 + 133)
155#define __NR_SVR4_rename (__NR_SVR4 + 134)
156#define __NR_SVR4_nuname (__NR_SVR4 + 135)
157#define __NR_SVR4_setegid (__NR_SVR4 + 136)
158#define __NR_SVR4_sysconf (__NR_SVR4 + 137)
159#define __NR_SVR4_adjtime (__NR_SVR4 + 138)
160#define __NR_SVR4_sysinfo (__NR_SVR4 + 139)
161#define __NR_SVR4_reserved8 (__NR_SVR4 + 140)
162#define __NR_SVR4_seteuid (__NR_SVR4 + 141)
163#define __NR_SVR4_PYRAMID_statis (__NR_SVR4 + 142)
164#define __NR_SVR4_PYRAMID_tuning (__NR_SVR4 + 143)
165#define __NR_SVR4_PYRAMID_forcerr (__NR_SVR4 + 144)
166#define __NR_SVR4_PYRAMID_mpcntl (__NR_SVR4 + 145)
167#define __NR_SVR4_reserved9 (__NR_SVR4 + 146)
168#define __NR_SVR4_reserved10 (__NR_SVR4 + 147)
169#define __NR_SVR4_reserved11 (__NR_SVR4 + 148)
170#define __NR_SVR4_reserved12 (__NR_SVR4 + 149)
171#define __NR_SVR4_reserved13 (__NR_SVR4 + 150)
172#define __NR_SVR4_reserved14 (__NR_SVR4 + 151)
173#define __NR_SVR4_reserved15 (__NR_SVR4 + 152)
174#define __NR_SVR4_reserved16 (__NR_SVR4 + 153)
175#define __NR_SVR4_reserved17 (__NR_SVR4 + 154)
176#define __NR_SVR4_reserved18 (__NR_SVR4 + 155)
177#define __NR_SVR4_reserved19 (__NR_SVR4 + 156)
178#define __NR_SVR4_reserved20 (__NR_SVR4 + 157)
179#define __NR_SVR4_reserved21 (__NR_SVR4 + 158)
180#define __NR_SVR4_reserved22 (__NR_SVR4 + 159)
181#define __NR_SVR4_reserved23 (__NR_SVR4 + 160)
182#define __NR_SVR4_reserved24 (__NR_SVR4 + 161)
183#define __NR_SVR4_reserved25 (__NR_SVR4 + 162)
184#define __NR_SVR4_reserved26 (__NR_SVR4 + 163)
185#define __NR_SVR4_reserved27 (__NR_SVR4 + 164)
186#define __NR_SVR4_reserved28 (__NR_SVR4 + 165)
187#define __NR_SVR4_reserved29 (__NR_SVR4 + 166)
188#define __NR_SVR4_reserved30 (__NR_SVR4 + 167)
189#define __NR_SVR4_reserved31 (__NR_SVR4 + 168)
190#define __NR_SVR4_reserved32 (__NR_SVR4 + 169)
191#define __NR_SVR4_reserved33 (__NR_SVR4 + 170)
192#define __NR_SVR4_reserved34 (__NR_SVR4 + 171)
193#define __NR_SVR4_reserved35 (__NR_SVR4 + 172)
194#define __NR_SVR4_reserved36 (__NR_SVR4 + 173)
195#define __NR_SVR4_reserved37 (__NR_SVR4 + 174)
196#define __NR_SVR4_reserved38 (__NR_SVR4 + 175)
197#define __NR_SVR4_reserved39 (__NR_SVR4 + 176)
198#define __NR_SVR4_reserved40 (__NR_SVR4 + 177)
199#define __NR_SVR4_reserved41 (__NR_SVR4 + 178)
200#define __NR_SVR4_reserved42 (__NR_SVR4 + 179)
201#define __NR_SVR4_reserved43 (__NR_SVR4 + 180)
202#define __NR_SVR4_reserved44 (__NR_SVR4 + 181)
203#define __NR_SVR4_reserved45 (__NR_SVR4 + 182)
204#define __NR_SVR4_reserved46 (__NR_SVR4 + 183)
205#define __NR_SVR4_reserved47 (__NR_SVR4 + 184)
206#define __NR_SVR4_reserved48 (__NR_SVR4 + 185)
207#define __NR_SVR4_reserved49 (__NR_SVR4 + 186)
208#define __NR_SVR4_reserved50 (__NR_SVR4 + 187)
209#define __NR_SVR4_reserved51 (__NR_SVR4 + 188)
210#define __NR_SVR4_reserved52 (__NR_SVR4 + 189)
211#define __NR_SVR4_reserved53 (__NR_SVR4 + 190)
212#define __NR_SVR4_reserved54 (__NR_SVR4 + 191)
213#define __NR_SVR4_reserved55 (__NR_SVR4 + 192)
214#define __NR_SVR4_reserved56 (__NR_SVR4 + 193)
215#define __NR_SVR4_reserved57 (__NR_SVR4 + 194)
216#define __NR_SVR4_reserved58 (__NR_SVR4 + 195)
217#define __NR_SVR4_reserved59 (__NR_SVR4 + 196)
218#define __NR_SVR4_reserved60 (__NR_SVR4 + 197)
219#define __NR_SVR4_reserved61 (__NR_SVR4 + 198)
220#define __NR_SVR4_reserved62 (__NR_SVR4 + 199)
221#define __NR_SVR4_reserved63 (__NR_SVR4 + 200)
222#define __NR_SVR4_aread (__NR_SVR4 + 201)
223#define __NR_SVR4_awrite (__NR_SVR4 + 202)
224#define __NR_SVR4_listio (__NR_SVR4 + 203)
225#define __NR_SVR4_mips_acancel (__NR_SVR4 + 204)
226#define __NR_SVR4_astatus (__NR_SVR4 + 205)
227#define __NR_SVR4_await (__NR_SVR4 + 206)
228#define __NR_SVR4_areadv (__NR_SVR4 + 207)
229#define __NR_SVR4_awritev (__NR_SVR4 + 208)
230#define __NR_SVR4_MIPS_reserved1 (__NR_SVR4 + 209)
231#define __NR_SVR4_MIPS_reserved2 (__NR_SVR4 + 210)
232#define __NR_SVR4_MIPS_reserved3 (__NR_SVR4 + 211)
233#define __NR_SVR4_MIPS_reserved4 (__NR_SVR4 + 212)
234#define __NR_SVR4_MIPS_reserved5 (__NR_SVR4 + 213)
235#define __NR_SVR4_MIPS_reserved6 (__NR_SVR4 + 214)
236#define __NR_SVR4_MIPS_reserved7 (__NR_SVR4 + 215)
237#define __NR_SVR4_MIPS_reserved8 (__NR_SVR4 + 216)
238#define __NR_SVR4_MIPS_reserved9 (__NR_SVR4 + 217)
239#define __NR_SVR4_MIPS_reserved10 (__NR_SVR4 + 218)
240#define __NR_SVR4_MIPS_reserved11 (__NR_SVR4 + 219)
241#define __NR_SVR4_MIPS_reserved12 (__NR_SVR4 + 220)
242#define __NR_SVR4_CDC_reserved1 (__NR_SVR4 + 221)
243#define __NR_SVR4_CDC_reserved2 (__NR_SVR4 + 222)
244#define __NR_SVR4_CDC_reserved3 (__NR_SVR4 + 223)
245#define __NR_SVR4_CDC_reserved4 (__NR_SVR4 + 224)
246#define __NR_SVR4_CDC_reserved5 (__NR_SVR4 + 225)
247#define __NR_SVR4_CDC_reserved6 (__NR_SVR4 + 226)
248#define __NR_SVR4_CDC_reserved7 (__NR_SVR4 + 227)
249#define __NR_SVR4_CDC_reserved8 (__NR_SVR4 + 228)
250#define __NR_SVR4_CDC_reserved9 (__NR_SVR4 + 229)
251#define __NR_SVR4_CDC_reserved10 (__NR_SVR4 + 230)
252#define __NR_SVR4_CDC_reserved11 (__NR_SVR4 + 231)
253#define __NR_SVR4_CDC_reserved12 (__NR_SVR4 + 232)
254#define __NR_SVR4_CDC_reserved13 (__NR_SVR4 + 233)
255#define __NR_SVR4_CDC_reserved14 (__NR_SVR4 + 234)
256#define __NR_SVR4_CDC_reserved15 (__NR_SVR4 + 235)
257#define __NR_SVR4_CDC_reserved16 (__NR_SVR4 + 236)
258#define __NR_SVR4_CDC_reserved17 (__NR_SVR4 + 237)
259#define __NR_SVR4_CDC_reserved18 (__NR_SVR4 + 238)
260#define __NR_SVR4_CDC_reserved19 (__NR_SVR4 + 239)
261#define __NR_SVR4_CDC_reserved20 (__NR_SVR4 + 240)
262
263/*
264 * SYS V syscalls are in the range from 1000 to 1999
265 */
266#define __NR_SYSV 1000
267#define __NR_SYSV_syscall (__NR_SYSV + 0)
268#define __NR_SYSV_exit (__NR_SYSV + 1)
269#define __NR_SYSV_fork (__NR_SYSV + 2)
270#define __NR_SYSV_read (__NR_SYSV + 3)
271#define __NR_SYSV_write (__NR_SYSV + 4)
272#define __NR_SYSV_open (__NR_SYSV + 5)
273#define __NR_SYSV_close (__NR_SYSV + 6)
274#define __NR_SYSV_wait (__NR_SYSV + 7)
275#define __NR_SYSV_creat (__NR_SYSV + 8)
276#define __NR_SYSV_link (__NR_SYSV + 9)
277#define __NR_SYSV_unlink (__NR_SYSV + 10)
278#define __NR_SYSV_execv (__NR_SYSV + 11)
279#define __NR_SYSV_chdir (__NR_SYSV + 12)
280#define __NR_SYSV_time (__NR_SYSV + 13)
281#define __NR_SYSV_mknod (__NR_SYSV + 14)
282#define __NR_SYSV_chmod (__NR_SYSV + 15)
283#define __NR_SYSV_chown (__NR_SYSV + 16)
284#define __NR_SYSV_brk (__NR_SYSV + 17)
285#define __NR_SYSV_stat (__NR_SYSV + 18)
286#define __NR_SYSV_lseek (__NR_SYSV + 19)
287#define __NR_SYSV_getpid (__NR_SYSV + 20)
288#define __NR_SYSV_mount (__NR_SYSV + 21)
289#define __NR_SYSV_umount (__NR_SYSV + 22)
290#define __NR_SYSV_setuid (__NR_SYSV + 23)
291#define __NR_SYSV_getuid (__NR_SYSV + 24)
292#define __NR_SYSV_stime (__NR_SYSV + 25)
293#define __NR_SYSV_ptrace (__NR_SYSV + 26)
294#define __NR_SYSV_alarm (__NR_SYSV + 27)
295#define __NR_SYSV_fstat (__NR_SYSV + 28)
296#define __NR_SYSV_pause (__NR_SYSV + 29)
297#define __NR_SYSV_utime (__NR_SYSV + 30)
298#define __NR_SYSV_stty (__NR_SYSV + 31)
299#define __NR_SYSV_gtty (__NR_SYSV + 32)
300#define __NR_SYSV_access (__NR_SYSV + 33)
301#define __NR_SYSV_nice (__NR_SYSV + 34)
302#define __NR_SYSV_statfs (__NR_SYSV + 35)
303#define __NR_SYSV_sync (__NR_SYSV + 36)
304#define __NR_SYSV_kill (__NR_SYSV + 37)
305#define __NR_SYSV_fstatfs (__NR_SYSV + 38)
306#define __NR_SYSV_setpgrp (__NR_SYSV + 39)
307#define __NR_SYSV_syssgi (__NR_SYSV + 40)
308#define __NR_SYSV_dup (__NR_SYSV + 41)
309#define __NR_SYSV_pipe (__NR_SYSV + 42)
310#define __NR_SYSV_times (__NR_SYSV + 43)
311#define __NR_SYSV_profil (__NR_SYSV + 44)
312#define __NR_SYSV_plock (__NR_SYSV + 45)
313#define __NR_SYSV_setgid (__NR_SYSV + 46)
314#define __NR_SYSV_getgid (__NR_SYSV + 47)
315#define __NR_SYSV_sig (__NR_SYSV + 48)
316#define __NR_SYSV_msgsys (__NR_SYSV + 49)
317#define __NR_SYSV_sysmips (__NR_SYSV + 50)
318#define __NR_SYSV_acct (__NR_SYSV + 51)
319#define __NR_SYSV_shmsys (__NR_SYSV + 52)
320#define __NR_SYSV_semsys (__NR_SYSV + 53)
321#define __NR_SYSV_ioctl (__NR_SYSV + 54)
322#define __NR_SYSV_uadmin (__NR_SYSV + 55)
323#define __NR_SYSV_sysmp (__NR_SYSV + 56)
324#define __NR_SYSV_utssys (__NR_SYSV + 57)
325#define __NR_SYSV_USG_reserved1 (__NR_SYSV + 58)
326#define __NR_SYSV_execve (__NR_SYSV + 59)
327#define __NR_SYSV_umask (__NR_SYSV + 60)
328#define __NR_SYSV_chroot (__NR_SYSV + 61)
329#define __NR_SYSV_fcntl (__NR_SYSV + 62)
330#define __NR_SYSV_ulimit (__NR_SYSV + 63)
331#define __NR_SYSV_SAFARI4_reserved1 (__NR_SYSV + 64)
332#define __NR_SYSV_SAFARI4_reserved2 (__NR_SYSV + 65)
333#define __NR_SYSV_SAFARI4_reserved3 (__NR_SYSV + 66)
334#define __NR_SYSV_SAFARI4_reserved4 (__NR_SYSV + 67)
335#define __NR_SYSV_SAFARI4_reserved5 (__NR_SYSV + 68)
336#define __NR_SYSV_SAFARI4_reserved6 (__NR_SYSV + 69)
337#define __NR_SYSV_advfs (__NR_SYSV + 70)
338#define __NR_SYSV_unadvfs (__NR_SYSV + 71)
339#define __NR_SYSV_rmount (__NR_SYSV + 72)
340#define __NR_SYSV_rumount (__NR_SYSV + 73)
341#define __NR_SYSV_rfstart (__NR_SYSV + 74)
342#define __NR_SYSV_getrlimit64 (__NR_SYSV + 75)
343#define __NR_SYSV_setrlimit64 (__NR_SYSV + 76)
344#define __NR_SYSV_nanosleep (__NR_SYSV + 77)
345#define __NR_SYSV_lseek64 (__NR_SYSV + 78)
346#define __NR_SYSV_rmdir (__NR_SYSV + 79)
347#define __NR_SYSV_mkdir (__NR_SYSV + 80)
348#define __NR_SYSV_getdents (__NR_SYSV + 81)
349#define __NR_SYSV_sginap (__NR_SYSV + 82)
350#define __NR_SYSV_sgikopt (__NR_SYSV + 83)
351#define __NR_SYSV_sysfs (__NR_SYSV + 84)
352#define __NR_SYSV_getmsg (__NR_SYSV + 85)
353#define __NR_SYSV_putmsg (__NR_SYSV + 86)
354#define __NR_SYSV_poll (__NR_SYSV + 87)
355#define __NR_SYSV_sigreturn (__NR_SYSV + 88)
356#define __NR_SYSV_accept (__NR_SYSV + 89)
357#define __NR_SYSV_bind (__NR_SYSV + 90)
358#define __NR_SYSV_connect (__NR_SYSV + 91)
359#define __NR_SYSV_gethostid (__NR_SYSV + 92)
360#define __NR_SYSV_getpeername (__NR_SYSV + 93)
361#define __NR_SYSV_getsockname (__NR_SYSV + 94)
362#define __NR_SYSV_getsockopt (__NR_SYSV + 95)
363#define __NR_SYSV_listen (__NR_SYSV + 96)
364#define __NR_SYSV_recv (__NR_SYSV + 97)
365#define __NR_SYSV_recvfrom (__NR_SYSV + 98)
366#define __NR_SYSV_recvmsg (__NR_SYSV + 99)
367#define __NR_SYSV_select (__NR_SYSV + 100)
368#define __NR_SYSV_send (__NR_SYSV + 101)
369#define __NR_SYSV_sendmsg (__NR_SYSV + 102)
370#define __NR_SYSV_sendto (__NR_SYSV + 103)
371#define __NR_SYSV_sethostid (__NR_SYSV + 104)
372#define __NR_SYSV_setsockopt (__NR_SYSV + 105)
373#define __NR_SYSV_shutdown (__NR_SYSV + 106)
374#define __NR_SYSV_socket (__NR_SYSV + 107)
375#define __NR_SYSV_gethostname (__NR_SYSV + 108)
376#define __NR_SYSV_sethostname (__NR_SYSV + 109)
377#define __NR_SYSV_getdomainname (__NR_SYSV + 110)
378#define __NR_SYSV_setdomainname (__NR_SYSV + 111)
379#define __NR_SYSV_truncate (__NR_SYSV + 112)
380#define __NR_SYSV_ftruncate (__NR_SYSV + 113)
381#define __NR_SYSV_rename (__NR_SYSV + 114)
382#define __NR_SYSV_symlink (__NR_SYSV + 115)
383#define __NR_SYSV_readlink (__NR_SYSV + 116)
384#define __NR_SYSV_lstat (__NR_SYSV + 117)
385#define __NR_SYSV_nfsmount (__NR_SYSV + 118)
386#define __NR_SYSV_nfssvc (__NR_SYSV + 119)
387#define __NR_SYSV_getfh (__NR_SYSV + 120)
388#define __NR_SYSV_async_daemon (__NR_SYSV + 121)
389#define __NR_SYSV_exportfs (__NR_SYSV + 122)
390#define __NR_SYSV_setregid (__NR_SYSV + 123)
391#define __NR_SYSV_setreuid (__NR_SYSV + 124)
392#define __NR_SYSV_getitimer (__NR_SYSV + 125)
393#define __NR_SYSV_setitimer (__NR_SYSV + 126)
394#define __NR_SYSV_adjtime (__NR_SYSV + 127)
395#define __NR_SYSV_BSD_getime (__NR_SYSV + 128)
396#define __NR_SYSV_sproc (__NR_SYSV + 129)
397#define __NR_SYSV_prctl (__NR_SYSV + 130)
398#define __NR_SYSV_procblk (__NR_SYSV + 131)
399#define __NR_SYSV_sprocsp (__NR_SYSV + 132)
400#define __NR_SYSV_sgigsc (__NR_SYSV + 133)
401#define __NR_SYSV_mmap (__NR_SYSV + 134)
402#define __NR_SYSV_munmap (__NR_SYSV + 135)
403#define __NR_SYSV_mprotect (__NR_SYSV + 136)
404#define __NR_SYSV_msync (__NR_SYSV + 137)
405#define __NR_SYSV_madvise (__NR_SYSV + 138)
406#define __NR_SYSV_pagelock (__NR_SYSV + 139)
407#define __NR_SYSV_getpagesize (__NR_SYSV + 140)
408#define __NR_SYSV_quotactl (__NR_SYSV + 141)
409#define __NR_SYSV_libdetach (__NR_SYSV + 142)
410#define __NR_SYSV_BSDgetpgrp (__NR_SYSV + 143)
411#define __NR_SYSV_BSDsetpgrp (__NR_SYSV + 144)
412#define __NR_SYSV_vhangup (__NR_SYSV + 145)
413#define __NR_SYSV_fsync (__NR_SYSV + 146)
414#define __NR_SYSV_fchdir (__NR_SYSV + 147)
415#define __NR_SYSV_getrlimit (__NR_SYSV + 148)
416#define __NR_SYSV_setrlimit (__NR_SYSV + 149)
417#define __NR_SYSV_cacheflush (__NR_SYSV + 150)
418#define __NR_SYSV_cachectl (__NR_SYSV + 151)
419#define __NR_SYSV_fchown (__NR_SYSV + 152)
420#define __NR_SYSV_fchmod (__NR_SYSV + 153)
421#define __NR_SYSV_wait3 (__NR_SYSV + 154)
422#define __NR_SYSV_socketpair (__NR_SYSV + 155)
423#define __NR_SYSV_sysinfo (__NR_SYSV + 156)
424#define __NR_SYSV_nuname (__NR_SYSV + 157)
425#define __NR_SYSV_xstat (__NR_SYSV + 158)
426#define __NR_SYSV_lxstat (__NR_SYSV + 159)
427#define __NR_SYSV_fxstat (__NR_SYSV + 160)
428#define __NR_SYSV_xmknod (__NR_SYSV + 161)
429#define __NR_SYSV_ksigaction (__NR_SYSV + 162)
430#define __NR_SYSV_sigpending (__NR_SYSV + 163)
431#define __NR_SYSV_sigprocmask (__NR_SYSV + 164)
432#define __NR_SYSV_sigsuspend (__NR_SYSV + 165)
433#define __NR_SYSV_sigpoll (__NR_SYSV + 166)
434#define __NR_SYSV_swapctl (__NR_SYSV + 167)
435#define __NR_SYSV_getcontext (__NR_SYSV + 168)
436#define __NR_SYSV_setcontext (__NR_SYSV + 169)
437#define __NR_SYSV_waitsys (__NR_SYSV + 170)
438#define __NR_SYSV_sigstack (__NR_SYSV + 171)
439#define __NR_SYSV_sigaltstack (__NR_SYSV + 172)
440#define __NR_SYSV_sigsendset (__NR_SYSV + 173)
441#define __NR_SYSV_statvfs (__NR_SYSV + 174)
442#define __NR_SYSV_fstatvfs (__NR_SYSV + 175)
443#define __NR_SYSV_getpmsg (__NR_SYSV + 176)
444#define __NR_SYSV_putpmsg (__NR_SYSV + 177)
445#define __NR_SYSV_lchown (__NR_SYSV + 178)
446#define __NR_SYSV_priocntl (__NR_SYSV + 179)
447#define __NR_SYSV_ksigqueue (__NR_SYSV + 180)
448#define __NR_SYSV_readv (__NR_SYSV + 181)
449#define __NR_SYSV_writev (__NR_SYSV + 182)
450#define __NR_SYSV_truncate64 (__NR_SYSV + 183)
451#define __NR_SYSV_ftruncate64 (__NR_SYSV + 184)
452#define __NR_SYSV_mmap64 (__NR_SYSV + 185)
453#define __NR_SYSV_dmi (__NR_SYSV + 186)
454#define __NR_SYSV_pread (__NR_SYSV + 187)
455#define __NR_SYSV_pwrite (__NR_SYSV + 188)
456
457/*
458 * BSD 4.3 syscalls are in the range from 2000 to 2999
459 */
460#define __NR_BSD43 2000
461#define __NR_BSD43_syscall (__NR_BSD43 + 0)
462#define __NR_BSD43_exit (__NR_BSD43 + 1)
463#define __NR_BSD43_fork (__NR_BSD43 + 2)
464#define __NR_BSD43_read (__NR_BSD43 + 3)
465#define __NR_BSD43_write (__NR_BSD43 + 4)
466#define __NR_BSD43_open (__NR_BSD43 + 5)
467#define __NR_BSD43_close (__NR_BSD43 + 6)
468#define __NR_BSD43_wait (__NR_BSD43 + 7)
469#define __NR_BSD43_creat (__NR_BSD43 + 8)
470#define __NR_BSD43_link (__NR_BSD43 + 9)
471#define __NR_BSD43_unlink (__NR_BSD43 + 10)
472#define __NR_BSD43_exec (__NR_BSD43 + 11)
473#define __NR_BSD43_chdir (__NR_BSD43 + 12)
474#define __NR_BSD43_time (__NR_BSD43 + 13)
475#define __NR_BSD43_mknod (__NR_BSD43 + 14)
476#define __NR_BSD43_chmod (__NR_BSD43 + 15)
477#define __NR_BSD43_chown (__NR_BSD43 + 16)
478#define __NR_BSD43_sbreak (__NR_BSD43 + 17)
479#define __NR_BSD43_oldstat (__NR_BSD43 + 18)
480#define __NR_BSD43_lseek (__NR_BSD43 + 19)
481#define __NR_BSD43_getpid (__NR_BSD43 + 20)
482#define __NR_BSD43_oldmount (__NR_BSD43 + 21)
483#define __NR_BSD43_umount (__NR_BSD43 + 22)
484#define __NR_BSD43_setuid (__NR_BSD43 + 23)
485#define __NR_BSD43_getuid (__NR_BSD43 + 24)
486#define __NR_BSD43_stime (__NR_BSD43 + 25)
487#define __NR_BSD43_ptrace (__NR_BSD43 + 26)
488#define __NR_BSD43_alarm (__NR_BSD43 + 27)
489#define __NR_BSD43_oldfstat (__NR_BSD43 + 28)
490#define __NR_BSD43_pause (__NR_BSD43 + 29)
491#define __NR_BSD43_utime (__NR_BSD43 + 30)
492#define __NR_BSD43_stty (__NR_BSD43 + 31)
493#define __NR_BSD43_gtty (__NR_BSD43 + 32)
494#define __NR_BSD43_access (__NR_BSD43 + 33)
495#define __NR_BSD43_nice (__NR_BSD43 + 34)
496#define __NR_BSD43_ftime (__NR_BSD43 + 35)
497#define __NR_BSD43_sync (__NR_BSD43 + 36)
498#define __NR_BSD43_kill (__NR_BSD43 + 37)
499#define __NR_BSD43_stat (__NR_BSD43 + 38)
500#define __NR_BSD43_oldsetpgrp (__NR_BSD43 + 39)
501#define __NR_BSD43_lstat (__NR_BSD43 + 40)
502#define __NR_BSD43_dup (__NR_BSD43 + 41)
503#define __NR_BSD43_pipe (__NR_BSD43 + 42)
504#define __NR_BSD43_times (__NR_BSD43 + 43)
505#define __NR_BSD43_profil (__NR_BSD43 + 44)
506#define __NR_BSD43_msgsys (__NR_BSD43 + 45)
507#define __NR_BSD43_setgid (__NR_BSD43 + 46)
508#define __NR_BSD43_getgid (__NR_BSD43 + 47)
509#define __NR_BSD43_ssig (__NR_BSD43 + 48)
510#define __NR_BSD43_reserved1 (__NR_BSD43 + 49)
511#define __NR_BSD43_reserved2 (__NR_BSD43 + 50)
512#define __NR_BSD43_sysacct (__NR_BSD43 + 51)
513#define __NR_BSD43_phys (__NR_BSD43 + 52)
514#define __NR_BSD43_lock (__NR_BSD43 + 53)
515#define __NR_BSD43_ioctl (__NR_BSD43 + 54)
516#define __NR_BSD43_reboot (__NR_BSD43 + 55)
517#define __NR_BSD43_mpxchan (__NR_BSD43 + 56)
518#define __NR_BSD43_symlink (__NR_BSD43 + 57)
519#define __NR_BSD43_readlink (__NR_BSD43 + 58)
520#define __NR_BSD43_execve (__NR_BSD43 + 59)
521#define __NR_BSD43_umask (__NR_BSD43 + 60)
522#define __NR_BSD43_chroot (__NR_BSD43 + 61)
523#define __NR_BSD43_fstat (__NR_BSD43 + 62)
524#define __NR_BSD43_reserved3 (__NR_BSD43 + 63)
525#define __NR_BSD43_getpagesize (__NR_BSD43 + 64)
526#define __NR_BSD43_mremap (__NR_BSD43 + 65)
527#define __NR_BSD43_vfork (__NR_BSD43 + 66)
528#define __NR_BSD43_vread (__NR_BSD43 + 67)
529#define __NR_BSD43_vwrite (__NR_BSD43 + 68)
530#define __NR_BSD43_sbrk (__NR_BSD43 + 69)
531#define __NR_BSD43_sstk (__NR_BSD43 + 70)
532#define __NR_BSD43_mmap (__NR_BSD43 + 71)
533#define __NR_BSD43_vadvise (__NR_BSD43 + 72)
534#define __NR_BSD43_munmap (__NR_BSD43 + 73)
535#define __NR_BSD43_mprotect (__NR_BSD43 + 74)
536#define __NR_BSD43_madvise (__NR_BSD43 + 75)
537#define __NR_BSD43_vhangup (__NR_BSD43 + 76)
538#define __NR_BSD43_vlimit (__NR_BSD43 + 77)
539#define __NR_BSD43_mincore (__NR_BSD43 + 78)
540#define __NR_BSD43_getgroups (__NR_BSD43 + 79)
541#define __NR_BSD43_setgroups (__NR_BSD43 + 80)
542#define __NR_BSD43_getpgrp (__NR_BSD43 + 81)
543#define __NR_BSD43_setpgrp (__NR_BSD43 + 82)
544#define __NR_BSD43_setitimer (__NR_BSD43 + 83)
545#define __NR_BSD43_wait3 (__NR_BSD43 + 84)
546#define __NR_BSD43_swapon (__NR_BSD43 + 85)
547#define __NR_BSD43_getitimer (__NR_BSD43 + 86)
548#define __NR_BSD43_gethostname (__NR_BSD43 + 87)
549#define __NR_BSD43_sethostname (__NR_BSD43 + 88)
550#define __NR_BSD43_getdtablesize (__NR_BSD43 + 89)
551#define __NR_BSD43_dup2 (__NR_BSD43 + 90)
552#define __NR_BSD43_getdopt (__NR_BSD43 + 91)
553#define __NR_BSD43_fcntl (__NR_BSD43 + 92)
554#define __NR_BSD43_select (__NR_BSD43 + 93)
555#define __NR_BSD43_setdopt (__NR_BSD43 + 94)
556#define __NR_BSD43_fsync (__NR_BSD43 + 95)
557#define __NR_BSD43_setpriority (__NR_BSD43 + 96)
558#define __NR_BSD43_socket (__NR_BSD43 + 97)
559#define __NR_BSD43_connect (__NR_BSD43 + 98)
560#define __NR_BSD43_oldaccept (__NR_BSD43 + 99)
561#define __NR_BSD43_getpriority (__NR_BSD43 + 100)
562#define __NR_BSD43_send (__NR_BSD43 + 101)
563#define __NR_BSD43_recv (__NR_BSD43 + 102)
564#define __NR_BSD43_sigreturn (__NR_BSD43 + 103)
565#define __NR_BSD43_bind (__NR_BSD43 + 104)
566#define __NR_BSD43_setsockopt (__NR_BSD43 + 105)
567#define __NR_BSD43_listen (__NR_BSD43 + 106)
568#define __NR_BSD43_vtimes (__NR_BSD43 + 107)
569#define __NR_BSD43_sigvec (__NR_BSD43 + 108)
570#define __NR_BSD43_sigblock (__NR_BSD43 + 109)
571#define __NR_BSD43_sigsetmask (__NR_BSD43 + 110)
572#define __NR_BSD43_sigpause (__NR_BSD43 + 111)
573#define __NR_BSD43_sigstack (__NR_BSD43 + 112)
574#define __NR_BSD43_oldrecvmsg (__NR_BSD43 + 113)
575#define __NR_BSD43_oldsendmsg (__NR_BSD43 + 114)
576#define __NR_BSD43_vtrace (__NR_BSD43 + 115)
577#define __NR_BSD43_gettimeofday (__NR_BSD43 + 116)
578#define __NR_BSD43_getrusage (__NR_BSD43 + 117)
579#define __NR_BSD43_getsockopt (__NR_BSD43 + 118)
580#define __NR_BSD43_reserved4 (__NR_BSD43 + 119)
581#define __NR_BSD43_readv (__NR_BSD43 + 120)
582#define __NR_BSD43_writev (__NR_BSD43 + 121)
583#define __NR_BSD43_settimeofday (__NR_BSD43 + 122)
584#define __NR_BSD43_fchown (__NR_BSD43 + 123)
585#define __NR_BSD43_fchmod (__NR_BSD43 + 124)
586#define __NR_BSD43_oldrecvfrom (__NR_BSD43 + 125)
587#define __NR_BSD43_setreuid (__NR_BSD43 + 126)
588#define __NR_BSD43_setregid (__NR_BSD43 + 127)
589#define __NR_BSD43_rename (__NR_BSD43 + 128)
590#define __NR_BSD43_truncate (__NR_BSD43 + 129)
591#define __NR_BSD43_ftruncate (__NR_BSD43 + 130)
592#define __NR_BSD43_flock (__NR_BSD43 + 131)
593#define __NR_BSD43_semsys (__NR_BSD43 + 132)
594#define __NR_BSD43_sendto (__NR_BSD43 + 133)
595#define __NR_BSD43_shutdown (__NR_BSD43 + 134)
596#define __NR_BSD43_socketpair (__NR_BSD43 + 135)
597#define __NR_BSD43_mkdir (__NR_BSD43 + 136)
598#define __NR_BSD43_rmdir (__NR_BSD43 + 137)
599#define __NR_BSD43_utimes (__NR_BSD43 + 138)
600#define __NR_BSD43_sigcleanup (__NR_BSD43 + 139)
601#define __NR_BSD43_adjtime (__NR_BSD43 + 140)
602#define __NR_BSD43_oldgetpeername (__NR_BSD43 + 141)
603#define __NR_BSD43_gethostid (__NR_BSD43 + 142)
604#define __NR_BSD43_sethostid (__NR_BSD43 + 143)
605#define __NR_BSD43_getrlimit (__NR_BSD43 + 144)
606#define __NR_BSD43_setrlimit (__NR_BSD43 + 145)
607#define __NR_BSD43_killpg (__NR_BSD43 + 146)
608#define __NR_BSD43_shmsys (__NR_BSD43 + 147)
609#define __NR_BSD43_quota (__NR_BSD43 + 148)
610#define __NR_BSD43_qquota (__NR_BSD43 + 149)
611#define __NR_BSD43_oldgetsockname (__NR_BSD43 + 150)
612#define __NR_BSD43_sysmips (__NR_BSD43 + 151)
613#define __NR_BSD43_cacheflush (__NR_BSD43 + 152)
614#define __NR_BSD43_cachectl (__NR_BSD43 + 153)
615#define __NR_BSD43_debug (__NR_BSD43 + 154)
616#define __NR_BSD43_reserved5 (__NR_BSD43 + 155)
617#define __NR_BSD43_reserved6 (__NR_BSD43 + 156)
618#define __NR_BSD43_nfs_mount (__NR_BSD43 + 157)
619#define __NR_BSD43_nfs_svc (__NR_BSD43 + 158)
620#define __NR_BSD43_getdirentries (__NR_BSD43 + 159)
621#define __NR_BSD43_statfs (__NR_BSD43 + 160)
622#define __NR_BSD43_fstatfs (__NR_BSD43 + 161)
623#define __NR_BSD43_unmount (__NR_BSD43 + 162)
624#define __NR_BSD43_async_daemon (__NR_BSD43 + 163)
625#define __NR_BSD43_nfs_getfh (__NR_BSD43 + 164)
626#define __NR_BSD43_getdomainname (__NR_BSD43 + 165)
627#define __NR_BSD43_setdomainname (__NR_BSD43 + 166)
628#define __NR_BSD43_pcfs_mount (__NR_BSD43 + 167)
629#define __NR_BSD43_quotactl (__NR_BSD43 + 168)
630#define __NR_BSD43_oldexportfs (__NR_BSD43 + 169)
631#define __NR_BSD43_smount (__NR_BSD43 + 170)
632#define __NR_BSD43_mipshwconf (__NR_BSD43 + 171)
633#define __NR_BSD43_exportfs (__NR_BSD43 + 172)
634#define __NR_BSD43_nfsfh_open (__NR_BSD43 + 173)
635#define __NR_BSD43_libattach (__NR_BSD43 + 174)
636#define __NR_BSD43_libdetach (__NR_BSD43 + 175)
637#define __NR_BSD43_accept (__NR_BSD43 + 176)
638#define __NR_BSD43_reserved7 (__NR_BSD43 + 177)
639#define __NR_BSD43_reserved8 (__NR_BSD43 + 178)
640#define __NR_BSD43_recvmsg (__NR_BSD43 + 179)
641#define __NR_BSD43_recvfrom (__NR_BSD43 + 180)
642#define __NR_BSD43_sendmsg (__NR_BSD43 + 181)
643#define __NR_BSD43_getpeername (__NR_BSD43 + 182)
644#define __NR_BSD43_getsockname (__NR_BSD43 + 183)
645#define __NR_BSD43_aread (__NR_BSD43 + 184)
646#define __NR_BSD43_awrite (__NR_BSD43 + 185)
647#define __NR_BSD43_listio (__NR_BSD43 + 186)
648#define __NR_BSD43_acancel (__NR_BSD43 + 187)
649#define __NR_BSD43_astatus (__NR_BSD43 + 188)
650#define __NR_BSD43_await (__NR_BSD43 + 189)
651#define __NR_BSD43_areadv (__NR_BSD43 + 190)
652#define __NR_BSD43_awritev (__NR_BSD43 + 191)
653
654/*
655 * POSIX syscalls are in the range from 3000 to 3999
656 */
657#define __NR_POSIX 3000
658#define __NR_POSIX_syscall (__NR_POSIX + 0)
659#define __NR_POSIX_exit (__NR_POSIX + 1)
660#define __NR_POSIX_fork (__NR_POSIX + 2)
661#define __NR_POSIX_read (__NR_POSIX + 3)
662#define __NR_POSIX_write (__NR_POSIX + 4)
663#define __NR_POSIX_open (__NR_POSIX + 5)
664#define __NR_POSIX_close (__NR_POSIX + 6)
665#define __NR_POSIX_wait (__NR_POSIX + 7)
666#define __NR_POSIX_creat (__NR_POSIX + 8)
667#define __NR_POSIX_link (__NR_POSIX + 9)
668#define __NR_POSIX_unlink (__NR_POSIX + 10)
669#define __NR_POSIX_exec (__NR_POSIX + 11)
670#define __NR_POSIX_chdir (__NR_POSIX + 12)
671#define __NR_POSIX_gtime (__NR_POSIX + 13)
672#define __NR_POSIX_mknod (__NR_POSIX + 14)
673#define __NR_POSIX_chmod (__NR_POSIX + 15)
674#define __NR_POSIX_chown (__NR_POSIX + 16)
675#define __NR_POSIX_sbreak (__NR_POSIX + 17)
676#define __NR_POSIX_stat (__NR_POSIX + 18)
677#define __NR_POSIX_lseek (__NR_POSIX + 19)
678#define __NR_POSIX_getpid (__NR_POSIX + 20)
679#define __NR_POSIX_mount (__NR_POSIX + 21)
680#define __NR_POSIX_umount (__NR_POSIX + 22)
681#define __NR_POSIX_setuid (__NR_POSIX + 23)
682#define __NR_POSIX_getuid (__NR_POSIX + 24)
683#define __NR_POSIX_stime (__NR_POSIX + 25)
684#define __NR_POSIX_ptrace (__NR_POSIX + 26)
685#define __NR_POSIX_alarm (__NR_POSIX + 27)
686#define __NR_POSIX_fstat (__NR_POSIX + 28)
687#define __NR_POSIX_pause (__NR_POSIX + 29)
688#define __NR_POSIX_utime (__NR_POSIX + 30)
689#define __NR_POSIX_stty (__NR_POSIX + 31)
690#define __NR_POSIX_gtty (__NR_POSIX + 32)
691#define __NR_POSIX_access (__NR_POSIX + 33)
692#define __NR_POSIX_nice (__NR_POSIX + 34)
693#define __NR_POSIX_statfs (__NR_POSIX + 35)
694#define __NR_POSIX_sync (__NR_POSIX + 36)
695#define __NR_POSIX_kill (__NR_POSIX + 37)
696#define __NR_POSIX_fstatfs (__NR_POSIX + 38)
697#define __NR_POSIX_getpgrp (__NR_POSIX + 39)
698#define __NR_POSIX_syssgi (__NR_POSIX + 40)
699#define __NR_POSIX_dup (__NR_POSIX + 41)
700#define __NR_POSIX_pipe (__NR_POSIX + 42)
701#define __NR_POSIX_times (__NR_POSIX + 43)
702#define __NR_POSIX_profil (__NR_POSIX + 44)
703#define __NR_POSIX_lock (__NR_POSIX + 45)
704#define __NR_POSIX_setgid (__NR_POSIX + 46)
705#define __NR_POSIX_getgid (__NR_POSIX + 47)
706#define __NR_POSIX_sig (__NR_POSIX + 48)
707#define __NR_POSIX_msgsys (__NR_POSIX + 49)
708#define __NR_POSIX_sysmips (__NR_POSIX + 50)
709#define __NR_POSIX_sysacct (__NR_POSIX + 51)
710#define __NR_POSIX_shmsys (__NR_POSIX + 52)
711#define __NR_POSIX_semsys (__NR_POSIX + 53)
712#define __NR_POSIX_ioctl (__NR_POSIX + 54)
713#define __NR_POSIX_uadmin (__NR_POSIX + 55)
714#define __NR_POSIX_exch (__NR_POSIX + 56)
715#define __NR_POSIX_utssys (__NR_POSIX + 57)
716#define __NR_POSIX_USG_reserved1 (__NR_POSIX + 58)
717#define __NR_POSIX_exece (__NR_POSIX + 59)
718#define __NR_POSIX_umask (__NR_POSIX + 60)
719#define __NR_POSIX_chroot (__NR_POSIX + 61)
720#define __NR_POSIX_fcntl (__NR_POSIX + 62)
721#define __NR_POSIX_ulimit (__NR_POSIX + 63)
722#define __NR_POSIX_SAFARI4_reserved1 (__NR_POSIX + 64)
723#define __NR_POSIX_SAFARI4_reserved2 (__NR_POSIX + 65)
724#define __NR_POSIX_SAFARI4_reserved3 (__NR_POSIX + 66)
725#define __NR_POSIX_SAFARI4_reserved4 (__NR_POSIX + 67)
726#define __NR_POSIX_SAFARI4_reserved5 (__NR_POSIX + 68)
727#define __NR_POSIX_SAFARI4_reserved6 (__NR_POSIX + 69)
728#define __NR_POSIX_advfs (__NR_POSIX + 70)
729#define __NR_POSIX_unadvfs (__NR_POSIX + 71)
730#define __NR_POSIX_rmount (__NR_POSIX + 72)
731#define __NR_POSIX_rumount (__NR_POSIX + 73)
732#define __NR_POSIX_rfstart (__NR_POSIX + 74)
733#define __NR_POSIX_reserved1 (__NR_POSIX + 75)
734#define __NR_POSIX_rdebug (__NR_POSIX + 76)
735#define __NR_POSIX_rfstop (__NR_POSIX + 77)
736#define __NR_POSIX_rfsys (__NR_POSIX + 78)
737#define __NR_POSIX_rmdir (__NR_POSIX + 79)
738#define __NR_POSIX_mkdir (__NR_POSIX + 80)
739#define __NR_POSIX_getdents (__NR_POSIX + 81)
740#define __NR_POSIX_sginap (__NR_POSIX + 82)
741#define __NR_POSIX_sgikopt (__NR_POSIX + 83)
742#define __NR_POSIX_sysfs (__NR_POSIX + 84)
743#define __NR_POSIX_getmsg (__NR_POSIX + 85)
744#define __NR_POSIX_putmsg (__NR_POSIX + 86)
745#define __NR_POSIX_poll (__NR_POSIX + 87)
746#define __NR_POSIX_sigreturn (__NR_POSIX + 88)
747#define __NR_POSIX_accept (__NR_POSIX + 89)
748#define __NR_POSIX_bind (__NR_POSIX + 90)
749#define __NR_POSIX_connect (__NR_POSIX + 91)
750#define __NR_POSIX_gethostid (__NR_POSIX + 92)
751#define __NR_POSIX_getpeername (__NR_POSIX + 93)
752#define __NR_POSIX_getsockname (__NR_POSIX + 94)
753#define __NR_POSIX_getsockopt (__NR_POSIX + 95)
754#define __NR_POSIX_listen (__NR_POSIX + 96)
755#define __NR_POSIX_recv (__NR_POSIX + 97)
756#define __NR_POSIX_recvfrom (__NR_POSIX + 98)
757#define __NR_POSIX_recvmsg (__NR_POSIX + 99)
758#define __NR_POSIX_select (__NR_POSIX + 100)
759#define __NR_POSIX_send (__NR_POSIX + 101)
760#define __NR_POSIX_sendmsg (__NR_POSIX + 102)
761#define __NR_POSIX_sendto (__NR_POSIX + 103)
762#define __NR_POSIX_sethostid (__NR_POSIX + 104)
763#define __NR_POSIX_setsockopt (__NR_POSIX + 105)
764#define __NR_POSIX_shutdown (__NR_POSIX + 106)
765#define __NR_POSIX_socket (__NR_POSIX + 107)
766#define __NR_POSIX_gethostname (__NR_POSIX + 108)
767#define __NR_POSIX_sethostname (__NR_POSIX + 109)
768#define __NR_POSIX_getdomainname (__NR_POSIX + 110)
769#define __NR_POSIX_setdomainname (__NR_POSIX + 111)
770#define __NR_POSIX_truncate (__NR_POSIX + 112)
771#define __NR_POSIX_ftruncate (__NR_POSIX + 113)
772#define __NR_POSIX_rename (__NR_POSIX + 114)
773#define __NR_POSIX_symlink (__NR_POSIX + 115)
774#define __NR_POSIX_readlink (__NR_POSIX + 116)
775#define __NR_POSIX_lstat (__NR_POSIX + 117)
776#define __NR_POSIX_nfs_mount (__NR_POSIX + 118)
777#define __NR_POSIX_nfs_svc (__NR_POSIX + 119)
778#define __NR_POSIX_nfs_getfh (__NR_POSIX + 120)
779#define __NR_POSIX_async_daemon (__NR_POSIX + 121)
780#define __NR_POSIX_exportfs (__NR_POSIX + 122)
781#define __NR_POSIX_SGI_setregid (__NR_POSIX + 123)
782#define __NR_POSIX_SGI_setreuid (__NR_POSIX + 124)
783#define __NR_POSIX_getitimer (__NR_POSIX + 125)
784#define __NR_POSIX_setitimer (__NR_POSIX + 126)
785#define __NR_POSIX_adjtime (__NR_POSIX + 127)
786#define __NR_POSIX_SGI_bsdgettime (__NR_POSIX + 128)
787#define __NR_POSIX_SGI_sproc (__NR_POSIX + 129)
788#define __NR_POSIX_SGI_prctl (__NR_POSIX + 130)
789#define __NR_POSIX_SGI_blkproc (__NR_POSIX + 131)
790#define __NR_POSIX_SGI_reserved1 (__NR_POSIX + 132)
791#define __NR_POSIX_SGI_sgigsc (__NR_POSIX + 133)
792#define __NR_POSIX_SGI_mmap (__NR_POSIX + 134)
793#define __NR_POSIX_SGI_munmap (__NR_POSIX + 135)
794#define __NR_POSIX_SGI_mprotect (__NR_POSIX + 136)
795#define __NR_POSIX_SGI_msync (__NR_POSIX + 137)
796#define __NR_POSIX_SGI_madvise (__NR_POSIX + 138)
797#define __NR_POSIX_SGI_mpin (__NR_POSIX + 139)
798#define __NR_POSIX_SGI_getpagesize (__NR_POSIX + 140)
799#define __NR_POSIX_SGI_libattach (__NR_POSIX + 141)
800#define __NR_POSIX_SGI_libdetach (__NR_POSIX + 142)
801#define __NR_POSIX_SGI_getpgrp (__NR_POSIX + 143)
802#define __NR_POSIX_SGI_setpgrp (__NR_POSIX + 144)
803#define __NR_POSIX_SGI_reserved2 (__NR_POSIX + 145)
804#define __NR_POSIX_SGI_reserved3 (__NR_POSIX + 146)
805#define __NR_POSIX_SGI_reserved4 (__NR_POSIX + 147)
806#define __NR_POSIX_SGI_reserved5 (__NR_POSIX + 148)
807#define __NR_POSIX_SGI_reserved6 (__NR_POSIX + 149)
808#define __NR_POSIX_cacheflush (__NR_POSIX + 150)
809#define __NR_POSIX_cachectl (__NR_POSIX + 151)
810#define __NR_POSIX_fchown (__NR_POSIX + 152)
811#define __NR_POSIX_fchmod (__NR_POSIX + 153)
812#define __NR_POSIX_wait3 (__NR_POSIX + 154)
813#define __NR_POSIX_mmap (__NR_POSIX + 155)
814#define __NR_POSIX_munmap (__NR_POSIX + 156)
815#define __NR_POSIX_madvise (__NR_POSIX + 157)
816#define __NR_POSIX_BSD_getpagesize (__NR_POSIX + 158)
817#define __NR_POSIX_setreuid (__NR_POSIX + 159)
818#define __NR_POSIX_setregid (__NR_POSIX + 160)
819#define __NR_POSIX_setpgid (__NR_POSIX + 161)
820#define __NR_POSIX_getgroups (__NR_POSIX + 162)
821#define __NR_POSIX_setgroups (__NR_POSIX + 163)
822#define __NR_POSIX_gettimeofday (__NR_POSIX + 164)
823#define __NR_POSIX_getrusage (__NR_POSIX + 165)
824#define __NR_POSIX_getrlimit (__NR_POSIX + 166)
825#define __NR_POSIX_setrlimit (__NR_POSIX + 167)
826#define __NR_POSIX_waitpid (__NR_POSIX + 168)
827#define __NR_POSIX_dup2 (__NR_POSIX + 169)
828#define __NR_POSIX_reserved2 (__NR_POSIX + 170)
829#define __NR_POSIX_reserved3 (__NR_POSIX + 171)
830#define __NR_POSIX_reserved4 (__NR_POSIX + 172)
831#define __NR_POSIX_reserved5 (__NR_POSIX + 173)
832#define __NR_POSIX_reserved6 (__NR_POSIX + 174)
833#define __NR_POSIX_reserved7 (__NR_POSIX + 175)
834#define __NR_POSIX_reserved8 (__NR_POSIX + 176)
835#define __NR_POSIX_reserved9 (__NR_POSIX + 177)
836#define __NR_POSIX_reserved10 (__NR_POSIX + 178)
837#define __NR_POSIX_reserved11 (__NR_POSIX + 179)
838#define __NR_POSIX_reserved12 (__NR_POSIX + 180)
839#define __NR_POSIX_reserved13 (__NR_POSIX + 181)
840#define __NR_POSIX_reserved14 (__NR_POSIX + 182)
841#define __NR_POSIX_reserved15 (__NR_POSIX + 183)
842#define __NR_POSIX_reserved16 (__NR_POSIX + 184)
843#define __NR_POSIX_reserved17 (__NR_POSIX + 185)
844#define __NR_POSIX_reserved18 (__NR_POSIX + 186)
845#define __NR_POSIX_reserved19 (__NR_POSIX + 187)
846#define __NR_POSIX_reserved20 (__NR_POSIX + 188)
847#define __NR_POSIX_reserved21 (__NR_POSIX + 189)
848#define __NR_POSIX_reserved22 (__NR_POSIX + 190)
849#define __NR_POSIX_reserved23 (__NR_POSIX + 191)
850#define __NR_POSIX_reserved24 (__NR_POSIX + 192)
851#define __NR_POSIX_reserved25 (__NR_POSIX + 193)
852#define __NR_POSIX_reserved26 (__NR_POSIX + 194)
853#define __NR_POSIX_reserved27 (__NR_POSIX + 195)
854#define __NR_POSIX_reserved28 (__NR_POSIX + 196)
855#define __NR_POSIX_reserved29 (__NR_POSIX + 197)
856#define __NR_POSIX_reserved30 (__NR_POSIX + 198)
857#define __NR_POSIX_reserved31 (__NR_POSIX + 199)
858#define __NR_POSIX_reserved32 (__NR_POSIX + 200)
859#define __NR_POSIX_reserved33 (__NR_POSIX + 201)
860#define __NR_POSIX_reserved34 (__NR_POSIX + 202)
861#define __NR_POSIX_reserved35 (__NR_POSIX + 203)
862#define __NR_POSIX_reserved36 (__NR_POSIX + 204)
863#define __NR_POSIX_reserved37 (__NR_POSIX + 205)
864#define __NR_POSIX_reserved38 (__NR_POSIX + 206)
865#define __NR_POSIX_reserved39 (__NR_POSIX + 207)
866#define __NR_POSIX_reserved40 (__NR_POSIX + 208)
867#define __NR_POSIX_reserved41 (__NR_POSIX + 209)
868#define __NR_POSIX_reserved42 (__NR_POSIX + 210)
869#define __NR_POSIX_reserved43 (__NR_POSIX + 211)
870#define __NR_POSIX_reserved44 (__NR_POSIX + 212)
871#define __NR_POSIX_reserved45 (__NR_POSIX + 213)
872#define __NR_POSIX_reserved46 (__NR_POSIX + 214)
873#define __NR_POSIX_reserved47 (__NR_POSIX + 215)
874#define __NR_POSIX_reserved48 (__NR_POSIX + 216)
875#define __NR_POSIX_reserved49 (__NR_POSIX + 217)
876#define __NR_POSIX_reserved50 (__NR_POSIX + 218)
877#define __NR_POSIX_reserved51 (__NR_POSIX + 219)
878#define __NR_POSIX_reserved52 (__NR_POSIX + 220)
879#define __NR_POSIX_reserved53 (__NR_POSIX + 221)
880#define __NR_POSIX_reserved54 (__NR_POSIX + 222)
881#define __NR_POSIX_reserved55 (__NR_POSIX + 223)
882#define __NR_POSIX_reserved56 (__NR_POSIX + 224)
883#define __NR_POSIX_reserved57 (__NR_POSIX + 225)
884#define __NR_POSIX_reserved58 (__NR_POSIX + 226)
885#define __NR_POSIX_reserved59 (__NR_POSIX + 227)
886#define __NR_POSIX_reserved60 (__NR_POSIX + 228)
887#define __NR_POSIX_reserved61 (__NR_POSIX + 229)
888#define __NR_POSIX_reserved62 (__NR_POSIX + 230)
889#define __NR_POSIX_reserved63 (__NR_POSIX + 231)
890#define __NR_POSIX_reserved64 (__NR_POSIX + 232)
891#define __NR_POSIX_reserved65 (__NR_POSIX + 233)
892#define __NR_POSIX_reserved66 (__NR_POSIX + 234)
893#define __NR_POSIX_reserved67 (__NR_POSIX + 235)
894#define __NR_POSIX_reserved68 (__NR_POSIX + 236)
895#define __NR_POSIX_reserved69 (__NR_POSIX + 237)
896#define __NR_POSIX_reserved70 (__NR_POSIX + 238)
897#define __NR_POSIX_reserved71 (__NR_POSIX + 239)
898#define __NR_POSIX_reserved72 (__NR_POSIX + 240)
899#define __NR_POSIX_reserved73 (__NR_POSIX + 241)
900#define __NR_POSIX_reserved74 (__NR_POSIX + 242)
901#define __NR_POSIX_reserved75 (__NR_POSIX + 243)
902#define __NR_POSIX_reserved76 (__NR_POSIX + 244)
903#define __NR_POSIX_reserved77 (__NR_POSIX + 245)
904#define __NR_POSIX_reserved78 (__NR_POSIX + 246)
905#define __NR_POSIX_reserved79 (__NR_POSIX + 247)
906#define __NR_POSIX_reserved80 (__NR_POSIX + 248)
907#define __NR_POSIX_reserved81 (__NR_POSIX + 249)
908#define __NR_POSIX_reserved82 (__NR_POSIX + 250)
909#define __NR_POSIX_reserved83 (__NR_POSIX + 251)
910#define __NR_POSIX_reserved84 (__NR_POSIX + 252)
911#define __NR_POSIX_reserved85 (__NR_POSIX + 253)
912#define __NR_POSIX_reserved86 (__NR_POSIX + 254)
913#define __NR_POSIX_reserved87 (__NR_POSIX + 255)
914#define __NR_POSIX_reserved88 (__NR_POSIX + 256)
915#define __NR_POSIX_reserved89 (__NR_POSIX + 257)
916#define __NR_POSIX_reserved90 (__NR_POSIX + 258)
917#define __NR_POSIX_reserved91 (__NR_POSIX + 259)
918#define __NR_POSIX_netboot (__NR_POSIX + 260)
919#define __NR_POSIX_netunboot (__NR_POSIX + 261)
920#define __NR_POSIX_rdump (__NR_POSIX + 262)
921#define __NR_POSIX_setsid (__NR_POSIX + 263)
922#define __NR_POSIX_getmaxsig (__NR_POSIX + 264)
923#define __NR_POSIX_sigpending (__NR_POSIX + 265)
924#define __NR_POSIX_sigprocmask (__NR_POSIX + 266)
925#define __NR_POSIX_sigsuspend (__NR_POSIX + 267)
926#define __NR_POSIX_sigaction (__NR_POSIX + 268)
927#define __NR_POSIX_MIPS_reserved1 (__NR_POSIX + 269)
928#define __NR_POSIX_MIPS_reserved2 (__NR_POSIX + 270)
929#define __NR_POSIX_MIPS_reserved3 (__NR_POSIX + 271)
930#define __NR_POSIX_MIPS_reserved4 (__NR_POSIX + 272)
931#define __NR_POSIX_MIPS_reserved5 (__NR_POSIX + 273)
932#define __NR_POSIX_MIPS_reserved6 (__NR_POSIX + 274)
933#define __NR_POSIX_MIPS_reserved7 (__NR_POSIX + 275)
934#define __NR_POSIX_MIPS_reserved8 (__NR_POSIX + 276)
935#define __NR_POSIX_MIPS_reserved9 (__NR_POSIX + 277)
936#define __NR_POSIX_MIPS_reserved10 (__NR_POSIX + 278)
937#define __NR_POSIX_MIPS_reserved11 (__NR_POSIX + 279)
938#define __NR_POSIX_TANDEM_reserved1 (__NR_POSIX + 280)
939#define __NR_POSIX_TANDEM_reserved2 (__NR_POSIX + 281)
940#define __NR_POSIX_TANDEM_reserved3 (__NR_POSIX + 282)
941#define __NR_POSIX_TANDEM_reserved4 (__NR_POSIX + 283)
942#define __NR_POSIX_TANDEM_reserved5 (__NR_POSIX + 284)
943#define __NR_POSIX_TANDEM_reserved6 (__NR_POSIX + 285)
944#define __NR_POSIX_TANDEM_reserved7 (__NR_POSIX + 286)
945#define __NR_POSIX_TANDEM_reserved8 (__NR_POSIX + 287)
946#define __NR_POSIX_TANDEM_reserved9 (__NR_POSIX + 288)
947#define __NR_POSIX_TANDEM_reserved10 (__NR_POSIX + 289)
948#define __NR_POSIX_TANDEM_reserved11 (__NR_POSIX + 290)
949#define __NR_POSIX_TANDEM_reserved12 (__NR_POSIX + 291)
950#define __NR_POSIX_TANDEM_reserved13 (__NR_POSIX + 292)
951#define __NR_POSIX_TANDEM_reserved14 (__NR_POSIX + 293)
952#define __NR_POSIX_TANDEM_reserved15 (__NR_POSIX + 294)
953#define __NR_POSIX_TANDEM_reserved16 (__NR_POSIX + 295)
954#define __NR_POSIX_TANDEM_reserved17 (__NR_POSIX + 296)
955#define __NR_POSIX_TANDEM_reserved18 (__NR_POSIX + 297)
956#define __NR_POSIX_TANDEM_reserved19 (__NR_POSIX + 298)
957#define __NR_POSIX_TANDEM_reserved20 (__NR_POSIX + 299)
958#define __NR_POSIX_SGI_reserved7 (__NR_POSIX + 300)
959#define __NR_POSIX_SGI_reserved8 (__NR_POSIX + 301)
960#define __NR_POSIX_SGI_reserved9 (__NR_POSIX + 302)
961#define __NR_POSIX_SGI_reserved10 (__NR_POSIX + 303)
962#define __NR_POSIX_SGI_reserved11 (__NR_POSIX + 304)
963#define __NR_POSIX_SGI_reserved12 (__NR_POSIX + 305)
964#define __NR_POSIX_SGI_reserved13 (__NR_POSIX + 306)
965#define __NR_POSIX_SGI_reserved14 (__NR_POSIX + 307)
966#define __NR_POSIX_SGI_reserved15 (__NR_POSIX + 308)
967#define __NR_POSIX_SGI_reserved16 (__NR_POSIX + 309)
968#define __NR_POSIX_SGI_reserved17 (__NR_POSIX + 310)
969#define __NR_POSIX_SGI_reserved18 (__NR_POSIX + 311)
970#define __NR_POSIX_SGI_reserved19 (__NR_POSIX + 312)
971#define __NR_POSIX_SGI_reserved20 (__NR_POSIX + 313)
972#define __NR_POSIX_SGI_reserved21 (__NR_POSIX + 314)
973#define __NR_POSIX_SGI_reserved22 (__NR_POSIX + 315)
974#define __NR_POSIX_SGI_reserved23 (__NR_POSIX + 316)
975#define __NR_POSIX_SGI_reserved24 (__NR_POSIX + 317)
976#define __NR_POSIX_SGI_reserved25 (__NR_POSIX + 318)
977#define __NR_POSIX_SGI_reserved26 (__NR_POSIX + 319)
978
979#endif /* _ASM_RISCOS_SYSCALL_H */
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h
new file mode 100644
index 000000000000..31c0c2347f4f
--- /dev/null
+++ b/include/asm-mips/rtc.h
@@ -0,0 +1,37 @@
1/*
2 * include/asm-mips/rtc.h
3 *
4 * (Really an interface for drivers/char/genrtc.c)
5 *
6 * Copyright (C) 2004 MontaVista Software Inc.
7 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
8 *
9 * Please read the COPYING file for all license details.
10 */
11
12#ifndef _MIPS_RTC_H
13#define _MIPS_RTC_H
14
15#ifdef __KERNEL__
16
17#include <linux/rtc.h>
18
19#define RTC_PIE 0x40 /* periodic interrupt enable */
20#define RTC_AIE 0x20 /* alarm interrupt enable */
21#define RTC_UIE 0x10 /* update-finished interrupt enable */
22
23/* some dummy definitions */
24#define RTC_BATT_BAD 0x100 /* battery bad */
25#define RTC_SQWE 0x08 /* enable square-wave output */
26#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
27#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
28#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
29
30unsigned int get_rtc_time(struct rtc_time *time);
31int set_rtc_time(struct rtc_time *time);
32unsigned int get_rtc_ss(void);
33int get_rtc_pll(struct rtc_pll_info *pll);
34int set_rtc_pll(struct rtc_pll_info *pll);
35
36#endif
37#endif
diff --git a/include/asm-mips/scatterlist.h b/include/asm-mips/scatterlist.h
new file mode 100644
index 000000000000..22634706e9d5
--- /dev/null
+++ b/include/asm-mips/scatterlist.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_SCATTERLIST_H
2#define __ASM_SCATTERLIST_H
3
4struct scatterlist {
5 struct page * page;
6 unsigned int offset;
7 dma_addr_t dma_address;
8 unsigned int length;
9};
10
11/*
12 * These macros should be used after a pci_map_sg call has been done
13 * to get bus addresses of each of the SG entries and their lengths.
14 * You should only work with the number of sg entries pci_map_sg
15 * returns, or alternatively stop on the first sg_dma_len(sg) which
16 * is 0.
17 */
18#define sg_dma_address(sg) ((sg)->dma_address)
19#define sg_dma_len(sg) ((sg)->length)
20
21#define ISA_DMA_THRESHOLD (0x00ffffffUL)
22
23#endif /* __ASM_SCATTERLIST_H */
diff --git a/include/asm-mips/sections.h b/include/asm-mips/sections.h
new file mode 100644
index 000000000000..f7016278b266
--- /dev/null
+++ b/include/asm-mips/sections.h
@@ -0,0 +1,8 @@
1#ifndef _ASM_SECTIONS_H
2#define _ASM_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6extern char _fdata;
7
8#endif /* _ASM_SECTIONS_H */
diff --git a/include/asm-mips/segment.h b/include/asm-mips/segment.h
new file mode 100644
index 000000000000..92ac001fc483
--- /dev/null
+++ b/include/asm-mips/segment.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_SEGMENT_H
2#define _ASM_SEGMENT_H
3
4/* Only here because we have some old header files that expect it.. */
5
6#endif /* _ASM_SEGMENT_H */
diff --git a/include/asm-mips/semaphore.h b/include/asm-mips/semaphore.h
new file mode 100644
index 000000000000..c2c97dec661b
--- /dev/null
+++ b/include/asm-mips/semaphore.h
@@ -0,0 +1,112 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996 Linus Torvalds
7 * Copyright (C) 1998, 99, 2000, 01, 04 Ralf Baechle
8 * Copyright (C) 1999, 2000, 01 Silicon Graphics, Inc.
9 * Copyright (C) 2000, 01 MIPS Technologies, Inc.
10 *
11 * In all honesty, little of the old MIPS code left - the PPC64 variant was
12 * just looking nice and portable so I ripped it. Credits to whoever wrote
13 * it.
14 */
15#ifndef __ASM_SEMAPHORE_H
16#define __ASM_SEMAPHORE_H
17
18/*
19 * Remove spinlock-based RW semaphores; RW semaphore definitions are
20 * now in rwsem.h and we use the generic lib/rwsem.c implementation.
21 * Rework semaphores to use atomic_dec_if_positive.
22 * -- Paul Mackerras (paulus@samba.org)
23 */
24
25#ifdef __KERNEL__
26
27#include <asm/atomic.h>
28#include <asm/system.h>
29#include <linux/wait.h>
30#include <linux/rwsem.h>
31
32struct semaphore {
33 /*
34 * Note that any negative value of count is equivalent to 0,
35 * but additionally indicates that some process(es) might be
36 * sleeping on `wait'.
37 */
38 atomic_t count;
39 wait_queue_head_t wait;
40};
41
42#define __SEMAPHORE_INITIALIZER(name, n) \
43{ \
44 .count = ATOMIC_INIT(n), \
45 .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \
46}
47
48#define __MUTEX_INITIALIZER(name) \
49 __SEMAPHORE_INITIALIZER(name, 1)
50
51#define __DECLARE_SEMAPHORE_GENERIC(name, count) \
52 struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
53
54#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name, 1)
55#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name, 0)
56
57static inline void sema_init (struct semaphore *sem, int val)
58{
59 atomic_set(&sem->count, val);
60 init_waitqueue_head(&sem->wait);
61}
62
63static inline void init_MUTEX (struct semaphore *sem)
64{
65 sema_init(sem, 1);
66}
67
68static inline void init_MUTEX_LOCKED (struct semaphore *sem)
69{
70 sema_init(sem, 0);
71}
72
73extern void __down(struct semaphore * sem);
74extern int __down_interruptible(struct semaphore * sem);
75extern void __up(struct semaphore * sem);
76
77static inline void down(struct semaphore * sem)
78{
79 might_sleep();
80
81 /*
82 * Try to get the semaphore, take the slow path if we fail.
83 */
84 if (unlikely(atomic_dec_return(&sem->count) < 0))
85 __down(sem);
86}
87
88static inline int down_interruptible(struct semaphore * sem)
89{
90 int ret = 0;
91
92 might_sleep();
93
94 if (unlikely(atomic_dec_return(&sem->count) < 0))
95 ret = __down_interruptible(sem);
96 return ret;
97}
98
99static inline int down_trylock(struct semaphore * sem)
100{
101 return atomic_dec_if_positive(&sem->count) < 0;
102}
103
104static inline void up(struct semaphore * sem)
105{
106 if (unlikely(atomic_inc_return(&sem->count) <= 0))
107 __up(sem);
108}
109
110#endif /* __KERNEL__ */
111
112#endif /* __ASM_SEMAPHORE_H */
diff --git a/include/asm-mips/sembuf.h b/include/asm-mips/sembuf.h
new file mode 100644
index 000000000000..7281a4decaa0
--- /dev/null
+++ b/include/asm-mips/sembuf.h
@@ -0,0 +1,22 @@
1#ifndef _ASM_SEMBUF_H
2#define _ASM_SEMBUF_H
3
4/*
5 * The semid64_ds structure for the MIPS architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 2 miscellaneous 64-bit values
11 */
12
13struct semid64_ds {
14 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
15 __kernel_time_t sem_otime; /* last semop time */
16 __kernel_time_t sem_ctime; /* last change time */
17 unsigned long sem_nsems; /* no. of semaphores in array */
18 unsigned long __unused1;
19 unsigned long __unused2;
20};
21
22#endif /* _ASM_SEMBUF_H */
diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h
new file mode 100644
index 000000000000..8a70ff58f760
--- /dev/null
+++ b/include/asm-mips/serial.h
@@ -0,0 +1,444 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SERIAL_H
10#define _ASM_SERIAL_H
11
12#include <linux/config.h>
13
14/*
15 * This assumes you have a 1.8432 MHz clock for your UART.
16 *
17 * It'd be nice if someone built a serial card with a 24.576 MHz
18 * clock, since the 16550A is capable of handling a top speed of 1.5
19 * megabits/second; but this requires the faster clock.
20 */
21#define BASE_BAUD (1843200 / 16)
22
23/* Standard COM flags (except for COM4, because of the 8514 problem) */
24#ifdef CONFIG_SERIAL_DETECT_IRQ
25#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
26#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
27#else
28#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
29#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
30#endif
31
32#ifdef CONFIG_SERIAL_MANY_PORTS
33#define FOURPORT_FLAGS ASYNC_FOURPORT
34#define ACCENT_FLAGS 0
35#define BOCA_FLAGS 0
36#define HUB6_FLAGS 0
37#define RS_TABLE_SIZE 64
38#else
39#define RS_TABLE_SIZE
40#endif
41
42/*
43 * The following define the access methods for the HUB6 card. All
44 * access is through two ports for all 24 possible chips. The card is
45 * selected through the high 2 bits, the port on that card with the
46 * "middle" 3 bits, and the register on that port with the bottom
47 * 3 bits.
48 *
49 * While the access port and interrupt is configurable, the default
50 * port locations are 0x302 for the port control register, and 0x303
51 * for the data read/write register. Normally, the interrupt is at irq3
52 * but can be anything from 3 to 7 inclusive. Note that using 3 will
53 * require disabling com2.
54 */
55
56#define C_P(card,port) (((card)<<6|(port)<<3) + 1)
57
58#ifdef CONFIG_MACH_JAZZ
59#include <asm/jazz.h>
60
61#ifndef CONFIG_OLIVETTI_M700
62 /* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
63 exactly which ones ... XXX */
64#define JAZZ_BASE_BAUD ( 8000000 / 16 ) /* ( 3072000 / 16) */
65#else
66/* but the M700 isn't such a strange beast */
67#define JAZZ_BASE_BAUD BASE_BAUD
68#endif
69
70#define _JAZZ_SERIAL_INIT(int, base) \
71 { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
72 .iomem_base = (u8 *) base, .iomem_reg_shift = 0, \
73 .io_type = SERIAL_IO_MEM }
74#define JAZZ_SERIAL_PORT_DEFNS \
75 _JAZZ_SERIAL_INIT(JAZZ_SERIAL1_IRQ, JAZZ_SERIAL1_BASE), \
76 _JAZZ_SERIAL_INIT(JAZZ_SERIAL2_IRQ, JAZZ_SERIAL2_BASE),
77#else
78#define JAZZ_SERIAL_PORT_DEFNS
79#endif
80
81#ifdef CONFIG_MIPS_COBALT
82#include <asm/cobalt/cobalt.h>
83#define COBALT_BASE_BAUD (18432000 / 16)
84#define COBALT_SERIAL_PORT_DEFNS \
85 /* UART CLK PORT IRQ FLAGS */ \
86 { 0, COBALT_BASE_BAUD, 0xc800000, COBALT_SERIAL_IRQ, STD_COM_FLAGS }, /* ttyS0 */
87#else
88#define COBALT_SERIAL_PORT_DEFNS
89#endif
90
91/*
92 * Both Galileo boards have the same UART mappings.
93 */
94#if defined (CONFIG_MIPS_EV96100) || defined (CONFIG_MIPS_EV64120)
95#include <asm/galileo-boards/ev96100.h>
96#include <asm/galileo-boards/ev96100int.h>
97#define EV96100_SERIAL_PORT_DEFNS \
98 { .baud_base = EV96100_BASE_BAUD, .irq = EV96100INT_UART_0, \
99 .flags = STD_COM_FLAGS, \
100 .iomem_base = EV96100_UART0_REGS_BASE, .iomem_reg_shift = 2, \
101 .io_type = SERIAL_IO_MEM }, \
102 { .baud_base = EV96100_BASE_BAUD, .irq = EV96100INT_UART_0, \
103 .flags = STD_COM_FLAGS, \
104 .iomem_base = EV96100_UART1_REGS_BASE, .iomem_reg_shift = 2, \
105 .io_type = SERIAL_IO_MEM },
106#else
107#define EV96100_SERIAL_PORT_DEFNS
108#endif
109
110#ifdef CONFIG_MIPS_ITE8172
111#include <asm/it8172/it8172.h>
112#include <asm/it8172/it8172_int.h>
113#include <asm/it8712.h>
114#define ITE_SERIAL_PORT_DEFNS \
115 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
116 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, \
117 { .baud_base = (24000000/(16*13)), .port = (IT8172_PCI_IO_BASE + IT8712_UART1_PORT), \
118 .irq = IT8172_SERIRQ_4, .flags = STD_COM_FLAGS, .type = 0x3 }, \
119 /* Smart Card Reader 0 */ \
120 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR0_BASE), \
121 .irq = IT8172_SCR0_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, \
122 /* Smart Card Reader 1 */ \
123 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
124 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 },
125#else
126#define ITE_SERIAL_PORT_DEFNS
127#endif
128
129#ifdef CONFIG_MIPS_IVR
130#include <asm/it8172/it8172.h>
131#include <asm/it8172/it8172_int.h>
132#define IVR_SERIAL_PORT_DEFNS \
133 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
134 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, \
135 /* Smart Card Reader 1 */ \
136 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
137 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 },
138#else
139#define IVR_SERIAL_PORT_DEFNS
140#endif
141
142#ifdef CONFIG_TOSHIBA_JMR3927
143#include <asm/jmr3927/jmr3927.h>
144#define TXX927_SERIAL_PORT_DEFNS \
145 { .baud_base = JMR3927_BASE_BAUD, .port = UART0_ADDR, .irq = UART0_INT, \
146 .flags = UART0_FLAGS, .type = 1 }, \
147 { .baud_base = JMR3927_BASE_BAUD, .port = UART1_ADDR, .irq = UART1_INT, \
148 .flags = UART1_FLAGS, .type = 1 },
149#else
150#define TXX927_SERIAL_PORT_DEFNS
151#endif
152
153#ifdef CONFIG_SERIAL_AU1X00
154#include <asm/mach-au1x00/au1000.h>
155#ifdef CONFIG_SOC_AU1000
156#define AU1000_SERIAL_PORT_DEFNS \
157 { .baud_base = 0, .port = UART0_ADDR, \
158 .iomem_base = (unsigned char *)UART0_ADDR, \
159 .irq = AU1000_UART0_INT, .flags = STD_COM_FLAGS, \
160 .iomem_reg_shift = 2 }, \
161 { .baud_base = 0, .port = UART1_ADDR, \
162 .iomem_base = (unsigned char *)UART1_ADDR, \
163 .irq = AU1000_UART1_INT, .flags = STD_COM_FLAGS, \
164 .iomem_reg_shift = 2 }, \
165 { .baud_base = 0, .port = UART2_ADDR, \
166 .iomem_base = (unsigned char *)UART2_ADDR, \
167 .irq = AU1000_UART2_INT, .flags = STD_COM_FLAGS, \
168 .iomem_reg_shift = 2 }, \
169 { .baud_base = 0, .port = UART3_ADDR, \
170 .iomem_base = (unsigned char *)UART3_ADDR, \
171 .irq = AU1000_UART3_INT, .flags = STD_COM_FLAGS, \
172 .iomem_reg_shift = 2 },
173#endif
174
175#ifdef CONFIG_SOC_AU1500
176#define AU1000_SERIAL_PORT_DEFNS \
177 { .baud_base = 0, .port = UART0_ADDR, \
178 .iomem_base = (unsigned char *)UART0_ADDR, \
179 .irq = AU1500_UART0_INT, .flags = STD_COM_FLAGS, \
180 .iomem_reg_shift = 2 }, \
181 { .baud_base = 0, .port = UART3_ADDR, \
182 .iomem_base = (unsigned char *)UART3_ADDR, \
183 .irq = AU1500_UART3_INT, .flags = STD_COM_FLAGS, \
184 .iomem_reg_shift = 2 },
185#endif
186
187#ifdef CONFIG_SOC_AU1100
188#define AU1000_SERIAL_PORT_DEFNS \
189 { .baud_base = 0, .port = UART0_ADDR, \
190 .iomem_base = (unsigned char *)UART0_ADDR, \
191 .irq = AU1100_UART0_INT, .flags = STD_COM_FLAGS, \
192 .iomem_reg_shift = 2 }, \
193 { .baud_base = 0, .port = UART1_ADDR, \
194 .iomem_base = (unsigned char *)UART1_ADDR, \
195 .irq = AU1100_UART1_INT, .flags = STD_COM_FLAGS, \
196 .iomem_reg_shift = 2 }, \
197 { .baud_base = 0, .port = UART3_ADDR, \
198 .iomem_base = (unsigned char *)UART3_ADDR, \
199 .irq = AU1100_UART3_INT, .flags = STD_COM_FLAGS, \
200 .iomem_reg_shift = 2 },
201#endif
202
203#ifdef CONFIG_SOC_AU1550
204#define AU1000_SERIAL_PORT_DEFNS \
205 { .baud_base = 0, .port = UART0_ADDR, \
206 .iomem_base = (unsigned char *)UART0_ADDR, \
207 .irq = AU1550_UART0_INT, .flags = STD_COM_FLAGS, \
208 .iomem_reg_shift = 2 }, \
209 { .baud_base = 0, .port = UART1_ADDR, \
210 .iomem_base = (unsigned char *)UART1_ADDR, \
211 .irq = AU1550_UART1_INT, .flags = STD_COM_FLAGS, \
212 .iomem_reg_shift = 2 }, \
213 { .baud_base = 0, .port = UART3_ADDR, \
214 .iomem_base = (unsigned char *)UART3_ADDR, \
215 .irq = AU1550_UART3_INT, .flags = STD_COM_FLAGS,\
216 .iomem_reg_shift = 2 },
217#endif
218
219#ifdef CONFIG_SOC_AU1200
220#define AU1000_SERIAL_PORT_DEFNS \
221 { .baud_base = 0, .port = UART0_ADDR, \
222 .iomem_base = (unsigned char *)UART0_ADDR, \
223 .irq = AU1200_UART0_INT, .flags = STD_COM_FLAGS, \
224 .iomem_reg_shift = 2 }, \
225 { .baud_base = 0, .port = UART1_ADDR, \
226 .iomem_base = (unsigned char *)UART1_ADDR, \
227 .irq = AU1200_UART1_INT, .flags = STD_COM_FLAGS, \
228 .iomem_reg_shift = 2 },
229#endif
230
231#else
232#define AU1000_SERIAL_PORT_DEFNS
233#endif
234
235#ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
236#define STD_SERIAL_PORT_DEFNS \
237 /* UART CLK PORT IRQ FLAGS */ \
238 { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
239 { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
240 { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
241 { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
242
243#ifdef CONFIG_SERIAL_MANY_PORTS
244#define EXTRA_SERIAL_PORT_DEFNS \
245 { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \
246 { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \
247 { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \
248 { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \
249 { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \
250 { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \
251 { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \
252 { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \
253 { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \
254 { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \
255 { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \
256 { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \
257 { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \
258 { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \
259 { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \
260 { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \
261 { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \
262 { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \
263 { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \
264 { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \
265 { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \
266 { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \
267 { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \
268 { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \
269 { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \
270 { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \
271 { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \
272 { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */
273#else /* CONFIG_SERIAL_MANY_PORTS */
274#define EXTRA_SERIAL_PORT_DEFNS
275#endif /* CONFIG_SERIAL_MANY_PORTS */
276
277#else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
278#define STD_SERIAL_PORT_DEFNS
279#define EXTRA_SERIAL_PORT_DEFNS
280#endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */
281
282/* You can have up to four HUB6's in the system, but I've only
283 * included two cards here for a total of twelve ports.
284 */
285#if (defined(CONFIG_HUB6) && defined(CONFIG_SERIAL_MANY_PORTS))
286#define HUB6_SERIAL_PORT_DFNS \
287 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) }, /* ttyS32 */ \
288 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) }, /* ttyS33 */ \
289 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) }, /* ttyS34 */ \
290 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) }, /* ttyS35 */ \
291 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) }, /* ttyS36 */ \
292 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) }, /* ttyS37 */ \
293 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) }, /* ttyS38 */ \
294 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) }, /* ttyS39 */ \
295 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) }, /* ttyS40 */ \
296 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) }, /* ttyS41 */ \
297 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) }, /* ttyS42 */ \
298 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) }, /* ttyS43 */
299#else
300#define HUB6_SERIAL_PORT_DFNS
301#endif
302
303#ifdef CONFIG_MOMENCO_JAGUAR_ATX
304/* Ordinary NS16552 duart with a 20MHz crystal. */
305#define JAGUAR_ATX_UART_CLK 20000000
306#define JAGUAR_ATX_BASE_BAUD (JAGUAR_ATX_UART_CLK / 16)
307
308#define JAGUAR_ATX_SERIAL1_IRQ 6
309#define JAGUAR_ATX_SERIAL1_BASE 0xfd000023L
310
311#define _JAGUAR_ATX_SERIAL_INIT(int, base) \
312 { baud_base: JAGUAR_ATX_BASE_BAUD, irq: int, \
313 flags: (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
314 iomem_base: (u8 *) base, iomem_reg_shift: 2, \
315 io_type: SERIAL_IO_MEM }
316#define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS \
317 _JAGUAR_ATX_SERIAL_INIT(JAGUAR_ATX_SERIAL1_IRQ, JAGUAR_ATX_SERIAL1_BASE)
318#else
319#define MOMENCO_JAGUAR_ATX_SERIAL_PORT_DEFNS
320#endif
321
322#ifdef CONFIG_MOMENCO_OCELOT_3
323#define OCELOT_3_BASE_BAUD ( 20000000 / 16 )
324#define OCELOT_3_SERIAL_IRQ 6
325#define OCELOT_3_SERIAL_BASE (signed)0xfd000020
326
327#define _OCELOT_3_SERIAL_INIT(int, base) \
328 { baud_base: OCELOT_3_BASE_BAUD, irq: int, \
329 flags: STD_COM_FLAGS, \
330 iomem_base: (u8 *) base, iomem_reg_shift: 2, \
331 io_type: SERIAL_IO_MEM }
332
333#define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
334 _OCELOT_3_SERIAL_INIT(OCELOT_3_SERIAL_IRQ, OCELOT_3_SERIAL_BASE)
335#else
336#define MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
337#endif
338
339#ifdef CONFIG_MOMENCO_OCELOT
340/* Ordinary NS16552 duart with a 20MHz crystal. */
341#define OCELOT_BASE_BAUD ( 20000000 / 16 )
342
343#define OCELOT_SERIAL1_IRQ 4
344#define OCELOT_SERIAL1_BASE 0xe0001020
345
346#define _OCELOT_SERIAL_INIT(int, base) \
347 { .baud_base = OCELOT_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
348 .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
349 .io_type = SERIAL_IO_MEM }
350#define MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
351 _OCELOT_SERIAL_INIT(OCELOT_SERIAL1_IRQ, OCELOT_SERIAL1_BASE)
352#else
353#define MOMENCO_OCELOT_SERIAL_PORT_DEFNS
354#endif
355
356#ifdef CONFIG_MOMENCO_OCELOT_G
357/* Ordinary NS16552 duart with a 20MHz crystal. */
358#define OCELOT_G_BASE_BAUD ( 20000000 / 16 )
359
360#define OCELOT_G_SERIAL1_IRQ 4
361#if 0
362#define OCELOT_G_SERIAL1_BASE 0xe0001020
363#else
364#define OCELOT_G_SERIAL1_BASE 0xfd000020
365#endif
366
367#define _OCELOT_G_SERIAL_INIT(int, base) \
368 { .baud_base = OCELOT_G_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS,\
369 .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \
370 .io_type = SERIAL_IO_MEM }
371#define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
372 _OCELOT_G_SERIAL_INIT(OCELOT_G_SERIAL1_IRQ, OCELOT_G_SERIAL1_BASE)
373#else
374#define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS
375#endif
376
377#ifdef CONFIG_MOMENCO_OCELOT_C
378/* Ordinary NS16552 duart with a 20MHz crystal. */
379#define OCELOT_C_BASE_BAUD ( 20000000 / 16 )
380
381#define OCELOT_C_SERIAL1_IRQ 80
382#define OCELOT_C_SERIAL1_BASE 0xfd000020
383
384#define OCELOT_C_SERIAL2_IRQ 81
385#define OCELOT_C_SERIAL2_BASE 0xfd000000
386
387#define _OCELOT_C_SERIAL_INIT(int, base) \
388 { .baud_base = OCELOT_C_BASE_BAUD, \
389 .irq = (int), \
390 .flags = STD_COM_FLAGS, \
391 .iomem_base = (u8 *) base, \
392 .iomem_reg_shift = 2, \
393 .io_type = SERIAL_IO_MEM \
394 }
395#define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
396 _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL1_IRQ, OCELOT_C_SERIAL1_BASE), \
397 _OCELOT_C_SERIAL_INIT(OCELOT_C_SERIAL2_IRQ, OCELOT_C_SERIAL2_BASE)
398#else
399#define MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS
400#endif
401
402#ifdef CONFIG_DDB5477
403#include <asm/ddb5xxx/ddb5477.h>
404#define DDB5477_SERIAL_PORT_DEFNS \
405 { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART0, \
406 .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04200, \
407 .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM}, \
408 { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART1, \
409 .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04240, \
410 .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM},
411#else
412#define DDB5477_SERIAL_PORT_DEFNS
413#endif
414
415#ifdef CONFIG_SGI_IP32
416/*
417 * The IP32 (SGI O2) has standard serial ports (UART 16550A) mapped in memory
418 * They are initialized in ip32_setup
419 */
420#define IP32_SERIAL_PORT_DEFNS \
421 {},{},
422#else
423#define IP32_SERIAL_PORT_DEFNS
424#endif /* CONFIG_SGI_IP32 */
425
426#define SERIAL_PORT_DFNS \
427 COBALT_SERIAL_PORT_DEFNS \
428 DDB5477_SERIAL_PORT_DEFNS \
429 EV96100_SERIAL_PORT_DEFNS \
430 EXTRA_SERIAL_PORT_DEFNS \
431 HUB6_SERIAL_PORT_DFNS \
432 IP32_SERIAL_PORT_DEFNS \
433 ITE_SERIAL_PORT_DEFNS \
434 IVR_SERIAL_PORT_DEFNS \
435 JAZZ_SERIAL_PORT_DEFNS \
436 STD_SERIAL_PORT_DEFNS \
437 MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
438 MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
439 MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
440 MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \
441 TXX927_SERIAL_PORT_DEFNS \
442 AU1000_SERIAL_PORT_DEFNS
443
444#endif /* _ASM_SERIAL_H */
diff --git a/include/asm-mips/setup.h b/include/asm-mips/setup.h
new file mode 100644
index 000000000000..737fa4a6912e
--- /dev/null
+++ b/include/asm-mips/setup.h
@@ -0,0 +1,8 @@
1#ifdef __KERNEL__
2#ifndef _MIPS_SETUP_H
3#define _MIPS_SETUP_H
4
5#define COMMAND_LINE_SIZE 256
6
7#endif /* __SETUP_H */
8#endif /* __KERNEL__ */
diff --git a/include/asm-mips/sgi/gio.h b/include/asm-mips/sgi/gio.h
new file mode 100644
index 000000000000..a38d66f99872
--- /dev/null
+++ b/include/asm-mips/sgi/gio.h
@@ -0,0 +1,86 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * gio.h: Definitions for SGI GIO bus
7 *
8 * Copyright (C) 2002 Ladislav Michl
9 */
10
11#ifndef _SGI_GIO_H
12#define _SGI_GIO_H
13
14/*
15 * GIO bus addresses
16 *
17 * The Indigo and Indy have two GIO bus connectors. Indigo2 (all models) have
18 * three physical connectors, but only two slots, GFX and EXP0.
19 *
20 * There is 10MB of GIO address space for GIO64 slot devices
21 * slot# slot type address range size
22 * ----- --------- ----------------------- -----
23 * 0 GFX 0x1f000000 - 0x1f3fffff 4MB
24 * 1 EXP0 0x1f400000 - 0x1f5fffff 2MB
25 * 2 EXP1 0x1f600000 - 0x1f9fffff 4MB
26 *
27 * There are un-slotted devices, HPC, I/O and misc devices, which are grouped
28 * into the HPC address space.
29 * - MISC 0x1fb00000 - 0x1fbfffff 1MB
30 *
31 * Following space is reserved and unused
32 * - RESERVED 0x18000000 - 0x1effffff 112MB
33 *
34 * GIO bus IDs
35 *
36 * Each GIO bus device identifies itself to the system by answering a
37 * read with an "ID" value. IDs are either 8 or 32 bits long. IDs less
38 * than 128 are 8 bits long, with the most significant 24 bits read from
39 * the slot undefined.
40 *
41 * 32-bit IDs are divided into
42 * bits 0:6 the product ID; ranges from 0x00 to 0x7F.
43 * bit 7 0=GIO Product ID is 8 bits wide
44 * 1=GIO Product ID is 32 bits wide.
45 * bits 8:15 manufacturer version for the product.
46 * bit 16 0=GIO32 and GIO32-bis, 1=GIO64.
47 * bit 17 0=no ROM present
48 * 1=ROM present on this board AND next three words
49 * space define the ROM.
50 * bits 18:31 up to manufacturer.
51 *
52 * IDs above 0x50/0xd0 are of 3rd party boards.
53 *
54 * 8-bit IDs
55 * 0x01 XPI low cost FDDI
56 * 0x02 GTR TokenRing
57 * 0x04 Synchronous ISDN
58 * 0x05 ATM board [*]
59 * 0x06 Canon Interface
60 * 0x07 16 bit SCSI Card [*]
61 * 0x08 JPEG (Double Wide)
62 * 0x09 JPEG (Single Wide)
63 * 0x0a XPI mez. FDDI device 0
64 * 0x0b XPI mez. FDDI device 1
65 * 0x0c SMPTE 259M Video [*]
66 * 0x0d Babblefish Compression [*]
67 * 0x0e E-Plex 8-port Ethernet
68 * 0x30 Lyon Lamb IVAS
69 * 0xb8 GIO 100BaseTX Fast Ethernet (gfe)
70 *
71 * [*] Device provide 32-bit ID.
72 *
73 */
74
75#define GIO_ID(x) (x & 0x7f)
76#define GIO_32BIT_ID 0x80
77#define GIO_REV(x) ((x >> 8) & 0xff)
78#define GIO_64BIT_IFACE 0x10000
79#define GIO_ROM_PRESENT 0x20000
80#define GIO_VENDOR_CODE(x) ((x >> 18) & 0x3fff)
81
82#define GIO_SLOT_GFX_BASE 0x1f000000
83#define GIO_SLOT_EXP0_BASE 0x1f400000
84#define GIO_SLOT_EXP1_BASE 0x1f600000
85
86#endif /* _SGI_GIO_H */
diff --git a/include/asm-mips/sgi/hpc3.h b/include/asm-mips/sgi/hpc3.h
new file mode 100644
index 000000000000..a5b988d7327a
--- /dev/null
+++ b/include/asm-mips/sgi/hpc3.h
@@ -0,0 +1,317 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * hpc3.h: Definitions for SGI HPC3 controller
7 *
8 * Copyright (C) 1996 David S. Miller
9 * Copyright (C) 1998 Ralf Baechle
10 */
11
12#ifndef _SGI_HPC3_H
13#define _SGI_HPC3_H
14
15#include <linux/types.h>
16#include <asm/page.h>
17
18/* An HPC DMA descriptor. */
19struct hpc_dma_desc {
20 u32 pbuf; /* physical address of data buffer */
21 u32 cntinfo; /* counter and info bits */
22#define HPCDMA_EOX 0x80000000 /* last desc in chain for tx */
23#define HPCDMA_EOR 0x80000000 /* last desc in chain for rx */
24#define HPCDMA_EOXP 0x40000000 /* end of packet for tx */
25#define HPCDMA_EORP 0x40000000 /* end of packet for rx */
26#define HPCDMA_XIE 0x20000000 /* irq generated when at end of this desc */
27#define HPCDMA_XIU 0x01000000 /* Tx buffer in use by CPU. */
28#define HPCDMA_EIPC 0x00ff0000 /* SEEQ ethernet special xternal bytecount */
29#define HPCDMA_ETXD 0x00008000 /* set to one by HPC when packet tx'd */
30#define HPCDMA_OWN 0x00004000 /* Denotes ring buffer ownership on rx */
31#define HPCDMA_BCNT 0x00003fff /* size in bytes of this dma buffer */
32
33 u32 pnext; /* paddr of next hpc_dma_desc if any */
34};
35
36/* The set of regs for each HPC3 PBUS DMA channel. */
37struct hpc3_pbus_dmacregs {
38 volatile u32 pbdma_bptr; /* pbus dma channel buffer ptr */
39 volatile u32 pbdma_dptr; /* pbus dma channel desc ptr */
40 u32 _unused0[0x1000/4 - 2]; /* padding */
41 volatile u32 pbdma_ctrl; /* pbus dma channel control register has
42 * copletely different meaning for read
43 * compared with write */
44 /* read */
45#define HPC3_PDMACTRL_INT 0x00000001 /* interrupt (cleared after read) */
46#define HPC3_PDMACTRL_ISACT 0x00000002 /* channel active */
47 /* write */
48#define HPC3_PDMACTRL_SEL 0x00000002 /* little endian transfer */
49#define HPC3_PDMACTRL_RCV 0x00000004 /* direction is receive */
50#define HPC3_PDMACTRL_FLSH 0x00000008 /* enable flush for receive DMA */
51#define HPC3_PDMACTRL_ACT 0x00000010 /* start dma transfer */
52#define HPC3_PDMACTRL_LD 0x00000020 /* load enable for ACT */
53#define HPC3_PDMACTRL_RT 0x00000040 /* Use realtime GIO bus servicing */
54#define HPC3_PDMACTRL_HW 0x0000ff00 /* DMA High-water mark */
55#define HPC3_PDMACTRL_FB 0x003f0000 /* Ptr to beginning of fifo */
56#define HPC3_PDMACTRL_FE 0x3f000000 /* Ptr to end of fifo */
57
58 u32 _unused1[0x1000/4 - 1]; /* padding */
59};
60
61/* The HPC3 SCSI registers, this does not include external ones. */
62struct hpc3_scsiregs {
63 volatile u32 cbptr; /* current dma buffer ptr, diagnostic use only */
64 volatile u32 ndptr; /* next dma descriptor ptr */
65 u32 _unused0[0x1000/4 - 2]; /* padding */
66 volatile u32 bcd; /* byte count info */
67#define HPC3_SBCD_BCNTMSK 0x00003fff /* bytes to transfer from/to memory */
68#define HPC3_SBCD_XIE 0x00004000 /* Send IRQ when done with cur buf */
69#define HPC3_SBCD_EOX 0x00008000 /* Indicates this is last buf in chain */
70
71 volatile u32 ctrl; /* control register */
72#define HPC3_SCTRL_IRQ 0x01 /* IRQ asserted, either dma done or parity */
73#define HPC3_SCTRL_ENDIAN 0x02 /* DMA endian mode, 0=big 1=little */
74#define HPC3_SCTRL_DIR 0x04 /* DMA direction, 1=dev2mem 0=mem2dev */
75#define HPC3_SCTRL_FLUSH 0x08 /* Tells HPC3 to flush scsi fifos */
76#define HPC3_SCTRL_ACTIVE 0x10 /* SCSI DMA channel is active */
77#define HPC3_SCTRL_AMASK 0x20 /* DMA active inhibits PIO */
78#define HPC3_SCTRL_CRESET 0x40 /* Resets dma channel and external controller */
79#define HPC3_SCTRL_PERR 0x80 /* Bad parity on HPC3 iface to scsi controller */
80
81 volatile u32 gfptr; /* current GIO fifo ptr */
82 volatile u32 dfptr; /* current device fifo ptr */
83 volatile u32 dconfig; /* DMA configuration register */
84#define HPC3_SDCFG_HCLK 0x00001 /* Enable DMA half clock mode */
85#define HPC3_SDCFG_D1 0x00006 /* Cycles to spend in D1 state */
86#define HPC3_SDCFG_D2 0x00038 /* Cycles to spend in D2 state */
87#define HPC3_SDCFG_D3 0x001c0 /* Cycles to spend in D3 state */
88#define HPC3_SDCFG_HWAT 0x00e00 /* DMA high water mark */
89#define HPC3_SDCFG_HW 0x01000 /* Enable 16-bit halfword DMA accesses to scsi */
90#define HPC3_SDCFG_SWAP 0x02000 /* Byte swap all DMA accesses */
91#define HPC3_SDCFG_EPAR 0x04000 /* Enable parity checking for DMA */
92#define HPC3_SDCFG_POLL 0x08000 /* hd_dreq polarity control */
93#define HPC3_SDCFG_ERLY 0x30000 /* hd_dreq behavior control bits */
94
95 volatile u32 pconfig; /* PIO configuration register */
96#define HPC3_SPCFG_P3 0x0003 /* Cycles to spend in P3 state */
97#define HPC3_SPCFG_P2W 0x001c /* Cycles to spend in P2 state for writes */
98#define HPC3_SPCFG_P2R 0x01e0 /* Cycles to spend in P2 state for reads */
99#define HPC3_SPCFG_P1 0x0e00 /* Cycles to spend in P1 state */
100#define HPC3_SPCFG_HW 0x1000 /* Enable 16-bit halfword PIO accesses to scsi */
101#define HPC3_SPCFG_SWAP 0x2000 /* Byte swap all PIO accesses */
102#define HPC3_SPCFG_EPAR 0x4000 /* Enable parity checking for PIO */
103#define HPC3_SPCFG_FUJI 0x8000 /* Fujitsu scsi controller mode for faster dma/pio */
104
105 u32 _unused1[0x1000/4 - 6]; /* padding */
106};
107
108/* SEEQ ethernet HPC3 registers, only one seeq per HPC3. */
109struct hpc3_ethregs {
110 /* Receiver registers. */
111 volatile u32 rx_cbptr; /* current dma buffer ptr, diagnostic use only */
112 volatile u32 rx_ndptr; /* next dma descriptor ptr */
113 u32 _unused0[0x1000/4 - 2]; /* padding */
114 volatile u32 rx_bcd; /* byte count info */
115#define HPC3_ERXBCD_BCNTMSK 0x00003fff /* bytes to be sent to memory */
116#define HPC3_ERXBCD_XIE 0x20000000 /* HPC3 interrupts cpu at end of this buf */
117#define HPC3_ERXBCD_EOX 0x80000000 /* flags this as end of descriptor chain */
118
119 volatile u32 rx_ctrl; /* control register */
120#define HPC3_ERXCTRL_STAT50 0x0000003f /* Receive status reg bits of Seeq8003 */
121#define HPC3_ERXCTRL_STAT6 0x00000040 /* Rdonly irq status */
122#define HPC3_ERXCTRL_STAT7 0x00000080 /* Rdonlt old/new status bit from Seeq */
123#define HPC3_ERXCTRL_ENDIAN 0x00000100 /* Endian for dma channel, little=1 big=0 */
124#define HPC3_ERXCTRL_ACTIVE 0x00000200 /* Tells if DMA transfer is in progress */
125#define HPC3_ERXCTRL_AMASK 0x00000400 /* Tells if ACTIVE inhibits PIO's to hpc3 */
126#define HPC3_ERXCTRL_RBO 0x00000800 /* Receive buffer overflow if set to 1 */
127
128 volatile u32 rx_gfptr; /* current GIO fifo ptr */
129 volatile u32 rx_dfptr; /* current device fifo ptr */
130 u32 _unused1; /* padding */
131 volatile u32 rx_reset; /* reset register */
132#define HPC3_ERXRST_CRESET 0x1 /* Reset dma channel and external controller */
133#define HPC3_ERXRST_CLRIRQ 0x2 /* Clear channel interrupt */
134#define HPC3_ERXRST_LBACK 0x4 /* Enable diagnostic loopback mode of Seeq8003 */
135
136 volatile u32 rx_dconfig; /* DMA configuration register */
137#define HPC3_ERXDCFG_D1 0x0000f /* Cycles to spend in D1 state for PIO */
138#define HPC3_ERXDCFG_D2 0x000f0 /* Cycles to spend in D2 state for PIO */
139#define HPC3_ERXDCFG_D3 0x00f00 /* Cycles to spend in D3 state for PIO */
140#define HPC3_ERXDCFG_WCTRL 0x01000 /* Enable writes of desc into ex ctrl port */
141#define HPC3_ERXDCFG_FRXDC 0x02000 /* Clear eop stat bits upon rxdc, hw seeq fix */
142#define HPC3_ERXDCFG_FEOP 0x04000 /* Bad packet marker timeout enable */
143#define HPC3_ERXDCFG_FIRQ 0x08000 /* Another bad packet timeout enable */
144#define HPC3_ERXDCFG_PTO 0x30000 /* Programmed timeout value for above two */
145
146 volatile u32 rx_pconfig; /* PIO configuration register */
147#define HPC3_ERXPCFG_P1 0x000f /* Cycles to spend in P1 state for PIO */
148#define HPC3_ERXPCFG_P2 0x00f0 /* Cycles to spend in P2 state for PIO */
149#define HPC3_ERXPCFG_P3 0x0f00 /* Cycles to spend in P3 state for PIO */
150#define HPC3_ERXPCFG_TST 0x1000 /* Diagnistic ram test feature bit */
151
152 u32 _unused2[0x1000/4 - 8]; /* padding */
153
154 /* Transmitter registers. */
155 volatile u32 tx_cbptr; /* current dma buffer ptr, diagnostic use only */
156 volatile u32 tx_ndptr; /* next dma descriptor ptr */
157 u32 _unused3[0x1000/4 - 2]; /* padding */
158 volatile u32 tx_bcd; /* byte count info */
159#define HPC3_ETXBCD_BCNTMSK 0x00003fff /* bytes to be read from memory */
160#define HPC3_ETXBCD_ESAMP 0x10000000 /* if set, too late to add descriptor */
161#define HPC3_ETXBCD_XIE 0x20000000 /* Interrupt cpu at end of cur desc */
162#define HPC3_ETXBCD_EOP 0x40000000 /* Last byte of cur buf is end of packet */
163#define HPC3_ETXBCD_EOX 0x80000000 /* This buf is the end of desc chain */
164
165 volatile u32 tx_ctrl; /* control register */
166#define HPC3_ETXCTRL_STAT30 0x0000000f /* Rdonly copy of seeq tx stat reg */
167#define HPC3_ETXCTRL_STAT4 0x00000010 /* Indicate late collision occurred */
168#define HPC3_ETXCTRL_STAT75 0x000000e0 /* Rdonly irq status from seeq */
169#define HPC3_ETXCTRL_ENDIAN 0x00000100 /* DMA channel endian mode, 1=little 0=big */
170#define HPC3_ETXCTRL_ACTIVE 0x00000200 /* DMA tx channel is active */
171#define HPC3_ETXCTRL_AMASK 0x00000400 /* Indicates ACTIVE inhibits PIO's */
172
173 volatile u32 tx_gfptr; /* current GIO fifo ptr */
174 volatile u32 tx_dfptr; /* current device fifo ptr */
175 u32 _unused4[0x1000/4 - 4]; /* padding */
176};
177
178struct hpc3_regs {
179 /* First regs for the PBUS 8 dma channels. */
180 struct hpc3_pbus_dmacregs pbdma[8];
181
182 /* Now the HPC scsi registers, we get two scsi reg sets. */
183 struct hpc3_scsiregs scsi_chan0, scsi_chan1;
184
185 /* The SEEQ hpc3 ethernet dma/control registers. */
186 struct hpc3_ethregs ethregs;
187
188 /* Here are where the hpc3 fifo's can be directly accessed
189 * via PIO accesses. Under normal operation we never stick
190 * our grubby paws in here so it's just padding. */
191 u32 _unused0[0x18000/4];
192
193 /* HPC3 irq status regs. Due to a peculiar bug you need to
194 * look at two different register addresses to get at all of
195 * the status bits. The first reg can only reliably report
196 * bits 4:0 of the status, and the second reg can only
197 * reliably report bits 9:5 of the hpc3 irq status. I told
198 * you it was a peculiar bug. ;-)
199 */
200 volatile u32 istat0; /* Irq status, only bits <4:0> reliable. */
201#define HPC3_ISTAT_PBIMASK 0x0ff /* irq bits for pbus devs 0 --> 7 */
202#define HPC3_ISTAT_SC0MASK 0x100 /* irq bit for scsi channel 0 */
203#define HPC3_ISTAT_SC1MASK 0x200 /* irq bit for scsi channel 1 */
204
205 volatile u32 gio_misc; /* GIO misc control bits. */
206#define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */
207#define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */
208
209 volatile u32 eeprom; /* EEPROM data reg. */
210#define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */
211#define HPC3_EEPROM_CSEL 0x02 /* Chip select */
212#define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */
213#define HPC3_EEPROM_DATO 0x08 /* Data out */
214#define HPC3_EEPROM_DATI 0x10 /* Data in */
215
216 volatile u32 istat1; /* Irq status, only bits <9:5> reliable. */
217 volatile u32 bestat; /* Bus error interrupt status reg. */
218#define HPC3_BESTAT_BLMASK 0x000ff /* Bus lane where bad parity occurred */
219#define HPC3_BESTAT_CTYPE 0x00100 /* Bus cycle type, 0=PIO 1=DMA */
220#define HPC3_BESTAT_PIDSHIFT 9
221#define HPC3_BESTAT_PIDMASK 0x3f700 /* DMA channel parity identifier */
222
223 u32 _unused1[0x14000/4 - 5]; /* padding */
224
225 /* Now direct PIO per-HPC3 peripheral access to external regs. */
226 volatile u32 scsi0_ext[256]; /* SCSI channel 0 external regs */
227 u32 _unused2[0x7c00/4];
228 volatile u32 scsi1_ext[256]; /* SCSI channel 1 external regs */
229 u32 _unused3[0x7c00/4];
230 volatile u32 eth_ext[320]; /* Ethernet external registers */
231 u32 _unused4[0x3b00/4];
232
233 /* Per-peripheral device external registers and DMA/PIO control. */
234 volatile u32 pbus_extregs[16][256];
235 volatile u32 pbus_dmacfg[8][128];
236 /* Cycles to spend in D3 for reads */
237#define HPC3_DMACFG_D3R_MASK 0x00000001
238#define HPC3_DMACFG_D3R_SHIFT 0
239 /* Cycles to spend in D4 for reads */
240#define HPC3_DMACFG_D4R_MASK 0x0000001e
241#define HPC3_DMACFG_D4R_SHIFT 1
242 /* Cycles to spend in D5 for reads */
243#define HPC3_DMACFG_D5R_MASK 0x000001e0
244#define HPC3_DMACFG_D5R_SHIFT 5
245 /* Cycles to spend in D3 for writes */
246#define HPC3_DMACFG_D3W_MASK 0x00000200
247#define HPC3_DMACFG_D3W_SHIFT 9
248 /* Cycles to spend in D4 for writes */
249#define HPC3_DMACFG_D4W_MASK 0x00003c00
250#define HPC3_DMACFG_D4W_SHIFT 10
251 /* Cycles to spend in D5 for writes */
252#define HPC3_DMACFG_D5W_MASK 0x0003c000
253#define HPC3_DMACFG_D5W_SHIFT 14
254 /* Enable 16-bit DMA access mode */
255#define HPC3_DMACFG_DS16 0x00040000
256 /* Places halfwords on high 16 bits of bus */
257#define HPC3_DMACFG_EVENHI 0x00080000
258 /* Make this device real time */
259#define HPC3_DMACFG_RTIME 0x00200000
260 /* 5 bit burst count for DMA device */
261#define HPC3_DMACFG_BURST_MASK 0x07c00000
262#define HPC3_DMACFG_BURST_SHIFT 22
263 /* Use live pbus_dreq unsynchronized signal */
264#define HPC3_DMACFG_DRQLIVE 0x08000000
265 volatile u32 pbus_piocfg[16][64];
266 /* Cycles to spend in P2 state for reads */
267#define HPC3_PIOCFG_P2R_MASK 0x00001
268#define HPC3_PIOCFG_P2R_SHIFT 0
269 /* Cycles to spend in P3 state for reads */
270#define HPC3_PIOCFG_P3R_MASK 0x0001e
271#define HPC3_PIOCFG_P3R_SHIFT 1
272 /* Cycles to spend in P4 state for reads */
273#define HPC3_PIOCFG_P4R_MASK 0x001e0
274#define HPC3_PIOCFG_P4R_SHIFT 5
275 /* Cycles to spend in P2 state for writes */
276#define HPC3_PIOCFG_P2W_MASK 0x00200
277#define HPC3_PIOCFG_P2W_SHIFT 9
278 /* Cycles to spend in P3 state for writes */
279#define HPC3_PIOCFG_P3W_MASK 0x03c00
280#define HPC3_PIOCFG_P3W_SHIFT 10
281 /* Cycles to spend in P4 state for writes */
282#define HPC3_PIOCFG_P4W_MASK 0x3c000
283#define HPC3_PIOCFG_P4W_SHIFT 14
284 /* Enable 16-bit PIO accesses */
285#define HPC3_PIOCFG_DS16 0x40000
286 /* Place even address bits in bits <15:8> */
287#define HPC3_PIOCFG_EVENHI 0x80000
288
289 /* PBUS PROM control regs. */
290 volatile u32 pbus_promwe; /* PROM write enable register */
291#define HPC3_PROM_WENAB 0x1 /* Enable writes to the PROM */
292
293 u32 _unused5[0x0800/4 - 1];
294 volatile u32 pbus_promswap; /* Chip select swap reg */
295#define HPC3_PROM_SWAP 0x1 /* invert GIO addr bit to select prom0 or prom1 */
296
297 u32 _unused6[0x0800/4 - 1];
298 volatile u32 pbus_gout; /* PROM general purpose output reg */
299#define HPC3_PROM_STAT 0x1 /* General purpose status bit in gout */
300
301 u32 _unused7[0x1000/4 - 1];
302 volatile u32 rtcregs[14]; /* Dallas clock registers */
303 u32 _unused8[50];
304 volatile u32 bbram[8192-50-14]; /* Battery backed ram */
305};
306
307/*
308 * It is possible to have two HPC3's within the address space on
309 * one machine, though only having one is more likely on an Indy.
310 */
311extern struct hpc3_regs *hpc3c0, *hpc3c1;
312#define HPC3_CHIP0_BASE 0x1fb80000 /* physical */
313#define HPC3_CHIP1_BASE 0x1fb00000 /* physical */
314
315extern void sgihpc_init(void);
316
317#endif /* _SGI_HPC3_H */
diff --git a/include/asm-mips/sgi/ioc.h b/include/asm-mips/sgi/ioc.h
new file mode 100644
index 000000000000..169187f53fbc
--- /dev/null
+++ b/include/asm-mips/sgi/ioc.h
@@ -0,0 +1,200 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * ioc.h: Definitions for SGI I/O Controller
7 *
8 * Copyright (C) 1996 David S. Miller
9 * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle
10 * Copyright (C) 2001, 2003 Ladislav Michl
11 */
12
13#ifndef _SGI_IOC_H
14#define _SGI_IOC_H
15
16#include <linux/types.h>
17#include <asm/sgi/pi1.h>
18
19/*
20 * All registers are 8-bit wide alligned on 32-bit boundary. Bad things
21 * happen if you try word access them. You have been warned.
22 */
23
24struct sgioc_uart_regs {
25 u8 _ctrl1[3];
26 volatile u8 ctrl1;
27 u8 _data1[3];
28 volatile u8 data1;
29 u8 _ctrl2[3];
30 volatile u8 ctrl2;
31 u8 _data2[3];
32 volatile u8 data2;
33};
34
35struct sgioc_keyb_regs {
36 u8 _data[3];
37 volatile u8 data;
38 u8 _command[3];
39 volatile u8 command;
40};
41
42struct sgint_regs {
43 u8 _istat0[3];
44 volatile u8 istat0; /* Interrupt status zero */
45#define SGINT_ISTAT0_FFULL 0x01
46#define SGINT_ISTAT0_SCSI0 0x02
47#define SGINT_ISTAT0_SCSI1 0x04
48#define SGINT_ISTAT0_ENET 0x08
49#define SGINT_ISTAT0_GFXDMA 0x10
50#define SGINT_ISTAT0_PPORT 0x20
51#define SGINT_ISTAT0_HPC2 0x40
52#define SGINT_ISTAT0_LIO2 0x80
53 u8 _imask0[3];
54 volatile u8 imask0; /* Interrupt mask zero */
55 u8 _istat1[3];
56 volatile u8 istat1; /* Interrupt status one */
57#define SGINT_ISTAT1_ISDNI 0x01
58#define SGINT_ISTAT1_PWR 0x02
59#define SGINT_ISTAT1_ISDNH 0x04
60#define SGINT_ISTAT1_LIO3 0x08
61#define SGINT_ISTAT1_HPC3 0x10
62#define SGINT_ISTAT1_AFAIL 0x20
63#define SGINT_ISTAT1_VIDEO 0x40
64#define SGINT_ISTAT1_GIO2 0x80
65 u8 _imask1[3];
66 volatile u8 imask1; /* Interrupt mask one */
67 u8 _vmeistat[3];
68 volatile u8 vmeistat; /* VME interrupt status */
69 u8 _cmeimask0[3];
70 volatile u8 cmeimask0; /* VME interrupt mask zero */
71 u8 _cmeimask1[3];
72 volatile u8 cmeimask1; /* VME interrupt mask one */
73 u8 _cmepol[3];
74 volatile u8 cmepol; /* VME polarity */
75 u8 _tclear[3];
76 volatile u8 tclear;
77 u8 _errstat[3];
78 volatile u8 errstat; /* Error status reg, reserved on INT2 */
79 u32 _unused0[2];
80 u8 _tcnt0[3];
81 volatile u8 tcnt0; /* counter 0 */
82 u8 _tcnt1[3];
83 volatile u8 tcnt1; /* counter 1 */
84 u8 _tcnt2[3];
85 volatile u8 tcnt2; /* counter 2 */
86 u8 _tcword[3];
87 volatile u8 tcword; /* control word */
88#define SGINT_TCWORD_BCD 0x01 /* Use BCD mode for counters */
89#define SGINT_TCWORD_MMASK 0x0e /* Mode bitmask. */
90#define SGINT_TCWORD_MITC 0x00 /* IRQ on terminal count (doesn't work) */
91#define SGINT_TCWORD_MOS 0x02 /* One-shot IRQ mode. */
92#define SGINT_TCWORD_MRGEN 0x04 /* Normal rate generation */
93#define SGINT_TCWORD_MSWGEN 0x06 /* Square wave generator mode */
94#define SGINT_TCWORD_MSWST 0x08 /* Software strobe */
95#define SGINT_TCWORD_MHWST 0x0a /* Hardware strobe */
96#define SGINT_TCWORD_CMASK 0x30 /* Command mask */
97#define SGINT_TCWORD_CLAT 0x00 /* Latch command */
98#define SGINT_TCWORD_CLSB 0x10 /* LSB read/write */
99#define SGINT_TCWORD_CMSB 0x20 /* MSB read/write */
100#define SGINT_TCWORD_CALL 0x30 /* Full counter read/write */
101#define SGINT_TCWORD_CNT0 0x00 /* Select counter zero */
102#define SGINT_TCWORD_CNT1 0x40 /* Select counter one */
103#define SGINT_TCWORD_CNT2 0x80 /* Select counter two */
104#define SGINT_TCWORD_CRBCK 0xc0 /* Readback command */
105};
106
107/*
108 * The timer is the good old 8254. Unlike in PCs it's clocked at exactly 1MHz
109 */
110#define SGINT_TIMER_CLOCK 1000000
111
112/*
113 * This is the constant we're using for calibrating the counter.
114 */
115#define SGINT_TCSAMP_COUNTER ((SGINT_TIMER_CLOCK / HZ) + 255)
116
117/* We need software copies of these because they are write only. */
118extern u8 sgi_ioc_reset, sgi_ioc_write;
119
120struct sgioc_regs {
121 struct pi1_regs pport;
122 u32 _unused0[2];
123 struct sgioc_uart_regs uart;
124 struct sgioc_keyb_regs kbdmouse;
125 u8 _gcsel[3];
126 volatile u8 gcsel;
127 u8 _genctrl[3];
128 volatile u8 genctrl;
129 u8 _panel[3];
130 volatile u8 panel;
131#define SGIOC_PANEL_POWERON 0x01
132#define SGIOC_PANEL_POWERINTR 0x02
133#define SGIOC_PANEL_VOLDNINTR 0x10
134#define SGIOC_PANEL_VOLDNHOLD 0x20
135#define SGIOC_PANEL_VOLUPINTR 0x40
136#define SGIOC_PANEL_VOLUPHOLD 0x80
137 u32 _unused1;
138 u8 _sysid[3];
139 volatile u8 sysid;
140#define SGIOC_SYSID_FULLHOUSE 0x01
141#define SGIOC_SYSID_BOARDREV(x) ((x & 0xe0) > 5)
142#define SGIOC_SYSID_CHIPREV(x) ((x & 0x1e) > 1)
143 u32 _unused2;
144 u8 _read[3];
145 volatile u8 read;
146 u32 _unused3;
147 u8 _dmasel[3];
148 volatile u8 dmasel;
149#define SGIOC_DMASEL_SCLK10MHZ 0x00 /* use 10MHZ serial clock */
150#define SGIOC_DMASEL_ISDNB 0x01 /* enable isdn B */
151#define SGIOC_DMASEL_ISDNA 0x02 /* enable isdn A */
152#define SGIOC_DMASEL_PPORT 0x04 /* use parallel DMA */
153#define SGIOC_DMASEL_SCLK667MHZ 0x10 /* use 6.67MHZ serial clock */
154#define SGIOC_DMASEL_SCLKEXT 0x20 /* use external serial clock */
155 u32 _unused4;
156 u8 _reset[3];
157 volatile u8 reset;
158#define SGIOC_RESET_PPORT 0x01 /* 0=parport reset, 1=nornal */
159#define SGIOC_RESET_KBDMOUSE 0x02 /* 0=kbdmouse reset, 1=normal */
160#define SGIOC_RESET_EISA 0x04 /* 0=eisa reset, 1=normal */
161#define SGIOC_RESET_ISDN 0x08 /* 0=isdn reset, 1=normal */
162#define SGIOC_RESET_LC0OFF 0x10 /* guiness: turn led off (red, else green) */
163#define SGIOC_RESET_LC1OFF 0x20 /* guiness: turn led off (green, else amber) */
164 u32 _unused5;
165 u8 _write[3];
166 volatile u8 write;
167#define SGIOC_WRITE_NTHRESH 0x01 /* use 4.5db threshhold */
168#define SGIOC_WRITE_TPSPEED 0x02 /* use 100ohm TP speed */
169#define SGIOC_WRITE_EPSEL 0x04 /* force cable mode: 1=AUI 0=TP */
170#define SGIOC_WRITE_EASEL 0x08 /* 1=autoselect 0=manual cable selection */
171#define SGIOC_WRITE_U1AMODE 0x10 /* 1=PC 0=MAC UART mode */
172#define SGIOC_WRITE_U0AMODE 0x20 /* 1=PC 0=MAC UART mode */
173#define SGIOC_WRITE_MLO 0x40 /* 1=4.75V 0=+5V */
174#define SGIOC_WRITE_MHI 0x80 /* 1=5.25V 0=+5V */
175 u32 _unused6;
176 struct sgint_regs int3;
177 u32 _unused7[16];
178 volatile u32 extio; /* FullHouse only */
179#define EXTIO_S0_IRQ_3 0x8000 /* S0: vid.vsync */
180#define EXTIO_S0_IRQ_2 0x4000 /* S0: gfx.fifofull */
181#define EXTIO_S0_IRQ_1 0x2000 /* S0: gfx.int */
182#define EXTIO_S0_RETRACE 0x1000
183#define EXTIO_SG_IRQ_3 0x0800 /* SG: vid.vsync */
184#define EXTIO_SG_IRQ_2 0x0400 /* SG: gfx.fifofull */
185#define EXTIO_SG_IRQ_1 0x0200 /* SG: gfx.int */
186#define EXTIO_SG_RETRACE 0x0100
187#define EXTIO_GIO_33MHZ 0x0080
188#define EXTIO_EISA_BUSERR 0x0040
189#define EXTIO_MC_BUSERR 0x0020
190#define EXTIO_HPC3_BUSERR 0x0010
191#define EXTIO_S0_STAT_1 0x0008
192#define EXTIO_S0_STAT_0 0x0004
193#define EXTIO_SG_STAT_1 0x0002
194#define EXTIO_SG_STAT_0 0x0001
195};
196
197extern struct sgioc_regs *sgioc;
198extern struct sgint_regs *sgint;
199
200#endif
diff --git a/include/asm-mips/sgi/ip22.h b/include/asm-mips/sgi/ip22.h
new file mode 100644
index 000000000000..97d73adb4e40
--- /dev/null
+++ b/include/asm-mips/sgi/ip22.h
@@ -0,0 +1,77 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * ip22.h: Definitions for SGI IP22 machines
7 *
8 * Copyright (C) 1996 David S. Miller
9 * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle
10 */
11
12#ifndef _SGI_IP22_H
13#define _SGI_IP22_H
14
15/*
16 * These are the virtual IRQ numbers, we divide all IRQ's into
17 * 'spaces', the 'space' determines where and how to enable/disable
18 * that particular IRQ on an SGI machine. HPC DMA and MC DMA interrups
19 * are not supported this way. Driver is supposed to allocate HPC/MC
20 * interrupt as shareable and then look to proper status bit (see
21 * HAL2 driver). This will prevent many complications, trust me ;-)
22 */
23
24#include <asm/sgi/ioc.h>
25
26#define SGINT_EISA 0 /* 16 EISA irq levels (Indigo2) */
27#define SGINT_CPU 16 /* MIPS CPU define 8 interrupt sources */
28#define SGINT_LOCAL0 24 /* 8 local0 irq levels */
29#define SGINT_LOCAL1 32 /* 8 local1 irq levels */
30#define SGINT_LOCAL2 40 /* 8 local2 vectored irq levels */
31#define SGINT_LOCAL3 48 /* 8 local3 vectored irq levels */
32#define SGINT_END 56 /* End of 'spaces' */
33
34/*
35 * Individual interrupt definitions for the Indy and Indigo2
36 */
37
38#define SGI_SOFT_0_IRQ SGINT_CPU + 0
39#define SGI_SOFT_1_IRQ SGINT_CPU + 1
40#define SGI_LOCAL_0_IRQ SGINT_CPU + 2
41#define SGI_LOCAL_1_IRQ SGINT_CPU + 3
42#define SGI_8254_0_IRQ SGINT_CPU + 4
43#define SGI_8254_1_IRQ SGINT_CPU + 5
44#define SGI_BUSERR_IRQ SGINT_CPU + 6
45#define SGI_TIMER_IRQ SGINT_CPU + 7
46
47#define SGI_FIFO_IRQ SGINT_LOCAL0 + 0 /* FIFO full */
48#define SGI_GIO_0_IRQ SGI_FIFO_IRQ /* GIO-0 */
49#define SGI_WD93_0_IRQ SGINT_LOCAL0 + 1 /* 1st onboard WD93 */
50#define SGI_WD93_1_IRQ SGINT_LOCAL0 + 2 /* 2nd onboard WD93 */
51#define SGI_ENET_IRQ SGINT_LOCAL0 + 3 /* onboard ethernet */
52#define SGI_MCDMA_IRQ SGINT_LOCAL0 + 4 /* MC DMA done */
53#define SGI_PARPORT_IRQ SGINT_LOCAL0 + 5 /* Parallel port */
54#define SGI_GIO_1_IRQ SGINT_LOCAL0 + 6 /* GE / GIO-1 / 2nd-HPC */
55#define SGI_MAP_0_IRQ SGINT_LOCAL0 + 7 /* Mappable interrupt 0 */
56
57#define SGI_GPL0_IRQ SGINT_LOCAL1 + 0 /* General Purpose LOCAL1_N<0> */
58#define SGI_PANEL_IRQ SGINT_LOCAL1 + 1 /* front panel */
59#define SGI_GPL2_IRQ SGINT_LOCAL1 + 2 /* General Purpose LOCAL1_N<2> */
60#define SGI_MAP_1_IRQ SGINT_LOCAL1 + 3 /* Mappable interrupt 1 */
61#define SGI_HPCDMA_IRQ SGINT_LOCAL1 + 4 /* HPC DMA done */
62#define SGI_ACFAIL_IRQ SGINT_LOCAL1 + 5 /* AC fail */
63#define SGI_VINO_IRQ SGINT_LOCAL1 + 6 /* Indy VINO */
64#define SGI_GIO_2_IRQ SGINT_LOCAL1 + 7 /* Vert retrace / GIO-2 */
65
66/* Mapped interrupts. These interrupts may be mapped to either 0, or 1 */
67#define SGI_VERT_IRQ SGINT_LOCAL2 + 0 /* INT3: newport vertical status */
68#define SGI_EISA_IRQ SGINT_LOCAL2 + 3 /* EISA interrupts */
69#define SGI_KEYBD_IRQ SGINT_LOCAL2 + 4 /* keyboard */
70#define SGI_SERIAL_IRQ SGINT_LOCAL2 + 5 /* onboard serial */
71
72#define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE)
73
74extern unsigned short ip22_eeprom_read(volatile unsigned int *ctrl, int reg);
75extern unsigned short ip22_nvram_read(int reg);
76
77#endif
diff --git a/include/asm-mips/sgi/mc.h b/include/asm-mips/sgi/mc.h
new file mode 100644
index 000000000000..fd98f930607c
--- /dev/null
+++ b/include/asm-mips/sgi/mc.h
@@ -0,0 +1,231 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * mc.h: Definitions for SGI Memory Controller
7 *
8 * Copyright (C) 1996 David S. Miller
9 * Copyright (C) 1999 Ralf Baechle
10 * Copyright (C) 1999 Silicon Graphics, Inc.
11 */
12
13#ifndef _SGI_MC_H
14#define _SGI_MC_H
15
16struct sgimc_regs {
17 u32 _unused0;
18 volatile u32 cpuctrl0; /* CPU control register 0, readwrite */
19#define SGIMC_CCTRL0_REFS 0x0000000f /* REFS mask */
20#define SGIMC_CCTRL0_EREFRESH 0x00000010 /* Memory refresh enable */
21#define SGIMC_CCTRL0_EPERRGIO 0x00000020 /* GIO parity error enable */
22#define SGIMC_CCTRL0_EPERRMEM 0x00000040 /* Main mem parity error enable */
23#define SGIMC_CCTRL0_EPERRCPU 0x00000080 /* CPU bus parity error enable */
24#define SGIMC_CCTRL0_WDOG 0x00000100 /* Watchdog timer enable */
25#define SGIMC_CCTRL0_SYSINIT 0x00000200 /* System init bit */
26#define SGIMC_CCTRL0_GFXRESET 0x00000400 /* Graphics interface reset */
27#define SGIMC_CCTRL0_EISALOCK 0x00000800 /* Lock CPU from memory for EISA */
28#define SGIMC_CCTRL0_EPERRSCMD 0x00001000 /* SysCMD bus parity error enable */
29#define SGIMC_CCTRL0_IENAB 0x00002000 /* Allow interrupts from MC */
30#define SGIMC_CCTRL0_ESNOOP 0x00004000 /* Snooping I/O enable */
31#define SGIMC_CCTRL0_EPROMWR 0x00008000 /* Prom writes from cpu enable */
32#define SGIMC_CCTRL0_WRESETPMEM 0x00010000 /* Perform warm reset, preserves mem */
33#define SGIMC_CCTRL0_LENDIAN 0x00020000 /* Put MC in little-endian mode */
34#define SGIMC_CCTRL0_WRESETDMEM 0x00040000 /* Warm reset, destroys mem contents */
35#define SGIMC_CCTRL0_CMEMBADPAR 0x02000000 /* Generate bad perr from cpu to mem */
36#define SGIMC_CCTRL0_R4KNOCHKPARR 0x04000000 /* Don't chk parity on mem data reads */
37#define SGIMC_CCTRL0_GIOBTOB 0x08000000 /* Allow GIO back to back writes */
38 u32 _unused1;
39 volatile u32 cpuctrl1; /* CPU control register 1, readwrite */
40#define SGIMC_CCTRL1_EGIOTIMEO 0x00000010 /* GIO bus timeout enable */
41#define SGIMC_CCTRL1_FIXEDEHPC 0x00001000 /* Fixed HPC endianness */
42#define SGIMC_CCTRL1_LITTLEHPC 0x00002000 /* Little endian HPC */
43#define SGIMC_CCTRL1_FIXEDEEXP0 0x00004000 /* Fixed EXP0 endianness */
44#define SGIMC_CCTRL1_LITTLEEXP0 0x00008000 /* Little endian EXP0 */
45#define SGIMC_CCTRL1_FIXEDEEXP1 0x00010000 /* Fixed EXP1 endianness */
46#define SGIMC_CCTRL1_LITTLEEXP1 0x00020000 /* Little endian EXP1 */
47
48 u32 _unused2;
49 volatile u32 watchdogt; /* Watchdog reg rdonly, write clears */
50
51 u32 _unused3;
52 volatile u32 systemid; /* MC system ID register, readonly */
53#define SGIMC_SYSID_MASKREV 0x0000000f /* Revision of MC controller */
54#define SGIMC_SYSID_EPRESENT 0x00000010 /* Indicates presence of EISA bus */
55
56 u32 _unused4[3];
57 volatile u32 divider; /* Divider reg for RPSS */
58
59 u32 _unused5;
60 volatile u32 eeprom; /* EEPROM byte reg for r4k */
61#define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */
62#define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */
63#define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */
64#define SGIMC_EEPROM_SDATAO 0x00000008 /* Serial EEPROM data-out */
65#define SGIMC_EEPROM_SDATAI 0x00000010 /* Serial EEPROM data-in */
66
67 u32 _unused6[3];
68 volatile u32 rcntpre; /* Preload refresh counter */
69
70 u32 _unused7;
71 volatile u32 rcounter; /* Readonly refresh counter */
72
73 u32 _unused8[13];
74 volatile u32 giopar; /* Parameter word for GIO64 */
75#define SGIMC_GIOPAR_HPC64 0x00000001 /* HPC talks to GIO using 64-bits */
76#define SGIMC_GIOPAR_GFX64 0x00000002 /* GFX talks to GIO using 64-bits */
77#define SGIMC_GIOPAR_EXP064 0x00000004 /* EXP(slot0) talks using 64-bits */
78#define SGIMC_GIOPAR_EXP164 0x00000008 /* EXP(slot1) talks using 64-bits */
79#define SGIMC_GIOPAR_EISA64 0x00000010 /* EISA bus talks 64-bits to GIO */
80#define SGIMC_GIOPAR_HPC264 0x00000020 /* 2nd HPX talks 64-bits to GIO */
81#define SGIMC_GIOPAR_RTIMEGFX 0x00000040 /* GFX device has realtime attr */
82#define SGIMC_GIOPAR_RTIMEEXP0 0x00000080 /* EXP(slot0) has realtime attr */
83#define SGIMC_GIOPAR_RTIMEEXP1 0x00000100 /* EXP(slot1) has realtime attr */
84#define SGIMC_GIOPAR_MASTEREISA 0x00000200 /* EISA bus can act as bus master */
85#define SGIMC_GIOPAR_ONEBUS 0x00000400 /* Exists one GIO64 pipelined bus */
86#define SGIMC_GIOPAR_MASTERGFX 0x00000800 /* GFX can act as a bus master */
87#define SGIMC_GIOPAR_MASTEREXP0 0x00001000 /* EXP(slot0) can bus master */
88#define SGIMC_GIOPAR_MASTEREXP1 0x00002000 /* EXP(slot1) can bus master */
89#define SGIMC_GIOPAR_PLINEEXP0 0x00004000 /* EXP(slot0) has pipeline attr */
90#define SGIMC_GIOPAR_PLINEEXP1 0x00008000 /* EXP(slot1) has pipeline attr */
91
92 u32 _unused9;
93 volatile u32 cputp; /* CPU bus arb time period */
94
95 u32 _unused10[3];
96 volatile u32 lbursttp; /* Time period for long bursts */
97
98 /* MC chip can drive up to 4 bank 4 SIMMs each. All SIMMs in bank must
99 * be the same size. The size encoding for supported SIMMs is bellow */
100 u32 _unused11[9];
101 volatile u32 mconfig0; /* Memory config register zero */
102 u32 _unused12;
103 volatile u32 mconfig1; /* Memory config register one */
104#define SGIMC_MCONFIG_BASEADDR 0x000000ff /* Base address of bank*/
105#define SGIMC_MCONFIG_RMASK 0x00001f00 /* Ram config bitmask */
106#define SGIMC_MCONFIG_BVALID 0x00002000 /* Bank is valid */
107#define SGIMC_MCONFIG_SBANKS 0x00004000 /* Number of subbanks */
108
109 u32 _unused13;
110 volatile u32 cmacc; /* Mem access config for CPU */
111 u32 _unused14;
112 volatile u32 gmacc; /* Mem access config for GIO */
113
114 /* This define applies to both cmacc and gmacc registers above. */
115#define SGIMC_MACC_ALIASBIG 0x20000000 /* 512MB home for alias */
116
117 /* Error address/status regs from GIO and CPU perspectives. */
118 u32 _unused15;
119 volatile u32 cerr; /* Error address reg for CPU */
120 u32 _unused16;
121 volatile u32 cstat; /* Status reg for CPU */
122#define SGIMC_CSTAT_RD 0x00000100 /* read parity error */
123#define SGIMC_CSTAT_PAR 0x00000200 /* CPU parity error */
124#define SGIMC_CSTAT_ADDR 0x00000400 /* memory bus error bad addr */
125#define SGIMC_CSTAT_SYSAD_PAR 0x00000800 /* sysad parity error */
126#define SGIMC_CSTAT_SYSCMD_PAR 0x00001000 /* syscmd parity error */
127#define SGIMC_CSTAT_BAD_DATA 0x00002000 /* bad data identifier */
128#define SGIMC_CSTAT_PAR_MASK 0x00001f00 /* parity error mask */
129#define SGIMC_CSTAT_RD_PAR (SGIMC_CSTAT_RD | SGIMC_CSTAT_PAR)
130
131 u32 _unused17;
132 volatile u32 gerr; /* Error address reg for GIO */
133 u32 _unused18;
134 volatile u32 gstat; /* Status reg for GIO */
135#define SGIMC_GSTAT_RD 0x00000100 /* read parity error */
136#define SGIMC_GSTAT_WR 0x00000200 /* write parity error */
137#define SGIMC_GSTAT_TIME 0x00000400 /* GIO bus timed out */
138#define SGIMC_GSTAT_PROM 0x00000800 /* write to PROM when PROM_EN not set */
139#define SGIMC_GSTAT_ADDR 0x00001000 /* parity error on addr cycle */
140#define SGIMC_GSTAT_BC 0x00002000 /* parity error on byte count cycle */
141#define SGIMC_GSTAT_PIO_RD 0x00004000 /* read data parity on pio */
142#define SGIMC_GSTAT_PIO_WR 0x00008000 /* write data parity on pio */
143
144 /* Special hard bus locking registers. */
145 u32 _unused19;
146 volatile u32 syssembit; /* Uni-bit system semaphore */
147 u32 _unused20;
148 volatile u32 mlock; /* Global GIO memory access lock */
149 u32 _unused21;
150 volatile u32 elock; /* Locks EISA from GIO accesses */
151
152 /* GIO dma control registers. */
153 u32 _unused22[15];
154 volatile u32 gio_dma_trans; /* DMA mask to translation GIO addrs */
155 u32 _unused23;
156 volatile u32 gio_dma_sbits; /* DMA GIO addr substitution bits */
157 u32 _unused24;
158 volatile u32 dma_intr_cause; /* DMA IRQ cause indicator bits */
159 u32 _unused25;
160 volatile u32 dma_ctrl; /* Main DMA control reg */
161
162 /* DMA TLB entry 0 */
163 u32 _unused26[5];
164 volatile u32 dtlb_hi0;
165 u32 _unused27;
166 volatile u32 dtlb_lo0;
167
168 /* DMA TLB entry 1 */
169 u32 _unused28;
170 volatile u32 dtlb_hi1;
171 u32 _unused29;
172 volatile u32 dtlb_lo1;
173
174 /* DMA TLB entry 2 */
175 u32 _unused30;
176 volatile u32 dtlb_hi2;
177 u32 _unused31;
178 volatile u32 dtlb_lo2;
179
180 /* DMA TLB entry 3 */
181 u32 _unused32;
182 volatile u32 dtlb_hi3;
183 u32 _unused33;
184 volatile u32 dtlb_lo3;
185
186 u32 _unused34[0x0392];
187
188 u32 _unused35;
189 volatile u32 rpsscounter; /* Chirps at 100ns */
190
191 u32 _unused36[0x1000/4-2*4];
192
193 u32 _unused37;
194 volatile u32 maddronly; /* Address DMA goes at */
195 u32 _unused38;
196 volatile u32 maddrpdeflts; /* Same as above, plus set defaults */
197 u32 _unused39;
198 volatile u32 dmasz; /* DMA count */
199 u32 _unused40;
200 volatile u32 ssize; /* DMA stride size */
201 u32 _unused41;
202 volatile u32 gmaddronly; /* Set GIO DMA but don't start trans */
203 u32 _unused42;
204 volatile u32 dmaddnpgo; /* Set GIO DMA addr + start transfer */
205 u32 _unused43;
206 volatile u32 dmamode; /* DMA mode config bit settings */
207 u32 _unused44;
208 volatile u32 dmaccount; /* Zoom and byte count for DMA */
209 u32 _unused45;
210 volatile u32 dmastart; /* Pedal to the metal. */
211 u32 _unused46;
212 volatile u32 dmarunning; /* DMA op is in progress */
213 u32 _unused47;
214 volatile u32 maddrdefstart; /* Set dma addr, defaults, and kick it */
215};
216
217extern struct sgimc_regs *sgimc;
218#define SGIMC_BASE 0x1fa00000 /* physical */
219
220/* Base location of the two ram banks found in IP2[0268] machines. */
221#define SGIMC_SEG0_BADDR 0x08000000
222#define SGIMC_SEG1_BADDR 0x20000000
223
224/* Maximum size of the above banks are per machine. */
225#define SGIMC_SEG0_SIZE_ALL 0x10000000 /* 256MB */
226#define SGIMC_SEG1_SIZE_IP20_IP22 0x08000000 /* 128MB */
227#define SGIMC_SEG1_SIZE_IP26_IP28 0x20000000 /* 512MB */
228
229extern void sgimc_init(void);
230
231#endif /* _SGI_MC_H */
diff --git a/include/asm-mips/sgi/pi1.h b/include/asm-mips/sgi/pi1.h
new file mode 100644
index 000000000000..c9506915dc5c
--- /dev/null
+++ b/include/asm-mips/sgi/pi1.h
@@ -0,0 +1,71 @@
1/*
2 * pi1.h: Definitions for SGI PI1 parallel port
3 */
4
5#ifndef _SGI_PI1_H
6#define _SGI_PI1_H
7
8struct pi1_regs {
9 u8 _data[3];
10 volatile u8 data;
11 u8 _ctrl[3];
12 volatile u8 ctrl;
13#define PI1_CTRL_STROBE_N 0x01
14#define PI1_CTRL_AFD_N 0x02
15#define PI1_CTRL_INIT_N 0x04
16#define PI1_CTRL_SLIN_N 0x08
17#define PI1_CTRL_IRQ_ENA 0x10
18#define PI1_CTRL_DIR 0x20
19#define PI1_CTRL_SEL 0x40
20 u8 _status[3];
21 volatile u8 status;
22#define PI1_STAT_DEVID 0x03 /* bits 0-1 */
23#define PI1_STAT_NOINK 0x04 /* SGI MODE only */
24#define PI1_STAT_ERROR 0x08
25#define PI1_STAT_ONLINE 0x10
26#define PI1_STAT_PE 0x20
27#define PI1_STAT_ACK 0x40
28#define PI1_STAT_BUSY 0x80
29 u8 _dmactrl[3];
30 volatile u8 dmactrl;
31#define PI1_DMACTRL_FIFO_EMPTY 0x01 /* fifo empty R/O */
32#define PI1_DMACTRL_ABORT 0x02 /* reset DMA and internal fifo W/O */
33#define PI1_DMACTRL_STDMODE 0x00 /* bits 2-3 */
34#define PI1_DMACTRL_SGIMODE 0x04 /* bits 2-3 */
35#define PI1_DMACTRL_RICOHMODE 0x08 /* bits 2-3 */
36#define PI1_DMACTRL_HPMODE 0x0c /* bits 2-3 */
37#define PI1_DMACTRL_BLKMODE 0x10 /* block mode */
38#define PI1_DMACTRL_FIFO_CLEAR 0x20 /* clear fifo W/O */
39#define PI1_DMACTRL_READ 0x40 /* read */
40#define PI1_DMACTRL_RUN 0x80 /* pedal to the metal */
41 u8 _intstat[3];
42 volatile u8 intstat;
43#define PI1_INTSTAT_ACK 0x04
44#define PI1_INTSTAT_FEMPTY 0x08
45#define PI1_INTSTAT_NOINK 0x10
46#define PI1_INTSTAT_ONLINE 0x20
47#define PI1_INTSTAT_ERR 0x40
48#define PI1_INTSTAT_PE 0x80
49 u8 _intmask[3];
50 volatile u8 intmask; /* enabled low, reset high*/
51#define PI1_INTMASK_ACK 0x04
52#define PI1_INTMASK_FIFO_EMPTY 0x08
53#define PI1_INTMASK_NOINK 0x10
54#define PI1_INTMASK_ONLINE 0x20
55#define PI1_INTMASK_ERR 0x40
56#define PI1_INTMASK_PE 0x80
57 u8 _timer1[3];
58 volatile u8 timer1;
59#define PI1_TIME1 0x27
60 u8 _timer2[3];
61 volatile u8 timer2;
62#define PI1_TIME2 0x13
63 u8 _timer3[3];
64 volatile u8 timer3;
65#define PI1_TIME3 0x10
66 u8 _timer4[3];
67 volatile u8 timer4;
68#define PI1_TIME4 0x00
69};
70
71#endif
diff --git a/include/asm-mips/sgi/sgi.h b/include/asm-mips/sgi/sgi.h
new file mode 100644
index 000000000000..645cea7c0f8e
--- /dev/null
+++ b/include/asm-mips/sgi/sgi.h
@@ -0,0 +1,47 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * sgi.h: Definitions specific to SGI machines.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@sgi.com)
9 */
10#ifndef _ASM_SGI_SGI_H
11#define _ASM_SGI_SGI_H
12
13/* UP=UniProcessor MP=MultiProcessor(capable) */
14enum sgi_mach {
15 ip4, /* R2k UP */
16 ip5, /* R2k MP */
17 ip6, /* R3k UP */
18 ip7, /* R3k MP */
19 ip9, /* R3k UP */
20 ip12, /* R3kA UP, Indigo */
21 ip15, /* R3kA MP */
22 ip17, /* R4K UP */
23 ip19, /* R4K MP */
24 ip20, /* R4K UP, Indigo */
25 ip21, /* TFP MP */
26 ip22, /* R4x00 UP, Indigo2 */
27 ip25, /* R10k MP */
28 ip26, /* TFP UP, Indigo2 */
29 ip27, /* R10k MP, R12k MP, Origin */
30 ip28, /* R10k UP, Indigo2 */
31 ip30, /* Octane */
32 ip32, /* O2 */
33};
34
35extern enum sgi_mach sgimach;
36extern void sgi_sysinit(void);
37
38/* Many I/O space registers are byte sized and are contained within
39 * one byte per word, specifically the MSB, this macro helps out.
40 */
41#ifdef __MIPSEL__
42#define SGI_MSB(regaddr) (regaddr)
43#else
44#define SGI_MSB(regaddr) ((regaddr) | 0x3)
45#endif
46
47#endif /* _ASM_SGI_SGI_H */
diff --git a/include/asm-mips/sgialib.h b/include/asm-mips/sgialib.h
new file mode 100644
index 000000000000..73f097315502
--- /dev/null
+++ b/include/asm-mips/sgialib.h
@@ -0,0 +1,127 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI ARCS firmware interface library for the Linux kernel.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 2001, 2002 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SGIALIB_H
12#define _ASM_SGIALIB_H
13
14#include <asm/sgiarcs.h>
15
16extern struct linux_romvec *romvec;
17extern int prom_argc;
18
19extern LONG *_prom_argv, *_prom_envp;
20
21/* A 32-bit ARC PROM pass arguments and environment as 32-bit pointer.
22 These macros take care of sign extension. */
23#define prom_argv(index) ((char *) (long) _prom_argv[(index)])
24#define prom_argc(index) ((char *) (long) _prom_argc[(index)])
25
26extern int prom_flags;
27
28#define PROM_FLAG_ARCS 1
29#define PROM_FLAG_USE_AS_CONSOLE 2
30#define PROM_FLAG_DONT_FREE_TEMP 4
31
32/* Simple char-by-char console I/O. */
33extern void prom_putchar(char c);
34extern char prom_getchar(void);
35
36/* Generic printf() using ARCS console I/O. */
37extern void prom_printf(char *fmt, ...);
38
39/* Memory descriptor management. */
40#define PROM_MAX_PMEMBLOCKS 32
41struct prom_pmemblock {
42 LONG base; /* Within KSEG0 or XKPHYS. */
43 ULONG size; /* In bytes. */
44 ULONG type; /* free or prom memory */
45};
46
47/* Get next memory descriptor after CURR, returns first descriptor
48 * in chain is CURR is NULL.
49 */
50extern struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr);
51#define PROM_NULL_MDESC ((struct linux_mdesc *) 0)
52
53/* Called by prom_init to setup the physical memory pmemblock
54 * array.
55 */
56extern void prom_meminit(void);
57extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
58
59/* PROM device tree library routines. */
60#define PROM_NULL_COMPONENT ((pcomponent *) 0)
61
62/* Get sibling component of THIS. */
63extern pcomponent *ArcGetPeer(pcomponent *this);
64
65/* Get child component of THIS. */
66extern pcomponent *ArcGetChild(pcomponent *this);
67
68/* Get parent component of CHILD. */
69extern pcomponent *prom_getparent(pcomponent *child);
70
71/* Copy component opaque data of component THIS into BUFFER
72 * if component THIS has opaque data. Returns success or
73 * failure status.
74 */
75extern long prom_getcdata(void *buffer, pcomponent *this);
76
77/* Other misc. component routines. */
78extern pcomponent *prom_childadd(pcomponent *this, pcomponent *tmp, void *data);
79extern long prom_delcomponent(pcomponent *this);
80extern pcomponent *prom_componentbypath(char *path);
81
82/* This is called at prom_init time to identify the
83 * ARC architecture we are running on
84 */
85extern void prom_identify_arch(void);
86
87/* Environment variable routines. */
88extern PCHAR ArcGetEnvironmentVariable(PCHAR name);
89extern LONG ArcSetEnvironmentVariable(PCHAR name, PCHAR value);
90
91/* ARCS command line acquisition and parsing. */
92extern char *prom_getcmdline(void);
93extern void prom_init_cmdline(void);
94
95/* Acquiring info about the current time, etc. */
96extern struct linux_tinfo *prom_gettinfo(void);
97extern unsigned long prom_getrtime(void);
98
99/* File operations. */
100extern long prom_getvdirent(unsigned long fd, struct linux_vdirent *ent, unsigned long num, unsigned long *cnt);
101extern long prom_open(char *name, enum linux_omode md, unsigned long *fd);
102extern long prom_close(unsigned long fd);
103extern LONG ArcRead(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
104extern long prom_getrstatus(unsigned long fd);
105extern LONG ArcWrite(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
106extern long prom_seek(unsigned long fd, struct linux_bigint *off, enum linux_seekmode sm);
107extern long prom_mount(char *name, enum linux_mountops op);
108extern long prom_getfinfo(unsigned long fd, struct linux_finfo *buf);
109extern long prom_setfinfo(unsigned long fd, unsigned long flags, unsigned long msk);
110
111/* Running stand-along programs. */
112extern long prom_load(char *name, unsigned long end, unsigned long *pc, unsigned long *eaddr);
113extern long prom_invoke(unsigned long pc, unsigned long sp, long argc, char **argv, char **envp);
114extern long prom_exec(char *name, long argc, char **argv, char **envp);
115
116/* Misc. routines. */
117extern VOID prom_halt(VOID) __attribute__((noreturn));
118extern VOID prom_powerdown(VOID) __attribute__((noreturn));
119extern VOID prom_restart(VOID) __attribute__((noreturn));
120extern VOID ArcReboot(VOID) __attribute__((noreturn));
121extern VOID ArcEnterInteractiveMode(VOID) __attribute__((noreturn));
122extern long prom_cfgsave(VOID);
123extern struct linux_sysid *prom_getsysid(VOID);
124extern VOID ArcFlushAllCaches(VOID);
125extern DISPLAY_STATUS *ArcGetDisplayStatus(ULONG FileID);
126
127#endif /* _ASM_SGIALIB_H */
diff --git a/include/asm-mips/sgiarcs.h b/include/asm-mips/sgiarcs.h
new file mode 100644
index 000000000000..59450335f049
--- /dev/null
+++ b/include/asm-mips/sgiarcs.h
@@ -0,0 +1,549 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * ARC firmware interface defines.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 1999, 2001 Ralf Baechle (ralf@gnu.org)
10 * Copyright (C) 1999 Silicon Graphics, Inc.
11 */
12#ifndef _ASM_SGIARCS_H
13#define _ASM_SGIARCS_H
14
15#include <linux/config.h>
16#include <asm/types.h>
17#include <asm/arc/types.h>
18
19/* Various ARCS error codes. */
20#define PROM_ESUCCESS 0x00
21#define PROM_E2BIG 0x01
22#define PROM_EACCESS 0x02
23#define PROM_EAGAIN 0x03
24#define PROM_EBADF 0x04
25#define PROM_EBUSY 0x05
26#define PROM_EFAULT 0x06
27#define PROM_EINVAL 0x07
28#define PROM_EIO 0x08
29#define PROM_EISDIR 0x09
30#define PROM_EMFILE 0x0a
31#define PROM_EMLINK 0x0b
32#define PROM_ENAMETOOLONG 0x0c
33#define PROM_ENODEV 0x0d
34#define PROM_ENOENT 0x0e
35#define PROM_ENOEXEC 0x0f
36#define PROM_ENOMEM 0x10
37#define PROM_ENOSPC 0x11
38#define PROM_ENOTDIR 0x12
39#define PROM_ENOTTY 0x13
40#define PROM_ENXIO 0x14
41#define PROM_EROFS 0x15
42/* SGI ARCS specific errno's. */
43#define PROM_EADDRNOTAVAIL 0x1f
44#define PROM_ETIMEDOUT 0x20
45#define PROM_ECONNABORTED 0x21
46#define PROM_ENOCONNECT 0x22
47
48/* Device classes, types, and identifiers for prom
49 * device inventory queries.
50 */
51enum linux_devclass {
52 system, processor, cache, adapter, controller, peripheral, memory
53};
54
55enum linux_devtypes {
56 /* Generic stuff. */
57 Arc, Cpu, Fpu,
58
59 /* Primary insn and data caches. */
60 picache, pdcache,
61
62 /* Secondary insn, data, and combined caches. */
63 sicache, sdcache, sccache,
64
65 memdev, eisa_adapter, tc_adapter, scsi_adapter, dti_adapter,
66 multifunc_adapter, dsk_controller, tp_controller, cdrom_controller,
67 worm_controller, serial_controller, net_controller, disp_controller,
68 parallel_controller, ptr_controller, kbd_controller, audio_controller,
69 misc_controller, disk_peripheral, flpy_peripheral, tp_peripheral,
70 modem_peripheral, monitor_peripheral, printer_peripheral,
71 ptr_peripheral, kbd_peripheral, term_peripheral, line_peripheral,
72 net_peripheral, misc_peripheral, anon
73};
74
75enum linux_identifier {
76 bogus, ronly, removable, consin, consout, input, output
77};
78
79/* A prom device tree component. */
80struct linux_component {
81 enum linux_devclass class; /* node class */
82 enum linux_devtypes type; /* node type */
83 enum linux_identifier iflags; /* node flags */
84 USHORT vers; /* node version */
85 USHORT rev; /* node revision */
86 ULONG key; /* completely magic */
87 ULONG amask; /* XXX affinity mask??? */
88 ULONG cdsize; /* size of configuration data */
89 ULONG ilen; /* length of string identifier */
90 _PULONG iname; /* string identifier */
91};
92typedef struct linux_component pcomponent;
93
94struct linux_sysid {
95 char vend[8], prod[8];
96};
97
98/* ARCS prom memory descriptors. */
99enum arcs_memtypes {
100 arcs_eblock, /* exception block */
101 arcs_rvpage, /* ARCS romvec page */
102 arcs_fcontig, /* Contiguous and free */
103 arcs_free, /* Generic free memory */
104 arcs_bmem, /* Borken memory, don't use */
105 arcs_prog, /* A loaded program resides here */
106 arcs_atmp, /* ARCS temporary storage area, wish Sparc OpenBoot told this */
107 arcs_aperm, /* ARCS permanent storage... */
108};
109
110/* ARC has slightly different types than ARCS */
111enum arc_memtypes {
112 arc_eblock, /* exception block */
113 arc_rvpage, /* romvec page */
114 arc_free, /* Generic free memory */
115 arc_bmem, /* Borken memory, don't use */
116 arc_prog, /* A loaded program resides here */
117 arc_atmp, /* temporary storage area */
118 arc_aperm, /* permanent storage */
119 arc_fcontig, /* Contiguous and free */
120};
121
122union linux_memtypes {
123 enum arcs_memtypes arcs;
124 enum arc_memtypes arc;
125};
126
127struct linux_mdesc {
128 union linux_memtypes type;
129 ULONG base;
130 ULONG pages;
131};
132
133/* Time of day descriptor. */
134struct linux_tinfo {
135 unsigned short yr;
136 unsigned short mnth;
137 unsigned short day;
138 unsigned short hr;
139 unsigned short min;
140 unsigned short sec;
141 unsigned short msec;
142};
143
144/* ARCS virtual dirents. */
145struct linux_vdirent {
146 ULONG namelen;
147 unsigned char attr;
148 char fname[32]; /* XXX imperical, should be a define */
149};
150
151/* Other stuff for files. */
152enum linux_omode {
153 rdonly, wronly, rdwr, wronly_creat, rdwr_creat,
154 wronly_ssede, rdwr_ssede, dirent, dirent_creat
155};
156
157enum linux_seekmode {
158 absolute, relative
159};
160
161enum linux_mountops {
162 media_load, media_unload
163};
164
165/* This prom has a bolixed design. */
166struct linux_bigint {
167#ifdef __MIPSEL__
168 u32 lo;
169 s32 hi;
170#else /* !(__MIPSEL__) */
171 s32 hi;
172 u32 lo;
173#endif
174};
175
176struct linux_finfo {
177 struct linux_bigint begin;
178 struct linux_bigint end;
179 struct linux_bigint cur;
180 enum linux_devtypes dtype;
181 unsigned long namelen;
182 unsigned char attr;
183 char name[32]; /* XXX imperical, should be define */
184};
185
186/* This describes the vector containing function pointers to the ARC
187 firmware functions. */
188struct linux_romvec {
189 LONG load; /* Load an executable image. */
190 LONG invoke; /* Invoke a standalong image. */
191 LONG exec; /* Load and begin execution of a
192 standalone image. */
193 LONG halt; /* Halt the machine. */
194 LONG pdown; /* Power down the machine. */
195 LONG restart; /* XXX soft reset??? */
196 LONG reboot; /* Reboot the machine. */
197 LONG imode; /* Enter PROM interactive mode. */
198 LONG _unused1; /* Was ReturnFromMain(). */
199
200 /* PROM device tree interface. */
201 LONG next_component;
202 LONG child_component;
203 LONG parent_component;
204 LONG component_data;
205 LONG child_add;
206 LONG comp_del;
207 LONG component_by_path;
208
209 /* Misc. stuff. */
210 LONG cfg_save;
211 LONG get_sysid;
212
213 /* Probing for memory. */
214 LONG get_mdesc;
215 LONG _unused2; /* was Signal() */
216
217 LONG get_tinfo;
218 LONG get_rtime;
219
220 /* File type operations. */
221 LONG get_vdirent;
222 LONG open;
223 LONG close;
224 LONG read;
225 LONG get_rstatus;
226 LONG write;
227 LONG seek;
228 LONG mount;
229
230 /* Dealing with firmware environment variables. */
231 LONG get_evar;
232 LONG set_evar;
233
234 LONG get_finfo;
235 LONG set_finfo;
236
237 /* Miscellaneous. */
238 LONG cache_flush;
239 LONG TestUnicodeCharacter; /* ARC; not sure if ARCS too */
240 LONG GetDisplayStatus;
241};
242
243/* The SGI ARCS parameter block is in a fixed location for standalone
244 * programs to access PROM facilities easily.
245 */
246typedef struct _SYSTEM_PARAMETER_BLOCK {
247 ULONG magic; /* magic cookie */
248#define PROMBLOCK_MAGIC 0x53435241
249
250 ULONG len; /* length of parm block */
251 USHORT ver; /* ARCS firmware version */
252 USHORT rev; /* ARCS firmware revision */
253 _PLONG rs_block; /* Restart block. */
254 _PLONG dbg_block; /* Debug block. */
255 _PLONG gevect; /* XXX General vector??? */
256 _PLONG utlbvect; /* XXX UTLB vector??? */
257 ULONG rveclen; /* Size of romvec struct. */
258 _PVOID romvec; /* Function interface. */
259 ULONG pveclen; /* Length of private vector. */
260 _PVOID pvector; /* Private vector. */
261 ULONG adap_cnt; /* Adapter count. */
262 ULONG adap_typ0; /* First adapter type. */
263 ULONG adap_vcnt0; /* Adapter 0 vector count. */
264 _PVOID adap_vector; /* Adapter 0 vector ptr. */
265 ULONG adap_typ1; /* Second adapter type. */
266 ULONG adap_vcnt1; /* Adapter 1 vector count. */
267 _PVOID adap_vector1; /* Adapter 1 vector ptr. */
268 /* More adapter vectors go here... */
269} SYSTEM_PARAMETER_BLOCK, *PSYSTEM_PARAMETER_BLOCK;
270
271#define PROMBLOCK ((PSYSTEM_PARAMETER_BLOCK) (int)0xA0001000)
272#define ROMVECTOR ((struct linux_romvec *) (long)(PROMBLOCK)->romvec)
273
274/* Cache layout parameter block. */
275union linux_cache_key {
276 struct param {
277#ifdef __MIPSEL__
278 unsigned short size;
279 unsigned char lsize;
280 unsigned char bsize;
281#else /* !(__MIPSEL__) */
282 unsigned char bsize;
283 unsigned char lsize;
284 unsigned short size;
285#endif
286 } info;
287 unsigned long allinfo;
288};
289
290/* Configuration data. */
291struct linux_cdata {
292 char *name;
293 int mlen;
294 enum linux_devtypes type;
295};
296
297/* Common SGI ARCS firmware file descriptors. */
298#define SGIPROM_STDIN 0
299#define SGIPROM_STDOUT 1
300
301/* Common SGI ARCS firmware file types. */
302#define SGIPROM_ROFILE 0x01 /* read-only file */
303#define SGIPROM_HFILE 0x02 /* hidden file */
304#define SGIPROM_SFILE 0x04 /* System file */
305#define SGIPROM_AFILE 0x08 /* Archive file */
306#define SGIPROM_DFILE 0x10 /* Directory file */
307#define SGIPROM_DELFILE 0x20 /* Deleted file */
308
309/* SGI ARCS boot record information. */
310struct sgi_partition {
311 unsigned char flag;
312#define SGIPART_UNUSED 0x00
313#define SGIPART_ACTIVE 0x80
314
315 unsigned char shead, ssect, scyl; /* unused */
316 unsigned char systype; /* OS type, Irix or NT */
317 unsigned char ehead, esect, ecyl; /* unused */
318 unsigned char rsect0, rsect1, rsect2, rsect3;
319 unsigned char tsect0, tsect1, tsect2, tsect3;
320};
321
322#define SGIBBLOCK_MAGIC 0xaa55
323#define SGIBBLOCK_MAXPART 0x0004
324
325struct sgi_bootblock {
326 unsigned char _unused[446];
327 struct sgi_partition partitions[SGIBBLOCK_MAXPART];
328 unsigned short magic;
329};
330
331/* BIOS parameter block. */
332struct sgi_bparm_block {
333 unsigned short bytes_sect; /* bytes per sector */
334 unsigned char sect_clust; /* sectors per cluster */
335 unsigned short sect_resv; /* reserved sectors */
336 unsigned char nfats; /* # of allocation tables */
337 unsigned short nroot_dirents; /* # of root directory entries */
338 unsigned short sect_volume; /* sectors in volume */
339 unsigned char media_type; /* media descriptor */
340 unsigned short sect_fat; /* sectors per allocation table */
341 unsigned short sect_track; /* sectors per track */
342 unsigned short nheads; /* # of heads */
343 unsigned short nhsects; /* # of hidden sectors */
344};
345
346struct sgi_bsector {
347 unsigned char jmpinfo[3];
348 unsigned char manuf_name[8];
349 struct sgi_bparm_block info;
350};
351
352/* Debugging block used with SGI symmon symbolic debugger. */
353#define SMB_DEBUG_MAGIC 0xfeeddead
354struct linux_smonblock {
355 unsigned long magic;
356 void (*handler)(void); /* Breakpoint routine. */
357 unsigned long dtable_base; /* Base addr of dbg table. */
358 int (*printf)(const char *fmt, ...);
359 unsigned long btable_base; /* Breakpoint table. */
360 unsigned long mpflushreqs; /* SMP cache flush request list. */
361 unsigned long ntab; /* Name table. */
362 unsigned long stab; /* Symbol table. */
363 int smax; /* Max # of symbols. */
364};
365
366/*
367 * Macros for calling a 32-bit ARC implementation from 64-bit code
368 */
369
370#if defined(CONFIG_MIPS64) && defined(CONFIG_ARC32)
371
372#define __arc_clobbers \
373 "$2","$3" /* ... */, "$8","$9","$10","$11", \
374 "$12","$13","$14","$15","$16","$24","$25","$31"
375
376#define ARC_CALL0(dest) \
377({ long __res; \
378 long __vec = (long) romvec->dest; \
379 __asm__ __volatile__( \
380 "dsubu\t$29, 32\n\t" \
381 "jalr\t%1\n\t" \
382 "daddu\t$29, 32\n\t" \
383 "move\t%0, $2" \
384 : "=r" (__res), "=r" (__vec) \
385 : "1" (__vec) \
386 : __arc_clobbers, "$4","$5","$6","$7"); \
387 (unsigned long) __res; \
388})
389
390#define ARC_CALL1(dest,a1) \
391({ long __res; \
392 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
393 long __vec = (long) romvec->dest; \
394 __asm__ __volatile__( \
395 "dsubu\t$29, 32\n\t" \
396 "jalr\t%1\n\t" \
397 "daddu\t$29, 32\n\t" \
398 "move\t%0, $2" \
399 : "=r" (__res), "=r" (__vec) \
400 : "1" (__vec), "r" (__a1) \
401 : __arc_clobbers, "$5","$6","$7"); \
402 (unsigned long) __res; \
403})
404
405#define ARC_CALL2(dest,a1,a2) \
406({ long __res; \
407 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
408 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
409 long __vec = (long) romvec->dest; \
410 __asm__ __volatile__( \
411 "dsubu\t$29, 32\n\t" \
412 "jalr\t%1\n\t" \
413 "daddu\t$29, 32\n\t" \
414 "move\t%0, $2" \
415 : "=r" (__res), "=r" (__vec) \
416 : "1" (__vec), "r" (__a1), "r" (__a2) \
417 : __arc_clobbers, "$6","$7"); \
418 __res; \
419})
420
421#define ARC_CALL3(dest,a1,a2,a3) \
422({ long __res; \
423 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
424 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
425 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
426 long __vec = (long) romvec->dest; \
427 __asm__ __volatile__( \
428 "dsubu\t$29, 32\n\t" \
429 "jalr\t%1\n\t" \
430 "daddu\t$29, 32\n\t" \
431 "move\t%0, $2" \
432 : "=r" (__res), "=r" (__vec) \
433 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3) \
434 : __arc_clobbers, "$7"); \
435 __res; \
436})
437
438#define ARC_CALL4(dest,a1,a2,a3,a4) \
439({ long __res; \
440 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
441 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
442 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
443 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
444 long __vec = (long) romvec->dest; \
445 __asm__ __volatile__( \
446 "dsubu\t$29, 32\n\t" \
447 "jalr\t%1\n\t" \
448 "daddu\t$29, 32\n\t" \
449 "move\t%0, $2" \
450 : "=r" (__res), "=r" (__vec) \
451 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3), \
452 "r" (__a4) \
453 : __arc_clobbers); \
454 __res; \
455})
456
457#define ARC_CALL5(dest,a1,a2,a3,a4,a5) \
458({ long __res; \
459 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
460 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
461 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
462 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
463 register signed int __a5 = (a5); \
464 long __vec = (long) romvec->dest; \
465 __asm__ __volatile__( \
466 "dsubu\t$29, 32\n\t" \
467 "sw\t%7, 16($29)\n\t" \
468 "jalr\t%1\n\t" \
469 "daddu\t$29, 32\n\t" \
470 "move\t%0, $2" \
471 : "=r" (__res), "=r" (__vec) \
472 : "1" (__vec), \
473 "r" (__a1), "r" (__a2), "r" (__a3), "r" (__a4), \
474 "r" (__a5) \
475 : __arc_clobbers); \
476 __res; \
477})
478
479#endif /* defined(CONFIG_MIPS64) && defined(CONFIG_ARC32) */
480
481#if (defined(CONFIG_MIPS32) && defined(CONFIG_ARC32)) || \
482 (defined(CONFIG_MIPS64) && defined(CONFIG_ARC64))
483
484#define ARC_CALL0(dest) \
485({ long __res; \
486 long (*__vec)(void) = (void *) romvec->dest; \
487 \
488 __res = __vec(); \
489 __res; \
490})
491
492#define ARC_CALL1(dest,a1) \
493({ long __res; \
494 long __a1 = (long) (a1); \
495 long (*__vec)(long) = (void *) romvec->dest; \
496 \
497 __res = __vec(__a1); \
498 __res; \
499})
500
501#define ARC_CALL2(dest,a1,a2) \
502({ long __res; \
503 long __a1 = (long) (a1); \
504 long __a2 = (long) (a2); \
505 long (*__vec)(long, long) = (void *) romvec->dest; \
506 \
507 __res = __vec(__a1, __a2); \
508 __res; \
509})
510
511#define ARC_CALL3(dest,a1,a2,a3) \
512({ long __res; \
513 long __a1 = (long) (a1); \
514 long __a2 = (long) (a2); \
515 long __a3 = (long) (a3); \
516 long (*__vec)(long, long, long) = (void *) romvec->dest; \
517 \
518 __res = __vec(__a1, __a2, __a3); \
519 __res; \
520})
521
522#define ARC_CALL4(dest,a1,a2,a3,a4) \
523({ long __res; \
524 long __a1 = (long) (a1); \
525 long __a2 = (long) (a2); \
526 long __a3 = (long) (a3); \
527 long __a4 = (long) (a4); \
528 long (*__vec)(long, long, long, long) = (void *) romvec->dest; \
529 \
530 __res = __vec(__a1, __a2, __a3, __a4); \
531 __res; \
532})
533
534#define ARC_CALL5(dest,a1,a2,a3,a4,a5) \
535({ long __res; \
536 long __a1 = (long) (a1); \
537 long __a2 = (long) (a2); \
538 long __a3 = (long) (a3); \
539 long __a4 = (long) (a4); \
540 long __a5 = (long) (a5); \
541 long (*__vec)(long, long, long, long, long); \
542 __vec = (void *) romvec->dest; \
543 \
544 __res = __vec(__a1, __a2, __a3, __a4, __a5); \
545 __res; \
546})
547#endif /* both kernel and ARC either 32-bit or 64-bit */
548
549#endif /* _ASM_SGIARCS_H */
diff --git a/include/asm-mips/sgidefs.h b/include/asm-mips/sgidefs.h
new file mode 100644
index 000000000000..876442fcfb32
--- /dev/null
+++ b/include/asm-mips/sgidefs.h
@@ -0,0 +1,44 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 1999, 2001 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#ifndef __ASM_SGIDEFS_H
11#define __ASM_SGIDEFS_H
12
13/*
14 * Using a Linux compiler for building Linux seems logic but not to
15 * everybody.
16 */
17#ifndef __linux__
18#error Use a Linux compiler or give up.
19#endif
20
21/*
22 * Definitions for the ISA levels
23 *
24 * With the introduction of MIPS32 / MIPS64 instruction sets definitions
25 * MIPS ISAs are no longer subsets of each other. Therefore comparisons
26 * on these symbols except with == may result in unexpected results and
27 * are forbidden!
28 */
29#define _MIPS_ISA_MIPS1 1
30#define _MIPS_ISA_MIPS2 2
31#define _MIPS_ISA_MIPS3 3
32#define _MIPS_ISA_MIPS4 4
33#define _MIPS_ISA_MIPS5 5
34#define _MIPS_ISA_MIPS32 6
35#define _MIPS_ISA_MIPS64 7
36
37/*
38 * Subprogram calling convention
39 */
40#define _MIPS_SIM_ABI32 1
41#define _MIPS_SIM_NABI32 2
42#define _MIPS_SIM_ABI64 3
43
44#endif /* __ASM_SGIDEFS_H */
diff --git a/include/asm-mips/shmbuf.h b/include/asm-mips/shmbuf.h
new file mode 100644
index 000000000000..f994438277bf
--- /dev/null
+++ b/include/asm-mips/shmbuf.h
@@ -0,0 +1,38 @@
1#ifndef _ASM_SHMBUF_H
2#define _ASM_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for the MIPS architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 2 miscellaneous 32-bit rsp. 64-bit values
11 */
12
13struct shmid64_ds {
14 struct ipc64_perm shm_perm; /* operation perms */
15 size_t shm_segsz; /* size of segment (bytes) */
16 __kernel_time_t shm_atime; /* last attach time */
17 __kernel_time_t shm_dtime; /* last detach time */
18 __kernel_time_t shm_ctime; /* last change time */
19 __kernel_pid_t shm_cpid; /* pid of creator */
20 __kernel_pid_t shm_lpid; /* pid of last operator */
21 unsigned long shm_nattch; /* no. of current attaches */
22 unsigned long __unused1;
23 unsigned long __unused2;
24};
25
26struct shminfo64 {
27 unsigned long shmmax;
28 unsigned long shmmin;
29 unsigned long shmmni;
30 unsigned long shmseg;
31 unsigned long shmall;
32 unsigned long __unused1;
33 unsigned long __unused2;
34 unsigned long __unused3;
35 unsigned long __unused4;
36};
37
38#endif /* _ASM_SHMBUF_H */
diff --git a/include/asm-mips/shmparam.h b/include/asm-mips/shmparam.h
new file mode 100644
index 000000000000..09290720751c
--- /dev/null
+++ b/include/asm-mips/shmparam.h
@@ -0,0 +1,13 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 */
6#ifndef _ASM_SHMPARAM_H
7#define _ASM_SHMPARAM_H
8
9#define __ARCH_FORCE_SHMLBA 1
10
11#define SHMLBA 0x40000 /* attach addr a multiple of this */
12
13#endif /* _ASM_SHMPARAM_H */
diff --git a/include/asm-mips/sibyte/board.h b/include/asm-mips/sibyte/board.h
new file mode 100644
index 000000000000..d7b11b6c7c32
--- /dev/null
+++ b/include/asm-mips/sibyte/board.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef _SIBYTE_BOARD_H
20#define _SIBYTE_BOARD_H
21
22#include <linux/config.h>
23
24#ifdef CONFIG_SIBYTE_BOARD
25
26#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \
27 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \
28 defined(CONFIG_SIBYTE_LITTLESUR)
29#include <asm/sibyte/swarm.h>
30#endif
31
32#if defined(CONFIG_SIBYTE_SENTOSA) || defined(CONFIG_SIBYTE_RHONE)
33#include <asm/sibyte/sentosa.h>
34#endif
35
36#ifdef CONFIG_SIBYTE_CARMEL
37#include <asm/sibyte/carmel.h>
38#endif
39
40#ifdef __ASSEMBLY__
41
42#ifdef LEDS_PHYS
43#define setleds(t0,t1,c0,c1,c2,c3) \
44 li t0, (LEDS_PHYS|0xa0000000); \
45 li t1, c0; \
46 sb t1, 0x18(t0); \
47 li t1, c1; \
48 sb t1, 0x10(t0); \
49 li t1, c2; \
50 sb t1, 0x08(t0); \
51 li t1, c3; \
52 sb t1, 0x00(t0)
53#else
54#define setleds(t0,t1,c0,c1,c2,c3)
55#endif /* LEDS_PHYS */
56
57#else
58
59#ifdef LEDS_PHYS
60extern void setleds(char *str);
61#else
62#define setleds(s) do { } while (0)
63#endif /* LEDS_PHYS */
64
65#endif /* __ASSEMBLY__ */
66
67#endif /* CONFIG_SIBYTE_BOARD */
68
69#endif /* _SIBYTE_BOARD_H */
diff --git a/include/asm-mips/sibyte/carmel.h b/include/asm-mips/sibyte/carmel.h
new file mode 100644
index 000000000000..7ac5da13ce8a
--- /dev/null
+++ b/include/asm-mips/sibyte/carmel.h
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2002 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#ifndef __ASM_SIBYTE_CARMEL_H
19#define __ASM_SIBYTE_CARMEL_H
20
21#include <linux/config.h>
22
23#include <asm/sibyte/sb1250.h>
24#include <asm/sibyte/sb1250_int.h>
25
26#define SIBYTE_BOARD_NAME "Carmel"
27
28#define GPIO_PHY_INTERRUPT 2
29#define GPIO_NONMASKABLE_INT 3
30#define GPIO_CF_INSERTED 6
31#define GPIO_MONTEREY_RESET 7
32#define GPIO_QUADUART_INT 8
33#define GPIO_CF_INT 9
34#define GPIO_FPGA_CCLK 10
35#define GPIO_FPGA_DOUT 11
36#define GPIO_FPGA_DIN 12
37#define GPIO_FPGA_PGM 13
38#define GPIO_FPGA_DONE 14
39#define GPIO_FPGA_INIT 15
40
41#define LEDS_CS 2
42#define LEDS_PHYS 0x100C0000
43#define MLEDS_CS 3
44#define MLEDS_PHYS 0x100A0000
45#define UART_CS 4
46#define UART_PHYS 0x100D0000
47#define ARAVALI_CS 5
48#define ARAVALI_PHYS 0x11000000
49#define IDE_CS 6
50#define IDE_PHYS 0x100B0000
51#define ARAVALI2_CS 7
52#define ARAVALI2_PHYS 0x100E0000
53
54#if defined(CONFIG_SIBYTE_CARMEL)
55#define K_GPIO_GB_IDE 9
56#define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE)
57#endif
58
59
60#endif /* __ASM_SIBYTE_CARMEL_H */
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h
new file mode 100644
index 000000000000..d62da4e2dd36
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef _ASM_SIBYTE_SB1250_H
20#define _ASM_SIBYTE_SB1250_H
21
22/*
23 * yymmddpp: year, month, day, patch.
24 * should sync with Makefile EXTRAVERSION
25 */
26#define SIBYTE_RELEASE 0x02111403
27
28#define SB1250_NR_IRQS 64
29
30#define SB1250_DUART_MINOR_BASE 64
31
32#ifndef __ASSEMBLY__
33
34#include <asm/addrspace.h>
35
36/* For revision/pass information */
37#include <asm/sibyte/sb1250_scd.h>
38extern unsigned int sb1_pass;
39extern unsigned int soc_pass;
40extern unsigned int soc_type;
41extern unsigned int periph_rev;
42extern unsigned int zbbus_mhz;
43
44extern void sb1250_time_init(void);
45extern unsigned long sb1250_gettimeoffset(void);
46extern void sb1250_mask_irq(int cpu, int irq);
47extern void sb1250_unmask_irq(int cpu, int irq);
48extern void sb1250_smp_finish(void);
49extern void prom_printf(char *fmt, ...);
50
51#define AT_spin \
52 __asm__ __volatile__ ( \
53 ".set noat\n" \
54 "li $at, 0\n" \
55 "1: beqz $at, 1b\n" \
56 ".set at\n" \
57 )
58
59#endif
60
61#define IOADDR(a) (IO_BASE + (a))
62
63#endif
diff --git a/include/asm-mips/sibyte/sb1250_defs.h b/include/asm-mips/sibyte/sb1250_defs.h
new file mode 100644
index 000000000000..96088fb074a4
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_defs.h
@@ -0,0 +1,242 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Global constants and macros File: sb1250_defs.h
5 *
6 * This file contains macros and definitions used by the other
7 * include files.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34#ifndef _SB1250_DEFS_H
35#define _SB1250_DEFS_H
36
37/*
38 * These headers require ANSI C89 string concatenation, and GCC or other
39 * 'long long' (64-bit integer) support.
40 */
41#if !defined(__STDC__) && !defined(_MSC_VER)
42#error SiByte headers require ANSI C89 support
43#endif
44
45
46/* *********************************************************************
47 * Macros for feature tests, used to enable include file features
48 * for chip features only present in certain chip revisions.
49 *
50 * SIBYTE_HDR_FEATURES may be defined to be the mask value chip/revision
51 * which is to be exposed by the headers. If undefined, it defaults to
52 * "all features."
53 *
54 * Use like:
55 *
56 * #define SIBYTE_HDR_FEATURES SIBYTE_HDR_FMASK_112x_PASS1
57 *
58 * Generate defines only for that revision of chip.
59 *
60 * #if SIBYTE_HDR_FEATURE(chip,pass)
61 *
62 * True if header features for that revision or later of
63 * that particular chip type are enabled in SIBYTE_HDR_FEATURES.
64 * (Use this to bracket #defines for features present in a given
65 * revision and later.)
66 *
67 * Note that there is no implied ordering between chip types.
68 *
69 * Note also that 'chip' and 'pass' must textually exactly
70 * match the defines below. So, for example,
71 * SIBYTE_HDR_FEATURE(112x, PASS1) is OK, but
72 * SIBYTE_HDR_FEATURE(1120, pass1) is not (for two reasons).
73 *
74 * #if SIBYTE_HDR_FEATURE_UP_TO(chip,pass)
75 *
76 * Same as SIBYTE_HDR_FEATURE, but true for the named revision
77 * and earlier revisions of the named chip type.
78 *
79 * #if SIBYTE_HDR_FEATURE_EXACT(chip,pass)
80 *
81 * Same as SIBYTE_HDR_FEATURE, but only true for the named
82 * revision of the named chip type. (Note that this CANNOT
83 * be used to verify that you're compiling only for that
84 * particular chip/revision. It will be true any time this
85 * chip/revision is included in SIBYTE_HDR_FEATURES.)
86 *
87 * #if SIBYTE_HDR_FEATURE_CHIP(chip)
88 *
89 * True if header features for (any revision of) that chip type
90 * are enabled in SIBYTE_HDR_FEATURES. (Use this to bracket
91 * #defines for features specific to a given chip type.)
92 *
93 * Mask values currently include room for additional revisions of each
94 * chip type, but can be renumbered at will. Note that they MUST fit
95 * into 31 bits and may not include C type constructs, for safe use in
96 * CPP conditionals. Bit positions within chip types DO indicate
97 * ordering, so be careful when adding support for new minor revs.
98 ********************************************************************* */
99
100#define SIBYTE_HDR_FMASK_1250_ALL 0x00000ff
101#define SIBYTE_HDR_FMASK_1250_PASS1 0x0000001
102#define SIBYTE_HDR_FMASK_1250_PASS2 0x0000002
103#define SIBYTE_HDR_FMASK_1250_PASS3 0x0000004
104
105#define SIBYTE_HDR_FMASK_112x_ALL 0x0000f00
106#define SIBYTE_HDR_FMASK_112x_PASS1 0x0000100
107
108/* Bit mask for chip/revision. (use _ALL for all revisions of a chip). */
109#define SIBYTE_HDR_FMASK(chip, pass) \
110 (SIBYTE_HDR_FMASK_ ## chip ## _ ## pass)
111#define SIBYTE_HDR_FMASK_ALLREVS(chip) \
112 (SIBYTE_HDR_FMASK_ ## chip ## _ALL)
113
114#define SIBYTE_HDR_FMASK_ALL \
115 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL)
116
117#ifndef SIBYTE_HDR_FEATURES
118#define SIBYTE_HDR_FEATURES SIBYTE_HDR_FMASK_ALL
119#endif
120
121
122/* Bit mask for revisions of chip exclusively before the named revision. */
123#define SIBYTE_HDR_FMASK_BEFORE(chip, pass) \
124 ((SIBYTE_HDR_FMASK(chip, pass) - 1) & SIBYTE_HDR_FMASK_ALLREVS(chip))
125
126/* Bit mask for revisions of chip exclusively after the named revision. */
127#define SIBYTE_HDR_FMASK_AFTER(chip, pass) \
128 (~(SIBYTE_HDR_FMASK(chip, pass) \
129 | (SIBYTE_HDR_FMASK(chip, pass) - 1)) & SIBYTE_HDR_FMASK_ALLREVS(chip))
130
131
132/* True if header features enabled for (any revision of) that chip type. */
133#define SIBYTE_HDR_FEATURE_CHIP(chip) \
134 (!! (SIBYTE_HDR_FMASK_ALLREVS(chip) & SIBYTE_HDR_FEATURES))
135
136/* True if header features enabled for that rev or later, inclusive. */
137#define SIBYTE_HDR_FEATURE(chip, pass) \
138 (!! ((SIBYTE_HDR_FMASK(chip, pass) \
139 | SIBYTE_HDR_FMASK_AFTER(chip, pass)) & SIBYTE_HDR_FEATURES))
140
141/* True if header features enabled for exactly that rev. */
142#define SIBYTE_HDR_FEATURE_EXACT(chip, pass) \
143 (!! (SIBYTE_HDR_FMASK(chip, pass) & SIBYTE_HDR_FEATURES))
144
145/* True if header features enabled for that rev or before, inclusive. */
146#define SIBYTE_HDR_FEATURE_UP_TO(chip, pass) \
147 (!! ((SIBYTE_HDR_FMASK(chip, pass) \
148 | SIBYTE_HDR_FMASK_BEFORE(chip, pass)) & SIBYTE_HDR_FEATURES))
149
150
151/* *********************************************************************
152 * Naming schemes for constants in these files:
153 *
154 * M_xxx MASK constant (identifies bits in a register).
155 * For multi-bit fields, all bits in the field will
156 * be set.
157 *
158 * K_xxx "Code" constant (value for data in a multi-bit
159 * field). The value is right justified.
160 *
161 * V_xxx "Value" constant. This is the same as the
162 * corresponding "K_xxx" constant, except it is
163 * shifted to the correct position in the register.
164 *
165 * S_xxx SHIFT constant. This is the number of bits that
166 * a field value (code) needs to be shifted
167 * (towards the left) to put the value in the right
168 * position for the register.
169 *
170 * A_xxx ADDRESS constant. This will be a physical
171 * address. Use the PHYS_TO_K1 macro to generate
172 * a K1SEG address.
173 *
174 * R_xxx RELATIVE offset constant. This is an offset from
175 * an A_xxx constant (usually the first register in
176 * a group).
177 *
178 * G_xxx(X) GET value. This macro obtains a multi-bit field
179 * from a register, masks it, and shifts it to
180 * the bottom of the register (retrieving a K_xxx
181 * value, for example).
182 *
183 * V_xxx(X) VALUE. This macro computes the value of a
184 * K_xxx constant shifted to the correct position
185 * in the register.
186 ********************************************************************* */
187
188
189
190
191/*
192 * Cast to 64-bit number. Presumably the syntax is different in
193 * assembly language.
194 *
195 * Note: you'll need to define uint32_t and uint64_t in your headers.
196 */
197
198#if !defined(__ASSEMBLER__)
199#define _SB_MAKE64(x) ((uint64_t)(x))
200#define _SB_MAKE32(x) ((uint32_t)(x))
201#else
202#define _SB_MAKE64(x) (x)
203#define _SB_MAKE32(x) (x)
204#endif
205
206
207/*
208 * Make a mask for 1 bit at position 'n'
209 */
210
211#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n))
212#define _SB_MAKEMASK1_32(n) (_SB_MAKE32(1) << _SB_MAKE32(n))
213
214/*
215 * Make a mask for 'v' bits at position 'n'
216 */
217
218#define _SB_MAKEMASK(v,n) (_SB_MAKE64((_SB_MAKE64(1)<<(v))-1) << _SB_MAKE64(n))
219#define _SB_MAKEMASK_32(v,n) (_SB_MAKE32((_SB_MAKE32(1)<<(v))-1) << _SB_MAKE32(n))
220
221/*
222 * Make a value at 'v' at bit position 'n'
223 */
224
225#define _SB_MAKEVALUE(v,n) (_SB_MAKE64(v) << _SB_MAKE64(n))
226#define _SB_MAKEVALUE_32(v,n) (_SB_MAKE32(v) << _SB_MAKE32(n))
227
228#define _SB_GETVALUE(v,n,m) ((_SB_MAKE64(v) & _SB_MAKE64(m)) >> _SB_MAKE64(n))
229#define _SB_GETVALUE_32(v,n,m) ((_SB_MAKE32(v) & _SB_MAKE32(m)) >> _SB_MAKE32(n))
230
231/*
232 * Macros to read/write on-chip registers
233 * XXX should we do the PHYS_TO_K1 here?
234 */
235
236
237#if defined(__mips64) && !defined(__ASSEMBLER__)
238#define SBWRITECSR(csr,val) *((volatile uint64_t *) PHYS_TO_K1(csr)) = (val)
239#define SBREADCSR(csr) (*((volatile uint64_t *) PHYS_TO_K1(csr)))
240#endif /* __ASSEMBLER__ */
241
242#endif
diff --git a/include/asm-mips/sibyte/sb1250_dma.h b/include/asm-mips/sibyte/sb1250_dma.h
new file mode 100644
index 000000000000..f1b08d32338d
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_dma.h
@@ -0,0 +1,594 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * DMA definitions File: sb1250_dma.h
5 *
6 * This module contains constants and macros useful for
7 * programming the SB1250's DMA controllers, both the data mover
8 * and the Ethernet DMA.
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 * Author: Mitch Lichtenberg
13 *
14 *********************************************************************
15 *
16 * Copyright 2000,2001,2002,2003
17 * Broadcom Corporation. All rights reserved.
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License as
21 * published by the Free Software Foundation; either version 2 of
22 * the License, or (at your option) any later version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA
33 ********************************************************************* */
34
35
36#ifndef _SB1250_DMA_H
37#define _SB1250_DMA_H
38
39
40#include "sb1250_defs.h"
41
42/* *********************************************************************
43 * DMA Registers
44 ********************************************************************* */
45
46/*
47 * Ethernet and Serial DMA Configuration Register 0 (Table 7-4)
48 * Registers: DMA_CONFIG0_MAC_x_RX_CH_0
49 * Registers: DMA_CONFIG0_MAC_x_TX_CH_0
50 * Registers: DMA_CONFIG0_SER_x_RX
51 * Registers: DMA_CONFIG0_SER_x_TX
52 */
53
54
55#define M_DMA_DROP _SB_MAKEMASK1(0)
56
57#define M_DMA_CHAIN_SEL _SB_MAKEMASK1(1)
58#define M_DMA_RESERVED1 _SB_MAKEMASK1(2)
59
60#define S_DMA_DESC_TYPE _SB_MAKE64(1)
61#define M_DMA_DESC_TYPE _SB_MAKE64(2,S_DMA_DESC_TYPE)
62#define V_DMA_DESC_TYPE(x) _SB_MAKEVALUE(x,S_DMA_DESC_TYPE)
63#define G_DMA_DESC_TYPE(x) _SB_GETVALUE(x,S_DMA_DESC_TYPE,M_DMA_DESC_TYPE)
64
65#define K_DMA_DESC_TYPE_RING_AL 0
66#define K_DMA_DESC_TYPE_CHAIN_AL 1
67
68#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
69#define K_DMA_DESC_TYPE_RING_UAL_WI 2
70#define K_DMA_DESC_TYPE_RING_UAL_RMW 3
71#endif /* 1250 PASS3 || 112x PASS1 */
72
73#define M_DMA_EOP_INT_EN _SB_MAKEMASK1(3)
74#define M_DMA_HWM_INT_EN _SB_MAKEMASK1(4)
75#define M_DMA_LWM_INT_EN _SB_MAKEMASK1(5)
76#define M_DMA_TBX_EN _SB_MAKEMASK1(6)
77#define M_DMA_TDX_EN _SB_MAKEMASK1(7)
78
79#define S_DMA_INT_PKTCNT _SB_MAKE64(8)
80#define M_DMA_INT_PKTCNT _SB_MAKEMASK(8,S_DMA_INT_PKTCNT)
81#define V_DMA_INT_PKTCNT(x) _SB_MAKEVALUE(x,S_DMA_INT_PKTCNT)
82#define G_DMA_INT_PKTCNT(x) _SB_GETVALUE(x,S_DMA_INT_PKTCNT,M_DMA_INT_PKTCNT)
83
84#define S_DMA_RINGSZ _SB_MAKE64(16)
85#define M_DMA_RINGSZ _SB_MAKEMASK(16,S_DMA_RINGSZ)
86#define V_DMA_RINGSZ(x) _SB_MAKEVALUE(x,S_DMA_RINGSZ)
87#define G_DMA_RINGSZ(x) _SB_GETVALUE(x,S_DMA_RINGSZ,M_DMA_RINGSZ)
88
89#define S_DMA_HIGH_WATERMARK _SB_MAKE64(32)
90#define M_DMA_HIGH_WATERMARK _SB_MAKEMASK(16,S_DMA_HIGH_WATERMARK)
91#define V_DMA_HIGH_WATERMARK(x) _SB_MAKEVALUE(x,S_DMA_HIGH_WATERMARK)
92#define G_DMA_HIGH_WATERMARK(x) _SB_GETVALUE(x,S_DMA_HIGH_WATERMARK,M_DMA_HIGH_WATERMARK)
93
94#define S_DMA_LOW_WATERMARK _SB_MAKE64(48)
95#define M_DMA_LOW_WATERMARK _SB_MAKEMASK(16,S_DMA_LOW_WATERMARK)
96#define V_DMA_LOW_WATERMARK(x) _SB_MAKEVALUE(x,S_DMA_LOW_WATERMARK)
97#define G_DMA_LOW_WATERMARK(x) _SB_GETVALUE(x,S_DMA_LOW_WATERMARK,M_DMA_LOW_WATERMARK)
98
99/*
100 * Ethernet and Serial DMA Configuration Register 1 (Table 7-5)
101 * Registers: DMA_CONFIG1_MAC_x_RX_CH_0
102 * Registers: DMA_CONFIG1_DMA_x_TX_CH_0
103 * Registers: DMA_CONFIG1_SER_x_RX
104 * Registers: DMA_CONFIG1_SER_x_TX
105 */
106
107#define M_DMA_HDR_CF_EN _SB_MAKEMASK1(0)
108#define M_DMA_ASIC_XFR_EN _SB_MAKEMASK1(1)
109#define M_DMA_PRE_ADDR_EN _SB_MAKEMASK1(2)
110#define M_DMA_FLOW_CTL_EN _SB_MAKEMASK1(3)
111#define M_DMA_NO_DSCR_UPDT _SB_MAKEMASK1(4)
112#define M_DMA_L2CA _SB_MAKEMASK1(5)
113
114#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
115#define M_DMA_RX_XTRA_STATUS _SB_MAKEMASK1(6)
116#define M_DMA_TX_CPU_PAUSE _SB_MAKEMASK1(6)
117#define M_DMA_TX_FC_PAUSE_EN _SB_MAKEMASK1(7)
118#endif /* 1250 PASS3 || 112x PASS1 */
119
120#define M_DMA_MBZ1 _SB_MAKEMASK(6,15)
121
122#define S_DMA_HDR_SIZE _SB_MAKE64(21)
123#define M_DMA_HDR_SIZE _SB_MAKEMASK(9,S_DMA_HDR_SIZE)
124#define V_DMA_HDR_SIZE(x) _SB_MAKEVALUE(x,S_DMA_HDR_SIZE)
125#define G_DMA_HDR_SIZE(x) _SB_GETVALUE(x,S_DMA_HDR_SIZE,M_DMA_HDR_SIZE)
126
127#define M_DMA_MBZ2 _SB_MAKEMASK(5,32)
128
129#define S_DMA_ASICXFR_SIZE _SB_MAKE64(37)
130#define M_DMA_ASICXFR_SIZE _SB_MAKEMASK(9,S_DMA_ASICXFR_SIZE)
131#define V_DMA_ASICXFR_SIZE(x) _SB_MAKEVALUE(x,S_DMA_ASICXFR_SIZE)
132#define G_DMA_ASICXFR_SIZE(x) _SB_GETVALUE(x,S_DMA_ASICXFR_SIZE,M_DMA_ASICXFR_SIZE)
133
134#define S_DMA_INT_TIMEOUT _SB_MAKE64(48)
135#define M_DMA_INT_TIMEOUT _SB_MAKEMASK(16,S_DMA_INT_TIMEOUT)
136#define V_DMA_INT_TIMEOUT(x) _SB_MAKEVALUE(x,S_DMA_INT_TIMEOUT)
137#define G_DMA_INT_TIMEOUT(x) _SB_GETVALUE(x,S_DMA_INT_TIMEOUT,M_DMA_INT_TIMEOUT)
138
139/*
140 * Ethernet and Serial DMA Descriptor base address (Table 7-6)
141 */
142
143#define M_DMA_DSCRBASE_MBZ _SB_MAKEMASK(4,0)
144
145
146/*
147 * ASIC Mode Base Address (Table 7-7)
148 */
149
150#define M_DMA_ASIC_BASE_MBZ _SB_MAKEMASK(20,0)
151
152/*
153 * DMA Descriptor Count Registers (Table 7-8)
154 */
155
156/* No bitfields */
157
158
159/*
160 * Current Descriptor Address Register (Table 7-11)
161 */
162
163#define S_DMA_CURDSCR_ADDR _SB_MAKE64(0)
164#define M_DMA_CURDSCR_ADDR _SB_MAKEMASK(40,S_DMA_CURDSCR_ADDR)
165#define S_DMA_CURDSCR_COUNT _SB_MAKE64(40)
166#define M_DMA_CURDSCR_COUNT _SB_MAKEMASK(16,S_DMA_CURDSCR_COUNT)
167
168#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
169#define M_DMA_TX_CH_PAUSE_ON _SB_MAKEMASK1(56)
170#endif /* 1250 PASS3 || 112x PASS1 */
171
172/*
173 * Receive Packet Drop Registers
174 */
175#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
176#define S_DMA_OODLOST_RX _SB_MAKE64(0)
177#define M_DMA_OODLOST_RX _SB_MAKEMASK(16,S_DMA_OODLOST_RX)
178#define G_DMA_OODLOST_RX(x) _SB_GETVALUE(x,S_DMA_OODLOST_RX,M_DMA_OODLOST_RX)
179
180#define S_DMA_EOP_COUNT_RX _SB_MAKE64(16)
181#define M_DMA_EOP_COUNT_RX _SB_MAKEMASK(8,S_DMA_EOP_COUNT_RX)
182#define G_DMA_EOP_COUNT_RX(x) _SB_GETVALUE(x,S_DMA_EOP_COUNT_RX,M_DMA_EOP_COUNT_RX)
183#endif /* 1250 PASS3 || 112x PASS1 */
184
185/* *********************************************************************
186 * DMA Descriptors
187 ********************************************************************* */
188
189/*
190 * Descriptor doubleword "A" (Table 7-12)
191 */
192
193#define S_DMA_DSCRA_OFFSET _SB_MAKE64(0)
194#define M_DMA_DSCRA_OFFSET _SB_MAKEMASK(5,S_DMA_DSCRA_OFFSET)
195#define V_DMA_DSCRA_OFFSET(x) _SB_MAKEVALUE(x,S_DMA_DSCRA_OFFSET)
196#define G_DMA_DSCRA_OFFSET(x) _SB_GETVALUE(x,S_DMA_DSCRA_OFFSET,M_DMA_DSCRA_OFFSET)
197
198/* Note: Don't shift the address over, just mask it with the mask below */
199#define S_DMA_DSCRA_A_ADDR _SB_MAKE64(5)
200#define M_DMA_DSCRA_A_ADDR _SB_MAKEMASK(35,S_DMA_DSCRA_A_ADDR)
201
202#define M_DMA_DSCRA_A_ADDR_OFFSET (M_DMA_DSCRA_OFFSET | M_DMA_DSCRA_A_ADDR)
203
204#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
205#define S_DMA_DSCRA_A_ADDR_UA _SB_MAKE64(0)
206#define M_DMA_DSCRA_A_ADDR_UA _SB_MAKEMASK(40,S_DMA_DSCRA_A_ADDR_UA)
207#endif /* 1250 PASS3 || 112x PASS1 */
208
209#define S_DMA_DSCRA_A_SIZE _SB_MAKE64(40)
210#define M_DMA_DSCRA_A_SIZE _SB_MAKEMASK(9,S_DMA_DSCRA_A_SIZE)
211#define V_DMA_DSCRA_A_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRA_A_SIZE)
212#define G_DMA_DSCRA_A_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRA_A_SIZE,M_DMA_DSCRA_A_SIZE)
213
214#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
215#define S_DMA_DSCRA_DSCR_CNT _SB_MAKE64(40)
216#define M_DMA_DSCRA_DSCR_CNT _SB_MAKEMASK(8,S_DMA_DSCRA_DSCR_CNT)
217#define G_DMA_DSCRA_DSCR_CNT(x) _SB_GETVALUE(x,S_DMA_DSCRA_DSCR_CNT,M_DMA_DSCRA_DSCR_CNT)
218#endif /* 1250 PASS3 || 112x PASS1 */
219
220#define M_DMA_DSCRA_INTERRUPT _SB_MAKEMASK1(49)
221#define M_DMA_DSCRA_OFFSETB _SB_MAKEMASK1(50)
222
223#define S_DMA_DSCRA_STATUS _SB_MAKE64(51)
224#define M_DMA_DSCRA_STATUS _SB_MAKEMASK(13,S_DMA_DSCRA_STATUS)
225#define V_DMA_DSCRA_STATUS(x) _SB_MAKEVALUE(x,S_DMA_DSCRA_STATUS)
226#define G_DMA_DSCRA_STATUS(x) _SB_GETVALUE(x,S_DMA_DSCRA_STATUS,M_DMA_DSCRA_STATUS)
227
228/*
229 * Descriptor doubleword "B" (Table 7-13)
230 */
231
232
233#define S_DMA_DSCRB_OPTIONS _SB_MAKE64(0)
234#define M_DMA_DSCRB_OPTIONS _SB_MAKEMASK(4,S_DMA_DSCRB_OPTIONS)
235#define V_DMA_DSCRB_OPTIONS(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_OPTIONS)
236#define G_DMA_DSCRB_OPTIONS(x) _SB_GETVALUE(x,S_DMA_DSCRB_OPTIONS,M_DMA_DSCRB_OPTIONS)
237
238#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
239#define S_DMA_DSCRB_A_SIZE _SB_MAKE64(8)
240#define M_DMA_DSCRB_A_SIZE _SB_MAKEMASK(14,S_DMA_DSCRB_A_SIZE)
241#define V_DMA_DSCRB_A_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_A_SIZE)
242#define G_DMA_DSCRB_A_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRB_A_SIZE,M_DMA_DSCRB_A_SIZE)
243#endif /* 1250 PASS3 || 112x PASS1 */
244
245#define R_DMA_DSCRB_ADDR _SB_MAKE64(0x10)
246
247/* Note: Don't shift the address over, just mask it with the mask below */
248#define S_DMA_DSCRB_B_ADDR _SB_MAKE64(5)
249#define M_DMA_DSCRB_B_ADDR _SB_MAKEMASK(35,S_DMA_DSCRB_B_ADDR)
250
251#define S_DMA_DSCRB_B_SIZE _SB_MAKE64(40)
252#define M_DMA_DSCRB_B_SIZE _SB_MAKEMASK(9,S_DMA_DSCRB_B_SIZE)
253#define V_DMA_DSCRB_B_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_B_SIZE)
254#define G_DMA_DSCRB_B_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRB_B_SIZE,M_DMA_DSCRB_B_SIZE)
255
256#define M_DMA_DSCRB_B_VALID _SB_MAKEMASK1(49)
257
258#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
259#define S_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKE64(48)
260#define M_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKEMASK(2,S_DMA_DSCRB_PKT_SIZE_MSB)
261#define V_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_PKT_SIZE_MSB)
262#define G_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_GETVALUE(x,S_DMA_DSCRB_PKT_SIZE_MSB,M_DMA_DSCRB_PKT_SIZE_MSB)
263#endif /* 1250 PASS3 || 112x PASS1 */
264
265#define S_DMA_DSCRB_PKT_SIZE _SB_MAKE64(50)
266#define M_DMA_DSCRB_PKT_SIZE _SB_MAKEMASK(14,S_DMA_DSCRB_PKT_SIZE)
267#define V_DMA_DSCRB_PKT_SIZE(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_PKT_SIZE)
268#define G_DMA_DSCRB_PKT_SIZE(x) _SB_GETVALUE(x,S_DMA_DSCRB_PKT_SIZE,M_DMA_DSCRB_PKT_SIZE)
269
270/*
271 * from pass2 some bits in dscr_b are also used for rx status
272 */
273#define S_DMA_DSCRB_STATUS _SB_MAKE64(0)
274#define M_DMA_DSCRB_STATUS _SB_MAKEMASK(1,S_DMA_DSCRB_STATUS)
275#define V_DMA_DSCRB_STATUS(x) _SB_MAKEVALUE(x,S_DMA_DSCRB_STATUS)
276#define G_DMA_DSCRB_STATUS(x) _SB_GETVALUE(x,S_DMA_DSCRB_STATUS,M_DMA_DSCRB_STATUS)
277
278/*
279 * Ethernet Descriptor Status Bits (Table 7-15)
280 */
281
282#define M_DMA_ETHRX_BADIP4CS _SB_MAKEMASK1(51)
283#define M_DMA_ETHRX_DSCRERR _SB_MAKEMASK1(52)
284
285#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
286/* Note: BADTCPCS is actually in DSCR_B options field */
287#define M_DMA_ETHRX_BADTCPCS _SB_MAKEMASK1(0)
288#endif /* 1250 PASS2 || 112x PASS1 */
289
290#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
291#define M_DMA_ETH_VLAN_FLAG _SB_MAKEMASK1(1)
292#define M_DMA_ETH_CRC_FLAG _SB_MAKEMASK1(2)
293#endif /* 1250 PASS3 || 112x PASS1 */
294
295#define S_DMA_ETHRX_RXCH 53
296#define M_DMA_ETHRX_RXCH _SB_MAKEMASK(2,S_DMA_ETHRX_RXCH)
297#define V_DMA_ETHRX_RXCH(x) _SB_MAKEVALUE(x,S_DMA_ETHRX_RXCH)
298#define G_DMA_ETHRX_RXCH(x) _SB_GETVALUE(x,S_DMA_ETHRX_RXCH,M_DMA_ETHRX_RXCH)
299
300#define S_DMA_ETHRX_PKTTYPE 55
301#define M_DMA_ETHRX_PKTTYPE _SB_MAKEMASK(3,S_DMA_ETHRX_PKTTYPE)
302#define V_DMA_ETHRX_PKTTYPE(x) _SB_MAKEVALUE(x,S_DMA_ETHRX_PKTTYPE)
303#define G_DMA_ETHRX_PKTTYPE(x) _SB_GETVALUE(x,S_DMA_ETHRX_PKTTYPE,M_DMA_ETHRX_PKTTYPE)
304
305#define K_DMA_ETHRX_PKTTYPE_IPV4 0
306#define K_DMA_ETHRX_PKTTYPE_ARPV4 1
307#define K_DMA_ETHRX_PKTTYPE_802 2
308#define K_DMA_ETHRX_PKTTYPE_OTHER 3
309#define K_DMA_ETHRX_PKTTYPE_USER0 4
310#define K_DMA_ETHRX_PKTTYPE_USER1 5
311#define K_DMA_ETHRX_PKTTYPE_USER2 6
312#define K_DMA_ETHRX_PKTTYPE_USER3 7
313
314#define M_DMA_ETHRX_MATCH_HASH _SB_MAKEMASK1(58)
315#define M_DMA_ETHRX_MATCH_EXACT _SB_MAKEMASK1(59)
316#define M_DMA_ETHRX_BCAST _SB_MAKEMASK1(60)
317#define M_DMA_ETHRX_MCAST _SB_MAKEMASK1(61)
318#define M_DMA_ETHRX_BAD _SB_MAKEMASK1(62)
319#define M_DMA_ETHRX_SOP _SB_MAKEMASK1(63)
320
321/*
322 * Ethernet Transmit Status Bits (Table 7-16)
323 */
324
325#define M_DMA_ETHTX_SOP _SB_MAKEMASK1(63)
326
327/*
328 * Ethernet Transmit Options (Table 7-17)
329 */
330
331#define K_DMA_ETHTX_NOTSOP _SB_MAKE64(0x00)
332#define K_DMA_ETHTX_APPENDCRC _SB_MAKE64(0x01)
333#define K_DMA_ETHTX_REPLACECRC _SB_MAKE64(0x02)
334#define K_DMA_ETHTX_APPENDCRC_APPENDPAD _SB_MAKE64(0x03)
335#define K_DMA_ETHTX_APPENDVLAN_REPLACECRC _SB_MAKE64(0x04)
336#define K_DMA_ETHTX_REMOVEVLAN_REPLACECRC _SB_MAKE64(0x05)
337#define K_DMA_ETHTX_REPLACEVLAN_REPLACECRC _SB_MAKE64(0x6)
338#define K_DMA_ETHTX_NOMODS _SB_MAKE64(0x07)
339#define K_DMA_ETHTX_RESERVED1 _SB_MAKE64(0x08)
340#define K_DMA_ETHTX_REPLACESADDR_APPENDCRC _SB_MAKE64(0x09)
341#define K_DMA_ETHTX_REPLACESADDR_REPLACECRC _SB_MAKE64(0x0A)
342#define K_DMA_ETHTX_REPLACESADDR_APPENDCRC_APPENDPAD _SB_MAKE64(0x0B)
343#define K_DMA_ETHTX_REPLACESADDR_APPENDVLAN_REPLACECRC _SB_MAKE64(0x0C)
344#define K_DMA_ETHTX_REPLACESADDR_REMOVEVLAN_REPLACECRC _SB_MAKE64(0x0D)
345#define K_DMA_ETHTX_REPLACESADDR_REPLACEVLAN_REPLACECRC _SB_MAKE64(0x0E)
346#define K_DMA_ETHTX_RESERVED2 _SB_MAKE64(0x0F)
347
348/*
349 * Serial Receive Options (Table 7-18)
350 */
351#define M_DMA_SERRX_CRC_ERROR _SB_MAKEMASK1(56)
352#define M_DMA_SERRX_ABORT _SB_MAKEMASK1(57)
353#define M_DMA_SERRX_OCTET_ERROR _SB_MAKEMASK1(58)
354#define M_DMA_SERRX_LONGFRAME_ERROR _SB_MAKEMASK1(59)
355#define M_DMA_SERRX_SHORTFRAME_ERROR _SB_MAKEMASK1(60)
356#define M_DMA_SERRX_OVERRUN_ERROR _SB_MAKEMASK1(61)
357#define M_DMA_SERRX_GOOD _SB_MAKEMASK1(62)
358#define M_DMA_SERRX_SOP _SB_MAKEMASK1(63)
359
360/*
361 * Serial Transmit Status Bits (Table 7-20)
362 */
363
364#define M_DMA_SERTX_FLAG _SB_MAKEMASK1(63)
365
366/*
367 * Serial Transmit Options (Table 7-21)
368 */
369
370#define K_DMA_SERTX_RESERVED _SB_MAKEMASK1(0)
371#define K_DMA_SERTX_APPENDCRC _SB_MAKEMASK1(1)
372#define K_DMA_SERTX_APPENDPAD _SB_MAKEMASK1(2)
373#define K_DMA_SERTX_ABORT _SB_MAKEMASK1(3)
374
375
376/* *********************************************************************
377 * Data Mover Registers
378 ********************************************************************* */
379
380/*
381 * Data Mover Descriptor Base Address Register (Table 7-22)
382 * Register: DM_DSCR_BASE_0
383 * Register: DM_DSCR_BASE_1
384 * Register: DM_DSCR_BASE_2
385 * Register: DM_DSCR_BASE_3
386 */
387
388#define M_DM_DSCR_BASE_MBZ _SB_MAKEMASK(4,0)
389
390/* Note: Just mask the base address and then OR it in. */
391#define S_DM_DSCR_BASE_ADDR _SB_MAKE64(4)
392#define M_DM_DSCR_BASE_ADDR _SB_MAKEMASK(36,S_DM_DSCR_BASE_ADDR)
393
394#define S_DM_DSCR_BASE_RINGSZ _SB_MAKE64(40)
395#define M_DM_DSCR_BASE_RINGSZ _SB_MAKEMASK(16,S_DM_DSCR_BASE_RINGSZ)
396#define V_DM_DSCR_BASE_RINGSZ(x) _SB_MAKEVALUE(x,S_DM_DSCR_BASE_RINGSZ)
397#define G_DM_DSCR_BASE_RINGSZ(x) _SB_GETVALUE(x,S_DM_DSCR_BASE_RINGSZ,M_DM_DSCR_BASE_RINGSZ)
398
399#define S_DM_DSCR_BASE_PRIORITY _SB_MAKE64(56)
400#define M_DM_DSCR_BASE_PRIORITY _SB_MAKEMASK(3,S_DM_DSCR_BASE_PRIORITY)
401#define V_DM_DSCR_BASE_PRIORITY(x) _SB_MAKEVALUE(x,S_DM_DSCR_BASE_PRIORITY)
402#define G_DM_DSCR_BASE_PRIORITY(x) _SB_GETVALUE(x,S_DM_DSCR_BASE_PRIORITY,M_DM_DSCR_BASE_PRIORITY)
403
404#define K_DM_DSCR_BASE_PRIORITY_1 0
405#define K_DM_DSCR_BASE_PRIORITY_2 1
406#define K_DM_DSCR_BASE_PRIORITY_4 2
407#define K_DM_DSCR_BASE_PRIORITY_8 3
408#define K_DM_DSCR_BASE_PRIORITY_16 4
409
410#define M_DM_DSCR_BASE_ACTIVE _SB_MAKEMASK1(59)
411#define M_DM_DSCR_BASE_INTERRUPT _SB_MAKEMASK1(60)
412#define M_DM_DSCR_BASE_RESET _SB_MAKEMASK1(61) /* write register */
413#define M_DM_DSCR_BASE_ERROR _SB_MAKEMASK1(61) /* read register */
414#define M_DM_DSCR_BASE_ABORT _SB_MAKEMASK1(62)
415#define M_DM_DSCR_BASE_ENABL _SB_MAKEMASK1(63)
416
417/*
418 * Data Mover Descriptor Count Register (Table 7-25)
419 */
420
421/* no bitfields */
422
423/*
424 * Data Mover Current Descriptor Address (Table 7-24)
425 * Register: DM_CUR_DSCR_ADDR_0
426 * Register: DM_CUR_DSCR_ADDR_1
427 * Register: DM_CUR_DSCR_ADDR_2
428 * Register: DM_CUR_DSCR_ADDR_3
429 */
430
431#define S_DM_CUR_DSCR_DSCR_ADDR _SB_MAKE64(0)
432#define M_DM_CUR_DSCR_DSCR_ADDR _SB_MAKEMASK(40,S_DM_CUR_DSCR_DSCR_ADDR)
433
434#define S_DM_CUR_DSCR_DSCR_COUNT _SB_MAKE64(48)
435#define M_DM_CUR_DSCR_DSCR_COUNT _SB_MAKEMASK(16,S_DM_CUR_DSCR_DSCR_COUNT)
436#define V_DM_CUR_DSCR_DSCR_COUNT(r) _SB_MAKEVALUE(r,S_DM_CUR_DSCR_DSCR_COUNT)
437#define G_DM_CUR_DSCR_DSCR_COUNT(r) _SB_GETVALUE(r,S_DM_CUR_DSCR_DSCR_COUNT,\
438 M_DM_CUR_DSCR_DSCR_COUNT)
439
440
441#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
442/*
443 * Data Mover Channel Partial Result Registers
444 * Register: DM_PARTIAL_0
445 * Register: DM_PARTIAL_1
446 * Register: DM_PARTIAL_2
447 * Register: DM_PARTIAL_3
448 */
449#define S_DM_PARTIAL_CRC_PARTIAL _SB_MAKE64(0)
450#define M_DM_PARTIAL_CRC_PARTIAL _SB_MAKEMASK(32,S_DM_PARTIAL_CRC_PARTIAL)
451#define V_DM_PARTIAL_CRC_PARTIAL(r) _SB_MAKEVALUE(r,S_DM_PARTIAL_CRC_PARTIAL)
452#define G_DM_PARTIAL_CRC_PARTIAL(r) _SB_GETVALUE(r,S_DM_PARTIAL_CRC_PARTIAL,\
453 M_DM_PARTIAL_CRC_PARTIAL)
454
455#define S_DM_PARTIAL_TCPCS_PARTIAL _SB_MAKE64(32)
456#define M_DM_PARTIAL_TCPCS_PARTIAL _SB_MAKEMASK(16,S_DM_PARTIAL_TCPCS_PARTIAL)
457#define V_DM_PARTIAL_TCPCS_PARTIAL(r) _SB_MAKEVALUE(r,S_DM_PARTIAL_TCPCS_PARTIAL)
458#define G_DM_PARTIAL_TCPCS_PARTIAL(r) _SB_GETVALUE(r,S_DM_PARTIAL_TCPCS_PARTIAL,\
459 M_DM_PARTIAL_TCPCS_PARTIAL)
460
461#define M_DM_PARTIAL_ODD_BYTE _SB_MAKEMASK1(48)
462#endif /* 1250 PASS3 || 112x PASS1 */
463
464
465#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
466/*
467 * Data Mover CRC Definition Registers
468 * Register: CRC_DEF_0
469 * Register: CRC_DEF_1
470 */
471#define S_CRC_DEF_CRC_INIT _SB_MAKE64(0)
472#define M_CRC_DEF_CRC_INIT _SB_MAKEMASK(32,S_CRC_DEF_CRC_INIT)
473#define V_CRC_DEF_CRC_INIT(r) _SB_MAKEVALUE(r,S_CRC_DEF_CRC_INIT)
474#define G_CRC_DEF_CRC_INIT(r) _SB_GETVALUE(r,S_CRC_DEF_CRC_INIT,\
475 M_CRC_DEF_CRC_INIT)
476
477#define S_CRC_DEF_CRC_POLY _SB_MAKE64(32)
478#define M_CRC_DEF_CRC_POLY _SB_MAKEMASK(32,S_CRC_DEF_CRC_POLY)
479#define V_CRC_DEF_CRC_POLY(r) _SB_MAKEVALUE(r,S_CRC_DEF_CRC_POLY)
480#define G_CRC_DEF_CRC_POLY(r) _SB_GETVALUE(r,S_CRC_DEF_CRC_POLY,\
481 M_CRC_DEF_CRC_POLY)
482#endif /* 1250 PASS3 || 112x PASS1 */
483
484
485#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
486/*
487 * Data Mover CRC/Checksum Definition Registers
488 * Register: CTCP_DEF_0
489 * Register: CTCP_DEF_1
490 */
491#define S_CTCP_DEF_CRC_TXOR _SB_MAKE64(0)
492#define M_CTCP_DEF_CRC_TXOR _SB_MAKEMASK(32,S_CTCP_DEF_CRC_TXOR)
493#define V_CTCP_DEF_CRC_TXOR(r) _SB_MAKEVALUE(r,S_CTCP_DEF_CRC_TXOR)
494#define G_CTCP_DEF_CRC_TXOR(r) _SB_GETVALUE(r,S_CTCP_DEF_CRC_TXOR,\
495 M_CTCP_DEF_CRC_TXOR)
496
497#define S_CTCP_DEF_TCPCS_INIT _SB_MAKE64(32)
498#define M_CTCP_DEF_TCPCS_INIT _SB_MAKEMASK(16,S_CTCP_DEF_TCPCS_INIT)
499#define V_CTCP_DEF_TCPCS_INIT(r) _SB_MAKEVALUE(r,S_CTCP_DEF_TCPCS_INIT)
500#define G_CTCP_DEF_TCPCS_INIT(r) _SB_GETVALUE(r,S_CTCP_DEF_TCPCS_INIT,\
501 M_CTCP_DEF_TCPCS_INIT)
502
503#define S_CTCP_DEF_CRC_WIDTH _SB_MAKE64(48)
504#define M_CTCP_DEF_CRC_WIDTH _SB_MAKEMASK(2,S_CTCP_DEF_CRC_WIDTH)
505#define V_CTCP_DEF_CRC_WIDTH(r) _SB_MAKEVALUE(r,S_CTCP_DEF_CRC_WIDTH)
506#define G_CTCP_DEF_CRC_WIDTH(r) _SB_GETVALUE(r,S_CTCP_DEF_CRC_WIDTH,\
507 M_CTCP_DEF_CRC_WIDTH)
508
509#define K_CTCP_DEF_CRC_WIDTH_4 0
510#define K_CTCP_DEF_CRC_WIDTH_2 1
511#define K_CTCP_DEF_CRC_WIDTH_1 2
512
513#define M_CTCP_DEF_CRC_BIT_ORDER _SB_MAKEMASK1(50)
514#endif /* 1250 PASS3 || 112x PASS1 */
515
516
517/*
518 * Data Mover Descriptor Doubleword "A" (Table 7-26)
519 */
520
521#define S_DM_DSCRA_DST_ADDR _SB_MAKE64(0)
522#define M_DM_DSCRA_DST_ADDR _SB_MAKEMASK(40,S_DM_DSCRA_DST_ADDR)
523
524#define M_DM_DSCRA_UN_DEST _SB_MAKEMASK1(40)
525#define M_DM_DSCRA_UN_SRC _SB_MAKEMASK1(41)
526#define M_DM_DSCRA_INTERRUPT _SB_MAKEMASK1(42)
527#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
528#define M_DM_DSCRA_THROTTLE _SB_MAKEMASK1(43)
529#endif /* up to 1250 PASS1 */
530
531#define S_DM_DSCRA_DIR_DEST _SB_MAKE64(44)
532#define M_DM_DSCRA_DIR_DEST _SB_MAKEMASK(2,S_DM_DSCRA_DIR_DEST)
533#define V_DM_DSCRA_DIR_DEST(x) _SB_MAKEVALUE(x,S_DM_DSCRA_DIR_DEST)
534#define G_DM_DSCRA_DIR_DEST(x) _SB_GETVALUE(x,S_DM_DSCRA_DIR_DEST,M_DM_DSCRA_DIR_DEST)
535
536#define K_DM_DSCRA_DIR_DEST_INCR 0
537#define K_DM_DSCRA_DIR_DEST_DECR 1
538#define K_DM_DSCRA_DIR_DEST_CONST 2
539
540#define V_DM_DSCRA_DIR_DEST_INCR _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_INCR,S_DM_DSCRA_DIR_DEST)
541#define V_DM_DSCRA_DIR_DEST_DECR _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_DECR,S_DM_DSCRA_DIR_DEST)
542#define V_DM_DSCRA_DIR_DEST_CONST _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_CONST,S_DM_DSCRA_DIR_DEST)
543
544#define S_DM_DSCRA_DIR_SRC _SB_MAKE64(46)
545#define M_DM_DSCRA_DIR_SRC _SB_MAKEMASK(2,S_DM_DSCRA_DIR_SRC)
546#define V_DM_DSCRA_DIR_SRC(x) _SB_MAKEVALUE(x,S_DM_DSCRA_DIR_SRC)
547#define G_DM_DSCRA_DIR_SRC(x) _SB_GETVALUE(x,S_DM_DSCRA_DIR_SRC,M_DM_DSCRA_DIR_SRC)
548
549#define K_DM_DSCRA_DIR_SRC_INCR 0
550#define K_DM_DSCRA_DIR_SRC_DECR 1
551#define K_DM_DSCRA_DIR_SRC_CONST 2
552
553#define V_DM_DSCRA_DIR_SRC_INCR _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_INCR,S_DM_DSCRA_DIR_SRC)
554#define V_DM_DSCRA_DIR_SRC_DECR _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_DECR,S_DM_DSCRA_DIR_SRC)
555#define V_DM_DSCRA_DIR_SRC_CONST _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_CONST,S_DM_DSCRA_DIR_SRC)
556
557
558#define M_DM_DSCRA_ZERO_MEM _SB_MAKEMASK1(48)
559#define M_DM_DSCRA_PREFETCH _SB_MAKEMASK1(49)
560#define M_DM_DSCRA_L2C_DEST _SB_MAKEMASK1(50)
561#define M_DM_DSCRA_L2C_SRC _SB_MAKEMASK1(51)
562
563#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
564#define M_DM_DSCRA_RD_BKOFF _SB_MAKEMASK1(52)
565#define M_DM_DSCRA_WR_BKOFF _SB_MAKEMASK1(53)
566#endif /* 1250 PASS2 || 112x PASS1 */
567
568#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
569#define M_DM_DSCRA_TCPCS_EN _SB_MAKEMASK1(54)
570#define M_DM_DSCRA_TCPCS_RES _SB_MAKEMASK1(55)
571#define M_DM_DSCRA_TCPCS_AP _SB_MAKEMASK1(56)
572#define M_DM_DSCRA_CRC_EN _SB_MAKEMASK1(57)
573#define M_DM_DSCRA_CRC_RES _SB_MAKEMASK1(58)
574#define M_DM_DSCRA_CRC_AP _SB_MAKEMASK1(59)
575#define M_DM_DSCRA_CRC_DFN _SB_MAKEMASK1(60)
576#define M_DM_DSCRA_CRC_XBIT _SB_MAKEMASK1(61)
577#endif /* 1250 PASS3 || 112x PASS1 */
578
579#define M_DM_DSCRA_RESERVED2 _SB_MAKEMASK(3,61)
580
581/*
582 * Data Mover Descriptor Doubleword "B" (Table 7-25)
583 */
584
585#define S_DM_DSCRB_SRC_ADDR _SB_MAKE64(0)
586#define M_DM_DSCRB_SRC_ADDR _SB_MAKEMASK(40,S_DM_DSCRB_SRC_ADDR)
587
588#define S_DM_DSCRB_SRC_LENGTH _SB_MAKE64(40)
589#define M_DM_DSCRB_SRC_LENGTH _SB_MAKEMASK(20,S_DM_DSCRB_SRC_LENGTH)
590#define V_DM_DSCRB_SRC_LENGTH(x) _SB_MAKEVALUE(x,S_DM_DSCRB_SRC_LENGTH)
591#define G_DM_DSCRB_SRC_LENGTH(x) _SB_GETVALUE(x,S_DM_DSCRB_SRC_LENGTH,M_DM_DSCRB_SRC_LENGTH)
592
593
594#endif
diff --git a/include/asm-mips/sibyte/sb1250_genbus.h b/include/asm-mips/sibyte/sb1250_genbus.h
new file mode 100644
index 000000000000..0d9dfac3d7db
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_genbus.h
@@ -0,0 +1,276 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Generic Bus Constants File: sb1250_genbus.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's Generic Bus interface
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_GENBUS_H
36#define _SB1250_GENBUS_H
37
38#include "sb1250_defs.h"
39
40/*
41 * Generic Bus Region Configuration Registers (Table 11-4)
42 */
43
44#define S_IO_RDY_ACTIVE 0
45#define M_IO_RDY_ACTIVE _SB_MAKEMASK1(S_IO_RDY_ACTIVE)
46
47#define S_IO_ENA_RDY 1
48#define M_IO_ENA_RDY _SB_MAKEMASK1(S_IO_ENA_RDY)
49
50#define S_IO_WIDTH_SEL 2
51#define M_IO_WIDTH_SEL _SB_MAKEMASK(2,S_IO_WIDTH_SEL)
52#define K_IO_WIDTH_SEL_1 0
53#define K_IO_WIDTH_SEL_2 1
54#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
55#define K_IO_WIDTH_SEL_1L 2
56#endif /* 1250 PASS2 || 112x PASS1 */
57#define K_IO_WIDTH_SEL_4 3
58#define V_IO_WIDTH_SEL(x) _SB_MAKEVALUE(x,S_IO_WIDTH_SEL)
59#define G_IO_WIDTH_SEL(x) _SB_GETVALUE(x,S_IO_WIDTH_SEL,M_IO_WIDTH_SEL)
60
61#define S_IO_PARITY_ENA 4
62#define M_IO_PARITY_ENA _SB_MAKEMASK1(S_IO_PARITY_ENA)
63#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
64#define S_IO_BURST_EN 5
65#define M_IO_BURST_EN _SB_MAKEMASK1(S_IO_BURST_EN)
66#endif /* 1250 PASS2 || 112x PASS1 */
67#define S_IO_PARITY_ODD 6
68#define M_IO_PARITY_ODD _SB_MAKEMASK1(S_IO_PARITY_ODD)
69#define S_IO_NONMUX 7
70#define M_IO_NONMUX _SB_MAKEMASK1(S_IO_NONMUX)
71
72#define S_IO_TIMEOUT 8
73#define M_IO_TIMEOUT _SB_MAKEMASK(8,S_IO_TIMEOUT)
74#define V_IO_TIMEOUT(x) _SB_MAKEVALUE(x,S_IO_TIMEOUT)
75#define G_IO_TIMEOUT(x) _SB_GETVALUE(x,S_IO_TIMEOUT,M_IO_TIMEOUT)
76
77/*
78 * Generic Bus Region Size register (Table 11-5)
79 */
80
81#define S_IO_MULT_SIZE 0
82#define M_IO_MULT_SIZE _SB_MAKEMASK(12,S_IO_MULT_SIZE)
83#define V_IO_MULT_SIZE(x) _SB_MAKEVALUE(x,S_IO_MULT_SIZE)
84#define G_IO_MULT_SIZE(x) _SB_GETVALUE(x,S_IO_MULT_SIZE,M_IO_MULT_SIZE)
85
86#define S_IO_REGSIZE 16 /* # bits to shift size for this reg */
87
88/*
89 * Generic Bus Region Address (Table 11-6)
90 */
91
92#define S_IO_START_ADDR 0
93#define M_IO_START_ADDR _SB_MAKEMASK(14,S_IO_START_ADDR)
94#define V_IO_START_ADDR(x) _SB_MAKEVALUE(x,S_IO_START_ADDR)
95#define G_IO_START_ADDR(x) _SB_GETVALUE(x,S_IO_START_ADDR,M_IO_START_ADDR)
96
97#define S_IO_ADDRBASE 16 /* # bits to shift addr for this reg */
98
99/*
100 * Generic Bus Region 0 Timing Registers (Table 11-7)
101 */
102
103#define S_IO_ALE_WIDTH 0
104#define M_IO_ALE_WIDTH _SB_MAKEMASK(3,S_IO_ALE_WIDTH)
105#define V_IO_ALE_WIDTH(x) _SB_MAKEVALUE(x,S_IO_ALE_WIDTH)
106#define G_IO_ALE_WIDTH(x) _SB_GETVALUE(x,S_IO_ALE_WIDTH,M_IO_ALE_WIDTH)
107
108#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
109#define M_IO_EARLY_CS _SB_MAKEMASK1(3)
110#endif /* 1250 PASS2 || 112x PASS1 */
111
112#define S_IO_ALE_TO_CS 4
113#define M_IO_ALE_TO_CS _SB_MAKEMASK(2,S_IO_ALE_TO_CS)
114#define V_IO_ALE_TO_CS(x) _SB_MAKEVALUE(x,S_IO_ALE_TO_CS)
115#define G_IO_ALE_TO_CS(x) _SB_GETVALUE(x,S_IO_ALE_TO_CS,M_IO_ALE_TO_CS)
116
117#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
118#define S_IO_BURST_WIDTH _SB_MAKE64(6)
119#define M_IO_BURST_WIDTH _SB_MAKEMASK(2,S_IO_BURST_WIDTH)
120#define V_IO_BURST_WIDTH(x) _SB_MAKEVALUE(x,S_IO_BURST_WIDTH)
121#define G_IO_BURST_WIDTH(x) _SB_GETVALUE(x,S_IO_BURST_WIDTH,M_IO_BURST_WIDTH)
122#endif /* 1250 PASS2 || 112x PASS1 */
123
124#define S_IO_CS_WIDTH 8
125#define M_IO_CS_WIDTH _SB_MAKEMASK(5,S_IO_CS_WIDTH)
126#define V_IO_CS_WIDTH(x) _SB_MAKEVALUE(x,S_IO_CS_WIDTH)
127#define G_IO_CS_WIDTH(x) _SB_GETVALUE(x,S_IO_CS_WIDTH,M_IO_CS_WIDTH)
128
129#define S_IO_RDY_SMPLE 13
130#define M_IO_RDY_SMPLE _SB_MAKEMASK(3,S_IO_RDY_SMPLE)
131#define V_IO_RDY_SMPLE(x) _SB_MAKEVALUE(x,S_IO_RDY_SMPLE)
132#define G_IO_RDY_SMPLE(x) _SB_GETVALUE(x,S_IO_RDY_SMPLE,M_IO_RDY_SMPLE)
133
134
135/*
136 * Generic Bus Timing 1 Registers (Table 11-8)
137 */
138
139#define S_IO_ALE_TO_WRITE 0
140#define M_IO_ALE_TO_WRITE _SB_MAKEMASK(3,S_IO_ALE_TO_WRITE)
141#define V_IO_ALE_TO_WRITE(x) _SB_MAKEVALUE(x,S_IO_ALE_TO_WRITE)
142#define G_IO_ALE_TO_WRITE(x) _SB_GETVALUE(x,S_IO_ALE_TO_WRITE,M_IO_ALE_TO_WRITE)
143
144#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
145#define M_IO_RDY_SYNC _SB_MAKEMASK1(3)
146#endif /* 1250 PASS2 || 112x PASS1 */
147
148#define S_IO_WRITE_WIDTH 4
149#define M_IO_WRITE_WIDTH _SB_MAKEMASK(4,S_IO_WRITE_WIDTH)
150#define V_IO_WRITE_WIDTH(x) _SB_MAKEVALUE(x,S_IO_WRITE_WIDTH)
151#define G_IO_WRITE_WIDTH(x) _SB_GETVALUE(x,S_IO_WRITE_WIDTH,M_IO_WRITE_WIDTH)
152
153#define S_IO_IDLE_CYCLE 8
154#define M_IO_IDLE_CYCLE _SB_MAKEMASK(4,S_IO_IDLE_CYCLE)
155#define V_IO_IDLE_CYCLE(x) _SB_MAKEVALUE(x,S_IO_IDLE_CYCLE)
156#define G_IO_IDLE_CYCLE(x) _SB_GETVALUE(x,S_IO_IDLE_CYCLE,M_IO_IDLE_CYCLE)
157
158#define S_IO_OE_TO_CS 12
159#define M_IO_OE_TO_CS _SB_MAKEMASK(2,S_IO_OE_TO_CS)
160#define V_IO_OE_TO_CS(x) _SB_MAKEVALUE(x,S_IO_OE_TO_CS)
161#define G_IO_OE_TO_CS(x) _SB_GETVALUE(x,S_IO_OE_TO_CS,M_IO_OE_TO_CS)
162
163#define S_IO_CS_TO_OE 14
164#define M_IO_CS_TO_OE _SB_MAKEMASK(2,S_IO_CS_TO_OE)
165#define V_IO_CS_TO_OE(x) _SB_MAKEVALUE(x,S_IO_CS_TO_OE)
166#define G_IO_CS_TO_OE(x) _SB_GETVALUE(x,S_IO_CS_TO_OE,M_IO_CS_TO_OE)
167
168/*
169 * Generic Bus Interrupt Status Register (Table 11-9)
170 */
171
172#define M_IO_CS_ERR_INT _SB_MAKEMASK(0,8)
173#define M_IO_CS0_ERR_INT _SB_MAKEMASK1(0)
174#define M_IO_CS1_ERR_INT _SB_MAKEMASK1(1)
175#define M_IO_CS2_ERR_INT _SB_MAKEMASK1(2)
176#define M_IO_CS3_ERR_INT _SB_MAKEMASK1(3)
177#define M_IO_CS4_ERR_INT _SB_MAKEMASK1(4)
178#define M_IO_CS5_ERR_INT _SB_MAKEMASK1(5)
179#define M_IO_CS6_ERR_INT _SB_MAKEMASK1(6)
180#define M_IO_CS7_ERR_INT _SB_MAKEMASK1(7)
181
182#define M_IO_RD_PAR_INT _SB_MAKEMASK1(9)
183#define M_IO_TIMEOUT_INT _SB_MAKEMASK1(10)
184#define M_IO_ILL_ADDR_INT _SB_MAKEMASK1(11)
185#define M_IO_MULT_CS_INT _SB_MAKEMASK1(12)
186#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
187#define M_IO_COH_ERR _SB_MAKEMASK1(14)
188#endif /* 1250 PASS2 || 112x PASS1 */
189
190/*
191 * PCMCIA configuration register (Table 12-6)
192 */
193
194#define M_PCMCIA_CFG_ATTRMEM _SB_MAKEMASK1(0)
195#define M_PCMCIA_CFG_3VEN _SB_MAKEMASK1(1)
196#define M_PCMCIA_CFG_5VEN _SB_MAKEMASK1(2)
197#define M_PCMCIA_CFG_VPPEN _SB_MAKEMASK1(3)
198#define M_PCMCIA_CFG_RESET _SB_MAKEMASK1(4)
199#define M_PCMCIA_CFG_APWRONEN _SB_MAKEMASK1(5)
200#define M_PCMCIA_CFG_CDMASK _SB_MAKEMASK1(6)
201#define M_PCMCIA_CFG_WPMASK _SB_MAKEMASK1(7)
202#define M_PCMCIA_CFG_RDYMASK _SB_MAKEMASK1(8)
203#define M_PCMCIA_CFG_PWRCTL _SB_MAKEMASK1(9)
204
205/*
206 * PCMCIA status register (Table 12-7)
207 */
208
209#define M_PCMCIA_STATUS_CD1 _SB_MAKEMASK1(0)
210#define M_PCMCIA_STATUS_CD2 _SB_MAKEMASK1(1)
211#define M_PCMCIA_STATUS_VS1 _SB_MAKEMASK1(2)
212#define M_PCMCIA_STATUS_VS2 _SB_MAKEMASK1(3)
213#define M_PCMCIA_STATUS_WP _SB_MAKEMASK1(4)
214#define M_PCMCIA_STATUS_RDY _SB_MAKEMASK1(5)
215#define M_PCMCIA_STATUS_3VEN _SB_MAKEMASK1(6)
216#define M_PCMCIA_STATUS_5VEN _SB_MAKEMASK1(7)
217#define M_PCMCIA_STATUS_CDCHG _SB_MAKEMASK1(8)
218#define M_PCMCIA_STATUS_WPCHG _SB_MAKEMASK1(9)
219#define M_PCMCIA_STATUS_RDYCHG _SB_MAKEMASK1(10)
220
221/*
222 * GPIO Interrupt Type Register (table 13-3)
223 */
224
225#define K_GPIO_INTR_DISABLE 0
226#define K_GPIO_INTR_EDGE 1
227#define K_GPIO_INTR_LEVEL 2
228#define K_GPIO_INTR_SPLIT 3
229
230#define S_GPIO_INTR_TYPEX(n) (((n)/2)*2)
231#define M_GPIO_INTR_TYPEX(n) _SB_MAKEMASK(2,S_GPIO_INTR_TYPEX(n))
232#define V_GPIO_INTR_TYPEX(n,x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPEX(n))
233#define G_GPIO_INTR_TYPEX(n,x) _SB_GETVALUE(x,S_GPIO_INTR_TYPEX(n),M_GPIO_INTR_TYPEX(n))
234
235#define S_GPIO_INTR_TYPE0 0
236#define M_GPIO_INTR_TYPE0 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE0)
237#define V_GPIO_INTR_TYPE0(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE0)
238#define G_GPIO_INTR_TYPE0(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE0,M_GPIO_INTR_TYPE0)
239
240#define S_GPIO_INTR_TYPE2 2
241#define M_GPIO_INTR_TYPE2 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE2)
242#define V_GPIO_INTR_TYPE2(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE2)
243#define G_GPIO_INTR_TYPE2(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE2,M_GPIO_INTR_TYPE2)
244
245#define S_GPIO_INTR_TYPE4 4
246#define M_GPIO_INTR_TYPE4 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE4)
247#define V_GPIO_INTR_TYPE4(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE4)
248#define G_GPIO_INTR_TYPE4(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE4,M_GPIO_INTR_TYPE4)
249
250#define S_GPIO_INTR_TYPE6 6
251#define M_GPIO_INTR_TYPE6 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE6)
252#define V_GPIO_INTR_TYPE6(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE6)
253#define G_GPIO_INTR_TYPE6(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE6,M_GPIO_INTR_TYPE6)
254
255#define S_GPIO_INTR_TYPE8 8
256#define M_GPIO_INTR_TYPE8 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE8)
257#define V_GPIO_INTR_TYPE8(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE8)
258#define G_GPIO_INTR_TYPE8(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE8,M_GPIO_INTR_TYPE8)
259
260#define S_GPIO_INTR_TYPE10 10
261#define M_GPIO_INTR_TYPE10 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE10)
262#define V_GPIO_INTR_TYPE10(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE10)
263#define G_GPIO_INTR_TYPE10(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE10,M_GPIO_INTR_TYPE10)
264
265#define S_GPIO_INTR_TYPE12 12
266#define M_GPIO_INTR_TYPE12 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE12)
267#define V_GPIO_INTR_TYPE12(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE12)
268#define G_GPIO_INTR_TYPE12(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE12,M_GPIO_INTR_TYPE12)
269
270#define S_GPIO_INTR_TYPE14 14
271#define M_GPIO_INTR_TYPE14 _SB_MAKEMASK(2,S_GPIO_INTR_TYPE14)
272#define V_GPIO_INTR_TYPE14(x) _SB_MAKEVALUE(x,S_GPIO_INTR_TYPE14)
273#define G_GPIO_INTR_TYPE14(x) _SB_GETVALUE(x,S_GPIO_INTR_TYPE14,M_GPIO_INTR_TYPE14)
274
275
276#endif
diff --git a/include/asm-mips/sibyte/sb1250_int.h b/include/asm-mips/sibyte/sb1250_int.h
new file mode 100644
index 000000000000..c3f74df211f4
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_int.h
@@ -0,0 +1,247 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Interrupt Mapper definitions File: sb1250_int.h
5 *
6 * This module contains constants for manipulating the SB1250's
7 * interrupt mapper and definitions for the interrupt sources.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_INT_H
36#define _SB1250_INT_H
37
38#include "sb1250_defs.h"
39
40/* *********************************************************************
41 * Interrupt Mapper Constants
42 ********************************************************************* */
43
44/*
45 * Interrupt sources (Table 4-8, UM 0.2)
46 *
47 * First, the interrupt numbers.
48 */
49
50#define K_INT_WATCHDOG_TIMER_0 0
51#define K_INT_WATCHDOG_TIMER_1 1
52#define K_INT_TIMER_0 2
53#define K_INT_TIMER_1 3
54#define K_INT_TIMER_2 4
55#define K_INT_TIMER_3 5
56#define K_INT_SMB_0 6
57#define K_INT_SMB_1 7
58#define K_INT_UART_0 8
59#define K_INT_UART_1 9
60#define K_INT_SER_0 10
61#define K_INT_SER_1 11
62#define K_INT_PCMCIA 12
63#define K_INT_ADDR_TRAP 13
64#define K_INT_PERF_CNT 14
65#define K_INT_TRACE_FREEZE 15
66#define K_INT_BAD_ECC 16
67#define K_INT_COR_ECC 17
68#define K_INT_IO_BUS 18
69#define K_INT_MAC_0 19
70#define K_INT_MAC_1 20
71#define K_INT_MAC_2 21
72#define K_INT_DM_CH_0 22
73#define K_INT_DM_CH_1 23
74#define K_INT_DM_CH_2 24
75#define K_INT_DM_CH_3 25
76#define K_INT_MBOX_0 26
77#define K_INT_MBOX_1 27
78#define K_INT_MBOX_2 28
79#define K_INT_MBOX_3 29
80#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
81#define K_INT_CYCLE_CP0_INT 30
82#define K_INT_CYCLE_CP1_INT 31
83#endif /* 1250 PASS2 || 112x PASS1 */
84#define K_INT_GPIO_0 32
85#define K_INT_GPIO_1 33
86#define K_INT_GPIO_2 34
87#define K_INT_GPIO_3 35
88#define K_INT_GPIO_4 36
89#define K_INT_GPIO_5 37
90#define K_INT_GPIO_6 38
91#define K_INT_GPIO_7 39
92#define K_INT_GPIO_8 40
93#define K_INT_GPIO_9 41
94#define K_INT_GPIO_10 42
95#define K_INT_GPIO_11 43
96#define K_INT_GPIO_12 44
97#define K_INT_GPIO_13 45
98#define K_INT_GPIO_14 46
99#define K_INT_GPIO_15 47
100#define K_INT_LDT_FATAL 48
101#define K_INT_LDT_NONFATAL 49
102#define K_INT_LDT_SMI 50
103#define K_INT_LDT_NMI 51
104#define K_INT_LDT_INIT 52
105#define K_INT_LDT_STARTUP 53
106#define K_INT_LDT_EXT 54
107#define K_INT_PCI_ERROR 55
108#define K_INT_PCI_INTA 56
109#define K_INT_PCI_INTB 57
110#define K_INT_PCI_INTC 58
111#define K_INT_PCI_INTD 59
112#define K_INT_SPARE_2 60
113#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
114#define K_INT_MAC_0_CH1 61
115#define K_INT_MAC_1_CH1 62
116#define K_INT_MAC_2_CH1 63
117#endif /* 1250 PASS2 || 112x PASS1 */
118
119/*
120 * Mask values for each interrupt
121 */
122
123#define M_INT_WATCHDOG_TIMER_0 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_0)
124#define M_INT_WATCHDOG_TIMER_1 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_1)
125#define M_INT_TIMER_0 _SB_MAKEMASK1(K_INT_TIMER_0)
126#define M_INT_TIMER_1 _SB_MAKEMASK1(K_INT_TIMER_1)
127#define M_INT_TIMER_2 _SB_MAKEMASK1(K_INT_TIMER_2)
128#define M_INT_TIMER_3 _SB_MAKEMASK1(K_INT_TIMER_3)
129#define M_INT_SMB_0 _SB_MAKEMASK1(K_INT_SMB_0)
130#define M_INT_SMB_1 _SB_MAKEMASK1(K_INT_SMB_1)
131#define M_INT_UART_0 _SB_MAKEMASK1(K_INT_UART_0)
132#define M_INT_UART_1 _SB_MAKEMASK1(K_INT_UART_1)
133#define M_INT_SER_0 _SB_MAKEMASK1(K_INT_SER_0)
134#define M_INT_SER_1 _SB_MAKEMASK1(K_INT_SER_1)
135#define M_INT_PCMCIA _SB_MAKEMASK1(K_INT_PCMCIA)
136#define M_INT_ADDR_TRAP _SB_MAKEMASK1(K_INT_ADDR_TRAP)
137#define M_INT_PERF_CNT _SB_MAKEMASK1(K_INT_PERF_CNT)
138#define M_INT_TRACE_FREEZE _SB_MAKEMASK1(K_INT_TRACE_FREEZE)
139#define M_INT_BAD_ECC _SB_MAKEMASK1(K_INT_BAD_ECC)
140#define M_INT_COR_ECC _SB_MAKEMASK1(K_INT_COR_ECC)
141#define M_INT_IO_BUS _SB_MAKEMASK1(K_INT_IO_BUS)
142#define M_INT_MAC_0 _SB_MAKEMASK1(K_INT_MAC_0)
143#define M_INT_MAC_1 _SB_MAKEMASK1(K_INT_MAC_1)
144#define M_INT_MAC_2 _SB_MAKEMASK1(K_INT_MAC_2)
145#define M_INT_DM_CH_0 _SB_MAKEMASK1(K_INT_DM_CH_0)
146#define M_INT_DM_CH_1 _SB_MAKEMASK1(K_INT_DM_CH_1)
147#define M_INT_DM_CH_2 _SB_MAKEMASK1(K_INT_DM_CH_2)
148#define M_INT_DM_CH_3 _SB_MAKEMASK1(K_INT_DM_CH_3)
149#define M_INT_MBOX_0 _SB_MAKEMASK1(K_INT_MBOX_0)
150#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1)
151#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2)
152#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3)
153#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
154#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT)
155#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT)
156#endif /* 1250 PASS2 || 112x PASS1 */
157#define M_INT_GPIO_0 _SB_MAKEMASK1(K_INT_GPIO_0)
158#define M_INT_GPIO_1 _SB_MAKEMASK1(K_INT_GPIO_1)
159#define M_INT_GPIO_2 _SB_MAKEMASK1(K_INT_GPIO_2)
160#define M_INT_GPIO_3 _SB_MAKEMASK1(K_INT_GPIO_3)
161#define M_INT_GPIO_4 _SB_MAKEMASK1(K_INT_GPIO_4)
162#define M_INT_GPIO_5 _SB_MAKEMASK1(K_INT_GPIO_5)
163#define M_INT_GPIO_6 _SB_MAKEMASK1(K_INT_GPIO_6)
164#define M_INT_GPIO_7 _SB_MAKEMASK1(K_INT_GPIO_7)
165#define M_INT_GPIO_8 _SB_MAKEMASK1(K_INT_GPIO_8)
166#define M_INT_GPIO_9 _SB_MAKEMASK1(K_INT_GPIO_9)
167#define M_INT_GPIO_10 _SB_MAKEMASK1(K_INT_GPIO_10)
168#define M_INT_GPIO_11 _SB_MAKEMASK1(K_INT_GPIO_11)
169#define M_INT_GPIO_12 _SB_MAKEMASK1(K_INT_GPIO_12)
170#define M_INT_GPIO_13 _SB_MAKEMASK1(K_INT_GPIO_13)
171#define M_INT_GPIO_14 _SB_MAKEMASK1(K_INT_GPIO_14)
172#define M_INT_GPIO_15 _SB_MAKEMASK1(K_INT_GPIO_15)
173#define M_INT_LDT_FATAL _SB_MAKEMASK1(K_INT_LDT_FATAL)
174#define M_INT_LDT_NONFATAL _SB_MAKEMASK1(K_INT_LDT_NONFATAL)
175#define M_INT_LDT_SMI _SB_MAKEMASK1(K_INT_LDT_SMI)
176#define M_INT_LDT_NMI _SB_MAKEMASK1(K_INT_LDT_NMI)
177#define M_INT_LDT_INIT _SB_MAKEMASK1(K_INT_LDT_INIT)
178#define M_INT_LDT_STARTUP _SB_MAKEMASK1(K_INT_LDT_STARTUP)
179#define M_INT_LDT_EXT _SB_MAKEMASK1(K_INT_LDT_EXT)
180#define M_INT_PCI_ERROR _SB_MAKEMASK1(K_INT_PCI_ERROR)
181#define M_INT_PCI_INTA _SB_MAKEMASK1(K_INT_PCI_INTA)
182#define M_INT_PCI_INTB _SB_MAKEMASK1(K_INT_PCI_INTB)
183#define M_INT_PCI_INTC _SB_MAKEMASK1(K_INT_PCI_INTC)
184#define M_INT_PCI_INTD _SB_MAKEMASK1(K_INT_PCI_INTD)
185#define M_INT_SPARE_2 _SB_MAKEMASK1(K_INT_SPARE_2)
186#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
187#define M_INT_MAC_0_CH1 _SB_MAKEMASK1(K_INT_MAC_0_CH1)
188#define M_INT_MAC_1_CH1 _SB_MAKEMASK1(K_INT_MAC_1_CH1)
189#define M_INT_MAC_2_CH1 _SB_MAKEMASK1(K_INT_MAC_2_CH1)
190#endif /* 1250 PASS2 || 112x PASS1 */
191
192/*
193 * Interrupt mappings
194 */
195
196#define K_INT_MAP_I0 0 /* interrupt pins on processor */
197#define K_INT_MAP_I1 1
198#define K_INT_MAP_I2 2
199#define K_INT_MAP_I3 3
200#define K_INT_MAP_I4 4
201#define K_INT_MAP_I5 5
202#define K_INT_MAP_NMI 6 /* nonmaskable */
203#define K_INT_MAP_DINT 7 /* debug interrupt */
204
205/*
206 * LDT Interrupt Set Register (table 4-5)
207 */
208
209#define S_INT_LDT_INTMSG 0
210#define M_INT_LDT_INTMSG _SB_MAKEMASK(3,S_INT_LDT_INTMSG)
211#define V_INT_LDT_INTMSG(x) _SB_MAKEVALUE(x,S_INT_LDT_INTMSG)
212#define G_INT_LDT_INTMSG(x) _SB_GETVALUE(x,S_INT_LDT_INTMSG,M_INT_LDT_INTMSG)
213
214#define K_INT_LDT_INTMSG_FIXED 0
215#define K_INT_LDT_INTMSG_ARBITRATED 1
216#define K_INT_LDT_INTMSG_SMI 2
217#define K_INT_LDT_INTMSG_NMI 3
218#define K_INT_LDT_INTMSG_INIT 4
219#define K_INT_LDT_INTMSG_STARTUP 5
220#define K_INT_LDT_INTMSG_EXTINT 6
221#define K_INT_LDT_INTMSG_RESERVED 7
222
223#define M_INT_LDT_EDGETRIGGER 0
224#define M_INT_LDT_LEVELTRIGGER _SB_MAKEMASK1(3)
225
226#define M_INT_LDT_PHYSICALDEST 0
227#define M_INT_LDT_LOGICALDEST _SB_MAKEMASK1(4)
228
229#define S_INT_LDT_INTDEST 5
230#define M_INT_LDT_INTDEST _SB_MAKEMASK(10,S_INT_LDT_INTDEST)
231#define V_INT_LDT_INTDEST(x) _SB_MAKEVALUE(x,S_INT_LDT_INTDEST)
232#define G_INT_LDT_INTDEST(x) _SB_GETVALUE(x,S_INT_LDT_INTDEST,M_INT_LDT_INTDEST)
233
234#define S_INT_LDT_VECTOR 13
235#define M_INT_LDT_VECTOR _SB_MAKEMASK(8,S_INT_LDT_VECTOR)
236#define V_INT_LDT_VECTOR(x) _SB_MAKEVALUE(x,S_INT_LDT_VECTOR)
237#define G_INT_LDT_VECTOR(x) _SB_GETVALUE(x,S_INT_LDT_VECTOR,M_INT_LDT_VECTOR)
238
239/*
240 * Vector format (Table 4-6)
241 */
242
243#define M_LDTVECT_RAISEINT 0x00
244#define M_LDTVECT_RAISEMBOX 0x40
245
246
247#endif
diff --git a/include/asm-mips/sibyte/sb1250_l2c.h b/include/asm-mips/sibyte/sb1250_l2c.h
new file mode 100644
index 000000000000..799db828d963
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_l2c.h
@@ -0,0 +1,128 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * L2 Cache constants and macros File: sb1250_l2c.h
5 *
6 * This module contains constants useful for manipulating the
7 * level 2 cache.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_L2C_H
36#define _SB1250_L2C_H
37
38#include "sb1250_defs.h"
39
40/*
41 * Level 2 Cache Tag register (Table 5-3)
42 */
43
44#define S_L2C_TAG_MBZ 0
45#define M_L2C_TAG_MBZ _SB_MAKEMASK(5,S_L2C_TAG_MBZ)
46
47#define S_L2C_TAG_INDEX 5
48#define M_L2C_TAG_INDEX _SB_MAKEMASK(12,S_L2C_TAG_INDEX)
49#define V_L2C_TAG_INDEX(x) _SB_MAKEVALUE(x,S_L2C_TAG_INDEX)
50#define G_L2C_TAG_INDEX(x) _SB_GETVALUE(x,S_L2C_TAG_INDEX,M_L2C_TAG_INDEX)
51
52#define S_L2C_TAG_TAG 17
53#define M_L2C_TAG_TAG _SB_MAKEMASK(23,S_L2C_TAG_TAG)
54#define V_L2C_TAG_TAG(x) _SB_MAKEVALUE(x,S_L2C_TAG_TAG)
55#define G_L2C_TAG_TAG(x) _SB_GETVALUE(x,S_L2C_TAG_TAG,M_L2C_TAG_TAG)
56
57#define S_L2C_TAG_ECC 40
58#define M_L2C_TAG_ECC _SB_MAKEMASK(6,S_L2C_TAG_ECC)
59#define V_L2C_TAG_ECC(x) _SB_MAKEVALUE(x,S_L2C_TAG_ECC)
60#define G_L2C_TAG_ECC(x) _SB_GETVALUE(x,S_L2C_TAG_ECC,M_L2C_TAG_ECC)
61
62#define S_L2C_TAG_WAY 46
63#define M_L2C_TAG_WAY _SB_MAKEMASK(2,S_L2C_TAG_WAY)
64#define V_L2C_TAG_WAY(x) _SB_MAKEVALUE(x,S_L2C_TAG_WAY)
65#define G_L2C_TAG_WAY(x) _SB_GETVALUE(x,S_L2C_TAG_WAY,M_L2C_TAG_WAY)
66
67#define M_L2C_TAG_DIRTY _SB_MAKEMASK1(48)
68#define M_L2C_TAG_VALID _SB_MAKEMASK1(49)
69
70/*
71 * Format of level 2 cache management address (table 5-2)
72 */
73
74#define S_L2C_MGMT_INDEX 5
75#define M_L2C_MGMT_INDEX _SB_MAKEMASK(12,S_L2C_MGMT_INDEX)
76#define V_L2C_MGMT_INDEX(x) _SB_MAKEVALUE(x,S_L2C_MGMT_INDEX)
77#define G_L2C_MGMT_INDEX(x) _SB_GETVALUE(x,S_L2C_MGMT_INDEX,M_L2C_MGMT_INDEX)
78
79#define S_L2C_MGMT_QUADRANT 15
80#define M_L2C_MGMT_QUADRANT _SB_MAKEMASK(2,S_L2C_MGMT_QUADRANT)
81#define V_L2C_MGMT_QUADRANT(x) _SB_MAKEVALUE(x,S_L2C_MGMT_QUADRANT)
82#define G_L2C_MGMT_QUADRANT(x) _SB_GETVALUE(x,S_L2C_MGMT_QUADRANT,M_L2C_MGMT_QUADRANT)
83
84#define S_L2C_MGMT_HALF 16
85#define M_L2C_MGMT_HALF _SB_MAKEMASK(1,S_L2C_MGMT_HALF)
86
87#define S_L2C_MGMT_WAY 17
88#define M_L2C_MGMT_WAY _SB_MAKEMASK(2,S_L2C_MGMT_WAY)
89#define V_L2C_MGMT_WAY(x) _SB_MAKEVALUE(x,S_L2C_MGMT_WAY)
90#define G_L2C_MGMT_WAY(x) _SB_GETVALUE(x,S_L2C_MGMT_WAY,M_L2C_MGMT_WAY)
91
92#define S_L2C_MGMT_TAG 21
93#define M_L2C_MGMT_TAG _SB_MAKEMASK(6,S_L2C_MGMT_TAG)
94#define V_L2C_MGMT_TAG(x) _SB_MAKEVALUE(x,S_L2C_MGMT_TAG)
95#define G_L2C_MGMT_TAG(x) _SB_GETVALUE(x,S_L2C_MGMT_TAG,M_L2C_MGMT_TAG)
96
97#define M_L2C_MGMT_DIRTY _SB_MAKEMASK1(19)
98#define M_L2C_MGMT_VALID _SB_MAKEMASK1(20)
99
100#define A_L2C_MGMT_TAG_BASE 0x00D0000000
101
102#define L2C_ENTRIES_PER_WAY 4096
103#define L2C_NUM_WAYS 4
104
105
106#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
107/*
108 * L2 Read Misc. register (A_L2_READ_MISC)
109 */
110#define S_L2C_MISC_NO_WAY 10
111#define M_L2C_MISC_NO_WAY _SB_MAKEMASK(4,S_L2C_MISC_NO_WAY)
112#define V_L2C_MISC_NO_WAY(x) _SB_MAKEVALUE(x,S_L2C_MISC_NO_WAY)
113#define G_L2C_MISC_NO_WAY(x) _SB_GETVALUE(x,S_L2C_MISC_NO_WAY,M_L2C_MISC_NO_WAY)
114
115#define M_L2C_MISC_ECC_CLEANUP_DIS _SB_MAKEMASK1(9)
116#define M_L2C_MISC_MC_PRIO_LOW _SB_MAKEMASK1(8)
117#define M_L2C_MISC_SOFT_DISABLE_T _SB_MAKEMASK1(7)
118#define M_L2C_MISC_SOFT_DISABLE_B _SB_MAKEMASK1(6)
119#define M_L2C_MISC_SOFT_DISABLE_R _SB_MAKEMASK1(5)
120#define M_L2C_MISC_SOFT_DISABLE_L _SB_MAKEMASK1(4)
121#define M_L2C_MISC_SCACHE_DISABLE_T _SB_MAKEMASK1(3)
122#define M_L2C_MISC_SCACHE_DISABLE_B _SB_MAKEMASK1(2)
123#define M_L2C_MISC_SCACHE_DISABLE_R _SB_MAKEMASK1(1)
124#define M_L2C_MISC_SCACHE_DISABLE_L _SB_MAKEMASK1(0)
125#endif /* 1250 PASS3 || 112x PASS1 */
126
127
128#endif
diff --git a/include/asm-mips/sibyte/sb1250_ldt.h b/include/asm-mips/sibyte/sb1250_ldt.h
new file mode 100644
index 000000000000..d8753885df17
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_ldt.h
@@ -0,0 +1,425 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * LDT constants File: sb1250_ldt.h
5 *
6 * This module contains constants and macros to describe
7 * the LDT interface on the SB1250.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_LDT_H
36#define _SB1250_LDT_H
37
38#include "sb1250_defs.h"
39
40#define K_LDT_VENDOR_SIBYTE 0x166D
41#define K_LDT_DEVICE_SB1250 0x0002
42
43/*
44 * LDT Interface Type 1 (bridge) configuration header
45 */
46
47#define R_LDT_TYPE1_DEVICEID 0x0000
48#define R_LDT_TYPE1_CMDSTATUS 0x0004
49#define R_LDT_TYPE1_CLASSREV 0x0008
50#define R_LDT_TYPE1_DEVHDR 0x000C
51#define R_LDT_TYPE1_BAR0 0x0010 /* not used */
52#define R_LDT_TYPE1_BAR1 0x0014 /* not used */
53
54#define R_LDT_TYPE1_BUSID 0x0018 /* bus ID register */
55#define R_LDT_TYPE1_SECSTATUS 0x001C /* secondary status / I/O base/limit */
56#define R_LDT_TYPE1_MEMLIMIT 0x0020
57#define R_LDT_TYPE1_PREFETCH 0x0024
58#define R_LDT_TYPE1_PREF_BASE 0x0028
59#define R_LDT_TYPE1_PREF_LIMIT 0x002C
60#define R_LDT_TYPE1_IOLIMIT 0x0030
61#define R_LDT_TYPE1_CAPPTR 0x0034
62#define R_LDT_TYPE1_ROMADDR 0x0038
63#define R_LDT_TYPE1_BRCTL 0x003C
64#define R_LDT_TYPE1_CMD 0x0040
65#define R_LDT_TYPE1_LINKCTRL 0x0044
66#define R_LDT_TYPE1_LINKFREQ 0x0048
67#define R_LDT_TYPE1_RESERVED1 0x004C
68#define R_LDT_TYPE1_SRICMD 0x0050
69#define R_LDT_TYPE1_SRITXNUM 0x0054
70#define R_LDT_TYPE1_SRIRXNUM 0x0058
71#define R_LDT_TYPE1_ERRSTATUS 0x0068
72#define R_LDT_TYPE1_SRICTRL 0x006C
73#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
74#define R_LDT_TYPE1_ADDSTATUS 0x0070
75#endif /* 1250 PASS2 || 112x PASS1 */
76#define R_LDT_TYPE1_TXBUFCNT 0x00C8
77#define R_LDT_TYPE1_EXPCRC 0x00DC
78#define R_LDT_TYPE1_RXCRC 0x00F0
79
80
81/*
82 * LDT Device ID register
83 */
84
85#define S_LDT_DEVICEID_VENDOR 0
86#define M_LDT_DEVICEID_VENDOR _SB_MAKEMASK_32(16,S_LDT_DEVICEID_VENDOR)
87#define V_LDT_DEVICEID_VENDOR(x) _SB_MAKEVALUE_32(x,S_LDT_DEVICEID_VENDOR)
88#define G_LDT_DEVICEID_VENDOR(x) _SB_GETVALUE_32(x,S_LDT_DEVICEID_VENDOR,M_LDT_DEVICEID_VENDOR)
89
90#define S_LDT_DEVICEID_DEVICEID 16
91#define M_LDT_DEVICEID_DEVICEID _SB_MAKEMASK_32(16,S_LDT_DEVICEID_DEVICEID)
92#define V_LDT_DEVICEID_DEVICEID(x) _SB_MAKEVALUE_32(x,S_LDT_DEVICEID_DEVICEID)
93#define G_LDT_DEVICEID_DEVICEID(x) _SB_GETVALUE_32(x,S_LDT_DEVICEID_DEVICEID,M_LDT_DEVICEID_DEVICEID)
94
95
96/*
97 * LDT Command Register (Table 8-13)
98 */
99
100#define M_LDT_CMD_IOSPACE_EN _SB_MAKEMASK1_32(0)
101#define M_LDT_CMD_MEMSPACE_EN _SB_MAKEMASK1_32(1)
102#define M_LDT_CMD_MASTER_EN _SB_MAKEMASK1_32(2)
103#define M_LDT_CMD_SPECCYC_EN _SB_MAKEMASK1_32(3)
104#define M_LDT_CMD_MEMWRINV_EN _SB_MAKEMASK1_32(4)
105#define M_LDT_CMD_VGAPALSNP_EN _SB_MAKEMASK1_32(5)
106#define M_LDT_CMD_PARERRRESP _SB_MAKEMASK1_32(6)
107#define M_LDT_CMD_WAITCYCCTRL _SB_MAKEMASK1_32(7)
108#define M_LDT_CMD_SERR_EN _SB_MAKEMASK1_32(8)
109#define M_LDT_CMD_FASTB2B_EN _SB_MAKEMASK1_32(9)
110
111/*
112 * LDT class and revision registers
113 */
114
115#define S_LDT_CLASSREV_REV 0
116#define M_LDT_CLASSREV_REV _SB_MAKEMASK_32(8,S_LDT_CLASSREV_REV)
117#define V_LDT_CLASSREV_REV(x) _SB_MAKEVALUE_32(x,S_LDT_CLASSREV_REV)
118#define G_LDT_CLASSREV_REV(x) _SB_GETVALUE_32(x,S_LDT_CLASSREV_REV,M_LDT_CLASSREV_REV)
119
120#define S_LDT_CLASSREV_CLASS 8
121#define M_LDT_CLASSREV_CLASS _SB_MAKEMASK_32(24,S_LDT_CLASSREV_CLASS)
122#define V_LDT_CLASSREV_CLASS(x) _SB_MAKEVALUE_32(x,S_LDT_CLASSREV_CLASS)
123#define G_LDT_CLASSREV_CLASS(x) _SB_GETVALUE_32(x,S_LDT_CLASSREV_CLASS,M_LDT_CLASSREV_CLASS)
124
125#define K_LDT_REV 0x01
126#define K_LDT_CLASS 0x060000
127
128/*
129 * Device Header (offset 0x0C)
130 */
131
132#define S_LDT_DEVHDR_CLINESZ 0
133#define M_LDT_DEVHDR_CLINESZ _SB_MAKEMASK_32(8,S_LDT_DEVHDR_CLINESZ)
134#define V_LDT_DEVHDR_CLINESZ(x) _SB_MAKEVALUE_32(x,S_LDT_DEVHDR_CLINESZ)
135#define G_LDT_DEVHDR_CLINESZ(x) _SB_GETVALUE_32(x,S_LDT_DEVHDR_CLINESZ,M_LDT_DEVHDR_CLINESZ)
136
137#define S_LDT_DEVHDR_LATTMR 8
138#define M_LDT_DEVHDR_LATTMR _SB_MAKEMASK_32(8,S_LDT_DEVHDR_LATTMR)
139#define V_LDT_DEVHDR_LATTMR(x) _SB_MAKEVALUE_32(x,S_LDT_DEVHDR_LATTMR)
140#define G_LDT_DEVHDR_LATTMR(x) _SB_GETVALUE_32(x,S_LDT_DEVHDR_LATTMR,M_LDT_DEVHDR_LATTMR)
141
142#define S_LDT_DEVHDR_HDRTYPE 16
143#define M_LDT_DEVHDR_HDRTYPE _SB_MAKEMASK_32(8,S_LDT_DEVHDR_HDRTYPE)
144#define V_LDT_DEVHDR_HDRTYPE(x) _SB_MAKEVALUE_32(x,S_LDT_DEVHDR_HDRTYPE)
145#define G_LDT_DEVHDR_HDRTYPE(x) _SB_GETVALUE_32(x,S_LDT_DEVHDR_HDRTYPE,M_LDT_DEVHDR_HDRTYPE)
146
147#define K_LDT_DEVHDR_HDRTYPE_TYPE1 1
148
149#define S_LDT_DEVHDR_BIST 24
150#define M_LDT_DEVHDR_BIST _SB_MAKEMASK_32(8,S_LDT_DEVHDR_BIST)
151#define V_LDT_DEVHDR_BIST(x) _SB_MAKEVALUE_32(x,S_LDT_DEVHDR_BIST)
152#define G_LDT_DEVHDR_BIST(x) _SB_GETVALUE_32(x,S_LDT_DEVHDR_BIST,M_LDT_DEVHDR_BIST)
153
154
155
156/*
157 * LDT Status Register (Table 8-14). Note that these constants
158 * assume you've read the command and status register
159 * together (32-bit read at offset 0x04)
160 *
161 * These bits also apply to the secondary status
162 * register (Table 8-15), offset 0x1C
163 */
164
165#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
166#define M_LDT_STATUS_VGAEN _SB_MAKEMASK1_32(3)
167#endif /* 1250 PASS2 || 112x PASS1 */
168#define M_LDT_STATUS_CAPLIST _SB_MAKEMASK1_32(20)
169#define M_LDT_STATUS_66MHZCAP _SB_MAKEMASK1_32(21)
170#define M_LDT_STATUS_RESERVED2 _SB_MAKEMASK1_32(22)
171#define M_LDT_STATUS_FASTB2BCAP _SB_MAKEMASK1_32(23)
172#define M_LDT_STATUS_MSTRDPARERR _SB_MAKEMASK1_32(24)
173
174#define S_LDT_STATUS_DEVSELTIMING 25
175#define M_LDT_STATUS_DEVSELTIMING _SB_MAKEMASK_32(2,S_LDT_STATUS_DEVSELTIMING)
176#define V_LDT_STATUS_DEVSELTIMING(x) _SB_MAKEVALUE_32(x,S_LDT_STATUS_DEVSELTIMING)
177#define G_LDT_STATUS_DEVSELTIMING(x) _SB_GETVALUE_32(x,S_LDT_STATUS_DEVSELTIMING,M_LDT_STATUS_DEVSELTIMING)
178
179#define M_LDT_STATUS_SIGDTGTABORT _SB_MAKEMASK1_32(27)
180#define M_LDT_STATUS_RCVDTGTABORT _SB_MAKEMASK1_32(28)
181#define M_LDT_STATUS_RCVDMSTRABORT _SB_MAKEMASK1_32(29)
182#define M_LDT_STATUS_SIGDSERR _SB_MAKEMASK1_32(30)
183#define M_LDT_STATUS_DETPARERR _SB_MAKEMASK1_32(31)
184
185/*
186 * Bridge Control Register (Table 8-16). Note that these
187 * constants assume you've read the register as a 32-bit
188 * read (offset 0x3C)
189 */
190
191#define M_LDT_BRCTL_PARERRRESP_EN _SB_MAKEMASK1_32(16)
192#define M_LDT_BRCTL_SERR_EN _SB_MAKEMASK1_32(17)
193#define M_LDT_BRCTL_ISA_EN _SB_MAKEMASK1_32(18)
194#define M_LDT_BRCTL_VGA_EN _SB_MAKEMASK1_32(19)
195#define M_LDT_BRCTL_MSTRABORTMODE _SB_MAKEMASK1_32(21)
196#define M_LDT_BRCTL_SECBUSRESET _SB_MAKEMASK1_32(22)
197#define M_LDT_BRCTL_FASTB2B_EN _SB_MAKEMASK1_32(23)
198#define M_LDT_BRCTL_PRIDISCARD _SB_MAKEMASK1_32(24)
199#define M_LDT_BRCTL_SECDISCARD _SB_MAKEMASK1_32(25)
200#define M_LDT_BRCTL_DISCARDSTAT _SB_MAKEMASK1_32(26)
201#define M_LDT_BRCTL_DISCARDSERR_EN _SB_MAKEMASK1_32(27)
202
203/*
204 * LDT Command Register (Table 8-17). Note that these constants
205 * assume you've read the command and status register together
206 * 32-bit read at offset 0x40
207 */
208
209#define M_LDT_CMD_WARMRESET _SB_MAKEMASK1_32(16)
210#define M_LDT_CMD_DOUBLEENDED _SB_MAKEMASK1_32(17)
211
212#define S_LDT_CMD_CAPTYPE 29
213#define M_LDT_CMD_CAPTYPE _SB_MAKEMASK_32(3,S_LDT_CMD_CAPTYPE)
214#define V_LDT_CMD_CAPTYPE(x) _SB_MAKEVALUE_32(x,S_LDT_CMD_CAPTYPE)
215#define G_LDT_CMD_CAPTYPE(x) _SB_GETVALUE_32(x,S_LDT_CMD_CAPTYPE,M_LDT_CMD_CAPTYPE)
216
217/*
218 * LDT link control register (Table 8-18), and (Table 8-19)
219 */
220
221#define M_LDT_LINKCTRL_CAPSYNCFLOOD_EN _SB_MAKEMASK1_32(1)
222#define M_LDT_LINKCTRL_CRCSTARTTEST _SB_MAKEMASK1_32(2)
223#define M_LDT_LINKCTRL_CRCFORCEERR _SB_MAKEMASK1_32(3)
224#define M_LDT_LINKCTRL_LINKFAIL _SB_MAKEMASK1_32(4)
225#define M_LDT_LINKCTRL_INITDONE _SB_MAKEMASK1_32(5)
226#define M_LDT_LINKCTRL_EOC _SB_MAKEMASK1_32(6)
227#define M_LDT_LINKCTRL_XMITOFF _SB_MAKEMASK1_32(7)
228
229#define S_LDT_LINKCTRL_CRCERR 8
230#define M_LDT_LINKCTRL_CRCERR _SB_MAKEMASK_32(4,S_LDT_LINKCTRL_CRCERR)
231#define V_LDT_LINKCTRL_CRCERR(x) _SB_MAKEVALUE_32(x,S_LDT_LINKCTRL_CRCERR)
232#define G_LDT_LINKCTRL_CRCERR(x) _SB_GETVALUE_32(x,S_LDT_LINKCTRL_CRCERR,M_LDT_LINKCTRL_CRCERR)
233
234#define S_LDT_LINKCTRL_MAXIN 16
235#define M_LDT_LINKCTRL_MAXIN _SB_MAKEMASK_32(3,S_LDT_LINKCTRL_MAXIN)
236#define V_LDT_LINKCTRL_MAXIN(x) _SB_MAKEVALUE_32(x,S_LDT_LINKCTRL_MAXIN)
237#define G_LDT_LINKCTRL_MAXIN(x) _SB_GETVALUE_32(x,S_LDT_LINKCTRL_MAXIN,M_LDT_LINKCTRL_MAXIN)
238
239#define M_LDT_LINKCTRL_DWFCLN _SB_MAKEMASK1_32(19)
240
241#define S_LDT_LINKCTRL_MAXOUT 20
242#define M_LDT_LINKCTRL_MAXOUT _SB_MAKEMASK_32(3,S_LDT_LINKCTRL_MAXOUT)
243#define V_LDT_LINKCTRL_MAXOUT(x) _SB_MAKEVALUE_32(x,S_LDT_LINKCTRL_MAXOUT)
244#define G_LDT_LINKCTRL_MAXOUT(x) _SB_GETVALUE_32(x,S_LDT_LINKCTRL_MAXOUT,M_LDT_LINKCTRL_MAXOUT)
245
246#define M_LDT_LINKCTRL_DWFCOUT _SB_MAKEMASK1_32(23)
247
248#define S_LDT_LINKCTRL_WIDTHIN 24
249#define M_LDT_LINKCTRL_WIDTHIN _SB_MAKEMASK_32(3,S_LDT_LINKCTRL_WIDTHIN)
250#define V_LDT_LINKCTRL_WIDTHIN(x) _SB_MAKEVALUE_32(x,S_LDT_LINKCTRL_WIDTHIN)
251#define G_LDT_LINKCTRL_WIDTHIN(x) _SB_GETVALUE_32(x,S_LDT_LINKCTRL_WIDTHIN,M_LDT_LINKCTRL_WIDTHIN)
252
253#define M_LDT_LINKCTRL_DWFCLIN_EN _SB_MAKEMASK1_32(27)
254
255#define S_LDT_LINKCTRL_WIDTHOUT 28
256#define M_LDT_LINKCTRL_WIDTHOUT _SB_MAKEMASK_32(3,S_LDT_LINKCTRL_WIDTHOUT)
257#define V_LDT_LINKCTRL_WIDTHOUT(x) _SB_MAKEVALUE_32(x,S_LDT_LINKCTRL_WIDTHOUT)
258#define G_LDT_LINKCTRL_WIDTHOUT(x) _SB_GETVALUE_32(x,S_LDT_LINKCTRL_WIDTHOUT,M_LDT_LINKCTRL_WIDTHOUT)
259
260#define M_LDT_LINKCTRL_DWFCOUT_EN _SB_MAKEMASK1_32(31)
261
262/*
263 * LDT Link frequency register (Table 8-20) offset 0x48
264 */
265
266#define S_LDT_LINKFREQ_FREQ 8
267#define M_LDT_LINKFREQ_FREQ _SB_MAKEMASK_32(4,S_LDT_LINKFREQ_FREQ)
268#define V_LDT_LINKFREQ_FREQ(x) _SB_MAKEVALUE_32(x,S_LDT_LINKFREQ_FREQ)
269#define G_LDT_LINKFREQ_FREQ(x) _SB_GETVALUE_32(x,S_LDT_LINKFREQ_FREQ,M_LDT_LINKFREQ_FREQ)
270
271#define K_LDT_LINKFREQ_200MHZ 0
272#define K_LDT_LINKFREQ_300MHZ 1
273#define K_LDT_LINKFREQ_400MHZ 2
274#define K_LDT_LINKFREQ_500MHZ 3
275#define K_LDT_LINKFREQ_600MHZ 4
276#define K_LDT_LINKFREQ_800MHZ 5
277#define K_LDT_LINKFREQ_1000MHZ 6
278
279/*
280 * LDT SRI Command Register (Table 8-21). Note that these constants
281 * assume you've read the command and status register together
282 * 32-bit read at offset 0x50
283 */
284
285#define M_LDT_SRICMD_SIPREADY _SB_MAKEMASK1_32(16)
286#define M_LDT_SRICMD_SYNCPTRCTL _SB_MAKEMASK1_32(17)
287#define M_LDT_SRICMD_REDUCESYNCZERO _SB_MAKEMASK1_32(18)
288#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
289#define M_LDT_SRICMD_DISSTARVATIONCNT _SB_MAKEMASK1_32(19) /* PASS1 */
290#endif /* up to 1250 PASS1 */
291#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
292#define M_LDT_SRICMD_DISMULTTXVLD _SB_MAKEMASK1_32(19)
293#define M_LDT_SRICMD_EXPENDIAN _SB_MAKEMASK1_32(26)
294#endif /* 1250 PASS2 || 112x PASS1 */
295
296
297#define S_LDT_SRICMD_RXMARGIN 20
298#define M_LDT_SRICMD_RXMARGIN _SB_MAKEMASK_32(5,S_LDT_SRICMD_RXMARGIN)
299#define V_LDT_SRICMD_RXMARGIN(x) _SB_MAKEVALUE_32(x,S_LDT_SRICMD_RXMARGIN)
300#define G_LDT_SRICMD_RXMARGIN(x) _SB_GETVALUE_32(x,S_LDT_SRICMD_RXMARGIN,M_LDT_SRICMD_RXMARGIN)
301
302#define M_LDT_SRICMD_LDTPLLCOMPAT _SB_MAKEMASK1_32(25)
303
304#define S_LDT_SRICMD_TXINITIALOFFSET 28
305#define M_LDT_SRICMD_TXINITIALOFFSET _SB_MAKEMASK_32(3,S_LDT_SRICMD_TXINITIALOFFSET)
306#define V_LDT_SRICMD_TXINITIALOFFSET(x) _SB_MAKEVALUE_32(x,S_LDT_SRICMD_TXINITIALOFFSET)
307#define G_LDT_SRICMD_TXINITIALOFFSET(x) _SB_GETVALUE_32(x,S_LDT_SRICMD_TXINITIALOFFSET,M_LDT_SRICMD_TXINITIALOFFSET)
308
309#define M_LDT_SRICMD_LINKFREQDIRECT _SB_MAKEMASK1_32(31)
310
311/*
312 * LDT Error control and status register (Table 8-22) (Table 8-23)
313 */
314
315#define M_LDT_ERRCTL_PROTFATAL_EN _SB_MAKEMASK1_32(0)
316#define M_LDT_ERRCTL_PROTNONFATAL_EN _SB_MAKEMASK1_32(1)
317#define M_LDT_ERRCTL_PROTSYNCFLOOD_EN _SB_MAKEMASK1_32(2)
318#define M_LDT_ERRCTL_OVFFATAL_EN _SB_MAKEMASK1_32(3)
319#define M_LDT_ERRCTL_OVFNONFATAL_EN _SB_MAKEMASK1_32(4)
320#define M_LDT_ERRCTL_OVFSYNCFLOOD_EN _SB_MAKEMASK1_32(5)
321#define M_LDT_ERRCTL_EOCNXAFATAL_EN _SB_MAKEMASK1_32(6)
322#define M_LDT_ERRCTL_EOCNXANONFATAL_EN _SB_MAKEMASK1_32(7)
323#define M_LDT_ERRCTL_EOCNXASYNCFLOOD_EN _SB_MAKEMASK1_32(8)
324#define M_LDT_ERRCTL_CRCFATAL_EN _SB_MAKEMASK1_32(9)
325#define M_LDT_ERRCTL_CRCNONFATAL_EN _SB_MAKEMASK1_32(10)
326#define M_LDT_ERRCTL_SERRFATAL_EN _SB_MAKEMASK1_32(11)
327#define M_LDT_ERRCTL_SRCTAGFATAL_EN _SB_MAKEMASK1_32(12)
328#define M_LDT_ERRCTL_SRCTAGNONFATAL_EN _SB_MAKEMASK1_32(13)
329#define M_LDT_ERRCTL_SRCTAGSYNCFLOOD_EN _SB_MAKEMASK1_32(14)
330#define M_LDT_ERRCTL_MAPNXAFATAL_EN _SB_MAKEMASK1_32(15)
331#define M_LDT_ERRCTL_MAPNXANONFATAL_EN _SB_MAKEMASK1_32(16)
332#define M_LDT_ERRCTL_MAPNXASYNCFLOOD_EN _SB_MAKEMASK1_32(17)
333
334#define M_LDT_ERRCTL_PROTOERR _SB_MAKEMASK1_32(24)
335#define M_LDT_ERRCTL_OVFERR _SB_MAKEMASK1_32(25)
336#define M_LDT_ERRCTL_EOCNXAERR _SB_MAKEMASK1_32(26)
337#define M_LDT_ERRCTL_SRCTAGERR _SB_MAKEMASK1_32(27)
338#define M_LDT_ERRCTL_MAPNXAERR _SB_MAKEMASK1_32(28)
339
340/*
341 * SRI Control register (Table 8-24, 8-25) Offset 0x6C
342 */
343
344#define S_LDT_SRICTRL_NEEDRESP 0
345#define M_LDT_SRICTRL_NEEDRESP _SB_MAKEMASK_32(2,S_LDT_SRICTRL_NEEDRESP)
346#define V_LDT_SRICTRL_NEEDRESP(x) _SB_MAKEVALUE_32(x,S_LDT_SRICTRL_NEEDRESP)
347#define G_LDT_SRICTRL_NEEDRESP(x) _SB_GETVALUE_32(x,S_LDT_SRICTRL_NEEDRESP,M_LDT_SRICTRL_NEEDRESP)
348
349#define S_LDT_SRICTRL_NEEDNPREQ 2
350#define M_LDT_SRICTRL_NEEDNPREQ _SB_MAKEMASK_32(2,S_LDT_SRICTRL_NEEDNPREQ)
351#define V_LDT_SRICTRL_NEEDNPREQ(x) _SB_MAKEVALUE_32(x,S_LDT_SRICTRL_NEEDNPREQ)
352#define G_LDT_SRICTRL_NEEDNPREQ(x) _SB_GETVALUE_32(x,S_LDT_SRICTRL_NEEDNPREQ,M_LDT_SRICTRL_NEEDNPREQ)
353
354#define S_LDT_SRICTRL_NEEDPREQ 4
355#define M_LDT_SRICTRL_NEEDPREQ _SB_MAKEMASK_32(2,S_LDT_SRICTRL_NEEDPREQ)
356#define V_LDT_SRICTRL_NEEDPREQ(x) _SB_MAKEVALUE_32(x,S_LDT_SRICTRL_NEEDPREQ)
357#define G_LDT_SRICTRL_NEEDPREQ(x) _SB_GETVALUE_32(x,S_LDT_SRICTRL_NEEDPREQ,M_LDT_SRICTRL_NEEDPREQ)
358
359#define S_LDT_SRICTRL_WANTRESP 8
360#define M_LDT_SRICTRL_WANTRESP _SB_MAKEMASK_32(2,S_LDT_SRICTRL_WANTRESP)
361#define V_LDT_SRICTRL_WANTRESP(x) _SB_MAKEVALUE_32(x,S_LDT_SRICTRL_WANTRESP)
362#define G_LDT_SRICTRL_WANTRESP(x) _SB_GETVALUE_32(x,S_LDT_SRICTRL_WANTRESP,M_LDT_SRICTRL_WANTRESP)
363
364#define S_LDT_SRICTRL_WANTNPREQ 10
365#define M_LDT_SRICTRL_WANTNPREQ _SB_MAKEMASK_32(2,S_LDT_SRICTRL_WANTNPREQ)
366#define V_LDT_SRICTRL_WANTNPREQ(x) _SB_MAKEVALUE_32(x,S_LDT_SRICTRL_WANTNPREQ)
367#define G_LDT_SRICTRL_WANTNPREQ(x) _SB_GETVALUE_32(x,S_LDT_SRICTRL_WANTNPREQ,M_LDT_SRICTRL_WANTNPREQ)
368
369#define S_LDT_SRICTRL_WANTPREQ 12
370#define M_LDT_SRICTRL_WANTPREQ _SB_MAKEMASK_32(2,S_LDT_SRICTRL_WANTPREQ)
371#define V_LDT_SRICTRL_WANTPREQ(x) _SB_MAKEVALUE_32(x,S_LDT_SRICTRL_WANTPREQ)
372#define G_LDT_SRICTRL_WANTPREQ(x) _SB_GETVALUE_32(x,S_LDT_SRICTRL_WANTPREQ,M_LDT_SRICTRL_WANTPREQ)
373
374#define S_LDT_SRICTRL_BUFRELSPACE 16
375#define M_LDT_SRICTRL_BUFRELSPACE _SB_MAKEMASK_32(4,S_LDT_SRICTRL_BUFRELSPACE)
376#define V_LDT_SRICTRL_BUFRELSPACE(x) _SB_MAKEVALUE_32(x,S_LDT_SRICTRL_BUFRELSPACE)
377#define G_LDT_SRICTRL_BUFRELSPACE(x) _SB_GETVALUE_32(x,S_LDT_SRICTRL_BUFRELSPACE,M_LDT_SRICTRL_BUFRELSPACE)
378
379/*
380 * LDT SRI Transmit Buffer Count register (Table 8-26)
381 */
382
383#define S_LDT_TXBUFCNT_PCMD 0
384#define M_LDT_TXBUFCNT_PCMD _SB_MAKEMASK_32(4,S_LDT_TXBUFCNT_PCMD)
385#define V_LDT_TXBUFCNT_PCMD(x) _SB_MAKEVALUE_32(x,S_LDT_TXBUFCNT_PCMD)
386#define G_LDT_TXBUFCNT_PCMD(x) _SB_GETVALUE_32(x,S_LDT_TXBUFCNT_PCMD,M_LDT_TXBUFCNT_PCMD)
387
388#define S_LDT_TXBUFCNT_PDATA 4
389#define M_LDT_TXBUFCNT_PDATA _SB_MAKEMASK_32(4,S_LDT_TXBUFCNT_PDATA)
390#define V_LDT_TXBUFCNT_PDATA(x) _SB_MAKEVALUE_32(x,S_LDT_TXBUFCNT_PDATA)
391#define G_LDT_TXBUFCNT_PDATA(x) _SB_GETVALUE_32(x,S_LDT_TXBUFCNT_PDATA,M_LDT_TXBUFCNT_PDATA)
392
393#define S_LDT_TXBUFCNT_NPCMD 8
394#define M_LDT_TXBUFCNT_NPCMD _SB_MAKEMASK_32(4,S_LDT_TXBUFCNT_NPCMD)
395#define V_LDT_TXBUFCNT_NPCMD(x) _SB_MAKEVALUE_32(x,S_LDT_TXBUFCNT_NPCMD)
396#define G_LDT_TXBUFCNT_NPCMD(x) _SB_GETVALUE_32(x,S_LDT_TXBUFCNT_NPCMD,M_LDT_TXBUFCNT_NPCMD)
397
398#define S_LDT_TXBUFCNT_NPDATA 12
399#define M_LDT_TXBUFCNT_NPDATA _SB_MAKEMASK_32(4,S_LDT_TXBUFCNT_NPDATA)
400#define V_LDT_TXBUFCNT_NPDATA(x) _SB_MAKEVALUE_32(x,S_LDT_TXBUFCNT_NPDATA)
401#define G_LDT_TXBUFCNT_NPDATA(x) _SB_GETVALUE_32(x,S_LDT_TXBUFCNT_NPDATA,M_LDT_TXBUFCNT_NPDATA)
402
403#define S_LDT_TXBUFCNT_RCMD 16
404#define M_LDT_TXBUFCNT_RCMD _SB_MAKEMASK_32(4,S_LDT_TXBUFCNT_RCMD)
405#define V_LDT_TXBUFCNT_RCMD(x) _SB_MAKEVALUE_32(x,S_LDT_TXBUFCNT_RCMD)
406#define G_LDT_TXBUFCNT_RCMD(x) _SB_GETVALUE_32(x,S_LDT_TXBUFCNT_RCMD,M_LDT_TXBUFCNT_RCMD)
407
408#define S_LDT_TXBUFCNT_RDATA 20
409#define M_LDT_TXBUFCNT_RDATA _SB_MAKEMASK_32(4,S_LDT_TXBUFCNT_RDATA)
410#define V_LDT_TXBUFCNT_RDATA(x) _SB_MAKEVALUE_32(x,S_LDT_TXBUFCNT_RDATA)
411#define G_LDT_TXBUFCNT_RDATA(x) _SB_GETVALUE_32(x,S_LDT_TXBUFCNT_RDATA,M_LDT_TXBUFCNT_RDATA)
412
413#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
414/*
415 * Additional Status Register
416 */
417
418#define S_LDT_ADDSTATUS_TGTDONE 0
419#define M_LDT_ADDSTATUS_TGTDONE _SB_MAKEMASK_32(8,S_LDT_ADDSTATUS_TGTDONE)
420#define V_LDT_ADDSTATUS_TGTDONE(x) _SB_MAKEVALUE_32(x,S_LDT_ADDSTATUS_TGTDONE)
421#define G_LDT_ADDSTATUS_TGTDONE(x) _SB_GETVALUE_32(x,S_LDT_ADDSTATUS_TGTDONE,M_LDT_ADDSTATUS_TGTDONE)
422#endif /* 1250 PASS2 || 112x PASS1 */
423
424#endif
425
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h
new file mode 100644
index 000000000000..81f603f03a98
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_mac.h
@@ -0,0 +1,643 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * MAC constants and macros File: sb1250_mac.h
5 *
6 * This module contains constants and macros for the SB1250's
7 * ethernet controllers.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_MAC_H
36#define _SB1250_MAC_H
37
38#include "sb1250_defs.h"
39
40/* *********************************************************************
41 * Ethernet MAC Registers
42 ********************************************************************* */
43
44/*
45 * MAC Configuration Register (Table 9-13)
46 * Register: MAC_CFG_0
47 * Register: MAC_CFG_1
48 * Register: MAC_CFG_2
49 */
50
51
52#define M_MAC_RESERVED0 _SB_MAKEMASK1(0)
53#define M_MAC_TX_HOLD_SOP_EN _SB_MAKEMASK1(1)
54#define M_MAC_RETRY_EN _SB_MAKEMASK1(2)
55#define M_MAC_RET_DRPREQ_EN _SB_MAKEMASK1(3)
56#define M_MAC_RET_UFL_EN _SB_MAKEMASK1(4)
57#define M_MAC_BURST_EN _SB_MAKEMASK1(5)
58
59#define S_MAC_TX_PAUSE _SB_MAKE64(6)
60#define M_MAC_TX_PAUSE_CNT _SB_MAKEMASK(3,S_MAC_TX_PAUSE)
61#define V_MAC_TX_PAUSE_CNT(x) _SB_MAKEVALUE(x,S_MAC_TX_PAUSE)
62
63#define K_MAC_TX_PAUSE_CNT_512 0
64#define K_MAC_TX_PAUSE_CNT_1K 1
65#define K_MAC_TX_PAUSE_CNT_2K 2
66#define K_MAC_TX_PAUSE_CNT_4K 3
67#define K_MAC_TX_PAUSE_CNT_8K 4
68#define K_MAC_TX_PAUSE_CNT_16K 5
69#define K_MAC_TX_PAUSE_CNT_32K 6
70#define K_MAC_TX_PAUSE_CNT_64K 7
71
72#define V_MAC_TX_PAUSE_CNT_512 V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_512)
73#define V_MAC_TX_PAUSE_CNT_1K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_1K)
74#define V_MAC_TX_PAUSE_CNT_2K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_2K)
75#define V_MAC_TX_PAUSE_CNT_4K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_4K)
76#define V_MAC_TX_PAUSE_CNT_8K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_8K)
77#define V_MAC_TX_PAUSE_CNT_16K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_16K)
78#define V_MAC_TX_PAUSE_CNT_32K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_32K)
79#define V_MAC_TX_PAUSE_CNT_64K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_64K)
80
81#define M_MAC_RESERVED1 _SB_MAKEMASK(8,9)
82
83#define M_MAC_AP_STAT_EN _SB_MAKEMASK1(17)
84#define M_MAC_RESERVED2 _SB_MAKEMASK1(18)
85#define M_MAC_DRP_ERRPKT_EN _SB_MAKEMASK1(19)
86#define M_MAC_DRP_FCSERRPKT_EN _SB_MAKEMASK1(20)
87#define M_MAC_DRP_CODEERRPKT_EN _SB_MAKEMASK1(21)
88#define M_MAC_DRP_DRBLERRPKT_EN _SB_MAKEMASK1(22)
89#define M_MAC_DRP_RNTPKT_EN _SB_MAKEMASK1(23)
90#define M_MAC_DRP_OSZPKT_EN _SB_MAKEMASK1(24)
91#define M_MAC_DRP_LENERRPKT_EN _SB_MAKEMASK1(25)
92
93#define M_MAC_RESERVED3 _SB_MAKEMASK(6,26)
94
95#define M_MAC_BYPASS_SEL _SB_MAKEMASK1(32)
96#define M_MAC_HDX_EN _SB_MAKEMASK1(33)
97
98#define S_MAC_SPEED_SEL _SB_MAKE64(34)
99#define M_MAC_SPEED_SEL _SB_MAKEMASK(2,S_MAC_SPEED_SEL)
100#define V_MAC_SPEED_SEL(x) _SB_MAKEVALUE(x,S_MAC_SPEED_SEL)
101#define G_MAC_SPEED_SEL(x) _SB_GETVALUE(x,S_MAC_SPEED_SEL,M_MAC_SPEED_SEL)
102
103#define K_MAC_SPEED_SEL_10MBPS 0
104#define K_MAC_SPEED_SEL_100MBPS 1
105#define K_MAC_SPEED_SEL_1000MBPS 2
106#define K_MAC_SPEED_SEL_RESERVED 3
107
108#define V_MAC_SPEED_SEL_10MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_10MBPS)
109#define V_MAC_SPEED_SEL_100MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_100MBPS)
110#define V_MAC_SPEED_SEL_1000MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_1000MBPS)
111#define V_MAC_SPEED_SEL_RESERVED V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_RESERVED)
112
113#define M_MAC_TX_CLK_EDGE_SEL _SB_MAKEMASK1(36)
114#define M_MAC_LOOPBACK_SEL _SB_MAKEMASK1(37)
115#define M_MAC_FAST_SYNC _SB_MAKEMASK1(38)
116#define M_MAC_SS_EN _SB_MAKEMASK1(39)
117
118#define S_MAC_BYPASS_CFG _SB_MAKE64(40)
119#define M_MAC_BYPASS_CFG _SB_MAKEMASK(2,S_MAC_BYPASS_CFG)
120#define V_MAC_BYPASS_CFG(x) _SB_MAKEVALUE(x,S_MAC_BYPASS_CFG)
121#define G_MAC_BYPASS_CFG(x) _SB_GETVALUE(x,S_MAC_BYPASS_CFG,M_MAC_BYPASS_CFG)
122
123#define K_MAC_BYPASS_GMII 0
124#define K_MAC_BYPASS_ENCODED 1
125#define K_MAC_BYPASS_SOP 2
126#define K_MAC_BYPASS_EOP 3
127
128#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42)
129#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43)
130
131#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
132#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44)
133#endif /* 1250 PASS2 || 112x PASS1 */
134
135#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
136#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45)
137#endif /* 1250 PASS3 || 112x PASS1 */
138
139#define S_MAC_BYPASS_IFG _SB_MAKE64(46)
140#define M_MAC_BYPASS_IFG _SB_MAKEMASK(8,S_MAC_BYPASS_IFG)
141#define V_MAC_BYPASS_IFG(x) _SB_MAKEVALUE(x,S_MAC_BYPASS_IFG)
142#define G_MAC_BYPASS_IFG(x) _SB_GETVALUE(x,S_MAC_BYPASS_IFG,M_MAC_BYPASS_IFG)
143
144#define K_MAC_FC_CMD_DISABLED 0
145#define K_MAC_FC_CMD_ENABLED 1
146#define K_MAC_FC_CMD_ENAB_FALSECARR 2
147
148#define V_MAC_FC_CMD_DISABLED V_MAC_FC_CMD(K_MAC_FC_CMD_DISABLED)
149#define V_MAC_FC_CMD_ENABLED V_MAC_FC_CMD(K_MAC_FC_CMD_ENABLED)
150#define V_MAC_FC_CMD_ENAB_FALSECARR V_MAC_FC_CMD(K_MAC_FC_CMD_ENAB_FALSECARR)
151
152#define M_MAC_FC_SEL _SB_MAKEMASK1(54)
153
154#define S_MAC_FC_CMD _SB_MAKE64(55)
155#define M_MAC_FC_CMD _SB_MAKEMASK(2,S_MAC_FC_CMD)
156#define V_MAC_FC_CMD(x) _SB_MAKEVALUE(x,S_MAC_FC_CMD)
157#define G_MAC_FC_CMD(x) _SB_GETVALUE(x,S_MAC_FC_CMD,M_MAC_FC_CMD)
158
159#define S_MAC_RX_CH_SEL _SB_MAKE64(57)
160#define M_MAC_RX_CH_SEL _SB_MAKEMASK(7,S_MAC_RX_CH_SEL)
161#define V_MAC_RX_CH_SEL(x) _SB_MAKEVALUE(x,S_MAC_RX_CH_SEL)
162#define G_MAC_RX_CH_SEL(x) _SB_GETVALUE(x,S_MAC_RX_CH_SEL,M_MAC_RX_CH_SEL)
163
164
165/*
166 * MAC Enable Registers
167 * Register: MAC_ENABLE_0
168 * Register: MAC_ENABLE_1
169 * Register: MAC_ENABLE_2
170 */
171
172#define M_MAC_RXDMA_EN0 _SB_MAKEMASK1(0)
173#define M_MAC_RXDMA_EN1 _SB_MAKEMASK1(1)
174#define M_MAC_TXDMA_EN0 _SB_MAKEMASK1(4)
175#define M_MAC_TXDMA_EN1 _SB_MAKEMASK1(5)
176
177#define M_MAC_PORT_RESET _SB_MAKEMASK1(8)
178
179#define M_MAC_RX_ENABLE _SB_MAKEMASK1(10)
180#define M_MAC_TX_ENABLE _SB_MAKEMASK1(11)
181#define M_MAC_BYP_RX_ENABLE _SB_MAKEMASK1(12)
182#define M_MAC_BYP_TX_ENABLE _SB_MAKEMASK1(13)
183
184/*
185 * MAC DMA Control Register
186 * Register: MAC_TXD_CTL_0
187 * Register: MAC_TXD_CTL_1
188 * Register: MAC_TXD_CTL_2
189 */
190
191#define S_MAC_TXD_WEIGHT0 _SB_MAKE64(0)
192#define M_MAC_TXD_WEIGHT0 _SB_MAKEMASK(4,S_MAC_TXD_WEIGHT0)
193#define V_MAC_TXD_WEIGHT0(x) _SB_MAKEVALUE(x,S_MAC_TXD_WEIGHT0)
194#define G_MAC_TXD_WEIGHT0(x) _SB_GETVALUE(x,S_MAC_TXD_WEIGHT0,M_MAC_TXD_WEIGHT0)
195
196#define S_MAC_TXD_WEIGHT1 _SB_MAKE64(4)
197#define M_MAC_TXD_WEIGHT1 _SB_MAKEMASK(4,S_MAC_TXD_WEIGHT1)
198#define V_MAC_TXD_WEIGHT1(x) _SB_MAKEVALUE(x,S_MAC_TXD_WEIGHT1)
199#define G_MAC_TXD_WEIGHT1(x) _SB_GETVALUE(x,S_MAC_TXD_WEIGHT1,M_MAC_TXD_WEIGHT1)
200
201/*
202 * MAC Fifo Threshhold registers (Table 9-14)
203 * Register: MAC_THRSH_CFG_0
204 * Register: MAC_THRSH_CFG_1
205 * Register: MAC_THRSH_CFG_2
206 */
207
208#define S_MAC_TX_WR_THRSH _SB_MAKE64(0)
209#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
210/* XXX: Can't enable, as it has the same name as a pass2+ define below. */
211/* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */
212#endif /* up to 1250 PASS1 */
213#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
214#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH)
215#endif /* 1250 PASS2 || 112x PASS1 */
216#define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH)
217#define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH)
218
219#define S_MAC_TX_RD_THRSH _SB_MAKE64(8)
220#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
221/* XXX: Can't enable, as it has the same name as a pass2+ define below. */
222/* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */
223#endif /* up to 1250 PASS1 */
224#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
225#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH)
226#endif /* 1250 PASS2 || 112x PASS1 */
227#define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH)
228#define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH)
229
230#define S_MAC_TX_RL_THRSH _SB_MAKE64(16)
231#define M_MAC_TX_RL_THRSH _SB_MAKEMASK(4,S_MAC_TX_RL_THRSH)
232#define V_MAC_TX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RL_THRSH)
233#define G_MAC_TX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RL_THRSH,M_MAC_TX_RL_THRSH)
234
235#define S_MAC_RX_PL_THRSH _SB_MAKE64(24)
236#define M_MAC_RX_PL_THRSH _SB_MAKEMASK(6,S_MAC_RX_PL_THRSH)
237#define V_MAC_RX_PL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_PL_THRSH)
238#define G_MAC_RX_PL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_PL_THRSH,M_MAC_RX_PL_THRSH)
239
240#define S_MAC_RX_RD_THRSH _SB_MAKE64(32)
241#define M_MAC_RX_RD_THRSH _SB_MAKEMASK(6,S_MAC_RX_RD_THRSH)
242#define V_MAC_RX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RD_THRSH)
243#define G_MAC_RX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RD_THRSH,M_MAC_RX_RD_THRSH)
244
245#define S_MAC_RX_RL_THRSH _SB_MAKE64(40)
246#define M_MAC_RX_RL_THRSH _SB_MAKEMASK(6,S_MAC_RX_RL_THRSH)
247#define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH)
248#define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH)
249
250#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
251#define S_MAC_ENC_FC_THRSH _SB_MAKE64(56)
252#define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH)
253#define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH)
254#define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH)
255#endif /* 1250 PASS2 || 112x PASS1 */
256
257/*
258 * MAC Frame Configuration Registers (Table 9-15)
259 * Register: MAC_FRAME_CFG_0
260 * Register: MAC_FRAME_CFG_1
261 * Register: MAC_FRAME_CFG_2
262 */
263
264/* XXXCGD: ??? Unused in pass2? */
265#define S_MAC_IFG_RX _SB_MAKE64(0)
266#define M_MAC_IFG_RX _SB_MAKEMASK(6,S_MAC_IFG_RX)
267#define V_MAC_IFG_RX(x) _SB_MAKEVALUE(x,S_MAC_IFG_RX)
268#define G_MAC_IFG_RX(x) _SB_GETVALUE(x,S_MAC_IFG_RX,M_MAC_IFG_RX)
269
270#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
271#define S_MAC_PRE_LEN _SB_MAKE64(0)
272#define M_MAC_PRE_LEN _SB_MAKEMASK(6,S_MAC_PRE_LEN)
273#define V_MAC_PRE_LEN(x) _SB_MAKEVALUE(x,S_MAC_PRE_LEN)
274#define G_MAC_PRE_LEN(x) _SB_GETVALUE(x,S_MAC_PRE_LEN,M_MAC_PRE_LEN)
275#endif /* 1250 PASS3 || 112x PASS1 */
276
277#define S_MAC_IFG_TX _SB_MAKE64(6)
278#define M_MAC_IFG_TX _SB_MAKEMASK(6,S_MAC_IFG_TX)
279#define V_MAC_IFG_TX(x) _SB_MAKEVALUE(x,S_MAC_IFG_TX)
280#define G_MAC_IFG_TX(x) _SB_GETVALUE(x,S_MAC_IFG_TX,M_MAC_IFG_TX)
281
282#define S_MAC_IFG_THRSH _SB_MAKE64(12)
283#define M_MAC_IFG_THRSH _SB_MAKEMASK(6,S_MAC_IFG_THRSH)
284#define V_MAC_IFG_THRSH(x) _SB_MAKEVALUE(x,S_MAC_IFG_THRSH)
285#define G_MAC_IFG_THRSH(x) _SB_GETVALUE(x,S_MAC_IFG_THRSH,M_MAC_IFG_THRSH)
286
287#define S_MAC_BACKOFF_SEL _SB_MAKE64(18)
288#define M_MAC_BACKOFF_SEL _SB_MAKEMASK(4,S_MAC_BACKOFF_SEL)
289#define V_MAC_BACKOFF_SEL(x) _SB_MAKEVALUE(x,S_MAC_BACKOFF_SEL)
290#define G_MAC_BACKOFF_SEL(x) _SB_GETVALUE(x,S_MAC_BACKOFF_SEL,M_MAC_BACKOFF_SEL)
291
292#define S_MAC_LFSR_SEED _SB_MAKE64(22)
293#define M_MAC_LFSR_SEED _SB_MAKEMASK(8,S_MAC_LFSR_SEED)
294#define V_MAC_LFSR_SEED(x) _SB_MAKEVALUE(x,S_MAC_LFSR_SEED)
295#define G_MAC_LFSR_SEED(x) _SB_GETVALUE(x,S_MAC_LFSR_SEED,M_MAC_LFSR_SEED)
296
297#define S_MAC_SLOT_SIZE _SB_MAKE64(30)
298#define M_MAC_SLOT_SIZE _SB_MAKEMASK(10,S_MAC_SLOT_SIZE)
299#define V_MAC_SLOT_SIZE(x) _SB_MAKEVALUE(x,S_MAC_SLOT_SIZE)
300#define G_MAC_SLOT_SIZE(x) _SB_GETVALUE(x,S_MAC_SLOT_SIZE,M_MAC_SLOT_SIZE)
301
302#define S_MAC_MIN_FRAMESZ _SB_MAKE64(40)
303#define M_MAC_MIN_FRAMESZ _SB_MAKEMASK(8,S_MAC_MIN_FRAMESZ)
304#define V_MAC_MIN_FRAMESZ(x) _SB_MAKEVALUE(x,S_MAC_MIN_FRAMESZ)
305#define G_MAC_MIN_FRAMESZ(x) _SB_GETVALUE(x,S_MAC_MIN_FRAMESZ,M_MAC_MIN_FRAMESZ)
306
307#define S_MAC_MAX_FRAMESZ _SB_MAKE64(48)
308#define M_MAC_MAX_FRAMESZ _SB_MAKEMASK(16,S_MAC_MAX_FRAMESZ)
309#define V_MAC_MAX_FRAMESZ(x) _SB_MAKEVALUE(x,S_MAC_MAX_FRAMESZ)
310#define G_MAC_MAX_FRAMESZ(x) _SB_GETVALUE(x,S_MAC_MAX_FRAMESZ,M_MAC_MAX_FRAMESZ)
311
312/*
313 * These constants are used to configure the fields within the Frame
314 * Configuration Register.
315 */
316
317#define K_MAC_IFG_RX_10 _SB_MAKE64(0) /* See table 176, not used */
318#define K_MAC_IFG_RX_100 _SB_MAKE64(0)
319#define K_MAC_IFG_RX_1000 _SB_MAKE64(0)
320
321#define K_MAC_IFG_TX_10 _SB_MAKE64(20)
322#define K_MAC_IFG_TX_100 _SB_MAKE64(20)
323#define K_MAC_IFG_TX_1000 _SB_MAKE64(8)
324
325#define K_MAC_IFG_THRSH_10 _SB_MAKE64(4)
326#define K_MAC_IFG_THRSH_100 _SB_MAKE64(4)
327#define K_MAC_IFG_THRSH_1000 _SB_MAKE64(0)
328
329#define K_MAC_SLOT_SIZE_10 _SB_MAKE64(0)
330#define K_MAC_SLOT_SIZE_100 _SB_MAKE64(0)
331#define K_MAC_SLOT_SIZE_1000 _SB_MAKE64(0)
332
333#define V_MAC_IFG_RX_10 V_MAC_IFG_RX(K_MAC_IFG_RX_10)
334#define V_MAC_IFG_RX_100 V_MAC_IFG_RX(K_MAC_IFG_RX_100)
335#define V_MAC_IFG_RX_1000 V_MAC_IFG_RX(K_MAC_IFG_RX_1000)
336
337#define V_MAC_IFG_TX_10 V_MAC_IFG_TX(K_MAC_IFG_TX_10)
338#define V_MAC_IFG_TX_100 V_MAC_IFG_TX(K_MAC_IFG_TX_100)
339#define V_MAC_IFG_TX_1000 V_MAC_IFG_TX(K_MAC_IFG_TX_1000)
340
341#define V_MAC_IFG_THRSH_10 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_10)
342#define V_MAC_IFG_THRSH_100 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_100)
343#define V_MAC_IFG_THRSH_1000 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_1000)
344
345#define V_MAC_SLOT_SIZE_10 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_10)
346#define V_MAC_SLOT_SIZE_100 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_100)
347#define V_MAC_SLOT_SIZE_1000 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_1000)
348
349#define K_MAC_MIN_FRAMESZ_FIFO _SB_MAKE64(9)
350#define K_MAC_MIN_FRAMESZ_DEFAULT _SB_MAKE64(64)
351#define K_MAC_MAX_FRAMESZ_DEFAULT _SB_MAKE64(1518)
352#define K_MAC_MAX_FRAMESZ_JUMBO _SB_MAKE64(9216)
353
354#define V_MAC_MIN_FRAMESZ_FIFO V_MAC_MIN_FRAMESZ(K_MAC_MIN_FRAMESZ_FIFO)
355#define V_MAC_MIN_FRAMESZ_DEFAULT V_MAC_MIN_FRAMESZ(K_MAC_MIN_FRAMESZ_DEFAULT)
356#define V_MAC_MAX_FRAMESZ_DEFAULT V_MAC_MAX_FRAMESZ(K_MAC_MAX_FRAMESZ_DEFAULT)
357#define V_MAC_MAX_FRAMESZ_JUMBO V_MAC_MAX_FRAMESZ(K_MAC_MAX_FRAMESZ_JUMBO)
358
359/*
360 * MAC VLAN Tag Registers (Table 9-16)
361 * Register: MAC_VLANTAG_0
362 * Register: MAC_VLANTAG_1
363 * Register: MAC_VLANTAG_2
364 */
365
366#define S_MAC_VLAN_TAG _SB_MAKE64(0)
367#define M_MAC_VLAN_TAG _SB_MAKEMASK(32,S_MAC_VLAN_TAG)
368#define V_MAC_VLAN_TAG(x) _SB_MAKEVALUE(x,S_MAC_VLAN_TAG)
369#define G_MAC_VLAN_TAG(x) _SB_GETVALUE(x,S_MAC_VLAN_TAG,M_MAC_VLAN_TAG)
370
371#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
372#define S_MAC_TX_PKT_OFFSET _SB_MAKE64(32)
373#define M_MAC_TX_PKT_OFFSET _SB_MAKEMASK(8,S_MAC_TX_PKT_OFFSET)
374#define V_MAC_TX_PKT_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_TX_PKT_OFFSET)
375#define G_MAC_TX_PKT_OFFSET(x) _SB_GETVALUE(x,S_MAC_TX_PKT_OFFSET,M_MAC_TX_PKT_OFFSET)
376
377#define S_MAC_TX_CRC_OFFSET _SB_MAKE64(40)
378#define M_MAC_TX_CRC_OFFSET _SB_MAKEMASK(8,S_MAC_TX_CRC_OFFSET)
379#define V_MAC_TX_CRC_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_TX_CRC_OFFSET)
380#define G_MAC_TX_CRC_OFFSET(x) _SB_GETVALUE(x,S_MAC_TX_CRC_OFFSET,M_MAC_TX_CRC_OFFSET)
381
382#define M_MAC_CH_BASE_FC_EN _SB_MAKEMASK1(48)
383#endif /* 1250 PASS3 || 112x PASS1 */
384
385/*
386 * MAC Status Registers (Table 9-17)
387 * Also used for the MAC Interrupt Mask Register (Table 9-18)
388 * Register: MAC_STATUS_0
389 * Register: MAC_STATUS_1
390 * Register: MAC_STATUS_2
391 * Register: MAC_INT_MASK_0
392 * Register: MAC_INT_MASK_1
393 * Register: MAC_INT_MASK_2
394 */
395
396/*
397 * Use these constants to shift the appropriate channel
398 * into the CH0 position so the same tests can be used
399 * on each channel.
400 */
401
402#define S_MAC_RX_CH0 _SB_MAKE64(0)
403#define S_MAC_RX_CH1 _SB_MAKE64(8)
404#define S_MAC_TX_CH0 _SB_MAKE64(16)
405#define S_MAC_TX_CH1 _SB_MAKE64(24)
406
407#define S_MAC_TXCHANNELS _SB_MAKE64(16) /* this is 1st TX chan */
408#define S_MAC_CHANWIDTH _SB_MAKE64(8) /* bits between channels */
409
410/*
411 * These are the same as RX channel 0. The idea here
412 * is that you'll use one of the "S_" things above
413 * and pass just the six bits to a DMA-channel-specific ISR
414 */
415#define M_MAC_INT_CHANNEL _SB_MAKEMASK(8,0)
416#define M_MAC_INT_EOP_COUNT _SB_MAKEMASK1(0)
417#define M_MAC_INT_EOP_TIMER _SB_MAKEMASK1(1)
418#define M_MAC_INT_EOP_SEEN _SB_MAKEMASK1(2)
419#define M_MAC_INT_HWM _SB_MAKEMASK1(3)
420#define M_MAC_INT_LWM _SB_MAKEMASK1(4)
421#define M_MAC_INT_DSCR _SB_MAKEMASK1(5)
422#define M_MAC_INT_ERR _SB_MAKEMASK1(6)
423#define M_MAC_INT_DZERO _SB_MAKEMASK1(7) /* only for TX channels */
424#define M_MAC_INT_DROP _SB_MAKEMASK1(7) /* only for RX channels */
425
426/*
427 * In the following definitions we use ch (0/1) and txrx (TX=1, RX=0, see
428 * also DMA_TX/DMA_RX in sb_regs.h).
429 */
430#define S_MAC_STATUS_CH_OFFSET(ch,txrx) _SB_MAKE64(((ch) + 2 * (txrx)) * S_MAC_CHANWIDTH)
431
432#define M_MAC_STATUS_CHANNEL(ch,txrx) _SB_MAKEVALUE(_SB_MAKEMASK(8,0),S_MAC_STATUS_CH_OFFSET(ch,txrx))
433#define M_MAC_STATUS_EOP_COUNT(ch,txrx) _SB_MAKEVALUE(M_MAC_INT_EOP_COUNT,S_MAC_STATUS_CH_OFFSET(ch,txrx))
434#define M_MAC_STATUS_EOP_TIMER(ch,txrx) _SB_MAKEVALUE(M_MAC_INT_EOP_TIMER,S_MAC_STATUS_CH_OFFSET(ch,txrx))
435#define M_MAC_STATUS_EOP_SEEN(ch,txrx) _SB_MAKEVALUE(M_MAC_INT_EOP_SEEN,S_MAC_STATUS_CH_OFFSET(ch,txrx))
436#define M_MAC_STATUS_HWM(ch,txrx) _SB_MAKEVALUE(M_MAC_INT_HWM,S_MAC_STATUS_CH_OFFSET(ch,txrx))
437#define M_MAC_STATUS_LWM(ch,txrx) _SB_MAKEVALUE(M_MAC_INT_LWM,S_MAC_STATUS_CH_OFFSET(ch,txrx))
438#define M_MAC_STATUS_DSCR(ch,txrx) _SB_MAKEVALUE(M_MAC_INT_DSCR,S_MAC_STATUS_CH_OFFSET(ch,txrx))
439#define M_MAC_STATUS_ERR(ch,txrx) _SB_MAKEVALUE(M_MAC_INT_ERR,S_MAC_STATUS_CH_OFFSET(ch,txrx))
440#define M_MAC_STATUS_DZERO(ch,txrx) _SB_MAKEVALUE(M_MAC_INT_DZERO,S_MAC_STATUS_CH_OFFSET(ch,txrx))
441#define M_MAC_STATUS_DROP(ch,txrx) _SB_MAKEVALUE(M_MAC_INT_DROP,S_MAC_STATUS_CH_OFFSET(ch,txrx))
442#define M_MAC_STATUS_OTHER_ERR _SB_MAKEVALUE(_SB_MAKEMASK(7,0),40)
443
444
445#define M_MAC_RX_UNDRFL _SB_MAKEMASK1(40)
446#define M_MAC_RX_OVRFL _SB_MAKEMASK1(41)
447#define M_MAC_TX_UNDRFL _SB_MAKEMASK1(42)
448#define M_MAC_TX_OVRFL _SB_MAKEMASK1(43)
449#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44)
450#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45)
451#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46)
452#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
453#define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */
454#endif /* 1250 PASS2 || 112x PASS1 */
455
456#define S_MAC_COUNTER_ADDR _SB_MAKE64(47)
457#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR)
458#define V_MAC_COUNTER_ADDR(x) _SB_MAKEVALUE(x,S_MAC_COUNTER_ADDR)
459#define G_MAC_COUNTER_ADDR(x) _SB_GETVALUE(x,S_MAC_COUNTER_ADDR,M_MAC_COUNTER_ADDR)
460
461#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
462#define M_MAC_TX_PAUSE_ON _SB_MAKEMASK1(52)
463#endif /* 1250 PASS3 || 112x PASS1 */
464
465/*
466 * MAC Fifo Pointer Registers (Table 9-19) [Debug register]
467 * Register: MAC_FIFO_PTRS_0
468 * Register: MAC_FIFO_PTRS_1
469 * Register: MAC_FIFO_PTRS_2
470 */
471
472#define S_MAC_TX_WRPTR _SB_MAKE64(0)
473#define M_MAC_TX_WRPTR _SB_MAKEMASK(6,S_MAC_TX_WRPTR)
474#define V_MAC_TX_WRPTR(x) _SB_MAKEVALUE(x,S_MAC_TX_WRPTR)
475#define G_MAC_TX_WRPTR(x) _SB_GETVALUE(x,S_MAC_TX_WRPTR,M_MAC_TX_WRPTR)
476
477#define S_MAC_TX_RDPTR _SB_MAKE64(8)
478#define M_MAC_TX_RDPTR _SB_MAKEMASK(6,S_MAC_TX_RDPTR)
479#define V_MAC_TX_RDPTR(x) _SB_MAKEVALUE(x,S_MAC_TX_RDPTR)
480#define G_MAC_TX_RDPTR(x) _SB_GETVALUE(x,S_MAC_TX_RDPTR,M_MAC_TX_RDPTR)
481
482#define S_MAC_RX_WRPTR _SB_MAKE64(16)
483#define M_MAC_RX_WRPTR _SB_MAKEMASK(6,S_MAC_RX_WRPTR)
484#define V_MAC_RX_WRPTR(x) _SB_MAKEVALUE(x,S_MAC_RX_WRPTR)
485#define G_MAC_RX_WRPTR(x) _SB_GETVALUE(x,S_MAC_RX_WRPTR,M_MAC_TX_WRPTR)
486
487#define S_MAC_RX_RDPTR _SB_MAKE64(24)
488#define M_MAC_RX_RDPTR _SB_MAKEMASK(6,S_MAC_RX_RDPTR)
489#define V_MAC_RX_RDPTR(x) _SB_MAKEVALUE(x,S_MAC_RX_RDPTR)
490#define G_MAC_RX_RDPTR(x) _SB_GETVALUE(x,S_MAC_RX_RDPTR,M_MAC_TX_RDPTR)
491
492/*
493 * MAC Fifo End Of Packet Count Registers (Table 9-20) [Debug register]
494 * Register: MAC_EOPCNT_0
495 * Register: MAC_EOPCNT_1
496 * Register: MAC_EOPCNT_2
497 */
498
499#define S_MAC_TX_EOP_COUNTER _SB_MAKE64(0)
500#define M_MAC_TX_EOP_COUNTER _SB_MAKEMASK(6,S_MAC_TX_EOP_COUNTER)
501#define V_MAC_TX_EOP_COUNTER(x) _SB_MAKEVALUE(x,S_MAC_TX_EOP_COUNTER)
502#define G_MAC_TX_EOP_COUNTER(x) _SB_GETVALUE(x,S_MAC_TX_EOP_COUNTER,M_MAC_TX_EOP_COUNTER)
503
504#define S_MAC_RX_EOP_COUNTER _SB_MAKE64(8)
505#define M_MAC_RX_EOP_COUNTER _SB_MAKEMASK(6,S_MAC_RX_EOP_COUNTER)
506#define V_MAC_RX_EOP_COUNTER(x) _SB_MAKEVALUE(x,S_MAC_RX_EOP_COUNTER)
507#define G_MAC_RX_EOP_COUNTER(x) _SB_GETVALUE(x,S_MAC_RX_EOP_COUNTER,M_MAC_RX_EOP_COUNTER)
508
509/*
510 * MAC Recieve Address Filter Exact Match Registers (Table 9-21)
511 * Registers: MAC_ADDR0_0 through MAC_ADDR7_0
512 * Registers: MAC_ADDR0_1 through MAC_ADDR7_1
513 * Registers: MAC_ADDR0_2 through MAC_ADDR7_2
514 */
515
516/* No bitfields */
517
518/*
519 * MAC Receive Address Filter Mask Registers
520 * Registers: MAC_ADDRMASK0_0 and MAC_ADDRMASK0_1
521 * Registers: MAC_ADDRMASK1_0 and MAC_ADDRMASK1_1
522 * Registers: MAC_ADDRMASK2_0 and MAC_ADDRMASK2_1
523 */
524
525/* No bitfields */
526
527/*
528 * MAC Recieve Address Filter Hash Match Registers (Table 9-22)
529 * Registers: MAC_HASH0_0 through MAC_HASH7_0
530 * Registers: MAC_HASH0_1 through MAC_HASH7_1
531 * Registers: MAC_HASH0_2 through MAC_HASH7_2
532 */
533
534/* No bitfields */
535
536/*
537 * MAC Transmit Source Address Registers (Table 9-23)
538 * Register: MAC_ETHERNET_ADDR_0
539 * Register: MAC_ETHERNET_ADDR_1
540 * Register: MAC_ETHERNET_ADDR_2
541 */
542
543/* No bitfields */
544
545/*
546 * MAC Packet Type Configuration Register
547 * Register: MAC_TYPE_CFG_0
548 * Register: MAC_TYPE_CFG_1
549 * Register: MAC_TYPE_CFG_2
550 */
551
552#define S_TYPECFG_TYPESIZE _SB_MAKE64(16)
553
554#define S_TYPECFG_TYPE0 _SB_MAKE64(0)
555#define M_TYPECFG_TYPE0 _SB_MAKEMASK(16,S_TYPECFG_TYPE0)
556#define V_TYPECFG_TYPE0(x) _SB_MAKEVALUE(x,S_TYPECFG_TYPE0)
557#define G_TYPECFG_TYPE0(x) _SB_GETVALUE(x,S_TYPECFG_TYPE0,M_TYPECFG_TYPE0)
558
559#define S_TYPECFG_TYPE1 _SB_MAKE64(0)
560#define M_TYPECFG_TYPE1 _SB_MAKEMASK(16,S_TYPECFG_TYPE1)
561#define V_TYPECFG_TYPE1(x) _SB_MAKEVALUE(x,S_TYPECFG_TYPE1)
562#define G_TYPECFG_TYPE1(x) _SB_GETVALUE(x,S_TYPECFG_TYPE1,M_TYPECFG_TYPE1)
563
564#define S_TYPECFG_TYPE2 _SB_MAKE64(0)
565#define M_TYPECFG_TYPE2 _SB_MAKEMASK(16,S_TYPECFG_TYPE2)
566#define V_TYPECFG_TYPE2(x) _SB_MAKEVALUE(x,S_TYPECFG_TYPE2)
567#define G_TYPECFG_TYPE2(x) _SB_GETVALUE(x,S_TYPECFG_TYPE2,M_TYPECFG_TYPE2)
568
569#define S_TYPECFG_TYPE3 _SB_MAKE64(0)
570#define M_TYPECFG_TYPE3 _SB_MAKEMASK(16,S_TYPECFG_TYPE3)
571#define V_TYPECFG_TYPE3(x) _SB_MAKEVALUE(x,S_TYPECFG_TYPE3)
572#define G_TYPECFG_TYPE3(x) _SB_GETVALUE(x,S_TYPECFG_TYPE3,M_TYPECFG_TYPE3)
573
574/*
575 * MAC Receive Address Filter Control Registers (Table 9-24)
576 * Register: MAC_ADFILTER_CFG_0
577 * Register: MAC_ADFILTER_CFG_1
578 * Register: MAC_ADFILTER_CFG_2
579 */
580
581#define M_MAC_ALLPKT_EN _SB_MAKEMASK1(0)
582#define M_MAC_UCAST_EN _SB_MAKEMASK1(1)
583#define M_MAC_UCAST_INV _SB_MAKEMASK1(2)
584#define M_MAC_MCAST_EN _SB_MAKEMASK1(3)
585#define M_MAC_MCAST_INV _SB_MAKEMASK1(4)
586#define M_MAC_BCAST_EN _SB_MAKEMASK1(5)
587#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6)
588#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
589#define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7)
590#endif /* 1250 PASS2 || 112x PASS1 */
591
592#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8)
593#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET)
594#define V_MAC_IPHDR_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_IPHDR_OFFSET)
595#define G_MAC_IPHDR_OFFSET(x) _SB_GETVALUE(x,S_MAC_IPHDR_OFFSET,M_MAC_IPHDR_OFFSET)
596
597#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
598#define S_MAC_RX_CRC_OFFSET _SB_MAKE64(16)
599#define M_MAC_RX_CRC_OFFSET _SB_MAKEMASK(8,S_MAC_RX_CRC_OFFSET)
600#define V_MAC_RX_CRC_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_RX_CRC_OFFSET)
601#define G_MAC_RX_CRC_OFFSET(x) _SB_GETVALUE(x,S_MAC_RX_CRC_OFFSET,M_MAC_RX_CRC_OFFSET)
602
603#define S_MAC_RX_PKT_OFFSET _SB_MAKE64(24)
604#define M_MAC_RX_PKT_OFFSET _SB_MAKEMASK(8,S_MAC_RX_PKT_OFFSET)
605#define V_MAC_RX_PKT_OFFSET(x) _SB_MAKEVALUE(x,S_MAC_RX_PKT_OFFSET)
606#define G_MAC_RX_PKT_OFFSET(x) _SB_GETVALUE(x,S_MAC_RX_PKT_OFFSET,M_MAC_RX_PKT_OFFSET)
607
608#define M_MAC_FWDPAUSE_EN _SB_MAKEMASK1(32)
609#define M_MAC_VLAN_DET_EN _SB_MAKEMASK1(33)
610
611#define S_MAC_RX_CH_MSN_SEL _SB_MAKE64(34)
612#define M_MAC_RX_CH_MSN_SEL _SB_MAKEMASK(8,S_MAC_RX_CH_MSN_SEL)
613#define V_MAC_RX_CH_MSN_SEL(x) _SB_MAKEVALUE(x,S_MAC_RX_CH_MSN_SEL)
614#define G_MAC_RX_CH_MSN_SEL(x) _SB_GETVALUE(x,S_MAC_RX_CH_MSN_SEL,M_MAC_RX_CH_MSN_SEL)
615#endif /* 1250 PASS3 || 112x PASS1 */
616
617/*
618 * MAC Receive Channel Select Registers (Table 9-25)
619 */
620
621/* no bitfields */
622
623/*
624 * MAC MII Management Interface Registers (Table 9-26)
625 * Register: MAC_MDIO_0
626 * Register: MAC_MDIO_1
627 * Register: MAC_MDIO_2
628 */
629
630#define S_MAC_MDC 0
631#define S_MAC_MDIO_DIR 1
632#define S_MAC_MDIO_OUT 2
633#define S_MAC_GENC 3
634#define S_MAC_MDIO_IN 4
635
636#define M_MAC_MDC _SB_MAKEMASK1(S_MAC_MDC)
637#define M_MAC_MDIO_DIR _SB_MAKEMASK1(S_MAC_MDIO_DIR)
638#define M_MAC_MDIO_DIR_INPUT _SB_MAKEMASK1(S_MAC_MDIO_DIR)
639#define M_MAC_MDIO_OUT _SB_MAKEMASK1(S_MAC_MDIO_OUT)
640#define M_MAC_GENC _SB_MAKEMASK1(S_MAC_GENC)
641#define M_MAC_MDIO_IN _SB_MAKEMASK1(S_MAC_MDIO_IN)
642
643#endif
diff --git a/include/asm-mips/sibyte/sb1250_mc.h b/include/asm-mips/sibyte/sb1250_mc.h
new file mode 100644
index 000000000000..93a48334b874
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_mc.h
@@ -0,0 +1,548 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Memory Controller constants File: sb1250_mc.h
5 *
6 * This module contains constants and macros useful for
7 * programming the memory controller.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_MC_H
36#define _SB1250_MC_H
37
38#include "sb1250_defs.h"
39
40/*
41 * Memory Channel Config Register (table 6-14)
42 */
43
44#define S_MC_RESERVED0 0
45#define M_MC_RESERVED0 _SB_MAKEMASK(8,S_MC_RESERVED0)
46
47#define S_MC_CHANNEL_SEL 8
48#define M_MC_CHANNEL_SEL _SB_MAKEMASK(8,S_MC_CHANNEL_SEL)
49#define V_MC_CHANNEL_SEL(x) _SB_MAKEVALUE(x,S_MC_CHANNEL_SEL)
50#define G_MC_CHANNEL_SEL(x) _SB_GETVALUE(x,S_MC_CHANNEL_SEL,M_MC_CHANNEL_SEL)
51
52#define S_MC_BANK0_MAP 16
53#define M_MC_BANK0_MAP _SB_MAKEMASK(4,S_MC_BANK0_MAP)
54#define V_MC_BANK0_MAP(x) _SB_MAKEVALUE(x,S_MC_BANK0_MAP)
55#define G_MC_BANK0_MAP(x) _SB_GETVALUE(x,S_MC_BANK0_MAP,M_MC_BANK0_MAP)
56
57#define K_MC_BANK0_MAP_DEFAULT 0x00
58#define V_MC_BANK0_MAP_DEFAULT V_MC_BANK0_MAP(K_MC_BANK0_MAP_DEFAULT)
59
60#define S_MC_BANK1_MAP 20
61#define M_MC_BANK1_MAP _SB_MAKEMASK(4,S_MC_BANK1_MAP)
62#define V_MC_BANK1_MAP(x) _SB_MAKEVALUE(x,S_MC_BANK1_MAP)
63#define G_MC_BANK1_MAP(x) _SB_GETVALUE(x,S_MC_BANK1_MAP,M_MC_BANK1_MAP)
64
65#define K_MC_BANK1_MAP_DEFAULT 0x08
66#define V_MC_BANK1_MAP_DEFAULT V_MC_BANK1_MAP(K_MC_BANK1_MAP_DEFAULT)
67
68#define S_MC_BANK2_MAP 24
69#define M_MC_BANK2_MAP _SB_MAKEMASK(4,S_MC_BANK2_MAP)
70#define V_MC_BANK2_MAP(x) _SB_MAKEVALUE(x,S_MC_BANK2_MAP)
71#define G_MC_BANK2_MAP(x) _SB_GETVALUE(x,S_MC_BANK2_MAP,M_MC_BANK2_MAP)
72
73#define K_MC_BANK2_MAP_DEFAULT 0x09
74#define V_MC_BANK2_MAP_DEFAULT V_MC_BANK2_MAP(K_MC_BANK2_MAP_DEFAULT)
75
76#define S_MC_BANK3_MAP 28
77#define M_MC_BANK3_MAP _SB_MAKEMASK(4,S_MC_BANK3_MAP)
78#define V_MC_BANK3_MAP(x) _SB_MAKEVALUE(x,S_MC_BANK3_MAP)
79#define G_MC_BANK3_MAP(x) _SB_GETVALUE(x,S_MC_BANK3_MAP,M_MC_BANK3_MAP)
80
81#define K_MC_BANK3_MAP_DEFAULT 0x0C
82#define V_MC_BANK3_MAP_DEFAULT V_MC_BANK3_MAP(K_MC_BANK3_MAP_DEFAULT)
83
84#define M_MC_RESERVED1 _SB_MAKEMASK(8,32)
85
86#define S_MC_QUEUE_SIZE 40
87#define M_MC_QUEUE_SIZE _SB_MAKEMASK(4,S_MC_QUEUE_SIZE)
88#define V_MC_QUEUE_SIZE(x) _SB_MAKEVALUE(x,S_MC_QUEUE_SIZE)
89#define G_MC_QUEUE_SIZE(x) _SB_GETVALUE(x,S_MC_QUEUE_SIZE,M_MC_QUEUE_SIZE)
90#define V_MC_QUEUE_SIZE_DEFAULT V_MC_QUEUE_SIZE(0x0A)
91
92#define S_MC_AGE_LIMIT 44
93#define M_MC_AGE_LIMIT _SB_MAKEMASK(4,S_MC_AGE_LIMIT)
94#define V_MC_AGE_LIMIT(x) _SB_MAKEVALUE(x,S_MC_AGE_LIMIT)
95#define G_MC_AGE_LIMIT(x) _SB_GETVALUE(x,S_MC_AGE_LIMIT,M_MC_AGE_LIMIT)
96#define V_MC_AGE_LIMIT_DEFAULT V_MC_AGE_LIMIT(8)
97
98#define S_MC_WR_LIMIT 48
99#define M_MC_WR_LIMIT _SB_MAKEMASK(4,S_MC_WR_LIMIT)
100#define V_MC_WR_LIMIT(x) _SB_MAKEVALUE(x,S_MC_WR_LIMIT)
101#define G_MC_WR_LIMIT(x) _SB_GETVALUE(x,S_MC_WR_LIMIT,M_MC_WR_LIMIT)
102#define V_MC_WR_LIMIT_DEFAULT V_MC_WR_LIMIT(5)
103
104#define M_MC_IOB1HIGHPRIORITY _SB_MAKEMASK1(52)
105
106#define M_MC_RESERVED2 _SB_MAKEMASK(3,53)
107
108#define S_MC_CS_MODE 56
109#define M_MC_CS_MODE _SB_MAKEMASK(4,S_MC_CS_MODE)
110#define V_MC_CS_MODE(x) _SB_MAKEVALUE(x,S_MC_CS_MODE)
111#define G_MC_CS_MODE(x) _SB_GETVALUE(x,S_MC_CS_MODE,M_MC_CS_MODE)
112
113#define K_MC_CS_MODE_MSB_CS 0
114#define K_MC_CS_MODE_INTLV_CS 15
115#define K_MC_CS_MODE_MIXED_CS_10 12
116#define K_MC_CS_MODE_MIXED_CS_30 6
117#define K_MC_CS_MODE_MIXED_CS_32 3
118
119#define V_MC_CS_MODE_MSB_CS V_MC_CS_MODE(K_MC_CS_MODE_MSB_CS)
120#define V_MC_CS_MODE_INTLV_CS V_MC_CS_MODE(K_MC_CS_MODE_INTLV_CS)
121#define V_MC_CS_MODE_MIXED_CS_10 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_10)
122#define V_MC_CS_MODE_MIXED_CS_30 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_30)
123#define V_MC_CS_MODE_MIXED_CS_32 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_32)
124
125#define M_MC_ECC_DISABLE _SB_MAKEMASK1(60)
126#define M_MC_BERR_DISABLE _SB_MAKEMASK1(61)
127#define M_MC_FORCE_SEQ _SB_MAKEMASK1(62)
128#define M_MC_DEBUG _SB_MAKEMASK1(63)
129
130#define V_MC_CONFIG_DEFAULT V_MC_WR_LIMIT_DEFAULT | V_MC_AGE_LIMIT_DEFAULT | \
131 V_MC_BANK0_MAP_DEFAULT | V_MC_BANK1_MAP_DEFAULT | \
132 V_MC_BANK2_MAP_DEFAULT | V_MC_BANK3_MAP_DEFAULT | V_MC_CHANNEL_SEL(0) | \
133 M_MC_IOB1HIGHPRIORITY | V_MC_QUEUE_SIZE_DEFAULT
134
135
136/*
137 * Memory clock config register (Table 6-15)
138 *
139 * Note: this field has been updated to be consistent with the errata to 0.2
140 */
141
142#define S_MC_CLK_RATIO 0
143#define M_MC_CLK_RATIO _SB_MAKEMASK(4,S_MC_CLK_RATIO)
144#define V_MC_CLK_RATIO(x) _SB_MAKEVALUE(x,S_MC_CLK_RATIO)
145#define G_MC_CLK_RATIO(x) _SB_GETVALUE(x,S_MC_CLK_RATIO,M_MC_CLK_RATIO)
146
147#define K_MC_CLK_RATIO_2X 4
148#define K_MC_CLK_RATIO_25X 5
149#define K_MC_CLK_RATIO_3X 6
150#define K_MC_CLK_RATIO_35X 7
151#define K_MC_CLK_RATIO_4X 8
152#define K_MC_CLK_RATIO_45X 9
153
154#define V_MC_CLK_RATIO_2X V_MC_CLK_RATIO(K_MC_CLK_RATIO_2X)
155#define V_MC_CLK_RATIO_25X V_MC_CLK_RATIO(K_MC_CLK_RATIO_25X)
156#define V_MC_CLK_RATIO_3X V_MC_CLK_RATIO(K_MC_CLK_RATIO_3X)
157#define V_MC_CLK_RATIO_35X V_MC_CLK_RATIO(K_MC_CLK_RATIO_35X)
158#define V_MC_CLK_RATIO_4X V_MC_CLK_RATIO(K_MC_CLK_RATIO_4X)
159#define V_MC_CLK_RATIO_45X V_MC_CLK_RATIO(K_MC_CLK_RATIO_45X)
160#define V_MC_CLK_RATIO_DEFAULT V_MC_CLK_RATIO_25X
161
162#define S_MC_REF_RATE 8
163#define M_MC_REF_RATE _SB_MAKEMASK(8,S_MC_REF_RATE)
164#define V_MC_REF_RATE(x) _SB_MAKEVALUE(x,S_MC_REF_RATE)
165#define G_MC_REF_RATE(x) _SB_GETVALUE(x,S_MC_REF_RATE,M_MC_REF_RATE)
166
167#define K_MC_REF_RATE_100MHz 0x62
168#define K_MC_REF_RATE_133MHz 0x81
169#define K_MC_REF_RATE_200MHz 0xC4
170
171#define V_MC_REF_RATE_100MHz V_MC_REF_RATE(K_MC_REF_RATE_100MHz)
172#define V_MC_REF_RATE_133MHz V_MC_REF_RATE(K_MC_REF_RATE_133MHz)
173#define V_MC_REF_RATE_200MHz V_MC_REF_RATE(K_MC_REF_RATE_200MHz)
174#define V_MC_REF_RATE_DEFAULT V_MC_REF_RATE_100MHz
175
176#define S_MC_CLOCK_DRIVE 16
177#define M_MC_CLOCK_DRIVE _SB_MAKEMASK(4,S_MC_CLOCK_DRIVE)
178#define V_MC_CLOCK_DRIVE(x) _SB_MAKEVALUE(x,S_MC_CLOCK_DRIVE)
179#define G_MC_CLOCK_DRIVE(x) _SB_GETVALUE(x,S_MC_CLOCK_DRIVE,M_MC_CLOCK_DRIVE)
180#define V_MC_CLOCK_DRIVE_DEFAULT V_MC_CLOCK_DRIVE(0xF)
181
182#define S_MC_DATA_DRIVE 20
183#define M_MC_DATA_DRIVE _SB_MAKEMASK(4,S_MC_DATA_DRIVE)
184#define V_MC_DATA_DRIVE(x) _SB_MAKEVALUE(x,S_MC_DATA_DRIVE)
185#define G_MC_DATA_DRIVE(x) _SB_GETVALUE(x,S_MC_DATA_DRIVE,M_MC_DATA_DRIVE)
186#define V_MC_DATA_DRIVE_DEFAULT V_MC_DATA_DRIVE(0x0)
187
188#define S_MC_ADDR_DRIVE 24
189#define M_MC_ADDR_DRIVE _SB_MAKEMASK(4,S_MC_ADDR_DRIVE)
190#define V_MC_ADDR_DRIVE(x) _SB_MAKEVALUE(x,S_MC_ADDR_DRIVE)
191#define G_MC_ADDR_DRIVE(x) _SB_GETVALUE(x,S_MC_ADDR_DRIVE,M_MC_ADDR_DRIVE)
192#define V_MC_ADDR_DRIVE_DEFAULT V_MC_ADDR_DRIVE(0x0)
193
194#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
195#define M_MC_REF_DISABLE _SB_MAKEMASK1(30)
196#endif /* 1250 PASS3 || 112x PASS1 */
197
198#define M_MC_DLL_BYPASS _SB_MAKEMASK1(31)
199
200#define S_MC_DQI_SKEW 32
201#define M_MC_DQI_SKEW _SB_MAKEMASK(8,S_MC_DQI_SKEW)
202#define V_MC_DQI_SKEW(x) _SB_MAKEVALUE(x,S_MC_DQI_SKEW)
203#define G_MC_DQI_SKEW(x) _SB_GETVALUE(x,S_MC_DQI_SKEW,M_MC_DQI_SKEW)
204#define V_MC_DQI_SKEW_DEFAULT V_MC_DQI_SKEW(0)
205
206#define S_MC_DQO_SKEW 40
207#define M_MC_DQO_SKEW _SB_MAKEMASK(8,S_MC_DQO_SKEW)
208#define V_MC_DQO_SKEW(x) _SB_MAKEVALUE(x,S_MC_DQO_SKEW)
209#define G_MC_DQO_SKEW(x) _SB_GETVALUE(x,S_MC_DQO_SKEW,M_MC_DQO_SKEW)
210#define V_MC_DQO_SKEW_DEFAULT V_MC_DQO_SKEW(0)
211
212#define S_MC_ADDR_SKEW 48
213#define M_MC_ADDR_SKEW _SB_MAKEMASK(8,S_MC_ADDR_SKEW)
214#define V_MC_ADDR_SKEW(x) _SB_MAKEVALUE(x,S_MC_ADDR_SKEW)
215#define G_MC_ADDR_SKEW(x) _SB_GETVALUE(x,S_MC_ADDR_SKEW,M_MC_ADDR_SKEW)
216#define V_MC_ADDR_SKEW_DEFAULT V_MC_ADDR_SKEW(0x0F)
217
218#define S_MC_DLL_DEFAULT 56
219#define M_MC_DLL_DEFAULT _SB_MAKEMASK(8,S_MC_DLL_DEFAULT)
220#define V_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_MC_DLL_DEFAULT)
221#define G_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_MC_DLL_DEFAULT,M_MC_DLL_DEFAULT)
222#define V_MC_DLL_DEFAULT_DEFAULT V_MC_DLL_DEFAULT(0x10)
223
224#define V_MC_CLKCONFIG_DEFAULT V_MC_DLL_DEFAULT_DEFAULT | \
225 V_MC_ADDR_SKEW_DEFAULT | \
226 V_MC_DQO_SKEW_DEFAULT | \
227 V_MC_DQI_SKEW_DEFAULT | \
228 V_MC_ADDR_DRIVE_DEFAULT | \
229 V_MC_DATA_DRIVE_DEFAULT | \
230 V_MC_CLOCK_DRIVE_DEFAULT | \
231 V_MC_REF_RATE_DEFAULT
232
233
234
235/*
236 * DRAM Command Register (Table 6-13)
237 */
238
239#define S_MC_COMMAND 0
240#define M_MC_COMMAND _SB_MAKEMASK(4,S_MC_COMMAND)
241#define V_MC_COMMAND(x) _SB_MAKEVALUE(x,S_MC_COMMAND)
242#define G_MC_COMMAND(x) _SB_GETVALUE(x,S_MC_COMMAND,M_MC_COMMAND)
243
244#define K_MC_COMMAND_EMRS 0
245#define K_MC_COMMAND_MRS 1
246#define K_MC_COMMAND_PRE 2
247#define K_MC_COMMAND_AR 3
248#define K_MC_COMMAND_SETRFSH 4
249#define K_MC_COMMAND_CLRRFSH 5
250#define K_MC_COMMAND_SETPWRDN 6
251#define K_MC_COMMAND_CLRPWRDN 7
252
253#define V_MC_COMMAND_EMRS V_MC_COMMAND(K_MC_COMMAND_EMRS)
254#define V_MC_COMMAND_MRS V_MC_COMMAND(K_MC_COMMAND_MRS)
255#define V_MC_COMMAND_PRE V_MC_COMMAND(K_MC_COMMAND_PRE)
256#define V_MC_COMMAND_AR V_MC_COMMAND(K_MC_COMMAND_AR)
257#define V_MC_COMMAND_SETRFSH V_MC_COMMAND(K_MC_COMMAND_SETRFSH)
258#define V_MC_COMMAND_CLRRFSH V_MC_COMMAND(K_MC_COMMAND_CLRRFSH)
259#define V_MC_COMMAND_SETPWRDN V_MC_COMMAND(K_MC_COMMAND_SETPWRDN)
260#define V_MC_COMMAND_CLRPWRDN V_MC_COMMAND(K_MC_COMMAND_CLRPWRDN)
261
262#define M_MC_CS0 _SB_MAKEMASK1(4)
263#define M_MC_CS1 _SB_MAKEMASK1(5)
264#define M_MC_CS2 _SB_MAKEMASK1(6)
265#define M_MC_CS3 _SB_MAKEMASK1(7)
266
267/*
268 * DRAM Mode Register (Table 6-14)
269 */
270
271#define S_MC_EMODE 0
272#define M_MC_EMODE _SB_MAKEMASK(15,S_MC_EMODE)
273#define V_MC_EMODE(x) _SB_MAKEVALUE(x,S_MC_EMODE)
274#define G_MC_EMODE(x) _SB_GETVALUE(x,S_MC_EMODE,M_MC_EMODE)
275#define V_MC_EMODE_DEFAULT V_MC_EMODE(0)
276
277#define S_MC_MODE 16
278#define M_MC_MODE _SB_MAKEMASK(15,S_MC_MODE)
279#define V_MC_MODE(x) _SB_MAKEVALUE(x,S_MC_MODE)
280#define G_MC_MODE(x) _SB_GETVALUE(x,S_MC_MODE,M_MC_MODE)
281#define V_MC_MODE_DEFAULT V_MC_MODE(0x22)
282
283#define S_MC_DRAM_TYPE 32
284#define M_MC_DRAM_TYPE _SB_MAKEMASK(3,S_MC_DRAM_TYPE)
285#define V_MC_DRAM_TYPE(x) _SB_MAKEVALUE(x,S_MC_DRAM_TYPE)
286#define G_MC_DRAM_TYPE(x) _SB_GETVALUE(x,S_MC_DRAM_TYPE,M_MC_DRAM_TYPE)
287
288#define K_MC_DRAM_TYPE_JEDEC 0
289#define K_MC_DRAM_TYPE_FCRAM 1
290#define K_MC_DRAM_TYPE_SGRAM 2
291
292#define V_MC_DRAM_TYPE_JEDEC V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_JEDEC)
293#define V_MC_DRAM_TYPE_FCRAM V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_FCRAM)
294#define V_MC_DRAM_TYPE_SGRAM V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_SGRAM)
295
296#define M_MC_EXTERNALDECODE _SB_MAKEMASK1(35)
297
298#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
299#define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36)
300#define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(38)
301#endif /* 1250 PASS3 || 112x PASS1 */
302
303
304
305/*
306 * SDRAM Timing Register (Table 6-15)
307 */
308
309#define M_MC_w2rIDLE_TWOCYCLES _SB_MAKEMASK1(60)
310#define M_MC_r2wIDLE_TWOCYCLES _SB_MAKEMASK1(61)
311#define M_MC_r2rIDLE_TWOCYCLES _SB_MAKEMASK1(62)
312
313#define S_MC_tFIFO 56
314#define M_MC_tFIFO _SB_MAKEMASK(4,S_MC_tFIFO)
315#define V_MC_tFIFO(x) _SB_MAKEVALUE(x,S_MC_tFIFO)
316#define G_MC_tFIFO(x) _SB_GETVALUE(x,S_MC_tFIFO,M_MC_tFIFO)
317#define K_MC_tFIFO_DEFAULT 1
318#define V_MC_tFIFO_DEFAULT V_MC_tFIFO(K_MC_tFIFO_DEFAULT)
319
320#define S_MC_tRFC 52
321#define M_MC_tRFC _SB_MAKEMASK(4,S_MC_tRFC)
322#define V_MC_tRFC(x) _SB_MAKEVALUE(x,S_MC_tRFC)
323#define G_MC_tRFC(x) _SB_GETVALUE(x,S_MC_tRFC,M_MC_tRFC)
324#define K_MC_tRFC_DEFAULT 12
325#define V_MC_tRFC_DEFAULT V_MC_tRFC(K_MC_tRFC_DEFAULT)
326
327#define S_MC_tCwCr 40
328#define M_MC_tCwCr _SB_MAKEMASK(4,S_MC_tCwCr)
329#define V_MC_tCwCr(x) _SB_MAKEVALUE(x,S_MC_tCwCr)
330#define G_MC_tCwCr(x) _SB_GETVALUE(x,S_MC_tCwCr,M_MC_tCwCr)
331#define K_MC_tCwCr_DEFAULT 4
332#define V_MC_tCwCr_DEFAULT V_MC_tCwCr(K_MC_tCwCr_DEFAULT)
333
334#define S_MC_tRCr 28
335#define M_MC_tRCr _SB_MAKEMASK(4,S_MC_tRCr)
336#define V_MC_tRCr(x) _SB_MAKEVALUE(x,S_MC_tRCr)
337#define G_MC_tRCr(x) _SB_GETVALUE(x,S_MC_tRCr,M_MC_tRCr)
338#define K_MC_tRCr_DEFAULT 9
339#define V_MC_tRCr_DEFAULT V_MC_tRCr(K_MC_tRCr_DEFAULT)
340
341#define S_MC_tRCw 24
342#define M_MC_tRCw _SB_MAKEMASK(4,S_MC_tRCw)
343#define V_MC_tRCw(x) _SB_MAKEVALUE(x,S_MC_tRCw)
344#define G_MC_tRCw(x) _SB_GETVALUE(x,S_MC_tRCw,M_MC_tRCw)
345#define K_MC_tRCw_DEFAULT 10
346#define V_MC_tRCw_DEFAULT V_MC_tRCw(K_MC_tRCw_DEFAULT)
347
348#define S_MC_tRRD 20
349#define M_MC_tRRD _SB_MAKEMASK(4,S_MC_tRRD)
350#define V_MC_tRRD(x) _SB_MAKEVALUE(x,S_MC_tRRD)
351#define G_MC_tRRD(x) _SB_GETVALUE(x,S_MC_tRRD,M_MC_tRRD)
352#define K_MC_tRRD_DEFAULT 2
353#define V_MC_tRRD_DEFAULT V_MC_tRRD(K_MC_tRRD_DEFAULT)
354
355#define S_MC_tRP 16
356#define M_MC_tRP _SB_MAKEMASK(4,S_MC_tRP)
357#define V_MC_tRP(x) _SB_MAKEVALUE(x,S_MC_tRP)
358#define G_MC_tRP(x) _SB_GETVALUE(x,S_MC_tRP,M_MC_tRP)
359#define K_MC_tRP_DEFAULT 4
360#define V_MC_tRP_DEFAULT V_MC_tRP(K_MC_tRP_DEFAULT)
361
362#define S_MC_tCwD 8
363#define M_MC_tCwD _SB_MAKEMASK(4,S_MC_tCwD)
364#define V_MC_tCwD(x) _SB_MAKEVALUE(x,S_MC_tCwD)
365#define G_MC_tCwD(x) _SB_GETVALUE(x,S_MC_tCwD,M_MC_tCwD)
366#define K_MC_tCwD_DEFAULT 1
367#define V_MC_tCwD_DEFAULT V_MC_tCwD(K_MC_tCwD_DEFAULT)
368
369#define M_tCrDh _SB_MAKEMASK1(7)
370#define M_MC_tCrDh M_tCrDh
371
372#define S_MC_tCrD 4
373#define M_MC_tCrD _SB_MAKEMASK(3,S_MC_tCrD)
374#define V_MC_tCrD(x) _SB_MAKEVALUE(x,S_MC_tCrD)
375#define G_MC_tCrD(x) _SB_GETVALUE(x,S_MC_tCrD,M_MC_tCrD)
376#define K_MC_tCrD_DEFAULT 2
377#define V_MC_tCrD_DEFAULT V_MC_tCrD(K_MC_tCrD_DEFAULT)
378
379#define S_MC_tRCD 0
380#define M_MC_tRCD _SB_MAKEMASK(4,S_MC_tRCD)
381#define V_MC_tRCD(x) _SB_MAKEVALUE(x,S_MC_tRCD)
382#define G_MC_tRCD(x) _SB_GETVALUE(x,S_MC_tRCD,M_MC_tRCD)
383#define K_MC_tRCD_DEFAULT 3
384#define V_MC_tRCD_DEFAULT V_MC_tRCD(K_MC_tRCD_DEFAULT)
385
386#define V_MC_TIMING_DEFAULT V_MC_tFIFO(K_MC_tFIFO_DEFAULT) | \
387 V_MC_tRFC(K_MC_tRFC_DEFAULT) | \
388 V_MC_tCwCr(K_MC_tCwCr_DEFAULT) | \
389 V_MC_tRCr(K_MC_tRCr_DEFAULT) | \
390 V_MC_tRCw(K_MC_tRCw_DEFAULT) | \
391 V_MC_tRRD(K_MC_tRRD_DEFAULT) | \
392 V_MC_tRP(K_MC_tRP_DEFAULT) | \
393 V_MC_tCwD(K_MC_tCwD_DEFAULT) | \
394 V_MC_tCrD(K_MC_tCrD_DEFAULT) | \
395 V_MC_tRCD(K_MC_tRCD_DEFAULT) | \
396 M_MC_r2rIDLE_TWOCYCLES
397
398/*
399 * Errata says these are not the default
400 * M_MC_w2rIDLE_TWOCYCLES | \
401 * M_MC_r2wIDLE_TWOCYCLES | \
402 */
403
404
405/*
406 * Chip Select Start Address Register (Table 6-17)
407 */
408
409#define S_MC_CS0_START 0
410#define M_MC_CS0_START _SB_MAKEMASK(16,S_MC_CS0_START)
411#define V_MC_CS0_START(x) _SB_MAKEVALUE(x,S_MC_CS0_START)
412#define G_MC_CS0_START(x) _SB_GETVALUE(x,S_MC_CS0_START,M_MC_CS0_START)
413
414#define S_MC_CS1_START 16
415#define M_MC_CS1_START _SB_MAKEMASK(16,S_MC_CS1_START)
416#define V_MC_CS1_START(x) _SB_MAKEVALUE(x,S_MC_CS1_START)
417#define G_MC_CS1_START(x) _SB_GETVALUE(x,S_MC_CS1_START,M_MC_CS1_START)
418
419#define S_MC_CS2_START 32
420#define M_MC_CS2_START _SB_MAKEMASK(16,S_MC_CS2_START)
421#define V_MC_CS2_START(x) _SB_MAKEVALUE(x,S_MC_CS2_START)
422#define G_MC_CS2_START(x) _SB_GETVALUE(x,S_MC_CS2_START,M_MC_CS2_START)
423
424#define S_MC_CS3_START 48
425#define M_MC_CS3_START _SB_MAKEMASK(16,S_MC_CS3_START)
426#define V_MC_CS3_START(x) _SB_MAKEVALUE(x,S_MC_CS3_START)
427#define G_MC_CS3_START(x) _SB_GETVALUE(x,S_MC_CS3_START,M_MC_CS3_START)
428
429/*
430 * Chip Select End Address Register (Table 6-18)
431 */
432
433#define S_MC_CS0_END 0
434#define M_MC_CS0_END _SB_MAKEMASK(16,S_MC_CS0_END)
435#define V_MC_CS0_END(x) _SB_MAKEVALUE(x,S_MC_CS0_END)
436#define G_MC_CS0_END(x) _SB_GETVALUE(x,S_MC_CS0_END,M_MC_CS0_END)
437
438#define S_MC_CS1_END 16
439#define M_MC_CS1_END _SB_MAKEMASK(16,S_MC_CS1_END)
440#define V_MC_CS1_END(x) _SB_MAKEVALUE(x,S_MC_CS1_END)
441#define G_MC_CS1_END(x) _SB_GETVALUE(x,S_MC_CS1_END,M_MC_CS1_END)
442
443#define S_MC_CS2_END 32
444#define M_MC_CS2_END _SB_MAKEMASK(16,S_MC_CS2_END)
445#define V_MC_CS2_END(x) _SB_MAKEVALUE(x,S_MC_CS2_END)
446#define G_MC_CS2_END(x) _SB_GETVALUE(x,S_MC_CS2_END,M_MC_CS2_END)
447
448#define S_MC_CS3_END 48
449#define M_MC_CS3_END _SB_MAKEMASK(16,S_MC_CS3_END)
450#define V_MC_CS3_END(x) _SB_MAKEVALUE(x,S_MC_CS3_END)
451#define G_MC_CS3_END(x) _SB_GETVALUE(x,S_MC_CS3_END,M_MC_CS3_END)
452
453/*
454 * Chip Select Interleave Register (Table 6-19)
455 */
456
457#define S_MC_INTLV_RESERVED 0
458#define M_MC_INTLV_RESERVED _SB_MAKEMASK(5,S_MC_INTLV_RESERVED)
459
460#define S_MC_INTERLEAVE 7
461#define M_MC_INTERLEAVE _SB_MAKEMASK(18,S_MC_INTERLEAVE)
462#define V_MC_INTERLEAVE(x) _SB_MAKEVALUE(x,S_MC_INTERLEAVE)
463
464#define S_MC_INTLV_MBZ 25
465#define M_MC_INTLV_MBZ _SB_MAKEMASK(39,S_MC_INTLV_MBZ)
466
467/*
468 * Row Address Bits Register (Table 6-20)
469 */
470
471#define S_MC_RAS_RESERVED 0
472#define M_MC_RAS_RESERVED _SB_MAKEMASK(5,S_MC_RAS_RESERVED)
473
474#define S_MC_RAS_SELECT 12
475#define M_MC_RAS_SELECT _SB_MAKEMASK(25,S_MC_RAS_SELECT)
476#define V_MC_RAS_SELECT(x) _SB_MAKEVALUE(x,S_MC_RAS_SELECT)
477
478#define S_MC_RAS_MBZ 37
479#define M_MC_RAS_MBZ _SB_MAKEMASK(27,S_MC_RAS_MBZ)
480
481
482/*
483 * Column Address Bits Register (Table 6-21)
484 */
485
486#define S_MC_CAS_RESERVED 0
487#define M_MC_CAS_RESERVED _SB_MAKEMASK(5,S_MC_CAS_RESERVED)
488
489#define S_MC_CAS_SELECT 5
490#define M_MC_CAS_SELECT _SB_MAKEMASK(18,S_MC_CAS_SELECT)
491#define V_MC_CAS_SELECT(x) _SB_MAKEVALUE(x,S_MC_CAS_SELECT)
492
493#define S_MC_CAS_MBZ 23
494#define M_MC_CAS_MBZ _SB_MAKEMASK(41,S_MC_CAS_MBZ)
495
496
497/*
498 * Bank Address Address Bits Register (Table 6-22)
499 */
500
501#define S_MC_BA_RESERVED 0
502#define M_MC_BA_RESERVED _SB_MAKEMASK(5,S_MC_BA_RESERVED)
503
504#define S_MC_BA_SELECT 5
505#define M_MC_BA_SELECT _SB_MAKEMASK(20,S_MC_BA_SELECT)
506#define V_MC_BA_SELECT(x) _SB_MAKEVALUE(x,S_MC_BA_SELECT)
507
508#define S_MC_BA_MBZ 25
509#define M_MC_BA_MBZ _SB_MAKEMASK(39,S_MC_BA_MBZ)
510
511/*
512 * Chip Select Attribute Register (Table 6-23)
513 */
514
515#define K_MC_CS_ATTR_CLOSED 0
516#define K_MC_CS_ATTR_CASCHECK 1
517#define K_MC_CS_ATTR_HINT 2
518#define K_MC_CS_ATTR_OPEN 3
519
520#define S_MC_CS0_PAGE 0
521#define M_MC_CS0_PAGE _SB_MAKEMASK(2,S_MC_CS0_PAGE)
522#define V_MC_CS0_PAGE(x) _SB_MAKEVALUE(x,S_MC_CS0_PAGE)
523#define G_MC_CS0_PAGE(x) _SB_GETVALUE(x,S_MC_CS0_PAGE,M_MC_CS0_PAGE)
524
525#define S_MC_CS1_PAGE 16
526#define M_MC_CS1_PAGE _SB_MAKEMASK(2,S_MC_CS1_PAGE)
527#define V_MC_CS1_PAGE(x) _SB_MAKEVALUE(x,S_MC_CS1_PAGE)
528#define G_MC_CS1_PAGE(x) _SB_GETVALUE(x,S_MC_CS1_PAGE,M_MC_CS1_PAGE)
529
530#define S_MC_CS2_PAGE 32
531#define M_MC_CS2_PAGE _SB_MAKEMASK(2,S_MC_CS2_PAGE)
532#define V_MC_CS2_PAGE(x) _SB_MAKEVALUE(x,S_MC_CS2_PAGE)
533#define G_MC_CS2_PAGE(x) _SB_GETVALUE(x,S_MC_CS2_PAGE,M_MC_CS2_PAGE)
534
535#define S_MC_CS3_PAGE 48
536#define M_MC_CS3_PAGE _SB_MAKEMASK(2,S_MC_CS3_PAGE)
537#define V_MC_CS3_PAGE(x) _SB_MAKEVALUE(x,S_MC_CS3_PAGE)
538#define G_MC_CS3_PAGE(x) _SB_GETVALUE(x,S_MC_CS3_PAGE,M_MC_CS3_PAGE)
539
540/*
541 * ECC Test ECC Register (Table 6-25)
542 */
543
544#define S_MC_ECC_INVERT 0
545#define M_MC_ECC_INVERT _SB_MAKEMASK(8,S_MC_ECC_INVERT)
546
547
548#endif
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
new file mode 100644
index 000000000000..5d496c6faba6
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_regs.h
@@ -0,0 +1,836 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Register Definitions File: sb1250_regs.h
5 *
6 * This module contains the addresses of the on-chip peripherals
7 * on the SB1250.
8 *
9 * SB1250 specification level: 01/02/2002
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_REGS_H
36#define _SB1250_REGS_H
37
38#include "sb1250_defs.h"
39
40
41/* *********************************************************************
42 * Some general notes:
43 *
44 * For the most part, when there is more than one peripheral
45 * of the same type on the SOC, the constants below will be
46 * offsets from the base of each peripheral. For example,
47 * the MAC registers are described as offsets from the first
48 * MAC register, and there will be a MAC_REGISTER() macro
49 * to calculate the base address of a given MAC.
50 *
51 * The information in this file is based on the SB1250 SOC
52 * manual version 0.2, July 2000.
53 ********************************************************************* */
54
55
56/* *********************************************************************
57 * Memory Controller Registers
58 ********************************************************************* */
59
60/*
61 * XXX: can't remove MC base 0 if 112x, since it's used by other macros,
62 * since there is one reg there (but it could get its addr/offset constant).
63 */
64#define A_MC_BASE_0 0x0010051000
65#define A_MC_BASE_1 0x0010052000
66#define MC_REGISTER_SPACING 0x1000
67
68#define A_MC_BASE(ctlid) ((ctlid)*MC_REGISTER_SPACING+A_MC_BASE_0)
69#define A_MC_REGISTER(ctlid,reg) (A_MC_BASE(ctlid)+(reg))
70
71#define R_MC_CONFIG 0x0000000100
72#define R_MC_DRAMCMD 0x0000000120
73#define R_MC_DRAMMODE 0x0000000140
74#define R_MC_TIMING1 0x0000000160
75#define R_MC_TIMING2 0x0000000180
76#define R_MC_CS_START 0x00000001A0
77#define R_MC_CS_END 0x00000001C0
78#define R_MC_CS_INTERLEAVE 0x00000001E0
79#define S_MC_CS_STARTEND 16
80
81#define R_MC_CSX_BASE 0x0000000200
82#define R_MC_CSX_ROW 0x0000000000 /* relative to CSX_BASE, above */
83#define R_MC_CSX_COL 0x0000000020 /* relative to CSX_BASE, above */
84#define R_MC_CSX_BA 0x0000000040 /* relative to CSX_BASE, above */
85#define MC_CSX_SPACING 0x0000000060 /* relative to CSX_BASE, above */
86
87#define R_MC_CS0_ROW 0x0000000200
88#define R_MC_CS0_COL 0x0000000220
89#define R_MC_CS0_BA 0x0000000240
90#define R_MC_CS1_ROW 0x0000000260
91#define R_MC_CS1_COL 0x0000000280
92#define R_MC_CS1_BA 0x00000002A0
93#define R_MC_CS2_ROW 0x00000002C0
94#define R_MC_CS2_COL 0x00000002E0
95#define R_MC_CS2_BA 0x0000000300
96#define R_MC_CS3_ROW 0x0000000320
97#define R_MC_CS3_COL 0x0000000340
98#define R_MC_CS3_BA 0x0000000360
99#define R_MC_CS_ATTR 0x0000000380
100#define R_MC_TEST_DATA 0x0000000400
101#define R_MC_TEST_ECC 0x0000000420
102#define R_MC_MCLK_CFG 0x0000000500
103
104/* *********************************************************************
105 * L2 Cache Control Registers
106 ********************************************************************* */
107
108#define A_L2_READ_TAG 0x0010040018
109#define A_L2_ECC_TAG 0x0010040038
110#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
111#define A_L2_READ_MISC 0x0010040058
112#endif /* 1250 PASS3 || 112x PASS1 */
113#define A_L2_WAY_DISABLE 0x0010041000
114#define A_L2_MAKEDISABLE(x) (A_L2_WAY_DISABLE | (((~(x))&0x0F) << 8))
115#define A_L2_MGMT_TAG_BASE 0x00D0000000
116
117#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
118#define A_L2_CACHE_DISABLE 0x0010042000
119#define A_L2_MAKECACHEDISABLE(x) (A_L2_CACHE_DISABLE | (((x)&0x0F) << 8))
120#define A_L2_MISC_CONFIG 0x0010043000
121#endif /* 1250 PASS2 || 112x PASS1 */
122
123/* Backward-compatibility definitions. */
124/* XXX: discourage people from using these constants. */
125#define A_L2_READ_ADDRESS A_L2_READ_TAG
126#define A_L2_EEC_ADDRESS A_L2_ECC_TAG
127
128
129/* *********************************************************************
130 * PCI Interface Registers
131 ********************************************************************* */
132
133#define A_PCI_TYPE00_HEADER 0x00DE000000
134#define A_PCI_TYPE01_HEADER 0x00DE000800
135
136
137/* *********************************************************************
138 * Ethernet DMA and MACs
139 ********************************************************************* */
140
141#define A_MAC_BASE_0 0x0010064000
142#define A_MAC_BASE_1 0x0010065000
143#if SIBYTE_HDR_FEATURE_CHIP(1250)
144#define A_MAC_BASE_2 0x0010066000
145#endif /* 1250 */
146
147#define MAC_SPACING 0x1000
148#define MAC_DMA_TXRX_SPACING 0x0400
149#define MAC_DMA_CHANNEL_SPACING 0x0100
150#define DMA_RX 0
151#define DMA_TX 1
152#define MAC_NUM_DMACHAN 2 /* channels per direction */
153
154/* XXX: not correct; depends on SOC type. */
155#define MAC_NUM_PORTS 3
156
157#define A_MAC_CHANNEL_BASE(macnum) \
158 (A_MAC_BASE_0 + \
159 MAC_SPACING*(macnum))
160
161#define A_MAC_REGISTER(macnum,reg) \
162 (A_MAC_BASE_0 + \
163 MAC_SPACING*(macnum) + (reg))
164
165
166#define R_MAC_DMA_CHANNELS 0x800 /* Relative to A_MAC_CHANNEL_BASE */
167
168#define A_MAC_DMA_CHANNEL_BASE(macnum,txrx,chan) \
169 ((A_MAC_CHANNEL_BASE(macnum)) + \
170 R_MAC_DMA_CHANNELS + \
171 (MAC_DMA_TXRX_SPACING*(txrx)) + \
172 (MAC_DMA_CHANNEL_SPACING*(chan)))
173
174#define R_MAC_DMA_CHANNEL_BASE(txrx,chan) \
175 (R_MAC_DMA_CHANNELS + \
176 (MAC_DMA_TXRX_SPACING*(txrx)) + \
177 (MAC_DMA_CHANNEL_SPACING*(chan)))
178
179#define A_MAC_DMA_REGISTER(macnum,txrx,chan,reg) \
180 (A_MAC_DMA_CHANNEL_BASE(macnum,txrx,chan) + \
181 (reg))
182
183#define R_MAC_DMA_REGISTER(txrx,chan,reg) \
184 (R_MAC_DMA_CHANNEL_BASE(txrx,chan) + \
185 (reg))
186
187/*
188 * DMA channel registers, relative to A_MAC_DMA_CHANNEL_BASE
189 */
190
191#define R_MAC_DMA_CONFIG0 0x00000000
192#define R_MAC_DMA_CONFIG1 0x00000008
193#define R_MAC_DMA_DSCR_BASE 0x00000010
194#define R_MAC_DMA_DSCR_CNT 0x00000018
195#define R_MAC_DMA_CUR_DSCRA 0x00000020
196#define R_MAC_DMA_CUR_DSCRB 0x00000028
197#define R_MAC_DMA_CUR_DSCRADDR 0x00000030
198#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
199#define R_MAC_DMA_OODPKTLOST_RX 0x00000038 /* rx only */
200#endif /* 1250 PASS3 || 112x PASS1 */
201
202/*
203 * RMON Counters
204 */
205
206#define R_MAC_RMON_TX_BYTES 0x00000000
207#define R_MAC_RMON_COLLISIONS 0x00000008
208#define R_MAC_RMON_LATE_COL 0x00000010
209#define R_MAC_RMON_EX_COL 0x00000018
210#define R_MAC_RMON_FCS_ERROR 0x00000020
211#define R_MAC_RMON_TX_ABORT 0x00000028
212/* Counter #6 (0x30) now reserved */
213#define R_MAC_RMON_TX_BAD 0x00000038
214#define R_MAC_RMON_TX_GOOD 0x00000040
215#define R_MAC_RMON_TX_RUNT 0x00000048
216#define R_MAC_RMON_TX_OVERSIZE 0x00000050
217#define R_MAC_RMON_RX_BYTES 0x00000080
218#define R_MAC_RMON_RX_MCAST 0x00000088
219#define R_MAC_RMON_RX_BCAST 0x00000090
220#define R_MAC_RMON_RX_BAD 0x00000098
221#define R_MAC_RMON_RX_GOOD 0x000000A0
222#define R_MAC_RMON_RX_RUNT 0x000000A8
223#define R_MAC_RMON_RX_OVERSIZE 0x000000B0
224#define R_MAC_RMON_RX_FCS_ERROR 0x000000B8
225#define R_MAC_RMON_RX_LENGTH_ERROR 0x000000C0
226#define R_MAC_RMON_RX_CODE_ERROR 0x000000C8
227#define R_MAC_RMON_RX_ALIGN_ERROR 0x000000D0
228
229/* Updated to spec 0.2 */
230#define R_MAC_CFG 0x00000100
231#define R_MAC_THRSH_CFG 0x00000108
232#define R_MAC_VLANTAG 0x00000110
233#define R_MAC_FRAMECFG 0x00000118
234#define R_MAC_EOPCNT 0x00000120
235#define R_MAC_FIFO_PTRS 0x00000130
236#define R_MAC_ADFILTER_CFG 0x00000200
237#define R_MAC_ETHERNET_ADDR 0x00000208
238#define R_MAC_PKT_TYPE 0x00000210
239#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
240#define R_MAC_ADMASK0 0x00000218
241#define R_MAC_ADMASK1 0x00000220
242#endif /* 1250 PASS3 || 112x PASS1 */
243#define R_MAC_HASH_BASE 0x00000240
244#define R_MAC_ADDR_BASE 0x00000280
245#define R_MAC_CHLO0_BASE 0x00000300
246#define R_MAC_CHUP0_BASE 0x00000320
247#define R_MAC_ENABLE 0x00000400
248#define R_MAC_STATUS 0x00000408
249#define R_MAC_INT_MASK 0x00000410
250#define R_MAC_TXD_CTL 0x00000420
251#define R_MAC_MDIO 0x00000428
252#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
253#define R_MAC_STATUS1 0x00000430
254#endif /* 1250 PASS2 || 112x PASS1 */
255#define R_MAC_DEBUG_STATUS 0x00000448
256
257#define MAC_HASH_COUNT 8
258#define MAC_ADDR_COUNT 8
259#define MAC_CHMAP_COUNT 4
260
261
262/* *********************************************************************
263 * DUART Registers
264 ********************************************************************* */
265
266
267#define R_DUART_NUM_PORTS 2
268
269#define A_DUART 0x0010060000
270
271#define A_DUART_REG(r)
272
273#define DUART_CHANREG_SPACING 0x100
274#define A_DUART_CHANREG(chan,reg) (A_DUART + DUART_CHANREG_SPACING*(chan) + (reg))
275#define R_DUART_CHANREG(chan,reg) (DUART_CHANREG_SPACING*(chan) + (reg))
276
277#define R_DUART_MODE_REG_1 0x100
278#define R_DUART_MODE_REG_2 0x110
279#define R_DUART_STATUS 0x120
280#define R_DUART_CLK_SEL 0x130
281#define R_DUART_CMD 0x150
282#define R_DUART_RX_HOLD 0x160
283#define R_DUART_TX_HOLD 0x170
284
285#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
286#define R_DUART_FULL_CTL 0x140
287#define R_DUART_OPCR_X 0x180
288#define R_DUART_AUXCTL_X 0x190
289#endif /* 1250 PASS2 || 112x PASS1 */
290
291
292/*
293 * The IMR and ISR can't be addressed with A_DUART_CHANREG,
294 * so use this macro instead.
295 */
296
297#define R_DUART_AUX_CTRL 0x310
298#define R_DUART_ISR_A 0x320
299#define R_DUART_IMR_A 0x330
300#define R_DUART_ISR_B 0x340
301#define R_DUART_IMR_B 0x350
302#define R_DUART_OUT_PORT 0x360
303#define R_DUART_OPCR 0x370
304
305#define R_DUART_SET_OPR 0x3B0
306#define R_DUART_CLEAR_OPR 0x3C0
307
308#define DUART_IMRISR_SPACING 0x20
309
310#define R_DUART_IMRREG(chan) (R_DUART_IMR_A + (chan)*DUART_IMRISR_SPACING)
311#define R_DUART_ISRREG(chan) (R_DUART_ISR_A + (chan)*DUART_IMRISR_SPACING)
312
313#define A_DUART_IMRREG(chan) (A_DUART + R_DUART_IMRREG(chan))
314#define A_DUART_ISRREG(chan) (A_DUART + R_DUART_ISRREG(chan))
315
316
317
318
319/*
320 * These constants are the absolute addresses.
321 */
322
323#define A_DUART_MODE_REG_1_A 0x0010060100
324#define A_DUART_MODE_REG_2_A 0x0010060110
325#define A_DUART_STATUS_A 0x0010060120
326#define A_DUART_CLK_SEL_A 0x0010060130
327#define A_DUART_CMD_A 0x0010060150
328#define A_DUART_RX_HOLD_A 0x0010060160
329#define A_DUART_TX_HOLD_A 0x0010060170
330
331#define A_DUART_MODE_REG_1_B 0x0010060200
332#define A_DUART_MODE_REG_2_B 0x0010060210
333#define A_DUART_STATUS_B 0x0010060220
334#define A_DUART_CLK_SEL_B 0x0010060230
335#define A_DUART_CMD_B 0x0010060250
336#define A_DUART_RX_HOLD_B 0x0010060260
337#define A_DUART_TX_HOLD_B 0x0010060270
338
339#define A_DUART_INPORT_CHNG 0x0010060300
340#define A_DUART_AUX_CTRL 0x0010060310
341#define A_DUART_ISR_A 0x0010060320
342#define A_DUART_IMR_A 0x0010060330
343#define A_DUART_ISR_B 0x0010060340
344#define A_DUART_IMR_B 0x0010060350
345#define A_DUART_OUT_PORT 0x0010060360
346#define A_DUART_OPCR 0x0010060370
347#define A_DUART_IN_PORT 0x0010060380
348#define A_DUART_ISR 0x0010060390
349#define A_DUART_IMR 0x00100603A0
350#define A_DUART_SET_OPR 0x00100603B0
351#define A_DUART_CLEAR_OPR 0x00100603C0
352#define A_DUART_INPORT_CHNG_A 0x00100603D0
353#define A_DUART_INPORT_CHNG_B 0x00100603E0
354
355#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
356#define A_DUART_FULL_CTL_A 0x0010060140
357#define A_DUART_FULL_CTL_B 0x0010060240
358
359#define A_DUART_OPCR_A 0x0010060180
360#define A_DUART_OPCR_B 0x0010060280
361
362#define A_DUART_INPORT_CHNG_DEBUG 0x00100603F0
363#endif /* 1250 PASS2 || 112x PASS1 */
364
365
366/* *********************************************************************
367 * Synchronous Serial Registers
368 ********************************************************************* */
369
370
371#define A_SER_BASE_0 0x0010060400
372#define A_SER_BASE_1 0x0010060800
373#define SER_SPACING 0x400
374
375#define SER_DMA_TXRX_SPACING 0x80
376
377#define SER_NUM_PORTS 2
378
379#define A_SER_CHANNEL_BASE(sernum) \
380 (A_SER_BASE_0 + \
381 SER_SPACING*(sernum))
382
383#define A_SER_REGISTER(sernum,reg) \
384 (A_SER_BASE_0 + \
385 SER_SPACING*(sernum) + (reg))
386
387
388#define R_SER_DMA_CHANNELS 0 /* Relative to A_SER_BASE_x */
389
390#define A_SER_DMA_CHANNEL_BASE(sernum,txrx) \
391 ((A_SER_CHANNEL_BASE(sernum)) + \
392 R_SER_DMA_CHANNELS + \
393 (SER_DMA_TXRX_SPACING*(txrx)))
394
395#define A_SER_DMA_REGISTER(sernum,txrx,reg) \
396 (A_SER_DMA_CHANNEL_BASE(sernum,txrx) + \
397 (reg))
398
399
400/*
401 * DMA channel registers, relative to A_SER_DMA_CHANNEL_BASE
402 */
403
404#define R_SER_DMA_CONFIG0 0x00000000
405#define R_SER_DMA_CONFIG1 0x00000008
406#define R_SER_DMA_DSCR_BASE 0x00000010
407#define R_SER_DMA_DSCR_CNT 0x00000018
408#define R_SER_DMA_CUR_DSCRA 0x00000020
409#define R_SER_DMA_CUR_DSCRB 0x00000028
410#define R_SER_DMA_CUR_DSCRADDR 0x00000030
411
412#define R_SER_DMA_CONFIG0_RX 0x00000000
413#define R_SER_DMA_CONFIG1_RX 0x00000008
414#define R_SER_DMA_DSCR_BASE_RX 0x00000010
415#define R_SER_DMA_DSCR_COUNT_RX 0x00000018
416#define R_SER_DMA_CUR_DSCR_A_RX 0x00000020
417#define R_SER_DMA_CUR_DSCR_B_RX 0x00000028
418#define R_SER_DMA_CUR_DSCR_ADDR_RX 0x00000030
419
420#define R_SER_DMA_CONFIG0_TX 0x00000080
421#define R_SER_DMA_CONFIG1_TX 0x00000088
422#define R_SER_DMA_DSCR_BASE_TX 0x00000090
423#define R_SER_DMA_DSCR_COUNT_TX 0x00000098
424#define R_SER_DMA_CUR_DSCR_A_TX 0x000000A0
425#define R_SER_DMA_CUR_DSCR_B_TX 0x000000A8
426#define R_SER_DMA_CUR_DSCR_ADDR_TX 0x000000B0
427
428#define R_SER_MODE 0x00000100
429#define R_SER_MINFRM_SZ 0x00000108
430#define R_SER_MAXFRM_SZ 0x00000110
431#define R_SER_ADDR 0x00000118
432#define R_SER_USR0_ADDR 0x00000120
433#define R_SER_USR1_ADDR 0x00000128
434#define R_SER_USR2_ADDR 0x00000130
435#define R_SER_USR3_ADDR 0x00000138
436#define R_SER_CMD 0x00000140
437#define R_SER_TX_RD_THRSH 0x00000160
438#define R_SER_TX_WR_THRSH 0x00000168
439#define R_SER_RX_RD_THRSH 0x00000170
440#define R_SER_LINE_MODE 0x00000178
441#define R_SER_DMA_ENABLE 0x00000180
442#define R_SER_INT_MASK 0x00000190
443#define R_SER_STATUS 0x00000188
444#define R_SER_STATUS_DEBUG 0x000001A8
445#define R_SER_RX_TABLE_BASE 0x00000200
446#define SER_RX_TABLE_COUNT 16
447#define R_SER_TX_TABLE_BASE 0x00000300
448#define SER_TX_TABLE_COUNT 16
449
450/* RMON Counters */
451#define R_SER_RMON_TX_BYTE_LO 0x000001C0
452#define R_SER_RMON_TX_BYTE_HI 0x000001C8
453#define R_SER_RMON_RX_BYTE_LO 0x000001D0
454#define R_SER_RMON_RX_BYTE_HI 0x000001D8
455#define R_SER_RMON_TX_UNDERRUN 0x000001E0
456#define R_SER_RMON_RX_OVERFLOW 0x000001E8
457#define R_SER_RMON_RX_ERRORS 0x000001F0
458#define R_SER_RMON_RX_BADADDR 0x000001F8
459
460/* *********************************************************************
461 * Generic Bus Registers
462 ********************************************************************* */
463
464#define IO_EXT_CFG_COUNT 8
465
466#define A_IO_EXT_BASE 0x0010061000
467#define A_IO_EXT_REG(r) (A_IO_EXT_BASE + (r))
468
469#define A_IO_EXT_CFG_BASE 0x0010061000
470#define A_IO_EXT_MULT_SIZE_BASE 0x0010061100
471#define A_IO_EXT_START_ADDR_BASE 0x0010061200
472#define A_IO_EXT_TIME_CFG0_BASE 0x0010061600
473#define A_IO_EXT_TIME_CFG1_BASE 0x0010061700
474
475#define IO_EXT_REGISTER_SPACING 8
476#define A_IO_EXT_CS_BASE(cs) (A_IO_EXT_CFG_BASE+IO_EXT_REGISTER_SPACING*(cs))
477#define R_IO_EXT_REG(reg,cs) ((cs)*IO_EXT_REGISTER_SPACING + (reg))
478
479#define R_IO_EXT_CFG 0x0000
480#define R_IO_EXT_MULT_SIZE 0x0100
481#define R_IO_EXT_START_ADDR 0x0200
482#define R_IO_EXT_TIME_CFG0 0x0600
483#define R_IO_EXT_TIME_CFG1 0x0700
484
485
486#define A_IO_INTERRUPT_STATUS 0x0010061A00
487#define A_IO_INTERRUPT_DATA0 0x0010061A10
488#define A_IO_INTERRUPT_DATA1 0x0010061A18
489#define A_IO_INTERRUPT_DATA2 0x0010061A20
490#define A_IO_INTERRUPT_DATA3 0x0010061A28
491#define A_IO_INTERRUPT_ADDR0 0x0010061A30
492#define A_IO_INTERRUPT_ADDR1 0x0010061A40
493#define A_IO_INTERRUPT_PARITY 0x0010061A50
494#define A_IO_PCMCIA_CFG 0x0010061A60
495#define A_IO_PCMCIA_STATUS 0x0010061A70
496#define A_IO_DRIVE_0 0x0010061300
497#define A_IO_DRIVE_1 0x0010061308
498#define A_IO_DRIVE_2 0x0010061310
499#define A_IO_DRIVE_3 0x0010061318
500#define A_IO_DRIVE_BASE A_IO_DRIVE_0
501#define IO_DRIVE_REGISTER_SPACING 8
502#define R_IO_DRIVE(x) ((x)*IO_DRIVE_REGISTER_SPACING)
503#define A_IO_DRIVE(x) (A_IO_DRIVE_BASE + R_IO_DRIVE(x))
504
505#define R_IO_INTERRUPT_STATUS 0x0A00
506#define R_IO_INTERRUPT_DATA0 0x0A10
507#define R_IO_INTERRUPT_DATA1 0x0A18
508#define R_IO_INTERRUPT_DATA2 0x0A20
509#define R_IO_INTERRUPT_DATA3 0x0A28
510#define R_IO_INTERRUPT_ADDR0 0x0A30
511#define R_IO_INTERRUPT_ADDR1 0x0A40
512#define R_IO_INTERRUPT_PARITY 0x0A50
513#define R_IO_PCMCIA_CFG 0x0A60
514#define R_IO_PCMCIA_STATUS 0x0A70
515
516/* *********************************************************************
517 * GPIO Registers
518 ********************************************************************* */
519
520#define A_GPIO_CLR_EDGE 0x0010061A80
521#define A_GPIO_INT_TYPE 0x0010061A88
522#define A_GPIO_INPUT_INVERT 0x0010061A90
523#define A_GPIO_GLITCH 0x0010061A98
524#define A_GPIO_READ 0x0010061AA0
525#define A_GPIO_DIRECTION 0x0010061AA8
526#define A_GPIO_PIN_CLR 0x0010061AB0
527#define A_GPIO_PIN_SET 0x0010061AB8
528
529#define A_GPIO_BASE 0x0010061A80
530
531#define R_GPIO_CLR_EDGE 0x00
532#define R_GPIO_INT_TYPE 0x08
533#define R_GPIO_INPUT_INVERT 0x10
534#define R_GPIO_GLITCH 0x18
535#define R_GPIO_READ 0x20
536#define R_GPIO_DIRECTION 0x28
537#define R_GPIO_PIN_CLR 0x30
538#define R_GPIO_PIN_SET 0x38
539
540/* *********************************************************************
541 * SMBus Registers
542 ********************************************************************* */
543
544#define A_SMB_XTRA_0 0x0010060000
545#define A_SMB_XTRA_1 0x0010060008
546#define A_SMB_FREQ_0 0x0010060010
547#define A_SMB_FREQ_1 0x0010060018
548#define A_SMB_STATUS_0 0x0010060020
549#define A_SMB_STATUS_1 0x0010060028
550#define A_SMB_CMD_0 0x0010060030
551#define A_SMB_CMD_1 0x0010060038
552#define A_SMB_START_0 0x0010060040
553#define A_SMB_START_1 0x0010060048
554#define A_SMB_DATA_0 0x0010060050
555#define A_SMB_DATA_1 0x0010060058
556#define A_SMB_CONTROL_0 0x0010060060
557#define A_SMB_CONTROL_1 0x0010060068
558#define A_SMB_PEC_0 0x0010060070
559#define A_SMB_PEC_1 0x0010060078
560
561#define A_SMB_0 0x0010060000
562#define A_SMB_1 0x0010060008
563#define SMB_REGISTER_SPACING 0x8
564#define A_SMB_BASE(idx) (A_SMB_0+(idx)*SMB_REGISTER_SPACING)
565#define A_SMB_REGISTER(idx,reg) (A_SMB_BASE(idx)+(reg))
566
567#define R_SMB_XTRA 0x0000000000
568#define R_SMB_FREQ 0x0000000010
569#define R_SMB_STATUS 0x0000000020
570#define R_SMB_CMD 0x0000000030
571#define R_SMB_START 0x0000000040
572#define R_SMB_DATA 0x0000000050
573#define R_SMB_CONTROL 0x0000000060
574#define R_SMB_PEC 0x0000000070
575
576/* *********************************************************************
577 * Timer Registers
578 ********************************************************************* */
579
580/*
581 * Watchdog timers
582 */
583
584#define A_SCD_WDOG_0 0x0010020050
585#define A_SCD_WDOG_1 0x0010020150
586#define SCD_WDOG_SPACING 0x100
587#define SCD_NUM_WDOGS 2
588#define A_SCD_WDOG_BASE(w) (A_SCD_WDOG_0+SCD_WDOG_SPACING*(w))
589#define A_SCD_WDOG_REGISTER(w,r) (A_SCD_WDOG_BASE(w) + (r))
590
591#define R_SCD_WDOG_INIT 0x0000000000
592#define R_SCD_WDOG_CNT 0x0000000008
593#define R_SCD_WDOG_CFG 0x0000000010
594
595#define A_SCD_WDOG_INIT_0 0x0010020050
596#define A_SCD_WDOG_CNT_0 0x0010020058
597#define A_SCD_WDOG_CFG_0 0x0010020060
598
599#define A_SCD_WDOG_INIT_1 0x0010020150
600#define A_SCD_WDOG_CNT_1 0x0010020158
601#define A_SCD_WDOG_CFG_1 0x0010020160
602
603/*
604 * Generic timers
605 */
606
607#define A_SCD_TIMER_0 0x0010020070
608#define A_SCD_TIMER_1 0x0010020078
609#define A_SCD_TIMER_2 0x0010020170
610#define A_SCD_TIMER_3 0x0010020178
611#define SCD_NUM_TIMERS 4
612#define A_SCD_TIMER_BASE(w) (A_SCD_TIMER_0+0x08*((w)&1)+0x100*(((w)&2)>>1))
613#define A_SCD_TIMER_REGISTER(w,r) (A_SCD_TIMER_BASE(w) + (r))
614
615#define R_SCD_TIMER_INIT 0x0000000000
616#define R_SCD_TIMER_CNT 0x0000000010
617#define R_SCD_TIMER_CFG 0x0000000020
618
619#define A_SCD_TIMER_INIT_0 0x0010020070
620#define A_SCD_TIMER_CNT_0 0x0010020080
621#define A_SCD_TIMER_CFG_0 0x0010020090
622
623#define A_SCD_TIMER_INIT_1 0x0010020078
624#define A_SCD_TIMER_CNT_1 0x0010020088
625#define A_SCD_TIMER_CFG_1 0x0010020098
626
627#define A_SCD_TIMER_INIT_2 0x0010020170
628#define A_SCD_TIMER_CNT_2 0x0010020180
629#define A_SCD_TIMER_CFG_2 0x0010020190
630
631#define A_SCD_TIMER_INIT_3 0x0010020178
632#define A_SCD_TIMER_CNT_3 0x0010020188
633#define A_SCD_TIMER_CFG_3 0x0010020198
634
635#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
636#define A_SCD_SCRATCH 0x0010020C10
637
638#define A_SCD_ZBBUS_CYCLE_COUNT 0x0010030000
639#define A_SCD_ZBBUS_CYCLE_CP0 0x0010020C00
640#define A_SCD_ZBBUS_CYCLE_CP1 0x0010020C08
641#endif /* 1250 PASS2 || 112x PASS1 */
642
643
644/* *********************************************************************
645 * System Control Registers
646 ********************************************************************* */
647
648#define A_SCD_SYSTEM_REVISION 0x0010020000
649#define A_SCD_SYSTEM_CFG 0x0010020008
650#define A_SCD_SYSTEM_MANUF 0x0010038000
651
652/* *********************************************************************
653 * System Address Trap Registers
654 ********************************************************************* */
655
656#define A_ADDR_TRAP_INDEX 0x00100200B0
657#define A_ADDR_TRAP_REG 0x00100200B8
658#define A_ADDR_TRAP_UP_0 0x0010020400
659#define A_ADDR_TRAP_UP_1 0x0010020408
660#define A_ADDR_TRAP_UP_2 0x0010020410
661#define A_ADDR_TRAP_UP_3 0x0010020418
662#define A_ADDR_TRAP_DOWN_0 0x0010020420
663#define A_ADDR_TRAP_DOWN_1 0x0010020428
664#define A_ADDR_TRAP_DOWN_2 0x0010020430
665#define A_ADDR_TRAP_DOWN_3 0x0010020438
666#define A_ADDR_TRAP_CFG_0 0x0010020440
667#define A_ADDR_TRAP_CFG_1 0x0010020448
668#define A_ADDR_TRAP_CFG_2 0x0010020450
669#define A_ADDR_TRAP_CFG_3 0x0010020458
670#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
671#define A_ADDR_TRAP_REG_DEBUG 0x0010020460
672#endif /* 1250 PASS2 || 112x PASS1 */
673
674
675/* *********************************************************************
676 * System Interrupt Mapper Registers
677 ********************************************************************* */
678
679#define A_IMR_CPU0_BASE 0x0010020000
680#define A_IMR_CPU1_BASE 0x0010022000
681#define IMR_REGISTER_SPACING 0x2000
682#define IMR_REGISTER_SPACING_SHIFT 13
683
684#define A_IMR_MAPPER(cpu) (A_IMR_CPU0_BASE+(cpu)*IMR_REGISTER_SPACING)
685#define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg))
686
687#define R_IMR_INTERRUPT_DIAG 0x0010
688#define R_IMR_INTERRUPT_MASK 0x0028
689#define R_IMR_INTERRUPT_TRACE 0x0038
690#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040
691#define R_IMR_LDT_INTERRUPT_SET 0x0048
692#define R_IMR_LDT_INTERRUPT 0x0018
693#define R_IMR_LDT_INTERRUPT_CLR 0x0020
694#define R_IMR_MAILBOX_CPU 0x00c0
695#define R_IMR_ALIAS_MAILBOX_CPU 0x1000
696#define R_IMR_MAILBOX_SET_CPU 0x00C8
697#define R_IMR_ALIAS_MAILBOX_SET_CPU 0x1008
698#define R_IMR_MAILBOX_CLR_CPU 0x00D0
699#define R_IMR_INTERRUPT_STATUS_BASE 0x0100
700#define R_IMR_INTERRUPT_STATUS_COUNT 7
701#define R_IMR_INTERRUPT_MAP_BASE 0x0200
702#define R_IMR_INTERRUPT_MAP_COUNT 64
703
704/* *********************************************************************
705 * System Performance Counter Registers
706 ********************************************************************* */
707
708#define A_SCD_PERF_CNT_CFG 0x00100204C0
709#define A_SCD_PERF_CNT_0 0x00100204D0
710#define A_SCD_PERF_CNT_1 0x00100204D8
711#define A_SCD_PERF_CNT_2 0x00100204E0
712#define A_SCD_PERF_CNT_3 0x00100204E8
713
714/* *********************************************************************
715 * System Bus Watcher Registers
716 ********************************************************************* */
717
718#define A_SCD_BUS_ERR_STATUS 0x0010020880
719#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
720#define A_SCD_BUS_ERR_STATUS_DEBUG 0x00100208D0
721#endif /* 1250 PASS2 || 112x PASS1 */
722#define A_BUS_ERR_DATA_0 0x00100208A0
723#define A_BUS_ERR_DATA_1 0x00100208A8
724#define A_BUS_ERR_DATA_2 0x00100208B0
725#define A_BUS_ERR_DATA_3 0x00100208B8
726#define A_BUS_L2_ERRORS 0x00100208C0
727#define A_BUS_MEM_IO_ERRORS 0x00100208C8
728
729/* *********************************************************************
730 * System Debug Controller Registers
731 ********************************************************************* */
732
733#define A_SCD_JTAG_BASE 0x0010000000
734
735/* *********************************************************************
736 * System Trace Buffer Registers
737 ********************************************************************* */
738
739#define A_SCD_TRACE_CFG 0x0010020A00
740#define A_SCD_TRACE_READ 0x0010020A08
741#define A_SCD_TRACE_EVENT_0 0x0010020A20
742#define A_SCD_TRACE_EVENT_1 0x0010020A28
743#define A_SCD_TRACE_EVENT_2 0x0010020A30
744#define A_SCD_TRACE_EVENT_3 0x0010020A38
745#define A_SCD_TRACE_SEQUENCE_0 0x0010020A40
746#define A_SCD_TRACE_SEQUENCE_1 0x0010020A48
747#define A_SCD_TRACE_SEQUENCE_2 0x0010020A50
748#define A_SCD_TRACE_SEQUENCE_3 0x0010020A58
749#define A_SCD_TRACE_EVENT_4 0x0010020A60
750#define A_SCD_TRACE_EVENT_5 0x0010020A68
751#define A_SCD_TRACE_EVENT_6 0x0010020A70
752#define A_SCD_TRACE_EVENT_7 0x0010020A78
753#define A_SCD_TRACE_SEQUENCE_4 0x0010020A80
754#define A_SCD_TRACE_SEQUENCE_5 0x0010020A88
755#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90
756#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98
757
758/* *********************************************************************
759 * System Generic DMA Registers
760 ********************************************************************* */
761
762#define A_DM_0 0x0010020B00
763#define A_DM_1 0x0010020B20
764#define A_DM_2 0x0010020B40
765#define A_DM_3 0x0010020B60
766#define DM_REGISTER_SPACING 0x20
767#define DM_NUM_CHANNELS 4
768#define A_DM_BASE(idx) (A_DM_0 + ((idx) * DM_REGISTER_SPACING))
769#define A_DM_REGISTER(idx,reg) (A_DM_BASE(idx) + (reg))
770
771#define R_DM_DSCR_BASE 0x0000000000
772#define R_DM_DSCR_COUNT 0x0000000008
773#define R_DM_CUR_DSCR_ADDR 0x0000000010
774#define R_DM_DSCR_BASE_DEBUG 0x0000000018
775
776#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
777#define A_DM_PARTIAL_0 0x0010020ba0
778#define A_DM_PARTIAL_1 0x0010020ba8
779#define A_DM_PARTIAL_2 0x0010020bb0
780#define A_DM_PARTIAL_3 0x0010020bb8
781#define DM_PARTIAL_REGISTER_SPACING 0x8
782#define A_DM_PARTIAL(idx) (A_DM_PARTIAL_0 + ((idx) * DM_PARTIAL_REGISTER_SPACING))
783#endif /* 1250 PASS3 || 112x PASS1 */
784
785#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
786#define A_DM_CRC_0 0x0010020b80
787#define A_DM_CRC_1 0x0010020b90
788#define DM_CRC_REGISTER_SPACING 0x10
789#define DM_CRC_NUM_CHANNELS 2
790#define A_DM_CRC_BASE(idx) (A_DM_CRC_0 + ((idx) * DM_CRC_REGISTER_SPACING))
791#define A_DM_CRC_REGISTER(idx,reg) (A_DM_CRC_BASE(idx) + (reg))
792
793#define R_CRC_DEF_0 0x00
794#define R_CTCP_DEF_0 0x08
795#endif /* 1250 PASS3 || 112x PASS1 */
796
797/* *********************************************************************
798 * Physical Address Map
799 ********************************************************************* */
800
801#define A_PHYS_MEMORY_0 _SB_MAKE64(0x0000000000)
802#define A_PHYS_MEMORY_SIZE _SB_MAKE64((256*1024*1024))
803#define A_PHYS_SYSTEM_CTL _SB_MAKE64(0x0010000000)
804#define A_PHYS_IO_SYSTEM _SB_MAKE64(0x0010060000)
805#define A_PHYS_GENBUS _SB_MAKE64(0x0010090000)
806#define A_PHYS_GENBUS_END _SB_MAKE64(0x0040000000)
807#define A_PHYS_LDTPCI_IO_MATCH_BYTES_32 _SB_MAKE64(0x0040000000)
808#define A_PHYS_LDTPCI_IO_MATCH_BITS_32 _SB_MAKE64(0x0060000000)
809#define A_PHYS_MEMORY_1 _SB_MAKE64(0x0080000000)
810#define A_PHYS_MEMORY_2 _SB_MAKE64(0x0090000000)
811#define A_PHYS_MEMORY_3 _SB_MAKE64(0x00C0000000)
812#define A_PHYS_L2_CACHE_TEST _SB_MAKE64(0x00D0000000)
813#define A_PHYS_LDT_SPECIAL_MATCH_BYTES _SB_MAKE64(0x00D8000000)
814#define A_PHYS_LDTPCI_IO_MATCH_BYTES _SB_MAKE64(0x00DC000000)
815#define A_PHYS_LDTPCI_CFG_MATCH_BYTES _SB_MAKE64(0x00DE000000)
816#define A_PHYS_LDT_SPECIAL_MATCH_BITS _SB_MAKE64(0x00F8000000)
817#define A_PHYS_LDTPCI_IO_MATCH_BITS _SB_MAKE64(0x00FC000000)
818#define A_PHYS_LDTPCI_CFG_MATCH_BITS _SB_MAKE64(0x00FE000000)
819#define A_PHYS_MEMORY_EXP _SB_MAKE64(0x0100000000)
820#define A_PHYS_MEMORY_EXP_SIZE _SB_MAKE64((508*1024*1024*1024))
821#define A_PHYS_LDT_EXP _SB_MAKE64(0x8000000000)
822#define A_PHYS_PCI_FULLACCESS_BYTES _SB_MAKE64(0xF000000000)
823#define A_PHYS_PCI_FULLACCESS_BITS _SB_MAKE64(0xF100000000)
824#define A_PHYS_RESERVED _SB_MAKE64(0xF200000000)
825#define A_PHYS_RESERVED_SPECIAL_LDT _SB_MAKE64(0xFD00000000)
826
827#define A_PHYS_L2CACHE_WAY_SIZE _SB_MAKE64(0x0000020000)
828#define PHYS_L2CACHE_NUM_WAYS 4
829#define A_PHYS_L2CACHE_TOTAL_SIZE _SB_MAKE64(0x0000080000)
830#define A_PHYS_L2CACHE_WAY0 _SB_MAKE64(0x00D0180000)
831#define A_PHYS_L2CACHE_WAY1 _SB_MAKE64(0x00D01A0000)
832#define A_PHYS_L2CACHE_WAY2 _SB_MAKE64(0x00D01C0000)
833#define A_PHYS_L2CACHE_WAY3 _SB_MAKE64(0x00D01E0000)
834
835
836#endif
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
new file mode 100644
index 000000000000..22e8041959e2
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_scd.h
@@ -0,0 +1,582 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * SCD Constants and Macros File: sb1250_scd.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the System Control and Debug module on the 1250.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34#ifndef _SB1250_SCD_H
35#define _SB1250_SCD_H
36
37#include "sb1250_defs.h"
38
39/* *********************************************************************
40 * System control/debug registers
41 ********************************************************************* */
42
43/*
44 * System Revision Register (Table 4-1)
45 */
46
47#define M_SYS_RESERVED _SB_MAKEMASK(8,0)
48
49#define S_SYS_REVISION _SB_MAKE64(8)
50#define M_SYS_REVISION _SB_MAKEMASK(8,S_SYS_REVISION)
51#define V_SYS_REVISION(x) _SB_MAKEVALUE(x,S_SYS_REVISION)
52#define G_SYS_REVISION(x) _SB_GETVALUE(x,S_SYS_REVISION,M_SYS_REVISION)
53
54#if SIBYTE_HDR_FEATURE_CHIP(1250)
55#define K_SYS_REVISION_BCM1250_PASS1 1
56#define K_SYS_REVISION_BCM1250_PASS2 3
57#define K_SYS_REVISION_BCM1250_A10 11
58#define K_SYS_REVISION_BCM1250_PASS2_2 16
59#define K_SYS_REVISION_BCM1250_B2 17
60#define K_SYS_REVISION_BCM1250_PASS3 32
61#define K_SYS_REVISION_BCM1250_C1 33
62
63/* XXX: discourage people from using these constants. */
64#define K_SYS_REVISION_PASS1 K_SYS_REVISION_BCM1250_PASS1
65#define K_SYS_REVISION_PASS2 K_SYS_REVISION_BCM1250_PASS2
66#define K_SYS_REVISION_PASS2_2 K_SYS_REVISION_BCM1250_PASS2_2
67#define K_SYS_REVISION_PASS3 K_SYS_REVISION_BCM1250_PASS3
68#endif /* 1250 */
69
70#if SIBYTE_HDR_FEATURE_CHIP(112x)
71#define K_SYS_REVISION_BCM112x_A1 32
72#define K_SYS_REVISION_BCM112x_A2 33
73#endif /* 112x */
74
75/* XXX: discourage people from using these constants. */
76#define S_SYS_PART _SB_MAKE64(16)
77#define M_SYS_PART _SB_MAKEMASK(16,S_SYS_PART)
78#define V_SYS_PART(x) _SB_MAKEVALUE(x,S_SYS_PART)
79#define G_SYS_PART(x) _SB_GETVALUE(x,S_SYS_PART,M_SYS_PART)
80
81/* XXX: discourage people from using these constants. */
82#define K_SYS_PART_SB1250 0x1250
83#define K_SYS_PART_BCM1120 0x1121
84#define K_SYS_PART_BCM1125 0x1123
85#define K_SYS_PART_BCM1125H 0x1124
86
87/* The "peripheral set" (SOC type) is the low 4 bits of the "part" field. */
88#define S_SYS_SOC_TYPE _SB_MAKE64(16)
89#define M_SYS_SOC_TYPE _SB_MAKEMASK(4,S_SYS_SOC_TYPE)
90#define V_SYS_SOC_TYPE(x) _SB_MAKEVALUE(x,S_SYS_SOC_TYPE)
91#define G_SYS_SOC_TYPE(x) _SB_GETVALUE(x,S_SYS_SOC_TYPE,M_SYS_SOC_TYPE)
92
93#define K_SYS_SOC_TYPE_BCM1250 0x0
94#define K_SYS_SOC_TYPE_BCM1120 0x1
95#define K_SYS_SOC_TYPE_BCM1250_ALT 0x2 /* 1250pass2 w/ 1/4 L2. */
96#define K_SYS_SOC_TYPE_BCM1125 0x3
97#define K_SYS_SOC_TYPE_BCM1125H 0x4
98#define K_SYS_SOC_TYPE_BCM1250_ALT2 0x5 /* 1250pass2 w/ 1/2 L2. */
99
100/*
101 * Calculate correct SOC type given a copy of system revision register.
102 *
103 * (For the assembler version, sysrev and dest may be the same register.
104 * Also, it clobbers AT.)
105 */
106#ifdef __ASSEMBLER__
107#define SYS_SOC_TYPE(dest, sysrev) \
108 .set push ; \
109 .set reorder ; \
110 dsrl dest, sysrev, S_SYS_SOC_TYPE ; \
111 andi dest, dest, (M_SYS_SOC_TYPE >> S_SYS_SOC_TYPE); \
112 beq dest, K_SYS_SOC_TYPE_BCM1250_ALT, 991f ; \
113 beq dest, K_SYS_SOC_TYPE_BCM1250_ALT2, 991f ; \
114 b 992f ; \
115991: li dest, K_SYS_SOC_TYPE_BCM1250 ; \
116992: \
117 .set pop
118#else
119#define SYS_SOC_TYPE(sysrev) \
120 ((G_SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250_ALT \
121 || G_SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250_ALT2) \
122 ? K_SYS_SOC_TYPE_BCM1250 : G_SYS_SOC_TYPE(sysrev))
123#endif
124
125#define S_SYS_WID _SB_MAKE64(32)
126#define M_SYS_WID _SB_MAKEMASK(32,S_SYS_WID)
127#define V_SYS_WID(x) _SB_MAKEVALUE(x,S_SYS_WID)
128#define G_SYS_WID(x) _SB_GETVALUE(x,S_SYS_WID,M_SYS_WID)
129
130/* System Manufacturing Register
131* Register: SCD_SYSTEM_MANUF
132*/
133
134/* Wafer ID: bits 31:0 */
135#define S_SYS_WAFERID1_200 _SB_MAKE64(0)
136#define M_SYS_WAFERID1_200 _SB_MAKEMASK(32,S_SYS_WAFERID1_200)
137#define V_SYS_WAFERID1_200(x) _SB_MAKEVALUE(x,S_SYS_WAFERID1_200)
138#define G_SYS_WAFERID1_200(x) _SB_GETVALUE(x,S_SYS_WAFERID1_200,M_SYS_WAFERID1_200)
139
140#define S_SYS_BIN _SB_MAKE64(32)
141#define M_SYS_BIN _SB_MAKEMASK(4,S_SYS_BIN)
142#define V_SYS_BIN _SB_MAKEVALUE(x,S_SYS_BIN)
143#define G_SYS_BIN _SB_GETVALUE(x,S_SYS_BIN,M_SYS_BIN)
144
145/* Wafer ID: bits 39:36 */
146#define S_SYS_WAFERID2_200 _SB_MAKE64(36)
147#define M_SYS_WAFERID2_200 _SB_MAKEMASK(4,S_SYS_WAFERID2_200)
148#define V_SYS_WAFERID2_200(x) _SB_MAKEVALUE(x,S_SYS_WAFERID2_200)
149#define G_SYS_WAFERID2_200(x) _SB_GETVALUE(x,S_SYS_WAFERID2_200,M_SYS_WAFERID2_200)
150
151/* Wafer ID: bits 39:0 */
152#define S_SYS_WAFERID_300 _SB_MAKE64(0)
153#define M_SYS_WAFERID_300 _SB_MAKEMASK(40,S_SYS_WAFERID_300)
154#define V_SYS_WAFERID_300(x) _SB_MAKEVALUE(x,S_SYS_WAFERID_300)
155#define G_SYS_WAFERID_300(x) _SB_GETVALUE(x,S_SYS_WAFERID_300,M_SYS_WAFERID_300)
156
157#define S_SYS_XPOS _SB_MAKE64(40)
158#define M_SYS_XPOS _SB_MAKEMASK(6,S_SYS_XPOS)
159#define V_SYS_XPOS(x) _SB_MAKEVALUE(x,S_SYS_XPOS)
160#define G_SYS_XPOS(x) _SB_GETVALUE(x,S_SYS_XPOS,M_SYS_XPOS)
161
162#define S_SYS_YPOS _SB_MAKE64(46)
163#define M_SYS_YPOS _SB_MAKEMASK(6,S_SYS_YPOS)
164#define V_SYS_YPOS(x) _SB_MAKEVALUE(x,S_SYS_YPOS)
165#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS)
166
167/*
168 * System Config Register (Table 4-2)
169 * Register: SCD_SYSTEM_CFG
170 */
171
172#define M_SYS_LDT_PLL_BYP _SB_MAKEMASK1(3)
173#define M_SYS_PCI_SYNC_TEST_MODE _SB_MAKEMASK1(4)
174#define M_SYS_IOB0_DIV _SB_MAKEMASK1(5)
175#define M_SYS_IOB1_DIV _SB_MAKEMASK1(6)
176
177#define S_SYS_PLL_DIV _SB_MAKE64(7)
178#define M_SYS_PLL_DIV _SB_MAKEMASK(5,S_SYS_PLL_DIV)
179#define V_SYS_PLL_DIV(x) _SB_MAKEVALUE(x,S_SYS_PLL_DIV)
180#define G_SYS_PLL_DIV(x) _SB_GETVALUE(x,S_SYS_PLL_DIV,M_SYS_PLL_DIV)
181
182#define M_SYS_SER0_ENABLE _SB_MAKEMASK1(12)
183#define M_SYS_SER0_RSTB_EN _SB_MAKEMASK1(13)
184#define M_SYS_SER1_ENABLE _SB_MAKEMASK1(14)
185#define M_SYS_SER1_RSTB_EN _SB_MAKEMASK1(15)
186#define M_SYS_PCMCIA_ENABLE _SB_MAKEMASK1(16)
187
188#define S_SYS_BOOT_MODE _SB_MAKE64(17)
189#define M_SYS_BOOT_MODE _SB_MAKEMASK(2,S_SYS_BOOT_MODE)
190#define V_SYS_BOOT_MODE(x) _SB_MAKEVALUE(x,S_SYS_BOOT_MODE)
191#define G_SYS_BOOT_MODE(x) _SB_GETVALUE(x,S_SYS_BOOT_MODE,M_SYS_BOOT_MODE)
192#define K_SYS_BOOT_MODE_ROM32 0
193#define K_SYS_BOOT_MODE_ROM8 1
194#define K_SYS_BOOT_MODE_SMBUS_SMALL 2
195#define K_SYS_BOOT_MODE_SMBUS_BIG 3
196
197#define M_SYS_PCI_HOST _SB_MAKEMASK1(19)
198#define M_SYS_PCI_ARBITER _SB_MAKEMASK1(20)
199#define M_SYS_SOUTH_ON_LDT _SB_MAKEMASK1(21)
200#define M_SYS_BIG_ENDIAN _SB_MAKEMASK1(22)
201#define M_SYS_GENCLK_EN _SB_MAKEMASK1(23)
202#define M_SYS_LDT_TEST_EN _SB_MAKEMASK1(24)
203#define M_SYS_GEN_PARITY_EN _SB_MAKEMASK1(25)
204
205#define S_SYS_CONFIG 26
206#define M_SYS_CONFIG _SB_MAKEMASK(6,S_SYS_CONFIG)
207#define V_SYS_CONFIG(x) _SB_MAKEVALUE(x,S_SYS_CONFIG)
208#define G_SYS_CONFIG(x) _SB_GETVALUE(x,S_SYS_CONFIG,M_SYS_CONFIG)
209
210/* The following bits are writeable by JTAG only. */
211
212#define M_SYS_CLKSTOP _SB_MAKEMASK1(32)
213#define M_SYS_CLKSTEP _SB_MAKEMASK1(33)
214
215#define S_SYS_CLKCOUNT 34
216#define M_SYS_CLKCOUNT _SB_MAKEMASK(8,S_SYS_CLKCOUNT)
217#define V_SYS_CLKCOUNT(x) _SB_MAKEVALUE(x,S_SYS_CLKCOUNT)
218#define G_SYS_CLKCOUNT(x) _SB_GETVALUE(x,S_SYS_CLKCOUNT,M_SYS_CLKCOUNT)
219
220#define M_SYS_PLL_BYPASS _SB_MAKEMASK1(42)
221
222#define S_SYS_PLL_IREF 43
223#define M_SYS_PLL_IREF _SB_MAKEMASK(2,S_SYS_PLL_IREF)
224
225#define S_SYS_PLL_VCO 45
226#define M_SYS_PLL_VCO _SB_MAKEMASK(2,S_SYS_PLL_VCO)
227
228#define S_SYS_PLL_VREG 47
229#define M_SYS_PLL_VREG _SB_MAKEMASK(2,S_SYS_PLL_VREG)
230
231#define M_SYS_MEM_RESET _SB_MAKEMASK1(49)
232#define M_SYS_L2C_RESET _SB_MAKEMASK1(50)
233#define M_SYS_IO_RESET_0 _SB_MAKEMASK1(51)
234#define M_SYS_IO_RESET_1 _SB_MAKEMASK1(52)
235#define M_SYS_SCD_RESET _SB_MAKEMASK1(53)
236
237/* End of bits writable by JTAG only. */
238
239#define M_SYS_CPU_RESET_0 _SB_MAKEMASK1(54)
240#define M_SYS_CPU_RESET_1 _SB_MAKEMASK1(55)
241
242#define M_SYS_UNICPU0 _SB_MAKEMASK1(56)
243#define M_SYS_UNICPU1 _SB_MAKEMASK1(57)
244
245#define M_SYS_SB_SOFTRES _SB_MAKEMASK1(58)
246#define M_SYS_EXT_RESET _SB_MAKEMASK1(59)
247#define M_SYS_SYSTEM_RESET _SB_MAKEMASK1(60)
248
249#define M_SYS_MISR_MODE _SB_MAKEMASK1(61)
250#define M_SYS_MISR_RESET _SB_MAKEMASK1(62)
251
252#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
253#define M_SYS_SW_FLAG _SB_MAKEMASK1(63)
254#endif /* 1250 PASS2 || 112x PASS1 */
255
256
257/*
258 * Mailbox Registers (Table 4-3)
259 * Registers: SCD_MBOX_CPU_x
260 */
261
262#define S_MBOX_INT_3 0
263#define M_MBOX_INT_3 _SB_MAKEMASK(16,S_MBOX_INT_3)
264#define S_MBOX_INT_2 16
265#define M_MBOX_INT_2 _SB_MAKEMASK(16,S_MBOX_INT_2)
266#define S_MBOX_INT_1 32
267#define M_MBOX_INT_1 _SB_MAKEMASK(16,S_MBOX_INT_1)
268#define S_MBOX_INT_0 48
269#define M_MBOX_INT_0 _SB_MAKEMASK(16,S_MBOX_INT_0)
270
271/*
272 * Watchdog Registers (Table 4-8) (Table 4-9) (Table 4-10)
273 * Registers: SCD_WDOG_INIT_CNT_x
274 */
275
276#define V_SCD_WDOG_FREQ 1000000
277
278#define S_SCD_WDOG_INIT 0
279#define M_SCD_WDOG_INIT _SB_MAKEMASK(23,S_SCD_WDOG_INIT)
280
281#define S_SCD_WDOG_CNT 0
282#define M_SCD_WDOG_CNT _SB_MAKEMASK(23,S_SCD_WDOG_CNT)
283
284#define S_SCD_WDOG_ENABLE 0
285#define M_SCD_WDOG_ENABLE _SB_MAKEMASK1(S_SCD_WDOG_ENABLE)
286
287#define S_SCD_WDOG_RESET_TYPE 2
288#define M_SCD_WDOG_RESET_TYPE _SB_MAKEMASK(3,S_SCD_WDOG_RESET_TYPE)
289#define V_SCD_WDOG_RESET_TYPE(x) _SB_MAKEVALUE(x,S_SCD_WDOG_RESET_TYPE)
290#define G_SCD_WDOG_RESET_TYPE(x) _SB_GETVALUE(x,S_SCD_WDOG_RESET_TYPE,M_SCD_WDOG_RESET_TYPE)
291
292#define K_SCD_WDOG_RESET_FULL 0 /* actually, (x & 1) == 0 */
293#define K_SCD_WDOG_RESET_SOFT 1
294#define K_SCD_WDOG_RESET_CPU0 3
295#define K_SCD_WDOG_RESET_CPU1 5
296#define K_SCD_WDOG_RESET_BOTH_CPUS 7
297
298/* This feature is present in 1250 C0 and later, but *not* in 112x A revs. */
299#if SIBYTE_HDR_FEATURE(1250, PASS3)
300#define S_SCD_WDOG_HAS_RESET 8
301#define M_SCD_WDOG_HAS_RESET _SB_MAKEMASK1(S_SCD_WDOG_HAS_RESET)
302#endif
303
304
305/*
306 * Timer Registers (Table 4-11) (Table 4-12) (Table 4-13)
307 */
308
309#define V_SCD_TIMER_FREQ 1000000
310
311#define S_SCD_TIMER_INIT 0
312#define M_SCD_TIMER_INIT _SB_MAKEMASK(20,S_SCD_TIMER_INIT)
313#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT)
314#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT)
315
316#define S_SCD_TIMER_CNT 0
317#define M_SCD_TIMER_CNT _SB_MAKEMASK(20,S_SCD_TIMER_CNT)
318#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT)
319#define G_SCD_TIMER_CNT(x) _SB_GETVALUE(x,S_SCD_TIMER_CNT,M_SCD_TIMER_CNT)
320
321#define M_SCD_TIMER_ENABLE _SB_MAKEMASK1(0)
322#define M_SCD_TIMER_MODE _SB_MAKEMASK1(1)
323#define M_SCD_TIMER_MODE_CONTINUOUS M_SCD_TIMER_MODE
324
325/*
326 * System Performance Counters
327 */
328
329#define S_SPC_CFG_SRC0 0
330#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0)
331#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0)
332#define G_SPC_CFG_SRC0(x) _SB_GETVALUE(x,S_SPC_CFG_SRC0,M_SPC_CFG_SRC0)
333
334#define S_SPC_CFG_SRC1 8
335#define M_SPC_CFG_SRC1 _SB_MAKEMASK(8,S_SPC_CFG_SRC1)
336#define V_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC1)
337#define G_SPC_CFG_SRC1(x) _SB_GETVALUE(x,S_SPC_CFG_SRC1,M_SPC_CFG_SRC1)
338
339#define S_SPC_CFG_SRC2 16
340#define M_SPC_CFG_SRC2 _SB_MAKEMASK(8,S_SPC_CFG_SRC2)
341#define V_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC2)
342#define G_SPC_CFG_SRC2(x) _SB_GETVALUE(x,S_SPC_CFG_SRC2,M_SPC_CFG_SRC2)
343
344#define S_SPC_CFG_SRC3 24
345#define M_SPC_CFG_SRC3 _SB_MAKEMASK(8,S_SPC_CFG_SRC3)
346#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3)
347#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3)
348
349#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32)
350#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33)
351
352
353/*
354 * Bus Watcher
355 */
356
357#define S_SCD_BERR_TID 8
358#define M_SCD_BERR_TID _SB_MAKEMASK(10,S_SCD_BERR_TID)
359#define V_SCD_BERR_TID(x) _SB_MAKEVALUE(x,S_SCD_BERR_TID)
360#define G_SCD_BERR_TID(x) _SB_GETVALUE(x,S_SCD_BERR_TID,M_SCD_BERR_TID)
361
362#define S_SCD_BERR_RID 18
363#define M_SCD_BERR_RID _SB_MAKEMASK(4,S_SCD_BERR_RID)
364#define V_SCD_BERR_RID(x) _SB_MAKEVALUE(x,S_SCD_BERR_RID)
365#define G_SCD_BERR_RID(x) _SB_GETVALUE(x,S_SCD_BERR_RID,M_SCD_BERR_RID)
366
367#define S_SCD_BERR_DCODE 22
368#define M_SCD_BERR_DCODE _SB_MAKEMASK(3,S_SCD_BERR_DCODE)
369#define V_SCD_BERR_DCODE(x) _SB_MAKEVALUE(x,S_SCD_BERR_DCODE)
370#define G_SCD_BERR_DCODE(x) _SB_GETVALUE(x,S_SCD_BERR_DCODE,M_SCD_BERR_DCODE)
371
372#define M_SCD_BERR_MULTERRS _SB_MAKEMASK1(30)
373
374
375#define S_SCD_L2ECC_CORR_D 0
376#define M_SCD_L2ECC_CORR_D _SB_MAKEMASK(8,S_SCD_L2ECC_CORR_D)
377#define V_SCD_L2ECC_CORR_D(x) _SB_MAKEVALUE(x,S_SCD_L2ECC_CORR_D)
378#define G_SCD_L2ECC_CORR_D(x) _SB_GETVALUE(x,S_SCD_L2ECC_CORR_D,M_SCD_L2ECC_CORR_D)
379
380#define S_SCD_L2ECC_BAD_D 8
381#define M_SCD_L2ECC_BAD_D _SB_MAKEMASK(8,S_SCD_L2ECC_BAD_D)
382#define V_SCD_L2ECC_BAD_D(x) _SB_MAKEVALUE(x,S_SCD_L2ECC_BAD_D)
383#define G_SCD_L2ECC_BAD_D(x) _SB_GETVALUE(x,S_SCD_L2ECC_BAD_D,M_SCD_L2ECC_BAD_D)
384
385#define S_SCD_L2ECC_CORR_T 16
386#define M_SCD_L2ECC_CORR_T _SB_MAKEMASK(8,S_SCD_L2ECC_CORR_T)
387#define V_SCD_L2ECC_CORR_T(x) _SB_MAKEVALUE(x,S_SCD_L2ECC_CORR_T)
388#define G_SCD_L2ECC_CORR_T(x) _SB_GETVALUE(x,S_SCD_L2ECC_CORR_T,M_SCD_L2ECC_CORR_T)
389
390#define S_SCD_L2ECC_BAD_T 24
391#define M_SCD_L2ECC_BAD_T _SB_MAKEMASK(8,S_SCD_L2ECC_BAD_T)
392#define V_SCD_L2ECC_BAD_T(x) _SB_MAKEVALUE(x,S_SCD_L2ECC_BAD_T)
393#define G_SCD_L2ECC_BAD_T(x) _SB_GETVALUE(x,S_SCD_L2ECC_BAD_T,M_SCD_L2ECC_BAD_T)
394
395#define S_SCD_MEM_ECC_CORR 0
396#define M_SCD_MEM_ECC_CORR _SB_MAKEMASK(8,S_SCD_MEM_ECC_CORR)
397#define V_SCD_MEM_ECC_CORR(x) _SB_MAKEVALUE(x,S_SCD_MEM_ECC_CORR)
398#define G_SCD_MEM_ECC_CORR(x) _SB_GETVALUE(x,S_SCD_MEM_ECC_CORR,M_SCD_MEM_ECC_CORR)
399
400#define S_SCD_MEM_ECC_BAD 8
401#define M_SCD_MEM_ECC_BAD _SB_MAKEMASK(8,S_SCD_MEM_ECC_BAD)
402#define V_SCD_MEM_ECC_BAD(x) _SB_MAKEVALUE(x,S_SCD_MEM_ECC_BAD)
403#define G_SCD_MEM_ECC_BAD(x) _SB_GETVALUE(x,S_SCD_MEM_ECC_BAD,M_SCD_MEM_ECC_BAD)
404
405#define S_SCD_MEM_BUSERR 16
406#define M_SCD_MEM_BUSERR _SB_MAKEMASK(8,S_SCD_MEM_BUSERR)
407#define V_SCD_MEM_BUSERR(x) _SB_MAKEVALUE(x,S_SCD_MEM_BUSERR)
408#define G_SCD_MEM_BUSERR(x) _SB_GETVALUE(x,S_SCD_MEM_BUSERR,M_SCD_MEM_BUSERR)
409
410
411/*
412 * Address Trap Registers
413 */
414
415#define M_ATRAP_INDEX _SB_MAKEMASK(4,0)
416#define M_ATRAP_ADDRESS _SB_MAKEMASK(40,0)
417
418#define S_ATRAP_CFG_CNT 0
419#define M_ATRAP_CFG_CNT _SB_MAKEMASK(3,S_ATRAP_CFG_CNT)
420#define V_ATRAP_CFG_CNT(x) _SB_MAKEVALUE(x,S_ATRAP_CFG_CNT)
421#define G_ATRAP_CFG_CNT(x) _SB_GETVALUE(x,S_ATRAP_CFG_CNT,M_ATRAP_CFG_CNT)
422
423#define M_ATRAP_CFG_WRITE _SB_MAKEMASK1(3)
424#define M_ATRAP_CFG_ALL _SB_MAKEMASK1(4)
425#define M_ATRAP_CFG_INV _SB_MAKEMASK1(5)
426#define M_ATRAP_CFG_USESRC _SB_MAKEMASK1(6)
427#define M_ATRAP_CFG_SRCINV _SB_MAKEMASK1(7)
428
429#define S_ATRAP_CFG_AGENTID 8
430#define M_ATRAP_CFG_AGENTID _SB_MAKEMASK(4,S_ATRAP_CFG_AGENTID)
431#define V_ATRAP_CFG_AGENTID(x) _SB_MAKEVALUE(x,S_ATRAP_CFG_AGENTID)
432#define G_ATRAP_CFG_AGENTID(x) _SB_GETVALUE(x,S_ATRAP_CFG_AGENTID,M_ATRAP_CFG_AGENTID)
433
434#define K_BUS_AGENT_CPU0 0
435#define K_BUS_AGENT_CPU1 1
436#define K_BUS_AGENT_IOB0 2
437#define K_BUS_AGENT_IOB1 3
438#define K_BUS_AGENT_SCD 4
439#define K_BUS_AGENT_RESERVED 5
440#define K_BUS_AGENT_L2C 6
441#define K_BUS_AGENT_MC 7
442
443#define S_ATRAP_CFG_CATTR 12
444#define M_ATRAP_CFG_CATTR _SB_MAKEMASK(3,S_ATRAP_CFG_CATTR)
445#define V_ATRAP_CFG_CATTR(x) _SB_MAKEVALUE(x,S_ATRAP_CFG_CATTR)
446#define G_ATRAP_CFG_CATTR(x) _SB_GETVALUE(x,S_ATRAP_CFG_CATTR,M_ATRAP_CFG_CATTR)
447
448#define K_ATRAP_CFG_CATTR_IGNORE 0
449#define K_ATRAP_CFG_CATTR_UNC 1
450#define K_ATRAP_CFG_CATTR_CACHEABLE 2
451#define K_ATRAP_CFG_CATTR_NONCOH 3
452#define K_ATRAP_CFG_CATTR_COHERENT 4
453#define K_ATRAP_CFG_CATTR_NOTUNC 5
454#define K_ATRAP_CFG_CATTR_NOTNONCOH 6
455#define K_ATRAP_CFG_CATTR_NOTCOHERENT 7
456
457/*
458 * Trace Buffer Config register
459 */
460
461#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
462#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
463#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
464#define M_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3)
465#define M_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4)
466#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
467#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
468#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
469#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
470#define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8)
471#endif /* 1250 PASS2 || 112x PASS1 */
472
473#define S_SCD_TRACE_CFG_CUR_ADDR 10
474#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR)
475#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR)
476#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR)
477
478/*
479 * Trace Event registers
480 */
481
482#define S_SCD_TREVT_ADDR_MATCH 0
483#define M_SCD_TREVT_ADDR_MATCH _SB_MAKEMASK(4,S_SCD_TREVT_ADDR_MATCH)
484#define V_SCD_TREVT_ADDR_MATCH(x) _SB_MAKEVALUE(x,S_SCD_TREVT_ADDR_MATCH)
485#define G_SCD_TREVT_ADDR_MATCH(x) _SB_GETVALUE(x,S_SCD_TREVT_ADDR_MATCH,M_SCD_TREVT_ADDR_MATCH)
486
487#define M_SCD_TREVT_REQID_MATCH _SB_MAKEMASK1(4)
488#define M_SCD_TREVT_DATAID_MATCH _SB_MAKEMASK1(5)
489#define M_SCD_TREVT_RESPID_MATCH _SB_MAKEMASK1(6)
490#define M_SCD_TREVT_INTERRUPT _SB_MAKEMASK1(7)
491#define M_SCD_TREVT_DEBUG_PIN _SB_MAKEMASK1(9)
492#define M_SCD_TREVT_WRITE _SB_MAKEMASK1(10)
493#define M_SCD_TREVT_READ _SB_MAKEMASK1(11)
494
495#define S_SCD_TREVT_REQID 12
496#define M_SCD_TREVT_REQID _SB_MAKEMASK(4,S_SCD_TREVT_REQID)
497#define V_SCD_TREVT_REQID(x) _SB_MAKEVALUE(x,S_SCD_TREVT_REQID)
498#define G_SCD_TREVT_REQID(x) _SB_GETVALUE(x,S_SCD_TREVT_REQID,M_SCD_TREVT_REQID)
499
500#define S_SCD_TREVT_RESPID 16
501#define M_SCD_TREVT_RESPID _SB_MAKEMASK(4,S_SCD_TREVT_RESPID)
502#define V_SCD_TREVT_RESPID(x) _SB_MAKEVALUE(x,S_SCD_TREVT_RESPID)
503#define G_SCD_TREVT_RESPID(x) _SB_GETVALUE(x,S_SCD_TREVT_RESPID,M_SCD_TREVT_RESPID)
504
505#define S_SCD_TREVT_DATAID 20
506#define M_SCD_TREVT_DATAID _SB_MAKEMASK(4,S_SCD_TREVT_DATAID)
507#define V_SCD_TREVT_DATAID(x) _SB_MAKEVALUE(x,S_SCD_TREVT_DATAID)
508#define G_SCD_TREVT_DATAID(x) _SB_GETVALUE(x,S_SCD_TREVT_DATAID,M_SCD_TREVT_DATID)
509
510#define S_SCD_TREVT_COUNT 24
511#define M_SCD_TREVT_COUNT _SB_MAKEMASK(8,S_SCD_TREVT_COUNT)
512#define V_SCD_TREVT_COUNT(x) _SB_MAKEVALUE(x,S_SCD_TREVT_COUNT)
513#define G_SCD_TREVT_COUNT(x) _SB_GETVALUE(x,S_SCD_TREVT_COUNT,M_SCD_TREVT_COUNT)
514
515/*
516 * Trace Sequence registers
517 */
518
519#define S_SCD_TRSEQ_EVENT4 0
520#define M_SCD_TRSEQ_EVENT4 _SB_MAKEMASK(4,S_SCD_TRSEQ_EVENT4)
521#define V_SCD_TRSEQ_EVENT4(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_EVENT4)
522#define G_SCD_TRSEQ_EVENT4(x) _SB_GETVALUE(x,S_SCD_TRSEQ_EVENT4,M_SCD_TRSEQ_EVENT4)
523
524#define S_SCD_TRSEQ_EVENT3 4
525#define M_SCD_TRSEQ_EVENT3 _SB_MAKEMASK(4,S_SCD_TRSEQ_EVENT3)
526#define V_SCD_TRSEQ_EVENT3(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_EVENT3)
527#define G_SCD_TRSEQ_EVENT3(x) _SB_GETVALUE(x,S_SCD_TRSEQ_EVENT3,M_SCD_TRSEQ_EVENT3)
528
529#define S_SCD_TRSEQ_EVENT2 8
530#define M_SCD_TRSEQ_EVENT2 _SB_MAKEMASK(4,S_SCD_TRSEQ_EVENT2)
531#define V_SCD_TRSEQ_EVENT2(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_EVENT2)
532#define G_SCD_TRSEQ_EVENT2(x) _SB_GETVALUE(x,S_SCD_TRSEQ_EVENT2,M_SCD_TRSEQ_EVENT2)
533
534#define S_SCD_TRSEQ_EVENT1 12
535#define M_SCD_TRSEQ_EVENT1 _SB_MAKEMASK(4,S_SCD_TRSEQ_EVENT1)
536#define V_SCD_TRSEQ_EVENT1(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_EVENT1)
537#define G_SCD_TRSEQ_EVENT1(x) _SB_GETVALUE(x,S_SCD_TRSEQ_EVENT1,M_SCD_TRSEQ_EVENT1)
538
539#define K_SCD_TRSEQ_E0 0
540#define K_SCD_TRSEQ_E1 1
541#define K_SCD_TRSEQ_E2 2
542#define K_SCD_TRSEQ_E3 3
543#define K_SCD_TRSEQ_E0_E1 4
544#define K_SCD_TRSEQ_E1_E2 5
545#define K_SCD_TRSEQ_E2_E3 6
546#define K_SCD_TRSEQ_E0_E1_E2 7
547#define K_SCD_TRSEQ_E0_E1_E2_E3 8
548#define K_SCD_TRSEQ_E0E1 9
549#define K_SCD_TRSEQ_E0E1E2 10
550#define K_SCD_TRSEQ_E0E1E2E3 11
551#define K_SCD_TRSEQ_E0E1_E2 12
552#define K_SCD_TRSEQ_E0E1_E2E3 13
553#define K_SCD_TRSEQ_E0E1_E2_E3 14
554#define K_SCD_TRSEQ_IGNORED 15
555
556#define K_SCD_TRSEQ_TRIGGER_ALL (V_SCD_TRSEQ_EVENT1(K_SCD_TRSEQ_IGNORED) | \
557 V_SCD_TRSEQ_EVENT2(K_SCD_TRSEQ_IGNORED) | \
558 V_SCD_TRSEQ_EVENT3(K_SCD_TRSEQ_IGNORED) | \
559 V_SCD_TRSEQ_EVENT4(K_SCD_TRSEQ_IGNORED))
560
561#define S_SCD_TRSEQ_FUNCTION 16
562#define M_SCD_TRSEQ_FUNCTION _SB_MAKEMASK(4,S_SCD_TRSEQ_FUNCTION)
563#define V_SCD_TRSEQ_FUNCTION(x) _SB_MAKEVALUE(x,S_SCD_TRSEQ_FUNCTION)
564#define G_SCD_TRSEQ_FUNCTION(x) _SB_GETVALUE(x,S_SCD_TRSEQ_FUNCTION,M_SCD_TRSEQ_FUNCTION)
565
566#define K_SCD_TRSEQ_FUNC_NOP 0
567#define K_SCD_TRSEQ_FUNC_START 1
568#define K_SCD_TRSEQ_FUNC_STOP 2
569#define K_SCD_TRSEQ_FUNC_FREEZE 3
570
571#define V_SCD_TRSEQ_FUNC_NOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_NOP)
572#define V_SCD_TRSEQ_FUNC_START V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_START)
573#define V_SCD_TRSEQ_FUNC_STOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_STOP)
574#define V_SCD_TRSEQ_FUNC_FREEZE V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_FREEZE)
575
576#define M_SCD_TRSEQ_ASAMPLE _SB_MAKEMASK1(18)
577#define M_SCD_TRSEQ_DSAMPLE _SB_MAKEMASK1(19)
578#define M_SCD_TRSEQ_DEBUGPIN _SB_MAKEMASK1(20)
579#define M_SCD_TRSEQ_DEBUGCPU _SB_MAKEMASK1(21)
580#define M_SCD_TRSEQ_CLEARUSE _SB_MAKEMASK1(22)
581
582#endif
diff --git a/include/asm-mips/sibyte/sb1250_smbus.h b/include/asm-mips/sibyte/sb1250_smbus.h
new file mode 100644
index 000000000000..287cbfe9efa2
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_smbus.h
@@ -0,0 +1,170 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * SMBUS Constants File: sb1250_smbus.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's SMbus devices.
8 *
9 * SB1250 specification level: 01/02/2002
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_SMBUS_H
36#define _SB1250_SMBUS_H
37
38#include "sb1250_defs.h"
39
40/*
41 * SMBus Clock Frequency Register (Table 14-2)
42 */
43
44#define S_SMB_FREQ_DIV 0
45#define M_SMB_FREQ_DIV _SB_MAKEMASK(13,S_SMB_FREQ_DIV)
46#define V_SMB_FREQ_DIV(x) _SB_MAKEVALUE(x,S_SMB_FREQ_DIV)
47
48#define K_SMB_FREQ_400KHZ 0x1F
49#define K_SMB_FREQ_100KHZ 0x7D
50
51#define S_SMB_CMD 0
52#define M_SMB_CMD _SB_MAKEMASK(8,S_SMB_CMD)
53#define V_SMB_CMD(x) _SB_MAKEVALUE(x,S_SMB_CMD)
54
55/*
56 * SMBus control register (Table 14-4)
57 */
58
59#define M_SMB_ERR_INTR _SB_MAKEMASK1(0)
60#define M_SMB_FINISH_INTR _SB_MAKEMASK1(1)
61#define M_SMB_DATA_OUT _SB_MAKEMASK1(4)
62#define M_SMB_DATA_DIR _SB_MAKEMASK1(5)
63#define M_SMB_DATA_DIR_OUTPUT M_SMB_DATA_DIR
64#define M_SMB_CLK_OUT _SB_MAKEMASK1(6)
65#define M_SMB_DIRECT_ENABLE _SB_MAKEMASK1(7)
66
67/*
68 * SMBus status registers (Table 14-5)
69 */
70
71#define M_SMB_BUSY _SB_MAKEMASK1(0)
72#define M_SMB_ERROR _SB_MAKEMASK1(1)
73#define M_SMB_ERROR_TYPE _SB_MAKEMASK1(2)
74#define M_SMB_REF _SB_MAKEMASK1(6)
75#define M_SMB_DATA_IN _SB_MAKEMASK1(7)
76
77/*
78 * SMBus Start/Command registers (Table 14-9)
79 */
80
81#define S_SMB_ADDR 0
82#define M_SMB_ADDR _SB_MAKEMASK(7,S_SMB_ADDR)
83#define V_SMB_ADDR(x) _SB_MAKEVALUE(x,S_SMB_ADDR)
84#define G_SMB_ADDR(x) _SB_GETVALUE(x,S_SMB_ADDR,M_SMB_ADDR)
85
86#define M_SMB_QDATA _SB_MAKEMASK1(7)
87
88#define S_SMB_TT 8
89#define M_SMB_TT _SB_MAKEMASK(3,S_SMB_TT)
90#define V_SMB_TT(x) _SB_MAKEVALUE(x,S_SMB_TT)
91#define G_SMB_TT(x) _SB_GETVALUE(x,S_SMB_TT,M_SMB_TT)
92
93#define K_SMB_TT_WR1BYTE 0
94#define K_SMB_TT_WR2BYTE 1
95#define K_SMB_TT_WR3BYTE 2
96#define K_SMB_TT_CMD_RD1BYTE 3
97#define K_SMB_TT_CMD_RD2BYTE 4
98#define K_SMB_TT_RD1BYTE 5
99#define K_SMB_TT_QUICKCMD 6
100#define K_SMB_TT_EEPROMREAD 7
101
102#define V_SMB_TT_WR1BYTE V_SMB_TT(K_SMB_TT_WR1BYTE)
103#define V_SMB_TT_WR2BYTE V_SMB_TT(K_SMB_TT_WR2BYTE)
104#define V_SMB_TT_WR3BYTE V_SMB_TT(K_SMB_TT_WR3BYTE)
105#define V_SMB_TT_CMD_RD1BYTE V_SMB_TT(K_SMB_TT_CMD_RD1BYTE)
106#define V_SMB_TT_CMD_RD2BYTE V_SMB_TT(K_SMB_TT_CMD_RD2BYTE)
107#define V_SMB_TT_RD1BYTE V_SMB_TT(K_SMB_TT_RD1BYTE)
108#define V_SMB_TT_QUICKCMD V_SMB_TT(K_SMB_TT_QUICKCMD)
109#define V_SMB_TT_EEPROMREAD V_SMB_TT(K_SMB_TT_EEPROMREAD)
110
111#define M_SMB_PEC _SB_MAKEMASK1(15)
112
113/*
114 * SMBus Data Register (Table 14-6) and SMBus Extra Register (Table 14-7)
115 */
116
117#define S_SMB_LB 0
118#define M_SMB_LB _SB_MAKEMASK(8,S_SMB_LB)
119#define V_SMB_LB(x) _SB_MAKEVALUE(x,S_SMB_LB)
120
121#define S_SMB_MB 8
122#define M_SMB_MB _SB_MAKEMASK(8,S_SMB_MB)
123#define V_SMB_MB(x) _SB_MAKEVALUE(x,S_SMB_MB)
124
125
126/*
127 * SMBus Packet Error Check register (Table 14-8)
128 */
129
130#define S_SPEC_PEC 0
131#define M_SPEC_PEC _SB_MAKEMASK(8,S_SPEC_PEC)
132#define V_SPEC_MB(x) _SB_MAKEVALUE(x,S_SPEC_PEC)
133
134
135#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
136
137#define S_SMB_CMDH 8
138#define M_SMB_CMDH _SB_MAKEMASK(8,S_SMBH_CMD)
139#define V_SMB_CMDH(x) _SB_MAKEVALUE(x,S_SMBH_CMD)
140
141#define M_SMB_EXTEND _SB_MAKEMASK1(14)
142
143#define M_SMB_DIR _SB_MAKEMASK1(13)
144
145#define S_SMB_DFMT 8
146#define M_SMB_DFMT _SB_MAKEMASK(3,S_SMB_DFMT)
147#define V_SMB_DFMT(x) _SB_MAKEVALUE(x,S_SMB_DFMT)
148#define G_SMB_DFMT(x) _SB_GETVALUE(x,S_SMB_DFMT,M_SMB_DFMT)
149
150#define K_SMB_DFMT_1BYTE 0
151#define K_SMB_DFMT_2BYTE 1
152#define K_SMB_DFMT_3BYTE 2
153#define K_SMB_DFMT_4BYTE 3
154#define K_SMB_DFMT_NODATA 4
155#define K_SMB_DFMT_CMD4BYTE 5
156#define K_SMB_DFMT_CMD5BYTE 6
157#define K_SMB_DFMT_RESERVED 7
158
159#define V_SMB_DFMT_1BYTE V_SMB_DFMT(K_SMB_DFMT_1BYTE)
160#define V_SMB_DFMT_2BYTE V_SMB_DFMT(K_SMB_DFMT_2BYTE)
161#define V_SMB_DFMT_3BYTE V_SMB_DFMT(K_SMB_DFMT_3BYTE)
162#define V_SMB_DFMT_4BYTE V_SMB_DFMT(K_SMB_DFMT_4BYTE)
163#define V_SMB_DFMT_NODATA V_SMB_DFMT(K_SMB_DFMT_NODATA)
164#define V_SMB_DFMT_CMD4BYTE V_SMB_DFMT(K_SMB_DFMT_CMD4BYTE)
165#define V_SMB_DFMT_CMD5BYTE V_SMB_DFMT(K_SMB_DFMT_CMD5BYTE)
166#define V_SMB_DFMT_RESERVED V_SMB_DFMT(K_SMB_DFMT_RESERVED)
167
168#endif /* 1250 PASS2 || 112x PASS1 */
169
170#endif
diff --git a/include/asm-mips/sibyte/sb1250_syncser.h b/include/asm-mips/sibyte/sb1250_syncser.h
new file mode 100644
index 000000000000..8d5e8edd3c4b
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_syncser.h
@@ -0,0 +1,148 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Synchronous Serial Constants File: sb1250_syncser.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's Synchronous Serial
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_SYNCSER_H
36#define _SB1250_SYNCSER_H
37
38#include "sb1250_defs.h"
39
40/*
41 * Serial Mode Configuration Register
42 */
43
44#define M_SYNCSER_CRC_MODE _SB_MAKEMASK1(0)
45#define M_SYNCSER_MSB_FIRST _SB_MAKEMASK1(1)
46
47#define S_SYNCSER_FLAG_NUM 2
48#define M_SYNCSER_FLAG_NUM _SB_MAKEMASK(4,S_SYNCSER_FLAG_NUM)
49#define V_SYNCSER_FLAG_NUM _SB_MAKEVALUE(x,S_SYNCSER_FLAG_NUM)
50
51#define M_SYNCSER_FLAG_EN _SB_MAKEMASK1(6)
52#define M_SYNCSER_HDLC_EN _SB_MAKEMASK1(7)
53#define M_SYNCSER_LOOP_MODE _SB_MAKEMASK1(8)
54#define M_SYNCSER_LOOPBACK _SB_MAKEMASK1(9)
55
56/*
57 * Serial Clock Source and Line Interface Mode Register
58 */
59
60#define M_SYNCSER_RXCLK_INV _SB_MAKEMASK1(0)
61#define M_SYNCSER_RXCLK_EXT _SB_MAKEMASK1(1)
62
63#define S_SYNCSER_RXSYNC_DLY 2
64#define M_SYNCSER_RXSYNC_DLY _SB_MAKEMASK(2,S_SYNCSER_RXSYNC_DLY)
65#define V_SYNCSER_RXSYNC_DLY(x) _SB_MAKEVALUE(x,S_SYNCSER_RXSYNC_DLY)
66
67#define M_SYNCSER_RXSYNC_LOW _SB_MAKEMASK1(4)
68#define M_SYNCSER_RXSTRB_LOW _SB_MAKEMASK1(5)
69
70#define M_SYNCSER_RXSYNC_EDGE _SB_MAKEMASK1(6)
71#define M_SYNCSER_RXSYNC_INT _SB_MAKEMASK1(7)
72
73#define M_SYNCSER_TXCLK_INV _SB_MAKEMASK1(8)
74#define M_SYNCSER_TXCLK_EXT _SB_MAKEMASK1(9)
75
76#define S_SYNCSER_TXSYNC_DLY 10
77#define M_SYNCSER_TXSYNC_DLY _SB_MAKEMASK(2,S_SYNCSER_TXSYNC_DLY)
78#define V_SYNCSER_TXSYNC_DLY(x) _SB_MAKEVALUE(x,S_SYNCSER_TXSYNC_DLY)
79
80#define M_SYNCSER_TXSYNC_LOW _SB_MAKEMASK1(12)
81#define M_SYNCSER_TXSTRB_LOW _SB_MAKEMASK1(13)
82
83#define M_SYNCSER_TXSYNC_EDGE _SB_MAKEMASK1(14)
84#define M_SYNCSER_TXSYNC_INT _SB_MAKEMASK1(15)
85
86/*
87 * Serial Command Register
88 */
89
90#define M_SYNCSER_CMD_RX_EN _SB_MAKEMASK1(0)
91#define M_SYNCSER_CMD_TX_EN _SB_MAKEMASK1(1)
92#define M_SYNCSER_CMD_RX_RESET _SB_MAKEMASK1(2)
93#define M_SYNCSER_CMD_TX_RESET _SB_MAKEMASK1(3)
94#define M_SYNCSER_CMD_TX_PAUSE _SB_MAKEMASK1(5)
95
96/*
97 * Serial DMA Enable Register
98 */
99
100#define M_SYNCSER_DMA_RX_EN _SB_MAKEMASK1(0)
101#define M_SYNCSER_DMA_TX_EN _SB_MAKEMASK1(4)
102
103/*
104 * Serial Status Register
105 */
106
107#define M_SYNCSER_RX_CRCERR _SB_MAKEMASK1(0)
108#define M_SYNCSER_RX_ABORT _SB_MAKEMASK1(1)
109#define M_SYNCSER_RX_OCTET _SB_MAKEMASK1(2)
110#define M_SYNCSER_RX_LONGFRM _SB_MAKEMASK1(3)
111#define M_SYNCSER_RX_SHORTFRM _SB_MAKEMASK1(4)
112#define M_SYNCSER_RX_OVERRUN _SB_MAKEMASK1(5)
113#define M_SYNCSER_RX_SYNC_ERR _SB_MAKEMASK1(6)
114#define M_SYNCSER_TX_CRCERR _SB_MAKEMASK1(8)
115#define M_SYNCSER_TX_UNDERRUN _SB_MAKEMASK1(9)
116#define M_SYNCSER_TX_SYNC_ERR _SB_MAKEMASK1(10)
117#define M_SYNCSER_TX_PAUSE_COMPLETE _SB_MAKEMASK1(11)
118#define M_SYNCSER_RX_EOP_COUNT _SB_MAKEMASK1(16)
119#define M_SYNCSER_RX_EOP_TIMER _SB_MAKEMASK1(17)
120#define M_SYNCSER_RX_EOP_SEEN _SB_MAKEMASK1(18)
121#define M_SYNCSER_RX_HWM _SB_MAKEMASK1(19)
122#define M_SYNCSER_RX_LWM _SB_MAKEMASK1(20)
123#define M_SYNCSER_RX_DSCR _SB_MAKEMASK1(21)
124#define M_SYNCSER_RX_DERR _SB_MAKEMASK1(22)
125#define M_SYNCSER_TX_EOP_COUNT _SB_MAKEMASK1(24)
126#define M_SYNCSER_TX_EOP_TIMER _SB_MAKEMASK1(25)
127#define M_SYNCSER_TX_EOP_SEEN _SB_MAKEMASK1(26)
128#define M_SYNCSER_TX_HWM _SB_MAKEMASK1(27)
129#define M_SYNCSER_TX_LWM _SB_MAKEMASK1(28)
130#define M_SYNCSER_TX_DSCR _SB_MAKEMASK1(29)
131#define M_SYNCSER_TX_DERR _SB_MAKEMASK1(30)
132#define M_SYNCSER_TX_DZERO _SB_MAKEMASK1(31)
133
134/*
135 * Sequencer Table Entry format
136 */
137
138#define M_SYNCSER_SEQ_LAST _SB_MAKEMASK1(0)
139#define M_SYNCSER_SEQ_BYTE _SB_MAKEMASK1(1)
140
141#define S_SYNCSER_SEQ_COUNT 2
142#define M_SYNCSER_SEQ_COUNT _SB_MAKEMASK(4,S_SYNCSER_SEQ_COUNT)
143#define V_SYNCSER_SEQ_COUNT(x) _SB_MAKEVALUE(x,S_SYNCSER_SEQ_COUNT)
144
145#define M_SYNCSER_SEQ_ENABLE _SB_MAKEMASK1(6)
146#define M_SYNCSER_SEQ_STROBE _SB_MAKEMASK1(7)
147
148#endif
diff --git a/include/asm-mips/sibyte/sb1250_uart.h b/include/asm-mips/sibyte/sb1250_uart.h
new file mode 100644
index 000000000000..7655d6945cca
--- /dev/null
+++ b/include/asm-mips/sibyte/sb1250_uart.h
@@ -0,0 +1,354 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * UART Constants File: sb1250_uart.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's UARTs
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 * Author: Mitch Lichtenberg
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_UART_H
36#define _SB1250_UART_H
37
38#include "sb1250_defs.h"
39
40/* **********************************************************************
41 * DUART Registers
42 ********************************************************************** */
43
44/*
45 * DUART Mode Register #1 (Table 10-3)
46 * Register: DUART_MODE_REG_1_A
47 * Register: DUART_MODE_REG_1_B
48 */
49
50#define S_DUART_BITS_PER_CHAR 0
51#define M_DUART_BITS_PER_CHAR _SB_MAKEMASK(2,S_DUART_BITS_PER_CHAR)
52#define V_DUART_BITS_PER_CHAR(x) _SB_MAKEVALUE(x,S_DUART_BITS_PER_CHAR)
53
54#define K_DUART_BITS_PER_CHAR_RSV0 0
55#define K_DUART_BITS_PER_CHAR_RSV1 1
56#define K_DUART_BITS_PER_CHAR_7 2
57#define K_DUART_BITS_PER_CHAR_8 3
58
59#define V_DUART_BITS_PER_CHAR_RSV0 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV0)
60#define V_DUART_BITS_PER_CHAR_RSV1 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV1)
61#define V_DUART_BITS_PER_CHAR_7 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_7)
62#define V_DUART_BITS_PER_CHAR_8 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_8)
63
64
65#define M_DUART_PARITY_TYPE_EVEN 0x00
66#define M_DUART_PARITY_TYPE_ODD _SB_MAKEMASK1(2)
67
68#define S_DUART_PARITY_MODE 3
69#define M_DUART_PARITY_MODE _SB_MAKEMASK(2,S_DUART_PARITY_MODE)
70#define V_DUART_PARITY_MODE(x) _SB_MAKEVALUE(x,S_DUART_PARITY_MODE)
71
72#define K_DUART_PARITY_MODE_ADD 0
73#define K_DUART_PARITY_MODE_ADD_FIXED 1
74#define K_DUART_PARITY_MODE_NONE 2
75
76#define V_DUART_PARITY_MODE_ADD V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD)
77#define V_DUART_PARITY_MODE_ADD_FIXED V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD_FIXED)
78#define V_DUART_PARITY_MODE_NONE V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_NONE)
79
80#define M_DUART_ERR_MODE _SB_MAKEMASK1(5) /* must be zero */
81
82#define M_DUART_RX_IRQ_SEL_RXRDY 0
83#define M_DUART_RX_IRQ_SEL_RXFULL _SB_MAKEMASK1(6)
84
85#define M_DUART_RX_RTS_ENA _SB_MAKEMASK1(7)
86
87/*
88 * DUART Mode Register #2 (Table 10-4)
89 * Register: DUART_MODE_REG_2_A
90 * Register: DUART_MODE_REG_2_B
91 */
92
93#define M_DUART_MODE_RESERVED1 _SB_MAKEMASK(3,0) /* ignored */
94
95#define M_DUART_STOP_BIT_LEN_2 _SB_MAKEMASK1(3)
96#define M_DUART_STOP_BIT_LEN_1 0
97
98#define M_DUART_TX_CTS_ENA _SB_MAKEMASK1(4)
99
100
101#define M_DUART_MODE_RESERVED2 _SB_MAKEMASK1(5) /* must be zero */
102
103#define S_DUART_CHAN_MODE 6
104#define M_DUART_CHAN_MODE _SB_MAKEMASK(2,S_DUART_CHAN_MODE)
105#define V_DUART_CHAN_MODE(x) _SB_MAKEVALUE(x,S_DUART_CHAN_MODE)
106
107#define K_DUART_CHAN_MODE_NORMAL 0
108#define K_DUART_CHAN_MODE_LCL_LOOP 2
109#define K_DUART_CHAN_MODE_REM_LOOP 3
110
111#define V_DUART_CHAN_MODE_NORMAL V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_NORMAL)
112#define V_DUART_CHAN_MODE_LCL_LOOP V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_LCL_LOOP)
113#define V_DUART_CHAN_MODE_REM_LOOP V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_REM_LOOP)
114
115/*
116 * DUART Command Register (Table 10-5)
117 * Register: DUART_CMD_A
118 * Register: DUART_CMD_B
119 */
120
121#define M_DUART_RX_EN _SB_MAKEMASK1(0)
122#define M_DUART_RX_DIS _SB_MAKEMASK1(1)
123#define M_DUART_TX_EN _SB_MAKEMASK1(2)
124#define M_DUART_TX_DIS _SB_MAKEMASK1(3)
125
126#define S_DUART_MISC_CMD 4
127#define M_DUART_MISC_CMD _SB_MAKEMASK(3,S_DUART_MISC_CMD)
128#define V_DUART_MISC_CMD(x) _SB_MAKEVALUE(x,S_DUART_MISC_CMD)
129
130#define K_DUART_MISC_CMD_NOACTION0 0
131#define K_DUART_MISC_CMD_NOACTION1 1
132#define K_DUART_MISC_CMD_RESET_RX 2
133#define K_DUART_MISC_CMD_RESET_TX 3
134#define K_DUART_MISC_CMD_NOACTION4 4
135#define K_DUART_MISC_CMD_RESET_BREAK_INT 5
136#define K_DUART_MISC_CMD_START_BREAK 6
137#define K_DUART_MISC_CMD_STOP_BREAK 7
138
139#define V_DUART_MISC_CMD_NOACTION0 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION0)
140#define V_DUART_MISC_CMD_NOACTION1 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION1)
141#define V_DUART_MISC_CMD_RESET_RX V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_RX)
142#define V_DUART_MISC_CMD_RESET_TX V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_TX)
143#define V_DUART_MISC_CMD_NOACTION4 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION4)
144#define V_DUART_MISC_CMD_RESET_BREAK_INT V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_BREAK_INT)
145#define V_DUART_MISC_CMD_START_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_START_BREAK)
146#define V_DUART_MISC_CMD_STOP_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_STOP_BREAK)
147
148#define M_DUART_CMD_RESERVED _SB_MAKEMASK1(7)
149
150/*
151 * DUART Status Register (Table 10-6)
152 * Register: DUART_STATUS_A
153 * Register: DUART_STATUS_B
154 * READ-ONLY
155 */
156
157#define M_DUART_RX_RDY _SB_MAKEMASK1(0)
158#define M_DUART_RX_FFUL _SB_MAKEMASK1(1)
159#define M_DUART_TX_RDY _SB_MAKEMASK1(2)
160#define M_DUART_TX_EMT _SB_MAKEMASK1(3)
161#define M_DUART_OVRUN_ERR _SB_MAKEMASK1(4)
162#define M_DUART_PARITY_ERR _SB_MAKEMASK1(5)
163#define M_DUART_FRM_ERR _SB_MAKEMASK1(6)
164#define M_DUART_RCVD_BRK _SB_MAKEMASK1(7)
165
166/*
167 * DUART Baud Rate Register (Table 10-7)
168 * Register: DUART_CLK_SEL_A
169 * Register: DUART_CLK_SEL_B
170 */
171
172#define M_DUART_CLK_COUNTER _SB_MAKEMASK(12,0)
173#define V_DUART_BAUD_RATE(x) (100000000/((x)*20)-1)
174
175/*
176 * DUART Data Registers (Table 10-8 and 10-9)
177 * Register: DUART_RX_HOLD_A
178 * Register: DUART_RX_HOLD_B
179 * Register: DUART_TX_HOLD_A
180 * Register: DUART_TX_HOLD_B
181 */
182
183#define M_DUART_RX_DATA _SB_MAKEMASK(8,0)
184#define M_DUART_TX_DATA _SB_MAKEMASK(8,0)
185
186/*
187 * DUART Input Port Register (Table 10-10)
188 * Register: DUART_IN_PORT
189 */
190
191#define M_DUART_IN_PIN0_VAL _SB_MAKEMASK1(0)
192#define M_DUART_IN_PIN1_VAL _SB_MAKEMASK1(1)
193#define M_DUART_IN_PIN2_VAL _SB_MAKEMASK1(2)
194#define M_DUART_IN_PIN3_VAL _SB_MAKEMASK1(3)
195#define M_DUART_IN_PIN4_VAL _SB_MAKEMASK1(4)
196#define M_DUART_IN_PIN5_VAL _SB_MAKEMASK1(5)
197#define M_DUART_RIN0_PIN _SB_MAKEMASK1(6)
198#define M_DUART_RIN1_PIN _SB_MAKEMASK1(7)
199
200/*
201 * DUART Input Port Change Status Register (Tables 10-11, 10-12, and 10-13)
202 * Register: DUART_INPORT_CHNG
203 */
204
205#define S_DUART_IN_PIN_VAL 0
206#define M_DUART_IN_PIN_VAL _SB_MAKEMASK(4,S_DUART_IN_PIN_VAL)
207
208#define S_DUART_IN_PIN_CHNG 4
209#define M_DUART_IN_PIN_CHNG _SB_MAKEMASK(4,S_DUART_IN_PIN_CHNG)
210
211
212/*
213 * DUART Output port control register (Table 10-14)
214 * Register: DUART_OPCR
215 */
216
217#define M_DUART_OPCR_RESERVED0 _SB_MAKEMASK1(0) /* must be zero */
218#define M_DUART_OPC2_SEL _SB_MAKEMASK1(1)
219#define M_DUART_OPCR_RESERVED1 _SB_MAKEMASK1(2) /* must be zero */
220#define M_DUART_OPC3_SEL _SB_MAKEMASK1(3)
221#define M_DUART_OPCR_RESERVED2 _SB_MAKEMASK(4,4) /* must be zero */
222
223/*
224 * DUART Aux Control Register (Table 10-15)
225 * Register: DUART_AUX_CTRL
226 */
227
228#define M_DUART_IP0_CHNG_ENA _SB_MAKEMASK1(0)
229#define M_DUART_IP1_CHNG_ENA _SB_MAKEMASK1(1)
230#define M_DUART_IP2_CHNG_ENA _SB_MAKEMASK1(2)
231#define M_DUART_IP3_CHNG_ENA _SB_MAKEMASK1(3)
232#define M_DUART_ACR_RESERVED _SB_MAKEMASK(4,4)
233
234#define M_DUART_CTS_CHNG_ENA _SB_MAKEMASK1(0)
235#define M_DUART_CIN_CHNG_ENA _SB_MAKEMASK1(2)
236
237/*
238 * DUART Interrupt Status Register (Table 10-16)
239 * Register: DUART_ISR
240 */
241
242#define M_DUART_ISR_TX_A _SB_MAKEMASK1(0)
243#define M_DUART_ISR_RX_A _SB_MAKEMASK1(1)
244#define M_DUART_ISR_BRK_A _SB_MAKEMASK1(2)
245#define M_DUART_ISR_IN_A _SB_MAKEMASK1(3)
246#define M_DUART_ISR_TX_B _SB_MAKEMASK1(4)
247#define M_DUART_ISR_RX_B _SB_MAKEMASK1(5)
248#define M_DUART_ISR_BRK_B _SB_MAKEMASK1(6)
249#define M_DUART_ISR_IN_B _SB_MAKEMASK1(7)
250
251/*
252 * DUART Channel A Interrupt Status Register (Table 10-17)
253 * DUART Channel B Interrupt Status Register (Table 10-18)
254 * Register: DUART_ISR_A
255 * Register: DUART_ISR_B
256 */
257
258#define M_DUART_ISR_TX _SB_MAKEMASK1(0)
259#define M_DUART_ISR_RX _SB_MAKEMASK1(1)
260#define M_DUART_ISR_BRK _SB_MAKEMASK1(2)
261#define M_DUART_ISR_IN _SB_MAKEMASK1(3)
262#define M_DUART_ISR_RESERVED _SB_MAKEMASK(4,4)
263
264/*
265 * DUART Interrupt Mask Register (Table 10-19)
266 * Register: DUART_IMR
267 */
268
269#define M_DUART_IMR_TX_A _SB_MAKEMASK1(0)
270#define M_DUART_IMR_RX_A _SB_MAKEMASK1(1)
271#define M_DUART_IMR_BRK_A _SB_MAKEMASK1(2)
272#define M_DUART_IMR_IN_A _SB_MAKEMASK1(3)
273#define M_DUART_IMR_ALL_A _SB_MAKEMASK(4,0)
274
275#define M_DUART_IMR_TX_B _SB_MAKEMASK1(4)
276#define M_DUART_IMR_RX_B _SB_MAKEMASK1(5)
277#define M_DUART_IMR_BRK_B _SB_MAKEMASK1(6)
278#define M_DUART_IMR_IN_B _SB_MAKEMASK1(7)
279#define M_DUART_IMR_ALL_B _SB_MAKEMASK(4,4)
280
281/*
282 * DUART Channel A Interrupt Mask Register (Table 10-20)
283 * DUART Channel B Interrupt Mask Register (Table 10-21)
284 * Register: DUART_IMR_A
285 * Register: DUART_IMR_B
286 */
287
288#define M_DUART_IMR_TX _SB_MAKEMASK1(0)
289#define M_DUART_IMR_RX _SB_MAKEMASK1(1)
290#define M_DUART_IMR_BRK _SB_MAKEMASK1(2)
291#define M_DUART_IMR_IN _SB_MAKEMASK1(3)
292#define M_DUART_IMR_ALL _SB_MAKEMASK(4,0)
293#define M_DUART_IMR_RESERVED _SB_MAKEMASK(4,4)
294
295
296/*
297 * DUART Output Port Set Register (Table 10-22)
298 * Register: DUART_SET_OPR
299 */
300
301#define M_DUART_SET_OPR0 _SB_MAKEMASK1(0)
302#define M_DUART_SET_OPR1 _SB_MAKEMASK1(1)
303#define M_DUART_SET_OPR2 _SB_MAKEMASK1(2)
304#define M_DUART_SET_OPR3 _SB_MAKEMASK1(3)
305#define M_DUART_OPSR_RESERVED _SB_MAKEMASK(4,4)
306
307/*
308 * DUART Output Port Clear Register (Table 10-23)
309 * Register: DUART_CLEAR_OPR
310 */
311
312#define M_DUART_CLR_OPR0 _SB_MAKEMASK1(0)
313#define M_DUART_CLR_OPR1 _SB_MAKEMASK1(1)
314#define M_DUART_CLR_OPR2 _SB_MAKEMASK1(2)
315#define M_DUART_CLR_OPR3 _SB_MAKEMASK1(3)
316#define M_DUART_OPCR_RESERVED _SB_MAKEMASK(4,4)
317
318/*
319 * DUART Output Port RTS Register (Table 10-24)
320 * Register: DUART_OUT_PORT
321 */
322
323#define M_DUART_OUT_PIN_SET0 _SB_MAKEMASK1(0)
324#define M_DUART_OUT_PIN_SET1 _SB_MAKEMASK1(1)
325#define M_DUART_OUT_PIN_CLR0 _SB_MAKEMASK1(2)
326#define M_DUART_OUT_PIN_CLR1 _SB_MAKEMASK1(3)
327#define M_DUART_OPRR_RESERVED _SB_MAKEMASK(4,4)
328
329#define M_DUART_OUT_PIN_SET(chan) \
330 (chan == 0 ? M_DUART_OUT_PIN_SET0 : M_DUART_OUT_PIN_SET1)
331#define M_DUART_OUT_PIN_CLR(chan) \
332 (chan == 0 ? M_DUART_OUT_PIN_CLR0 : M_DUART_OUT_PIN_CLR1)
333
334#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
335/*
336 * Full Interrupt Control Register
337 */
338
339#define S_DUART_SIG_FULL _SB_MAKE64(0)
340#define M_DUART_SIG_FULL _SB_MAKEMASK(4,S_DUART_SIG_FULL)
341#define V_DUART_SIG_FULL(x) _SB_MAKEVALUE(x,S_DUART_SIG_FULL)
342#define G_DUART_SIG_FULL(x) _SB_GETVALUE(x,S_DUART_SIG_FULL,M_DUART_SIG_FULL)
343
344#define S_DUART_INT_TIME _SB_MAKE64(4)
345#define M_DUART_INT_TIME _SB_MAKEMASK(4,S_DUART_INT_TIME)
346#define V_DUART_INT_TIME(x) _SB_MAKEVALUE(x,S_DUART_INT_TIME)
347#define G_DUART_INT_TIME(x) _SB_GETVALUE(x,S_DUART_INT_TIME,M_DUART_INT_TIME)
348#endif /* 1250 PASS2 || 112x PASS1 */
349
350
351/* ********************************************************************** */
352
353
354#endif
diff --git a/include/asm-mips/sibyte/sentosa.h b/include/asm-mips/sibyte/sentosa.h
new file mode 100644
index 000000000000..824605847af4
--- /dev/null
+++ b/include/asm-mips/sibyte/sentosa.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#ifndef __ASM_SIBYTE_SENTOSA_H
19#define __ASM_SIBYTE_SENTOSA_H
20
21#include <linux/config.h>
22#include <asm/sibyte/sb1250.h>
23#include <asm/sibyte/sb1250_int.h>
24
25#ifdef CONFIG_SIBYTE_SENTOSA
26#define SIBYTE_BOARD_NAME "BCM91250E (Sentosa)"
27#endif
28#ifdef CONFIG_SIBYTE_RHONE
29#define SIBYTE_BOARD_NAME "BCM91125E (Rhone)"
30#endif
31
32/* Generic bus chip selects */
33#ifdef CONFIG_SIBYTE_RHONE
34#define LEDS_CS 6
35#define LEDS_PHYS 0x1d0a0000
36#endif
37
38/* GPIOs */
39#define K_GPIO_DBG_LED 0
40
41#endif /* __ASM_SIBYTE_SENTOSA_H */
diff --git a/include/asm-mips/sibyte/swarm.h b/include/asm-mips/sibyte/swarm.h
new file mode 100644
index 000000000000..97fa0494c30c
--- /dev/null
+++ b/include/asm-mips/sibyte/swarm.h
@@ -0,0 +1,71 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#ifndef __ASM_SIBYTE_SWARM_H
19#define __ASM_SIBYTE_SWARM_H
20
21#include <linux/config.h>
22#include <asm/sibyte/sb1250.h>
23#include <asm/sibyte/sb1250_int.h>
24
25#ifdef CONFIG_SIBYTE_SWARM
26#define SIBYTE_BOARD_NAME "BCM91250A (SWARM)"
27#define SIBYTE_HAVE_PCMCIA 1
28#define SIBYTE_HAVE_IDE 1
29#endif
30#ifdef CONFIG_SIBYTE_PTSWARM
31#define SIBYTE_BOARD_NAME "PTSWARM"
32#define SIBYTE_HAVE_PCMCIA 1
33#define SIBYTE_HAVE_IDE 1
34#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
35#endif
36#ifdef CONFIG_SIBYTE_LITTLESUR
37#define SIBYTE_BOARD_NAME "BCM1250C2 (LittleSur)"
38#define SIBYTE_HAVE_PCMCIA 0
39#define SIBYTE_HAVE_IDE 1
40#define SIBYTE_DEFAULT_CONSOLE "cfe0"
41#endif
42#ifdef CONFIG_SIBYTE_CRHONE
43#define SIBYTE_BOARD_NAME "BCM91125C (CRhone)"
44#define SIBYTE_HAVE_PCMCIA 0
45#define SIBYTE_HAVE_IDE 0
46#endif
47#ifdef CONFIG_SIBYTE_CRHINE
48#define SIBYTE_BOARD_NAME "BCM91120C (CRhine)"
49#define SIBYTE_HAVE_PCMCIA 0
50#define SIBYTE_HAVE_IDE 0
51#endif
52
53/* Generic bus chip selects */
54#define LEDS_CS 3
55#define LEDS_PHYS 0x100a0000
56
57#ifdef SIBYTE_HAVE_IDE
58#define IDE_CS 4
59#define IDE_PHYS 0x100b0000
60#define K_GPIO_GB_IDE 4
61#define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE)
62#endif
63
64#ifdef SIBYTE_HAVE_PCMCIA
65#define PCMCIA_CS 6
66#define PCMCIA_PHYS 0x11000000
67#define K_GPIO_PC_READY 9
68#define K_INT_PC_READY (K_INT_GPIO_0 + K_GPIO_PC_READY)
69#endif
70
71#endif /* __ASM_SIBYTE_SWARM_H */
diff --git a/include/asm-mips/sibyte/trace_prof.h b/include/asm-mips/sibyte/trace_prof.h
new file mode 100644
index 000000000000..557792075e9a
--- /dev/null
+++ b/include/asm-mips/sibyte/trace_prof.h
@@ -0,0 +1,110 @@
1/*
2 * Copyright (C) 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef __ASM_SIBYTE_TRACE_PROF_H
20#define __ASM_SIBYTE_TRACE_PROF_H
21
22#undef DBG
23#if SBPROF_TB_DEBUG
24#define DBG(a) a
25#else
26#define DBG(a)
27#endif
28
29#define SBPROF_TB_MAJOR 240
30#define DEVNAME "bcm1250_tbprof"
31
32typedef u_int64_t tb_sample_t[6*256];
33
34struct sbprof_tb {
35 int open;
36 tb_sample_t *sbprof_tbbuf;
37 int next_tb_sample;
38
39 volatile int tb_enable;
40 volatile int tb_armed;
41
42 wait_queue_head_t tb_sync;
43 wait_queue_head_t tb_read;
44};
45
46#define MAX_SAMPLE_BYTES (24*1024*1024)
47#define MAX_TBSAMPLE_BYTES (12*1024*1024)
48
49#define MAX_SAMPLES (MAX_SAMPLE_BYTES/sizeof(u_int32_t))
50#define TB_SAMPLE_SIZE (sizeof(tb_sample_t))
51#define MAX_TB_SAMPLES (MAX_TBSAMPLE_BYTES/TB_SAMPLE_SIZE)
52
53/* IOCTLs */
54#define SBPROF_ZBSTART _IOW('s', 0, int)
55#define SBPROF_ZBSTOP _IOW('s', 1, int)
56#define SBPROF_ZBWAITFULL _IOW('s', 2, int)
57
58/***************************************************************************
59 * Routines for gathering ZBbus profiles using trace buffer
60 ***************************************************************************/
61
62/* Requires: Already called zclk_timer_init with a value that won't
63 saturate 40 bits. No subsequent use of SCD performance counters
64 or trace buffer.
65 Effect: Starts gathering random ZBbus profiles using trace buffer. */
66extern int sbprof_zbprof_start(struct file *filp);
67
68/* Effect: Stops collection of ZBbus profiles */
69extern int sbprof_zbprof_stop(void);
70
71
72/***************************************************************************
73 * Routines for using 40-bit SCD cycle counter
74 *
75 * Client responsible for either handling interrupts or making sure
76 * the cycles counter never saturates, e.g., by doing
77 * zclk_timer_init(0) at least every 2^40 - 1 ZCLKs.
78 ***************************************************************************/
79
80/* Configures SCD counter 0 to count ZCLKs starting from val;
81 Configures SCD counters1,2,3 to count nothing.
82 Must not be called while gathering ZBbus profiles.
83
84unsigned long long val; */
85#define zclk_timer_init(val) \
86 __asm__ __volatile__ (".set push;" \
87 ".set mips64;" \
88 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
89 "sd %0, 0x10($8);" /* write val to counter0 */ \
90 "sd %1, 0($8);" /* config counter0 for zclks*/ \
91 ".set pop" \
92 : /* no outputs */ \
93 /* enable, counter0 */ \
94 : /* inputs */ "r"(val), "r" ((1ULL << 33) | 1ULL) \
95 : /* modifies */ "$8" )
96
97
98/* Reads SCD counter 0 and puts result in value
99 unsigned long long val; */
100#define zclk_get(val) \
101 __asm__ __volatile__ (".set push;" \
102 ".set mips64;" \
103 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
104 "ld %0, 0x10($8);" /* write val to counter0 */ \
105 ".set pop" \
106 : /* outputs */ "=r"(val) \
107 : /* inputs */ \
108 : /* modifies */ "$8" )
109
110#endif /* __ASM_SIBYTE_TRACE_PROF_H */
diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h
new file mode 100644
index 000000000000..18939e84b6f2
--- /dev/null
+++ b/include/asm-mips/sigcontext.h
@@ -0,0 +1,93 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 1997, 1999 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SIGCONTEXT_H
10#define _ASM_SIGCONTEXT_H
11
12#include <asm/sgidefs.h>
13
14#if _MIPS_SIM == _MIPS_SIM_ABI32
15
16/*
17 * Keep this struct definition in sync with the sigcontext fragment
18 * in arch/mips/tools/offset.c
19 */
20struct sigcontext {
21 unsigned int sc_regmask; /* Unused */
22 unsigned int sc_status;
23 unsigned long long sc_pc;
24 unsigned long long sc_regs[32];
25 unsigned long long sc_fpregs[32];
26 unsigned int sc_ownedfp; /* Unused */
27 unsigned int sc_fpc_csr;
28 unsigned int sc_fpc_eir; /* Unused */
29 unsigned int sc_used_math;
30 unsigned int sc_ssflags; /* Unused */
31 unsigned long long sc_mdhi;
32 unsigned long long sc_mdlo;
33
34 unsigned int sc_cause; /* Unused */
35 unsigned int sc_badvaddr; /* Unused */
36
37 unsigned long sc_sigset[4]; /* kernel's sigset_t */
38};
39
40#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
41
42#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
43
44/*
45 * Keep this struct definition in sync with the sigcontext fragment
46 * in arch/mips/tools/offset.c
47 *
48 * Warning: this structure illdefined with sc_badvaddr being just an unsigned
49 * int so it was changed to unsigned long in 2.6.0-test1. This may break
50 * binary compatibility - no prisoners.
51 */
52struct sigcontext {
53 unsigned long sc_regs[32];
54 unsigned long sc_fpregs[32];
55 unsigned long sc_mdhi;
56 unsigned long sc_mdlo;
57 unsigned long sc_pc;
58 unsigned long sc_badvaddr;
59 unsigned int sc_status;
60 unsigned int sc_fpc_csr;
61 unsigned int sc_fpc_eir;
62 unsigned int sc_used_math;
63 unsigned int sc_cause;
64};
65
66#ifdef __KERNEL__
67
68#include <linux/posix_types.h>
69
70struct sigcontext32 {
71 __u32 sc_regmask; /* Unused */
72 __u32 sc_status;
73 __u64 sc_pc;
74 __u64 sc_regs[32];
75 __u64 sc_fpregs[32];
76 __u32 sc_ownedfp; /* Unused */
77 __u32 sc_fpc_csr;
78 __u32 sc_fpc_eir; /* Unused */
79 __u32 sc_used_math;
80 __u32 sc_ssflags; /* Unused */
81 __u64 sc_mdhi;
82 __u64 sc_mdlo;
83
84 __u32 sc_cause; /* Unused */
85 __u32 sc_badvaddr; /* Unused */
86
87 __u32 sc_sigset[4]; /* kernel's sigset_t */
88};
89#endif /* __KERNEL__ */
90
91#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
92
93#endif /* _ASM_SIGCONTEXT_H */
diff --git a/include/asm-mips/siginfo.h b/include/asm-mips/siginfo.h
new file mode 100644
index 000000000000..8ddd3c99bcf7
--- /dev/null
+++ b/include/asm-mips/siginfo.h
@@ -0,0 +1,132 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 1999, 2001, 2003 Ralf Baechle
7 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SIGINFO_H
10#define _ASM_SIGINFO_H
11
12#include <linux/config.h>
13
14#define SIGEV_HEAD_SIZE (sizeof(long) + 2*sizeof(int))
15#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE-SIGEV_HEAD_SIZE) / sizeof(int))
16#undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
17
18#define HAVE_ARCH_SIGINFO_T
19
20/*
21 * We duplicate the generic versions - <asm-generic/siginfo.h> is just borked
22 * by design ...
23 */
24#define HAVE_ARCH_COPY_SIGINFO
25struct siginfo;
26
27/*
28 * Careful to keep union _sifields from shifting ...
29 */
30#ifdef CONFIG_MIPS32
31#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
32#endif
33#ifdef CONFIG_MIPS64
34#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
35#endif
36
37#include <asm-generic/siginfo.h>
38
39typedef struct siginfo {
40 int si_signo;
41 int si_code;
42 int si_errno;
43 int __pad0[SI_MAX_SIZE / sizeof(int) - SI_PAD_SIZE - 3];
44
45 union {
46 int _pad[SI_PAD_SIZE];
47
48 /* kill() */
49 struct {
50 pid_t _pid; /* sender's pid */
51 __ARCH_SI_UID_T _uid; /* sender's uid */
52 } _kill;
53
54 /* POSIX.1b timers */
55 struct {
56 timer_t _tid; /* timer id */
57 int _overrun; /* overrun count */
58 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
59 sigval_t _sigval; /* same as below */
60 int _sys_private; /* not to be passed to user */
61 } _timer;
62
63 /* POSIX.1b signals */
64 struct {
65 pid_t _pid; /* sender's pid */
66 __ARCH_SI_UID_T _uid; /* sender's uid */
67 sigval_t _sigval;
68 } _rt;
69
70 /* SIGCHLD */
71 struct {
72 pid_t _pid; /* which child */
73 __ARCH_SI_UID_T _uid; /* sender's uid */
74 int _status; /* exit code */
75 clock_t _utime;
76 clock_t _stime;
77 } _sigchld;
78
79 /* IRIX SIGCHLD */
80 struct {
81 pid_t _pid; /* which child */
82 clock_t _utime;
83 int _status; /* exit code */
84 clock_t _stime;
85 } _irix_sigchld;
86
87 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
88 struct {
89 void __user *_addr; /* faulting insn/memory ref. */
90#ifdef __ARCH_SI_TRAPNO
91 int _trapno; /* TRAP # which caused the signal */
92#endif
93 } _sigfault;
94
95 /* SIGPOLL, SIGXFSZ (To do ...) */
96 struct {
97 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
98 int _fd;
99 } _sigpoll;
100 } _sifields;
101} siginfo_t;
102
103/*
104 * si_code values
105 * Again these have been choosen to be IRIX compatible.
106 */
107#undef SI_ASYNCIO
108#undef SI_TIMER
109#undef SI_MESGQ
110#define SI_ASYNCIO -2 /* sent by AIO completion */
111#define SI_TIMER __SI_CODE(__SI_TIMER,-3) /* sent by timer expiration */
112#define SI_MESGQ __SI_CODE(__SI_MESGQ,-4) /* sent by real time mesq state change */
113
114#ifdef __KERNEL__
115
116/*
117 * Duplicated here because of <asm-generic/siginfo.h> braindamage ...
118 */
119#include <linux/string.h>
120
121static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
122{
123 if (from->si_code < 0)
124 memcpy(to, from, sizeof(*to));
125 else
126 /* _sigchld is currently the largest know union member */
127 memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
128}
129
130#endif
131
132#endif /* _ASM_SIGINFO_H */
diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h
new file mode 100644
index 000000000000..994987db61be
--- /dev/null
+++ b/include/asm-mips/signal.h
@@ -0,0 +1,178 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 96, 97, 98, 99, 2003 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SIGNAL_H
10#define _ASM_SIGNAL_H
11
12#include <linux/config.h>
13#include <linux/types.h>
14
15#define _NSIG 128
16#define _NSIG_BPW (sizeof(unsigned long) * 8)
17#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
18
19typedef struct {
20 unsigned long sig[_NSIG_WORDS];
21} sigset_t;
22
23typedef unsigned long old_sigset_t; /* at least 32 bits */
24
25#define SIGHUP 1 /* Hangup (POSIX). */
26#define SIGINT 2 /* Interrupt (ANSI). */
27#define SIGQUIT 3 /* Quit (POSIX). */
28#define SIGILL 4 /* Illegal instruction (ANSI). */
29#define SIGTRAP 5 /* Trace trap (POSIX). */
30#define SIGIOT 6 /* IOT trap (4.2 BSD). */
31#define SIGABRT SIGIOT /* Abort (ANSI). */
32#define SIGEMT 7
33#define SIGFPE 8 /* Floating-point exception (ANSI). */
34#define SIGKILL 9 /* Kill, unblockable (POSIX). */
35#define SIGBUS 10 /* BUS error (4.2 BSD). */
36#define SIGSEGV 11 /* Segmentation violation (ANSI). */
37#define SIGSYS 12
38#define SIGPIPE 13 /* Broken pipe (POSIX). */
39#define SIGALRM 14 /* Alarm clock (POSIX). */
40#define SIGTERM 15 /* Termination (ANSI). */
41#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */
42#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */
43#define SIGCHLD 18 /* Child status has changed (POSIX). */
44#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
45#define SIGPWR 19 /* Power failure restart (System V). */
46#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
47#define SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
48#define SIGIO 22 /* I/O now possible (4.2 BSD). */
49#define SIGPOLL SIGIO /* Pollable event occurred (System V). */
50#define SIGSTOP 23 /* Stop, unblockable (POSIX). */
51#define SIGTSTP 24 /* Keyboard stop (POSIX). */
52#define SIGCONT 25 /* Continue (POSIX). */
53#define SIGTTIN 26 /* Background read from tty (POSIX). */
54#define SIGTTOU 27 /* Background write to tty (POSIX). */
55#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
56#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
57#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
58#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
59
60/* These should not be considered constants from userland. */
61#define SIGRTMIN 32
62#define SIGRTMAX _NSIG
63
64/*
65 * SA_FLAGS values:
66 *
67 * SA_ONSTACK indicates that a registered stack_t will be used.
68 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
69 * SA_RESTART flag to get restarting signals (which were the default long ago)
70 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
71 * SA_RESETHAND clears the handler when the signal is delivered.
72 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
73 * SA_NODEFER prevents the current signal from being masked in the handler.
74 *
75 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
76 * Unix names RESETHAND and NODEFER respectively.
77 */
78#define SA_ONSTACK 0x08000000
79#define SA_RESETHAND 0x80000000
80#define SA_RESTART 0x10000000
81#define SA_SIGINFO 0x00000008
82#define SA_NODEFER 0x40000000
83#define SA_NOCLDWAIT 0x00010000
84#define SA_NOCLDSTOP 0x00000001
85
86#define SA_NOMASK SA_NODEFER
87#define SA_ONESHOT SA_RESETHAND
88#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
89
90#define SA_RESTORER 0x04000000 /* Only for o32 */
91
92/*
93 * sigaltstack controls
94 */
95#define SS_ONSTACK 1
96#define SS_DISABLE 2
97
98#define MINSIGSTKSZ 2048
99#define SIGSTKSZ 8192
100
101#ifdef __KERNEL__
102
103/*
104 * These values of sa_flags are used only by the kernel as part of the
105 * irq handling routines.
106 *
107 * SA_INTERRUPT is also used by the irq handling routines.
108 * SA_SHIRQ flag is for shared interrupt support on PCI and EISA.
109 */
110#define SA_PROBE SA_ONESHOT
111#define SA_SAMPLE_RANDOM SA_RESTART
112#define SA_SHIRQ 0x02000000
113
114#endif /* __KERNEL__ */
115
116#define SIG_BLOCK 1 /* for blocking signals */
117#define SIG_UNBLOCK 2 /* for unblocking signals */
118#define SIG_SETMASK 3 /* for setting the signal mask */
119#define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility:
120 set only the low 32 bit of the sigset. */
121
122/* Type of a signal handler. */
123typedef void (*__sighandler_t)(int);
124
125/* Fake signal functions */
126#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
127#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
128#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
129
130struct sigaction {
131 unsigned int sa_flags;
132 __sighandler_t sa_handler;
133 sigset_t sa_mask;
134};
135
136struct k_sigaction {
137 struct sigaction sa;
138#ifdef CONFIG_BINFMT_IRIX
139 void (*sa_restorer)(void);
140#endif
141};
142
143/* IRIX compatible stack_t */
144typedef struct sigaltstack {
145 void *ss_sp;
146 size_t ss_size;
147 int ss_flags;
148} stack_t;
149
150#ifdef __KERNEL__
151#include <asm/sigcontext.h>
152
153/*
154 * The following break codes are or were in use for specific purposes in
155 * other MIPS operating systems. Linux/MIPS doesn't use all of them. The
156 * unused ones are here as placeholders; we might encounter them in
157 * non-Linux/MIPS object files or make use of them in the future.
158 */
159#define BRK_USERBP 0 /* User bp (used by debuggers) */
160#define BRK_KERNELBP 1 /* Break in the kernel */
161#define BRK_ABORT 2 /* Sometimes used by abort(3) to SIGIOT */
162#define BRK_BD_TAKEN 3 /* For bd slot emulation - not implemented */
163#define BRK_BD_NOTTAKEN 4 /* For bd slot emulation - not implemented */
164#define BRK_SSTEPBP 5 /* User bp (used by debuggers) */
165#define BRK_OVERFLOW 6 /* Overflow check */
166#define BRK_DIVZERO 7 /* Divide by zero check */
167#define BRK_RANGE 8 /* Range error check */
168#define BRK_STACKOVERFLOW 9 /* For Ada stackchecking */
169#define BRK_NORLD 10 /* No rld found - not used by Linux/MIPS */
170#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */
171#define BRK_MULOVF 1023 /* Multiply overflow */
172#define BRK_BUG 512 /* Used by BUG() */
173
174#define ptrace_signal_deliver(regs, cookie) do { } while (0)
175
176#endif /* __KERNEL__ */
177
178#endif /* _ASM_SIGNAL_H */
diff --git a/include/asm-mips/sim.h b/include/asm-mips/sim.h
new file mode 100644
index 000000000000..6333169be329
--- /dev/null
+++ b/include/asm-mips/sim.h
@@ -0,0 +1,83 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999, 2000, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SIM_H
10#define _ASM_SIM_H
11
12#include <linux/config.h>
13
14#include <asm/offset.h>
15
16#define __str2(x) #x
17#define __str(x) __str2(x)
18
19#ifdef CONFIG_MIPS32
20
21#define save_static_function(symbol) \
22__asm__ ( \
23 ".text\n\t" \
24 ".globl\t" #symbol "\n\t" \
25 ".align\t2\n\t" \
26 ".type\t" #symbol ", @function\n\t" \
27 ".ent\t" #symbol ", 0\n" \
28 #symbol":\n\t" \
29 ".frame\t$29, 0, $31\n\t" \
30 "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
31 "sw\t$17,"__str(PT_R17)"($29)\n\t" \
32 "sw\t$18,"__str(PT_R18)"($29)\n\t" \
33 "sw\t$19,"__str(PT_R19)"($29)\n\t" \
34 "sw\t$20,"__str(PT_R20)"($29)\n\t" \
35 "sw\t$21,"__str(PT_R21)"($29)\n\t" \
36 "sw\t$22,"__str(PT_R22)"($29)\n\t" \
37 "sw\t$23,"__str(PT_R23)"($29)\n\t" \
38 "sw\t$30,"__str(PT_R30)"($29)\n\t" \
39 "j\t_" #symbol "\n\t" \
40 ".end\t" #symbol "\n\t" \
41 ".size\t" #symbol",. - " #symbol)
42
43#define nabi_no_regargs
44
45#endif /* CONFIG_MIPS32 */
46
47#ifdef CONFIG_MIPS64
48
49#define save_static_function(symbol) \
50__asm__ ( \
51 ".text\n\t" \
52 ".globl\t" #symbol "\n\t" \
53 ".align\t2\n\t" \
54 ".type\t" #symbol ", @function\n\t" \
55 ".ent\t" #symbol ", 0\n" \
56 #symbol":\n\t" \
57 ".frame\t$29, 0, $31\n\t" \
58 "sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
59 "sd\t$17,"__str(PT_R17)"($29)\n\t" \
60 "sd\t$18,"__str(PT_R18)"($29)\n\t" \
61 "sd\t$19,"__str(PT_R19)"($29)\n\t" \
62 "sd\t$20,"__str(PT_R20)"($29)\n\t" \
63 "sd\t$21,"__str(PT_R21)"($29)\n\t" \
64 "sd\t$22,"__str(PT_R22)"($29)\n\t" \
65 "sd\t$23,"__str(PT_R23)"($29)\n\t" \
66 "sd\t$30,"__str(PT_R30)"($29)\n\t" \
67 "j\t_" #symbol "\n\t" \
68 ".end\t" #symbol "\n\t" \
69 ".size\t" #symbol",. - " #symbol)
70
71#define nabi_no_regargs \
72 unsigned long __dummy0, \
73 unsigned long __dummy1, \
74 unsigned long __dummy2, \
75 unsigned long __dummy3, \
76 unsigned long __dummy4, \
77 unsigned long __dummy5, \
78 unsigned long __dummy6, \
79 unsigned long __dummy7,
80
81#endif /* CONFIG_MIPS64 */
82
83#endif /* _ASM_SIM_H */
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h
new file mode 100644
index 000000000000..8ba370ecfd4c
--- /dev/null
+++ b/include/asm-mips/smp.h
@@ -0,0 +1,111 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General
3 * Public License. See the file "COPYING" in the main directory of this
4 * archive for more details.
5 *
6 * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com)
7 * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc.
8 * Copyright (C) 2000, 2001, 2002 Ralf Baechle
9 * Copyright (C) 2000, 2001 Broadcom Corporation
10 */
11#ifndef __ASM_SMP_H
12#define __ASM_SMP_H
13
14#include <linux/config.h>
15
16#ifdef CONFIG_SMP
17
18#include <linux/bitops.h>
19#include <linux/linkage.h>
20#include <linux/threads.h>
21#include <linux/cpumask.h>
22#include <asm/atomic.h>
23
24#define smp_processor_id() (current_thread_info()->cpu)
25
26/* Map from cpu id to sequential logical cpu number. This will only
27 not be idempotent when cpus failed to come on-line. */
28extern int __cpu_number_map[NR_CPUS];
29#define cpu_number_map(cpu) __cpu_number_map[cpu]
30
31/* The reverse map from sequential logical cpu number to cpu id. */
32extern int __cpu_logical_map[NR_CPUS];
33#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
34
35#define NO_PROC_ID (-1)
36
37struct call_data_struct {
38 void (*func)(void *);
39 void *info;
40 atomic_t started;
41 atomic_t finished;
42 int wait;
43};
44
45extern struct call_data_struct *call_data;
46
47#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */
48#define SMP_CALL_FUNCTION 0x2
49
50extern cpumask_t phys_cpu_present_map;
51extern cpumask_t cpu_online_map;
52#define cpu_possible_map phys_cpu_present_map
53
54extern cpumask_t cpu_callout_map;
55/* We don't mark CPUs online until __cpu_up(), so we need another measure */
56static inline int num_booting_cpus(void)
57{
58 return cpus_weight(cpu_callout_map);
59}
60
61/* These are defined by the board-specific code. */
62
63/*
64 * Cause the function described by call_data to be executed on the passed
65 * cpu. When the function has finished, increment the finished field of
66 * call_data.
67 */
68extern void core_send_ipi(int cpu, unsigned int action);
69
70/*
71 * Firmware CPU startup hook
72 */
73extern void prom_boot_secondary(int cpu, struct task_struct *idle);
74
75/*
76 * After we've done initial boot, this function is called to allow the
77 * board code to clean up state, if needed
78 */
79extern void prom_init_secondary(void);
80
81/*
82 * Detect available CPUs, populate phys_cpu_present_map before smp_init
83 */
84extern void prom_prepare_cpus(unsigned int max_cpus);
85
86/*
87 * Last chance for the board code to finish SMP initialization before
88 * the CPU is "online".
89 */
90extern void prom_smp_finish(void);
91
92/* Hook for after all CPUs are online */
93extern void prom_cpus_done(void);
94
95extern void asmlinkage smp_bootstrap(void);
96
97/*
98 * this function sends a 'reschedule' IPI to another CPU.
99 * it goes straight through and wastes no time serializing
100 * anything. Worst case is that we lose a reschedule ...
101 */
102static inline void smp_send_reschedule(int cpu)
103{
104 core_send_ipi(cpu, SMP_RESCHEDULE_YOURSELF);
105}
106
107extern asmlinkage void smp_call_function_interrupt(void);
108
109#endif /* CONFIG_SMP */
110
111#endif /* __ASM_SMP_H */
diff --git a/include/asm-mips/sn/addrs.h b/include/asm-mips/sn/addrs.h
new file mode 100644
index 000000000000..2b5cef1ba37f
--- /dev/null
+++ b/include/asm-mips/sn/addrs.h
@@ -0,0 +1,458 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc.
7 * Copyright (C) 1999, 2000 by Ralf Baechle
8 */
9#ifndef _ASM_SN_ADDRS_H
10#define _ASM_SN_ADDRS_H
11
12#include <linux/config.h>
13
14#ifndef __ASSEMBLY__
15#include <linux/types.h>
16#endif /* !__ASSEMBLY__ */
17
18#include <asm/addrspace.h>
19#include <asm/sn/kldir.h>
20
21#if defined(CONFIG_SGI_IP27)
22#include <asm/sn/sn0/addrs.h>
23#elif defined(CONFIG_SGI_IP35)
24#include <asm/sn/sn1/addrs.h>
25#endif
26
27
28#ifndef __ASSEMBLY__
29
30#if defined(CONFIG_SGI_IO) /* FIXME */
31#define PS_UINT_CAST (__psunsigned_t)
32#define UINT64_CAST (__uint64_t)
33#else /* CONFIG_SGI_IO */
34#define PS_UINT_CAST (unsigned long)
35#define UINT64_CAST (unsigned long)
36#endif /* CONFIG_SGI_IO */
37
38#define HUBREG_CAST (volatile hubreg_t *)
39
40#else /* __ASSEMBLY__ */
41
42#define PS_UINT_CAST
43#define UINT64_CAST
44#define HUBREG_CAST
45
46#endif /* __ASSEMBLY__ */
47
48
49#define NASID_GET_META(_n) ((_n) >> NASID_LOCAL_BITS)
50#ifdef CONFIG_SGI_IP27
51#define NASID_GET_LOCAL(_n) ((_n) & 0xf)
52#endif
53#define NASID_MAKE(_m, _l) (((_m) << NASID_LOCAL_BITS) | (_l))
54
55#define NODE_ADDRSPACE_MASK (NODE_ADDRSPACE_SIZE - 1)
56#define TO_NODE_ADDRSPACE(_pa) (UINT64_CAST (_pa) & NODE_ADDRSPACE_MASK)
57
58#define CHANGE_ADDR_NASID(_pa, _nasid) \
59 ((UINT64_CAST (_pa) & ~NASID_MASK) | \
60 (UINT64_CAST(_nasid) << NASID_SHFT))
61
62
63/*
64 * The following macros are used to index to the beginning of a specific
65 * node's address space.
66 */
67
68#define NODE_OFFSET(_n) (UINT64_CAST (_n) << NODE_SIZE_BITS)
69
70#define NODE_CAC_BASE(_n) (CAC_BASE + NODE_OFFSET(_n))
71#define NODE_HSPEC_BASE(_n) (HSPEC_BASE + NODE_OFFSET(_n))
72#define NODE_IO_BASE(_n) (IO_BASE + NODE_OFFSET(_n))
73#define NODE_MSPEC_BASE(_n) (MSPEC_BASE + NODE_OFFSET(_n))
74#define NODE_UNCAC_BASE(_n) (UNCAC_BASE + NODE_OFFSET(_n))
75
76#define TO_NODE(_n, _x) (NODE_OFFSET(_n) | ((_x) ))
77#define TO_NODE_CAC(_n, _x) (NODE_CAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
78#define TO_NODE_UNCAC(_n, _x) (NODE_UNCAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
79#define TO_NODE_MSPEC(_n, _x) (NODE_MSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
80#define TO_NODE_HSPEC(_n, _x) (NODE_HSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
81
82
83#define RAW_NODE_SWIN_BASE(nasid, widget) \
84 (NODE_IO_BASE(nasid) + (UINT64_CAST (widget) << SWIN_SIZE_BITS))
85
86#define WIDGETID_GET(addr) ((unsigned char)((addr >> SWIN_SIZE_BITS) & 0xff))
87
88/*
89 * The following definitions pertain to the IO special address
90 * space. They define the location of the big and little windows
91 * of any given node.
92 */
93
94#define SWIN_SIZE_BITS 24
95#define SWIN_SIZE (UINT64_CAST 1 << 24)
96#define SWIN_SIZEMASK (SWIN_SIZE - 1)
97#define SWIN_WIDGET_MASK 0xF
98
99/*
100 * Convert smallwindow address to xtalk address.
101 *
102 * 'addr' can be physical or virtual address, but will be converted
103 * to Xtalk address in the range 0 -> SWINZ_SIZEMASK
104 */
105#define SWIN_WIDGETADDR(addr) ((addr) & SWIN_SIZEMASK)
106#define SWIN_WIDGETNUM(addr) (((addr) >> SWIN_SIZE_BITS) & SWIN_WIDGET_MASK)
107/*
108 * Verify if addr belongs to small window address on node with "nasid"
109 *
110 *
111 * NOTE: "addr" is expected to be XKPHYS address, and NOT physical
112 * address
113 *
114 *
115 */
116#define NODE_SWIN_ADDR(nasid, addr) \
117 (((addr) >= NODE_SWIN_BASE(nasid, 0)) && \
118 ((addr) < (NODE_SWIN_BASE(nasid, HUB_NUM_WIDGET) + SWIN_SIZE)\
119 ))
120
121/*
122 * The following define the major position-independent aliases used
123 * in SN.
124 * UALIAS -- 256MB in size, reads in the UALIAS result in
125 * uncached references to the memory of the reader's node.
126 * CPU_UALIAS -- 128kb in size, the bottom part of UALIAS is flipped
127 * depending on which CPU does the access to provide
128 * all CPUs with unique uncached memory at low addresses.
129 * LBOOT -- 256MB in size, reads in the LBOOT area result in
130 * uncached references to the local hub's boot prom and
131 * other directory-bus connected devices.
132 * IALIAS -- 8MB in size, reads in the IALIAS result in uncached
133 * references to the local hub's registers.
134 */
135
136#define UALIAS_BASE HSPEC_BASE
137#define UALIAS_SIZE 0x10000000 /* 256 Megabytes */
138#define UALIAS_LIMIT (UALIAS_BASE + UALIAS_SIZE)
139
140/*
141 * The bottom of ualias space is flipped depending on whether you're
142 * processor 0 or 1 within a node.
143 */
144#ifdef CONFIG_SGI_IP27
145#define UALIAS_FLIP_BASE UALIAS_BASE
146#define UALIAS_FLIP_SIZE 0x20000
147#define UALIAS_FLIP_BIT 0x10000
148#define UALIAS_FLIP_ADDR(_x) (cputoslice(smp_processor_id()) ? \
149 (_x) ^ UALIAS_FLIP_BIT : (_x))
150
151#define LBOOT_BASE (HSPEC_BASE + 0x10000000)
152#define LBOOT_SIZE 0x10000000
153#define LBOOT_LIMIT (LBOOT_BASE + LBOOT_SIZE)
154#define LBOOT_STRIDE 0 /* IP27 has only one CPU PROM */
155
156#endif
157
158#define HUB_REGISTER_WIDGET 1
159#define IALIAS_BASE NODE_SWIN_BASE(0, HUB_REGISTER_WIDGET)
160#define IALIAS_SIZE 0x800000 /* 8 Megabytes */
161#define IS_IALIAS(_a) (((_a) >= IALIAS_BASE) && \
162 ((_a) < (IALIAS_BASE + IALIAS_SIZE)))
163
164/*
165 * Macro for referring to Hub's RBOOT space
166 */
167
168#ifdef CONFIG_SGI_IP27
169#define RBOOT_SIZE 0x10000000 /* 256 Megabytes */
170#define NODE_RBOOT_BASE(_n) (NODE_HSPEC_BASE(_n) + 0x30000000)
171#define NODE_RBOOT_LIMIT(_n) (NODE_RBOOT_BASE(_n) + RBOOT_SIZE)
172
173#endif
174
175/*
176 * Macros for referring the Hub's back door space
177 *
178 * These macros correctly process addresses in any node's space.
179 * WARNING: They won't work in assembler.
180 *
181 * BDDIR_ENTRY_LO returns the address of the low double-word of the dir
182 * entry corresponding to a physical (Cac or Uncac) address.
183 * BDDIR_ENTRY_HI returns the address of the high double-word of the entry.
184 * BDPRT_ENTRY returns the address of the double-word protection entry
185 * corresponding to the page containing the physical address.
186 * BDPRT_ENTRY_S Stores the value into the protection entry.
187 * BDPRT_ENTRY_L Load the value from the protection entry.
188 * BDECC_ENTRY returns the address of the ECC byte corresponding to a
189 * double-word at a specified physical address.
190 * BDECC_ENTRY_H returns the address of the two ECC bytes corresponding to a
191 * quad-word at a specified physical address.
192 */
193#define NODE_BDOOR_BASE(_n) (NODE_HSPEC_BASE(_n) + (NODE_ADDRSPACE_SIZE/2))
194
195#define NODE_BDECC_BASE(_n) (NODE_BDOOR_BASE(_n))
196#define NODE_BDDIR_BASE(_n) (NODE_BDOOR_BASE(_n) + (NODE_ADDRSPACE_SIZE/4))
197#ifdef CONFIG_SGI_IP27
198#define BDDIR_ENTRY_LO(_pa) ((HSPEC_BASE + \
199 NODE_ADDRSPACE_SIZE * 3 / 4 + \
200 0x200) | \
201 UINT64_CAST (_pa) & NASID_MASK | \
202 UINT64_CAST (_pa) >> 2 & BDDIR_UPPER_MASK | \
203 UINT64_CAST (_pa) >> 3 & 0x1f << 4)
204
205#define BDDIR_ENTRY_HI(_pa) ((HSPEC_BASE + \
206 NODE_ADDRSPACE_SIZE * 3 / 4 + \
207 0x208) | \
208 UINT64_CAST (_pa) & NASID_MASK | \
209 UINT64_CAST (_pa) >> 2 & BDDIR_UPPER_MASK | \
210 UINT64_CAST (_pa) >> 3 & 0x1f << 4)
211
212#define BDPRT_ENTRY(_pa, _rgn) ((HSPEC_BASE + \
213 NODE_ADDRSPACE_SIZE * 3 / 4) | \
214 UINT64_CAST (_pa) & NASID_MASK | \
215 UINT64_CAST (_pa) >> 2 & BDDIR_UPPER_MASK | \
216 (_rgn) << 3)
217#define BDPRT_ENTRY_ADDR(_pa,_rgn) (BDPRT_ENTRY((_pa),(_rgn)))
218#define BDPRT_ENTRY_S(_pa,_rgn,_val) (*(__psunsigned_t *)BDPRT_ENTRY((_pa),(_rgn))=(_val))
219#define BDPRT_ENTRY_L(_pa,_rgn) (*(__psunsigned_t *)BDPRT_ENTRY((_pa),(_rgn)))
220
221#define BDECC_ENTRY(_pa) ((HSPEC_BASE + \
222 NODE_ADDRSPACE_SIZE / 2) | \
223 UINT64_CAST (_pa) & NASID_MASK | \
224 UINT64_CAST (_pa) >> 2 & BDECC_UPPER_MASK | \
225 UINT64_CAST (_pa) >> 3 & 3)
226
227/*
228 * Macro to convert a back door directory or protection address into the
229 * raw physical address of the associated cache line or protection page.
230 */
231#define BDADDR_IS_DIR(_ba) ((UINT64_CAST (_ba) & 0x200) != 0)
232#define BDADDR_IS_PRT(_ba) ((UINT64_CAST (_ba) & 0x200) == 0)
233
234#define BDDIR_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
235 (UINT64_CAST (_ba) & BDDIR_UPPER_MASK)<<2 | \
236 (UINT64_CAST (_ba) & 0x1f << 4) << 3)
237
238#define BDPRT_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
239 (UINT64_CAST (_ba) & BDDIR_UPPER_MASK)<<2)
240
241#define BDECC_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
242 (UINT64_CAST (_ba) & BDECC_UPPER_MASK)<<2 | \
243 (UINT64_CAST (_ba) & 3) << 3)
244#endif /* CONFIG_SGI_IP27 */
245
246
247/*
248 * The following macros produce the correct base virtual address for
249 * the hub registers. The LOCAL_HUB_* macros produce the appropriate
250 * address for the local registers. The REMOTE_HUB_* macro produce
251 * the address for the specified hub's registers. The intent is
252 * that the appropriate PI, MD, NI, or II register would be substituted
253 * for _x.
254 */
255
256#ifdef _STANDALONE
257
258/* DO NOT USE THESE DIRECTLY IN THE KERNEL. SEE BELOW. */
259#define LOCAL_HUB(_x) (HUBREG_CAST (IALIAS_BASE + (_x)))
260#define REMOTE_HUB(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
261 0x800000 + (_x)))
262#endif /* _STANDALONE */
263
264/*
265 * WARNING:
266 * When certain Hub chip workaround are defined, it's not sufficient
267 * to dereference the *_HUB_ADDR() macros. You should instead use
268 * HUB_L() and HUB_S() if you must deal with pointers to hub registers.
269 * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S().
270 * They're always safe.
271 */
272#define LOCAL_HUB_ADDR(_x) (HUBREG_CAST (IALIAS_BASE + (_x)))
273#define REMOTE_HUB_ADDR(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
274 0x800000 + (_x)))
275#ifdef CONFIG_SGI_IP27
276#define REMOTE_HUB_PI_ADDR(_n, _sn, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
277 0x800000 + (_x)))
278#endif /* CONFIG_SGI_IP27 */
279
280#ifndef __ASSEMBLY__
281
282#define HUB_L(_a) *(_a)
283#define HUB_S(_a, _d) *(_a) = (_d)
284
285#define LOCAL_HUB_L(_r) HUB_L(LOCAL_HUB_ADDR(_r))
286#define LOCAL_HUB_S(_r, _d) HUB_S(LOCAL_HUB_ADDR(_r), (_d))
287#define REMOTE_HUB_L(_n, _r) HUB_L(REMOTE_HUB_ADDR((_n), (_r)))
288#define REMOTE_HUB_S(_n, _r, _d) HUB_S(REMOTE_HUB_ADDR((_n), (_r)), (_d))
289#define REMOTE_HUB_PI_L(_n, _sn, _r) HUB_L(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)))
290#define REMOTE_HUB_PI_S(_n, _sn, _r, _d) HUB_S(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)), (_d))
291
292#endif /* !__ASSEMBLY__ */
293
294/*
295 * The following macros are used to get to a hub/bridge register, given
296 * the base of the register space.
297 */
298#define HUB_REG_PTR(_base, _off) \
299 (HUBREG_CAST ((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
300
301#define HUB_REG_PTR_L(_base, _off) \
302 HUB_L(HUB_REG_PTR((_base), (_off)))
303
304#define HUB_REG_PTR_S(_base, _off, _data) \
305 HUB_S(HUB_REG_PTR((_base), (_off)), (_data))
306
307/*
308 * Software structure locations -- permanently fixed
309 * See diagram in kldir.h
310 */
311
312#define PHYS_RAMBASE 0x0
313#define K0_RAMBASE PHYS_TO_K0(PHYS_RAMBASE)
314
315#define EX_HANDLER_OFFSET(slice) ((slice) << 16)
316#define EX_HANDLER_ADDR(nasid, slice) \
317 PHYS_TO_K0(NODE_OFFSET(nasid) | EX_HANDLER_OFFSET(slice))
318#define EX_HANDLER_SIZE 0x0400
319
320#define EX_FRAME_OFFSET(slice) ((slice) << 16 | 0x400)
321#define EX_FRAME_ADDR(nasid, slice) \
322 PHYS_TO_K0(NODE_OFFSET(nasid) | EX_FRAME_OFFSET(slice))
323#define EX_FRAME_SIZE 0x0c00
324
325#define ARCS_SPB_OFFSET 0x1000
326#define ARCS_SPB_ADDR(nasid) \
327 PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET)
328#define ARCS_SPB_SIZE 0x0400
329
330#ifdef _STANDALONE
331
332#define ARCS_TVECTOR_OFFSET 0x2800
333#define ARCS_PVECTOR_OFFSET 0x2c00
334
335/*
336 * These addresses are used by the master CPU to install the transfer
337 * and private vectors. All others use the SPB to find them.
338 */
339#define TVADDR (NODE_CAC_BASE(get_nasid()) + ARCS_TVECTOR_OFFSET)
340#define PVADDR (NODE_CAC_BASE(get_nasid()) + ARCS_PVECTOR_OFFSET)
341
342#endif /* _STANDALONE */
343
344#define KLDIR_OFFSET 0x2000
345#define KLDIR_ADDR(nasid) \
346 TO_NODE_UNCAC((nasid), KLDIR_OFFSET)
347#define KLDIR_SIZE 0x0400
348
349
350/*
351 * Software structure locations -- indirected through KLDIR
352 * See diagram in kldir.h
353 *
354 * Important: All low memory structures must only be accessed
355 * uncached, except for the symmon stacks.
356 */
357
358#define KLI_LAUNCH 0 /* Dir. entries */
359#define KLI_KLCONFIG 1
360#define KLI_NMI 2
361#define KLI_GDA 3
362#define KLI_FREEMEM 4
363#define KLI_SYMMON_STK 5
364#define KLI_PI_ERROR 6
365#define KLI_KERN_VARS 7
366#define KLI_KERN_XP 8
367#define KLI_KERN_PARTID 9
368
369#ifndef __ASSEMBLY__
370
371#define KLD_BASE(nasid) ((kldir_ent_t *) KLDIR_ADDR(nasid))
372#define KLD_LAUNCH(nasid) (KLD_BASE(nasid) + KLI_LAUNCH)
373#define KLD_NMI(nasid) (KLD_BASE(nasid) + KLI_NMI)
374#define KLD_KLCONFIG(nasid) (KLD_BASE(nasid) + KLI_KLCONFIG)
375#define KLD_PI_ERROR(nasid) (KLD_BASE(nasid) + KLI_PI_ERROR)
376#define KLD_GDA(nasid) (KLD_BASE(nasid) + KLI_GDA)
377#define KLD_SYMMON_STK(nasid) (KLD_BASE(nasid) + KLI_SYMMON_STK)
378#define KLD_FREEMEM(nasid) (KLD_BASE(nasid) + KLI_FREEMEM)
379#define KLD_KERN_VARS(nasid) (KLD_BASE(nasid) + KLI_KERN_VARS)
380#define KLD_KERN_XP(nasid) (KLD_BASE(nasid) + KLI_KERN_XP)
381#define KLD_KERN_PARTID(nasid) (KLD_BASE(nasid) + KLI_KERN_PARTID)
382
383#define LAUNCH_OFFSET(nasid, slice) \
384 (KLD_LAUNCH(nasid)->offset + \
385 KLD_LAUNCH(nasid)->stride * (slice))
386#define LAUNCH_ADDR(nasid, slice) \
387 TO_NODE_UNCAC((nasid), LAUNCH_OFFSET(nasid, slice))
388#define LAUNCH_SIZE(nasid) KLD_LAUNCH(nasid)->size
389
390#define NMI_OFFSET(nasid, slice) \
391 (KLD_NMI(nasid)->offset + \
392 KLD_NMI(nasid)->stride * (slice))
393#define NMI_ADDR(nasid, slice) \
394 TO_NODE_UNCAC((nasid), NMI_OFFSET(nasid, slice))
395#define NMI_SIZE(nasid) KLD_NMI(nasid)->size
396
397#define KLCONFIG_OFFSET(nasid) KLD_KLCONFIG(nasid)->offset
398#define KLCONFIG_ADDR(nasid) \
399 TO_NODE_UNCAC((nasid), KLCONFIG_OFFSET(nasid))
400#define KLCONFIG_SIZE(nasid) KLD_KLCONFIG(nasid)->size
401
402#define GDA_ADDR(nasid) KLD_GDA(nasid)->pointer
403#define GDA_SIZE(nasid) KLD_GDA(nasid)->size
404
405#define SYMMON_STK_OFFSET(nasid, slice) \
406 (KLD_SYMMON_STK(nasid)->offset + \
407 KLD_SYMMON_STK(nasid)->stride * (slice))
408#define SYMMON_STK_STRIDE(nasid) KLD_SYMMON_STK(nasid)->stride
409
410#define SYMMON_STK_ADDR(nasid, slice) \
411 TO_NODE_CAC((nasid), SYMMON_STK_OFFSET(nasid, slice))
412
413#define SYMMON_STK_SIZE(nasid) KLD_SYMMON_STK(nasid)->stride
414
415#define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size)
416
417/* loading symmon 4k below UNIX. the arcs loader needs the topaddr for a
418 * relocatable program
419 */
420#define UNIX_DEBUG_LOADADDR 0x300000
421#define SYMMON_LOADADDR(nasid) \
422 TO_NODE(nasid, PHYS_TO_K0(UNIX_DEBUG_LOADADDR - 0x1000))
423
424#define FREEMEM_OFFSET(nasid) KLD_FREEMEM(nasid)->offset
425#define FREEMEM_ADDR(nasid) SYMMON_STK_END(nasid)
426/*
427 * XXX
428 * Fix this. FREEMEM_ADDR should be aware of if symmon is loaded.
429 * Also, it should take into account what prom thinks to be a safe
430 * address
431 PHYS_TO_K0(NODE_OFFSET(nasid) + FREEMEM_OFFSET(nasid))
432 */
433#define FREEMEM_SIZE(nasid) KLD_FREEMEM(nasid)->size
434
435#define PI_ERROR_OFFSET(nasid) KLD_PI_ERROR(nasid)->offset
436#define PI_ERROR_ADDR(nasid) \
437 TO_NODE_UNCAC((nasid), PI_ERROR_OFFSET(nasid))
438#define PI_ERROR_SIZE(nasid) KLD_PI_ERROR(nasid)->size
439
440#define NODE_OFFSET_TO_K0(_nasid, _off) \
441 PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE)
442#define NODE_OFFSET_TO_K1(_nasid, _off) \
443 TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE)
444#define K0_TO_NODE_OFFSET(_k0addr) \
445 ((__psunsigned_t)(_k0addr) & NODE_ADDRSPACE_MASK)
446
447#define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer
448#define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size
449
450#define KERN_XP_ADDR(nasid) KLD_KERN_XP(nasid)->pointer
451#define KERN_XP_SIZE(nasid) KLD_KERN_XP(nasid)->size
452
453#define GPDA_ADDR(nasid) TO_NODE_CAC(nasid, GPDA_OFFSET)
454
455#endif /* !__ASSEMBLY__ */
456
457
458#endif /* _ASM_SN_ADDRS_H */
diff --git a/include/asm-mips/sn/agent.h b/include/asm-mips/sn/agent.h
new file mode 100644
index 000000000000..d6df13aaed49
--- /dev/null
+++ b/include/asm-mips/sn/agent.h
@@ -0,0 +1,47 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * This file has definitions for the hub and snac interfaces.
7 *
8 * Copyright (C) 1992 - 1997, 1999, 2000 Silcon Graphics, Inc.
9 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SGI_SN_AGENT_H
12#define _ASM_SGI_SN_AGENT_H
13
14#include <linux/config.h>
15#include <linux/topology.h>
16#include <asm/sn/addrs.h>
17#include <asm/sn/arch.h>
18
19#if defined(CONFIG_SGI_IP27)
20#include <asm/sn/sn0/hub.h>
21#elif defined(CONFIG_SGI_IP35)
22#include <asm/sn/sn1/hub.h>
23#endif /* !CONFIG_SGI_IP27 && !CONFIG_SGI_IP35 */
24
25/*
26 * NIC register macros
27 */
28
29#if defined(CONFIG_SGI_IP27)
30#define HUB_NIC_ADDR(_cpuid) \
31 REMOTE_HUB_ADDR(COMPACT_TO_NASID_NODEID(cpu_to_node(_cpuid)), \
32 MD_MLAN_CTL)
33#endif
34
35#define SET_HUB_NIC(_my_cpuid, _val) \
36 (HUB_S(HUB_NIC_ADDR(_my_cpuid), (_val)))
37
38#define SET_MY_HUB_NIC(_v) \
39 SET_HUB_NIC(cpuid(), (_v))
40
41#define GET_HUB_NIC(_my_cpuid) \
42 (HUB_L(HUB_NIC_ADDR(_my_cpuid)))
43
44#define GET_MY_HUB_NIC() \
45 GET_HUB_NIC(cpuid())
46
47#endif /* _ASM_SGI_SN_AGENT_H */
diff --git a/include/asm-mips/sn/arch.h b/include/asm-mips/sn/arch.h
new file mode 100644
index 000000000000..d247a819de7f
--- /dev/null
+++ b/include/asm-mips/sn/arch.h
@@ -0,0 +1,66 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI specific setup.
7 *
8 * Copyright (C) 1995 - 1997, 1999 Silcon Graphics, Inc.
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SN_ARCH_H
12#define _ASM_SN_ARCH_H
13
14#include <linux/config.h>
15#include <linux/types.h>
16#include <asm/sn/types.h>
17#ifdef CONFIG_SGI_IP27
18#include <asm/sn/sn0/arch.h>
19#endif
20
21typedef u64 hubreg_t;
22typedef u64 nic_t;
23
24#define cputonasid(cpu) (cpu_data[(cpu)].p_nasid)
25#define cputoslice(cpu) (cpu_data[(cpu)].p_slice)
26#define makespnum(_nasid, _slice) \
27 (((_nasid) << CPUS_PER_NODE_SHFT) | (_slice))
28
29#define INVALID_NASID (nasid_t)-1
30#define INVALID_CNODEID (cnodeid_t)-1
31#define INVALID_PNODEID (pnodeid_t)-1
32#define INVALID_MODULE (moduleid_t)-1
33#define INVALID_PARTID (partid_t)-1
34
35extern nasid_t get_nasid(void);
36extern cnodeid_t get_cpu_cnode(cpuid_t);
37extern int get_cpu_slice(cpuid_t);
38
39/*
40 * NO ONE should access these arrays directly. The only reason we refer to
41 * them here is to avoid the procedure call that would be required in the
42 * macros below. (Really want private data members here :-)
43 */
44extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
45extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
46
47/*
48 * These macros are used by various parts of the kernel to convert
49 * between the three different kinds of node numbering. At least some
50 * of them may change to procedure calls in the future, but the macros
51 * will continue to work. Don't use the arrays above directly.
52 */
53
54#define NASID_TO_REGION(nnode) \
55 ((nnode) >> \
56 (is_fine_dirmode() ? NASID_TO_FINEREG_SHFT : NASID_TO_COARSEREG_SHFT))
57
58extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
59extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
60extern cnodeid_t cpuid_to_compact_node[MAXCPUS];
61
62#define NASID_TO_COMPACT_NODEID(nnode) (nasid_to_compact_node[nnode])
63#define COMPACT_TO_NASID_NODEID(cnode) (compact_to_nasid_node[cnode])
64#define CPUID_TO_COMPACT_NODEID(cpu) (cpuid_to_compact_node[(cpu)])
65
66#endif /* _ASM_SN_ARCH_H */
diff --git a/include/asm-mips/sn/gda.h b/include/asm-mips/sn/gda.h
new file mode 100644
index 000000000000..9cb6ff770915
--- /dev/null
+++ b/include/asm-mips/sn/gda.h
@@ -0,0 +1,107 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/gda.h>.
7 *
8 * Copyright (C) 1992 - 1997, 2000 Silicon Graphics, Inc.
9 *
10 * gda.h -- Contains the data structure for the global data area,
11 * The GDA contains information communicated between the
12 * PROM, SYMMON, and the kernel.
13 */
14#ifndef _ASM_SN_GDA_H
15#define _ASM_SN_GDA_H
16
17#include <asm/sn/addrs.h>
18
19#define GDA_MAGIC 0x58464552
20
21/*
22 * GDA Version History
23 *
24 * Version # | Change
25 * -------------+-------------------------------------------------------
26 * 1 | Initial SN0 version
27 * 2 | Prom sets g_partid field to the partition number. 0 IS
28 * | a valid partition #.
29 */
30
31#define GDA_VERSION 2 /* Current GDA version # */
32
33#define G_MAGICOFF 0
34#define G_VERSIONOFF 4
35#define G_PROMOPOFF 6
36#define G_MASTEROFF 8
37#define G_VDSOFF 12
38#define G_HKDNORMOFF 16
39#define G_HKDUTLBOFF 24
40#define G_HKDXUTLBOFF 32
41#define G_PARTIDOFF 40
42#define G_TABLEOFF 128
43
44#ifndef __ASSEMBLY__
45
46typedef struct gda {
47 u32 g_magic; /* GDA magic number */
48 u16 g_version; /* Version of this structure */
49 u16 g_masterid; /* The NASID:CPUNUM of the master cpu */
50 u32 g_promop; /* Passes requests from the kernel to prom */
51 u32 g_vds; /* Store the virtual dipswitches here */
52 void **g_hooked_norm;/* ptr to pda loc for norm hndlr */
53 void **g_hooked_utlb;/* ptr to pda loc for utlb hndlr */
54 void **g_hooked_xtlb;/* ptr to pda loc for xtlb hndlr */
55 int g_partid; /* partition id */
56 int g_symmax; /* Max symbols in name table. */
57 void *g_dbstab; /* Address of idbg symbol table */
58 char *g_nametab; /* Address of idbg name table */
59 void *g_ktext_repmask;
60 /* Pointer to a mask of nodes with copies
61 * of the kernel. */
62 char g_padding[56]; /* pad out to 128 bytes */
63 nasid_t g_nasidtable[MAX_COMPACT_NODES]; /* NASID of each node,
64 * indexed by cnodeid.
65 */
66} gda_t;
67
68#define GDA ((gda_t*) GDA_ADDR(get_nasid()))
69
70#endif /* !__ASSEMBLY__ */
71/*
72 * Define: PART_GDA_VERSION
73 * Purpose: Define the minimum version of the GDA required, lower
74 * revisions assume GDA is NOT set up, and read partition
75 * information from the board info.
76 */
77#define PART_GDA_VERSION 2
78
79/*
80 * The following requests can be sent to the PROM during startup.
81 */
82
83#define PROMOP_MAGIC 0x0ead0000
84#define PROMOP_MAGIC_MASK 0x0fff0000
85
86#define PROMOP_BIST_SHIFT 11
87#define PROMOP_BIST_MASK (0x3 << 11)
88
89#define PROMOP_REG PI_ERR_STACK_ADDR_A
90
91#define PROMOP_INVALID (PROMOP_MAGIC | 0x00)
92#define PROMOP_HALT (PROMOP_MAGIC | 0x10)
93#define PROMOP_POWERDOWN (PROMOP_MAGIC | 0x20)
94#define PROMOP_RESTART (PROMOP_MAGIC | 0x30)
95#define PROMOP_REBOOT (PROMOP_MAGIC | 0x40)
96#define PROMOP_IMODE (PROMOP_MAGIC | 0x50)
97
98#define PROMOP_CMD_MASK 0x00f0
99#define PROMOP_OPTIONS_MASK 0xfff0
100
101#define PROMOP_SKIP_DIAGS 0x0100 /* don't bother running diags */
102#define PROMOP_SKIP_MEMINIT 0x0200 /* don't bother initing memory */
103#define PROMOP_SKIP_DEVINIT 0x0400 /* don't bother initing devices */
104#define PROMOP_BIST1 0x0800 /* keep track of which BIST ran */
105#define PROMOP_BIST2 0x1000 /* keep track of which BIST ran */
106
107#endif /* _ASM_SN_GDA_H */
diff --git a/include/asm-mips/sn/hub.h b/include/asm-mips/sn/hub.h
new file mode 100644
index 000000000000..1992d9254a08
--- /dev/null
+++ b/include/asm-mips/sn/hub.h
@@ -0,0 +1,16 @@
1#ifndef __ASM_SN_HUB_H
2#define __ASM_SN_HUB_H
3
4#include <linux/types.h>
5#include <linux/cpumask.h>
6#include <asm/sn/types.h>
7#include <asm/sn/io.h>
8#include <asm/sn/klkernvars.h>
9#include <asm/xtalk/xtalk.h>
10
11/* ip27-hubio.c */
12extern unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget,
13 unsigned long xtalk_addr, size_t size);
14extern void hub_pio_init(cnodeid_t cnode);
15
16#endif /* __ASM_SN_HUB_H */
diff --git a/include/asm-mips/sn/intr.h b/include/asm-mips/sn/intr.h
new file mode 100644
index 000000000000..6718b644b970
--- /dev/null
+++ b/include/asm-mips/sn/intr.h
@@ -0,0 +1,129 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997 Silicon Graphics, Inc.
7 */
8#ifndef __ASM_SN_INTR_H
9#define __ASM_SN_INTR_H
10
11/* Number of interrupt levels associated with each interrupt register. */
12#define N_INTPEND_BITS 64
13
14#define INT_PEND0_BASELVL 0
15#define INT_PEND1_BASELVL 64
16
17#define N_INTPENDJUNK_BITS 8
18#define INTPENDJUNK_CLRBIT 0x80
19
20/*
21 * Macros to manipulate the interrupt register on the calling hub chip.
22 */
23
24#define LOCAL_HUB_SEND_INTR(level) \
25 LOCAL_HUB_S(PI_INT_PEND_MOD, (0x100 | (level)))
26#define REMOTE_HUB_SEND_INTR(hub, level) \
27 REMOTE_HUB_S((hub), PI_INT_PEND_MOD, (0x100 | (level)))
28
29/*
30 * When clearing the interrupt, make sure this clear does make it
31 * to the hub. Otherwise we could end up losing interrupts.
32 * We do an uncached load of the int_pend0 register to ensure this.
33 */
34
35#define LOCAL_HUB_CLR_INTR(level) \
36do { \
37 LOCAL_HUB_S(PI_INT_PEND_MOD, (level)); \
38 LOCAL_HUB_L(PI_INT_PEND0); \
39} while (0);
40
41#define REMOTE_HUB_CLR_INTR(hub, level) \
42do { \
43 nasid_t __hub = (hub); \
44 \
45 REMOTE_HUB_S(__hub, PI_INT_PEND_MOD, (level)); \
46 REMOTE_HUB_L(__hub, PI_INT_PEND0); \
47} while (0);
48
49/*
50 * Hard-coded interrupt levels:
51 */
52
53/*
54 * L0 = SW1
55 * L1 = SW2
56 * L2 = INT_PEND0
57 * L3 = INT_PEND1
58 * L4 = RTC
59 * L5 = Profiling Timer
60 * L6 = Hub Errors
61 * L7 = Count/Compare (T5 counters)
62 */
63
64
65/*
66 * INT_PEND0 hard-coded bits.
67 */
68
69/*
70 * INT_PEND0 bits determined by hardware:
71 */
72#define RESERVED_INTR 0 /* What is this bit? */
73#define GFX_INTR_A 1
74#define GFX_INTR_B 2
75#define PG_MIG_INTR 3
76#define UART_INTR 4
77#define CC_PEND_A 5
78#define CC_PEND_B 6
79
80/*
81 * INT_PEND0 used by the kernel for itself ...
82 */
83#define CPU_RESCHED_A_IRQ 7
84#define CPU_RESCHED_B_IRQ 8
85#define CPU_CALL_A_IRQ 9
86#define CPU_CALL_B_IRQ 10
87#define MSC_MESG_INTR 11
88#define BASE_PCI_IRQ 12
89
90/*
91 * INT_PEND0 again, bits determined by hardware / hardcoded:
92 */
93#define SDISK_INTR 63 /* SABLE name */
94#define IP_PEND0_6_63 63 /* What is this bit? */
95
96/*
97 * INT_PEND1 hard-coded bits:
98 */
99#define NI_BRDCAST_ERR_A 39
100#define NI_BRDCAST_ERR_B 40
101
102#define LLP_PFAIL_INTR_A 41 /* see ml/SN/SN0/sysctlr.c */
103#define LLP_PFAIL_INTR_B 42
104
105#define TLB_INTR_A 43 /* used for tlb flush random */
106#define TLB_INTR_B 44
107
108#define IP27_INTR_0 45 /* Reserved for PROM use */
109#define IP27_INTR_1 46 /* do not use in Kernel */
110#define IP27_INTR_2 47
111#define IP27_INTR_3 48
112#define IP27_INTR_4 49
113#define IP27_INTR_5 50
114#define IP27_INTR_6 51
115#define IP27_INTR_7 52
116
117#define BRIDGE_ERROR_INTR 53 /* Setup by PROM to catch */
118 /* Bridge Errors */
119#define DEBUG_INTR_A 54
120#define DEBUG_INTR_B 55 /* Used by symmon to stop all cpus */
121#define IO_ERROR_INTR 57 /* Setup by PROM */
122#define CLK_ERR_INTR 58
123#define COR_ERR_INTR_A 59
124#define COR_ERR_INTR_B 60
125#define MD_COR_ERR_INTR 61
126#define NI_ERROR_INTR 62
127#define MSC_PANIC_INTR 63
128
129#endif /* __ASM_SN_INTR_H */
diff --git a/include/asm-mips/sn/io.h b/include/asm-mips/sn/io.h
new file mode 100644
index 000000000000..13326453efc9
--- /dev/null
+++ b/include/asm-mips/sn/io.h
@@ -0,0 +1,60 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000, 2003 Ralf Baechle
7 * Copyright (C) 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SN_IO_H
10#define _ASM_SN_IO_H
11
12#include <linux/config.h>
13#if defined (CONFIG_SGI_IP27)
14#include <asm/sn/sn0/hubio.h>
15#endif
16
17
18#define IIO_ITTE_BASE 0x400160 /* base of translation table entries */
19#define IIO_ITTE(bigwin) (IIO_ITTE_BASE + 8*(bigwin))
20
21#define IIO_ITTE_OFFSET_BITS 5 /* size of offset field */
22#define IIO_ITTE_OFFSET_MASK ((1<<IIO_ITTE_OFFSET_BITS)-1)
23#define IIO_ITTE_OFFSET_SHIFT 0
24
25#define IIO_ITTE_WIDGET_BITS 4 /* size of widget field */
26#define IIO_ITTE_WIDGET_MASK ((1<<IIO_ITTE_WIDGET_BITS)-1)
27#define IIO_ITTE_WIDGET_SHIFT 8
28
29#define IIO_ITTE_IOSP 1 /* I/O Space bit */
30#define IIO_ITTE_IOSP_MASK 1
31#define IIO_ITTE_IOSP_SHIFT 12
32#define HUB_PIO_MAP_TO_MEM 0
33#define HUB_PIO_MAP_TO_IO 1
34
35#define IIO_ITTE_INVALID_WIDGET 3 /* an invalid widget */
36
37#define IIO_ITTE_PUT(nasid, bigwin, io_or_mem, widget, addr) \
38 REMOTE_HUB_S((nasid), IIO_ITTE(bigwin), \
39 (((((addr) >> BWIN_SIZE_BITS) & \
40 IIO_ITTE_OFFSET_MASK) << IIO_ITTE_OFFSET_SHIFT) | \
41 (io_or_mem << IIO_ITTE_IOSP_SHIFT) | \
42 (((widget) & IIO_ITTE_WIDGET_MASK) << IIO_ITTE_WIDGET_SHIFT)))
43
44#define IIO_ITTE_DISABLE(nasid, bigwin) \
45 IIO_ITTE_PUT((nasid), HUB_PIO_MAP_TO_MEM, \
46 (bigwin), IIO_ITTE_INVALID_WIDGET, 0)
47
48#define IIO_ITTE_GET(nasid, bigwin) REMOTE_HUB_ADDR((nasid), IIO_ITTE(bigwin))
49
50/*
51 * Macro which takes the widget number, and returns the
52 * IO PRB address of that widget.
53 * value _x is expected to be a widget number in the range
54 * 0, 8 - 0xF
55 */
56#define IIO_IOPRB(_x) (IIO_IOPRB_0 + ( ( (_x) < HUB_WIDGET_ID_MIN ? \
57 (_x) : \
58 (_x) - (HUB_WIDGET_ID_MIN-1)) << 3) )
59
60#endif /* _ASM_SN_IO_H */
diff --git a/include/asm-mips/sn/ioc3.h b/include/asm-mips/sn/ioc3.h
new file mode 100644
index 000000000000..f7d530f306f2
--- /dev/null
+++ b/include/asm-mips/sn/ioc3.h
@@ -0,0 +1,661 @@
1/*
2 * Copyright (C) 1999, 2000 Ralf Baechle
3 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
4 */
5#ifndef _IOC3_H
6#define _IOC3_H
7
8/* SUPERIO uart register map */
9typedef volatile struct ioc3_uartregs {
10 union {
11 volatile u8 rbr; /* read only, DLAB == 0 */
12 volatile u8 thr; /* write only, DLAB == 0 */
13 volatile u8 dll; /* DLAB == 1 */
14 } u1;
15 union {
16 volatile u8 ier; /* DLAB == 0 */
17 volatile u8 dlm; /* DLAB == 1 */
18 } u2;
19 union {
20 volatile u8 iir; /* read only */
21 volatile u8 fcr; /* write only */
22 } u3;
23 volatile u8 iu_lcr;
24 volatile u8 iu_mcr;
25 volatile u8 iu_lsr;
26 volatile u8 iu_msr;
27 volatile u8 iu_scr;
28} ioc3_uregs_t;
29
30#define iu_rbr u1.rbr
31#define iu_thr u1.thr
32#define iu_dll u1.dll
33#define iu_ier u2.ier
34#define iu_dlm u2.dlm
35#define iu_iir u3.iir
36#define iu_fcr u3.fcr
37
38struct ioc3_sioregs {
39 volatile u8 fill[0x141]; /* starts at 0x141 */
40
41 volatile u8 uartc;
42 volatile u8 kbdcg;
43
44 volatile u8 fill0[0x150 - 0x142 - 1];
45
46 volatile u8 pp_data;
47 volatile u8 pp_dsr;
48 volatile u8 pp_dcr;
49
50 volatile u8 fill1[0x158 - 0x152 - 1];
51
52 volatile u8 pp_fifa;
53 volatile u8 pp_cfgb;
54 volatile u8 pp_ecr;
55
56 volatile u8 fill2[0x168 - 0x15a - 1];
57
58 volatile u8 rtcad;
59 volatile u8 rtcdat;
60
61 volatile u8 fill3[0x170 - 0x169 - 1];
62
63 struct ioc3_uartregs uartb; /* 0x20170 */
64 struct ioc3_uartregs uarta; /* 0x20178 */
65};
66
67/* Register layout of IOC3 in configuration space. */
68struct ioc3 {
69 volatile u32 pad0[7]; /* 0x00000 */
70 volatile u32 sio_ir; /* 0x0001c */
71 volatile u32 sio_ies; /* 0x00020 */
72 volatile u32 sio_iec; /* 0x00024 */
73 volatile u32 sio_cr; /* 0x00028 */
74 volatile u32 int_out; /* 0x0002c */
75 volatile u32 mcr; /* 0x00030 */
76
77 /* General Purpose I/O registers */
78 volatile u32 gpcr_s; /* 0x00034 */
79 volatile u32 gpcr_c; /* 0x00038 */
80 volatile u32 gpdr; /* 0x0003c */
81 volatile u32 gppr_0; /* 0x00040 */
82 volatile u32 gppr_1; /* 0x00044 */
83 volatile u32 gppr_2; /* 0x00048 */
84 volatile u32 gppr_3; /* 0x0004c */
85 volatile u32 gppr_4; /* 0x00050 */
86 volatile u32 gppr_5; /* 0x00054 */
87 volatile u32 gppr_6; /* 0x00058 */
88 volatile u32 gppr_7; /* 0x0005c */
89 volatile u32 gppr_8; /* 0x00060 */
90 volatile u32 gppr_9; /* 0x00064 */
91 volatile u32 gppr_10; /* 0x00068 */
92 volatile u32 gppr_11; /* 0x0006c */
93 volatile u32 gppr_12; /* 0x00070 */
94 volatile u32 gppr_13; /* 0x00074 */
95 volatile u32 gppr_14; /* 0x00078 */
96 volatile u32 gppr_15; /* 0x0007c */
97
98 /* Parallel Port Registers */
99 volatile u32 ppbr_h_a; /* 0x00080 */
100 volatile u32 ppbr_l_a; /* 0x00084 */
101 volatile u32 ppcr_a; /* 0x00088 */
102 volatile u32 ppcr; /* 0x0008c */
103 volatile u32 ppbr_h_b; /* 0x00090 */
104 volatile u32 ppbr_l_b; /* 0x00094 */
105 volatile u32 ppcr_b; /* 0x00098 */
106
107 /* Keyboard and Mouse Registers */
108 volatile u32 km_csr; /* 0x0009c */
109 volatile u32 k_rd; /* 0x000a0 */
110 volatile u32 m_rd; /* 0x000a4 */
111 volatile u32 k_wd; /* 0x000a8 */
112 volatile u32 m_wd; /* 0x000ac */
113
114 /* Serial Port Registers */
115 volatile u32 sbbr_h; /* 0x000b0 */
116 volatile u32 sbbr_l; /* 0x000b4 */
117 volatile u32 sscr_a; /* 0x000b8 */
118 volatile u32 stpir_a; /* 0x000bc */
119 volatile u32 stcir_a; /* 0x000c0 */
120 volatile u32 srpir_a; /* 0x000c4 */
121 volatile u32 srcir_a; /* 0x000c8 */
122 volatile u32 srtr_a; /* 0x000cc */
123 volatile u32 shadow_a; /* 0x000d0 */
124 volatile u32 sscr_b; /* 0x000d4 */
125 volatile u32 stpir_b; /* 0x000d8 */
126 volatile u32 stcir_b; /* 0x000dc */
127 volatile u32 srpir_b; /* 0x000e0 */
128 volatile u32 srcir_b; /* 0x000e4 */
129 volatile u32 srtr_b; /* 0x000e8 */
130 volatile u32 shadow_b; /* 0x000ec */
131
132 /* Ethernet Registers */
133 volatile u32 emcr; /* 0x000f0 */
134 volatile u32 eisr; /* 0x000f4 */
135 volatile u32 eier; /* 0x000f8 */
136 volatile u32 ercsr; /* 0x000fc */
137 volatile u32 erbr_h; /* 0x00100 */
138 volatile u32 erbr_l; /* 0x00104 */
139 volatile u32 erbar; /* 0x00108 */
140 volatile u32 ercir; /* 0x0010c */
141 volatile u32 erpir; /* 0x00110 */
142 volatile u32 ertr; /* 0x00114 */
143 volatile u32 etcsr; /* 0x00118 */
144 volatile u32 ersr; /* 0x0011c */
145 volatile u32 etcdc; /* 0x00120 */
146 volatile u32 ebir; /* 0x00124 */
147 volatile u32 etbr_h; /* 0x00128 */
148 volatile u32 etbr_l; /* 0x0012c */
149 volatile u32 etcir; /* 0x00130 */
150 volatile u32 etpir; /* 0x00134 */
151 volatile u32 emar_h; /* 0x00138 */
152 volatile u32 emar_l; /* 0x0013c */
153 volatile u32 ehar_h; /* 0x00140 */
154 volatile u32 ehar_l; /* 0x00144 */
155 volatile u32 micr; /* 0x00148 */
156 volatile u32 midr_r; /* 0x0014c */
157 volatile u32 midr_w; /* 0x00150 */
158 volatile u32 pad1[(0x20000 - 0x00154) / 4];
159
160 /* SuperIO Registers XXX */
161 struct ioc3_sioregs sregs; /* 0x20000 */
162 volatile u32 pad2[(0x40000 - 0x20180) / 4];
163
164 /* SSRAM Diagnostic Access */
165 volatile u32 ssram[(0x80000 - 0x40000) / 4];
166
167 /* Bytebus device offsets
168 0x80000 - Access to the generic devices selected with DEV0
169 0x9FFFF bytebus DEV_SEL_0
170 0xA0000 - Access to the generic devices selected with DEV1
171 0xBFFFF bytebus DEV_SEL_1
172 0xC0000 - Access to the generic devices selected with DEV2
173 0xDFFFF bytebus DEV_SEL_2
174 0xE0000 - Access to the generic devices selected with DEV3
175 0xFFFFF bytebus DEV_SEL_3 */
176};
177
178/*
179 * Ethernet RX Buffer
180 */
181struct ioc3_erxbuf {
182 u32 w0; /* first word (valid,bcnt,cksum) */
183 u32 err; /* second word various errors */
184 /* next comes n bytes of padding */
185 /* then the received ethernet frame itself */
186};
187
188#define ERXBUF_IPCKSUM_MASK 0x0000ffff
189#define ERXBUF_BYTECNT_MASK 0x07ff0000
190#define ERXBUF_BYTECNT_SHIFT 16
191#define ERXBUF_V 0x80000000
192
193#define ERXBUF_CRCERR 0x00000001 /* aka RSV15 */
194#define ERXBUF_FRAMERR 0x00000002 /* aka RSV14 */
195#define ERXBUF_CODERR 0x00000004 /* aka RSV13 */
196#define ERXBUF_INVPREAMB 0x00000008 /* aka RSV18 */
197#define ERXBUF_LOLEN 0x00007000 /* aka RSV2_0 */
198#define ERXBUF_HILEN 0x03ff0000 /* aka RSV12_3 */
199#define ERXBUF_MULTICAST 0x04000000 /* aka RSV16 */
200#define ERXBUF_BROADCAST 0x08000000 /* aka RSV17 */
201#define ERXBUF_LONGEVENT 0x10000000 /* aka RSV19 */
202#define ERXBUF_BADPKT 0x20000000 /* aka RSV20 */
203#define ERXBUF_GOODPKT 0x40000000 /* aka RSV21 */
204#define ERXBUF_CARRIER 0x80000000 /* aka RSV22 */
205
206/*
207 * Ethernet TX Descriptor
208 */
209#define ETXD_DATALEN 104
210struct ioc3_etxd {
211 u32 cmd; /* command field */
212 u32 bufcnt; /* buffer counts field */
213 u64 p1; /* buffer pointer 1 */
214 u64 p2; /* buffer pointer 2 */
215 u8 data[ETXD_DATALEN]; /* opt. tx data */
216};
217
218#define ETXD_BYTECNT_MASK 0x000007ff /* total byte count */
219#define ETXD_INTWHENDONE 0x00001000 /* intr when done */
220#define ETXD_D0V 0x00010000 /* data 0 valid */
221#define ETXD_B1V 0x00020000 /* buf 1 valid */
222#define ETXD_B2V 0x00040000 /* buf 2 valid */
223#define ETXD_DOCHECKSUM 0x00080000 /* insert ip cksum */
224#define ETXD_CHKOFF_MASK 0x07f00000 /* cksum byte offset */
225#define ETXD_CHKOFF_SHIFT 20
226
227#define ETXD_D0CNT_MASK 0x0000007f
228#define ETXD_B1CNT_MASK 0x0007ff00
229#define ETXD_B1CNT_SHIFT 8
230#define ETXD_B2CNT_MASK 0x7ff00000
231#define ETXD_B2CNT_SHIFT 20
232
233/*
234 * Bytebus device space
235 */
236#define IOC3_BYTEBUS_DEV0 0x80000L
237#define IOC3_BYTEBUS_DEV1 0xa0000L
238#define IOC3_BYTEBUS_DEV2 0xc0000L
239#define IOC3_BYTEBUS_DEV3 0xe0000L
240
241/* ------------------------------------------------------------------------- */
242
243/* Superio Registers (PIO Access) */
244#define IOC3_SIO_BASE 0x20000
245#define IOC3_SIO_UARTC (IOC3_SIO_BASE+0x141) /* UART Config */
246#define IOC3_SIO_KBDCG (IOC3_SIO_BASE+0x142) /* KBD Config */
247#define IOC3_SIO_PP_BASE (IOC3_SIO_BASE+PP_BASE) /* Parallel Port */
248#define IOC3_SIO_RTC_BASE (IOC3_SIO_BASE+0x168) /* Real Time Clock */
249#define IOC3_SIO_UB_BASE (IOC3_SIO_BASE+UARTB_BASE) /* UART B */
250#define IOC3_SIO_UA_BASE (IOC3_SIO_BASE+UARTA_BASE) /* UART A */
251
252/* SSRAM Diagnostic Access */
253#define IOC3_SSRAM IOC3_RAM_OFF /* base of SSRAM diagnostic access */
254#define IOC3_SSRAM_LEN 0x40000 /* 256kb (address space size, may not be fully populated) */
255#define IOC3_SSRAM_DM 0x0000ffff /* data mask */
256#define IOC3_SSRAM_PM 0x00010000 /* parity mask */
257
258/* bitmasks for PCI_SCR */
259#define PCI_SCR_PAR_RESP_EN 0x00000040 /* enb PCI parity checking */
260#define PCI_SCR_SERR_EN 0x00000100 /* enable the SERR# driver */
261#define PCI_SCR_DROP_MODE_EN 0x00008000 /* drop pios on parity err */
262#define PCI_SCR_RX_SERR (0x1 << 16)
263#define PCI_SCR_DROP_MODE (0x1 << 17)
264#define PCI_SCR_SIG_PAR_ERR (0x1 << 24)
265#define PCI_SCR_SIG_TAR_ABRT (0x1 << 27)
266#define PCI_SCR_RX_TAR_ABRT (0x1 << 28)
267#define PCI_SCR_SIG_MST_ABRT (0x1 << 29)
268#define PCI_SCR_SIG_SERR (0x1 << 30)
269#define PCI_SCR_PAR_ERR (0x1 << 31)
270
271/* bitmasks for IOC3_KM_CSR */
272#define KM_CSR_K_WRT_PEND 0x00000001 /* kbd port xmitting or resetting */
273#define KM_CSR_M_WRT_PEND 0x00000002 /* mouse port xmitting or resetting */
274#define KM_CSR_K_LCB 0x00000004 /* Line Cntrl Bit for last KBD write */
275#define KM_CSR_M_LCB 0x00000008 /* same for mouse */
276#define KM_CSR_K_DATA 0x00000010 /* state of kbd data line */
277#define KM_CSR_K_CLK 0x00000020 /* state of kbd clock line */
278#define KM_CSR_K_PULL_DATA 0x00000040 /* pull kbd data line low */
279#define KM_CSR_K_PULL_CLK 0x00000080 /* pull kbd clock line low */
280#define KM_CSR_M_DATA 0x00000100 /* state of ms data line */
281#define KM_CSR_M_CLK 0x00000200 /* state of ms clock line */
282#define KM_CSR_M_PULL_DATA 0x00000400 /* pull ms data line low */
283#define KM_CSR_M_PULL_CLK 0x00000800 /* pull ms clock line low */
284#define KM_CSR_EMM_MODE 0x00001000 /* emulation mode */
285#define KM_CSR_SIM_MODE 0x00002000 /* clock X8 */
286#define KM_CSR_K_SM_IDLE 0x00004000 /* Keyboard is idle */
287#define KM_CSR_M_SM_IDLE 0x00008000 /* Mouse is idle */
288#define KM_CSR_K_TO 0x00010000 /* Keyboard trying to send/receive */
289#define KM_CSR_M_TO 0x00020000 /* Mouse trying to send/receive */
290#define KM_CSR_K_TO_EN 0x00040000 /* KM_CSR_K_TO + KM_CSR_K_TO_EN = cause
291 SIO_IR to assert */
292#define KM_CSR_M_TO_EN 0x00080000 /* KM_CSR_M_TO + KM_CSR_M_TO_EN = cause
293 SIO_IR to assert */
294#define KM_CSR_K_CLAMP_ONE 0x00100000 /* Pull K_CLK low after rec. one char */
295#define KM_CSR_M_CLAMP_ONE 0x00200000 /* Pull M_CLK low after rec. one char */
296#define KM_CSR_K_CLAMP_THREE 0x00400000 /* Pull K_CLK low after rec. three chars */
297#define KM_CSR_M_CLAMP_THREE 0x00800000 /* Pull M_CLK low after rec. three char */
298
299/* bitmasks for IOC3_K_RD and IOC3_M_RD */
300#define KM_RD_DATA_2 0x000000ff /* 3rd char recvd since last read */
301#define KM_RD_DATA_2_SHIFT 0
302#define KM_RD_DATA_1 0x0000ff00 /* 2nd char recvd since last read */
303#define KM_RD_DATA_1_SHIFT 8
304#define KM_RD_DATA_0 0x00ff0000 /* 1st char recvd since last read */
305#define KM_RD_DATA_0_SHIFT 16
306#define KM_RD_FRAME_ERR_2 0x01000000 /* framing or parity error in byte 2 */
307#define KM_RD_FRAME_ERR_1 0x02000000 /* same for byte 1 */
308#define KM_RD_FRAME_ERR_0 0x04000000 /* same for byte 0 */
309
310#define KM_RD_KBD_MSE 0x08000000 /* 0 if from kbd, 1 if from mouse */
311#define KM_RD_OFLO 0x10000000 /* 4th char recvd before this read */
312#define KM_RD_VALID_2 0x20000000 /* DATA_2 valid */
313#define KM_RD_VALID_1 0x40000000 /* DATA_1 valid */
314#define KM_RD_VALID_0 0x80000000 /* DATA_0 valid */
315#define KM_RD_VALID_ALL (KM_RD_VALID_0|KM_RD_VALID_1|KM_RD_VALID_2)
316
317/* bitmasks for IOC3_K_WD & IOC3_M_WD */
318#define KM_WD_WRT_DATA 0x000000ff /* write to keyboard/mouse port */
319#define KM_WD_WRT_DATA_SHIFT 0
320
321/* bitmasks for serial RX status byte */
322#define RXSB_OVERRUN 0x01 /* char(s) lost */
323#define RXSB_PAR_ERR 0x02 /* parity error */
324#define RXSB_FRAME_ERR 0x04 /* framing error */
325#define RXSB_BREAK 0x08 /* break character */
326#define RXSB_CTS 0x10 /* state of CTS */
327#define RXSB_DCD 0x20 /* state of DCD */
328#define RXSB_MODEM_VALID 0x40 /* DCD, CTS and OVERRUN are valid */
329#define RXSB_DATA_VALID 0x80 /* data byte, FRAME_ERR PAR_ERR & BREAK valid */
330
331/* bitmasks for serial TX control byte */
332#define TXCB_INT_WHEN_DONE 0x20 /* interrupt after this byte is sent */
333#define TXCB_INVALID 0x00 /* byte is invalid */
334#define TXCB_VALID 0x40 /* byte is valid */
335#define TXCB_MCR 0x80 /* data<7:0> to modem control register */
336#define TXCB_DELAY 0xc0 /* delay data<7:0> mSec */
337
338/* bitmasks for IOC3_SBBR_L */
339#define SBBR_L_SIZE 0x00000001 /* 0 == 1KB rings, 1 == 4KB rings */
340#define SBBR_L_BASE 0xfffff000 /* lower serial ring base addr */
341
342/* bitmasks for IOC3_SSCR_<A:B> */
343#define SSCR_RX_THRESHOLD 0x000001ff /* hiwater mark */
344#define SSCR_TX_TIMER_BUSY 0x00010000 /* TX timer in progress */
345#define SSCR_HFC_EN 0x00020000 /* hardware flow control enabled */
346#define SSCR_RX_RING_DCD 0x00040000 /* post RX record on delta-DCD */
347#define SSCR_RX_RING_CTS 0x00080000 /* post RX record on delta-CTS */
348#define SSCR_HIGH_SPD 0x00100000 /* 4X speed */
349#define SSCR_DIAG 0x00200000 /* bypass clock divider for sim */
350#define SSCR_RX_DRAIN 0x08000000 /* drain RX buffer to memory */
351#define SSCR_DMA_EN 0x10000000 /* enable ring buffer DMA */
352#define SSCR_DMA_PAUSE 0x20000000 /* pause DMA */
353#define SSCR_PAUSE_STATE 0x40000000 /* sets when PAUSE takes effect */
354#define SSCR_RESET 0x80000000 /* reset DMA channels */
355
356/* all producer/comsumer pointers are the same bitfield */
357#define PROD_CONS_PTR_4K 0x00000ff8 /* for 4K buffers */
358#define PROD_CONS_PTR_1K 0x000003f8 /* for 1K buffers */
359#define PROD_CONS_PTR_OFF 3
360
361/* bitmasks for IOC3_SRCIR_<A:B> */
362#define SRCIR_ARM 0x80000000 /* arm RX timer */
363
364/* bitmasks for IOC3_SRPIR_<A:B> */
365#define SRPIR_BYTE_CNT 0x07000000 /* bytes in packer */
366#define SRPIR_BYTE_CNT_SHIFT 24
367
368/* bitmasks for IOC3_STCIR_<A:B> */
369#define STCIR_BYTE_CNT 0x0f000000 /* bytes in unpacker */
370#define STCIR_BYTE_CNT_SHIFT 24
371
372/* bitmasks for IOC3_SHADOW_<A:B> */
373#define SHADOW_DR 0x00000001 /* data ready */
374#define SHADOW_OE 0x00000002 /* overrun error */
375#define SHADOW_PE 0x00000004 /* parity error */
376#define SHADOW_FE 0x00000008 /* framing error */
377#define SHADOW_BI 0x00000010 /* break interrupt */
378#define SHADOW_THRE 0x00000020 /* transmit holding register empty */
379#define SHADOW_TEMT 0x00000040 /* transmit shift register empty */
380#define SHADOW_RFCE 0x00000080 /* char in RX fifo has an error */
381#define SHADOW_DCTS 0x00010000 /* delta clear to send */
382#define SHADOW_DDCD 0x00080000 /* delta data carrier detect */
383#define SHADOW_CTS 0x00100000 /* clear to send */
384#define SHADOW_DCD 0x00800000 /* data carrier detect */
385#define SHADOW_DTR 0x01000000 /* data terminal ready */
386#define SHADOW_RTS 0x02000000 /* request to send */
387#define SHADOW_OUT1 0x04000000 /* 16550 OUT1 bit */
388#define SHADOW_OUT2 0x08000000 /* 16550 OUT2 bit */
389#define SHADOW_LOOP 0x10000000 /* loopback enabled */
390
391/* bitmasks for IOC3_SRTR_<A:B> */
392#define SRTR_CNT 0x00000fff /* reload value for RX timer */
393#define SRTR_CNT_VAL 0x0fff0000 /* current value of RX timer */
394#define SRTR_CNT_VAL_SHIFT 16
395#define SRTR_HZ 16000 /* SRTR clock frequency */
396
397/* bitmasks for IOC3_SIO_IR, IOC3_SIO_IEC and IOC3_SIO_IES */
398#define SIO_IR_SA_TX_MT 0x00000001 /* Serial port A TX empty */
399#define SIO_IR_SA_RX_FULL 0x00000002 /* port A RX buf full */
400#define SIO_IR_SA_RX_HIGH 0x00000004 /* port A RX hiwat */
401#define SIO_IR_SA_RX_TIMER 0x00000008 /* port A RX timeout */
402#define SIO_IR_SA_DELTA_DCD 0x00000010 /* port A delta DCD */
403#define SIO_IR_SA_DELTA_CTS 0x00000020 /* port A delta CTS */
404#define SIO_IR_SA_INT 0x00000040 /* port A pass-thru intr */
405#define SIO_IR_SA_TX_EXPLICIT 0x00000080 /* port A explicit TX thru */
406#define SIO_IR_SA_MEMERR 0x00000100 /* port A PCI error */
407#define SIO_IR_SB_TX_MT 0x00000200 /* */
408#define SIO_IR_SB_RX_FULL 0x00000400 /* */
409#define SIO_IR_SB_RX_HIGH 0x00000800 /* */
410#define SIO_IR_SB_RX_TIMER 0x00001000 /* */
411#define SIO_IR_SB_DELTA_DCD 0x00002000 /* */
412#define SIO_IR_SB_DELTA_CTS 0x00004000 /* */
413#define SIO_IR_SB_INT 0x00008000 /* */
414#define SIO_IR_SB_TX_EXPLICIT 0x00010000 /* */
415#define SIO_IR_SB_MEMERR 0x00020000 /* */
416#define SIO_IR_PP_INT 0x00040000 /* P port pass-thru intr */
417#define SIO_IR_PP_INTA 0x00080000 /* PP context A thru */
418#define SIO_IR_PP_INTB 0x00100000 /* PP context B thru */
419#define SIO_IR_PP_MEMERR 0x00200000 /* PP PCI error */
420#define SIO_IR_KBD_INT 0x00400000 /* kbd/mouse intr */
421#define SIO_IR_RT_INT 0x08000000 /* RT output pulse */
422#define SIO_IR_GEN_INT1 0x10000000 /* RT input pulse */
423#define SIO_IR_GEN_INT_SHIFT 28
424
425/* per device interrupt masks */
426#define SIO_IR_SA (SIO_IR_SA_TX_MT | SIO_IR_SA_RX_FULL | \
427 SIO_IR_SA_RX_HIGH | SIO_IR_SA_RX_TIMER | \
428 SIO_IR_SA_DELTA_DCD | SIO_IR_SA_DELTA_CTS | \
429 SIO_IR_SA_INT | SIO_IR_SA_TX_EXPLICIT | \
430 SIO_IR_SA_MEMERR)
431#define SIO_IR_SB (SIO_IR_SB_TX_MT | SIO_IR_SB_RX_FULL | \
432 SIO_IR_SB_RX_HIGH | SIO_IR_SB_RX_TIMER | \
433 SIO_IR_SB_DELTA_DCD | SIO_IR_SB_DELTA_CTS | \
434 SIO_IR_SB_INT | SIO_IR_SB_TX_EXPLICIT | \
435 SIO_IR_SB_MEMERR)
436#define SIO_IR_PP (SIO_IR_PP_INT | SIO_IR_PP_INTA | \
437 SIO_IR_PP_INTB | SIO_IR_PP_MEMERR)
438#define SIO_IR_RT (SIO_IR_RT_INT | SIO_IR_GEN_INT1)
439
440/* macro to load pending interrupts */
441#define IOC3_PENDING_INTRS(mem) (PCI_INW(&((mem)->sio_ir)) & \
442 PCI_INW(&((mem)->sio_ies_ro)))
443
444/* bitmasks for SIO_CR */
445#define SIO_CR_SIO_RESET 0x00000001 /* reset the SIO */
446#define SIO_CR_SER_A_BASE 0x000000fe /* DMA poll addr port A */
447#define SIO_CR_SER_A_BASE_SHIFT 1
448#define SIO_CR_SER_B_BASE 0x00007f00 /* DMA poll addr port B */
449#define SIO_CR_SER_B_BASE_SHIFT 8
450#define SIO_SR_CMD_PULSE 0x00078000 /* byte bus strobe length */
451#define SIO_CR_CMD_PULSE_SHIFT 15
452#define SIO_CR_ARB_DIAG 0x00380000 /* cur !enet PCI requet (ro) */
453#define SIO_CR_ARB_DIAG_TXA 0x00000000
454#define SIO_CR_ARB_DIAG_RXA 0x00080000
455#define SIO_CR_ARB_DIAG_TXB 0x00100000
456#define SIO_CR_ARB_DIAG_RXB 0x00180000
457#define SIO_CR_ARB_DIAG_PP 0x00200000
458#define SIO_CR_ARB_DIAG_IDLE 0x00400000 /* 0 -> active request (ro) */
459
460/* bitmasks for INT_OUT */
461#define INT_OUT_COUNT 0x0000ffff /* pulse interval timer */
462#define INT_OUT_MODE 0x00070000 /* mode mask */
463#define INT_OUT_MODE_0 0x00000000 /* set output to 0 */
464#define INT_OUT_MODE_1 0x00040000 /* set output to 1 */
465#define INT_OUT_MODE_1PULSE 0x00050000 /* send 1 pulse */
466#define INT_OUT_MODE_PULSES 0x00060000 /* send 1 pulse every interval */
467#define INT_OUT_MODE_SQW 0x00070000 /* toggle output every interval */
468#define INT_OUT_DIAG 0x40000000 /* diag mode */
469#define INT_OUT_INT_OUT 0x80000000 /* current state of INT_OUT */
470
471/* time constants for INT_OUT */
472#define INT_OUT_NS_PER_TICK (30 * 260) /* 30 ns PCI clock, divisor=260 */
473#define INT_OUT_TICKS_PER_PULSE 3 /* outgoing pulse lasts 3 ticks */
474#define INT_OUT_US_TO_COUNT(x) /* convert uS to a count value */ \
475 (((x) * 10 + INT_OUT_NS_PER_TICK / 200) * \
476 100 / INT_OUT_NS_PER_TICK - 1)
477#define INT_OUT_COUNT_TO_US(x) /* convert count value to uS */ \
478 (((x) + 1) * INT_OUT_NS_PER_TICK / 1000)
479#define INT_OUT_MIN_TICKS 3 /* min period is width of pulse in "ticks" */
480#define INT_OUT_MAX_TICKS INT_OUT_COUNT /* largest possible count */
481
482/* bitmasks for GPCR */
483#define GPCR_DIR 0x000000ff /* tristate pin input or output */
484#define GPCR_DIR_PIN(x) (1<<(x)) /* access one of the DIR bits */
485#define GPCR_EDGE 0x000f0000 /* extint edge or level sensitive */
486#define GPCR_EDGE_PIN(x) (1<<((x)+15)) /* access one of the EDGE bits */
487
488/* values for GPCR */
489#define GPCR_INT_OUT_EN 0x00100000 /* enable INT_OUT to pin 0 */
490#define GPCR_MLAN_EN 0x00200000 /* enable MCR to pin 8 */
491#define GPCR_DIR_SERA_XCVR 0x00000080 /* Port A Transceiver select enable */
492#define GPCR_DIR_SERB_XCVR 0x00000040 /* Port B Transceiver select enable */
493#define GPCR_DIR_PHY_RST 0x00000020 /* ethernet PHY reset enable */
494
495/* defs for some of the generic I/O pins */
496#define GPCR_PHY_RESET 0x20 /* pin is output to PHY reset */
497#define GPCR_UARTB_MODESEL 0x40 /* pin is output to port B mode sel */
498#define GPCR_UARTA_MODESEL 0x80 /* pin is output to port A mode sel */
499
500#define GPPR_PHY_RESET_PIN 5 /* GIO pin controlling phy reset */
501#define GPPR_UARTB_MODESEL_PIN 6 /* GIO pin controlling uart b mode select */
502#define GPPR_UARTA_MODESEL_PIN 7 /* GIO pin controlling uart a mode select */
503
504#define EMCR_DUPLEX 0x00000001
505#define EMCR_PROMISC 0x00000002
506#define EMCR_PADEN 0x00000004
507#define EMCR_RXOFF_MASK 0x000001f8
508#define EMCR_RXOFF_SHIFT 3
509#define EMCR_RAMPAR 0x00000200
510#define EMCR_BADPAR 0x00000800
511#define EMCR_BUFSIZ 0x00001000
512#define EMCR_TXDMAEN 0x00002000
513#define EMCR_TXEN 0x00004000
514#define EMCR_RXDMAEN 0x00008000
515#define EMCR_RXEN 0x00010000
516#define EMCR_LOOPBACK 0x00020000
517#define EMCR_ARB_DIAG 0x001c0000
518#define EMCR_ARB_DIAG_IDLE 0x00200000
519#define EMCR_RST 0x80000000
520
521#define EISR_RXTIMERINT 0x00000001
522#define EISR_RXTHRESHINT 0x00000002
523#define EISR_RXOFLO 0x00000004
524#define EISR_RXBUFOFLO 0x00000008
525#define EISR_RXMEMERR 0x00000010
526#define EISR_RXPARERR 0x00000020
527#define EISR_TXEMPTY 0x00010000
528#define EISR_TXRTRY 0x00020000
529#define EISR_TXEXDEF 0x00040000
530#define EISR_TXLCOL 0x00080000
531#define EISR_TXGIANT 0x00100000
532#define EISR_TXBUFUFLO 0x00200000
533#define EISR_TXEXPLICIT 0x00400000
534#define EISR_TXCOLLWRAP 0x00800000
535#define EISR_TXDEFERWRAP 0x01000000
536#define EISR_TXMEMERR 0x02000000
537#define EISR_TXPARERR 0x04000000
538
539#define ERCSR_THRESH_MASK 0x000001ff /* enet RX threshold */
540#define ERCSR_RX_TMR 0x40000000 /* simulation only */
541#define ERCSR_DIAG_OFLO 0x80000000 /* simulation only */
542
543#define ERBR_ALIGNMENT 4096
544#define ERBR_L_RXRINGBASE_MASK 0xfffff000
545
546#define ERBAR_BARRIER_BIT 0x0100
547#define ERBAR_RXBARR_MASK 0xffff0000
548#define ERBAR_RXBARR_SHIFT 16
549
550#define ERCIR_RXCONSUME_MASK 0x00000fff
551
552#define ERPIR_RXPRODUCE_MASK 0x00000fff
553#define ERPIR_ARM 0x80000000
554
555#define ERTR_CNT_MASK 0x000007ff
556
557#define ETCSR_IPGT_MASK 0x0000007f
558#define ETCSR_IPGR1_MASK 0x00007f00
559#define ETCSR_IPGR1_SHIFT 8
560#define ETCSR_IPGR2_MASK 0x007f0000
561#define ETCSR_IPGR2_SHIFT 16
562#define ETCSR_NOTXCLK 0x80000000
563
564#define ETCDC_COLLCNT_MASK 0x0000ffff
565#define ETCDC_DEFERCNT_MASK 0xffff0000
566#define ETCDC_DEFERCNT_SHIFT 16
567
568#define ETBR_ALIGNMENT (64*1024)
569#define ETBR_L_RINGSZ_MASK 0x00000001
570#define ETBR_L_RINGSZ128 0
571#define ETBR_L_RINGSZ512 1
572#define ETBR_L_TXRINGBASE_MASK 0xffffc000
573
574#define ETCIR_TXCONSUME_MASK 0x0000ffff
575#define ETCIR_IDLE 0x80000000
576
577#define ETPIR_TXPRODUCE_MASK 0x0000ffff
578
579#define EBIR_TXBUFPROD_MASK 0x0000001f
580#define EBIR_TXBUFCONS_MASK 0x00001f00
581#define EBIR_TXBUFCONS_SHIFT 8
582#define EBIR_RXBUFPROD_MASK 0x007fc000
583#define EBIR_RXBUFPROD_SHIFT 14
584#define EBIR_RXBUFCONS_MASK 0xff800000
585#define EBIR_RXBUFCONS_SHIFT 23
586
587#define MICR_REGADDR_MASK 0x0000001f
588#define MICR_PHYADDR_MASK 0x000003e0
589#define MICR_PHYADDR_SHIFT 5
590#define MICR_READTRIG 0x00000400
591#define MICR_BUSY 0x00000800
592
593#define MIDR_DATA_MASK 0x0000ffff
594
595#define ERXBUF_IPCKSUM_MASK 0x0000ffff
596#define ERXBUF_BYTECNT_MASK 0x07ff0000
597#define ERXBUF_BYTECNT_SHIFT 16
598#define ERXBUF_V 0x80000000
599
600#define ERXBUF_CRCERR 0x00000001 /* aka RSV15 */
601#define ERXBUF_FRAMERR 0x00000002 /* aka RSV14 */
602#define ERXBUF_CODERR 0x00000004 /* aka RSV13 */
603#define ERXBUF_INVPREAMB 0x00000008 /* aka RSV18 */
604#define ERXBUF_LOLEN 0x00007000 /* aka RSV2_0 */
605#define ERXBUF_HILEN 0x03ff0000 /* aka RSV12_3 */
606#define ERXBUF_MULTICAST 0x04000000 /* aka RSV16 */
607#define ERXBUF_BROADCAST 0x08000000 /* aka RSV17 */
608#define ERXBUF_LONGEVENT 0x10000000 /* aka RSV19 */
609#define ERXBUF_BADPKT 0x20000000 /* aka RSV20 */
610#define ERXBUF_GOODPKT 0x40000000 /* aka RSV21 */
611#define ERXBUF_CARRIER 0x80000000 /* aka RSV22 */
612
613#define ETXD_BYTECNT_MASK 0x000007ff /* total byte count */
614#define ETXD_INTWHENDONE 0x00001000 /* intr when done */
615#define ETXD_D0V 0x00010000 /* data 0 valid */
616#define ETXD_B1V 0x00020000 /* buf 1 valid */
617#define ETXD_B2V 0x00040000 /* buf 2 valid */
618#define ETXD_DOCHECKSUM 0x00080000 /* insert ip cksum */
619#define ETXD_CHKOFF_MASK 0x07f00000 /* cksum byte offset */
620#define ETXD_CHKOFF_SHIFT 20
621
622#define ETXD_D0CNT_MASK 0x0000007f
623#define ETXD_B1CNT_MASK 0x0007ff00
624#define ETXD_B1CNT_SHIFT 8
625#define ETXD_B2CNT_MASK 0x7ff00000
626#define ETXD_B2CNT_SHIFT 20
627
628typedef enum ioc3_subdevs_e {
629 ioc3_subdev_ether,
630 ioc3_subdev_generic,
631 ioc3_subdev_nic,
632 ioc3_subdev_kbms,
633 ioc3_subdev_ttya,
634 ioc3_subdev_ttyb,
635 ioc3_subdev_ecpp,
636 ioc3_subdev_rt,
637 ioc3_nsubdevs
638} ioc3_subdev_t;
639
640/* subdevice disable bits,
641 * from the standard INFO_LBL_SUBDEVS
642 */
643#define IOC3_SDB_ETHER (1<<ioc3_subdev_ether)
644#define IOC3_SDB_GENERIC (1<<ioc3_subdev_generic)
645#define IOC3_SDB_NIC (1<<ioc3_subdev_nic)
646#define IOC3_SDB_KBMS (1<<ioc3_subdev_kbms)
647#define IOC3_SDB_TTYA (1<<ioc3_subdev_ttya)
648#define IOC3_SDB_TTYB (1<<ioc3_subdev_ttyb)
649#define IOC3_SDB_ECPP (1<<ioc3_subdev_ecpp)
650#define IOC3_SDB_RT (1<<ioc3_subdev_rt)
651
652#define IOC3_ALL_SUBDEVS ((1<<ioc3_nsubdevs)-1)
653
654#define IOC3_SDB_SERIAL (IOC3_SDB_TTYA|IOC3_SDB_TTYB)
655
656#define IOC3_STD_SUBDEVS IOC3_ALL_SUBDEVS
657
658#define IOC3_INTA_SUBDEVS IOC3_SDB_ETHER
659#define IOC3_INTB_SUBDEVS (IOC3_SDB_GENERIC|IOC3_SDB_KBMS|IOC3_SDB_SERIAL|IOC3_SDB_ECPP|IOC3_SDB_RT)
660
661#endif /* _IOC3_H */
diff --git a/include/asm-mips/sn/klconfig.h b/include/asm-mips/sn/klconfig.h
new file mode 100644
index 000000000000..d028e28d6239
--- /dev/null
+++ b/include/asm-mips/sn/klconfig.h
@@ -0,0 +1,980 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/klconfig.h>.
7 *
8 * Copyright (C) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 1999, 2000 by Ralf Baechle
10 */
11#ifndef _ASM_SN_KLCONFIG_H
12#define _ASM_SN_KLCONFIG_H
13
14/*
15 * The KLCONFIG structures store info about the various BOARDs found
16 * during Hardware Discovery. In addition, it stores info about the
17 * components found on the BOARDs.
18 */
19
20/*
21 * WARNING:
22 * Certain assembly language routines (notably xxxxx.s) in the IP27PROM
23 * will depend on the format of the data structures in this file. In
24 * most cases, rearranging the fields can seriously break things.
25 * Adding fields in the beginning or middle can also break things.
26 * Add fields if necessary, to the end of a struct in such a way
27 * that offsets of existing fields do not change.
28 */
29
30#include <linux/config.h>
31#include <linux/types.h>
32#include <asm/sn/types.h>
33
34#if defined(CONFIG_SGI_IP27)
35
36#include <asm/sn/sn0/addrs.h>
37//#include <sys/SN/router.h>
38// XXX Stolen from <sys/SN/router.h>:
39#define MAX_ROUTER_PORTS (6) /* Max. number of ports on a router */
40#include <asm/sn/sn0/sn0_fru.h>
41//#include <sys/graph.h>
42//#include <sys/xtalk/xbow.h>
43
44#elif defined(CONFIG_SGI_IP35)
45
46#include <asm/sn/sn1/addrs.h>
47#include <sys/sn/router.h>
48#include <sys/graph.h>
49#include <asm/xtalk/xbow.h>
50
51#endif /* !CONFIG_SGI_IP27 && !CONFIG_SGI_IP35 */
52
53#if defined(CONFIG_SGI_IP27) || defined(CONFIG_SGI_IP35)
54#include <asm/sn/agent.h>
55#include <asm/arc/types.h>
56#include <asm/arc/hinv.h>
57#if defined(CONFIG_SGI_IO) || defined(CONFIG_SGI_IP35)
58// The hack file has to be before vector and after sn0_fru....
59#include <asm/hack.h>
60#include <asm/sn/vector.h>
61#include <asm/xtalk/xtalk.h>
62#endif /* CONFIG_SGI_IO || CONFIG_SGI_IP35 */
63#endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */
64
65#define KLCFGINFO_MAGIC 0xbeedbabe
66
67#ifdef FRUTEST
68typedef u64 klconf_off_t;
69#else
70typedef s32 klconf_off_t;
71#endif
72
73/*
74 * Some IMPORTANT OFFSETS. These are the offsets on all NODES.
75 */
76#if 0
77#define RAMBASE 0
78#define ARCSSPB_OFF 0x1000 /* shift it to sys/arcs/spb.h */
79
80#define OFF_HWGRAPH 0
81#endif
82
83#define MAX_MODULE_ID 255
84#define SIZE_PAD 4096 /* 4k padding for structures */
85/*
86 * 1 NODE brd, 2 Router brd (1 8p, 1 meta), 6 Widgets,
87 * 2 Midplanes assuming no pci card cages
88 */
89#define MAX_SLOTS_PER_NODE (1 + 2 + 6 + 2)
90
91/* XXX if each node is guranteed to have some memory */
92
93#define MAX_PCI_DEVS 8
94
95/* lboard_t->brd_flags fields */
96/* All bits in this field are currently used. Try the pad fields if
97 you need more flag bits */
98
99#define ENABLE_BOARD 0x01
100#define FAILED_BOARD 0x02
101#define DUPLICATE_BOARD 0x04 /* Boards like midplanes/routers which
102 are discovered twice. Use one of them */
103#define VISITED_BOARD 0x08 /* Used for compact hub numbering. */
104#define LOCAL_MASTER_IO6 0x10 /* master io6 for that node */
105#define GLOBAL_MASTER_IO6 0x20
106#define THIRD_NIC_PRESENT 0x40 /* for future use */
107#define SECOND_NIC_PRESENT 0x80 /* addons like MIO are present */
108
109/* klinfo->flags fields */
110
111#define KLINFO_ENABLE 0x01 /* This component is enabled */
112#define KLINFO_FAILED 0x02 /* This component failed */
113#define KLINFO_DEVICE 0x04 /* This component is a device */
114#define KLINFO_VISITED 0x08 /* This component has been visited */
115#define KLINFO_CONTROLLER 0x10 /* This component is a device controller */
116#define KLINFO_INSTALL 0x20 /* Install a driver */
117#define KLINFO_HEADLESS 0x40 /* Headless (or hubless) component */
118#define IS_CONSOLE_IOC3(i) ((((klinfo_t *)i)->flags) & KLINFO_INSTALL)
119
120#define GB2 0x80000000
121
122#define MAX_RSV_PTRS 32
123
124/* Structures to manage various data storage areas */
125/* The numbers must be contiguous since the array index i
126 is used in the code to allocate various areas.
127*/
128
129#define BOARD_STRUCT 0
130#define COMPONENT_STRUCT 1
131#define ERRINFO_STRUCT 2
132#define KLMALLOC_TYPE_MAX (ERRINFO_STRUCT + 1)
133#define DEVICE_STRUCT 3
134
135
136typedef struct console_s {
137#if defined(CONFIG_SGI_IO) /* FIXME */
138 __psunsigned_t uart_base;
139 __psunsigned_t config_base;
140 __psunsigned_t memory_base;
141#else
142 unsigned long uart_base;
143 unsigned long config_base;
144 unsigned long memory_base;
145#endif
146 short baud;
147 short flag;
148 int type;
149 nasid_t nasid;
150 char wid;
151 char npci;
152 nic_t baseio_nic;
153} console_t;
154
155typedef struct klc_malloc_hdr {
156 klconf_off_t km_base;
157 klconf_off_t km_limit;
158 klconf_off_t km_current;
159} klc_malloc_hdr_t;
160
161/* Functions/macros needed to use this structure */
162
163typedef struct kl_config_hdr {
164 u64 ch_magic; /* set this to KLCFGINFO_MAGIC */
165 u32 ch_version; /* structure version number */
166 klconf_off_t ch_malloc_hdr_off; /* offset of ch_malloc_hdr */
167 klconf_off_t ch_cons_off; /* offset of ch_cons */
168 klconf_off_t ch_board_info; /* the link list of boards */
169 console_t ch_cons_info; /* address info of the console */
170 klc_malloc_hdr_t ch_malloc_hdr[KLMALLOC_TYPE_MAX];
171 confidence_t ch_sw_belief; /* confidence that software is bad*/
172 confidence_t ch_sn0net_belief; /* confidence that sn0net is bad */
173} kl_config_hdr_t;
174
175
176#define KL_CONFIG_HDR(_nasid) ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid)))
177#if 0
178#define KL_CONFIG_MALLOC_HDR(_nasid) \
179 (KL_CONFIG_HDR(_nasid)->ch_malloc_hdr)
180#endif
181#define KL_CONFIG_INFO_OFFSET(_nasid) \
182 (KL_CONFIG_HDR(_nasid)->ch_board_info)
183#define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off) \
184 (KL_CONFIG_HDR(_nasid)->ch_board_info = (_off))
185
186#define KL_CONFIG_INFO(_nasid) \
187 (lboard_t *)((KL_CONFIG_HDR(_nasid)->ch_board_info) ? \
188 NODE_OFFSET_TO_K1((_nasid), KL_CONFIG_HDR(_nasid)->ch_board_info) : \
189 0)
190#define KL_CONFIG_MAGIC(_nasid) (KL_CONFIG_HDR(_nasid)->ch_magic)
191
192#define KL_CONFIG_CHECK_MAGIC(_nasid) \
193 (KL_CONFIG_HDR(_nasid)->ch_magic == KLCFGINFO_MAGIC)
194
195#define KL_CONFIG_HDR_INIT_MAGIC(_nasid) \
196 (KL_CONFIG_HDR(_nasid)->ch_magic = KLCFGINFO_MAGIC)
197
198/* --- New Macros for the changed kl_config_hdr_t structure --- */
199
200#if defined(CONFIG_SGI_IO)
201#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
202 ((__psunsigned_t)_k + (_k->ch_malloc_hdr_off)))
203#else
204#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
205 (unsigned long)_k + (_k->ch_malloc_hdr_off)))
206#endif
207
208#define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
209
210#if defined(CONFIG_SGI_IO)
211#define PTR_CH_CONS_INFO(_k) ((console_t *)\
212 ((__psunsigned_t)_k + (_k->ch_cons_off)))
213#else
214#define PTR_CH_CONS_INFO(_k) ((console_t *)\
215 ((unsigned long)_k + (_k->ch_cons_off)))
216#endif
217
218#define KL_CONFIG_CH_CONS_INFO(_n) PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))
219
220/* ------------------------------------------------------------- */
221
222#define KL_CONFIG_INFO_START(_nasid) \
223 (klconf_off_t)(KLCONFIG_OFFSET(_nasid) + sizeof(kl_config_hdr_t))
224
225#define KL_CONFIG_BOARD_NASID(_brd) ((_brd)->brd_nasid)
226#define KL_CONFIG_BOARD_SET_NEXT(_brd, _off) ((_brd)->brd_next = (_off))
227
228#define KL_CONFIG_DUPLICATE_BOARD(_brd) ((_brd)->brd_flags & DUPLICATE_BOARD)
229
230#define XBOW_PORT_TYPE_HUB(_xbowp, _link) \
231 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_HUB)
232#define XBOW_PORT_TYPE_IO(_xbowp, _link) \
233 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_IO)
234
235#define XBOW_PORT_IS_ENABLED(_xbowp, _link) \
236 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_ENABLE)
237#define XBOW_PORT_NASID(_xbowp, _link) \
238 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_nasid)
239
240#define XBOW_PORT_IO 0x1
241#define XBOW_PORT_HUB 0x2
242#define XBOW_PORT_ENABLE 0x4
243
244#define SN0_PORT_FENCE_SHFT 0
245#define SN0_PORT_FENCE_MASK (1 << SN0_PORT_FENCE_SHFT)
246
247/*
248 * The KLCONFIG area is organized as a LINKED LIST of BOARDs. A BOARD
249 * can be either 'LOCAL' or 'REMOTE'. LOCAL means it is attached to
250 * the LOCAL/current NODE. REMOTE means it is attached to a different
251 * node.(TBD - Need a way to treat ROUTER boards.)
252 *
253 * There are 2 different structures to represent these boards -
254 * lboard - Local board, rboard - remote board. These 2 structures
255 * can be arbitrarily mixed in the LINKED LIST of BOARDs. (Refer
256 * Figure below). The first byte of the rboard or lboard structure
257 * is used to find out its type - no unions are used.
258 * If it is a lboard, then the config info of this board will be found
259 * on the local node. (LOCAL NODE BASE + offset value gives pointer to
260 * the structure.
261 * If it is a rboard, the local structure contains the node number
262 * and the offset of the beginning of the LINKED LIST on the remote node.
263 * The details of the hardware on a remote node can be built locally,
264 * if required, by reading the LINKED LIST on the remote node and
265 * ignoring all the rboards on that node.
266 *
267 * The local node uses the REMOTE NODE NUMBER + OFFSET to point to the
268 * First board info on the remote node. The remote node list is
269 * traversed as the local list, using the REMOTE BASE ADDRESS and not
270 * the local base address and ignoring all rboard values.
271 *
272 *
273 KLCONFIG
274
275 +------------+ +------------+ +------------+ +------------+
276 | lboard | +-->| lboard | +-->| rboard | +-->| lboard |
277 +------------+ | +------------+ | +------------+ | +------------+
278 | board info | | | board info | | |errinfo,bptr| | | board info |
279 +------------+ | +------------+ | +------------+ | +------------+
280 | offset |--+ | offset |--+ | offset |--+ |offset=NULL |
281 +------------+ +------------+ +------------+ +------------+
282
283
284 +------------+
285 | board info |
286 +------------+ +--------------------------------+
287 | compt 1 |------>| type, rev, diaginfo, size ... | (CPU)
288 +------------+ +--------------------------------+
289 | compt 2 |--+
290 +------------+ | +--------------------------------+
291 | ... | +--->| type, rev, diaginfo, size ... | (MEM_BANK)
292 +------------+ +--------------------------------+
293 | errinfo |--+
294 +------------+ | +--------------------------------+
295 +--->|r/l brd errinfo,compt err flags |
296 +--------------------------------+
297
298 *
299 * Each BOARD consists of COMPONENTs and the BOARD structure has
300 * pointers (offsets) to its COMPONENT structure.
301 * The COMPONENT structure has version info, size and speed info, revision,
302 * error info and the NIC info. This structure can accommodate any
303 * BOARD with arbitrary COMPONENT composition.
304 *
305 * The ERRORINFO part of each BOARD has error information
306 * that describes errors about the BOARD itself. It also has flags to
307 * indicate the COMPONENT(s) on the board that have errors. The error
308 * information specific to the COMPONENT is present in the respective
309 * COMPONENT structure.
310 *
311 * The ERRORINFO structure is also treated like a COMPONENT, ie. the
312 * BOARD has pointers(offset) to the ERRORINFO structure. The rboard
313 * structure also has a pointer to the ERRORINFO structure. This is
314 * the place to store ERRORINFO about a REMOTE NODE, if the HUB on
315 * that NODE is not working or if the REMOTE MEMORY is BAD. In cases where
316 * only the CPU of the REMOTE NODE is disabled, the ERRORINFO pointer can
317 * be a NODE NUMBER, REMOTE OFFSET combination, pointing to error info
318 * which is present on the REMOTE NODE.(TBD)
319 * REMOTE ERRINFO can be stored on any of the nearest nodes
320 * or on all the nearest nodes.(TBD)
321 * Like BOARD structures, REMOTE ERRINFO structures can be built locally
322 * using the rboard errinfo pointer.
323 *
324 * In order to get useful information from this Data organization, a set of
325 * interface routines are provided (TBD). The important thing to remember while
326 * manipulating the structures, is that, the NODE number information should
327 * be used. If the NODE is non-zero (remote) then each offset should
328 * be added to the REMOTE BASE ADDR else it should be added to the LOCAL BASE ADDR.
329 * This includes offsets for BOARDS, COMPONENTS and ERRORINFO.
330 *
331 * Note that these structures do not provide much info about connectivity.
332 * That info will be part of HWGRAPH, which is an extension of the cfg_t
333 * data structure. (ref IP27prom/cfg.h) It has to be extended to include
334 * the IO part of the Network(TBD).
335 *
336 * The data structures below define the above concepts.
337 */
338
339/*
340 * Values for CPU types
341 */
342#define KL_CPU_R4000 0x1 /* Standard R4000 */
343#define KL_CPU_TFP 0x2 /* TFP processor */
344#define KL_CPU_R10000 0x3 /* R10000 (T5) */
345#define KL_CPU_NONE (-1) /* no cpu present in slot */
346
347/*
348 * IP27 BOARD classes
349 */
350
351#define KLCLASS_MASK 0xf0
352#define KLCLASS_NONE 0x00
353#define KLCLASS_NODE 0x10 /* CPU, Memory and HUB board */
354#define KLCLASS_CPU KLCLASS_NODE
355#define KLCLASS_IO 0x20 /* BaseIO, 4 ch SCSI, ethernet, FDDI
356 and the non-graphics widget boards */
357#define KLCLASS_ROUTER 0x30 /* Router board */
358#define KLCLASS_MIDPLANE 0x40 /* We need to treat this as a board
359 so that we can record error info */
360#define KLCLASS_GFX 0x50 /* graphics boards */
361
362#define KLCLASS_PSEUDO_GFX 0x60 /* HDTV type cards that use a gfx
363 * hw ifc to xtalk and are not gfx
364 * class for sw purposes */
365
366#define KLCLASS_MAX 7 /* Bump this if a new CLASS is added */
367#define KLTYPE_MAX 10 /* Bump this if a new CLASS is added */
368
369#define KLCLASS_UNKNOWN 0xf0
370
371#define KLCLASS(_x) ((_x) & KLCLASS_MASK)
372
373/*
374 * IP27 board types
375 */
376
377#define KLTYPE_MASK 0x0f
378#define KLTYPE_NONE 0x00
379#define KLTYPE_EMPTY 0x00
380
381#define KLTYPE_WEIRDCPU (KLCLASS_CPU | 0x0)
382#define KLTYPE_IP27 (KLCLASS_CPU | 0x1) /* 2 CPUs(R10K) per board */
383
384#define KLTYPE_WEIRDIO (KLCLASS_IO | 0x0)
385#define KLTYPE_BASEIO (KLCLASS_IO | 0x1) /* IOC3, SuperIO, Bridge, SCSI */
386#define KLTYPE_IO6 KLTYPE_BASEIO /* Additional name */
387#define KLTYPE_4CHSCSI (KLCLASS_IO | 0x2)
388#define KLTYPE_MSCSI KLTYPE_4CHSCSI /* Additional name */
389#define KLTYPE_ETHERNET (KLCLASS_IO | 0x3)
390#define KLTYPE_MENET KLTYPE_ETHERNET /* Additional name */
391#define KLTYPE_FDDI (KLCLASS_IO | 0x4)
392#define KLTYPE_UNUSED (KLCLASS_IO | 0x5) /* XXX UNUSED */
393#define KLTYPE_HAROLD (KLCLASS_IO | 0x6) /* PCI SHOE BOX */
394#define KLTYPE_PCI KLTYPE_HAROLD
395#define KLTYPE_VME (KLCLASS_IO | 0x7) /* Any 3rd party VME card */
396#define KLTYPE_MIO (KLCLASS_IO | 0x8)
397#define KLTYPE_FC (KLCLASS_IO | 0x9)
398#define KLTYPE_LINC (KLCLASS_IO | 0xA)
399#define KLTYPE_TPU (KLCLASS_IO | 0xB) /* Tensor Processing Unit */
400#define KLTYPE_GSN_A (KLCLASS_IO | 0xC) /* Main GSN board */
401#define KLTYPE_GSN_B (KLCLASS_IO | 0xD) /* Auxiliary GSN board */
402
403#define KLTYPE_GFX (KLCLASS_GFX | 0x0) /* unknown graphics type */
404#define KLTYPE_GFX_KONA (KLCLASS_GFX | 0x1) /* KONA graphics on IP27 */
405#define KLTYPE_GFX_MGRA (KLCLASS_GFX | 0x3) /* MGRAS graphics on IP27 */
406
407#define KLTYPE_WEIRDROUTER (KLCLASS_ROUTER | 0x0)
408#define KLTYPE_ROUTER (KLCLASS_ROUTER | 0x1)
409#define KLTYPE_ROUTER2 KLTYPE_ROUTER /* Obsolete! */
410#define KLTYPE_NULL_ROUTER (KLCLASS_ROUTER | 0x2)
411#define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3)
412
413#define KLTYPE_WEIRDMIDPLANE (KLCLASS_MIDPLANE | 0x0)
414#define KLTYPE_MIDPLANE8 (KLCLASS_MIDPLANE | 0x1) /* 8 slot backplane */
415#define KLTYPE_MIDPLANE KLTYPE_MIDPLANE8
416#define KLTYPE_PBRICK_XBOW (KLCLASS_MIDPLANE | 0x2)
417
418#define KLTYPE_IOBRICK (KLCLASS_IOBRICK | 0x0)
419#define KLTYPE_IBRICK (KLCLASS_IOBRICK | 0x1)
420#define KLTYPE_PBRICK (KLCLASS_IOBRICK | 0x2)
421#define KLTYPE_XBRICK (KLCLASS_IOBRICK | 0x3)
422
423#define KLTYPE_PBRICK_BRIDGE KLTYPE_PBRICK
424
425/* The value of type should be more than 8 so that hinv prints
426 * out the board name from the NIC string. For values less than
427 * 8 the name of the board needs to be hard coded in a few places.
428 * When bringup started nic names had not standardized and so we
429 * had to hard code. (For people interested in history.)
430 */
431#define KLTYPE_XTHD (KLCLASS_PSEUDO_GFX | 0x9)
432
433#define KLTYPE_UNKNOWN (KLCLASS_UNKNOWN | 0xf)
434
435#define KLTYPE(_x) ((_x) & KLTYPE_MASK)
436#define IS_MIO_PRESENT(l) ((l->brd_type == KLTYPE_BASEIO) && \
437 (l->brd_flags & SECOND_NIC_PRESENT))
438#define IS_MIO_IOC3(l,n) (IS_MIO_PRESENT(l) && (n > 2))
439
440/*
441 * board structures
442 */
443
444#define MAX_COMPTS_PER_BRD 24
445
446#define LOCAL_BOARD 1
447#define REMOTE_BOARD 2
448
449#define LBOARD_STRUCT_VERSION 2
450
451typedef struct lboard_s {
452 klconf_off_t brd_next; /* Next BOARD */
453 unsigned char struct_type; /* type of structure, local or remote */
454 unsigned char brd_type; /* type+class */
455 unsigned char brd_sversion; /* version of this structure */
456 unsigned char brd_brevision; /* board revision */
457 unsigned char brd_promver; /* board prom version, if any */
458 unsigned char brd_flags; /* Enabled, Disabled etc */
459 unsigned char brd_slot; /* slot number */
460 unsigned short brd_debugsw; /* Debug switches */
461 moduleid_t brd_module; /* module to which it belongs */
462 partid_t brd_partition; /* Partition number */
463 unsigned short brd_diagval; /* diagnostic value */
464 unsigned short brd_diagparm; /* diagnostic parameter */
465 unsigned char brd_inventory; /* inventory history */
466 unsigned char brd_numcompts; /* Number of components */
467 nic_t brd_nic; /* Number in CAN */
468 nasid_t brd_nasid; /* passed parameter */
469 klconf_off_t brd_compts[MAX_COMPTS_PER_BRD]; /* pointers to COMPONENTS */
470 klconf_off_t brd_errinfo; /* Board's error information */
471 struct lboard_s *brd_parent; /* Logical parent for this brd */
472 vertex_hdl_t brd_graph_link; /* vertex hdl to connect extern compts */
473 confidence_t brd_confidence; /* confidence that the board is bad */
474 nasid_t brd_owner; /* who owns this board */
475 unsigned char brd_nic_flags; /* To handle 8 more NICs */
476 char brd_name[32];
477} lboard_t;
478
479
480/*
481 * Make sure we pass back the calias space address for local boards.
482 * klconfig board traversal and error structure extraction defines.
483 */
484
485#define BOARD_SLOT(_brd) ((_brd)->brd_slot)
486
487#define KLCF_CLASS(_brd) KLCLASS((_brd)->brd_type)
488#define KLCF_TYPE(_brd) KLTYPE((_brd)->brd_type)
489#define KLCF_REMOTE(_brd) (((_brd)->struct_type & LOCAL_BOARD) ? 0 : 1)
490#define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts)
491#define KLCF_MODULE_ID(_brd) ((_brd)->brd_module)
492
493#ifdef FRUTEST
494
495#define KLCF_NEXT(_brd) ((_brd)->brd_next ? (lboard_t *)((_brd)->brd_next): NULL)
496#define KLCF_COMP(_brd, _ndx) (klinfo_t *)((_brd)->brd_compts[(_ndx)])
497#define KLCF_COMP_ERROR(_brd, _comp) (_brd = _brd , (_comp)->errinfo)
498
499#else
500
501#define KLCF_NEXT(_brd) \
502 ((_brd)->brd_next ? \
503 (lboard_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), (_brd)->brd_next)):\
504 NULL)
505#define KLCF_COMP(_brd, _ndx) \
506 (klinfo_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), \
507 (_brd)->brd_compts[(_ndx)]))
508
509#define KLCF_COMP_ERROR(_brd, _comp) \
510 (NODE_OFFSET_TO_K1(NASID_GET(_brd), (_comp)->errinfo))
511
512#endif
513
514#define KLCF_COMP_TYPE(_comp) ((_comp)->struct_type)
515#define KLCF_BRIDGE_W_ID(_comp) ((_comp)->physid) /* Widget ID */
516
517
518
519/*
520 * Generic info structure. This stores common info about a
521 * component.
522 */
523
524typedef struct klinfo_s { /* Generic info */
525 unsigned char struct_type; /* type of this structure */
526 unsigned char struct_version; /* version of this structure */
527 unsigned char flags; /* Enabled, disabled etc */
528 unsigned char revision; /* component revision */
529 unsigned short diagval; /* result of diagnostics */
530 unsigned short diagparm; /* diagnostic parameter */
531 unsigned char inventory; /* previous inventory status */
532 nic_t nic; /* MUst be aligned properly */
533 unsigned char physid; /* physical id of component */
534 unsigned int virtid; /* virtual id as seen by system */
535 unsigned char widid; /* Widget id - if applicable */
536 nasid_t nasid; /* node number - from parent */
537 char pad1; /* pad out structure. */
538 char pad2; /* pad out structure. */
539 COMPONENT *arcs_compt; /* ptr to the arcs struct for ease*/
540 klconf_off_t errinfo; /* component specific errors */
541 unsigned short pad3; /* pci fields have moved over to */
542 unsigned short pad4; /* klbri_t */
543} klinfo_t ;
544
545#define KLCONFIG_INFO_ENABLED(_i) ((_i)->flags & KLINFO_ENABLE)
546/*
547 * Component structures.
548 * Following are the currently identified components:
549 * CPU, HUB, MEM_BANK,
550 * XBOW(consists of 16 WIDGETs, each of which can be HUB or GRAPHICS or BRIDGE)
551 * BRIDGE, IOC3, SuperIO, SCSI, FDDI
552 * ROUTER
553 * GRAPHICS
554 */
555#define KLSTRUCT_UNKNOWN 0
556#define KLSTRUCT_CPU 1
557#define KLSTRUCT_HUB 2
558#define KLSTRUCT_MEMBNK 3
559#define KLSTRUCT_XBOW 4
560#define KLSTRUCT_BRI 5
561#define KLSTRUCT_IOC3 6
562#define KLSTRUCT_PCI 7
563#define KLSTRUCT_VME 8
564#define KLSTRUCT_ROU 9
565#define KLSTRUCT_GFX 10
566#define KLSTRUCT_SCSI 11
567#define KLSTRUCT_FDDI 12
568#define KLSTRUCT_MIO 13
569#define KLSTRUCT_DISK 14
570#define KLSTRUCT_TAPE 15
571#define KLSTRUCT_CDROM 16
572#define KLSTRUCT_HUB_UART 17
573#define KLSTRUCT_IOC3ENET 18
574#define KLSTRUCT_IOC3UART 19
575#define KLSTRUCT_UNUSED 20 /* XXX UNUSED */
576#define KLSTRUCT_IOC3PCKM 21
577#define KLSTRUCT_RAD 22
578#define KLSTRUCT_HUB_TTY 23
579#define KLSTRUCT_IOC3_TTY 24
580
581/* Early Access IO proms are compatible
582 only with KLSTRUCT values upto 24. */
583
584#define KLSTRUCT_FIBERCHANNEL 25
585#define KLSTRUCT_MOD_SERIAL_NUM 26
586#define KLSTRUCT_IOC3MS 27
587#define KLSTRUCT_TPU 28
588#define KLSTRUCT_GSN_A 29
589#define KLSTRUCT_GSN_B 30
590#define KLSTRUCT_XTHD 31
591
592/*
593 * These are the indices of various components within a lboard structure.
594 */
595
596#define IP27_CPU0_INDEX 0
597#define IP27_CPU1_INDEX 1
598#define IP27_HUB_INDEX 2
599#define IP27_MEM_INDEX 3
600
601#define BASEIO_BRIDGE_INDEX 0
602#define BASEIO_IOC3_INDEX 1
603#define BASEIO_SCSI1_INDEX 2
604#define BASEIO_SCSI2_INDEX 3
605
606#define MIDPLANE_XBOW_INDEX 0
607#define ROUTER_COMPONENT_INDEX 0
608
609#define CH4SCSI_BRIDGE_INDEX 0
610
611/* Info holders for various hardware components */
612
613typedef u64 *pci_t;
614typedef u64 *vmeb_t;
615typedef u64 *vmed_t;
616typedef u64 *fddi_t;
617typedef u64 *scsi_t;
618typedef u64 *mio_t;
619typedef u64 *graphics_t;
620typedef u64 *router_t;
621
622/*
623 * The port info in ip27_cfg area translates to a lboart_t in the
624 * KLCONFIG area. But since KLCONFIG does not use pointers, lboart_t
625 * is stored in terms of a nasid and a offset from start of KLCONFIG
626 * area on that nasid.
627 */
628typedef struct klport_s {
629 nasid_t port_nasid;
630 unsigned char port_flag;
631 klconf_off_t port_offset;
632} klport_t;
633
634#if 0
635/*
636 * This is very similar to the klport_s but instead of having a componant
637 * offset it has a board offset.
638 */
639typedef struct klxbow_port_s {
640 nasid_t port_nasid;
641 unsigned char port_flag;
642 klconf_off_t board_offset;
643} klxbow_port_t;
644#endif
645
646typedef struct klcpu_s { /* CPU */
647 klinfo_t cpu_info;
648 unsigned short cpu_prid; /* Processor PRID value */
649 unsigned short cpu_fpirr; /* FPU IRR value */
650 unsigned short cpu_speed; /* Speed in MHZ */
651 unsigned short cpu_scachesz; /* secondary cache size in MB */
652 unsigned short cpu_scachespeed;/* secondary cache speed in MHz */
653} klcpu_t ;
654
655#define CPU_STRUCT_VERSION 2
656
657typedef struct klhub_s { /* HUB */
658 klinfo_t hub_info;
659 uint hub_flags; /* PCFG_HUB_xxx flags */
660 klport_t hub_port; /* hub is connected to this */
661 nic_t hub_box_nic; /* nic of containing box */
662 klconf_off_t hub_mfg_nic; /* MFG NIC string */
663 u64 hub_speed; /* Speed of hub in HZ */
664} klhub_t ;
665
666typedef struct klhub_uart_s { /* HUB */
667 klinfo_t hubuart_info;
668 uint hubuart_flags; /* PCFG_HUB_xxx flags */
669 nic_t hubuart_box_nic; /* nic of containing box */
670} klhub_uart_t ;
671
672#define MEMORY_STRUCT_VERSION 2
673
674typedef struct klmembnk_s { /* MEMORY BANK */
675 klinfo_t membnk_info;
676 short membnk_memsz; /* Total memory in megabytes */
677 short membnk_dimm_select; /* bank to physical addr mapping*/
678 short membnk_bnksz[MD_MEM_BANKS]; /* Memory bank sizes */
679 short membnk_attr;
680} klmembnk_t ;
681
682#define KLCONFIG_MEMBNK_SIZE(_info, _bank) \
683 ((_info)->membnk_bnksz[(_bank)])
684
685
686#define MEMBNK_PREMIUM 1
687#define KLCONFIG_MEMBNK_PREMIUM(_info, _bank) \
688 ((_info)->membnk_attr & (MEMBNK_PREMIUM << (_bank)))
689
690#define MAX_SERIAL_NUM_SIZE 10
691
692typedef struct klmod_serial_num_s {
693 klinfo_t snum_info;
694 union {
695 char snum_str[MAX_SERIAL_NUM_SIZE];
696 unsigned long long snum_int;
697 } snum;
698} klmod_serial_num_t;
699
700/* Macros needed to access serial number structure in lboard_t.
701 Hard coded values are necessary since we cannot treat
702 serial number struct as a component without losing compatibility
703 between prom versions. */
704
705#define GET_SNUM_COMP(_l) ((klmod_serial_num_t *)\
706 KLCF_COMP(_l, _l->brd_numcompts))
707
708#define MAX_XBOW_LINKS 16
709
710typedef struct klxbow_s { /* XBOW */
711 klinfo_t xbow_info ;
712 klport_t xbow_port_info[MAX_XBOW_LINKS] ; /* Module number */
713 int xbow_master_hub_link;
714 /* type of brd connected+component struct ptr+flags */
715} klxbow_t ;
716
717#define MAX_PCI_SLOTS 8
718
719typedef struct klpci_device_s {
720 s32 pci_device_id; /* 32 bits of vendor/device ID. */
721 s32 pci_device_pad; /* 32 bits of padding. */
722} klpci_device_t;
723
724#define BRIDGE_STRUCT_VERSION 2
725
726typedef struct klbri_s { /* BRIDGE */
727 klinfo_t bri_info ;
728 unsigned char bri_eprominfo ; /* IO6prom connected to bridge */
729 unsigned char bri_bustype ; /* PCI/VME BUS bridge/GIO */
730 pci_t pci_specific ; /* PCI Board config info */
731 klpci_device_t bri_devices[MAX_PCI_DEVS] ; /* PCI IDs */
732 klconf_off_t bri_mfg_nic ;
733} klbri_t ;
734
735#define MAX_IOC3_TTY 2
736
737typedef struct klioc3_s { /* IOC3 */
738 klinfo_t ioc3_info ;
739 unsigned char ioc3_ssram ; /* Info about ssram */
740 unsigned char ioc3_nvram ; /* Info about nvram */
741 klinfo_t ioc3_superio ; /* Info about superio */
742 klconf_off_t ioc3_tty_off ;
743 klinfo_t ioc3_enet ;
744 klconf_off_t ioc3_enet_off ;
745 klconf_off_t ioc3_kbd_off ;
746} klioc3_t ;
747
748#define MAX_VME_SLOTS 8
749
750typedef struct klvmeb_s { /* VME BRIDGE - PCI CTLR */
751 klinfo_t vmeb_info ;
752 vmeb_t vmeb_specific ;
753 klconf_off_t vmeb_brdinfo[MAX_VME_SLOTS] ; /* VME Board config info */
754} klvmeb_t ;
755
756typedef struct klvmed_s { /* VME DEVICE - VME BOARD */
757 klinfo_t vmed_info ;
758 vmed_t vmed_specific ;
759 klconf_off_t vmed_brdinfo[MAX_VME_SLOTS] ; /* VME Board config info */
760} klvmed_t ;
761
762#define ROUTER_VECTOR_VERS 2
763
764/* XXX - Don't we need the number of ports here?!? */
765typedef struct klrou_s { /* ROUTER */
766 klinfo_t rou_info ;
767 uint rou_flags ; /* PCFG_ROUTER_xxx flags */
768 nic_t rou_box_nic ; /* nic of the containing module */
769 klport_t rou_port[MAX_ROUTER_PORTS + 1] ; /* array index 1 to 6 */
770 klconf_off_t rou_mfg_nic ; /* MFG NIC string */
771 u64 rou_vector; /* vector from master node */
772} klrou_t ;
773
774/*
775 * Graphics Controller/Device
776 *
777 * (IP27/IO6) Prom versions 6.13 (and 6.5.1 kernels) and earlier
778 * used a couple different structures to store graphics information.
779 * For compatibility reasons, the newer data structure preserves some
780 * of the layout so that fields that are used in the old versions remain
781 * in the same place (with the same info). Determination of what version
782 * of this structure we have is done by checking the cookie field.
783 */
784#define KLGFX_COOKIE 0x0c0de000
785
786typedef struct klgfx_s { /* GRAPHICS Device */
787 klinfo_t gfx_info;
788 klconf_off_t old_gndevs; /* for compatibility with older proms */
789 klconf_off_t old_gdoff0; /* for compatibility with older proms */
790 uint cookie; /* for compatibility with older proms */
791 uint moduleslot;
792 struct klgfx_s *gfx_next_pipe;
793 graphics_t gfx_specific;
794 klconf_off_t pad0; /* for compatibility with older proms */
795 klconf_off_t gfx_mfg_nic;
796} klgfx_t;
797
798typedef struct klxthd_s {
799 klinfo_t xthd_info ;
800 klconf_off_t xthd_mfg_nic ; /* MFG NIC string */
801} klxthd_t ;
802
803typedef struct kltpu_s { /* TPU board */
804 klinfo_t tpu_info ;
805 klconf_off_t tpu_mfg_nic ; /* MFG NIC string */
806} kltpu_t ;
807
808typedef struct klgsn_s { /* GSN board */
809 klinfo_t gsn_info ;
810 klconf_off_t gsn_mfg_nic ; /* MFG NIC string */
811} klgsn_t ;
812
813#define MAX_SCSI_DEVS 16
814
815/*
816 * NOTE: THis is the max sized kl* structure and is used in klmalloc.c
817 * to allocate space of type COMPONENT. Make sure that if the size of
818 * any other component struct becomes more than this, then redefine
819 * that as the size to be klmalloced.
820 */
821
822typedef struct klscsi_s { /* SCSI Controller */
823 klinfo_t scsi_info ;
824 scsi_t scsi_specific ;
825 unsigned char scsi_numdevs ;
826 klconf_off_t scsi_devinfo[MAX_SCSI_DEVS] ;
827} klscsi_t ;
828
829typedef struct klscdev_s { /* SCSI device */
830 klinfo_t scdev_info ;
831 struct scsidisk_data *scdev_cfg ; /* driver fills up this */
832} klscdev_t ;
833
834typedef struct klttydev_s { /* TTY device */
835 klinfo_t ttydev_info ;
836 struct terminal_data *ttydev_cfg ; /* driver fills up this */
837} klttydev_t ;
838
839typedef struct klenetdev_s { /* ENET device */
840 klinfo_t enetdev_info ;
841 struct net_data *enetdev_cfg ; /* driver fills up this */
842} klenetdev_t ;
843
844typedef struct klkbddev_s { /* KBD device */
845 klinfo_t kbddev_info ;
846 struct keyboard_data *kbddev_cfg ; /* driver fills up this */
847} klkbddev_t ;
848
849typedef struct klmsdev_s { /* mouse device */
850 klinfo_t msdev_info ;
851 void *msdev_cfg ;
852} klmsdev_t ;
853
854#define MAX_FDDI_DEVS 10 /* XXX Is this true */
855
856typedef struct klfddi_s { /* FDDI */
857 klinfo_t fddi_info ;
858 fddi_t fddi_specific ;
859 klconf_off_t fddi_devinfo[MAX_FDDI_DEVS] ;
860} klfddi_t ;
861
862typedef struct klmio_s { /* MIO */
863 klinfo_t mio_info ;
864 mio_t mio_specific ;
865} klmio_t ;
866
867
868typedef union klcomp_s {
869 klcpu_t kc_cpu;
870 klhub_t kc_hub;
871 klmembnk_t kc_mem;
872 klxbow_t kc_xbow;
873 klbri_t kc_bri;
874 klioc3_t kc_ioc3;
875 klvmeb_t kc_vmeb;
876 klvmed_t kc_vmed;
877 klrou_t kc_rou;
878 klgfx_t kc_gfx;
879 klscsi_t kc_scsi;
880 klscdev_t kc_scsi_dev;
881 klfddi_t kc_fddi;
882 klmio_t kc_mio;
883 klmod_serial_num_t kc_snum ;
884} klcomp_t;
885
886typedef union kldev_s { /* for device structure allocation */
887 klscdev_t kc_scsi_dev ;
888 klttydev_t kc_tty_dev ;
889 klenetdev_t kc_enet_dev ;
890 klkbddev_t kc_kbd_dev ;
891} kldev_t ;
892
893/* Data structure interface routines. TBD */
894
895/* Include launch info in this file itself? TBD */
896
897/*
898 * TBD - Can the ARCS and device driver related info also be included in the
899 * KLCONFIG area. On the IO4PROM, prom device driver info is part of cfgnode_t
900 * structure, viz private to the IO4prom.
901 */
902
903/*
904 * TBD - Allocation issues.
905 *
906 * Do we need to Mark off sepatate heaps for lboard_t, rboard_t, component,
907 * errinfo and allocate from them, or have a single heap and allocate all
908 * structures from it. Debug is easier in the former method since we can
909 * dump all similar structs in one command, but there will be lots of holes,
910 * in memory and max limits are needed for number of structures.
911 * Another way to make it organized, is to have a union of all components
912 * and allocate a aligned chunk of memory greater than the biggest
913 * component.
914 */
915
916typedef union {
917 lboard_t *lbinfo ;
918} biptr_t ;
919
920
921#define BRI_PER_XBOW 6
922#define PCI_PER_BRI 8
923#define DEV_PER_PCI 16
924
925
926/* Virtual dipswitch values (starting from switch "7"): */
927
928#define VDS_NOGFX 0x8000 /* Don't enable gfx and autoboot */
929#define VDS_NOMP 0x100 /* Don't start slave processors */
930#define VDS_MANUMODE 0x80 /* Manufacturing mode */
931#define VDS_NOARB 0x40 /* No bootmaster arbitration */
932#define VDS_PODMODE 0x20 /* Go straight to POD mode */
933#define VDS_NO_DIAGS 0x10 /* Don't run any diags after BM arb */
934#define VDS_DEFAULTS 0x08 /* Use default environment values */
935#define VDS_NOMEMCLEAR 0x04 /* Don't run mem cfg code */
936#define VDS_2ND_IO4 0x02 /* Boot from the second IO4 */
937#define VDS_DEBUG_PROM 0x01 /* Print PROM debugging messages */
938
939/* external declarations of Linux kernel functions. */
940
941extern lboard_t *find_lboard(lboard_t *start, unsigned char type);
942extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
943extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
944extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int);
945extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class);
946
947
948#if defined(CONFIG_SGI_IO)
949extern xwidgetnum_t nodevertex_widgetnum_get(vertex_hdl_t node_vtx);
950extern vertex_hdl_t nodevertex_xbow_peer_get(vertex_hdl_t node_vtx);
951extern lboard_t *find_gfxpipe(int pipenum);
952extern void setup_gfxpipe_link(vertex_hdl_t vhdl,int pipenum);
953extern lboard_t *find_lboard_module_class(lboard_t *start, moduleid_t mod,
954 unsigned char brd_class);
955extern lboard_t *find_nic_lboard(lboard_t *, nic_t);
956extern lboard_t *find_nic_type_lboard(nasid_t, unsigned char, nic_t);
957extern lboard_t *find_lboard_modslot(lboard_t *start, moduleid_t mod, slotid_t slot);
958extern lboard_t *find_lboard_module(lboard_t *start, moduleid_t mod);
959extern lboard_t *get_board_name(nasid_t nasid, moduleid_t mod, slotid_t slot, char *name);
960extern int config_find_nic_router(nasid_t, nic_t, lboard_t **, klrou_t**);
961extern int config_find_nic_hub(nasid_t, nic_t, lboard_t **, klhub_t**);
962extern int config_find_xbow(nasid_t, lboard_t **, klxbow_t**);
963extern klcpu_t *get_cpuinfo(cpuid_t cpu);
964extern int update_klcfg_cpuinfo(nasid_t, int);
965extern void board_to_path(lboard_t *brd, char *path);
966extern moduleid_t get_module_id(nasid_t nasid);
967extern void nic_name_convert(char *old_name, char *new_name);
968extern int module_brds(nasid_t nasid, lboard_t **module_brds, int n);
969extern lboard_t *brd_from_key(ulong_t key);
970extern void device_component_canonical_name_get(lboard_t *,klinfo_t *,
971 char *);
972extern int board_serial_number_get(lboard_t *,char *);
973extern int is_master_baseio(nasid_t,moduleid_t,slotid_t);
974extern nasid_t get_actual_nasid(lboard_t *brd) ;
975extern net_vec_t klcfg_discover_route(lboard_t *, lboard_t *, int);
976#else /* CONFIG_SGI_IO */
977extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu);
978#endif /* CONFIG_SGI_IO */
979
980#endif /* _ASM_SN_KLCONFIG_H */
diff --git a/include/asm-mips/sn/kldir.h b/include/asm-mips/sn/kldir.h
new file mode 100644
index 000000000000..f0efab1672ec
--- /dev/null
+++ b/include/asm-mips/sn/kldir.h
@@ -0,0 +1,248 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/kldir.h>, revision 1.21.
7 *
8 * Copyright (C) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 1999, 2000 by Ralf Baechle
10 */
11#ifndef _ASM_SN_KLDIR_H
12#define _ASM_SN_KLDIR_H
13
14#include <linux/config.h>
15
16#if defined(CONFIG_SGI_IO)
17#include <asm/hack.h>
18#endif
19
20/*
21 * The kldir memory area resides at a fixed place in each node's memory and
22 * provides pointers to most other IP27 memory areas. This allows us to
23 * resize and/or relocate memory areas at a later time without breaking all
24 * firmware and kernels that use them. Indices in the array are
25 * permanently dedicated to areas listed below. Some memory areas (marked
26 * below) reside at a permanently fixed location, but are included in the
27 * directory for completeness.
28 */
29
30#define KLDIR_MAGIC 0x434d5f53505f5357
31
32/*
33 * The upper portion of the memory map applies during boot
34 * only and is overwritten by IRIX/SYMMON.
35 *
36 * MEMORY MAP PER NODE
37 *
38 * 0x2000000 (32M) +-----------------------------------------+
39 * | IO6 BUFFERS FOR FLASH ENET IOC3 |
40 * 0x1F80000 (31.5M) +-----------------------------------------+
41 * | IO6 TEXT/DATA/BSS/stack |
42 * 0x1C00000 (30M) +-----------------------------------------+
43 * | IO6 PROM DEBUG TEXT/DATA/BSS/stack |
44 * 0x0800000 (28M) +-----------------------------------------+
45 * | IP27 PROM TEXT/DATA/BSS/stack |
46 * 0x1B00000 (27M) +-----------------------------------------+
47 * | IP27 CFG |
48 * 0x1A00000 (26M) +-----------------------------------------+
49 * | Graphics PROM |
50 * 0x1800000 (24M) +-----------------------------------------+
51 * | 3rd Party PROM drivers |
52 * 0x1600000 (22M) +-----------------------------------------+
53 * | |
54 * | Free |
55 * | |
56 * +-----------------------------------------+
57 * | UNIX DEBUG Version |
58 * 0x190000 (2M--) +-----------------------------------------+
59 * | SYMMON |
60 * | (For UNIX Debug only) |
61 * 0x34000 (208K) +-----------------------------------------+
62 * | SYMMON STACK [NUM_CPU_PER_NODE] |
63 * | (For UNIX Debug only) |
64 * 0x25000 (148K) +-----------------------------------------+
65 * | KLCONFIG - II (temp) |
66 * | |
67 * | ---------------------------- |
68 * | |
69 * | UNIX NON-DEBUG Version |
70 * 0x19000 (100K) +-----------------------------------------+
71 *
72 *
73 * The lower portion of the memory map contains information that is
74 * permanent and is used by the IP27PROM, IO6PROM and IRIX.
75 *
76 * 0x19000 (100K) +-----------------------------------------+
77 * | |
78 * | PI Error Spools (32K) |
79 * | |
80 * 0x12000 (72K) +-----------------------------------------+
81 * | Unused |
82 * 0x11c00 (71K) +-----------------------------------------+
83 * | CPU 1 NMI Eframe area |
84 * 0x11a00 (70.5K) +-----------------------------------------+
85 * | CPU 0 NMI Eframe area |
86 * 0x11800 (70K) +-----------------------------------------+
87 * | CPU 1 NMI Register save area |
88 * 0x11600 (69.5K) +-----------------------------------------+
89 * | CPU 0 NMI Register save area |
90 * 0x11400 (69K) +-----------------------------------------+
91 * | GDA (1k) |
92 * 0x11000 (68K) +-----------------------------------------+
93 * | Early cache Exception stack |
94 * | and/or |
95 * | kernel/io6prom nmi registers |
96 * 0x10800 (66k) +-----------------------------------------+
97 * | cache error eframe |
98 * 0x10400 (65K) +-----------------------------------------+
99 * | Exception Handlers (UALIAS copy) |
100 * 0x10000 (64K) +-----------------------------------------+
101 * | |
102 * | |
103 * | KLCONFIG - I (permanent) (48K) |
104 * | |
105 * | |
106 * | |
107 * 0x4000 (16K) +-----------------------------------------+
108 * | NMI Handler (Protected Page) |
109 * 0x3000 (12K) +-----------------------------------------+
110 * | ARCS PVECTORS (master node only) |
111 * 0x2c00 (11K) +-----------------------------------------+
112 * | ARCS TVECTORS (master node only) |
113 * 0x2800 (10K) +-----------------------------------------+
114 * | LAUNCH [NUM_CPU] |
115 * 0x2400 (9K) +-----------------------------------------+
116 * | Low memory directory (KLDIR) |
117 * 0x2000 (8K) +-----------------------------------------+
118 * | ARCS SPB (1K) |
119 * 0x1000 (4K) +-----------------------------------------+
120 * | Early cache Exception stack |
121 * | and/or |
122 * | kernel/io6prom nmi registers |
123 * 0x800 (2k) +-----------------------------------------+
124 * | cache error eframe |
125 * 0x400 (1K) +-----------------------------------------+
126 * | Exception Handlers |
127 * 0x0 (0K) +-----------------------------------------+
128 */
129
130#ifdef __ASSEMBLY__
131#define KLDIR_OFF_MAGIC 0x00
132#define KLDIR_OFF_OFFSET 0x08
133#define KLDIR_OFF_POINTER 0x10
134#define KLDIR_OFF_SIZE 0x18
135#define KLDIR_OFF_COUNT 0x20
136#define KLDIR_OFF_STRIDE 0x28
137#endif /* __ASSEMBLY__ */
138
139#if !defined(CONFIG_SGI_IO)
140
141/*
142 * This is defined here because IP27_SYMMON_STK_SIZE must be at least what
143 * we define here. Since it's set up in the prom. We can't redefine it later
144 * and expect more space to be allocated. The way to find out the true size
145 * of the symmon stacks is to divide SYMMON_STK_SIZE by SYMMON_STK_STRIDE
146 * for a particular node.
147 */
148#define SYMMON_STACK_SIZE 0x8000
149
150#if defined (PROM) || defined (SABLE)
151
152/*
153 * These defines are prom version dependent. No code other than the IP27
154 * prom should attempt to use these values.
155 */
156#define IP27_LAUNCH_OFFSET 0x2400
157#define IP27_LAUNCH_SIZE 0x400
158#define IP27_LAUNCH_COUNT 2
159#define IP27_LAUNCH_STRIDE 0x200
160
161#define IP27_KLCONFIG_OFFSET 0x4000
162#define IP27_KLCONFIG_SIZE 0xc000
163#define IP27_KLCONFIG_COUNT 1
164#define IP27_KLCONFIG_STRIDE 0
165
166#define IP27_NMI_OFFSET 0x3000
167#define IP27_NMI_SIZE 0x40
168#define IP27_NMI_COUNT 2
169#define IP27_NMI_STRIDE 0x40
170
171#define IP27_PI_ERROR_OFFSET 0x12000
172#define IP27_PI_ERROR_SIZE 0x4000
173#define IP27_PI_ERROR_COUNT 1
174#define IP27_PI_ERROR_STRIDE 0
175
176#define IP27_SYMMON_STK_OFFSET 0x25000
177#define IP27_SYMMON_STK_SIZE 0xe000
178#define IP27_SYMMON_STK_COUNT 2
179/* IP27_SYMMON_STK_STRIDE must be >= SYMMON_STACK_SIZE */
180#define IP27_SYMMON_STK_STRIDE 0x7000
181
182#define IP27_FREEMEM_OFFSET 0x19000
183#define IP27_FREEMEM_SIZE -1
184#define IP27_FREEMEM_COUNT 1
185#define IP27_FREEMEM_STRIDE 0
186
187#endif /* PROM || SABLE*/
188/*
189 * There will be only one of these in a partition so the IO6 must set it up.
190 */
191#define IO6_GDA_OFFSET 0x11000
192#define IO6_GDA_SIZE 0x400
193#define IO6_GDA_COUNT 1
194#define IO6_GDA_STRIDE 0
195
196/*
197 * save area of kernel nmi regs in the prom format
198 */
199#define IP27_NMI_KREGS_OFFSET 0x11400
200#define IP27_NMI_KREGS_CPU_SIZE 0x200
201/*
202 * save area of kernel nmi regs in eframe format
203 */
204#define IP27_NMI_EFRAME_OFFSET 0x11800
205#define IP27_NMI_EFRAME_SIZE 0x200
206
207#define KLDIR_ENT_SIZE 0x40
208#define KLDIR_MAX_ENTRIES (0x400 / 0x40)
209
210#endif /* !CONFIG_SGI_IO */
211
212#ifndef __ASSEMBLY__
213typedef struct kldir_ent_s {
214 u64 magic; /* Indicates validity of entry */
215 off_t offset; /* Offset from start of node space */
216#if defined(CONFIG_SGI_IO) /* FIXME */
217 __psunsigned_t pointer; /* Pointer to area in some cases */
218#else
219 unsigned long pointer; /* Pointer to area in some cases */
220#endif
221 size_t size; /* Size in bytes */
222 u64 count; /* Repeat count if array, 1 if not */
223 size_t stride; /* Stride if array, 0 if not */
224 char rsvd[16]; /* Pad entry to 0x40 bytes */
225 /* NOTE: These 16 bytes are used in the Partition KLDIR
226 entry to store partition info. Refer to klpart.h for this. */
227} kldir_ent_t;
228#endif /* !__ASSEMBLY__ */
229
230#if defined(CONFIG_SGI_IO)
231
232#define KLDIR_ENT_SIZE 0x40
233#define KLDIR_MAX_ENTRIES (0x400 / 0x40)
234
235/*
236 * The actual offsets of each memory area are machine-dependent
237 */
238#ifdef CONFIG_SGI_IP27
239// Not yet #include <asm/sn/sn0/kldir.h>
240#elif defined(CONFIG_SGI_IP35)
241#include <asm/sn/sn1/kldir.h>
242#else
243#error "kldir.h is currently defined for IP27 and IP35 platforms only"
244#endif
245
246#endif /* CONFIG_SGI_IO */
247
248#endif /* _ASM_SN_KLDIR_H */
diff --git a/include/asm-mips/sn/klkernvars.h b/include/asm-mips/sn/klkernvars.h
new file mode 100644
index 000000000000..5de4c5e8ab30
--- /dev/null
+++ b/include/asm-mips/sn/klkernvars.h
@@ -0,0 +1,29 @@
1/*
2 * File ported from IRIX to Linux by Kanoj Sarcar, 06/08/00.
3 * Copyright 2000 Silicon Graphics, Inc.
4 */
5#ifndef __ASM_SN_KLKERNVARS_H
6#define __ASM_SN_KLKERNVARS_H
7
8#define KV_MAGIC_OFFSET 0x0
9#define KV_RO_NASID_OFFSET 0x4
10#define KV_RW_NASID_OFFSET 0x6
11
12#define KV_MAGIC 0x5f4b565f
13
14#ifndef __ASSEMBLY__
15
16#include <asm/sn/types.h>
17
18typedef struct kern_vars_s {
19 int kv_magic;
20 nasid_t kv_ro_nasid;
21 nasid_t kv_rw_nasid;
22 unsigned long kv_ro_baseaddr;
23 unsigned long kv_rw_baseaddr;
24} kern_vars_t;
25
26#endif /* !__ASSEMBLY__ */
27
28#endif /* __ASM_SN_KLKERNVARS_H */
29
diff --git a/include/asm-mips/sn/launch.h b/include/asm-mips/sn/launch.h
new file mode 100644
index 000000000000..b67699c0c475
--- /dev/null
+++ b/include/asm-mips/sn/launch.h
@@ -0,0 +1,107 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 2000 Silicon Graphics, Inc.
7 * Copyright (C) 2000 by Colin Ngam
8 */
9#ifndef _ASM_SN_LAUNCH_H
10#define _ASM_SN_LAUNCH_H
11
12#include <linux/config.h>
13#include <asm/sn/types.h>
14#include <asm/sn/addrs.h>
15
16/*
17 * The launch data structure resides at a fixed place in each node's memory
18 * and is used to communicate between the master processor and the slave
19 * processors.
20 *
21 * The master stores launch parameters in the launch structure
22 * corresponding to a target processor that is in a slave loop, then sends
23 * an interrupt to the slave processor. The slave calls the desired
24 * function, then returns to the slave loop. The master may poll or wait
25 * for the slaves to finish.
26 *
27 * There is an array of launch structures, one per CPU on the node. One
28 * interrupt level is used per local CPU.
29 */
30
31#define LAUNCH_MAGIC 0xaddbead2addbead3
32#ifdef CONFIG_SGI_IP27
33#define LAUNCH_SIZEOF 0x100
34#define LAUNCH_PADSZ 0xa0
35#endif
36
37#define LAUNCH_OFF_MAGIC 0x00 /* Struct offsets for assembly */
38#define LAUNCH_OFF_BUSY 0x08
39#define LAUNCH_OFF_CALL 0x10
40#define LAUNCH_OFF_CALLC 0x18
41#define LAUNCH_OFF_CALLPARM 0x20
42#define LAUNCH_OFF_STACK 0x28
43#define LAUNCH_OFF_GP 0x30
44#define LAUNCH_OFF_BEVUTLB 0x38
45#define LAUNCH_OFF_BEVNORMAL 0x40
46#define LAUNCH_OFF_BEVECC 0x48
47
48#define LAUNCH_STATE_DONE 0 /* Return value of LAUNCH_POLL */
49#define LAUNCH_STATE_SENT 1
50#define LAUNCH_STATE_RECD 2
51
52/*
53 * The launch routine is called only if the complement address is correct.
54 *
55 * Before control is transferred to a routine, the complement address
56 * is zeroed (invalidated) to prevent an accidental call from a spurious
57 * interrupt.
58 *
59 * The slave_launch routine turns on the BUSY flag, and the slave loop
60 * clears the BUSY flag after control is returned to it.
61 */
62
63#ifndef __ASSEMBLY__
64
65typedef int launch_state_t;
66typedef void (*launch_proc_t)(u64 call_parm);
67
68typedef struct launch_s {
69 volatile u64 magic; /* Magic number */
70 volatile u64 busy; /* Slave currently active */
71 volatile launch_proc_t call_addr; /* Func. for slave to call */
72 volatile u64 call_addr_c; /* 1's complement of call_addr*/
73 volatile u64 call_parm; /* Single parm passed to call*/
74 volatile void *stack_addr; /* Stack pointer for slave function */
75 volatile void *gp_addr; /* Global pointer for slave func. */
76 volatile char *bevutlb;/* Address of bev utlb ex handler */
77 volatile char *bevnormal;/*Address of bev normal ex handler */
78 volatile char *bevecc;/* Address of bev cache err handler */
79 volatile char pad[160]; /* Pad to LAUNCH_SIZEOF */
80} launch_t;
81
82/*
83 * PROM entry points for launch routines are determined by IPxxprom/start.s
84 */
85
86#define LAUNCH_SLAVE (*(void (*)(int nasid, int cpu, \
87 launch_proc_t call_addr, \
88 u64 call_parm, \
89 void *stack_addr, \
90 void *gp_addr)) \
91 IP27PROM_LAUNCHSLAVE)
92
93#define LAUNCH_WAIT (*(void (*)(int nasid, int cpu, int timeout_msec)) \
94 IP27PROM_WAITSLAVE)
95
96#define LAUNCH_POLL (*(launch_state_t (*)(int nasid, int cpu)) \
97 IP27PROM_POLLSLAVE)
98
99#define LAUNCH_LOOP (*(void (*)(void)) \
100 IP27PROM_SLAVELOOP)
101
102#define LAUNCH_FLASH (*(void (*)(void)) \
103 IP27PROM_FLASHLEDS)
104
105#endif /* !__ASSEMBLY__ */
106
107#endif /* _ASM_SN_LAUNCH_H */
diff --git a/include/asm-mips/sn/mapped_kernel.h b/include/asm-mips/sn/mapped_kernel.h
new file mode 100644
index 000000000000..3a17846df849
--- /dev/null
+++ b/include/asm-mips/sn/mapped_kernel.h
@@ -0,0 +1,59 @@
1/*
2 * File created by Kanoj Sarcar 06/06/00.
3 * Copyright 2000 Silicon Graphics, Inc.
4 */
5#ifndef __ASM_SN_MAPPED_KERNEL_H
6#define __ASM_SN_MAPPED_KERNEL_H
7
8/*
9 * Note on how mapped kernels work: the text and data section is
10 * compiled at cksseg segment (LOADADDR = 0xc001c000), and the
11 * init/setup/data section gets a 16M virtual address bump in the
12 * ld.script file (so that tlblo0 and tlblo1 maps the sections).
13 * The vmlinux.64 section addresses are put in the xkseg range
14 * using the change-addresses makefile option. Use elfdump -of
15 * on IRIX to see where the sections go. The Origin loader loads
16 * the two sections contiguously in physical memory. The loader
17 * sets the entry point into kernel_entry using a xkphys address,
18 * but instead of using 0xa800000001160000, it uses the address
19 * 0xa800000000160000, which is where it physically loaded that
20 * code. So no jumps can be done before we have switched to using
21 * cksseg addresses.
22 */
23#include <linux/config.h>
24#include <asm/addrspace.h>
25
26#ifdef CONFIG_BUILD_ELF64
27#define REP_BASE CAC_BASE
28#else
29#define REP_BASE CKSEG0
30#endif
31
32#ifdef CONFIG_MAPPED_KERNEL
33
34#define MAPPED_ADDR_RO_TO_PHYS(x) (x - REP_BASE)
35#define MAPPED_ADDR_RW_TO_PHYS(x) (x - REP_BASE - 16777216)
36
37#define MAPPED_KERN_RO_PHYSBASE(n) \
38 (PLAT_NODE_DATA(n)->kern_vars.kv_ro_baseaddr)
39#define MAPPED_KERN_RW_PHYSBASE(n) \
40 (PLAT_NODE_DATA(n)->kern_vars.kv_rw_baseaddr)
41
42#define MAPPED_KERN_RO_TO_PHYS(x) \
43 ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \
44 MAPPED_KERN_RO_PHYSBASE(get_compact_nodeid()))
45#define MAPPED_KERN_RW_TO_PHYS(x) \
46 ((unsigned long)MAPPED_ADDR_RW_TO_PHYS(x) | \
47 MAPPED_KERN_RW_PHYSBASE(get_compact_nodeid()))
48
49#else /* CONFIG_MAPPED_KERNEL */
50
51#define MAPPED_KERN_RO_TO_PHYS(x) (x - REP_BASE)
52#define MAPPED_KERN_RW_TO_PHYS(x) (x - REP_BASE)
53
54#endif /* CONFIG_MAPPED_KERNEL */
55
56#define MAPPED_KERN_RO_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RO_TO_PHYS(x))
57#define MAPPED_KERN_RW_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RW_TO_PHYS(x))
58
59#endif /* __ASM_SN_MAPPED_KERNEL_H */
diff --git a/include/asm-mips/sn/nmi.h b/include/asm-mips/sn/nmi.h
new file mode 100644
index 000000000000..6b7b0b5f3729
--- /dev/null
+++ b/include/asm-mips/sn/nmi.h
@@ -0,0 +1,125 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997 Silicon Graphics, Inc.
7 */
8#ifndef __ASM_SN_NMI_H
9#define __ASM_SN_NMI_H
10
11#ident "$Revision: 1.5 $"
12
13#include <asm/sn/addrs.h>
14
15/*
16 * The launch data structure resides at a fixed place in each node's memory
17 * and is used to communicate between the master processor and the slave
18 * processors.
19 *
20 * The master stores launch parameters in the launch structure
21 * corresponding to a target processor that is in a slave loop, then sends
22 * an interrupt to the slave processor. The slave calls the desired
23 * function, followed by an optional rendezvous function, then returns to
24 * the slave loop. The master does not wait for the slaves before
25 * returning.
26 *
27 * There is an array of launch structures, one per CPU on the node. One
28 * interrupt level is used per CPU.
29 */
30
31#define NMI_MAGIC 0x48414d4d455201
32#define NMI_SIZEOF 0x40
33
34#define NMI_OFF_MAGIC 0x00 /* Struct offsets for assembly */
35#define NMI_OFF_FLAGS 0x08
36#define NMI_OFF_CALL 0x10
37#define NMI_OFF_CALLC 0x18
38#define NMI_OFF_CALLPARM 0x20
39#define NMI_OFF_GMASTER 0x28
40
41/*
42 * The NMI routine is called only if the complement address is
43 * correct.
44 *
45 * Before control is transferred to a routine, the complement address
46 * is zeroed (invalidated) to prevent an accidental call from a spurious
47 * interrupt.
48 *
49 */
50
51#ifndef __ASSEMBLY__
52
53typedef struct nmi_s {
54 volatile unsigned long magic; /* Magic number */
55 volatile unsigned long flags; /* Combination of flags above */
56 volatile void *call_addr; /* Routine for slave to call */
57 volatile void *call_addr_c; /* 1's complement of address */
58 volatile void *call_parm; /* Single parm passed to call */
59 volatile unsigned long gmaster; /* Flag true only on global master*/
60} nmi_t;
61
62#endif /* !__ASSEMBLY__ */
63
64/* Following definitions are needed both in the prom & the kernel
65 * to identify the format of the nmi cpu register save area in the
66 * low memory on each node.
67 */
68#ifndef __ASSEMBLY__
69
70struct reg_struct {
71 unsigned long gpr[32];
72 unsigned long sr;
73 unsigned long cause;
74 unsigned long epc;
75 unsigned long badva;
76 unsigned long error_epc;
77 unsigned long cache_err;
78 unsigned long nmi_sr;
79};
80
81#endif /* !__ASSEMBLY__ */
82
83/* These are the assembly language offsets into the reg_struct structure */
84
85#define R0_OFF 0x0
86#define R1_OFF 0x8
87#define R2_OFF 0x10
88#define R3_OFF 0x18
89#define R4_OFF 0x20
90#define R5_OFF 0x28
91#define R6_OFF 0x30
92#define R7_OFF 0x38
93#define R8_OFF 0x40
94#define R9_OFF 0x48
95#define R10_OFF 0x50
96#define R11_OFF 0x58
97#define R12_OFF 0x60
98#define R13_OFF 0x68
99#define R14_OFF 0x70
100#define R15_OFF 0x78
101#define R16_OFF 0x80
102#define R17_OFF 0x88
103#define R18_OFF 0x90
104#define R19_OFF 0x98
105#define R20_OFF 0xa0
106#define R21_OFF 0xa8
107#define R22_OFF 0xb0
108#define R23_OFF 0xb8
109#define R24_OFF 0xc0
110#define R25_OFF 0xc8
111#define R26_OFF 0xd0
112#define R27_OFF 0xd8
113#define R28_OFF 0xe0
114#define R29_OFF 0xe8
115#define R30_OFF 0xf0
116#define R31_OFF 0xf8
117#define SR_OFF 0x100
118#define CAUSE_OFF 0x108
119#define EPC_OFF 0x110
120#define BADVA_OFF 0x118
121#define ERROR_EPC_OFF 0x120
122#define CACHE_ERR_OFF 0x128
123#define NMISR_OFF 0x130
124
125#endif /* __ASM_SN_NMI_H */
diff --git a/include/asm-mips/sn/sn0/addrs.h b/include/asm-mips/sn/sn0/addrs.h
new file mode 100644
index 000000000000..398815639fb8
--- /dev/null
+++ b/include/asm-mips/sn/sn0/addrs.h
@@ -0,0 +1,364 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/SN0/addrs.h>, revision 1.126.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SN_SN0_ADDRS_H
12#define _ASM_SN_SN0_ADDRS_H
13
14#include <linux/config.h>
15
16/*
17 * SN0 (on a T5) Address map
18 *
19 * This file contains a set of definitions and macros which are used
20 * to reference into the major address spaces (CAC, HSPEC, IO, MSPEC,
21 * and UNCAC) used by the SN0 architecture. It also contains addresses
22 * for "major" statically locatable PROM/Kernel data structures, such as
23 * the partition table, the configuration data structure, etc.
24 * We make an implicit assumption that the processor using this file
25 * follows the R10K's provisions for specifying uncached attributes;
26 * should this change, the base registers may very well become processor-
27 * dependent.
28 *
29 * For more information on the address spaces, see the "Local Resources"
30 * chapter of the Hub specification.
31 *
32 * NOTE: This header file is included both by C and by assembler source
33 * files. Please bracket any language-dependent definitions
34 * appropriately.
35 */
36
37/*
38 * Some of the macros here need to be casted to appropriate types when used
39 * from C. They definitely must not be casted from assembly language so we
40 * use some new ANSI preprocessor stuff to paste these on where needed.
41 */
42
43/*
44 * The following couple of definitions will eventually need to be variables,
45 * since the amount of address space assigned to each node depends on
46 * whether the system is running in N-mode (more nodes with less memory)
47 * or M-mode (fewer nodes with more memory). We expect that it will
48 * be a while before we need to make this decision dynamically, though,
49 * so for now we just use defines bracketed by an ifdef.
50 */
51
52#ifdef CONFIG_SGI_SN0_N_MODE
53
54#define NODE_SIZE_BITS 31
55#define BWIN_SIZE_BITS 28
56
57#define NASID_BITS 9
58#define NASID_BITMASK (0x1ffLL)
59#define NASID_SHFT 31
60#define NASID_META_BITS 5
61#define NASID_LOCAL_BITS 4
62
63#define BDDIR_UPPER_MASK (UINT64_CAST 0x7ffff << 10)
64#define BDECC_UPPER_MASK (UINT64_CAST 0x3ffffff << 3)
65
66#else /* !defined(CONFIG_SGI_SN0_N_MODE), assume that M-mode is desired */
67
68#define NODE_SIZE_BITS 32
69#define BWIN_SIZE_BITS 29
70
71#define NASID_BITMASK (0xffLL)
72#define NASID_BITS 8
73#define NASID_SHFT 32
74#define NASID_META_BITS 4
75#define NASID_LOCAL_BITS 4
76
77#define BDDIR_UPPER_MASK (UINT64_CAST 0xfffff << 10)
78#define BDECC_UPPER_MASK (UINT64_CAST 0x7ffffff << 3)
79
80#endif /* !defined(CONFIG_SGI_SN0_N_MODE) */
81
82#define NODE_ADDRSPACE_SIZE (UINT64_CAST 1 << NODE_SIZE_BITS)
83
84#define NASID_MASK (UINT64_CAST NASID_BITMASK << NASID_SHFT)
85#define NASID_GET(_pa) (int) ((UINT64_CAST (_pa) >> \
86 NASID_SHFT) & NASID_BITMASK)
87
88#if !defined(__ASSEMBLY__) && !defined(_STANDALONE)
89
90#define NODE_SWIN_BASE(nasid, widget) \
91 ((widget == 0) ? NODE_BWIN_BASE((nasid), SWIN0_BIGWIN) \
92 : RAW_NODE_SWIN_BASE(nasid, widget))
93#else /* __ASSEMBLY__ || _STANDALONE */
94#define NODE_SWIN_BASE(nasid, widget) \
95 (NODE_IO_BASE(nasid) + (UINT64_CAST (widget) << SWIN_SIZE_BITS))
96#endif /* __ASSEMBLY__ || _STANDALONE */
97
98/*
99 * The following definitions pertain to the IO special address
100 * space. They define the location of the big and little windows
101 * of any given node.
102 */
103
104#define BWIN_INDEX_BITS 3
105#define BWIN_SIZE (UINT64_CAST 1 << BWIN_SIZE_BITS)
106#define BWIN_SIZEMASK (BWIN_SIZE - 1)
107#define BWIN_WIDGET_MASK 0x7
108#define NODE_BWIN_BASE0(nasid) (NODE_IO_BASE(nasid) + BWIN_SIZE)
109#define NODE_BWIN_BASE(nasid, bigwin) (NODE_BWIN_BASE0(nasid) + \
110 (UINT64_CAST (bigwin) << BWIN_SIZE_BITS))
111
112#define BWIN_WIDGETADDR(addr) ((addr) & BWIN_SIZEMASK)
113#define BWIN_WINDOWNUM(addr) (((addr) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK)
114/*
115 * Verify if addr belongs to large window address of node with "nasid"
116 *
117 *
118 * NOTE: "addr" is expected to be XKPHYS address, and NOT physical
119 * address
120 *
121 *
122 */
123
124#define NODE_BWIN_ADDR(nasid, addr) \
125 (((addr) >= NODE_BWIN_BASE0(nasid)) && \
126 ((addr) < (NODE_BWIN_BASE(nasid, HUB_NUM_BIG_WINDOW) + \
127 BWIN_SIZE)))
128
129/*
130 * The following define the major position-independent aliases used
131 * in SN0.
132 * CALIAS -- Varies in size, points to the first n bytes of memory
133 * on the reader's node.
134 */
135
136#define CALIAS_BASE CAC_BASE
137
138
139
140#define BRIDGE_REG_PTR(_base, _off) ((volatile bridgereg_t *) \
141 ((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
142
143#define SN0_WIDGET_BASE(_nasid, _wid) (NODE_SWIN_BASE((_nasid), (_wid)))
144
145/* Turn on sable logging for the processors whose bits are set. */
146#ifdef SABLE
147#define SABLE_LOG_TRIGGER(_map) \
148 *((volatile hubreg_t *)(IO_BASE + 0x17ffff0)) = (_map)
149#else
150#define SABLE_LOG_TRIGGER(_map)
151#endif /* SABLE */
152
153#ifndef __ASSEMBLY__
154#define KERN_NMI_ADDR(nasid, slice) \
155 TO_NODE_UNCAC((nasid), IP27_NMI_KREGS_OFFSET + \
156 (IP27_NMI_KREGS_CPU_SIZE * (slice)))
157#endif /* !__ASSEMBLY__ */
158
159#ifdef PROM
160
161#define MISC_PROM_BASE PHYS_TO_K0(0x01300000)
162#define MISC_PROM_SIZE 0x200000
163
164#define DIAG_BASE PHYS_TO_K0(0x01500000)
165#define DIAG_SIZE 0x300000
166
167#define ROUTE_BASE PHYS_TO_K0(0x01800000)
168#define ROUTE_SIZE 0x200000
169
170#define IP27PROM_FLASH_HDR PHYS_TO_K0(0x01300000)
171#define IP27PROM_FLASH_DATA PHYS_TO_K0(0x01301000)
172#define IP27PROM_CORP_MAX 32
173#define IP27PROM_CORP PHYS_TO_K0(0x01800000)
174#define IP27PROM_CORP_SIZE 0x10000
175#define IP27PROM_CORP_STK PHYS_TO_K0(0x01810000)
176#define IP27PROM_CORP_STKSIZE 0x2000
177#define IP27PROM_DECOMP_BUF PHYS_TO_K0(0x01900000)
178#define IP27PROM_DECOMP_SIZE 0xfff00
179
180#define IP27PROM_BASE PHYS_TO_K0(0x01a00000)
181#define IP27PROM_BASE_MAPPED (UNCAC_BASE | 0x1fc00000)
182#define IP27PROM_SIZE_MAX 0x100000
183
184#define IP27PROM_PCFG PHYS_TO_K0(0x01b00000)
185#define IP27PROM_PCFG_SIZE 0xd0000
186#define IP27PROM_ERRDMP PHYS_TO_K1(0x01bd0000)
187#define IP27PROM_ERRDMP_SIZE 0xf000
188
189#define IP27PROM_INIT_START PHYS_TO_K1(0x01bd0000)
190#define IP27PROM_CONSOLE PHYS_TO_K1(0x01bdf000)
191#define IP27PROM_CONSOLE_SIZE 0x200
192#define IP27PROM_NETUART PHYS_TO_K1(0x01bdf200)
193#define IP27PROM_NETUART_SIZE 0x100
194#define IP27PROM_UNUSED1 PHYS_TO_K1(0x01bdf300)
195#define IP27PROM_UNUSED1_SIZE 0x500
196#define IP27PROM_ELSC_BASE_A PHYS_TO_K0(0x01bdf800)
197#define IP27PROM_ELSC_BASE_B PHYS_TO_K0(0x01bdfc00)
198#define IP27PROM_STACK_A PHYS_TO_K0(0x01be0000)
199#define IP27PROM_STACK_B PHYS_TO_K0(0x01bf0000)
200#define IP27PROM_STACK_SHFT 16
201#define IP27PROM_STACK_SIZE (1 << IP27PROM_STACK_SHFT)
202#define IP27PROM_INIT_END PHYS_TO_K0(0x01c00000)
203
204#define SLAVESTACK_BASE PHYS_TO_K0(0x01580000)
205#define SLAVESTACK_SIZE 0x40000
206
207#define ENETBUFS_BASE PHYS_TO_K0(0x01f80000)
208#define ENETBUFS_SIZE 0x20000
209
210#define IO6PROM_BASE PHYS_TO_K0(0x01c00000)
211#define IO6PROM_SIZE 0x400000
212#define IO6PROM_BASE_MAPPED (UNCAC_BASE | 0x11c00000)
213#define IO6DPROM_BASE PHYS_TO_K0(0x01c00000)
214#define IO6DPROM_SIZE 0x200000
215
216#define NODEBUGUNIX_ADDR PHYS_TO_K0(0x00019000)
217#define DEBUGUNIX_ADDR PHYS_TO_K0(0x00100000)
218
219#define IP27PROM_INT_LAUNCH 10 /* and 11 */
220#define IP27PROM_INT_NETUART 12 /* through 17 */
221
222#endif /* PROM */
223
224/*
225 * needed by symmon so it needs to be outside #if PROM
226 */
227#define IP27PROM_ELSC_SHFT 10
228#define IP27PROM_ELSC_SIZE (1 << IP27PROM_ELSC_SHFT)
229
230/*
231 * This address is used by IO6PROM to build MemoryDescriptors of
232 * free memory. This address is important since unix gets loaded
233 * at this address, and this memory has to be FREE if unix is to
234 * be loaded.
235 */
236
237#define FREEMEM_BASE PHYS_TO_K0(0x2000000)
238
239#define IO6PROM_STACK_SHFT 14 /* stack per cpu */
240#define IO6PROM_STACK_SIZE (1 << IO6PROM_STACK_SHFT)
241
242/*
243 * IP27 PROM vectors
244 */
245
246#define IP27PROM_ENTRY PHYS_TO_COMPATK1(0x1fc00000)
247#define IP27PROM_RESTART PHYS_TO_COMPATK1(0x1fc00008)
248#define IP27PROM_SLAVELOOP PHYS_TO_COMPATK1(0x1fc00010)
249#define IP27PROM_PODMODE PHYS_TO_COMPATK1(0x1fc00018)
250#define IP27PROM_IOC3UARTPOD PHYS_TO_COMPATK1(0x1fc00020)
251#define IP27PROM_FLASHLEDS PHYS_TO_COMPATK1(0x1fc00028)
252#define IP27PROM_REPOD PHYS_TO_COMPATK1(0x1fc00030)
253#define IP27PROM_LAUNCHSLAVE PHYS_TO_COMPATK1(0x1fc00038)
254#define IP27PROM_WAITSLAVE PHYS_TO_COMPATK1(0x1fc00040)
255#define IP27PROM_POLLSLAVE PHYS_TO_COMPATK1(0x1fc00048)
256
257#define KL_UART_BASE LOCAL_HUB_ADDR(MD_UREG0_0) /* base of UART regs */
258#define KL_UART_CMD LOCAL_HUB_ADDR(MD_UREG0_0) /* UART command reg */
259#define KL_UART_DATA LOCAL_HUB_ADDR(MD_UREG0_1) /* UART data reg */
260#define KL_I2C_REG MD_UREG0_0 /* I2C reg */
261
262#ifndef __ASSEMBLY__
263
264/* Address 0x400 to 0x1000 ualias points to cache error eframe + misc
265 * CACHE_ERR_SP_PTR could either contain an address to the stack, or
266 * the stack could start at CACHE_ERR_SP_PTR
267 */
268#if defined (HUB_ERR_STS_WAR)
269#define CACHE_ERR_EFRAME 0x480
270#else /* HUB_ERR_STS_WAR */
271#define CACHE_ERR_EFRAME 0x400
272#endif /* HUB_ERR_STS_WAR */
273
274#define CACHE_ERR_ECCFRAME (CACHE_ERR_EFRAME + EF_SIZE)
275#define CACHE_ERR_SP_PTR (0x1000 - 32) /* why -32? TBD */
276#define CACHE_ERR_IBASE_PTR (0x1000 - 40)
277#define CACHE_ERR_SP (CACHE_ERR_SP_PTR - 16)
278#define CACHE_ERR_AREA_SIZE (ARCS_SPB_OFFSET - CACHE_ERR_EFRAME)
279
280#endif /* !__ASSEMBLY__ */
281
282#define _ARCSPROM
283
284#ifdef _STANDALONE
285
286/*
287 * The PROM needs to pass the device base address and the
288 * device pci cfg space address to the device drivers during
289 * install. The COMPONENT->Key field is used for this purpose.
290 * Macros needed by SN0 device drivers to convert the
291 * COMPONENT->Key field to the respective base address.
292 * Key field looks as follows:
293 *
294 * +----------------------------------------------------+
295 * |devnasid | widget |pciid |hubwidid|hstnasid | adap |
296 * | 2 | 1 | 1 | 1 | 2 | 1 |
297 * +----------------------------------------------------+
298 * | | | | | | |
299 * 64 48 40 32 24 8 0
300 *
301 * These are used by standalone drivers till the io infrastructure
302 * is in place.
303 */
304
305#ifndef __ASSEMBLY__
306
307#define uchar unsigned char
308
309#define KEY_DEVNASID_SHFT 48
310#define KEY_WIDID_SHFT 40
311#define KEY_PCIID_SHFT 32
312#define KEY_HUBWID_SHFT 24
313#define KEY_HSTNASID_SHFT 8
314
315#define MK_SN0_KEY(nasid, widid, pciid) \
316 ((((__psunsigned_t)nasid)<< KEY_DEVNASID_SHFT |\
317 ((__psunsigned_t)widid) << KEY_WIDID_SHFT) |\
318 ((__psunsigned_t)pciid) << KEY_PCIID_SHFT)
319
320#define ADD_HUBWID_KEY(key,hubwid)\
321 (key|=((__psunsigned_t)hubwid << KEY_HUBWID_SHFT))
322
323#define ADD_HSTNASID_KEY(key,hstnasid)\
324 (key|=((__psunsigned_t)hstnasid << KEY_HSTNASID_SHFT))
325
326#define GET_DEVNASID_FROM_KEY(key) ((short)(key >> KEY_DEVNASID_SHFT))
327#define GET_WIDID_FROM_KEY(key) ((uchar)(key >> KEY_WIDID_SHFT))
328#define GET_PCIID_FROM_KEY(key) ((uchar)(key >> KEY_PCIID_SHFT))
329#define GET_HUBWID_FROM_KEY(key) ((uchar)(key >> KEY_HUBWID_SHFT))
330#define GET_HSTNASID_FROM_KEY(key) ((short)(key >> KEY_HSTNASID_SHFT))
331
332#define PCI_64_TARGID_SHFT 60
333
334#define GET_PCIBASE_FROM_KEY(key) (NODE_SWIN_BASE(GET_DEVNASID_FROM_KEY(key),\
335 GET_WIDID_FROM_KEY(key))\
336 | BRIDGE_DEVIO(GET_PCIID_FROM_KEY(key)))
337
338#define GET_PCICFGBASE_FROM_KEY(key) \
339 (NODE_SWIN_BASE(GET_DEVNASID_FROM_KEY(key),\
340 GET_WIDID_FROM_KEY(key))\
341 | BRIDGE_TYPE0_CFG_DEV(GET_PCIID_FROM_KEY(key)))
342
343#define GET_WIDBASE_FROM_KEY(key) \
344 (NODE_SWIN_BASE(GET_DEVNASID_FROM_KEY(key),\
345 GET_WIDID_FROM_KEY(key)))
346
347#define PUT_INSTALL_STATUS(c,s) c->Revision = s
348#define GET_INSTALL_STATUS(c) c->Revision
349
350#endif /* !__ASSEMBLY__ */
351
352#endif /* _STANDALONE */
353
354#if defined (HUB_ERR_STS_WAR)
355
356#define ERR_STS_WAR_REGISTER IIO_IIBUSERR
357#define ERR_STS_WAR_ADDR LOCAL_HUB_ADDR(IIO_IIBUSERR)
358#define ERR_STS_WAR_PHYSADDR TO_PHYS((__psunsigned_t)ERR_STS_WAR_ADDR)
359 /* Used to match addr in error reg. */
360#define OLD_ERR_STS_WAR_OFFSET ((MD_MEM_BANKS * MD_BANK_SIZE) - 0x100)
361
362#endif /* HUB_ERR_STS_WAR */
363
364#endif /* _ASM_SN_SN0_ADDRS_H */
diff --git a/include/asm-mips/sn/sn0/arch.h b/include/asm-mips/sn/sn0/arch.h
new file mode 100644
index 000000000000..0e00dd474afc
--- /dev/null
+++ b/include/asm-mips/sn/sn0/arch.h
@@ -0,0 +1,89 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI IP27 specific setup.
7 *
8 * Copyright (C) 1995 - 1997, 1999 Silcon Graphics, Inc.
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SN_SN0_ARCH_H
12#define _ASM_SN_SN0_ARCH_H
13
14#include <linux/config.h>
15
16#ifndef SABLE
17
18#ifndef SN0XXL /* 128 cpu SMP max */
19/*
20 * This is the maximum number of nodes that can be part of a kernel.
21 * Effectively, it's the maximum number of compact node ids (cnodeid_t).
22 */
23#define MAX_COMPACT_NODES 64
24
25/*
26 * MAXCPUS refers to the maximum number of CPUs in a single kernel.
27 * This is not necessarily the same as MAXNODES * CPUS_PER_NODE
28 */
29#define MAXCPUS 128
30
31#else /* SN0XXL system */
32
33#define MAX_COMPACT_NODES 128
34#define MAXCPUS 256
35
36#endif /* SN0XXL */
37
38/*
39 * This is the maximum number of NASIDS that can be present in a system.
40 * (Highest NASID plus one.)
41 */
42#define MAX_NASIDS 256
43
44/*
45 * MAX_REGIONS refers to the maximum number of hardware partitioned regions.
46 */
47#define MAX_REGIONS 64
48#define MAX_NONPREMIUM_REGIONS 16
49#define MAX_PREMIUM_REGIONS MAX_REGIONS
50
51/*
52 * MAX_PARITIONS refers to the maximum number of logically defined
53 * partitions the system can support.
54 */
55#define MAX_PARTITIONS MAX_REGIONS
56
57
58#else
59
60#define MAX_COMPACT_NODES 4
61#define MAX_NASIDS 4
62#define MAXCPUS 8
63
64#endif
65
66#define NASID_MASK_BYTES ((MAX_NASIDS + 7) / 8)
67
68/*
69 * Slot constants for SN0
70 */
71#ifdef CONFIG_SGI_SN0_N_MODE
72#define MAX_MEM_SLOTS 16 /* max slots per node */
73#else /* !CONFIG_SGI_SN0_N_MODE, assume M_MODE */
74#define MAX_MEM_SLOTS 32 /* max slots per node */
75#endif /* defined(N_MODE) */
76
77#if SABLE_RTL
78#define SLOT_SHIFT (28)
79#define SLOT_MIN_MEM_SIZE (16*1024*1024)
80#else
81#define SLOT_SHIFT (27)
82#define SLOT_MIN_MEM_SIZE (32*1024*1024)
83#endif
84
85#define CPUS_PER_NODE 2 /* CPUs on a single hub */
86#define CPUS_PER_NODE_SHFT 1 /* Bits to shift in the node number */
87#define CPUS_PER_SUBNODE 2 /* CPUs on a single hub PI */
88
89#endif /* _ASM_SN_SN0_ARCH_H */
diff --git a/include/asm-mips/sn/sn0/hub.h b/include/asm-mips/sn/sn0/hub.h
new file mode 100644
index 000000000000..f5dbba6f4610
--- /dev/null
+++ b/include/asm-mips/sn/sn0/hub.h
@@ -0,0 +1,44 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
7 * Copyright (C) 1999 by Ralf Baechle
8 */
9#ifndef _ASM_SN_SN0_HUB_H
10#define _ASM_SN_SN0_HUB_H
11
12/* The secret password; used to release protection */
13#define HUB_PASSWORD 0x53474972756c6573ull
14
15#define CHIPID_HUB 0
16#define CHIPID_ROUTER 1
17
18#define HUB_REV_1_0 1
19#define HUB_REV_2_0 2
20#define HUB_REV_2_1 3
21#define HUB_REV_2_2 4
22#define HUB_REV_2_3 5
23#define HUB_REV_2_4 6
24
25#define MAX_HUB_PATH 80
26
27#include <asm/sn/sn0/addrs.h>
28#include <asm/sn/sn0/hubpi.h>
29#include <asm/sn/sn0/hubmd.h>
30#include <asm/sn/sn0/hubio.h>
31#include <asm/sn/sn0/hubni.h>
32//#include <asm/sn/sn0/hubcore.h>
33
34#ifdef SABLE
35#define IP27_NO_HUBUART_INT 1
36#endif
37
38/* Translation of uncached attributes */
39#define UATTR_HSPEC 0
40#define UATTR_IO 1
41#define UATTR_MSPEC 2
42#define UATTR_UNCAC 3
43
44#endif /* _ASM_SN_SN0_HUB_H */
diff --git a/include/asm-mips/sn/sn0/hubio.h b/include/asm-mips/sn/sn0/hubio.h
new file mode 100644
index 000000000000..80cf6a52ed3b
--- /dev/null
+++ b/include/asm-mips/sn/sn0/hubio.h
@@ -0,0 +1,988 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/SN0/hubio.h>, Revision 1.80.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SGI_SN_SN0_HUBIO_H
12#define _ASM_SGI_SN_SN0_HUBIO_H
13
14/*
15 * Hub I/O interface registers
16 *
17 * All registers in this file are subject to change until Hub chip tapeout.
18 * In general, the longer software name should be used when available.
19 */
20
21/*
22 * Slightly friendlier names for some common registers.
23 * The hardware definitions follow.
24 */
25#define IIO_WIDGET IIO_WID /* Widget identification */
26#define IIO_WIDGET_STAT IIO_WSTAT /* Widget status register */
27#define IIO_WIDGET_CTRL IIO_WCR /* Widget control register */
28#define IIO_WIDGET_TOUT IIO_WRTO /* Widget request timeout */
29#define IIO_WIDGET_FLUSH IIO_WTFR /* Widget target flush */
30#define IIO_PROTECT IIO_ILAPR /* IO interface protection */
31#define IIO_PROTECT_OVRRD IIO_ILAPO /* IO protect override */
32#define IIO_OUTWIDGET_ACCESS IIO_IOWA /* Outbound widget access */
33#define IIO_INWIDGET_ACCESS IIO_IIWA /* Inbound widget access */
34#define IIO_INDEV_ERR_MASK IIO_IIDEM /* Inbound device error mask */
35#define IIO_LLP_CSR IIO_ILCSR /* LLP control and status */
36#define IIO_LLP_LOG IIO_ILLR /* LLP log */
37#define IIO_XTALKCC_TOUT IIO_IXCC /* Xtalk credit count timeout*/
38#define IIO_XTALKTT_TOUT IIO_IXTT /* Xtalk tail timeout */
39#define IIO_IO_ERR_CLR IIO_IECLR /* IO error clear */
40#define IIO_BTE_CRB_CNT IIO_IBCN /* IO BTE CRB count */
41
42#define IIO_LLP_CSR_IS_UP 0x00002000
43#define IIO_LLP_CSR_LLP_STAT_MASK 0x00003000
44#define IIO_LLP_CSR_LLP_STAT_SHFT 12
45
46/* key to IIO_PROTECT_OVRRD */
47#define IIO_PROTECT_OVRRD_KEY 0x53474972756c6573ull /* "SGIrules" */
48
49/* BTE register names */
50#define IIO_BTE_STAT_0 IIO_IBLS_0 /* Also BTE length/status 0 */
51#define IIO_BTE_SRC_0 IIO_IBSA_0 /* Also BTE source address 0 */
52#define IIO_BTE_DEST_0 IIO_IBDA_0 /* Also BTE dest. address 0 */
53#define IIO_BTE_CTRL_0 IIO_IBCT_0 /* Also BTE control/terminate 0 */
54#define IIO_BTE_NOTIFY_0 IIO_IBNA_0 /* Also BTE notification 0 */
55#define IIO_BTE_INT_0 IIO_IBIA_0 /* Also BTE interrupt 0 */
56#define IIO_BTE_OFF_0 0 /* Base offset from BTE 0 regs. */
57#define IIO_BTE_OFF_1 IIO_IBLS_1 - IIO_IBLS_0 /* Offset from base to BTE 1 */
58
59/* BTE register offsets from base */
60#define BTEOFF_STAT 0
61#define BTEOFF_SRC (IIO_BTE_SRC_0 - IIO_BTE_STAT_0)
62#define BTEOFF_DEST (IIO_BTE_DEST_0 - IIO_BTE_STAT_0)
63#define BTEOFF_CTRL (IIO_BTE_CTRL_0 - IIO_BTE_STAT_0)
64#define BTEOFF_NOTIFY (IIO_BTE_NOTIFY_0 - IIO_BTE_STAT_0)
65#define BTEOFF_INT (IIO_BTE_INT_0 - IIO_BTE_STAT_0)
66
67
68/*
69 * The following definitions use the names defined in the IO interface
70 * document for ease of reference. When possible, software should
71 * generally use the longer but clearer names defined above.
72 */
73
74#define IIO_BASE 0x400000
75#define IIO_BASE_BTE0 0x410000
76#define IIO_BASE_BTE1 0x420000
77#define IIO_BASE_PERF 0x430000
78#define IIO_PERF_CNT 0x430008
79
80#define IO_PERF_SETS 32
81
82#define IIO_WID 0x400000 /* Widget identification */
83#define IIO_WSTAT 0x400008 /* Widget status */
84#define IIO_WCR 0x400020 /* Widget control */
85
86#define IIO_WSTAT_ECRAZY (1ULL << 32) /* Hub gone crazy */
87#define IIO_WSTAT_TXRETRY (1ULL << 9) /* Hub Tx Retry timeout */
88#define IIO_WSTAT_TXRETRY_MASK (0x7F)
89#define IIO_WSTAT_TXRETRY_SHFT (16)
90#define IIO_WSTAT_TXRETRY_CNT(w) (((w) >> IIO_WSTAT_TXRETRY_SHFT) & \
91 IIO_WSTAT_TXRETRY_MASK)
92
93#define IIO_ILAPR 0x400100 /* Local Access Protection */
94#define IIO_ILAPO 0x400108 /* Protection override */
95#define IIO_IOWA 0x400110 /* outbound widget access */
96#define IIO_IIWA 0x400118 /* inbound widget access */
97#define IIO_IIDEM 0x400120 /* Inbound Device Error Mask */
98#define IIO_ILCSR 0x400128 /* LLP control and status */
99#define IIO_ILLR 0x400130 /* LLP Log */
100#define IIO_IIDSR 0x400138 /* Interrupt destination */
101
102#define IIO_IIBUSERR 0x1400208 /* Reads here cause a bus error. */
103
104/* IO Interrupt Destination Register */
105#define IIO_IIDSR_SENT_SHIFT 28
106#define IIO_IIDSR_SENT_MASK 0x10000000
107#define IIO_IIDSR_ENB_SHIFT 24
108#define IIO_IIDSR_ENB_MASK 0x01000000
109#define IIO_IIDSR_NODE_SHIFT 8
110#define IIO_IIDSR_NODE_MASK 0x0000ff00
111#define IIO_IIDSR_LVL_SHIFT 0
112#define IIO_IIDSR_LVL_MASK 0x0000003f
113
114
115/* GFX Flow Control Node/Widget Register */
116#define IIO_IGFX_0 0x400140 /* gfx node/widget register 0 */
117#define IIO_IGFX_1 0x400148 /* gfx node/widget register 1 */
118#define IIO_IGFX_W_NUM_BITS 4 /* size of widget num field */
119#define IIO_IGFX_W_NUM_MASK ((1<<IIO_IGFX_W_NUM_BITS)-1)
120#define IIO_IGFX_W_NUM_SHIFT 0
121#define IIO_IGFX_N_NUM_BITS 9 /* size of node num field */
122#define IIO_IGFX_N_NUM_MASK ((1<<IIO_IGFX_N_NUM_BITS)-1)
123#define IIO_IGFX_N_NUM_SHIFT 4
124#define IIO_IGFX_P_NUM_BITS 1 /* size of processor num field */
125#define IIO_IGFX_P_NUM_MASK ((1<<IIO_IGFX_P_NUM_BITS)-1)
126#define IIO_IGFX_P_NUM_SHIFT 16
127#define IIO_IGFX_VLD_BITS 1 /* size of valid field */
128#define IIO_IGFX_VLD_MASK ((1<<IIO_IGFX_VLD_BITS)-1)
129#define IIO_IGFX_VLD_SHIFT 20
130#define IIO_IGFX_INIT(widget, node, cpu, valid) (\
131 (((widget) & IIO_IGFX_W_NUM_MASK) << IIO_IGFX_W_NUM_SHIFT) | \
132 (((node) & IIO_IGFX_N_NUM_MASK) << IIO_IGFX_N_NUM_SHIFT) | \
133 (((cpu) & IIO_IGFX_P_NUM_MASK) << IIO_IGFX_P_NUM_SHIFT) | \
134 (((valid) & IIO_IGFX_VLD_MASK) << IIO_IGFX_VLD_SHIFT) )
135
136/* Scratch registers (not all bits available) */
137#define IIO_SCRATCH_REG0 0x400150
138#define IIO_SCRATCH_REG1 0x400158
139#define IIO_SCRATCH_MASK 0x0000000f00f11fff
140
141#define IIO_SCRATCH_BIT0_0 0x0000000800000000
142#define IIO_SCRATCH_BIT0_1 0x0000000400000000
143#define IIO_SCRATCH_BIT0_2 0x0000000200000000
144#define IIO_SCRATCH_BIT0_3 0x0000000100000000
145#define IIO_SCRATCH_BIT0_4 0x0000000000800000
146#define IIO_SCRATCH_BIT0_5 0x0000000000400000
147#define IIO_SCRATCH_BIT0_6 0x0000000000200000
148#define IIO_SCRATCH_BIT0_7 0x0000000000100000
149#define IIO_SCRATCH_BIT0_8 0x0000000000010000
150#define IIO_SCRATCH_BIT0_9 0x0000000000001000
151#define IIO_SCRATCH_BIT0_R 0x0000000000000fff
152
153/* IO Translation Table Entries */
154#define IIO_NUM_ITTES 7 /* ITTEs numbered 0..6 */
155 /* Hw manuals number them 1..7! */
156
157/*
158 * As a permanent workaround for a bug in the PI side of the hub, we've
159 * redefined big window 7 as small window 0.
160 */
161#define HUB_NUM_BIG_WINDOW IIO_NUM_ITTES - 1
162
163/*
164 * Use the top big window as a surrogate for the first small window
165 */
166#define SWIN0_BIGWIN HUB_NUM_BIG_WINDOW
167
168#define ILCSR_WARM_RESET 0x100
169/*
170 * The IO LLP control status register and widget control register
171 */
172#ifndef __ASSEMBLY__
173
174typedef union hubii_wid_u {
175 u64 wid_reg_value;
176 struct {
177 u64 wid_rsvd: 32, /* unused */
178 wid_rev_num: 4, /* revision number */
179 wid_part_num: 16, /* the widget type: hub=c101 */
180 wid_mfg_num: 11, /* Manufacturer id (IBM) */
181 wid_rsvd1: 1; /* Reserved */
182 } wid_fields_s;
183} hubii_wid_t;
184
185
186typedef union hubii_wcr_u {
187 u64 wcr_reg_value;
188 struct {
189 u64 wcr_rsvd: 41, /* unused */
190 wcr_e_thresh: 5, /* elasticity threshold */
191 wcr_dir_con: 1, /* widget direct connect */
192 wcr_f_bad_pkt: 1, /* Force bad llp pkt enable */
193 wcr_xbar_crd: 3, /* LLP crossbar credit */
194 wcr_rsvd1: 8, /* Reserved */
195 wcr_tag_mode: 1, /* Tag mode */
196 wcr_widget_id: 4; /* LLP crossbar credit */
197 } wcr_fields_s;
198} hubii_wcr_t;
199
200#define iwcr_dir_con wcr_fields_s.wcr_dir_con
201
202typedef union hubii_wstat_u {
203 u64 reg_value;
204 struct {
205 u64 rsvd1: 31,
206 crazy: 1, /* Crazy bit */
207 rsvd2: 8,
208 llp_tx_cnt: 8, /* LLP Xmit retry counter */
209 rsvd3: 6,
210 tx_max_rtry: 1, /* LLP Retry Timeout Signal */
211 rsvd4: 2,
212 xt_tail_to: 1, /* Xtalk Tail Timeout */
213 xt_crd_to: 1, /* Xtalk Credit Timeout */
214 pending: 4; /* Pending Requests */
215 } wstat_fields_s;
216} hubii_wstat_t;
217
218
219typedef union hubii_ilcsr_u {
220 u64 icsr_reg_value;
221 struct {
222 u64 icsr_rsvd: 22, /* unused */
223 icsr_max_burst: 10, /* max burst */
224 icsr_rsvd4: 6, /* reserved */
225 icsr_max_retry: 10, /* max retry */
226 icsr_rsvd3: 2, /* reserved */
227 icsr_lnk_stat: 2, /* link status */
228 icsr_bm8: 1, /* Bit mode 8 */
229 icsr_llp_en: 1, /* LLP enable bit */
230 icsr_rsvd2: 1, /* reserver */
231 icsr_wrm_reset: 1, /* Warm reset bit */
232 icsr_rsvd1: 2, /* Data ready offset */
233 icsr_null_to: 6; /* Null timeout */
234
235 } icsr_fields_s;
236} hubii_ilcsr_t;
237
238
239typedef union hubii_iowa_u {
240 u64 iowa_reg_value;
241 struct {
242 u64 iowa_rsvd: 48, /* unused */
243 iowa_wxoac: 8, /* xtalk widget access bits */
244 iowa_rsvd1: 7, /* xtalk widget access bits */
245 iowa_w0oac: 1; /* xtalk widget access bits */
246 } iowa_fields_s;
247} hubii_iowa_t;
248
249typedef union hubii_iiwa_u {
250 u64 iiwa_reg_value;
251 struct {
252 u64 iiwa_rsvd: 48, /* unused */
253 iiwa_wxiac: 8, /* hub wid access bits */
254 iiwa_rsvd1: 7, /* reserved */
255 iiwa_w0iac: 1; /* hub wid0 access */
256 } iiwa_fields_s;
257} hubii_iiwa_t;
258
259typedef union hubii_illr_u {
260 u64 illr_reg_value;
261 struct {
262 u64 illr_rsvd: 32, /* unused */
263 illr_cb_cnt: 16, /* checkbit error count */
264 illr_sn_cnt: 16; /* sequence number count */
265 } illr_fields_s;
266} hubii_illr_t;
267
268/* The structures below are defined to extract and modify the ii
269performance registers */
270
271/* io_perf_sel allows the caller to specify what tests will be
272 performed */
273typedef union io_perf_sel {
274 u64 perf_sel_reg;
275 struct {
276 u64 perf_rsvd : 48,
277 perf_icct : 8,
278 perf_ippr1 : 4,
279 perf_ippr0 : 4;
280 } perf_sel_bits;
281} io_perf_sel_t;
282
283/* io_perf_cnt is to extract the count from the hub registers. Due to
284 hardware problems there is only one counter, not two. */
285
286typedef union io_perf_cnt {
287 u64 perf_cnt;
288 struct {
289 u64 perf_rsvd1 : 32,
290 perf_rsvd2 : 12,
291 perf_cnt : 20;
292 } perf_cnt_bits;
293} io_perf_cnt_t;
294
295#endif /* !__ASSEMBLY__ */
296
297
298#define LNK_STAT_WORKING 0x2
299
300#define IIO_LLP_CB_MAX 0xffff
301#define IIO_LLP_SN_MAX 0xffff
302
303/* IO PRB Entries */
304#define IIO_NUM_IPRBS (9)
305#define IIO_IOPRB_0 0x400198 /* PRB entry 0 */
306#define IIO_IOPRB_8 0x4001a0 /* PRB entry 8 */
307#define IIO_IOPRB_9 0x4001a8 /* PRB entry 9 */
308#define IIO_IOPRB_A 0x4001b0 /* PRB entry a */
309#define IIO_IOPRB_B 0x4001b8 /* PRB entry b */
310#define IIO_IOPRB_C 0x4001c0 /* PRB entry c */
311#define IIO_IOPRB_D 0x4001c8 /* PRB entry d */
312#define IIO_IOPRB_E 0x4001d0 /* PRB entry e */
313#define IIO_IOPRB_F 0x4001d8 /* PRB entry f */
314
315
316#define IIO_IXCC 0x4001e0 /* Crosstalk credit count timeout */
317#define IIO_IXTCC IIO_IXCC
318#define IIO_IMEM 0x4001e8 /* Miscellaneous Enable Mask */
319#define IIO_IXTT 0x4001f0 /* Crosstalk tail timeout */
320#define IIO_IECLR 0x4001f8 /* IO error clear */
321#define IIO_IBCN 0x400200 /* IO BTE CRB count */
322
323/*
324 * IIO_IMEM Register fields.
325 */
326#define IIO_IMEM_W0ESD 0x1 /* Widget 0 shut down due to error */
327#define IIO_IMEM_B0ESD (1 << 4) /* BTE 0 shut down due to error */
328#define IIO_IMEM_B1ESD (1 << 8) /* BTE 1 Shut down due to error */
329
330/* PIO Read address Table Entries */
331#define IIO_IPCA 0x400300 /* PRB Counter adjust */
332#define IIO_NUM_PRTES 8 /* Total number of PRB table entries */
333#define IIO_PRTE_0 0x400308 /* PIO Read address table entry 0 */
334#define IIO_PRTE(_x) (IIO_PRTE_0 + (8 * (_x)))
335#define IIO_WIDPRTE(x) IIO_PRTE(((x) - 8)) /* widget ID to its PRTE num */
336#define IIO_IPDR 0x400388 /* PIO table entry deallocation */
337#define IIO_ICDR 0x400390 /* CRB Entry Deallocation */
338#define IIO_IFDR 0x400398 /* IOQ FIFO Depth */
339#define IIO_IIAP 0x4003a0 /* IIQ Arbitration Parameters */
340#define IIO_IMMR IIO_IIAP
341#define IIO_ICMR 0x4003a8 /* CRB Managment Register */
342#define IIO_ICCR 0x4003b0 /* CRB Control Register */
343#define IIO_ICTO 0x4003b8 /* CRB Time Out Register */
344#define IIO_ICTP 0x4003c0 /* CRB Time Out Prescalar */
345
346
347/*
348 * ICMR register fields
349 */
350#define IIO_ICMR_PC_VLD_SHFT 36
351#define IIO_ICMR_PC_VLD_MASK (0x7fffUL << IIO_ICMR_PC_VLD_SHFT)
352
353#define IIO_ICMR_CRB_VLD_SHFT 20
354#define IIO_ICMR_CRB_VLD_MASK (0x7fffUL << IIO_ICMR_CRB_VLD_SHFT)
355
356#define IIO_ICMR_FC_CNT_SHFT 16
357#define IIO_ICMR_FC_CNT_MASK (0xf << IIO_ICMR_FC_CNT_SHFT)
358
359#define IIO_ICMR_C_CNT_SHFT 4
360#define IIO_ICMR_C_CNT_MASK (0xf << IIO_ICMR_C_CNT_SHFT)
361
362#define IIO_ICMR_P_CNT_SHFT 0
363#define IIO_ICMR_P_CNT_MASK (0xf << IIO_ICMR_P_CNT_SHFT)
364
365#define IIO_ICMR_PRECISE (1UL << 52)
366#define IIO_ICMR_CLR_RPPD (1UL << 13)
367#define IIO_ICMR_CLR_RQPD (1UL << 12)
368
369/*
370 * IIO PIO Deallocation register field masks : (IIO_IPDR)
371 */
372#define IIO_IPDR_PND (1 << 4)
373
374/*
375 * IIO CRB deallocation register field masks: (IIO_ICDR)
376 */
377#define IIO_ICDR_PND (1 << 4)
378
379/*
380 * IIO CRB control register Fields: IIO_ICCR
381 */
382#define IIO_ICCR_PENDING (0x10000)
383#define IIO_ICCR_CMD_MASK (0xFF)
384#define IIO_ICCR_CMD_SHFT (7)
385#define IIO_ICCR_CMD_NOP (0x0) /* No Op */
386#define IIO_ICCR_CMD_WAKE (0x100) /* Reactivate CRB entry and process */
387#define IIO_ICCR_CMD_TIMEOUT (0x200) /* Make CRB timeout & mark invalid */
388#define IIO_ICCR_CMD_EJECT (0x400) /* Contents of entry written to memory
389 * via a WB
390 */
391#define IIO_ICCR_CMD_FLUSH (0x800)
392
393/*
394 * CRB manipulation macros
395 * The CRB macros are slightly complicated, since there are up to
396 * four registers associated with each CRB entry.
397 */
398#define IIO_NUM_CRBS 15 /* Number of CRBs */
399#define IIO_NUM_NORMAL_CRBS 12 /* Number of regular CRB entries */
400#define IIO_NUM_PC_CRBS 4 /* Number of partial cache CRBs */
401#define IIO_ICRB_OFFSET 8
402#define IIO_ICRB_0 0x400400
403/* XXX - This is now tuneable:
404 #define IIO_FIRST_PC_ENTRY 12
405 */
406
407#define IIO_ICRB_A(_x) (IIO_ICRB_0 + (4 * IIO_ICRB_OFFSET * (_x)))
408#define IIO_ICRB_B(_x) (IIO_ICRB_A(_x) + 1*IIO_ICRB_OFFSET)
409#define IIO_ICRB_C(_x) (IIO_ICRB_A(_x) + 2*IIO_ICRB_OFFSET)
410#define IIO_ICRB_D(_x) (IIO_ICRB_A(_x) + 3*IIO_ICRB_OFFSET)
411
412/* XXX - IBUE register coming for Hub 2 */
413
414/*
415 *
416 * CRB Register description.
417 *
418 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
419 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
420 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
421 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
422 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
423 *
424 * Many of the fields in CRB are status bits used by hardware
425 * for implementation of the protocol. It's very dangerous to
426 * mess around with the CRB registers.
427 *
428 * It's OK to read the CRB registers and try to make sense out of the
429 * fields in CRB.
430 *
431 * Updating CRB requires all activities in Hub IIO to be quiesced.
432 * otherwise, a write to CRB could corrupt other CRB entries.
433 * CRBs are here only as a back door peek to hub IIO's status.
434 * Quiescing implies no dmas no PIOs
435 * either directly from the cpu or from sn0net.
436 * this is not something that can be done easily. So, AVOID updating
437 * CRBs.
438 */
439
440/*
441 * Fields in CRB Register A
442 */
443#ifndef __ASSEMBLY__
444typedef union icrba_u {
445 u64 reg_value;
446 struct {
447 u64 resvd: 6,
448 stall_bte0: 1, /* Stall BTE 0 */
449 stall_bte1: 1, /* Stall BTE 1 */
450 error: 1, /* CRB has an error */
451 ecode: 3, /* Error Code */
452 lnetuce: 1, /* SN0net Uncorrectable error */
453 mark: 1, /* CRB Has been marked */
454 xerr: 1, /* Error bit set in xtalk header */
455 sidn: 4, /* SIDN field from xtalk */
456 tnum: 5, /* TNUM field in xtalk */
457 addr: 38, /* Address of request */
458 valid: 1, /* Valid status */
459 iow: 1; /* IO Write operation */
460 } icrba_fields_s;
461} icrba_t;
462
463/* This is an alternate typedef for the HUB1 CRB A in order to allow
464 runtime selection of the format based on the REV_ID field of the
465 NI_STATUS_REV_ID register. */
466typedef union h1_icrba_u {
467 u64 reg_value;
468
469 struct {
470 u64 resvd: 6,
471 unused: 1, /* Unused but RW!! */
472 error: 1, /* CRB has an error */
473 ecode: 4, /* Error Code */
474 lnetuce: 1, /* SN0net Uncorrectable error */
475 mark: 1, /* CRB Has been marked */
476 xerr: 1, /* Error bit set in xtalk header */
477 sidn: 4, /* SIDN field from xtalk */
478 tnum: 5, /* TNUM field in xtalk */
479 addr: 38, /* Address of request */
480 valid: 1, /* Valid status */
481 iow: 1; /* IO Write operation */
482 } h1_icrba_fields_s;
483} h1_icrba_t;
484
485/* XXX - Is this still right? Check the spec. */
486#define ICRBN_A_CERR_SHFT 54
487#define ICRBN_A_ERR_MASK 0x3ff
488
489#if 0 /* Disabled, this causes namespace polution and break allmodconfig */
490/*
491 * Easy access macros.
492 */
493#define a_error icrba_fields_s.error
494#define a_ecode icrba_fields_s.ecode
495#define a_lnetuce icrba_fields_s.lnetuce
496#define a_mark icrba_fields_s.mark
497#define a_xerr icrba_fields_s.xerr
498#define a_sidn icrba_fields_s.sidn
499#define a_tnum icrba_fields_s.tnum
500#define a_addr icrba_fields_s.addr
501#define a_valid icrba_fields_s.valid
502#define a_iow icrba_fields_s.iow
503#endif
504
505#endif /* !__ASSEMBLY__ */
506
507#define IIO_ICRB_ADDR_SHFT 2 /* Shift to get proper address */
508
509/*
510 * values for "ecode" field
511 */
512#define IIO_ICRB_ECODE_DERR 0 /* Directory error due to IIO access */
513#define IIO_ICRB_ECODE_PERR 1 /* Poison error on IO access */
514#define IIO_ICRB_ECODE_WERR 2 /* Write error by IIO access
515 * e.g. WINV to a Read only line.
516 */
517#define IIO_ICRB_ECODE_AERR 3 /* Access error caused by IIO access */
518#define IIO_ICRB_ECODE_PWERR 4 /* Error on partial write */
519#define IIO_ICRB_ECODE_PRERR 5 /* Error on partial read */
520#define IIO_ICRB_ECODE_TOUT 6 /* CRB timeout before deallocating */
521#define IIO_ICRB_ECODE_XTERR 7 /* Incoming xtalk pkt had error bit */
522
523
524
525/*
526 * Fields in CRB Register B
527 */
528#ifndef __ASSEMBLY__
529typedef union icrbb_u {
530 u64 reg_value;
531 struct {
532 u64 rsvd1: 5,
533 btenum: 1, /* BTE to which entry belongs to */
534 cohtrans: 1, /* Coherent transaction */
535 xtsize: 2, /* Xtalk operation size
536 * 0: Double Word
537 * 1: 32 Bytes.
538 * 2: 128 Bytes,
539 * 3: Reserved.
540 */
541 srcnode: 9, /* Source Node ID */
542 srcinit: 2, /* Source Initiator:
543 * See below for field values.
544 */
545 useold: 1, /* Use OLD command for processing */
546 imsgtype: 2, /* Incoming message type
547 * see below for field values
548 */
549 imsg: 8, /* Incoming message */
550 initator: 3, /* Initiator of original request
551 * See below for field values.
552 */
553 reqtype: 5, /* Identifies type of request
554 * See below for field values.
555 */
556 rsvd2: 7,
557 ackcnt: 11, /* Invalidate ack count */
558 resp: 1, /* data response given to processor */
559 ack: 1, /* indicates data ack received */
560 hold: 1, /* entry is gathering inval acks */
561 wb_pend:1, /* waiting for writeback to complete */
562 intvn: 1, /* Intervention */
563 stall_ib: 1, /* Stall Ibuf (from crosstalk) */
564 stall_intr: 1; /* Stall internal interrupts */
565 } icrbb_field_s;
566} icrbb_t;
567
568/* This is an alternate typedef for the HUB1 CRB B in order to allow
569 runtime selection of the format based on the REV_ID field of the
570 NI_STATUS_REV_ID register. */
571typedef union h1_icrbb_u {
572 u64 reg_value;
573 struct {
574 u64 rsvd1: 5,
575 btenum: 1, /* BTE to which entry belongs to */
576 cohtrans: 1, /* Coherent transaction */
577 xtsize: 2, /* Xtalk operation size
578 * 0: Double Word
579 * 1: 32 Bytes.
580 * 2: 128 Bytes,
581 * 3: Reserved.
582 */
583 srcnode: 9, /* Source Node ID */
584 srcinit: 2, /* Source Initiator:
585 * See below for field values.
586 */
587 useold: 1, /* Use OLD command for processing */
588 imsgtype: 2, /* Incoming message type
589 * see below for field values
590 */
591 imsg: 8, /* Incoming message */
592 initator: 3, /* Initiator of original request
593 * See below for field values.
594 */
595 rsvd2: 1,
596 pcache: 1, /* entry belongs to partial cache */
597 reqtype: 5, /* Identifies type of request
598 * See below for field values.
599 */
600 stl_ib: 1, /* stall Ibus coming from xtalk */
601 stl_intr: 1, /* Stall internal interrupts */
602 stl_bte0: 1, /* Stall BTE 0 */
603 stl_bte1: 1, /* Stall BTE 1 */
604 intrvn: 1, /* Req was target of intervention */
605 ackcnt: 11, /* Invalidate ack count */
606 resp: 1, /* data response given to processor */
607 ack: 1, /* indicates data ack received */
608 hold: 1, /* entry is gathering inval acks */
609 wb_pend:1, /* waiting for writeback to complete */
610 sleep: 1, /* xtalk req sleeping till IO-sync */
611 pnd_reply: 1, /* replies not issed due to IOQ full */
612 pnd_req: 1; /* reqs not issued due to IOQ full */
613 } h1_icrbb_field_s;
614} h1_icrbb_t;
615
616
617#define b_imsgtype icrbb_field_s.imsgtype
618#define b_btenum icrbb_field_s.btenum
619#define b_cohtrans icrbb_field_s.cohtrans
620#define b_xtsize icrbb_field_s.xtsize
621#define b_srcnode icrbb_field_s.srcnode
622#define b_srcinit icrbb_field_s.srcinit
623#define b_imsgtype icrbb_field_s.imsgtype
624#define b_imsg icrbb_field_s.imsg
625#define b_initiator icrbb_field_s.initiator
626
627#endif /* !__ASSEMBLY__ */
628
629/*
630 * values for field xtsize
631 */
632#define IIO_ICRB_XTSIZE_DW 0 /* Xtalk operation size is 8 bytes */
633#define IIO_ICRB_XTSIZE_32 1 /* Xtalk operation size is 32 bytes */
634#define IIO_ICRB_XTSIZE_128 2 /* Xtalk operation size is 128 bytes */
635
636/*
637 * values for field srcinit
638 */
639#define IIO_ICRB_PROC0 0 /* Source of request is Proc 0 */
640#define IIO_ICRB_PROC1 1 /* Source of request is Proc 1 */
641#define IIO_ICRB_GB_REQ 2 /* Source is Guranteed BW request */
642#define IIO_ICRB_IO_REQ 3 /* Source is Normal IO request */
643
644/*
645 * Values for field imsgtype
646 */
647#define IIO_ICRB_IMSGT_XTALK 0 /* Incoming Meessage from Xtalk */
648#define IIO_ICRB_IMSGT_BTE 1 /* Incoming message from BTE */
649#define IIO_ICRB_IMSGT_SN0NET 2 /* Incoming message from SN0 net */
650#define IIO_ICRB_IMSGT_CRB 3 /* Incoming message from CRB ??? */
651
652/*
653 * values for field initiator.
654 */
655#define IIO_ICRB_INIT_XTALK 0 /* Message originated in xtalk */
656#define IIO_ICRB_INIT_BTE0 0x1 /* Message originated in BTE 0 */
657#define IIO_ICRB_INIT_SN0NET 0x2 /* Message originated in SN0net */
658#define IIO_ICRB_INIT_CRB 0x3 /* Message originated in CRB ? */
659#define IIO_ICRB_INIT_BTE1 0x5 /* MEssage originated in BTE 1 */
660
661/*
662 * Values for field reqtype.
663 */
664/* XXX - Need to fix this for Hub 2 */
665#define IIO_ICRB_REQ_DWRD 0 /* Request type double word */
666#define IIO_ICRB_REQ_QCLRD 1 /* Request is Qrtr Caceh line Rd */
667#define IIO_ICRB_REQ_BLKRD 2 /* Request is block read */
668#define IIO_ICRB_REQ_RSHU 6 /* Request is BTE block read */
669#define IIO_ICRB_REQ_REXU 7 /* request is BTE Excl Read */
670#define IIO_ICRB_REQ_RDEX 8 /* Request is Read Exclusive */
671#define IIO_ICRB_REQ_WINC 9 /* Request is Write Invalidate */
672#define IIO_ICRB_REQ_BWINV 10 /* Request is BTE Winv */
673#define IIO_ICRB_REQ_PIORD 11 /* Request is PIO read */
674#define IIO_ICRB_REQ_PIOWR 12 /* Request is PIO Write */
675#define IIO_ICRB_REQ_PRDM 13 /* Request is Fetch&Op */
676#define IIO_ICRB_REQ_PWRM 14 /* Request is Store &Op */
677#define IIO_ICRB_REQ_PTPWR 15 /* Request is Peer to peer */
678#define IIO_ICRB_REQ_WB 16 /* Request is Write back */
679#define IIO_ICRB_REQ_DEX 17 /* Retained DEX Cache line */
680
681/*
682 * Fields in CRB Register C
683 */
684
685#ifndef __ASSEMBLY__
686
687typedef union icrbc_s {
688 u64 reg_value;
689 struct {
690 u64 rsvd: 6,
691 sleep: 1,
692 pricnt: 4, /* Priority count sent with Read req */
693 pripsc: 4, /* Priority Pre scalar */
694 bteop: 1, /* BTE Operation */
695 push_be: 34, /* Push address Byte enable
696 * Holds push addr, if CRB is for BTE
697 * If CRB belongs to Partial cache,
698 * this contains byte enables bits
699 * ([47:46] = 0)
700 */
701 suppl: 11, /* Supplemental field */
702 barrop: 1, /* Barrier Op bit set in xtalk req */
703 doresp: 1, /* Xtalk req needs a response */
704 gbr: 1; /* GBR bit set in xtalk packet */
705 } icrbc_field_s;
706} icrbc_t;
707
708#define c_pricnt icrbc_field_s.pricnt
709#define c_pripsc icrbc_field_s.pripsc
710#define c_bteop icrbc_field_s.bteop
711#define c_bteaddr icrbc_field_s.push_be /* push_be field has 2 names */
712#define c_benable icrbc_field_s.push_be /* push_be field has 2 names */
713#define c_suppl icrbc_field_s.suppl
714#define c_barrop icrbc_field_s.barrop
715#define c_doresp icrbc_field_s.doresp
716#define c_gbr icrbc_field_s.gbr
717#endif /* !__ASSEMBLY__ */
718
719/*
720 * Fields in CRB Register D
721 */
722
723#ifndef __ASSEMBLY__
724typedef union icrbd_s {
725 u64 reg_value;
726 struct {
727 u64 rsvd: 38,
728 toutvld: 1, /* Timeout in progress for this CRB */
729 ctxtvld: 1, /* Context field below is valid */
730 rsvd2: 1,
731 context: 15, /* Bit vector:
732 * Has a bit set for each CRB entry
733 * which needs to be deallocated
734 * before this CRB entry is processed.
735 * Set only for barrier operations.
736 */
737 timeout: 8; /* Timeout Upper 8 bits */
738 } icrbd_field_s;
739} icrbd_t;
740
741#define icrbd_toutvld icrbd_field_s.toutvld
742#define icrbd_ctxtvld icrbd_field_s.ctxtvld
743#define icrbd_context icrbd_field_s.context
744
745
746typedef union hubii_ifdr_u {
747 u64 hi_ifdr_value;
748 struct {
749 u64 ifdr_rsvd: 49,
750 ifdr_maxrp: 7,
751 ifdr_rsvd1: 1,
752 ifdr_maxrq: 7;
753 } hi_ifdr_fields;
754} hubii_ifdr_t;
755
756#endif /* !__ASSEMBLY__ */
757
758/*
759 * Hardware designed names for the BTE control registers.
760 */
761#define IIO_IBLS_0 0x410000 /* BTE length/status 0 */
762#define IIO_IBSA_0 0x410008 /* BTE source address 0 */
763#define IIO_IBDA_0 0x410010 /* BTE destination address 0 */
764#define IIO_IBCT_0 0x410018 /* BTE control/terminate 0 */
765#define IIO_IBNA_0 0x410020 /* BTE notification address 0 */
766#define IIO_IBNR_0 IIO_IBNA_0
767#define IIO_IBIA_0 0x410028 /* BTE interrupt address 0 */
768
769#define IIO_IBLS_1 0x420000 /* BTE length/status 1 */
770#define IIO_IBSA_1 0x420008 /* BTE source address 1 */
771#define IIO_IBDA_1 0x420010 /* BTE destination address 1 */
772#define IIO_IBCT_1 0x420018 /* BTE control/terminate 1 */
773#define IIO_IBNA_1 0x420020 /* BTE notification address 1 */
774#define IIO_IBNR_1 IIO_IBNA_1
775#define IIO_IBIA_1 0x420028 /* BTE interrupt address 1 */
776
777/*
778 * More miscellaneous registers
779 */
780#define IIO_IPCR 0x430000 /* Performance Control */
781#define IIO_IPPR 0x430008 /* Performance Profiling */
782
783/*
784 * IO Error Clear register bit field definitions
785 */
786#define IECLR_BTE1 (1 << 18) /* clear bte error 1 ??? */
787#define IECLR_BTE0 (1 << 17) /* clear bte error 0 ??? */
788#define IECLR_CRAZY (1 << 16) /* clear crazy bit in wstat reg */
789#define IECLR_PRB_F (1 << 15) /* clear err bit in PRB_F reg */
790#define IECLR_PRB_E (1 << 14) /* clear err bit in PRB_E reg */
791#define IECLR_PRB_D (1 << 13) /* clear err bit in PRB_D reg */
792#define IECLR_PRB_C (1 << 12) /* clear err bit in PRB_C reg */
793#define IECLR_PRB_B (1 << 11) /* clear err bit in PRB_B reg */
794#define IECLR_PRB_A (1 << 10) /* clear err bit in PRB_A reg */
795#define IECLR_PRB_9 (1 << 9) /* clear err bit in PRB_9 reg */
796#define IECLR_PRB_8 (1 << 8) /* clear err bit in PRB_8 reg */
797#define IECLR_PRB_0 (1 << 0) /* clear err bit in PRB_0 reg */
798
799/*
800 * IO PIO Read Table Entry format
801 */
802
803#ifndef __ASSEMBLY__
804
805typedef union iprte_a {
806 u64 entry;
807 struct {
808 u64 rsvd1 : 7, /* Reserved field */
809 valid : 1, /* Maps to a timeout entry */
810 rsvd2 : 1,
811 srcnode : 9, /* Node which did this PIO */
812 initiator : 2, /* If T5A or T5B or IO */
813 rsvd3 : 3,
814 addr : 38, /* Physical address of PIO */
815 rsvd4 : 3;
816 } iprte_fields;
817} iprte_a_t;
818
819#define iprte_valid iprte_fields.valid
820#define iprte_timeout iprte_fields.timeout
821#define iprte_srcnode iprte_fields.srcnode
822#define iprte_init iprte_fields.initiator
823#define iprte_addr iprte_fields.addr
824
825#endif /* !__ASSEMBLY__ */
826
827#define IPRTE_ADDRSHFT 3
828
829/*
830 * Hub IIO PRB Register format.
831 */
832
833#ifndef __ASSEMBLY__
834/*
835 * Note: Fields bnakctr, anakctr, xtalkctrmode, ovflow fields are
836 * "Status" fields, and should only be used in case of clean up after errors.
837 */
838
839typedef union iprb_u {
840 u64 reg_value;
841 struct {
842 u64 rsvd1: 15,
843 error: 1, /* Widget rcvd wr resp pkt w/ error */
844 ovflow: 5, /* Over flow count. perf measurement */
845 fire_and_forget: 1, /* Launch Write without response */
846 mode: 2, /* Widget operation Mode */
847 rsvd2: 2,
848 bnakctr: 14,
849 rsvd3: 2,
850 anakctr: 14,
851 xtalkctr: 8;
852 } iprb_fields_s;
853} iprb_t;
854
855#define iprb_regval reg_value
856
857#define iprb_error iprb_fields_s.error
858#define iprb_ovflow iprb_fields_s.ovflow
859#define iprb_ff iprb_fields_s.fire_and_forget
860#define iprb_mode iprb_fields_s.mode
861#define iprb_bnakctr iprb_fields_s.bnakctr
862#define iprb_anakctr iprb_fields_s.anakctr
863#define iprb_xtalkctr iprb_fields_s.xtalkctr
864
865#endif /* !__ASSEMBLY__ */
866
867/*
868 * values for mode field in iprb_t.
869 * For details of the meanings of NAK and Accept, refer the PIO flow
870 * document
871 */
872#define IPRB_MODE_NORMAL (0)
873#define IPRB_MODE_COLLECT_A (1) /* PRB in collect A mode */
874#define IPRB_MODE_SERVICE_A (2) /* NAK B and Accept A */
875#define IPRB_MODE_SERVICE_B (3) /* NAK A and Accept B */
876
877/*
878 * IO CRB entry C_A to E_A : Partial (cache) CRBS
879 */
880#ifndef __ASSEMBLY__
881typedef union icrbp_a {
882 u64 ip_reg; /* the entire register value */
883 struct {
884 u64 error: 1, /* 63, error occurred */
885 ln_uce: 1, /* 62: uncorrectable memory */
886 ln_ae: 1, /* 61: protection violation */
887 ln_werr:1, /* 60: write access error */
888 ln_aerr:1, /* 59: sn0net: Address error */
889 ln_perr:1, /* 58: sn0net: poison error */
890 timeout:1, /* 57: CRB timed out */
891 l_bdpkt:1, /* 56: truncated pkt on sn0net */
892 c_bdpkt:1, /* 55: truncated pkt on xtalk */
893 c_err: 1, /* 54: incoming xtalk req, err set*/
894 rsvd1: 12, /* 53-42: reserved */
895 valid: 1, /* 41: Valid status */
896 sidn: 4, /* 40-37: SIDN field of xtalk rqst */
897 tnum: 5, /* 36-32: TNUM of xtalk request */
898 bo: 1, /* 31: barrier op set in xtalk rqst*/
899 resprqd:1, /* 30: xtalk rqst requires response*/
900 gbr: 1, /* 29: gbr bit set in xtalk rqst */
901 size: 2, /* 28-27: size of xtalk request */
902 excl: 4, /* 26-23: exclusive bit(s) */
903 stall: 3, /* 22-20: stall (xtalk, bte 0/1) */
904 intvn: 1, /* 19: rqst target of intervention*/
905 resp: 1, /* 18: Data response given to t5 */
906 ack: 1, /* 17: Data ack received. */
907 hold: 1, /* 16: crb gathering invalidate acks*/
908 wb: 1, /* 15: writeback pending. */
909 ack_cnt:11, /* 14-04: counter of invalidate acks*/
910 tscaler:4; /* 03-00: Timeout prescaler */
911 } ip_fmt;
912} icrbp_a_t;
913
914#endif /* !__ASSEMBLY__ */
915
916/*
917 * A couple of defines to go with the above structure.
918 */
919#define ICRBP_A_CERR_SHFT 54
920#define ICRBP_A_ERR_MASK 0x3ff
921
922#ifndef __ASSEMBLY__
923typedef union hubii_idsr {
924 u64 iin_reg;
925 struct {
926 u64 rsvd1 : 35,
927 isent : 1,
928 rsvd2 : 3,
929 ienable: 1,
930 rsvd : 7,
931 node : 9,
932 rsvd4 : 1,
933 level : 7;
934 } iin_fmt;
935} hubii_idsr_t;
936#endif /* !__ASSEMBLY__ */
937
938/*
939 * IO BTE Length/Status (IIO_IBLS) register bit field definitions
940 */
941#define IBLS_BUSY (0x1 << 20)
942#define IBLS_ERROR_SHFT 16
943#define IBLS_ERROR (0x1 << IBLS_ERROR_SHFT)
944#define IBLS_LENGTH_MASK 0xffff
945
946/*
947 * IO BTE Control/Terminate register (IBCT) register bit field definitions
948 */
949#define IBCT_POISON (0x1 << 8)
950#define IBCT_NOTIFY (0x1 << 4)
951#define IBCT_ZFIL_MODE (0x1 << 0)
952
953/*
954 * IO BTE Interrupt Address Register (IBIA) register bit field definitions
955 */
956#define IBIA_LEVEL_SHFT 16
957#define IBIA_LEVEL_MASK (0x7f << IBIA_LEVEL_SHFT)
958#define IBIA_NODE_ID_SHFT 0
959#define IBIA_NODE_ID_MASK (0x1ff)
960
961/*
962 * Miscellaneous hub constants
963 */
964
965/* Number of widgets supported by hub */
966#define HUB_NUM_WIDGET 9
967#define HUB_WIDGET_ID_MIN 0x8
968#define HUB_WIDGET_ID_MAX 0xf
969
970#define HUB_WIDGET_PART_NUM 0xc101
971#define MAX_HUBS_PER_XBOW 2
972
973/*
974 * Get a hub's widget id from widget control register
975 */
976#define IIO_WCR_WID_GET(nasid) (REMOTE_HUB_L(nasid, III_WCR) & 0xf)
977#define IIO_WST_ERROR_MASK (UINT64_CAST 1 << 32) /* Widget status error */
978
979/*
980 * Number of credits Hub widget has while sending req/response to
981 * xbow.
982 * Value of 3 is required by Xbow 1.1
983 * We may be able to increase this to 4 with Xbow 1.2.
984 */
985#define HUBII_XBOW_CREDIT 3
986#define HUBII_XBOW_REV2_CREDIT 4
987
988#endif /* _ASM_SGI_SN_SN0_HUBIO_H */
diff --git a/include/asm-mips/sn/sn0/hubmd.h b/include/asm-mips/sn/sn0/hubmd.h
new file mode 100644
index 000000000000..a66def4e0ba0
--- /dev/null
+++ b/include/asm-mips/sn/sn0/hubmd.h
@@ -0,0 +1,790 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/SN0/hubmd.h>, revision 1.59.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SN_SN0_HUBMD_H
12#define _ASM_SN_SN0_HUBMD_H
13
14#include <linux/config.h>
15
16/*
17 * Hub Memory/Directory interface registers
18 */
19#define CACHE_SLINE_SIZE 128 /* Secondary cache line size on SN0 */
20
21#define MAX_REGIONS 64
22
23/* Hardware page size and shift */
24
25#define MD_PAGE_SIZE 4096 /* Page size in bytes */
26#define MD_PAGE_NUM_SHFT 12 /* Address to page number shift */
27
28/* Register offsets from LOCAL_HUB or REMOTE_HUB */
29
30#define MD_BASE 0x200000
31#define MD_BASE_PERF 0x210000
32#define MD_BASE_JUNK 0x220000
33
34#define MD_IO_PROTECT 0x200000 /* MD and core register protection */
35#define MD_IO_PROT_OVRRD 0x200008 /* Clear my bit in MD_IO_PROTECT */
36#define MD_HSPEC_PROTECT 0x200010 /* BDDIR, LBOOT, RBOOT protection */
37#define MD_MEMORY_CONFIG 0x200018 /* Memory/Directory DIMM control */
38#define MD_REFRESH_CONTROL 0x200020 /* Memory/Directory refresh ctrl */
39#define MD_FANDOP_CAC_STAT 0x200028 /* Fetch-and-op cache status */
40#define MD_MIG_DIFF_THRESH 0x200030 /* Page migr. count diff thresh. */
41#define MD_MIG_VALUE_THRESH 0x200038 /* Page migr. count abs. thresh. */
42#define MD_MIG_CANDIDATE 0x200040 /* Latest page migration candidate */
43#define MD_MIG_CANDIDATE_CLR 0x200048 /* Clear page migration candidate */
44#define MD_DIR_ERROR 0x200050 /* Directory DIMM error */
45#define MD_DIR_ERROR_CLR 0x200058 /* Directory DIMM error clear */
46#define MD_PROTOCOL_ERROR 0x200060 /* Directory protocol error */
47#define MD_PROTOCOL_ERROR_CLR 0x200068 /* Directory protocol error clear */
48#define MD_MEM_ERROR 0x200070 /* Memory DIMM error */
49#define MD_MEM_ERROR_CLR 0x200078 /* Memory DIMM error clear */
50#define MD_MISC_ERROR 0x200080 /* Miscellaneous MD error */
51#define MD_MISC_ERROR_CLR 0x200088 /* Miscellaneous MD error clear */
52#define MD_MEM_DIMM_INIT 0x200090 /* Memory DIMM mode initization. */
53#define MD_DIR_DIMM_INIT 0x200098 /* Directory DIMM mode init. */
54#define MD_MOQ_SIZE 0x2000a0 /* MD outgoing queue size */
55#define MD_MLAN_CTL 0x2000a8 /* NIC (Microlan) control register */
56
57#define MD_PERF_SEL 0x210000 /* Select perf monitor events */
58#define MD_PERF_CNT0 0x210010 /* Performance counter 0 */
59#define MD_PERF_CNT1 0x210018 /* Performance counter 1 */
60#define MD_PERF_CNT2 0x210020 /* Performance counter 2 */
61#define MD_PERF_CNT3 0x210028 /* Performance counter 3 */
62#define MD_PERF_CNT4 0x210030 /* Performance counter 4 */
63#define MD_PERF_CNT5 0x210038 /* Performance counter 5 */
64
65#define MD_UREG0_0 0x220000 /* uController/UART 0 register */
66#define MD_UREG0_1 0x220008 /* uController/UART 0 register */
67#define MD_UREG0_2 0x220010 /* uController/UART 0 register */
68#define MD_UREG0_3 0x220018 /* uController/UART 0 register */
69#define MD_UREG0_4 0x220020 /* uController/UART 0 register */
70#define MD_UREG0_5 0x220028 /* uController/UART 0 register */
71#define MD_UREG0_6 0x220030 /* uController/UART 0 register */
72#define MD_UREG0_7 0x220038 /* uController/UART 0 register */
73
74#define MD_SLOTID_USTAT 0x220048 /* Hub slot ID & UART/uCtlr status */
75#define MD_LED0 0x220050 /* Eight-bit LED for CPU A */
76#define MD_LED1 0x220058 /* Eight-bit LED for CPU B */
77
78#define MD_UREG1_0 0x220080 /* uController/UART 1 register */
79#define MD_UREG1_1 0x220088 /* uController/UART 1 register */
80#define MD_UREG1_2 0x220090 /* uController/UART 1 register */
81#define MD_UREG1_3 0x220098 /* uController/UART 1 register */
82#define MD_UREG1_4 0x2200a0 /* uController/UART 1 register */
83#define MD_UREG1_5 0x2200a8 /* uController/UART 1 register */
84#define MD_UREG1_6 0x2200b0 /* uController/UART 1 register */
85#define MD_UREG1_7 0x2200b8 /* uController/UART 1 register */
86#define MD_UREG1_8 0x2200c0 /* uController/UART 1 register */
87#define MD_UREG1_9 0x2200c8 /* uController/UART 1 register */
88#define MD_UREG1_10 0x2200d0 /* uController/UART 1 register */
89#define MD_UREG1_11 0x2200d8 /* uController/UART 1 register */
90#define MD_UREG1_12 0x2200e0 /* uController/UART 1 register */
91#define MD_UREG1_13 0x2200e8 /* uController/UART 1 register */
92#define MD_UREG1_14 0x2200f0 /* uController/UART 1 register */
93#define MD_UREG1_15 0x2200f8 /* uController/UART 1 register */
94
95#ifdef CONFIG_SGI_SN0_N_MODE
96#define MD_MEM_BANKS 4 /* 4 banks of memory max in N mode */
97#else
98#define MD_MEM_BANKS 8 /* 8 banks of memory max in M mode */
99#endif
100
101/*
102 * MD_MEMORY_CONFIG fields
103 *
104 * MD_SIZE_xxx are useful for representing the size of a SIMM or bank
105 * (SIMM pair). They correspond to the values needed for the bit
106 * triplets (MMC_BANK_MASK) in the MD_MEMORY_CONFIG register for bank size.
107 * Bits not used by the MD are used by software.
108 */
109
110#define MD_SIZE_EMPTY 0 /* Valid in MEMORY_CONFIG */
111#define MD_SIZE_8MB 1
112#define MD_SIZE_16MB 2
113#define MD_SIZE_32MB 3 /* Broken in Hub 1 */
114#define MD_SIZE_64MB 4 /* Valid in MEMORY_CONFIG */
115#define MD_SIZE_128MB 5 /* Valid in MEMORY_CONFIG */
116#define MD_SIZE_256MB 6
117#define MD_SIZE_512MB 7 /* Valid in MEMORY_CONFIG */
118#define MD_SIZE_1GB 8
119#define MD_SIZE_2GB 9
120#define MD_SIZE_4GB 10
121
122#define MD_SIZE_BYTES(size) ((size) == 0 ? 0 : 0x400000L << (size))
123#define MD_SIZE_MBYTES(size) ((size) == 0 ? 0 : 4 << (size))
124
125#define MMC_FPROM_CYC_SHFT 49 /* Have to use UINT64_CAST, instead */
126#define MMC_FPROM_CYC_MASK (UINT64_CAST 31 << 49) /* of 'L' suffix, */
127#define MMC_FPROM_WR_SHFT 44 /* for assembler */
128#define MMC_FPROM_WR_MASK (UINT64_CAST 31 << 44)
129#define MMC_UCTLR_CYC_SHFT 39
130#define MMC_UCTLR_CYC_MASK (UINT64_CAST 31 << 39)
131#define MMC_UCTLR_WR_SHFT 34
132#define MMC_UCTLR_WR_MASK (UINT64_CAST 31 << 34)
133#define MMC_DIMM0_SEL_SHFT 32
134#define MMC_DIMM0_SEL_MASK (UINT64_CAST 3 << 32)
135#define MMC_IO_PROT_EN_SHFT 31
136#define MMC_IO_PROT_EN_MASK (UINT64_CAST 1 << 31)
137#define MMC_IO_PROT (UINT64_CAST 1 << 31)
138#define MMC_ARB_MLSS_SHFT 30
139#define MMC_ARB_MLSS_MASK (UINT64_CAST 1 << 30)
140#define MMC_ARB_MLSS (UINT64_CAST 1 << 30)
141#define MMC_IGNORE_ECC_SHFT 29
142#define MMC_IGNORE_ECC_MASK (UINT64_CAST 1 << 29)
143#define MMC_IGNORE_ECC (UINT64_CAST 1 << 29)
144#define MMC_DIR_PREMIUM_SHFT 28
145#define MMC_DIR_PREMIUM_MASK (UINT64_CAST 1 << 28)
146#define MMC_DIR_PREMIUM (UINT64_CAST 1 << 28)
147#define MMC_REPLY_GUAR_SHFT 24
148#define MMC_REPLY_GUAR_MASK (UINT64_CAST 15 << 24)
149#define MMC_BANK_SHFT(_b) ((_b) * 3)
150#define MMC_BANK_MASK(_b) (UINT64_CAST 7 << MMC_BANK_SHFT(_b))
151#define MMC_BANK_ALL_MASK 0xffffff
152#define MMC_RESET_DEFAULTS (UINT64_CAST 0x0f << MMC_FPROM_CYC_SHFT | \
153 UINT64_CAST 0x07 << MMC_FPROM_WR_SHFT | \
154 UINT64_CAST 0x1f << MMC_UCTLR_CYC_SHFT | \
155 UINT64_CAST 0x0f << MMC_UCTLR_WR_SHFT | \
156 MMC_IGNORE_ECC | MMC_DIR_PREMIUM | \
157 UINT64_CAST 0x0f << MMC_REPLY_GUAR_SHFT | \
158 MMC_BANK_ALL_MASK)
159
160/* MD_REFRESH_CONTROL fields */
161
162#define MRC_ENABLE_SHFT 63
163#define MRC_ENABLE_MASK (UINT64_CAST 1 << 63)
164#define MRC_ENABLE (UINT64_CAST 1 << 63)
165#define MRC_COUNTER_SHFT 12
166#define MRC_COUNTER_MASK (UINT64_CAST 0xfff << 12)
167#define MRC_CNT_THRESH_MASK 0xfff
168#define MRC_RESET_DEFAULTS (UINT64_CAST 0x400)
169
170/* MD_MEM_DIMM_INIT and MD_DIR_DIMM_INIT fields */
171
172#define MDI_SELECT_SHFT 32
173#define MDI_SELECT_MASK (UINT64_CAST 0x0f << 32)
174#define MDI_DIMM_MODE_MASK (UINT64_CAST 0xfff)
175
176/* MD_MOQ_SIZE fields */
177
178#define MMS_RP_SIZE_SHFT 8
179#define MMS_RP_SIZE_MASK (UINT64_CAST 0x3f << 8)
180#define MMS_RQ_SIZE_SHFT 0
181#define MMS_RQ_SIZE_MASK (UINT64_CAST 0x1f)
182#define MMS_RESET_DEFAULTS (0x32 << 8 | 0x12)
183
184/* MD_FANDOP_CAC_STAT fields */
185
186#define MFC_VALID_SHFT 63
187#define MFC_VALID_MASK (UINT64_CAST 1 << 63)
188#define MFC_VALID (UINT64_CAST 1 << 63)
189#define MFC_ADDR_SHFT 6
190#define MFC_ADDR_MASK (UINT64_CAST 0x3ffffff)
191
192/* MD_MLAN_CTL fields */
193
194#define MLAN_PHI1_SHFT 27
195#define MLAN_PHI1_MASK (UINT64_CAST 0x7f << 27)
196#define MLAN_PHI0_SHFT 20
197#define MLAN_PHI0_MASK (UINT64_CAST 0x7f << 27)
198#define MLAN_PULSE_SHFT 10
199#define MLAN_PULSE_MASK (UINT64_CAST 0x3ff << 10)
200#define MLAN_SAMPLE_SHFT 2
201#define MLAN_SAMPLE_MASK (UINT64_CAST 0xff << 2)
202#define MLAN_DONE_SHFT 1
203#define MLAN_DONE_MASK 2
204#define MLAN_DONE (UINT64_CAST 0x02)
205#define MLAN_RD_DATA (UINT64_CAST 0x01)
206#define MLAN_RESET_DEFAULTS (UINT64_CAST 0x31 << MLAN_PHI1_SHFT | \
207 UINT64_CAST 0x31 << MLAN_PHI0_SHFT)
208
209/* MD_SLOTID_USTAT bit definitions */
210
211#define MSU_CORECLK_TST_SHFT 7 /* You don't wanna know */
212#define MSU_CORECLK_TST_MASK (UINT64_CAST 1 << 7)
213#define MSU_CORECLK_TST (UINT64_CAST 1 << 7)
214#define MSU_CORECLK_SHFT 6 /* You don't wanna know */
215#define MSU_CORECLK_MASK (UINT64_CAST 1 << 6)
216#define MSU_CORECLK (UINT64_CAST 1 << 6)
217#define MSU_NETSYNC_SHFT 5 /* You don't wanna know */
218#define MSU_NETSYNC_MASK (UINT64_CAST 1 << 5)
219#define MSU_NETSYNC (UINT64_CAST 1 << 5)
220#define MSU_FPROMRDY_SHFT 4 /* Flash PROM ready bit */
221#define MSU_FPROMRDY_MASK (UINT64_CAST 1 << 4)
222#define MSU_FPROMRDY (UINT64_CAST 1 << 4)
223#define MSU_I2CINTR_SHFT 3 /* I2C interrupt bit */
224#define MSU_I2CINTR_MASK (UINT64_CAST 1 << 3)
225#define MSU_I2CINTR (UINT64_CAST 1 << 3)
226#define MSU_SLOTID_MASK 0xff
227#define MSU_SN0_SLOTID_SHFT 0 /* Slot ID */
228#define MSU_SN0_SLOTID_MASK (UINT64_CAST 7)
229#define MSU_SN00_SLOTID_SHFT 7
230#define MSU_SN00_SLOTID_MASK (UINT64_CAST 0x80)
231
232#define MSU_PIMM_PSC_SHFT 4
233#define MSU_PIMM_PSC_MASK (0xf << MSU_PIMM_PSC_SHFT)
234
235/* MD_MIG_DIFF_THRESH bit definitions */
236
237#define MD_MIG_DIFF_THRES_VALID_MASK (UINT64_CAST 0x1 << 63)
238#define MD_MIG_DIFF_THRES_VALID_SHFT 63
239#define MD_MIG_DIFF_THRES_VALUE_MASK (UINT64_CAST 0xfffff)
240
241/* MD_MIG_VALUE_THRESH bit definitions */
242
243#define MD_MIG_VALUE_THRES_VALID_MASK (UINT64_CAST 0x1 << 63)
244#define MD_MIG_VALUE_THRES_VALID_SHFT 63
245#define MD_MIG_VALUE_THRES_VALUE_MASK (UINT64_CAST 0xfffff)
246
247/* MD_MIG_CANDIDATE bit definitions */
248
249#define MD_MIG_CANDIDATE_VALID_MASK (UINT64_CAST 0x1 << 63)
250#define MD_MIG_CANDIDATE_VALID_SHFT 63
251#define MD_MIG_CANDIDATE_TYPE_MASK (UINT64_CAST 0x1 << 30)
252#define MD_MIG_CANDIDATE_TYPE_SHFT 30
253#define MD_MIG_CANDIDATE_OVERRUN_MASK (UINT64_CAST 0x1 << 29)
254#define MD_MIG_CANDIDATE_OVERRUN_SHFT 29
255#define MD_MIG_CANDIDATE_INITIATOR_MASK (UINT64_CAST 0x7ff << 18)
256#define MD_MIG_CANDIDATE_INITIATOR_SHFT 18
257#define MD_MIG_CANDIDATE_NODEID_MASK (UINT64_CAST 0x1ff << 20)
258#define MD_MIG_CANDIDATE_NODEID_SHFT 20
259#define MD_MIG_CANDIDATE_ADDR_MASK (UINT64_CAST 0x3ffff)
260#define MD_MIG_CANDIDATE_ADDR_SHFT 14 /* The address starts at bit 14 */
261
262/* Other MD definitions */
263
264#define MD_BANK_SHFT 29 /* log2(512 MB) */
265#define MD_BANK_MASK (UINT64_CAST 7 << 29)
266#define MD_BANK_SIZE (UINT64_CAST 1 << MD_BANK_SHFT) /* 512 MB */
267#define MD_BANK_OFFSET(_b) (UINT64_CAST (_b) << MD_BANK_SHFT)
268
269/*
270 * The following definitions cover the bit field definitions for the
271 * various MD registers. For multi-bit registers, we define both
272 * a shift amount and a mask value. By convention, if you want to
273 * isolate a field, you should mask the field and then shift it down,
274 * since this makes the masks useful without a shift.
275 */
276
277/* Directory entry states for both premium and standard SIMMs. */
278
279#define MD_DIR_SHARED (UINT64_CAST 0x0) /* 000 */
280#define MD_DIR_POISONED (UINT64_CAST 0x1) /* 001 */
281#define MD_DIR_EXCLUSIVE (UINT64_CAST 0x2) /* 010 */
282#define MD_DIR_BUSY_SHARED (UINT64_CAST 0x3) /* 011 */
283#define MD_DIR_BUSY_EXCL (UINT64_CAST 0x4) /* 100 */
284#define MD_DIR_WAIT (UINT64_CAST 0x5) /* 101 */
285#define MD_DIR_UNOWNED (UINT64_CAST 0x7) /* 111 */
286
287/*
288 * The MD_DIR_FORCE_ECC bit can be added directory entry write data
289 * to forcing the ECC to be written as-is instead of recalculated.
290 */
291
292#define MD_DIR_FORCE_ECC (UINT64_CAST 1 << 63)
293
294/*
295 * Premium SIMM directory entry shifts and masks. Each is valid only in the
296 * context(s) indicated, where A, B, and C indicate the directory entry format
297 * as shown, and low and/or high indicates which double-word of the entry.
298 *
299 * Format A: STATE = shared, FINE = 1
300 * Format B: STATE = shared, FINE = 0
301 * Format C: STATE != shared (FINE must be 0)
302 */
303
304#define MD_PDIR_MASK 0xffffffffffff /* Whole entry */
305#define MD_PDIR_ECC_SHFT 0 /* ABC low or high */
306#define MD_PDIR_ECC_MASK 0x7f
307#define MD_PDIR_PRIO_SHFT 8 /* ABC low */
308#define MD_PDIR_PRIO_MASK (0xf << 8)
309#define MD_PDIR_AX_SHFT 7 /* ABC low */
310#define MD_PDIR_AX_MASK (1 << 7)
311#define MD_PDIR_AX (1 << 7)
312#define MD_PDIR_FINE_SHFT 12 /* ABC low */
313#define MD_PDIR_FINE_MASK (1 << 12)
314#define MD_PDIR_FINE (1 << 12)
315#define MD_PDIR_OCT_SHFT 13 /* A low */
316#define MD_PDIR_OCT_MASK (7 << 13)
317#define MD_PDIR_STATE_SHFT 13 /* BC low */
318#define MD_PDIR_STATE_MASK (7 << 13)
319#define MD_PDIR_ONECNT_SHFT 16 /* BC low */
320#define MD_PDIR_ONECNT_MASK (0x3f << 16)
321#define MD_PDIR_PTR_SHFT 22 /* C low */
322#define MD_PDIR_PTR_MASK (UINT64_CAST 0x7ff << 22)
323#define MD_PDIR_VECMSB_SHFT 22 /* AB low */
324#define MD_PDIR_VECMSB_BITMASK 0x3ffffff
325#define MD_PDIR_VECMSB_BITSHFT 27
326#define MD_PDIR_VECMSB_MASK (UINT64_CAST MD_PDIR_VECMSB_BITMASK << 22)
327#define MD_PDIR_CWOFF_SHFT 7 /* C high */
328#define MD_PDIR_CWOFF_MASK (7 << 7)
329#define MD_PDIR_VECLSB_SHFT 10 /* AB high */
330#define MD_PDIR_VECLSB_BITMASK (UINT64_CAST 0x3fffffffff)
331#define MD_PDIR_VECLSB_BITSHFT 0
332#define MD_PDIR_VECLSB_MASK (MD_PDIR_VECLSB_BITMASK << 10)
333
334/*
335 * Directory initialization values
336 */
337
338#define MD_PDIR_INIT_LO (MD_DIR_UNOWNED << MD_PDIR_STATE_SHFT | \
339 MD_PDIR_AX)
340#define MD_PDIR_INIT_HI 0
341#define MD_PDIR_INIT_PROT (MD_PROT_RW << MD_PPROT_IO_SHFT | \
342 MD_PROT_RW << MD_PPROT_SHFT)
343
344/*
345 * Standard SIMM directory entry shifts and masks. Each is valid only in the
346 * context(s) indicated, where A and C indicate the directory entry format
347 * as shown, and low and/or high indicates which double-word of the entry.
348 *
349 * Format A: STATE == shared
350 * Format C: STATE != shared
351 */
352
353#define MD_SDIR_MASK 0xffff /* Whole entry */
354#define MD_SDIR_ECC_SHFT 0 /* AC low or high */
355#define MD_SDIR_ECC_MASK 0x1f
356#define MD_SDIR_PRIO_SHFT 6 /* AC low */
357#define MD_SDIR_PRIO_MASK (1 << 6)
358#define MD_SDIR_AX_SHFT 5 /* AC low */
359#define MD_SDIR_AX_MASK (1 << 5)
360#define MD_SDIR_AX (1 << 5)
361#define MD_SDIR_STATE_SHFT 7 /* AC low */
362#define MD_SDIR_STATE_MASK (7 << 7)
363#define MD_SDIR_PTR_SHFT 10 /* C low */
364#define MD_SDIR_PTR_MASK (0x3f << 10)
365#define MD_SDIR_CWOFF_SHFT 5 /* C high */
366#define MD_SDIR_CWOFF_MASK (7 << 5)
367#define MD_SDIR_VECMSB_SHFT 11 /* A low */
368#define MD_SDIR_VECMSB_BITMASK 0x1f
369#define MD_SDIR_VECMSB_BITSHFT 7
370#define MD_SDIR_VECMSB_MASK (MD_SDIR_VECMSB_BITMASK << 11)
371#define MD_SDIR_VECLSB_SHFT 5 /* A high */
372#define MD_SDIR_VECLSB_BITMASK 0x7ff
373#define MD_SDIR_VECLSB_BITSHFT 0
374#define MD_SDIR_VECLSB_MASK (MD_SDIR_VECLSB_BITMASK << 5)
375
376/*
377 * Directory initialization values
378 */
379
380#define MD_SDIR_INIT_LO (MD_DIR_UNOWNED << MD_SDIR_STATE_SHFT | \
381 MD_SDIR_AX)
382#define MD_SDIR_INIT_HI 0
383#define MD_SDIR_INIT_PROT (MD_PROT_RW << MD_SPROT_SHFT)
384
385/* Protection and migration field values */
386
387#define MD_PROT_RW (UINT64_CAST 0x6)
388#define MD_PROT_RO (UINT64_CAST 0x3)
389#define MD_PROT_NO (UINT64_CAST 0x0)
390#define MD_PROT_BAD (UINT64_CAST 0x5)
391
392/* Premium SIMM protection entry shifts and masks. */
393
394#define MD_PPROT_SHFT 0 /* Prot. field */
395#define MD_PPROT_MASK 7
396#define MD_PPROT_MIGMD_SHFT 3 /* Migration mode */
397#define MD_PPROT_MIGMD_MASK (3 << 3)
398#define MD_PPROT_REFCNT_SHFT 5 /* Reference count */
399#define MD_PPROT_REFCNT_WIDTH 0x7ffff
400#define MD_PPROT_REFCNT_MASK (MD_PPROT_REFCNT_WIDTH << 5)
401
402#define MD_PPROT_IO_SHFT 45 /* I/O Prot field */
403#define MD_PPROT_IO_MASK (UINT64_CAST 7 << 45)
404
405/* Standard SIMM protection entry shifts and masks. */
406
407#define MD_SPROT_SHFT 0 /* Prot. field */
408#define MD_SPROT_MASK 7
409#define MD_SPROT_MIGMD_SHFT 3 /* Migration mode */
410#define MD_SPROT_MIGMD_MASK (3 << 3)
411#define MD_SPROT_REFCNT_SHFT 5 /* Reference count */
412#define MD_SPROT_REFCNT_WIDTH 0x7ff
413#define MD_SPROT_REFCNT_MASK (MD_SPROT_REFCNT_WIDTH << 5)
414
415/* Migration modes used in protection entries */
416
417#define MD_PROT_MIGMD_IREL (UINT64_CAST 0x3 << 3)
418#define MD_PROT_MIGMD_IABS (UINT64_CAST 0x2 << 3)
419#define MD_PROT_MIGMD_PREL (UINT64_CAST 0x1 << 3)
420#define MD_PROT_MIGMD_OFF (UINT64_CAST 0x0 << 3)
421
422
423/*
424 * Operations on page migration threshold register
425 */
426
427#ifndef __ASSEMBLY__
428
429/*
430 * LED register macros
431 */
432
433#define CPU_LED_ADDR(_nasid, _slice) \
434 (private.p_sn00 ? \
435 REMOTE_HUB_ADDR((_nasid), MD_UREG1_0 + ((_slice) << 5)) : \
436 REMOTE_HUB_ADDR((_nasid), MD_LED0 + ((_slice) << 3)))
437
438#define SET_CPU_LEDS(_nasid, _slice, _val) \
439 (HUB_S(CPU_LED_ADDR(_nasid, _slice), (_val)))
440
441#define SET_MY_LEDS(_v) \
442 SET_CPU_LEDS(get_nasid(), get_slice(), (_v))
443
444/*
445 * Operations on Memory/Directory DIMM control register
446 */
447
448#define DIRTYPE_PREMIUM 1
449#define DIRTYPE_STANDARD 0
450#define MD_MEMORY_CONFIG_DIR_TYPE_GET(region) (\
451 (REMOTE_HUB_L(region, MD_MEMORY_CONFIG) & MMC_DIR_PREMIUM_MASK) >> \
452 MMC_DIR_PREMIUM_SHFT)
453
454
455/*
456 * Operations on page migration count difference and absolute threshold
457 * registers
458 */
459
460#define MD_MIG_DIFF_THRESH_GET(region) ( \
461 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) & \
462 MD_MIG_DIFF_THRES_VALUE_MASK)
463
464#define MD_MIG_DIFF_THRESH_SET(region, value) ( \
465 REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH, \
466 MD_MIG_DIFF_THRES_VALID_MASK | (value)))
467
468#define MD_MIG_DIFF_THRESH_DISABLE(region) ( \
469 REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH, \
470 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) \
471 & ~MD_MIG_DIFF_THRES_VALID_MASK))
472
473#define MD_MIG_DIFF_THRESH_ENABLE(region) ( \
474 REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH, \
475 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) \
476 | MD_MIG_DIFF_THRES_VALID_MASK))
477
478#define MD_MIG_DIFF_THRESH_IS_ENABLED(region) ( \
479 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) & \
480 MD_MIG_DIFF_THRES_VALID_MASK)
481
482#define MD_MIG_VALUE_THRESH_GET(region) ( \
483 REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) & \
484 MD_MIG_VALUE_THRES_VALUE_MASK)
485
486#define MD_MIG_VALUE_THRESH_SET(region, value) ( \
487 REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH, \
488 MD_MIG_VALUE_THRES_VALID_MASK | (value)))
489
490#define MD_MIG_VALUE_THRESH_DISABLE(region) ( \
491 REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH, \
492 REMOTE_HUB_L(region, MD_MIG_VALUE_THRESH) \
493 & ~MD_MIG_VALUE_THRES_VALID_MASK))
494
495#define MD_MIG_VALUE_THRESH_ENABLE(region) ( \
496 REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH, \
497 REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) \
498 | MD_MIG_VALUE_THRES_VALID_MASK))
499
500#define MD_MIG_VALUE_THRESH_IS_ENABLED(region) ( \
501 REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) & \
502 MD_MIG_VALUE_THRES_VALID_MASK)
503
504/*
505 * Operations on page migration candidate register
506 */
507
508#define MD_MIG_CANDIDATE_GET(my_region_id) ( \
509 REMOTE_HUB_L((my_region_id), MD_MIG_CANDIDATE_CLR))
510
511#define MD_MIG_CANDIDATE_HWPFN(value) ((value) & MD_MIG_CANDIDATE_ADDR_MASK)
512
513#define MD_MIG_CANDIDATE_NODEID(value) ( \
514 ((value) & MD_MIG_CANDIDATE_NODEID_MASK) >> MD_MIG_CANDIDATE_NODEID_SHFT)
515
516#define MD_MIG_CANDIDATE_TYPE(value) ( \
517 ((value) & MD_MIG_CANDIDATE_TYPE_MASK) >> MD_MIG_CANDIDATE_TYPE_SHFT)
518
519#define MD_MIG_CANDIDATE_VALID(value) ( \
520 ((value) & MD_MIG_CANDIDATE_VALID_MASK) >> MD_MIG_CANDIDATE_VALID_SHFT)
521
522/*
523 * Macros to retrieve fields in the protection entry
524 */
525
526/* for Premium SIMM */
527#define MD_PPROT_REFCNT_GET(value) ( \
528 ((value) & MD_PPROT_REFCNT_MASK) >> MD_PPROT_REFCNT_SHFT)
529
530#define MD_PPROT_MIGMD_GET(value) ( \
531 ((value) & MD_PPROT_MIGMD_MASK) >> MD_PPROT_MIGMD_SHFT)
532
533/* for Standard SIMM */
534#define MD_SPROT_REFCNT_GET(value) ( \
535 ((value) & MD_SPROT_REFCNT_MASK) >> MD_SPROT_REFCNT_SHFT)
536
537#define MD_SPROT_MIGMD_GET(value) ( \
538 ((value) & MD_SPROT_MIGMD_MASK) >> MD_SPROT_MIGMD_SHFT)
539
540/*
541 * Format of dir_error, mem_error, protocol_error and misc_error registers
542 */
543
544struct dir_error_reg {
545 u64 uce_vld: 1, /* 63: valid directory uce */
546 ae_vld: 1, /* 62: valid dir prot ecc error */
547 ce_vld: 1, /* 61: valid correctable ECC err*/
548 rsvd1: 19, /* 60-42: reserved */
549 bad_prot: 3, /* 41-39: encoding, bad access rights*/
550 bad_syn: 7, /* 38-32: bad dir syndrome */
551 rsvd2: 2, /* 31-30: reserved */
552 hspec_addr:27, /* 29-03: bddir space bad entry */
553 uce_ovr: 1, /* 2: multiple dir uce's */
554 ae_ovr: 1, /* 1: multiple prot ecc errs*/
555 ce_ovr: 1; /* 0: multiple correctable errs */
556};
557
558typedef union md_dir_error {
559 u64 derr_reg; /* the entire register */
560 struct dir_error_reg derr_fmt; /* the register format */
561} md_dir_error_t;
562
563
564struct mem_error_reg {
565 u64 uce_vld: 1, /* 63: valid memory uce */
566 ce_vld: 1, /* 62: valid correctable ECC err*/
567 rsvd1: 22, /* 61-40: reserved */
568 bad_syn: 8, /* 39-32: bad mem ecc syndrome */
569 address: 29, /* 31-03: bad entry pointer */
570 rsvd2: 1, /* 2: reserved */
571 uce_ovr: 1, /* 1: multiple mem uce's */
572 ce_ovr: 1; /* 0: multiple correctable errs */
573};
574
575
576typedef union md_mem_error {
577 u64 merr_reg; /* the entire register */
578 struct mem_error_reg merr_fmt; /* format of the mem_error reg */
579} md_mem_error_t;
580
581
582struct proto_error_reg {
583 u64 valid: 1, /* 63: valid protocol error */
584 rsvd1: 2, /* 62-61: reserved */
585 initiator:11, /* 60-50: id of request initiator*/
586 backoff: 2, /* 49-48: backoff control */
587 msg_type: 8, /* 47-40: type of request */
588 access: 2, /* 39-38: access rights of initiator*/
589 priority: 1, /* 37: priority level of requestor*/
590 dir_state: 4, /* 36-33: state of directory */
591 pointer_me:1, /* 32: initiator same as dir ptr */
592 address: 29, /* 31-03: request address */
593 rsvd2: 2, /* 02-01: reserved */
594 overrun: 1; /* 0: multiple protocol errs */
595};
596
597typedef union md_proto_error {
598 u64 perr_reg; /* the entire register */
599 struct proto_error_reg perr_fmt; /* format of the register */
600} md_proto_error_t;
601
602
603struct md_sdir_high_fmt {
604 unsigned short sd_hi_bvec : 11,
605 sd_hi_ecc : 5;
606};
607
608
609typedef union md_sdir_high {
610 /* The 16 bits of standard directory, upper word */
611 unsigned short sd_hi_val;
612 struct md_sdir_high_fmt sd_hi_fmt;
613}md_sdir_high_t;
614
615
616struct md_sdir_low_shared_fmt {
617 /* The meaning of lower directory, shared */
618 unsigned short sds_lo_bvec : 5,
619 sds_lo_unused: 1,
620 sds_lo_state : 3,
621 sds_lo_prio : 1,
622 sds_lo_ax : 1,
623 sds_lo_ecc : 5;
624};
625
626struct md_sdir_low_exclusive_fmt {
627 /* The meaning of lower directory, exclusive */
628 unsigned short sde_lo_ptr : 6,
629 sde_lo_state : 3,
630 sde_lo_prio : 1,
631 sde_lo_ax : 1,
632 sde_lo_ecc : 5;
633};
634
635
636typedef union md_sdir_low {
637 /* The 16 bits of standard directory, lower word */
638 unsigned short sd_lo_val;
639 struct md_sdir_low_exclusive_fmt sde_lo_fmt;
640 struct md_sdir_low_shared_fmt sds_lo_fmt;
641}md_sdir_low_t;
642
643
644
645struct md_pdir_high_fmt {
646 u64 pd_hi_unused : 16,
647 pd_hi_bvec : 38,
648 pd_hi_unused1 : 3,
649 pd_hi_ecc : 7;
650};
651
652
653typedef union md_pdir_high {
654 /* The 48 bits of standard directory, upper word */
655 u64 pd_hi_val;
656 struct md_pdir_high_fmt pd_hi_fmt;
657}md_pdir_high_t;
658
659
660struct md_pdir_low_shared_fmt {
661 /* The meaning of lower directory, shared */
662 u64 pds_lo_unused : 16,
663 pds_lo_bvec : 26,
664 pds_lo_cnt : 6,
665 pds_lo_state : 3,
666 pds_lo_ste : 1,
667 pds_lo_prio : 4,
668 pds_lo_ax : 1,
669 pds_lo_ecc : 7;
670};
671
672struct md_pdir_low_exclusive_fmt {
673 /* The meaning of lower directory, exclusive */
674 u64 pde_lo_unused : 31,
675 pde_lo_ptr : 11,
676 pde_lo_unused1 : 6,
677 pde_lo_state : 3,
678 pde_lo_ste : 1,
679 pde_lo_prio : 4,
680 pde_lo_ax : 1,
681 pde_lo_ecc : 7;
682};
683
684
685typedef union md_pdir_loent {
686 /* The 48 bits of premium directory, lower word */
687 u64 pd_lo_val;
688 struct md_pdir_low_exclusive_fmt pde_lo_fmt;
689 struct md_pdir_low_shared_fmt pds_lo_fmt;
690}md_pdir_low_t;
691
692
693/*
694 * the following two "union" definitions and two
695 * "struct" definitions are used in vmdump.c to
696 * represent directory memory information.
697 */
698
699typedef union md_dir_high {
700 md_sdir_high_t md_sdir_high;
701 md_pdir_high_t md_pdir_high;
702} md_dir_high_t;
703
704typedef union md_dir_low {
705 md_sdir_low_t md_sdir_low;
706 md_pdir_low_t md_pdir_low;
707} md_dir_low_t;
708
709typedef struct bddir_entry {
710 md_dir_low_t md_dir_low;
711 md_dir_high_t md_dir_high;
712} bddir_entry_t;
713
714typedef struct dir_mem_entry {
715 u64 prcpf[MAX_REGIONS];
716 bddir_entry_t directory_words[MD_PAGE_SIZE/CACHE_SLINE_SIZE];
717} dir_mem_entry_t;
718
719
720
721typedef union md_perf_sel {
722 u64 perf_sel_reg;
723 struct {
724 u64 perf_rsvd : 60,
725 perf_en : 1,
726 perf_sel : 3;
727 } perf_sel_bits;
728} md_perf_sel_t;
729
730typedef union md_perf_cnt {
731 u64 perf_cnt;
732 struct {
733 u64 perf_rsvd : 44,
734 perf_cnt : 20;
735 } perf_cnt_bits;
736} md_perf_cnt_t;
737
738
739#endif /* !__ASSEMBLY__ */
740
741
742#define DIR_ERROR_VALID_MASK 0xe000000000000000
743#define DIR_ERROR_VALID_SHFT 61
744#define DIR_ERROR_VALID_UCE 0x8000000000000000
745#define DIR_ERROR_VALID_AE 0x4000000000000000
746#define DIR_ERROR_VALID_CE 0x2000000000000000
747
748#define MEM_ERROR_VALID_MASK 0xc000000000000000
749#define MEM_ERROR_VALID_SHFT 62
750#define MEM_ERROR_VALID_UCE 0x8000000000000000
751#define MEM_ERROR_VALID_CE 0x4000000000000000
752
753#define PROTO_ERROR_VALID_MASK 0x8000000000000000
754
755#define MISC_ERROR_VALID_MASK 0x3ff
756
757/*
758 * Mask for hspec address that is stored in the dir error register.
759 * This represents bits 29 through 3.
760 */
761#define DIR_ERR_HSPEC_MASK 0x3ffffff8
762#define ERROR_HSPEC_MASK 0x3ffffff8
763#define ERROR_HSPEC_SHFT 3
764#define ERROR_ADDR_MASK 0xfffffff8
765#define ERROR_ADDR_SHFT 3
766
767/*
768 * MD_MISC_ERROR register defines.
769 */
770
771#define MMCE_VALID_MASK 0x3ff
772#define MMCE_ILL_MSG_SHFT 8
773#define MMCE_ILL_MSG_MASK (UINT64_CAST 0x03 << MMCE_ILL_MSG_SHFT)
774#define MMCE_ILL_REV_SHFT 6
775#define MMCE_ILL_REV_MASK (UINT64_CAST 0x03 << MMCE_ILL_REV_SHFT)
776#define MMCE_LONG_PACK_SHFT 4
777#define MMCE_LONG_PACK_MASK (UINT64_CAST 0x03 << MMCE_lONG_PACK_SHFT)
778#define MMCE_SHORT_PACK_SHFT 2
779#define MMCE_SHORT_PACK_MASK (UINT64_CAST 0x03 << MMCE_SHORT_PACK_SHFT)
780#define MMCE_BAD_DATA_SHFT 0
781#define MMCE_BAD_DATA_MASK (UINT64_CAST 0x03 << MMCE_BAD_DATA_SHFT)
782
783
784#define MD_PERF_COUNTERS 6
785#define MD_PERF_SETS 6
786
787#define MEM_DIMM_MASK 0xe0000000
788#define MEM_DIMM_SHFT 29
789
790#endif /* _ASM_SN_SN0_HUBMD_H */
diff --git a/include/asm-mips/sn/sn0/hubni.h b/include/asm-mips/sn/sn0/hubni.h
new file mode 100644
index 000000000000..b40d3ef97a12
--- /dev/null
+++ b/include/asm-mips/sn/sn0/hubni.h
@@ -0,0 +1,255 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/SN0/hubni.h>, Revision 1.27.
7 *
8 * Copyright (C) 1992-1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SGI_SN0_HUBNI_H
12#define _ASM_SGI_SN0_HUBNI_H
13
14#ifndef __ASSEMBLY__
15#include <linux/types.h>
16#endif
17
18/*
19 * Hub Network Interface registers
20 *
21 * All registers in this file are subject to change until Hub chip tapeout.
22 */
23
24#define NI_BASE 0x600000
25#define NI_BASE_TABLES 0x630000
26
27#define NI_STATUS_REV_ID 0x600000 /* Hub network status, rev, and ID */
28#define NI_PORT_RESET 0x600008 /* Reset the network interface */
29#define NI_PROTECTION 0x600010 /* NI register access permissions */
30#define NI_GLOBAL_PARMS 0x600018 /* LLP parameters */
31#define NI_SCRATCH_REG0 0x600100 /* Scratch register 0 (64 bits) */
32#define NI_SCRATCH_REG1 0x600108 /* Scratch register 1 (64 bits) */
33#define NI_DIAG_PARMS 0x600110 /* Parameters for diags */
34
35#define NI_VECTOR_PARMS 0x600200 /* Vector PIO routing parameters */
36#define NI_VECTOR 0x600208 /* Vector PIO route */
37#define NI_VECTOR_DATA 0x600210 /* Vector PIO data */
38#define NI_VECTOR_STATUS 0x600300 /* Vector PIO return status */
39#define NI_RETURN_VECTOR 0x600308 /* Vector PIO return vector */
40#define NI_VECTOR_READ_DATA 0x600310 /* Vector PIO read data */
41#define NI_VECTOR_CLEAR 0x600380 /* Vector PIO read & clear status */
42
43#define NI_IO_PROTECT 0x600400 /* PIO protection bits */
44#define NI_IO_PROT_OVRRD 0x600408 /* PIO protection bit override */
45
46#define NI_AGE_CPU0_MEMORY 0x600500 /* CPU 0 memory age control */
47#define NI_AGE_CPU0_PIO 0x600508 /* CPU 0 PIO age control */
48#define NI_AGE_CPU1_MEMORY 0x600510 /* CPU 1 memory age control */
49#define NI_AGE_CPU1_PIO 0x600518 /* CPU 1 PIO age control */
50#define NI_AGE_GBR_MEMORY 0x600520 /* GBR memory age control */
51#define NI_AGE_GBR_PIO 0x600528 /* GBR PIO age control */
52#define NI_AGE_IO_MEMORY 0x600530 /* IO memory age control */
53#define NI_AGE_IO_PIO 0x600538 /* IO PIO age control */
54#define NI_AGE_REG_MIN NI_AGE_CPU0_MEMORY
55#define NI_AGE_REG_MAX NI_AGE_IO_PIO
56
57#define NI_PORT_PARMS 0x608000 /* LLP Parameters */
58#define NI_PORT_ERROR 0x608008 /* LLP Errors */
59#define NI_PORT_ERROR_CLEAR 0x608088 /* Clear the error bits */
60
61#define NI_META_TABLE0 0x638000 /* First meta routing table entry */
62#define NI_META_TABLE(_x) (NI_META_TABLE0 + (8 * (_x)))
63#define NI_META_ENTRIES 32
64
65#define NI_LOCAL_TABLE0 0x638100 /* First local routing table entry */
66#define NI_LOCAL_TABLE(_x) (NI_LOCAL_TABLE0 + (8 * (_x)))
67#define NI_LOCAL_ENTRIES 16
68
69/*
70 * NI_STATUS_REV_ID mask and shift definitions
71 * Have to use UINT64_CAST instead of 'L' suffix, for assembler.
72 */
73
74#define NSRI_8BITMODE_SHFT 30
75#define NSRI_8BITMODE_MASK (UINT64_CAST 0x1 << 30)
76#define NSRI_LINKUP_SHFT 29
77#define NSRI_LINKUP_MASK (UINT64_CAST 0x1 << 29)
78#define NSRI_DOWNREASON_SHFT 28 /* 0=failed, 1=never came */
79#define NSRI_DOWNREASON_MASK (UINT64_CAST 0x1 << 28) /* out of reset. */
80#define NSRI_MORENODES_SHFT 18
81#define NSRI_MORENODES_MASK (UINT64_CAST 1 << 18) /* Max. # of nodes */
82#define MORE_MEMORY 0
83#define MORE_NODES 1
84#define NSRI_REGIONSIZE_SHFT 17
85#define NSRI_REGIONSIZE_MASK (UINT64_CAST 1 << 17) /* Granularity */
86#define REGIONSIZE_FINE 1
87#define REGIONSIZE_COARSE 0
88#define NSRI_NODEID_SHFT 8
89#define NSRI_NODEID_MASK (UINT64_CAST 0x1ff << 8)/* Node (Hub) ID */
90#define NSRI_REV_SHFT 4
91#define NSRI_REV_MASK (UINT64_CAST 0xf << 4) /* Chip Revision */
92#define NSRI_CHIPID_SHFT 0
93#define NSRI_CHIPID_MASK (UINT64_CAST 0xf) /* Chip type ID */
94
95/*
96 * In fine mode, each node is a region. In coarse mode, there are
97 * eight nodes per region.
98 */
99#define NASID_TO_FINEREG_SHFT 0
100#define NASID_TO_COARSEREG_SHFT 3
101
102/* NI_PORT_RESET mask definitions */
103
104#define NPR_PORTRESET (UINT64_CAST 1 << 7) /* Send warm reset */
105#define NPR_LINKRESET (UINT64_CAST 1 << 1) /* Send link reset */
106#define NPR_LOCALRESET (UINT64_CAST 1) /* Reset entire hub */
107
108/* NI_PROTECTION mask and shift definitions */
109
110#define NPROT_RESETOK (UINT64_CAST 1)
111
112/* NI_GLOBAL_PARMS mask and shift definitions */
113
114#define NGP_MAXRETRY_SHFT 48 /* Maximum retries */
115#define NGP_MAXRETRY_MASK (UINT64_CAST 0x3ff << 48)
116#define NGP_TAILTOWRAP_SHFT 32 /* Tail timeout wrap */
117#define NGP_TAILTOWRAP_MASK (UINT64_CAST 0xffff << 32)
118
119#define NGP_CREDITTOVAL_SHFT 16 /* Tail timeout wrap */
120#define NGP_CREDITTOVAL_MASK (UINT64_CAST 0xf << 16)
121#define NGP_TAILTOVAL_SHFT 4 /* Tail timeout value */
122#define NGP_TAILTOVAL_MASK (UINT64_CAST 0xf << 4)
123
124/* NI_DIAG_PARMS mask and shift definitions */
125
126#define NDP_PORTTORESET (UINT64_CAST 1 << 18) /* Port tmout reset */
127#define NDP_LLP8BITMODE (UINT64_CAST 1 << 12) /* LLP 8-bit mode */
128#define NDP_PORTDISABLE (UINT64_CAST 1 << 6) /* Port disable */
129#define NDP_SENDERROR (UINT64_CAST 1) /* Send data error */
130
131/*
132 * NI_VECTOR_PARMS mask and shift definitions.
133 * TYPE may be any of the first four PIOTYPEs defined under NI_VECTOR_STATUS.
134 */
135
136#define NVP_PIOID_SHFT 40
137#define NVP_PIOID_MASK (UINT64_CAST 0x3ff << 40)
138#define NVP_WRITEID_SHFT 32
139#define NVP_WRITEID_MASK (UINT64_CAST 0xff << 32)
140#define NVP_ADDRESS_MASK (UINT64_CAST 0xffff8) /* Bits 19:3 */
141#define NVP_TYPE_SHFT 0
142#define NVP_TYPE_MASK (UINT64_CAST 0x3)
143
144/* NI_VECTOR_STATUS mask and shift definitions */
145
146#define NVS_VALID (UINT64_CAST 1 << 63)
147#define NVS_OVERRUN (UINT64_CAST 1 << 62)
148#define NVS_TARGET_SHFT 51
149#define NVS_TARGET_MASK (UINT64_CAST 0x3ff << 51)
150#define NVS_PIOID_SHFT 40
151#define NVS_PIOID_MASK (UINT64_CAST 0x3ff << 40)
152#define NVS_WRITEID_SHFT 32
153#define NVS_WRITEID_MASK (UINT64_CAST 0xff << 32)
154#define NVS_ADDRESS_MASK (UINT64_CAST 0xfffffff8) /* Bits 31:3 */
155#define NVS_TYPE_SHFT 0
156#define NVS_TYPE_MASK (UINT64_CAST 0x7)
157#define NVS_ERROR_MASK (UINT64_CAST 0x4) /* bit set means error */
158
159
160#define PIOTYPE_READ 0 /* VECTOR_PARMS and VECTOR_STATUS */
161#define PIOTYPE_WRITE 1 /* VECTOR_PARMS and VECTOR_STATUS */
162#define PIOTYPE_UNDEFINED 2 /* VECTOR_PARMS and VECTOR_STATUS */
163#define PIOTYPE_EXCHANGE 3 /* VECTOR_PARMS and VECTOR_STATUS */
164#define PIOTYPE_ADDR_ERR 4 /* VECTOR_STATUS only */
165#define PIOTYPE_CMD_ERR 5 /* VECTOR_STATUS only */
166#define PIOTYPE_PROT_ERR 6 /* VECTOR_STATUS only */
167#define PIOTYPE_UNKNOWN 7 /* VECTOR_STATUS only */
168
169/* NI_AGE_XXX mask and shift definitions */
170
171#define NAGE_VCH_SHFT 10
172#define NAGE_VCH_MASK (UINT64_CAST 3 << 10)
173#define NAGE_CC_SHFT 8
174#define NAGE_CC_MASK (UINT64_CAST 3 << 8)
175#define NAGE_AGE_SHFT 0
176#define NAGE_AGE_MASK (UINT64_CAST 0xff)
177#define NAGE_MASK (NAGE_VCH_MASK | NAGE_CC_MASK | NAGE_AGE_MASK)
178
179#define VCHANNEL_A 0
180#define VCHANNEL_B 1
181#define VCHANNEL_ANY 2
182
183/* NI_PORT_PARMS mask and shift definitions */
184
185#define NPP_NULLTO_SHFT 10
186#define NPP_NULLTO_MASK (UINT64_CAST 0x3f << 16)
187#define NPP_MAXBURST_SHFT 0
188#define NPP_MAXBURST_MASK (UINT64_CAST 0x3ff)
189#define NPP_RESET_DFLT_HUB20 ((UINT64_CAST 1 << NPP_NULLTO_SHFT) | \
190 (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
191#define NPP_RESET_DEFAULTS ((UINT64_CAST 6 << NPP_NULLTO_SHFT) | \
192 (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
193
194
195/* NI_PORT_ERROR mask and shift definitions */
196
197#define NPE_LINKRESET (UINT64_CAST 1 << 37)
198#define NPE_INTERNALERROR (UINT64_CAST 1 << 36)
199#define NPE_BADMESSAGE (UINT64_CAST 1 << 35)
200#define NPE_BADDEST (UINT64_CAST 1 << 34)
201#define NPE_FIFOOVERFLOW (UINT64_CAST 1 << 33)
202#define NPE_CREDITTO_SHFT 28
203#define NPE_CREDITTO_MASK (UINT64_CAST 0xf << 28)
204#define NPE_TAILTO_SHFT 24
205#define NPE_TAILTO_MASK (UINT64_CAST 0xf << 24)
206#define NPE_RETRYCOUNT_SHFT 16
207#define NPE_RETRYCOUNT_MASK (UINT64_CAST 0xff << 16)
208#define NPE_CBERRCOUNT_SHFT 8
209#define NPE_CBERRCOUNT_MASK (UINT64_CAST 0xff << 8)
210#define NPE_SNERRCOUNT_SHFT 0
211#define NPE_SNERRCOUNT_MASK (UINT64_CAST 0xff << 0)
212#define NPE_MASK 0x3effffffff
213
214#define NPE_COUNT_MAX 0xff
215
216#define NPE_FATAL_ERRORS (NPE_LINKRESET | NPE_INTERNALERROR | \
217 NPE_BADMESSAGE | NPE_BADDEST | \
218 NPE_FIFOOVERFLOW | NPE_CREDITTO_MASK | \
219 NPE_TAILTO_MASK)
220
221/* NI_META_TABLE mask and shift definitions */
222
223#define NMT_EXIT_PORT_MASK (UINT64_CAST 0xf)
224
225/* NI_LOCAL_TABLE mask and shift definitions */
226
227#define NLT_EXIT_PORT_MASK (UINT64_CAST 0xf)
228
229#ifndef __ASSEMBLY__
230
231typedef union hubni_port_error_u {
232 u64 nipe_reg_value;
233 struct {
234 u64 nipe_rsvd: 26, /* unused */
235 nipe_lnk_reset: 1, /* link reset */
236 nipe_intl_err: 1, /* internal error */
237 nipe_bad_msg: 1, /* bad message */
238 nipe_bad_dest: 1, /* bad dest */
239 nipe_fifo_ovfl: 1, /* fifo overflow */
240 nipe_rsvd1: 1, /* unused */
241 nipe_credit_to: 4, /* credit timeout */
242 nipe_tail_to: 4, /* tail timeout */
243 nipe_retry_cnt: 8, /* retry error count */
244 nipe_cb_cnt: 8, /* checkbit error count */
245 nipe_sn_cnt: 8; /* sequence number count */
246 } nipe_fields_s;
247} hubni_port_error_t;
248
249#define NI_LLP_RETRY_MAX 0xff
250#define NI_LLP_CB_MAX 0xff
251#define NI_LLP_SN_MAX 0xff
252
253#endif /* !__ASSEMBLY__ */
254
255#endif /* _ASM_SGI_SN0_HUBNI_H */
diff --git a/include/asm-mips/sn/sn0/hubpi.h b/include/asm-mips/sn/sn0/hubpi.h
new file mode 100644
index 000000000000..355bba8552e3
--- /dev/null
+++ b/include/asm-mips/sn/sn0/hubpi.h
@@ -0,0 +1,427 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/SN0/hubpi.h>, revision 1.28.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SN_SN0_HUBPI_H
12#define _ASM_SN_SN0_HUBPI_H
13
14#include <linux/types.h>
15
16/*
17 * Hub I/O interface registers
18 *
19 * All registers in this file are subject to change until Hub chip tapeout.
20 * All register "addresses" are actually offsets. Use the LOCAL_HUB
21 * or REMOTE_HUB macros to synthesize an actual address
22 */
23
24#define PI_BASE 0x000000
25
26/* General protection and control registers */
27
28#define PI_CPU_PROTECT 0x000000 /* CPU Protection */
29#define PI_PROT_OVERRD 0x000008 /* Clear CPU Protection bit */
30#define PI_IO_PROTECT 0x000010 /* Interrupt Pending Protection */
31#define PI_REGION_PRESENT 0x000018 /* Indicates whether region exists */
32#define PI_CPU_NUM 0x000020 /* CPU Number ID */
33#define PI_CALIAS_SIZE 0x000028 /* Cached Alias Size */
34#define PI_MAX_CRB_TIMEOUT 0x000030 /* Maximum Timeout for CRB */
35#define PI_CRB_SFACTOR 0x000038 /* Scale factor for CRB timeout */
36
37/* CALIAS values */
38#define PI_CALIAS_SIZE_0 0
39#define PI_CALIAS_SIZE_4K 1
40#define PI_CALIAS_SIZE_8K 2
41#define PI_CALIAS_SIZE_16K 3
42#define PI_CALIAS_SIZE_32K 4
43#define PI_CALIAS_SIZE_64K 5
44#define PI_CALIAS_SIZE_128K 6
45#define PI_CALIAS_SIZE_256K 7
46#define PI_CALIAS_SIZE_512K 8
47#define PI_CALIAS_SIZE_1M 9
48#define PI_CALIAS_SIZE_2M 10
49#define PI_CALIAS_SIZE_4M 11
50#define PI_CALIAS_SIZE_8M 12
51#define PI_CALIAS_SIZE_16M 13
52#define PI_CALIAS_SIZE_32M 14
53#define PI_CALIAS_SIZE_64M 15
54
55/* Processor control and status checking */
56
57#define PI_CPU_PRESENT_A 0x000040 /* CPU Present A */
58#define PI_CPU_PRESENT_B 0x000048 /* CPU Present B */
59#define PI_CPU_ENABLE_A 0x000050 /* CPU Enable A */
60#define PI_CPU_ENABLE_B 0x000058 /* CPU Enable B */
61#define PI_REPLY_LEVEL 0x000060 /* Reply Level */
62#define PI_HARDRESET_BIT 0x020068 /* Bit cleared by s/w on SR */
63#define PI_NMI_A 0x000070 /* NMI to CPU A */
64#define PI_NMI_B 0x000078 /* NMI to CPU B */
65#define PI_NMI_OFFSET (PI_NMI_B - PI_NMI_A)
66#define PI_SOFTRESET 0x000080 /* Softreset (to both CPUs) */
67
68/* Regular Interrupt register checking. */
69
70#define PI_INT_PEND_MOD 0x000090 /* Write to set pending ints */
71#define PI_INT_PEND0 0x000098 /* Read to get pending ints */
72#define PI_INT_PEND1 0x0000a0 /* Read to get pending ints */
73#define PI_INT_MASK0_A 0x0000a8 /* Interrupt Mask 0 for CPU A */
74#define PI_INT_MASK1_A 0x0000b0 /* Interrupt Mask 1 for CPU A */
75#define PI_INT_MASK0_B 0x0000b8 /* Interrupt Mask 0 for CPU B */
76#define PI_INT_MASK1_B 0x0000c0 /* Interrupt Mask 1 for CPU B */
77
78#define PI_INT_MASK_OFFSET 0x10 /* Offset from A to B */
79
80/* Crosscall interrupts */
81
82#define PI_CC_PEND_SET_A 0x0000c8 /* CC Interrupt Pending Set, CPU A */
83#define PI_CC_PEND_SET_B 0x0000d0 /* CC Interrupt Pending Set, CPU B */
84#define PI_CC_PEND_CLR_A 0x0000d8 /* CC Interrupt Pending Clr, CPU A */
85#define PI_CC_PEND_CLR_B 0x0000e0 /* CC Interrupt Pending Clr, CPU B */
86#define PI_CC_MASK 0x0000e8 /* CC Interrupt mask */
87
88#define PI_INT_SET_OFFSET 0x08 /* Offset from A to B */
89
90/* Realtime Counter and Profiler control registers */
91
92#define PI_RT_COUNT 0x030100 /* Real Time Counter */
93#define PI_RT_COMPARE_A 0x000108 /* Real Time Compare A */
94#define PI_RT_COMPARE_B 0x000110 /* Real Time Compare B */
95#define PI_PROFILE_COMPARE 0x000118 /* L5 int to both cpus when == RTC */
96#define PI_RT_PEND_A 0x000120 /* Set if RT int for A pending */
97#define PI_RT_PEND_B 0x000128 /* Set if RT int for B pending */
98#define PI_PROF_PEND_A 0x000130 /* Set if Prof int for A pending */
99#define PI_PROF_PEND_B 0x000138 /* Set if Prof int for B pending */
100#define PI_RT_EN_A 0x000140 /* RT int for CPU A enable */
101#define PI_RT_EN_B 0x000148 /* RT int for CPU B enable */
102#define PI_PROF_EN_A 0x000150 /* PROF int for CPU A enable */
103#define PI_PROF_EN_B 0x000158 /* PROF int for CPU B enable */
104#define PI_RT_LOCAL_CTRL 0x000160 /* RT control register */
105#define PI_RT_FILTER_CTRL 0x000168 /* GCLK Filter control register */
106
107#define PI_COUNT_OFFSET 0x08 /* A to B offset for all counts */
108
109/* Built-In Self Test support */
110
111#define PI_BIST_WRITE_DATA 0x000200 /* BIST write data */
112#define PI_BIST_READ_DATA 0x000208 /* BIST read data */
113#define PI_BIST_COUNT_TARG 0x000210 /* BIST Count and Target */
114#define PI_BIST_READY 0x000218 /* BIST Ready indicator */
115#define PI_BIST_SHIFT_LOAD 0x000220 /* BIST control */
116#define PI_BIST_SHIFT_UNLOAD 0x000228 /* BIST control */
117#define PI_BIST_ENTER_RUN 0x000230 /* BIST control */
118
119/* Graphics control registers */
120
121#define PI_GFX_PAGE_A 0x000300 /* Graphics page A */
122#define PI_GFX_CREDIT_CNTR_A 0x000308 /* Graphics credit counter A */
123#define PI_GFX_BIAS_A 0x000310 /* Graphics bias A */
124#define PI_GFX_INT_CNTR_A 0x000318 /* Graphics interrupt counter A */
125#define PI_GFX_INT_CMP_A 0x000320 /* Graphics interrupt comparator A */
126#define PI_GFX_PAGE_B 0x000328 /* Graphics page B */
127#define PI_GFX_CREDIT_CNTR_B 0x000330 /* Graphics credit counter B */
128#define PI_GFX_BIAS_B 0x000338 /* Graphics bias B */
129#define PI_GFX_INT_CNTR_B 0x000340 /* Graphics interrupt counter B */
130#define PI_GFX_INT_CMP_B 0x000348 /* Graphics interrupt comparator B */
131
132#define PI_GFX_OFFSET (PI_GFX_PAGE_B - PI_GFX_PAGE_A)
133#define PI_GFX_PAGE_ENABLE 0x0000010000000000LL
134
135/* Error and timeout registers */
136#define PI_ERR_INT_PEND 0x000400 /* Error Interrupt Pending */
137#define PI_ERR_INT_MASK_A 0x000408 /* Error Interrupt mask for CPU A */
138#define PI_ERR_INT_MASK_B 0x000410 /* Error Interrupt mask for CPU B */
139#define PI_ERR_STACK_ADDR_A 0x000418 /* Error stack address for CPU A */
140#define PI_ERR_STACK_ADDR_B 0x000420 /* Error stack address for CPU B */
141#define PI_ERR_STACK_SIZE 0x000428 /* Error Stack Size */
142#define PI_ERR_STATUS0_A 0x000430 /* Error Status 0A */
143#define PI_ERR_STATUS0_A_RCLR 0x000438 /* Error Status 0A clear on read */
144#define PI_ERR_STATUS1_A 0x000440 /* Error Status 1A */
145#define PI_ERR_STATUS1_A_RCLR 0x000448 /* Error Status 1A clear on read */
146#define PI_ERR_STATUS0_B 0x000450 /* Error Status 0B */
147#define PI_ERR_STATUS0_B_RCLR 0x000458 /* Error Status 0B clear on read */
148#define PI_ERR_STATUS1_B 0x000460 /* Error Status 1B */
149#define PI_ERR_STATUS1_B_RCLR 0x000468 /* Error Status 1B clear on read */
150#define PI_SPOOL_CMP_A 0x000470 /* Spool compare for CPU A */
151#define PI_SPOOL_CMP_B 0x000478 /* Spool compare for CPU B */
152#define PI_CRB_TIMEOUT_A 0x000480 /* Timed out CRB entries for A */
153#define PI_CRB_TIMEOUT_B 0x000488 /* Timed out CRB entries for B */
154#define PI_SYSAD_ERRCHK_EN 0x000490 /* Enables SYSAD error checking */
155#define PI_BAD_CHECK_BIT_A 0x000498 /* Force SYSAD check bit error */
156#define PI_BAD_CHECK_BIT_B 0x0004a0 /* Force SYSAD check bit error */
157#define PI_NACK_CNT_A 0x0004a8 /* Consecutive NACK counter */
158#define PI_NACK_CNT_B 0x0004b0 /* " " for CPU B */
159#define PI_NACK_CMP 0x0004b8 /* NACK count compare */
160#define PI_STACKADDR_OFFSET (PI_ERR_STACK_ADDR_B - PI_ERR_STACK_ADDR_A)
161#define PI_ERRSTAT_OFFSET (PI_ERR_STATUS0_B - PI_ERR_STATUS0_A)
162#define PI_RDCLR_OFFSET (PI_ERR_STATUS0_A_RCLR - PI_ERR_STATUS0_A)
163
164/* Bits in PI_ERR_INT_PEND */
165#define PI_ERR_SPOOL_CMP_B 0x00000001 /* Spool end hit high water */
166#define PI_ERR_SPOOL_CMP_A 0x00000002
167#define PI_ERR_SPUR_MSG_B 0x00000004 /* Spurious message intr. */
168#define PI_ERR_SPUR_MSG_A 0x00000008
169#define PI_ERR_WRB_TERR_B 0x00000010 /* WRB TERR */
170#define PI_ERR_WRB_TERR_A 0x00000020
171#define PI_ERR_WRB_WERR_B 0x00000040 /* WRB WERR */
172#define PI_ERR_WRB_WERR_A 0x00000080
173#define PI_ERR_SYSSTATE_B 0x00000100 /* SysState parity error */
174#define PI_ERR_SYSSTATE_A 0x00000200
175#define PI_ERR_SYSAD_DATA_B 0x00000400 /* SysAD data parity error */
176#define PI_ERR_SYSAD_DATA_A 0x00000800
177#define PI_ERR_SYSAD_ADDR_B 0x00001000 /* SysAD addr parity error */
178#define PI_ERR_SYSAD_ADDR_A 0x00002000
179#define PI_ERR_SYSCMD_DATA_B 0x00004000 /* SysCmd data parity error */
180#define PI_ERR_SYSCMD_DATA_A 0x00008000
181#define PI_ERR_SYSCMD_ADDR_B 0x00010000 /* SysCmd addr parity error */
182#define PI_ERR_SYSCMD_ADDR_A 0x00020000
183#define PI_ERR_BAD_SPOOL_B 0x00040000 /* Error spooling to memory */
184#define PI_ERR_BAD_SPOOL_A 0x00080000
185#define PI_ERR_UNCAC_UNCORR_B 0x00100000 /* Uncached uncorrectable */
186#define PI_ERR_UNCAC_UNCORR_A 0x00200000
187#define PI_ERR_SYSSTATE_TAG_B 0x00400000 /* SysState tag parity error */
188#define PI_ERR_SYSSTATE_TAG_A 0x00800000
189#define PI_ERR_MD_UNCORR 0x01000000 /* Must be cleared in MD */
190
191#define PI_ERR_CLEAR_ALL_A 0x00aaaaaa
192#define PI_ERR_CLEAR_ALL_B 0x00555555
193
194
195/*
196 * The following three macros define all possible error int pends.
197 */
198
199#define PI_FATAL_ERR_CPU_A (PI_ERR_SYSSTATE_TAG_A | \
200 PI_ERR_BAD_SPOOL_A | \
201 PI_ERR_SYSCMD_ADDR_A | \
202 PI_ERR_SYSCMD_DATA_A | \
203 PI_ERR_SYSAD_ADDR_A | \
204 PI_ERR_SYSAD_DATA_A | \
205 PI_ERR_SYSSTATE_A)
206
207#define PI_MISC_ERR_CPU_A (PI_ERR_UNCAC_UNCORR_A | \
208 PI_ERR_WRB_WERR_A | \
209 PI_ERR_WRB_TERR_A | \
210 PI_ERR_SPUR_MSG_A | \
211 PI_ERR_SPOOL_CMP_A)
212
213#define PI_FATAL_ERR_CPU_B (PI_ERR_SYSSTATE_TAG_B | \
214 PI_ERR_BAD_SPOOL_B | \
215 PI_ERR_SYSCMD_ADDR_B | \
216 PI_ERR_SYSCMD_DATA_B | \
217 PI_ERR_SYSAD_ADDR_B | \
218 PI_ERR_SYSAD_DATA_B | \
219 PI_ERR_SYSSTATE_B)
220
221#define PI_MISC_ERR_CPU_B (PI_ERR_UNCAC_UNCORR_B | \
222 PI_ERR_WRB_WERR_B | \
223 PI_ERR_WRB_TERR_B | \
224 PI_ERR_SPUR_MSG_B | \
225 PI_ERR_SPOOL_CMP_B)
226
227#define PI_ERR_GENERIC (PI_ERR_MD_UNCORR)
228
229/*
230 * Error types for PI_ERR_STATUS0_[AB] and error stack:
231 * Use the write types if WRBRRB is 1 else use the read types
232 */
233
234/* Fields in PI_ERR_STATUS0_[AB] */
235#define PI_ERR_ST0_TYPE_MASK 0x0000000000000007
236#define PI_ERR_ST0_TYPE_SHFT 0
237#define PI_ERR_ST0_REQNUM_MASK 0x0000000000000038
238#define PI_ERR_ST0_REQNUM_SHFT 3
239#define PI_ERR_ST0_SUPPL_MASK 0x000000000001ffc0
240#define PI_ERR_ST0_SUPPL_SHFT 6
241#define PI_ERR_ST0_CMD_MASK 0x0000000001fe0000
242#define PI_ERR_ST0_CMD_SHFT 17
243#define PI_ERR_ST0_ADDR_MASK 0x3ffffffffe000000
244#define PI_ERR_ST0_ADDR_SHFT 25
245#define PI_ERR_ST0_OVERRUN_MASK 0x4000000000000000
246#define PI_ERR_ST0_OVERRUN_SHFT 62
247#define PI_ERR_ST0_VALID_MASK 0x8000000000000000
248#define PI_ERR_ST0_VALID_SHFT 63
249
250/* Fields in PI_ERR_STATUS1_[AB] */
251#define PI_ERR_ST1_SPOOL_MASK 0x00000000001fffff
252#define PI_ERR_ST1_SPOOL_SHFT 0
253#define PI_ERR_ST1_TOUTCNT_MASK 0x000000001fe00000
254#define PI_ERR_ST1_TOUTCNT_SHFT 21
255#define PI_ERR_ST1_INVCNT_MASK 0x0000007fe0000000
256#define PI_ERR_ST1_INVCNT_SHFT 29
257#define PI_ERR_ST1_CRBNUM_MASK 0x0000038000000000
258#define PI_ERR_ST1_CRBNUM_SHFT 39
259#define PI_ERR_ST1_WRBRRB_MASK 0x0000040000000000
260#define PI_ERR_ST1_WRBRRB_SHFT 42
261#define PI_ERR_ST1_CRBSTAT_MASK 0x001ff80000000000
262#define PI_ERR_ST1_CRBSTAT_SHFT 43
263#define PI_ERR_ST1_MSGSRC_MASK 0xffe0000000000000
264#define PI_ERR_ST1_MSGSRC_SHFT 53
265
266/* Fields in the error stack */
267#define PI_ERR_STK_TYPE_MASK 0x0000000000000003
268#define PI_ERR_STK_TYPE_SHFT 0
269#define PI_ERR_STK_SUPPL_MASK 0x0000000000000038
270#define PI_ERR_STK_SUPPL_SHFT 3
271#define PI_ERR_STK_REQNUM_MASK 0x00000000000001c0
272#define PI_ERR_STK_REQNUM_SHFT 6
273#define PI_ERR_STK_CRBNUM_MASK 0x0000000000000e00
274#define PI_ERR_STK_CRBNUM_SHFT 9
275#define PI_ERR_STK_WRBRRB_MASK 0x0000000000001000
276#define PI_ERR_STK_WRBRRB_SHFT 12
277#define PI_ERR_STK_CRBSTAT_MASK 0x00000000007fe000
278#define PI_ERR_STK_CRBSTAT_SHFT 13
279#define PI_ERR_STK_CMD_MASK 0x000000007f800000
280#define PI_ERR_STK_CMD_SHFT 23
281#define PI_ERR_STK_ADDR_MASK 0xffffffff80000000
282#define PI_ERR_STK_ADDR_SHFT 31
283
284/* Error type in the error status or stack on Read CRBs */
285#define PI_ERR_RD_PRERR 1
286#define PI_ERR_RD_DERR 2
287#define PI_ERR_RD_TERR 3
288
289/* Error type in the error status or stack on Write CRBs */
290#define PI_ERR_WR_WERR 0
291#define PI_ERR_WR_PWERR 1
292#define PI_ERR_WR_TERR 3
293
294/* Read or Write CRB in error status or stack */
295#define PI_ERR_RRB 0
296#define PI_ERR_WRB 1
297#define PI_ERR_ANY_CRB 2
298
299/* Address masks in the error status and error stack are not the same */
300#define ERR_STK_ADDR_SHFT 7
301#define ERR_STAT0_ADDR_SHFT 3
302
303#define PI_MIN_STACK_SIZE 4096 /* For figuring out the size to set */
304#define PI_STACK_SIZE_SHFT 12 /* 4k */
305
306#define ERR_STACK_SIZE_BYTES(_sz) \
307 ((_sz) ? (PI_MIN_STACK_SIZE << ((_sz) - 1)) : 0)
308
309#ifndef __ASSEMBLY__
310/*
311 * format of error stack and error status registers.
312 */
313
314struct err_stack_format {
315 u64 sk_addr : 33, /* address */
316 sk_cmd : 8, /* message command */
317 sk_crb_sts : 10, /* status from RRB or WRB */
318 sk_rw_rb : 1, /* RRB == 0, WRB == 1 */
319 sk_crb_num : 3, /* WRB (0 to 7) or RRB (0 to 4) */
320 sk_t5_req : 3, /* RRB T5 request number */
321 sk_suppl : 3, /* lowest 3 bit of supplemental */
322 sk_err_type: 3; /* error type */
323};
324
325typedef union pi_err_stack {
326 u64 pi_stk_word;
327 struct err_stack_format pi_stk_fmt;
328} pi_err_stack_t;
329
330struct err_status0_format {
331 u64 s0_valid : 1, /* Valid */
332 s0_ovr_run : 1, /* Overrun, spooled to memory */
333 s0_addr : 37, /* address */
334 s0_cmd : 8, /* message command */
335 s0_supl : 11, /* message supplemental field */
336 s0_t5_req : 3, /* RRB T5 request number */
337 s0_err_type: 3; /* error type */
338};
339
340typedef union pi_err_stat0 {
341 u64 pi_stat0_word;
342 struct err_status0_format pi_stat0_fmt;
343} pi_err_stat0_t;
344
345struct err_status1_format {
346 u64 s1_src : 11, /* message source */
347 s1_crb_sts : 10, /* status from RRB or WRB */
348 s1_rw_rb : 1, /* RRB == 0, WRB == 1 */
349 s1_crb_num : 3, /* WRB (0 to 7) or RRB (0 to 4) */
350 s1_inval_cnt:10, /* signed invalidate counter RRB */
351 s1_to_cnt : 8, /* crb timeout counter */
352 s1_spl_cnt : 21; /* number spooled to memory */
353};
354
355typedef union pi_err_stat1 {
356 u64 pi_stat1_word;
357 struct err_status1_format pi_stat1_fmt;
358} pi_err_stat1_t;
359
360typedef u64 rtc_time_t;
361
362#endif /* !__ASSEMBLY__ */
363
364
365/* Bits in PI_SYSAD_ERRCHK_EN */
366#define PI_SYSAD_ERRCHK_ECCGEN 0x01 /* Enable ECC generation */
367#define PI_SYSAD_ERRCHK_QUALGEN 0x02 /* Enable data quality signal gen. */
368#define PI_SYSAD_ERRCHK_SADP 0x04 /* Enable SysAD parity checking */
369#define PI_SYSAD_ERRCHK_CMDP 0x08 /* Enable SysCmd parity checking */
370#define PI_SYSAD_ERRCHK_STATE 0x10 /* Enable SysState parity checking */
371#define PI_SYSAD_ERRCHK_QUAL 0x20 /* Enable data quality checking */
372#define PI_SYSAD_CHECK_ALL 0x3f /* Generate and check all signals. */
373
374/* Interrupt pending bits on R10000 */
375
376#define HUB_IP_PEND0 0x0400
377#define HUB_IP_PEND1_CC 0x0800
378#define HUB_IP_RT 0x1000
379#define HUB_IP_PROF 0x2000
380#define HUB_IP_ERROR 0x4000
381#define HUB_IP_MASK 0x7c00
382
383/* PI_RT_LOCAL_CTRL mask and shift definitions */
384
385#define PRLC_USE_INT_SHFT 16
386#define PRLC_USE_INT_MASK (UINT64_CAST 1 << 16)
387#define PRLC_USE_INT (UINT64_CAST 1 << 16)
388#define PRLC_GCLK_SHFT 15
389#define PRLC_GCLK_MASK (UINT64_CAST 1 << 15)
390#define PRLC_GCLK (UINT64_CAST 1 << 15)
391#define PRLC_GCLK_COUNT_SHFT 8
392#define PRLC_GCLK_COUNT_MASK (UINT64_CAST 0x7f << 8)
393#define PRLC_MAX_COUNT_SHFT 1
394#define PRLC_MAX_COUNT_MASK (UINT64_CAST 0x7f << 1)
395#define PRLC_GCLK_EN_SHFT 0
396#define PRLC_GCLK_EN_MASK (UINT64_CAST 1)
397#define PRLC_GCLK_EN (UINT64_CAST 1)
398
399/* PI_RT_FILTER_CTRL mask and shift definitions */
400
401#if 0
402/*
403 * XXX - This register's definition has changed, but it's only implemented
404 * in Hub 2.
405 */
406#define PRFC_DROP_COUNT_SHFT 27
407#define PRFC_DROP_COUNT_MASK (UINT64_CAST 0x3ff << 27)
408#define PRFC_DROP_CTR_SHFT 18
409#define PRFC_DROP_CTR_MASK (UINT64_CAST 0x1ff << 18)
410#define PRFC_MASK_ENABLE_SHFT 10
411#define PRFC_MASK_ENABLE_MASK (UINT64_CAST 0x7f << 10)
412#define PRFC_MASK_CTR_SHFT 2
413#define PRFC_MASK_CTR_MASK (UINT64_CAST 0xff << 2)
414#define PRFC_OFFSET_SHFT 0
415#define PRFC_OFFSET_MASK (UINT64_CAST 3)
416#endif /* 0 */
417
418
419/*
420 * Bits for NACK_CNT_A/B and NACK_CMP
421 */
422#define PI_NACK_CNT_EN_SHFT 20
423#define PI_NACK_CNT_EN_MASK 0x100000
424#define PI_NACK_CNT_MASK 0x0fffff
425#define PI_NACK_CNT_MAX 0x0fffff
426
427#endif /* _ASM_SN_SN0_HUBPI_H */
diff --git a/include/asm-mips/sn/sn0/ip27.h b/include/asm-mips/sn/sn0/ip27.h
new file mode 100644
index 000000000000..ade0e974dd78
--- /dev/null
+++ b/include/asm-mips/sn/sn0/ip27.h
@@ -0,0 +1,92 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/SN0/IP27.h>.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SN_SN0_IP27_H
12#define _ASM_SN_SN0_IP27_H
13
14#include <asm/mipsregs.h>
15
16/*
17 * Simple definitions for the masks which remove SW bits from pte.
18 */
19
20#define TLBLO_HWBITSHIFT 0 /* Shift value, for masking */
21
22#ifndef __ASSEMBLY__
23
24#define CAUSE_BERRINTR IE_IRQ5
25
26#define ECCF_CACHE_ERR 0
27#define ECCF_TAGLO 1
28#define ECCF_ECC 2
29#define ECCF_ERROREPC 3
30#define ECCF_PADDR 4
31#define ECCF_SIZE (5 * sizeof(long))
32
33#endif /* !__ASSEMBLY__ */
34
35#ifdef __ASSEMBLY__
36
37/*
38 * KL_GET_CPUNUM (similar to EV_GET_SPNUM for EVEREST platform) reads
39 * the processor number of the calling processor. The proc parameters
40 * must be a register.
41 */
42#define KL_GET_CPUNUM(proc) \
43 dli proc, LOCAL_HUB(0); \
44 ld proc, PI_CPU_NUM(proc)
45
46#endif /* __ASSEMBLY__ */
47
48/*
49 * R10000 status register interrupt bit mask usage for IP27.
50 */
51#define SRB_SWTIMO IE_SW0 /* 0x0100 */
52#define SRB_NET IE_SW1 /* 0x0200 */
53#define SRB_DEV0 IE_IRQ0 /* 0x0400 */
54#define SRB_DEV1 IE_IRQ1 /* 0x0800 */
55#define SRB_TIMOCLK IE_IRQ2 /* 0x1000 */
56#define SRB_PROFCLK IE_IRQ3 /* 0x2000 */
57#define SRB_ERR IE_IRQ4 /* 0x4000 */
58#define SRB_SCHEDCLK IE_IRQ5 /* 0x8000 */
59
60#define SR_IBIT_HI SRB_DEV0
61#define SR_IBIT_PROF SRB_PROFCLK
62
63#define SRB_SWTIMO_IDX 0
64#define SRB_NET_IDX 1
65#define SRB_DEV0_IDX 2
66#define SRB_DEV1_IDX 3
67#define SRB_TIMOCLK_IDX 4
68#define SRB_PROFCLK_IDX 5
69#define SRB_ERR_IDX 6
70#define SRB_SCHEDCLK_IDX 7
71
72#define NUM_CAUSE_INTRS 8
73
74#define SCACHE_LINESIZE 128
75#define SCACHE_LINEMASK (SCACHE_LINESIZE - 1)
76
77#include <asm/sn/addrs.h>
78
79#define LED_CYCLE_MASK 0x0f
80#define LED_CYCLE_SHFT 4
81
82#define SEND_NMI(_nasid, _slice) \
83 REMOTE_HUB_S((_nasid), (PI_NMI_A + ((_slice) * PI_NMI_OFFSET)), 1)
84
85/* Sanity hazzard ... Below all the Origin hacks are following. */
86
87#define SN00_BRIDGE 0x9200000008000000
88#define SN00I_BRIDGE0 0x920000000b000000
89#define SN00I_BRIDGE1 0x920000000e000000
90#define SN00I_BRIDGE2 0x920000000f000000
91
92#endif /* _ASM_SN_SN0_IP27_H */
diff --git a/include/asm-mips/sn/sn0/sn0_fru.h b/include/asm-mips/sn/sn0/sn0_fru.h
new file mode 100644
index 000000000000..82c6377c275a
--- /dev/null
+++ b/include/asm-mips/sn/sn0/sn0_fru.h
@@ -0,0 +1,44 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Derived from IRIX <sys/SN/SN0/sn0_fru.h>
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silcon Graphics, Inc.
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SN_SN0_SN0_FRU_H
12#define _ASM_SN_SN0_SN0_FRU_H
13
14#define MAX_DIMMS 8 /* max # of dimm banks */
15#define MAX_PCIDEV 8 /* max # of pci devices on a pci bus */
16
17typedef unsigned char confidence_t;
18
19typedef struct kf_mem_s {
20 confidence_t km_confidence; /* confidence level that the memory is bad
21 * is this necessary ?
22 */
23 confidence_t km_dimm[MAX_DIMMS];
24 /* confidence level that dimm[i] is bad
25 *I think this is the right number
26 */
27
28} kf_mem_t;
29
30typedef struct kf_cpu_s {
31 confidence_t kc_confidence; /* confidence level that cpu is bad */
32 confidence_t kc_icache; /* confidence level that instr. cache is bad */
33 confidence_t kc_dcache; /* confidence level that data cache is bad */
34 confidence_t kc_scache; /* confidence level that sec. cache is bad */
35 confidence_t kc_sysbus; /* confidence level that sysad/cmd/state bus is bad */
36} kf_cpu_t;
37
38typedef struct kf_pci_bus_s {
39 confidence_t kpb_belief; /* confidence level that the pci bus is bad */
40 confidence_t kpb_pcidev_belief[MAX_PCIDEV];
41 /* confidence level that the pci dev is bad */
42} kf_pci_bus_t;
43
44#endif /* _ASM_SN_SN0_SN0_FRU_H */
diff --git a/include/asm-mips/sn/sn_private.h b/include/asm-mips/sn/sn_private.h
new file mode 100644
index 000000000000..1a2c3025bf28
--- /dev/null
+++ b/include/asm-mips/sn/sn_private.h
@@ -0,0 +1,19 @@
1#ifndef __ASM_SN_SN_PRIVATE_H
2#define __ASM_SN_SN_PRIVATE_H
3
4#include <asm/sn/types.h>
5
6extern nasid_t master_nasid;
7
8extern void cpu_node_probe(void);
9extern cnodeid_t get_compact_nodeid(void);
10extern void hub_rtc_init(cnodeid_t);
11extern void cpu_time_init(void);
12extern void per_cpu_init(void);
13extern void install_cpu_nmi_handler(int slice);
14extern void install_ipi(void);
15extern void setup_replication_mask(void);
16extern void replicate_kernel_text(void);
17extern pfn_t node_getfirstfree(cnodeid_t);
18
19#endif /* __ASM_SN_SN_PRIVATE_H */
diff --git a/include/asm-mips/sn/types.h b/include/asm-mips/sn/types.h
new file mode 100644
index 000000000000..74d0bb260b86
--- /dev/null
+++ b/include/asm-mips/sn/types.h
@@ -0,0 +1,26 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999 Silicon Graphics, Inc.
7 * Copyright (C) 1999 by Ralf Baechle
8 */
9#ifndef _ASM_SN_TYPES_H
10#define _ASM_SN_TYPES_H
11
12#include <linux/types.h>
13
14typedef unsigned long cpuid_t;
15typedef unsigned long cnodemask_t;
16typedef signed short nasid_t; /* node id in numa-as-id space */
17typedef signed short cnodeid_t; /* node id in compact-id space */
18typedef signed char partid_t; /* partition ID type */
19typedef signed short moduleid_t; /* user-visible module number type */
20typedef signed short cmoduleid_t; /* kernel compact module id type */
21typedef unsigned char clusterid_t; /* Clusterid of the cell */
22typedef unsigned long pfn_t;
23
24typedef dev_t vertex_hdl_t; /* hardware graph vertex handle */
25
26#endif /* _ASM_SN_TYPES_H */
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
new file mode 100644
index 000000000000..b3bc698dfdee
--- /dev/null
+++ b/include/asm-mips/sni.h
@@ -0,0 +1,107 @@
1/*
2 * SNI specific definitions
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1997, 1998 by Ralf Baechle
9 */
10#ifndef __ASM_SNI_H
11#define __ASM_SNI_H
12
13#define SNI_PORT_BASE 0xb4000000
14
15/*
16 * ASIC PCI registers for little endian configuration.
17 */
18#ifndef __MIPSEL__
19#error "Fix me for big endian"
20#endif
21#define PCIMT_UCONF 0xbfff0000
22#define PCIMT_IOADTIMEOUT2 0xbfff0008
23#define PCIMT_IOMEMCONF 0xbfff0010
24#define PCIMT_IOMMU 0xbfff0018
25#define PCIMT_IOADTIMEOUT1 0xbfff0020
26#define PCIMT_DMAACCESS 0xbfff0028
27#define PCIMT_DMAHIT 0xbfff0030
28#define PCIMT_ERRSTATUS 0xbfff0038
29#define PCIMT_ERRADDR 0xbfff0040
30#define PCIMT_SYNDROME 0xbfff0048
31#define PCIMT_ITPEND 0xbfff0050
32#define IT_INT2 0x01
33#define IT_INTD 0x02
34#define IT_INTC 0x04
35#define IT_INTB 0x08
36#define IT_INTA 0x10
37#define IT_EISA 0x20
38#define IT_SCSI 0x40
39#define IT_ETH 0x80
40#define PCIMT_IRQSEL 0xbfff0058
41#define PCIMT_TESTMEM 0xbfff0060
42#define PCIMT_ECCREG 0xbfff0068
43#define PCIMT_CONFIG_ADDRESS 0xbfff0070
44#define PCIMT_ASIC_ID 0xbfff0078 /* read */
45#define PCIMT_SOFT_RESET 0xbfff0078 /* write */
46#define PCIMT_PIA_OE 0xbfff0080
47#define PCIMT_PIA_DATAOUT 0xbfff0088
48#define PCIMT_PIA_DATAIN 0xbfff0090
49#define PCIMT_CACHECONF 0xbfff0098
50#define PCIMT_INVSPACE 0xbfff00a0
51#define PCIMT_PCI_CONF 0xbfff0100
52
53/*
54 * Data port for the PCI bus.
55 */
56#define PCIMT_CONFIG_DATA 0xb4000cfc
57
58/*
59 * Board specific registers
60 */
61#define PCIMT_CSMSR 0xbfd00000
62#define PCIMT_CSSWITCH 0xbfd10000
63#define PCIMT_CSITPEND 0xbfd20000
64#define PCIMT_AUTO_PO_EN 0xbfd30000
65#define PCIMT_CLR_TEMP 0xbfd40000
66#define PCIMT_AUTO_PO_DIS 0xbfd50000
67#define PCIMT_EXMSR 0xbfd60000
68#define PCIMT_UNUSED1 0xbfd70000
69#define PCIMT_CSWCSM 0xbfd80000
70#define PCIMT_UNUSED2 0xbfd90000
71#define PCIMT_CSLED 0xbfda0000
72#define PCIMT_CSMAPISA 0xbfdb0000
73#define PCIMT_CSRSTBP 0xbfdc0000
74#define PCIMT_CLRPOFF 0xbfdd0000
75#define PCIMT_CSTIMER 0xbfde0000
76#define PCIMT_PWDN 0xbfdf0000
77
78/*
79 * Interrupt 0-16 are EISA interrupts. Interrupts from 16 on are assigned
80 * to the other interrupts generated by ASIC PCI.
81 *
82 * INT2 is a wired-or of the push button interrupt, high temperature interrupt
83 * ASIC PCI interrupt.
84 */
85#define PCIMT_KEYBOARD_IRQ 1
86#define PCIMT_IRQ_INT2 16
87#define PCIMT_IRQ_INTD 17
88#define PCIMT_IRQ_INTC 18
89#define PCIMT_IRQ_INTB 19
90#define PCIMT_IRQ_INTA 20
91#define PCIMT_IRQ_EISA 21
92#define PCIMT_IRQ_SCSI 22
93#define PCIMT_IRQ_ETHERNET 23
94#define PCIMT_IRQ_TEMPERATURE 24
95#define PCIMT_IRQ_EISA_NMI 25
96#define PCIMT_IRQ_POWER_OFF 26
97#define PCIMT_IRQ_BUTTON 27
98
99/*
100 * Base address for the mapped 16mb EISA bus segment.
101 */
102#define PCIMT_EISA_BASE 0xb0000000
103
104/* PCI EISA Interrupt acknowledge */
105#define PCIMT_INT_ACKNOWLEDGE 0xba000000
106
107#endif /* __ASM_SNI_H */
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
new file mode 100644
index 000000000000..020b4db70ee5
--- /dev/null
+++ b/include/asm-mips/socket.h
@@ -0,0 +1,102 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1997, 1999, 2000, 2001 Ralf Baechle
7 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SOCKET_H
10#define _ASM_SOCKET_H
11
12#include <asm/sockios.h>
13
14/*
15 * For setsockopt(2)
16 *
17 * This defines are ABI conformant as far as Linux supports these ...
18 */
19#define SOL_SOCKET 0xffff
20
21#define SO_DEBUG 0x0001 /* Record debugging information. */
22#define SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
23#define SO_KEEPALIVE 0x0008 /* Keep connections alive and send
24 SIGPIPE when they die. */
25#define SO_DONTROUTE 0x0010 /* Don't do local routing. */
26#define SO_BROADCAST 0x0020 /* Allow transmission of
27 broadcast messages. */
28#define SO_LINGER 0x0080 /* Block on close of a reliable
29 socket to transmit pending data. */
30#define SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band. */
31#if 0
32To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
33#endif
34
35#define SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */
36#define SO_STYLE SO_TYPE /* Synonym */
37#define SO_ERROR 0x1007 /* get error status and clear */
38#define SO_SNDBUF 0x1001 /* Send buffer size. */
39#define SO_RCVBUF 0x1002 /* Receive buffer. */
40#define SO_SNDLOWAT 0x1003 /* send low-water mark */
41#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
42#define SO_SNDTIMEO 0x1005 /* send timeout */
43#define SO_RCVTIMEO 0x1006 /* receive timeout */
44#define SO_ACCEPTCONN 0x1009
45
46/* linux-specific, might as well be the same as on i386 */
47#define SO_NO_CHECK 11
48#define SO_PRIORITY 12
49#define SO_BSDCOMPAT 14
50
51#define SO_PASSCRED 17
52#define SO_PEERCRED 18
53
54/* Security levels - as per NRL IPv6 - don't actually do anything */
55#define SO_SECURITY_AUTHENTICATION 22
56#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
57#define SO_SECURITY_ENCRYPTION_NETWORK 24
58
59#define SO_BINDTODEVICE 25
60
61/* Socket filtering */
62#define SO_ATTACH_FILTER 26
63#define SO_DETACH_FILTER 27
64
65#define SO_PEERNAME 28
66#define SO_TIMESTAMP 29
67#define SCM_TIMESTAMP SO_TIMESTAMP
68
69#define SO_PEERSEC 30
70
71#ifdef __KERNEL__
72
73/** sock_type - Socket types
74 *
75 * Please notice that for binary compat reasons MIPS has to
76 * override the enum sock_type in include/linux/net.h, so
77 * we define ARCH_HAS_SOCKET_TYPES here.
78 *
79 * @SOCK_DGRAM - datagram (conn.less) socket
80 * @SOCK_STREAM - stream (connection) socket
81 * @SOCK_RAW - raw socket
82 * @SOCK_RDM - reliably-delivered message
83 * @SOCK_SEQPACKET - sequential packet socket
84 * @SOCK_PACKET - linux specific way of getting packets at the dev level.
85 * For writing rarp and other similar things on the user level.
86 */
87enum sock_type {
88 SOCK_DGRAM = 1,
89 SOCK_STREAM = 2,
90 SOCK_RAW = 3,
91 SOCK_RDM = 4,
92 SOCK_SEQPACKET = 5,
93 SOCK_PACKET = 10,
94};
95
96#define SOCK_MAX (SOCK_PACKET + 1)
97
98#define ARCH_HAS_SOCKET_TYPES 1
99
100#endif /* __KERNEL__ */
101
102#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-mips/sockios.h b/include/asm-mips/sockios.h
new file mode 100644
index 000000000000..87a50bf039ed
--- /dev/null
+++ b/include/asm-mips/sockios.h
@@ -0,0 +1,25 @@
1/*
2 * Socket-level I/O control calls.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995 by Ralf Baechle
9 */
10#ifndef _ASM_SOCKIOS_H
11#define _ASM_SOCKIOS_H
12
13#include <asm/ioctl.h>
14
15/* Socket-level I/O control calls. */
16#define FIOGETOWN _IOR('f', 123, int)
17#define FIOSETOWN _IOW('f', 124, int)
18
19#define SIOCATMARK _IOR('s', 7, int)
20#define SIOCSPGRP _IOW('s', 8, pid_t)
21#define SIOCGPGRP _IOR('s', 9, pid_t)
22
23#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */
24
25#endif /* _ASM_SOCKIOS_H */
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
new file mode 100644
index 000000000000..114d3eb98a6a
--- /dev/null
+++ b/include/asm-mips/spinlock.h
@@ -0,0 +1,299 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SPINLOCK_H
10#define _ASM_SPINLOCK_H
11
12#include <linux/config.h>
13#include <asm/war.h>
14
15/*
16 * Your basic SMP spinlocks, allowing only a single CPU anywhere
17 */
18
19typedef struct {
20 volatile unsigned int lock;
21#ifdef CONFIG_PREEMPT
22 unsigned int break_lock;
23#endif
24} spinlock_t;
25
26#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
27
28#define spin_lock_init(x) do { (x)->lock = 0; } while(0)
29
30#define spin_is_locked(x) ((x)->lock != 0)
31#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock)
32#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
33
34/*
35 * Simple spin lock operations. There are two variants, one clears IRQ's
36 * on the local processor, one does not.
37 *
38 * We make no fairness assumptions. They have a cost.
39 */
40
41static inline void _raw_spin_lock(spinlock_t *lock)
42{
43 unsigned int tmp;
44
45 if (R10000_LLSC_WAR) {
46 __asm__ __volatile__(
47 " .set noreorder # _raw_spin_lock \n"
48 "1: ll %1, %2 \n"
49 " bnez %1, 1b \n"
50 " li %1, 1 \n"
51 " sc %1, %0 \n"
52 " beqzl %1, 1b \n"
53 " nop \n"
54 " sync \n"
55 " .set reorder \n"
56 : "=m" (lock->lock), "=&r" (tmp)
57 : "m" (lock->lock)
58 : "memory");
59 } else {
60 __asm__ __volatile__(
61 " .set noreorder # _raw_spin_lock \n"
62 "1: ll %1, %2 \n"
63 " bnez %1, 1b \n"
64 " li %1, 1 \n"
65 " sc %1, %0 \n"
66 " beqz %1, 1b \n"
67 " sync \n"
68 " .set reorder \n"
69 : "=m" (lock->lock), "=&r" (tmp)
70 : "m" (lock->lock)
71 : "memory");
72 }
73}
74
75static inline void _raw_spin_unlock(spinlock_t *lock)
76{
77 __asm__ __volatile__(
78 " .set noreorder # _raw_spin_unlock \n"
79 " sync \n"
80 " sw $0, %0 \n"
81 " .set\treorder \n"
82 : "=m" (lock->lock)
83 : "m" (lock->lock)
84 : "memory");
85}
86
87static inline unsigned int _raw_spin_trylock(spinlock_t *lock)
88{
89 unsigned int temp, res;
90
91 if (R10000_LLSC_WAR) {
92 __asm__ __volatile__(
93 " .set noreorder # _raw_spin_trylock \n"
94 "1: ll %0, %3 \n"
95 " ori %2, %0, 1 \n"
96 " sc %2, %1 \n"
97 " beqzl %2, 1b \n"
98 " nop \n"
99 " andi %2, %0, 1 \n"
100 " sync \n"
101 " .set reorder"
102 : "=&r" (temp), "=m" (lock->lock), "=&r" (res)
103 : "m" (lock->lock)
104 : "memory");
105 } else {
106 __asm__ __volatile__(
107 " .set noreorder # _raw_spin_trylock \n"
108 "1: ll %0, %3 \n"
109 " ori %2, %0, 1 \n"
110 " sc %2, %1 \n"
111 " beqz %2, 1b \n"
112 " andi %2, %0, 1 \n"
113 " sync \n"
114 " .set reorder"
115 : "=&r" (temp), "=m" (lock->lock), "=&r" (res)
116 : "m" (lock->lock)
117 : "memory");
118 }
119
120 return res == 0;
121}
122
123/*
124 * Read-write spinlocks, allowing multiple readers but only one writer.
125 *
126 * NOTE! it is quite common to have readers in interrupts but no interrupt
127 * writers. For those circumstances we can "mix" irq-safe locks - any writer
128 * needs to get a irq-safe write-lock, but readers can get non-irqsafe
129 * read-locks.
130 */
131
132typedef struct {
133 volatile unsigned int lock;
134#ifdef CONFIG_PREEMPT
135 unsigned int break_lock;
136#endif
137} rwlock_t;
138
139#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
140
141#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
142
143static inline void _raw_read_lock(rwlock_t *rw)
144{
145 unsigned int tmp;
146
147 if (R10000_LLSC_WAR) {
148 __asm__ __volatile__(
149 " .set noreorder # _raw_read_lock \n"
150 "1: ll %1, %2 \n"
151 " bltz %1, 1b \n"
152 " addu %1, 1 \n"
153 " sc %1, %0 \n"
154 " beqzl %1, 1b \n"
155 " nop \n"
156 " sync \n"
157 " .set reorder \n"
158 : "=m" (rw->lock), "=&r" (tmp)
159 : "m" (rw->lock)
160 : "memory");
161 } else {
162 __asm__ __volatile__(
163 " .set noreorder # _raw_read_lock \n"
164 "1: ll %1, %2 \n"
165 " bltz %1, 1b \n"
166 " addu %1, 1 \n"
167 " sc %1, %0 \n"
168 " beqz %1, 1b \n"
169 " sync \n"
170 " .set reorder \n"
171 : "=m" (rw->lock), "=&r" (tmp)
172 : "m" (rw->lock)
173 : "memory");
174 }
175}
176
177/* Note the use of sub, not subu which will make the kernel die with an
178 overflow exception if we ever try to unlock an rwlock that is already
179 unlocked or is being held by a writer. */
180static inline void _raw_read_unlock(rwlock_t *rw)
181{
182 unsigned int tmp;
183
184 if (R10000_LLSC_WAR) {
185 __asm__ __volatile__(
186 "1: ll %1, %2 # _raw_read_unlock \n"
187 " sub %1, 1 \n"
188 " sc %1, %0 \n"
189 " beqzl %1, 1b \n"
190 " sync \n"
191 : "=m" (rw->lock), "=&r" (tmp)
192 : "m" (rw->lock)
193 : "memory");
194 } else {
195 __asm__ __volatile__(
196 " .set noreorder # _raw_read_unlock \n"
197 "1: ll %1, %2 \n"
198 " sub %1, 1 \n"
199 " sc %1, %0 \n"
200 " beqz %1, 1b \n"
201 " sync \n"
202 " .set reorder \n"
203 : "=m" (rw->lock), "=&r" (tmp)
204 : "m" (rw->lock)
205 : "memory");
206 }
207}
208
209static inline void _raw_write_lock(rwlock_t *rw)
210{
211 unsigned int tmp;
212
213 if (R10000_LLSC_WAR) {
214 __asm__ __volatile__(
215 " .set noreorder # _raw_write_lock \n"
216 "1: ll %1, %2 \n"
217 " bnez %1, 1b \n"
218 " lui %1, 0x8000 \n"
219 " sc %1, %0 \n"
220 " beqzl %1, 1b \n"
221 " nop \n"
222 " sync \n"
223 " .set reorder \n"
224 : "=m" (rw->lock), "=&r" (tmp)
225 : "m" (rw->lock)
226 : "memory");
227 } else {
228 __asm__ __volatile__(
229 " .set noreorder # _raw_write_lock \n"
230 "1: ll %1, %2 \n"
231 " bnez %1, 1b \n"
232 " lui %1, 0x8000 \n"
233 " sc %1, %0 \n"
234 " beqz %1, 1b \n"
235 " nop \n"
236 " sync \n"
237 " .set reorder \n"
238 : "=m" (rw->lock), "=&r" (tmp)
239 : "m" (rw->lock)
240 : "memory");
241 }
242}
243
244static inline void _raw_write_unlock(rwlock_t *rw)
245{
246 __asm__ __volatile__(
247 " sync # _raw_write_unlock \n"
248 " sw $0, %0 \n"
249 : "=m" (rw->lock)
250 : "m" (rw->lock)
251 : "memory");
252}
253
254#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
255
256static inline int _raw_write_trylock(rwlock_t *rw)
257{
258 unsigned int tmp;
259 int ret;
260
261 if (R10000_LLSC_WAR) {
262 __asm__ __volatile__(
263 " .set noreorder # _raw_write_trylock \n"
264 " li %2, 0 \n"
265 "1: ll %1, %3 \n"
266 " bnez %1, 2f \n"
267 " lui %1, 0x8000 \n"
268 " sc %1, %0 \n"
269 " beqzl %1, 1b \n"
270 " nop \n"
271 " sync \n"
272 " li %2, 1 \n"
273 " .set reorder \n"
274 "2: \n"
275 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
276 : "m" (rw->lock)
277 : "memory");
278 } else {
279 __asm__ __volatile__(
280 " .set noreorder # _raw_write_trylock \n"
281 " li %2, 0 \n"
282 "1: ll %1, %3 \n"
283 " bnez %1, 2f \n"
284 " lui %1, 0x8000 \n"
285 " sc %1, %0 \n"
286 " beqz %1, 1b \n"
287 " sync \n"
288 " li %2, 1 \n"
289 " .set reorder \n"
290 "2: \n"
291 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
292 : "m" (rw->lock)
293 : "memory");
294 }
295
296 return ret;
297}
298
299#endif /* _ASM_SPINLOCK_H */
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
new file mode 100644
index 000000000000..86283c25fd5b
--- /dev/null
+++ b/include/asm-mips/stackframe.h
@@ -0,0 +1,346 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 99, 2001 Ralf Baechle
7 * Copyright (C) 1994, 1995, 1996 Paul M. Antoine.
8 * Copyright (C) 1999 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_STACKFRAME_H
11#define _ASM_STACKFRAME_H
12
13#include <linux/config.h>
14#include <linux/threads.h>
15
16#include <asm/asm.h>
17#include <asm/mipsregs.h>
18#include <asm/offset.h>
19
20 .macro SAVE_AT
21 .set push
22 .set noat
23 LONG_S $1, PT_R1(sp)
24 .set pop
25 .endm
26
27 .macro SAVE_TEMP
28 mfhi v1
29#ifdef CONFIG_MIPS32
30 LONG_S $8, PT_R8(sp)
31 LONG_S $9, PT_R9(sp)
32#endif
33 LONG_S v1, PT_HI(sp)
34 mflo v1
35 LONG_S $10, PT_R10(sp)
36 LONG_S $11, PT_R11(sp)
37 LONG_S v1, PT_LO(sp)
38 LONG_S $12, PT_R12(sp)
39 LONG_S $13, PT_R13(sp)
40 LONG_S $14, PT_R14(sp)
41 LONG_S $15, PT_R15(sp)
42 LONG_S $24, PT_R24(sp)
43 .endm
44
45 .macro SAVE_STATIC
46 LONG_S $16, PT_R16(sp)
47 LONG_S $17, PT_R17(sp)
48 LONG_S $18, PT_R18(sp)
49 LONG_S $19, PT_R19(sp)
50 LONG_S $20, PT_R20(sp)
51 LONG_S $21, PT_R21(sp)
52 LONG_S $22, PT_R22(sp)
53 LONG_S $23, PT_R23(sp)
54 LONG_S $30, PT_R30(sp)
55 .endm
56
57#ifdef CONFIG_SMP
58 .macro get_saved_sp /* SMP variation */
59#ifdef CONFIG_MIPS32
60 mfc0 k0, CP0_CONTEXT
61 lui k1, %hi(kernelsp)
62 srl k0, k0, 23
63 sll k0, k0, 2
64 addu k1, k0
65 LONG_L k1, %lo(kernelsp)(k1)
66#endif
67#if defined(CONFIG_MIPS64) && !defined(CONFIG_BUILD_ELF64)
68 MFC0 k1, CP0_CONTEXT
69 dsra k1, 23
70 lui k0, %hi(pgd_current)
71 addiu k0, %lo(pgd_current)
72 dsubu k1, k0
73 lui k0, %hi(kernelsp)
74 daddu k1, k0
75 LONG_L k1, %lo(kernelsp)(k1)
76#endif
77#if defined(CONFIG_MIPS64) && defined(CONFIG_BUILD_ELF64)
78 MFC0 k1, CP0_CONTEXT
79 dsrl k1, 23
80 dsll k1, k1, 3
81 LONG_L k1, kernelsp(k1)
82#endif
83 .endm
84
85 .macro set_saved_sp stackp temp temp2
86#ifdef CONFIG_MIPS32
87 mfc0 \temp, CP0_CONTEXT
88 srl \temp, 23
89 sll \temp, 2
90 LONG_S \stackp, kernelsp(\temp)
91#endif
92#if defined(CONFIG_MIPS64) && !defined(CONFIG_BUILD_ELF64)
93 lw \temp, TI_CPU(gp)
94 dsll \temp, 3
95 lui \temp2, %hi(kernelsp)
96 daddu \temp, \temp2
97 LONG_S \stackp, %lo(kernelsp)(\temp)
98#endif
99#if defined(CONFIG_MIPS64) && defined(CONFIG_BUILD_ELF64)
100 lw \temp, TI_CPU(gp)
101 dsll \temp, 3
102 LONG_S \stackp, kernelsp(\temp)
103#endif
104 .endm
105#else
106 .macro get_saved_sp /* Uniprocessor variation */
107 lui k1, %hi(kernelsp)
108 LONG_L k1, %lo(kernelsp)(k1)
109 .endm
110
111 .macro set_saved_sp stackp temp temp2
112 LONG_S \stackp, kernelsp
113 .endm
114#endif
115
116 .macro SAVE_SOME
117 .set push
118 .set noat
119 .set reorder
120 mfc0 k0, CP0_STATUS
121 sll k0, 3 /* extract cu0 bit */
122 .set noreorder
123 bltz k0, 8f
124 move k1, sp
125 .set reorder
126 /* Called from user mode, new stack. */
127 get_saved_sp
1288: move k0, sp
129 PTR_SUBU sp, k1, PT_SIZE
130 LONG_S k0, PT_R29(sp)
131 LONG_S $3, PT_R3(sp)
132 LONG_S $0, PT_R0(sp)
133 mfc0 v1, CP0_STATUS
134 LONG_S $2, PT_R2(sp)
135 LONG_S v1, PT_STATUS(sp)
136 LONG_S $4, PT_R4(sp)
137 mfc0 v1, CP0_CAUSE
138 LONG_S $5, PT_R5(sp)
139 LONG_S v1, PT_CAUSE(sp)
140 LONG_S $6, PT_R6(sp)
141 MFC0 v1, CP0_EPC
142 LONG_S $7, PT_R7(sp)
143#ifdef CONFIG_MIPS64
144 LONG_S $8, PT_R8(sp)
145 LONG_S $9, PT_R9(sp)
146#endif
147 LONG_S v1, PT_EPC(sp)
148 LONG_S $25, PT_R25(sp)
149 LONG_S $28, PT_R28(sp)
150 LONG_S $31, PT_R31(sp)
151 ori $28, sp, _THREAD_MASK
152 xori $28, _THREAD_MASK
153 .set pop
154 .endm
155
156 .macro SAVE_ALL
157 SAVE_SOME
158 SAVE_AT
159 SAVE_TEMP
160 SAVE_STATIC
161 .endm
162
163 .macro RESTORE_AT
164 .set push
165 .set noat
166 LONG_L $1, PT_R1(sp)
167 .set pop
168 .endm
169
170 .macro RESTORE_TEMP
171 LONG_L $24, PT_LO(sp)
172#ifdef CONFIG_MIPS32
173 LONG_L $8, PT_R8(sp)
174 LONG_L $9, PT_R9(sp)
175#endif
176 mtlo $24
177 LONG_L $24, PT_HI(sp)
178 LONG_L $10, PT_R10(sp)
179 LONG_L $11, PT_R11(sp)
180 mthi $24
181 LONG_L $12, PT_R12(sp)
182 LONG_L $13, PT_R13(sp)
183 LONG_L $14, PT_R14(sp)
184 LONG_L $15, PT_R15(sp)
185 LONG_L $24, PT_R24(sp)
186 .endm
187
188 .macro RESTORE_STATIC
189 LONG_L $16, PT_R16(sp)
190 LONG_L $17, PT_R17(sp)
191 LONG_L $18, PT_R18(sp)
192 LONG_L $19, PT_R19(sp)
193 LONG_L $20, PT_R20(sp)
194 LONG_L $21, PT_R21(sp)
195 LONG_L $22, PT_R22(sp)
196 LONG_L $23, PT_R23(sp)
197 LONG_L $30, PT_R30(sp)
198 .endm
199
200#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
201
202 .macro RESTORE_SOME
203 .set push
204 .set reorder
205 .set noat
206 mfc0 a0, CP0_STATUS
207 ori a0, 0x1f
208 xori a0, 0x1f
209 mtc0 a0, CP0_STATUS
210 li v1, 0xff00
211 and a0, v1
212 LONG_L v0, PT_STATUS(sp)
213 nor v1, $0, v1
214 and v0, v1
215 or v0, a0
216 mtc0 v0, CP0_STATUS
217 LONG_L $31, PT_R31(sp)
218 LONG_L $28, PT_R28(sp)
219 LONG_L $25, PT_R25(sp)
220#ifdef CONFIG_MIPS64
221 LONG_L $8, PT_R8(sp)
222 LONG_L $9, PT_R9(sp)
223#endif
224 LONG_L $7, PT_R7(sp)
225 LONG_L $6, PT_R6(sp)
226 LONG_L $5, PT_R5(sp)
227 LONG_L $4, PT_R4(sp)
228 LONG_L $3, PT_R3(sp)
229 LONG_L $2, PT_R2(sp)
230 .set pop
231 .endm
232
233 .macro RESTORE_SP_AND_RET
234 .set push
235 .set noreorder
236 LONG_L k0, PT_EPC(sp)
237 LONG_L sp, PT_R29(sp)
238 jr k0
239 rfe
240 .set pop
241 .endm
242
243#else
244
245 .macro RESTORE_SOME
246 .set push
247 .set reorder
248 .set noat
249 mfc0 a0, CP0_STATUS
250 ori a0, 0x1f
251 xori a0, 0x1f
252 mtc0 a0, CP0_STATUS
253 li v1, 0xff00
254 and a0, v1
255 LONG_L v0, PT_STATUS(sp)
256 nor v1, $0, v1
257 and v0, v1
258 or v0, a0
259 mtc0 v0, CP0_STATUS
260 LONG_L v1, PT_EPC(sp)
261 MTC0 v1, CP0_EPC
262 LONG_L $31, PT_R31(sp)
263 LONG_L $28, PT_R28(sp)
264 LONG_L $25, PT_R25(sp)
265#ifdef CONFIG_MIPS64
266 LONG_L $8, PT_R8(sp)
267 LONG_L $9, PT_R9(sp)
268#endif
269 LONG_L $7, PT_R7(sp)
270 LONG_L $6, PT_R6(sp)
271 LONG_L $5, PT_R5(sp)
272 LONG_L $4, PT_R4(sp)
273 LONG_L $3, PT_R3(sp)
274 LONG_L $2, PT_R2(sp)
275 .set pop
276 .endm
277
278 .macro RESTORE_SP_AND_RET
279 LONG_L sp, PT_R29(sp)
280 .set mips3
281 eret
282 .set mips0
283 .endm
284
285#endif
286
287 .macro RESTORE_SP
288 LONG_L sp, PT_R29(sp)
289 .endm
290
291 .macro RESTORE_ALL
292 RESTORE_TEMP
293 RESTORE_STATIC
294 RESTORE_AT
295 RESTORE_SOME
296 RESTORE_SP
297 .endm
298
299 .macro RESTORE_ALL_AND_RET
300 RESTORE_TEMP
301 RESTORE_STATIC
302 RESTORE_AT
303 RESTORE_SOME
304 RESTORE_SP_AND_RET
305 .endm
306
307/*
308 * Move to kernel mode and disable interrupts.
309 * Set cp0 enable bit as sign that we're running on the kernel stack
310 */
311 .macro CLI
312 mfc0 t0, CP0_STATUS
313 li t1, ST0_CU0 | 0x1f
314 or t0, t1
315 xori t0, 0x1f
316 mtc0 t0, CP0_STATUS
317 irq_disable_hazard
318 .endm
319
320/*
321 * Move to kernel mode and enable interrupts.
322 * Set cp0 enable bit as sign that we're running on the kernel stack
323 */
324 .macro STI
325 mfc0 t0, CP0_STATUS
326 li t1, ST0_CU0 | 0x1f
327 or t0, t1
328 xori t0, 0x1e
329 mtc0 t0, CP0_STATUS
330 irq_enable_hazard
331 .endm
332
333/*
334 * Just move to kernel mode and leave interrupts as they are.
335 * Set cp0 enable bit as sign that we're running on the kernel stack
336 */
337 .macro KMODE
338 mfc0 t0, CP0_STATUS
339 li t1, ST0_CU0 | 0x1e
340 or t0, t1
341 xori t0, 0x1e
342 mtc0 t0, CP0_STATUS
343 irq_disable_hazard
344 .endm
345
346#endif /* _ASM_STACKFRAME_H */
diff --git a/include/asm-mips/stat.h b/include/asm-mips/stat.h
new file mode 100644
index 000000000000..6e00f751ab6d
--- /dev/null
+++ b/include/asm-mips/stat.h
@@ -0,0 +1,132 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1999, 2000 Ralf Baechle
7 * Copyright (C) 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_STAT_H
10#define _ASM_STAT_H
11
12#include <linux/types.h>
13
14#include <asm/sgidefs.h>
15
16#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
17
18struct stat {
19 unsigned st_dev;
20 long st_pad1[3]; /* Reserved for network id */
21 ino_t st_ino;
22 mode_t st_mode;
23 nlink_t st_nlink;
24 uid_t st_uid;
25 gid_t st_gid;
26 unsigned st_rdev;
27 long st_pad2[2];
28 off_t st_size;
29 long st_pad3;
30 /*
31 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
32 * but we don't have it under Linux.
33 */
34 time_t st_atime;
35 long st_atime_nsec;
36 time_t st_mtime;
37 long st_mtime_nsec;
38 time_t st_ctime;
39 long st_ctime_nsec;
40 long st_blksize;
41 long st_blocks;
42 long st_pad4[14];
43};
44
45/*
46 * This matches struct stat64 in glibc2.1, hence the absolutely insane
47 * amounts of padding around dev_t's. The memory layout is the same as of
48 * struct stat of the 64-bit kernel.
49 */
50
51struct stat64 {
52 unsigned long st_dev;
53 unsigned long st_pad0[3]; /* Reserved for st_dev expansion */
54
55 unsigned long long st_ino;
56
57 mode_t st_mode;
58 nlink_t st_nlink;
59
60 uid_t st_uid;
61 gid_t st_gid;
62
63 unsigned long st_rdev;
64 unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
65
66 long long st_size;
67
68 /*
69 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
70 * but we don't have it under Linux.
71 */
72 time_t st_atime;
73 unsigned long st_atime_nsec; /* Reserved for st_atime expansion */
74
75 time_t st_mtime;
76 unsigned long st_mtime_nsec; /* Reserved for st_mtime expansion */
77
78 time_t st_ctime;
79 unsigned long st_ctime_nsec; /* Reserved for st_ctime expansion */
80
81 unsigned long st_blksize;
82 unsigned long st_pad2;
83
84 long long st_blocks;
85};
86
87#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
88
89#if _MIPS_SIM == _MIPS_SIM_ABI64
90
91/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
92struct stat {
93 unsigned int st_dev;
94 unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
95
96 unsigned long st_ino;
97
98 mode_t st_mode;
99 nlink_t st_nlink;
100
101 uid_t st_uid;
102 gid_t st_gid;
103
104 unsigned int st_rdev;
105 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
106
107 off_t st_size;
108
109 /*
110 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
111 * but we don't have it under Linux.
112 */
113 unsigned int st_atime;
114 unsigned int st_atime_nsec;
115
116 unsigned int st_mtime;
117 unsigned int st_mtime_nsec;
118
119 unsigned int st_ctime;
120 unsigned int st_ctime_nsec;
121
122 unsigned int st_blksize;
123 unsigned int st_pad2;
124
125 unsigned long st_blocks;
126};
127
128#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
129
130#define STAT_HAVE_NSEC 1
131
132#endif /* _ASM_STAT_H */
diff --git a/include/asm-mips/statfs.h b/include/asm-mips/statfs.h
new file mode 100644
index 000000000000..5076fec65780
--- /dev/null
+++ b/include/asm-mips/statfs.h
@@ -0,0 +1,96 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1999 by Ralf Baechle
7 */
8#ifndef _ASM_STATFS_H
9#define _ASM_STATFS_H
10
11#include <linux/posix_types.h>
12#include <asm/sgidefs.h>
13
14#ifndef __KERNEL_STRICT_NAMES
15
16#include <linux/types.h>
17
18typedef __kernel_fsid_t fsid_t;
19
20#endif
21
22struct statfs {
23 long f_type;
24#define f_fstyp f_type
25 long f_bsize;
26 long f_frsize; /* Fragment size - unsupported */
27 long f_blocks;
28 long f_bfree;
29 long f_files;
30 long f_ffree;
31 long f_bavail;
32
33 /* Linux specials */
34 __kernel_fsid_t f_fsid;
35 long f_namelen;
36 long f_spare[6];
37};
38
39#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
40
41/*
42 * Unlike the traditional version the LFAPI version has none of the ABI junk
43 */
44struct statfs64 {
45 __u32 f_type;
46 __u32 f_bsize;
47 __u32 f_frsize; /* Fragment size - unsupported */
48 __u32 __pad;
49 __u64 f_blocks;
50 __u64 f_bfree;
51 __u64 f_files;
52 __u64 f_ffree;
53 __u64 f_bavail;
54 __kernel_fsid_t f_fsid;
55 __u32 f_namelen;
56 __u32 f_spare[6];
57};
58
59#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
60
61#if _MIPS_SIM == _MIPS_SIM_ABI64
62
63struct statfs64 { /* Same as struct statfs */
64 long f_type;
65 long f_bsize;
66 long f_frsize; /* Fragment size - unsupported */
67 long f_blocks;
68 long f_bfree;
69 long f_files;
70 long f_ffree;
71 long f_bavail;
72
73 /* Linux specials */
74 __kernel_fsid_t f_fsid;
75 long f_namelen;
76 long f_spare[6];
77};
78
79struct compat_statfs64 {
80 __u32 f_type;
81 __u32 f_bsize;
82 __u32 f_frsize; /* Fragment size - unsupported */
83 __u32 __pad;
84 __u64 f_blocks;
85 __u64 f_bfree;
86 __u64 f_files;
87 __u64 f_ffree;
88 __u64 f_bavail;
89 __kernel_fsid_t f_fsid;
90 __u32 f_namelen;
91 __u32 f_spare[6];
92};
93
94#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
95
96#endif /* _ASM_STATFS_H */
diff --git a/include/asm-mips/string.h b/include/asm-mips/string.h
new file mode 100644
index 000000000000..b18345504f8a
--- /dev/null
+++ b/include/asm-mips/string.h
@@ -0,0 +1,166 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 1994, 95, 96, 97, 98, 2000, 01 Ralf Baechle
7 * Copyright (c) 2000 by Silicon Graphics, Inc.
8 * Copyright (c) 2001 MIPS Technologies, Inc.
9 */
10#ifndef _ASM_STRING_H
11#define _ASM_STRING_H
12
13#include <linux/config.h>
14
15/*
16 * Most of the inline functions are rather naive implementations so I just
17 * didn't bother updating them for 64-bit ...
18 */
19#ifdef CONFIG_MIPS32
20
21#ifndef IN_STRING_C
22
23#define __HAVE_ARCH_STRCPY
24static __inline__ char *strcpy(char *__dest, __const__ char *__src)
25{
26 char *__xdest = __dest;
27
28 __asm__ __volatile__(
29 ".set\tnoreorder\n\t"
30 ".set\tnoat\n"
31 "1:\tlbu\t$1,(%1)\n\t"
32 "addiu\t%1,1\n\t"
33 "sb\t$1,(%0)\n\t"
34 "bnez\t$1,1b\n\t"
35 "addiu\t%0,1\n\t"
36 ".set\tat\n\t"
37 ".set\treorder"
38 : "=r" (__dest), "=r" (__src)
39 : "0" (__dest), "1" (__src)
40 : "memory");
41
42 return __xdest;
43}
44
45#define __HAVE_ARCH_STRNCPY
46static __inline__ char *strncpy(char *__dest, __const__ char *__src, size_t __n)
47{
48 char *__xdest = __dest;
49
50 if (__n == 0)
51 return __xdest;
52
53 __asm__ __volatile__(
54 ".set\tnoreorder\n\t"
55 ".set\tnoat\n"
56 "1:\tlbu\t$1,(%1)\n\t"
57 "subu\t%2,1\n\t"
58 "sb\t$1,(%0)\n\t"
59 "beqz\t$1,2f\n\t"
60 "addiu\t%0,1\n\t"
61 "bnez\t%2,1b\n\t"
62 "addiu\t%1,1\n"
63 "2:\n\t"
64 ".set\tat\n\t"
65 ".set\treorder"
66 : "=r" (__dest), "=r" (__src), "=r" (__n)
67 : "0" (__dest), "1" (__src), "2" (__n)
68 : "memory");
69
70 return __xdest;
71}
72
73#define __HAVE_ARCH_STRCMP
74static __inline__ int strcmp(__const__ char *__cs, __const__ char *__ct)
75{
76 int __res;
77
78 __asm__ __volatile__(
79 ".set\tnoreorder\n\t"
80 ".set\tnoat\n\t"
81 "lbu\t%2,(%0)\n"
82 "1:\tlbu\t$1,(%1)\n\t"
83 "addiu\t%0,1\n\t"
84 "bne\t$1,%2,2f\n\t"
85 "addiu\t%1,1\n\t"
86 "bnez\t%2,1b\n\t"
87 "lbu\t%2,(%0)\n\t"
88#if defined(CONFIG_CPU_R3000)
89 "nop\n\t"
90#endif
91 "move\t%2,$1\n"
92 "2:\tsubu\t%2,$1\n"
93 "3:\t.set\tat\n\t"
94 ".set\treorder"
95 : "=r" (__cs), "=r" (__ct), "=r" (__res)
96 : "0" (__cs), "1" (__ct));
97
98 return __res;
99}
100
101#endif /* !defined(IN_STRING_C) */
102
103#define __HAVE_ARCH_STRNCMP
104static __inline__ int
105strncmp(__const__ char *__cs, __const__ char *__ct, size_t __count)
106{
107 int __res;
108
109 __asm__ __volatile__(
110 ".set\tnoreorder\n\t"
111 ".set\tnoat\n"
112 "1:\tlbu\t%3,(%0)\n\t"
113 "beqz\t%2,2f\n\t"
114 "lbu\t$1,(%1)\n\t"
115 "subu\t%2,1\n\t"
116 "bne\t$1,%3,3f\n\t"
117 "addiu\t%0,1\n\t"
118 "bnez\t%3,1b\n\t"
119 "addiu\t%1,1\n"
120 "2:\n\t"
121#if defined(CONFIG_CPU_R3000)
122 "nop\n\t"
123#endif
124 "move\t%3,$1\n"
125 "3:\tsubu\t%3,$1\n\t"
126 ".set\tat\n\t"
127 ".set\treorder"
128 : "=r" (__cs), "=r" (__ct), "=r" (__count), "=r" (__res)
129 : "0" (__cs), "1" (__ct), "2" (__count));
130
131 return __res;
132}
133#endif /* CONFIG_MIPS32 */
134
135#define __HAVE_ARCH_MEMSET
136extern void *memset(void *__s, int __c, size_t __count);
137
138#define __HAVE_ARCH_MEMCPY
139extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
140
141#define __HAVE_ARCH_MEMMOVE
142extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
143
144#ifdef CONFIG_MIPS32
145#define __HAVE_ARCH_MEMSCAN
146static __inline__ void *memscan(void *__addr, int __c, size_t __size)
147{
148 char *__end = (char *)__addr + __size;
149 unsigned char __uc = (unsigned char) __c;
150
151 __asm__(".set\tpush\n\t"
152 ".set\tnoat\n\t"
153 ".set\treorder\n\t"
154 "1:\tbeq\t%0,%1,2f\n\t"
155 "addiu\t%0,1\n\t"
156 "lbu\t$1,-1(%0)\n\t"
157 "bne\t$1,%z4,1b\n"
158 "2:\t.set\tpop"
159 : "=r" (__addr), "=r" (__end)
160 : "0" (__addr), "1" (__end), "Jr" (__uc));
161
162 return __addr;
163}
164#endif /* CONFIG_MIPS32 */
165
166#endif /* _ASM_STRING_H */
diff --git a/include/asm-mips/suspend.h b/include/asm-mips/suspend.h
new file mode 100644
index 000000000000..2562f8f9be0e
--- /dev/null
+++ b/include/asm-mips/suspend.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_SUSPEND_H
2#define __ASM_SUSPEND_H
3
4/* Somewhen... Maybe :-) */
5
6#endif /* __ASM_SUSPEND_H */
diff --git a/include/asm-mips/sysmips.h b/include/asm-mips/sysmips.h
new file mode 100644
index 000000000000..4f47b7d6a5f7
--- /dev/null
+++ b/include/asm-mips/sysmips.h
@@ -0,0 +1,25 @@
1/*
2 * Definitions for the MIPS sysmips(2) call
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995 by Ralf Baechle
9 */
10#ifndef _ASM_SYSMIPS_H
11#define _ASM_SYSMIPS_H
12
13/*
14 * Commands for the sysmips(2) call
15 *
16 * sysmips(2) is deprecated - though some existing software uses it.
17 * We only support the following commands.
18 */
19#define SETNAME 1 /* set hostname */
20#define FLUSH_CACHE 3 /* writeback and invalidate caches */
21#define MIPS_FIXADE 7 /* control address error fixing */
22#define MIPS_RDNVRAM 10 /* read NVRAM */
23#define MIPS_ATOMIC_SET 2001 /* atomically set variable */
24
25#endif /* _ASM_SYSMIPS_H */
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
new file mode 100644
index 000000000000..888fd8908467
--- /dev/null
+++ b/include/asm-mips/system.h
@@ -0,0 +1,438 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics
9 * Kevin D. Kissell, kevink@mips.org and Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2000 MIPS Technologies, Inc.
11 */
12#ifndef _ASM_SYSTEM_H
13#define _ASM_SYSTEM_H
14
15#include <linux/config.h>
16#include <linux/types.h>
17
18#include <asm/addrspace.h>
19#include <asm/cpu-features.h>
20#include <asm/ptrace.h>
21#include <asm/war.h>
22#include <asm/interrupt.h>
23
24/*
25 * read_barrier_depends - Flush all pending reads that subsequents reads
26 * depend on.
27 *
28 * No data-dependent reads from memory-like regions are ever reordered
29 * over this barrier. All reads preceding this primitive are guaranteed
30 * to access memory (but not necessarily other CPUs' caches) before any
31 * reads following this primitive that depend on the data return by
32 * any of the preceding reads. This primitive is much lighter weight than
33 * rmb() on most CPUs, and is never heavier weight than is
34 * rmb().
35 *
36 * These ordering constraints are respected by both the local CPU
37 * and the compiler.
38 *
39 * Ordering is not guaranteed by anything other than these primitives,
40 * not even by data dependencies. See the documentation for
41 * memory_barrier() for examples and URLs to more information.
42 *
43 * For example, the following code would force ordering (the initial
44 * value of "a" is zero, "b" is one, and "p" is "&a"):
45 *
46 * <programlisting>
47 * CPU 0 CPU 1
48 *
49 * b = 2;
50 * memory_barrier();
51 * p = &b; q = p;
52 * read_barrier_depends();
53 * d = *q;
54 * </programlisting>
55 *
56 * because the read of "*q" depends on the read of "p" and these
57 * two reads are separated by a read_barrier_depends(). However,
58 * the following code, with the same initial values for "a" and "b":
59 *
60 * <programlisting>
61 * CPU 0 CPU 1
62 *
63 * a = 2;
64 * memory_barrier();
65 * b = 3; y = b;
66 * read_barrier_depends();
67 * x = a;
68 * </programlisting>
69 *
70 * does not enforce ordering, since there is no data dependency between
71 * the read of "a" and the read of "b". Therefore, on some CPUs, such
72 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
73 * in cases like thiswhere there are no data dependencies.
74 */
75
76#define read_barrier_depends() do { } while(0)
77
78#ifdef CONFIG_CPU_HAS_SYNC
79#define __sync() \
80 __asm__ __volatile__( \
81 ".set push\n\t" \
82 ".set noreorder\n\t" \
83 ".set mips2\n\t" \
84 "sync\n\t" \
85 ".set pop" \
86 : /* no output */ \
87 : /* no input */ \
88 : "memory")
89#else
90#define __sync() do { } while(0)
91#endif
92
93#define __fast_iob() \
94 __asm__ __volatile__( \
95 ".set push\n\t" \
96 ".set noreorder\n\t" \
97 "lw $0,%0\n\t" \
98 "nop\n\t" \
99 ".set pop" \
100 : /* no output */ \
101 : "m" (*(int *)CKSEG1) \
102 : "memory")
103
104#define fast_wmb() __sync()
105#define fast_rmb() __sync()
106#define fast_mb() __sync()
107#define fast_iob() \
108 do { \
109 __sync(); \
110 __fast_iob(); \
111 } while (0)
112
113#ifdef CONFIG_CPU_HAS_WB
114
115#include <asm/wbflush.h>
116
117#define wmb() fast_wmb()
118#define rmb() fast_rmb()
119#define mb() wbflush()
120#define iob() wbflush()
121
122#else /* !CONFIG_CPU_HAS_WB */
123
124#define wmb() fast_wmb()
125#define rmb() fast_rmb()
126#define mb() fast_mb()
127#define iob() fast_iob()
128
129#endif /* !CONFIG_CPU_HAS_WB */
130
131#ifdef CONFIG_SMP
132#define smp_mb() mb()
133#define smp_rmb() rmb()
134#define smp_wmb() wmb()
135#define smp_read_barrier_depends() read_barrier_depends()
136#else
137#define smp_mb() barrier()
138#define smp_rmb() barrier()
139#define smp_wmb() barrier()
140#define smp_read_barrier_depends() do { } while(0)
141#endif
142
143#define set_mb(var, value) \
144do { var = value; mb(); } while (0)
145
146#define set_wmb(var, value) \
147do { var = value; wmb(); } while (0)
148
149/*
150 * switch_to(n) should switch tasks to task nr n, first
151 * checking that n isn't the current task, in which case it does nothing.
152 */
153extern asmlinkage void *resume(void *last, void *next, void *next_ti);
154
155struct task_struct;
156
157#define switch_to(prev,next,last) \
158do { \
159 (last) = resume(prev, next, next->thread_info); \
160} while(0)
161
162#define ROT_IN_PIECES \
163 " .set noreorder \n" \
164 " .set reorder \n"
165
166static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
167{
168 __u32 retval;
169
170 if (cpu_has_llsc && R10000_LLSC_WAR) {
171 unsigned long dummy;
172
173 __asm__ __volatile__(
174 "1: ll %0, %3 # xchg_u32 \n"
175 " move %2, %z4 \n"
176 " sc %2, %1 \n"
177 " beqzl %2, 1b \n"
178 ROT_IN_PIECES
179#ifdef CONFIG_SMP
180 " sync \n"
181#endif
182 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
183 : "R" (*m), "Jr" (val)
184 : "memory");
185 } else if (cpu_has_llsc) {
186 unsigned long dummy;
187
188 __asm__ __volatile__(
189 "1: ll %0, %3 # xchg_u32 \n"
190 " move %2, %z4 \n"
191 " sc %2, %1 \n"
192 " beqz %2, 1b \n"
193#ifdef CONFIG_SMP
194 " sync \n"
195#endif
196 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
197 : "R" (*m), "Jr" (val)
198 : "memory");
199 } else {
200 unsigned long flags;
201
202 local_irq_save(flags);
203 retval = *m;
204 *m = val;
205 local_irq_restore(flags); /* implies memory barrier */
206 }
207
208 return retval;
209}
210
211#ifdef CONFIG_MIPS64
212static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
213{
214 __u64 retval;
215
216 if (cpu_has_llsc && R10000_LLSC_WAR) {
217 unsigned long dummy;
218
219 __asm__ __volatile__(
220 "1: lld %0, %3 # xchg_u64 \n"
221 " move %2, %z4 \n"
222 " scd %2, %1 \n"
223 " beqzl %2, 1b \n"
224 ROT_IN_PIECES
225#ifdef CONFIG_SMP
226 " sync \n"
227#endif
228 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
229 : "R" (*m), "Jr" (val)
230 : "memory");
231 } else if (cpu_has_llsc) {
232 unsigned long dummy;
233
234 __asm__ __volatile__(
235 "1: lld %0, %3 # xchg_u64 \n"
236 " move %2, %z4 \n"
237 " scd %2, %1 \n"
238 " beqz %2, 1b \n"
239#ifdef CONFIG_SMP
240 " sync \n"
241#endif
242 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
243 : "R" (*m), "Jr" (val)
244 : "memory");
245 } else {
246 unsigned long flags;
247
248 local_irq_save(flags);
249 retval = *m;
250 *m = val;
251 local_irq_restore(flags); /* implies memory barrier */
252 }
253
254 return retval;
255}
256#else
257extern __u64 __xchg_u64_unsupported_on_32bit_kernels(volatile __u64 * m, __u64 val);
258#define __xchg_u64 __xchg_u64_unsupported_on_32bit_kernels
259#endif
260
261/* This function doesn't exist, so you'll get a linker error
262 if something tries to do an invalid xchg(). */
263extern void __xchg_called_with_bad_pointer(void);
264
265static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
266{
267 switch (size) {
268 case 4:
269 return __xchg_u32(ptr, x);
270 case 8:
271 return __xchg_u64(ptr, x);
272 }
273 __xchg_called_with_bad_pointer();
274 return x;
275}
276
277#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
278#define tas(ptr) (xchg((ptr),1))
279
280#define __HAVE_ARCH_CMPXCHG 1
281
282static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
283 unsigned long new)
284{
285 __u32 retval;
286
287 if (cpu_has_llsc && R10000_LLSC_WAR) {
288 __asm__ __volatile__(
289 " .set noat \n"
290 "1: ll %0, %2 # __cmpxchg_u32 \n"
291 " bne %0, %z3, 2f \n"
292 " move $1, %z4 \n"
293 " sc $1, %1 \n"
294 " beqzl $1, 1b \n"
295 ROT_IN_PIECES
296#ifdef CONFIG_SMP
297 " sync \n"
298#endif
299 "2: \n"
300 " .set at \n"
301 : "=&r" (retval), "=m" (*m)
302 : "R" (*m), "Jr" (old), "Jr" (new)
303 : "memory");
304 } else if (cpu_has_llsc) {
305 __asm__ __volatile__(
306 " .set noat \n"
307 "1: ll %0, %2 # __cmpxchg_u32 \n"
308 " bne %0, %z3, 2f \n"
309 " move $1, %z4 \n"
310 " sc $1, %1 \n"
311 " beqz $1, 1b \n"
312#ifdef CONFIG_SMP
313 " sync \n"
314#endif
315 "2: \n"
316 " .set at \n"
317 : "=&r" (retval), "=m" (*m)
318 : "R" (*m), "Jr" (old), "Jr" (new)
319 : "memory");
320 } else {
321 unsigned long flags;
322
323 local_irq_save(flags);
324 retval = *m;
325 if (retval == old)
326 *m = new;
327 local_irq_restore(flags); /* implies memory barrier */
328 }
329
330 return retval;
331}
332
333#ifdef CONFIG_MIPS64
334static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
335 unsigned long new)
336{
337 __u64 retval;
338
339 if (cpu_has_llsc) {
340 __asm__ __volatile__(
341 " .set noat \n"
342 "1: lld %0, %2 # __cmpxchg_u64 \n"
343 " bne %0, %z3, 2f \n"
344 " move $1, %z4 \n"
345 " scd $1, %1 \n"
346 " beqzl $1, 1b \n"
347 ROT_IN_PIECES
348#ifdef CONFIG_SMP
349 " sync \n"
350#endif
351 "2: \n"
352 " .set at \n"
353 : "=&r" (retval), "=m" (*m)
354 : "R" (*m), "Jr" (old), "Jr" (new)
355 : "memory");
356 } else if (cpu_has_llsc) {
357 __asm__ __volatile__(
358 " .set noat \n"
359 "1: lld %0, %2 # __cmpxchg_u64 \n"
360 " bne %0, %z3, 2f \n"
361 " move $1, %z4 \n"
362 " scd $1, %1 \n"
363 " beqz $1, 1b \n"
364#ifdef CONFIG_SMP
365 " sync \n"
366#endif
367 "2: \n"
368 " .set at \n"
369 : "=&r" (retval), "=m" (*m)
370 : "R" (*m), "Jr" (old), "Jr" (new)
371 : "memory");
372 } else {
373 unsigned long flags;
374
375 local_irq_save(flags);
376 retval = *m;
377 if (retval == old)
378 *m = new;
379 local_irq_restore(flags); /* implies memory barrier */
380 }
381
382 return retval;
383}
384#else
385extern unsigned long __cmpxchg_u64_unsupported_on_32bit_kernels(
386 volatile int * m, unsigned long old, unsigned long new);
387#define __cmpxchg_u64 __cmpxchg_u64_unsupported_on_32bit_kernels
388#endif
389
390/* This function doesn't exist, so you'll get a linker error
391 if something tries to do an invalid cmpxchg(). */
392extern void __cmpxchg_called_with_bad_pointer(void);
393
394static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
395 unsigned long new, int size)
396{
397 switch (size) {
398 case 4:
399 return __cmpxchg_u32(ptr, old, new);
400 case 8:
401 return __cmpxchg_u64(ptr, old, new);
402 }
403 __cmpxchg_called_with_bad_pointer();
404 return old;
405}
406
407#define cmpxchg(ptr,old,new) ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(old), (unsigned long)(new),sizeof(*(ptr))))
408
409extern void *set_except_vector(int n, void *addr);
410extern void per_cpu_trap_init(void);
411
412extern NORET_TYPE void __die(const char *, struct pt_regs *, const char *file,
413 const char *func, unsigned long line);
414extern void __die_if_kernel(const char *, struct pt_regs *, const char *file,
415 const char *func, unsigned long line);
416
417#define die(msg, regs) \
418 __die(msg, regs, __FILE__ ":", __FUNCTION__, __LINE__)
419#define die_if_kernel(msg, regs) \
420 __die_if_kernel(msg, regs, __FILE__ ":", __FUNCTION__, __LINE__)
421
422extern int stop_a_enabled;
423
424/*
425 * Taken from include/asm-ia64/system.h; prevents deadlock on SMP
426 * systems.
427 */
428#define prepare_arch_switch(rq, next) \
429do { \
430 spin_lock(&(next)->switch_lock); \
431 spin_unlock(&(rq)->lock); \
432} while (0)
433#define finish_arch_switch(rq, prev) spin_unlock_irq(&(prev)->switch_lock)
434#define task_running(rq, p) ((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock))
435
436#define arch_align_stack(x) (x)
437
438#endif /* _ASM_SYSTEM_H */
diff --git a/include/asm-mips/termbits.h b/include/asm-mips/termbits.h
new file mode 100644
index 000000000000..c29c65b7818e
--- /dev/null
+++ b/include/asm-mips/termbits.h
@@ -0,0 +1,207 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1996, 1999, 2001 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#ifndef _ASM_TERMBITS_H
11#define _ASM_TERMBITS_H
12
13#include <linux/posix_types.h>
14
15typedef unsigned char cc_t;
16#if (_MIPS_SZLONG == 32)
17typedef unsigned long speed_t;
18typedef unsigned long tcflag_t;
19#endif
20#if (_MIPS_SZLONG == 64)
21typedef __u32 speed_t;
22typedef __u32 tcflag_t;
23#endif
24
25/*
26 * The ABI says nothing about NCC but seems to use NCCS as
27 * replacement for it in struct termio
28 */
29#define NCCS 23
30struct termios {
31 tcflag_t c_iflag; /* input mode flags */
32 tcflag_t c_oflag; /* output mode flags */
33 tcflag_t c_cflag; /* control mode flags */
34 tcflag_t c_lflag; /* local mode flags */
35 cc_t c_line; /* line discipline */
36 cc_t c_cc[NCCS]; /* control characters */
37};
38
39/* c_cc characters */
40#define VINTR 0 /* Interrupt character [ISIG]. */
41#define VQUIT 1 /* Quit character [ISIG]. */
42#define VERASE 2 /* Erase character [ICANON]. */
43#define VKILL 3 /* Kill-line character [ICANON]. */
44#define VMIN 4 /* Minimum number of bytes read at once [!ICANON]. */
45#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON]. */
46#define VEOL2 6 /* Second EOL character [ICANON]. */
47#define VSWTC 7 /* ??? */
48#define VSWTCH VSWTC
49#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */
50#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */
51#define VSUSP 10 /* Suspend character [ISIG]. */
52#if 0
53/*
54 * VDSUSP is not supported
55 */
56#define VDSUSP 11 /* Delayed suspend character [ISIG]. */
57#endif
58#define VREPRINT 12 /* Reprint-line character [ICANON]. */
59#define VDISCARD 13 /* Discard character [IEXTEN]. */
60#define VWERASE 14 /* Word-erase character [ICANON]. */
61#define VLNEXT 15 /* Literal-next character [IEXTEN]. */
62#define VEOF 16 /* End-of-file character [ICANON]. */
63#define VEOL 17 /* End-of-line character [ICANON]. */
64
65/* c_iflag bits */
66#define IGNBRK 0000001 /* Ignore break condition. */
67#define BRKINT 0000002 /* Signal interrupt on break. */
68#define IGNPAR 0000004 /* Ignore characters with parity errors. */
69#define PARMRK 0000010 /* Mark parity and framing errors. */
70#define INPCK 0000020 /* Enable input parity check. */
71#define ISTRIP 0000040 /* Strip 8th bit off characters. */
72#define INLCR 0000100 /* Map NL to CR on input. */
73#define IGNCR 0000200 /* Ignore CR. */
74#define ICRNL 0000400 /* Map CR to NL on input. */
75#define IUCLC 0001000 /* Map upper case to lower case on input. */
76#define IXON 0002000 /* Enable start/stop output control. */
77#define IXANY 0004000 /* Any character will restart after stop. */
78#define IXOFF 0010000 /* Enable start/stop input control. */
79#define IMAXBEL 0020000 /* Ring bell when input queue is full. */
80#define IUTF8 0040000 /* Input is UTF8 */
81
82/* c_oflag bits */
83#define OPOST 0000001 /* Perform output processing. */
84#define OLCUC 0000002 /* Map lower case to upper case on output. */
85#define ONLCR 0000004 /* Map NL to CR-NL on output. */
86#define OCRNL 0000010
87#define ONOCR 0000020
88#define ONLRET 0000040
89#define OFILL 0000100
90#define OFDEL 0000200
91#define NLDLY 0000400
92#define NL0 0000000
93#define NL1 0000400
94#define CRDLY 0003000
95#define CR0 0000000
96#define CR1 0001000
97#define CR2 0002000
98#define CR3 0003000
99#define TABDLY 0014000
100#define TAB0 0000000
101#define TAB1 0004000
102#define TAB2 0010000
103#define TAB3 0014000
104#define XTABS 0014000
105#define BSDLY 0020000
106#define BS0 0000000
107#define BS1 0020000
108#define VTDLY 0040000
109#define VT0 0000000
110#define VT1 0040000
111#define FFDLY 0100000
112#define FF0 0000000
113#define FF1 0100000
114/*
115#define PAGEOUT ???
116#define WRAP ???
117 */
118
119/* c_cflag bit meaning */
120#define CBAUD 0010017
121#define B0 0000000 /* hang up */
122#define B50 0000001
123#define B75 0000002
124#define B110 0000003
125#define B134 0000004
126#define B150 0000005
127#define B200 0000006
128#define B300 0000007
129#define B600 0000010
130#define B1200 0000011
131#define B1800 0000012
132#define B2400 0000013
133#define B4800 0000014
134#define B9600 0000015
135#define B19200 0000016
136#define B38400 0000017
137#define EXTA B19200
138#define EXTB B38400
139#define CSIZE 0000060 /* Number of bits per byte (mask). */
140#define CS5 0000000 /* 5 bits per byte. */
141#define CS6 0000020 /* 6 bits per byte. */
142#define CS7 0000040 /* 7 bits per byte. */
143#define CS8 0000060 /* 8 bits per byte. */
144#define CSTOPB 0000100 /* Two stop bits instead of one. */
145#define CREAD 0000200 /* Enable receiver. */
146#define PARENB 0000400 /* Parity enable. */
147#define PARODD 0001000 /* Odd parity instead of even. */
148#define HUPCL 0002000 /* Hang up on last close. */
149#define CLOCAL 0004000 /* Ignore modem status lines. */
150#define CBAUDEX 0010000
151#define B57600 0010001
152#define B115200 0010002
153#define B230400 0010003
154#define B460800 0010004
155#define B500000 0010005
156#define B576000 0010006
157#define B921600 0010007
158#define B1000000 0010010
159#define B1152000 0010011
160#define B1500000 0010012
161#define B2000000 0010013
162#define B2500000 0010014
163#define B3000000 0010015
164#define B3500000 0010016
165#define B4000000 0010017
166#define CIBAUD 002003600000 /* input baud rate (not used) */
167#define CMSPAR 010000000000 /* mark or space (stick) parity */
168#define CRTSCTS 020000000000 /* flow control */
169
170/* c_lflag bits */
171#define ISIG 0000001 /* Enable signals. */
172#define ICANON 0000002 /* Do erase and kill processing. */
173#define XCASE 0000004
174#define ECHO 0000010 /* Enable echo. */
175#define ECHOE 0000020 /* Visual erase for ERASE. */
176#define ECHOK 0000040 /* Echo NL after KILL. */
177#define ECHONL 0000100 /* Echo NL even if ECHO is off. */
178#define NOFLSH 0000200 /* Disable flush after interrupt. */
179#define IEXTEN 0000400 /* Enable DISCARD and LNEXT. */
180#define ECHOCTL 0001000 /* Echo control characters as ^X. */
181#define ECHOPRT 0002000 /* Hardcopy visual erase. */
182#define ECHOKE 0004000 /* Visual erase for KILL. */
183#define FLUSHO 0020000
184#define PENDIN 0040000 /* Retype pending input (state). */
185#define TOSTOP 0100000 /* Send SIGTTOU for background output. */
186#define ITOSTOP TOSTOP
187
188/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
189#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
190
191/* tcflow() and TCXONC use these */
192#define TCOOFF 0 /* Suspend output. */
193#define TCOON 1 /* Restart suspended output. */
194#define TCIOFF 2 /* Send a STOP character. */
195#define TCION 3 /* Send a START character. */
196
197/* tcflush() and TCFLSH use these */
198#define TCIFLUSH 0 /* Discard data received but not yet read. */
199#define TCOFLUSH 1 /* Discard data written but not yet sent. */
200#define TCIOFLUSH 2 /* Discard all pending data. */
201
202/* tcsetattr uses these */
203#define TCSANOW TCSETS /* Change immediately. */
204#define TCSADRAIN TCSETSW /* Change when pending output is written. */
205#define TCSAFLUSH TCSETSF /* Flush pending input before changing. */
206
207#endif /* _ASM_TERMBITS_H */
diff --git a/include/asm-mips/termios.h b/include/asm-mips/termios.h
new file mode 100644
index 000000000000..4906204d34fe
--- /dev/null
+++ b/include/asm-mips/termios.h
@@ -0,0 +1,148 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 1996, 2000, 2001 by Ralf Baechle
7 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_TERMIOS_H
10#define _ASM_TERMIOS_H
11
12#include <asm/termbits.h>
13#include <asm/ioctls.h>
14
15struct sgttyb {
16 char sg_ispeed;
17 char sg_ospeed;
18 char sg_erase;
19 char sg_kill;
20 int sg_flags; /* SGI special - int, not short */
21};
22
23struct tchars {
24 char t_intrc;
25 char t_quitc;
26 char t_startc;
27 char t_stopc;
28 char t_eofc;
29 char t_brkc;
30};
31
32struct ltchars {
33 char t_suspc; /* stop process signal */
34 char t_dsuspc; /* delayed stop process signal */
35 char t_rprntc; /* reprint line */
36 char t_flushc; /* flush output (toggles) */
37 char t_werasc; /* word erase */
38 char t_lnextc; /* literal next character */
39};
40
41/* TIOCGSIZE, TIOCSSIZE not defined yet. Only needed for SunOS source
42 compatibility anyway ... */
43
44struct winsize {
45 unsigned short ws_row;
46 unsigned short ws_col;
47 unsigned short ws_xpixel;
48 unsigned short ws_ypixel;
49};
50
51#define NCC 8
52struct termio {
53 unsigned short c_iflag; /* input mode flags */
54 unsigned short c_oflag; /* output mode flags */
55 unsigned short c_cflag; /* control mode flags */
56 unsigned short c_lflag; /* local mode flags */
57 char c_line; /* line discipline */
58 unsigned char c_cc[NCCS]; /* control characters */
59};
60
61#ifdef __KERNEL__
62#include <linux/module.h>
63
64/*
65 * intr=^C quit=^\ erase=del kill=^U
66 * vmin=\1 vtime=\0 eol2=\0 swtc=\0
67 * start=^Q stop=^S susp=^Z vdsusp=
68 * reprint=^R discard=^U werase=^W lnext=^V
69 * eof=^D eol=\0
70 */
71#define INIT_C_CC "\003\034\177\025\1\0\0\0\021\023\032\0\022\017\027\026\004\0"
72#endif
73
74/* modem lines */
75#define TIOCM_LE 0x001 /* line enable */
76#define TIOCM_DTR 0x002 /* data terminal ready */
77#define TIOCM_RTS 0x004 /* request to send */
78#define TIOCM_ST 0x010 /* secondary transmit */
79#define TIOCM_SR 0x020 /* secondary receive */
80#define TIOCM_CTS 0x040 /* clear to send */
81#define TIOCM_CAR 0x100 /* carrier detect */
82#define TIOCM_CD TIOCM_CAR
83#define TIOCM_RNG 0x200 /* ring */
84#define TIOCM_RI TIOCM_RNG
85#define TIOCM_DSR 0x400 /* data set ready */
86#define TIOCM_OUT1 0x2000
87#define TIOCM_OUT2 0x4000
88#define TIOCM_LOOP 0x8000
89
90/* line disciplines */
91#define N_TTY 0
92#define N_SLIP 1
93#define N_MOUSE 2
94#define N_PPP 3
95#define N_STRIP 4
96#define N_AX25 5
97#define N_X25 6 /* X.25 async */
98#define N_6PACK 7
99#define N_MASC 8 /* Reserved fo Mobitex module <kaz@cafe.net> */
100#define N_R3964 9 /* Reserved for Simatic R3964 module */
101#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
102#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
103#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
104#define N_HDLC 13 /* synchronous HDLC */
105#define N_SYNC_PPP 14 /* synchronous PPP */
106#define N_HCI 15 /* Bluetooth HCI UART */
107
108#ifdef __KERNEL__
109
110#include <linux/string.h>
111
112/*
113 * Translate a "termio" structure into a "termios". Ugh.
114 */
115#define user_termio_to_kernel_termios(termios, termio) \
116({ \
117 unsigned short tmp; \
118 get_user(tmp, &(termio)->c_iflag); \
119 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
120 get_user(tmp, &(termio)->c_oflag); \
121 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
122 get_user(tmp, &(termio)->c_cflag); \
123 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
124 get_user(tmp, &(termio)->c_lflag); \
125 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
126 get_user((termios)->c_line, &(termio)->c_line); \
127 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
128})
129
130/*
131 * Translate a "termios" structure into a "termio". Ugh.
132 */
133#define kernel_termios_to_user_termio(termio, termios) \
134({ \
135 put_user((termios)->c_iflag, &(termio)->c_iflag); \
136 put_user((termios)->c_oflag, &(termio)->c_oflag); \
137 put_user((termios)->c_cflag, &(termio)->c_cflag); \
138 put_user((termios)->c_lflag, &(termio)->c_lflag); \
139 put_user((termios)->c_line, &(termio)->c_line); \
140 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
141})
142
143#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
144#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
145
146#endif /* defined(__KERNEL__) */
147
148#endif /* _ASM_TERMIOS_H */
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
new file mode 100644
index 000000000000..768900305e2f
--- /dev/null
+++ b/include/asm-mips/thread_info.h
@@ -0,0 +1,137 @@
1/* thread_info.h: MIPS low-level thread information
2 *
3 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
4 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
5 */
6
7#ifndef _ASM_THREAD_INFO_H
8#define _ASM_THREAD_INFO_H
9
10#ifdef __KERNEL__
11
12#include <linux/config.h>
13
14#ifndef __ASSEMBLY__
15
16#include <asm/processor.h>
17
18/*
19 * low level task data that entry.S needs immediate access to
20 * - this struct should fit entirely inside of one cache line
21 * - this struct shares the supervisor stack pages
22 * - if the contents of this structure are changed, the assembly constants
23 * must also be changed
24 */
25struct thread_info {
26 struct task_struct *task; /* main task structure */
27 struct exec_domain *exec_domain; /* execution domain */
28 unsigned long flags; /* low level flags */
29 __u32 cpu; /* current CPU */
30 __s32 preempt_count; /* 0 => preemptable, <0 => BUG */
31
32 mm_segment_t addr_limit; /* thread address space:
33 0-0xBFFFFFFF for user-thead
34 0-0xFFFFFFFF for kernel-thread
35 */
36 struct restart_block restart_block;
37};
38
39/*
40 * macros/functions for gaining access to the thread information structure
41 *
42 * preempt_count needs to be 1 initially, until the scheduler is functional.
43 */
44#define INIT_THREAD_INFO(tsk) \
45{ \
46 .task = &tsk, \
47 .exec_domain = &default_exec_domain, \
48 .flags = 0, \
49 .cpu = 0, \
50 .preempt_count = 1, \
51 .addr_limit = KERNEL_DS, \
52 .restart_block = { \
53 .fn = do_no_restart_syscall, \
54 }, \
55}
56
57#define init_thread_info (init_thread_union.thread_info)
58#define init_stack (init_thread_union.stack)
59
60/* How to get the thread information struct from C. */
61register struct thread_info *__current_thread_info __asm__("$28");
62#define current_thread_info() __current_thread_info
63
64/* thread information allocation */
65#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_MIPS32)
66#define THREAD_SIZE_ORDER (1)
67#endif
68#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_MIPS64)
69#define THREAD_SIZE_ORDER (2)
70#endif
71#ifdef CONFIG_PAGE_SIZE_8KB
72#define THREAD_SIZE_ORDER (1)
73#endif
74#ifdef CONFIG_PAGE_SIZE_16KB
75#define THREAD_SIZE_ORDER (0)
76#endif
77#ifdef CONFIG_PAGE_SIZE_64KB
78#define THREAD_SIZE_ORDER (0)
79#endif
80
81#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
82#define THREAD_MASK (THREAD_SIZE - 1UL)
83
84#ifdef CONFIG_DEBUG_STACK_USAGE
85#define alloc_thread_info(tsk) \
86({ \
87 struct thread_info *ret; \
88 \
89 ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \
90 if (ret) \
91 memset(ret, 0, THREAD_SIZE); \
92 ret; \
93})
94#else
95#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
96#endif
97
98#define free_thread_info(info) kfree(info)
99#define get_thread_info(ti) get_task_struct((ti)->task)
100#define put_thread_info(ti) put_task_struct((ti)->task)
101
102#endif /* !__ASSEMBLY__ */
103
104#define PREEMPT_ACTIVE 0x10000000
105
106/*
107 * thread information flags
108 * - these are process state flags that various assembly files may need to
109 * access
110 * - pending work-to-be-done flags are in LSW
111 * - other flags in MSW
112 */
113#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
114#define TIF_SIGPENDING 2 /* signal pending */
115#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
116#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
117#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
118#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
119#define TIF_MEMDIE 18
120#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
121
122#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
123#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
124#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
125#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
126#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
127#define _TIF_USEDFPU (1<<TIF_USEDFPU)
128#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
129
130#define _TIF_WORK_MASK 0x0000ffef /* work to do on
131 interrupt/exception return */
132#define _TIF_ALLWORK_MASK 0x8000ffff /* work to do on any return to
133 u-space */
134
135#endif /* __KERNEL__ */
136
137#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
new file mode 100644
index 000000000000..e22a20665871
--- /dev/null
+++ b/include/asm-mips/time.h
@@ -0,0 +1,96 @@
1/*
2 * Copyright (C) 2001, 2002, MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 * Copyright (c) 2003 Maciej W. Rozycki
5 *
6 * include/asm-mips/time.h
7 * header file for the new style time.c file and time services.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * Please refer to Documentation/mips/time.README.
15 */
16#ifndef _ASM_TIME_H
17#define _ASM_TIME_H
18
19#include <linux/interrupt.h>
20#include <linux/linkage.h>
21#include <linux/ptrace.h>
22#include <linux/rtc.h>
23
24/*
25 * RTC ops. By default, they point to no-RTC functions.
26 * rtc_get_time - mktime(year, mon, day, hour, min, sec) in seconds.
27 * rtc_set_time - reverse the above translation and set time to RTC.
28 * rtc_set_mmss - similar to rtc_set_time, but only min and sec need
29 * to be set. Used by RTC sync-up.
30 */
31extern unsigned long (*rtc_get_time)(void);
32extern int (*rtc_set_time)(unsigned long);
33extern int (*rtc_set_mmss)(unsigned long);
34
35/*
36 * Timer interrupt functions.
37 * mips_timer_state is needed for high precision timer calibration.
38 * mips_timer_ack may be NULL if the interrupt is self-recoverable.
39 */
40extern int (*mips_timer_state)(void);
41extern void (*mips_timer_ack)(void);
42
43/*
44 * High precision timer functions.
45 * If mips_hpt_read is NULL, an R4k-compatible timer setup is attempted.
46 */
47extern unsigned int (*mips_hpt_read)(void);
48extern void (*mips_hpt_init)(unsigned int);
49
50/*
51 * to_tm() converts system time back to (year, mon, day, hour, min, sec).
52 * It is intended to help implement rtc_set_time() functions.
53 * Copied from PPC implementation.
54 */
55extern void to_tm(unsigned long tim, struct rtc_time *tm);
56
57/*
58 * do_gettimeoffset(). By default, this func pointer points to
59 * do_null_gettimeoffset(), which leads to the same resolution as HZ.
60 * Higher resolution versions are available, which give ~1us resolution.
61 */
62extern unsigned long (*do_gettimeoffset)(void);
63
64/*
65 * high-level timer interrupt routines.
66 */
67extern irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs);
68
69/*
70 * the corresponding low-level timer interrupt routine.
71 */
72extern asmlinkage void ll_timer_interrupt(int irq, struct pt_regs *regs);
73
74/*
75 * profiling and process accouting is done separately in local_timer_interrupt
76 */
77extern void local_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs);
78extern asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs);
79
80/*
81 * board specific routines required by time_init().
82 * board_time_init is defaulted to NULL and can remain so.
83 * board_timer_setup must be setup properly in machine setup routine.
84 */
85struct irqaction;
86extern void (*board_time_init)(void);
87extern void (*board_timer_setup)(struct irqaction *irq);
88
89/*
90 * mips_hpt_frequency - must be set if you intend to use an R4k-compatible
91 * counter as a timer interrupt source; otherwise it can be set up
92 * automagically with an aid of mips_timer_state.
93 */
94extern unsigned int mips_hpt_frequency;
95
96#endif /* _ASM_TIME_H */
diff --git a/include/asm-mips/timex.h b/include/asm-mips/timex.h
new file mode 100644
index 000000000000..98aa737b34aa
--- /dev/null
+++ b/include/asm-mips/timex.h
@@ -0,0 +1,54 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1998, 1999, 2003 by Ralf Baechle
7 */
8#ifndef _ASM_TIMEX_H
9#define _ASM_TIMEX_H
10
11#include <asm/mipsregs.h>
12
13/*
14 * This is the frequency of the timer used for Linux's timer interrupt.
15 * The value should be defined as accurate as possible or under certain
16 * circumstances Linux timekeeping might become inaccurate or fail.
17 *
18 * For many system the exact clockrate of the timer isn't known but due to
19 * the way this value is used we can get away with a wrong value as long
20 * as this value is:
21 *
22 * - a multiple of HZ
23 * - a divisor of the actual rate
24 *
25 * 500000 is a good such cheat value.
26 *
27 * The obscure number 1193182 is the same as used by the original i8254
28 * time in legacy PC hardware; the chip unfortunately also found in a
29 * bunch of MIPS systems. The last remaining user of the i8254 for the
30 * timer interrupt is the RM200; it's a very standard system so there is
31 * no reason to make this a separate architecture.
32 */
33
34#include <timex.h>
35
36/*
37 * Standard way to access the cycle counter.
38 * Currently only used on SMP for scheduling.
39 *
40 * Only the low 32 bits are available as a continuously counting entity.
41 * But this only means we'll force a reschedule every 8 seconds or so,
42 * which isn't an evil thing.
43 *
44 * We know that all SMP capable CPUs have cycle counters.
45 */
46
47typedef unsigned int cycles_t;
48
49static inline cycles_t get_cycles (void)
50{
51 return read_c0_count();
52}
53
54#endif /* _ASM_TIMEX_H */
diff --git a/include/asm-mips/titan_dep.h b/include/asm-mips/titan_dep.h
new file mode 100644
index 000000000000..fd9599e40a0a
--- /dev/null
+++ b/include/asm-mips/titan_dep.h
@@ -0,0 +1,231 @@
1/*
2 * Copyright 2003 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * Board specific definititions for the PMC-Sierra Yosemite
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __TITAN_DEP_H__
14#define __TITAN_DEP_H__
15
16#include <asm/addrspace.h> /* for KSEG1ADDR() */
17#include <asm/byteorder.h> /* for cpu_to_le32() */
18
19#define TITAN_READ(ofs) \
20 (*(volatile u32 *)(ocd_base+(ofs)))
21#define TITAN_READ_16(ofs) \
22 (*(volatile u16 *)(ocd_base+(ofs)))
23#define TITAN_READ_8(ofs) \
24 (*(volatile u8 *)(ocd_base+(ofs)))
25
26#define TITAN_WRITE(ofs, data) \
27 do { *(volatile u32 *)(ocd_base+(ofs)) = (data); } while (0)
28#define TITAN_WRITE_16(ofs, data) \
29 do { *(volatile u16 *)(ocd_base+(ofs)) = (data); } while (0)
30#define TITAN_WRITE_8(ofs, data) \
31 do { *(volatile u8 *)(ocd_base+(ofs)) = (data); } while (0)
32
33/*
34 * PCI specific defines
35 */
36#define TITAN_PCI_0_CONFIG_ADDRESS 0x780
37#define TITAN_PCI_0_CONFIG_DATA 0x784
38
39/*
40 * HT specific defines
41 */
42#define RM9000x2_HTLINK_REG 0xbb000644
43#define RM9000x2_BASE_ADDR 0xbb000000
44
45#define OCD_BASE 0xfb000000UL
46#define OCD_SIZE 0x3000UL
47
48extern unsigned long ocd_base;
49
50/*
51 * OCD Registers
52 */
53#define RM9000x2_OCD_LKB5 0x0128 /* Ethernet */
54#define RM9000x2_OCD_LKM5 0x012c
55
56#define RM9000x2_OCD_LKB7 0x0138 /* HT Region 0 */
57#define RM9000x2_OCD_LKM7 0x013c
58#define RM9000x2_OCD_LKB8 0x0140 /* HT Region 1 */
59#define RM9000x2_OCD_LKM8 0x0144
60
61#define RM9000x2_OCD_LKB9 0x0148 /* Local Bus */
62#define RM9000x2_OCD_LKM9 0x014c
63#define RM9000x2_OCD_LKB10 0x0150
64#define RM9000x2_OCD_LKM10 0x0154
65#define RM9000x2_OCD_LKB11 0x0158
66#define RM9000x2_OCD_LKM11 0x015c
67#define RM9000x2_OCD_LKB12 0x0160
68#define RM9000x2_OCD_LKM12 0x0164
69
70#define RM9000x2_OCD_LKB13 0x0168 /* Scratch RAM */
71#define RM9000x2_OCD_LKM13 0x016c
72
73#define RM9000x2_OCD_LPD0 0x0200 /* Local Bus */
74#define RM9000x2_OCD_LPD1 0x0210
75#define RM9000x2_OCD_LPD2 0x0220
76#define RM9000x2_OCD_LPD3 0x0230
77
78#define RM9000x2_OCD_HTDVID 0x0600 /* HT Device Header */
79#define RM9000x2_OCD_HTSC 0x0604
80#define RM9000x2_OCD_HTCCR 0x0608
81#define RM9000x2_OCD_HTBHL 0x060c
82#define RM9000x2_OCD_HTBAR0 0x0610
83#define RM9000x2_OCD_HTBAR1 0x0614
84#define RM9000x2_OCD_HTBAR2 0x0618
85#define RM9000x2_OCD_HTBAR3 0x061c
86#define RM9000x2_OCD_HTBAR4 0x0620
87#define RM9000x2_OCD_HTBAR5 0x0624
88#define RM9000x2_OCD_HTCBCPT 0x0628
89#define RM9000x2_OCD_HTSDVID 0x062c
90#define RM9000x2_OCD_HTXRA 0x0630
91#define RM9000x2_OCD_HTCAP1 0x0634
92#define RM9000x2_OCD_HTIL 0x063c
93
94#define RM9000x2_OCD_HTLCC 0x0640 /* HT Capability Block */
95#define RM9000x2_OCD_HTLINK 0x0644
96#define RM9000x2_OCD_HTFQREV 0x0648
97
98#define RM9000x2_OCD_HTERCTL 0x0668 /* HT Controller */
99#define RM9000x2_OCD_HTRXDB 0x066c
100#define RM9000x2_OCD_HTIMPED 0x0670
101#define RM9000x2_OCD_HTSWIMP 0x0674
102#define RM9000x2_OCD_HTCAL 0x0678
103
104#define RM9000x2_OCD_HTBAA30 0x0680
105#define RM9000x2_OCD_HTBAA54 0x0684
106#define RM9000x2_OCD_HTMASK0 0x0688
107#define RM9000x2_OCD_HTMASK1 0x068c
108#define RM9000x2_OCD_HTMASK2 0x0690
109#define RM9000x2_OCD_HTMASK3 0x0694
110#define RM9000x2_OCD_HTMASK4 0x0698
111#define RM9000x2_OCD_HTMASK5 0x069c
112
113#define RM9000x2_OCD_HTIFCTL 0x06a0
114#define RM9000x2_OCD_HTPLL 0x06a4
115
116#define RM9000x2_OCD_HTSRI 0x06b0
117#define RM9000x2_OCD_HTRXNUM 0x06b4
118#define RM9000x2_OCD_HTTXNUM 0x06b8
119
120#define RM9000x2_OCD_HTTXCNT 0x06c8
121
122#define RM9000x2_OCD_HTERROR 0x06d8
123#define RM9000x2_OCD_HTRCRCE 0x06dc
124#define RM9000x2_OCD_HTEOI 0x06e0
125
126#define RM9000x2_OCD_CRCR 0x06f0
127
128#define RM9000x2_OCD_HTCFGA 0x06f8
129#define RM9000x2_OCD_HTCFGD 0x06fc
130
131#define RM9000x2_OCD_INTMSG 0x0a00
132
133#define RM9000x2_OCD_INTPIN0 0x0a40
134#define RM9000x2_OCD_INTPIN1 0x0a44
135#define RM9000x2_OCD_INTPIN2 0x0a48
136#define RM9000x2_OCD_INTPIN3 0x0a4c
137#define RM9000x2_OCD_INTPIN4 0x0a50
138#define RM9000x2_OCD_INTPIN5 0x0a54
139#define RM9000x2_OCD_INTPIN6 0x0a58
140#define RM9000x2_OCD_INTPIN7 0x0a5c
141#define RM9000x2_OCD_SEM 0x0a60
142#define RM9000x2_OCD_SEMSET 0x0a64
143#define RM9000x2_OCD_SEMCLR 0x0a68
144
145#define RM9000x2_OCD_TKT 0x0a70
146#define RM9000x2_OCD_TKTINC 0x0a74
147
148#define RM9000x2_OCD_NMICONFIG 0x0ac0 /* Interrupts */
149#define RM9000x2_OCD_INTP0PRI 0x1a80
150#define RM9000x2_OCD_INTP1PRI 0x1a80
151#define RM9000x2_OCD_INTP0STATUS0 0x1b00
152#define RM9000x2_OCD_INTP0MASK0 0x1b04
153#define RM9000x2_OCD_INTP0SET0 0x1b08
154#define RM9000x2_OCD_INTP0CLEAR0 0x1b0c
155#define RM9000x2_OCD_INTP0STATUS1 0x1b10
156#define RM9000x2_OCD_INTP0MASK1 0x1b14
157#define RM9000x2_OCD_INTP0SET1 0x1b18
158#define RM9000x2_OCD_INTP0CLEAR1 0x1b1c
159#define RM9000x2_OCD_INTP0STATUS2 0x1b20
160#define RM9000x2_OCD_INTP0MASK2 0x1b24
161#define RM9000x2_OCD_INTP0SET2 0x1b28
162#define RM9000x2_OCD_INTP0CLEAR2 0x1b2c
163#define RM9000x2_OCD_INTP0STATUS3 0x1b30
164#define RM9000x2_OCD_INTP0MASK3 0x1b34
165#define RM9000x2_OCD_INTP0SET3 0x1b38
166#define RM9000x2_OCD_INTP0CLEAR3 0x1b3c
167#define RM9000x2_OCD_INTP0STATUS4 0x1b40
168#define RM9000x2_OCD_INTP0MASK4 0x1b44
169#define RM9000x2_OCD_INTP0SET4 0x1b48
170#define RM9000x2_OCD_INTP0CLEAR4 0x1b4c
171#define RM9000x2_OCD_INTP0STATUS5 0x1b50
172#define RM9000x2_OCD_INTP0MASK5 0x1b54
173#define RM9000x2_OCD_INTP0SET5 0x1b58
174#define RM9000x2_OCD_INTP0CLEAR5 0x1b5c
175#define RM9000x2_OCD_INTP0STATUS6 0x1b60
176#define RM9000x2_OCD_INTP0MASK6 0x1b64
177#define RM9000x2_OCD_INTP0SET6 0x1b68
178#define RM9000x2_OCD_INTP0CLEAR6 0x1b6c
179#define RM9000x2_OCD_INTP0STATUS7 0x1b70
180#define RM9000x2_OCD_INTP0MASK7 0x1b74
181#define RM9000x2_OCD_INTP0SET7 0x1b78
182#define RM9000x2_OCD_INTP0CLEAR7 0x1b7c
183#define RM9000x2_OCD_INTP1STATUS0 0x2b00
184#define RM9000x2_OCD_INTP1MASK0 0x2b04
185#define RM9000x2_OCD_INTP1SET0 0x2b08
186#define RM9000x2_OCD_INTP1CLEAR0 0x2b0c
187#define RM9000x2_OCD_INTP1STATUS1 0x2b10
188#define RM9000x2_OCD_INTP1MASK1 0x2b14
189#define RM9000x2_OCD_INTP1SET1 0x2b18
190#define RM9000x2_OCD_INTP1CLEAR1 0x2b1c
191#define RM9000x2_OCD_INTP1STATUS2 0x2b20
192#define RM9000x2_OCD_INTP1MASK2 0x2b24
193#define RM9000x2_OCD_INTP1SET2 0x2b28
194#define RM9000x2_OCD_INTP1CLEAR2 0x2b2c
195#define RM9000x2_OCD_INTP1STATUS3 0x2b30
196#define RM9000x2_OCD_INTP1MASK3 0x2b34
197#define RM9000x2_OCD_INTP1SET3 0x2b38
198#define RM9000x2_OCD_INTP1CLEAR3 0x2b3c
199#define RM9000x2_OCD_INTP1STATUS4 0x2b40
200#define RM9000x2_OCD_INTP1MASK4 0x2b44
201#define RM9000x2_OCD_INTP1SET4 0x2b48
202#define RM9000x2_OCD_INTP1CLEAR4 0x2b4c
203#define RM9000x2_OCD_INTP1STATUS5 0x2b50
204#define RM9000x2_OCD_INTP1MASK5 0x2b54
205#define RM9000x2_OCD_INTP1SET5 0x2b58
206#define RM9000x2_OCD_INTP1CLEAR5 0x2b5c
207#define RM9000x2_OCD_INTP1STATUS6 0x2b60
208#define RM9000x2_OCD_INTP1MASK6 0x2b64
209#define RM9000x2_OCD_INTP1SET6 0x2b68
210#define RM9000x2_OCD_INTP1CLEAR6 0x2b6c
211#define RM9000x2_OCD_INTP1STATUS7 0x2b70
212#define RM9000x2_OCD_INTP1MASK7 0x2b74
213#define RM9000x2_OCD_INTP1SET7 0x2b78
214#define RM9000x2_OCD_INTP1CLEAR7 0x2b7c
215
216#define OCD_READ(reg) (*(volatile unsigned int *)(ocd_base + (reg)))
217#define OCD_WRITE(reg, val) \
218 do { *(volatile unsigned int *)(ocd_base + (reg)) = (val); } while (0)
219
220/*
221 * Hypertransport specific macros
222 */
223#define RM9K_WRITE(ofs, data) *(volatile u_int32_t *)(RM9000x2_BASE_ADDR+ofs) = data
224#define RM9K_WRITE_8(ofs, data) *(volatile u8 *)(RM9000x2_BASE_ADDR+ofs) = data
225#define RM9K_WRITE_16(ofs, data) *(volatile u16 *)(RM9000x2_BASE_ADDR+ofs) = data
226
227#define RM9K_READ(ofs, val) *(val) = *(volatile u_int32_t *)(RM9000x2_BASE_ADDR+ofs)
228#define RM9K_READ_8(ofs, val) *(val) = *(volatile u8 *)(RM9000x2_BASE_ADDR+ofs)
229#define RM9K_READ_16(ofs, val) *(val) = *(volatile u16 *)(RM9000x2_BASE_ADDR+ofs)
230
231#endif
diff --git a/include/asm-mips/tlb.h b/include/asm-mips/tlb.h
new file mode 100644
index 000000000000..80d9dfcf1e88
--- /dev/null
+++ b/include/asm-mips/tlb.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_TLB_H
2#define __ASM_TLB_H
3
4/*
5 * MIPS doesn't need any special per-pte or per-vma handling, except
6 * we need to flush cache for area to be unmapped.
7 */
8#define tlb_start_vma(tlb, vma) \
9 do { \
10 if (!tlb->fullmm) \
11 flush_cache_range(vma, vma->vm_start, vma->vm_end); \
12 } while (0)
13#define tlb_end_vma(tlb, vma) do { } while (0)
14#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
15
16/*
17 * .. because we flush the whole mm when it fills up.
18 */
19#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
20
21#include <asm-generic/tlb.h>
22
23#endif /* __ASM_TLB_H */
diff --git a/include/asm-mips/tlbdebug.h b/include/asm-mips/tlbdebug.h
new file mode 100644
index 000000000000..fff7a73e22d0
--- /dev/null
+++ b/include/asm-mips/tlbdebug.h
@@ -0,0 +1,20 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002 by Ralf Baechle
7 */
8#ifndef __ASM_TLBDEBUG_H
9#define __ASM_TLBDEBUG_H
10
11/*
12 * TLB debugging functions:
13 */
14extern void dump_tlb(int first, int last);
15extern void dump_tlb_all(void);
16extern void dump_tlb_wired(void);
17extern void dump_tlb_addr(unsigned long addr);
18extern void dump_tlb_nonwired(void);
19
20#endif /* __ASM_TLBDEBUG_H */
diff --git a/include/asm-mips/tlbflush.h b/include/asm-mips/tlbflush.h
new file mode 100644
index 000000000000..bb4ae3cdcbf1
--- /dev/null
+++ b/include/asm-mips/tlbflush.h
@@ -0,0 +1,55 @@
1#ifndef __ASM_TLBFLUSH_H
2#define __ASM_TLBFLUSH_H
3
4#include <linux/config.h>
5#include <linux/mm.h>
6
7/*
8 * TLB flushing:
9 *
10 * - flush_tlb_all() flushes all processes TLB entries
11 * - flush_tlb_mm(mm) flushes the specified mm context TLB entries
12 * - flush_tlb_page(vma, vmaddr) flushes one page
13 * - flush_tlb_range(vma, start, end) flushes a range of pages
14 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
15 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
16 */
17extern void local_flush_tlb_all(void);
18extern void local_flush_tlb_mm(struct mm_struct *mm);
19extern void local_flush_tlb_range(struct vm_area_struct *vma,
20 unsigned long start, unsigned long end);
21extern void local_flush_tlb_kernel_range(unsigned long start,
22 unsigned long end);
23extern void local_flush_tlb_page(struct vm_area_struct *vma,
24 unsigned long page);
25extern void local_flush_tlb_one(unsigned long vaddr);
26
27#ifdef CONFIG_SMP
28
29extern void flush_tlb_all(void);
30extern void flush_tlb_mm(struct mm_struct *);
31extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long,
32 unsigned long);
33extern void flush_tlb_kernel_range(unsigned long, unsigned long);
34extern void flush_tlb_page(struct vm_area_struct *, unsigned long);
35extern void flush_tlb_one(unsigned long vaddr);
36
37#else /* CONFIG_SMP */
38
39#define flush_tlb_all() local_flush_tlb_all()
40#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
41#define flush_tlb_range(vma,vmaddr,end) local_flush_tlb_range(vma, vmaddr, end)
42#define flush_tlb_kernel_range(vmaddr,end) \
43 local_flush_tlb_kernel_range(vmaddr, end)
44#define flush_tlb_page(vma,page) local_flush_tlb_page(vma, page)
45#define flush_tlb_one(vaddr) local_flush_tlb_one(vaddr)
46
47#endif /* CONFIG_SMP */
48
49static inline void flush_tlb_pgtables(struct mm_struct *mm,
50 unsigned long start, unsigned long end)
51{
52 /* Nothing to do on MIPS. */
53}
54
55#endif /* __ASM_TLBFLUSH_H */
diff --git a/include/asm-mips/topology.h b/include/asm-mips/topology.h
new file mode 100644
index 000000000000..0440fb9f2180
--- /dev/null
+++ b/include/asm-mips/topology.h
@@ -0,0 +1 @@
#include <topology.h>
diff --git a/include/asm-mips/traps.h b/include/asm-mips/traps.h
new file mode 100644
index 000000000000..179012263007
--- /dev/null
+++ b/include/asm-mips/traps.h
@@ -0,0 +1,24 @@
1/*
2 * Trap handling definitions.
3 *
4 * Copyright (C) 2002, 2003 Maciej W. Rozycki
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASM_TRAPS_H
12#define _ASM_TRAPS_H
13
14/*
15 * Possible status responses for a board_be_handler backend.
16 */
17#define MIPS_BE_DISCARD 0 /* return with no action */
18#define MIPS_BE_FIXUP 1 /* return to the fixup code */
19#define MIPS_BE_FATAL 2 /* treat as an unrecoverable error */
20
21extern void (*board_be_init)(void);
22extern int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
23
24#endif /* _ASM_TRAPS_H */
diff --git a/include/asm-mips/tx3912.h b/include/asm-mips/tx3912.h
new file mode 100644
index 000000000000..d709d87363d0
--- /dev/null
+++ b/include/asm-mips/tx3912.h
@@ -0,0 +1,361 @@
1/*
2 * include/asm-mips/tx3912.h
3 *
4 * Copyright (C) 2001 Steven J. Hill (sjhill@realitydiluted.com)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Registers for TMPR3912/05 and PR31700 processors
11 */
12#ifndef _TX3912_H_
13#define _TX3912_H_
14
15/*****************************************************************************
16 * Clock Subsystem *
17 * --------------- *
18 * Chapter 6 in Philips PR31700 and Toshiba TMPR3905/12 User Manuals *
19 *****************************************************************************/
20#define TX3912_CLK_CTRL 0x01c0
21
22/*
23 * Clock control register values
24 */
25#define TX3912_CLK_CTRL_CHICLKDIV_MASK 0xff000000
26#define TX3912_CLK_CTRL_ENCLKTEST 0x00800000
27#define TX3912_CLK_CTRL_CLKTESTSELSIB 0x00400000
28#define TX3912_CLK_CTRL_CHIMCLKSEL 0x00200000
29#define TX3912_CLK_CTRL_CHICLKDIR 0x00100000
30#define TX3912_CLK_CTRL_ENCHIMCLK 0x00080000
31#define TX3912_CLK_CTRL_ENVIDCLK 0x00040000
32#define TX3912_CLK_CTRL_ENMBUSCLK 0x00020000
33#define TX3912_CLK_CTRL_ENSPICLK 0x00010000
34#define TX3912_CLK_CTRL_ENTIMERCLK 0x00008000
35#define TX3912_CLK_CTRL_ENFASTTIMERCLK 0x00004000
36#define TX3912_CLK_CTRL_SIBMCLKDIR 0x00002000
37#define TX3912_CLK_CTRL_reserved1 0x00001000
38#define TX3912_CLK_CTRL_ENSIBMCLK 0x00000800
39#define TX3912_CLK_CTRL_SIBMCLKDIV_6 0x00000600
40#define TX3912_CLK_CTRL_SIBMCLKDIV_5 0x00000500
41#define TX3912_CLK_CTRL_SIBMCLKDIV_4 0x00000400
42#define TX3912_CLK_CTRL_SIBMCLKDIV_3 0x00000300
43#define TX3912_CLK_CTRL_SIBMCLKDIV_2 0x00000200
44#define TX3912_CLK_CTRL_SIBMCLKDIV_1 0x00000100
45#define TX3912_CLK_CTRL_CSERSEL 0x00000080
46#define TX3912_CLK_CTRL_CSERDIV_6 0x00000060
47#define TX3912_CLK_CTRL_CSERDIV_5 0x00000050
48#define TX3912_CLK_CTRL_CSERDIV_4 0x00000040
49#define TX3912_CLK_CTRL_CSERDIV_3 0x00000030
50#define TX3912_CLK_CTRL_CSERDIV_2 0x00000020
51#define TX3912_CLK_CTRL_CSERDIV_1 0x00000010
52#define TX3912_CLK_CTRL_ENCSERCLK 0x00000008
53#define TX3912_CLK_CTRL_ENIRCLK 0x00000004
54#define TX3912_CLK_CTRL_ENUARTACLK 0x00000002
55#define TX3912_CLK_CTRL_ENUARTBCLK 0x00000001
56
57
58/*****************************************************************************
59 * Interrupt Subsystem *
60 * ------------------- *
61 * Chapter 8 in Philips PR31700 and Toshiba TMPR3905/12 User Manuals *
62 *****************************************************************************/
63#define TX3912_INT1_CLEAR 0x0100
64#define TX3912_INT2_CLEAR 0x0104
65#define TX3912_INT3_CLEAR 0x0108
66#define TX3912_INT4_CLEAR 0x010c
67#define TX3912_INT5_CLEAR 0x0110
68#define TX3912_INT1_ENABLE 0x0118
69#define TX3912_INT2_ENABLE 0x011c
70#define TX3912_INT3_ENABLE 0x0120
71#define TX3912_INT4_ENABLE 0x0124
72#define TX3912_INT5_ENABLE 0x0128
73#define TX3912_INT6_ENABLE 0x012c
74#define TX3912_INT1_STATUS 0x0100
75#define TX3912_INT2_STATUS 0x0104
76#define TX3912_INT3_STATUS 0x0108
77#define TX3912_INT4_STATUS 0x010c
78#define TX3912_INT5_STATUS 0x0110
79#define TX3912_INT6_STATUS 0x0114
80
81/*
82 * Interrupt 2 register values
83 */
84#define TX3912_INT2_UARTARXINT 0x80000000
85#define TX3912_INT2_UARTARXOVERRUNINT 0x40000000
86#define TX3912_INT2_UARTAFRAMEERRINT 0x20000000
87#define TX3912_INT2_UARTABREAKINT 0x10000000
88#define TX3912_INT2_UARTAPARITYINT 0x08000000
89#define TX3912_INT2_UARTATXINT 0x04000000
90#define TX3912_INT2_UARTATXOVERRUNINT 0x02000000
91#define TX3912_INT2_UARTAEMPTYINT 0x01000000
92#define TX3912_INT2_UARTADMAFULLINT 0x00800000
93#define TX3912_INT2_UARTADMAHALFINT 0x00400000
94#define TX3912_INT2_UARTBRXINT 0x00200000
95#define TX3912_INT2_UARTBRXOVERRUNINT 0x00100000
96#define TX3912_INT2_UARTBFRAMEERRINT 0x00080000
97#define TX3912_INT2_UARTBBREAKINT 0x00040000
98#define TX3912_INT2_UARTBPARITYINT 0x00020000
99#define TX3912_INT2_UARTBTXINT 0x00010000
100#define TX3912_INT2_UARTBTXOVERRUNINT 0x00008000
101#define TX3912_INT2_UARTBEMPTYINT 0x00004000
102#define TX3912_INT2_UARTBDMAFULLINT 0x00002000
103#define TX3912_INT2_UARTBDMAHALFINT 0x00001000
104#define TX3912_INT2_UARTA_RX_BITS 0xf8000000
105#define TX3912_INT2_UARTA_TX_BITS 0x07c00000
106#define TX3912_INT2_UARTB_RX_BITS 0x003e0000
107#define TX3912_INT2_UARTB_TX_BITS 0x0001f000
108
109/*
110 * Interrupt 5 register values
111 */
112#define TX3912_INT5_RTCINT 0x80000000
113#define TX3912_INT5_ALARMINT 0x40000000
114#define TX3912_INT5_PERINT 0x20000000
115#define TX3912_INT5_STPTIMERINT 0x10000000
116#define TX3912_INT5_POSPWRINT 0x08000000
117#define TX3912_INT5_NEGPWRINT 0x04000000
118#define TX3912_INT5_POSPWROKINT 0x02000000
119#define TX3912_INT5_NEGPWROKINT 0x01000000
120#define TX3912_INT5_POSONBUTINT 0x00800000
121#define TX3912_INT5_NEGONBUTINT 0x00400000
122#define TX3912_INT5_SPIBUFAVAILINT 0x00200000
123#define TX3912_INT5_SPIERRINT 0x00100000
124#define TX3912_INT5_SPIRCVINT 0x00080000
125#define TX3912_INT5_SPIEMPTYINT 0x00040000
126#define TX3912_INT5_IRCONSMINT 0x00020000
127#define TX3912_INT5_CARSTINT 0x00010000
128#define TX3912_INT5_POSCARINT 0x00008000
129#define TX3912_INT5_NEGCARINT 0x00004000
130#define TX3912_INT5_IOPOSINT6 0x00002000
131#define TX3912_INT5_IOPOSINT5 0x00001000
132#define TX3912_INT5_IOPOSINT4 0x00000800
133#define TX3912_INT5_IOPOSINT3 0x00000400
134#define TX3912_INT5_IOPOSINT2 0x00000200
135#define TX3912_INT5_IOPOSINT1 0x00000100
136#define TX3912_INT5_IOPOSINT0 0x00000080
137#define TX3912_INT5_IONEGINT6 0x00000040
138#define TX3912_INT5_IONEGINT5 0x00000020
139#define TX3912_INT5_IONEGINT4 0x00000010
140#define TX3912_INT5_IONEGINT3 0x00000008
141#define TX3912_INT5_IONEGINT2 0x00000004
142#define TX3912_INT5_IONEGINT1 0x00000002
143#define TX3912_INT5_IONEGINT0 0x00000001
144
145/*
146 * Interrupt 6 status register values
147 */
148#define TX3912_INT6_STATUS_IRQHIGH 0x80000000
149#define TX3912_INT6_STATUS_IRQLOW 0x40000000
150#define TX3912_INT6_STATUS_reserved6 0x3fffffc0
151#define TX3912_INT6_STATUS_INTVEC_POSNEGPWROKINT 0x0000003c
152#define TX3912_INT6_STATUS_INTVEC_ALARMINT 0x00000038
153#define TX3912_INT6_STATUS_INTVEC_PERINT 0x00000034
154#define TX3912_INT6_STATUS_INTVEC_reserved5 0x00000030
155#define TX3912_INT6_STATUS_INTVEC_UARTARXINT 0x0000002c
156#define TX3912_INT6_STATUS_INTVEC_UARTBRXINT 0x00000028
157#define TX3912_INT6_STATUS_INTVEC_reserved4 0x00000024
158#define TX3912_INT6_STATUS_INTVEC_IOPOSINT65 0x00000020
159#define TX3912_INT6_STATUS_INTVEC_reserved3 0x0000001c
160#define TX3912_INT6_STATUS_INTVEC_IONEGINT65 0x00000018
161#define TX3912_INT6_STATUS_INTVEC_reserved2 0x00000014
162#define TX3912_INT6_STATUS_INTVEC_SNDDMACNTINT 0x00000010
163#define TX3912_INT6_STATUS_INTVEC_TELDMACNTINT 0x0000000c
164#define TX3912_INT6_STATUS_INTVEC_CHIDMACNTINT 0x00000008
165#define TX3912_INT6_STATUS_INTVEC_IOPOSNEGINT0 0x00000004
166#define TX3912_INT6_STATUS_INTVEC_STDHANDLER 0x00000000
167#define TX3912_INT6_STATUS_reserved1 0x00000003
168
169/*
170 * Interrupt 6 enable register values
171 */
172#define TX3912_INT6_ENABLE_reserved5 0xfff80000
173#define TX3912_INT6_ENABLE_GLOBALEN 0x00040000
174#define TX3912_INT6_ENABLE_IRQPRITEST 0x00020000
175#define TX3912_INT6_ENABLE_IRQTEST 0x00010000
176#define TX3912_INT6_ENABLE_PRIORITYMASK_POSNEGPWROKINT 0x00008000
177#define TX3912_INT6_ENABLE_PRIORITYMASK_ALARMINT 0x00004000
178#define TX3912_INT6_ENABLE_PRIORITYMASK_PERINT 0x00002000
179#define TX3912_INT6_ENABLE_PRIORITYMASK_reserved4 0x00001000
180#define TX3912_INT6_ENABLE_PRIORITYMASK_UARTARXINT 0x00000800
181#define TX3912_INT6_ENABLE_PRIORITYMASK_UARTBRXINT 0x00000400
182#define TX3912_INT6_ENABLE_PRIORITYMASK_reserved3 0x00000200
183#define TX3912_INT6_ENABLE_PRIORITYMASK_IOPOSINT65 0x00000100
184#define TX3912_INT6_ENABLE_PRIORITYMASK_reserved2 0x00000080
185#define TX3912_INT6_ENABLE_PRIORITYMASK_IONEGINT65 0x00000040
186#define TX3912_INT6_ENABLE_PRIORITYMASK_reserved1 0x00000020
187#define TX3912_INT6_ENABLE_PRIORITYMASK_SNDDMACNTINT 0x00000010
188#define TX3912_INT6_ENABLE_PRIORITYMASK_TELDMACNTINT 0x00000008
189#define TX3912_INT6_ENABLE_PRIORITYMASK_CHIDMACNTINT 0x00000004
190#define TX3912_INT6_ENABLE_PRIORITYMASK_IOPOSNEGINT0 0x00000002
191#define TX3912_INT6_ENABLE_PRIORITYMASK_STDHANDLER 0x00000001
192#define TX3912_INT6_ENABLE_HIGH_PRIORITY 0x0000ffff
193
194
195/*****************************************************************************
196 * Power Subsystem *
197 * --------------- *
198 * Chapter 11 in Philips PR31700 User Manual *
199 * Chapter 12 in Toshiba TMPR3905/12 User Manual *
200 *****************************************************************************/
201#define TX3912_POWER_CTRL 0x01c4
202
203/*
204 * Power control register values
205 */
206#define TX3912_POWER_CTRL_ONBUTN 0x80000000
207#define TX3912_POWER_CTRL_PWRINT 0x40000000
208#define TX3912_POWER_CTRL_PWROK 0x20000000
209#define TX3912_POWER_CTRL_VIDRF_MASK 0x18000000
210#define TX3912_POWER_CTRL_SLOWBUS 0x04000000
211#define TX3912_POWER_CTRL_DIVMOD 0x02000000
212#define TX3912_POWER_CTRL_reserved2 0x01ff0000
213#define TX3912_POWER_CTRL_STPTIMERVAL_MASK 0x0000f000
214#define TX3912_POWER_CTRL_ENSTPTIMER 0x00000800
215#define TX3912_POWER_CTRL_ENFORCESHUTDWN 0x00000400
216#define TX3912_POWER_CTRL_FORCESHUTDWN 0x00000200
217#define TX3912_POWER_CTRL_FORCESHUTDWNOCC 0x00000100
218#define TX3912_POWER_CTRL_SELC2MS 0x00000080
219#define TX3912_POWER_CTRL_reserved1 0x00000040
220#define TX3912_POWER_CTRL_BPDBVCC3 0x00000020
221#define TX3912_POWER_CTRL_STOPCPU 0x00000010
222#define TX3912_POWER_CTRL_DBNCONBUTN 0x00000008
223#define TX3912_POWER_CTRL_COLDSTART 0x00000004
224#define TX3912_POWER_CTRL_PWRCS 0x00000002
225#define TX3912_POWER_CTRL_VCCON 0x00000001
226
227
228/*****************************************************************************
229 * Timer Subsystem *
230 * --------------- *
231 * Chapter 14 in Philips PR31700 User Manual *
232 * Chapter 15 in Toshiba TMPR3905/12 User Manual *
233 *****************************************************************************/
234#define TX3912_RTC_HIGH 0x0140
235#define TX3912_RTC_LOW 0x0144
236#define TX3912_RTC_ALARM_HIGH 0x0148
237#define TX3912_RTC_ALARM_LOW 0x014c
238#define TX3912_TIMER_CTRL 0x0150
239#define TX3912_TIMER_PERIOD 0x0154
240
241/*
242 * Timer control register values
243 */
244#define TX3912_TIMER_CTRL_FREEZEPRE 0x00000080
245#define TX3912_TIMER_CTRL_FREEZERTC 0x00000040
246#define TX3912_TIMER_CTRL_FREEZETIMER 0x00000020
247#define TX3912_TIMER_CTRL_ENPERTIMER 0x00000010
248#define TX3912_TIMER_CTRL_RTCCLEAR 0x00000008
249#define TX3912_TIMER_CTRL_TESTC8MS 0x00000004
250#define TX3912_TIMER_CTRL_ENTESTCLK 0x00000002
251#define TX3912_TIMER_CTRL_ENRTCTST 0x00000001
252
253/*
254 * The periodic timer has granularity of 868 nanoseconds which
255 * results in a count of (1.152 x 10^6 / 100) in order to achieve
256 * a 10 millisecond periodic system clock.
257 */
258#define TX3912_SYS_TIMER_VALUE (1152000/HZ)
259
260
261/*****************************************************************************
262 * UART Subsystem *
263 * -------------- *
264 * Chapter 15 in Philips PR31700 User Manual *
265 * Chapter 16 in Toshiba TMPR3905/12 User Manual *
266 *****************************************************************************/
267#define TX3912_UARTA_CTRL1 0x00b0
268#define TX3912_UARTA_CTRL2 0x00b4
269#define TX3912_UARTA_DMA_CTRL1 0x00b8
270#define TX3912_UARTA_DMA_CTRL2 0x00bc
271#define TX3912_UARTA_DMA_CNT 0x00c0
272#define TX3912_UARTA_DATA 0x00c4
273#define TX3912_UARTB_CTRL1 0x00c8
274#define TX3912_UARTB_CTRL2 0x00cc
275#define TX3912_UARTB_DMA_CTRL1 0x00d0
276#define TX3912_UARTB_DMA_CTRL2 0x00d4
277#define TX3912_UARTB_DMA_CNT 0x00d8
278#define TX3912_UARTB_DATA 0x00dc
279
280/*
281 * UART Control Register 1 values
282 */
283#define TX3912_UART_CTRL1_UARTON 0x80000000
284#define TX3912_UART_CTRL1_EMPTY 0x40000000
285#define TX3912_UART_CTRL1_PRXHOLDFULL 0x20000000
286#define TX3912_UART_CTRL1_RXHOLDFULL 0x10000000
287#define TX3912_UART_CTRL1_reserved1 0x0fff0000
288#define TX3912_UART_CTRL1_ENDMARX 0x00008000
289#define TX3912_UART_CTRL1_ENDMATX 0x00004000
290#define TX3912_UART_CTRL1_TESTMODE 0x00002000
291#define TX3912_UART_CTRL1_ENBREAKHALT 0x00001000
292#define TX3912_UART_CTRL1_ENDMATEST 0x00000800
293#define TX3912_UART_CTRL1_ENDMALOOP 0x00000400
294#define TX3912_UART_CTRL1_PULSEOPT1 0x00000200
295#define TX3912_UART_CTRL1_PULSEOPT1 0x00000100
296#define TX3912_UART_CTRL1_DTINVERT 0x00000080
297#define TX3912_UART_CTRL1_DISTXD 0x00000040
298#define TX3912_UART_CTRL1_TWOSTOP 0x00000020
299#define TX3912_UART_CTRL1_LOOPBACK 0x00000010
300#define TX3912_UART_CTRL1_BIT_7 0x00000008
301#define TX3912_UART_CTRL1_EVENPARITY 0x00000004
302#define TX3912_UART_CTRL1_ENPARITY 0x00000002
303#define TX3912_UART_CTRL1_ENUART 0x00000001
304
305/*
306 * UART Control Register 2 values
307 */
308#define TX3912_UART_CTRL2_B230400 0x0000 /* 0 */
309#define TX3912_UART_CTRL2_B115200 0x0001 /* 1 */
310#define TX3912_UART_CTRL2_B76800 0x0002 /* 2 */
311#define TX3912_UART_CTRL2_B57600 0x0003 /* 3 */
312#define TX3912_UART_CTRL2_B38400 0x0005 /* 5 */
313#define TX3912_UART_CTRL2_B19200 0x000b /* 11 */
314#define TX3912_UART_CTRL2_B9600 0x0016 /* 22 */
315#define TX3912_UART_CTRL2_B4800 0x002f /* 47 */
316#define TX3912_UART_CTRL2_B2400 0x005f /* 95 */
317#define TX3912_UART_CTRL2_B1200 0x00bf /* 191 */
318#define TX3912_UART_CTRL2_B600 0x017f /* 383 */
319#define TX3912_UART_CTRL2_B300 0x02ff /* 767 */
320
321/*****************************************************************************
322 * Video Subsystem *
323 * --------------- *
324 * Chapter 16 in Philips PR31700 User Manual *
325 * Chapter 17 in Toshiba TMPR3905/12 User Manual *
326 *****************************************************************************/
327#define TX3912_VIDEO_CTRL1 0x0028
328#define TX3912_VIDEO_CTRL2 0x002c
329#define TX3912_VIDEO_CTRL3 0x0030
330#define TX3912_VIDEO_CTRL4 0x0034
331#define TX3912_VIDEO_CTRL5 0x0038
332#define TX3912_VIDEO_CTRL6 0x003c
333#define TX3912_VIDEO_CTRL7 0x0040
334#define TX3912_VIDEO_CTRL8 0x0044
335#define TX3912_VIDEO_CTRL9 0x0048
336#define TX3912_VIDEO_CTRL10 0x004c
337#define TX3912_VIDEO_CTRL11 0x0050
338#define TX3912_VIDEO_CTRL12 0x0054
339#define TX3912_VIDEO_CTRL13 0x0058
340#define TX3912_VIDEO_CTRL14 0x005c
341
342/*
343 * Video Control Register 1 values
344 */
345#define TX3912_VIDEO_CTRL1_LINECNT 0xffc00000
346#define TX3912_VIDEO_CTRL1_LOADDLY 0x00200000
347#define TX3912_VIDEO_CTRL1_BAUDVAL 0x001f0000
348#define TX3912_VIDEO_CTRL1_VIDDONEVAL 0x0000fe00
349#define TX3912_VIDEO_CTRL1_ENFREEZEFRAME 0x00000100
350#define TX3912_VIDEO_CTRL1_BITSEL_MASK 0x000000c0
351#define TX3912_VIDEO_CTRL1_BITSEL_8BIT_COLOR 0x000000c0
352#define TX3912_VIDEO_CTRL1_BITSEL_4BIT_GRAY 0x00000080
353#define TX3912_VIDEO_CTRL1_BITSEL_2BIT_GRAY 0x00000040
354#define TX3912_VIDEO_CTRL1_DISPSPLIT 0x00000020
355#define TX3912_VIDEO_CTRL1_DISP8 0x00000010
356#define TX3912_VIDEO_CTRL1_DFMODE 0x00000008
357#define TX3912_VIDEO_CTRL1_INVVID 0x00000004
358#define TX3912_VIDEO_CTRL1_DISPON 0x00000002
359#define TX3912_VIDEO_CTRL1_ENVID 0x00000001
360
361#endif /* _TX3912_H_ */
diff --git a/include/asm-mips/tx4927/smsc_fdc37m81x.h b/include/asm-mips/tx4927/smsc_fdc37m81x.h
new file mode 100644
index 000000000000..5d93bab51254
--- /dev/null
+++ b/include/asm-mips/tx4927/smsc_fdc37m81x.h
@@ -0,0 +1,69 @@
1/*
2 * linux/include/asm-mips/tx4927/smsc_fdc37m81x.h
3 *
4 * Interface for smsc fdc48m81x Super IO chip
5 *
6 * Author: MontaVista Software, Inc. source@mvista.com
7 *
8 * 2001-2003 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 *
13 * Copyright (C) 2004 MontaVista Software Inc.
14 * Manish Lachwani, mlachwani@mvista.com
15 */
16
17#ifndef _SMSC_FDC37M81X_H_
18#define _SMSC_FDC37M81X_H_
19
20/* Common Registers */
21#define SMSC_FDC37M81X_CONFIG_INDEX 0x00
22#define SMSC_FDC37M81X_CONFIG_DATA 0x01
23#define SMSC_FDC37M81X_CONF 0x02
24#define SMSC_FDC37M81X_INDEX 0x03
25#define SMSC_FDC37M81X_DNUM 0x07
26#define SMSC_FDC37M81X_DID 0x20
27#define SMSC_FDC37M81X_DREV 0x21
28#define SMSC_FDC37M81X_PCNT 0x22
29#define SMSC_FDC37M81X_PMGT 0x23
30#define SMSC_FDC37M81X_OSC 0x24
31#define SMSC_FDC37M81X_CONFPA0 0x26
32#define SMSC_FDC37M81X_CONFPA1 0x27
33#define SMSC_FDC37M81X_TEST4 0x2B
34#define SMSC_FDC37M81X_TEST5 0x2C
35#define SMSC_FDC37M81X_TEST1 0x2D
36#define SMSC_FDC37M81X_TEST2 0x2E
37#define SMSC_FDC37M81X_TEST3 0x2F
38
39/* Logical device numbers */
40#define SMSC_FDC37M81X_FDD 0x00
41#define SMSC_FDC37M81X_PARALLEL 0x03
42#define SMSC_FDC37M81X_SERIAL1 0x04
43#define SMSC_FDC37M81X_SERIAL2 0x05
44#define SMSC_FDC37M81X_KBD 0x07
45#define SMSC_FDC37M81X_AUXIO 0x08
46#define SMSC_FDC37M81X_NONE 0xff
47
48/* Logical device Config Registers */
49#define SMSC_FDC37M81X_ACTIVE 0x30
50#define SMSC_FDC37M81X_BASEADDR0 0x60
51#define SMSC_FDC37M81X_BASEADDR1 0x61
52#define SMSC_FDC37M81X_INT 0x70
53#define SMSC_FDC37M81X_INT2 0x72
54#define SMSC_FDC37M81X_LDCR_F0 0xF0
55
56/* Chip Config Values */
57#define SMSC_FDC37M81X_CONFIG_ENTER 0x55
58#define SMSC_FDC37M81X_CONFIG_EXIT 0xaa
59#define SMSC_FDC37M81X_CHIP_ID 0x4d
60
61unsigned long __init smsc_fdc37m81x_init(unsigned long port);
62
63void smsc_fdc37m81x_config_beg(void);
64
65void smsc_fdc37m81x_config_end(void);
66
67void smsc_fdc37m81x_config_set(u8 reg, u8 val);
68
69#endif
diff --git a/include/asm-mips/tx4927/toshiba_rbtx4927.h b/include/asm-mips/tx4927/toshiba_rbtx4927.h
new file mode 100644
index 000000000000..6ce1e9475f99
--- /dev/null
+++ b/include/asm-mips/tx4927/toshiba_rbtx4927.h
@@ -0,0 +1,56 @@
1/*
2 * Author: MontaVista Software, Inc.
3 * source@mvista.com
4 *
5 * Copyright 2001-2002 MontaVista Software Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
17 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
18 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
20 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27#ifndef __ASM_TX4927_TOSHIBA_RBTX4927_H
28#define __ASM_TX4927_TOSHIBA_RBTX4927_H
29
30#include <linux/config.h>
31#include <asm/tx4927/tx4927.h>
32#include <asm/tx4927/tx4927_mips.h>
33#ifdef CONFIG_PCI
34#include <asm/tx4927/tx4927_pci.h>
35#endif
36
37#define TOSHIBA_RBTX4927_WR08(a,b) do { TX4927_WR08(a,b); wbflush(); } while ( 0 )
38
39
40#ifdef CONFIG_PCI
41#define TBTX4927_ISA_IO_OFFSET TX4927_PCIIO
42#else
43#define TBTX4927_ISA_IO_OFFSET 0
44#endif
45
46#define RBTX4927_SW_RESET_DO 0xbc00f000
47#define RBTX4927_SW_RESET_DO_SET 0x01
48
49#define RBTX4927_SW_RESET_ENABLE 0xbc00f002
50#define RBTX4927_SW_RESET_ENABLE_SET 0x01
51
52
53#define RBTX4927_RTL_8019_BASE (0x1c020280-TBTX4927_ISA_IO_OFFSET)
54#define RBTX4927_RTL_8019_IRQ (29)
55
56#endif /* __ASM_TX4927_TOSHIBA_RBTX4927_H */
diff --git a/include/asm-mips/tx4927/tx4927.h b/include/asm-mips/tx4927/tx4927.h
new file mode 100644
index 000000000000..5d939db6e220
--- /dev/null
+++ b/include/asm-mips/tx4927/tx4927.h
@@ -0,0 +1,525 @@
1/*
2 * Author: MontaVista Software, Inc.
3 * source@mvista.com
4 *
5 * Copyright 2001-2002 MontaVista Software Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
17 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
18 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
20 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27#ifndef __ASM_TX4927_TX4927_H
28#define __ASM_TX4927_TX4927_H
29
30#include <asm/tx4927/tx4927_mips.h>
31
32/*
33 This register naming came from the intergrate cpu/controoler name TX4927
34 followed by the device name from table 4.2.2 on page 4-3 and then followed
35 by the register name from table 4.2.3 on pages 4-4 to 4-8. The manaul
36 used is "TMPR4927BT Preliminary Rev 0.1 20.Jul.2001".
37 */
38
39#define TX4927_SIO_0_BASE
40
41/* TX4927 controller */
42#define TX4927_BASE 0xfff1f0000
43#define TX4927_BASE 0xfff1f0000
44#define TX4927_LIMIT 0xfff1fffff
45
46
47/* TX4927 SDRAM controller (64-bit registers) */
48#define TX4927_SDRAMC_BASE 0x8000
49#define TX4927_SDRAMC_SDCCR0 0x8000
50#define TX4927_SDRAMC_SDCCR1 0x8008
51#define TX4927_SDRAMC_SDCCR2 0x8010
52#define TX4927_SDRAMC_SDCCR3 0x8018
53#define TX4927_SDRAMC_SDCTR 0x8040
54#define TX4927_SDRAMC_SDCMD 0x8058
55#define TX4927_SDRAMC_LIMIT 0x8fff
56
57
58/* TX4927 external bus controller (64-bit registers) */
59#define TX4927_EBUSC_BASE 0x9000
60#define TX4927_EBUSC_EBCCR0 0x9000
61#define TX4927_EBUSC_EBCCR1 0x9008
62#define TX4927_EBUSC_EBCCR2 0x9010
63#define TX4927_EBUSC_EBCCR3 0x9018
64#define TX4927_EBUSC_EBCCR4 0x9020
65#define TX4927_EBUSC_EBCCR5 0x9028
66#define TX4927_EBUSC_EBCCR6 0x9030
67#define TX4927_EBUSC_EBCCR7 0x9008
68#define TX4927_EBUSC_LIMIT 0x9fff
69
70
71/* TX4927 SDRRAM Error Check Correction (64-bit registers) */
72#define TX4927_ECC_BASE 0xa000
73#define TX4927_ECC_ECCCR 0xa000
74#define TX4927_ECC_ECCSR 0xa008
75#define TX4927_ECC_LIMIT 0xafff
76
77
78/* TX4927 DMA Controller (64-bit registers) */
79#define TX4927_DMAC_BASE 0xb000
80#define TX4927_DMAC_TBD 0xb000
81#define TX4927_DMAC_LIMIT 0xbfff
82
83
84/* TX4927 PCI Controller (32-bit registers) */
85#define TX4927_PCIC_BASE 0xd000
86#define TX4927_PCIC_TBD 0xb000
87#define TX4927_PCIC_LIMIT 0xdfff
88
89
90/* TX4927 Configuration registers (64-bit registers) */
91#define TX4927_CONFIG_BASE 0xe000
92#define TX4927_CONFIG_CCFG 0xe000
93#define TX4927_CONFIG_CCFG_RESERVED_42_63 BM_63_42
94#define TX4927_CONFIG_CCFG_WDRST BM_41_41
95#define TX4927_CONFIG_CCFG_WDREXEN BM_40_40
96#define TX4927_CONFIG_CCFG_BCFG BM_39_32
97#define TX4927_CONFIG_CCFG_RESERVED_27_31 BM_31_27
98#define TX4927_CONFIG_CCFG_GTOT BM_26_25
99#define TX4927_CONFIG_CCFG_GTOT_4096 BM_26_25
100#define TX4927_CONFIG_CCFG_GTOT_2048 BM_26_26
101#define TX4927_CONFIG_CCFG_GTOT_1024 BM_25_25
102#define TX4927_CONFIG_CCFG_GTOT_0512 (~BM_26_25)
103#define TX4927_CONFIG_CCFG_TINTDIS BM_24_24
104#define TX4927_CONFIG_CCFG_PCI66 BM_23_23
105#define TX4927_CONFIG_CCFG_PCIMODE BM_22_22
106#define TX4927_CONFIG_CCFG_RESERVED_20_21 BM_21_20
107#define TX4927_CONFIG_CCFG_DIVMODE BM_19_17
108#define TX4927_CONFIG_CCFG_DIVMODE_2_0 BM_19_19
109#define TX4927_CONFIG_CCFG_DIVMODE_3_0 (BM_19_19|BM_17_17)
110#define TX4927_CONFIG_CCFG_DIVMODE_4_0 BM_19_18
111#define TX4927_CONFIG_CCFG_DIVMODE_2_5 BM_19_17
112#define TX4927_CONFIG_CCFG_DIVMODE_8_0 (~BM_19_17)
113#define TX4927_CONFIG_CCFG_DIVMODE_12_0 BM_17_17
114#define TX4927_CONFIG_CCFG_DIVMODE_16_0 BM_18_18
115#define TX4927_CONFIG_CCFG_DIVMODE_10_0 BM_18_17
116#define TX4927_CONFIG_CCFG_BEOW BM_16_16
117#define TX4927_CONFIG_CCFG_WR BM_15_15
118#define TX4927_CONFIG_CCFG_TOE BM_14_14
119#define TX4927_CONFIG_CCFG_PCIARB BM_13_13
120#define TX4927_CONFIG_CCFG_PCIDIVMODE BM_12_11
121#define TX4927_CONFIG_CCFG_RESERVED_08_10 BM_10_08
122#define TX4927_CONFIG_CCFG_SYSSP BM_07_06
123#define TX4927_CONFIG_CCFG_RESERVED_03_05 BM_05_03
124#define TX4927_CONFIG_CCFG_ENDIAN BM_02_02
125#define TX4927_CONFIG_CCFG_ARMODE BM_01_01
126#define TX4927_CONFIG_CCFG_ACEHOLD BM_00_00
127#define TX4927_CONFIG_REVID 0xe008
128#define TX4927_CONFIG_REVID_RESERVED_32_63 BM_32_63
129#define TX4927_CONFIG_REVID_PCODE BM_16_31
130#define TX4927_CONFIG_REVID_MJERREV BM_12_15
131#define TX4927_CONFIG_REVID_MINEREV BM_08_11
132#define TX4927_CONFIG_REVID_MJREV BM_04_07
133#define TX4927_CONFIG_REVID_MINREV BM_00_03
134#define TX4927_CONFIG_PCFG 0xe010
135#define TX4927_CONFIG_PCFG_RESERVED_57_63 BM_57_63
136#define TX4927_CONFIG_PCFG_DRVDATA BM_56_56
137#define TX4927_CONFIG_PCFG_DRVCB BM_55_55
138#define TX4927_CONFIG_PCFG_DRVDQM BM_54_54
139#define TX4927_CONFIG_PCFG_DRVADDR BM_53_53
140#define TX4927_CONFIG_PCFG_DRVCKE BM_52_52
141#define TX4927_CONFIG_PCFG_DRVRAS BM_51_51
142#define TX4927_CONFIG_PCFG_DRVCAS BM_50_50
143#define TX4927_CONFIG_PCFG_DRVWE BM_49_49
144#define TX4927_CONFIG_PCFG_DRVCS3 BM_48_48
145#define TX4927_CONFIG_PCFG_DRVCS2 BM_47_47
146#define TX4927_CONFIG_PCFG_DRVCS1 BM_46_4k
147#define TX4927_CONFIG_PCFG_DRVCS0 BM_45_45
148#define TX4927_CONFIG_PCFG_DRVCK3 BM_44_44
149#define TX4927_CONFIG_PCFG_DRVCK2 BM_43_43
150#define TX4927_CONFIG_PCFG_DRVCK1 BM_42_42
151#define TX4927_CONFIG_PCFG_DRVCK0 BM_41_41
152#define TX4927_CONFIG_PCFG_DRVCKIN BM_40_40
153#define TX4927_CONFIG_PCFG_RESERVED_33_39 BM_33_39
154#define TX4927_CONFIG_PCFG_BYPASS_PLL BM_32_32
155#define TX4927_CONFIG_PCFG_RESERVED_30_31 BM_30_31
156#define TX4927_CONFIG_PCFG_SDCLKDLY BM_28_29
157#define TX4927_CONFIG_PCFG_SDCLKDLY_DELAY_1 (~BM_28_29)
158#define TX4927_CONFIG_PCFG_SDCLKDLY_DELAY_2 BM_28_28
159#define TX4927_CONFIG_PCFG_SDCLKDLY_DELAY_3 BM_29_29
160#define TX4927_CONFIG_PCFG_SDCLKDLY_DELAY_4 BM_28_29
161#define TX4927_CONFIG_PCFG_SYSCLKEN BM_27_27
162#define TX4927_CONFIG_PCFG_SDCLKEN3 BM_26_26
163#define TX4927_CONFIG_PCFG_SDCLKEN2 BM_25_25
164#define TX4927_CONFIG_PCFG_SDCLKEN1 BM_24_24
165#define TX4927_CONFIG_PCFG_SDCLKEN0 BM_23_23
166#define TX4927_CONFIG_PCFG_SDCLKINEN BM_22_22
167#define TX4927_CONFIG_PCFG_PCICLKEN5 BM_21_21
168#define TX4927_CONFIG_PCFG_PCICLKEN4 BM_20_20
169#define TX4927_CONFIG_PCFG_PCICLKEN3 BM_19_19
170#define TX4927_CONFIG_PCFG_PCICLKEN2 BM_18_18
171#define TX4927_CONFIG_PCFG_PCICLKEN1 BM_17_17
172#define TX4927_CONFIG_PCFG_PCICLKEN0 BM_16_16
173#define TX4927_CONFIG_PCFG_RESERVED_10_15 BM_10_15
174#define TX4927_CONFIG_PCFG_SEL2 BM_09_09
175#define TX4927_CONFIG_PCFG_SEL1 BM_08_08
176#define TX4927_CONFIG_PCFG_DMASEL3 BM_06_07
177#define TX4927_CONFIG_PCFG_DMASEL3_DMAREQ3 (~BM_06_07)
178#define TX4927_CONFIG_PCFG_DMASEL3_SIO0 BM_06_06
179#define TX4927_CONFIG_PCFG_DMASEL3_ACLC3 BM_07_07
180#define TX4927_CONFIG_PCFG_DMASEL3_ACLC1 BM_06_07
181#define TX4927_CONFIG_PCFG_DMASEL2 BM_06_07
182#define TX4927_CONFIG_PCFG_DMASEL2_SEL2_0_DMAREQ2 (~BM_06_07)
183#define TX4927_CONFIG_PCFG_DMASEL2_SEL2_0_SIO0 BM_06_06
184#define TX4927_CONFIG_PCFG_DMASEL2_SEL2_0_RESERVED_10 BM_07_07
185#define TX4927_CONFIG_PCFG_DMASEL2_SEL2_0_RESERVED_11 BM_06_07
186#define TX4927_CONFIG_PCFG_DMASEL2_SEL2_1_ACLC1 (~BM_06_07)
187#define TX4927_CONFIG_PCFG_DMASEL2_SEL2_1_SIO0 BM_06_06
188#define TX4927_CONFIG_PCFG_DMASEL2_SEL2_1_ACLC2 BM_07_07
189#define TX4927_CONFIG_PCFG_DMASEL2_SEL2_1_ACLC0 BM_06_07
190#define TX4927_CONFIG_PCFG_DMASEL1 BM_02_03
191#define TX4927_CONFIG_PCFG_DMASEL1_DMAREQ1 (~BM_02_03)
192#define TX4927_CONFIG_PCFG_DMASEL1_SIO1 BM_02_02
193#define TX4927_CONFIG_PCFG_DMASEL1_ACLC1 BM_03_03
194#define TX4927_CONFIG_PCFG_DMASEL1_ACLC3 BM_02_03
195#define TX4927_CONFIG_PCFG_DMASEL0 BM_00_01
196#define TX4927_CONFIG_PCFG_DMASEL0_DMAREQ0 (~BM_00_01)
197#define TX4927_CONFIG_PCFG_DMASEL0_SIO1 BM_00_00
198#define TX4927_CONFIG_PCFG_DMASEL0_ACLC0 BM_01_01
199#define TX4927_CONFIG_PCFG_DMASEL0_ACLC2 BM_00_01
200#define TX4927_CONFIG_TOEA 0xe018
201#define TX4927_CONFIG_TOEA_RESERVED_36_63 BM_36_63
202#define TX4927_CONFIG_TOEA_TOEA BM_00_35
203#define TX4927_CONFIG_CLKCTR 0xe020
204#define TX4927_CONFIG_CLKCTR_RESERVED_26_63 BM_26_63
205#define TX4927_CONFIG_CLKCTR_ACLCKD BM_25_25
206#define TX4927_CONFIG_CLKCTR_PIOCKD BM_24_24
207#define TX4927_CONFIG_CLKCTR_DMACKD BM_23_23
208#define TX4927_CONFIG_CLKCTR_PCICKD BM_22_22
209#define TX4927_CONFIG_CLKCTR_SET_21 BM_21_21
210#define TX4927_CONFIG_CLKCTR_TM0CKD BM_20_20
211#define TX4927_CONFIG_CLKCTR_TM1CKD BM_19_19
212#define TX4927_CONFIG_CLKCTR_TM2CKD BM_18_18
213#define TX4927_CONFIG_CLKCTR_SIO0CKD BM_17_17
214#define TX4927_CONFIG_CLKCTR_SIO1CKD BM_16_16
215#define TX4927_CONFIG_CLKCTR_RESERVED_10_15 BM_10_15
216#define TX4927_CONFIG_CLKCTR_ACLRST BM_09_09
217#define TX4927_CONFIG_CLKCTR_PIORST BM_08_08
218#define TX4927_CONFIG_CLKCTR_DMARST BM_07_07
219#define TX4927_CONFIG_CLKCTR_PCIRST BM_06_06
220#define TX4927_CONFIG_CLKCTR_RESERVED_05_05 BM_05_05
221#define TX4927_CONFIG_CLKCTR_TM0RST BM_04_04
222#define TX4927_CONFIG_CLKCTR_TM1RST BM_03_03
223#define TX4927_CONFIG_CLKCTR_TM2RST BM_02_02
224#define TX4927_CONFIG_CLKCTR_SIO0RST BM_01_01
225#define TX4927_CONFIG_CLKCTR_SIO1RST BM_00_00
226#define TX4927_CONFIG_GARBC 0xe030
227#define TX4927_CONFIG_GARBC_RESERVED_10_63 BM_10_63
228#define TX4927_CONFIG_GARBC_SET_09 BM_09_09
229#define TX4927_CONFIG_GARBC_ARBMD BM_08_08
230#define TX4927_CONFIG_GARBC_RESERVED_06_07 BM_06_07
231#define TX4927_CONFIG_GARBC_PRIORITY_H1 BM_04_05
232#define TX4927_CONFIG_GARBC_PRIORITY_H1_PCI (~BM_04_05)
233#define TX4927_CONFIG_GARBC_PRIORITY_H1_PDMAC BM_04_04
234#define TX4927_CONFIG_GARBC_PRIORITY_H1_DMAC BM_05_05
235#define TX4927_CONFIG_GARBC_PRIORITY_H1_BAD_VALUE BM_04_05
236#define TX4927_CONFIG_GARBC_PRIORITY_H2 BM_02_03
237#define TX4927_CONFIG_GARBC_PRIORITY_H2_PCI (~BM_02_03)
238#define TX4927_CONFIG_GARBC_PRIORITY_H2_PDMAC BM_02_02
239#define TX4927_CONFIG_GARBC_PRIORITY_H2_DMAC BM_03_03
240#define TX4927_CONFIG_GARBC_PRIORITY_H2_BAD_VALUE BM_02_03
241#define TX4927_CONFIG_GARBC_PRIORITY_H3 BM_00_01
242#define TX4927_CONFIG_GARBC_PRIORITY_H3_PCI (~BM_00_01)
243#define TX4927_CONFIG_GARBC_PRIORITY_H3_PDMAC BM_00_00
244#define TX4927_CONFIG_GARBC_PRIORITY_H3_DMAC BM_01_01
245#define TX4927_CONFIG_GARBC_PRIORITY_H3_BAD_VALUE BM_00_01
246#define TX4927_CONFIG_RAMP 0xe048
247#define TX4927_CONFIG_RAMP_RESERVED_20_63 BM_20_63
248#define TX4927_CONFIG_RAMP_RAMP BM_00_19
249#define TX4927_CONFIG_LIMIT 0xefff
250
251
252/* TX4927 Timer 0 (32-bit registers) */
253#define TX4927_TMR0_BASE 0xf000
254#define TX4927_TMR0_TMTCR0 0xf004
255#define TX4927_TMR0_TMTISR0 0xf008
256#define TX4927_TMR0_TMCPRA0 0xf008
257#define TX4927_TMR0_TMCPRB0 0xf00c
258#define TX4927_TMR0_TMITMR0 0xf010
259#define TX4927_TMR0_TMCCDR0 0xf020
260#define TX4927_TMR0_TMPGMR0 0xf030
261#define TX4927_TMR0_TMTRR0 0xf0f0
262#define TX4927_TMR0_LIMIT 0xf0ff
263
264
265/* TX4927 Timer 1 (32-bit registers) */
266#define TX4927_TMR1_BASE 0xf100
267#define TX4927_TMR1_TMTCR1 0xf104
268#define TX4927_TMR1_TMTISR1 0xf108
269#define TX4927_TMR1_TMCPRA1 0xf108
270#define TX4927_TMR1_TMCPRB1 0xf10c
271#define TX4927_TMR1_TMITMR1 0xf110
272#define TX4927_TMR1_TMCCDR1 0xf120
273#define TX4927_TMR1_TMPGMR1 0xf130
274#define TX4927_TMR1_TMTRR1 0xf1f0
275#define TX4927_TMR1_LIMIT 0xf1ff
276
277
278/* TX4927 Timer 2 (32-bit registers) */
279#define TX4927_TMR2_BASE 0xf200
280#define TX4927_TMR2_TMTCR2 0xf104
281#define TX4927_TMR2_TMTISR2 0xf208
282#define TX4927_TMR2_TMCPRA2 0xf208
283#define TX4927_TMR2_TMCPRB2 0xf20c
284#define TX4927_TMR2_TMITMR2 0xf210
285#define TX4927_TMR2_TMCCDR2 0xf220
286#define TX4927_TMR2_TMPGMR2 0xf230
287#define TX4927_TMR2_TMTRR2 0xf2f0
288#define TX4927_TMR2_LIMIT 0xf2ff
289
290
291/* TX4927 serial port 0 (32-bit registers) */
292#define TX4927_SIO0_BASE 0xf300
293#define TX4927_SIO0_SILCR0 0xf300
294#define TX4927_SIO0_SILCR0_RESERVED_16_31 BM_16_31
295#define TX4927_SIO0_SILCR0_RWUB BM_15_15
296#define TX4927_SIO0_SILCR0_TWUB BM_14_14
297#define TX4927_SIO0_SILCR0_UODE BM_13_13
298#define TX4927_SIO0_SILCR0_RESERVED_07_12 BM_07_12
299#define TX4927_SIO0_SILCR0_SCS BM_05_06
300#define TX4927_SIO0_SILCR0_SCS_IMBUSCLK_IC (~BM_05_06)
301#define TX4927_SIO0_SILCR0_SCS_IMBUSCLK_BRG BM_05_05
302#define TX4927_SIO0_SILCR0_SCS_SCLK_EC BM_06_06
303#define TX4927_SIO0_SILCR0_SCS_SCLK_BRG BM_05_06
304#define TX4927_SIO0_SILCR0_UEPS BM_04_04
305#define TX4927_SIO0_SILCR0_UPEN BM_03_03
306#define TX4927_SIO0_SILCR0_USBL BM_02_02
307#define TX4927_SIO0_SILCR0_UMODE BM_00_01
308#define TX4927_SIO0_SILCR0_UMODE_DATA_8_BIT BM_00_01
309#define TX4927_SIO0_SILCR0_UMODE_DATA_7_BIT (~BM_00_01)
310#define TX4927_SIO0_SILCR0_UMODE_DATA_8_BIT_MC BM_01_01
311#define TX4927_SIO0_SILCR0_UMODE_DATA_7_BIT_MC BM_00_01
312#define TX4927_SIO0_SIDICR0 0xf304
313#define TX4927_SIO0_SIDICR0_RESERVED_16_31 BM_16_31
314#define TX4927_SIO0_SIDICR0_TDE BM_15_15
315#define TX4927_SIO0_SIDICR0_RDE BM_14_14
316#define TX4927_SIO0_SIDICR0_TIE BM_13_13
317#define TX4927_SIO0_SIDICR0_RIE BM_12_12
318#define TX4927_SIO0_SIDICR0_SPIE BM_11_11
319#define TX4927_SIO0_SIDICR0_CTSAC BM_09_10
320#define TX4927_SIO0_SIDICR0_CTSAC_NONE (~BM_09_10)
321#define TX4927_SIO0_SIDICR0_CTSAC_RISE BM_09_09
322#define TX4927_SIO0_SIDICR0_CTSAC_FALL BM_10_10
323#define TX4927_SIO0_SIDICR0_CTSAC_BOTH BM_09_10
324#define TX4927_SIO0_SIDICR0_RESERVED_06_08 BM_06_08
325#define TX4927_SIO0_SIDICR0_STIE BM_00_05
326#define TX4927_SIO0_SIDICR0_STIE_NONE (~BM_00_05)
327#define TX4927_SIO0_SIDICR0_STIE_OERS BM_05_05
328#define TX4927_SIO0_SIDICR0_STIE_CTSAC BM_04_04
329#define TX4927_SIO0_SIDICR0_STIE_RBRKD BM_03_03
330#define TX4927_SIO0_SIDICR0_STIE_TRDY BM_02_02
331#define TX4927_SIO0_SIDICR0_STIE_TXALS BM_01_01
332#define TX4927_SIO0_SIDICR0_STIE_UBRKD BM_00_00
333#define TX4927_SIO0_SIDISR0 0xf308
334#define TX4927_SIO0_SIDISR0_RESERVED_16_31 BM_16_31
335#define TX4927_SIO0_SIDISR0_UBRK BM_15_15
336#define TX4927_SIO0_SIDISR0_UVALID BM_14_14
337#define TX4927_SIO0_SIDISR0_UFER BM_13_13
338#define TX4927_SIO0_SIDISR0_UPER BM_12_12
339#define TX4927_SIO0_SIDISR0_UOER BM_11_11
340#define TX4927_SIO0_SIDISR0_ERI BM_10_10
341#define TX4927_SIO0_SIDISR0_TOUT BM_09_09
342#define TX4927_SIO0_SIDISR0_TDIS BM_08_08
343#define TX4927_SIO0_SIDISR0_RDIS BM_07_07
344#define TX4927_SIO0_SIDISR0_STIS BM_06_06
345#define TX4927_SIO0_SIDISR0_RESERVED_05_05 BM_05_05
346#define TX4927_SIO0_SIDISR0_RFDN BM_00_04
347#define TX4927_SIO0_SISCISR0 0xf30c
348#define TX4927_SIO0_SISCISR0_RESERVED_06_31 BM_06_31
349#define TX4927_SIO0_SISCISR0_OERS BM_05_05
350#define TX4927_SIO0_SISCISR0_CTSS BM_04_04
351#define TX4927_SIO0_SISCISR0_RBRKD BM_03_03
352#define TX4927_SIO0_SISCISR0_TRDY BM_02_02
353#define TX4927_SIO0_SISCISR0_TXALS BM_01_01
354#define TX4927_SIO0_SISCISR0_UBRKD BM_00_00
355#define TX4927_SIO0_SIFCR0 0xf310
356#define TX4927_SIO0_SIFCR0_RESERVED_16_31 BM_16_31
357#define TX4927_SIO0_SIFCR0_SWRST BM_16_31
358#define TX4927_SIO0_SIFCR0_RESERVED_09_14 BM_09_14
359#define TX4927_SIO0_SIFCR0_RDIL BM_16_31
360#define TX4927_SIO0_SIFCR0_RDIL_BYTES_1 (~BM_07_08)
361#define TX4927_SIO0_SIFCR0_RDIL_BYTES_4 BM_07_07
362#define TX4927_SIO0_SIFCR0_RDIL_BYTES_8 BM_08_08
363#define TX4927_SIO0_SIFCR0_RDIL_BYTES_12 BM_07_08
364#define TX4927_SIO0_SIFCR0_RESERVED_05_06 BM_05_06
365#define TX4927_SIO0_SIFCR0_TDIL BM_03_04
366#define TX4927_SIO0_SIFCR0_TDIL_BYTES_1 (~BM_03_04)
367#define TX4927_SIO0_SIFCR0_TDIL_BYTES_4 BM_03_03
368#define TX4927_SIO0_SIFCR0_TDIL_BYTES_8 BM_04_04
369#define TX4927_SIO0_SIFCR0_TDIL_BYTES_0 BM_03_04
370#define TX4927_SIO0_SIFCR0_TFRST BM_02_02
371#define TX4927_SIO0_SIFCR0_RFRST BM_01_01
372#define TX4927_SIO0_SIFCR0_FRSTE BM_00_00
373#define TX4927_SIO0_SIFLCR0 0xf314
374#define TX4927_SIO0_SIFLCR0_RESERVED_13_31 BM_13_31
375#define TX4927_SIO0_SIFLCR0_RCS BM_12_12
376#define TX4927_SIO0_SIFLCR0_TES BM_11_11
377#define TX4927_SIO0_SIFLCR0_RESERVED_10_10 BM_10_10
378#define TX4927_SIO0_SIFLCR0_RTSSC BM_09_09
379#define TX4927_SIO0_SIFLCR0_RSDE BM_08_08
380#define TX4927_SIO0_SIFLCR0_TSDE BM_07_07
381#define TX4927_SIO0_SIFLCR0_RESERVED_05_06 BM_05_06
382#define TX4927_SIO0_SIFLCR0_RTSTL BM_01_04
383#define TX4927_SIO0_SIFLCR0_TBRK BM_00_00
384#define TX4927_SIO0_SIBGR0 0xf318
385#define TX4927_SIO0_SIBGR0_RESERVED_10_31 BM_10_31
386#define TX4927_SIO0_SIBGR0_BCLK BM_08_09
387#define TX4927_SIO0_SIBGR0_BCLK_T0 (~BM_08_09)
388#define TX4927_SIO0_SIBGR0_BCLK_T2 BM_08_08
389#define TX4927_SIO0_SIBGR0_BCLK_T4 BM_09_09
390#define TX4927_SIO0_SIBGR0_BCLK_T6 BM_08_09
391#define TX4927_SIO0_SIBGR0_BRD BM_00_07
392#define TX4927_SIO0_SITFIF00 0xf31c
393#define TX4927_SIO0_SITFIF00_RESERVED_08_31 BM_08_31
394#define TX4927_SIO0_SITFIF00_TXD BM_00_07
395#define TX4927_SIO0_SIRFIFO0 0xf320
396#define TX4927_SIO0_SIRFIFO0_RESERVED_08_31 BM_08_31
397#define TX4927_SIO0_SIRFIFO0_RXD BM_00_07
398#define TX4927_SIO0_SIRFIFO0 0xf320
399#define TX4927_SIO0_LIMIT 0xf3ff
400
401
402/* TX4927 serial port 1 (32-bit registers) */
403#define TX4927_SIO1_BASE 0xf400
404#define TX4927_SIO1_SILCR1 0xf400
405#define TX4927_SIO1_SIDICR1 0xf404
406#define TX4927_SIO1_SIDISR1 0xf408
407#define TX4927_SIO1_SISCISR1 0xf40c
408#define TX4927_SIO1_SIFCR1 0xf410
409#define TX4927_SIO1_SIFLCR1 0xf414
410#define TX4927_SIO1_SIBGR1 0xf418
411#define TX4927_SIO1_SITFIF01 0xf41c
412#define TX4927_SIO1_SIRFIFO1 0xf420
413#define TX4927_SIO1_LIMIT 0xf4ff
414
415
416/* TX4927 parallel port (32-bit registers) */
417#define TX4927_PIO_BASE 0xf500
418#define TX4927_PIO_PIOD0 0xf500
419#define TX4927_PIO_PIODI 0xf504
420#define TX4927_PIO_PIODIR 0xf508
421#define TX4927_PIO_PIOOD 0xf50c
422#define TX4927_PIO_LIMIT 0xf50f
423
424
425/* TX4927 Interrupt Controller (32-bit registers) */
426#define TX4927_IRC_BASE 0xf510
427#define TX4927_IRC_IRFLAG0 0xf510
428#define TX4927_IRC_IRFLAG1 0xf514
429#define TX4927_IRC_IRPOL 0xf518
430#define TX4927_IRC_IRRCNT 0xf51c
431#define TX4927_IRC_IRMASKINT 0xf520
432#define TX4927_IRC_IRMASKEXT 0xf524
433#define TX4927_IRC_IRDEN 0xf600
434#define TX4927_IRC_IRDM0 0xf604
435#define TX4927_IRC_IRDM1 0xf608
436#define TX4927_IRC_IRLVL0 0xf610
437#define TX4927_IRC_IRLVL1 0xf614
438#define TX4927_IRC_IRLVL2 0xf618
439#define TX4927_IRC_IRLVL3 0xf61c
440#define TX4927_IRC_IRLVL4 0xf620
441#define TX4927_IRC_IRLVL5 0xf624
442#define TX4927_IRC_IRLVL6 0xf628
443#define TX4927_IRC_IRLVL7 0xf62c
444#define TX4927_IRC_IRMSK 0xf640
445#define TX4927_IRC_IREDC 0xf660
446#define TX4927_IRC_IRPND 0xf680
447#define TX4927_IRC_IRCS 0xf6a0
448#define TX4927_IRC_LIMIT 0xf6ff
449
450
451/* TX4927 AC-link controller (32-bit registers) */
452#define TX4927_ACLC_BASE 0xf700
453#define TX4927_ACLC_ACCTLEN 0xf700
454#define TX4927_ACLC_ACCTLDIS 0xf704
455#define TX4927_ACLC_ACREGACC 0xf708
456#define TX4927_ACLC_ACINTSTS 0xf710
457#define TX4927_ACLC_ACINTMSTS 0xf714
458#define TX4927_ACLC_ACINTEN 0xf718
459#define TX4927_ACLC_ACINTDIS 0xf71c
460#define TX4927_ACLC_ACSEMAPH 0xf720
461#define TX4927_ACLC_ACGPIDAT 0xf740
462#define TX4927_ACLC_ACGPODAT 0xf744
463#define TX4927_ACLC_ACSLTEN 0xf748
464#define TX4927_ACLC_ACSLTDIS 0xf74c
465#define TX4927_ACLC_ACFIFOSTS 0xf750
466#define TX4927_ACLC_ACDMASTS 0xf780
467#define TX4927_ACLC_ACDMASEL 0xf784
468#define TX4927_ACLC_ACAUDODAT 0xf7a0
469#define TX4927_ACLC_ACSURRDAT 0xf7a4
470#define TX4927_ACLC_ACCENTDAT 0xf7a8
471#define TX4927_ACLC_ACLFEDAT 0xf7ac
472#define TX4927_ACLC_ACAUDIDAT 0xf7b0
473#define TX4927_ACLC_ACMODODAT 0xf7b8
474#define TX4927_ACLC_ACMODIDAT 0xf7bc
475#define TX4927_ACLC_ACREVID 0xf7fc
476#define TX4927_ACLC_LIMIT 0xf7ff
477
478
479#define TX4927_REG(x) ((TX4927_BASE)+(x))
480
481#define TX4927_RD08( reg ) (*(vu08*)(reg))
482#define TX4927_WR08( reg, val ) ((*(vu08*)(reg))=(val))
483
484#define TX4927_RD16( reg ) (*(vu16*)(reg))
485#define TX4927_WR16( reg, val ) ((*(vu16*)(reg))=(val))
486
487#define TX4927_RD32( reg ) (*(vu32*)(reg))
488#define TX4927_WR32( reg, val ) ((*(vu32*)(reg))=(val))
489
490#define TX4927_RD64( reg ) (*(vu64*)(reg))
491#define TX4927_WR64( reg, val ) ((*(vu64*)(reg))=(val))
492
493#define TX4927_RD( reg ) TX4927_RD32( reg )
494#define TX4927_WR( reg, val ) TX4927_WR32( reg, val )
495
496
497
498
499
500#define MI8259_IRQ_ISA_RAW_BEG 0 /* optional backplane i8259 */
501#define MI8259_IRQ_ISA_RAW_END 15
502#define TX4927_IRQ_CP0_RAW_BEG 0 /* tx4927 cpu built-in cp0 */
503#define TX4927_IRQ_CP0_RAW_END 7
504#define TX4927_IRQ_PIC_RAW_BEG 0 /* tx4927 cpu build-in pic */
505#define TX4927_IRQ_PIC_RAW_END 31
506
507
508#define MI8259_IRQ_ISA_BEG MI8259_IRQ_ISA_RAW_BEG /* 0 */
509#define MI8259_IRQ_ISA_END MI8259_IRQ_ISA_RAW_END /* 15 */
510
511#define TX4927_IRQ_CP0_BEG ((MI8259_IRQ_ISA_END+1)+TX4927_IRQ_CP0_RAW_BEG) /* 16 */
512#define TX4927_IRQ_CP0_END ((MI8259_IRQ_ISA_END+1)+TX4927_IRQ_CP0_RAW_END) /* 23 */
513
514#define TX4927_IRQ_PIC_BEG ((TX4927_IRQ_CP0_END+1)+TX4927_IRQ_PIC_RAW_BEG) /* 24 */
515#define TX4927_IRQ_PIC_END ((TX4927_IRQ_CP0_END+1)+TX4927_IRQ_PIC_RAW_END) /* 55 */
516
517
518#define TX4927_IRQ_USER0 (TX4927_IRQ_CP0_BEG+0)
519#define TX4927_IRQ_USER1 (TX4927_IRQ_CP0_BEG+1)
520#define TX4927_IRQ_NEST_PIC_ON_CP0 (TX4927_IRQ_CP0_BEG+2)
521#define TX4927_IRQ_CPU_TIMER (TX4927_IRQ_CP0_BEG+7)
522
523#define TX4927_IRQ_NEST_EXT_ON_PIC (TX4927_IRQ_PIC_BEG+3)
524
525#endif /* __ASM_TX4927_TX4927_H */
diff --git a/include/asm-mips/tx4927/tx4927_mips.h b/include/asm-mips/tx4927/tx4927_mips.h
new file mode 100644
index 000000000000..242ab93bf2e2
--- /dev/null
+++ b/include/asm-mips/tx4927/tx4927_mips.h
@@ -0,0 +1,4177 @@
1/*
2 * Author: MontaVista Software, Inc.
3 * source@mvista.com
4 *
5 * Copyright 2001-2002 MontaVista Software Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
17 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
18 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
20 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27#ifndef __ASM_TX4927_TX4927_MIPS_H
28#define __ASM_TX4927_TX4927_MIPS_H
29
30#ifndef __ASSEMBLY__
31
32static inline void asm_wait(void)
33{
34 __asm__(".set\tmips3\n\t"
35 "wait\n\t"
36 ".set\tmips0");
37}
38
39#define reg_rd08(r) ((u8 )(*((vu8 *)(r))))
40#define reg_rd16(r) ((u16)(*((vu16*)(r))))
41#define reg_rd32(r) ((u32)(*((vu32*)(r))))
42#define reg_rd64(r) ((u64)(*((vu64*)(r))))
43
44#define reg_wr08(r,v) ((*((vu8 *)(r)))=((u8 )(v)))
45#define reg_wr16(r,v) ((*((vu16*)(r)))=((u16)(v)))
46#define reg_wr32(r,v) ((*((vu32*)(r)))=((u32)(v)))
47#define reg_wr64(r,v) ((*((vu64*)(r)))=((u64)(v)))
48
49typedef volatile __signed char vs8;
50typedef volatile unsigned char vu8;
51
52typedef volatile __signed short vs16;
53typedef volatile unsigned short vu16;
54
55typedef volatile __signed int vs32;
56typedef volatile unsigned int vu32;
57
58typedef s8 s08;
59typedef vs8 vs08;
60
61typedef u8 u08;
62typedef vu8 vu08;
63
64
65#if (_MIPS_SZLONG == 64)
66
67typedef volatile __signed__ long vs64;
68typedef volatile unsigned long vu64;
69
70#else
71
72typedef volatile __signed__ long long vs64;
73typedef volatile unsigned long long vu64;
74
75#endif
76
77
78#define BM_00_00 0x0000000000000001
79#define BM_01_00 0x0000000000000003
80#define BM_00_01 BM_01_00
81#define BM_02_00 0x0000000000000007
82#define BM_00_02 BM_02_00
83#define BM_03_00 0x000000000000000f
84#define BM_00_03 BM_03_00
85#define BM_04_00 0x000000000000001f
86#define BM_00_04 BM_04_00
87#define BM_05_00 0x000000000000003f
88#define BM_00_05 BM_05_00
89#define BM_06_00 0x000000000000007f
90#define BM_00_06 BM_06_00
91#define BM_07_00 0x00000000000000ff
92#define BM_00_07 BM_07_00
93#define BM_08_00 0x00000000000001ff
94#define BM_00_08 BM_08_00
95#define BM_09_00 0x00000000000003ff
96#define BM_00_09 BM_09_00
97#define BM_10_00 0x00000000000007ff
98#define BM_00_10 BM_10_00
99#define BM_11_00 0x0000000000000fff
100#define BM_00_11 BM_11_00
101#define BM_12_00 0x0000000000001fff
102#define BM_00_12 BM_12_00
103#define BM_13_00 0x0000000000003fff
104#define BM_00_13 BM_13_00
105#define BM_14_00 0x0000000000007fff
106#define BM_00_14 BM_14_00
107#define BM_15_00 0x000000000000ffff
108#define BM_00_15 BM_15_00
109#define BM_16_00 0x000000000001ffff
110#define BM_00_16 BM_16_00
111#define BM_17_00 0x000000000003ffff
112#define BM_00_17 BM_17_00
113#define BM_18_00 0x000000000007ffff
114#define BM_00_18 BM_18_00
115#define BM_19_00 0x00000000000fffff
116#define BM_00_19 BM_19_00
117#define BM_20_00 0x00000000001fffff
118#define BM_00_20 BM_20_00
119#define BM_21_00 0x00000000003fffff
120#define BM_00_21 BM_21_00
121#define BM_22_00 0x00000000007fffff
122#define BM_00_22 BM_22_00
123#define BM_23_00 0x0000000000ffffff
124#define BM_00_23 BM_23_00
125#define BM_24_00 0x0000000001ffffff
126#define BM_00_24 BM_24_00
127#define BM_25_00 0x0000000003ffffff
128#define BM_00_25 BM_25_00
129#define BM_26_00 0x0000000007ffffff
130#define BM_00_26 BM_26_00
131#define BM_27_00 0x000000000fffffff
132#define BM_00_27 BM_27_00
133#define BM_28_00 0x000000001fffffff
134#define BM_00_28 BM_28_00
135#define BM_29_00 0x000000003fffffff
136#define BM_00_29 BM_29_00
137#define BM_30_00 0x000000007fffffff
138#define BM_00_30 BM_30_00
139#define BM_31_00 0x00000000ffffffff
140#define BM_00_31 BM_31_00
141#define BM_32_00 0x00000001ffffffff
142#define BM_00_32 BM_32_00
143#define BM_33_00 0x00000003ffffffff
144#define BM_00_33 BM_33_00
145#define BM_34_00 0x00000007ffffffff
146#define BM_00_34 BM_34_00
147#define BM_35_00 0x0000000fffffffff
148#define BM_00_35 BM_35_00
149#define BM_36_00 0x0000001fffffffff
150#define BM_00_36 BM_36_00
151#define BM_37_00 0x0000003fffffffff
152#define BM_00_37 BM_37_00
153#define BM_38_00 0x0000007fffffffff
154#define BM_00_38 BM_38_00
155#define BM_39_00 0x000000ffffffffff
156#define BM_00_39 BM_39_00
157#define BM_40_00 0x000001ffffffffff
158#define BM_00_40 BM_40_00
159#define BM_41_00 0x000003ffffffffff
160#define BM_00_41 BM_41_00
161#define BM_42_00 0x000007ffffffffff
162#define BM_00_42 BM_42_00
163#define BM_43_00 0x00000fffffffffff
164#define BM_00_43 BM_43_00
165#define BM_44_00 0x00001fffffffffff
166#define BM_00_44 BM_44_00
167#define BM_45_00 0x00003fffffffffff
168#define BM_00_45 BM_45_00
169#define BM_46_00 0x00007fffffffffff
170#define BM_00_46 BM_46_00
171#define BM_47_00 0x0000ffffffffffff
172#define BM_00_47 BM_47_00
173#define BM_48_00 0x0001ffffffffffff
174#define BM_00_48 BM_48_00
175#define BM_49_00 0x0003ffffffffffff
176#define BM_00_49 BM_49_00
177#define BM_50_00 0x0007ffffffffffff
178#define BM_00_50 BM_50_00
179#define BM_51_00 0x000fffffffffffff
180#define BM_00_51 BM_51_00
181#define BM_52_00 0x001fffffffffffff
182#define BM_00_52 BM_52_00
183#define BM_53_00 0x003fffffffffffff
184#define BM_00_53 BM_53_00
185#define BM_54_00 0x007fffffffffffff
186#define BM_00_54 BM_54_00
187#define BM_55_00 0x00ffffffffffffff
188#define BM_00_55 BM_55_00
189#define BM_56_00 0x01ffffffffffffff
190#define BM_00_56 BM_56_00
191#define BM_57_00 0x03ffffffffffffff
192#define BM_00_57 BM_57_00
193#define BM_58_00 0x07ffffffffffffff
194#define BM_00_58 BM_58_00
195#define BM_59_00 0x0fffffffffffffff
196#define BM_00_59 BM_59_00
197#define BM_60_00 0x1fffffffffffffff
198#define BM_00_60 BM_60_00
199#define BM_61_00 0x3fffffffffffffff
200#define BM_00_61 BM_61_00
201#define BM_62_00 0x7fffffffffffffff
202#define BM_00_62 BM_62_00
203#define BM_63_00 0xffffffffffffffff
204#define BM_00_63 BM_63_00
205#define BM_01_01 0x0000000000000002
206#define BM_02_01 0x0000000000000006
207#define BM_01_02 BM_02_01
208#define BM_03_01 0x000000000000000e
209#define BM_01_03 BM_03_01
210#define BM_04_01 0x000000000000001e
211#define BM_01_04 BM_04_01
212#define BM_05_01 0x000000000000003e
213#define BM_01_05 BM_05_01
214#define BM_06_01 0x000000000000007e
215#define BM_01_06 BM_06_01
216#define BM_07_01 0x00000000000000fe
217#define BM_01_07 BM_07_01
218#define BM_08_01 0x00000000000001fe
219#define BM_01_08 BM_08_01
220#define BM_09_01 0x00000000000003fe
221#define BM_01_09 BM_09_01
222#define BM_10_01 0x00000000000007fe
223#define BM_01_10 BM_10_01
224#define BM_11_01 0x0000000000000ffe
225#define BM_01_11 BM_11_01
226#define BM_12_01 0x0000000000001ffe
227#define BM_01_12 BM_12_01
228#define BM_13_01 0x0000000000003ffe
229#define BM_01_13 BM_13_01
230#define BM_14_01 0x0000000000007ffe
231#define BM_01_14 BM_14_01
232#define BM_15_01 0x000000000000fffe
233#define BM_01_15 BM_15_01
234#define BM_16_01 0x000000000001fffe
235#define BM_01_16 BM_16_01
236#define BM_17_01 0x000000000003fffe
237#define BM_01_17 BM_17_01
238#define BM_18_01 0x000000000007fffe
239#define BM_01_18 BM_18_01
240#define BM_19_01 0x00000000000ffffe
241#define BM_01_19 BM_19_01
242#define BM_20_01 0x00000000001ffffe
243#define BM_01_20 BM_20_01
244#define BM_21_01 0x00000000003ffffe
245#define BM_01_21 BM_21_01
246#define BM_22_01 0x00000000007ffffe
247#define BM_01_22 BM_22_01
248#define BM_23_01 0x0000000000fffffe
249#define BM_01_23 BM_23_01
250#define BM_24_01 0x0000000001fffffe
251#define BM_01_24 BM_24_01
252#define BM_25_01 0x0000000003fffffe
253#define BM_01_25 BM_25_01
254#define BM_26_01 0x0000000007fffffe
255#define BM_01_26 BM_26_01
256#define BM_27_01 0x000000000ffffffe
257#define BM_01_27 BM_27_01
258#define BM_28_01 0x000000001ffffffe
259#define BM_01_28 BM_28_01
260#define BM_29_01 0x000000003ffffffe
261#define BM_01_29 BM_29_01
262#define BM_30_01 0x000000007ffffffe
263#define BM_01_30 BM_30_01
264#define BM_31_01 0x00000000fffffffe
265#define BM_01_31 BM_31_01
266#define BM_32_01 0x00000001fffffffe
267#define BM_01_32 BM_32_01
268#define BM_33_01 0x00000003fffffffe
269#define BM_01_33 BM_33_01
270#define BM_34_01 0x00000007fffffffe
271#define BM_01_34 BM_34_01
272#define BM_35_01 0x0000000ffffffffe
273#define BM_01_35 BM_35_01
274#define BM_36_01 0x0000001ffffffffe
275#define BM_01_36 BM_36_01
276#define BM_37_01 0x0000003ffffffffe
277#define BM_01_37 BM_37_01
278#define BM_38_01 0x0000007ffffffffe
279#define BM_01_38 BM_38_01
280#define BM_39_01 0x000000fffffffffe
281#define BM_01_39 BM_39_01
282#define BM_40_01 0x000001fffffffffe
283#define BM_01_40 BM_40_01
284#define BM_41_01 0x000003fffffffffe
285#define BM_01_41 BM_41_01
286#define BM_42_01 0x000007fffffffffe
287#define BM_01_42 BM_42_01
288#define BM_43_01 0x00000ffffffffffe
289#define BM_01_43 BM_43_01
290#define BM_44_01 0x00001ffffffffffe
291#define BM_01_44 BM_44_01
292#define BM_45_01 0x00003ffffffffffe
293#define BM_01_45 BM_45_01
294#define BM_46_01 0x00007ffffffffffe
295#define BM_01_46 BM_46_01
296#define BM_47_01 0x0000fffffffffffe
297#define BM_01_47 BM_47_01
298#define BM_48_01 0x0001fffffffffffe
299#define BM_01_48 BM_48_01
300#define BM_49_01 0x0003fffffffffffe
301#define BM_01_49 BM_49_01
302#define BM_50_01 0x0007fffffffffffe
303#define BM_01_50 BM_50_01
304#define BM_51_01 0x000ffffffffffffe
305#define BM_01_51 BM_51_01
306#define BM_52_01 0x001ffffffffffffe
307#define BM_01_52 BM_52_01
308#define BM_53_01 0x003ffffffffffffe
309#define BM_01_53 BM_53_01
310#define BM_54_01 0x007ffffffffffffe
311#define BM_01_54 BM_54_01
312#define BM_55_01 0x00fffffffffffffe
313#define BM_01_55 BM_55_01
314#define BM_56_01 0x01fffffffffffffe
315#define BM_01_56 BM_56_01
316#define BM_57_01 0x03fffffffffffffe
317#define BM_01_57 BM_57_01
318#define BM_58_01 0x07fffffffffffffe
319#define BM_01_58 BM_58_01
320#define BM_59_01 0x0ffffffffffffffe
321#define BM_01_59 BM_59_01
322#define BM_60_01 0x1ffffffffffffffe
323#define BM_01_60 BM_60_01
324#define BM_61_01 0x3ffffffffffffffe
325#define BM_01_61 BM_61_01
326#define BM_62_01 0x7ffffffffffffffe
327#define BM_01_62 BM_62_01
328#define BM_63_01 0xfffffffffffffffe
329#define BM_01_63 BM_63_01
330#define BM_02_02 0x0000000000000004
331#define BM_03_02 0x000000000000000c
332#define BM_02_03 BM_03_02
333#define BM_04_02 0x000000000000001c
334#define BM_02_04 BM_04_02
335#define BM_05_02 0x000000000000003c
336#define BM_02_05 BM_05_02
337#define BM_06_02 0x000000000000007c
338#define BM_02_06 BM_06_02
339#define BM_07_02 0x00000000000000fc
340#define BM_02_07 BM_07_02
341#define BM_08_02 0x00000000000001fc
342#define BM_02_08 BM_08_02
343#define BM_09_02 0x00000000000003fc
344#define BM_02_09 BM_09_02
345#define BM_10_02 0x00000000000007fc
346#define BM_02_10 BM_10_02
347#define BM_11_02 0x0000000000000ffc
348#define BM_02_11 BM_11_02
349#define BM_12_02 0x0000000000001ffc
350#define BM_02_12 BM_12_02
351#define BM_13_02 0x0000000000003ffc
352#define BM_02_13 BM_13_02
353#define BM_14_02 0x0000000000007ffc
354#define BM_02_14 BM_14_02
355#define BM_15_02 0x000000000000fffc
356#define BM_02_15 BM_15_02
357#define BM_16_02 0x000000000001fffc
358#define BM_02_16 BM_16_02
359#define BM_17_02 0x000000000003fffc
360#define BM_02_17 BM_17_02
361#define BM_18_02 0x000000000007fffc
362#define BM_02_18 BM_18_02
363#define BM_19_02 0x00000000000ffffc
364#define BM_02_19 BM_19_02
365#define BM_20_02 0x00000000001ffffc
366#define BM_02_20 BM_20_02
367#define BM_21_02 0x00000000003ffffc
368#define BM_02_21 BM_21_02
369#define BM_22_02 0x00000000007ffffc
370#define BM_02_22 BM_22_02
371#define BM_23_02 0x0000000000fffffc
372#define BM_02_23 BM_23_02
373#define BM_24_02 0x0000000001fffffc
374#define BM_02_24 BM_24_02
375#define BM_25_02 0x0000000003fffffc
376#define BM_02_25 BM_25_02
377#define BM_26_02 0x0000000007fffffc
378#define BM_02_26 BM_26_02
379#define BM_27_02 0x000000000ffffffc
380#define BM_02_27 BM_27_02
381#define BM_28_02 0x000000001ffffffc
382#define BM_02_28 BM_28_02
383#define BM_29_02 0x000000003ffffffc
384#define BM_02_29 BM_29_02
385#define BM_30_02 0x000000007ffffffc
386#define BM_02_30 BM_30_02
387#define BM_31_02 0x00000000fffffffc
388#define BM_02_31 BM_31_02
389#define BM_32_02 0x00000001fffffffc
390#define BM_02_32 BM_32_02
391#define BM_33_02 0x00000003fffffffc
392#define BM_02_33 BM_33_02
393#define BM_34_02 0x00000007fffffffc
394#define BM_02_34 BM_34_02
395#define BM_35_02 0x0000000ffffffffc
396#define BM_02_35 BM_35_02
397#define BM_36_02 0x0000001ffffffffc
398#define BM_02_36 BM_36_02
399#define BM_37_02 0x0000003ffffffffc
400#define BM_02_37 BM_37_02
401#define BM_38_02 0x0000007ffffffffc
402#define BM_02_38 BM_38_02
403#define BM_39_02 0x000000fffffffffc
404#define BM_02_39 BM_39_02
405#define BM_40_02 0x000001fffffffffc
406#define BM_02_40 BM_40_02
407#define BM_41_02 0x000003fffffffffc
408#define BM_02_41 BM_41_02
409#define BM_42_02 0x000007fffffffffc
410#define BM_02_42 BM_42_02
411#define BM_43_02 0x00000ffffffffffc
412#define BM_02_43 BM_43_02
413#define BM_44_02 0x00001ffffffffffc
414#define BM_02_44 BM_44_02
415#define BM_45_02 0x00003ffffffffffc
416#define BM_02_45 BM_45_02
417#define BM_46_02 0x00007ffffffffffc
418#define BM_02_46 BM_46_02
419#define BM_47_02 0x0000fffffffffffc
420#define BM_02_47 BM_47_02
421#define BM_48_02 0x0001fffffffffffc
422#define BM_02_48 BM_48_02
423#define BM_49_02 0x0003fffffffffffc
424#define BM_02_49 BM_49_02
425#define BM_50_02 0x0007fffffffffffc
426#define BM_02_50 BM_50_02
427#define BM_51_02 0x000ffffffffffffc
428#define BM_02_51 BM_51_02
429#define BM_52_02 0x001ffffffffffffc
430#define BM_02_52 BM_52_02
431#define BM_53_02 0x003ffffffffffffc
432#define BM_02_53 BM_53_02
433#define BM_54_02 0x007ffffffffffffc
434#define BM_02_54 BM_54_02
435#define BM_55_02 0x00fffffffffffffc
436#define BM_02_55 BM_55_02
437#define BM_56_02 0x01fffffffffffffc
438#define BM_02_56 BM_56_02
439#define BM_57_02 0x03fffffffffffffc
440#define BM_02_57 BM_57_02
441#define BM_58_02 0x07fffffffffffffc
442#define BM_02_58 BM_58_02
443#define BM_59_02 0x0ffffffffffffffc
444#define BM_02_59 BM_59_02
445#define BM_60_02 0x1ffffffffffffffc
446#define BM_02_60 BM_60_02
447#define BM_61_02 0x3ffffffffffffffc
448#define BM_02_61 BM_61_02
449#define BM_62_02 0x7ffffffffffffffc
450#define BM_02_62 BM_62_02
451#define BM_63_02 0xfffffffffffffffc
452#define BM_02_63 BM_63_02
453#define BM_03_03 0x0000000000000008
454#define BM_04_03 0x0000000000000018
455#define BM_03_04 BM_04_03
456#define BM_05_03 0x0000000000000038
457#define BM_03_05 BM_05_03
458#define BM_06_03 0x0000000000000078
459#define BM_03_06 BM_06_03
460#define BM_07_03 0x00000000000000f8
461#define BM_03_07 BM_07_03
462#define BM_08_03 0x00000000000001f8
463#define BM_03_08 BM_08_03
464#define BM_09_03 0x00000000000003f8
465#define BM_03_09 BM_09_03
466#define BM_10_03 0x00000000000007f8
467#define BM_03_10 BM_10_03
468#define BM_11_03 0x0000000000000ff8
469#define BM_03_11 BM_11_03
470#define BM_12_03 0x0000000000001ff8
471#define BM_03_12 BM_12_03
472#define BM_13_03 0x0000000000003ff8
473#define BM_03_13 BM_13_03
474#define BM_14_03 0x0000000000007ff8
475#define BM_03_14 BM_14_03
476#define BM_15_03 0x000000000000fff8
477#define BM_03_15 BM_15_03
478#define BM_16_03 0x000000000001fff8
479#define BM_03_16 BM_16_03
480#define BM_17_03 0x000000000003fff8
481#define BM_03_17 BM_17_03
482#define BM_18_03 0x000000000007fff8
483#define BM_03_18 BM_18_03
484#define BM_19_03 0x00000000000ffff8
485#define BM_03_19 BM_19_03
486#define BM_20_03 0x00000000001ffff8
487#define BM_03_20 BM_20_03
488#define BM_21_03 0x00000000003ffff8
489#define BM_03_21 BM_21_03
490#define BM_22_03 0x00000000007ffff8
491#define BM_03_22 BM_22_03
492#define BM_23_03 0x0000000000fffff8
493#define BM_03_23 BM_23_03
494#define BM_24_03 0x0000000001fffff8
495#define BM_03_24 BM_24_03
496#define BM_25_03 0x0000000003fffff8
497#define BM_03_25 BM_25_03
498#define BM_26_03 0x0000000007fffff8
499#define BM_03_26 BM_26_03
500#define BM_27_03 0x000000000ffffff8
501#define BM_03_27 BM_27_03
502#define BM_28_03 0x000000001ffffff8
503#define BM_03_28 BM_28_03
504#define BM_29_03 0x000000003ffffff8
505#define BM_03_29 BM_29_03
506#define BM_30_03 0x000000007ffffff8
507#define BM_03_30 BM_30_03
508#define BM_31_03 0x00000000fffffff8
509#define BM_03_31 BM_31_03
510#define BM_32_03 0x00000001fffffff8
511#define BM_03_32 BM_32_03
512#define BM_33_03 0x00000003fffffff8
513#define BM_03_33 BM_33_03
514#define BM_34_03 0x00000007fffffff8
515#define BM_03_34 BM_34_03
516#define BM_35_03 0x0000000ffffffff8
517#define BM_03_35 BM_35_03
518#define BM_36_03 0x0000001ffffffff8
519#define BM_03_36 BM_36_03
520#define BM_37_03 0x0000003ffffffff8
521#define BM_03_37 BM_37_03
522#define BM_38_03 0x0000007ffffffff8
523#define BM_03_38 BM_38_03
524#define BM_39_03 0x000000fffffffff8
525#define BM_03_39 BM_39_03
526#define BM_40_03 0x000001fffffffff8
527#define BM_03_40 BM_40_03
528#define BM_41_03 0x000003fffffffff8
529#define BM_03_41 BM_41_03
530#define BM_42_03 0x000007fffffffff8
531#define BM_03_42 BM_42_03
532#define BM_43_03 0x00000ffffffffff8
533#define BM_03_43 BM_43_03
534#define BM_44_03 0x00001ffffffffff8
535#define BM_03_44 BM_44_03
536#define BM_45_03 0x00003ffffffffff8
537#define BM_03_45 BM_45_03
538#define BM_46_03 0x00007ffffffffff8
539#define BM_03_46 BM_46_03
540#define BM_47_03 0x0000fffffffffff8
541#define BM_03_47 BM_47_03
542#define BM_48_03 0x0001fffffffffff8
543#define BM_03_48 BM_48_03
544#define BM_49_03 0x0003fffffffffff8
545#define BM_03_49 BM_49_03
546#define BM_50_03 0x0007fffffffffff8
547#define BM_03_50 BM_50_03
548#define BM_51_03 0x000ffffffffffff8
549#define BM_03_51 BM_51_03
550#define BM_52_03 0x001ffffffffffff8
551#define BM_03_52 BM_52_03
552#define BM_53_03 0x003ffffffffffff8
553#define BM_03_53 BM_53_03
554#define BM_54_03 0x007ffffffffffff8
555#define BM_03_54 BM_54_03
556#define BM_55_03 0x00fffffffffffff8
557#define BM_03_55 BM_55_03
558#define BM_56_03 0x01fffffffffffff8
559#define BM_03_56 BM_56_03
560#define BM_57_03 0x03fffffffffffff8
561#define BM_03_57 BM_57_03
562#define BM_58_03 0x07fffffffffffff8
563#define BM_03_58 BM_58_03
564#define BM_59_03 0x0ffffffffffffff8
565#define BM_03_59 BM_59_03
566#define BM_60_03 0x1ffffffffffffff8
567#define BM_03_60 BM_60_03
568#define BM_61_03 0x3ffffffffffffff8
569#define BM_03_61 BM_61_03
570#define BM_62_03 0x7ffffffffffffff8
571#define BM_03_62 BM_62_03
572#define BM_63_03 0xfffffffffffffff8
573#define BM_03_63 BM_63_03
574#define BM_04_04 0x0000000000000010
575#define BM_05_04 0x0000000000000030
576#define BM_04_05 BM_05_04
577#define BM_06_04 0x0000000000000070
578#define BM_04_06 BM_06_04
579#define BM_07_04 0x00000000000000f0
580#define BM_04_07 BM_07_04
581#define BM_08_04 0x00000000000001f0
582#define BM_04_08 BM_08_04
583#define BM_09_04 0x00000000000003f0
584#define BM_04_09 BM_09_04
585#define BM_10_04 0x00000000000007f0
586#define BM_04_10 BM_10_04
587#define BM_11_04 0x0000000000000ff0
588#define BM_04_11 BM_11_04
589#define BM_12_04 0x0000000000001ff0
590#define BM_04_12 BM_12_04
591#define BM_13_04 0x0000000000003ff0
592#define BM_04_13 BM_13_04
593#define BM_14_04 0x0000000000007ff0
594#define BM_04_14 BM_14_04
595#define BM_15_04 0x000000000000fff0
596#define BM_04_15 BM_15_04
597#define BM_16_04 0x000000000001fff0
598#define BM_04_16 BM_16_04
599#define BM_17_04 0x000000000003fff0
600#define BM_04_17 BM_17_04
601#define BM_18_04 0x000000000007fff0
602#define BM_04_18 BM_18_04
603#define BM_19_04 0x00000000000ffff0
604#define BM_04_19 BM_19_04
605#define BM_20_04 0x00000000001ffff0
606#define BM_04_20 BM_20_04
607#define BM_21_04 0x00000000003ffff0
608#define BM_04_21 BM_21_04
609#define BM_22_04 0x00000000007ffff0
610#define BM_04_22 BM_22_04
611#define BM_23_04 0x0000000000fffff0
612#define BM_04_23 BM_23_04
613#define BM_24_04 0x0000000001fffff0
614#define BM_04_24 BM_24_04
615#define BM_25_04 0x0000000003fffff0
616#define BM_04_25 BM_25_04
617#define BM_26_04 0x0000000007fffff0
618#define BM_04_26 BM_26_04
619#define BM_27_04 0x000000000ffffff0
620#define BM_04_27 BM_27_04
621#define BM_28_04 0x000000001ffffff0
622#define BM_04_28 BM_28_04
623#define BM_29_04 0x000000003ffffff0
624#define BM_04_29 BM_29_04
625#define BM_30_04 0x000000007ffffff0
626#define BM_04_30 BM_30_04
627#define BM_31_04 0x00000000fffffff0
628#define BM_04_31 BM_31_04
629#define BM_32_04 0x00000001fffffff0
630#define BM_04_32 BM_32_04
631#define BM_33_04 0x00000003fffffff0
632#define BM_04_33 BM_33_04
633#define BM_34_04 0x00000007fffffff0
634#define BM_04_34 BM_34_04
635#define BM_35_04 0x0000000ffffffff0
636#define BM_04_35 BM_35_04
637#define BM_36_04 0x0000001ffffffff0
638#define BM_04_36 BM_36_04
639#define BM_37_04 0x0000003ffffffff0
640#define BM_04_37 BM_37_04
641#define BM_38_04 0x0000007ffffffff0
642#define BM_04_38 BM_38_04
643#define BM_39_04 0x000000fffffffff0
644#define BM_04_39 BM_39_04
645#define BM_40_04 0x000001fffffffff0
646#define BM_04_40 BM_40_04
647#define BM_41_04 0x000003fffffffff0
648#define BM_04_41 BM_41_04
649#define BM_42_04 0x000007fffffffff0
650#define BM_04_42 BM_42_04
651#define BM_43_04 0x00000ffffffffff0
652#define BM_04_43 BM_43_04
653#define BM_44_04 0x00001ffffffffff0
654#define BM_04_44 BM_44_04
655#define BM_45_04 0x00003ffffffffff0
656#define BM_04_45 BM_45_04
657#define BM_46_04 0x00007ffffffffff0
658#define BM_04_46 BM_46_04
659#define BM_47_04 0x0000fffffffffff0
660#define BM_04_47 BM_47_04
661#define BM_48_04 0x0001fffffffffff0
662#define BM_04_48 BM_48_04
663#define BM_49_04 0x0003fffffffffff0
664#define BM_04_49 BM_49_04
665#define BM_50_04 0x0007fffffffffff0
666#define BM_04_50 BM_50_04
667#define BM_51_04 0x000ffffffffffff0
668#define BM_04_51 BM_51_04
669#define BM_52_04 0x001ffffffffffff0
670#define BM_04_52 BM_52_04
671#define BM_53_04 0x003ffffffffffff0
672#define BM_04_53 BM_53_04
673#define BM_54_04 0x007ffffffffffff0
674#define BM_04_54 BM_54_04
675#define BM_55_04 0x00fffffffffffff0
676#define BM_04_55 BM_55_04
677#define BM_56_04 0x01fffffffffffff0
678#define BM_04_56 BM_56_04
679#define BM_57_04 0x03fffffffffffff0
680#define BM_04_57 BM_57_04
681#define BM_58_04 0x07fffffffffffff0
682#define BM_04_58 BM_58_04
683#define BM_59_04 0x0ffffffffffffff0
684#define BM_04_59 BM_59_04
685#define BM_60_04 0x1ffffffffffffff0
686#define BM_04_60 BM_60_04
687#define BM_61_04 0x3ffffffffffffff0
688#define BM_04_61 BM_61_04
689#define BM_62_04 0x7ffffffffffffff0
690#define BM_04_62 BM_62_04
691#define BM_63_04 0xfffffffffffffff0
692#define BM_04_63 BM_63_04
693#define BM_05_05 0x0000000000000020
694#define BM_06_05 0x0000000000000060
695#define BM_05_06 BM_06_05
696#define BM_07_05 0x00000000000000e0
697#define BM_05_07 BM_07_05
698#define BM_08_05 0x00000000000001e0
699#define BM_05_08 BM_08_05
700#define BM_09_05 0x00000000000003e0
701#define BM_05_09 BM_09_05
702#define BM_10_05 0x00000000000007e0
703#define BM_05_10 BM_10_05
704#define BM_11_05 0x0000000000000fe0
705#define BM_05_11 BM_11_05
706#define BM_12_05 0x0000000000001fe0
707#define BM_05_12 BM_12_05
708#define BM_13_05 0x0000000000003fe0
709#define BM_05_13 BM_13_05
710#define BM_14_05 0x0000000000007fe0
711#define BM_05_14 BM_14_05
712#define BM_15_05 0x000000000000ffe0
713#define BM_05_15 BM_15_05
714#define BM_16_05 0x000000000001ffe0
715#define BM_05_16 BM_16_05
716#define BM_17_05 0x000000000003ffe0
717#define BM_05_17 BM_17_05
718#define BM_18_05 0x000000000007ffe0
719#define BM_05_18 BM_18_05
720#define BM_19_05 0x00000000000fffe0
721#define BM_05_19 BM_19_05
722#define BM_20_05 0x00000000001fffe0
723#define BM_05_20 BM_20_05
724#define BM_21_05 0x00000000003fffe0
725#define BM_05_21 BM_21_05
726#define BM_22_05 0x00000000007fffe0
727#define BM_05_22 BM_22_05
728#define BM_23_05 0x0000000000ffffe0
729#define BM_05_23 BM_23_05
730#define BM_24_05 0x0000000001ffffe0
731#define BM_05_24 BM_24_05
732#define BM_25_05 0x0000000003ffffe0
733#define BM_05_25 BM_25_05
734#define BM_26_05 0x0000000007ffffe0
735#define BM_05_26 BM_26_05
736#define BM_27_05 0x000000000fffffe0
737#define BM_05_27 BM_27_05
738#define BM_28_05 0x000000001fffffe0
739#define BM_05_28 BM_28_05
740#define BM_29_05 0x000000003fffffe0
741#define BM_05_29 BM_29_05
742#define BM_30_05 0x000000007fffffe0
743#define BM_05_30 BM_30_05
744#define BM_31_05 0x00000000ffffffe0
745#define BM_05_31 BM_31_05
746#define BM_32_05 0x00000001ffffffe0
747#define BM_05_32 BM_32_05
748#define BM_33_05 0x00000003ffffffe0
749#define BM_05_33 BM_33_05
750#define BM_34_05 0x00000007ffffffe0
751#define BM_05_34 BM_34_05
752#define BM_35_05 0x0000000fffffffe0
753#define BM_05_35 BM_35_05
754#define BM_36_05 0x0000001fffffffe0
755#define BM_05_36 BM_36_05
756#define BM_37_05 0x0000003fffffffe0
757#define BM_05_37 BM_37_05
758#define BM_38_05 0x0000007fffffffe0
759#define BM_05_38 BM_38_05
760#define BM_39_05 0x000000ffffffffe0
761#define BM_05_39 BM_39_05
762#define BM_40_05 0x000001ffffffffe0
763#define BM_05_40 BM_40_05
764#define BM_41_05 0x000003ffffffffe0
765#define BM_05_41 BM_41_05
766#define BM_42_05 0x000007ffffffffe0
767#define BM_05_42 BM_42_05
768#define BM_43_05 0x00000fffffffffe0
769#define BM_05_43 BM_43_05
770#define BM_44_05 0x00001fffffffffe0
771#define BM_05_44 BM_44_05
772#define BM_45_05 0x00003fffffffffe0
773#define BM_05_45 BM_45_05
774#define BM_46_05 0x00007fffffffffe0
775#define BM_05_46 BM_46_05
776#define BM_47_05 0x0000ffffffffffe0
777#define BM_05_47 BM_47_05
778#define BM_48_05 0x0001ffffffffffe0
779#define BM_05_48 BM_48_05
780#define BM_49_05 0x0003ffffffffffe0
781#define BM_05_49 BM_49_05
782#define BM_50_05 0x0007ffffffffffe0
783#define BM_05_50 BM_50_05
784#define BM_51_05 0x000fffffffffffe0
785#define BM_05_51 BM_51_05
786#define BM_52_05 0x001fffffffffffe0
787#define BM_05_52 BM_52_05
788#define BM_53_05 0x003fffffffffffe0
789#define BM_05_53 BM_53_05
790#define BM_54_05 0x007fffffffffffe0
791#define BM_05_54 BM_54_05
792#define BM_55_05 0x00ffffffffffffe0
793#define BM_05_55 BM_55_05
794#define BM_56_05 0x01ffffffffffffe0
795#define BM_05_56 BM_56_05
796#define BM_57_05 0x03ffffffffffffe0
797#define BM_05_57 BM_57_05
798#define BM_58_05 0x07ffffffffffffe0
799#define BM_05_58 BM_58_05
800#define BM_59_05 0x0fffffffffffffe0
801#define BM_05_59 BM_59_05
802#define BM_60_05 0x1fffffffffffffe0
803#define BM_05_60 BM_60_05
804#define BM_61_05 0x3fffffffffffffe0
805#define BM_05_61 BM_61_05
806#define BM_62_05 0x7fffffffffffffe0
807#define BM_05_62 BM_62_05
808#define BM_63_05 0xffffffffffffffe0
809#define BM_05_63 BM_63_05
810#define BM_06_06 0x0000000000000040
811#define BM_07_06 0x00000000000000c0
812#define BM_06_07 BM_07_06
813#define BM_08_06 0x00000000000001c0
814#define BM_06_08 BM_08_06
815#define BM_09_06 0x00000000000003c0
816#define BM_06_09 BM_09_06
817#define BM_10_06 0x00000000000007c0
818#define BM_06_10 BM_10_06
819#define BM_11_06 0x0000000000000fc0
820#define BM_06_11 BM_11_06
821#define BM_12_06 0x0000000000001fc0
822#define BM_06_12 BM_12_06
823#define BM_13_06 0x0000000000003fc0
824#define BM_06_13 BM_13_06
825#define BM_14_06 0x0000000000007fc0
826#define BM_06_14 BM_14_06
827#define BM_15_06 0x000000000000ffc0
828#define BM_06_15 BM_15_06
829#define BM_16_06 0x000000000001ffc0
830#define BM_06_16 BM_16_06
831#define BM_17_06 0x000000000003ffc0
832#define BM_06_17 BM_17_06
833#define BM_18_06 0x000000000007ffc0
834#define BM_06_18 BM_18_06
835#define BM_19_06 0x00000000000fffc0
836#define BM_06_19 BM_19_06
837#define BM_20_06 0x00000000001fffc0
838#define BM_06_20 BM_20_06
839#define BM_21_06 0x00000000003fffc0
840#define BM_06_21 BM_21_06
841#define BM_22_06 0x00000000007fffc0
842#define BM_06_22 BM_22_06
843#define BM_23_06 0x0000000000ffffc0
844#define BM_06_23 BM_23_06
845#define BM_24_06 0x0000000001ffffc0
846#define BM_06_24 BM_24_06
847#define BM_25_06 0x0000000003ffffc0
848#define BM_06_25 BM_25_06
849#define BM_26_06 0x0000000007ffffc0
850#define BM_06_26 BM_26_06
851#define BM_27_06 0x000000000fffffc0
852#define BM_06_27 BM_27_06
853#define BM_28_06 0x000000001fffffc0
854#define BM_06_28 BM_28_06
855#define BM_29_06 0x000000003fffffc0
856#define BM_06_29 BM_29_06
857#define BM_30_06 0x000000007fffffc0
858#define BM_06_30 BM_30_06
859#define BM_31_06 0x00000000ffffffc0
860#define BM_06_31 BM_31_06
861#define BM_32_06 0x00000001ffffffc0
862#define BM_06_32 BM_32_06
863#define BM_33_06 0x00000003ffffffc0
864#define BM_06_33 BM_33_06
865#define BM_34_06 0x00000007ffffffc0
866#define BM_06_34 BM_34_06
867#define BM_35_06 0x0000000fffffffc0
868#define BM_06_35 BM_35_06
869#define BM_36_06 0x0000001fffffffc0
870#define BM_06_36 BM_36_06
871#define BM_37_06 0x0000003fffffffc0
872#define BM_06_37 BM_37_06
873#define BM_38_06 0x0000007fffffffc0
874#define BM_06_38 BM_38_06
875#define BM_39_06 0x000000ffffffffc0
876#define BM_06_39 BM_39_06
877#define BM_40_06 0x000001ffffffffc0
878#define BM_06_40 BM_40_06
879#define BM_41_06 0x000003ffffffffc0
880#define BM_06_41 BM_41_06
881#define BM_42_06 0x000007ffffffffc0
882#define BM_06_42 BM_42_06
883#define BM_43_06 0x00000fffffffffc0
884#define BM_06_43 BM_43_06
885#define BM_44_06 0x00001fffffffffc0
886#define BM_06_44 BM_44_06
887#define BM_45_06 0x00003fffffffffc0
888#define BM_06_45 BM_45_06
889#define BM_46_06 0x00007fffffffffc0
890#define BM_06_46 BM_46_06
891#define BM_47_06 0x0000ffffffffffc0
892#define BM_06_47 BM_47_06
893#define BM_48_06 0x0001ffffffffffc0
894#define BM_06_48 BM_48_06
895#define BM_49_06 0x0003ffffffffffc0
896#define BM_06_49 BM_49_06
897#define BM_50_06 0x0007ffffffffffc0
898#define BM_06_50 BM_50_06
899#define BM_51_06 0x000fffffffffffc0
900#define BM_06_51 BM_51_06
901#define BM_52_06 0x001fffffffffffc0
902#define BM_06_52 BM_52_06
903#define BM_53_06 0x003fffffffffffc0
904#define BM_06_53 BM_53_06
905#define BM_54_06 0x007fffffffffffc0
906#define BM_06_54 BM_54_06
907#define BM_55_06 0x00ffffffffffffc0
908#define BM_06_55 BM_55_06
909#define BM_56_06 0x01ffffffffffffc0
910#define BM_06_56 BM_56_06
911#define BM_57_06 0x03ffffffffffffc0
912#define BM_06_57 BM_57_06
913#define BM_58_06 0x07ffffffffffffc0
914#define BM_06_58 BM_58_06
915#define BM_59_06 0x0fffffffffffffc0
916#define BM_06_59 BM_59_06
917#define BM_60_06 0x1fffffffffffffc0
918#define BM_06_60 BM_60_06
919#define BM_61_06 0x3fffffffffffffc0
920#define BM_06_61 BM_61_06
921#define BM_62_06 0x7fffffffffffffc0
922#define BM_06_62 BM_62_06
923#define BM_63_06 0xffffffffffffffc0
924#define BM_06_63 BM_63_06
925#define BM_07_07 0x0000000000000080
926#define BM_08_07 0x0000000000000180
927#define BM_07_08 BM_08_07
928#define BM_09_07 0x0000000000000380
929#define BM_07_09 BM_09_07
930#define BM_10_07 0x0000000000000780
931#define BM_07_10 BM_10_07
932#define BM_11_07 0x0000000000000f80
933#define BM_07_11 BM_11_07
934#define BM_12_07 0x0000000000001f80
935#define BM_07_12 BM_12_07
936#define BM_13_07 0x0000000000003f80
937#define BM_07_13 BM_13_07
938#define BM_14_07 0x0000000000007f80
939#define BM_07_14 BM_14_07
940#define BM_15_07 0x000000000000ff80
941#define BM_07_15 BM_15_07
942#define BM_16_07 0x000000000001ff80
943#define BM_07_16 BM_16_07
944#define BM_17_07 0x000000000003ff80
945#define BM_07_17 BM_17_07
946#define BM_18_07 0x000000000007ff80
947#define BM_07_18 BM_18_07
948#define BM_19_07 0x00000000000fff80
949#define BM_07_19 BM_19_07
950#define BM_20_07 0x00000000001fff80
951#define BM_07_20 BM_20_07
952#define BM_21_07 0x00000000003fff80
953#define BM_07_21 BM_21_07
954#define BM_22_07 0x00000000007fff80
955#define BM_07_22 BM_22_07
956#define BM_23_07 0x0000000000ffff80
957#define BM_07_23 BM_23_07
958#define BM_24_07 0x0000000001ffff80
959#define BM_07_24 BM_24_07
960#define BM_25_07 0x0000000003ffff80
961#define BM_07_25 BM_25_07
962#define BM_26_07 0x0000000007ffff80
963#define BM_07_26 BM_26_07
964#define BM_27_07 0x000000000fffff80
965#define BM_07_27 BM_27_07
966#define BM_28_07 0x000000001fffff80
967#define BM_07_28 BM_28_07
968#define BM_29_07 0x000000003fffff80
969#define BM_07_29 BM_29_07
970#define BM_30_07 0x000000007fffff80
971#define BM_07_30 BM_30_07
972#define BM_31_07 0x00000000ffffff80
973#define BM_07_31 BM_31_07
974#define BM_32_07 0x00000001ffffff80
975#define BM_07_32 BM_32_07
976#define BM_33_07 0x00000003ffffff80
977#define BM_07_33 BM_33_07
978#define BM_34_07 0x00000007ffffff80
979#define BM_07_34 BM_34_07
980#define BM_35_07 0x0000000fffffff80
981#define BM_07_35 BM_35_07
982#define BM_36_07 0x0000001fffffff80
983#define BM_07_36 BM_36_07
984#define BM_37_07 0x0000003fffffff80
985#define BM_07_37 BM_37_07
986#define BM_38_07 0x0000007fffffff80
987#define BM_07_38 BM_38_07
988#define BM_39_07 0x000000ffffffff80
989#define BM_07_39 BM_39_07
990#define BM_40_07 0x000001ffffffff80
991#define BM_07_40 BM_40_07
992#define BM_41_07 0x000003ffffffff80
993#define BM_07_41 BM_41_07
994#define BM_42_07 0x000007ffffffff80
995#define BM_07_42 BM_42_07
996#define BM_43_07 0x00000fffffffff80
997#define BM_07_43 BM_43_07
998#define BM_44_07 0x00001fffffffff80
999#define BM_07_44 BM_44_07
1000#define BM_45_07 0x00003fffffffff80
1001#define BM_07_45 BM_45_07
1002#define BM_46_07 0x00007fffffffff80
1003#define BM_07_46 BM_46_07
1004#define BM_47_07 0x0000ffffffffff80
1005#define BM_07_47 BM_47_07
1006#define BM_48_07 0x0001ffffffffff80
1007#define BM_07_48 BM_48_07
1008#define BM_49_07 0x0003ffffffffff80
1009#define BM_07_49 BM_49_07
1010#define BM_50_07 0x0007ffffffffff80
1011#define BM_07_50 BM_50_07
1012#define BM_51_07 0x000fffffffffff80
1013#define BM_07_51 BM_51_07
1014#define BM_52_07 0x001fffffffffff80
1015#define BM_07_52 BM_52_07
1016#define BM_53_07 0x003fffffffffff80
1017#define BM_07_53 BM_53_07
1018#define BM_54_07 0x007fffffffffff80
1019#define BM_07_54 BM_54_07
1020#define BM_55_07 0x00ffffffffffff80
1021#define BM_07_55 BM_55_07
1022#define BM_56_07 0x01ffffffffffff80
1023#define BM_07_56 BM_56_07
1024#define BM_57_07 0x03ffffffffffff80
1025#define BM_07_57 BM_57_07
1026#define BM_58_07 0x07ffffffffffff80
1027#define BM_07_58 BM_58_07
1028#define BM_59_07 0x0fffffffffffff80
1029#define BM_07_59 BM_59_07
1030#define BM_60_07 0x1fffffffffffff80
1031#define BM_07_60 BM_60_07
1032#define BM_61_07 0x3fffffffffffff80
1033#define BM_07_61 BM_61_07
1034#define BM_62_07 0x7fffffffffffff80
1035#define BM_07_62 BM_62_07
1036#define BM_63_07 0xffffffffffffff80
1037#define BM_07_63 BM_63_07
1038#define BM_08_08 0x0000000000000100
1039#define BM_09_08 0x0000000000000300
1040#define BM_08_09 BM_09_08
1041#define BM_10_08 0x0000000000000700
1042#define BM_08_10 BM_10_08
1043#define BM_11_08 0x0000000000000f00
1044#define BM_08_11 BM_11_08
1045#define BM_12_08 0x0000000000001f00
1046#define BM_08_12 BM_12_08
1047#define BM_13_08 0x0000000000003f00
1048#define BM_08_13 BM_13_08
1049#define BM_14_08 0x0000000000007f00
1050#define BM_08_14 BM_14_08
1051#define BM_15_08 0x000000000000ff00
1052#define BM_08_15 BM_15_08
1053#define BM_16_08 0x000000000001ff00
1054#define BM_08_16 BM_16_08
1055#define BM_17_08 0x000000000003ff00
1056#define BM_08_17 BM_17_08
1057#define BM_18_08 0x000000000007ff00
1058#define BM_08_18 BM_18_08
1059#define BM_19_08 0x00000000000fff00
1060#define BM_08_19 BM_19_08
1061#define BM_20_08 0x00000000001fff00
1062#define BM_08_20 BM_20_08
1063#define BM_21_08 0x00000000003fff00
1064#define BM_08_21 BM_21_08
1065#define BM_22_08 0x00000000007fff00
1066#define BM_08_22 BM_22_08
1067#define BM_23_08 0x0000000000ffff00
1068#define BM_08_23 BM_23_08
1069#define BM_24_08 0x0000000001ffff00
1070#define BM_08_24 BM_24_08
1071#define BM_25_08 0x0000000003ffff00
1072#define BM_08_25 BM_25_08
1073#define BM_26_08 0x0000000007ffff00
1074#define BM_08_26 BM_26_08
1075#define BM_27_08 0x000000000fffff00
1076#define BM_08_27 BM_27_08
1077#define BM_28_08 0x000000001fffff00
1078#define BM_08_28 BM_28_08
1079#define BM_29_08 0x000000003fffff00
1080#define BM_08_29 BM_29_08
1081#define BM_30_08 0x000000007fffff00
1082#define BM_08_30 BM_30_08
1083#define BM_31_08 0x00000000ffffff00
1084#define BM_08_31 BM_31_08
1085#define BM_32_08 0x00000001ffffff00
1086#define BM_08_32 BM_32_08
1087#define BM_33_08 0x00000003ffffff00
1088#define BM_08_33 BM_33_08
1089#define BM_34_08 0x00000007ffffff00
1090#define BM_08_34 BM_34_08
1091#define BM_35_08 0x0000000fffffff00
1092#define BM_08_35 BM_35_08
1093#define BM_36_08 0x0000001fffffff00
1094#define BM_08_36 BM_36_08
1095#define BM_37_08 0x0000003fffffff00
1096#define BM_08_37 BM_37_08
1097#define BM_38_08 0x0000007fffffff00
1098#define BM_08_38 BM_38_08
1099#define BM_39_08 0x000000ffffffff00
1100#define BM_08_39 BM_39_08
1101#define BM_40_08 0x000001ffffffff00
1102#define BM_08_40 BM_40_08
1103#define BM_41_08 0x000003ffffffff00
1104#define BM_08_41 BM_41_08
1105#define BM_42_08 0x000007ffffffff00
1106#define BM_08_42 BM_42_08
1107#define BM_43_08 0x00000fffffffff00
1108#define BM_08_43 BM_43_08
1109#define BM_44_08 0x00001fffffffff00
1110#define BM_08_44 BM_44_08
1111#define BM_45_08 0x00003fffffffff00
1112#define BM_08_45 BM_45_08
1113#define BM_46_08 0x00007fffffffff00
1114#define BM_08_46 BM_46_08
1115#define BM_47_08 0x0000ffffffffff00
1116#define BM_08_47 BM_47_08
1117#define BM_48_08 0x0001ffffffffff00
1118#define BM_08_48 BM_48_08
1119#define BM_49_08 0x0003ffffffffff00
1120#define BM_08_49 BM_49_08
1121#define BM_50_08 0x0007ffffffffff00
1122#define BM_08_50 BM_50_08
1123#define BM_51_08 0x000fffffffffff00
1124#define BM_08_51 BM_51_08
1125#define BM_52_08 0x001fffffffffff00
1126#define BM_08_52 BM_52_08
1127#define BM_53_08 0x003fffffffffff00
1128#define BM_08_53 BM_53_08
1129#define BM_54_08 0x007fffffffffff00
1130#define BM_08_54 BM_54_08
1131#define BM_55_08 0x00ffffffffffff00
1132#define BM_08_55 BM_55_08
1133#define BM_56_08 0x01ffffffffffff00
1134#define BM_08_56 BM_56_08
1135#define BM_57_08 0x03ffffffffffff00
1136#define BM_08_57 BM_57_08
1137#define BM_58_08 0x07ffffffffffff00
1138#define BM_08_58 BM_58_08
1139#define BM_59_08 0x0fffffffffffff00
1140#define BM_08_59 BM_59_08
1141#define BM_60_08 0x1fffffffffffff00
1142#define BM_08_60 BM_60_08
1143#define BM_61_08 0x3fffffffffffff00
1144#define BM_08_61 BM_61_08
1145#define BM_62_08 0x7fffffffffffff00
1146#define BM_08_62 BM_62_08
1147#define BM_63_08 0xffffffffffffff00
1148#define BM_08_63 BM_63_08
1149#define BM_09_09 0x0000000000000200
1150#define BM_10_09 0x0000000000000600
1151#define BM_09_10 BM_10_09
1152#define BM_11_09 0x0000000000000e00
1153#define BM_09_11 BM_11_09
1154#define BM_12_09 0x0000000000001e00
1155#define BM_09_12 BM_12_09
1156#define BM_13_09 0x0000000000003e00
1157#define BM_09_13 BM_13_09
1158#define BM_14_09 0x0000000000007e00
1159#define BM_09_14 BM_14_09
1160#define BM_15_09 0x000000000000fe00
1161#define BM_09_15 BM_15_09
1162#define BM_16_09 0x000000000001fe00
1163#define BM_09_16 BM_16_09
1164#define BM_17_09 0x000000000003fe00
1165#define BM_09_17 BM_17_09
1166#define BM_18_09 0x000000000007fe00
1167#define BM_09_18 BM_18_09
1168#define BM_19_09 0x00000000000ffe00
1169#define BM_09_19 BM_19_09
1170#define BM_20_09 0x00000000001ffe00
1171#define BM_09_20 BM_20_09
1172#define BM_21_09 0x00000000003ffe00
1173#define BM_09_21 BM_21_09
1174#define BM_22_09 0x00000000007ffe00
1175#define BM_09_22 BM_22_09
1176#define BM_23_09 0x0000000000fffe00
1177#define BM_09_23 BM_23_09
1178#define BM_24_09 0x0000000001fffe00
1179#define BM_09_24 BM_24_09
1180#define BM_25_09 0x0000000003fffe00
1181#define BM_09_25 BM_25_09
1182#define BM_26_09 0x0000000007fffe00
1183#define BM_09_26 BM_26_09
1184#define BM_27_09 0x000000000ffffe00
1185#define BM_09_27 BM_27_09
1186#define BM_28_09 0x000000001ffffe00
1187#define BM_09_28 BM_28_09
1188#define BM_29_09 0x000000003ffffe00
1189#define BM_09_29 BM_29_09
1190#define BM_30_09 0x000000007ffffe00
1191#define BM_09_30 BM_30_09
1192#define BM_31_09 0x00000000fffffe00
1193#define BM_09_31 BM_31_09
1194#define BM_32_09 0x00000001fffffe00
1195#define BM_09_32 BM_32_09
1196#define BM_33_09 0x00000003fffffe00
1197#define BM_09_33 BM_33_09
1198#define BM_34_09 0x00000007fffffe00
1199#define BM_09_34 BM_34_09
1200#define BM_35_09 0x0000000ffffffe00
1201#define BM_09_35 BM_35_09
1202#define BM_36_09 0x0000001ffffffe00
1203#define BM_09_36 BM_36_09
1204#define BM_37_09 0x0000003ffffffe00
1205#define BM_09_37 BM_37_09
1206#define BM_38_09 0x0000007ffffffe00
1207#define BM_09_38 BM_38_09
1208#define BM_39_09 0x000000fffffffe00
1209#define BM_09_39 BM_39_09
1210#define BM_40_09 0x000001fffffffe00
1211#define BM_09_40 BM_40_09
1212#define BM_41_09 0x000003fffffffe00
1213#define BM_09_41 BM_41_09
1214#define BM_42_09 0x000007fffffffe00
1215#define BM_09_42 BM_42_09
1216#define BM_43_09 0x00000ffffffffe00
1217#define BM_09_43 BM_43_09
1218#define BM_44_09 0x00001ffffffffe00
1219#define BM_09_44 BM_44_09
1220#define BM_45_09 0x00003ffffffffe00
1221#define BM_09_45 BM_45_09
1222#define BM_46_09 0x00007ffffffffe00
1223#define BM_09_46 BM_46_09
1224#define BM_47_09 0x0000fffffffffe00
1225#define BM_09_47 BM_47_09
1226#define BM_48_09 0x0001fffffffffe00
1227#define BM_09_48 BM_48_09
1228#define BM_49_09 0x0003fffffffffe00
1229#define BM_09_49 BM_49_09
1230#define BM_50_09 0x0007fffffffffe00
1231#define BM_09_50 BM_50_09
1232#define BM_51_09 0x000ffffffffffe00
1233#define BM_09_51 BM_51_09
1234#define BM_52_09 0x001ffffffffffe00
1235#define BM_09_52 BM_52_09
1236#define BM_53_09 0x003ffffffffffe00
1237#define BM_09_53 BM_53_09
1238#define BM_54_09 0x007ffffffffffe00
1239#define BM_09_54 BM_54_09
1240#define BM_55_09 0x00fffffffffffe00
1241#define BM_09_55 BM_55_09
1242#define BM_56_09 0x01fffffffffffe00
1243#define BM_09_56 BM_56_09
1244#define BM_57_09 0x03fffffffffffe00
1245#define BM_09_57 BM_57_09
1246#define BM_58_09 0x07fffffffffffe00
1247#define BM_09_58 BM_58_09
1248#define BM_59_09 0x0ffffffffffffe00
1249#define BM_09_59 BM_59_09
1250#define BM_60_09 0x1ffffffffffffe00
1251#define BM_09_60 BM_60_09
1252#define BM_61_09 0x3ffffffffffffe00
1253#define BM_09_61 BM_61_09
1254#define BM_62_09 0x7ffffffffffffe00
1255#define BM_09_62 BM_62_09
1256#define BM_63_09 0xfffffffffffffe00
1257#define BM_09_63 BM_63_09
1258#define BM_10_10 0x0000000000000400
1259#define BM_11_10 0x0000000000000c00
1260#define BM_10_11 BM_11_10
1261#define BM_12_10 0x0000000000001c00
1262#define BM_10_12 BM_12_10
1263#define BM_13_10 0x0000000000003c00
1264#define BM_10_13 BM_13_10
1265#define BM_14_10 0x0000000000007c00
1266#define BM_10_14 BM_14_10
1267#define BM_15_10 0x000000000000fc00
1268#define BM_10_15 BM_15_10
1269#define BM_16_10 0x000000000001fc00
1270#define BM_10_16 BM_16_10
1271#define BM_17_10 0x000000000003fc00
1272#define BM_10_17 BM_17_10
1273#define BM_18_10 0x000000000007fc00
1274#define BM_10_18 BM_18_10
1275#define BM_19_10 0x00000000000ffc00
1276#define BM_10_19 BM_19_10
1277#define BM_20_10 0x00000000001ffc00
1278#define BM_10_20 BM_20_10
1279#define BM_21_10 0x00000000003ffc00
1280#define BM_10_21 BM_21_10
1281#define BM_22_10 0x00000000007ffc00
1282#define BM_10_22 BM_22_10
1283#define BM_23_10 0x0000000000fffc00
1284#define BM_10_23 BM_23_10
1285#define BM_24_10 0x0000000001fffc00
1286#define BM_10_24 BM_24_10
1287#define BM_25_10 0x0000000003fffc00
1288#define BM_10_25 BM_25_10
1289#define BM_26_10 0x0000000007fffc00
1290#define BM_10_26 BM_26_10
1291#define BM_27_10 0x000000000ffffc00
1292#define BM_10_27 BM_27_10
1293#define BM_28_10 0x000000001ffffc00
1294#define BM_10_28 BM_28_10
1295#define BM_29_10 0x000000003ffffc00
1296#define BM_10_29 BM_29_10
1297#define BM_30_10 0x000000007ffffc00
1298#define BM_10_30 BM_30_10
1299#define BM_31_10 0x00000000fffffc00
1300#define BM_10_31 BM_31_10
1301#define BM_32_10 0x00000001fffffc00
1302#define BM_10_32 BM_32_10
1303#define BM_33_10 0x00000003fffffc00
1304#define BM_10_33 BM_33_10
1305#define BM_34_10 0x00000007fffffc00
1306#define BM_10_34 BM_34_10
1307#define BM_35_10 0x0000000ffffffc00
1308#define BM_10_35 BM_35_10
1309#define BM_36_10 0x0000001ffffffc00
1310#define BM_10_36 BM_36_10
1311#define BM_37_10 0x0000003ffffffc00
1312#define BM_10_37 BM_37_10
1313#define BM_38_10 0x0000007ffffffc00
1314#define BM_10_38 BM_38_10
1315#define BM_39_10 0x000000fffffffc00
1316#define BM_10_39 BM_39_10
1317#define BM_40_10 0x000001fffffffc00
1318#define BM_10_40 BM_40_10
1319#define BM_41_10 0x000003fffffffc00
1320#define BM_10_41 BM_41_10
1321#define BM_42_10 0x000007fffffffc00
1322#define BM_10_42 BM_42_10
1323#define BM_43_10 0x00000ffffffffc00
1324#define BM_10_43 BM_43_10
1325#define BM_44_10 0x00001ffffffffc00
1326#define BM_10_44 BM_44_10
1327#define BM_45_10 0x00003ffffffffc00
1328#define BM_10_45 BM_45_10
1329#define BM_46_10 0x00007ffffffffc00
1330#define BM_10_46 BM_46_10
1331#define BM_47_10 0x0000fffffffffc00
1332#define BM_10_47 BM_47_10
1333#define BM_48_10 0x0001fffffffffc00
1334#define BM_10_48 BM_48_10
1335#define BM_49_10 0x0003fffffffffc00
1336#define BM_10_49 BM_49_10
1337#define BM_50_10 0x0007fffffffffc00
1338#define BM_10_50 BM_50_10
1339#define BM_51_10 0x000ffffffffffc00
1340#define BM_10_51 BM_51_10
1341#define BM_52_10 0x001ffffffffffc00
1342#define BM_10_52 BM_52_10
1343#define BM_53_10 0x003ffffffffffc00
1344#define BM_10_53 BM_53_10
1345#define BM_54_10 0x007ffffffffffc00
1346#define BM_10_54 BM_54_10
1347#define BM_55_10 0x00fffffffffffc00
1348#define BM_10_55 BM_55_10
1349#define BM_56_10 0x01fffffffffffc00
1350#define BM_10_56 BM_56_10
1351#define BM_57_10 0x03fffffffffffc00
1352#define BM_10_57 BM_57_10
1353#define BM_58_10 0x07fffffffffffc00
1354#define BM_10_58 BM_58_10
1355#define BM_59_10 0x0ffffffffffffc00
1356#define BM_10_59 BM_59_10
1357#define BM_60_10 0x1ffffffffffffc00
1358#define BM_10_60 BM_60_10
1359#define BM_61_10 0x3ffffffffffffc00
1360#define BM_10_61 BM_61_10
1361#define BM_62_10 0x7ffffffffffffc00
1362#define BM_10_62 BM_62_10
1363#define BM_63_10 0xfffffffffffffc00
1364#define BM_10_63 BM_63_10
1365#define BM_11_11 0x0000000000000800
1366#define BM_12_11 0x0000000000001800
1367#define BM_11_12 BM_12_11
1368#define BM_13_11 0x0000000000003800
1369#define BM_11_13 BM_13_11
1370#define BM_14_11 0x0000000000007800
1371#define BM_11_14 BM_14_11
1372#define BM_15_11 0x000000000000f800
1373#define BM_11_15 BM_15_11
1374#define BM_16_11 0x000000000001f800
1375#define BM_11_16 BM_16_11
1376#define BM_17_11 0x000000000003f800
1377#define BM_11_17 BM_17_11
1378#define BM_18_11 0x000000000007f800
1379#define BM_11_18 BM_18_11
1380#define BM_19_11 0x00000000000ff800
1381#define BM_11_19 BM_19_11
1382#define BM_20_11 0x00000000001ff800
1383#define BM_11_20 BM_20_11
1384#define BM_21_11 0x00000000003ff800
1385#define BM_11_21 BM_21_11
1386#define BM_22_11 0x00000000007ff800
1387#define BM_11_22 BM_22_11
1388#define BM_23_11 0x0000000000fff800
1389#define BM_11_23 BM_23_11
1390#define BM_24_11 0x0000000001fff800
1391#define BM_11_24 BM_24_11
1392#define BM_25_11 0x0000000003fff800
1393#define BM_11_25 BM_25_11
1394#define BM_26_11 0x0000000007fff800
1395#define BM_11_26 BM_26_11
1396#define BM_27_11 0x000000000ffff800
1397#define BM_11_27 BM_27_11
1398#define BM_28_11 0x000000001ffff800
1399#define BM_11_28 BM_28_11
1400#define BM_29_11 0x000000003ffff800
1401#define BM_11_29 BM_29_11
1402#define BM_30_11 0x000000007ffff800
1403#define BM_11_30 BM_30_11
1404#define BM_31_11 0x00000000fffff800
1405#define BM_11_31 BM_31_11
1406#define BM_32_11 0x00000001fffff800
1407#define BM_11_32 BM_32_11
1408#define BM_33_11 0x00000003fffff800
1409#define BM_11_33 BM_33_11
1410#define BM_34_11 0x00000007fffff800
1411#define BM_11_34 BM_34_11
1412#define BM_35_11 0x0000000ffffff800
1413#define BM_11_35 BM_35_11
1414#define BM_36_11 0x0000001ffffff800
1415#define BM_11_36 BM_36_11
1416#define BM_37_11 0x0000003ffffff800
1417#define BM_11_37 BM_37_11
1418#define BM_38_11 0x0000007ffffff800
1419#define BM_11_38 BM_38_11
1420#define BM_39_11 0x000000fffffff800
1421#define BM_11_39 BM_39_11
1422#define BM_40_11 0x000001fffffff800
1423#define BM_11_40 BM_40_11
1424#define BM_41_11 0x000003fffffff800
1425#define BM_11_41 BM_41_11
1426#define BM_42_11 0x000007fffffff800
1427#define BM_11_42 BM_42_11
1428#define BM_43_11 0x00000ffffffff800
1429#define BM_11_43 BM_43_11
1430#define BM_44_11 0x00001ffffffff800
1431#define BM_11_44 BM_44_11
1432#define BM_45_11 0x00003ffffffff800
1433#define BM_11_45 BM_45_11
1434#define BM_46_11 0x00007ffffffff800
1435#define BM_11_46 BM_46_11
1436#define BM_47_11 0x0000fffffffff800
1437#define BM_11_47 BM_47_11
1438#define BM_48_11 0x0001fffffffff800
1439#define BM_11_48 BM_48_11
1440#define BM_49_11 0x0003fffffffff800
1441#define BM_11_49 BM_49_11
1442#define BM_50_11 0x0007fffffffff800
1443#define BM_11_50 BM_50_11
1444#define BM_51_11 0x000ffffffffff800
1445#define BM_11_51 BM_51_11
1446#define BM_52_11 0x001ffffffffff800
1447#define BM_11_52 BM_52_11
1448#define BM_53_11 0x003ffffffffff800
1449#define BM_11_53 BM_53_11
1450#define BM_54_11 0x007ffffffffff800
1451#define BM_11_54 BM_54_11
1452#define BM_55_11 0x00fffffffffff800
1453#define BM_11_55 BM_55_11
1454#define BM_56_11 0x01fffffffffff800
1455#define BM_11_56 BM_56_11
1456#define BM_57_11 0x03fffffffffff800
1457#define BM_11_57 BM_57_11
1458#define BM_58_11 0x07fffffffffff800
1459#define BM_11_58 BM_58_11
1460#define BM_59_11 0x0ffffffffffff800
1461#define BM_11_59 BM_59_11
1462#define BM_60_11 0x1ffffffffffff800
1463#define BM_11_60 BM_60_11
1464#define BM_61_11 0x3ffffffffffff800
1465#define BM_11_61 BM_61_11
1466#define BM_62_11 0x7ffffffffffff800
1467#define BM_11_62 BM_62_11
1468#define BM_63_11 0xfffffffffffff800
1469#define BM_11_63 BM_63_11
1470#define BM_12_12 0x0000000000001000
1471#define BM_13_12 0x0000000000003000
1472#define BM_12_13 BM_13_12
1473#define BM_14_12 0x0000000000007000
1474#define BM_12_14 BM_14_12
1475#define BM_15_12 0x000000000000f000
1476#define BM_12_15 BM_15_12
1477#define BM_16_12 0x000000000001f000
1478#define BM_12_16 BM_16_12
1479#define BM_17_12 0x000000000003f000
1480#define BM_12_17 BM_17_12
1481#define BM_18_12 0x000000000007f000
1482#define BM_12_18 BM_18_12
1483#define BM_19_12 0x00000000000ff000
1484#define BM_12_19 BM_19_12
1485#define BM_20_12 0x00000000001ff000
1486#define BM_12_20 BM_20_12
1487#define BM_21_12 0x00000000003ff000
1488#define BM_12_21 BM_21_12
1489#define BM_22_12 0x00000000007ff000
1490#define BM_12_22 BM_22_12
1491#define BM_23_12 0x0000000000fff000
1492#define BM_12_23 BM_23_12
1493#define BM_24_12 0x0000000001fff000
1494#define BM_12_24 BM_24_12
1495#define BM_25_12 0x0000000003fff000
1496#define BM_12_25 BM_25_12
1497#define BM_26_12 0x0000000007fff000
1498#define BM_12_26 BM_26_12
1499#define BM_27_12 0x000000000ffff000
1500#define BM_12_27 BM_27_12
1501#define BM_28_12 0x000000001ffff000
1502#define BM_12_28 BM_28_12
1503#define BM_29_12 0x000000003ffff000
1504#define BM_12_29 BM_29_12
1505#define BM_30_12 0x000000007ffff000
1506#define BM_12_30 BM_30_12
1507#define BM_31_12 0x00000000fffff000
1508#define BM_12_31 BM_31_12
1509#define BM_32_12 0x00000001fffff000
1510#define BM_12_32 BM_32_12
1511#define BM_33_12 0x00000003fffff000
1512#define BM_12_33 BM_33_12
1513#define BM_34_12 0x00000007fffff000
1514#define BM_12_34 BM_34_12
1515#define BM_35_12 0x0000000ffffff000
1516#define BM_12_35 BM_35_12
1517#define BM_36_12 0x0000001ffffff000
1518#define BM_12_36 BM_36_12
1519#define BM_37_12 0x0000003ffffff000
1520#define BM_12_37 BM_37_12
1521#define BM_38_12 0x0000007ffffff000
1522#define BM_12_38 BM_38_12
1523#define BM_39_12 0x000000fffffff000
1524#define BM_12_39 BM_39_12
1525#define BM_40_12 0x000001fffffff000
1526#define BM_12_40 BM_40_12
1527#define BM_41_12 0x000003fffffff000
1528#define BM_12_41 BM_41_12
1529#define BM_42_12 0x000007fffffff000
1530#define BM_12_42 BM_42_12
1531#define BM_43_12 0x00000ffffffff000
1532#define BM_12_43 BM_43_12
1533#define BM_44_12 0x00001ffffffff000
1534#define BM_12_44 BM_44_12
1535#define BM_45_12 0x00003ffffffff000
1536#define BM_12_45 BM_45_12
1537#define BM_46_12 0x00007ffffffff000
1538#define BM_12_46 BM_46_12
1539#define BM_47_12 0x0000fffffffff000
1540#define BM_12_47 BM_47_12
1541#define BM_48_12 0x0001fffffffff000
1542#define BM_12_48 BM_48_12
1543#define BM_49_12 0x0003fffffffff000
1544#define BM_12_49 BM_49_12
1545#define BM_50_12 0x0007fffffffff000
1546#define BM_12_50 BM_50_12
1547#define BM_51_12 0x000ffffffffff000
1548#define BM_12_51 BM_51_12
1549#define BM_52_12 0x001ffffffffff000
1550#define BM_12_52 BM_52_12
1551#define BM_53_12 0x003ffffffffff000
1552#define BM_12_53 BM_53_12
1553#define BM_54_12 0x007ffffffffff000
1554#define BM_12_54 BM_54_12
1555#define BM_55_12 0x00fffffffffff000
1556#define BM_12_55 BM_55_12
1557#define BM_56_12 0x01fffffffffff000
1558#define BM_12_56 BM_56_12
1559#define BM_57_12 0x03fffffffffff000
1560#define BM_12_57 BM_57_12
1561#define BM_58_12 0x07fffffffffff000
1562#define BM_12_58 BM_58_12
1563#define BM_59_12 0x0ffffffffffff000
1564#define BM_12_59 BM_59_12
1565#define BM_60_12 0x1ffffffffffff000
1566#define BM_12_60 BM_60_12
1567#define BM_61_12 0x3ffffffffffff000
1568#define BM_12_61 BM_61_12
1569#define BM_62_12 0x7ffffffffffff000
1570#define BM_12_62 BM_62_12
1571#define BM_63_12 0xfffffffffffff000
1572#define BM_12_63 BM_63_12
1573#define BM_13_13 0x0000000000002000
1574#define BM_14_13 0x0000000000006000
1575#define BM_13_14 BM_14_13
1576#define BM_15_13 0x000000000000e000
1577#define BM_13_15 BM_15_13
1578#define BM_16_13 0x000000000001e000
1579#define BM_13_16 BM_16_13
1580#define BM_17_13 0x000000000003e000
1581#define BM_13_17 BM_17_13
1582#define BM_18_13 0x000000000007e000
1583#define BM_13_18 BM_18_13
1584#define BM_19_13 0x00000000000fe000
1585#define BM_13_19 BM_19_13
1586#define BM_20_13 0x00000000001fe000
1587#define BM_13_20 BM_20_13
1588#define BM_21_13 0x00000000003fe000
1589#define BM_13_21 BM_21_13
1590#define BM_22_13 0x00000000007fe000
1591#define BM_13_22 BM_22_13
1592#define BM_23_13 0x0000000000ffe000
1593#define BM_13_23 BM_23_13
1594#define BM_24_13 0x0000000001ffe000
1595#define BM_13_24 BM_24_13
1596#define BM_25_13 0x0000000003ffe000
1597#define BM_13_25 BM_25_13
1598#define BM_26_13 0x0000000007ffe000
1599#define BM_13_26 BM_26_13
1600#define BM_27_13 0x000000000fffe000
1601#define BM_13_27 BM_27_13
1602#define BM_28_13 0x000000001fffe000
1603#define BM_13_28 BM_28_13
1604#define BM_29_13 0x000000003fffe000
1605#define BM_13_29 BM_29_13
1606#define BM_30_13 0x000000007fffe000
1607#define BM_13_30 BM_30_13
1608#define BM_31_13 0x00000000ffffe000
1609#define BM_13_31 BM_31_13
1610#define BM_32_13 0x00000001ffffe000
1611#define BM_13_32 BM_32_13
1612#define BM_33_13 0x00000003ffffe000
1613#define BM_13_33 BM_33_13
1614#define BM_34_13 0x00000007ffffe000
1615#define BM_13_34 BM_34_13
1616#define BM_35_13 0x0000000fffffe000
1617#define BM_13_35 BM_35_13
1618#define BM_36_13 0x0000001fffffe000
1619#define BM_13_36 BM_36_13
1620#define BM_37_13 0x0000003fffffe000
1621#define BM_13_37 BM_37_13
1622#define BM_38_13 0x0000007fffffe000
1623#define BM_13_38 BM_38_13
1624#define BM_39_13 0x000000ffffffe000
1625#define BM_13_39 BM_39_13
1626#define BM_40_13 0x000001ffffffe000
1627#define BM_13_40 BM_40_13
1628#define BM_41_13 0x000003ffffffe000
1629#define BM_13_41 BM_41_13
1630#define BM_42_13 0x000007ffffffe000
1631#define BM_13_42 BM_42_13
1632#define BM_43_13 0x00000fffffffe000
1633#define BM_13_43 BM_43_13
1634#define BM_44_13 0x00001fffffffe000
1635#define BM_13_44 BM_44_13
1636#define BM_45_13 0x00003fffffffe000
1637#define BM_13_45 BM_45_13
1638#define BM_46_13 0x00007fffffffe000
1639#define BM_13_46 BM_46_13
1640#define BM_47_13 0x0000ffffffffe000
1641#define BM_13_47 BM_47_13
1642#define BM_48_13 0x0001ffffffffe000
1643#define BM_13_48 BM_48_13
1644#define BM_49_13 0x0003ffffffffe000
1645#define BM_13_49 BM_49_13
1646#define BM_50_13 0x0007ffffffffe000
1647#define BM_13_50 BM_50_13
1648#define BM_51_13 0x000fffffffffe000
1649#define BM_13_51 BM_51_13
1650#define BM_52_13 0x001fffffffffe000
1651#define BM_13_52 BM_52_13
1652#define BM_53_13 0x003fffffffffe000
1653#define BM_13_53 BM_53_13
1654#define BM_54_13 0x007fffffffffe000
1655#define BM_13_54 BM_54_13
1656#define BM_55_13 0x00ffffffffffe000
1657#define BM_13_55 BM_55_13
1658#define BM_56_13 0x01ffffffffffe000
1659#define BM_13_56 BM_56_13
1660#define BM_57_13 0x03ffffffffffe000
1661#define BM_13_57 BM_57_13
1662#define BM_58_13 0x07ffffffffffe000
1663#define BM_13_58 BM_58_13
1664#define BM_59_13 0x0fffffffffffe000
1665#define BM_13_59 BM_59_13
1666#define BM_60_13 0x1fffffffffffe000
1667#define BM_13_60 BM_60_13
1668#define BM_61_13 0x3fffffffffffe000
1669#define BM_13_61 BM_61_13
1670#define BM_62_13 0x7fffffffffffe000
1671#define BM_13_62 BM_62_13
1672#define BM_63_13 0xffffffffffffe000
1673#define BM_13_63 BM_63_13
1674#define BM_14_14 0x0000000000004000
1675#define BM_15_14 0x000000000000c000
1676#define BM_14_15 BM_15_14
1677#define BM_16_14 0x000000000001c000
1678#define BM_14_16 BM_16_14
1679#define BM_17_14 0x000000000003c000
1680#define BM_14_17 BM_17_14
1681#define BM_18_14 0x000000000007c000
1682#define BM_14_18 BM_18_14
1683#define BM_19_14 0x00000000000fc000
1684#define BM_14_19 BM_19_14
1685#define BM_20_14 0x00000000001fc000
1686#define BM_14_20 BM_20_14
1687#define BM_21_14 0x00000000003fc000
1688#define BM_14_21 BM_21_14
1689#define BM_22_14 0x00000000007fc000
1690#define BM_14_22 BM_22_14
1691#define BM_23_14 0x0000000000ffc000
1692#define BM_14_23 BM_23_14
1693#define BM_24_14 0x0000000001ffc000
1694#define BM_14_24 BM_24_14
1695#define BM_25_14 0x0000000003ffc000
1696#define BM_14_25 BM_25_14
1697#define BM_26_14 0x0000000007ffc000
1698#define BM_14_26 BM_26_14
1699#define BM_27_14 0x000000000fffc000
1700#define BM_14_27 BM_27_14
1701#define BM_28_14 0x000000001fffc000
1702#define BM_14_28 BM_28_14
1703#define BM_29_14 0x000000003fffc000
1704#define BM_14_29 BM_29_14
1705#define BM_30_14 0x000000007fffc000
1706#define BM_14_30 BM_30_14
1707#define BM_31_14 0x00000000ffffc000
1708#define BM_14_31 BM_31_14
1709#define BM_32_14 0x00000001ffffc000
1710#define BM_14_32 BM_32_14
1711#define BM_33_14 0x00000003ffffc000
1712#define BM_14_33 BM_33_14
1713#define BM_34_14 0x00000007ffffc000
1714#define BM_14_34 BM_34_14
1715#define BM_35_14 0x0000000fffffc000
1716#define BM_14_35 BM_35_14
1717#define BM_36_14 0x0000001fffffc000
1718#define BM_14_36 BM_36_14
1719#define BM_37_14 0x0000003fffffc000
1720#define BM_14_37 BM_37_14
1721#define BM_38_14 0x0000007fffffc000
1722#define BM_14_38 BM_38_14
1723#define BM_39_14 0x000000ffffffc000
1724#define BM_14_39 BM_39_14
1725#define BM_40_14 0x000001ffffffc000
1726#define BM_14_40 BM_40_14
1727#define BM_41_14 0x000003ffffffc000
1728#define BM_14_41 BM_41_14
1729#define BM_42_14 0x000007ffffffc000
1730#define BM_14_42 BM_42_14
1731#define BM_43_14 0x00000fffffffc000
1732#define BM_14_43 BM_43_14
1733#define BM_44_14 0x00001fffffffc000
1734#define BM_14_44 BM_44_14
1735#define BM_45_14 0x00003fffffffc000
1736#define BM_14_45 BM_45_14
1737#define BM_46_14 0x00007fffffffc000
1738#define BM_14_46 BM_46_14
1739#define BM_47_14 0x0000ffffffffc000
1740#define BM_14_47 BM_47_14
1741#define BM_48_14 0x0001ffffffffc000
1742#define BM_14_48 BM_48_14
1743#define BM_49_14 0x0003ffffffffc000
1744#define BM_14_49 BM_49_14
1745#define BM_50_14 0x0007ffffffffc000
1746#define BM_14_50 BM_50_14
1747#define BM_51_14 0x000fffffffffc000
1748#define BM_14_51 BM_51_14
1749#define BM_52_14 0x001fffffffffc000
1750#define BM_14_52 BM_52_14
1751#define BM_53_14 0x003fffffffffc000
1752#define BM_14_53 BM_53_14
1753#define BM_54_14 0x007fffffffffc000
1754#define BM_14_54 BM_54_14
1755#define BM_55_14 0x00ffffffffffc000
1756#define BM_14_55 BM_55_14
1757#define BM_56_14 0x01ffffffffffc000
1758#define BM_14_56 BM_56_14
1759#define BM_57_14 0x03ffffffffffc000
1760#define BM_14_57 BM_57_14
1761#define BM_58_14 0x07ffffffffffc000
1762#define BM_14_58 BM_58_14
1763#define BM_59_14 0x0fffffffffffc000
1764#define BM_14_59 BM_59_14
1765#define BM_60_14 0x1fffffffffffc000
1766#define BM_14_60 BM_60_14
1767#define BM_61_14 0x3fffffffffffc000
1768#define BM_14_61 BM_61_14
1769#define BM_62_14 0x7fffffffffffc000
1770#define BM_14_62 BM_62_14
1771#define BM_63_14 0xffffffffffffc000
1772#define BM_14_63 BM_63_14
1773#define BM_15_15 0x0000000000008000
1774#define BM_16_15 0x0000000000018000
1775#define BM_15_16 BM_16_15
1776#define BM_17_15 0x0000000000038000
1777#define BM_15_17 BM_17_15
1778#define BM_18_15 0x0000000000078000
1779#define BM_15_18 BM_18_15
1780#define BM_19_15 0x00000000000f8000
1781#define BM_15_19 BM_19_15
1782#define BM_20_15 0x00000000001f8000
1783#define BM_15_20 BM_20_15
1784#define BM_21_15 0x00000000003f8000
1785#define BM_15_21 BM_21_15
1786#define BM_22_15 0x00000000007f8000
1787#define BM_15_22 BM_22_15
1788#define BM_23_15 0x0000000000ff8000
1789#define BM_15_23 BM_23_15
1790#define BM_24_15 0x0000000001ff8000
1791#define BM_15_24 BM_24_15
1792#define BM_25_15 0x0000000003ff8000
1793#define BM_15_25 BM_25_15
1794#define BM_26_15 0x0000000007ff8000
1795#define BM_15_26 BM_26_15
1796#define BM_27_15 0x000000000fff8000
1797#define BM_15_27 BM_27_15
1798#define BM_28_15 0x000000001fff8000
1799#define BM_15_28 BM_28_15
1800#define BM_29_15 0x000000003fff8000
1801#define BM_15_29 BM_29_15
1802#define BM_30_15 0x000000007fff8000
1803#define BM_15_30 BM_30_15
1804#define BM_31_15 0x00000000ffff8000
1805#define BM_15_31 BM_31_15
1806#define BM_32_15 0x00000001ffff8000
1807#define BM_15_32 BM_32_15
1808#define BM_33_15 0x00000003ffff8000
1809#define BM_15_33 BM_33_15
1810#define BM_34_15 0x00000007ffff8000
1811#define BM_15_34 BM_34_15
1812#define BM_35_15 0x0000000fffff8000
1813#define BM_15_35 BM_35_15
1814#define BM_36_15 0x0000001fffff8000
1815#define BM_15_36 BM_36_15
1816#define BM_37_15 0x0000003fffff8000
1817#define BM_15_37 BM_37_15
1818#define BM_38_15 0x0000007fffff8000
1819#define BM_15_38 BM_38_15
1820#define BM_39_15 0x000000ffffff8000
1821#define BM_15_39 BM_39_15
1822#define BM_40_15 0x000001ffffff8000
1823#define BM_15_40 BM_40_15
1824#define BM_41_15 0x000003ffffff8000
1825#define BM_15_41 BM_41_15
1826#define BM_42_15 0x000007ffffff8000
1827#define BM_15_42 BM_42_15
1828#define BM_43_15 0x00000fffffff8000
1829#define BM_15_43 BM_43_15
1830#define BM_44_15 0x00001fffffff8000
1831#define BM_15_44 BM_44_15
1832#define BM_45_15 0x00003fffffff8000
1833#define BM_15_45 BM_45_15
1834#define BM_46_15 0x00007fffffff8000
1835#define BM_15_46 BM_46_15
1836#define BM_47_15 0x0000ffffffff8000
1837#define BM_15_47 BM_47_15
1838#define BM_48_15 0x0001ffffffff8000
1839#define BM_15_48 BM_48_15
1840#define BM_49_15 0x0003ffffffff8000
1841#define BM_15_49 BM_49_15
1842#define BM_50_15 0x0007ffffffff8000
1843#define BM_15_50 BM_50_15
1844#define BM_51_15 0x000fffffffff8000
1845#define BM_15_51 BM_51_15
1846#define BM_52_15 0x001fffffffff8000
1847#define BM_15_52 BM_52_15
1848#define BM_53_15 0x003fffffffff8000
1849#define BM_15_53 BM_53_15
1850#define BM_54_15 0x007fffffffff8000
1851#define BM_15_54 BM_54_15
1852#define BM_55_15 0x00ffffffffff8000
1853#define BM_15_55 BM_55_15
1854#define BM_56_15 0x01ffffffffff8000
1855#define BM_15_56 BM_56_15
1856#define BM_57_15 0x03ffffffffff8000
1857#define BM_15_57 BM_57_15
1858#define BM_58_15 0x07ffffffffff8000
1859#define BM_15_58 BM_58_15
1860#define BM_59_15 0x0fffffffffff8000
1861#define BM_15_59 BM_59_15
1862#define BM_60_15 0x1fffffffffff8000
1863#define BM_15_60 BM_60_15
1864#define BM_61_15 0x3fffffffffff8000
1865#define BM_15_61 BM_61_15
1866#define BM_62_15 0x7fffffffffff8000
1867#define BM_15_62 BM_62_15
1868#define BM_63_15 0xffffffffffff8000
1869#define BM_15_63 BM_63_15
1870#define BM_16_16 0x0000000000010000
1871#define BM_17_16 0x0000000000030000
1872#define BM_16_17 BM_17_16
1873#define BM_18_16 0x0000000000070000
1874#define BM_16_18 BM_18_16
1875#define BM_19_16 0x00000000000f0000
1876#define BM_16_19 BM_19_16
1877#define BM_20_16 0x00000000001f0000
1878#define BM_16_20 BM_20_16
1879#define BM_21_16 0x00000000003f0000
1880#define BM_16_21 BM_21_16
1881#define BM_22_16 0x00000000007f0000
1882#define BM_16_22 BM_22_16
1883#define BM_23_16 0x0000000000ff0000
1884#define BM_16_23 BM_23_16
1885#define BM_24_16 0x0000000001ff0000
1886#define BM_16_24 BM_24_16
1887#define BM_25_16 0x0000000003ff0000
1888#define BM_16_25 BM_25_16
1889#define BM_26_16 0x0000000007ff0000
1890#define BM_16_26 BM_26_16
1891#define BM_27_16 0x000000000fff0000
1892#define BM_16_27 BM_27_16
1893#define BM_28_16 0x000000001fff0000
1894#define BM_16_28 BM_28_16
1895#define BM_29_16 0x000000003fff0000
1896#define BM_16_29 BM_29_16
1897#define BM_30_16 0x000000007fff0000
1898#define BM_16_30 BM_30_16
1899#define BM_31_16 0x00000000ffff0000
1900#define BM_16_31 BM_31_16
1901#define BM_32_16 0x00000001ffff0000
1902#define BM_16_32 BM_32_16
1903#define BM_33_16 0x00000003ffff0000
1904#define BM_16_33 BM_33_16
1905#define BM_34_16 0x00000007ffff0000
1906#define BM_16_34 BM_34_16
1907#define BM_35_16 0x0000000fffff0000
1908#define BM_16_35 BM_35_16
1909#define BM_36_16 0x0000001fffff0000
1910#define BM_16_36 BM_36_16
1911#define BM_37_16 0x0000003fffff0000
1912#define BM_16_37 BM_37_16
1913#define BM_38_16 0x0000007fffff0000
1914#define BM_16_38 BM_38_16
1915#define BM_39_16 0x000000ffffff0000
1916#define BM_16_39 BM_39_16
1917#define BM_40_16 0x000001ffffff0000
1918#define BM_16_40 BM_40_16
1919#define BM_41_16 0x000003ffffff0000
1920#define BM_16_41 BM_41_16
1921#define BM_42_16 0x000007ffffff0000
1922#define BM_16_42 BM_42_16
1923#define BM_43_16 0x00000fffffff0000
1924#define BM_16_43 BM_43_16
1925#define BM_44_16 0x00001fffffff0000
1926#define BM_16_44 BM_44_16
1927#define BM_45_16 0x00003fffffff0000
1928#define BM_16_45 BM_45_16
1929#define BM_46_16 0x00007fffffff0000
1930#define BM_16_46 BM_46_16
1931#define BM_47_16 0x0000ffffffff0000
1932#define BM_16_47 BM_47_16
1933#define BM_48_16 0x0001ffffffff0000
1934#define BM_16_48 BM_48_16
1935#define BM_49_16 0x0003ffffffff0000
1936#define BM_16_49 BM_49_16
1937#define BM_50_16 0x0007ffffffff0000
1938#define BM_16_50 BM_50_16
1939#define BM_51_16 0x000fffffffff0000
1940#define BM_16_51 BM_51_16
1941#define BM_52_16 0x001fffffffff0000
1942#define BM_16_52 BM_52_16
1943#define BM_53_16 0x003fffffffff0000
1944#define BM_16_53 BM_53_16
1945#define BM_54_16 0x007fffffffff0000
1946#define BM_16_54 BM_54_16
1947#define BM_55_16 0x00ffffffffff0000
1948#define BM_16_55 BM_55_16
1949#define BM_56_16 0x01ffffffffff0000
1950#define BM_16_56 BM_56_16
1951#define BM_57_16 0x03ffffffffff0000
1952#define BM_16_57 BM_57_16
1953#define BM_58_16 0x07ffffffffff0000
1954#define BM_16_58 BM_58_16
1955#define BM_59_16 0x0fffffffffff0000
1956#define BM_16_59 BM_59_16
1957#define BM_60_16 0x1fffffffffff0000
1958#define BM_16_60 BM_60_16
1959#define BM_61_16 0x3fffffffffff0000
1960#define BM_16_61 BM_61_16
1961#define BM_62_16 0x7fffffffffff0000
1962#define BM_16_62 BM_62_16
1963#define BM_63_16 0xffffffffffff0000
1964#define BM_16_63 BM_63_16
1965#define BM_17_17 0x0000000000020000
1966#define BM_18_17 0x0000000000060000
1967#define BM_17_18 BM_18_17
1968#define BM_19_17 0x00000000000e0000
1969#define BM_17_19 BM_19_17
1970#define BM_20_17 0x00000000001e0000
1971#define BM_17_20 BM_20_17
1972#define BM_21_17 0x00000000003e0000
1973#define BM_17_21 BM_21_17
1974#define BM_22_17 0x00000000007e0000
1975#define BM_17_22 BM_22_17
1976#define BM_23_17 0x0000000000fe0000
1977#define BM_17_23 BM_23_17
1978#define BM_24_17 0x0000000001fe0000
1979#define BM_17_24 BM_24_17
1980#define BM_25_17 0x0000000003fe0000
1981#define BM_17_25 BM_25_17
1982#define BM_26_17 0x0000000007fe0000
1983#define BM_17_26 BM_26_17
1984#define BM_27_17 0x000000000ffe0000
1985#define BM_17_27 BM_27_17
1986#define BM_28_17 0x000000001ffe0000
1987#define BM_17_28 BM_28_17
1988#define BM_29_17 0x000000003ffe0000
1989#define BM_17_29 BM_29_17
1990#define BM_30_17 0x000000007ffe0000
1991#define BM_17_30 BM_30_17
1992#define BM_31_17 0x00000000fffe0000
1993#define BM_17_31 BM_31_17
1994#define BM_32_17 0x00000001fffe0000
1995#define BM_17_32 BM_32_17
1996#define BM_33_17 0x00000003fffe0000
1997#define BM_17_33 BM_33_17
1998#define BM_34_17 0x00000007fffe0000
1999#define BM_17_34 BM_34_17
2000#define BM_35_17 0x0000000ffffe0000
2001#define BM_17_35 BM_35_17
2002#define BM_36_17 0x0000001ffffe0000
2003#define BM_17_36 BM_36_17
2004#define BM_37_17 0x0000003ffffe0000
2005#define BM_17_37 BM_37_17
2006#define BM_38_17 0x0000007ffffe0000
2007#define BM_17_38 BM_38_17
2008#define BM_39_17 0x000000fffffe0000
2009#define BM_17_39 BM_39_17
2010#define BM_40_17 0x000001fffffe0000
2011#define BM_17_40 BM_40_17
2012#define BM_41_17 0x000003fffffe0000
2013#define BM_17_41 BM_41_17
2014#define BM_42_17 0x000007fffffe0000
2015#define BM_17_42 BM_42_17
2016#define BM_43_17 0x00000ffffffe0000
2017#define BM_17_43 BM_43_17
2018#define BM_44_17 0x00001ffffffe0000
2019#define BM_17_44 BM_44_17
2020#define BM_45_17 0x00003ffffffe0000
2021#define BM_17_45 BM_45_17
2022#define BM_46_17 0x00007ffffffe0000
2023#define BM_17_46 BM_46_17
2024#define BM_47_17 0x0000fffffffe0000
2025#define BM_17_47 BM_47_17
2026#define BM_48_17 0x0001fffffffe0000
2027#define BM_17_48 BM_48_17
2028#define BM_49_17 0x0003fffffffe0000
2029#define BM_17_49 BM_49_17
2030#define BM_50_17 0x0007fffffffe0000
2031#define BM_17_50 BM_50_17
2032#define BM_51_17 0x000ffffffffe0000
2033#define BM_17_51 BM_51_17
2034#define BM_52_17 0x001ffffffffe0000
2035#define BM_17_52 BM_52_17
2036#define BM_53_17 0x003ffffffffe0000
2037#define BM_17_53 BM_53_17
2038#define BM_54_17 0x007ffffffffe0000
2039#define BM_17_54 BM_54_17
2040#define BM_55_17 0x00fffffffffe0000
2041#define BM_17_55 BM_55_17
2042#define BM_56_17 0x01fffffffffe0000
2043#define BM_17_56 BM_56_17
2044#define BM_57_17 0x03fffffffffe0000
2045#define BM_17_57 BM_57_17
2046#define BM_58_17 0x07fffffffffe0000
2047#define BM_17_58 BM_58_17
2048#define BM_59_17 0x0ffffffffffe0000
2049#define BM_17_59 BM_59_17
2050#define BM_60_17 0x1ffffffffffe0000
2051#define BM_17_60 BM_60_17
2052#define BM_61_17 0x3ffffffffffe0000
2053#define BM_17_61 BM_61_17
2054#define BM_62_17 0x7ffffffffffe0000
2055#define BM_17_62 BM_62_17
2056#define BM_63_17 0xfffffffffffe0000
2057#define BM_17_63 BM_63_17
2058#define BM_18_18 0x0000000000040000
2059#define BM_19_18 0x00000000000c0000
2060#define BM_18_19 BM_19_18
2061#define BM_20_18 0x00000000001c0000
2062#define BM_18_20 BM_20_18
2063#define BM_21_18 0x00000000003c0000
2064#define BM_18_21 BM_21_18
2065#define BM_22_18 0x00000000007c0000
2066#define BM_18_22 BM_22_18
2067#define BM_23_18 0x0000000000fc0000
2068#define BM_18_23 BM_23_18
2069#define BM_24_18 0x0000000001fc0000
2070#define BM_18_24 BM_24_18
2071#define BM_25_18 0x0000000003fc0000
2072#define BM_18_25 BM_25_18
2073#define BM_26_18 0x0000000007fc0000
2074#define BM_18_26 BM_26_18
2075#define BM_27_18 0x000000000ffc0000
2076#define BM_18_27 BM_27_18
2077#define BM_28_18 0x000000001ffc0000
2078#define BM_18_28 BM_28_18
2079#define BM_29_18 0x000000003ffc0000
2080#define BM_18_29 BM_29_18
2081#define BM_30_18 0x000000007ffc0000
2082#define BM_18_30 BM_30_18
2083#define BM_31_18 0x00000000fffc0000
2084#define BM_18_31 BM_31_18
2085#define BM_32_18 0x00000001fffc0000
2086#define BM_18_32 BM_32_18
2087#define BM_33_18 0x00000003fffc0000
2088#define BM_18_33 BM_33_18
2089#define BM_34_18 0x00000007fffc0000
2090#define BM_18_34 BM_34_18
2091#define BM_35_18 0x0000000ffffc0000
2092#define BM_18_35 BM_35_18
2093#define BM_36_18 0x0000001ffffc0000
2094#define BM_18_36 BM_36_18
2095#define BM_37_18 0x0000003ffffc0000
2096#define BM_18_37 BM_37_18
2097#define BM_38_18 0x0000007ffffc0000
2098#define BM_18_38 BM_38_18
2099#define BM_39_18 0x000000fffffc0000
2100#define BM_18_39 BM_39_18
2101#define BM_40_18 0x000001fffffc0000
2102#define BM_18_40 BM_40_18
2103#define BM_41_18 0x000003fffffc0000
2104#define BM_18_41 BM_41_18
2105#define BM_42_18 0x000007fffffc0000
2106#define BM_18_42 BM_42_18
2107#define BM_43_18 0x00000ffffffc0000
2108#define BM_18_43 BM_43_18
2109#define BM_44_18 0x00001ffffffc0000
2110#define BM_18_44 BM_44_18
2111#define BM_45_18 0x00003ffffffc0000
2112#define BM_18_45 BM_45_18
2113#define BM_46_18 0x00007ffffffc0000
2114#define BM_18_46 BM_46_18
2115#define BM_47_18 0x0000fffffffc0000
2116#define BM_18_47 BM_47_18
2117#define BM_48_18 0x0001fffffffc0000
2118#define BM_18_48 BM_48_18
2119#define BM_49_18 0x0003fffffffc0000
2120#define BM_18_49 BM_49_18
2121#define BM_50_18 0x0007fffffffc0000
2122#define BM_18_50 BM_50_18
2123#define BM_51_18 0x000ffffffffc0000
2124#define BM_18_51 BM_51_18
2125#define BM_52_18 0x001ffffffffc0000
2126#define BM_18_52 BM_52_18
2127#define BM_53_18 0x003ffffffffc0000
2128#define BM_18_53 BM_53_18
2129#define BM_54_18 0x007ffffffffc0000
2130#define BM_18_54 BM_54_18
2131#define BM_55_18 0x00fffffffffc0000
2132#define BM_18_55 BM_55_18
2133#define BM_56_18 0x01fffffffffc0000
2134#define BM_18_56 BM_56_18
2135#define BM_57_18 0x03fffffffffc0000
2136#define BM_18_57 BM_57_18
2137#define BM_58_18 0x07fffffffffc0000
2138#define BM_18_58 BM_58_18
2139#define BM_59_18 0x0ffffffffffc0000
2140#define BM_18_59 BM_59_18
2141#define BM_60_18 0x1ffffffffffc0000
2142#define BM_18_60 BM_60_18
2143#define BM_61_18 0x3ffffffffffc0000
2144#define BM_18_61 BM_61_18
2145#define BM_62_18 0x7ffffffffffc0000
2146#define BM_18_62 BM_62_18
2147#define BM_63_18 0xfffffffffffc0000
2148#define BM_18_63 BM_63_18
2149#define BM_19_19 0x0000000000080000
2150#define BM_20_19 0x0000000000180000
2151#define BM_19_20 BM_20_19
2152#define BM_21_19 0x0000000000380000
2153#define BM_19_21 BM_21_19
2154#define BM_22_19 0x0000000000780000
2155#define BM_19_22 BM_22_19
2156#define BM_23_19 0x0000000000f80000
2157#define BM_19_23 BM_23_19
2158#define BM_24_19 0x0000000001f80000
2159#define BM_19_24 BM_24_19
2160#define BM_25_19 0x0000000003f80000
2161#define BM_19_25 BM_25_19
2162#define BM_26_19 0x0000000007f80000
2163#define BM_19_26 BM_26_19
2164#define BM_27_19 0x000000000ff80000
2165#define BM_19_27 BM_27_19
2166#define BM_28_19 0x000000001ff80000
2167#define BM_19_28 BM_28_19
2168#define BM_29_19 0x000000003ff80000
2169#define BM_19_29 BM_29_19
2170#define BM_30_19 0x000000007ff80000
2171#define BM_19_30 BM_30_19
2172#define BM_31_19 0x00000000fff80000
2173#define BM_19_31 BM_31_19
2174#define BM_32_19 0x00000001fff80000
2175#define BM_19_32 BM_32_19
2176#define BM_33_19 0x00000003fff80000
2177#define BM_19_33 BM_33_19
2178#define BM_34_19 0x00000007fff80000
2179#define BM_19_34 BM_34_19
2180#define BM_35_19 0x0000000ffff80000
2181#define BM_19_35 BM_35_19
2182#define BM_36_19 0x0000001ffff80000
2183#define BM_19_36 BM_36_19
2184#define BM_37_19 0x0000003ffff80000
2185#define BM_19_37 BM_37_19
2186#define BM_38_19 0x0000007ffff80000
2187#define BM_19_38 BM_38_19
2188#define BM_39_19 0x000000fffff80000
2189#define BM_19_39 BM_39_19
2190#define BM_40_19 0x000001fffff80000
2191#define BM_19_40 BM_40_19
2192#define BM_41_19 0x000003fffff80000
2193#define BM_19_41 BM_41_19
2194#define BM_42_19 0x000007fffff80000
2195#define BM_19_42 BM_42_19
2196#define BM_43_19 0x00000ffffff80000
2197#define BM_19_43 BM_43_19
2198#define BM_44_19 0x00001ffffff80000
2199#define BM_19_44 BM_44_19
2200#define BM_45_19 0x00003ffffff80000
2201#define BM_19_45 BM_45_19
2202#define BM_46_19 0x00007ffffff80000
2203#define BM_19_46 BM_46_19
2204#define BM_47_19 0x0000fffffff80000
2205#define BM_19_47 BM_47_19
2206#define BM_48_19 0x0001fffffff80000
2207#define BM_19_48 BM_48_19
2208#define BM_49_19 0x0003fffffff80000
2209#define BM_19_49 BM_49_19
2210#define BM_50_19 0x0007fffffff80000
2211#define BM_19_50 BM_50_19
2212#define BM_51_19 0x000ffffffff80000
2213#define BM_19_51 BM_51_19
2214#define BM_52_19 0x001ffffffff80000
2215#define BM_19_52 BM_52_19
2216#define BM_53_19 0x003ffffffff80000
2217#define BM_19_53 BM_53_19
2218#define BM_54_19 0x007ffffffff80000
2219#define BM_19_54 BM_54_19
2220#define BM_55_19 0x00fffffffff80000
2221#define BM_19_55 BM_55_19
2222#define BM_56_19 0x01fffffffff80000
2223#define BM_19_56 BM_56_19
2224#define BM_57_19 0x03fffffffff80000
2225#define BM_19_57 BM_57_19
2226#define BM_58_19 0x07fffffffff80000
2227#define BM_19_58 BM_58_19
2228#define BM_59_19 0x0ffffffffff80000
2229#define BM_19_59 BM_59_19
2230#define BM_60_19 0x1ffffffffff80000
2231#define BM_19_60 BM_60_19
2232#define BM_61_19 0x3ffffffffff80000
2233#define BM_19_61 BM_61_19
2234#define BM_62_19 0x7ffffffffff80000
2235#define BM_19_62 BM_62_19
2236#define BM_63_19 0xfffffffffff80000
2237#define BM_19_63 BM_63_19
2238#define BM_20_20 0x0000000000100000
2239#define BM_21_20 0x0000000000300000
2240#define BM_20_21 BM_21_20
2241#define BM_22_20 0x0000000000700000
2242#define BM_20_22 BM_22_20
2243#define BM_23_20 0x0000000000f00000
2244#define BM_20_23 BM_23_20
2245#define BM_24_20 0x0000000001f00000
2246#define BM_20_24 BM_24_20
2247#define BM_25_20 0x0000000003f00000
2248#define BM_20_25 BM_25_20
2249#define BM_26_20 0x0000000007f00000
2250#define BM_20_26 BM_26_20
2251#define BM_27_20 0x000000000ff00000
2252#define BM_20_27 BM_27_20
2253#define BM_28_20 0x000000001ff00000
2254#define BM_20_28 BM_28_20
2255#define BM_29_20 0x000000003ff00000
2256#define BM_20_29 BM_29_20
2257#define BM_30_20 0x000000007ff00000
2258#define BM_20_30 BM_30_20
2259#define BM_31_20 0x00000000fff00000
2260#define BM_20_31 BM_31_20
2261#define BM_32_20 0x00000001fff00000
2262#define BM_20_32 BM_32_20
2263#define BM_33_20 0x00000003fff00000
2264#define BM_20_33 BM_33_20
2265#define BM_34_20 0x00000007fff00000
2266#define BM_20_34 BM_34_20
2267#define BM_35_20 0x0000000ffff00000
2268#define BM_20_35 BM_35_20
2269#define BM_36_20 0x0000001ffff00000
2270#define BM_20_36 BM_36_20
2271#define BM_37_20 0x0000003ffff00000
2272#define BM_20_37 BM_37_20
2273#define BM_38_20 0x0000007ffff00000
2274#define BM_20_38 BM_38_20
2275#define BM_39_20 0x000000fffff00000
2276#define BM_20_39 BM_39_20
2277#define BM_40_20 0x000001fffff00000
2278#define BM_20_40 BM_40_20
2279#define BM_41_20 0x000003fffff00000
2280#define BM_20_41 BM_41_20
2281#define BM_42_20 0x000007fffff00000
2282#define BM_20_42 BM_42_20
2283#define BM_43_20 0x00000ffffff00000
2284#define BM_20_43 BM_43_20
2285#define BM_44_20 0x00001ffffff00000
2286#define BM_20_44 BM_44_20
2287#define BM_45_20 0x00003ffffff00000
2288#define BM_20_45 BM_45_20
2289#define BM_46_20 0x00007ffffff00000
2290#define BM_20_46 BM_46_20
2291#define BM_47_20 0x0000fffffff00000
2292#define BM_20_47 BM_47_20
2293#define BM_48_20 0x0001fffffff00000
2294#define BM_20_48 BM_48_20
2295#define BM_49_20 0x0003fffffff00000
2296#define BM_20_49 BM_49_20
2297#define BM_50_20 0x0007fffffff00000
2298#define BM_20_50 BM_50_20
2299#define BM_51_20 0x000ffffffff00000
2300#define BM_20_51 BM_51_20
2301#define BM_52_20 0x001ffffffff00000
2302#define BM_20_52 BM_52_20
2303#define BM_53_20 0x003ffffffff00000
2304#define BM_20_53 BM_53_20
2305#define BM_54_20 0x007ffffffff00000
2306#define BM_20_54 BM_54_20
2307#define BM_55_20 0x00fffffffff00000
2308#define BM_20_55 BM_55_20
2309#define BM_56_20 0x01fffffffff00000
2310#define BM_20_56 BM_56_20
2311#define BM_57_20 0x03fffffffff00000
2312#define BM_20_57 BM_57_20
2313#define BM_58_20 0x07fffffffff00000
2314#define BM_20_58 BM_58_20
2315#define BM_59_20 0x0ffffffffff00000
2316#define BM_20_59 BM_59_20
2317#define BM_60_20 0x1ffffffffff00000
2318#define BM_20_60 BM_60_20
2319#define BM_61_20 0x3ffffffffff00000
2320#define BM_20_61 BM_61_20
2321#define BM_62_20 0x7ffffffffff00000
2322#define BM_20_62 BM_62_20
2323#define BM_63_20 0xfffffffffff00000
2324#define BM_20_63 BM_63_20
2325#define BM_21_21 0x0000000000200000
2326#define BM_22_21 0x0000000000600000
2327#define BM_21_22 BM_22_21
2328#define BM_23_21 0x0000000000e00000
2329#define BM_21_23 BM_23_21
2330#define BM_24_21 0x0000000001e00000
2331#define BM_21_24 BM_24_21
2332#define BM_25_21 0x0000000003e00000
2333#define BM_21_25 BM_25_21
2334#define BM_26_21 0x0000000007e00000
2335#define BM_21_26 BM_26_21
2336#define BM_27_21 0x000000000fe00000
2337#define BM_21_27 BM_27_21
2338#define BM_28_21 0x000000001fe00000
2339#define BM_21_28 BM_28_21
2340#define BM_29_21 0x000000003fe00000
2341#define BM_21_29 BM_29_21
2342#define BM_30_21 0x000000007fe00000
2343#define BM_21_30 BM_30_21
2344#define BM_31_21 0x00000000ffe00000
2345#define BM_21_31 BM_31_21
2346#define BM_32_21 0x00000001ffe00000
2347#define BM_21_32 BM_32_21
2348#define BM_33_21 0x00000003ffe00000
2349#define BM_21_33 BM_33_21
2350#define BM_34_21 0x00000007ffe00000
2351#define BM_21_34 BM_34_21
2352#define BM_35_21 0x0000000fffe00000
2353#define BM_21_35 BM_35_21
2354#define BM_36_21 0x0000001fffe00000
2355#define BM_21_36 BM_36_21
2356#define BM_37_21 0x0000003fffe00000
2357#define BM_21_37 BM_37_21
2358#define BM_38_21 0x0000007fffe00000
2359#define BM_21_38 BM_38_21
2360#define BM_39_21 0x000000ffffe00000
2361#define BM_21_39 BM_39_21
2362#define BM_40_21 0x000001ffffe00000
2363#define BM_21_40 BM_40_21
2364#define BM_41_21 0x000003ffffe00000
2365#define BM_21_41 BM_41_21
2366#define BM_42_21 0x000007ffffe00000
2367#define BM_21_42 BM_42_21
2368#define BM_43_21 0x00000fffffe00000
2369#define BM_21_43 BM_43_21
2370#define BM_44_21 0x00001fffffe00000
2371#define BM_21_44 BM_44_21
2372#define BM_45_21 0x00003fffffe00000
2373#define BM_21_45 BM_45_21
2374#define BM_46_21 0x00007fffffe00000
2375#define BM_21_46 BM_46_21
2376#define BM_47_21 0x0000ffffffe00000
2377#define BM_21_47 BM_47_21
2378#define BM_48_21 0x0001ffffffe00000
2379#define BM_21_48 BM_48_21
2380#define BM_49_21 0x0003ffffffe00000
2381#define BM_21_49 BM_49_21
2382#define BM_50_21 0x0007ffffffe00000
2383#define BM_21_50 BM_50_21
2384#define BM_51_21 0x000fffffffe00000
2385#define BM_21_51 BM_51_21
2386#define BM_52_21 0x001fffffffe00000
2387#define BM_21_52 BM_52_21
2388#define BM_53_21 0x003fffffffe00000
2389#define BM_21_53 BM_53_21
2390#define BM_54_21 0x007fffffffe00000
2391#define BM_21_54 BM_54_21
2392#define BM_55_21 0x00ffffffffe00000
2393#define BM_21_55 BM_55_21
2394#define BM_56_21 0x01ffffffffe00000
2395#define BM_21_56 BM_56_21
2396#define BM_57_21 0x03ffffffffe00000
2397#define BM_21_57 BM_57_21
2398#define BM_58_21 0x07ffffffffe00000
2399#define BM_21_58 BM_58_21
2400#define BM_59_21 0x0fffffffffe00000
2401#define BM_21_59 BM_59_21
2402#define BM_60_21 0x1fffffffffe00000
2403#define BM_21_60 BM_60_21
2404#define BM_61_21 0x3fffffffffe00000
2405#define BM_21_61 BM_61_21
2406#define BM_62_21 0x7fffffffffe00000
2407#define BM_21_62 BM_62_21
2408#define BM_63_21 0xffffffffffe00000
2409#define BM_21_63 BM_63_21
2410#define BM_22_22 0x0000000000400000
2411#define BM_23_22 0x0000000000c00000
2412#define BM_22_23 BM_23_22
2413#define BM_24_22 0x0000000001c00000
2414#define BM_22_24 BM_24_22
2415#define BM_25_22 0x0000000003c00000
2416#define BM_22_25 BM_25_22
2417#define BM_26_22 0x0000000007c00000
2418#define BM_22_26 BM_26_22
2419#define BM_27_22 0x000000000fc00000
2420#define BM_22_27 BM_27_22
2421#define BM_28_22 0x000000001fc00000
2422#define BM_22_28 BM_28_22
2423#define BM_29_22 0x000000003fc00000
2424#define BM_22_29 BM_29_22
2425#define BM_30_22 0x000000007fc00000
2426#define BM_22_30 BM_30_22
2427#define BM_31_22 0x00000000ffc00000
2428#define BM_22_31 BM_31_22
2429#define BM_32_22 0x00000001ffc00000
2430#define BM_22_32 BM_32_22
2431#define BM_33_22 0x00000003ffc00000
2432#define BM_22_33 BM_33_22
2433#define BM_34_22 0x00000007ffc00000
2434#define BM_22_34 BM_34_22
2435#define BM_35_22 0x0000000fffc00000
2436#define BM_22_35 BM_35_22
2437#define BM_36_22 0x0000001fffc00000
2438#define BM_22_36 BM_36_22
2439#define BM_37_22 0x0000003fffc00000
2440#define BM_22_37 BM_37_22
2441#define BM_38_22 0x0000007fffc00000
2442#define BM_22_38 BM_38_22
2443#define BM_39_22 0x000000ffffc00000
2444#define BM_22_39 BM_39_22
2445#define BM_40_22 0x000001ffffc00000
2446#define BM_22_40 BM_40_22
2447#define BM_41_22 0x000003ffffc00000
2448#define BM_22_41 BM_41_22
2449#define BM_42_22 0x000007ffffc00000
2450#define BM_22_42 BM_42_22
2451#define BM_43_22 0x00000fffffc00000
2452#define BM_22_43 BM_43_22
2453#define BM_44_22 0x00001fffffc00000
2454#define BM_22_44 BM_44_22
2455#define BM_45_22 0x00003fffffc00000
2456#define BM_22_45 BM_45_22
2457#define BM_46_22 0x00007fffffc00000
2458#define BM_22_46 BM_46_22
2459#define BM_47_22 0x0000ffffffc00000
2460#define BM_22_47 BM_47_22
2461#define BM_48_22 0x0001ffffffc00000
2462#define BM_22_48 BM_48_22
2463#define BM_49_22 0x0003ffffffc00000
2464#define BM_22_49 BM_49_22
2465#define BM_50_22 0x0007ffffffc00000
2466#define BM_22_50 BM_50_22
2467#define BM_51_22 0x000fffffffc00000
2468#define BM_22_51 BM_51_22
2469#define BM_52_22 0x001fffffffc00000
2470#define BM_22_52 BM_52_22
2471#define BM_53_22 0x003fffffffc00000
2472#define BM_22_53 BM_53_22
2473#define BM_54_22 0x007fffffffc00000
2474#define BM_22_54 BM_54_22
2475#define BM_55_22 0x00ffffffffc00000
2476#define BM_22_55 BM_55_22
2477#define BM_56_22 0x01ffffffffc00000
2478#define BM_22_56 BM_56_22
2479#define BM_57_22 0x03ffffffffc00000
2480#define BM_22_57 BM_57_22
2481#define BM_58_22 0x07ffffffffc00000
2482#define BM_22_58 BM_58_22
2483#define BM_59_22 0x0fffffffffc00000
2484#define BM_22_59 BM_59_22
2485#define BM_60_22 0x1fffffffffc00000
2486#define BM_22_60 BM_60_22
2487#define BM_61_22 0x3fffffffffc00000
2488#define BM_22_61 BM_61_22
2489#define BM_62_22 0x7fffffffffc00000
2490#define BM_22_62 BM_62_22
2491#define BM_63_22 0xffffffffffc00000
2492#define BM_22_63 BM_63_22
2493#define BM_23_23 0x0000000000800000
2494#define BM_24_23 0x0000000001800000
2495#define BM_23_24 BM_24_23
2496#define BM_25_23 0x0000000003800000
2497#define BM_23_25 BM_25_23
2498#define BM_26_23 0x0000000007800000
2499#define BM_23_26 BM_26_23
2500#define BM_27_23 0x000000000f800000
2501#define BM_23_27 BM_27_23
2502#define BM_28_23 0x000000001f800000
2503#define BM_23_28 BM_28_23
2504#define BM_29_23 0x000000003f800000
2505#define BM_23_29 BM_29_23
2506#define BM_30_23 0x000000007f800000
2507#define BM_23_30 BM_30_23
2508#define BM_31_23 0x00000000ff800000
2509#define BM_23_31 BM_31_23
2510#define BM_32_23 0x00000001ff800000
2511#define BM_23_32 BM_32_23
2512#define BM_33_23 0x00000003ff800000
2513#define BM_23_33 BM_33_23
2514#define BM_34_23 0x00000007ff800000
2515#define BM_23_34 BM_34_23
2516#define BM_35_23 0x0000000fff800000
2517#define BM_23_35 BM_35_23
2518#define BM_36_23 0x0000001fff800000
2519#define BM_23_36 BM_36_23
2520#define BM_37_23 0x0000003fff800000
2521#define BM_23_37 BM_37_23
2522#define BM_38_23 0x0000007fff800000
2523#define BM_23_38 BM_38_23
2524#define BM_39_23 0x000000ffff800000
2525#define BM_23_39 BM_39_23
2526#define BM_40_23 0x000001ffff800000
2527#define BM_23_40 BM_40_23
2528#define BM_41_23 0x000003ffff800000
2529#define BM_23_41 BM_41_23
2530#define BM_42_23 0x000007ffff800000
2531#define BM_23_42 BM_42_23
2532#define BM_43_23 0x00000fffff800000
2533#define BM_23_43 BM_43_23
2534#define BM_44_23 0x00001fffff800000
2535#define BM_23_44 BM_44_23
2536#define BM_45_23 0x00003fffff800000
2537#define BM_23_45 BM_45_23
2538#define BM_46_23 0x00007fffff800000
2539#define BM_23_46 BM_46_23
2540#define BM_47_23 0x0000ffffff800000
2541#define BM_23_47 BM_47_23
2542#define BM_48_23 0x0001ffffff800000
2543#define BM_23_48 BM_48_23
2544#define BM_49_23 0x0003ffffff800000
2545#define BM_23_49 BM_49_23
2546#define BM_50_23 0x0007ffffff800000
2547#define BM_23_50 BM_50_23
2548#define BM_51_23 0x000fffffff800000
2549#define BM_23_51 BM_51_23
2550#define BM_52_23 0x001fffffff800000
2551#define BM_23_52 BM_52_23
2552#define BM_53_23 0x003fffffff800000
2553#define BM_23_53 BM_53_23
2554#define BM_54_23 0x007fffffff800000
2555#define BM_23_54 BM_54_23
2556#define BM_55_23 0x00ffffffff800000
2557#define BM_23_55 BM_55_23
2558#define BM_56_23 0x01ffffffff800000
2559#define BM_23_56 BM_56_23
2560#define BM_57_23 0x03ffffffff800000
2561#define BM_23_57 BM_57_23
2562#define BM_58_23 0x07ffffffff800000
2563#define BM_23_58 BM_58_23
2564#define BM_59_23 0x0fffffffff800000
2565#define BM_23_59 BM_59_23
2566#define BM_60_23 0x1fffffffff800000
2567#define BM_23_60 BM_60_23
2568#define BM_61_23 0x3fffffffff800000
2569#define BM_23_61 BM_61_23
2570#define BM_62_23 0x7fffffffff800000
2571#define BM_23_62 BM_62_23
2572#define BM_63_23 0xffffffffff800000
2573#define BM_23_63 BM_63_23
2574#define BM_24_24 0x0000000001000000
2575#define BM_25_24 0x0000000003000000
2576#define BM_24_25 BM_25_24
2577#define BM_26_24 0x0000000007000000
2578#define BM_24_26 BM_26_24
2579#define BM_27_24 0x000000000f000000
2580#define BM_24_27 BM_27_24
2581#define BM_28_24 0x000000001f000000
2582#define BM_24_28 BM_28_24
2583#define BM_29_24 0x000000003f000000
2584#define BM_24_29 BM_29_24
2585#define BM_30_24 0x000000007f000000
2586#define BM_24_30 BM_30_24
2587#define BM_31_24 0x00000000ff000000
2588#define BM_24_31 BM_31_24
2589#define BM_32_24 0x00000001ff000000
2590#define BM_24_32 BM_32_24
2591#define BM_33_24 0x00000003ff000000
2592#define BM_24_33 BM_33_24
2593#define BM_34_24 0x00000007ff000000
2594#define BM_24_34 BM_34_24
2595#define BM_35_24 0x0000000fff000000
2596#define BM_24_35 BM_35_24
2597#define BM_36_24 0x0000001fff000000
2598#define BM_24_36 BM_36_24
2599#define BM_37_24 0x0000003fff000000
2600#define BM_24_37 BM_37_24
2601#define BM_38_24 0x0000007fff000000
2602#define BM_24_38 BM_38_24
2603#define BM_39_24 0x000000ffff000000
2604#define BM_24_39 BM_39_24
2605#define BM_40_24 0x000001ffff000000
2606#define BM_24_40 BM_40_24
2607#define BM_41_24 0x000003ffff000000
2608#define BM_24_41 BM_41_24
2609#define BM_42_24 0x000007ffff000000
2610#define BM_24_42 BM_42_24
2611#define BM_43_24 0x00000fffff000000
2612#define BM_24_43 BM_43_24
2613#define BM_44_24 0x00001fffff000000
2614#define BM_24_44 BM_44_24
2615#define BM_45_24 0x00003fffff000000
2616#define BM_24_45 BM_45_24
2617#define BM_46_24 0x00007fffff000000
2618#define BM_24_46 BM_46_24
2619#define BM_47_24 0x0000ffffff000000
2620#define BM_24_47 BM_47_24
2621#define BM_48_24 0x0001ffffff000000
2622#define BM_24_48 BM_48_24
2623#define BM_49_24 0x0003ffffff000000
2624#define BM_24_49 BM_49_24
2625#define BM_50_24 0x0007ffffff000000
2626#define BM_24_50 BM_50_24
2627#define BM_51_24 0x000fffffff000000
2628#define BM_24_51 BM_51_24
2629#define BM_52_24 0x001fffffff000000
2630#define BM_24_52 BM_52_24
2631#define BM_53_24 0x003fffffff000000
2632#define BM_24_53 BM_53_24
2633#define BM_54_24 0x007fffffff000000
2634#define BM_24_54 BM_54_24
2635#define BM_55_24 0x00ffffffff000000
2636#define BM_24_55 BM_55_24
2637#define BM_56_24 0x01ffffffff000000
2638#define BM_24_56 BM_56_24
2639#define BM_57_24 0x03ffffffff000000
2640#define BM_24_57 BM_57_24
2641#define BM_58_24 0x07ffffffff000000
2642#define BM_24_58 BM_58_24
2643#define BM_59_24 0x0fffffffff000000
2644#define BM_24_59 BM_59_24
2645#define BM_60_24 0x1fffffffff000000
2646#define BM_24_60 BM_60_24
2647#define BM_61_24 0x3fffffffff000000
2648#define BM_24_61 BM_61_24
2649#define BM_62_24 0x7fffffffff000000
2650#define BM_24_62 BM_62_24
2651#define BM_63_24 0xffffffffff000000
2652#define BM_24_63 BM_63_24
2653#define BM_25_25 0x0000000002000000
2654#define BM_26_25 0x0000000006000000
2655#define BM_25_26 BM_26_25
2656#define BM_27_25 0x000000000e000000
2657#define BM_25_27 BM_27_25
2658#define BM_28_25 0x000000001e000000
2659#define BM_25_28 BM_28_25
2660#define BM_29_25 0x000000003e000000
2661#define BM_25_29 BM_29_25
2662#define BM_30_25 0x000000007e000000
2663#define BM_25_30 BM_30_25
2664#define BM_31_25 0x00000000fe000000
2665#define BM_25_31 BM_31_25
2666#define BM_32_25 0x00000001fe000000
2667#define BM_25_32 BM_32_25
2668#define BM_33_25 0x00000003fe000000
2669#define BM_25_33 BM_33_25
2670#define BM_34_25 0x00000007fe000000
2671#define BM_25_34 BM_34_25
2672#define BM_35_25 0x0000000ffe000000
2673#define BM_25_35 BM_35_25
2674#define BM_36_25 0x0000001ffe000000
2675#define BM_25_36 BM_36_25
2676#define BM_37_25 0x0000003ffe000000
2677#define BM_25_37 BM_37_25
2678#define BM_38_25 0x0000007ffe000000
2679#define BM_25_38 BM_38_25
2680#define BM_39_25 0x000000fffe000000
2681#define BM_25_39 BM_39_25
2682#define BM_40_25 0x000001fffe000000
2683#define BM_25_40 BM_40_25
2684#define BM_41_25 0x000003fffe000000
2685#define BM_25_41 BM_41_25
2686#define BM_42_25 0x000007fffe000000
2687#define BM_25_42 BM_42_25
2688#define BM_43_25 0x00000ffffe000000
2689#define BM_25_43 BM_43_25
2690#define BM_44_25 0x00001ffffe000000
2691#define BM_25_44 BM_44_25
2692#define BM_45_25 0x00003ffffe000000
2693#define BM_25_45 BM_45_25
2694#define BM_46_25 0x00007ffffe000000
2695#define BM_25_46 BM_46_25
2696#define BM_47_25 0x0000fffffe000000
2697#define BM_25_47 BM_47_25
2698#define BM_48_25 0x0001fffffe000000
2699#define BM_25_48 BM_48_25
2700#define BM_49_25 0x0003fffffe000000
2701#define BM_25_49 BM_49_25
2702#define BM_50_25 0x0007fffffe000000
2703#define BM_25_50 BM_50_25
2704#define BM_51_25 0x000ffffffe000000
2705#define BM_25_51 BM_51_25
2706#define BM_52_25 0x001ffffffe000000
2707#define BM_25_52 BM_52_25
2708#define BM_53_25 0x003ffffffe000000
2709#define BM_25_53 BM_53_25
2710#define BM_54_25 0x007ffffffe000000
2711#define BM_25_54 BM_54_25
2712#define BM_55_25 0x00fffffffe000000
2713#define BM_25_55 BM_55_25
2714#define BM_56_25 0x01fffffffe000000
2715#define BM_25_56 BM_56_25
2716#define BM_57_25 0x03fffffffe000000
2717#define BM_25_57 BM_57_25
2718#define BM_58_25 0x07fffffffe000000
2719#define BM_25_58 BM_58_25
2720#define BM_59_25 0x0ffffffffe000000
2721#define BM_25_59 BM_59_25
2722#define BM_60_25 0x1ffffffffe000000
2723#define BM_25_60 BM_60_25
2724#define BM_61_25 0x3ffffffffe000000
2725#define BM_25_61 BM_61_25
2726#define BM_62_25 0x7ffffffffe000000
2727#define BM_25_62 BM_62_25
2728#define BM_63_25 0xfffffffffe000000
2729#define BM_25_63 BM_63_25
2730#define BM_26_26 0x0000000004000000
2731#define BM_27_26 0x000000000c000000
2732#define BM_26_27 BM_27_26
2733#define BM_28_26 0x000000001c000000
2734#define BM_26_28 BM_28_26
2735#define BM_29_26 0x000000003c000000
2736#define BM_26_29 BM_29_26
2737#define BM_30_26 0x000000007c000000
2738#define BM_26_30 BM_30_26
2739#define BM_31_26 0x00000000fc000000
2740#define BM_26_31 BM_31_26
2741#define BM_32_26 0x00000001fc000000
2742#define BM_26_32 BM_32_26
2743#define BM_33_26 0x00000003fc000000
2744#define BM_26_33 BM_33_26
2745#define BM_34_26 0x00000007fc000000
2746#define BM_26_34 BM_34_26
2747#define BM_35_26 0x0000000ffc000000
2748#define BM_26_35 BM_35_26
2749#define BM_36_26 0x0000001ffc000000
2750#define BM_26_36 BM_36_26
2751#define BM_37_26 0x0000003ffc000000
2752#define BM_26_37 BM_37_26
2753#define BM_38_26 0x0000007ffc000000
2754#define BM_26_38 BM_38_26
2755#define BM_39_26 0x000000fffc000000
2756#define BM_26_39 BM_39_26
2757#define BM_40_26 0x000001fffc000000
2758#define BM_26_40 BM_40_26
2759#define BM_41_26 0x000003fffc000000
2760#define BM_26_41 BM_41_26
2761#define BM_42_26 0x000007fffc000000
2762#define BM_26_42 BM_42_26
2763#define BM_43_26 0x00000ffffc000000
2764#define BM_26_43 BM_43_26
2765#define BM_44_26 0x00001ffffc000000
2766#define BM_26_44 BM_44_26
2767#define BM_45_26 0x00003ffffc000000
2768#define BM_26_45 BM_45_26
2769#define BM_46_26 0x00007ffffc000000
2770#define BM_26_46 BM_46_26
2771#define BM_47_26 0x0000fffffc000000
2772#define BM_26_47 BM_47_26
2773#define BM_48_26 0x0001fffffc000000
2774#define BM_26_48 BM_48_26
2775#define BM_49_26 0x0003fffffc000000
2776#define BM_26_49 BM_49_26
2777#define BM_50_26 0x0007fffffc000000
2778#define BM_26_50 BM_50_26
2779#define BM_51_26 0x000ffffffc000000
2780#define BM_26_51 BM_51_26
2781#define BM_52_26 0x001ffffffc000000
2782#define BM_26_52 BM_52_26
2783#define BM_53_26 0x003ffffffc000000
2784#define BM_26_53 BM_53_26
2785#define BM_54_26 0x007ffffffc000000
2786#define BM_26_54 BM_54_26
2787#define BM_55_26 0x00fffffffc000000
2788#define BM_26_55 BM_55_26
2789#define BM_56_26 0x01fffffffc000000
2790#define BM_26_56 BM_56_26
2791#define BM_57_26 0x03fffffffc000000
2792#define BM_26_57 BM_57_26
2793#define BM_58_26 0x07fffffffc000000
2794#define BM_26_58 BM_58_26
2795#define BM_59_26 0x0ffffffffc000000
2796#define BM_26_59 BM_59_26
2797#define BM_60_26 0x1ffffffffc000000
2798#define BM_26_60 BM_60_26
2799#define BM_61_26 0x3ffffffffc000000
2800#define BM_26_61 BM_61_26
2801#define BM_62_26 0x7ffffffffc000000
2802#define BM_26_62 BM_62_26
2803#define BM_63_26 0xfffffffffc000000
2804#define BM_26_63 BM_63_26
2805#define BM_27_27 0x0000000008000000
2806#define BM_28_27 0x0000000018000000
2807#define BM_27_28 BM_28_27
2808#define BM_29_27 0x0000000038000000
2809#define BM_27_29 BM_29_27
2810#define BM_30_27 0x0000000078000000
2811#define BM_27_30 BM_30_27
2812#define BM_31_27 0x00000000f8000000
2813#define BM_27_31 BM_31_27
2814#define BM_32_27 0x00000001f8000000
2815#define BM_27_32 BM_32_27
2816#define BM_33_27 0x00000003f8000000
2817#define BM_27_33 BM_33_27
2818#define BM_34_27 0x00000007f8000000
2819#define BM_27_34 BM_34_27
2820#define BM_35_27 0x0000000ff8000000
2821#define BM_27_35 BM_35_27
2822#define BM_36_27 0x0000001ff8000000
2823#define BM_27_36 BM_36_27
2824#define BM_37_27 0x0000003ff8000000
2825#define BM_27_37 BM_37_27
2826#define BM_38_27 0x0000007ff8000000
2827#define BM_27_38 BM_38_27
2828#define BM_39_27 0x000000fff8000000
2829#define BM_27_39 BM_39_27
2830#define BM_40_27 0x000001fff8000000
2831#define BM_27_40 BM_40_27
2832#define BM_41_27 0x000003fff8000000
2833#define BM_27_41 BM_41_27
2834#define BM_42_27 0x000007fff8000000
2835#define BM_27_42 BM_42_27
2836#define BM_43_27 0x00000ffff8000000
2837#define BM_27_43 BM_43_27
2838#define BM_44_27 0x00001ffff8000000
2839#define BM_27_44 BM_44_27
2840#define BM_45_27 0x00003ffff8000000
2841#define BM_27_45 BM_45_27
2842#define BM_46_27 0x00007ffff8000000
2843#define BM_27_46 BM_46_27
2844#define BM_47_27 0x0000fffff8000000
2845#define BM_27_47 BM_47_27
2846#define BM_48_27 0x0001fffff8000000
2847#define BM_27_48 BM_48_27
2848#define BM_49_27 0x0003fffff8000000
2849#define BM_27_49 BM_49_27
2850#define BM_50_27 0x0007fffff8000000
2851#define BM_27_50 BM_50_27
2852#define BM_51_27 0x000ffffff8000000
2853#define BM_27_51 BM_51_27
2854#define BM_52_27 0x001ffffff8000000
2855#define BM_27_52 BM_52_27
2856#define BM_53_27 0x003ffffff8000000
2857#define BM_27_53 BM_53_27
2858#define BM_54_27 0x007ffffff8000000
2859#define BM_27_54 BM_54_27
2860#define BM_55_27 0x00fffffff8000000
2861#define BM_27_55 BM_55_27
2862#define BM_56_27 0x01fffffff8000000
2863#define BM_27_56 BM_56_27
2864#define BM_57_27 0x03fffffff8000000
2865#define BM_27_57 BM_57_27
2866#define BM_58_27 0x07fffffff8000000
2867#define BM_27_58 BM_58_27
2868#define BM_59_27 0x0ffffffff8000000
2869#define BM_27_59 BM_59_27
2870#define BM_60_27 0x1ffffffff8000000
2871#define BM_27_60 BM_60_27
2872#define BM_61_27 0x3ffffffff8000000
2873#define BM_27_61 BM_61_27
2874#define BM_62_27 0x7ffffffff8000000
2875#define BM_27_62 BM_62_27
2876#define BM_63_27 0xfffffffff8000000
2877#define BM_27_63 BM_63_27
2878#define BM_28_28 0x0000000010000000
2879#define BM_29_28 0x0000000030000000
2880#define BM_28_29 BM_29_28
2881#define BM_30_28 0x0000000070000000
2882#define BM_28_30 BM_30_28
2883#define BM_31_28 0x00000000f0000000
2884#define BM_28_31 BM_31_28
2885#define BM_32_28 0x00000001f0000000
2886#define BM_28_32 BM_32_28
2887#define BM_33_28 0x00000003f0000000
2888#define BM_28_33 BM_33_28
2889#define BM_34_28 0x00000007f0000000
2890#define BM_28_34 BM_34_28
2891#define BM_35_28 0x0000000ff0000000
2892#define BM_28_35 BM_35_28
2893#define BM_36_28 0x0000001ff0000000
2894#define BM_28_36 BM_36_28
2895#define BM_37_28 0x0000003ff0000000
2896#define BM_28_37 BM_37_28
2897#define BM_38_28 0x0000007ff0000000
2898#define BM_28_38 BM_38_28
2899#define BM_39_28 0x000000fff0000000
2900#define BM_28_39 BM_39_28
2901#define BM_40_28 0x000001fff0000000
2902#define BM_28_40 BM_40_28
2903#define BM_41_28 0x000003fff0000000
2904#define BM_28_41 BM_41_28
2905#define BM_42_28 0x000007fff0000000
2906#define BM_28_42 BM_42_28
2907#define BM_43_28 0x00000ffff0000000
2908#define BM_28_43 BM_43_28
2909#define BM_44_28 0x00001ffff0000000
2910#define BM_28_44 BM_44_28
2911#define BM_45_28 0x00003ffff0000000
2912#define BM_28_45 BM_45_28
2913#define BM_46_28 0x00007ffff0000000
2914#define BM_28_46 BM_46_28
2915#define BM_47_28 0x0000fffff0000000
2916#define BM_28_47 BM_47_28
2917#define BM_48_28 0x0001fffff0000000
2918#define BM_28_48 BM_48_28
2919#define BM_49_28 0x0003fffff0000000
2920#define BM_28_49 BM_49_28
2921#define BM_50_28 0x0007fffff0000000
2922#define BM_28_50 BM_50_28
2923#define BM_51_28 0x000ffffff0000000
2924#define BM_28_51 BM_51_28
2925#define BM_52_28 0x001ffffff0000000
2926#define BM_28_52 BM_52_28
2927#define BM_53_28 0x003ffffff0000000
2928#define BM_28_53 BM_53_28
2929#define BM_54_28 0x007ffffff0000000
2930#define BM_28_54 BM_54_28
2931#define BM_55_28 0x00fffffff0000000
2932#define BM_28_55 BM_55_28
2933#define BM_56_28 0x01fffffff0000000
2934#define BM_28_56 BM_56_28
2935#define BM_57_28 0x03fffffff0000000
2936#define BM_28_57 BM_57_28
2937#define BM_58_28 0x07fffffff0000000
2938#define BM_28_58 BM_58_28
2939#define BM_59_28 0x0ffffffff0000000
2940#define BM_28_59 BM_59_28
2941#define BM_60_28 0x1ffffffff0000000
2942#define BM_28_60 BM_60_28
2943#define BM_61_28 0x3ffffffff0000000
2944#define BM_28_61 BM_61_28
2945#define BM_62_28 0x7ffffffff0000000
2946#define BM_28_62 BM_62_28
2947#define BM_63_28 0xfffffffff0000000
2948#define BM_28_63 BM_63_28
2949#define BM_29_29 0x0000000020000000
2950#define BM_30_29 0x0000000060000000
2951#define BM_29_30 BM_30_29
2952#define BM_31_29 0x00000000e0000000
2953#define BM_29_31 BM_31_29
2954#define BM_32_29 0x00000001e0000000
2955#define BM_29_32 BM_32_29
2956#define BM_33_29 0x00000003e0000000
2957#define BM_29_33 BM_33_29
2958#define BM_34_29 0x00000007e0000000
2959#define BM_29_34 BM_34_29
2960#define BM_35_29 0x0000000fe0000000
2961#define BM_29_35 BM_35_29
2962#define BM_36_29 0x0000001fe0000000
2963#define BM_29_36 BM_36_29
2964#define BM_37_29 0x0000003fe0000000
2965#define BM_29_37 BM_37_29
2966#define BM_38_29 0x0000007fe0000000
2967#define BM_29_38 BM_38_29
2968#define BM_39_29 0x000000ffe0000000
2969#define BM_29_39 BM_39_29
2970#define BM_40_29 0x000001ffe0000000
2971#define BM_29_40 BM_40_29
2972#define BM_41_29 0x000003ffe0000000
2973#define BM_29_41 BM_41_29
2974#define BM_42_29 0x000007ffe0000000
2975#define BM_29_42 BM_42_29
2976#define BM_43_29 0x00000fffe0000000
2977#define BM_29_43 BM_43_29
2978#define BM_44_29 0x00001fffe0000000
2979#define BM_29_44 BM_44_29
2980#define BM_45_29 0x00003fffe0000000
2981#define BM_29_45 BM_45_29
2982#define BM_46_29 0x00007fffe0000000
2983#define BM_29_46 BM_46_29
2984#define BM_47_29 0x0000ffffe0000000
2985#define BM_29_47 BM_47_29
2986#define BM_48_29 0x0001ffffe0000000
2987#define BM_29_48 BM_48_29
2988#define BM_49_29 0x0003ffffe0000000
2989#define BM_29_49 BM_49_29
2990#define BM_50_29 0x0007ffffe0000000
2991#define BM_29_50 BM_50_29
2992#define BM_51_29 0x000fffffe0000000
2993#define BM_29_51 BM_51_29
2994#define BM_52_29 0x001fffffe0000000
2995#define BM_29_52 BM_52_29
2996#define BM_53_29 0x003fffffe0000000
2997#define BM_29_53 BM_53_29
2998#define BM_54_29 0x007fffffe0000000
2999#define BM_29_54 BM_54_29
3000#define BM_55_29 0x00ffffffe0000000
3001#define BM_29_55 BM_55_29
3002#define BM_56_29 0x01ffffffe0000000
3003#define BM_29_56 BM_56_29
3004#define BM_57_29 0x03ffffffe0000000
3005#define BM_29_57 BM_57_29
3006#define BM_58_29 0x07ffffffe0000000
3007#define BM_29_58 BM_58_29
3008#define BM_59_29 0x0fffffffe0000000
3009#define BM_29_59 BM_59_29
3010#define BM_60_29 0x1fffffffe0000000
3011#define BM_29_60 BM_60_29
3012#define BM_61_29 0x3fffffffe0000000
3013#define BM_29_61 BM_61_29
3014#define BM_62_29 0x7fffffffe0000000
3015#define BM_29_62 BM_62_29
3016#define BM_63_29 0xffffffffe0000000
3017#define BM_29_63 BM_63_29
3018#define BM_30_30 0x0000000040000000
3019#define BM_31_30 0x00000000c0000000
3020#define BM_30_31 BM_31_30
3021#define BM_32_30 0x00000001c0000000
3022#define BM_30_32 BM_32_30
3023#define BM_33_30 0x00000003c0000000
3024#define BM_30_33 BM_33_30
3025#define BM_34_30 0x00000007c0000000
3026#define BM_30_34 BM_34_30
3027#define BM_35_30 0x0000000fc0000000
3028#define BM_30_35 BM_35_30
3029#define BM_36_30 0x0000001fc0000000
3030#define BM_30_36 BM_36_30
3031#define BM_37_30 0x0000003fc0000000
3032#define BM_30_37 BM_37_30
3033#define BM_38_30 0x0000007fc0000000
3034#define BM_30_38 BM_38_30
3035#define BM_39_30 0x000000ffc0000000
3036#define BM_30_39 BM_39_30
3037#define BM_40_30 0x000001ffc0000000
3038#define BM_30_40 BM_40_30
3039#define BM_41_30 0x000003ffc0000000
3040#define BM_30_41 BM_41_30
3041#define BM_42_30 0x000007ffc0000000
3042#define BM_30_42 BM_42_30
3043#define BM_43_30 0x00000fffc0000000
3044#define BM_30_43 BM_43_30
3045#define BM_44_30 0x00001fffc0000000
3046#define BM_30_44 BM_44_30
3047#define BM_45_30 0x00003fffc0000000
3048#define BM_30_45 BM_45_30
3049#define BM_46_30 0x00007fffc0000000
3050#define BM_30_46 BM_46_30
3051#define BM_47_30 0x0000ffffc0000000
3052#define BM_30_47 BM_47_30
3053#define BM_48_30 0x0001ffffc0000000
3054#define BM_30_48 BM_48_30
3055#define BM_49_30 0x0003ffffc0000000
3056#define BM_30_49 BM_49_30
3057#define BM_50_30 0x0007ffffc0000000
3058#define BM_30_50 BM_50_30
3059#define BM_51_30 0x000fffffc0000000
3060#define BM_30_51 BM_51_30
3061#define BM_52_30 0x001fffffc0000000
3062#define BM_30_52 BM_52_30
3063#define BM_53_30 0x003fffffc0000000
3064#define BM_30_53 BM_53_30
3065#define BM_54_30 0x007fffffc0000000
3066#define BM_30_54 BM_54_30
3067#define BM_55_30 0x00ffffffc0000000
3068#define BM_30_55 BM_55_30
3069#define BM_56_30 0x01ffffffc0000000
3070#define BM_30_56 BM_56_30
3071#define BM_57_30 0x03ffffffc0000000
3072#define BM_30_57 BM_57_30
3073#define BM_58_30 0x07ffffffc0000000
3074#define BM_30_58 BM_58_30
3075#define BM_59_30 0x0fffffffc0000000
3076#define BM_30_59 BM_59_30
3077#define BM_60_30 0x1fffffffc0000000
3078#define BM_30_60 BM_60_30
3079#define BM_61_30 0x3fffffffc0000000
3080#define BM_30_61 BM_61_30
3081#define BM_62_30 0x7fffffffc0000000
3082#define BM_30_62 BM_62_30
3083#define BM_63_30 0xffffffffc0000000
3084#define BM_30_63 BM_63_30
3085#define BM_31_31 0x0000000080000000
3086#define BM_32_31 0x0000000180000000
3087#define BM_31_32 BM_32_31
3088#define BM_33_31 0x0000000380000000
3089#define BM_31_33 BM_33_31
3090#define BM_34_31 0x0000000780000000
3091#define BM_31_34 BM_34_31
3092#define BM_35_31 0x0000000f80000000
3093#define BM_31_35 BM_35_31
3094#define BM_36_31 0x0000001f80000000
3095#define BM_31_36 BM_36_31
3096#define BM_37_31 0x0000003f80000000
3097#define BM_31_37 BM_37_31
3098#define BM_38_31 0x0000007f80000000
3099#define BM_31_38 BM_38_31
3100#define BM_39_31 0x000000ff80000000
3101#define BM_31_39 BM_39_31
3102#define BM_40_31 0x000001ff80000000
3103#define BM_31_40 BM_40_31
3104#define BM_41_31 0x000003ff80000000
3105#define BM_31_41 BM_41_31
3106#define BM_42_31 0x000007ff80000000
3107#define BM_31_42 BM_42_31
3108#define BM_43_31 0x00000fff80000000
3109#define BM_31_43 BM_43_31
3110#define BM_44_31 0x00001fff80000000
3111#define BM_31_44 BM_44_31
3112#define BM_45_31 0x00003fff80000000
3113#define BM_31_45 BM_45_31
3114#define BM_46_31 0x00007fff80000000
3115#define BM_31_46 BM_46_31
3116#define BM_47_31 0x0000ffff80000000
3117#define BM_31_47 BM_47_31
3118#define BM_48_31 0x0001ffff80000000
3119#define BM_31_48 BM_48_31
3120#define BM_49_31 0x0003ffff80000000
3121#define BM_31_49 BM_49_31
3122#define BM_50_31 0x0007ffff80000000
3123#define BM_31_50 BM_50_31
3124#define BM_51_31 0x000fffff80000000
3125#define BM_31_51 BM_51_31
3126#define BM_52_31 0x001fffff80000000
3127#define BM_31_52 BM_52_31
3128#define BM_53_31 0x003fffff80000000
3129#define BM_31_53 BM_53_31
3130#define BM_54_31 0x007fffff80000000
3131#define BM_31_54 BM_54_31
3132#define BM_55_31 0x00ffffff80000000
3133#define BM_31_55 BM_55_31
3134#define BM_56_31 0x01ffffff80000000
3135#define BM_31_56 BM_56_31
3136#define BM_57_31 0x03ffffff80000000
3137#define BM_31_57 BM_57_31
3138#define BM_58_31 0x07ffffff80000000
3139#define BM_31_58 BM_58_31
3140#define BM_59_31 0x0fffffff80000000
3141#define BM_31_59 BM_59_31
3142#define BM_60_31 0x1fffffff80000000
3143#define BM_31_60 BM_60_31
3144#define BM_61_31 0x3fffffff80000000
3145#define BM_31_61 BM_61_31
3146#define BM_62_31 0x7fffffff80000000
3147#define BM_31_62 BM_62_31
3148#define BM_63_31 0xffffffff80000000
3149#define BM_31_63 BM_63_31
3150#define BM_32_32 0x0000000100000000
3151#define BM_33_32 0x0000000300000000
3152#define BM_32_33 BM_33_32
3153#define BM_34_32 0x0000000700000000
3154#define BM_32_34 BM_34_32
3155#define BM_35_32 0x0000000f00000000
3156#define BM_32_35 BM_35_32
3157#define BM_36_32 0x0000001f00000000
3158#define BM_32_36 BM_36_32
3159#define BM_37_32 0x0000003f00000000
3160#define BM_32_37 BM_37_32
3161#define BM_38_32 0x0000007f00000000
3162#define BM_32_38 BM_38_32
3163#define BM_39_32 0x000000ff00000000
3164#define BM_32_39 BM_39_32
3165#define BM_40_32 0x000001ff00000000
3166#define BM_32_40 BM_40_32
3167#define BM_41_32 0x000003ff00000000
3168#define BM_32_41 BM_41_32
3169#define BM_42_32 0x000007ff00000000
3170#define BM_32_42 BM_42_32
3171#define BM_43_32 0x00000fff00000000
3172#define BM_32_43 BM_43_32
3173#define BM_44_32 0x00001fff00000000
3174#define BM_32_44 BM_44_32
3175#define BM_45_32 0x00003fff00000000
3176#define BM_32_45 BM_45_32
3177#define BM_46_32 0x00007fff00000000
3178#define BM_32_46 BM_46_32
3179#define BM_47_32 0x0000ffff00000000
3180#define BM_32_47 BM_47_32
3181#define BM_48_32 0x0001ffff00000000
3182#define BM_32_48 BM_48_32
3183#define BM_49_32 0x0003ffff00000000
3184#define BM_32_49 BM_49_32
3185#define BM_50_32 0x0007ffff00000000
3186#define BM_32_50 BM_50_32
3187#define BM_51_32 0x000fffff00000000
3188#define BM_32_51 BM_51_32
3189#define BM_52_32 0x001fffff00000000
3190#define BM_32_52 BM_52_32
3191#define BM_53_32 0x003fffff00000000
3192#define BM_32_53 BM_53_32
3193#define BM_54_32 0x007fffff00000000
3194#define BM_32_54 BM_54_32
3195#define BM_55_32 0x00ffffff00000000
3196#define BM_32_55 BM_55_32
3197#define BM_56_32 0x01ffffff00000000
3198#define BM_32_56 BM_56_32
3199#define BM_57_32 0x03ffffff00000000
3200#define BM_32_57 BM_57_32
3201#define BM_58_32 0x07ffffff00000000
3202#define BM_32_58 BM_58_32
3203#define BM_59_32 0x0fffffff00000000
3204#define BM_32_59 BM_59_32
3205#define BM_60_32 0x1fffffff00000000
3206#define BM_32_60 BM_60_32
3207#define BM_61_32 0x3fffffff00000000
3208#define BM_32_61 BM_61_32
3209#define BM_62_32 0x7fffffff00000000
3210#define BM_32_62 BM_62_32
3211#define BM_63_32 0xffffffff00000000
3212#define BM_32_63 BM_63_32
3213#define BM_33_33 0x0000000200000000
3214#define BM_34_33 0x0000000600000000
3215#define BM_33_34 BM_34_33
3216#define BM_35_33 0x0000000e00000000
3217#define BM_33_35 BM_35_33
3218#define BM_36_33 0x0000001e00000000
3219#define BM_33_36 BM_36_33
3220#define BM_37_33 0x0000003e00000000
3221#define BM_33_37 BM_37_33
3222#define BM_38_33 0x0000007e00000000
3223#define BM_33_38 BM_38_33
3224#define BM_39_33 0x000000fe00000000
3225#define BM_33_39 BM_39_33
3226#define BM_40_33 0x000001fe00000000
3227#define BM_33_40 BM_40_33
3228#define BM_41_33 0x000003fe00000000
3229#define BM_33_41 BM_41_33
3230#define BM_42_33 0x000007fe00000000
3231#define BM_33_42 BM_42_33
3232#define BM_43_33 0x00000ffe00000000
3233#define BM_33_43 BM_43_33
3234#define BM_44_33 0x00001ffe00000000
3235#define BM_33_44 BM_44_33
3236#define BM_45_33 0x00003ffe00000000
3237#define BM_33_45 BM_45_33
3238#define BM_46_33 0x00007ffe00000000
3239#define BM_33_46 BM_46_33
3240#define BM_47_33 0x0000fffe00000000
3241#define BM_33_47 BM_47_33
3242#define BM_48_33 0x0001fffe00000000
3243#define BM_33_48 BM_48_33
3244#define BM_49_33 0x0003fffe00000000
3245#define BM_33_49 BM_49_33
3246#define BM_50_33 0x0007fffe00000000
3247#define BM_33_50 BM_50_33
3248#define BM_51_33 0x000ffffe00000000
3249#define BM_33_51 BM_51_33
3250#define BM_52_33 0x001ffffe00000000
3251#define BM_33_52 BM_52_33
3252#define BM_53_33 0x003ffffe00000000
3253#define BM_33_53 BM_53_33
3254#define BM_54_33 0x007ffffe00000000
3255#define BM_33_54 BM_54_33
3256#define BM_55_33 0x00fffffe00000000
3257#define BM_33_55 BM_55_33
3258#define BM_56_33 0x01fffffe00000000
3259#define BM_33_56 BM_56_33
3260#define BM_57_33 0x03fffffe00000000
3261#define BM_33_57 BM_57_33
3262#define BM_58_33 0x07fffffe00000000
3263#define BM_33_58 BM_58_33
3264#define BM_59_33 0x0ffffffe00000000
3265#define BM_33_59 BM_59_33
3266#define BM_60_33 0x1ffffffe00000000
3267#define BM_33_60 BM_60_33
3268#define BM_61_33 0x3ffffffe00000000
3269#define BM_33_61 BM_61_33
3270#define BM_62_33 0x7ffffffe00000000
3271#define BM_33_62 BM_62_33
3272#define BM_63_33 0xfffffffe00000000
3273#define BM_33_63 BM_63_33
3274#define BM_34_34 0x0000000400000000
3275#define BM_35_34 0x0000000c00000000
3276#define BM_34_35 BM_35_34
3277#define BM_36_34 0x0000001c00000000
3278#define BM_34_36 BM_36_34
3279#define BM_37_34 0x0000003c00000000
3280#define BM_34_37 BM_37_34
3281#define BM_38_34 0x0000007c00000000
3282#define BM_34_38 BM_38_34
3283#define BM_39_34 0x000000fc00000000
3284#define BM_34_39 BM_39_34
3285#define BM_40_34 0x000001fc00000000
3286#define BM_34_40 BM_40_34
3287#define BM_41_34 0x000003fc00000000
3288#define BM_34_41 BM_41_34
3289#define BM_42_34 0x000007fc00000000
3290#define BM_34_42 BM_42_34
3291#define BM_43_34 0x00000ffc00000000
3292#define BM_34_43 BM_43_34
3293#define BM_44_34 0x00001ffc00000000
3294#define BM_34_44 BM_44_34
3295#define BM_45_34 0x00003ffc00000000
3296#define BM_34_45 BM_45_34
3297#define BM_46_34 0x00007ffc00000000
3298#define BM_34_46 BM_46_34
3299#define BM_47_34 0x0000fffc00000000
3300#define BM_34_47 BM_47_34
3301#define BM_48_34 0x0001fffc00000000
3302#define BM_34_48 BM_48_34
3303#define BM_49_34 0x0003fffc00000000
3304#define BM_34_49 BM_49_34
3305#define BM_50_34 0x0007fffc00000000
3306#define BM_34_50 BM_50_34
3307#define BM_51_34 0x000ffffc00000000
3308#define BM_34_51 BM_51_34
3309#define BM_52_34 0x001ffffc00000000
3310#define BM_34_52 BM_52_34
3311#define BM_53_34 0x003ffffc00000000
3312#define BM_34_53 BM_53_34
3313#define BM_54_34 0x007ffffc00000000
3314#define BM_34_54 BM_54_34
3315#define BM_55_34 0x00fffffc00000000
3316#define BM_34_55 BM_55_34
3317#define BM_56_34 0x01fffffc00000000
3318#define BM_34_56 BM_56_34
3319#define BM_57_34 0x03fffffc00000000
3320#define BM_34_57 BM_57_34
3321#define BM_58_34 0x07fffffc00000000
3322#define BM_34_58 BM_58_34
3323#define BM_59_34 0x0ffffffc00000000
3324#define BM_34_59 BM_59_34
3325#define BM_60_34 0x1ffffffc00000000
3326#define BM_34_60 BM_60_34
3327#define BM_61_34 0x3ffffffc00000000
3328#define BM_34_61 BM_61_34
3329#define BM_62_34 0x7ffffffc00000000
3330#define BM_34_62 BM_62_34
3331#define BM_63_34 0xfffffffc00000000
3332#define BM_34_63 BM_63_34
3333#define BM_35_35 0x0000000800000000
3334#define BM_36_35 0x0000001800000000
3335#define BM_35_36 BM_36_35
3336#define BM_37_35 0x0000003800000000
3337#define BM_35_37 BM_37_35
3338#define BM_38_35 0x0000007800000000
3339#define BM_35_38 BM_38_35
3340#define BM_39_35 0x000000f800000000
3341#define BM_35_39 BM_39_35
3342#define BM_40_35 0x000001f800000000
3343#define BM_35_40 BM_40_35
3344#define BM_41_35 0x000003f800000000
3345#define BM_35_41 BM_41_35
3346#define BM_42_35 0x000007f800000000
3347#define BM_35_42 BM_42_35
3348#define BM_43_35 0x00000ff800000000
3349#define BM_35_43 BM_43_35
3350#define BM_44_35 0x00001ff800000000
3351#define BM_35_44 BM_44_35
3352#define BM_45_35 0x00003ff800000000
3353#define BM_35_45 BM_45_35
3354#define BM_46_35 0x00007ff800000000
3355#define BM_35_46 BM_46_35
3356#define BM_47_35 0x0000fff800000000
3357#define BM_35_47 BM_47_35
3358#define BM_48_35 0x0001fff800000000
3359#define BM_35_48 BM_48_35
3360#define BM_49_35 0x0003fff800000000
3361#define BM_35_49 BM_49_35
3362#define BM_50_35 0x0007fff800000000
3363#define BM_35_50 BM_50_35
3364#define BM_51_35 0x000ffff800000000
3365#define BM_35_51 BM_51_35
3366#define BM_52_35 0x001ffff800000000
3367#define BM_35_52 BM_52_35
3368#define BM_53_35 0x003ffff800000000
3369#define BM_35_53 BM_53_35
3370#define BM_54_35 0x007ffff800000000
3371#define BM_35_54 BM_54_35
3372#define BM_55_35 0x00fffff800000000
3373#define BM_35_55 BM_55_35
3374#define BM_56_35 0x01fffff800000000
3375#define BM_35_56 BM_56_35
3376#define BM_57_35 0x03fffff800000000
3377#define BM_35_57 BM_57_35
3378#define BM_58_35 0x07fffff800000000
3379#define BM_35_58 BM_58_35
3380#define BM_59_35 0x0ffffff800000000
3381#define BM_35_59 BM_59_35
3382#define BM_60_35 0x1ffffff800000000
3383#define BM_35_60 BM_60_35
3384#define BM_61_35 0x3ffffff800000000
3385#define BM_35_61 BM_61_35
3386#define BM_62_35 0x7ffffff800000000
3387#define BM_35_62 BM_62_35
3388#define BM_63_35 0xfffffff800000000
3389#define BM_35_63 BM_63_35
3390#define BM_36_36 0x0000001000000000
3391#define BM_37_36 0x0000003000000000
3392#define BM_36_37 BM_37_36
3393#define BM_38_36 0x0000007000000000
3394#define BM_36_38 BM_38_36
3395#define BM_39_36 0x000000f000000000
3396#define BM_36_39 BM_39_36
3397#define BM_40_36 0x000001f000000000
3398#define BM_36_40 BM_40_36
3399#define BM_41_36 0x000003f000000000
3400#define BM_36_41 BM_41_36
3401#define BM_42_36 0x000007f000000000
3402#define BM_36_42 BM_42_36
3403#define BM_43_36 0x00000ff000000000
3404#define BM_36_43 BM_43_36
3405#define BM_44_36 0x00001ff000000000
3406#define BM_36_44 BM_44_36
3407#define BM_45_36 0x00003ff000000000
3408#define BM_36_45 BM_45_36
3409#define BM_46_36 0x00007ff000000000
3410#define BM_36_46 BM_46_36
3411#define BM_47_36 0x0000fff000000000
3412#define BM_36_47 BM_47_36
3413#define BM_48_36 0x0001fff000000000
3414#define BM_36_48 BM_48_36
3415#define BM_49_36 0x0003fff000000000
3416#define BM_36_49 BM_49_36
3417#define BM_50_36 0x0007fff000000000
3418#define BM_36_50 BM_50_36
3419#define BM_51_36 0x000ffff000000000
3420#define BM_36_51 BM_51_36
3421#define BM_52_36 0x001ffff000000000
3422#define BM_36_52 BM_52_36
3423#define BM_53_36 0x003ffff000000000
3424#define BM_36_53 BM_53_36
3425#define BM_54_36 0x007ffff000000000
3426#define BM_36_54 BM_54_36
3427#define BM_55_36 0x00fffff000000000
3428#define BM_36_55 BM_55_36
3429#define BM_56_36 0x01fffff000000000
3430#define BM_36_56 BM_56_36
3431#define BM_57_36 0x03fffff000000000
3432#define BM_36_57 BM_57_36
3433#define BM_58_36 0x07fffff000000000
3434#define BM_36_58 BM_58_36
3435#define BM_59_36 0x0ffffff000000000
3436#define BM_36_59 BM_59_36
3437#define BM_60_36 0x1ffffff000000000
3438#define BM_36_60 BM_60_36
3439#define BM_61_36 0x3ffffff000000000
3440#define BM_36_61 BM_61_36
3441#define BM_62_36 0x7ffffff000000000
3442#define BM_36_62 BM_62_36
3443#define BM_63_36 0xfffffff000000000
3444#define BM_36_63 BM_63_36
3445#define BM_37_37 0x0000002000000000
3446#define BM_38_37 0x0000006000000000
3447#define BM_37_38 BM_38_37
3448#define BM_39_37 0x000000e000000000
3449#define BM_37_39 BM_39_37
3450#define BM_40_37 0x000001e000000000
3451#define BM_37_40 BM_40_37
3452#define BM_41_37 0x000003e000000000
3453#define BM_37_41 BM_41_37
3454#define BM_42_37 0x000007e000000000
3455#define BM_37_42 BM_42_37
3456#define BM_43_37 0x00000fe000000000
3457#define BM_37_43 BM_43_37
3458#define BM_44_37 0x00001fe000000000
3459#define BM_37_44 BM_44_37
3460#define BM_45_37 0x00003fe000000000
3461#define BM_37_45 BM_45_37
3462#define BM_46_37 0x00007fe000000000
3463#define BM_37_46 BM_46_37
3464#define BM_47_37 0x0000ffe000000000
3465#define BM_37_47 BM_47_37
3466#define BM_48_37 0x0001ffe000000000
3467#define BM_37_48 BM_48_37
3468#define BM_49_37 0x0003ffe000000000
3469#define BM_37_49 BM_49_37
3470#define BM_50_37 0x0007ffe000000000
3471#define BM_37_50 BM_50_37
3472#define BM_51_37 0x000fffe000000000
3473#define BM_37_51 BM_51_37
3474#define BM_52_37 0x001fffe000000000
3475#define BM_37_52 BM_52_37
3476#define BM_53_37 0x003fffe000000000
3477#define BM_37_53 BM_53_37
3478#define BM_54_37 0x007fffe000000000
3479#define BM_37_54 BM_54_37
3480#define BM_55_37 0x00ffffe000000000
3481#define BM_37_55 BM_55_37
3482#define BM_56_37 0x01ffffe000000000
3483#define BM_37_56 BM_56_37
3484#define BM_57_37 0x03ffffe000000000
3485#define BM_37_57 BM_57_37
3486#define BM_58_37 0x07ffffe000000000
3487#define BM_37_58 BM_58_37
3488#define BM_59_37 0x0fffffe000000000
3489#define BM_37_59 BM_59_37
3490#define BM_60_37 0x1fffffe000000000
3491#define BM_37_60 BM_60_37
3492#define BM_61_37 0x3fffffe000000000
3493#define BM_37_61 BM_61_37
3494#define BM_62_37 0x7fffffe000000000
3495#define BM_37_62 BM_62_37
3496#define BM_63_37 0xffffffe000000000
3497#define BM_37_63 BM_63_37
3498#define BM_38_38 0x0000004000000000
3499#define BM_39_38 0x000000c000000000
3500#define BM_38_39 BM_39_38
3501#define BM_40_38 0x000001c000000000
3502#define BM_38_40 BM_40_38
3503#define BM_41_38 0x000003c000000000
3504#define BM_38_41 BM_41_38
3505#define BM_42_38 0x000007c000000000
3506#define BM_38_42 BM_42_38
3507#define BM_43_38 0x00000fc000000000
3508#define BM_38_43 BM_43_38
3509#define BM_44_38 0x00001fc000000000
3510#define BM_38_44 BM_44_38
3511#define BM_45_38 0x00003fc000000000
3512#define BM_38_45 BM_45_38
3513#define BM_46_38 0x00007fc000000000
3514#define BM_38_46 BM_46_38
3515#define BM_47_38 0x0000ffc000000000
3516#define BM_38_47 BM_47_38
3517#define BM_48_38 0x0001ffc000000000
3518#define BM_38_48 BM_48_38
3519#define BM_49_38 0x0003ffc000000000
3520#define BM_38_49 BM_49_38
3521#define BM_50_38 0x0007ffc000000000
3522#define BM_38_50 BM_50_38
3523#define BM_51_38 0x000fffc000000000
3524#define BM_38_51 BM_51_38
3525#define BM_52_38 0x001fffc000000000
3526#define BM_38_52 BM_52_38
3527#define BM_53_38 0x003fffc000000000
3528#define BM_38_53 BM_53_38
3529#define BM_54_38 0x007fffc000000000
3530#define BM_38_54 BM_54_38
3531#define BM_55_38 0x00ffffc000000000
3532#define BM_38_55 BM_55_38
3533#define BM_56_38 0x01ffffc000000000
3534#define BM_38_56 BM_56_38
3535#define BM_57_38 0x03ffffc000000000
3536#define BM_38_57 BM_57_38
3537#define BM_58_38 0x07ffffc000000000
3538#define BM_38_58 BM_58_38
3539#define BM_59_38 0x0fffffc000000000
3540#define BM_38_59 BM_59_38
3541#define BM_60_38 0x1fffffc000000000
3542#define BM_38_60 BM_60_38
3543#define BM_61_38 0x3fffffc000000000
3544#define BM_38_61 BM_61_38
3545#define BM_62_38 0x7fffffc000000000
3546#define BM_38_62 BM_62_38
3547#define BM_63_38 0xffffffc000000000
3548#define BM_38_63 BM_63_38
3549#define BM_39_39 0x0000008000000000
3550#define BM_40_39 0x0000018000000000
3551#define BM_39_40 BM_40_39
3552#define BM_41_39 0x0000038000000000
3553#define BM_39_41 BM_41_39
3554#define BM_42_39 0x0000078000000000
3555#define BM_39_42 BM_42_39
3556#define BM_43_39 0x00000f8000000000
3557#define BM_39_43 BM_43_39
3558#define BM_44_39 0x00001f8000000000
3559#define BM_39_44 BM_44_39
3560#define BM_45_39 0x00003f8000000000
3561#define BM_39_45 BM_45_39
3562#define BM_46_39 0x00007f8000000000
3563#define BM_39_46 BM_46_39
3564#define BM_47_39 0x0000ff8000000000
3565#define BM_39_47 BM_47_39
3566#define BM_48_39 0x0001ff8000000000
3567#define BM_39_48 BM_48_39
3568#define BM_49_39 0x0003ff8000000000
3569#define BM_39_49 BM_49_39
3570#define BM_50_39 0x0007ff8000000000
3571#define BM_39_50 BM_50_39
3572#define BM_51_39 0x000fff8000000000
3573#define BM_39_51 BM_51_39
3574#define BM_52_39 0x001fff8000000000
3575#define BM_39_52 BM_52_39
3576#define BM_53_39 0x003fff8000000000
3577#define BM_39_53 BM_53_39
3578#define BM_54_39 0x007fff8000000000
3579#define BM_39_54 BM_54_39
3580#define BM_55_39 0x00ffff8000000000
3581#define BM_39_55 BM_55_39
3582#define BM_56_39 0x01ffff8000000000
3583#define BM_39_56 BM_56_39
3584#define BM_57_39 0x03ffff8000000000
3585#define BM_39_57 BM_57_39
3586#define BM_58_39 0x07ffff8000000000
3587#define BM_39_58 BM_58_39
3588#define BM_59_39 0x0fffff8000000000
3589#define BM_39_59 BM_59_39
3590#define BM_60_39 0x1fffff8000000000
3591#define BM_39_60 BM_60_39
3592#define BM_61_39 0x3fffff8000000000
3593#define BM_39_61 BM_61_39
3594#define BM_62_39 0x7fffff8000000000
3595#define BM_39_62 BM_62_39
3596#define BM_63_39 0xffffff8000000000
3597#define BM_39_63 BM_63_39
3598#define BM_40_40 0x0000010000000000
3599#define BM_41_40 0x0000030000000000
3600#define BM_40_41 BM_41_40
3601#define BM_42_40 0x0000070000000000
3602#define BM_40_42 BM_42_40
3603#define BM_43_40 0x00000f0000000000
3604#define BM_40_43 BM_43_40
3605#define BM_44_40 0x00001f0000000000
3606#define BM_40_44 BM_44_40
3607#define BM_45_40 0x00003f0000000000
3608#define BM_40_45 BM_45_40
3609#define BM_46_40 0x00007f0000000000
3610#define BM_40_46 BM_46_40
3611#define BM_47_40 0x0000ff0000000000
3612#define BM_40_47 BM_47_40
3613#define BM_48_40 0x0001ff0000000000
3614#define BM_40_48 BM_48_40
3615#define BM_49_40 0x0003ff0000000000
3616#define BM_40_49 BM_49_40
3617#define BM_50_40 0x0007ff0000000000
3618#define BM_40_50 BM_50_40
3619#define BM_51_40 0x000fff0000000000
3620#define BM_40_51 BM_51_40
3621#define BM_52_40 0x001fff0000000000
3622#define BM_40_52 BM_52_40
3623#define BM_53_40 0x003fff0000000000
3624#define BM_40_53 BM_53_40
3625#define BM_54_40 0x007fff0000000000
3626#define BM_40_54 BM_54_40
3627#define BM_55_40 0x00ffff0000000000
3628#define BM_40_55 BM_55_40
3629#define BM_56_40 0x01ffff0000000000
3630#define BM_40_56 BM_56_40
3631#define BM_57_40 0x03ffff0000000000
3632#define BM_40_57 BM_57_40
3633#define BM_58_40 0x07ffff0000000000
3634#define BM_40_58 BM_58_40
3635#define BM_59_40 0x0fffff0000000000
3636#define BM_40_59 BM_59_40
3637#define BM_60_40 0x1fffff0000000000
3638#define BM_40_60 BM_60_40
3639#define BM_61_40 0x3fffff0000000000
3640#define BM_40_61 BM_61_40
3641#define BM_62_40 0x7fffff0000000000
3642#define BM_40_62 BM_62_40
3643#define BM_63_40 0xffffff0000000000
3644#define BM_40_63 BM_63_40
3645#define BM_41_41 0x0000020000000000
3646#define BM_42_41 0x0000060000000000
3647#define BM_41_42 BM_42_41
3648#define BM_43_41 0x00000e0000000000
3649#define BM_41_43 BM_43_41
3650#define BM_44_41 0x00001e0000000000
3651#define BM_41_44 BM_44_41
3652#define BM_45_41 0x00003e0000000000
3653#define BM_41_45 BM_45_41
3654#define BM_46_41 0x00007e0000000000
3655#define BM_41_46 BM_46_41
3656#define BM_47_41 0x0000fe0000000000
3657#define BM_41_47 BM_47_41
3658#define BM_48_41 0x0001fe0000000000
3659#define BM_41_48 BM_48_41
3660#define BM_49_41 0x0003fe0000000000
3661#define BM_41_49 BM_49_41
3662#define BM_50_41 0x0007fe0000000000
3663#define BM_41_50 BM_50_41
3664#define BM_51_41 0x000ffe0000000000
3665#define BM_41_51 BM_51_41
3666#define BM_52_41 0x001ffe0000000000
3667#define BM_41_52 BM_52_41
3668#define BM_53_41 0x003ffe0000000000
3669#define BM_41_53 BM_53_41
3670#define BM_54_41 0x007ffe0000000000
3671#define BM_41_54 BM_54_41
3672#define BM_55_41 0x00fffe0000000000
3673#define BM_41_55 BM_55_41
3674#define BM_56_41 0x01fffe0000000000
3675#define BM_41_56 BM_56_41
3676#define BM_57_41 0x03fffe0000000000
3677#define BM_41_57 BM_57_41
3678#define BM_58_41 0x07fffe0000000000
3679#define BM_41_58 BM_58_41
3680#define BM_59_41 0x0ffffe0000000000
3681#define BM_41_59 BM_59_41
3682#define BM_60_41 0x1ffffe0000000000
3683#define BM_41_60 BM_60_41
3684#define BM_61_41 0x3ffffe0000000000
3685#define BM_41_61 BM_61_41
3686#define BM_62_41 0x7ffffe0000000000
3687#define BM_41_62 BM_62_41
3688#define BM_63_41 0xfffffe0000000000
3689#define BM_41_63 BM_63_41
3690#define BM_42_42 0x0000040000000000
3691#define BM_43_42 0x00000c0000000000
3692#define BM_42_43 BM_43_42
3693#define BM_44_42 0x00001c0000000000
3694#define BM_42_44 BM_44_42
3695#define BM_45_42 0x00003c0000000000
3696#define BM_42_45 BM_45_42
3697#define BM_46_42 0x00007c0000000000
3698#define BM_42_46 BM_46_42
3699#define BM_47_42 0x0000fc0000000000
3700#define BM_42_47 BM_47_42
3701#define BM_48_42 0x0001fc0000000000
3702#define BM_42_48 BM_48_42
3703#define BM_49_42 0x0003fc0000000000
3704#define BM_42_49 BM_49_42
3705#define BM_50_42 0x0007fc0000000000
3706#define BM_42_50 BM_50_42
3707#define BM_51_42 0x000ffc0000000000
3708#define BM_42_51 BM_51_42
3709#define BM_52_42 0x001ffc0000000000
3710#define BM_42_52 BM_52_42
3711#define BM_53_42 0x003ffc0000000000
3712#define BM_42_53 BM_53_42
3713#define BM_54_42 0x007ffc0000000000
3714#define BM_42_54 BM_54_42
3715#define BM_55_42 0x00fffc0000000000
3716#define BM_42_55 BM_55_42
3717#define BM_56_42 0x01fffc0000000000
3718#define BM_42_56 BM_56_42
3719#define BM_57_42 0x03fffc0000000000
3720#define BM_42_57 BM_57_42
3721#define BM_58_42 0x07fffc0000000000
3722#define BM_42_58 BM_58_42
3723#define BM_59_42 0x0ffffc0000000000
3724#define BM_42_59 BM_59_42
3725#define BM_60_42 0x1ffffc0000000000
3726#define BM_42_60 BM_60_42
3727#define BM_61_42 0x3ffffc0000000000
3728#define BM_42_61 BM_61_42
3729#define BM_62_42 0x7ffffc0000000000
3730#define BM_42_62 BM_62_42
3731#define BM_63_42 0xfffffc0000000000
3732#define BM_42_63 BM_63_42
3733#define BM_43_43 0x0000080000000000
3734#define BM_44_43 0x0000180000000000
3735#define BM_43_44 BM_44_43
3736#define BM_45_43 0x0000380000000000
3737#define BM_43_45 BM_45_43
3738#define BM_46_43 0x0000780000000000
3739#define BM_43_46 BM_46_43
3740#define BM_47_43 0x0000f80000000000
3741#define BM_43_47 BM_47_43
3742#define BM_48_43 0x0001f80000000000
3743#define BM_43_48 BM_48_43
3744#define BM_49_43 0x0003f80000000000
3745#define BM_43_49 BM_49_43
3746#define BM_50_43 0x0007f80000000000
3747#define BM_43_50 BM_50_43
3748#define BM_51_43 0x000ff80000000000
3749#define BM_43_51 BM_51_43
3750#define BM_52_43 0x001ff80000000000
3751#define BM_43_52 BM_52_43
3752#define BM_53_43 0x003ff80000000000
3753#define BM_43_53 BM_53_43
3754#define BM_54_43 0x007ff80000000000
3755#define BM_43_54 BM_54_43
3756#define BM_55_43 0x00fff80000000000
3757#define BM_43_55 BM_55_43
3758#define BM_56_43 0x01fff80000000000
3759#define BM_43_56 BM_56_43
3760#define BM_57_43 0x03fff80000000000
3761#define BM_43_57 BM_57_43
3762#define BM_58_43 0x07fff80000000000
3763#define BM_43_58 BM_58_43
3764#define BM_59_43 0x0ffff80000000000
3765#define BM_43_59 BM_59_43
3766#define BM_60_43 0x1ffff80000000000
3767#define BM_43_60 BM_60_43
3768#define BM_61_43 0x3ffff80000000000
3769#define BM_43_61 BM_61_43
3770#define BM_62_43 0x7ffff80000000000
3771#define BM_43_62 BM_62_43
3772#define BM_63_43 0xfffff80000000000
3773#define BM_43_63 BM_63_43
3774#define BM_44_44 0x0000100000000000
3775#define BM_45_44 0x0000300000000000
3776#define BM_44_45 BM_45_44
3777#define BM_46_44 0x0000700000000000
3778#define BM_44_46 BM_46_44
3779#define BM_47_44 0x0000f00000000000
3780#define BM_44_47 BM_47_44
3781#define BM_48_44 0x0001f00000000000
3782#define BM_44_48 BM_48_44
3783#define BM_49_44 0x0003f00000000000
3784#define BM_44_49 BM_49_44
3785#define BM_50_44 0x0007f00000000000
3786#define BM_44_50 BM_50_44
3787#define BM_51_44 0x000ff00000000000
3788#define BM_44_51 BM_51_44
3789#define BM_52_44 0x001ff00000000000
3790#define BM_44_52 BM_52_44
3791#define BM_53_44 0x003ff00000000000
3792#define BM_44_53 BM_53_44
3793#define BM_54_44 0x007ff00000000000
3794#define BM_44_54 BM_54_44
3795#define BM_55_44 0x00fff00000000000
3796#define BM_44_55 BM_55_44
3797#define BM_56_44 0x01fff00000000000
3798#define BM_44_56 BM_56_44
3799#define BM_57_44 0x03fff00000000000
3800#define BM_44_57 BM_57_44
3801#define BM_58_44 0x07fff00000000000
3802#define BM_44_58 BM_58_44
3803#define BM_59_44 0x0ffff00000000000
3804#define BM_44_59 BM_59_44
3805#define BM_60_44 0x1ffff00000000000
3806#define BM_44_60 BM_60_44
3807#define BM_61_44 0x3ffff00000000000
3808#define BM_44_61 BM_61_44
3809#define BM_62_44 0x7ffff00000000000
3810#define BM_44_62 BM_62_44
3811#define BM_63_44 0xfffff00000000000
3812#define BM_44_63 BM_63_44
3813#define BM_45_45 0x0000200000000000
3814#define BM_46_45 0x0000600000000000
3815#define BM_45_46 BM_46_45
3816#define BM_47_45 0x0000e00000000000
3817#define BM_45_47 BM_47_45
3818#define BM_48_45 0x0001e00000000000
3819#define BM_45_48 BM_48_45
3820#define BM_49_45 0x0003e00000000000
3821#define BM_45_49 BM_49_45
3822#define BM_50_45 0x0007e00000000000
3823#define BM_45_50 BM_50_45
3824#define BM_51_45 0x000fe00000000000
3825#define BM_45_51 BM_51_45
3826#define BM_52_45 0x001fe00000000000
3827#define BM_45_52 BM_52_45
3828#define BM_53_45 0x003fe00000000000
3829#define BM_45_53 BM_53_45
3830#define BM_54_45 0x007fe00000000000
3831#define BM_45_54 BM_54_45
3832#define BM_55_45 0x00ffe00000000000
3833#define BM_45_55 BM_55_45
3834#define BM_56_45 0x01ffe00000000000
3835#define BM_45_56 BM_56_45
3836#define BM_57_45 0x03ffe00000000000
3837#define BM_45_57 BM_57_45
3838#define BM_58_45 0x07ffe00000000000
3839#define BM_45_58 BM_58_45
3840#define BM_59_45 0x0fffe00000000000
3841#define BM_45_59 BM_59_45
3842#define BM_60_45 0x1fffe00000000000
3843#define BM_45_60 BM_60_45
3844#define BM_61_45 0x3fffe00000000000
3845#define BM_45_61 BM_61_45
3846#define BM_62_45 0x7fffe00000000000
3847#define BM_45_62 BM_62_45
3848#define BM_63_45 0xffffe00000000000
3849#define BM_45_63 BM_63_45
3850#define BM_46_46 0x0000400000000000
3851#define BM_47_46 0x0000c00000000000
3852#define BM_46_47 BM_47_46
3853#define BM_48_46 0x0001c00000000000
3854#define BM_46_48 BM_48_46
3855#define BM_49_46 0x0003c00000000000
3856#define BM_46_49 BM_49_46
3857#define BM_50_46 0x0007c00000000000
3858#define BM_46_50 BM_50_46
3859#define BM_51_46 0x000fc00000000000
3860#define BM_46_51 BM_51_46
3861#define BM_52_46 0x001fc00000000000
3862#define BM_46_52 BM_52_46
3863#define BM_53_46 0x003fc00000000000
3864#define BM_46_53 BM_53_46
3865#define BM_54_46 0x007fc00000000000
3866#define BM_46_54 BM_54_46
3867#define BM_55_46 0x00ffc00000000000
3868#define BM_46_55 BM_55_46
3869#define BM_56_46 0x01ffc00000000000
3870#define BM_46_56 BM_56_46
3871#define BM_57_46 0x03ffc00000000000
3872#define BM_46_57 BM_57_46
3873#define BM_58_46 0x07ffc00000000000
3874#define BM_46_58 BM_58_46
3875#define BM_59_46 0x0fffc00000000000
3876#define BM_46_59 BM_59_46
3877#define BM_60_46 0x1fffc00000000000
3878#define BM_46_60 BM_60_46
3879#define BM_61_46 0x3fffc00000000000
3880#define BM_46_61 BM_61_46
3881#define BM_62_46 0x7fffc00000000000
3882#define BM_46_62 BM_62_46
3883#define BM_63_46 0xffffc00000000000
3884#define BM_46_63 BM_63_46
3885#define BM_47_47 0x0000800000000000
3886#define BM_48_47 0x0001800000000000
3887#define BM_47_48 BM_48_47
3888#define BM_49_47 0x0003800000000000
3889#define BM_47_49 BM_49_47
3890#define BM_50_47 0x0007800000000000
3891#define BM_47_50 BM_50_47
3892#define BM_51_47 0x000f800000000000
3893#define BM_47_51 BM_51_47
3894#define BM_52_47 0x001f800000000000
3895#define BM_47_52 BM_52_47
3896#define BM_53_47 0x003f800000000000
3897#define BM_47_53 BM_53_47
3898#define BM_54_47 0x007f800000000000
3899#define BM_47_54 BM_54_47
3900#define BM_55_47 0x00ff800000000000
3901#define BM_47_55 BM_55_47
3902#define BM_56_47 0x01ff800000000000
3903#define BM_47_56 BM_56_47
3904#define BM_57_47 0x03ff800000000000
3905#define BM_47_57 BM_57_47
3906#define BM_58_47 0x07ff800000000000
3907#define BM_47_58 BM_58_47
3908#define BM_59_47 0x0fff800000000000
3909#define BM_47_59 BM_59_47
3910#define BM_60_47 0x1fff800000000000
3911#define BM_47_60 BM_60_47
3912#define BM_61_47 0x3fff800000000000
3913#define BM_47_61 BM_61_47
3914#define BM_62_47 0x7fff800000000000
3915#define BM_47_62 BM_62_47
3916#define BM_63_47 0xffff800000000000
3917#define BM_47_63 BM_63_47
3918#define BM_48_48 0x0001000000000000
3919#define BM_49_48 0x0003000000000000
3920#define BM_48_49 BM_49_48
3921#define BM_50_48 0x0007000000000000
3922#define BM_48_50 BM_50_48
3923#define BM_51_48 0x000f000000000000
3924#define BM_48_51 BM_51_48
3925#define BM_52_48 0x001f000000000000
3926#define BM_48_52 BM_52_48
3927#define BM_53_48 0x003f000000000000
3928#define BM_48_53 BM_53_48
3929#define BM_54_48 0x007f000000000000
3930#define BM_48_54 BM_54_48
3931#define BM_55_48 0x00ff000000000000
3932#define BM_48_55 BM_55_48
3933#define BM_56_48 0x01ff000000000000
3934#define BM_48_56 BM_56_48
3935#define BM_57_48 0x03ff000000000000
3936#define BM_48_57 BM_57_48
3937#define BM_58_48 0x07ff000000000000
3938#define BM_48_58 BM_58_48
3939#define BM_59_48 0x0fff000000000000
3940#define BM_48_59 BM_59_48
3941#define BM_60_48 0x1fff000000000000
3942#define BM_48_60 BM_60_48
3943#define BM_61_48 0x3fff000000000000
3944#define BM_48_61 BM_61_48
3945#define BM_62_48 0x7fff000000000000
3946#define BM_48_62 BM_62_48
3947#define BM_63_48 0xffff000000000000
3948#define BM_48_63 BM_63_48
3949#define BM_49_49 0x0002000000000000
3950#define BM_50_49 0x0006000000000000
3951#define BM_49_50 BM_50_49
3952#define BM_51_49 0x000e000000000000
3953#define BM_49_51 BM_51_49
3954#define BM_52_49 0x001e000000000000
3955#define BM_49_52 BM_52_49
3956#define BM_53_49 0x003e000000000000
3957#define BM_49_53 BM_53_49
3958#define BM_54_49 0x007e000000000000
3959#define BM_49_54 BM_54_49
3960#define BM_55_49 0x00fe000000000000
3961#define BM_49_55 BM_55_49
3962#define BM_56_49 0x01fe000000000000
3963#define BM_49_56 BM_56_49
3964#define BM_57_49 0x03fe000000000000
3965#define BM_49_57 BM_57_49
3966#define BM_58_49 0x07fe000000000000
3967#define BM_49_58 BM_58_49
3968#define BM_59_49 0x0ffe000000000000
3969#define BM_49_59 BM_59_49
3970#define BM_60_49 0x1ffe000000000000
3971#define BM_49_60 BM_60_49
3972#define BM_61_49 0x3ffe000000000000
3973#define BM_49_61 BM_61_49
3974#define BM_62_49 0x7ffe000000000000
3975#define BM_49_62 BM_62_49
3976#define BM_63_49 0xfffe000000000000
3977#define BM_49_63 BM_63_49
3978#define BM_50_50 0x0004000000000000
3979#define BM_51_50 0x000c000000000000
3980#define BM_50_51 BM_51_50
3981#define BM_52_50 0x001c000000000000
3982#define BM_50_52 BM_52_50
3983#define BM_53_50 0x003c000000000000
3984#define BM_50_53 BM_53_50
3985#define BM_54_50 0x007c000000000000
3986#define BM_50_54 BM_54_50
3987#define BM_55_50 0x00fc000000000000
3988#define BM_50_55 BM_55_50
3989#define BM_56_50 0x01fc000000000000
3990#define BM_50_56 BM_56_50
3991#define BM_57_50 0x03fc000000000000
3992#define BM_50_57 BM_57_50
3993#define BM_58_50 0x07fc000000000000
3994#define BM_50_58 BM_58_50
3995#define BM_59_50 0x0ffc000000000000
3996#define BM_50_59 BM_59_50
3997#define BM_60_50 0x1ffc000000000000
3998#define BM_50_60 BM_60_50
3999#define BM_61_50 0x3ffc000000000000
4000#define BM_50_61 BM_61_50
4001#define BM_62_50 0x7ffc000000000000
4002#define BM_50_62 BM_62_50
4003#define BM_63_50 0xfffc000000000000
4004#define BM_50_63 BM_63_50
4005#define BM_51_51 0x0008000000000000
4006#define BM_52_51 0x0018000000000000
4007#define BM_51_52 BM_52_51
4008#define BM_53_51 0x0038000000000000
4009#define BM_51_53 BM_53_51
4010#define BM_54_51 0x0078000000000000
4011#define BM_51_54 BM_54_51
4012#define BM_55_51 0x00f8000000000000
4013#define BM_51_55 BM_55_51
4014#define BM_56_51 0x01f8000000000000
4015#define BM_51_56 BM_56_51
4016#define BM_57_51 0x03f8000000000000
4017#define BM_51_57 BM_57_51
4018#define BM_58_51 0x07f8000000000000
4019#define BM_51_58 BM_58_51
4020#define BM_59_51 0x0ff8000000000000
4021#define BM_51_59 BM_59_51
4022#define BM_60_51 0x1ff8000000000000
4023#define BM_51_60 BM_60_51
4024#define BM_61_51 0x3ff8000000000000
4025#define BM_51_61 BM_61_51
4026#define BM_62_51 0x7ff8000000000000
4027#define BM_51_62 BM_62_51
4028#define BM_63_51 0xfff8000000000000
4029#define BM_51_63 BM_63_51
4030#define BM_52_52 0x0010000000000000
4031#define BM_53_52 0x0030000000000000
4032#define BM_52_53 BM_53_52
4033#define BM_54_52 0x0070000000000000
4034#define BM_52_54 BM_54_52
4035#define BM_55_52 0x00f0000000000000
4036#define BM_52_55 BM_55_52
4037#define BM_56_52 0x01f0000000000000
4038#define BM_52_56 BM_56_52
4039#define BM_57_52 0x03f0000000000000
4040#define BM_52_57 BM_57_52
4041#define BM_58_52 0x07f0000000000000
4042#define BM_52_58 BM_58_52
4043#define BM_59_52 0x0ff0000000000000
4044#define BM_52_59 BM_59_52
4045#define BM_60_52 0x1ff0000000000000
4046#define BM_52_60 BM_60_52
4047#define BM_61_52 0x3ff0000000000000
4048#define BM_52_61 BM_61_52
4049#define BM_62_52 0x7ff0000000000000
4050#define BM_52_62 BM_62_52
4051#define BM_63_52 0xfff0000000000000
4052#define BM_52_63 BM_63_52
4053#define BM_53_53 0x0020000000000000
4054#define BM_54_53 0x0060000000000000
4055#define BM_53_54 BM_54_53
4056#define BM_55_53 0x00e0000000000000
4057#define BM_53_55 BM_55_53
4058#define BM_56_53 0x01e0000000000000
4059#define BM_53_56 BM_56_53
4060#define BM_57_53 0x03e0000000000000
4061#define BM_53_57 BM_57_53
4062#define BM_58_53 0x07e0000000000000
4063#define BM_53_58 BM_58_53
4064#define BM_59_53 0x0fe0000000000000
4065#define BM_53_59 BM_59_53
4066#define BM_60_53 0x1fe0000000000000
4067#define BM_53_60 BM_60_53
4068#define BM_61_53 0x3fe0000000000000
4069#define BM_53_61 BM_61_53
4070#define BM_62_53 0x7fe0000000000000
4071#define BM_53_62 BM_62_53
4072#define BM_63_53 0xffe0000000000000
4073#define BM_53_63 BM_63_53
4074#define BM_54_54 0x0040000000000000
4075#define BM_55_54 0x00c0000000000000
4076#define BM_54_55 BM_55_54
4077#define BM_56_54 0x01c0000000000000
4078#define BM_54_56 BM_56_54
4079#define BM_57_54 0x03c0000000000000
4080#define BM_54_57 BM_57_54
4081#define BM_58_54 0x07c0000000000000
4082#define BM_54_58 BM_58_54
4083#define BM_59_54 0x0fc0000000000000
4084#define BM_54_59 BM_59_54
4085#define BM_60_54 0x1fc0000000000000
4086#define BM_54_60 BM_60_54
4087#define BM_61_54 0x3fc0000000000000
4088#define BM_54_61 BM_61_54
4089#define BM_62_54 0x7fc0000000000000
4090#define BM_54_62 BM_62_54
4091#define BM_63_54 0xffc0000000000000
4092#define BM_54_63 BM_63_54
4093#define BM_55_55 0x0080000000000000
4094#define BM_56_55 0x0180000000000000
4095#define BM_55_56 BM_56_55
4096#define BM_57_55 0x0380000000000000
4097#define BM_55_57 BM_57_55
4098#define BM_58_55 0x0780000000000000
4099#define BM_55_58 BM_58_55
4100#define BM_59_55 0x0f80000000000000
4101#define BM_55_59 BM_59_55
4102#define BM_60_55 0x1f80000000000000
4103#define BM_55_60 BM_60_55
4104#define BM_61_55 0x3f80000000000000
4105#define BM_55_61 BM_61_55
4106#define BM_62_55 0x7f80000000000000
4107#define BM_55_62 BM_62_55
4108#define BM_63_55 0xff80000000000000
4109#define BM_55_63 BM_63_55
4110#define BM_56_56 0x0100000000000000
4111#define BM_57_56 0x0300000000000000
4112#define BM_56_57 BM_57_56
4113#define BM_58_56 0x0700000000000000
4114#define BM_56_58 BM_58_56
4115#define BM_59_56 0x0f00000000000000
4116#define BM_56_59 BM_59_56
4117#define BM_60_56 0x1f00000000000000
4118#define BM_56_60 BM_60_56
4119#define BM_61_56 0x3f00000000000000
4120#define BM_56_61 BM_61_56
4121#define BM_62_56 0x7f00000000000000
4122#define BM_56_62 BM_62_56
4123#define BM_63_56 0xff00000000000000
4124#define BM_56_63 BM_63_56
4125#define BM_57_57 0x0200000000000000
4126#define BM_58_57 0x0600000000000000
4127#define BM_57_58 BM_58_57
4128#define BM_59_57 0x0e00000000000000
4129#define BM_57_59 BM_59_57
4130#define BM_60_57 0x1e00000000000000
4131#define BM_57_60 BM_60_57
4132#define BM_61_57 0x3e00000000000000
4133#define BM_57_61 BM_61_57
4134#define BM_62_57 0x7e00000000000000
4135#define BM_57_62 BM_62_57
4136#define BM_63_57 0xfe00000000000000
4137#define BM_57_63 BM_63_57
4138#define BM_58_58 0x0400000000000000
4139#define BM_59_58 0x0c00000000000000
4140#define BM_58_59 BM_59_58
4141#define BM_60_58 0x1c00000000000000
4142#define BM_58_60 BM_60_58
4143#define BM_61_58 0x3c00000000000000
4144#define BM_58_61 BM_61_58
4145#define BM_62_58 0x7c00000000000000
4146#define BM_58_62 BM_62_58
4147#define BM_63_58 0xfc00000000000000
4148#define BM_58_63 BM_63_58
4149#define BM_59_59 0x0800000000000000
4150#define BM_60_59 0x1800000000000000
4151#define BM_59_60 BM_60_59
4152#define BM_61_59 0x3800000000000000
4153#define BM_59_61 BM_61_59
4154#define BM_62_59 0x7800000000000000
4155#define BM_59_62 BM_62_59
4156#define BM_63_59 0xf800000000000000
4157#define BM_59_63 BM_63_59
4158#define BM_60_60 0x1000000000000000
4159#define BM_61_60 0x3000000000000000
4160#define BM_60_61 BM_61_60
4161#define BM_62_60 0x7000000000000000
4162#define BM_60_62 BM_62_60
4163#define BM_63_60 0xf000000000000000
4164#define BM_60_63 BM_63_60
4165#define BM_61_61 0x2000000000000000
4166#define BM_62_61 0x6000000000000000
4167#define BM_61_62 BM_62_61
4168#define BM_63_61 0xe000000000000000
4169#define BM_61_63 BM_63_61
4170#define BM_62_62 0x4000000000000000
4171#define BM_63_62 0xc000000000000000
4172#define BM_62_63 BM_63_62
4173#define BM_63_63 0x8000000000000000
4174
4175#endif
4176
4177#endif /* __ASM_TX4927_TX4927_MIPS_H */
diff --git a/include/asm-mips/tx4927/tx4927_pci.h b/include/asm-mips/tx4927/tx4927_pci.h
new file mode 100644
index 000000000000..170433492246
--- /dev/null
+++ b/include/asm-mips/tx4927/tx4927_pci.h
@@ -0,0 +1,275 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000-2001 Toshiba Corporation
7 */
8#ifndef __ASM_TX4927_TX4927_PCI_H
9#define __ASM_TX4927_TX4927_PCI_H
10
11#define TX4927_CCFG_TOE 0x00004000
12
13#define TX4927_PCIMEM 0x08000000
14#define TX4927_PCIMEM_SIZE 0x08000000
15#define TX4927_PCIIO 0x16000000
16#define TX4927_PCIIO_SIZE 0x01000000
17
18#define TX4927_SDRAMC_REG 0xff1f8000
19#define TX4927_EBUSC_REG 0xff1f9000
20#define TX4927_PCIC_REG 0xff1fd000
21#define TX4927_CCFG_REG 0xff1fe000
22#define TX4927_IRC_REG 0xff1ff600
23#define TX4927_CE3 0x17f00000 /* 1M */
24#define TX4927_PCIRESET_ADDR 0xbc00f006
25#define TX4927_PCI_CLK_ADDR (KSEG1 + TX4927_CE3 + 0x00040020)
26
27#define TX4927_IMSTAT_ADDR(n) (KSEG1 + TX4927_CE3 + 0x0004001a + (n))
28#define tx4927_imstat_ptr(n) \
29 ((volatile unsigned char *)TX4927_IMSTAT_ADDR(n))
30
31/* bits for ISTAT3/IMASK3/IMSTAT3 */
32#define TX4927_INT3B_PCID 0
33#define TX4927_INT3B_PCIC 1
34#define TX4927_INT3B_PCIB 2
35#define TX4927_INT3B_PCIA 3
36#define TX4927_INT3F_PCID (1 << TX4927_INT3B_PCID)
37#define TX4927_INT3F_PCIC (1 << TX4927_INT3B_PCIC)
38#define TX4927_INT3F_PCIB (1 << TX4927_INT3B_PCIB)
39#define TX4927_INT3F_PCIA (1 << TX4927_INT3B_PCIA)
40
41/* bits for PCI_CLK (S6) */
42#define TX4927_PCI_CLK_HOST 0x80
43#define TX4927_PCI_CLK_MASK (0x0f << 3)
44#define TX4927_PCI_CLK_33 (0x01 << 3)
45#define TX4927_PCI_CLK_25 (0x04 << 3)
46#define TX4927_PCI_CLK_66 (0x09 << 3)
47#define TX4927_PCI_CLK_50 (0x0c << 3)
48#define TX4927_PCI_CLK_ACK 0x04
49#define TX4927_PCI_CLK_ACE 0x02
50#define TX4927_PCI_CLK_ENDIAN 0x01
51#define TX4927_NR_IRQ_LOCAL (8+16)
52#define TX4927_NR_IRQ_IRC 32 /* On-Chip IRC */
53
54#define TX4927_IR_PCIC 16
55#define TX4927_IR_PCIERR 22
56#define TX4927_IR_PCIPMA 23
57#define TX4927_IRQ_IRC_PCIC (TX4927_NR_IRQ_LOCAL + TX4927_IR_PCIC)
58#define TX4927_IRQ_IRC_PCIERR (TX4927_NR_IRQ_LOCAL + TX4927_IR_PCIERR)
59#define TX4927_IRQ_IOC1 (TX4927_NR_IRQ_LOCAL + TX4927_NR_IRQ_IRC)
60#define TX4927_IRQ_IOC_PCID (TX4927_IRQ_IOC1 + TX4927_INT3B_PCID)
61#define TX4927_IRQ_IOC_PCIC (TX4927_IRQ_IOC1 + TX4927_INT3B_PCIC)
62#define TX4927_IRQ_IOC_PCIB (TX4927_IRQ_IOC1 + TX4927_INT3B_PCIB)
63#define TX4927_IRQ_IOC_PCIA (TX4927_IRQ_IOC1 + TX4927_INT3B_PCIA)
64
65#ifdef _LANGUAGE_ASSEMBLY
66#define _CONST64(c) c
67#else
68#define _CONST64(c) c##ull
69
70#include <asm/byteorder.h>
71
72#define tx4927_pcireset_ptr \
73 ((volatile unsigned char *)TX4927_PCIRESET_ADDR)
74#define tx4927_pci_clk_ptr \
75 ((volatile unsigned char *)TX4927_PCI_CLK_ADDR)
76
77struct tx4927_sdramc_reg {
78 volatile unsigned long long cr[4];
79 volatile unsigned long long unused0[4];
80 volatile unsigned long long tr;
81 volatile unsigned long long unused1[2];
82 volatile unsigned long long cmd;
83};
84
85struct tx4927_ebusc_reg {
86 volatile unsigned long long cr[8];
87};
88
89struct tx4927_ccfg_reg {
90 volatile unsigned long long ccfg;
91 volatile unsigned long long crir;
92 volatile unsigned long long pcfg;
93 volatile unsigned long long tear;
94 volatile unsigned long long clkctr;
95 volatile unsigned long long unused0;
96 volatile unsigned long long garbc;
97 volatile unsigned long long unused1;
98 volatile unsigned long long unused2;
99 volatile unsigned long long ramp;
100};
101
102struct tx4927_irc_reg {
103 volatile unsigned long cer;
104 volatile unsigned long cr[2];
105 volatile unsigned long unused0;
106 volatile unsigned long ilr[8];
107 volatile unsigned long unused1[4];
108 volatile unsigned long imr;
109 volatile unsigned long unused2[7];
110 volatile unsigned long scr;
111 volatile unsigned long unused3[7];
112 volatile unsigned long ssr;
113 volatile unsigned long unused4[7];
114 volatile unsigned long csr;
115};
116
117struct tx4927_pcic_reg {
118 volatile unsigned long pciid;
119 volatile unsigned long pcistatus;
120 volatile unsigned long pciccrev;
121 volatile unsigned long pcicfg1;
122 volatile unsigned long p2gm0plbase; /* +10 */
123 volatile unsigned long p2gm0pubase;
124 volatile unsigned long p2gm1plbase;
125 volatile unsigned long p2gm1pubase;
126 volatile unsigned long p2gm2pbase; /* +20 */
127 volatile unsigned long p2giopbase;
128 volatile unsigned long unused0;
129 volatile unsigned long pcisid;
130 volatile unsigned long unused1; /* +30 */
131 volatile unsigned long pcicapptr;
132 volatile unsigned long unused2;
133 volatile unsigned long pcicfg2;
134 volatile unsigned long g2ptocnt; /* +40 */
135 volatile unsigned long unused3[15];
136 volatile unsigned long g2pstatus; /* +80 */
137 volatile unsigned long g2pmask;
138 volatile unsigned long pcisstatus;
139 volatile unsigned long pcimask;
140 volatile unsigned long p2gcfg; /* +90 */
141 volatile unsigned long p2gstatus;
142 volatile unsigned long p2gmask;
143 volatile unsigned long p2gccmd;
144 volatile unsigned long unused4[24]; /* +a0 */
145 volatile unsigned long pbareqport; /* +100 */
146 volatile unsigned long pbacfg;
147 volatile unsigned long pbastatus;
148 volatile unsigned long pbamask;
149 volatile unsigned long pbabm; /* +110 */
150 volatile unsigned long pbacreq;
151 volatile unsigned long pbacgnt;
152 volatile unsigned long pbacstate;
153 volatile unsigned long long g2pmgbase[3]; /* +120 */
154 volatile unsigned long long g2piogbase;
155 volatile unsigned long g2pmmask[3]; /* +140 */
156 volatile unsigned long g2piomask;
157 volatile unsigned long long g2pmpbase[3]; /* +150 */
158 volatile unsigned long long g2piopbase;
159 volatile unsigned long pciccfg; /* +170 */
160 volatile unsigned long pcicstatus;
161 volatile unsigned long pcicmask;
162 volatile unsigned long unused5;
163 volatile unsigned long long p2gmgbase[3]; /* +180 */
164 volatile unsigned long long p2giogbase;
165 volatile unsigned long g2pcfgadrs; /* +1a0 */
166 volatile unsigned long g2pcfgdata;
167 volatile unsigned long unused6[8];
168 volatile unsigned long g2pintack;
169 volatile unsigned long g2pspc;
170 volatile unsigned long unused7[12]; /* +1d0 */
171 volatile unsigned long long pdmca; /* +200 */
172 volatile unsigned long long pdmga;
173 volatile unsigned long long pdmpa;
174 volatile unsigned long long pdmcut;
175 volatile unsigned long long pdmcnt; /* +220 */
176 volatile unsigned long long pdmsts;
177 volatile unsigned long long unused8[2];
178 volatile unsigned long long pdmdb[4]; /* +240 */
179 volatile unsigned long long pdmtdh; /* +260 */
180 volatile unsigned long long pdmdms;
181};
182
183#endif /* _LANGUAGE_ASSEMBLY */
184
185/* IRCSR : Int. Current Status */
186#define TX4927_IRCSR_IF 0x00010000
187#define TX4927_IRCSR_ILV_MASK 0x00000700
188#define TX4927_IRCSR_IVL_MASK 0x0000001f
189
190/*
191 * PCIC
192 */
193
194/* bits for G2PSTATUS/G2PMASK */
195#define TX4927_PCIC_G2PSTATUS_ALL 0x00000003
196#define TX4927_PCIC_G2PSTATUS_TTOE 0x00000002
197#define TX4927_PCIC_G2PSTATUS_RTOE 0x00000001
198
199/* bits for PCIMASK (see also PCI_STATUS_XXX in linux/pci.h */
200#define TX4927_PCIC_PCISTATUS_ALL 0x0000f900
201
202/* bits for PBACFG */
203#define TX4927_PCIC_PBACFG_RPBA 0x00000004
204#define TX4927_PCIC_PBACFG_PBAEN 0x00000002
205#define TX4927_PCIC_PBACFG_BMCEN 0x00000001
206
207/* bits for G2PMnGBASE */
208#define TX4927_PCIC_G2PMnGBASE_BSDIS _CONST64(0x0000002000000000)
209#define TX4927_PCIC_G2PMnGBASE_ECHG _CONST64(0x0000001000000000)
210
211/* bits for G2PIOGBASE */
212#define TX4927_PCIC_G2PIOGBASE_BSDIS _CONST64(0x0000002000000000)
213#define TX4927_PCIC_G2PIOGBASE_ECHG _CONST64(0x0000001000000000)
214
215/* bits for PCICSTATUS/PCICMASK */
216#define TX4927_PCIC_PCICSTATUS_ALL 0x000007dc
217
218/* bits for PCICCFG */
219#define TX4927_PCIC_PCICCFG_LBWC_MASK 0x0fff0000
220#define TX4927_PCIC_PCICCFG_HRST 0x00000800
221#define TX4927_PCIC_PCICCFG_SRST 0x00000400
222#define TX4927_PCIC_PCICCFG_IRBER 0x00000200
223#define TX4927_PCIC_PCICCFG_IMSE0 0x00000100
224#define TX4927_PCIC_PCICCFG_IMSE1 0x00000080
225#define TX4927_PCIC_PCICCFG_IMSE2 0x00000040
226#define TX4927_PCIC_PCICCFG_IISE 0x00000020
227#define TX4927_PCIC_PCICCFG_ATR 0x00000010
228#define TX4927_PCIC_PCICCFG_ICAE 0x00000008
229
230/* bits for P2GMnGBASE */
231#define TX4927_PCIC_P2GMnGBASE_TMEMEN _CONST64(0x0000004000000000)
232#define TX4927_PCIC_P2GMnGBASE_TBSDIS _CONST64(0x0000002000000000)
233#define TX4927_PCIC_P2GMnGBASE_TECHG _CONST64(0x0000001000000000)
234
235/* bits for P2GIOGBASE */
236#define TX4927_PCIC_P2GIOGBASE_TIOEN _CONST64(0x0000004000000000)
237#define TX4927_PCIC_P2GIOGBASE_TBSDIS _CONST64(0x0000002000000000)
238#define TX4927_PCIC_P2GIOGBASE_TECHG _CONST64(0x0000001000000000)
239
240#define TX4927_PCIC_IDSEL_AD_TO_SLOT(ad) ((ad) - 11)
241#define TX4927_PCIC_MAX_DEVNU TX4927_PCIC_IDSEL_AD_TO_SLOT(32)
242
243/*
244 * CCFG
245 */
246/* CCFG : Chip Configuration */
247#define TX4927_CCFG_PCI66 0x00800000
248#define TX4927_CCFG_PCIMIDE 0x00400000
249#define TX4927_CCFG_PCIXARB 0x00002000
250#define TX4927_CCFG_PCIDIVMODE_MASK 0x00001800
251#define TX4927_CCFG_PCIDIVMODE_2_5 0x00000000
252#define TX4927_CCFG_PCIDIVMODE_3 0x00000800
253#define TX4927_CCFG_PCIDIVMODE_5 0x00001000
254#define TX4927_CCFG_PCIDIVMODE_6 0x00001800
255
256/* PCFG : Pin Configuration */
257#define TX4927_PCFG_PCICLKEN_ALL 0x003f0000
258#define TX4927_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
259
260/* CLKCTR : Clock Control */
261#define TX4927_CLKCTR_PCICKD 0x00400000
262#define TX4927_CLKCTR_PCIRST 0x00000040
263
264
265#ifndef _LANGUAGE_ASSEMBLY
266
267#define tx4927_sdramcptr ((struct tx4927_sdramc_reg *)TX4927_SDRAMC_REG)
268#define tx4927_pcicptr ((struct tx4927_pcic_reg *)TX4927_PCIC_REG)
269#define tx4927_ccfgptr ((struct tx4927_ccfg_reg *)TX4927_CCFG_REG)
270#define tx4927_ebuscptr ((struct tx4927_ebusc_reg *)TX4927_EBUSC_REG)
271#define tx4927_ircptr ((struct tx4927_irc_reg *)TX4927_IRC_REG)
272
273#endif /* _LANGUAGE_ASSEMBLY */
274
275#endif /* __ASM_TX4927_TX4927_PCI_H */
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h
new file mode 100644
index 000000000000..d2f0c76b00a9
--- /dev/null
+++ b/include/asm-mips/types.h
@@ -0,0 +1,108 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 1995, 1996, 1999 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_TYPES_H
10#define _ASM_TYPES_H
11
12#ifndef __ASSEMBLY__
13
14typedef unsigned short umode_t;
15
16/*
17 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
18 * header files exported to user space
19 */
20
21typedef __signed__ char __s8;
22typedef unsigned char __u8;
23
24typedef __signed__ short __s16;
25typedef unsigned short __u16;
26
27typedef __signed__ int __s32;
28typedef unsigned int __u32;
29
30#if (_MIPS_SZLONG == 64)
31
32typedef __signed__ long __s64;
33typedef unsigned long __u64;
34
35#else
36
37#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
38typedef __signed__ long long __s64;
39typedef unsigned long long __u64;
40#endif
41
42#endif
43
44#endif /* __ASSEMBLY__ */
45
46/*
47 * These aren't exported outside the kernel to avoid name space clashes
48 */
49#ifdef __KERNEL__
50
51#define BITS_PER_LONG _MIPS_SZLONG
52
53#ifndef __ASSEMBLY__
54
55#include <linux/config.h>
56
57typedef __signed char s8;
58typedef unsigned char u8;
59
60typedef __signed short s16;
61typedef unsigned short u16;
62
63typedef __signed int s32;
64typedef unsigned int u32;
65
66#if (_MIPS_SZLONG == 64)
67
68typedef __signed__ long s64;
69typedef unsigned long u64;
70
71#else
72
73#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
74typedef __signed__ long long s64;
75typedef unsigned long long u64;
76#endif
77
78#endif
79
80#if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \
81 || defined(CONFIG_MIPS64)
82typedef u64 dma_addr_t;
83#else
84typedef u32 dma_addr_t;
85#endif
86typedef u64 dma64_addr_t;
87
88/*
89 * Don't use phys_t. You've been warned.
90 */
91#ifdef CONFIG_64BIT_PHYS_ADDR
92typedef unsigned long long phys_t;
93#else
94typedef unsigned long phys_t;
95#endif
96
97#ifdef CONFIG_LBD
98typedef u64 sector_t;
99#define HAVE_SECTOR_T
100#endif
101
102typedef unsigned short kmem_bufctl_t;
103
104#endif /* __ASSEMBLY__ */
105
106#endif /* __KERNEL__ */
107
108#endif /* _ASM_TYPES_H */
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
new file mode 100644
index 000000000000..07114898e065
--- /dev/null
+++ b/include/asm-mips/uaccess.h
@@ -0,0 +1,830 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 03, 04 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_UACCESS_H
10#define _ASM_UACCESS_H
11
12#include <linux/config.h>
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/thread_info.h>
16#include <asm-generic/uaccess.h>
17
18/*
19 * The fs value determines whether argument validity checking should be
20 * performed or not. If get_fs() == USER_DS, checking is performed, with
21 * get_fs() == KERNEL_DS, checking is bypassed.
22 *
23 * For historical reasons, these macros are grossly misnamed.
24 */
25#ifdef CONFIG_MIPS32
26
27#define __UA_LIMIT 0x80000000UL
28
29#define __UA_ADDR ".word"
30#define __UA_LA "la"
31#define __UA_ADDU "addu"
32#define __UA_t0 "$8"
33#define __UA_t1 "$9"
34
35#endif /* CONFIG_MIPS32 */
36
37#ifdef CONFIG_MIPS64
38
39#define __UA_LIMIT (- TASK_SIZE)
40
41#define __UA_ADDR ".dword"
42#define __UA_LA "dla"
43#define __UA_ADDU "daddu"
44#define __UA_t0 "$12"
45#define __UA_t1 "$13"
46
47#endif /* CONFIG_MIPS64 */
48
49/*
50 * USER_DS is a bitmask that has the bits set that may not be set in a valid
51 * userspace address. Note that we limit 32-bit userspace to 0x7fff8000 but
52 * the arithmetic we're doing only works if the limit is a power of two, so
53 * we use 0x80000000 here on 32-bit kernels. If a process passes an invalid
54 * address in this range it's the process's problem, not ours :-)
55 */
56
57#define KERNEL_DS ((mm_segment_t) { 0UL })
58#define USER_DS ((mm_segment_t) { __UA_LIMIT })
59
60#define VERIFY_READ 0
61#define VERIFY_WRITE 1
62
63#define get_ds() (KERNEL_DS)
64#define get_fs() (current_thread_info()->addr_limit)
65#define set_fs(x) (current_thread_info()->addr_limit = (x))
66
67#define segment_eq(a,b) ((a).seg == (b).seg)
68
69
70/*
71 * Is a address valid? This does a straighforward calculation rather
72 * than tests.
73 *
74 * Address valid if:
75 * - "addr" doesn't have any high-bits set
76 * - AND "size" doesn't have any high-bits set
77 * - AND "addr+size" doesn't have any high-bits set
78 * - OR we are in kernel mode.
79 *
80 * __ua_size() is a trick to avoid runtime checking of positive constant
81 * sizes; for those we already know at compile time that the size is ok.
82 */
83#define __ua_size(size) \
84 ((__builtin_constant_p(size) && (signed long) (size) > 0) ? 0 : (size))
85
86/*
87 * access_ok: - Checks if a user space pointer is valid
88 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
89 * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
90 * to write to a block, it is always safe to read from it.
91 * @addr: User space pointer to start of block to check
92 * @size: Size of block to check
93 *
94 * Context: User context only. This function may sleep.
95 *
96 * Checks if a pointer to a block of memory in user space is valid.
97 *
98 * Returns true (nonzero) if the memory block may be valid, false (zero)
99 * if it is definitely invalid.
100 *
101 * Note that, depending on architecture, this function probably just
102 * checks that the pointer is in the user space range - after calling
103 * this function, memory access functions may still return -EFAULT.
104 */
105
106#define __access_mask get_fs().seg
107
108#define __access_ok(addr, size, mask) \
109 (((signed long)((mask) & ((addr) | ((addr) + (size)) | __ua_size(size)))) == 0)
110
111#define access_ok(type, addr, size) \
112 likely(__access_ok((unsigned long)(addr), (size),__access_mask))
113
114/*
115 * verify_area: - Obsolete/deprecated and will go away soon,
116 * use access_ok() instead.
117 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE
118 * @addr: User space pointer to start of block to check
119 * @size: Size of block to check
120 *
121 * Context: User context only. This function may sleep.
122 *
123 * This function has been replaced by access_ok().
124 *
125 * Checks if a pointer to a block of memory in user space is valid.
126 *
127 * Returns zero if the memory block may be valid, -EFAULT
128 * if it is definitely invalid.
129 *
130 * See access_ok() for more details.
131 */
132static inline int __deprecated verify_area(int type, const void * addr, unsigned long size)
133{
134 return access_ok(type, addr, size) ? 0 : -EFAULT;
135}
136
137/*
138 * put_user: - Write a simple value into user space.
139 * @x: Value to copy to user space.
140 * @ptr: Destination address, in user space.
141 *
142 * Context: User context only. This function may sleep.
143 *
144 * This macro copies a single simple value from kernel space to user
145 * space. It supports simple types like char and int, but not larger
146 * data types like structures or arrays.
147 *
148 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
149 * to the result of dereferencing @ptr.
150 *
151 * Returns zero on success, or -EFAULT on error.
152 */
153#define put_user(x,ptr) \
154 __put_user_check((x),(ptr),sizeof(*(ptr)))
155
156/*
157 * get_user: - Get a simple variable from user space.
158 * @x: Variable to store result.
159 * @ptr: Source address, in user space.
160 *
161 * Context: User context only. This function may sleep.
162 *
163 * This macro copies a single simple variable from user space to kernel
164 * space. It supports simple types like char and int, but not larger
165 * data types like structures or arrays.
166 *
167 * @ptr must have pointer-to-simple-variable type, and the result of
168 * dereferencing @ptr must be assignable to @x without a cast.
169 *
170 * Returns zero on success, or -EFAULT on error.
171 * On error, the variable @x is set to zero.
172 */
173#define get_user(x,ptr) \
174 __get_user_check((x),(ptr),sizeof(*(ptr)))
175
176/*
177 * __put_user: - Write a simple value into user space, with less checking.
178 * @x: Value to copy to user space.
179 * @ptr: Destination address, in user space.
180 *
181 * Context: User context only. This function may sleep.
182 *
183 * This macro copies a single simple value from kernel space to user
184 * space. It supports simple types like char and int, but not larger
185 * data types like structures or arrays.
186 *
187 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
188 * to the result of dereferencing @ptr.
189 *
190 * Caller must check the pointer with access_ok() before calling this
191 * function.
192 *
193 * Returns zero on success, or -EFAULT on error.
194 */
195#define __put_user(x,ptr) \
196 __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
197
198/*
199 * __get_user: - Get a simple variable from user space, with less checking.
200 * @x: Variable to store result.
201 * @ptr: Source address, in user space.
202 *
203 * Context: User context only. This function may sleep.
204 *
205 * This macro copies a single simple variable from user space to kernel
206 * space. It supports simple types like char and int, but not larger
207 * data types like structures or arrays.
208 *
209 * @ptr must have pointer-to-simple-variable type, and the result of
210 * dereferencing @ptr must be assignable to @x without a cast.
211 *
212 * Caller must check the pointer with access_ok() before calling this
213 * function.
214 *
215 * Returns zero on success, or -EFAULT on error.
216 * On error, the variable @x is set to zero.
217 */
218#define __get_user(x,ptr) \
219 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
220
221struct __large_struct { unsigned long buf[100]; };
222#define __m(x) (*(struct __large_struct *)(x))
223
224/*
225 * Yuck. We need two variants, one for 64bit operation and one
226 * for 32 bit mode and old iron.
227 */
228#ifdef __mips64
229#define __GET_USER_DW(__gu_err) __get_user_asm("ld", __gu_err)
230#else
231#define __GET_USER_DW(__gu_err) __get_user_asm_ll32(__gu_err)
232#endif
233
234#define __get_user_nocheck(x,ptr,size) \
235({ \
236 __typeof(*(ptr)) __gu_val = 0; \
237 long __gu_addr; \
238 long __gu_err = 0; \
239 \
240 might_sleep(); \
241 __gu_addr = (long) (ptr); \
242 switch (size) { \
243 case 1: __get_user_asm("lb", __gu_err); break; \
244 case 2: __get_user_asm("lh", __gu_err); break; \
245 case 4: __get_user_asm("lw", __gu_err); break; \
246 case 8: __GET_USER_DW(__gu_err); break; \
247 default: __get_user_unknown(); break; \
248 } \
249 x = (__typeof__(*(ptr))) __gu_val; \
250 __gu_err; \
251})
252
253#define __get_user_check(x,ptr,size) \
254({ \
255 __typeof__(*(ptr)) __gu_val = 0; \
256 long __gu_addr; \
257 long __gu_err; \
258 \
259 might_sleep(); \
260 __gu_addr = (long) (ptr); \
261 __gu_err = access_ok(VERIFY_READ, (void *) __gu_addr, size) \
262 ? 0 : -EFAULT; \
263 \
264 if (likely(!__gu_err)) { \
265 switch (size) { \
266 case 1: __get_user_asm("lb", __gu_err); break; \
267 case 2: __get_user_asm("lh", __gu_err); break; \
268 case 4: __get_user_asm("lw", __gu_err); break; \
269 case 8: __GET_USER_DW(__gu_err); break; \
270 default: __get_user_unknown(); break; \
271 } \
272 } \
273 x = (__typeof__(*(ptr))) __gu_val; \
274 __gu_err; \
275})
276
277#define __get_user_asm(insn,__gu_err) \
278({ \
279 __asm__ __volatile__( \
280 "1: " insn " %1, %3 \n" \
281 "2: \n" \
282 " .section .fixup,\"ax\" \n" \
283 "3: li %0, %4 \n" \
284 " j 2b \n" \
285 " .previous \n" \
286 " .section __ex_table,\"a\" \n" \
287 " "__UA_ADDR "\t1b, 3b \n" \
288 " .previous \n" \
289 : "=r" (__gu_err), "=r" (__gu_val) \
290 : "0" (__gu_err), "o" (__m(__gu_addr)), "i" (-EFAULT)); \
291})
292
293/*
294 * Get a long long 64 using 32 bit registers.
295 */
296#define __get_user_asm_ll32(__gu_err) \
297({ \
298 __asm__ __volatile__( \
299 "1: lw %1, %3 \n" \
300 "2: lw %D1, %4 \n" \
301 " move %0, $0 \n" \
302 "3: .section .fixup,\"ax\" \n" \
303 "4: li %0, %5 \n" \
304 " move %1, $0 \n" \
305 " move %D1, $0 \n" \
306 " j 3b \n" \
307 " .previous \n" \
308 " .section __ex_table,\"a\" \n" \
309 " " __UA_ADDR " 1b, 4b \n" \
310 " " __UA_ADDR " 2b, 4b \n" \
311 " .previous \n" \
312 : "=r" (__gu_err), "=&r" (__gu_val) \
313 : "0" (__gu_err), "o" (__m(__gu_addr)), \
314 "o" (__m(__gu_addr + 4)), "i" (-EFAULT)); \
315})
316
317extern void __get_user_unknown(void);
318
319/*
320 * Yuck. We need two variants, one for 64bit operation and one
321 * for 32 bit mode and old iron.
322 */
323#ifdef __mips64
324#define __PUT_USER_DW(__pu_val) __put_user_asm("sd", __pu_val)
325#else
326#define __PUT_USER_DW(__pu_val) __put_user_asm_ll32(__pu_val)
327#endif
328
329#define __put_user_nocheck(x,ptr,size) \
330({ \
331 __typeof__(*(ptr)) __pu_val; \
332 long __pu_addr; \
333 long __pu_err = 0; \
334 \
335 might_sleep(); \
336 __pu_val = (x); \
337 __pu_addr = (long) (ptr); \
338 switch (size) { \
339 case 1: __put_user_asm("sb", __pu_val); break; \
340 case 2: __put_user_asm("sh", __pu_val); break; \
341 case 4: __put_user_asm("sw", __pu_val); break; \
342 case 8: __PUT_USER_DW(__pu_val); break; \
343 default: __put_user_unknown(); break; \
344 } \
345 __pu_err; \
346})
347
348#define __put_user_check(x,ptr,size) \
349({ \
350 __typeof__(*(ptr)) __pu_val; \
351 long __pu_addr; \
352 long __pu_err; \
353 \
354 might_sleep(); \
355 __pu_val = (x); \
356 __pu_addr = (long) (ptr); \
357 __pu_err = access_ok(VERIFY_WRITE, (void *) __pu_addr, size) \
358 ? 0 : -EFAULT; \
359 \
360 if (likely(!__pu_err)) { \
361 switch (size) { \
362 case 1: __put_user_asm("sb", __pu_val); break; \
363 case 2: __put_user_asm("sh", __pu_val); break; \
364 case 4: __put_user_asm("sw", __pu_val); break; \
365 case 8: __PUT_USER_DW(__pu_val); break; \
366 default: __put_user_unknown(); break; \
367 } \
368 } \
369 __pu_err; \
370})
371
372#define __put_user_asm(insn, __pu_val) \
373({ \
374 __asm__ __volatile__( \
375 "1: " insn " %z2, %3 # __put_user_asm\n" \
376 "2: \n" \
377 " .section .fixup,\"ax\" \n" \
378 "3: li %0, %4 \n" \
379 " j 2b \n" \
380 " .previous \n" \
381 " .section __ex_table,\"a\" \n" \
382 " " __UA_ADDR " 1b, 3b \n" \
383 " .previous \n" \
384 : "=r" (__pu_err) \
385 : "0" (__pu_err), "Jr" (__pu_val), "o" (__m(__pu_addr)), \
386 "i" (-EFAULT)); \
387})
388
389#define __put_user_asm_ll32(__pu_val) \
390({ \
391 __asm__ __volatile__( \
392 "1: sw %2, %3 # __put_user_asm_ll32 \n" \
393 "2: sw %D2, %4 \n" \
394 "3: \n" \
395 " .section .fixup,\"ax\" \n" \
396 "4: li %0, %5 \n" \
397 " j 3b \n" \
398 " .previous \n" \
399 " .section __ex_table,\"a\" \n" \
400 " " __UA_ADDR " 1b, 4b \n" \
401 " " __UA_ADDR " 2b, 4b \n" \
402 " .previous" \
403 : "=r" (__pu_err) \
404 : "0" (__pu_err), "r" (__pu_val), "o" (__m(__pu_addr)), \
405 "o" (__m(__pu_addr + 4)), "i" (-EFAULT)); \
406})
407
408extern void __put_user_unknown(void);
409
410/*
411 * We're generating jump to subroutines which will be outside the range of
412 * jump instructions
413 */
414#ifdef MODULE
415#define __MODULE_JAL(destination) \
416 ".set\tnoat\n\t" \
417 __UA_LA "\t$1, " #destination "\n\t" \
418 "jalr\t$1\n\t" \
419 ".set\tat\n\t"
420#else
421#define __MODULE_JAL(destination) \
422 "jal\t" #destination "\n\t"
423#endif
424
425extern size_t __copy_user(void *__to, const void *__from, size_t __n);
426
427#define __invoke_copy_to_user(to,from,n) \
428({ \
429 register void *__cu_to_r __asm__ ("$4"); \
430 register const void *__cu_from_r __asm__ ("$5"); \
431 register long __cu_len_r __asm__ ("$6"); \
432 \
433 __cu_to_r = (to); \
434 __cu_from_r = (from); \
435 __cu_len_r = (n); \
436 __asm__ __volatile__( \
437 __MODULE_JAL(__copy_user) \
438 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
439 : \
440 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
441 "memory"); \
442 __cu_len_r; \
443})
444
445/*
446 * __copy_to_user: - Copy a block of data into user space, with less checking.
447 * @to: Destination address, in user space.
448 * @from: Source address, in kernel space.
449 * @n: Number of bytes to copy.
450 *
451 * Context: User context only. This function may sleep.
452 *
453 * Copy data from kernel space to user space. Caller must check
454 * the specified block with access_ok() before calling this function.
455 *
456 * Returns number of bytes that could not be copied.
457 * On success, this will be zero.
458 */
459#define __copy_to_user(to,from,n) \
460({ \
461 void *__cu_to; \
462 const void *__cu_from; \
463 long __cu_len; \
464 \
465 might_sleep(); \
466 __cu_to = (to); \
467 __cu_from = (from); \
468 __cu_len = (n); \
469 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, __cu_len); \
470 __cu_len; \
471})
472
473#define __copy_to_user_inatomic __copy_to_user
474#define __copy_from_user_inatomic __copy_from_user
475
476/*
477 * copy_to_user: - Copy a block of data into user space.
478 * @to: Destination address, in user space.
479 * @from: Source address, in kernel space.
480 * @n: Number of bytes to copy.
481 *
482 * Context: User context only. This function may sleep.
483 *
484 * Copy data from kernel space to user space.
485 *
486 * Returns number of bytes that could not be copied.
487 * On success, this will be zero.
488 */
489#define copy_to_user(to,from,n) \
490({ \
491 void *__cu_to; \
492 const void *__cu_from; \
493 long __cu_len; \
494 \
495 might_sleep(); \
496 __cu_to = (to); \
497 __cu_from = (from); \
498 __cu_len = (n); \
499 if (access_ok(VERIFY_WRITE, __cu_to, __cu_len)) \
500 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, \
501 __cu_len); \
502 __cu_len; \
503})
504
505#define __invoke_copy_from_user(to,from,n) \
506({ \
507 register void *__cu_to_r __asm__ ("$4"); \
508 register const void *__cu_from_r __asm__ ("$5"); \
509 register long __cu_len_r __asm__ ("$6"); \
510 \
511 __cu_to_r = (to); \
512 __cu_from_r = (from); \
513 __cu_len_r = (n); \
514 __asm__ __volatile__( \
515 ".set\tnoreorder\n\t" \
516 __MODULE_JAL(__copy_user) \
517 ".set\tnoat\n\t" \
518 __UA_ADDU "\t$1, %1, %2\n\t" \
519 ".set\tat\n\t" \
520 ".set\treorder" \
521 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
522 : \
523 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
524 "memory"); \
525 __cu_len_r; \
526})
527
528/*
529 * __copy_from_user: - Copy a block of data from user space, with less checking. * @to: Destination address, in kernel space.
530 * @from: Source address, in user space.
531 * @n: Number of bytes to copy.
532 *
533 * Context: User context only. This function may sleep.
534 *
535 * Copy data from user space to kernel space. Caller must check
536 * the specified block with access_ok() before calling this function.
537 *
538 * Returns number of bytes that could not be copied.
539 * On success, this will be zero.
540 *
541 * If some data could not be copied, this function will pad the copied
542 * data to the requested size using zero bytes.
543 */
544#define __copy_from_user(to,from,n) \
545({ \
546 void *__cu_to; \
547 const void *__cu_from; \
548 long __cu_len; \
549 \
550 might_sleep(); \
551 __cu_to = (to); \
552 __cu_from = (from); \
553 __cu_len = (n); \
554 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
555 __cu_len); \
556 __cu_len; \
557})
558
559/*
560 * copy_from_user: - Copy a block of data from user space.
561 * @to: Destination address, in kernel space.
562 * @from: Source address, in user space.
563 * @n: Number of bytes to copy.
564 *
565 * Context: User context only. This function may sleep.
566 *
567 * Copy data from user space to kernel space.
568 *
569 * Returns number of bytes that could not be copied.
570 * On success, this will be zero.
571 *
572 * If some data could not be copied, this function will pad the copied
573 * data to the requested size using zero bytes.
574 */
575#define copy_from_user(to,from,n) \
576({ \
577 void *__cu_to; \
578 const void *__cu_from; \
579 long __cu_len; \
580 \
581 might_sleep(); \
582 __cu_to = (to); \
583 __cu_from = (from); \
584 __cu_len = (n); \
585 if (access_ok(VERIFY_READ, __cu_from, __cu_len)) \
586 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
587 __cu_len); \
588 __cu_len; \
589})
590
591#define __copy_in_user(to, from, n) __copy_from_user(to, from, n)
592
593#define copy_in_user(to,from,n) \
594({ \
595 void *__cu_to; \
596 const void *__cu_from; \
597 long __cu_len; \
598 \
599 might_sleep(); \
600 __cu_to = (to); \
601 __cu_from = (from); \
602 __cu_len = (n); \
603 if (likely(access_ok(VERIFY_READ, __cu_from, __cu_len) && \
604 access_ok(VERIFY_WRITE, __cu_to, __cu_len))) \
605 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
606 __cu_len); \
607 __cu_len; \
608})
609
610/*
611 * __clear_user: - Zero a block of memory in user space, with less checking.
612 * @to: Destination address, in user space.
613 * @n: Number of bytes to zero.
614 *
615 * Zero a block of memory in user space. Caller must check
616 * the specified block with access_ok() before calling this function.
617 *
618 * Returns number of bytes that could not be cleared.
619 * On success, this will be zero.
620 */
621static inline __kernel_size_t
622__clear_user(void *addr, __kernel_size_t size)
623{
624 __kernel_size_t res;
625
626 might_sleep();
627 __asm__ __volatile__(
628 "move\t$4, %1\n\t"
629 "move\t$5, $0\n\t"
630 "move\t$6, %2\n\t"
631 __MODULE_JAL(__bzero)
632 "move\t%0, $6"
633 : "=r" (res)
634 : "r" (addr), "r" (size)
635 : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
636
637 return res;
638}
639
640#define clear_user(addr,n) \
641({ \
642 void * __cl_addr = (addr); \
643 unsigned long __cl_size = (n); \
644 if (__cl_size && access_ok(VERIFY_WRITE, \
645 ((unsigned long)(__cl_addr)), __cl_size)) \
646 __cl_size = __clear_user(__cl_addr, __cl_size); \
647 __cl_size; \
648})
649
650/*
651 * __strncpy_from_user: - Copy a NUL terminated string from userspace, with less checking.
652 * @dst: Destination address, in kernel space. This buffer must be at
653 * least @count bytes long.
654 * @src: Source address, in user space.
655 * @count: Maximum number of bytes to copy, including the trailing NUL.
656 *
657 * Copies a NUL-terminated string from userspace to kernel space.
658 * Caller must check the specified block with access_ok() before calling
659 * this function.
660 *
661 * On success, returns the length of the string (not including the trailing
662 * NUL).
663 *
664 * If access to userspace fails, returns -EFAULT (some data may have been
665 * copied).
666 *
667 * If @count is smaller than the length of the string, copies @count bytes
668 * and returns @count.
669 */
670static inline long
671__strncpy_from_user(char *__to, const char *__from, long __len)
672{
673 long res;
674
675 might_sleep();
676 __asm__ __volatile__(
677 "move\t$4, %1\n\t"
678 "move\t$5, %2\n\t"
679 "move\t$6, %3\n\t"
680 __MODULE_JAL(__strncpy_from_user_nocheck_asm)
681 "move\t%0, $2"
682 : "=r" (res)
683 : "r" (__to), "r" (__from), "r" (__len)
684 : "$2", "$3", "$4", "$5", "$6", __UA_t0, "$31", "memory");
685
686 return res;
687}
688
689/*
690 * strncpy_from_user: - Copy a NUL terminated string from userspace.
691 * @dst: Destination address, in kernel space. This buffer must be at
692 * least @count bytes long.
693 * @src: Source address, in user space.
694 * @count: Maximum number of bytes to copy, including the trailing NUL.
695 *
696 * Copies a NUL-terminated string from userspace to kernel space.
697 *
698 * On success, returns the length of the string (not including the trailing
699 * NUL).
700 *
701 * If access to userspace fails, returns -EFAULT (some data may have been
702 * copied).
703 *
704 * If @count is smaller than the length of the string, copies @count bytes
705 * and returns @count.
706 */
707static inline long
708strncpy_from_user(char *__to, const char *__from, long __len)
709{
710 long res;
711
712 might_sleep();
713 __asm__ __volatile__(
714 "move\t$4, %1\n\t"
715 "move\t$5, %2\n\t"
716 "move\t$6, %3\n\t"
717 __MODULE_JAL(__strncpy_from_user_asm)
718 "move\t%0, $2"
719 : "=r" (res)
720 : "r" (__to), "r" (__from), "r" (__len)
721 : "$2", "$3", "$4", "$5", "$6", __UA_t0, "$31", "memory");
722
723 return res;
724}
725
726/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
727static inline long __strlen_user(const char *s)
728{
729 long res;
730
731 might_sleep();
732 __asm__ __volatile__(
733 "move\t$4, %1\n\t"
734 __MODULE_JAL(__strlen_user_nocheck_asm)
735 "move\t%0, $2"
736 : "=r" (res)
737 : "r" (s)
738 : "$2", "$4", __UA_t0, "$31");
739
740 return res;
741}
742
743/*
744 * strlen_user: - Get the size of a string in user space.
745 * @str: The string to measure.
746 *
747 * Context: User context only. This function may sleep.
748 *
749 * Get the size of a NUL-terminated string in user space.
750 *
751 * Returns the size of the string INCLUDING the terminating NUL.
752 * On exception, returns 0.
753 *
754 * If there is a limit on the length of a valid string, you may wish to
755 * consider using strnlen_user() instead.
756 */
757static inline long strlen_user(const char *s)
758{
759 long res;
760
761 might_sleep();
762 __asm__ __volatile__(
763 "move\t$4, %1\n\t"
764 __MODULE_JAL(__strlen_user_asm)
765 "move\t%0, $2"
766 : "=r" (res)
767 : "r" (s)
768 : "$2", "$4", __UA_t0, "$31");
769
770 return res;
771}
772
773/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
774static inline long __strnlen_user(const char *s, long n)
775{
776 long res;
777
778 might_sleep();
779 __asm__ __volatile__(
780 "move\t$4, %1\n\t"
781 "move\t$5, %2\n\t"
782 __MODULE_JAL(__strnlen_user_nocheck_asm)
783 "move\t%0, $2"
784 : "=r" (res)
785 : "r" (s), "r" (n)
786 : "$2", "$4", "$5", __UA_t0, "$31");
787
788 return res;
789}
790
791/*
792 * strlen_user: - Get the size of a string in user space.
793 * @str: The string to measure.
794 *
795 * Context: User context only. This function may sleep.
796 *
797 * Get the size of a NUL-terminated string in user space.
798 *
799 * Returns the size of the string INCLUDING the terminating NUL.
800 * On exception, returns 0.
801 *
802 * If there is a limit on the length of a valid string, you may wish to
803 * consider using strnlen_user() instead.
804 */
805static inline long strnlen_user(const char *s, long n)
806{
807 long res;
808
809 might_sleep();
810 __asm__ __volatile__(
811 "move\t$4, %1\n\t"
812 "move\t$5, %2\n\t"
813 __MODULE_JAL(__strnlen_user_asm)
814 "move\t%0, $2"
815 : "=r" (res)
816 : "r" (s), "r" (n)
817 : "$2", "$4", "$5", __UA_t0, "$31");
818
819 return res;
820}
821
822struct exception_table_entry
823{
824 unsigned long insn;
825 unsigned long nextinsn;
826};
827
828extern int fixup_exception(struct pt_regs *regs);
829
830#endif /* _ASM_UACCESS_H */
diff --git a/include/asm-mips/ucontext.h b/include/asm-mips/ucontext.h
new file mode 100644
index 000000000000..8a4b20e88b81
--- /dev/null
+++ b/include/asm-mips/ucontext.h
@@ -0,0 +1,21 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Low level exception handling
7 *
8 * Copyright (C) 1998, 1999 by Ralf Baechle
9 */
10#ifndef _ASM_UCONTEXT_H
11#define _ASM_UCONTEXT_H
12
13struct ucontext {
14 unsigned long uc_flags;
15 struct ucontext *uc_link;
16 stack_t uc_stack;
17 struct sigcontext uc_mcontext;
18 sigset_t uc_sigmask; /* mask last for extensibility */
19};
20
21#endif /* _ASM_UCONTEXT_H */
diff --git a/include/asm-mips/unaligned.h b/include/asm-mips/unaligned.h
new file mode 100644
index 000000000000..a0042563838a
--- /dev/null
+++ b/include/asm-mips/unaligned.h
@@ -0,0 +1,14 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 1999, 2000, 2001, 2003 by Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_UNALIGNED_H
10#define _ASM_UNALIGNED_H
11
12#include <asm-generic/unaligned.h>
13
14#endif /* _ASM_UNALIGNED_H */
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
new file mode 100644
index 000000000000..6d21cc964f76
--- /dev/null
+++ b/include/asm-mips/unistd.h
@@ -0,0 +1,1185 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 *
9 * Changed system calls macros _syscall5 - _syscall7 to push args 5 to 7 onto
10 * the stack. Robin Farine for ACN S.A, Copyright (C) 1996 by ACN S.A
11 */
12#ifndef _ASM_UNISTD_H
13#define _ASM_UNISTD_H
14
15#include <asm/sgidefs.h>
16
17#if _MIPS_SIM == _MIPS_SIM_ABI32
18
19/*
20 * Linux o32 style syscalls are in the range from 4000 to 4999.
21 */
22#define __NR_Linux 4000
23#define __NR_syscall (__NR_Linux + 0)
24#define __NR_exit (__NR_Linux + 1)
25#define __NR_fork (__NR_Linux + 2)
26#define __NR_read (__NR_Linux + 3)
27#define __NR_write (__NR_Linux + 4)
28#define __NR_open (__NR_Linux + 5)
29#define __NR_close (__NR_Linux + 6)
30#define __NR_waitpid (__NR_Linux + 7)
31#define __NR_creat (__NR_Linux + 8)
32#define __NR_link (__NR_Linux + 9)
33#define __NR_unlink (__NR_Linux + 10)
34#define __NR_execve (__NR_Linux + 11)
35#define __NR_chdir (__NR_Linux + 12)
36#define __NR_time (__NR_Linux + 13)
37#define __NR_mknod (__NR_Linux + 14)
38#define __NR_chmod (__NR_Linux + 15)
39#define __NR_lchown (__NR_Linux + 16)
40#define __NR_break (__NR_Linux + 17)
41#define __NR_unused18 (__NR_Linux + 18)
42#define __NR_lseek (__NR_Linux + 19)
43#define __NR_getpid (__NR_Linux + 20)
44#define __NR_mount (__NR_Linux + 21)
45#define __NR_umount (__NR_Linux + 22)
46#define __NR_setuid (__NR_Linux + 23)
47#define __NR_getuid (__NR_Linux + 24)
48#define __NR_stime (__NR_Linux + 25)
49#define __NR_ptrace (__NR_Linux + 26)
50#define __NR_alarm (__NR_Linux + 27)
51#define __NR_unused28 (__NR_Linux + 28)
52#define __NR_pause (__NR_Linux + 29)
53#define __NR_utime (__NR_Linux + 30)
54#define __NR_stty (__NR_Linux + 31)
55#define __NR_gtty (__NR_Linux + 32)
56#define __NR_access (__NR_Linux + 33)
57#define __NR_nice (__NR_Linux + 34)
58#define __NR_ftime (__NR_Linux + 35)
59#define __NR_sync (__NR_Linux + 36)
60#define __NR_kill (__NR_Linux + 37)
61#define __NR_rename (__NR_Linux + 38)
62#define __NR_mkdir (__NR_Linux + 39)
63#define __NR_rmdir (__NR_Linux + 40)
64#define __NR_dup (__NR_Linux + 41)
65#define __NR_pipe (__NR_Linux + 42)
66#define __NR_times (__NR_Linux + 43)
67#define __NR_prof (__NR_Linux + 44)
68#define __NR_brk (__NR_Linux + 45)
69#define __NR_setgid (__NR_Linux + 46)
70#define __NR_getgid (__NR_Linux + 47)
71#define __NR_signal (__NR_Linux + 48)
72#define __NR_geteuid (__NR_Linux + 49)
73#define __NR_getegid (__NR_Linux + 50)
74#define __NR_acct (__NR_Linux + 51)
75#define __NR_umount2 (__NR_Linux + 52)
76#define __NR_lock (__NR_Linux + 53)
77#define __NR_ioctl (__NR_Linux + 54)
78#define __NR_fcntl (__NR_Linux + 55)
79#define __NR_mpx (__NR_Linux + 56)
80#define __NR_setpgid (__NR_Linux + 57)
81#define __NR_ulimit (__NR_Linux + 58)
82#define __NR_unused59 (__NR_Linux + 59)
83#define __NR_umask (__NR_Linux + 60)
84#define __NR_chroot (__NR_Linux + 61)
85#define __NR_ustat (__NR_Linux + 62)
86#define __NR_dup2 (__NR_Linux + 63)
87#define __NR_getppid (__NR_Linux + 64)
88#define __NR_getpgrp (__NR_Linux + 65)
89#define __NR_setsid (__NR_Linux + 66)
90#define __NR_sigaction (__NR_Linux + 67)
91#define __NR_sgetmask (__NR_Linux + 68)
92#define __NR_ssetmask (__NR_Linux + 69)
93#define __NR_setreuid (__NR_Linux + 70)
94#define __NR_setregid (__NR_Linux + 71)
95#define __NR_sigsuspend (__NR_Linux + 72)
96#define __NR_sigpending (__NR_Linux + 73)
97#define __NR_sethostname (__NR_Linux + 74)
98#define __NR_setrlimit (__NR_Linux + 75)
99#define __NR_getrlimit (__NR_Linux + 76)
100#define __NR_getrusage (__NR_Linux + 77)
101#define __NR_gettimeofday (__NR_Linux + 78)
102#define __NR_settimeofday (__NR_Linux + 79)
103#define __NR_getgroups (__NR_Linux + 80)
104#define __NR_setgroups (__NR_Linux + 81)
105#define __NR_reserved82 (__NR_Linux + 82)
106#define __NR_symlink (__NR_Linux + 83)
107#define __NR_unused84 (__NR_Linux + 84)
108#define __NR_readlink (__NR_Linux + 85)
109#define __NR_uselib (__NR_Linux + 86)
110#define __NR_swapon (__NR_Linux + 87)
111#define __NR_reboot (__NR_Linux + 88)
112#define __NR_readdir (__NR_Linux + 89)
113#define __NR_mmap (__NR_Linux + 90)
114#define __NR_munmap (__NR_Linux + 91)
115#define __NR_truncate (__NR_Linux + 92)
116#define __NR_ftruncate (__NR_Linux + 93)
117#define __NR_fchmod (__NR_Linux + 94)
118#define __NR_fchown (__NR_Linux + 95)
119#define __NR_getpriority (__NR_Linux + 96)
120#define __NR_setpriority (__NR_Linux + 97)
121#define __NR_profil (__NR_Linux + 98)
122#define __NR_statfs (__NR_Linux + 99)
123#define __NR_fstatfs (__NR_Linux + 100)
124#define __NR_ioperm (__NR_Linux + 101)
125#define __NR_socketcall (__NR_Linux + 102)
126#define __NR_syslog (__NR_Linux + 103)
127#define __NR_setitimer (__NR_Linux + 104)
128#define __NR_getitimer (__NR_Linux + 105)
129#define __NR_stat (__NR_Linux + 106)
130#define __NR_lstat (__NR_Linux + 107)
131#define __NR_fstat (__NR_Linux + 108)
132#define __NR_unused109 (__NR_Linux + 109)
133#define __NR_iopl (__NR_Linux + 110)
134#define __NR_vhangup (__NR_Linux + 111)
135#define __NR_idle (__NR_Linux + 112)
136#define __NR_vm86 (__NR_Linux + 113)
137#define __NR_wait4 (__NR_Linux + 114)
138#define __NR_swapoff (__NR_Linux + 115)
139#define __NR_sysinfo (__NR_Linux + 116)
140#define __NR_ipc (__NR_Linux + 117)
141#define __NR_fsync (__NR_Linux + 118)
142#define __NR_sigreturn (__NR_Linux + 119)
143#define __NR_clone (__NR_Linux + 120)
144#define __NR_setdomainname (__NR_Linux + 121)
145#define __NR_uname (__NR_Linux + 122)
146#define __NR_modify_ldt (__NR_Linux + 123)
147#define __NR_adjtimex (__NR_Linux + 124)
148#define __NR_mprotect (__NR_Linux + 125)
149#define __NR_sigprocmask (__NR_Linux + 126)
150#define __NR_create_module (__NR_Linux + 127)
151#define __NR_init_module (__NR_Linux + 128)
152#define __NR_delete_module (__NR_Linux + 129)
153#define __NR_get_kernel_syms (__NR_Linux + 130)
154#define __NR_quotactl (__NR_Linux + 131)
155#define __NR_getpgid (__NR_Linux + 132)
156#define __NR_fchdir (__NR_Linux + 133)
157#define __NR_bdflush (__NR_Linux + 134)
158#define __NR_sysfs (__NR_Linux + 135)
159#define __NR_personality (__NR_Linux + 136)
160#define __NR_afs_syscall (__NR_Linux + 137) /* Syscall for Andrew File System */
161#define __NR_setfsuid (__NR_Linux + 138)
162#define __NR_setfsgid (__NR_Linux + 139)
163#define __NR__llseek (__NR_Linux + 140)
164#define __NR_getdents (__NR_Linux + 141)
165#define __NR__newselect (__NR_Linux + 142)
166#define __NR_flock (__NR_Linux + 143)
167#define __NR_msync (__NR_Linux + 144)
168#define __NR_readv (__NR_Linux + 145)
169#define __NR_writev (__NR_Linux + 146)
170#define __NR_cacheflush (__NR_Linux + 147)
171#define __NR_cachectl (__NR_Linux + 148)
172#define __NR_sysmips (__NR_Linux + 149)
173#define __NR_unused150 (__NR_Linux + 150)
174#define __NR_getsid (__NR_Linux + 151)
175#define __NR_fdatasync (__NR_Linux + 152)
176#define __NR__sysctl (__NR_Linux + 153)
177#define __NR_mlock (__NR_Linux + 154)
178#define __NR_munlock (__NR_Linux + 155)
179#define __NR_mlockall (__NR_Linux + 156)
180#define __NR_munlockall (__NR_Linux + 157)
181#define __NR_sched_setparam (__NR_Linux + 158)
182#define __NR_sched_getparam (__NR_Linux + 159)
183#define __NR_sched_setscheduler (__NR_Linux + 160)
184#define __NR_sched_getscheduler (__NR_Linux + 161)
185#define __NR_sched_yield (__NR_Linux + 162)
186#define __NR_sched_get_priority_max (__NR_Linux + 163)
187#define __NR_sched_get_priority_min (__NR_Linux + 164)
188#define __NR_sched_rr_get_interval (__NR_Linux + 165)
189#define __NR_nanosleep (__NR_Linux + 166)
190#define __NR_mremap (__NR_Linux + 167)
191#define __NR_accept (__NR_Linux + 168)
192#define __NR_bind (__NR_Linux + 169)
193#define __NR_connect (__NR_Linux + 170)
194#define __NR_getpeername (__NR_Linux + 171)
195#define __NR_getsockname (__NR_Linux + 172)
196#define __NR_getsockopt (__NR_Linux + 173)
197#define __NR_listen (__NR_Linux + 174)
198#define __NR_recv (__NR_Linux + 175)
199#define __NR_recvfrom (__NR_Linux + 176)
200#define __NR_recvmsg (__NR_Linux + 177)
201#define __NR_send (__NR_Linux + 178)
202#define __NR_sendmsg (__NR_Linux + 179)
203#define __NR_sendto (__NR_Linux + 180)
204#define __NR_setsockopt (__NR_Linux + 181)
205#define __NR_shutdown (__NR_Linux + 182)
206#define __NR_socket (__NR_Linux + 183)
207#define __NR_socketpair (__NR_Linux + 184)
208#define __NR_setresuid (__NR_Linux + 185)
209#define __NR_getresuid (__NR_Linux + 186)
210#define __NR_query_module (__NR_Linux + 187)
211#define __NR_poll (__NR_Linux + 188)
212#define __NR_nfsservctl (__NR_Linux + 189)
213#define __NR_setresgid (__NR_Linux + 190)
214#define __NR_getresgid (__NR_Linux + 191)
215#define __NR_prctl (__NR_Linux + 192)
216#define __NR_rt_sigreturn (__NR_Linux + 193)
217#define __NR_rt_sigaction (__NR_Linux + 194)
218#define __NR_rt_sigprocmask (__NR_Linux + 195)
219#define __NR_rt_sigpending (__NR_Linux + 196)
220#define __NR_rt_sigtimedwait (__NR_Linux + 197)
221#define __NR_rt_sigqueueinfo (__NR_Linux + 198)
222#define __NR_rt_sigsuspend (__NR_Linux + 199)
223#define __NR_pread64 (__NR_Linux + 200)
224#define __NR_pwrite64 (__NR_Linux + 201)
225#define __NR_chown (__NR_Linux + 202)
226#define __NR_getcwd (__NR_Linux + 203)
227#define __NR_capget (__NR_Linux + 204)
228#define __NR_capset (__NR_Linux + 205)
229#define __NR_sigaltstack (__NR_Linux + 206)
230#define __NR_sendfile (__NR_Linux + 207)
231#define __NR_getpmsg (__NR_Linux + 208)
232#define __NR_putpmsg (__NR_Linux + 209)
233#define __NR_mmap2 (__NR_Linux + 210)
234#define __NR_truncate64 (__NR_Linux + 211)
235#define __NR_ftruncate64 (__NR_Linux + 212)
236#define __NR_stat64 (__NR_Linux + 213)
237#define __NR_lstat64 (__NR_Linux + 214)
238#define __NR_fstat64 (__NR_Linux + 215)
239#define __NR_pivot_root (__NR_Linux + 216)
240#define __NR_mincore (__NR_Linux + 217)
241#define __NR_madvise (__NR_Linux + 218)
242#define __NR_getdents64 (__NR_Linux + 219)
243#define __NR_fcntl64 (__NR_Linux + 220)
244#define __NR_reserved221 (__NR_Linux + 221)
245#define __NR_gettid (__NR_Linux + 222)
246#define __NR_readahead (__NR_Linux + 223)
247#define __NR_setxattr (__NR_Linux + 224)
248#define __NR_lsetxattr (__NR_Linux + 225)
249#define __NR_fsetxattr (__NR_Linux + 226)
250#define __NR_getxattr (__NR_Linux + 227)
251#define __NR_lgetxattr (__NR_Linux + 228)
252#define __NR_fgetxattr (__NR_Linux + 229)
253#define __NR_listxattr (__NR_Linux + 230)
254#define __NR_llistxattr (__NR_Linux + 231)
255#define __NR_flistxattr (__NR_Linux + 232)
256#define __NR_removexattr (__NR_Linux + 233)
257#define __NR_lremovexattr (__NR_Linux + 234)
258#define __NR_fremovexattr (__NR_Linux + 235)
259#define __NR_tkill (__NR_Linux + 236)
260#define __NR_sendfile64 (__NR_Linux + 237)
261#define __NR_futex (__NR_Linux + 238)
262#define __NR_sched_setaffinity (__NR_Linux + 239)
263#define __NR_sched_getaffinity (__NR_Linux + 240)
264#define __NR_io_setup (__NR_Linux + 241)
265#define __NR_io_destroy (__NR_Linux + 242)
266#define __NR_io_getevents (__NR_Linux + 243)
267#define __NR_io_submit (__NR_Linux + 244)
268#define __NR_io_cancel (__NR_Linux + 245)
269#define __NR_exit_group (__NR_Linux + 246)
270#define __NR_lookup_dcookie (__NR_Linux + 247)
271#define __NR_epoll_create (__NR_Linux + 248)
272#define __NR_epoll_ctl (__NR_Linux + 249)
273#define __NR_epoll_wait (__NR_Linux + 250)
274#define __NR_remap_file_pages (__NR_Linux + 251)
275#define __NR_set_tid_address (__NR_Linux + 252)
276#define __NR_restart_syscall (__NR_Linux + 253)
277#define __NR_fadvise64 (__NR_Linux + 254)
278#define __NR_statfs64 (__NR_Linux + 255)
279#define __NR_fstatfs64 (__NR_Linux + 256)
280#define __NR_timer_create (__NR_Linux + 257)
281#define __NR_timer_settime (__NR_Linux + 258)
282#define __NR_timer_gettime (__NR_Linux + 259)
283#define __NR_timer_getoverrun (__NR_Linux + 260)
284#define __NR_timer_delete (__NR_Linux + 261)
285#define __NR_clock_settime (__NR_Linux + 262)
286#define __NR_clock_gettime (__NR_Linux + 263)
287#define __NR_clock_getres (__NR_Linux + 264)
288#define __NR_clock_nanosleep (__NR_Linux + 265)
289#define __NR_tgkill (__NR_Linux + 266)
290#define __NR_utimes (__NR_Linux + 267)
291#define __NR_mbind (__NR_Linux + 268)
292#define __NR_get_mempolicy (__NR_Linux + 269)
293#define __NR_set_mempolicy (__NR_Linux + 270)
294#define __NR_mq_open (__NR_Linux + 271)
295#define __NR_mq_unlink (__NR_Linux + 272)
296#define __NR_mq_timedsend (__NR_Linux + 273)
297#define __NR_mq_timedreceive (__NR_Linux + 274)
298#define __NR_mq_notify (__NR_Linux + 275)
299#define __NR_mq_getsetattr (__NR_Linux + 276)
300#define __NR_vserver (__NR_Linux + 277)
301#define __NR_waitid (__NR_Linux + 278)
302/* #define __NR_sys_setaltroot (__NR_Linux + 279) */
303#define __NR_add_key (__NR_Linux + 280)
304#define __NR_request_key (__NR_Linux + 281)
305#define __NR_keyctl (__NR_Linux + 282)
306
307/*
308 * Offset of the last Linux o32 flavoured syscall
309 */
310#define __NR_Linux_syscalls 282
311
312#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
313
314#define __NR_O32_Linux 4000
315#define __NR_O32_Linux_syscalls 282
316
317#if _MIPS_SIM == _MIPS_SIM_ABI64
318
319/*
320 * Linux 64-bit syscalls are in the range from 5000 to 5999.
321 */
322#define __NR_Linux 5000
323#define __NR_read (__NR_Linux + 0)
324#define __NR_write (__NR_Linux + 1)
325#define __NR_open (__NR_Linux + 2)
326#define __NR_close (__NR_Linux + 3)
327#define __NR_stat (__NR_Linux + 4)
328#define __NR_fstat (__NR_Linux + 5)
329#define __NR_lstat (__NR_Linux + 6)
330#define __NR_poll (__NR_Linux + 7)
331#define __NR_lseek (__NR_Linux + 8)
332#define __NR_mmap (__NR_Linux + 9)
333#define __NR_mprotect (__NR_Linux + 10)
334#define __NR_munmap (__NR_Linux + 11)
335#define __NR_brk (__NR_Linux + 12)
336#define __NR_rt_sigaction (__NR_Linux + 13)
337#define __NR_rt_sigprocmask (__NR_Linux + 14)
338#define __NR_ioctl (__NR_Linux + 15)
339#define __NR_pread64 (__NR_Linux + 16)
340#define __NR_pwrite64 (__NR_Linux + 17)
341#define __NR_readv (__NR_Linux + 18)
342#define __NR_writev (__NR_Linux + 19)
343#define __NR_access (__NR_Linux + 20)
344#define __NR_pipe (__NR_Linux + 21)
345#define __NR__newselect (__NR_Linux + 22)
346#define __NR_sched_yield (__NR_Linux + 23)
347#define __NR_mremap (__NR_Linux + 24)
348#define __NR_msync (__NR_Linux + 25)
349#define __NR_mincore (__NR_Linux + 26)
350#define __NR_madvise (__NR_Linux + 27)
351#define __NR_shmget (__NR_Linux + 28)
352#define __NR_shmat (__NR_Linux + 29)
353#define __NR_shmctl (__NR_Linux + 30)
354#define __NR_dup (__NR_Linux + 31)
355#define __NR_dup2 (__NR_Linux + 32)
356#define __NR_pause (__NR_Linux + 33)
357#define __NR_nanosleep (__NR_Linux + 34)
358#define __NR_getitimer (__NR_Linux + 35)
359#define __NR_setitimer (__NR_Linux + 36)
360#define __NR_alarm (__NR_Linux + 37)
361#define __NR_getpid (__NR_Linux + 38)
362#define __NR_sendfile (__NR_Linux + 39)
363#define __NR_socket (__NR_Linux + 40)
364#define __NR_connect (__NR_Linux + 41)
365#define __NR_accept (__NR_Linux + 42)
366#define __NR_sendto (__NR_Linux + 43)
367#define __NR_recvfrom (__NR_Linux + 44)
368#define __NR_sendmsg (__NR_Linux + 45)
369#define __NR_recvmsg (__NR_Linux + 46)
370#define __NR_shutdown (__NR_Linux + 47)
371#define __NR_bind (__NR_Linux + 48)
372#define __NR_listen (__NR_Linux + 49)
373#define __NR_getsockname (__NR_Linux + 50)
374#define __NR_getpeername (__NR_Linux + 51)
375#define __NR_socketpair (__NR_Linux + 52)
376#define __NR_setsockopt (__NR_Linux + 53)
377#define __NR_getsockopt (__NR_Linux + 54)
378#define __NR_clone (__NR_Linux + 55)
379#define __NR_fork (__NR_Linux + 56)
380#define __NR_execve (__NR_Linux + 57)
381#define __NR_exit (__NR_Linux + 58)
382#define __NR_wait4 (__NR_Linux + 59)
383#define __NR_kill (__NR_Linux + 60)
384#define __NR_uname (__NR_Linux + 61)
385#define __NR_semget (__NR_Linux + 62)
386#define __NR_semop (__NR_Linux + 63)
387#define __NR_semctl (__NR_Linux + 64)
388#define __NR_shmdt (__NR_Linux + 65)
389#define __NR_msgget (__NR_Linux + 66)
390#define __NR_msgsnd (__NR_Linux + 67)
391#define __NR_msgrcv (__NR_Linux + 68)
392#define __NR_msgctl (__NR_Linux + 69)
393#define __NR_fcntl (__NR_Linux + 70)
394#define __NR_flock (__NR_Linux + 71)
395#define __NR_fsync (__NR_Linux + 72)
396#define __NR_fdatasync (__NR_Linux + 73)
397#define __NR_truncate (__NR_Linux + 74)
398#define __NR_ftruncate (__NR_Linux + 75)
399#define __NR_getdents (__NR_Linux + 76)
400#define __NR_getcwd (__NR_Linux + 77)
401#define __NR_chdir (__NR_Linux + 78)
402#define __NR_fchdir (__NR_Linux + 79)
403#define __NR_rename (__NR_Linux + 80)
404#define __NR_mkdir (__NR_Linux + 81)
405#define __NR_rmdir (__NR_Linux + 82)
406#define __NR_creat (__NR_Linux + 83)
407#define __NR_link (__NR_Linux + 84)
408#define __NR_unlink (__NR_Linux + 85)
409#define __NR_symlink (__NR_Linux + 86)
410#define __NR_readlink (__NR_Linux + 87)
411#define __NR_chmod (__NR_Linux + 88)
412#define __NR_fchmod (__NR_Linux + 89)
413#define __NR_chown (__NR_Linux + 90)
414#define __NR_fchown (__NR_Linux + 91)
415#define __NR_lchown (__NR_Linux + 92)
416#define __NR_umask (__NR_Linux + 93)
417#define __NR_gettimeofday (__NR_Linux + 94)
418#define __NR_getrlimit (__NR_Linux + 95)
419#define __NR_getrusage (__NR_Linux + 96)
420#define __NR_sysinfo (__NR_Linux + 97)
421#define __NR_times (__NR_Linux + 98)
422#define __NR_ptrace (__NR_Linux + 99)
423#define __NR_getuid (__NR_Linux + 100)
424#define __NR_syslog (__NR_Linux + 101)
425#define __NR_getgid (__NR_Linux + 102)
426#define __NR_setuid (__NR_Linux + 103)
427#define __NR_setgid (__NR_Linux + 104)
428#define __NR_geteuid (__NR_Linux + 105)
429#define __NR_getegid (__NR_Linux + 106)
430#define __NR_setpgid (__NR_Linux + 107)
431#define __NR_getppid (__NR_Linux + 108)
432#define __NR_getpgrp (__NR_Linux + 109)
433#define __NR_setsid (__NR_Linux + 110)
434#define __NR_setreuid (__NR_Linux + 111)
435#define __NR_setregid (__NR_Linux + 112)
436#define __NR_getgroups (__NR_Linux + 113)
437#define __NR_setgroups (__NR_Linux + 114)
438#define __NR_setresuid (__NR_Linux + 115)
439#define __NR_getresuid (__NR_Linux + 116)
440#define __NR_setresgid (__NR_Linux + 117)
441#define __NR_getresgid (__NR_Linux + 118)
442#define __NR_getpgid (__NR_Linux + 119)
443#define __NR_setfsuid (__NR_Linux + 120)
444#define __NR_setfsgid (__NR_Linux + 121)
445#define __NR_getsid (__NR_Linux + 122)
446#define __NR_capget (__NR_Linux + 123)
447#define __NR_capset (__NR_Linux + 124)
448#define __NR_rt_sigpending (__NR_Linux + 125)
449#define __NR_rt_sigtimedwait (__NR_Linux + 126)
450#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
451#define __NR_rt_sigsuspend (__NR_Linux + 128)
452#define __NR_sigaltstack (__NR_Linux + 129)
453#define __NR_utime (__NR_Linux + 130)
454#define __NR_mknod (__NR_Linux + 131)
455#define __NR_personality (__NR_Linux + 132)
456#define __NR_ustat (__NR_Linux + 133)
457#define __NR_statfs (__NR_Linux + 134)
458#define __NR_fstatfs (__NR_Linux + 135)
459#define __NR_sysfs (__NR_Linux + 136)
460#define __NR_getpriority (__NR_Linux + 137)
461#define __NR_setpriority (__NR_Linux + 138)
462#define __NR_sched_setparam (__NR_Linux + 139)
463#define __NR_sched_getparam (__NR_Linux + 140)
464#define __NR_sched_setscheduler (__NR_Linux + 141)
465#define __NR_sched_getscheduler (__NR_Linux + 142)
466#define __NR_sched_get_priority_max (__NR_Linux + 143)
467#define __NR_sched_get_priority_min (__NR_Linux + 144)
468#define __NR_sched_rr_get_interval (__NR_Linux + 145)
469#define __NR_mlock (__NR_Linux + 146)
470#define __NR_munlock (__NR_Linux + 147)
471#define __NR_mlockall (__NR_Linux + 148)
472#define __NR_munlockall (__NR_Linux + 149)
473#define __NR_vhangup (__NR_Linux + 150)
474#define __NR_pivot_root (__NR_Linux + 151)
475#define __NR__sysctl (__NR_Linux + 152)
476#define __NR_prctl (__NR_Linux + 153)
477#define __NR_adjtimex (__NR_Linux + 154)
478#define __NR_setrlimit (__NR_Linux + 155)
479#define __NR_chroot (__NR_Linux + 156)
480#define __NR_sync (__NR_Linux + 157)
481#define __NR_acct (__NR_Linux + 158)
482#define __NR_settimeofday (__NR_Linux + 159)
483#define __NR_mount (__NR_Linux + 160)
484#define __NR_umount2 (__NR_Linux + 161)
485#define __NR_swapon (__NR_Linux + 162)
486#define __NR_swapoff (__NR_Linux + 163)
487#define __NR_reboot (__NR_Linux + 164)
488#define __NR_sethostname (__NR_Linux + 165)
489#define __NR_setdomainname (__NR_Linux + 166)
490#define __NR_create_module (__NR_Linux + 167)
491#define __NR_init_module (__NR_Linux + 168)
492#define __NR_delete_module (__NR_Linux + 169)
493#define __NR_get_kernel_syms (__NR_Linux + 170)
494#define __NR_query_module (__NR_Linux + 171)
495#define __NR_quotactl (__NR_Linux + 172)
496#define __NR_nfsservctl (__NR_Linux + 173)
497#define __NR_getpmsg (__NR_Linux + 174)
498#define __NR_putpmsg (__NR_Linux + 175)
499#define __NR_afs_syscall (__NR_Linux + 176)
500#define __NR_reserved177 (__NR_Linux + 177)
501#define __NR_gettid (__NR_Linux + 178)
502#define __NR_readahead (__NR_Linux + 179)
503#define __NR_setxattr (__NR_Linux + 180)
504#define __NR_lsetxattr (__NR_Linux + 181)
505#define __NR_fsetxattr (__NR_Linux + 182)
506#define __NR_getxattr (__NR_Linux + 183)
507#define __NR_lgetxattr (__NR_Linux + 184)
508#define __NR_fgetxattr (__NR_Linux + 185)
509#define __NR_listxattr (__NR_Linux + 186)
510#define __NR_llistxattr (__NR_Linux + 187)
511#define __NR_flistxattr (__NR_Linux + 188)
512#define __NR_removexattr (__NR_Linux + 189)
513#define __NR_lremovexattr (__NR_Linux + 190)
514#define __NR_fremovexattr (__NR_Linux + 191)
515#define __NR_tkill (__NR_Linux + 192)
516#define __NR_reserved193 (__NR_Linux + 193)
517#define __NR_futex (__NR_Linux + 194)
518#define __NR_sched_setaffinity (__NR_Linux + 195)
519#define __NR_sched_getaffinity (__NR_Linux + 196)
520#define __NR_cacheflush (__NR_Linux + 197)
521#define __NR_cachectl (__NR_Linux + 198)
522#define __NR_sysmips (__NR_Linux + 199)
523#define __NR_io_setup (__NR_Linux + 200)
524#define __NR_io_destroy (__NR_Linux + 201)
525#define __NR_io_getevents (__NR_Linux + 202)
526#define __NR_io_submit (__NR_Linux + 203)
527#define __NR_io_cancel (__NR_Linux + 204)
528#define __NR_exit_group (__NR_Linux + 205)
529#define __NR_lookup_dcookie (__NR_Linux + 206)
530#define __NR_epoll_create (__NR_Linux + 207)
531#define __NR_epoll_ctl (__NR_Linux + 208)
532#define __NR_epoll_wait (__NR_Linux + 209)
533#define __NR_remap_file_pages (__NR_Linux + 210)
534#define __NR_rt_sigreturn (__NR_Linux + 211)
535#define __NR_set_tid_address (__NR_Linux + 212)
536#define __NR_restart_syscall (__NR_Linux + 213)
537#define __NR_semtimedop (__NR_Linux + 214)
538#define __NR_fadvise64 (__NR_Linux + 215)
539#define __NR_timer_create (__NR_Linux + 216)
540#define __NR_timer_settime (__NR_Linux + 217)
541#define __NR_timer_gettime (__NR_Linux + 218)
542#define __NR_timer_getoverrun (__NR_Linux + 219)
543#define __NR_timer_delete (__NR_Linux + 220)
544#define __NR_clock_settime (__NR_Linux + 221)
545#define __NR_clock_gettime (__NR_Linux + 222)
546#define __NR_clock_getres (__NR_Linux + 223)
547#define __NR_clock_nanosleep (__NR_Linux + 224)
548#define __NR_tgkill (__NR_Linux + 225)
549#define __NR_utimes (__NR_Linux + 226)
550#define __NR_mbind (__NR_Linux + 227)
551#define __NR_get_mempolicy (__NR_Linux + 228)
552#define __NR_set_mempolicy (__NR_Linux + 229)
553#define __NR_mq_open (__NR_Linux + 230)
554#define __NR_mq_unlink (__NR_Linux + 231)
555#define __NR_mq_timedsend (__NR_Linux + 232)
556#define __NR_mq_timedreceive (__NR_Linux + 233)
557#define __NR_mq_notify (__NR_Linux + 234)
558#define __NR_mq_getsetattr (__NR_Linux + 235)
559#define __NR_vserver (__NR_Linux + 236)
560#define __NR_waitid (__NR_Linux + 237)
561/* #define __NR_sys_setaltroot (__NR_Linux + 238) */
562#define __NR_add_key (__NR_Linux + 239)
563#define __NR_request_key (__NR_Linux + 240)
564#define __NR_keyctl (__NR_Linux + 241)
565
566/*
567 * Offset of the last Linux 64-bit flavoured syscall
568 */
569#define __NR_Linux_syscalls 241
570
571#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
572
573#define __NR_64_Linux 5000
574#define __NR_64_Linux_syscalls 241
575
576#if _MIPS_SIM == _MIPS_SIM_NABI32
577
578/*
579 * Linux N32 syscalls are in the range from 6000 to 6999.
580 */
581#define __NR_Linux 6000
582#define __NR_read (__NR_Linux + 0)
583#define __NR_write (__NR_Linux + 1)
584#define __NR_open (__NR_Linux + 2)
585#define __NR_close (__NR_Linux + 3)
586#define __NR_stat (__NR_Linux + 4)
587#define __NR_fstat (__NR_Linux + 5)
588#define __NR_lstat (__NR_Linux + 6)
589#define __NR_poll (__NR_Linux + 7)
590#define __NR_lseek (__NR_Linux + 8)
591#define __NR_mmap (__NR_Linux + 9)
592#define __NR_mprotect (__NR_Linux + 10)
593#define __NR_munmap (__NR_Linux + 11)
594#define __NR_brk (__NR_Linux + 12)
595#define __NR_rt_sigaction (__NR_Linux + 13)
596#define __NR_rt_sigprocmask (__NR_Linux + 14)
597#define __NR_ioctl (__NR_Linux + 15)
598#define __NR_pread64 (__NR_Linux + 16)
599#define __NR_pwrite64 (__NR_Linux + 17)
600#define __NR_readv (__NR_Linux + 18)
601#define __NR_writev (__NR_Linux + 19)
602#define __NR_access (__NR_Linux + 20)
603#define __NR_pipe (__NR_Linux + 21)
604#define __NR__newselect (__NR_Linux + 22)
605#define __NR_sched_yield (__NR_Linux + 23)
606#define __NR_mremap (__NR_Linux + 24)
607#define __NR_msync (__NR_Linux + 25)
608#define __NR_mincore (__NR_Linux + 26)
609#define __NR_madvise (__NR_Linux + 27)
610#define __NR_shmget (__NR_Linux + 28)
611#define __NR_shmat (__NR_Linux + 29)
612#define __NR_shmctl (__NR_Linux + 30)
613#define __NR_dup (__NR_Linux + 31)
614#define __NR_dup2 (__NR_Linux + 32)
615#define __NR_pause (__NR_Linux + 33)
616#define __NR_nanosleep (__NR_Linux + 34)
617#define __NR_getitimer (__NR_Linux + 35)
618#define __NR_setitimer (__NR_Linux + 36)
619#define __NR_alarm (__NR_Linux + 37)
620#define __NR_getpid (__NR_Linux + 38)
621#define __NR_sendfile (__NR_Linux + 39)
622#define __NR_socket (__NR_Linux + 40)
623#define __NR_connect (__NR_Linux + 41)
624#define __NR_accept (__NR_Linux + 42)
625#define __NR_sendto (__NR_Linux + 43)
626#define __NR_recvfrom (__NR_Linux + 44)
627#define __NR_sendmsg (__NR_Linux + 45)
628#define __NR_recvmsg (__NR_Linux + 46)
629#define __NR_shutdown (__NR_Linux + 47)
630#define __NR_bind (__NR_Linux + 48)
631#define __NR_listen (__NR_Linux + 49)
632#define __NR_getsockname (__NR_Linux + 50)
633#define __NR_getpeername (__NR_Linux + 51)
634#define __NR_socketpair (__NR_Linux + 52)
635#define __NR_setsockopt (__NR_Linux + 53)
636#define __NR_getsockopt (__NR_Linux + 54)
637#define __NR_clone (__NR_Linux + 55)
638#define __NR_fork (__NR_Linux + 56)
639#define __NR_execve (__NR_Linux + 57)
640#define __NR_exit (__NR_Linux + 58)
641#define __NR_wait4 (__NR_Linux + 59)
642#define __NR_kill (__NR_Linux + 60)
643#define __NR_uname (__NR_Linux + 61)
644#define __NR_semget (__NR_Linux + 62)
645#define __NR_semop (__NR_Linux + 63)
646#define __NR_semctl (__NR_Linux + 64)
647#define __NR_shmdt (__NR_Linux + 65)
648#define __NR_msgget (__NR_Linux + 66)
649#define __NR_msgsnd (__NR_Linux + 67)
650#define __NR_msgrcv (__NR_Linux + 68)
651#define __NR_msgctl (__NR_Linux + 69)
652#define __NR_fcntl (__NR_Linux + 70)
653#define __NR_flock (__NR_Linux + 71)
654#define __NR_fsync (__NR_Linux + 72)
655#define __NR_fdatasync (__NR_Linux + 73)
656#define __NR_truncate (__NR_Linux + 74)
657#define __NR_ftruncate (__NR_Linux + 75)
658#define __NR_getdents (__NR_Linux + 76)
659#define __NR_getcwd (__NR_Linux + 77)
660#define __NR_chdir (__NR_Linux + 78)
661#define __NR_fchdir (__NR_Linux + 79)
662#define __NR_rename (__NR_Linux + 80)
663#define __NR_mkdir (__NR_Linux + 81)
664#define __NR_rmdir (__NR_Linux + 82)
665#define __NR_creat (__NR_Linux + 83)
666#define __NR_link (__NR_Linux + 84)
667#define __NR_unlink (__NR_Linux + 85)
668#define __NR_symlink (__NR_Linux + 86)
669#define __NR_readlink (__NR_Linux + 87)
670#define __NR_chmod (__NR_Linux + 88)
671#define __NR_fchmod (__NR_Linux + 89)
672#define __NR_chown (__NR_Linux + 90)
673#define __NR_fchown (__NR_Linux + 91)
674#define __NR_lchown (__NR_Linux + 92)
675#define __NR_umask (__NR_Linux + 93)
676#define __NR_gettimeofday (__NR_Linux + 94)
677#define __NR_getrlimit (__NR_Linux + 95)
678#define __NR_getrusage (__NR_Linux + 96)
679#define __NR_sysinfo (__NR_Linux + 97)
680#define __NR_times (__NR_Linux + 98)
681#define __NR_ptrace (__NR_Linux + 99)
682#define __NR_getuid (__NR_Linux + 100)
683#define __NR_syslog (__NR_Linux + 101)
684#define __NR_getgid (__NR_Linux + 102)
685#define __NR_setuid (__NR_Linux + 103)
686#define __NR_setgid (__NR_Linux + 104)
687#define __NR_geteuid (__NR_Linux + 105)
688#define __NR_getegid (__NR_Linux + 106)
689#define __NR_setpgid (__NR_Linux + 107)
690#define __NR_getppid (__NR_Linux + 108)
691#define __NR_getpgrp (__NR_Linux + 109)
692#define __NR_setsid (__NR_Linux + 110)
693#define __NR_setreuid (__NR_Linux + 111)
694#define __NR_setregid (__NR_Linux + 112)
695#define __NR_getgroups (__NR_Linux + 113)
696#define __NR_setgroups (__NR_Linux + 114)
697#define __NR_setresuid (__NR_Linux + 115)
698#define __NR_getresuid (__NR_Linux + 116)
699#define __NR_setresgid (__NR_Linux + 117)
700#define __NR_getresgid (__NR_Linux + 118)
701#define __NR_getpgid (__NR_Linux + 119)
702#define __NR_setfsuid (__NR_Linux + 120)
703#define __NR_setfsgid (__NR_Linux + 121)
704#define __NR_getsid (__NR_Linux + 122)
705#define __NR_capget (__NR_Linux + 123)
706#define __NR_capset (__NR_Linux + 124)
707#define __NR_rt_sigpending (__NR_Linux + 125)
708#define __NR_rt_sigtimedwait (__NR_Linux + 126)
709#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
710#define __NR_rt_sigsuspend (__NR_Linux + 128)
711#define __NR_sigaltstack (__NR_Linux + 129)
712#define __NR_utime (__NR_Linux + 130)
713#define __NR_mknod (__NR_Linux + 131)
714#define __NR_personality (__NR_Linux + 132)
715#define __NR_ustat (__NR_Linux + 133)
716#define __NR_statfs (__NR_Linux + 134)
717#define __NR_fstatfs (__NR_Linux + 135)
718#define __NR_sysfs (__NR_Linux + 136)
719#define __NR_getpriority (__NR_Linux + 137)
720#define __NR_setpriority (__NR_Linux + 138)
721#define __NR_sched_setparam (__NR_Linux + 139)
722#define __NR_sched_getparam (__NR_Linux + 140)
723#define __NR_sched_setscheduler (__NR_Linux + 141)
724#define __NR_sched_getscheduler (__NR_Linux + 142)
725#define __NR_sched_get_priority_max (__NR_Linux + 143)
726#define __NR_sched_get_priority_min (__NR_Linux + 144)
727#define __NR_sched_rr_get_interval (__NR_Linux + 145)
728#define __NR_mlock (__NR_Linux + 146)
729#define __NR_munlock (__NR_Linux + 147)
730#define __NR_mlockall (__NR_Linux + 148)
731#define __NR_munlockall (__NR_Linux + 149)
732#define __NR_vhangup (__NR_Linux + 150)
733#define __NR_pivot_root (__NR_Linux + 151)
734#define __NR__sysctl (__NR_Linux + 152)
735#define __NR_prctl (__NR_Linux + 153)
736#define __NR_adjtimex (__NR_Linux + 154)
737#define __NR_setrlimit (__NR_Linux + 155)
738#define __NR_chroot (__NR_Linux + 156)
739#define __NR_sync (__NR_Linux + 157)
740#define __NR_acct (__NR_Linux + 158)
741#define __NR_settimeofday (__NR_Linux + 159)
742#define __NR_mount (__NR_Linux + 160)
743#define __NR_umount2 (__NR_Linux + 161)
744#define __NR_swapon (__NR_Linux + 162)
745#define __NR_swapoff (__NR_Linux + 163)
746#define __NR_reboot (__NR_Linux + 164)
747#define __NR_sethostname (__NR_Linux + 165)
748#define __NR_setdomainname (__NR_Linux + 166)
749#define __NR_create_module (__NR_Linux + 167)
750#define __NR_init_module (__NR_Linux + 168)
751#define __NR_delete_module (__NR_Linux + 169)
752#define __NR_get_kernel_syms (__NR_Linux + 170)
753#define __NR_query_module (__NR_Linux + 171)
754#define __NR_quotactl (__NR_Linux + 172)
755#define __NR_nfsservctl (__NR_Linux + 173)
756#define __NR_getpmsg (__NR_Linux + 174)
757#define __NR_putpmsg (__NR_Linux + 175)
758#define __NR_afs_syscall (__NR_Linux + 176)
759#define __NR_reserved177 (__NR_Linux + 177)
760#define __NR_gettid (__NR_Linux + 178)
761#define __NR_readahead (__NR_Linux + 179)
762#define __NR_setxattr (__NR_Linux + 180)
763#define __NR_lsetxattr (__NR_Linux + 181)
764#define __NR_fsetxattr (__NR_Linux + 182)
765#define __NR_getxattr (__NR_Linux + 183)
766#define __NR_lgetxattr (__NR_Linux + 184)
767#define __NR_fgetxattr (__NR_Linux + 185)
768#define __NR_listxattr (__NR_Linux + 186)
769#define __NR_llistxattr (__NR_Linux + 187)
770#define __NR_flistxattr (__NR_Linux + 188)
771#define __NR_removexattr (__NR_Linux + 189)
772#define __NR_lremovexattr (__NR_Linux + 190)
773#define __NR_fremovexattr (__NR_Linux + 191)
774#define __NR_tkill (__NR_Linux + 192)
775#define __NR_reserved193 (__NR_Linux + 193)
776#define __NR_futex (__NR_Linux + 194)
777#define __NR_sched_setaffinity (__NR_Linux + 195)
778#define __NR_sched_getaffinity (__NR_Linux + 196)
779#define __NR_cacheflush (__NR_Linux + 197)
780#define __NR_cachectl (__NR_Linux + 198)
781#define __NR_sysmips (__NR_Linux + 199)
782#define __NR_io_setup (__NR_Linux + 200)
783#define __NR_io_destroy (__NR_Linux + 201)
784#define __NR_io_getevents (__NR_Linux + 202)
785#define __NR_io_submit (__NR_Linux + 203)
786#define __NR_io_cancel (__NR_Linux + 204)
787#define __NR_exit_group (__NR_Linux + 205)
788#define __NR_lookup_dcookie (__NR_Linux + 206)
789#define __NR_epoll_create (__NR_Linux + 207)
790#define __NR_epoll_ctl (__NR_Linux + 208)
791#define __NR_epoll_wait (__NR_Linux + 209)
792#define __NR_remap_file_pages (__NR_Linux + 210)
793#define __NR_rt_sigreturn (__NR_Linux + 211)
794#define __NR_fcntl64 (__NR_Linux + 212)
795#define __NR_set_tid_address (__NR_Linux + 213)
796#define __NR_restart_syscall (__NR_Linux + 214)
797#define __NR_semtimedop (__NR_Linux + 215)
798#define __NR_fadvise64 (__NR_Linux + 216)
799#define __NR_statfs64 (__NR_Linux + 217)
800#define __NR_fstatfs64 (__NR_Linux + 218)
801#define __NR_sendfile64 (__NR_Linux + 219)
802#define __NR_timer_create (__NR_Linux + 220)
803#define __NR_timer_settime (__NR_Linux + 221)
804#define __NR_timer_gettime (__NR_Linux + 222)
805#define __NR_timer_getoverrun (__NR_Linux + 223)
806#define __NR_timer_delete (__NR_Linux + 224)
807#define __NR_clock_settime (__NR_Linux + 225)
808#define __NR_clock_gettime (__NR_Linux + 226)
809#define __NR_clock_getres (__NR_Linux + 227)
810#define __NR_clock_nanosleep (__NR_Linux + 228)
811#define __NR_tgkill (__NR_Linux + 229)
812#define __NR_utimes (__NR_Linux + 230)
813#define __NR_mbind (__NR_Linux + 231)
814#define __NR_get_mempolicy (__NR_Linux + 232)
815#define __NR_set_mempolicy (__NR_Linux + 233)
816#define __NR_mq_open (__NR_Linux + 234)
817#define __NR_mq_unlink (__NR_Linux + 235)
818#define __NR_mq_timedsend (__NR_Linux + 236)
819#define __NR_mq_timedreceive (__NR_Linux + 237)
820#define __NR_mq_notify (__NR_Linux + 238)
821#define __NR_mq_getsetattr (__NR_Linux + 239)
822#define __NR_vserver (__NR_Linux + 240)
823#define __NR_waitid (__NR_Linux + 241)
824/* #define __NR_sys_setaltroot (__NR_Linux + 242) */
825#define __NR_add_key (__NR_Linux + 243)
826#define __NR_request_key (__NR_Linux + 244)
827#define __NR_keyctl (__NR_Linux + 245)
828
829/*
830 * Offset of the last N32 flavoured syscall
831 */
832#define __NR_Linux_syscalls 245
833
834#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
835
836#define __NR_N32_Linux 6000
837#define __NR_N32_Linux_syscalls 245
838
839#ifndef __ASSEMBLY__
840
841/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
842#define _syscall0(type,name) \
843type name(void) \
844{ \
845 register unsigned long __a3 asm("$7"); \
846 unsigned long __v0; \
847 \
848 __asm__ volatile ( \
849 ".set\tnoreorder\n\t" \
850 "li\t$2, %2\t\t\t# " #name "\n\t" \
851 "syscall\n\t" \
852 "move\t%0, $2\n\t" \
853 ".set\treorder" \
854 : "=&r" (__v0), "=r" (__a3) \
855 : "i" (__NR_##name) \
856 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
857 "memory"); \
858 \
859 if (__a3 == 0) \
860 return (type) __v0; \
861 errno = __v0; \
862 return (type) -1; \
863}
864
865/*
866 * DANGER: This macro isn't usable for the pipe(2) call
867 * which has a unusual return convention.
868 */
869#define _syscall1(type,name,atype,a) \
870type name(atype a) \
871{ \
872 register unsigned long __a0 asm("$4") = (unsigned long) a; \
873 register unsigned long __a3 asm("$7"); \
874 unsigned long __v0; \
875 \
876 __asm__ volatile ( \
877 ".set\tnoreorder\n\t" \
878 "li\t$2, %3\t\t\t# " #name "\n\t" \
879 "syscall\n\t" \
880 "move\t%0, $2\n\t" \
881 ".set\treorder" \
882 : "=&r" (__v0), "=r" (__a3) \
883 : "r" (__a0), "i" (__NR_##name) \
884 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
885 "memory"); \
886 \
887 if (__a3 == 0) \
888 return (type) __v0; \
889 errno = __v0; \
890 return (type) -1; \
891}
892
893#define _syscall2(type,name,atype,a,btype,b) \
894type name(atype a, btype b) \
895{ \
896 register unsigned long __a0 asm("$4") = (unsigned long) a; \
897 register unsigned long __a1 asm("$5") = (unsigned long) b; \
898 register unsigned long __a3 asm("$7"); \
899 unsigned long __v0; \
900 \
901 __asm__ volatile ( \
902 ".set\tnoreorder\n\t" \
903 "li\t$2, %4\t\t\t# " #name "\n\t" \
904 "syscall\n\t" \
905 "move\t%0, $2\n\t" \
906 ".set\treorder" \
907 : "=&r" (__v0), "=r" (__a3) \
908 : "r" (__a0), "r" (__a1), "i" (__NR_##name) \
909 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
910 "memory"); \
911 \
912 if (__a3 == 0) \
913 return (type) __v0; \
914 errno = __v0; \
915 return (type) -1; \
916}
917
918#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
919type name(atype a, btype b, ctype c) \
920{ \
921 register unsigned long __a0 asm("$4") = (unsigned long) a; \
922 register unsigned long __a1 asm("$5") = (unsigned long) b; \
923 register unsigned long __a2 asm("$6") = (unsigned long) c; \
924 register unsigned long __a3 asm("$7"); \
925 unsigned long __v0; \
926 \
927 __asm__ volatile ( \
928 ".set\tnoreorder\n\t" \
929 "li\t$2, %5\t\t\t# " #name "\n\t" \
930 "syscall\n\t" \
931 "move\t%0, $2\n\t" \
932 ".set\treorder" \
933 : "=&r" (__v0), "=r" (__a3) \
934 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
935 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
936 "memory"); \
937 \
938 if (__a3 == 0) \
939 return (type) __v0; \
940 errno = __v0; \
941 return (type) -1; \
942}
943
944#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
945type name(atype a, btype b, ctype c, dtype d) \
946{ \
947 register unsigned long __a0 asm("$4") = (unsigned long) a; \
948 register unsigned long __a1 asm("$5") = (unsigned long) b; \
949 register unsigned long __a2 asm("$6") = (unsigned long) c; \
950 register unsigned long __a3 asm("$7") = (unsigned long) d; \
951 unsigned long __v0; \
952 \
953 __asm__ volatile ( \
954 ".set\tnoreorder\n\t" \
955 "li\t$2, %5\t\t\t# " #name "\n\t" \
956 "syscall\n\t" \
957 "move\t%0, $2\n\t" \
958 ".set\treorder" \
959 : "=&r" (__v0), "+r" (__a3) \
960 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
961 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
962 "memory"); \
963 \
964 if (__a3 == 0) \
965 return (type) __v0; \
966 errno = __v0; \
967 return (type) -1; \
968}
969
970#if (_MIPS_SIM == _MIPS_SIM_ABI32)
971
972/*
973 * Using those means your brain needs more than an oil change ;-)
974 */
975
976#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
977type name(atype a, btype b, ctype c, dtype d, etype e) \
978{ \
979 register unsigned long __a0 asm("$4") = (unsigned long) a; \
980 register unsigned long __a1 asm("$5") = (unsigned long) b; \
981 register unsigned long __a2 asm("$6") = (unsigned long) c; \
982 register unsigned long __a3 asm("$7") = (unsigned long) d; \
983 unsigned long __v0; \
984 \
985 __asm__ volatile ( \
986 ".set\tnoreorder\n\t" \
987 "lw\t$2, %6\n\t" \
988 "subu\t$29, 32\n\t" \
989 "sw\t$2, 16($29)\n\t" \
990 "li\t$2, %5\t\t\t# " #name "\n\t" \
991 "syscall\n\t" \
992 "move\t%0, $2\n\t" \
993 "addiu\t$29, 32\n\t" \
994 ".set\treorder" \
995 : "=&r" (__v0), "+r" (__a3) \
996 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name), \
997 "m" ((unsigned long)e) \
998 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
999 "memory"); \
1000 \
1001 if (__a3 == 0) \
1002 return (type) __v0; \
1003 errno = __v0; \
1004 return (type) -1; \
1005}
1006
1007#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
1008type name(atype a, btype b, ctype c, dtype d, etype e, ftype f) \
1009{ \
1010 register unsigned long __a0 asm("$4") = (unsigned long) a; \
1011 register unsigned long __a1 asm("$5") = (unsigned long) b; \
1012 register unsigned long __a2 asm("$6") = (unsigned long) c; \
1013 register unsigned long __a3 asm("$7") = (unsigned long) d; \
1014 unsigned long __v0; \
1015 \
1016 __asm__ volatile ( \
1017 ".set\tnoreorder\n\t" \
1018 "lw\t$2, %6\n\t" \
1019 "lw\t$8, %7\n\t" \
1020 "subu\t$29, 32\n\t" \
1021 "sw\t$2, 16($29)\n\t" \
1022 "sw\t$8, 20($29)\n\t" \
1023 "li\t$2, %5\t\t\t# " #name "\n\t" \
1024 "syscall\n\t" \
1025 "move\t%0, $2\n\t" \
1026 "addiu\t$29, 32\n\t" \
1027 ".set\treorder" \
1028 : "=&r" (__v0), "+r" (__a3) \
1029 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name), \
1030 "m" ((unsigned long)e), "m" ((unsigned long)f) \
1031 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1032 "memory"); \
1033 \
1034 if (__a3 == 0) \
1035 return (type) __v0; \
1036 errno = __v0; \
1037 return (type) -1; \
1038}
1039
1040#endif /* (_MIPS_SIM == _MIPS_SIM_ABI32) */
1041
1042#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
1043
1044#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
1045type name (atype a,btype b,ctype c,dtype d,etype e) \
1046{ \
1047 register unsigned long __a0 asm("$4") = (unsigned long) a; \
1048 register unsigned long __a1 asm("$5") = (unsigned long) b; \
1049 register unsigned long __a2 asm("$6") = (unsigned long) c; \
1050 register unsigned long __a3 asm("$7") = (unsigned long) d; \
1051 register unsigned long __a4 asm("$8") = (unsigned long) e; \
1052 unsigned long __v0; \
1053 \
1054 __asm__ volatile ( \
1055 ".set\tnoreorder\n\t" \
1056 "li\t$2, %6\t\t\t# " #name "\n\t" \
1057 "syscall\n\t" \
1058 "move\t%0, $2\n\t" \
1059 ".set\treorder" \
1060 : "=&r" (__v0), "+r" (__a3) \
1061 : "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), "i" (__NR_##name) \
1062 : "$2", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1063 "memory"); \
1064 \
1065 if (__a3 == 0) \
1066 return (type) __v0; \
1067 errno = __v0; \
1068 return (type) -1; \
1069}
1070
1071#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
1072type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
1073{ \
1074 register unsigned long __a0 asm("$4") = (unsigned long) a; \
1075 register unsigned long __a1 asm("$5") = (unsigned long) b; \
1076 register unsigned long __a2 asm("$6") = (unsigned long) c; \
1077 register unsigned long __a3 asm("$7") = (unsigned long) d; \
1078 register unsigned long __a4 asm("$8") = (unsigned long) e; \
1079 register unsigned long __a5 asm("$9") = (unsigned long) f; \
1080 unsigned long __v0; \
1081 \
1082 __asm__ volatile ( \
1083 ".set\tnoreorder\n\t" \
1084 "li\t$2, %7\t\t\t# " #name "\n\t" \
1085 "syscall\n\t" \
1086 "move\t%0, $2\n\t" \
1087 ".set\treorder" \
1088 : "=&r" (__v0), "+r" (__a3) \
1089 : "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), "r" (__a5), \
1090 "i" (__NR_##name) \
1091 : "$2", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1092 "memory"); \
1093 \
1094 if (__a3 == 0) \
1095 return (type) __v0; \
1096 errno = __v0; \
1097 return (type) -1; \
1098}
1099
1100#endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
1101
1102#ifdef __KERNEL__
1103
1104#include <linux/config.h>
1105
1106#define __ARCH_WANT_IPC_PARSE_VERSION
1107#define __ARCH_WANT_OLD_READDIR
1108#define __ARCH_WANT_SYS_ALARM
1109#define __ARCH_WANT_SYS_GETHOSTNAME
1110#define __ARCH_WANT_SYS_PAUSE
1111#define __ARCH_WANT_SYS_SGETMASK
1112#define __ARCH_WANT_SYS_UTIME
1113#define __ARCH_WANT_SYS_WAITPID
1114#define __ARCH_WANT_SYS_SOCKETCALL
1115#define __ARCH_WANT_SYS_FADVISE64
1116#define __ARCH_WANT_SYS_GETPGRP
1117#define __ARCH_WANT_SYS_LLSEEK
1118#define __ARCH_WANT_SYS_NICE
1119#define __ARCH_WANT_SYS_OLD_GETRLIMIT
1120#define __ARCH_WANT_SYS_OLDUMOUNT
1121#define __ARCH_WANT_SYS_SIGPENDING
1122#define __ARCH_WANT_SYS_SIGPROCMASK
1123#define __ARCH_WANT_SYS_RT_SIGACTION
1124# ifndef __mips64
1125# define __ARCH_WANT_STAT64
1126# endif
1127# ifdef CONFIG_MIPS32
1128# define __ARCH_WANT_SYS_TIME
1129# endif
1130# ifdef CONFIG_MIPS32_O32
1131# define __ARCH_WANT_COMPAT_SYS_TIME
1132# endif
1133#endif
1134
1135#ifdef __KERNEL_SYSCALLS__
1136
1137#include <linux/compiler.h>
1138#include <linux/types.h>
1139#include <linux/linkage.h>
1140#include <asm/ptrace.h>
1141#include <asm/sim.h>
1142
1143/*
1144 * we need this inline - forking from kernel space will result
1145 * in NO COPY ON WRITE (!!!), until an execve is executed. This
1146 * is no problem, but for the stack. This is handled by not letting
1147 * main() use the stack at all after fork(). Thus, no function
1148 * calls - which means inline code for fork too, as otherwise we
1149 * would use the stack upon exit from 'fork()'.
1150 *
1151 * Actually only pause and fork are needed inline, so that there
1152 * won't be any messing with the stack from main(), but we define
1153 * some others too.
1154 */
1155static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
1156
1157asmlinkage unsigned long sys_mmap(
1158 unsigned long addr, size_t len,
1159 int prot, int flags,
1160 int fd, off_t offset);
1161asmlinkage long sys_mmap2(
1162 unsigned long addr, unsigned long len,
1163 unsigned long prot, unsigned long flags,
1164 unsigned long fd, unsigned long pgoff);
1165asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs);
1166asmlinkage int sys_pipe(nabi_no_regargs struct pt_regs regs);
1167asmlinkage int sys_ptrace(long request, long pid, long addr, long data);
1168struct sigaction;
1169asmlinkage long sys_rt_sigaction(int sig,
1170 const struct sigaction __user *act,
1171 struct sigaction __user *oact,
1172 size_t sigsetsize);
1173
1174#endif /* __KERNEL_SYSCALLS__ */
1175#endif /* !__ASSEMBLY__ */
1176
1177/*
1178 * "Conditional" syscalls
1179 *
1180 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
1181 * but it doesn't work on all toolchains, so we just do it by hand
1182 */
1183#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
1184
1185#endif /* _ASM_UNISTD_H */
diff --git a/include/asm-mips/user.h b/include/asm-mips/user.h
new file mode 100644
index 000000000000..89bf8b4cab3c
--- /dev/null
+++ b/include/asm-mips/user.h
@@ -0,0 +1,58 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 1995, 1996, 1999 by Ralf Baechle
7 */
8#ifndef _ASM_USER_H
9#define _ASM_USER_H
10
11#include <asm/page.h>
12#include <asm/reg.h>
13
14/*
15 * Core file format: The core file is written in such a way that gdb
16 * can understand it and provide useful information to the user (under
17 * linux we use the `trad-core' bfd, NOT the irix-core). The file
18 * contents are as follows:
19 *
20 * upage: 1 page consisting of a user struct that tells gdb
21 * what is present in the file. Directly after this is a
22 * copy of the task_struct, which is currently not used by gdb,
23 * but it may come in handy at some point. All of the registers
24 * are stored as part of the upage. The upage should always be
25 * only one page long.
26 * data: The data segment follows next. We use current->end_text to
27 * current->brk to pick up all of the user variables, plus any memory
28 * that may have been sbrk'ed. No attempt is made to determine if a
29 * page is demand-zero or if a page is totally unused, we just cover
30 * the entire range. All of the addresses are rounded in such a way
31 * that an integral number of pages is written.
32 * stack: We need the stack information in order to get a meaningful
33 * backtrace. We need to write the data from usp to
34 * current->start_stack, so we round each of these in order to be able
35 * to write an integer number of pages.
36 */
37struct user {
38 unsigned long regs[EF_SIZE / /* integer and fp regs */
39 sizeof(unsigned long) + 64];
40 size_t u_tsize; /* text size (pages) */
41 size_t u_dsize; /* data size (pages) */
42 size_t u_ssize; /* stack size (pages) */
43 unsigned long start_code; /* text starting address */
44 unsigned long start_data; /* data starting address */
45 unsigned long start_stack; /* stack starting address */
46 long int signal; /* signal causing core dump */
47 struct regs * u_ar0; /* help gdb find registers */
48 unsigned long magic; /* identifies a core file */
49 char u_comm[32]; /* user command name */
50};
51
52#define NBPG PAGE_SIZE
53#define UPAGES 1
54#define HOST_TEXT_START_ADDR (u.start_code)
55#define HOST_DATA_START_ADDR (u.start_data)
56#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
57
58#endif /* _ASM_USER_H */
diff --git a/include/asm-mips/vga.h b/include/asm-mips/vga.h
new file mode 100644
index 000000000000..6b35cf054c79
--- /dev/null
+++ b/include/asm-mips/vga.h
@@ -0,0 +1,19 @@
1/*
2 * Access to VGA videoram
3 *
4 * (c) 1998 Martin Mares <mj@ucw.cz>
5 */
6#ifndef _ASM_VGA_H
7#define _ASM_VGA_H
8
9/*
10 * On the PC, we can just recalculate addresses and then
11 * access the videoram directly without any black magic.
12 */
13
14#define VGA_MAP_MEM(x) (0xb0000000L + (unsigned long)(x))
15
16#define vga_readb(x) (*(x))
17#define vga_writeb(x,y) (*(y) = (x))
18
19#endif /* _ASM_VGA_H */
diff --git a/include/asm-mips/vr4181/irq.h b/include/asm-mips/vr4181/irq.h
new file mode 100644
index 000000000000..4bf0ea970ed0
--- /dev/null
+++ b/include/asm-mips/vr4181/irq.h
@@ -0,0 +1,122 @@
1/*
2 * Macros for vr4181 IRQ numbers.
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14/*
15 * Strategy:
16 *
17 * Vr4181 has conceptually three levels of interrupt controllers:
18 * 1. the CPU itself with 8 intr level.
19 * 2. system interrupt controller, cascaded from int0 pin in CPU, 32 intrs
20 * 3. GPIO interrupts : forwarding external interrupts to sys intr controller
21 */
22
23/* decide the irq block assignment */
24#define VR4181_NUM_CPU_IRQ 8
25#define VR4181_NUM_SYS_IRQ 32
26#define VR4181_NUM_GPIO_IRQ 16
27
28#define VR4181_IRQ_BASE 0
29
30#define VR4181_CPU_IRQ_BASE VR4181_IRQ_BASE
31#define VR4181_SYS_IRQ_BASE (VR4181_CPU_IRQ_BASE + VR4181_NUM_CPU_IRQ)
32#define VR4181_GPIO_IRQ_BASE (VR4181_SYS_IRQ_BASE + VR4181_NUM_SYS_IRQ)
33
34/* CPU interrupts */
35
36/*
37 IP0 - Software interrupt
38 IP1 - Software interrupt
39 IP2 - All but battery, high speed modem, and real time clock
40 IP3 - RTC Long1 (system timer)
41 IP4 - RTC Long2
42 IP5 - High Speed Modem (unused on VR4181)
43 IP6 - Unused
44 IP7 - Timer interrupt from CPO_COMPARE
45*/
46
47#define VR4181_IRQ_SW1 (VR4181_CPU_IRQ_BASE + 0)
48#define VR4181_IRQ_SW2 (VR4181_CPU_IRQ_BASE + 1)
49#define VR4181_IRQ_INT0 (VR4181_CPU_IRQ_BASE + 2)
50#define VR4181_IRQ_INT1 (VR4181_CPU_IRQ_BASE + 3)
51#define VR4181_IRQ_INT2 (VR4181_CPU_IRQ_BASE + 4)
52#define VR4181_IRQ_INT3 (VR4181_CPU_IRQ_BASE + 5)
53#define VR4181_IRQ_INT4 (VR4181_CPU_IRQ_BASE + 6)
54#define VR4181_IRQ_TIMER (VR4181_CPU_IRQ_BASE + 7)
55
56
57/* Cascaded from VR4181_IRQ_INT0 (ICU mapped interrupts) */
58
59/*
60 IP2 - same as VR4181_IRQ_INT1
61 IP8 - This is a cascade to GPIO IRQ's. Do not use.
62 IP16 - same as VR4181_IRQ_INT2
63 IP18 - CompactFlash
64*/
65
66#define VR4181_IRQ_BATTERY (VR4181_SYS_IRQ_BASE + 0)
67#define VR4181_IRQ_POWER (VR4181_SYS_IRQ_BASE + 1)
68#define VR4181_IRQ_RTCL1 (VR4181_SYS_IRQ_BASE + 2)
69#define VR4181_IRQ_ETIMER (VR4181_SYS_IRQ_BASE + 3)
70#define VR4181_IRQ_RFU12 (VR4181_SYS_IRQ_BASE + 4)
71#define VR4181_IRQ_PIU (VR4181_SYS_IRQ_BASE + 5)
72#define VR4181_IRQ_AIU (VR4181_SYS_IRQ_BASE + 6)
73#define VR4181_IRQ_KIU (VR4181_SYS_IRQ_BASE + 7)
74#define VR4181_IRQ_GIU (VR4181_SYS_IRQ_BASE + 8)
75#define VR4181_IRQ_SIU (VR4181_SYS_IRQ_BASE + 9)
76#define VR4181_IRQ_RFU18 (VR4181_SYS_IRQ_BASE + 10)
77#define VR4181_IRQ_SOFT (VR4181_SYS_IRQ_BASE + 11)
78#define VR4181_IRQ_RFU20 (VR4181_SYS_IRQ_BASE + 12)
79#define VR4181_IRQ_DOZEPIU (VR4181_SYS_IRQ_BASE + 13)
80#define VR4181_IRQ_RFU22 (VR4181_SYS_IRQ_BASE + 14)
81#define VR4181_IRQ_RFU23 (VR4181_SYS_IRQ_BASE + 15)
82#define VR4181_IRQ_RTCL2 (VR4181_SYS_IRQ_BASE + 16)
83#define VR4181_IRQ_LED (VR4181_SYS_IRQ_BASE + 17)
84#define VR4181_IRQ_ECU (VR4181_SYS_IRQ_BASE + 18)
85#define VR4181_IRQ_CSU (VR4181_SYS_IRQ_BASE + 19)
86#define VR4181_IRQ_USB (VR4181_SYS_IRQ_BASE + 20)
87#define VR4181_IRQ_DMA (VR4181_SYS_IRQ_BASE + 21)
88#define VR4181_IRQ_LCD (VR4181_SYS_IRQ_BASE + 22)
89#define VR4181_IRQ_RFU31 (VR4181_SYS_IRQ_BASE + 23)
90#define VR4181_IRQ_RFU32 (VR4181_SYS_IRQ_BASE + 24)
91#define VR4181_IRQ_RFU33 (VR4181_SYS_IRQ_BASE + 25)
92#define VR4181_IRQ_RFU34 (VR4181_SYS_IRQ_BASE + 26)
93#define VR4181_IRQ_RFU35 (VR4181_SYS_IRQ_BASE + 27)
94#define VR4181_IRQ_RFU36 (VR4181_SYS_IRQ_BASE + 28)
95#define VR4181_IRQ_RFU37 (VR4181_SYS_IRQ_BASE + 29)
96#define VR4181_IRQ_RFU38 (VR4181_SYS_IRQ_BASE + 30)
97#define VR4181_IRQ_RFU39 (VR4181_SYS_IRQ_BASE + 31)
98
99/* Cascaded from VR4181_IRQ_GIU */
100#define VR4181_IRQ_GPIO0 (VR4181_GPIO_IRQ_BASE + 0)
101#define VR4181_IRQ_GPIO1 (VR4181_GPIO_IRQ_BASE + 1)
102#define VR4181_IRQ_GPIO2 (VR4181_GPIO_IRQ_BASE + 2)
103#define VR4181_IRQ_GPIO3 (VR4181_GPIO_IRQ_BASE + 3)
104#define VR4181_IRQ_GPIO4 (VR4181_GPIO_IRQ_BASE + 4)
105#define VR4181_IRQ_GPIO5 (VR4181_GPIO_IRQ_BASE + 5)
106#define VR4181_IRQ_GPIO6 (VR4181_GPIO_IRQ_BASE + 6)
107#define VR4181_IRQ_GPIO7 (VR4181_GPIO_IRQ_BASE + 7)
108#define VR4181_IRQ_GPIO8 (VR4181_GPIO_IRQ_BASE + 8)
109#define VR4181_IRQ_GPIO9 (VR4181_GPIO_IRQ_BASE + 9)
110#define VR4181_IRQ_GPIO10 (VR4181_GPIO_IRQ_BASE + 10)
111#define VR4181_IRQ_GPIO11 (VR4181_GPIO_IRQ_BASE + 11)
112#define VR4181_IRQ_GPIO12 (VR4181_GPIO_IRQ_BASE + 12)
113#define VR4181_IRQ_GPIO13 (VR4181_GPIO_IRQ_BASE + 13)
114#define VR4181_IRQ_GPIO14 (VR4181_GPIO_IRQ_BASE + 14)
115#define VR4181_IRQ_GPIO15 (VR4181_GPIO_IRQ_BASE + 15)
116
117
118// Alternative to above GPIO IRQ defines
119#define VR4181_IRQ_GPIO(pin) ((VR4181_IRQ_GPIO0) + (pin))
120
121#define VR4181_IRQ_MAX (VR4181_IRQ_BASE + VR4181_NUM_CPU_IRQ + \
122 VR4181_NUM_SYS_IRQ + VR4181_NUM_GPIO_IRQ)
diff --git a/include/asm-mips/vr4181/vr4181.h b/include/asm-mips/vr4181/vr4181.h
new file mode 100644
index 000000000000..5c5d60741515
--- /dev/null
+++ b/include/asm-mips/vr4181/vr4181.h
@@ -0,0 +1,413 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999 by Michael Klar
7 *
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
10 *
11 */
12#ifndef __ASM_VR4181_VR4181_H
13#define __ASM_VR4181_VR4181_H
14
15#include <asm/addrspace.h>
16
17#include <asm/vr4181/irq.h>
18
19#ifndef __ASSEMBLY__
20#define __preg8 (volatile unsigned char*)
21#define __preg16 (volatile unsigned short*)
22#define __preg32 (volatile unsigned int*)
23#else
24#define __preg8
25#define __preg16
26#define __preg32
27#endif
28
29// Embedded CPU peripheral registers
30// Note that many of the registers have different physical address for VR4181
31
32// Bus Control Unit (BCU)
33#define VR4181_BCUCNTREG1 __preg16(KSEG1 + 0x0A000000) /* BCU control register 1 (R/W) */
34#define VR4181_CMUCLKMSK __preg16(KSEG1 + 0x0A000004) /* Clock mask register (R/W) */
35#define VR4181_CMUCLKMSK_MSKCSUPCLK 0x0040
36#define VR4181_CMUCLKMSK_MSKAIUPCLK 0x0020
37#define VR4181_CMUCLKMSK_MSKPIUPCLK 0x0010
38#define VR4181_CMUCLKMSK_MSKADUPCLK 0x0008
39#define VR4181_CMUCLKMSK_MSKSIU18M 0x0004
40#define VR4181_CMUCLKMSK_MSKADU18M 0x0002
41#define VR4181_CMUCLKMSK_MSKUSB 0x0001
42#define VR4181_CMUCLKMSK_MSKSIU VR4181_CMUCLKMSK_MSKSIU18M
43#define VR4181_BCUSPEEDREG __preg16(KSEG1 + 0x0A00000C) /* BCU access time parameter (R/W) */
44#define VR4181_BCURFCNTREG __preg16(KSEG1 + 0x0A000010) /* BCU refresh control register (R/W) */
45#define VR4181_REVIDREG __preg16(KSEG1 + 0x0A000014) /* Revision ID register (R) */
46#define VR4181_CLKSPEEDREG __preg16(KSEG1 + 0x0A000018) /* Clock speed register (R) */
47#define VR4181_EDOMCYTREG __preg16(KSEG1 + 0x0A000300) /* Memory cycle timing register (R/W) */
48#define VR4181_MEMCFG_REG __preg16(KSEG1 + 0x0A000304) /* Memory configuration register (R/W) */
49#define VR4181_MODE_REG __preg16(KSEG1 + 0x0A000308) /* SDRAM mode register (R/W) */
50#define VR4181_SDTIMINGREG __preg16(KSEG1 + 0x0A00030C) /* SDRAM timing register (R/W) */
51
52// DMA Control Unit (DCU)
53#define VR4181_MICDEST1REG1 __preg16(KSEG1 + 0x0A000020) /* Microphone destination 1 address register 1 (R/W) */
54#define VR4181_MICDEST1REG2 __preg16(KSEG1 + 0x0A000022) /* Microphone destination 1 address register 2 (R/W) */
55#define VR4181_MICDEST2REG1 __preg16(KSEG1 + 0x0A000024) /* Microphone destination 2 address register 1 (R/W) */
56#define VR4181_MICDEST2REG2 __preg16(KSEG1 + 0x0A000026) /* Microphone destination 2 address register 2 (R/W) */
57#define VR4181_SPKRRC1REG1 __preg16(KSEG1 + 0x0A000028) /* Speaker Source 1 address register 1 (R/W) */
58#define VR4181_SPKRRC1REG2 __preg16(KSEG1 + 0x0A00002A) /* Speaker Source 1 address register 2 (R/W) */
59#define VR4181_SPKRRC2REG1 __preg16(KSEG1 + 0x0A00002C) /* Speaker Source 2 address register 1 (R/W) */
60#define VR4181_SPKRRC2REG2 __preg16(KSEG1 + 0x0A00002E) /* Speaker Source 2 address register 2 (R/W) */
61#define VR4181_DMARSTREG __preg16(KSEG1 + 0x0A000040) /* DMA Reset register (R/W) */
62#define VR4181_AIUDMAMSKREG __preg16(KSEG1 + 0x0A000046) /* Audio DMA mask register (R/W) */
63#define VR4181_USBDMAMSKREG __preg16(KSEG1 + 0x0A000600) /* USB DMA Mask register (R/W) */
64#define VR4181_USBRXS1AREG1 __preg16(KSEG1 + 0x0A000602) /* USB Rx source 1 address register 1 (R/W) */
65#define VR4181_USBRXS1AREG2 __preg16(KSEG1 + 0x0A000604) /* USB Rx source 1 address register 2 (R/W) */
66#define VR4181_USBRXS2AREG1 __preg16(KSEG1 + 0x0A000606) /* USB Rx source 2 address register 1 (R/W) */
67#define VR4181_USBRXS2AREG2 __preg16(KSEG1 + 0x0A000608) /* USB Rx source 2 address register 2 (R/W) */
68#define VR4181_USBTXS1AREG1 __preg16(KSEG1 + 0x0A00060A) /* USB Tx source 1 address register 1 (R/W) */
69#define VR4181_USBTXS1AREG2 __preg16(KSEG1 + 0x0A00060C) /* USB Tx source 1 address register 2 (R/W) */
70#define VR4181_USBTXS2AREG1 __preg16(KSEG1 + 0x0A00060E) /* USB Tx source 2 address register 1 (R/W) */
71#define VR4181_USBTXS2AREG2 __preg16(KSEG1 + 0x0A000610) /* USB Tx source 2 address register 2 (R/W) */
72#define VR4181_USBRXD1AREG1 __preg16(KSEG1 + 0x0A00062A) /* USB Rx destination 1 address register 1 (R/W) */
73#define VR4181_USBRXD1AREG2 __preg16(KSEG1 + 0x0A00062C) /* USB Rx destination 1 address register 2 (R/W) */
74#define VR4181_USBRXD2AREG1 __preg16(KSEG1 + 0x0A00062E) /* USB Rx destination 2 address register 1 (R/W) */
75#define VR4181_USBRXD2AREG2 __preg16(KSEG1 + 0x0A000630) /* USB Rx destination 2 address register 2 (R/W) */
76#define VR4181_USBTXD1AREG1 __preg16(KSEG1 + 0x0A000632) /* USB Tx destination 1 address register 1 (R/W) */
77#define VR4181_USBTXD1AREG2 __preg16(KSEG1 + 0x0A000634) /* USB Tx destination 1 address register 2 (R/W) */
78#define VR4181_USBTXD2AREG1 __preg16(KSEG1 + 0x0A000636) /* USB Tx destination 2 address register 1 (R/W) */
79#define VR4181_USBTXD2AREG2 __preg16(KSEG1 + 0x0A000638) /* USB Tx destination 2 address register 2 (R/W) */
80#define VR4181_RxRCLENREG __preg16(KSEG1 + 0x0A000652) /* USB Rx record length register (R/W) */
81#define VR4181_TxRCLENREG __preg16(KSEG1 + 0x0A000654) /* USB Tx record length register (R/W) */
82#define VR4181_MICRCLENREG __preg16(KSEG1 + 0x0A000658) /* Microphone record length register (R/W) */
83#define VR4181_SPKRCLENREG __preg16(KSEG1 + 0x0A00065A) /* Speaker record length register (R/W) */
84#define VR4181_USBCFGREG __preg16(KSEG1 + 0x0A00065C) /* USB configuration register (R/W) */
85#define VR4181_MICDMACFGREG __preg16(KSEG1 + 0x0A00065E) /* Microphone DMA configuration register (R/W) */
86#define VR4181_SPKDMACFGREG __preg16(KSEG1 + 0x0A000660) /* Speaker DMA configuration register (R/W) */
87#define VR4181_DMAITRQREG __preg16(KSEG1 + 0x0A000662) /* DMA interrupt request register (R/W) */
88#define VR4181_DMACLTREG __preg16(KSEG1 + 0x0A000664) /* DMA control register (R/W) */
89#define VR4181_DMAITMKREG __preg16(KSEG1 + 0x0A000666) /* DMA interrupt mask register (R/W) */
90
91// ISA Bridge
92#define VR4181_ISABRGCTL __preg16(KSEG1 + 0x0B0002C0) /* ISA Bridge Control Register (R/W) */
93#define VR4181_ISABRGSTS __preg16(KSEG1 + 0x0B0002C2) /* ISA Bridge Status Register (R/W) */
94#define VR4181_XISACTL __preg16(KSEG1 + 0x0B0002C4) /* External ISA Control Register (R/W) */
95
96// Clocked Serial Interface (CSI)
97#define VR4181_CSIMODE __preg16(KSEG1 + 0x0B000900) /* CSI Mode Register (R/W) */
98#define VR4181_CSIRXDATA __preg16(KSEG1 + 0x0B000902) /* CSI Receive Data Register (R) */
99#define VR4181_CSITXDATA __preg16(KSEG1 + 0x0B000904) /* CSI Transmit Data Register (R/W) */
100#define VR4181_CSILSTAT __preg16(KSEG1 + 0x0B000906) /* CSI Line Status Register (R/W) */
101#define VR4181_CSIINTMSK __preg16(KSEG1 + 0x0B000908) /* CSI Interrupt Mask Register (R/W) */
102#define VR4181_CSIINTSTAT __preg16(KSEG1 + 0x0B00090a) /* CSI Interrupt Status Register (R/W) */
103#define VR4181_CSITXBLEN __preg16(KSEG1 + 0x0B00090c) /* CSI Transmit Burst Length Register (R/W) */
104#define VR4181_CSIRXBLEN __preg16(KSEG1 + 0x0B00090e) /* CSI Receive Burst Length Register (R/W) */
105
106// Interrupt Control Unit (ICU)
107#define VR4181_SYSINT1REG __preg16(KSEG1 + 0x0A000080) /* Level 1 System interrupt register 1 (R) */
108#define VR4181_MSYSINT1REG __preg16(KSEG1 + 0x0A00008C) /* Level 1 mask system interrupt register 1 (R/W) */
109#define VR4181_NMIREG __preg16(KSEG1 + 0x0A000098) /* NMI register (R/W) */
110#define VR4181_SOFTINTREG __preg16(KSEG1 + 0x0A00009A) /* Software interrupt register (R/W) */
111#define VR4181_SYSINT2REG __preg16(KSEG1 + 0x0A000200) /* Level 1 System interrupt register 2 (R) */
112#define VR4181_MSYSINT2REG __preg16(KSEG1 + 0x0A000206) /* Level 1 mask system interrupt register 2 (R/W) */
113#define VR4181_PIUINTREGro __preg16(KSEG1 + 0x0B000082) /* Level 2 PIU interrupt register (R) */
114#define VR4181_AIUINTREG __preg16(KSEG1 + 0x0B000084) /* Level 2 AIU interrupt register (R) */
115#define VR4181_MPIUINTREG __preg16(KSEG1 + 0x0B00008E) /* Level 2 mask PIU interrupt register (R/W) */
116#define VR4181_MAIUINTREG __preg16(KSEG1 + 0x0B000090) /* Level 2 mask AIU interrupt register (R/W) */
117#define VR4181_MKIUINTREG __preg16(KSEG1 + 0x0B000092) /* Level 2 mask KIU interrupt register (R/W) */
118#define VR4181_KIUINTREG __preg16(KSEG1 + 0x0B000198) /* Level 2 KIU interrupt register (R) */
119
120// Power Management Unit (PMU)
121#define VR4181_PMUINTREG __preg16(KSEG1 + 0x0B0000A0) /* PMU Status Register (R/W) */
122#define VR4181_PMUINT_POWERSW 0x1 /* Power switch */
123#define VR4181_PMUINT_BATT 0x2 /* Low batt during normal operation */
124#define VR4181_PMUINT_DEADMAN 0x4 /* Deadman's switch */
125#define VR4181_PMUINT_RESET 0x8 /* Reset switch */
126#define VR4181_PMUINT_RTCRESET 0x10 /* RTC Reset */
127#define VR4181_PMUINT_TIMEOUT 0x20 /* HAL Timer Reset */
128#define VR4181_PMUINT_BATTLOW 0x100 /* Battery low */
129#define VR4181_PMUINT_RTC 0x200 /* RTC Alarm */
130#define VR4181_PMUINT_DCD 0x400 /* DCD# */
131#define VR4181_PMUINT_GPIO0 0x1000 /* GPIO0 */
132#define VR4181_PMUINT_GPIO1 0x2000 /* GPIO1 */
133#define VR4181_PMUINT_GPIO2 0x4000 /* GPIO2 */
134#define VR4181_PMUINT_GPIO3 0x8000 /* GPIO3 */
135
136#define VR4181_PMUCNTREG __preg16(KSEG1 + 0x0B0000A2) /* PMU Control Register (R/W) */
137#define VR4181_PMUWAITREG __preg16(KSEG1 + 0x0B0000A8) /* PMU Wait Counter Register (R/W) */
138#define VR4181_PMUDIVREG __preg16(KSEG1 + 0x0B0000AC) /* PMU Divide Mode Register (R/W) */
139#define VR4181_DRAMHIBCTL __preg16(KSEG1 + 0x0B0000B2) /* DRAM Hibernate Control Register (R/W) */
140
141// Real Time Clock Unit (RTC)
142#define VR4181_ETIMELREG __preg16(KSEG1 + 0x0B0000C0) /* Elapsed Time L Register (R/W) */
143#define VR4181_ETIMEMREG __preg16(KSEG1 + 0x0B0000C2) /* Elapsed Time M Register (R/W) */
144#define VR4181_ETIMEHREG __preg16(KSEG1 + 0x0B0000C4) /* Elapsed Time H Register (R/W) */
145#define VR4181_ECMPLREG __preg16(KSEG1 + 0x0B0000C8) /* Elapsed Compare L Register (R/W) */
146#define VR4181_ECMPMREG __preg16(KSEG1 + 0x0B0000CA) /* Elapsed Compare M Register (R/W) */
147#define VR4181_ECMPHREG __preg16(KSEG1 + 0x0B0000CC) /* Elapsed Compare H Register (R/W) */
148#define VR4181_RTCL1LREG __preg16(KSEG1 + 0x0B0000D0) /* RTC Long 1 L Register (R/W) */
149#define VR4181_RTCL1HREG __preg16(KSEG1 + 0x0B0000D2) /* RTC Long 1 H Register (R/W) */
150#define VR4181_RTCL1CNTLREG __preg16(KSEG1 + 0x0B0000D4) /* RTC Long 1 Count L Register (R) */
151#define VR4181_RTCL1CNTHREG __preg16(KSEG1 + 0x0B0000D6) /* RTC Long 1 Count H Register (R) */
152#define VR4181_RTCL2LREG __preg16(KSEG1 + 0x0B0000D8) /* RTC Long 2 L Register (R/W) */
153#define VR4181_RTCL2HREG __preg16(KSEG1 + 0x0B0000DA) /* RTC Long 2 H Register (R/W) */
154#define VR4181_RTCL2CNTLREG __preg16(KSEG1 + 0x0B0000DC) /* RTC Long 2 Count L Register (R) */
155#define VR4181_RTCL2CNTHREG __preg16(KSEG1 + 0x0B0000DE) /* RTC Long 2 Count H Register (R) */
156#define VR4181_RTCINTREG __preg16(KSEG1 + 0x0B0001DE) /* RTC Interrupt Register (R/W) */
157
158// Deadman's Switch Unit (DSU)
159#define VR4181_DSUCNTREG __preg16(KSEG1 + 0x0B0000E0) /* DSU Control Register (R/W) */
160#define VR4181_DSUSETREG __preg16(KSEG1 + 0x0B0000E2) /* DSU Dead Time Set Register (R/W) */
161#define VR4181_DSUCLRREG __preg16(KSEG1 + 0x0B0000E4) /* DSU Clear Register (W) */
162#define VR4181_DSUTIMREG __preg16(KSEG1 + 0x0B0000E6) /* DSU Elapsed Time Register (R/W) */
163
164// General Purpose I/O Unit (GIU)
165#define VR4181_GPMD0REG __preg16(KSEG1 + 0x0B000300) /* GPIO Mode 0 Register (R/W) */
166#define VR4181_GPMD1REG __preg16(KSEG1 + 0x0B000302) /* GPIO Mode 1 Register (R/W) */
167#define VR4181_GPMD2REG __preg16(KSEG1 + 0x0B000304) /* GPIO Mode 2 Register (R/W) */
168#define VR4181_GPMD3REG __preg16(KSEG1 + 0x0B000306) /* GPIO Mode 3 Register (R/W) */
169#define VR4181_GPDATHREG __preg16(KSEG1 + 0x0B000308) /* GPIO Data High Register (R/W) */
170#define VR4181_GPDATHREG_GPIO16 0x0001
171#define VR4181_GPDATHREG_GPIO17 0x0002
172#define VR4181_GPDATHREG_GPIO18 0x0004
173#define VR4181_GPDATHREG_GPIO19 0x0008
174#define VR4181_GPDATHREG_GPIO20 0x0010
175#define VR4181_GPDATHREG_GPIO21 0x0020
176#define VR4181_GPDATHREG_GPIO22 0x0040
177#define VR4181_GPDATHREG_GPIO23 0x0080
178#define VR4181_GPDATHREG_GPIO24 0x0100
179#define VR4181_GPDATHREG_GPIO25 0x0200
180#define VR4181_GPDATHREG_GPIO26 0x0400
181#define VR4181_GPDATHREG_GPIO27 0x0800
182#define VR4181_GPDATHREG_GPIO28 0x1000
183#define VR4181_GPDATHREG_GPIO29 0x2000
184#define VR4181_GPDATHREG_GPIO30 0x4000
185#define VR4181_GPDATHREG_GPIO31 0x8000
186#define VR4181_GPDATLREG __preg16(KSEG1 + 0x0B00030A) /* GPIO Data Low Register (R/W) */
187#define VR4181_GPDATLREG_GPIO0 0x0001
188#define VR4181_GPDATLREG_GPIO1 0x0002
189#define VR4181_GPDATLREG_GPIO2 0x0004
190#define VR4181_GPDATLREG_GPIO3 0x0008
191#define VR4181_GPDATLREG_GPIO4 0x0010
192#define VR4181_GPDATLREG_GPIO5 0x0020
193#define VR4181_GPDATLREG_GPIO6 0x0040
194#define VR4181_GPDATLREG_GPIO7 0x0080
195#define VR4181_GPDATLREG_GPIO8 0x0100
196#define VR4181_GPDATLREG_GPIO9 0x0200
197#define VR4181_GPDATLREG_GPIO10 0x0400
198#define VR4181_GPDATLREG_GPIO11 0x0800
199#define VR4181_GPDATLREG_GPIO12 0x1000
200#define VR4181_GPDATLREG_GPIO13 0x2000
201#define VR4181_GPDATLREG_GPIO14 0x4000
202#define VR4181_GPDATLREG_GPIO15 0x8000
203#define VR4181_GPINTEN __preg16(KSEG1 + 0x0B00030C) /* GPIO Interrupt Enable Register (R/W) */
204#define VR4181_GPINTMSK __preg16(KSEG1 + 0x0B00030E) /* GPIO Interrupt Mask Register (R/W) */
205#define VR4181_GPINTTYPH __preg16(KSEG1 + 0x0B000310) /* GPIO Interrupt Type High Register (R/W) */
206#define VR4181_GPINTTYPL __preg16(KSEG1 + 0x0B000312) /* GPIO Interrupt Type Low Register (R/W) */
207#define VR4181_GPINTSTAT __preg16(KSEG1 + 0x0B000314) /* GPIO Interrupt Status Register (R/W) */
208#define VR4181_GPHIBSTH __preg16(KSEG1 + 0x0B000316) /* GPIO Hibernate Pin State High Register (R/W) */
209#define VR4181_GPHIBSTL __preg16(KSEG1 + 0x0B000318) /* GPIO Hibernate Pin State Low Register (R/W) */
210#define VR4181_GPSICTL __preg16(KSEG1 + 0x0B00031A) /* GPIO Serial Interface Control Register (R/W) */
211#define VR4181_KEYEN __preg16(KSEG1 + 0x0B00031C) /* Keyboard Scan Pin Enable Register (R/W) */
212#define VR4181_PCS0STRA __preg16(KSEG1 + 0x0B000320) /* Programmable Chip Select [0] Start Address Register (R/W) */
213#define VR4181_PCS0STPA __preg16(KSEG1 + 0x0B000322) /* Programmable Chip Select [0] Stop Address Register (R/W) */
214#define VR4181_PCS0HIA __preg16(KSEG1 + 0x0B000324) /* Programmable Chip Select [0] High Address Register (R/W) */
215#define VR4181_PCS1STRA __preg16(KSEG1 + 0x0B000326) /* Programmable Chip Select [1] Start Address Register (R/W) */
216#define VR4181_PCS1STPA __preg16(KSEG1 + 0x0B000328) /* Programmable Chip Select [1] Stop Address Register (R/W) */
217#define VR4181_PCS1HIA __preg16(KSEG1 + 0x0B00032A) /* Programmable Chip Select [1] High Address Register (R/W) */
218#define VR4181_PCSMODE __preg16(KSEG1 + 0x0B00032C) /* Programmable Chip Select Mode Register (R/W) */
219#define VR4181_LCDGPMODE __preg16(KSEG1 + 0x0B00032E) /* LCD General Purpose Mode Register (R/W) */
220#define VR4181_MISCREG0 __preg16(KSEG1 + 0x0B000330) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
221#define VR4181_MISCREG1 __preg16(KSEG1 + 0x0B000332) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
222#define VR4181_MISCREG2 __preg16(KSEG1 + 0x0B000334) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
223#define VR4181_MISCREG3 __preg16(KSEG1 + 0x0B000336) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
224#define VR4181_MISCREG4 __preg16(KSEG1 + 0x0B000338) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
225#define VR4181_MISCREG5 __preg16(KSEG1 + 0x0B00033A) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
226#define VR4181_MISCREG6 __preg16(KSEG1 + 0x0B00033C) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
227#define VR4181_MISCREG7 __preg16(KSEG1 + 0x0B00033D) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
228#define VR4181_MISCREG8 __preg16(KSEG1 + 0x0B000340) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
229#define VR4181_MISCREG9 __preg16(KSEG1 + 0x0B000342) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
230#define VR4181_MISCREG10 __preg16(KSEG1 + 0x0B000344) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
231#define VR4181_MISCREG11 __preg16(KSEG1 + 0x0B000346) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
232#define VR4181_MISCREG12 __preg16(KSEG1 + 0x0B000348) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
233#define VR4181_MISCREG13 __preg16(KSEG1 + 0x0B00034A) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
234#define VR4181_MISCREG14 __preg16(KSEG1 + 0x0B00034C) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
235#define VR4181_MISCREG15 __preg16(KSEG1 + 0x0B00034E) /* Misc. R/W Battery Backed Registers for Non-Volatile Storage (R/W) */
236#define VR4181_SECIRQMASKL VR4181_GPINTEN
237// No SECIRQMASKH for VR4181
238
239// Touch Panel Interface Unit (PIU)
240#define VR4181_PIUCNTREG __preg16(KSEG1 + 0x0B000122) /* PIU Control register (R/W) */
241#define VR4181_PIUCNTREG_PIUSEQEN 0x0004
242#define VR4181_PIUCNTREG_PIUPWR 0x0002
243#define VR4181_PIUCNTREG_PADRST 0x0001
244
245#define VR4181_PIUINTREG __preg16(KSEG1 + 0x0B000124) /* PIU Interrupt cause register (R/W) */
246#define VR4181_PIUINTREG_OVP 0x8000
247#define VR4181_PIUINTREG_PADCMD 0x0040
248#define VR4181_PIUINTREG_PADADP 0x0020
249#define VR4181_PIUINTREG_PADPAGE1 0x0010
250#define VR4181_PIUINTREG_PADPAGE0 0x0008
251#define VR4181_PIUINTREG_PADDLOST 0x0004
252#define VR4181_PIUINTREG_PENCHG 0x0001
253
254#define VR4181_PIUSIVLREG __preg16(KSEG1 + 0x0B000126) /* PIU Data sampling interval register (R/W) */
255#define VR4181_PIUSTBLREG __preg16(KSEG1 + 0x0B000128) /* PIU A/D converter start delay register (R/W) */
256#define VR4181_PIUCMDREG __preg16(KSEG1 + 0x0B00012A) /* PIU A/D command register (R/W) */
257#define VR4181_PIUASCNREG __preg16(KSEG1 + 0x0B000130) /* PIU A/D port scan register (R/W) */
258#define VR4181_PIUAMSKREG __preg16(KSEG1 + 0x0B000132) /* PIU A/D scan mask register (R/W) */
259#define VR4181_PIUCIVLREG __preg16(KSEG1 + 0x0B00013E) /* PIU Check interval register (R) */
260#define VR4181_PIUPB00REG __preg16(KSEG1 + 0x0B0002A0) /* PIU Page 0 Buffer 0 register (R/W) */
261#define VR4181_PIUPB01REG __preg16(KSEG1 + 0x0B0002A2) /* PIU Page 0 Buffer 1 register (R/W) */
262#define VR4181_PIUPB02REG __preg16(KSEG1 + 0x0B0002A4) /* PIU Page 0 Buffer 2 register (R/W) */
263#define VR4181_PIUPB03REG __preg16(KSEG1 + 0x0B0002A6) /* PIU Page 0 Buffer 3 register (R/W) */
264#define VR4181_PIUPB10REG __preg16(KSEG1 + 0x0B0002A8) /* PIU Page 1 Buffer 0 register (R/W) */
265#define VR4181_PIUPB11REG __preg16(KSEG1 + 0x0B0002AA) /* PIU Page 1 Buffer 1 register (R/W) */
266#define VR4181_PIUPB12REG __preg16(KSEG1 + 0x0B0002AC) /* PIU Page 1 Buffer 2 register (R/W) */
267#define VR4181_PIUPB13REG __preg16(KSEG1 + 0x0B0002AE) /* PIU Page 1 Buffer 3 register (R/W) */
268#define VR4181_PIUAB0REG __preg16(KSEG1 + 0x0B0002B0) /* PIU A/D scan Buffer 0 register (R/W) */
269#define VR4181_PIUAB1REG __preg16(KSEG1 + 0x0B0002B2) /* PIU A/D scan Buffer 1 register (R/W) */
270#define VR4181_PIUAB2REG __preg16(KSEG1 + 0x0B0002B4) /* PIU A/D scan Buffer 2 register (R/W) */
271#define VR4181_PIUAB3REG __preg16(KSEG1 + 0x0B0002B6) /* PIU A/D scan Buffer 3 register (R/W) */
272#define VR4181_PIUPB04REG __preg16(KSEG1 + 0x0B0002BC) /* PIU Page 0 Buffer 4 register (R/W) */
273#define VR4181_PIUPB14REG __preg16(KSEG1 + 0x0B0002BE) /* PIU Page 1 Buffer 4 register (R/W) */
274
275// Audio Interface Unit (AIU)
276#define VR4181_SODATREG __preg16(KSEG1 + 0x0B000166) /* Speaker Output Data Register (R/W) */
277#define VR4181_SCNTREG __preg16(KSEG1 + 0x0B000168) /* Speaker Output Control Register (R/W) */
278#define VR4181_MIDATREG __preg16(KSEG1 + 0x0B000170) /* Mike Input Data Register (R/W) */
279#define VR4181_MCNTREG __preg16(KSEG1 + 0x0B000172) /* Mike Input Control Register (R/W) */
280#define VR4181_DVALIDREG __preg16(KSEG1 + 0x0B000178) /* Data Valid Register (R/W) */
281#define VR4181_SEQREG __preg16(KSEG1 + 0x0B00017A) /* Sequential Register (R/W) */
282#define VR4181_INTREG __preg16(KSEG1 + 0x0B00017C) /* Interrupt Register (R/W) */
283#define VR4181_SDMADATREG __preg16(KSEG1 + 0x0B000160) /* Speaker DMA Data Register (R/W) */
284#define VR4181_MDMADATREG __preg16(KSEG1 + 0x0B000162) /* Microphone DMA Data Register (R/W) */
285#define VR4181_DAVREF_SETUP __preg16(KSEG1 + 0x0B000164) /* DAC Vref setup register (R/W) */
286#define VR4181_SCNVC_END __preg16(KSEG1 + 0x0B00016E) /* Speaker sample rate control (R/W) */
287#define VR4181_MIDATREG __preg16(KSEG1 + 0x0B000170) /* Microphone Input Data Register (R/W) */
288#define VR4181_MCNTREG __preg16(KSEG1 + 0x0B000172) /* Microphone Input Control Register (R/W) */
289#define VR4181_MCNVC_END __preg16(KSEG1 + 0x0B00017E) /* Microphone sample rate control (R/W) */
290
291// Keyboard Interface Unit (KIU)
292#define VR4181_KIUDAT0 __preg16(KSEG1 + 0x0B000180) /* KIU Data0 Register (R/W) */
293#define VR4181_KIUDAT1 __preg16(KSEG1 + 0x0B000182) /* KIU Data1 Register (R/W) */
294#define VR4181_KIUDAT2 __preg16(KSEG1 + 0x0B000184) /* KIU Data2 Register (R/W) */
295#define VR4181_KIUDAT3 __preg16(KSEG1 + 0x0B000186) /* KIU Data3 Register (R/W) */
296#define VR4181_KIUDAT4 __preg16(KSEG1 + 0x0B000188) /* KIU Data4 Register (R/W) */
297#define VR4181_KIUDAT5 __preg16(KSEG1 + 0x0B00018A) /* KIU Data5 Register (R/W) */
298#define VR4181_KIUSCANREP __preg16(KSEG1 + 0x0B000190) /* KIU Scan/Repeat Register (R/W) */
299#define VR4181_KIUSCANREP_KEYEN 0x8000
300#define VR4181_KIUSCANREP_SCANSTP 0x0008
301#define VR4181_KIUSCANREP_SCANSTART 0x0004
302#define VR4181_KIUSCANREP_ATSTP 0x0002
303#define VR4181_KIUSCANREP_ATSCAN 0x0001
304#define VR4181_KIUSCANS __preg16(KSEG1 + 0x0B000192) /* KIU Scan Status Register (R) */
305#define VR4181_KIUWKS __preg16(KSEG1 + 0x0B000194) /* KIU Wait Keyscan Stable Register (R/W) */
306#define VR4181_KIUWKI __preg16(KSEG1 + 0x0B000196) /* KIU Wait Keyscan Interval Register (R/W) */
307#define VR4181_KIUINT __preg16(KSEG1 + 0x0B000198) /* KIU Interrupt Register (R/W) */
308#define VR4181_KIUINT_KDATLOST 0x0004
309#define VR4181_KIUINT_KDATRDY 0x0002
310#define VR4181_KIUINT_SCANINT 0x0001
311#define VR4181_KIUDAT6 __preg16(KSEG1 + 0x0B00018C) /* Scan Line 6 Key Data Register (R) */
312#define VR4181_KIUDAT7 __preg16(KSEG1 + 0x0B00018E) /* Scan Line 7 Key Data Register (R) */
313
314// CompactFlash Controller
315#define VR4181_PCCARDINDEX __preg8(KSEG1 + 0x0B0008E0) /* PC Card Controller Index Register */
316#define VR4181_PCCARDDATA __preg8(KSEG1 + 0x0B0008E1) /* PC Card Controller Data Register */
317#define VR4181_INTSTATREG __preg16(KSEG1 + 0x0B0008F8) /* Interrupt Status Register (R/W) */
318#define VR4181_INTMSKREG __preg16(KSEG1 + 0x0B0008FA) /* Interrupt Mask Register (R/W) */
319#define VR4181_CFG_REG_1 __preg16(KSEG1 + 0x0B0008FE) /* Configuration Register 1 */
320
321// LED Control Unit (LED)
322#define VR4181_LEDHTSREG __preg16(KSEG1 + 0x0B000240) /* LED H Time Set register (R/W) */
323#define VR4181_LEDLTSREG __preg16(KSEG1 + 0x0B000242) /* LED L Time Set register (R/W) */
324#define VR4181_LEDCNTREG __preg16(KSEG1 + 0x0B000248) /* LED Control register (R/W) */
325#define VR4181_LEDASTCREG __preg16(KSEG1 + 0x0B00024A) /* LED Auto Stop Time Count register (R/W) */
326#define VR4181_LEDINTREG __preg16(KSEG1 + 0x0B00024C) /* LED Interrupt register (R/W) */
327
328// Serial Interface Unit (SIU / SIU1 and SIU2)
329#define VR4181_SIURB __preg8(KSEG1 + 0x0C000010) /* Receiver Buffer Register (Read) DLAB = 0 (R) */
330#define VR4181_SIUTH __preg8(KSEG1 + 0x0C000010) /* Transmitter Holding Register (Write) DLAB = 0 (W) */
331#define VR4181_SIUDLL __preg8(KSEG1 + 0x0C000010) /* Divisor Latch (Least Significant Byte) DLAB = 1 (R/W) */
332#define VR4181_SIUIE __preg8(KSEG1 + 0x0C000011) /* Interrupt Enable DLAB = 0 (R/W) */
333#define VR4181_SIUDLM __preg8(KSEG1 + 0x0C000011) /* Divisor Latch (Most Significant Byte) DLAB = 1 (R/W) */
334#define VR4181_SIUIID __preg8(KSEG1 + 0x0C000012) /* Interrupt Identification Register (Read) (R) */
335#define VR4181_SIUFC __preg8(KSEG1 + 0x0C000012) /* FIFO Control Register (Write) (W) */
336#define VR4181_SIULC __preg8(KSEG1 + 0x0C000013) /* Line Control Register (R/W) */
337#define VR4181_SIUMC __preg8(KSEG1 + 0x0C000014) /* MODEM Control Register (R/W) */
338#define VR4181_SIULS __preg8(KSEG1 + 0x0C000015) /* Line Status Register (R/W) */
339#define VR4181_SIUMS __preg8(KSEG1 + 0x0C000016) /* MODEM Status Register (R/W) */
340#define VR4181_SIUSC __preg8(KSEG1 + 0x0C000017) /* Scratch Register (R/W) */
341#define VR4181_SIURESET __preg8(KSEG1 + 0x0C000019) /* SIU Reset Register (R/W) */
342#define VR4181_SIUACTMSK __preg8(KSEG1 + 0x0C00001C) /* SIU Activity Mask (R/W) */
343#define VR4181_SIUACTTMR __preg8(KSEG1 + 0x0C00001E) /* SIU Activity Timer (R/W) */
344#define VR4181_SIURB_2 __preg8(KSEG1 + 0x0C000000) /* Receive Buffer Register (Read) (R) */
345#define VR4181_SIUTH_2 __preg8(KSEG1 + 0x0C000000) /* Transmitter Holding Register (Write) (W) */
346#define VR4181_SIUDLL_2 __preg8(KSEG1 + 0x0C000000) /* Divisor Latch (Least Significant Byte) (R/W) */
347#define VR4181_SIUIE_2 __preg8(KSEG1 + 0x0C000001) /* Interrupt Enable (DLAB = 0) (R/W) */
348#define VR4181_SIUDLM_2 __preg8(KSEG1 + 0x0C000001) /* Divisor Latch (Most Significant Byte) (DLAB = 1) (R/W) */
349#define VR4181_SIUIID_2 __preg8(KSEG1 + 0x0C000002) /* Interrupt Identification Register (Read) (R) */
350#define VR4181_SIUFC_2 __preg8(KSEG1 + 0x0C000002) /* FIFO Control Register (Write) (W) */
351#define VR4181_SIULC_2 __preg8(KSEG1 + 0x0C000003) /* Line Control Register (R/W) */
352#define VR4181_SIUMC_2 __preg8(KSEG1 + 0x0C000004) /* Modem Control Register (R/W) */
353#define VR4181_SIULS_2 __preg8(KSEG1 + 0x0C000005) /* Line Status Register (R/W) */
354#define VR4181_SIUMS_2 __preg8(KSEG1 + 0x0C000006) /* Modem Status Register (R/W) */
355#define VR4181_SIUSC_2 __preg8(KSEG1 + 0x0C000007) /* Scratch Register (R/W) */
356#define VR4181_SIUIRSEL_2 __preg8(KSEG1 + 0x0C000008) /* SIU IrDA Selectot (R/W) */
357#define VR4181_SIURESET_2 __preg8(KSEG1 + 0x0C000009) /* SIU Reset Register (R/W) */
358#define VR4181_SIUCSEL_2 __preg8(KSEG1 + 0x0C00000A) /* IrDA Echo-back Control (R/W) */
359#define VR4181_SIUACTMSK_2 __preg8(KSEG1 + 0x0C00000C) /* SIU Activity Mask Register (R/W) */
360#define VR4181_SIUACTTMR_2 __preg8(KSEG1 + 0x0C00000E) /* SIU Activity Timer Register (R/W) */
361
362
363// USB Module
364#define VR4181_USBINFIFO __preg16(KSEG1 + 0x0B000780) /* USB Bulk Input FIFO (Bulk In End Point) (W) */
365#define VR4181_USBOUTFIFO __preg16(KSEG1 + 0x0B000782) /* USB Bulk Output FIFO (Bulk Out End Point) (R) */
366#define VR4181_USBCTLFIFO __preg16(KSEG1 + 0x0B000784) /* USB Control FIFO (Control End Point) (W) */
367#define VR4181_USBSTAT __preg16(KSEG1 + 0x0B000786) /* Interrupt Status Register (R/W) */
368#define VR4181_USBINTMSK __preg16(KSEG1 + 0x0B000788) /* Interrupt Mask Register (R/W) */
369#define VR4181_USBCTLREG __preg16(KSEG1 + 0x0B00078A) /* Control Register (R/W) */
370#define VR4181_USBSTPREG __preg16(KSEG1 + 0x0B00078C) /* USB Transfer Stop Register (R/W) */
371
372// LCD Controller
373#define VR4181_HRTOTALREG __preg16(KSEG1 + 0x0A000400) /* Horizontal total Register (R/W) */
374#define VR4181_HRVISIBREG __preg16(KSEG1 + 0x0A000402) /* Horizontal Visible Register (R/W) */
375#define VR4181_LDCLKSTREG __preg16(KSEG1 + 0x0A000404) /* Load clock start Register (R/W) */
376#define VR4181_LDCLKNDREG __preg16(KSEG1 + 0x0A000406) /* Load clock end Register (R/W) */
377#define VR4181_VRTOTALREG __preg16(KSEG1 + 0x0A000408) /* Vertical Total Register (R/W) */
378#define VR4181_VRVISIBREG __preg16(KSEG1 + 0x0A00040A) /* Vertical Visible Register (R/W) */
379#define VR4181_FVSTARTREG __preg16(KSEG1 + 0x0A00040C) /* FLM vertical start Register (R/W) */
380#define VR4181_FVENDREG __preg16(KSEG1 + 0x0A00040E) /* FLM vertical end Register (R/W) */
381#define VR4181_LCDCTRLREG __preg16(KSEG1 + 0x0A000410) /* LCD control Register (R/W) */
382#define VR4181_LCDINRQREG __preg16(KSEG1 + 0x0A000412) /* LCD Interrupt request Register (R/W) */
383#define VR4181_LCDCFGREG0 __preg16(KSEG1 + 0x0A000414) /* LCD Configuration Register 0 (R/W) */
384#define VR4181_LCDCFGREG1 __preg16(KSEG1 + 0x0A000416) /* LCD Configuration Register 1 (R/W) */
385#define VR4181_FBSTAD1REG __preg16(KSEG1 + 0x0A000418) /* Frame Buffer Start Address 1 Register (R/W) */
386#define VR4181_FBSTAD2REG __preg16(KSEG1 + 0x0A00041A) /* Frame Buffer Start Address 2 Register (R/W) */
387#define VR4181_FBNDAD1REG __preg16(KSEG1 + 0x0A000420) /* Frame Buffer End Address 1 Register (R/W) */
388#define VR4181_FBNDAD2REG __preg16(KSEG1 + 0x0A000422) /* Frame Buffer End Address 2 register (R/W) */
389#define VR4181_FHSTARTREG __preg16(KSEG1 + 0x0A000424) /* FLM horizontal Start Register (R/W) */
390#define VR4181_FHENDREG __preg16(KSEG1 + 0x0A000426) /* FLM horizontal End Register (R/W) */
391#define VR4181_PWRCONREG1 __preg16(KSEG1 + 0x0A000430) /* Power Control register 1 (R/W) */
392#define VR4181_PWRCONREG2 __preg16(KSEG1 + 0x0A000432) /* Power Control register 2 (R/W) */
393#define VR4181_LCDIMSKREG __preg16(KSEG1 + 0x0A000434) /* LCD Interrupt Mask register (R/W) */
394#define VR4181_CPINDCTREG __preg16(KSEG1 + 0x0A00047E) /* Color palette Index and control Register (R/W) */
395#define VR4181_CPALDATREG __preg32(KSEG1 + 0x0A000480) /* Color palette data register (32bits Register) (R/W) */
396
397// physical address spaces
398#define VR4181_LCD 0x0a000000
399#define VR4181_INTERNAL_IO_2 0x0b000000
400#define VR4181_INTERNAL_IO_1 0x0c000000
401#define VR4181_ISA_MEM 0x10000000
402#define VR4181_ISA_IO 0x14000000
403#define VR4181_ROM 0x18000000
404
405// This is the base address for IO port decoding to which the 16 bit IO port address
406// is added. Defining it to 0 will usually cause a kernel oops any time port IO is
407// attempted, which can be handy for turning up parts of the kernel that make
408// incorrect architecture assumptions (by assuming that everything acts like a PC),
409// but we need it correctly defined to use the PCMCIA/CF controller:
410#define VR4181_PORT_BASE (KSEG1 + VR4181_ISA_IO)
411#define VR4181_ISAMEM_BASE (KSEG1 + VR4181_ISA_MEM)
412
413#endif /* __ASM_VR4181_VR4181_H */
diff --git a/include/asm-mips/vr41xx/capcella.h b/include/asm-mips/vr41xx/capcella.h
new file mode 100644
index 000000000000..5b55083c5281
--- /dev/null
+++ b/include/asm-mips/vr41xx/capcella.h
@@ -0,0 +1,43 @@
1/*
2 * capcella.h, Include file for ZAO Networks Capcella.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ZAO_CAPCELLA_H
21#define __ZAO_CAPCELLA_H
22
23#include <asm/vr41xx/vr41xx.h>
24
25/*
26 * General-Purpose I/O Pin Number
27 */
28#define PC104PLUS_INTA_PIN 2
29#define PC104PLUS_INTB_PIN 3
30#define PC104PLUS_INTC_PIN 4
31#define PC104PLUS_INTD_PIN 5
32
33/*
34 * Interrupt Number
35 */
36#define RTL8139_1_IRQ GIU_IRQ(PC104PLUS_INTC_PIN)
37#define RTL8139_2_IRQ GIU_IRQ(PC104PLUS_INTD_PIN)
38#define PC104PLUS_INTA_IRQ GIU_IRQ(PC104PLUS_INTA_PIN)
39#define PC104PLUS_INTB_IRQ GIU_IRQ(PC104PLUS_INTB_PIN)
40#define PC104PLUS_INTC_IRQ GIU_IRQ(PC104PLUS_INTC_PIN)
41#define PC104PLUS_INTD_IRQ GIU_IRQ(PC104PLUS_INTD_PIN)
42
43#endif /* __ZAO_CAPCELLA_H */
diff --git a/include/asm-mips/vr41xx/cmbvr4133.h b/include/asm-mips/vr41xx/cmbvr4133.h
new file mode 100644
index 000000000000..42af389019ea
--- /dev/null
+++ b/include/asm-mips/vr41xx/cmbvr4133.h
@@ -0,0 +1,61 @@
1/*
2 * include/asm-mips/vr41xx/cmbvr4133.h
3 *
4 * Include file for NEC CMB-VR4133.
5 *
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and
7 * Jun Sun <jsun@mvista.com, or source@mvista.com> and
8 * Alex Sapkov <asapkov@ru.mvista.com>
9 *
10 * 2002-2004 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15#ifndef __NEC_CMBVR4133_H
16#define __NEC_CMBVR4133_H
17
18#include <asm/addrspace.h>
19#include <asm/vr41xx/vr41xx.h>
20
21/*
22 * General-Purpose I/O Pin Number
23 */
24#define CMBVR41XX_INTA_PIN 1
25#define CMBVR41XX_INTB_PIN 1
26#define CMBVR41XX_INTC_PIN 3
27#define CMBVR41XX_INTD_PIN 1
28#define CMBVR41XX_INTE_PIN 1
29
30/*
31 * Interrupt Number
32 */
33#define CMBVR41XX_INTA_IRQ GIU_IRQ(CMBVR41XX_INTA_PIN)
34#define CMBVR41XX_INTB_IRQ GIU_IRQ(CMBVR41XX_INTB_PIN)
35#define CMBVR41XX_INTC_IRQ GIU_IRQ(CMBVR41XX_INTC_PIN)
36#define CMBVR41XX_INTD_IRQ GIU_IRQ(CMBVR41XX_INTD_PIN)
37#define CMBVR41XX_INTE_IRQ GIU_IRQ(CMBVR41XX_INTE_PIN)
38
39#define I8259_IRQ_BASE 72
40#define I8259_IRQ(x) (I8259_IRQ_BASE + (x))
41#define TIMER_IRQ I8259_IRQ(0)
42#define KEYBOARD_IRQ I8259_IRQ(1)
43#define I8259_SLAVE_IRQ I8259_IRQ(2)
44#define UART3_IRQ I8259_IRQ(3)
45#define UART1_IRQ I8259_IRQ(4)
46#define UART2_IRQ I8259_IRQ(5)
47#define FDC_IRQ I8259_IRQ(6)
48#define PARPORT_IRQ I8259_IRQ(7)
49#define RTC_IRQ I8259_IRQ(8)
50#define USB_IRQ I8259_IRQ(9)
51#define I8259_INTA_IRQ I8259_IRQ(10)
52#define AUDIO_IRQ I8259_IRQ(11)
53#define AUX_IRQ I8259_IRQ(12)
54#define IDE_PRIMARY_IRQ I8259_IRQ(14)
55#define IDE_SECONDARY_IRQ I8259_IRQ(15)
56#define I8259_IRQ_LAST IDE_SECONDARY_IRQ
57
58#define RTC_PORT(x) (0xaf000100 + (x))
59#define RTC_IO_EXTENT 0x140
60
61#endif /* __NEC_CMBVR4133_H */
diff --git a/include/asm-mips/vr41xx/e55.h b/include/asm-mips/vr41xx/e55.h
new file mode 100644
index 000000000000..ea37b56fc66d
--- /dev/null
+++ b/include/asm-mips/vr41xx/e55.h
@@ -0,0 +1,43 @@
1/*
2 * e55.h, Include file for CASIO CASSIOPEIA E-10/15/55/65.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __CASIO_E55_H
21#define __CASIO_E55_H
22
23#include <asm/addrspace.h>
24#include <asm/vr41xx/vr41xx.h>
25
26/*
27 * Board specific address mapping
28 */
29#define VR41XX_ISA_MEM_BASE 0x10000000
30#define VR41XX_ISA_MEM_SIZE 0x04000000
31
32/* VR41XX_ISA_IO_BASE includes offset from real base. */
33#define VR41XX_ISA_IO_BASE 0x1400c000
34#define VR41XX_ISA_IO_SIZE 0x03ff4000
35
36#define ISA_BUS_IO_BASE 0
37#define ISA_BUS_IO_SIZE VR41XX_ISA_IO_SIZE
38
39#define IO_PORT_BASE KSEG1ADDR(VR41XX_ISA_IO_BASE)
40#define IO_PORT_RESOURCE_START ISA_BUS_IO_BASE
41#define IO_PORT_RESOURCE_END (ISA_BUS_IO_BASE + ISA_BUS_IO_SIZE - 1)
42
43#endif /* __CASIO_E55_H */
diff --git a/include/asm-mips/vr41xx/mpc30x.h b/include/asm-mips/vr41xx/mpc30x.h
new file mode 100644
index 000000000000..e6ac3c8e8bae
--- /dev/null
+++ b/include/asm-mips/vr41xx/mpc30x.h
@@ -0,0 +1,37 @@
1/*
2 * mpc30x.h, Include file for Victor MP-C303/304.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __VICTOR_MPC30X_H
21#define __VICTOR_MPC30X_H
22
23#include <asm/vr41xx/vr41xx.h>
24
25/*
26 * General-Purpose I/O Pin Number
27 */
28#define VRC4173_PIN 1
29#define MQ200_PIN 4
30
31/*
32 * Interrupt Number
33 */
34#define VRC4173_CASCADE_IRQ GIU_IRQ(VRC4173_PIN)
35#define MQ200_IRQ GIU_IRQ(MQ200_PIN)
36
37#endif /* __VICTOR_MPC30X_H */
diff --git a/include/asm-mips/vr41xx/siu.h b/include/asm-mips/vr41xx/siu.h
new file mode 100644
index 000000000000..865cc07ddd7f
--- /dev/null
+++ b/include/asm-mips/vr41xx/siu.h
@@ -0,0 +1,50 @@
1/*
2 * Include file for NEC VR4100 series Serial Interface Unit.
3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __NEC_VR41XX_SIU_H
21#define __NEC_VR41XX_SIU_H
22
23typedef enum {
24 SIU_INTERFACE_RS232C,
25 SIU_INTERFACE_IRDA,
26} siu_interface_t;
27
28extern void vr41xx_select_siu_interface(siu_interface_t interface);
29
30typedef enum {
31 SIU_USE_IRDA,
32 FIR_USE_IRDA,
33} irda_use_t;
34
35extern void vr41xx_use_irda(irda_use_t use);
36
37typedef enum {
38 SHARP_IRDA,
39 TEMIC_IRDA,
40 HP_IRDA,
41} irda_module_t;
42
43typedef enum {
44 IRDA_TX_1_5MBPS,
45 IRDA_TX_4MBPS,
46} irda_speed_t;
47
48extern void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed);
49
50#endif /* __NEC_VR41XX_SIU_H */
diff --git a/include/asm-mips/vr41xx/tb0219.h b/include/asm-mips/vr41xx/tb0219.h
new file mode 100644
index 000000000000..273c6392688f
--- /dev/null
+++ b/include/asm-mips/vr41xx/tb0219.h
@@ -0,0 +1,42 @@
1/*
2 * tb0219.h, Include file for TANBAC TB0219.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * Modified for TANBAC TB0219:
7 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#ifndef __TANBAC_TB0219_H
24#define __TANBAC_TB0219_H
25
26#include <asm/vr41xx/vr41xx.h>
27
28/*
29 * General-Purpose I/O Pin Number
30 */
31#define TB0219_PCI_SLOT1_PIN 2
32#define TB0219_PCI_SLOT2_PIN 3
33#define TB0219_PCI_SLOT3_PIN 4
34
35/*
36 * Interrupt Number
37 */
38#define TB0219_PCI_SLOT1_IRQ GIU_IRQ(TB0219_PCI_SLOT1_PIN)
39#define TB0219_PCI_SLOT2_IRQ GIU_IRQ(TB0219_PCI_SLOT2_PIN)
40#define TB0219_PCI_SLOT3_IRQ GIU_IRQ(TB0219_PCI_SLOT3_PIN)
41
42#endif /* __TANBAC_TB0219_H */
diff --git a/include/asm-mips/vr41xx/tb0226.h b/include/asm-mips/vr41xx/tb0226.h
new file mode 100644
index 000000000000..0ff9a60ecacc
--- /dev/null
+++ b/include/asm-mips/vr41xx/tb0226.h
@@ -0,0 +1,43 @@
1/*
2 * tb0226.h, Include file for TANBAC TB0226.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __TANBAC_TB0226_H
21#define __TANBAC_TB0226_H
22
23#include <asm/vr41xx/vr41xx.h>
24
25/*
26 * General-Purpose I/O Pin Number
27 */
28#define GD82559_1_PIN 2
29#define GD82559_2_PIN 3
30#define UPD720100_INTA_PIN 4
31#define UPD720100_INTB_PIN 8
32#define UPD720100_INTC_PIN 13
33
34/*
35 * Interrupt Number
36 */
37#define GD82559_1_IRQ GIU_IRQ(GD82559_1_PIN)
38#define GD82559_2_IRQ GIU_IRQ(GD82559_2_PIN)
39#define UPD720100_INTA_IRQ GIU_IRQ(UPD720100_INTA_PIN)
40#define UPD720100_INTB_IRQ GIU_IRQ(UPD720100_INTB_PIN)
41#define UPD720100_INTC_IRQ GIU_IRQ(UPD720100_INTC_PIN)
42
43#endif /* __TANBAC_TB0226_H */
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
new file mode 100644
index 000000000000..caacaced3213
--- /dev/null
+++ b/include/asm-mips/vr41xx/vr41xx.h
@@ -0,0 +1,320 @@
1/*
2 * include/asm-mips/vr41xx/vr41xx.h
3 *
4 * Include file for NEC VR4100 series.
5 *
6 * Copyright (C) 1999 Michael Klar
7 * Copyright (C) 2001, 2002 Paul Mundt
8 * Copyright (C) 2002 MontaVista Software, Inc.
9 * Copyright (C) 2002 TimeSys Corp.
10 * Copyright (C) 2003-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#ifndef __NEC_VR41XX_H
18#define __NEC_VR41XX_H
19
20#include <linux/interrupt.h>
21
22/*
23 * CPU Revision
24 */
25/* VR4122 0x00000c70-0x00000c72 */
26#define PRID_VR4122_REV1_0 0x00000c70
27#define PRID_VR4122_REV2_0 0x00000c70
28#define PRID_VR4122_REV2_1 0x00000c70
29#define PRID_VR4122_REV3_0 0x00000c71
30#define PRID_VR4122_REV3_1 0x00000c72
31
32/* VR4181A 0x00000c73-0x00000c7f */
33#define PRID_VR4181A_REV1_0 0x00000c73
34#define PRID_VR4181A_REV1_1 0x00000c74
35
36/* VR4131 0x00000c80-0x00000c83 */
37#define PRID_VR4131_REV1_2 0x00000c80
38#define PRID_VR4131_REV2_0 0x00000c81
39#define PRID_VR4131_REV2_1 0x00000c82
40#define PRID_VR4131_REV2_2 0x00000c83
41
42/* VR4133 0x00000c84- */
43#define PRID_VR4133 0x00000c84
44
45/*
46 * Bus Control Uint
47 */
48extern unsigned long vr41xx_calculate_clock_frequency(void);
49extern unsigned long vr41xx_get_vtclock_frequency(void);
50extern unsigned long vr41xx_get_tclock_frequency(void);
51
52/*
53 * Clock Mask Unit
54 */
55typedef enum {
56 PIU_CLOCK,
57 SIU_CLOCK,
58 AIU_CLOCK,
59 KIU_CLOCK,
60 FIR_CLOCK,
61 DSIU_CLOCK,
62 CSI_CLOCK,
63 PCIU_CLOCK,
64 HSP_CLOCK,
65 PCI_CLOCK,
66 CEU_CLOCK,
67 ETHER0_CLOCK,
68 ETHER1_CLOCK
69} vr41xx_clock_t;
70
71extern void vr41xx_supply_clock(vr41xx_clock_t clock);
72extern void vr41xx_mask_clock(vr41xx_clock_t clock);
73
74/*
75 * Interrupt Control Unit
76 */
77/* CPU core Interrupt Numbers */
78#define MIPS_CPU_IRQ_BASE 0
79#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
80#define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0)
81#define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1)
82#define INT0_CASCADE_IRQ MIPS_CPU_IRQ(2)
83#define INT1_CASCADE_IRQ MIPS_CPU_IRQ(3)
84#define INT2_CASCADE_IRQ MIPS_CPU_IRQ(4)
85#define INT3_CASCADE_IRQ MIPS_CPU_IRQ(5)
86#define INT4_CASCADE_IRQ MIPS_CPU_IRQ(6)
87#define TIMER_IRQ MIPS_CPU_IRQ(7)
88
89/* SYINT1 Interrupt Numbers */
90#define SYSINT1_IRQ_BASE 8
91#define SYSINT1_IRQ(x) (SYSINT1_IRQ_BASE + (x))
92#define BATTRY_IRQ SYSINT1_IRQ(0)
93#define POWER_IRQ SYSINT1_IRQ(1)
94#define RTCLONG1_IRQ SYSINT1_IRQ(2)
95#define ELAPSEDTIME_IRQ SYSINT1_IRQ(3)
96/* RFU */
97#define PIU_IRQ SYSINT1_IRQ(5)
98#define AIU_IRQ SYSINT1_IRQ(6)
99#define KIU_IRQ SYSINT1_IRQ(7)
100#define GIUINT_CASCADE_IRQ SYSINT1_IRQ(8)
101#define SIU_IRQ SYSINT1_IRQ(9)
102#define BUSERR_IRQ SYSINT1_IRQ(10)
103#define SOFTINT_IRQ SYSINT1_IRQ(11)
104#define CLKRUN_IRQ SYSINT1_IRQ(12)
105#define DOZEPIU_IRQ SYSINT1_IRQ(13)
106#define SYSINT1_IRQ_LAST DOZEPIU_IRQ
107
108/* SYSINT2 Interrupt Numbers */
109#define SYSINT2_IRQ_BASE 24
110#define SYSINT2_IRQ(x) (SYSINT2_IRQ_BASE + (x))
111#define RTCLONG2_IRQ SYSINT2_IRQ(0)
112#define LED_IRQ SYSINT2_IRQ(1)
113#define HSP_IRQ SYSINT2_IRQ(2)
114#define TCLOCK_IRQ SYSINT2_IRQ(3)
115#define FIR_IRQ SYSINT2_IRQ(4)
116#define CEU_IRQ SYSINT2_IRQ(4) /* same number as FIR_IRQ */
117#define DSIU_IRQ SYSINT2_IRQ(5)
118#define PCI_IRQ SYSINT2_IRQ(6)
119#define SCU_IRQ SYSINT2_IRQ(7)
120#define CSI_IRQ SYSINT2_IRQ(8)
121#define BCU_IRQ SYSINT2_IRQ(9)
122#define ETHERNET_IRQ SYSINT2_IRQ(10)
123#define SYSINT2_IRQ_LAST ETHERNET_IRQ
124
125/* GIU Interrupt Numbers */
126#define GIU_IRQ_BASE 40
127#define GIU_IRQ(x) (GIU_IRQ_BASE + (x)) /* IRQ 40-71 */
128#define GIU_IRQ_LAST GIU_IRQ(31)
129#define GIU_IRQ_TO_PIN(x) ((x) - GIU_IRQ_BASE) /* Pin 0-31 */
130
131extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
132extern int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq));
133
134#define PIUINT_COMMAND 0x0040
135#define PIUINT_DATA 0x0020
136#define PIUINT_PAGE1 0x0010
137#define PIUINT_PAGE0 0x0008
138#define PIUINT_DATALOST 0x0004
139#define PIUINT_STATUSCHANGE 0x0001
140
141extern void vr41xx_enable_piuint(uint16_t mask);
142extern void vr41xx_disable_piuint(uint16_t mask);
143
144#define AIUINT_INPUT_DMAEND 0x0800
145#define AIUINT_INPUT_DMAHALT 0x0400
146#define AIUINT_INPUT_DATALOST 0x0200
147#define AIUINT_INPUT_DATA 0x0100
148#define AIUINT_OUTPUT_DMAEND 0x0008
149#define AIUINT_OUTPUT_DMAHALT 0x0004
150#define AIUINT_OUTPUT_NODATA 0x0002
151
152extern void vr41xx_enable_aiuint(uint16_t mask);
153extern void vr41xx_disable_aiuint(uint16_t mask);
154
155#define KIUINT_DATALOST 0x0004
156#define KIUINT_DATAREADY 0x0002
157#define KIUINT_SCAN 0x0001
158
159extern void vr41xx_enable_kiuint(uint16_t mask);
160extern void vr41xx_disable_kiuint(uint16_t mask);
161
162#define DSIUINT_CTS 0x0800
163#define DSIUINT_RXERR 0x0400
164#define DSIUINT_RX 0x0200
165#define DSIUINT_TX 0x0100
166#define DSIUINT_ALL 0x0f00
167
168extern void vr41xx_enable_dsiuint(uint16_t mask);
169extern void vr41xx_disable_dsiuint(uint16_t mask);
170
171#define FIRINT_UNIT 0x0010
172#define FIRINT_RX_DMAEND 0x0008
173#define FIRINT_RX_DMAHALT 0x0004
174#define FIRINT_TX_DMAEND 0x0002
175#define FIRINT_TX_DMAHALT 0x0001
176
177extern void vr41xx_enable_firint(uint16_t mask);
178extern void vr41xx_disable_firint(uint16_t mask);
179
180extern void vr41xx_enable_pciint(void);
181extern void vr41xx_disable_pciint(void);
182
183extern void vr41xx_enable_scuint(void);
184extern void vr41xx_disable_scuint(void);
185
186#define CSIINT_TX_DMAEND 0x0040
187#define CSIINT_TX_DMAHALT 0x0020
188#define CSIINT_TX_DATA 0x0010
189#define CSIINT_TX_FIFOEMPTY 0x0008
190#define CSIINT_RX_DMAEND 0x0004
191#define CSIINT_RX_DMAHALT 0x0002
192#define CSIINT_RX_FIFOEMPTY 0x0001
193
194extern void vr41xx_enable_csiint(uint16_t mask);
195extern void vr41xx_disable_csiint(uint16_t mask);
196
197extern void vr41xx_enable_bcuint(void);
198extern void vr41xx_disable_bcuint(void);
199
200/*
201 * Power Management Unit
202 */
203
204/*
205 * RTC
206 */
207extern void vr41xx_set_rtclong1_cycle(uint32_t cycles);
208extern uint32_t vr41xx_read_rtclong1_counter(void);
209
210extern void vr41xx_set_rtclong2_cycle(uint32_t cycles);
211extern uint32_t vr41xx_read_rtclong2_counter(void);
212
213extern void vr41xx_set_tclock_cycle(uint32_t cycles);
214extern uint32_t vr41xx_read_tclock_counter(void);
215
216/*
217 * General-Purpose I/O Unit
218 */
219enum {
220 TRIGGER_LEVEL,
221 TRIGGER_EDGE,
222 TRIGGER_EDGE_FALLING,
223 TRIGGER_EDGE_RISING
224};
225
226enum {
227 SIGNAL_THROUGH,
228 SIGNAL_HOLD
229};
230
231extern void vr41xx_set_irq_trigger(int pin, int trigger, int hold);
232
233enum {
234 LEVEL_LOW,
235 LEVEL_HIGH
236};
237
238extern void vr41xx_set_irq_level(int pin, int level);
239
240enum {
241 PIO_INPUT,
242 PIO_OUTPUT
243};
244
245enum {
246 DATA_LOW,
247 DATA_HIGH
248};
249
250/*
251 * PCI Control Unit
252 */
253#define PCI_MASTER_ADDRESS_MASK 0x7fffffffU
254
255struct pci_master_address_conversion {
256 uint32_t bus_base_address;
257 uint32_t address_mask;
258 uint32_t pci_base_address;
259};
260
261struct pci_target_address_conversion {
262 uint32_t address_mask;
263 uint32_t bus_base_address;
264};
265
266typedef enum {
267 CANNOT_LOCK_FROM_DEVICE,
268 CAN_LOCK_FROM_DEVICE,
269} pci_exclusive_access_t;
270
271struct pci_mailbox_address {
272 uint32_t base_address;
273};
274
275struct pci_target_address_window {
276 uint32_t base_address;
277};
278
279typedef enum {
280 PCI_ARBITRATION_MODE_FAIR,
281 PCI_ARBITRATION_MODE_ALTERNATE_0,
282 PCI_ARBITRATION_MODE_ALTERNATE_B,
283} pci_arbiter_priority_control_t;
284
285typedef enum {
286 PCI_TAKE_AWAY_GNT_DISABLE,
287 PCI_TAKE_AWAY_GNT_ENABLE,
288} pci_take_away_gnt_mode_t;
289
290struct pci_controller_unit_setup {
291 struct pci_master_address_conversion *master_memory1;
292 struct pci_master_address_conversion *master_memory2;
293
294 struct pci_target_address_conversion *target_memory1;
295 struct pci_target_address_conversion *target_memory2;
296
297 struct pci_master_address_conversion *master_io;
298
299 pci_exclusive_access_t exclusive_access;
300
301 uint32_t pci_clock_max;
302 uint8_t wait_time_limit_from_irdy_to_trdy; /* Only VR4122 is supported */
303
304 struct pci_mailbox_address *mailbox;
305 struct pci_target_address_window *target_window1;
306 struct pci_target_address_window *target_window2;
307
308 uint8_t master_latency_timer;
309 uint8_t retry_limit;
310
311 pci_arbiter_priority_control_t arbiter_priority_control;
312 pci_take_away_gnt_mode_t take_away_gnt_mode;
313
314 struct resource *mem_resource;
315 struct resource *io_resource;
316};
317
318extern void vr41xx_pciu_setup(struct pci_controller_unit_setup *setup);
319
320#endif /* __NEC_VR41XX_H */
diff --git a/include/asm-mips/vr41xx/vrc4173.h b/include/asm-mips/vr41xx/vrc4173.h
new file mode 100644
index 000000000000..58e193c51b45
--- /dev/null
+++ b/include/asm-mips/vr41xx/vrc4173.h
@@ -0,0 +1,222 @@
1/*
2 * vrc4173.h, Include file for NEC VRC4173.
3 *
4 * Copyright (C) 2000 Michael R. McDonald
5 * Copyright (C) 2001-2003 Montavista Software Inc.
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>
7 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
8 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24#ifndef __NEC_VRC4173_H
25#define __NEC_VRC4173_H
26
27#include <linux/config.h>
28#include <asm/io.h>
29
30/*
31 * Interrupt Number
32 */
33#define VRC4173_IRQ_BASE 72
34#define VRC4173_IRQ(x) (VRC4173_IRQ_BASE + (x))
35#define VRC4173_USB_IRQ VRC4173_IRQ(0)
36#define VRC4173_PCMCIA2_IRQ VRC4173_IRQ(1)
37#define VRC4173_PCMCIA1_IRQ VRC4173_IRQ(2)
38#define VRC4173_PS2CH2_IRQ VRC4173_IRQ(3)
39#define VRC4173_PS2CH1_IRQ VRC4173_IRQ(4)
40#define VRC4173_PIU_IRQ VRC4173_IRQ(5)
41#define VRC4173_AIU_IRQ VRC4173_IRQ(6)
42#define VRC4173_KIU_IRQ VRC4173_IRQ(7)
43#define VRC4173_GIU_IRQ VRC4173_IRQ(8)
44#define VRC4173_AC97_IRQ VRC4173_IRQ(9)
45#define VRC4173_AC97INT1_IRQ VRC4173_IRQ(10)
46/* RFU */
47#define VRC4173_DOZEPIU_IRQ VRC4173_IRQ(13)
48#define VRC4173_IRQ_LAST VRC4173_DOZEPIU_IRQ
49
50/*
51 * PCI I/O accesses
52 */
53#ifdef CONFIG_VRC4173
54
55extern unsigned long vrc4173_io_offset;
56
57#define set_vrc4173_io_offset(offset) do { vrc4173_io_offset = (offset); } while (0)
58
59#define vrc4173_outb(val,port) outb((val), vrc4173_io_offset+(port))
60#define vrc4173_outw(val,port) outw((val), vrc4173_io_offset+(port))
61#define vrc4173_outl(val,port) outl((val), vrc4173_io_offset+(port))
62#define vrc4173_outb_p(val,port) outb_p((val), vrc4173_io_offset+(port))
63#define vrc4173_outw_p(val,port) outw_p((val), vrc4173_io_offset+(port))
64#define vrc4173_outl_p(val,port) outl_p((val), vrc4173_io_offset+(port))
65
66#define vrc4173_inb(port) inb(vrc4173_io_offset+(port))
67#define vrc4173_inw(port) inw(vrc4173_io_offset+(port))
68#define vrc4173_inl(port) inl(vrc4173_io_offset+(port))
69#define vrc4173_inb_p(port) inb_p(vrc4173_io_offset+(port))
70#define vrc4173_inw_p(port) inw_p(vrc4173_io_offset+(port))
71#define vrc4173_inl_p(port) inl_p(vrc4173_io_offset+(port))
72
73#define vrc4173_outsb(port,addr,count) outsb(vrc4173_io_offset+(port),(addr),(count))
74#define vrc4173_outsw(port,addr,count) outsw(vrc4173_io_offset+(port),(addr),(count))
75#define vrc4173_outsl(port,addr,count) outsl(vrc4173_io_offset+(port),(addr),(count))
76
77#define vrc4173_insb(port,addr,count) insb(vrc4173_io_offset+(port),(addr),(count))
78#define vrc4173_insw(port,addr,count) insw(vrc4173_io_offset+(port),(addr),(count))
79#define vrc4173_insl(port,addr,count) insl(vrc4173_io_offset+(port),(addr),(count))
80
81#else
82
83#define set_vrc4173_io_offset(offset) do {} while (0)
84
85#define vrc4173_outb(val,port) do {} while (0)
86#define vrc4173_outw(val,port) do {} while (0)
87#define vrc4173_outl(val,port) do {} while (0)
88#define vrc4173_outb_p(val,port) do {} while (0)
89#define vrc4173_outw_p(val,port) do {} while (0)
90#define vrc4173_outl_p(val,port) do {} while (0)
91
92#define vrc4173_inb(port) 0
93#define vrc4173_inw(port) 0
94#define vrc4173_inl(port) 0
95#define vrc4173_inb_p(port) 0
96#define vrc4173_inw_p(port) 0
97#define vrc4173_inl_p(port) 0
98
99#define vrc4173_outsb(port,addr,count) do {} while (0)
100#define vrc4173_outsw(port,addr,count) do {} while (0)
101#define vrc4173_outsl(port,addr,count) do {} while (0)
102
103#define vrc4173_insb(port,addr,count) do {} while (0)
104#define vrc4173_insw(port,addr,count) do {} while (0)
105#define vrc4173_insl(port,addr,count) do {} while (0)
106
107#endif
108
109/*
110 * Clock Mask Unit
111 */
112typedef enum vrc4173_clock {
113 VRC4173_PIU_CLOCK,
114 VRC4173_KIU_CLOCK,
115 VRC4173_AIU_CLOCK,
116 VRC4173_PS2_CH1_CLOCK,
117 VRC4173_PS2_CH2_CLOCK,
118 VRC4173_USBU_PCI_CLOCK,
119 VRC4173_CARDU1_PCI_CLOCK,
120 VRC4173_CARDU2_PCI_CLOCK,
121 VRC4173_AC97U_PCI_CLOCK,
122 VRC4173_USBU_48MHz_CLOCK,
123 VRC4173_EXT_48MHz_CLOCK,
124 VRC4173_48MHz_CLOCK,
125} vrc4173_clock_t;
126
127#ifdef CONFIG_VRC4173
128
129extern void vrc4173_supply_clock(vrc4173_clock_t clock);
130extern void vrc4173_mask_clock(vrc4173_clock_t clock);
131
132#else
133
134static inline void vrc4173_supply_clock(vrc4173_clock_t clock) {}
135static inline void vrc4173_mask_clock(vrc4173_clock_t clock) {}
136
137#endif
138
139/*
140 * Interupt Control Unit
141 */
142
143#define VRC4173_PIUINT_COMMAND 0x0040
144#define VRC4173_PIUINT_DATA 0x0020
145#define VRC4173_PIUINT_PAGE1 0x0010
146#define VRC4173_PIUINT_PAGE0 0x0008
147#define VRC4173_PIUINT_DATALOST 0x0004
148#define VRC4173_PIUINT_STATUSCHANGE 0x0001
149
150#ifdef CONFIG_VRC4173
151
152extern void vrc4173_enable_piuint(uint16_t mask);
153extern void vrc4173_disable_piuint(uint16_t mask);
154
155#else
156
157static inline void vrc4173_enable_piuint(uint16_t mask) {}
158static inline void vrc4173_disable_piuint(uint16_t mask) {}
159
160#endif
161
162#define VRC4173_AIUINT_INPUT_DMAEND 0x0800
163#define VRC4173_AIUINT_INPUT_DMAHALT 0x0400
164#define VRC4173_AIUINT_INPUT_DATALOST 0x0200
165#define VRC4173_AIUINT_INPUT_DATA 0x0100
166#define VRC4173_AIUINT_OUTPUT_DMAEND 0x0008
167#define VRC4173_AIUINT_OUTPUT_DMAHALT 0x0004
168#define VRC4173_AIUINT_OUTPUT_NODATA 0x0002
169
170#ifdef CONFIG_VRC4173
171
172extern void vrc4173_enable_aiuint(uint16_t mask);
173extern void vrc4173_disable_aiuint(uint16_t mask);
174
175#else
176
177static inline void vrc4173_enable_aiuint(uint16_t mask) {}
178static inline void vrc4173_disable_aiuint(uint16_t mask) {}
179
180#endif
181
182#define VRC4173_KIUINT_DATALOST 0x0004
183#define VRC4173_KIUINT_DATAREADY 0x0002
184#define VRC4173_KIUINT_SCAN 0x0001
185
186#ifdef CONFIG_VRC4173
187
188extern void vrc4173_enable_kiuint(uint16_t mask);
189extern void vrc4173_disable_kiuint(uint16_t mask);
190
191#else
192
193static inline void vrc4173_enable_kiuint(uint16_t mask) {}
194static inline void vrc4173_disable_kiuint(uint16_t mask) {}
195
196#endif
197
198/*
199 * General-Purpose I/O Unit
200 */
201typedef enum vrc4173_function {
202 PS2_CHANNEL1,
203 PS2_CHANNEL2,
204 TOUCHPANEL,
205 KEYBOARD_8SCANLINES,
206 KEYBOARD_10SCANLINES,
207 KEYBOARD_12SCANLINES,
208 GPIO_0_15PINS,
209 GPIO_16_20PINS,
210} vrc4173_function_t;
211
212#ifdef CONFIG_VRC4173
213
214extern void vrc4173_select_function(vrc4173_function_t function);
215
216#else
217
218static inline void vrc4173_select_function(vrc4173_function_t function) {}
219
220#endif
221
222#endif /* __NEC_VRC4173_H */
diff --git a/include/asm-mips/vr41xx/workpad.h b/include/asm-mips/vr41xx/workpad.h
new file mode 100644
index 000000000000..dfe01b43fb79
--- /dev/null
+++ b/include/asm-mips/vr41xx/workpad.h
@@ -0,0 +1,43 @@
1/*
2 * workpad.h, Include file for IBM WorkPad z50.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __IBM_WORKPAD_H
21#define __IBM_WORKPAD_H
22
23#include <asm/addrspace.h>
24#include <asm/vr41xx/vr41xx.h>
25
26/*
27 * Board specific address mapping
28 */
29#define VR41XX_ISA_MEM_BASE 0x10000000
30#define VR41XX_ISA_MEM_SIZE 0x04000000
31
32/* VR41XX_ISA_IO_BASE includes offset from real base. */
33#define VR41XX_ISA_IO_BASE 0x15000000
34#define VR41XX_ISA_IO_SIZE 0x03000000
35
36#define ISA_BUS_IO_BASE 0
37#define ISA_BUS_IO_SIZE VR41XX_ISA_IO_SIZE
38
39#define IO_PORT_BASE KSEG1ADDR(VR41XX_ISA_IO_BASE)
40#define IO_PORT_RESOURCE_START ISA_BUS_IO_BASE
41#define IO_PORT_RESOURCE_END (ISA_BUS_IO_BASE + ISA_BUS_IO_SIZE - 1)
42
43#endif /* __IBM_WORKPAD_H */
diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
new file mode 100644
index 000000000000..c4a704121343
--- /dev/null
+++ b/include/asm-mips/war.h
@@ -0,0 +1,224 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002, 2004 by Ralf Baechle
7 */
8#ifndef _ASM_WAR_H
9#define _ASM_WAR_H
10
11#include <linux/config.h>
12
13/*
14 * Another R4600 erratum. Due to the lack of errata information the exact
15 * technical details aren't known. I've experimentally found that disabling
16 * interrupts during indexed I-cache flushes seems to be sufficient to deal
17 * with the issue.
18 *
19 * #define R4600_V1_INDEX_ICACHEOP_WAR 1
20 */
21
22/*
23 * Pleasures of the R4600 V1.x. Cite from the IDT R4600 V1.7 errata:
24 *
25 * 18. The CACHE instructions Hit_Writeback_Invalidate_D, Hit_Writeback_D,
26 * Hit_Invalidate_D and Create_Dirty_Excl_D should only be
27 * executed if there is no other dcache activity. If the dcache is
28 * accessed for another instruction immeidately preceding when these
29 * cache instructions are executing, it is possible that the dcache
30 * tag match outputs used by these cache instructions will be
31 * incorrect. These cache instructions should be preceded by at least
32 * four instructions that are not any kind of load or store
33 * instruction.
34 *
35 * This is not allowed: lw
36 * nop
37 * nop
38 * nop
39 * cache Hit_Writeback_Invalidate_D
40 *
41 * This is allowed: lw
42 * nop
43 * nop
44 * nop
45 * nop
46 * cache Hit_Writeback_Invalidate_D
47 *
48 * #define R4600_V1_HIT_CACHEOP_WAR 1
49 */
50
51
52/*
53 * Writeback and invalidate the primary cache dcache before DMA.
54 *
55 * R4600 v2.0 bug: "The CACHE instructions Hit_Writeback_Inv_D,
56 * Hit_Writeback_D, Hit_Invalidate_D and Create_Dirty_Exclusive_D will only
57 * operate correctly if the internal data cache refill buffer is empty. These
58 * CACHE instructions should be separated from any potential data cache miss
59 * by a load instruction to an uncached address to empty the response buffer."
60 * (Revision 2.0 device errata from IDT available on http://www.idt.com/
61 * in .pdf format.)
62 *
63 * #define R4600_V2_HIT_CACHEOP_WAR 1
64 */
65
66/*
67 * R4600 CPU modules for the Indy come with both V1.7 and V2.0 processors.
68 */
69#ifdef CONFIG_SGI_IP22
70
71#define R4600_V1_INDEX_ICACHEOP_WAR 1
72#define R4600_V1_HIT_CACHEOP_WAR 1
73#define R4600_V2_HIT_CACHEOP_WAR 1
74
75#endif
76
77/*
78 * But the RM200C seems to have been shipped only with V2.0 R4600s
79 */
80#ifdef CONFIG_SNI_RM200_PCI
81
82#define R4600_V2_HIT_CACHEOP_WAR 1
83
84#endif
85
86#ifdef CONFIG_CPU_R5432
87
88/*
89 * When an interrupt happens on a CP0 register read instruction, CPU may
90 * lock up or read corrupted values of CP0 registers after it enters
91 * the exception handler.
92 *
93 * This workaround makes sure that we read a "safe" CP0 register as the
94 * first thing in the exception handler, which breaks one of the
95 * pre-conditions for this problem.
96 */
97#define R5432_CP0_INTERRUPT_WAR 1
98
99#endif
100
101#if defined(CONFIG_SB1_PASS_1_WORKAROUNDS) || \
102 defined(CONFIG_SB1_PASS_2_WORKAROUNDS)
103
104/*
105 * Workaround for the Sibyte M3 errata the text of which can be found at
106 *
107 * http://sibyte.broadcom.com/hw/bcm1250/docs/pass2errata.txt
108 *
109 * This will enable the use of a special TLB refill handler which does a
110 * consistency check on the information in c0_badvaddr and c0_entryhi and
111 * will just return and take the exception again if the information was
112 * found to be inconsistent.
113 */
114#define BCM1250_M3_WAR 1
115
116/*
117 * This is a DUART workaround related to glitches around register accesses
118 */
119#define SIBYTE_1956_WAR 1
120
121#endif
122
123/*
124 * Fill buffers not flushed on CACHE instructions
125 *
126 * Hit_Invalidate_I cacheops invalidate an icache line but the refill
127 * for that line can get stale data from the fill buffer instead of
128 * accessing memory if the previous icache miss was also to that line.
129 *
130 * Workaround: generate an icache refill from a different line
131 *
132 * Affects:
133 * MIPS 4K RTL revision <3.0, PRID revision <4
134 */
135#if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_ATLAS) || \
136 defined(CONFIG_MIPS_SEAD)
137#define MIPS4K_ICACHE_REFILL_WAR 1
138#endif
139
140/*
141 * Missing implicit forced flush of evictions caused by CACHE
142 * instruction
143 *
144 * Evictions caused by a CACHE instructions are not forced on to the
145 * bus. The BIU gives higher priority to fetches than to the data from
146 * the eviction buffer and no collision detection is performed between
147 * fetches and pending data from the eviction buffer.
148 *
149 * Workaround: Execute a SYNC instruction after the cache instruction
150 *
151 * Affects:
152 * MIPS 5Kc,5Kf RTL revision <2.3, PRID revision <8
153 * MIPS 20Kc RTL revision <4.0, PRID revision <?
154 */
155#if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_ATLAS) || \
156 defined(CONFIG_MIPS_SEAD)
157#define MIPS_CACHE_SYNC_WAR 1
158#endif
159
160/*
161 * From TX49/H2 manual: "If the instruction (i.e. CACHE) is issued for
162 * the line which this instruction itself exists, the following
163 * operation is not guaranteed."
164 *
165 * Workaround: do two phase flushing for Index_Invalidate_I
166 */
167#ifdef CONFIG_CPU_TX49XX
168#define TX49XX_ICACHE_INDEX_INV_WAR 1
169#endif
170
171/*
172 * On the RM9000 there is a problem which makes the CreateDirtyExclusive
173 * cache operation unusable on SMP systems.
174 */
175#if defined(CONFIG_MOMENCO_JAGUAR_ATX) || defined(CONFIG_PMC_YOSEMITE)
176#define RM9000_CDEX_SMP_WAR 1
177#endif
178
179/*
180 * ON the R10000 upto version 2.6 (not sure about 2.7) there is a bug that
181 * may cause ll / sc and lld / scd sequences to execute non-atomically.
182 */
183#ifdef CONFIG_SGI_IP27
184#define R10000_LLSC_WAR 1
185#endif
186
187/*
188 * Workarounds default to off
189 */
190#ifndef R4600_V1_INDEX_ICACHEOP_WAR
191#define R4600_V1_INDEX_ICACHEOP_WAR 0
192#endif
193#ifndef R4600_V1_HIT_CACHEOP_WAR
194#define R4600_V1_HIT_CACHEOP_WAR 0
195#endif
196#ifndef R4600_V2_HIT_CACHEOP_WAR
197#define R4600_V2_HIT_CACHEOP_WAR 0
198#endif
199#ifndef R5432_CP0_INTERRUPT_WAR
200#define R5432_CP0_INTERRUPT_WAR 0
201#endif
202#ifndef BCM1250_M3_WAR
203#define BCM1250_M3_WAR 0
204#endif
205#ifndef SIBYTE_1956_WAR
206#define SIBYTE_1956_WAR 0
207#endif
208#ifndef MIPS4K_ICACHE_REFILL_WAR
209#define MIPS4K_ICACHE_REFILL_WAR 0
210#endif
211#ifndef MIPS_CACHE_SYNC_WAR
212#define MIPS_CACHE_SYNC_WAR 0
213#endif
214#ifndef TX49XX_ICACHE_INDEX_INV_WAR
215#define TX49XX_ICACHE_INDEX_INV_WAR 0
216#endif
217#ifndef RM9000_CDEX_SMP_WAR
218#define RM9000_CDEX_SMP_WAR 0
219#endif
220#ifndef R10000_LLSC_WAR
221#define R10000_LLSC_WAR 0
222#endif
223
224#endif /* _ASM_WAR_H */
diff --git a/include/asm-mips/watch.h b/include/asm-mips/watch.h
new file mode 100644
index 000000000000..6aa90cae1114
--- /dev/null
+++ b/include/asm-mips/watch.h
@@ -0,0 +1,35 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1996, 1997, 1998, 2000, 2001 by Ralf Baechle
7 */
8#ifndef _ASM_WATCH_H
9#define _ASM_WATCH_H
10
11#include <linux/linkage.h>
12
13/*
14 * Types of reference for watch_set()
15 */
16enum wref_type {
17 wr_save = 1,
18 wr_load = 2
19};
20
21extern asmlinkage void __watch_set(unsigned long addr, enum wref_type ref);
22extern asmlinkage void __watch_clear(void);
23extern asmlinkage void __watch_reenable(void);
24
25#define watch_set(addr, ref) \
26 if (cpu_has_watch) \
27 __watch_set(addr, ref)
28#define watch_clear() \
29 if (cpu_has_watch) \
30 __watch_clear()
31#define watch_reenable() \
32 if (cpu_has_watch) \
33 __watch_reenable()
34
35#endif /* _ASM_WATCH_H */
diff --git a/include/asm-mips/wbflush.h b/include/asm-mips/wbflush.h
new file mode 100644
index 000000000000..c3bef50f37a8
--- /dev/null
+++ b/include/asm-mips/wbflush.h
@@ -0,0 +1,35 @@
1/*
2 * Header file for using the wbflush routine
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (c) 1998 Harald Koerfgen
9 * Copyright (C) 2002 Maciej W. Rozycki
10 */
11#ifndef _ASM_WBFLUSH_H
12#define _ASM_WBFLUSH_H
13
14#include <linux/config.h>
15
16#ifdef CONFIG_CPU_HAS_WB
17
18extern void (*__wbflush)(void);
19extern void wbflush_setup(void);
20
21#define wbflush() \
22 do { \
23 __sync(); \
24 __wbflush(); \
25 } while (0)
26
27#else /* !CONFIG_CPU_HAS_WB */
28
29#define wbflush_setup() do { } while (0)
30
31#define wbflush() fast_iob()
32
33#endif /* !CONFIG_CPU_HAS_WB */
34
35#endif /* _ASM_WBFLUSH_H */
diff --git a/include/asm-mips/xor.h b/include/asm-mips/xor.h
new file mode 100644
index 000000000000..c82eb12a5b18
--- /dev/null
+++ b/include/asm-mips/xor.h
@@ -0,0 +1 @@
#include <asm-generic/xor.h>
diff --git a/include/asm-mips/xtalk/xtalk.h b/include/asm-mips/xtalk/xtalk.h
new file mode 100644
index 000000000000..4a60f27c8817
--- /dev/null
+++ b/include/asm-mips/xtalk/xtalk.h
@@ -0,0 +1,52 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * xtalk.h -- platform-independent crosstalk interface, derived from
7 * IRIX <sys/PCI/bridge.h>, revision 1.38.
8 *
9 * Copyright (C) 1995 - 1997, 1999 Silcon Graphics, Inc.
10 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
11 */
12#ifndef _ASM_XTALK_XTALK_H
13#define _ASM_XTALK_XTALK_H
14
15#ifndef __ASSEMBLY__
16/*
17 * User-level device driver visible types
18 */
19typedef char xwidgetnum_t; /* xtalk widget number (0..15) */
20
21#define XWIDGET_NONE -1
22
23typedef int xwidget_part_num_t; /* xtalk widget part number */
24
25#define XWIDGET_PART_NUM_NONE -1
26
27typedef int xwidget_rev_num_t; /* xtalk widget revision number */
28
29#define XWIDGET_REV_NUM_NONE -1
30
31typedef int xwidget_mfg_num_t; /* xtalk widget manufacturing ID */
32
33#define XWIDGET_MFG_NUM_NONE -1
34
35typedef struct xtalk_piomap_s *xtalk_piomap_t;
36
37/* It is often convenient to fold the XIO target port
38 * number into the XIO address.
39 */
40#define XIO_NOWHERE (0xFFFFFFFFFFFFFFFFull)
41#define XIO_ADDR_BITS (0x0000FFFFFFFFFFFFull)
42#define XIO_PORT_BITS (0xF000000000000000ull)
43#define XIO_PORT_SHIFT (60)
44
45#define XIO_PACKED(x) (((x)&XIO_PORT_BITS) != 0)
46#define XIO_ADDR(x) ((x)&XIO_ADDR_BITS)
47#define XIO_PORT(x) ((xwidgetnum_t)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
48#define XIO_PACK(p,o) ((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
49
50#endif /* !__ASSEMBLY__ */
51
52#endif /* _ASM_XTALK_XTALK_H */
diff --git a/include/asm-mips/xtalk/xwidget.h b/include/asm-mips/xtalk/xwidget.h
new file mode 100644
index 000000000000..b4a13d7405ee
--- /dev/null
+++ b/include/asm-mips/xtalk/xwidget.h
@@ -0,0 +1,167 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * xwidget.h - generic crosstalk widget header file, derived from IRIX
7 * <sys/xtalk/xtalkwidget.h>, revision 1.32.
8 *
9 * Copyright (C) 1996, 1999 Silcon Graphics, Inc.
10 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
11 */
12#ifndef _ASM_XTALK_XWIDGET_H
13#define _ASM_XTALK_XWIDGET_H
14
15#include <linux/types.h>
16#include <asm/xtalk/xtalk.h>
17
18#define WIDGET_ID 0x04
19#define WIDGET_STATUS 0x0c
20#define WIDGET_ERR_UPPER_ADDR 0x14
21#define WIDGET_ERR_LOWER_ADDR 0x1c
22#define WIDGET_CONTROL 0x24
23#define WIDGET_REQ_TIMEOUT 0x2c
24#define WIDGET_INTDEST_UPPER_ADDR 0x34
25#define WIDGET_INTDEST_LOWER_ADDR 0x3c
26#define WIDGET_ERR_CMD_WORD 0x44
27#define WIDGET_LLP_CFG 0x4c
28#define WIDGET_TFLUSH 0x54
29
30/* WIDGET_ID */
31#define WIDGET_REV_NUM 0xf0000000
32#define WIDGET_PART_NUM 0x0ffff000
33#define WIDGET_MFG_NUM 0x00000ffe
34#define WIDGET_REV_NUM_SHFT 28
35#define WIDGET_PART_NUM_SHFT 12
36#define WIDGET_MFG_NUM_SHFT 1
37
38#define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT)
39#define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT)
40#define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT)
41
42/* WIDGET_STATUS */
43#define WIDGET_LLP_REC_CNT 0xff000000
44#define WIDGET_LLP_TX_CNT 0x00ff0000
45#define WIDGET_PENDING 0x0000001f
46
47/* WIDGET_ERR_UPPER_ADDR */
48#define WIDGET_ERR_UPPER_ADDR_ONLY 0x0000ffff
49
50/* WIDGET_CONTROL */
51#define WIDGET_F_BAD_PKT 0x00010000
52#define WIDGET_LLP_XBAR_CRD 0x0000f000
53#define WIDGET_LLP_XBAR_CRD_SHFT 12
54#define WIDGET_CLR_RLLP_CNT 0x00000800
55#define WIDGET_CLR_TLLP_CNT 0x00000400
56#define WIDGET_SYS_END 0x00000200
57#define WIDGET_MAX_TRANS 0x000001f0
58#define WIDGET_WIDGET_ID 0x0000000f
59
60/* WIDGET_INTDEST_UPPER_ADDR */
61#define WIDGET_INT_VECTOR 0xff000000
62#define WIDGET_INT_VECTOR_SHFT 24
63#define WIDGET_TARGET_ID 0x000f0000
64#define WIDGET_TARGET_ID_SHFT 16
65#define WIDGET_UPP_ADDR 0x0000ffff
66
67/* WIDGET_ERR_CMD_WORD */
68#define WIDGET_DIDN 0xf0000000
69#define WIDGET_SIDN 0x0f000000
70#define WIDGET_PACTYP 0x00f00000
71#define WIDGET_TNUM 0x000f8000
72#define WIDGET_COHERENT 0x00004000
73#define WIDGET_DS 0x00003000
74#define WIDGET_GBR 0x00000800
75#define WIDGET_VBPM 0x00000400
76#define WIDGET_ERROR 0x00000200
77#define WIDGET_BARRIER 0x00000100
78
79/* WIDGET_LLP_CFG */
80#define WIDGET_LLP_MAXRETRY 0x03ff0000
81#define WIDGET_LLP_MAXRETRY_SHFT 16
82#define WIDGET_LLP_NULLTIMEOUT 0x0000fc00
83#define WIDGET_LLP_NULLTIMEOUT_SHFT 10
84#define WIDGET_LLP_MAXBURST 0x000003ff
85#define WIDGET_LLP_MAXBURST_SHFT 0
86
87/*
88 * according to the crosstalk spec, only 32-bits access to the widget
89 * configuration registers is allowed. some widgets may allow 64-bits
90 * access but software should not depend on it. registers beyond the
91 * widget target flush register are widget dependent thus will not be
92 * defined here
93 */
94#ifndef __ASSEMBLY__
95typedef u32 widgetreg_t;
96
97/* widget configuration registers */
98typedef volatile struct widget_cfg {
99 widgetreg_t w_pad_0; /* 0x00 */
100 widgetreg_t w_id; /* 0x04 */
101 widgetreg_t w_pad_1; /* 0x08 */
102 widgetreg_t w_status; /* 0x0c */
103 widgetreg_t w_pad_2; /* 0x10 */
104 widgetreg_t w_err_upper_addr; /* 0x14 */
105 widgetreg_t w_pad_3; /* 0x18 */
106 widgetreg_t w_err_lower_addr; /* 0x1c */
107 widgetreg_t w_pad_4; /* 0x20 */
108 widgetreg_t w_control; /* 0x24 */
109 widgetreg_t w_pad_5; /* 0x28 */
110 widgetreg_t w_req_timeout; /* 0x2c */
111 widgetreg_t w_pad_6; /* 0x30 */
112 widgetreg_t w_intdest_upper_addr; /* 0x34 */
113 widgetreg_t w_pad_7; /* 0x38 */
114 widgetreg_t w_intdest_lower_addr; /* 0x3c */
115 widgetreg_t w_pad_8; /* 0x40 */
116 widgetreg_t w_err_cmd_word; /* 0x44 */
117 widgetreg_t w_pad_9; /* 0x48 */
118 widgetreg_t w_llp_cfg; /* 0x4c */
119 widgetreg_t w_pad_10; /* 0x50 */
120 widgetreg_t w_tflush; /* 0x54 */
121} widget_cfg_t;
122
123typedef struct {
124 unsigned didn:4;
125 unsigned sidn:4;
126 unsigned pactyp:4;
127 unsigned tnum:5;
128 unsigned ct:1;
129 unsigned ds:2;
130 unsigned gbr:1;
131 unsigned vbpm:1;
132 unsigned error:1;
133 unsigned bo:1;
134 unsigned other:8;
135} w_err_cmd_word_f;
136
137typedef union {
138 widgetreg_t r;
139 w_err_cmd_word_f f;
140} w_err_cmd_word_u;
141
142typedef struct xwidget_info_s *xwidget_info_t;
143
144/*
145 * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
146 */
147typedef struct xwidget_hwid_s {
148 xwidget_part_num_t part_num;
149 xwidget_rev_num_t rev_num;
150 xwidget_mfg_num_t mfg_num;
151} *xwidget_hwid_t;
152
153
154/*
155 * Returns 1 if a driver that handles devices described by hwid1 is able
156 * to manage a device with hardwareid hwid2. NOTE: We don't check rev
157 * numbers at all.
158 */
159#define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \
160 (((hwid1)->part_num == (hwid2)->part_num) && \
161 (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
162 ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
163 ((hwid1)->mfg_num == (hwid2)->mfg_num)))
164
165#endif /* !__ASSEMBLY__ */
166
167#endif /* _ASM_XTALK_XWIDGET_H */
diff --git a/include/asm-mips/xxs1500.h b/include/asm-mips/xxs1500.h
new file mode 100644
index 000000000000..75c0ddfeca13
--- /dev/null
+++ b/include/asm-mips/xxs1500.h
@@ -0,0 +1,35 @@
1/*
2 * MyCable XXS1500 Referrence Board
3 *
4 * Copyright 2003 MontaVista Software Inc.
5 * Author: Pete Popov, MontaVista Software, Inc.
6 * ppopov@mvista.com or source@mvista.com
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 *
25 *
26 */
27#ifndef __ASM_XXS1500_H
28#define __ASM_XXS1500_H
29
30/* PCMCIA XXS1500 specific defines */
31#define PCMCIA_MAX_SOCK 0
32#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
33#define PCMCIA_IRQ AU1000_GPIO_4
34
35#endif /* __ASM_XXS1500_ */