aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorWe-unite <3205135446@qq.com>2025-03-08 22:04:20 +0800
committerWe-unite <3205135446@qq.com>2025-03-08 22:04:20 +0800
commita07bb8fd1299070229f0e8f3dcb57ffd5ef9870a (patch)
tree84f21bd0bf7071bc5fc7dd989e77d7ceb5476682 /arch/mips/include
downloadohosKernel-a07bb8fd1299070229f0e8f3dcb57ffd5ef9870a.tar.gz
ohosKernel-a07bb8fd1299070229f0e8f3dcb57ffd5ef9870a.zip
Initial commit: OpenHarmony-v4.0-ReleaseOpenHarmony-v4.0-Release
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/Kbuild13
-rw-r--r--arch/mips/include/asm/abi.h32
-rw-r--r--arch/mips/include/asm/addrspace.h144
-rw-r--r--arch/mips/include/asm/amon.h12
-rw-r--r--arch/mips/include/asm/arch_hweight.h38
-rw-r--r--arch/mips/include/asm/asm-eva.h190
-rw-r--r--arch/mips/include/asm/asm-offsets.h1
-rw-r--r--arch/mips/include/asm/asm-prototypes.h8
-rw-r--r--arch/mips/include/asm/asm.h331
-rw-r--r--arch/mips/include/asm/asmmacro-32.h91
-rw-r--r--arch/mips/include/asm/asmmacro-64.h44
-rw-r--r--arch/mips/include/asm/asmmacro.h658
-rw-r--r--arch/mips/include/asm/atomic.h267
-rw-r--r--arch/mips/include/asm/barrier.h142
-rw-r--r--arch/mips/include/asm/bcache.h87
-rw-r--r--arch/mips/include/asm/bitops.h463
-rw-r--r--arch/mips/include/asm/bitrev.h31
-rw-r--r--arch/mips/include/asm/bmips-spaces.h8
-rw-r--r--arch/mips/include/asm/bmips.h128
-rw-r--r--arch/mips/include/asm/bootinfo.h166
-rw-r--r--arch/mips/include/asm/branch.h103
-rw-r--r--arch/mips/include/asm/break.h26
-rw-r--r--arch/mips/include/asm/bug.h44
-rw-r--r--arch/mips/include/asm/bugs.h53
-rw-r--r--arch/mips/include/asm/cache.h19
-rw-r--r--arch/mips/include/asm/cacheflush.h153
-rw-r--r--arch/mips/include/asm/cacheops.h116
-rw-r--r--arch/mips/include/asm/cdmm.h109
-rw-r--r--arch/mips/include/asm/cevt-r4k.h29
-rw-r--r--arch/mips/include/asm/checksum.h253
-rw-r--r--arch/mips/include/asm/clocksource.h11
-rw-r--r--arch/mips/include/asm/cmp.h18
-rw-r--r--arch/mips/include/asm/cmpxchg.h327
-rw-r--r--arch/mips/include/asm/compat-signal.h29
-rw-r--r--arch/mips/include/asm/compat.h191
-rw-r--r--arch/mips/include/asm/compiler.h73
-rw-r--r--arch/mips/include/asm/cop2.h72
-rw-r--r--arch/mips/include/asm/cpu-features.h739
-rw-r--r--arch/mips/include/asm/cpu-info.h219
-rw-r--r--arch/mips/include/asm/cpu-type.h223
-rw-r--r--arch/mips/include/asm/cpu.h451
-rw-r--r--arch/mips/include/asm/cpufeature.h22
-rw-r--r--arch/mips/include/asm/debug.h18
-rw-r--r--arch/mips/include/asm/dec/ecc.h51
-rw-r--r--arch/mips/include/asm/dec/interrupts.h126
-rw-r--r--arch/mips/include/asm/dec/ioasic.h34
-rw-r--r--arch/mips/include/asm/dec/ioasic_addrs.h152
-rw-r--r--arch/mips/include/asm/dec/ioasic_ints.h74
-rw-r--r--arch/mips/include/asm/dec/kn01.h89
-rw-r--r--arch/mips/include/asm/dec/kn02.h91
-rw-r--r--arch/mips/include/asm/dec/kn02ba.h63
-rw-r--r--arch/mips/include/asm/dec/kn02ca.h75
-rw-r--r--arch/mips/include/asm/dec/kn02xa.h84
-rw-r--r--arch/mips/include/asm/dec/kn03.h74
-rw-r--r--arch/mips/include/asm/dec/kn05.h81
-rw-r--r--arch/mips/include/asm/dec/kn230.h22
-rw-r--r--arch/mips/include/asm/dec/machtype.h27
-rw-r--r--arch/mips/include/asm/dec/prom.h165
-rw-r--r--arch/mips/include/asm/dec/system.h15
-rw-r--r--arch/mips/include/asm/delay.h32
-rw-r--r--arch/mips/include/asm/div64.h91
-rw-r--r--arch/mips/include/asm/dma-coherence.h38
-rw-r--r--arch/mips/include/asm/dma-direct.h8
-rw-r--r--arch/mips/include/asm/dma-mapping.h18
-rw-r--r--arch/mips/include/asm/dma.h318
-rw-r--r--arch/mips/include/asm/dmi.h20
-rw-r--r--arch/mips/include/asm/ds1287.h14
-rw-r--r--arch/mips/include/asm/dsemul.h115
-rw-r--r--arch/mips/include/asm/dsp.h81
-rw-r--r--arch/mips/include/asm/edac.h38
-rw-r--r--arch/mips/include/asm/elf.h538
-rw-r--r--arch/mips/include/asm/errno.h17
-rw-r--r--arch/mips/include/asm/eva.h43
-rw-r--r--arch/mips/include/asm/exec.h17
-rw-r--r--arch/mips/include/asm/extable.h14
-rw-r--r--arch/mips/include/asm/fb.h19
-rw-r--r--arch/mips/include/asm/fixmap.h79
-rw-r--r--arch/mips/include/asm/floppy.h56
-rw-r--r--arch/mips/include/asm/fpregdef.h113
-rw-r--r--arch/mips/include/asm/fpu.h328
-rw-r--r--arch/mips/include/asm/fpu_emulator.h187
-rw-r--r--arch/mips/include/asm/ftrace.h90
-rw-r--r--arch/mips/include/asm/futex.h204
-rw-r--r--arch/mips/include/asm/fw/arc/hinv.h176
-rw-r--r--arch/mips/include/asm/fw/arc/types.h86
-rw-r--r--arch/mips/include/asm/fw/cfe/cfe_api.h109
-rw-r--r--arch/mips/include/asm/fw/cfe/cfe_error.h67
-rw-r--r--arch/mips/include/asm/fw/fw.h31
-rw-r--r--arch/mips/include/asm/ginvt.h56
-rw-r--r--arch/mips/include/asm/gio_device.h53
-rw-r--r--arch/mips/include/asm/gt64120.h566
-rw-r--r--arch/mips/include/asm/hardirq.h18
-rw-r--r--arch/mips/include/asm/hazards.h422
-rw-r--r--arch/mips/include/asm/highmem.h59
-rw-r--r--arch/mips/include/asm/hpet.h74
-rw-r--r--arch/mips/include/asm/hugetlb.h86
-rw-r--r--arch/mips/include/asm/hw_irq.h20
-rw-r--r--arch/mips/include/asm/i8259.h93
-rw-r--r--arch/mips/include/asm/ide.h13
-rw-r--r--arch/mips/include/asm/idle.h32
-rw-r--r--arch/mips/include/asm/inst.h88
-rw-r--r--arch/mips/include/asm/io.h562
-rw-r--r--arch/mips/include/asm/ip32/crime.h158
-rw-r--r--arch/mips/include/asm/ip32/ip32_ints.h114
-rw-r--r--arch/mips/include/asm/ip32/mace.h365
-rw-r--r--arch/mips/include/asm/irq.h85
-rw-r--r--arch/mips/include/asm/irq_cpu.h22
-rw-r--r--arch/mips/include/asm/irq_gt641xx.h47
-rw-r--r--arch/mips/include/asm/irq_regs.h28
-rw-r--r--arch/mips/include/asm/irqflags.h185
-rw-r--r--arch/mips/include/asm/isa-rev.h24
-rw-r--r--arch/mips/include/asm/isadep.h35
-rw-r--r--arch/mips/include/asm/jazz.h310
-rw-r--r--arch/mips/include/asm/jazzdma.h88
-rw-r--r--arch/mips/include/asm/jump_label.h75
-rw-r--r--arch/mips/include/asm/kdebug.h20
-rw-r--r--arch/mips/include/asm/kexec.h51
-rw-r--r--arch/mips/include/asm/kgdb.h45
-rw-r--r--arch/mips/include/asm/kmap_types.h13
-rw-r--r--arch/mips/include/asm/kprobes.h78
-rw-r--r--arch/mips/include/asm/kvm_host.h1158
-rw-r--r--arch/mips/include/asm/kvm_types.h7
-rw-r--r--arch/mips/include/asm/linkage.h13
-rw-r--r--arch/mips/include/asm/llsc.h39
-rw-r--r--arch/mips/include/asm/local.h206
-rw-r--r--arch/mips/include/asm/maar.h127
-rw-r--r--arch/mips/include/asm/mach-ar7/ar7.h197
-rw-r--r--arch/mips/include/asm/mach-ar7/irq.h16
-rw-r--r--arch/mips/include/asm/mach-ar7/prom.h12
-rw-r--r--arch/mips/include/asm/mach-ar7/spaces.h22
-rw-r--r--arch/mips/include/asm/mach-ath25/ath25_platform.h74
-rw-r--r--arch/mips/include/asm/mach-ath25/cpu-feature-overrides.h60
-rw-r--r--arch/mips/include/asm/mach-ath79/ar71xx_regs.h1321
-rw-r--r--arch/mips/include/asm/mach-ath79/ar933x_uart.h64
-rw-r--r--arch/mips/include/asm/mach-ath79/ath79.h178
-rw-r--r--arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h56
-rw-r--r--arch/mips/include/asm/mach-ath79/irq.h32
-rw-r--r--arch/mips/include/asm/mach-ath79/kernel-entry-init.h28
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1000.h1211
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1000_dma.h453
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1100_mmc.h210
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1200fb.h15
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1550_spi.h16
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1550nd.h17
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1xxx_dbdma.h388
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1xxx_eth.h19
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1xxx_psc.h466
-rw-r--r--arch/mips/include/asm/mach-au1x00/cpu-feature-overrides.h94
-rw-r--r--arch/mips/include/asm/mach-au1x00/gpio-au1000.h532
-rw-r--r--arch/mips/include/asm/mach-au1x00/gpio-au1300.h123
-rw-r--r--arch/mips/include/asm/mach-au1x00/prom.h13
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx.h38
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h140
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h83
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h13
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h1068
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_cs.h11
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h126
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h13
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h9
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pci.h7
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h14
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h11
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h7
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_usbd.h18
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h35
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h104
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h14
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_iudma.h39
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h36
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h1431
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h22
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_timer.h12
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h54
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h54
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/ioremap.h44
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/irq.h8
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/spaces.h17
-rw-r--r--arch/mips/include/asm/mach-bmips/cpu-feature-overrides.h15
-rw-r--r--arch/mips/include/asm/mach-bmips/ioremap.h29
-rw-r--r--arch/mips/include/asm/mach-bmips/spaces.h18
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h80
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/irq.h58
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h160
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/mangle-port.h64
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/spaces.h24
-rw-r--r--arch/mips/include/asm/mach-cobalt/cobalt.h22
-rw-r--r--arch/mips/include/asm/mach-cobalt/cpu-feature-overrides.h57
-rw-r--r--arch/mips/include/asm/mach-cobalt/irq.h57
-rw-r--r--arch/mips/include/asm/mach-cobalt/mach-gt64120.h14
-rw-r--r--arch/mips/include/asm/mach-db1x00/bcsr.h261
-rw-r--r--arch/mips/include/asm/mach-db1x00/irq.h23
-rw-r--r--arch/mips/include/asm/mach-dec/cpu-feature-overrides.h97
-rw-r--r--arch/mips/include/asm/mach-dec/mc146818rtc.h39
-rw-r--r--arch/mips/include/asm/mach-generic/cpu-feature-overrides.h13
-rw-r--r--arch/mips/include/asm/mach-generic/floppy.h133
-rw-r--r--arch/mips/include/asm/mach-generic/ide.h138
-rw-r--r--arch/mips/include/asm/mach-generic/ioremap.h21
-rw-r--r--arch/mips/include/asm/mach-generic/irq.h39
-rw-r--r--arch/mips/include/asm/mach-generic/kernel-entry-init.h25
-rw-r--r--arch/mips/include/asm/mach-generic/kmalloc.h13
-rw-r--r--arch/mips/include/asm/mach-generic/mangle-port.h52
-rw-r--r--arch/mips/include/asm/mach-generic/mc146818rtc.h36
-rw-r--r--arch/mips/include/asm/mach-generic/spaces.h110
-rw-r--r--arch/mips/include/asm/mach-generic/topology.h1
-rw-r--r--arch/mips/include/asm/mach-ingenic/cpu-feature-overrides.h50
-rw-r--r--arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h51
-rw-r--r--arch/mips/include/asm/mach-ip22/spaces.h17
-rw-r--r--arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h76
-rw-r--r--arch/mips/include/asm/mach-ip27/irq.h24
-rw-r--r--arch/mips/include/asm/mach-ip27/kernel-entry-init.h96
-rw-r--r--arch/mips/include/asm/mach-ip27/mangle-port.h25
-rw-r--r--arch/mips/include/asm/mach-ip27/mmzone.h28
-rw-r--r--arch/mips/include/asm/mach-ip27/spaces.h35
-rw-r--r--arch/mips/include/asm/mach-ip27/topology.h31
-rw-r--r--arch/mips/include/asm/mach-ip28/cpu-feature-overrides.h54
-rw-r--r--arch/mips/include/asm/mach-ip28/spaces.h18
-rw-r--r--arch/mips/include/asm/mach-ip30/cpu-feature-overrides.h79
-rw-r--r--arch/mips/include/asm/mach-ip30/kernel-entry-init.h13
-rw-r--r--arch/mips/include/asm/mach-ip30/mangle-port.h22
-rw-r--r--arch/mips/include/asm/mach-ip30/spaces.h20
-rw-r--r--arch/mips/include/asm/mach-ip32/cpu-feature-overrides.h51
-rw-r--r--arch/mips/include/asm/mach-ip32/kmalloc.h12
-rw-r--r--arch/mips/include/asm/mach-ip32/mangle-port.h26
-rw-r--r--arch/mips/include/asm/mach-jazz/floppy.h133
-rw-r--r--arch/mips/include/asm/mach-jazz/mc146818rtc.h38
-rw-r--r--arch/mips/include/asm/mach-lantiq/falcon/cpu-feature-overrides.h53
-rw-r--r--arch/mips/include/asm/mach-lantiq/falcon/falcon_irq.h21
-rw-r--r--arch/mips/include/asm/mach-lantiq/falcon/irq.h16
-rw-r--r--arch/mips/include/asm/mach-lantiq/falcon/lantiq_soc.h69
-rw-r--r--arch/mips/include/asm/mach-lantiq/lantiq.h55
-rw-r--r--arch/mips/include/asm/mach-lantiq/lantiq_platform.h18
-rw-r--r--arch/mips/include/asm/mach-lantiq/xway/irq.h16
-rw-r--r--arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h22
-rw-r--r--arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h106
-rw-r--r--arch/mips/include/asm/mach-lantiq/xway/xway_dma.h50
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/cpu-feature-overrides.h44
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536.h306
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_mfgpt.h36
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_pci.h153
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_vsm.h32
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/loongson.h327
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/machine.h23
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/mem.h37
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/pci.h46
-rw-r--r--arch/mips/include/asm/mach-loongson2ef/spaces.h10
-rw-r--r--arch/mips/include/asm/mach-loongson32/cpufreq.h18
-rw-r--r--arch/mips/include/asm/mach-loongson32/dma.h21
-rw-r--r--arch/mips/include/asm/mach-loongson32/irq.h107
-rw-r--r--arch/mips/include/asm/mach-loongson32/loongson1.h54
-rw-r--r--arch/mips/include/asm/mach-loongson32/nand.h26
-rw-r--r--arch/mips/include/asm/mach-loongson32/platform.h28
-rw-r--r--arch/mips/include/asm/mach-loongson32/regs-clk.h81
-rw-r--r--arch/mips/include/asm/mach-loongson32/regs-mux.h124
-rw-r--r--arch/mips/include/asm/mach-loongson32/regs-pwm.h25
-rw-r--r--arch/mips/include/asm/mach-loongson32/regs-rtc.h19
-rw-r--r--arch/mips/include/asm/mach-loongson32/regs-wdt.h15
-rw-r--r--arch/mips/include/asm/mach-loongson64/boot_param.h236
-rw-r--r--arch/mips/include/asm/mach-loongson64/builtin_dtbs.h16
-rw-r--r--arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h51
-rw-r--r--arch/mips/include/asm/mach-loongson64/cpucfg-emul.h74
-rw-r--r--arch/mips/include/asm/mach-loongson64/irq.h15
-rw-r--r--arch/mips/include/asm/mach-loongson64/kernel-entry-init.h86
-rw-r--r--arch/mips/include/asm/mach-loongson64/loongson.h241
-rw-r--r--arch/mips/include/asm/mach-loongson64/loongson_hwmon.h56
-rw-r--r--arch/mips/include/asm/mach-loongson64/loongson_regs.h246
-rw-r--r--arch/mips/include/asm/mach-loongson64/mmzone.h24
-rw-r--r--arch/mips/include/asm/mach-loongson64/pci.h19
-rw-r--r--arch/mips/include/asm/mach-loongson64/spaces.h17
-rw-r--r--arch/mips/include/asm/mach-loongson64/topology.h25
-rw-r--r--arch/mips/include/asm/mach-loongson64/workarounds.h8
-rw-r--r--arch/mips/include/asm/mach-malta/cpu-feature-overrides.h70
-rw-r--r--arch/mips/include/asm/mach-malta/irq.h10
-rw-r--r--arch/mips/include/asm/mach-malta/kernel-entry-init.h145
-rw-r--r--arch/mips/include/asm/mach-malta/mach-gt64120.h20
-rw-r--r--arch/mips/include/asm/mach-malta/mc146818rtc.h36
-rw-r--r--arch/mips/include/asm/mach-malta/spaces.h46
-rw-r--r--arch/mips/include/asm/mach-netlogic/cpu-feature-overrides.h57
-rw-r--r--arch/mips/include/asm/mach-netlogic/irq.h17
-rw-r--r--arch/mips/include/asm/mach-netlogic/multi-node.h74
-rw-r--r--arch/mips/include/asm/mach-pic32/cpu-feature-overrides.h32
-rw-r--r--arch/mips/include/asm/mach-pic32/irq.h14
-rw-r--r--arch/mips/include/asm/mach-pic32/pic32.h36
-rw-r--r--arch/mips/include/asm/mach-pic32/spaces.h15
-rw-r--r--arch/mips/include/asm/mach-pistachio/irq.h15
-rw-r--r--arch/mips/include/asm/mach-ralink/irq.h10
-rw-r--r--arch/mips/include/asm/mach-ralink/mt7620.h138
-rw-r--r--arch/mips/include/asm/mach-ralink/mt7620/cpu-feature-overrides.h52
-rw-r--r--arch/mips/include/asm/mach-ralink/mt7621.h34
-rw-r--r--arch/mips/include/asm/mach-ralink/mt7621/cpu-feature-overrides.h60
-rw-r--r--arch/mips/include/asm/mach-ralink/pinmux.h52
-rw-r--r--arch/mips/include/asm/mach-ralink/ralink_regs.h62
-rw-r--r--arch/mips/include/asm/mach-ralink/rt288x.h51
-rw-r--r--arch/mips/include/asm/mach-ralink/rt288x/cpu-feature-overrides.h51
-rw-r--r--arch/mips/include/asm/mach-ralink/rt305x.h160
-rw-r--r--arch/mips/include/asm/mach-ralink/rt305x/cpu-feature-overrides.h51
-rw-r--r--arch/mips/include/asm/mach-ralink/rt3883.h251
-rw-r--r--arch/mips/include/asm/mach-ralink/rt3883/cpu-feature-overrides.h50
-rw-r--r--arch/mips/include/asm/mach-rc32434/cpu-feature-overrides.h63
-rw-r--r--arch/mips/include/asm/mach-rc32434/ddr.h141
-rw-r--r--arch/mips/include/asm/mach-rc32434/dma.h104
-rw-r--r--arch/mips/include/asm/mach-rc32434/dma_v.h53
-rw-r--r--arch/mips/include/asm/mach-rc32434/eth.h220
-rw-r--r--arch/mips/include/asm/mach-rc32434/gpio.h79
-rw-r--r--arch/mips/include/asm/mach-rc32434/integ.h59
-rw-r--r--arch/mips/include/asm/mach-rc32434/irq.h37
-rw-r--r--arch/mips/include/asm/mach-rc32434/pci.h478
-rw-r--r--arch/mips/include/asm/mach-rc32434/prom.h40
-rw-r--r--arch/mips/include/asm/mach-rc32434/rb.h75
-rw-r--r--arch/mips/include/asm/mach-rc32434/rc32434.h20
-rw-r--r--arch/mips/include/asm/mach-rc32434/timer.h65
-rw-r--r--arch/mips/include/asm/mach-rm/cpu-feature-overrides.h42
-rw-r--r--arch/mips/include/asm/mach-rm/mc146818rtc.h21
-rw-r--r--arch/mips/include/asm/mach-sibyte/cpu-feature-overrides.h49
-rw-r--r--arch/mips/include/asm/mach-tx39xx/ioremap.h25
-rw-r--r--arch/mips/include/asm/mach-tx39xx/mangle-port.h24
-rw-r--r--arch/mips/include/asm/mach-tx39xx/spaces.h17
-rw-r--r--arch/mips/include/asm/mach-tx49xx/cpu-feature-overrides.h26
-rw-r--r--arch/mips/include/asm/mach-tx49xx/ioremap.h30
-rw-r--r--arch/mips/include/asm/mach-tx49xx/kmalloc.h7
-rw-r--r--arch/mips/include/asm/mach-tx49xx/mangle-port.h27
-rw-r--r--arch/mips/include/asm/mach-tx49xx/spaces.h17
-rw-r--r--arch/mips/include/asm/mach-vr41xx/irq.h9
-rw-r--r--arch/mips/include/asm/machine.h90
-rw-r--r--arch/mips/include/asm/mc146818-time.h119
-rw-r--r--arch/mips/include/asm/mc146818rtc.h16
-rw-r--r--arch/mips/include/asm/mips-boards/bonito64.h430
-rw-r--r--arch/mips/include/asm/mips-boards/generic.h79
-rw-r--r--arch/mips/include/asm/mips-boards/launch.h36
-rw-r--r--arch/mips/include/asm/mips-boards/malta.h97
-rw-r--r--arch/mips/include/asm/mips-boards/maltaint.h63
-rw-r--r--arch/mips/include/asm/mips-boards/msc01_pci.h258
-rw-r--r--arch/mips/include/asm/mips-boards/piix4.h58
-rw-r--r--arch/mips/include/asm/mips-boards/sead3-addr.h83
-rw-r--r--arch/mips/include/asm/mips-boards/sim.h27
-rw-r--r--arch/mips/include/asm/mips-cm.h459
-rw-r--r--arch/mips/include/asm/mips-cpc.h179
-rw-r--r--arch/mips/include/asm/mips-cps.h236
-rw-r--r--arch/mips/include/asm/mips-gic.h373
-rw-r--r--arch/mips/include/asm/mips-r2-to-r6-emul.h101
-rw-r--r--arch/mips/include/asm/mips_mt.h31
-rw-r--r--arch/mips/include/asm/mipsmtregs.h423
-rw-r--r--arch/mips/include/asm/mipsprom.h77
-rw-r--r--arch/mips/include/asm/mipsregs.h2927
-rw-r--r--arch/mips/include/asm/mmiowb.h11
-rw-r--r--arch/mips/include/asm/mmu.h25
-rw-r--r--arch/mips/include/asm/mmu_context.h240
-rw-r--r--arch/mips/include/asm/mmzone.h29
-rw-r--r--arch/mips/include/asm/module.h86
-rw-r--r--arch/mips/include/asm/msa.h278
-rw-r--r--arch/mips/include/asm/msc01_ic.h147
-rw-r--r--arch/mips/include/asm/netlogic/common.h132
-rw-r--r--arch/mips/include/asm/netlogic/haldefs.h171
-rw-r--r--arch/mips/include/asm/netlogic/interrupt.h45
-rw-r--r--arch/mips/include/asm/netlogic/mips-extns.h301
-rw-r--r--arch/mips/include/asm/netlogic/psb-bootinfo.h95
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/bridge.h186
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h89
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/iomap.h214
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/pcibus.h113
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/pic.h366
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/sys.h213
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/uart.h192
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/xlp.h119
-rw-r--r--arch/mips/include/asm/netlogic/xlr/bridge.h104
-rw-r--r--arch/mips/include/asm/netlogic/xlr/flash.h55
-rw-r--r--arch/mips/include/asm/netlogic/xlr/fmn.h365
-rw-r--r--arch/mips/include/asm/netlogic/xlr/gpio.h74
-rw-r--r--arch/mips/include/asm/netlogic/xlr/iomap.h109
-rw-r--r--arch/mips/include/asm/netlogic/xlr/msidef.h84
-rw-r--r--arch/mips/include/asm/netlogic/xlr/pic.h306
-rw-r--r--arch/mips/include/asm/netlogic/xlr/xlr.h59
-rw-r--r--arch/mips/include/asm/octeon/cvmx-address.h341
-rw-r--r--arch/mips/include/asm/octeon/cvmx-agl-defs.h1759
-rw-r--r--arch/mips/include/asm/octeon/cvmx-asm.h139
-rw-r--r--arch/mips/include/asm/octeon/cvmx-asxx-defs.h566
-rw-r--r--arch/mips/include/asm/octeon/cvmx-boot-vector.h53
-rw-r--r--arch/mips/include/asm/octeon/cvmx-bootinfo.h424
-rw-r--r--arch/mips/include/asm/octeon/cvmx-bootmem.h341
-rw-r--r--arch/mips/include/asm/octeon/cvmx-ciu-defs.h176
-rw-r--r--arch/mips/include/asm/octeon/cvmx-ciu2-defs.h48
-rw-r--r--arch/mips/include/asm/octeon/cvmx-ciu3-defs.h353
-rw-r--r--arch/mips/include/asm/octeon/cvmx-cmd-queue.h619
-rw-r--r--arch/mips/include/asm/octeon/cvmx-config.h169
-rw-r--r--arch/mips/include/asm/octeon/cvmx-coremask.h89
-rw-r--r--arch/mips/include/asm/octeon/cvmx-dbg-defs.h101
-rw-r--r--arch/mips/include/asm/octeon/cvmx-dpi-defs.h874
-rw-r--r--arch/mips/include/asm/octeon/cvmx-fau.h619
-rw-r--r--arch/mips/include/asm/octeon/cvmx-fpa-defs.h1252
-rw-r--r--arch/mips/include/asm/octeon/cvmx-fpa.h308
-rw-r--r--arch/mips/include/asm/octeon/cvmx-gmxx-defs.h2259
-rw-r--r--arch/mips/include/asm/octeon/cvmx-gpio-defs.h399
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-board.h124
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-errata.h33
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-jtag.h43
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-loop.h60
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-npi.h61
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-rgmii.h93
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-sgmii.h87
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-spi.h84
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-util.h192
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-xaui.h87
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper.h178
-rw-r--r--arch/mips/include/asm/octeon/cvmx-iob-defs.h903
-rw-r--r--arch/mips/include/asm/octeon/cvmx-ipd-defs.h1472
-rw-r--r--arch/mips/include/asm/octeon/cvmx-ipd.h339
-rw-r--r--arch/mips/include/asm/octeon/cvmx-l2c-defs.h239
-rw-r--r--arch/mips/include/asm/octeon/cvmx-l2c.h364
-rw-r--r--arch/mips/include/asm/octeon/cvmx-l2d-defs.h60
-rw-r--r--arch/mips/include/asm/octeon/cvmx-l2t-defs.h143
-rw-r--r--arch/mips/include/asm/octeon/cvmx-led-defs.h214
-rw-r--r--arch/mips/include/asm/octeon/cvmx-lmcx-defs.h2943
-rw-r--r--arch/mips/include/asm/octeon/cvmx-mio-defs.h4396
-rw-r--r--arch/mips/include/asm/octeon/cvmx-mixx-defs.h430
-rw-r--r--arch/mips/include/asm/octeon/cvmx-npei-defs.h3925
-rw-r--r--arch/mips/include/asm/octeon/cvmx-npi-defs.h2514
-rw-r--r--arch/mips/include/asm/octeon/cvmx-packet.h69
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pci-defs.h2037
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pciercx-defs.h368
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pcsx-defs.h826
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pcsxx-defs.h664
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pemx-defs.h651
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pescx-defs.h579
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pexp-defs.h224
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pip-defs.h2734
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pip.h524
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pko-defs.h2205
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pko.h643
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pow-defs.h1001
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pow.h2215
-rw-r--r--arch/mips/include/asm/octeon/cvmx-rnm-defs.h171
-rw-r--r--arch/mips/include/asm/octeon/cvmx-rst-defs.h278
-rw-r--r--arch/mips/include/asm/octeon/cvmx-scratch.h139
-rw-r--r--arch/mips/include/asm/octeon/cvmx-sli-defs.h129
-rw-r--r--arch/mips/include/asm/octeon/cvmx-spi.h269
-rw-r--r--arch/mips/include/asm/octeon/cvmx-spinlock.h232
-rw-r--r--arch/mips/include/asm/octeon/cvmx-spxx-defs.h446
-rw-r--r--arch/mips/include/asm/octeon/cvmx-sriox-defs.h1614
-rw-r--r--arch/mips/include/asm/octeon/cvmx-srxx-defs.h140
-rw-r--r--arch/mips/include/asm/octeon/cvmx-stxx-defs.h330
-rw-r--r--arch/mips/include/asm/octeon/cvmx-sysinfo.h125
-rw-r--r--arch/mips/include/asm/octeon/cvmx-uctlx-defs.h386
-rw-r--r--arch/mips/include/asm/octeon/cvmx-wqe.h658
-rw-r--r--arch/mips/include/asm/octeon/cvmx.h495
-rw-r--r--arch/mips/include/asm/octeon/octeon-feature.h213
-rw-r--r--arch/mips/include/asm/octeon/octeon-model.h409
-rw-r--r--arch/mips/include/asm/octeon/octeon.h366
-rw-r--r--arch/mips/include/asm/octeon/pci-octeon.h69
-rw-r--r--arch/mips/include/asm/paccess.h114
-rw-r--r--arch/mips/include/asm/page.h261
-rw-r--r--arch/mips/include/asm/pci.h149
-rw-r--r--arch/mips/include/asm/pci/bridge.h825
-rw-r--r--arch/mips/include/asm/perf_event.h12
-rw-r--r--arch/mips/include/asm/pgalloc.h112
-rw-r--r--arch/mips/include/asm/pgtable-32.h248
-rw-r--r--arch/mips/include/asm/pgtable-64.h346
-rw-r--r--arch/mips/include/asm/pgtable-bits.h285
-rw-r--r--arch/mips/include/asm/pgtable.h744
-rw-r--r--arch/mips/include/asm/pm-cps.h49
-rw-r--r--arch/mips/include/asm/pm.h155
-rw-r--r--arch/mips/include/asm/prefetch.h87
-rw-r--r--arch/mips/include/asm/processor.h425
-rw-r--r--arch/mips/include/asm/prom.h30
-rw-r--r--arch/mips/include/asm/ptrace.h189
-rw-r--r--arch/mips/include/asm/r4k-timer.h30
-rw-r--r--arch/mips/include/asm/r4kcache.h379
-rw-r--r--arch/mips/include/asm/reboot.h15
-rw-r--r--arch/mips/include/asm/reg.h1
-rw-r--r--arch/mips/include/asm/regdef.h106
-rw-r--r--arch/mips/include/asm/rtlx.h88
-rw-r--r--arch/mips/include/asm/seccomp.h35
-rw-r--r--arch/mips/include/asm/setup.h31
-rw-r--r--arch/mips/include/asm/sgi/gio.h86
-rw-r--r--arch/mips/include/asm/sgi/heart.h323
-rw-r--r--arch/mips/include/asm/sgi/hpc3.h317
-rw-r--r--arch/mips/include/asm/sgi/ioc.h200
-rw-r--r--arch/mips/include/asm/sgi/ip22.h80
-rw-r--r--arch/mips/include/asm/sgi/mc.h231
-rw-r--r--arch/mips/include/asm/sgi/pi1.h72
-rw-r--r--arch/mips/include/asm/sgi/seeq.h21
-rw-r--r--arch/mips/include/asm/sgi/wd.h20
-rw-r--r--arch/mips/include/asm/sgialib.h61
-rw-r--r--arch/mips/include/asm/sgiarcs.h505
-rw-r--r--arch/mips/include/asm/shmparam.h13
-rw-r--r--arch/mips/include/asm/sibyte/bcm1480_int.h299
-rw-r--r--arch/mips/include/asm/sibyte/bcm1480_l2c.h163
-rw-r--r--arch/mips/include/asm/sibyte/bcm1480_mc.h971
-rw-r--r--arch/mips/include/asm/sibyte/bcm1480_regs.h889
-rw-r--r--arch/mips/include/asm/sibyte/bcm1480_scd.h393
-rw-r--r--arch/mips/include/asm/sibyte/bigsur.h35
-rw-r--r--arch/mips/include/asm/sibyte/board.h55
-rw-r--r--arch/mips/include/asm/sibyte/carmel.h45
-rw-r--r--arch/mips/include/asm/sibyte/sb1250.h55
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_defs.h246
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_dma.h581
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_genbus.h461
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_int.h235
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_l2c.h118
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_ldt.h409
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_mac.h643
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_mc.h537
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_regs.h880
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_scd.h641
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_smbus.h191
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_syncser.h133
-rw-r--r--arch/mips/include/asm/sibyte/sb1250_uart.h349
-rw-r--r--arch/mips/include/asm/sibyte/sentosa.h27
-rw-r--r--arch/mips/include/asm/sibyte/swarm.h51
-rw-r--r--arch/mips/include/asm/sigcontext.h37
-rw-r--r--arch/mips/include/asm/signal.h35
-rw-r--r--arch/mips/include/asm/sim.h70
-rw-r--r--arch/mips/include/asm/smp-cps.h48
-rw-r--r--arch/mips/include/asm/smp-ops.h121
-rw-r--r--arch/mips/include/asm/smp.h138
-rw-r--r--arch/mips/include/asm/sn/addrs.h377
-rw-r--r--arch/mips/include/asm/sn/agent.h45
-rw-r--r--arch/mips/include/asm/sn/arch.h28
-rw-r--r--arch/mips/include/asm/sn/fru.h44
-rw-r--r--arch/mips/include/asm/sn/gda.h105
-rw-r--r--arch/mips/include/asm/sn/intr.h112
-rw-r--r--arch/mips/include/asm/sn/io.h59
-rw-r--r--arch/mips/include/asm/sn/ioc3.h606
-rw-r--r--arch/mips/include/asm/sn/irq_alloc.h11
-rw-r--r--arch/mips/include/asm/sn/klconfig.h894
-rw-r--r--arch/mips/include/asm/sn/kldir.h36
-rw-r--r--arch/mips/include/asm/sn/klkernvars.h29
-rw-r--r--arch/mips/include/asm/sn/launch.h106
-rw-r--r--arch/mips/include/asm/sn/mapped_kernel.h55
-rw-r--r--arch/mips/include/asm/sn/nmi.h125
-rw-r--r--arch/mips/include/asm/sn/sn0/addrs.h283
-rw-r--r--arch/mips/include/asm/sn/sn0/arch.h56
-rw-r--r--arch/mips/include/asm/sn/sn0/hub.h62
-rw-r--r--arch/mips/include/asm/sn/sn0/hubio.h972
-rw-r--r--arch/mips/include/asm/sn/sn0/hubmd.h789
-rw-r--r--arch/mips/include/asm/sn/sn0/hubni.h263
-rw-r--r--arch/mips/include/asm/sn/sn0/hubpi.h409
-rw-r--r--arch/mips/include/asm/sn/sn0/kldir.h186
-rw-r--r--arch/mips/include/asm/sn/types.h25
-rw-r--r--arch/mips/include/asm/sni.h246
-rw-r--r--arch/mips/include/asm/socket.h50
-rw-r--r--arch/mips/include/asm/sparsemem.h18
-rw-r--r--arch/mips/include/asm/spinlock.h31
-rw-r--r--arch/mips/include/asm/spinlock_types.h8
-rw-r--r--arch/mips/include/asm/spram.h11
-rw-r--r--arch/mips/include/asm/stackframe.h492
-rw-r--r--arch/mips/include/asm/stackprotector.h41
-rw-r--r--arch/mips/include/asm/stacktrace.h89
-rw-r--r--arch/mips/include/asm/string.h22
-rw-r--r--arch/mips/include/asm/switch_to.h142
-rw-r--r--arch/mips/include/asm/sync.h209
-rw-r--r--arch/mips/include/asm/syscall.h160
-rw-r--r--arch/mips/include/asm/termios.h105
-rw-r--r--arch/mips/include/asm/thread_info.h199
-rw-r--r--arch/mips/include/asm/time.h73
-rw-r--r--arch/mips/include/asm/timex.h102
-rw-r--r--arch/mips/include/asm/tlb.h26
-rw-r--r--arch/mips/include/asm/tlbdebug.h17
-rw-r--r--arch/mips/include/asm/tlbex.h36
-rw-r--r--arch/mips/include/asm/tlbflush.h49
-rw-r--r--arch/mips/include/asm/tlbmisc.h11
-rw-r--r--arch/mips/include/asm/topology.h21
-rw-r--r--arch/mips/include/asm/traps.h38
-rw-r--r--arch/mips/include/asm/txx9/boards.h14
-rw-r--r--arch/mips/include/asm/txx9/dmac.h48
-rw-r--r--arch/mips/include/asm/txx9/generic.h98
-rw-r--r--arch/mips/include/asm/txx9/jmr3927.h179
-rw-r--r--arch/mips/include/asm/txx9/pci.h39
-rw-r--r--arch/mips/include/asm/txx9/rbtx4927.h92
-rw-r--r--arch/mips/include/asm/txx9/rbtx4938.h145
-rw-r--r--arch/mips/include/asm/txx9/rbtx4939.h142
-rw-r--r--arch/mips/include/asm/txx9/smsc_fdc37m81x.h68
-rw-r--r--arch/mips/include/asm/txx9/spi.h34
-rw-r--r--arch/mips/include/asm/txx9/tx3927.h341
-rw-r--r--arch/mips/include/asm/txx9/tx4927.h273
-rw-r--r--arch/mips/include/asm/txx9/tx4927pcic.h203
-rw-r--r--arch/mips/include/asm/txx9/tx4938.h312
-rw-r--r--arch/mips/include/asm/txx9/tx4939.h524
-rw-r--r--arch/mips/include/asm/txx9irq.h34
-rw-r--r--arch/mips/include/asm/txx9pio.h29
-rw-r--r--arch/mips/include/asm/txx9tmr.h67
-rw-r--r--arch/mips/include/asm/types.h17
-rw-r--r--arch/mips/include/asm/uaccess.h791
-rw-r--r--arch/mips/include/asm/uasm.h325
-rw-r--r--arch/mips/include/asm/unaligned-emul.h779
-rw-r--r--arch/mips/include/asm/unistd.h62
-rw-r--r--arch/mips/include/asm/unroll.h75
-rw-r--r--arch/mips/include/asm/uprobes.h45
-rw-r--r--arch/mips/include/asm/vdso.h58
-rw-r--r--arch/mips/include/asm/vdso/clocksource.h9
-rw-r--r--arch/mips/include/asm/vdso/gettimeofday.h219
-rw-r--r--arch/mips/include/asm/vdso/processor.h27
-rw-r--r--arch/mips/include/asm/vdso/vdso.h75
-rw-r--r--arch/mips/include/asm/vdso/vsyscall.h27
-rw-r--r--arch/mips/include/asm/vermagic.h72
-rw-r--r--arch/mips/include/asm/vga.h56
-rw-r--r--arch/mips/include/asm/vmalloc.h4
-rw-r--r--arch/mips/include/asm/vpe.h130
-rw-r--r--arch/mips/include/asm/vr41xx/capcella.h30
-rw-r--r--arch/mips/include/asm/vr41xx/giu.h41
-rw-r--r--arch/mips/include/asm/vr41xx/irq.h97
-rw-r--r--arch/mips/include/asm/vr41xx/mpc30x.h24
-rw-r--r--arch/mips/include/asm/vr41xx/pci.h77
-rw-r--r--arch/mips/include/asm/vr41xx/siu.h45
-rw-r--r--arch/mips/include/asm/vr41xx/tb0219.h29
-rw-r--r--arch/mips/include/asm/vr41xx/tb0226.h30
-rw-r--r--arch/mips/include/asm/vr41xx/tb0287.h30
-rw-r--r--arch/mips/include/asm/vr41xx/vr41xx.h148
-rw-r--r--arch/mips/include/asm/war.h73
-rw-r--r--arch/mips/include/asm/watch.h32
-rw-r--r--arch/mips/include/asm/wbflush.h34
-rw-r--r--arch/mips/include/asm/xtalk/xtalk.h52
-rw-r--r--arch/mips/include/asm/xtalk/xwidget.h279
-rw-r--r--arch/mips/include/asm/yamon-dt.h60
-rw-r--r--arch/mips/include/uapi/asm/Kbuild9
-rw-r--r--arch/mips/include/uapi/asm/auxvec.h20
-rw-r--r--arch/mips/include/uapi/asm/bitfield.h30
-rw-r--r--arch/mips/include/uapi/asm/bitsperlong.h9
-rw-r--r--arch/mips/include/uapi/asm/break.h32
-rw-r--r--arch/mips/include/uapi/asm/byteorder.h20
-rw-r--r--arch/mips/include/uapi/asm/cachectl.h27
-rw-r--r--arch/mips/include/uapi/asm/errno.h130
-rw-r--r--arch/mips/include/uapi/asm/fcntl.h80
-rw-r--r--arch/mips/include/uapi/asm/hwcap.h22
-rw-r--r--arch/mips/include/uapi/asm/inst.h1141
-rw-r--r--arch/mips/include/uapi/asm/ioctl.h28
-rw-r--r--arch/mips/include/uapi/asm/ioctls.h119
-rw-r--r--arch/mips/include/uapi/asm/kvm.h227
-rw-r--r--arch/mips/include/uapi/asm/mman.h109
-rw-r--r--arch/mips/include/uapi/asm/msgbuf.h68
-rw-r--r--arch/mips/include/uapi/asm/param.h17
-rw-r--r--arch/mips/include/uapi/asm/poll.h10
-rw-r--r--arch/mips/include/uapi/asm/posix_types.h26
-rw-r--r--arch/mips/include/uapi/asm/ptrace.h109
-rw-r--r--arch/mips/include/uapi/asm/reg.h207
-rw-r--r--arch/mips/include/uapi/asm/resource.h36
-rw-r--r--arch/mips/include/uapi/asm/sembuf.h36
-rw-r--r--arch/mips/include/uapi/asm/setup.h8
-rw-r--r--arch/mips/include/uapi/asm/sgidefs.h37
-rw-r--r--arch/mips/include/uapi/asm/shmbuf.h58
-rw-r--r--arch/mips/include/uapi/asm/sigcontext.h91
-rw-r--r--arch/mips/include/uapi/asm/siginfo.h32
-rw-r--r--arch/mips/include/uapi/asm/signal.h120
-rw-r--r--arch/mips/include/uapi/asm/socket.h162
-rw-r--r--arch/mips/include/uapi/asm/sockios.h27
-rw-r--r--arch/mips/include/uapi/asm/stat.h133
-rw-r--r--arch/mips/include/uapi/asm/statfs.h101
-rw-r--r--arch/mips/include/uapi/asm/swab.h71
-rw-r--r--arch/mips/include/uapi/asm/sysmips.h26
-rw-r--r--arch/mips/include/uapi/asm/termbits.h228
-rw-r--r--arch/mips/include/uapi/asm/termios.h81
-rw-r--r--arch/mips/include/uapi/asm/types.h31
-rw-r--r--arch/mips/include/uapi/asm/ucontext.h66
-rw-r--r--arch/mips/include/uapi/asm/unistd.h39
653 files changed, 128852 insertions, 0 deletions
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
new file mode 100644
index 000000000..95b4fa7bd
--- /dev/null
+++ b/arch/mips/include/asm/Kbuild
@@ -0,0 +1,13 @@
1# SPDX-License-Identifier: GPL-2.0
2# MIPS headers
3generated-y += syscall_table_32_o32.h
4generated-y += syscall_table_64_n32.h
5generated-y += syscall_table_64_n64.h
6generated-y += syscall_table_64_o32.h
7generic-y += export.h
8generic-y += kvm_para.h
9generic-y += mcs_spinlock.h
10generic-y += parport.h
11generic-y += qrwlock.h
12generic-y += qspinlock.h
13generic-y += user.h
diff --git a/arch/mips/include/asm/abi.h b/arch/mips/include/asm/abi.h
new file mode 100644
index 000000000..dba7f4b6b
--- /dev/null
+++ b/arch/mips/include/asm/abi.h
@@ -0,0 +1,32 @@
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, 06 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2005 MIPS Technologies, Inc.
8 */
9#ifndef _ASM_ABI_H
10#define _ASM_ABI_H
11
12#include <linux/signal_types.h>
13
14#include <asm/signal.h>
15#include <asm/siginfo.h>
16#include <asm/vdso.h>
17
18struct mips_abi {
19 int (* const setup_frame)(void *sig_return, struct ksignal *ksig,
20 struct pt_regs *regs, sigset_t *set);
21 int (* const setup_rt_frame)(void *sig_return, struct ksignal *ksig,
22 struct pt_regs *regs, sigset_t *set);
23 const unsigned long restart;
24
25 unsigned off_sc_fpregs;
26 unsigned off_sc_fpc_csr;
27 unsigned off_sc_used_math;
28
29 struct mips_vdso_image *vdso;
30};
31
32#endif /* _ASM_ABI_H */
diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
new file mode 100644
index 000000000..59a48c60a
--- /dev/null
+++ b/arch/mips/include/asm/addrspace.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, 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 <spaces.h>
14
15/*
16 * Configure language
17 */
18#ifdef __ASSEMBLY__
19#define _ATYPE_
20#define _ATYPE32_
21#define _ATYPE64_
22#define _CONST64_(x) x
23#else
24#define _ATYPE_ __PTRDIFF_TYPE__
25#define _ATYPE32_ int
26#define _ATYPE64_ __s64
27#ifdef CONFIG_64BIT
28#define _CONST64_(x) x ## L
29#else
30#define _CONST64_(x) x ## LL
31#endif
32#endif
33
34/*
35 * 32-bit MIPS address spaces
36 */
37#ifdef __ASSEMBLY__
38#define _ACAST32_
39#define _ACAST64_
40#else
41#define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */
42#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */
43#endif
44
45/*
46 * Returns the kernel segment base of a given address
47 */
48#define KSEGX(a) ((_ACAST32_(a)) & _ACAST32_(0xe0000000))
49
50/*
51 * Returns the physical address of a CKSEGx / XKPHYS address
52 */
53#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
54#define XPHYSADDR(a) ((_ACAST64_(a)) & \
55 _CONST64_(0x0000ffffffffffff))
56
57#ifdef CONFIG_64BIT
58
59/*
60 * Memory segments (64bit kernel mode addresses)
61 * The compatibility segments use the full 64-bit sign extended value. Note
62 * the R8000 doesn't have them so don't reference these in generic MIPS code.
63 */
64#define XKUSEG _CONST64_(0x0000000000000000)
65#define XKSSEG _CONST64_(0x4000000000000000)
66#define XKPHYS _CONST64_(0x8000000000000000)
67#define XKSEG _CONST64_(0xc000000000000000)
68#define CKSEG0 _CONST64_(0xffffffff80000000)
69#define CKSEG1 _CONST64_(0xffffffffa0000000)
70#define CKSSEG _CONST64_(0xffffffffc0000000)
71#define CKSEG3 _CONST64_(0xffffffffe0000000)
72
73#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
74#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1)
75#define CKSEG2ADDR(a) (CPHYSADDR(a) | CKSEG2)
76#define CKSEG3ADDR(a) (CPHYSADDR(a) | CKSEG3)
77
78#else
79
80#define CKSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
81#define CKSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
82#define CKSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
83#define CKSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
84
85/*
86 * Map an address to a certain kernel segment
87 */
88#define KSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
89#define KSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
90#define KSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
91#define KSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
92
93/*
94 * Memory segments (32bit kernel mode addresses)
95 * These are the traditional names used in the 32-bit universe.
96 */
97#define KUSEG 0x00000000
98#define KSEG0 0x80000000
99#define KSEG1 0xa0000000
100#define KSEG2 0xc0000000
101#define KSEG3 0xe0000000
102
103#define CKUSEG 0x00000000
104#define CKSEG0 0x80000000
105#define CKSEG1 0xa0000000
106#define CKSEG2 0xc0000000
107#define CKSEG3 0xe0000000
108
109#endif
110
111/*
112 * Cache modes for XKPHYS address conversion macros
113 */
114#define K_CALG_COH_EXCL1_NOL2 0
115#define K_CALG_COH_SHRL1_NOL2 1
116#define K_CALG_UNCACHED 2
117#define K_CALG_NONCOHERENT 3
118#define K_CALG_COH_EXCL 4
119#define K_CALG_COH_SHAREABLE 5
120#define K_CALG_NOTUSED 6
121#define K_CALG_UNCACHED_ACCEL 7
122
123/*
124 * 64-bit address conversions
125 */
126#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p))
127#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p))
128#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
129#define PHYS_TO_XKPHYS(cm, a) (XKPHYS | (_ACAST64_(cm) << 59) | (a))
130
131/*
132 * The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting
133 * the region, 3 bits for the CCA mode. This leaves 59 bits of which the
134 * R8000 implements most with its 48-bit physical address space.
135 */
136#define TO_PHYS_MASK _CONST64_(0x07ffffffffffffff) /* 2^^59 - 1 */
137
138#define COMPAT_K1BASE32 _CONST64_(0xffffffffa0000000)
139#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
140
141#define KDM_TO_PHYS(x) (_ACAST64_ (x) & TO_PHYS_MASK)
142#define PHYS_TO_K0(x) (_ACAST64_ (x) | CAC_BASE)
143
144#endif /* _ASM_ADDRSPACE_H */
diff --git a/arch/mips/include/asm/amon.h b/arch/mips/include/asm/amon.h
new file mode 100644
index 000000000..3cc03c64a
--- /dev/null
+++ b/arch/mips/include/asm/amon.h
@@ -0,0 +1,12 @@
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) 2013 Imagination Technologies Ltd.
7 *
8 * Arbitrary Monitor Support (AMON)
9 */
10int amon_cpu_avail(int cpu);
11int amon_cpu_start(int cpu, unsigned long pc, unsigned long sp,
12 unsigned long gp, unsigned long a0);
diff --git a/arch/mips/include/asm/arch_hweight.h b/arch/mips/include/asm/arch_hweight.h
new file mode 100644
index 000000000..712a7445e
--- /dev/null
+++ b/arch/mips/include/asm/arch_hweight.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 */
7#ifndef _ASM_ARCH_HWEIGHT_H
8#define _ASM_ARCH_HWEIGHT_H
9
10#ifdef ARCH_HAS_USABLE_BUILTIN_POPCOUNT
11
12#include <asm/types.h>
13
14static inline unsigned int __arch_hweight32(unsigned int w)
15{
16 return __builtin_popcount(w);
17}
18
19static inline unsigned int __arch_hweight16(unsigned int w)
20{
21 return __builtin_popcount(w & 0xffff);
22}
23
24static inline unsigned int __arch_hweight8(unsigned int w)
25{
26 return __builtin_popcount(w & 0xff);
27}
28
29static inline unsigned long __arch_hweight64(__u64 w)
30{
31 return __builtin_popcountll(w);
32}
33
34#else
35#include <asm-generic/bitops/arch_hweight.h>
36#endif
37
38#endif /* _ASM_ARCH_HWEIGHT_H */
diff --git a/arch/mips/include/asm/asm-eva.h b/arch/mips/include/asm/asm-eva.h
new file mode 100644
index 000000000..e327ebc76
--- /dev/null
+++ b/arch/mips/include/asm/asm-eva.h
@@ -0,0 +1,190 @@
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) 2014 Imagination Technologies Ltd.
7 *
8 */
9
10#ifndef __ASM_ASM_EVA_H
11#define __ASM_ASM_EVA_H
12
13#ifndef __ASSEMBLY__
14
15/* Kernel variants */
16
17#define kernel_cache(op, base) "cache " op ", " base "\n"
18#define kernel_pref(hint, base) "pref " hint ", " base "\n"
19#define kernel_ll(reg, addr) "ll " reg ", " addr "\n"
20#define kernel_sc(reg, addr) "sc " reg ", " addr "\n"
21#define kernel_lw(reg, addr) "lw " reg ", " addr "\n"
22#define kernel_lwl(reg, addr) "lwl " reg ", " addr "\n"
23#define kernel_lwr(reg, addr) "lwr " reg ", " addr "\n"
24#define kernel_lh(reg, addr) "lh " reg ", " addr "\n"
25#define kernel_lb(reg, addr) "lb " reg ", " addr "\n"
26#define kernel_lbu(reg, addr) "lbu " reg ", " addr "\n"
27#define kernel_sw(reg, addr) "sw " reg ", " addr "\n"
28#define kernel_swl(reg, addr) "swl " reg ", " addr "\n"
29#define kernel_swr(reg, addr) "swr " reg ", " addr "\n"
30#define kernel_sh(reg, addr) "sh " reg ", " addr "\n"
31#define kernel_sb(reg, addr) "sb " reg ", " addr "\n"
32
33#ifdef CONFIG_32BIT
34/*
35 * No 'sd' or 'ld' instructions in 32-bit but the code will
36 * do the correct thing
37 */
38#define kernel_sd(reg, addr) user_sw(reg, addr)
39#define kernel_ld(reg, addr) user_lw(reg, addr)
40#else
41#define kernel_sd(reg, addr) "sd " reg", " addr "\n"
42#define kernel_ld(reg, addr) "ld " reg", " addr "\n"
43#endif /* CONFIG_32BIT */
44
45#ifdef CONFIG_EVA
46
47#define __BUILD_EVA_INSN(insn, reg, addr) \
48 " .set push\n" \
49 " .set mips0\n" \
50 " .set eva\n" \
51 " "insn" "reg", "addr "\n" \
52 " .set pop\n"
53
54#define user_cache(op, base) __BUILD_EVA_INSN("cachee", op, base)
55#define user_pref(hint, base) __BUILD_EVA_INSN("prefe", hint, base)
56#define user_ll(reg, addr) __BUILD_EVA_INSN("lle", reg, addr)
57#define user_sc(reg, addr) __BUILD_EVA_INSN("sce", reg, addr)
58#define user_lw(reg, addr) __BUILD_EVA_INSN("lwe", reg, addr)
59#define user_lwl(reg, addr) __BUILD_EVA_INSN("lwle", reg, addr)
60#define user_lwr(reg, addr) __BUILD_EVA_INSN("lwre", reg, addr)
61#define user_lh(reg, addr) __BUILD_EVA_INSN("lhe", reg, addr)
62#define user_lb(reg, addr) __BUILD_EVA_INSN("lbe", reg, addr)
63#define user_lbu(reg, addr) __BUILD_EVA_INSN("lbue", reg, addr)
64/* No 64-bit EVA instruction for loading double words */
65#define user_ld(reg, addr) user_lw(reg, addr)
66#define user_sw(reg, addr) __BUILD_EVA_INSN("swe", reg, addr)
67#define user_swl(reg, addr) __BUILD_EVA_INSN("swle", reg, addr)
68#define user_swr(reg, addr) __BUILD_EVA_INSN("swre", reg, addr)
69#define user_sh(reg, addr) __BUILD_EVA_INSN("she", reg, addr)
70#define user_sb(reg, addr) __BUILD_EVA_INSN("sbe", reg, addr)
71/* No 64-bit EVA instruction for storing double words */
72#define user_sd(reg, addr) user_sw(reg, addr)
73
74#else
75
76#define user_cache(op, base) kernel_cache(op, base)
77#define user_pref(hint, base) kernel_pref(hint, base)
78#define user_ll(reg, addr) kernel_ll(reg, addr)
79#define user_sc(reg, addr) kernel_sc(reg, addr)
80#define user_lw(reg, addr) kernel_lw(reg, addr)
81#define user_lwl(reg, addr) kernel_lwl(reg, addr)
82#define user_lwr(reg, addr) kernel_lwr(reg, addr)
83#define user_lh(reg, addr) kernel_lh(reg, addr)
84#define user_lb(reg, addr) kernel_lb(reg, addr)
85#define user_lbu(reg, addr) kernel_lbu(reg, addr)
86#define user_sw(reg, addr) kernel_sw(reg, addr)
87#define user_swl(reg, addr) kernel_swl(reg, addr)
88#define user_swr(reg, addr) kernel_swr(reg, addr)
89#define user_sh(reg, addr) kernel_sh(reg, addr)
90#define user_sb(reg, addr) kernel_sb(reg, addr)
91
92#ifdef CONFIG_32BIT
93#define user_sd(reg, addr) kernel_sw(reg, addr)
94#define user_ld(reg, addr) kernel_lw(reg, addr)
95#else
96#define user_sd(reg, addr) kernel_sd(reg, addr)
97#define user_ld(reg, addr) kernel_ld(reg, addr)
98#endif /* CONFIG_32BIT */
99
100#endif /* CONFIG_EVA */
101
102#else /* __ASSEMBLY__ */
103
104#define kernel_cache(op, base) cache op, base
105#define kernel_pref(hint, base) pref hint, base
106#define kernel_ll(reg, addr) ll reg, addr
107#define kernel_sc(reg, addr) sc reg, addr
108#define kernel_lw(reg, addr) lw reg, addr
109#define kernel_lwl(reg, addr) lwl reg, addr
110#define kernel_lwr(reg, addr) lwr reg, addr
111#define kernel_lh(reg, addr) lh reg, addr
112#define kernel_lb(reg, addr) lb reg, addr
113#define kernel_lbu(reg, addr) lbu reg, addr
114#define kernel_sw(reg, addr) sw reg, addr
115#define kernel_swl(reg, addr) swl reg, addr
116#define kernel_swr(reg, addr) swr reg, addr
117#define kernel_sh(reg, addr) sh reg, addr
118#define kernel_sb(reg, addr) sb reg, addr
119
120#ifdef CONFIG_32BIT
121/*
122 * No 'sd' or 'ld' instructions in 32-bit but the code will
123 * do the correct thing
124 */
125#define kernel_sd(reg, addr) user_sw(reg, addr)
126#define kernel_ld(reg, addr) user_lw(reg, addr)
127#else
128#define kernel_sd(reg, addr) sd reg, addr
129#define kernel_ld(reg, addr) ld reg, addr
130#endif /* CONFIG_32BIT */
131
132#ifdef CONFIG_EVA
133
134#define __BUILD_EVA_INSN(insn, reg, addr) \
135 .set push; \
136 .set mips0; \
137 .set eva; \
138 insn reg, addr; \
139 .set pop;
140
141#define user_cache(op, base) __BUILD_EVA_INSN(cachee, op, base)
142#define user_pref(hint, base) __BUILD_EVA_INSN(prefe, hint, base)
143#define user_ll(reg, addr) __BUILD_EVA_INSN(lle, reg, addr)
144#define user_sc(reg, addr) __BUILD_EVA_INSN(sce, reg, addr)
145#define user_lw(reg, addr) __BUILD_EVA_INSN(lwe, reg, addr)
146#define user_lwl(reg, addr) __BUILD_EVA_INSN(lwle, reg, addr)
147#define user_lwr(reg, addr) __BUILD_EVA_INSN(lwre, reg, addr)
148#define user_lh(reg, addr) __BUILD_EVA_INSN(lhe, reg, addr)
149#define user_lb(reg, addr) __BUILD_EVA_INSN(lbe, reg, addr)
150#define user_lbu(reg, addr) __BUILD_EVA_INSN(lbue, reg, addr)
151/* No 64-bit EVA instruction for loading double words */
152#define user_ld(reg, addr) user_lw(reg, addr)
153#define user_sw(reg, addr) __BUILD_EVA_INSN(swe, reg, addr)
154#define user_swl(reg, addr) __BUILD_EVA_INSN(swle, reg, addr)
155#define user_swr(reg, addr) __BUILD_EVA_INSN(swre, reg, addr)
156#define user_sh(reg, addr) __BUILD_EVA_INSN(she, reg, addr)
157#define user_sb(reg, addr) __BUILD_EVA_INSN(sbe, reg, addr)
158/* No 64-bit EVA instruction for loading double words */
159#define user_sd(reg, addr) user_sw(reg, addr)
160#else
161
162#define user_cache(op, base) kernel_cache(op, base)
163#define user_pref(hint, base) kernel_pref(hint, base)
164#define user_ll(reg, addr) kernel_ll(reg, addr)
165#define user_sc(reg, addr) kernel_sc(reg, addr)
166#define user_lw(reg, addr) kernel_lw(reg, addr)
167#define user_lwl(reg, addr) kernel_lwl(reg, addr)
168#define user_lwr(reg, addr) kernel_lwr(reg, addr)
169#define user_lh(reg, addr) kernel_lh(reg, addr)
170#define user_lb(reg, addr) kernel_lb(reg, addr)
171#define user_lbu(reg, addr) kernel_lbu(reg, addr)
172#define user_sw(reg, addr) kernel_sw(reg, addr)
173#define user_swl(reg, addr) kernel_swl(reg, addr)
174#define user_swr(reg, addr) kernel_swr(reg, addr)
175#define user_sh(reg, addr) kernel_sh(reg, addr)
176#define user_sb(reg, addr) kernel_sb(reg, addr)
177
178#ifdef CONFIG_32BIT
179#define user_sd(reg, addr) kernel_sw(reg, addr)
180#define user_ld(reg, addr) kernel_lw(reg, addr)
181#else
182#define user_sd(reg, addr) kernel_sd(reg, addr)
183#define user_ld(reg, addr) kernel_ld(reg, addr)
184#endif /* CONFIG_32BIT */
185
186#endif /* CONFIG_EVA */
187
188#endif /* __ASSEMBLY__ */
189
190#endif /* __ASM_ASM_EVA_H */
diff --git a/arch/mips/include/asm/asm-offsets.h b/arch/mips/include/asm/asm-offsets.h
new file mode 100644
index 000000000..d370ee36a
--- /dev/null
+++ b/arch/mips/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/mips/include/asm/asm-prototypes.h b/arch/mips/include/asm/asm-prototypes.h
new file mode 100644
index 000000000..f901ed043
--- /dev/null
+++ b/arch/mips/include/asm/asm-prototypes.h
@@ -0,0 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#include <asm/checksum.h>
3#include <asm/page.h>
4#include <asm/fpu.h>
5#include <asm-generic/asm-prototypes.h>
6#include <linux/uaccess.h>
7#include <asm/ftrace.h>
8#include <asm/mmu_context.h>
diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
new file mode 100644
index 000000000..ea4b62ece
--- /dev/null
+++ b/arch/mips/include/asm/asm.h
@@ -0,0 +1,331 @@
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 <asm/sgidefs.h>
21#include <asm/asm-eva.h>
22
23#ifndef __VDSO__
24/*
25 * Emit CFI data in .debug_frame sections, not .eh_frame sections.
26 * We don't do DWARF unwinding at runtime, so only the offline DWARF
27 * information is useful to anyone. Note we should change this if we
28 * ever decide to enable DWARF unwinding at runtime.
29 */
30#define CFI_SECTIONS .cfi_sections .debug_frame
31#else
32 /*
33 * For the vDSO, emit both runtime unwind information and debug
34 * symbols for the .dbg file.
35 */
36#define CFI_SECTIONS
37#endif
38
39/*
40 * LEAF - declare leaf routine
41 */
42#define LEAF(symbol) \
43 CFI_SECTIONS; \
44 .globl symbol; \
45 .align 2; \
46 .type symbol, @function; \
47 .ent symbol, 0; \
48symbol: .frame sp, 0, ra; \
49 .cfi_startproc; \
50 .insn
51
52/*
53 * NESTED - declare nested routine entry point
54 */
55#define NESTED(symbol, framesize, rpc) \
56 CFI_SECTIONS; \
57 .globl symbol; \
58 .align 2; \
59 .type symbol, @function; \
60 .ent symbol, 0; \
61symbol: .frame sp, framesize, rpc; \
62 .cfi_startproc; \
63 .insn
64
65/*
66 * END - mark end of function
67 */
68#define END(function) \
69 .cfi_endproc; \
70 .end function; \
71 .size function, .-function
72
73/*
74 * EXPORT - export definition of symbol
75 */
76#define EXPORT(symbol) \
77 .globl symbol; \
78symbol:
79
80/*
81 * FEXPORT - export definition of a function symbol
82 */
83#define FEXPORT(symbol) \
84 .globl symbol; \
85 .type symbol, @function; \
86symbol: .insn
87
88/*
89 * ABS - export absolute symbol
90 */
91#define ABS(symbol,value) \
92 .globl symbol; \
93symbol = value
94
95#define TEXT(msg) \
96 .pushsection .data; \
978: .asciiz msg; \
98 .popsection;
99
100#define ASM_PANIC(msg) \
101 .set push; \
102 .set reorder; \
103 PTR_LA a0, 8f; \
104 jal panic; \
1059: b 9b; \
106 .set pop; \
107 TEXT(msg)
108
109/*
110 * Print formatted string
111 */
112#ifdef CONFIG_PRINTK
113#define ASM_PRINT(string) \
114 .set push; \
115 .set reorder; \
116 PTR_LA a0, 8f; \
117 jal printk; \
118 .set pop; \
119 TEXT(string)
120#else
121#define ASM_PRINT(string)
122#endif
123
124/*
125 * Stack alignment
126 */
127#if (_MIPS_SIM == _MIPS_SIM_ABI32)
128#define ALSZ 7
129#define ALMASK ~7
130#endif
131#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
132#define ALSZ 15
133#define ALMASK ~15
134#endif
135
136/*
137 * Macros to handle different pointer/register sizes for 32/64-bit code
138 */
139
140/*
141 * Size of a register
142 */
143#ifdef __mips64
144#define SZREG 8
145#else
146#define SZREG 4
147#endif
148
149/*
150 * Use the following macros in assemblercode to load/store registers,
151 * pointers etc.
152 */
153#if (_MIPS_SIM == _MIPS_SIM_ABI32)
154#define REG_S sw
155#define REG_L lw
156#define REG_SUBU subu
157#define REG_ADDU addu
158#endif
159#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
160#define REG_S sd
161#define REG_L ld
162#define REG_SUBU dsubu
163#define REG_ADDU daddu
164#endif
165
166/*
167 * How to add/sub/load/store/shift C int variables.
168 */
169#if (_MIPS_SZINT == 32)
170#define INT_ADD add
171#define INT_ADDU addu
172#define INT_ADDI addi
173#define INT_ADDIU addiu
174#define INT_SUB sub
175#define INT_SUBU subu
176#define INT_L lw
177#define INT_S sw
178#define INT_SLL sll
179#define INT_SLLV sllv
180#define INT_SRL srl
181#define INT_SRLV srlv
182#define INT_SRA sra
183#define INT_SRAV srav
184#endif
185
186#if (_MIPS_SZINT == 64)
187#define INT_ADD dadd
188#define INT_ADDU daddu
189#define INT_ADDI daddi
190#define INT_ADDIU daddiu
191#define INT_SUB dsub
192#define INT_SUBU dsubu
193#define INT_L ld
194#define INT_S sd
195#define INT_SLL dsll
196#define INT_SLLV dsllv
197#define INT_SRL dsrl
198#define INT_SRLV dsrlv
199#define INT_SRA dsra
200#define INT_SRAV dsrav
201#endif
202
203/*
204 * How to add/sub/load/store/shift C long variables.
205 */
206#if (_MIPS_SZLONG == 32)
207#define LONG_ADD add
208#define LONG_ADDU addu
209#define LONG_ADDI addi
210#define LONG_ADDIU addiu
211#define LONG_SUB sub
212#define LONG_SUBU subu
213#define LONG_L lw
214#define LONG_S sw
215#define LONG_SP swp
216#define LONG_SLL sll
217#define LONG_SLLV sllv
218#define LONG_SRL srl
219#define LONG_SRLV srlv
220#define LONG_SRA sra
221#define LONG_SRAV srav
222
223#ifdef __ASSEMBLY__
224#define LONG .word
225#endif
226#define LONGSIZE 4
227#define LONGMASK 3
228#define LONGLOG 2
229#endif
230
231#if (_MIPS_SZLONG == 64)
232#define LONG_ADD dadd
233#define LONG_ADDU daddu
234#define LONG_ADDI daddi
235#define LONG_ADDIU daddiu
236#define LONG_SUB dsub
237#define LONG_SUBU dsubu
238#define LONG_L ld
239#define LONG_S sd
240#define LONG_SP sdp
241#define LONG_SLL dsll
242#define LONG_SLLV dsllv
243#define LONG_SRL dsrl
244#define LONG_SRLV dsrlv
245#define LONG_SRA dsra
246#define LONG_SRAV dsrav
247
248#ifdef __ASSEMBLY__
249#define LONG .dword
250#endif
251#define LONGSIZE 8
252#define LONGMASK 7
253#define LONGLOG 3
254#endif
255
256/*
257 * How to add/sub/load/store/shift pointers.
258 */
259#if (_MIPS_SZPTR == 32)
260#define PTR_ADD add
261#define PTR_ADDU addu
262#define PTR_ADDI addi
263#define PTR_ADDIU addiu
264#define PTR_SUB sub
265#define PTR_SUBU subu
266#define PTR_L lw
267#define PTR_S sw
268#define PTR_LA la
269#define PTR_LI li
270#define PTR_SLL sll
271#define PTR_SLLV sllv
272#define PTR_SRL srl
273#define PTR_SRLV srlv
274#define PTR_SRA sra
275#define PTR_SRAV srav
276
277#define PTR_SCALESHIFT 2
278
279#define PTR .word
280#define PTRSIZE 4
281#define PTRLOG 2
282#endif
283
284#if (_MIPS_SZPTR == 64)
285#define PTR_ADD dadd
286#define PTR_ADDU daddu
287#define PTR_ADDI daddi
288#define PTR_ADDIU daddiu
289#define PTR_SUB dsub
290#define PTR_SUBU dsubu
291#define PTR_L ld
292#define PTR_S sd
293#define PTR_LA dla
294#define PTR_LI dli
295#define PTR_SLL dsll
296#define PTR_SLLV dsllv
297#define PTR_SRL dsrl
298#define PTR_SRLV dsrlv
299#define PTR_SRA dsra
300#define PTR_SRAV dsrav
301
302#define PTR_SCALESHIFT 3
303
304#define PTR .dword
305#define PTRSIZE 8
306#define PTRLOG 3
307#endif
308
309/*
310 * Some cp0 registers were extended to 64bit for MIPS III.
311 */
312#if (_MIPS_SIM == _MIPS_SIM_ABI32)
313#define MFC0 mfc0
314#define MTC0 mtc0
315#endif
316#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
317#define MFC0 dmfc0
318#define MTC0 dmtc0
319#endif
320
321#define SSNOP sll zero, zero, 1
322
323#ifdef CONFIG_SGI_IP28
324/* Inhibit speculative stores to volatile (e.g.DMA) or invalid addresses. */
325#include <asm/cacheops.h>
326#define R10KCBARRIER(addr) cache Cache_Barrier, addr;
327#else
328#define R10KCBARRIER(addr)
329#endif
330
331#endif /* __ASM_ASM_H */
diff --git a/arch/mips/include/asm/asmmacro-32.h b/arch/mips/include/asm/asmmacro-32.h
new file mode 100644
index 000000000..1c08c1f79
--- /dev/null
+++ b/arch/mips/include/asm/asmmacro-32.h
@@ -0,0 +1,91 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * asmmacro.h: Assembler macros to make things easier to read.
4 *
5 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
6 * Copyright (C) 1998, 1999, 2003 Ralf Baechle
7 */
8#ifndef _ASM_ASMMACRO_32_H
9#define _ASM_ASMMACRO_32_H
10
11#include <asm/asm-offsets.h>
12#include <asm/regdef.h>
13#include <asm/fpregdef.h>
14#include <asm/mipsregs.h>
15
16 .macro fpu_save_single thread tmp=t0
17 .set push
18 SET_HARDFLOAT
19 cfc1 \tmp, fcr31
20 s.d $f0, THREAD_FPR0(\thread)
21 s.d $f2, THREAD_FPR2(\thread)
22 s.d $f4, THREAD_FPR4(\thread)
23 s.d $f6, THREAD_FPR6(\thread)
24 s.d $f8, THREAD_FPR8(\thread)
25 s.d $f10, THREAD_FPR10(\thread)
26 s.d $f12, THREAD_FPR12(\thread)
27 s.d $f14, THREAD_FPR14(\thread)
28 s.d $f16, THREAD_FPR16(\thread)
29 s.d $f18, THREAD_FPR18(\thread)
30 s.d $f20, THREAD_FPR20(\thread)
31 s.d $f22, THREAD_FPR22(\thread)
32 s.d $f24, THREAD_FPR24(\thread)
33 s.d $f26, THREAD_FPR26(\thread)
34 s.d $f28, THREAD_FPR28(\thread)
35 s.d $f30, THREAD_FPR30(\thread)
36 sw \tmp, THREAD_FCR31(\thread)
37 .set pop
38 .endm
39
40 .macro fpu_restore_single thread tmp=t0
41 .set push
42 SET_HARDFLOAT
43 lw \tmp, THREAD_FCR31(\thread)
44 l.d $f0, THREAD_FPR0(\thread)
45 l.d $f2, THREAD_FPR2(\thread)
46 l.d $f4, THREAD_FPR4(\thread)
47 l.d $f6, THREAD_FPR6(\thread)
48 l.d $f8, THREAD_FPR8(\thread)
49 l.d $f10, THREAD_FPR10(\thread)
50 l.d $f12, THREAD_FPR12(\thread)
51 l.d $f14, THREAD_FPR14(\thread)
52 l.d $f16, THREAD_FPR16(\thread)
53 l.d $f18, THREAD_FPR18(\thread)
54 l.d $f20, THREAD_FPR20(\thread)
55 l.d $f22, THREAD_FPR22(\thread)
56 l.d $f24, THREAD_FPR24(\thread)
57 l.d $f26, THREAD_FPR26(\thread)
58 l.d $f28, THREAD_FPR28(\thread)
59 l.d $f30, THREAD_FPR30(\thread)
60 ctc1 \tmp, fcr31
61 .set pop
62 .endm
63
64 .macro cpu_save_nonscratch thread
65 LONG_S s0, THREAD_REG16(\thread)
66 LONG_S s1, THREAD_REG17(\thread)
67 LONG_S s2, THREAD_REG18(\thread)
68 LONG_S s3, THREAD_REG19(\thread)
69 LONG_S s4, THREAD_REG20(\thread)
70 LONG_S s5, THREAD_REG21(\thread)
71 LONG_S s6, THREAD_REG22(\thread)
72 LONG_S s7, THREAD_REG23(\thread)
73 LONG_S sp, THREAD_REG29(\thread)
74 LONG_S fp, THREAD_REG30(\thread)
75 .endm
76
77 .macro cpu_restore_nonscratch thread
78 LONG_L s0, THREAD_REG16(\thread)
79 LONG_L s1, THREAD_REG17(\thread)
80 LONG_L s2, THREAD_REG18(\thread)
81 LONG_L s3, THREAD_REG19(\thread)
82 LONG_L s4, THREAD_REG20(\thread)
83 LONG_L s5, THREAD_REG21(\thread)
84 LONG_L s6, THREAD_REG22(\thread)
85 LONG_L s7, THREAD_REG23(\thread)
86 LONG_L sp, THREAD_REG29(\thread)
87 LONG_L fp, THREAD_REG30(\thread)
88 LONG_L ra, THREAD_REG31(\thread)
89 .endm
90
91#endif /* _ASM_ASMMACRO_32_H */
diff --git a/arch/mips/include/asm/asmmacro-64.h b/arch/mips/include/asm/asmmacro-64.h
new file mode 100644
index 000000000..68039dee5
--- /dev/null
+++ b/arch/mips/include/asm/asmmacro-64.h
@@ -0,0 +1,44 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * asmmacro.h: Assembler macros to make things easier to read.
4 *
5 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
6 * Copyright (C) 1998, 1999 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_ASMMACRO_64_H
10#define _ASM_ASMMACRO_64_H
11
12#include <asm/asm-offsets.h>
13#include <asm/regdef.h>
14#include <asm/fpregdef.h>
15#include <asm/mipsregs.h>
16
17 .macro cpu_save_nonscratch thread
18 LONG_S s0, THREAD_REG16(\thread)
19 LONG_S s1, THREAD_REG17(\thread)
20 LONG_S s2, THREAD_REG18(\thread)
21 LONG_S s3, THREAD_REG19(\thread)
22 LONG_S s4, THREAD_REG20(\thread)
23 LONG_S s5, THREAD_REG21(\thread)
24 LONG_S s6, THREAD_REG22(\thread)
25 LONG_S s7, THREAD_REG23(\thread)
26 LONG_S sp, THREAD_REG29(\thread)
27 LONG_S fp, THREAD_REG30(\thread)
28 .endm
29
30 .macro cpu_restore_nonscratch thread
31 LONG_L s0, THREAD_REG16(\thread)
32 LONG_L s1, THREAD_REG17(\thread)
33 LONG_L s2, THREAD_REG18(\thread)
34 LONG_L s3, THREAD_REG19(\thread)
35 LONG_L s4, THREAD_REG20(\thread)
36 LONG_L s5, THREAD_REG21(\thread)
37 LONG_L s6, THREAD_REG22(\thread)
38 LONG_L s7, THREAD_REG23(\thread)
39 LONG_L sp, THREAD_REG29(\thread)
40 LONG_L fp, THREAD_REG30(\thread)
41 LONG_L ra, THREAD_REG31(\thread)
42 .endm
43
44#endif /* _ASM_ASMMACRO_64_H */
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
new file mode 100644
index 000000000..ca83ada70
--- /dev/null
+++ b/arch/mips/include/asm/asmmacro.h
@@ -0,0 +1,658 @@
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 <asm/hazards.h>
12#include <asm/asm-offsets.h>
13#include <asm/msa.h>
14
15#ifdef CONFIG_32BIT
16#include <asm/asmmacro-32.h>
17#endif
18#ifdef CONFIG_64BIT
19#include <asm/asmmacro-64.h>
20#endif
21
22/* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */
23#undef fp
24
25/*
26 * Helper macros for generating raw instruction encodings.
27 */
28#ifdef CONFIG_CPU_MICROMIPS
29 .macro insn32_if_mm enc
30 .insn
31 .hword ((\enc) >> 16)
32 .hword ((\enc) & 0xffff)
33 .endm
34
35 .macro insn_if_mips enc
36 .endm
37#else
38 .macro insn32_if_mm enc
39 .endm
40
41 .macro insn_if_mips enc
42 .insn
43 .word (\enc)
44 .endm
45#endif
46
47#ifdef CONFIG_CPU_HAS_DIEI
48 .macro local_irq_enable reg=t0
49 ei
50 irq_enable_hazard
51 .endm
52
53 .macro local_irq_disable reg=t0
54 di
55 irq_disable_hazard
56 .endm
57#else /* !CONFIG_CPU_MIPSR2 && !CONFIG_CPU_MIPSR5 && !CONFIG_CPU_MIPSR6 */
58 .macro local_irq_enable reg=t0
59 mfc0 \reg, CP0_STATUS
60 ori \reg, \reg, 1
61 mtc0 \reg, CP0_STATUS
62 irq_enable_hazard
63 .endm
64
65 .macro local_irq_disable reg=t0
66#ifdef CONFIG_PREEMPTION
67 lw \reg, TI_PRE_COUNT($28)
68 addi \reg, \reg, 1
69 sw \reg, TI_PRE_COUNT($28)
70#endif
71 mfc0 \reg, CP0_STATUS
72 ori \reg, \reg, 1
73 xori \reg, \reg, 1
74 mtc0 \reg, CP0_STATUS
75 irq_disable_hazard
76#ifdef CONFIG_PREEMPTION
77 lw \reg, TI_PRE_COUNT($28)
78 addi \reg, \reg, -1
79 sw \reg, TI_PRE_COUNT($28)
80#endif
81 .endm
82#endif /* !CONFIG_CPU_MIPSR2 && !CONFIG_CPU_MIPSR5 && !CONFIG_CPU_MIPSR6 */
83
84 .macro fpu_save_16even thread tmp=t0
85 .set push
86 SET_HARDFLOAT
87 cfc1 \tmp, fcr31
88 sdc1 $f0, THREAD_FPR0(\thread)
89 sdc1 $f2, THREAD_FPR2(\thread)
90 sdc1 $f4, THREAD_FPR4(\thread)
91 sdc1 $f6, THREAD_FPR6(\thread)
92 sdc1 $f8, THREAD_FPR8(\thread)
93 sdc1 $f10, THREAD_FPR10(\thread)
94 sdc1 $f12, THREAD_FPR12(\thread)
95 sdc1 $f14, THREAD_FPR14(\thread)
96 sdc1 $f16, THREAD_FPR16(\thread)
97 sdc1 $f18, THREAD_FPR18(\thread)
98 sdc1 $f20, THREAD_FPR20(\thread)
99 sdc1 $f22, THREAD_FPR22(\thread)
100 sdc1 $f24, THREAD_FPR24(\thread)
101 sdc1 $f26, THREAD_FPR26(\thread)
102 sdc1 $f28, THREAD_FPR28(\thread)
103 sdc1 $f30, THREAD_FPR30(\thread)
104 sw \tmp, THREAD_FCR31(\thread)
105 .set pop
106 .endm
107
108 .macro fpu_save_16odd thread
109 .set push
110 .set mips64r2
111 .set fp=64
112 SET_HARDFLOAT
113 sdc1 $f1, THREAD_FPR1(\thread)
114 sdc1 $f3, THREAD_FPR3(\thread)
115 sdc1 $f5, THREAD_FPR5(\thread)
116 sdc1 $f7, THREAD_FPR7(\thread)
117 sdc1 $f9, THREAD_FPR9(\thread)
118 sdc1 $f11, THREAD_FPR11(\thread)
119 sdc1 $f13, THREAD_FPR13(\thread)
120 sdc1 $f15, THREAD_FPR15(\thread)
121 sdc1 $f17, THREAD_FPR17(\thread)
122 sdc1 $f19, THREAD_FPR19(\thread)
123 sdc1 $f21, THREAD_FPR21(\thread)
124 sdc1 $f23, THREAD_FPR23(\thread)
125 sdc1 $f25, THREAD_FPR25(\thread)
126 sdc1 $f27, THREAD_FPR27(\thread)
127 sdc1 $f29, THREAD_FPR29(\thread)
128 sdc1 $f31, THREAD_FPR31(\thread)
129 .set pop
130 .endm
131
132 .macro fpu_save_double thread status tmp
133#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
134 defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
135 sll \tmp, \status, 5
136 bgez \tmp, 10f
137 fpu_save_16odd \thread
13810:
139#endif
140 fpu_save_16even \thread \tmp
141 .endm
142
143 .macro fpu_restore_16even thread tmp=t0
144 .set push
145 SET_HARDFLOAT
146 lw \tmp, THREAD_FCR31(\thread)
147 ldc1 $f0, THREAD_FPR0(\thread)
148 ldc1 $f2, THREAD_FPR2(\thread)
149 ldc1 $f4, THREAD_FPR4(\thread)
150 ldc1 $f6, THREAD_FPR6(\thread)
151 ldc1 $f8, THREAD_FPR8(\thread)
152 ldc1 $f10, THREAD_FPR10(\thread)
153 ldc1 $f12, THREAD_FPR12(\thread)
154 ldc1 $f14, THREAD_FPR14(\thread)
155 ldc1 $f16, THREAD_FPR16(\thread)
156 ldc1 $f18, THREAD_FPR18(\thread)
157 ldc1 $f20, THREAD_FPR20(\thread)
158 ldc1 $f22, THREAD_FPR22(\thread)
159 ldc1 $f24, THREAD_FPR24(\thread)
160 ldc1 $f26, THREAD_FPR26(\thread)
161 ldc1 $f28, THREAD_FPR28(\thread)
162 ldc1 $f30, THREAD_FPR30(\thread)
163 ctc1 \tmp, fcr31
164 .set pop
165 .endm
166
167 .macro fpu_restore_16odd thread
168 .set push
169 .set mips64r2
170 .set fp=64
171 SET_HARDFLOAT
172 ldc1 $f1, THREAD_FPR1(\thread)
173 ldc1 $f3, THREAD_FPR3(\thread)
174 ldc1 $f5, THREAD_FPR5(\thread)
175 ldc1 $f7, THREAD_FPR7(\thread)
176 ldc1 $f9, THREAD_FPR9(\thread)
177 ldc1 $f11, THREAD_FPR11(\thread)
178 ldc1 $f13, THREAD_FPR13(\thread)
179 ldc1 $f15, THREAD_FPR15(\thread)
180 ldc1 $f17, THREAD_FPR17(\thread)
181 ldc1 $f19, THREAD_FPR19(\thread)
182 ldc1 $f21, THREAD_FPR21(\thread)
183 ldc1 $f23, THREAD_FPR23(\thread)
184 ldc1 $f25, THREAD_FPR25(\thread)
185 ldc1 $f27, THREAD_FPR27(\thread)
186 ldc1 $f29, THREAD_FPR29(\thread)
187 ldc1 $f31, THREAD_FPR31(\thread)
188 .set pop
189 .endm
190
191 .macro fpu_restore_double thread status tmp
192#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
193 defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
194 sll \tmp, \status, 5
195 bgez \tmp, 10f # 16 register mode?
196
197 fpu_restore_16odd \thread
19810:
199#endif
200 fpu_restore_16even \thread \tmp
201 .endm
202
203#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5) || \
204 defined(CONFIG_CPU_MIPSR6)
205 .macro _EXT rd, rs, p, s
206 ext \rd, \rs, \p, \s
207 .endm
208#else /* !CONFIG_CPU_MIPSR2 && !CONFIG_CPU_MIPSR5 && !CONFIG_CPU_MIPSR6 */
209 .macro _EXT rd, rs, p, s
210 srl \rd, \rs, \p
211 andi \rd, \rd, (1 << \s) - 1
212 .endm
213#endif /* !CONFIG_CPU_MIPSR2 && !CONFIG_CPU_MIPSR5 && !CONFIG_CPU_MIPSR6 */
214
215/*
216 * Temporary until all gas have MT ASE support
217 */
218 .macro DMT reg=0
219 .word 0x41600bc1 | (\reg << 16)
220 .endm
221
222 .macro EMT reg=0
223 .word 0x41600be1 | (\reg << 16)
224 .endm
225
226 .macro DVPE reg=0
227 .word 0x41600001 | (\reg << 16)
228 .endm
229
230 .macro EVPE reg=0
231 .word 0x41600021 | (\reg << 16)
232 .endm
233
234 .macro MFTR rt=0, rd=0, u=0, sel=0
235 .word 0x41000000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel)
236 .endm
237
238 .macro MTTR rt=0, rd=0, u=0, sel=0
239 .word 0x41800000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel)
240 .endm
241
242#ifdef TOOLCHAIN_SUPPORTS_MSA
243 .macro _cfcmsa rd, cs
244 .set push
245 .set mips32r2
246 .set fp=64
247 .set msa
248 cfcmsa \rd, $\cs
249 .set pop
250 .endm
251
252 .macro _ctcmsa cd, rs
253 .set push
254 .set mips32r2
255 .set fp=64
256 .set msa
257 ctcmsa $\cd, \rs
258 .set pop
259 .endm
260
261 .macro ld_b wd, off, base
262 .set push
263 .set mips32r2
264 .set fp=64
265 .set msa
266 ld.b $w\wd, \off(\base)
267 .set pop
268 .endm
269
270 .macro ld_h wd, off, base
271 .set push
272 .set mips32r2
273 .set fp=64
274 .set msa
275 ld.h $w\wd, \off(\base)
276 .set pop
277 .endm
278
279 .macro ld_w wd, off, base
280 .set push
281 .set mips32r2
282 .set fp=64
283 .set msa
284 ld.w $w\wd, \off(\base)
285 .set pop
286 .endm
287
288 .macro ld_d wd, off, base
289 .set push
290 .set mips32r2
291 .set fp=64
292 .set msa
293 ld.d $w\wd, \off(\base)
294 .set pop
295 .endm
296
297 .macro st_b wd, off, base
298 .set push
299 .set mips32r2
300 .set fp=64
301 .set msa
302 st.b $w\wd, \off(\base)
303 .set pop
304 .endm
305
306 .macro st_h wd, off, base
307 .set push
308 .set mips32r2
309 .set fp=64
310 .set msa
311 st.h $w\wd, \off(\base)
312 .set pop
313 .endm
314
315 .macro st_w wd, off, base
316 .set push
317 .set mips32r2
318 .set fp=64
319 .set msa
320 st.w $w\wd, \off(\base)
321 .set pop
322 .endm
323
324 .macro st_d wd, off, base
325 .set push
326 .set mips32r2
327 .set fp=64
328 .set msa
329 st.d $w\wd, \off(\base)
330 .set pop
331 .endm
332
333 .macro copy_s_w ws, n
334 .set push
335 .set mips32r2
336 .set fp=64
337 .set msa
338 copy_s.w $1, $w\ws[\n]
339 .set pop
340 .endm
341
342 .macro copy_s_d ws, n
343 .set push
344 .set mips64r2
345 .set fp=64
346 .set msa
347 copy_s.d $1, $w\ws[\n]
348 .set pop
349 .endm
350
351 .macro insert_w wd, n
352 .set push
353 .set mips32r2
354 .set fp=64
355 .set msa
356 insert.w $w\wd[\n], $1
357 .set pop
358 .endm
359
360 .macro insert_d wd, n
361 .set push
362 .set mips64r2
363 .set fp=64
364 .set msa
365 insert.d $w\wd[\n], $1
366 .set pop
367 .endm
368#else
369
370 /*
371 * Temporary until all toolchains in use include MSA support.
372 */
373 .macro _cfcmsa rd, cs
374 .set push
375 .set noat
376 SET_HARDFLOAT
377 insn_if_mips 0x787e0059 | (\cs << 11)
378 insn32_if_mm 0x587e0056 | (\cs << 11)
379 move \rd, $1
380 .set pop
381 .endm
382
383 .macro _ctcmsa cd, rs
384 .set push
385 .set noat
386 SET_HARDFLOAT
387 move $1, \rs
388 insn_if_mips 0x783e0819 | (\cd << 6)
389 insn32_if_mm 0x583e0816 | (\cd << 6)
390 .set pop
391 .endm
392
393 .macro ld_b wd, off, base
394 .set push
395 .set noat
396 SET_HARDFLOAT
397 PTR_ADDU $1, \base, \off
398 insn_if_mips 0x78000820 | (\wd << 6)
399 insn32_if_mm 0x58000807 | (\wd << 6)
400 .set pop
401 .endm
402
403 .macro ld_h wd, off, base
404 .set push
405 .set noat
406 SET_HARDFLOAT
407 PTR_ADDU $1, \base, \off
408 insn_if_mips 0x78000821 | (\wd << 6)
409 insn32_if_mm 0x58000817 | (\wd << 6)
410 .set pop
411 .endm
412
413 .macro ld_w wd, off, base
414 .set push
415 .set noat
416 SET_HARDFLOAT
417 PTR_ADDU $1, \base, \off
418 insn_if_mips 0x78000822 | (\wd << 6)
419 insn32_if_mm 0x58000827 | (\wd << 6)
420 .set pop
421 .endm
422
423 .macro ld_d wd, off, base
424 .set push
425 .set noat
426 SET_HARDFLOAT
427 PTR_ADDU $1, \base, \off
428 insn_if_mips 0x78000823 | (\wd << 6)
429 insn32_if_mm 0x58000837 | (\wd << 6)
430 .set pop
431 .endm
432
433 .macro st_b wd, off, base
434 .set push
435 .set noat
436 SET_HARDFLOAT
437 PTR_ADDU $1, \base, \off
438 insn_if_mips 0x78000824 | (\wd << 6)
439 insn32_if_mm 0x5800080f | (\wd << 6)
440 .set pop
441 .endm
442
443 .macro st_h wd, off, base
444 .set push
445 .set noat
446 SET_HARDFLOAT
447 PTR_ADDU $1, \base, \off
448 insn_if_mips 0x78000825 | (\wd << 6)
449 insn32_if_mm 0x5800081f | (\wd << 6)
450 .set pop
451 .endm
452
453 .macro st_w wd, off, base
454 .set push
455 .set noat
456 SET_HARDFLOAT
457 PTR_ADDU $1, \base, \off
458 insn_if_mips 0x78000826 | (\wd << 6)
459 insn32_if_mm 0x5800082f | (\wd << 6)
460 .set pop
461 .endm
462
463 .macro st_d wd, off, base
464 .set push
465 .set noat
466 SET_HARDFLOAT
467 PTR_ADDU $1, \base, \off
468 insn_if_mips 0x78000827 | (\wd << 6)
469 insn32_if_mm 0x5800083f | (\wd << 6)
470 .set pop
471 .endm
472
473 .macro copy_s_w ws, n
474 .set push
475 .set noat
476 SET_HARDFLOAT
477 insn_if_mips 0x78b00059 | (\n << 16) | (\ws << 11)
478 insn32_if_mm 0x58b00056 | (\n << 16) | (\ws << 11)
479 .set pop
480 .endm
481
482 .macro copy_s_d ws, n
483 .set push
484 .set noat
485 SET_HARDFLOAT
486 insn_if_mips 0x78b80059 | (\n << 16) | (\ws << 11)
487 insn32_if_mm 0x58b80056 | (\n << 16) | (\ws << 11)
488 .set pop
489 .endm
490
491 .macro insert_w wd, n
492 .set push
493 .set noat
494 SET_HARDFLOAT
495 insn_if_mips 0x79300819 | (\n << 16) | (\wd << 6)
496 insn32_if_mm 0x59300816 | (\n << 16) | (\wd << 6)
497 .set pop
498 .endm
499
500 .macro insert_d wd, n
501 .set push
502 .set noat
503 SET_HARDFLOAT
504 insn_if_mips 0x79380819 | (\n << 16) | (\wd << 6)
505 insn32_if_mm 0x59380816 | (\n << 16) | (\wd << 6)
506 .set pop
507 .endm
508#endif
509
510#ifdef TOOLCHAIN_SUPPORTS_MSA
511#define FPR_BASE_OFFS THREAD_FPR0
512#define FPR_BASE $1
513#else
514#define FPR_BASE_OFFS 0
515#define FPR_BASE \thread
516#endif
517
518 .macro msa_save_all thread
519 .set push
520 .set noat
521#ifdef TOOLCHAIN_SUPPORTS_MSA
522 PTR_ADDU FPR_BASE, \thread, FPR_BASE_OFFS
523#endif
524 st_d 0, THREAD_FPR0 - FPR_BASE_OFFS, FPR_BASE
525 st_d 1, THREAD_FPR1 - FPR_BASE_OFFS, FPR_BASE
526 st_d 2, THREAD_FPR2 - FPR_BASE_OFFS, FPR_BASE
527 st_d 3, THREAD_FPR3 - FPR_BASE_OFFS, FPR_BASE
528 st_d 4, THREAD_FPR4 - FPR_BASE_OFFS, FPR_BASE
529 st_d 5, THREAD_FPR5 - FPR_BASE_OFFS, FPR_BASE
530 st_d 6, THREAD_FPR6 - FPR_BASE_OFFS, FPR_BASE
531 st_d 7, THREAD_FPR7 - FPR_BASE_OFFS, FPR_BASE
532 st_d 8, THREAD_FPR8 - FPR_BASE_OFFS, FPR_BASE
533 st_d 9, THREAD_FPR9 - FPR_BASE_OFFS, FPR_BASE
534 st_d 10, THREAD_FPR10 - FPR_BASE_OFFS, FPR_BASE
535 st_d 11, THREAD_FPR11 - FPR_BASE_OFFS, FPR_BASE
536 st_d 12, THREAD_FPR12 - FPR_BASE_OFFS, FPR_BASE
537 st_d 13, THREAD_FPR13 - FPR_BASE_OFFS, FPR_BASE
538 st_d 14, THREAD_FPR14 - FPR_BASE_OFFS, FPR_BASE
539 st_d 15, THREAD_FPR15 - FPR_BASE_OFFS, FPR_BASE
540 st_d 16, THREAD_FPR16 - FPR_BASE_OFFS, FPR_BASE
541 st_d 17, THREAD_FPR17 - FPR_BASE_OFFS, FPR_BASE
542 st_d 18, THREAD_FPR18 - FPR_BASE_OFFS, FPR_BASE
543 st_d 19, THREAD_FPR19 - FPR_BASE_OFFS, FPR_BASE
544 st_d 20, THREAD_FPR20 - FPR_BASE_OFFS, FPR_BASE
545 st_d 21, THREAD_FPR21 - FPR_BASE_OFFS, FPR_BASE
546 st_d 22, THREAD_FPR22 - FPR_BASE_OFFS, FPR_BASE
547 st_d 23, THREAD_FPR23 - FPR_BASE_OFFS, FPR_BASE
548 st_d 24, THREAD_FPR24 - FPR_BASE_OFFS, FPR_BASE
549 st_d 25, THREAD_FPR25 - FPR_BASE_OFFS, FPR_BASE
550 st_d 26, THREAD_FPR26 - FPR_BASE_OFFS, FPR_BASE
551 st_d 27, THREAD_FPR27 - FPR_BASE_OFFS, FPR_BASE
552 st_d 28, THREAD_FPR28 - FPR_BASE_OFFS, FPR_BASE
553 st_d 29, THREAD_FPR29 - FPR_BASE_OFFS, FPR_BASE
554 st_d 30, THREAD_FPR30 - FPR_BASE_OFFS, FPR_BASE
555 st_d 31, THREAD_FPR31 - FPR_BASE_OFFS, FPR_BASE
556 SET_HARDFLOAT
557 _cfcmsa $1, MSA_CSR
558 sw $1, THREAD_MSA_CSR(\thread)
559 .set pop
560 .endm
561
562 .macro msa_restore_all thread
563 .set push
564 .set noat
565 SET_HARDFLOAT
566 lw $1, THREAD_MSA_CSR(\thread)
567 _ctcmsa MSA_CSR, $1
568#ifdef TOOLCHAIN_SUPPORTS_MSA
569 PTR_ADDU FPR_BASE, \thread, FPR_BASE_OFFS
570#endif
571 ld_d 0, THREAD_FPR0 - FPR_BASE_OFFS, FPR_BASE
572 ld_d 1, THREAD_FPR1 - FPR_BASE_OFFS, FPR_BASE
573 ld_d 2, THREAD_FPR2 - FPR_BASE_OFFS, FPR_BASE
574 ld_d 3, THREAD_FPR3 - FPR_BASE_OFFS, FPR_BASE
575 ld_d 4, THREAD_FPR4 - FPR_BASE_OFFS, FPR_BASE
576 ld_d 5, THREAD_FPR5 - FPR_BASE_OFFS, FPR_BASE
577 ld_d 6, THREAD_FPR6 - FPR_BASE_OFFS, FPR_BASE
578 ld_d 7, THREAD_FPR7 - FPR_BASE_OFFS, FPR_BASE
579 ld_d 8, THREAD_FPR8 - FPR_BASE_OFFS, FPR_BASE
580 ld_d 9, THREAD_FPR9 - FPR_BASE_OFFS, FPR_BASE
581 ld_d 10, THREAD_FPR10 - FPR_BASE_OFFS, FPR_BASE
582 ld_d 11, THREAD_FPR11 - FPR_BASE_OFFS, FPR_BASE
583 ld_d 12, THREAD_FPR12 - FPR_BASE_OFFS, FPR_BASE
584 ld_d 13, THREAD_FPR13 - FPR_BASE_OFFS, FPR_BASE
585 ld_d 14, THREAD_FPR14 - FPR_BASE_OFFS, FPR_BASE
586 ld_d 15, THREAD_FPR15 - FPR_BASE_OFFS, FPR_BASE
587 ld_d 16, THREAD_FPR16 - FPR_BASE_OFFS, FPR_BASE
588 ld_d 17, THREAD_FPR17 - FPR_BASE_OFFS, FPR_BASE
589 ld_d 18, THREAD_FPR18 - FPR_BASE_OFFS, FPR_BASE
590 ld_d 19, THREAD_FPR19 - FPR_BASE_OFFS, FPR_BASE
591 ld_d 20, THREAD_FPR20 - FPR_BASE_OFFS, FPR_BASE
592 ld_d 21, THREAD_FPR21 - FPR_BASE_OFFS, FPR_BASE
593 ld_d 22, THREAD_FPR22 - FPR_BASE_OFFS, FPR_BASE
594 ld_d 23, THREAD_FPR23 - FPR_BASE_OFFS, FPR_BASE
595 ld_d 24, THREAD_FPR24 - FPR_BASE_OFFS, FPR_BASE
596 ld_d 25, THREAD_FPR25 - FPR_BASE_OFFS, FPR_BASE
597 ld_d 26, THREAD_FPR26 - FPR_BASE_OFFS, FPR_BASE
598 ld_d 27, THREAD_FPR27 - FPR_BASE_OFFS, FPR_BASE
599 ld_d 28, THREAD_FPR28 - FPR_BASE_OFFS, FPR_BASE
600 ld_d 29, THREAD_FPR29 - FPR_BASE_OFFS, FPR_BASE
601 ld_d 30, THREAD_FPR30 - FPR_BASE_OFFS, FPR_BASE
602 ld_d 31, THREAD_FPR31 - FPR_BASE_OFFS, FPR_BASE
603 .set pop
604 .endm
605
606#undef FPR_BASE_OFFS
607#undef FPR_BASE
608
609 .macro msa_init_upper wd
610#ifdef CONFIG_64BIT
611 insert_d \wd, 1
612#else
613 insert_w \wd, 2
614 insert_w \wd, 3
615#endif
616 .endm
617
618 .macro msa_init_all_upper
619 .set push
620 .set noat
621 SET_HARDFLOAT
622 not $1, zero
623 msa_init_upper 0
624 msa_init_upper 1
625 msa_init_upper 2
626 msa_init_upper 3
627 msa_init_upper 4
628 msa_init_upper 5
629 msa_init_upper 6
630 msa_init_upper 7
631 msa_init_upper 8
632 msa_init_upper 9
633 msa_init_upper 10
634 msa_init_upper 11
635 msa_init_upper 12
636 msa_init_upper 13
637 msa_init_upper 14
638 msa_init_upper 15
639 msa_init_upper 16
640 msa_init_upper 17
641 msa_init_upper 18
642 msa_init_upper 19
643 msa_init_upper 20
644 msa_init_upper 21
645 msa_init_upper 22
646 msa_init_upper 23
647 msa_init_upper 24
648 msa_init_upper 25
649 msa_init_upper 26
650 msa_init_upper 27
651 msa_init_upper 28
652 msa_init_upper 29
653 msa_init_upper 30
654 msa_init_upper 31
655 .set pop
656 .endm
657
658#endif /* _ASM_ASMMACRO_H */
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
new file mode 100644
index 000000000..27ad76791
--- /dev/null
+++ b/arch/mips/include/asm/atomic.h
@@ -0,0 +1,267 @@
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, 06 by Ralf Baechle
13 */
14#ifndef _ASM_ATOMIC_H
15#define _ASM_ATOMIC_H
16
17#include <linux/irqflags.h>
18#include <linux/types.h>
19#include <asm/barrier.h>
20#include <asm/compiler.h>
21#include <asm/cpu-features.h>
22#include <asm/cmpxchg.h>
23#include <asm/llsc.h>
24#include <asm/sync.h>
25#include <asm/war.h>
26
27#define ATOMIC_OPS(pfx, type) \
28static __always_inline type pfx##_read(const pfx##_t *v) \
29{ \
30 return READ_ONCE(v->counter); \
31} \
32 \
33static __always_inline void pfx##_set(pfx##_t *v, type i) \
34{ \
35 WRITE_ONCE(v->counter, i); \
36} \
37 \
38static __always_inline type pfx##_cmpxchg(pfx##_t *v, type o, type n) \
39{ \
40 return cmpxchg(&v->counter, o, n); \
41} \
42 \
43static __always_inline type pfx##_xchg(pfx##_t *v, type n) \
44{ \
45 return xchg(&v->counter, n); \
46}
47
48ATOMIC_OPS(atomic, int)
49
50#ifdef CONFIG_64BIT
51# define ATOMIC64_INIT(i) { (i) }
52ATOMIC_OPS(atomic64, s64)
53#endif
54
55#define ATOMIC_OP(pfx, op, type, c_op, asm_op, ll, sc) \
56static __inline__ void pfx##_##op(type i, pfx##_t * v) \
57{ \
58 type temp; \
59 \
60 if (!kernel_uses_llsc) { \
61 unsigned long flags; \
62 \
63 raw_local_irq_save(flags); \
64 v->counter c_op i; \
65 raw_local_irq_restore(flags); \
66 return; \
67 } \
68 \
69 __asm__ __volatile__( \
70 " .set push \n" \
71 " .set " MIPS_ISA_LEVEL " \n" \
72 " " __SYNC(full, loongson3_war) " \n" \
73 "1: " #ll " %0, %1 # " #pfx "_" #op " \n" \
74 " " #asm_op " %0, %2 \n" \
75 " " #sc " %0, %1 \n" \
76 "\t" __SC_BEQZ "%0, 1b \n" \
77 " .set pop \n" \
78 : "=&r" (temp), "+" GCC_OFF_SMALL_ASM() (v->counter) \
79 : "Ir" (i) : __LLSC_CLOBBER); \
80}
81
82#define ATOMIC_OP_RETURN(pfx, op, type, c_op, asm_op, ll, sc) \
83static __inline__ type pfx##_##op##_return_relaxed(type i, pfx##_t * v) \
84{ \
85 type temp, result; \
86 \
87 if (!kernel_uses_llsc) { \
88 unsigned long flags; \
89 \
90 raw_local_irq_save(flags); \
91 result = v->counter; \
92 result c_op i; \
93 v->counter = result; \
94 raw_local_irq_restore(flags); \
95 return result; \
96 } \
97 \
98 __asm__ __volatile__( \
99 " .set push \n" \
100 " .set " MIPS_ISA_LEVEL " \n" \
101 " " __SYNC(full, loongson3_war) " \n" \
102 "1: " #ll " %1, %2 # " #pfx "_" #op "_return\n" \
103 " " #asm_op " %0, %1, %3 \n" \
104 " " #sc " %0, %2 \n" \
105 "\t" __SC_BEQZ "%0, 1b \n" \
106 " " #asm_op " %0, %1, %3 \n" \
107 " .set pop \n" \
108 : "=&r" (result), "=&r" (temp), \
109 "+" GCC_OFF_SMALL_ASM() (v->counter) \
110 : "Ir" (i) : __LLSC_CLOBBER); \
111 \
112 return result; \
113}
114
115#define ATOMIC_FETCH_OP(pfx, op, type, c_op, asm_op, ll, sc) \
116static __inline__ type pfx##_fetch_##op##_relaxed(type i, pfx##_t * v) \
117{ \
118 int temp, result; \
119 \
120 if (!kernel_uses_llsc) { \
121 unsigned long flags; \
122 \
123 raw_local_irq_save(flags); \
124 result = v->counter; \
125 v->counter c_op i; \
126 raw_local_irq_restore(flags); \
127 return result; \
128 } \
129 \
130 __asm__ __volatile__( \
131 " .set push \n" \
132 " .set " MIPS_ISA_LEVEL " \n" \
133 " " __SYNC(full, loongson3_war) " \n" \
134 "1: " #ll " %1, %2 # " #pfx "_fetch_" #op "\n" \
135 " " #asm_op " %0, %1, %3 \n" \
136 " " #sc " %0, %2 \n" \
137 "\t" __SC_BEQZ "%0, 1b \n" \
138 " .set pop \n" \
139 " move %0, %1 \n" \
140 : "=&r" (result), "=&r" (temp), \
141 "+" GCC_OFF_SMALL_ASM() (v->counter) \
142 : "Ir" (i) : __LLSC_CLOBBER); \
143 \
144 return result; \
145}
146
147#undef ATOMIC_OPS
148#define ATOMIC_OPS(pfx, op, type, c_op, asm_op, ll, sc) \
149 ATOMIC_OP(pfx, op, type, c_op, asm_op, ll, sc) \
150 ATOMIC_OP_RETURN(pfx, op, type, c_op, asm_op, ll, sc) \
151 ATOMIC_FETCH_OP(pfx, op, type, c_op, asm_op, ll, sc)
152
153ATOMIC_OPS(atomic, add, int, +=, addu, ll, sc)
154ATOMIC_OPS(atomic, sub, int, -=, subu, ll, sc)
155
156#define atomic_add_return_relaxed atomic_add_return_relaxed
157#define atomic_sub_return_relaxed atomic_sub_return_relaxed
158#define atomic_fetch_add_relaxed atomic_fetch_add_relaxed
159#define atomic_fetch_sub_relaxed atomic_fetch_sub_relaxed
160
161#ifdef CONFIG_64BIT
162ATOMIC_OPS(atomic64, add, s64, +=, daddu, lld, scd)
163ATOMIC_OPS(atomic64, sub, s64, -=, dsubu, lld, scd)
164# define atomic64_add_return_relaxed atomic64_add_return_relaxed
165# define atomic64_sub_return_relaxed atomic64_sub_return_relaxed
166# define atomic64_fetch_add_relaxed atomic64_fetch_add_relaxed
167# define atomic64_fetch_sub_relaxed atomic64_fetch_sub_relaxed
168#endif /* CONFIG_64BIT */
169
170#undef ATOMIC_OPS
171#define ATOMIC_OPS(pfx, op, type, c_op, asm_op, ll, sc) \
172 ATOMIC_OP(pfx, op, type, c_op, asm_op, ll, sc) \
173 ATOMIC_FETCH_OP(pfx, op, type, c_op, asm_op, ll, sc)
174
175ATOMIC_OPS(atomic, and, int, &=, and, ll, sc)
176ATOMIC_OPS(atomic, or, int, |=, or, ll, sc)
177ATOMIC_OPS(atomic, xor, int, ^=, xor, ll, sc)
178
179#define atomic_fetch_and_relaxed atomic_fetch_and_relaxed
180#define atomic_fetch_or_relaxed atomic_fetch_or_relaxed
181#define atomic_fetch_xor_relaxed atomic_fetch_xor_relaxed
182
183#ifdef CONFIG_64BIT
184ATOMIC_OPS(atomic64, and, s64, &=, and, lld, scd)
185ATOMIC_OPS(atomic64, or, s64, |=, or, lld, scd)
186ATOMIC_OPS(atomic64, xor, s64, ^=, xor, lld, scd)
187# define atomic64_fetch_and_relaxed atomic64_fetch_and_relaxed
188# define atomic64_fetch_or_relaxed atomic64_fetch_or_relaxed
189# define atomic64_fetch_xor_relaxed atomic64_fetch_xor_relaxed
190#endif
191
192#undef ATOMIC_OPS
193#undef ATOMIC_FETCH_OP
194#undef ATOMIC_OP_RETURN
195#undef ATOMIC_OP
196
197/*
198 * atomic_sub_if_positive - conditionally subtract integer from atomic variable
199 * @i: integer value to subtract
200 * @v: pointer of type atomic_t
201 *
202 * Atomically test @v and subtract @i if @v is greater or equal than @i.
203 * The function returns the old value of @v minus @i.
204 */
205#define ATOMIC_SIP_OP(pfx, type, op, ll, sc) \
206static __inline__ int pfx##_sub_if_positive(type i, pfx##_t * v) \
207{ \
208 type temp, result; \
209 \
210 smp_mb__before_atomic(); \
211 \
212 if (!kernel_uses_llsc) { \
213 unsigned long flags; \
214 \
215 raw_local_irq_save(flags); \
216 result = v->counter; \
217 result -= i; \
218 if (result >= 0) \
219 v->counter = result; \
220 raw_local_irq_restore(flags); \
221 smp_mb__after_atomic(); \
222 return result; \
223 } \
224 \
225 __asm__ __volatile__( \
226 " .set push \n" \
227 " .set " MIPS_ISA_LEVEL " \n" \
228 " " __SYNC(full, loongson3_war) " \n" \
229 "1: " #ll " %1, %2 # atomic_sub_if_positive\n" \
230 " .set pop \n" \
231 " " #op " %0, %1, %3 \n" \
232 " move %1, %0 \n" \
233 " bltz %0, 2f \n" \
234 " .set push \n" \
235 " .set " MIPS_ISA_LEVEL " \n" \
236 " " #sc " %1, %2 \n" \
237 " " __SC_BEQZ "%1, 1b \n" \
238 "2: " __SYNC(full, loongson3_war) " \n" \
239 " .set pop \n" \
240 : "=&r" (result), "=&r" (temp), \
241 "+" GCC_OFF_SMALL_ASM() (v->counter) \
242 : "Ir" (i) \
243 : __LLSC_CLOBBER); \
244 \
245 /* \
246 * In the Loongson3 workaround case we already have a \
247 * completion barrier at 2: above, which is needed due to the \
248 * bltz that can branch to code outside of the LL/SC loop. As \
249 * such, we don't need to emit another barrier here. \
250 */ \
251 if (__SYNC_loongson3_war == 0) \
252 smp_mb__after_atomic(); \
253 \
254 return result; \
255}
256
257ATOMIC_SIP_OP(atomic, int, subu, ll, sc)
258#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)
259
260#ifdef CONFIG_64BIT
261ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
262#define atomic64_dec_if_positive(v) atomic64_sub_if_positive(1, v)
263#endif
264
265#undef ATOMIC_SIP_OP
266
267#endif /* _ASM_ATOMIC_H */
diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h
new file mode 100644
index 000000000..49ff172a7
--- /dev/null
+++ b/arch/mips/include/asm/barrier.h
@@ -0,0 +1,142 @@
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) 2006 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_BARRIER_H
9#define __ASM_BARRIER_H
10
11#include <asm/addrspace.h>
12#include <asm/sync.h>
13
14static inline void __sync(void)
15{
16 asm volatile(__SYNC(full, always) ::: "memory");
17}
18
19static inline void rmb(void)
20{
21 asm volatile(__SYNC(rmb, always) ::: "memory");
22}
23#define rmb rmb
24
25static inline void wmb(void)
26{
27 asm volatile(__SYNC(wmb, always) ::: "memory");
28}
29#define wmb wmb
30
31#define fast_mb() __sync()
32
33#define __fast_iob() \
34 __asm__ __volatile__( \
35 ".set push\n\t" \
36 ".set noreorder\n\t" \
37 "lw $0,%0\n\t" \
38 "nop\n\t" \
39 ".set pop" \
40 : /* no output */ \
41 : "m" (*(int *)CKSEG1) \
42 : "memory")
43#ifdef CONFIG_CPU_CAVIUM_OCTEON
44# define fast_iob() do { } while (0)
45#else /* ! CONFIG_CPU_CAVIUM_OCTEON */
46# ifdef CONFIG_SGI_IP28
47# define fast_iob() \
48 __asm__ __volatile__( \
49 ".set push\n\t" \
50 ".set noreorder\n\t" \
51 "lw $0,%0\n\t" \
52 "sync\n\t" \
53 "lw $0,%0\n\t" \
54 ".set pop" \
55 : /* no output */ \
56 : "m" (*(int *)CKSEG1ADDR(0x1fa00004)) \
57 : "memory")
58# else
59# define fast_iob() \
60 do { \
61 __sync(); \
62 __fast_iob(); \
63 } while (0)
64# endif
65#endif /* CONFIG_CPU_CAVIUM_OCTEON */
66
67#ifdef CONFIG_CPU_HAS_WB
68
69#include <asm/wbflush.h>
70
71#define mb() wbflush()
72#define iob() wbflush()
73
74#else /* !CONFIG_CPU_HAS_WB */
75
76#define mb() fast_mb()
77#define iob() fast_iob()
78
79#endif /* !CONFIG_CPU_HAS_WB */
80
81#if defined(CONFIG_WEAK_ORDERING)
82# define __smp_mb() __sync()
83# define __smp_rmb() rmb()
84# define __smp_wmb() wmb()
85#else
86# define __smp_mb() barrier()
87# define __smp_rmb() barrier()
88# define __smp_wmb() barrier()
89#endif
90
91/*
92 * When LL/SC does imply order, it must also be a compiler barrier to avoid the
93 * compiler from reordering where the CPU will not. When it does not imply
94 * order, the compiler is also free to reorder across the LL/SC loop and
95 * ordering will be done by smp_llsc_mb() and friends.
96 */
97#if defined(CONFIG_WEAK_REORDERING_BEYOND_LLSC) && defined(CONFIG_SMP)
98# define __WEAK_LLSC_MB sync
99# define smp_llsc_mb() \
100 __asm__ __volatile__(__stringify(__WEAK_LLSC_MB) : : :"memory")
101# define __LLSC_CLOBBER
102#else
103# define __WEAK_LLSC_MB
104# define smp_llsc_mb() do { } while (0)
105# define __LLSC_CLOBBER "memory"
106#endif
107
108#ifdef CONFIG_CPU_CAVIUM_OCTEON
109#define smp_mb__before_llsc() smp_wmb()
110#define __smp_mb__before_llsc() __smp_wmb()
111/* Cause previous writes to become visible on all CPUs as soon as possible */
112#define nudge_writes() __asm__ __volatile__(".set push\n\t" \
113 ".set arch=octeon\n\t" \
114 "syncw\n\t" \
115 ".set pop" : : : "memory")
116#else
117#define smp_mb__before_llsc() smp_llsc_mb()
118#define __smp_mb__before_llsc() smp_llsc_mb()
119#define nudge_writes() mb()
120#endif
121
122/*
123 * In the Loongson3 LL/SC workaround case, all of our LL/SC loops already have
124 * a completion barrier immediately preceding the LL instruction. Therefore we
125 * can skip emitting a barrier from __smp_mb__before_atomic().
126 */
127#ifdef CONFIG_CPU_LOONGSON3_WORKAROUNDS
128# define __smp_mb__before_atomic()
129#else
130# define __smp_mb__before_atomic() __smp_mb__before_llsc()
131#endif
132
133#define __smp_mb__after_atomic() smp_llsc_mb()
134
135static inline void sync_ginv(void)
136{
137 asm volatile(__SYNC(ginv, always));
138}
139
140#include <asm-generic/barrier.h>
141
142#endif /* __ASM_BARRIER_H */
diff --git a/arch/mips/include/asm/bcache.h b/arch/mips/include/asm/bcache.h
new file mode 100644
index 000000000..a00857b13
--- /dev/null
+++ b/arch/mips/include/asm/bcache.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 (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/types.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 void (*bc_prefetch_enable)(void);
23 void (*bc_prefetch_disable)(void);
24 bool (*bc_prefetch_is_enabled)(void);
25};
26
27extern void indy_sc_init(void);
28
29#ifdef CONFIG_BOARD_SCACHE
30
31extern struct bcache_ops *bcops;
32
33static inline void bc_enable(void)
34{
35 bcops->bc_enable();
36}
37
38static inline void bc_disable(void)
39{
40 bcops->bc_disable();
41}
42
43static inline void bc_wback_inv(unsigned long page, unsigned long size)
44{
45 bcops->bc_wback_inv(page, size);
46}
47
48static inline void bc_inv(unsigned long page, unsigned long size)
49{
50 bcops->bc_inv(page, size);
51}
52
53static inline void bc_prefetch_enable(void)
54{
55 if (bcops->bc_prefetch_enable)
56 bcops->bc_prefetch_enable();
57}
58
59static inline void bc_prefetch_disable(void)
60{
61 if (bcops->bc_prefetch_disable)
62 bcops->bc_prefetch_disable();
63}
64
65static inline bool bc_prefetch_is_enabled(void)
66{
67 if (bcops->bc_prefetch_is_enabled)
68 return bcops->bc_prefetch_is_enabled();
69
70 return false;
71}
72
73#else /* !defined(CONFIG_BOARD_SCACHE) */
74
75/* Not R4000 / R4400 / R4600 / R5000. */
76
77#define bc_enable() do { } while (0)
78#define bc_disable() do { } while (0)
79#define bc_wback_inv(page, size) do { } while (0)
80#define bc_inv(page, size) do { } while (0)
81#define bc_prefetch_enable() do { } while (0)
82#define bc_prefetch_disable() do { } while (0)
83#define bc_prefetch_is_enabled() 0
84
85#endif /* !defined(CONFIG_BOARD_SCACHE) */
86
87#endif /* _ASM_BCACHE_H */
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
new file mode 100644
index 000000000..a74769940
--- /dev/null
+++ b/arch/mips/include/asm/bitops.h
@@ -0,0 +1,463 @@
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, 99, 2000, 06, 07 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (c) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_BITOPS_H
10#define _ASM_BITOPS_H
11
12#ifndef _LINUX_BITOPS_H
13#error only <linux/bitops.h> can be included directly
14#endif
15
16#include <linux/bits.h>
17#include <linux/compiler.h>
18#include <linux/types.h>
19#include <asm/barrier.h>
20#include <asm/byteorder.h> /* sigh ... */
21#include <asm/compiler.h>
22#include <asm/cpu-features.h>
23#include <asm/isa-rev.h>
24#include <asm/llsc.h>
25#include <asm/sgidefs.h>
26#include <asm/war.h>
27
28#define __bit_op(mem, insn, inputs...) do { \
29 unsigned long temp; \
30 \
31 asm volatile( \
32 " .set push \n" \
33 " .set " MIPS_ISA_LEVEL " \n" \
34 " " __SYNC(full, loongson3_war) " \n" \
35 "1: " __LL "%0, %1 \n" \
36 " " insn " \n" \
37 " " __SC "%0, %1 \n" \
38 " " __SC_BEQZ "%0, 1b \n" \
39 " .set pop \n" \
40 : "=&r"(temp), "+" GCC_OFF_SMALL_ASM()(mem) \
41 : inputs \
42 : __LLSC_CLOBBER); \
43} while (0)
44
45#define __test_bit_op(mem, ll_dst, insn, inputs...) ({ \
46 unsigned long orig, temp; \
47 \
48 asm volatile( \
49 " .set push \n" \
50 " .set " MIPS_ISA_LEVEL " \n" \
51 " " __SYNC(full, loongson3_war) " \n" \
52 "1: " __LL ll_dst ", %2 \n" \
53 " " insn " \n" \
54 " " __SC "%1, %2 \n" \
55 " " __SC_BEQZ "%1, 1b \n" \
56 " .set pop \n" \
57 : "=&r"(orig), "=&r"(temp), \
58 "+" GCC_OFF_SMALL_ASM()(mem) \
59 : inputs \
60 : __LLSC_CLOBBER); \
61 \
62 orig; \
63})
64
65/*
66 * These are the "slower" versions of the functions and are in bitops.c.
67 * These functions call raw_local_irq_{save,restore}().
68 */
69void __mips_set_bit(unsigned long nr, volatile unsigned long *addr);
70void __mips_clear_bit(unsigned long nr, volatile unsigned long *addr);
71void __mips_change_bit(unsigned long nr, volatile unsigned long *addr);
72int __mips_test_and_set_bit_lock(unsigned long nr,
73 volatile unsigned long *addr);
74int __mips_test_and_clear_bit(unsigned long nr,
75 volatile unsigned long *addr);
76int __mips_test_and_change_bit(unsigned long nr,
77 volatile unsigned long *addr);
78
79
80/*
81 * set_bit - Atomically set a bit in memory
82 * @nr: the bit to set
83 * @addr: the address to start counting from
84 *
85 * This function is atomic and may not be reordered. See __set_bit()
86 * if you do not require the atomic guarantees.
87 * Note that @nr may be almost arbitrarily large; this function is not
88 * restricted to acting on a single-word quantity.
89 */
90static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
91{
92 volatile unsigned long *m = &addr[BIT_WORD(nr)];
93 int bit = nr % BITS_PER_LONG;
94
95 if (!kernel_uses_llsc) {
96 __mips_set_bit(nr, addr);
97 return;
98 }
99
100 if ((MIPS_ISA_REV >= 2) && __builtin_constant_p(bit) && (bit >= 16)) {
101 __bit_op(*m, __INS "%0, %3, %2, 1", "i"(bit), "r"(~0));
102 return;
103 }
104
105 __bit_op(*m, "or\t%0, %2", "ir"(BIT(bit)));
106}
107
108/*
109 * clear_bit - Clears a bit in memory
110 * @nr: Bit to clear
111 * @addr: Address to start counting from
112 *
113 * clear_bit() is atomic and may not be reordered. However, it does
114 * not contain a memory barrier, so if it is used for locking purposes,
115 * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic()
116 * in order to ensure changes are visible on other processors.
117 */
118static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
119{
120 volatile unsigned long *m = &addr[BIT_WORD(nr)];
121 int bit = nr % BITS_PER_LONG;
122
123 if (!kernel_uses_llsc) {
124 __mips_clear_bit(nr, addr);
125 return;
126 }
127
128 if ((MIPS_ISA_REV >= 2) && __builtin_constant_p(bit)) {
129 __bit_op(*m, __INS "%0, $0, %2, 1", "i"(bit));
130 return;
131 }
132
133 __bit_op(*m, "and\t%0, %2", "ir"(~BIT(bit)));
134}
135
136/*
137 * clear_bit_unlock - Clears a bit in memory
138 * @nr: Bit to clear
139 * @addr: Address to start counting from
140 *
141 * clear_bit() is atomic and implies release semantics before the memory
142 * operation. It can be used for an unlock.
143 */
144static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *addr)
145{
146 smp_mb__before_atomic();
147 clear_bit(nr, addr);
148}
149
150/*
151 * change_bit - Toggle a bit in memory
152 * @nr: Bit to change
153 * @addr: Address to start counting from
154 *
155 * change_bit() is atomic and may not be reordered.
156 * Note that @nr may be almost arbitrarily large; this function is not
157 * restricted to acting on a single-word quantity.
158 */
159static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
160{
161 volatile unsigned long *m = &addr[BIT_WORD(nr)];
162 int bit = nr % BITS_PER_LONG;
163
164 if (!kernel_uses_llsc) {
165 __mips_change_bit(nr, addr);
166 return;
167 }
168
169 __bit_op(*m, "xor\t%0, %2", "ir"(BIT(bit)));
170}
171
172/*
173 * test_and_set_bit_lock - Set a bit and return its old value
174 * @nr: Bit to set
175 * @addr: Address to count from
176 *
177 * This operation is atomic and implies acquire ordering semantics
178 * after the memory operation.
179 */
180static inline int test_and_set_bit_lock(unsigned long nr,
181 volatile unsigned long *addr)
182{
183 volatile unsigned long *m = &addr[BIT_WORD(nr)];
184 int bit = nr % BITS_PER_LONG;
185 unsigned long res, orig;
186
187 if (!kernel_uses_llsc) {
188 res = __mips_test_and_set_bit_lock(nr, addr);
189 } else {
190 orig = __test_bit_op(*m, "%0",
191 "or\t%1, %0, %3",
192 "ir"(BIT(bit)));
193 res = (orig & BIT(bit)) != 0;
194 }
195
196 smp_llsc_mb();
197
198 return res;
199}
200
201/*
202 * test_and_set_bit - Set a bit and return its old value
203 * @nr: Bit to set
204 * @addr: Address to count from
205 *
206 * This operation is atomic and cannot be reordered.
207 * It also implies a memory barrier.
208 */
209static inline int test_and_set_bit(unsigned long nr,
210 volatile unsigned long *addr)
211{
212 smp_mb__before_atomic();
213 return test_and_set_bit_lock(nr, addr);
214}
215
216/*
217 * test_and_clear_bit - Clear a bit and return its old value
218 * @nr: Bit to clear
219 * @addr: Address to count from
220 *
221 * This operation is atomic and cannot be reordered.
222 * It also implies a memory barrier.
223 */
224static inline int test_and_clear_bit(unsigned long nr,
225 volatile unsigned long *addr)
226{
227 volatile unsigned long *m = &addr[BIT_WORD(nr)];
228 int bit = nr % BITS_PER_LONG;
229 unsigned long res, orig;
230
231 smp_mb__before_atomic();
232
233 if (!kernel_uses_llsc) {
234 res = __mips_test_and_clear_bit(nr, addr);
235 } else if ((MIPS_ISA_REV >= 2) && __builtin_constant_p(nr)) {
236 res = __test_bit_op(*m, "%1",
237 __EXT "%0, %1, %3, 1;"
238 __INS "%1, $0, %3, 1",
239 "i"(bit));
240 } else {
241 orig = __test_bit_op(*m, "%0",
242 "or\t%1, %0, %3;"
243 "xor\t%1, %1, %3",
244 "ir"(BIT(bit)));
245 res = (orig & BIT(bit)) != 0;
246 }
247
248 smp_llsc_mb();
249
250 return res;
251}
252
253/*
254 * test_and_change_bit - Change a bit and return its old value
255 * @nr: Bit to change
256 * @addr: Address to count from
257 *
258 * This operation is atomic and cannot be reordered.
259 * It also implies a memory barrier.
260 */
261static inline int test_and_change_bit(unsigned long nr,
262 volatile unsigned long *addr)
263{
264 volatile unsigned long *m = &addr[BIT_WORD(nr)];
265 int bit = nr % BITS_PER_LONG;
266 unsigned long res, orig;
267
268 smp_mb__before_atomic();
269
270 if (!kernel_uses_llsc) {
271 res = __mips_test_and_change_bit(nr, addr);
272 } else {
273 orig = __test_bit_op(*m, "%0",
274 "xor\t%1, %0, %3",
275 "ir"(BIT(bit)));
276 res = (orig & BIT(bit)) != 0;
277 }
278
279 smp_llsc_mb();
280
281 return res;
282}
283
284#undef __bit_op
285#undef __test_bit_op
286
287#include <asm-generic/bitops/non-atomic.h>
288
289/*
290 * __clear_bit_unlock - Clears a bit in memory
291 * @nr: Bit to clear
292 * @addr: Address to start counting from
293 *
294 * __clear_bit() is non-atomic and implies release semantics before the memory
295 * operation. It can be used for an unlock if no other CPUs can concurrently
296 * modify other bits in the word.
297 */
298static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *addr)
299{
300 smp_mb__before_llsc();
301 __clear_bit(nr, addr);
302 nudge_writes();
303}
304
305/*
306 * Return the bit position (0..63) of the most significant 1 bit in a word
307 * Returns -1 if no 1 bit exists
308 */
309static __always_inline unsigned long __fls(unsigned long word)
310{
311 int num;
312
313 if (BITS_PER_LONG == 32 && !__builtin_constant_p(word) &&
314 __builtin_constant_p(cpu_has_clo_clz) && cpu_has_clo_clz) {
315 __asm__(
316 " .set push \n"
317 " .set "MIPS_ISA_LEVEL" \n"
318 " clz %0, %1 \n"
319 " .set pop \n"
320 : "=r" (num)
321 : "r" (word));
322
323 return 31 - num;
324 }
325
326 if (BITS_PER_LONG == 64 && !__builtin_constant_p(word) &&
327 __builtin_constant_p(cpu_has_mips64) && cpu_has_mips64) {
328 __asm__(
329 " .set push \n"
330 " .set "MIPS_ISA_LEVEL" \n"
331 " dclz %0, %1 \n"
332 " .set pop \n"
333 : "=r" (num)
334 : "r" (word));
335
336 return 63 - num;
337 }
338
339 num = BITS_PER_LONG - 1;
340
341#if BITS_PER_LONG == 64
342 if (!(word & (~0ul << 32))) {
343 num -= 32;
344 word <<= 32;
345 }
346#endif
347 if (!(word & (~0ul << (BITS_PER_LONG-16)))) {
348 num -= 16;
349 word <<= 16;
350 }
351 if (!(word & (~0ul << (BITS_PER_LONG-8)))) {
352 num -= 8;
353 word <<= 8;
354 }
355 if (!(word & (~0ul << (BITS_PER_LONG-4)))) {
356 num -= 4;
357 word <<= 4;
358 }
359 if (!(word & (~0ul << (BITS_PER_LONG-2)))) {
360 num -= 2;
361 word <<= 2;
362 }
363 if (!(word & (~0ul << (BITS_PER_LONG-1))))
364 num -= 1;
365 return num;
366}
367
368/*
369 * __ffs - find first bit in word.
370 * @word: The word to search
371 *
372 * Returns 0..SZLONG-1
373 * Undefined if no bit exists, so code should check against 0 first.
374 */
375static __always_inline unsigned long __ffs(unsigned long word)
376{
377 return __fls(word & -word);
378}
379
380/*
381 * fls - find last bit set.
382 * @word: The word to search
383 *
384 * This is defined the same way as ffs.
385 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
386 */
387static inline int fls(unsigned int x)
388{
389 int r;
390
391 if (!__builtin_constant_p(x) &&
392 __builtin_constant_p(cpu_has_clo_clz) && cpu_has_clo_clz) {
393 __asm__(
394 " .set push \n"
395 " .set "MIPS_ISA_LEVEL" \n"
396 " clz %0, %1 \n"
397 " .set pop \n"
398 : "=r" (x)
399 : "r" (x));
400
401 return 32 - x;
402 }
403
404 r = 32;
405 if (!x)
406 return 0;
407 if (!(x & 0xffff0000u)) {
408 x <<= 16;
409 r -= 16;
410 }
411 if (!(x & 0xff000000u)) {
412 x <<= 8;
413 r -= 8;
414 }
415 if (!(x & 0xf0000000u)) {
416 x <<= 4;
417 r -= 4;
418 }
419 if (!(x & 0xc0000000u)) {
420 x <<= 2;
421 r -= 2;
422 }
423 if (!(x & 0x80000000u)) {
424 x <<= 1;
425 r -= 1;
426 }
427 return r;
428}
429
430#include <asm-generic/bitops/fls64.h>
431
432/*
433 * ffs - find first bit set.
434 * @word: The word to search
435 *
436 * This is defined the same way as
437 * the libc and compiler builtin ffs routines, therefore
438 * differs in spirit from the above ffz (man ffs).
439 */
440static inline int ffs(int word)
441{
442 if (!word)
443 return 0;
444
445 return fls(word & -word);
446}
447
448#include <asm-generic/bitops/ffz.h>
449#include <asm-generic/bitops/find.h>
450
451#ifdef __KERNEL__
452
453#include <asm-generic/bitops/sched.h>
454
455#include <asm/arch_hweight.h>
456#include <asm-generic/bitops/const_hweight.h>
457
458#include <asm-generic/bitops/le.h>
459#include <asm-generic/bitops/ext2-atomic.h>
460
461#endif /* __KERNEL__ */
462
463#endif /* _ASM_BITOPS_H */
diff --git a/arch/mips/include/asm/bitrev.h b/arch/mips/include/asm/bitrev.h
new file mode 100644
index 000000000..8a2538e08
--- /dev/null
+++ b/arch/mips/include/asm/bitrev.h
@@ -0,0 +1,31 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __MIPS_ASM_BITREV_H__
3#define __MIPS_ASM_BITREV_H__
4
5#include <linux/swab.h>
6
7static __always_inline __attribute_const__ u32 __arch_bitrev32(u32 x)
8{
9 u32 ret;
10
11 asm("bitswap %0, %1" : "=r"(ret) : "r"(__swab32(x)));
12 return ret;
13}
14
15static __always_inline __attribute_const__ u16 __arch_bitrev16(u16 x)
16{
17 u16 ret;
18
19 asm("bitswap %0, %1" : "=r"(ret) : "r"(__swab16(x)));
20 return ret;
21}
22
23static __always_inline __attribute_const__ u8 __arch_bitrev8(u8 x)
24{
25 u8 ret;
26
27 asm("bitswap %0, %1" : "=r"(ret) : "r"(x));
28 return ret;
29}
30
31#endif /* __MIPS_ASM_BITREV_H__ */
diff --git a/arch/mips/include/asm/bmips-spaces.h b/arch/mips/include/asm/bmips-spaces.h
new file mode 100644
index 000000000..febc4c30a
--- /dev/null
+++ b/arch/mips/include/asm/bmips-spaces.h
@@ -0,0 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_BMIPS_SPACES_H
3#define __ASM_BMIPS_SPACES_H
4
5/* Avoid collisions with system base register (SBR) region on BMIPS3300 */
6#define FIXADDR_TOP ((unsigned long)(long)(int)0xff000000)
7
8#endif /* __ASM_BMIPS_SPACES_H */
diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h
new file mode 100644
index 000000000..581a6a3c6
--- /dev/null
+++ b/arch/mips/include/asm/bmips.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 * Copyright (C) 2011 by Kevin Cernekee (cernekee@gmail.com)
7 *
8 * Definitions for BMIPS processors
9 */
10#ifndef _ASM_BMIPS_H
11#define _ASM_BMIPS_H
12
13#include <linux/compiler.h>
14#include <linux/linkage.h>
15#include <asm/addrspace.h>
16#include <asm/mipsregs.h>
17#include <asm/hazards.h>
18
19/* NOTE: the CBR register returns a PA, and it can be above 0xff00_0000 */
20#define BMIPS_GET_CBR() ((void __iomem *)(CKSEG1 | \
21 (unsigned long) \
22 ((read_c0_brcm_cbr() >> 18) << 18)))
23
24#define BMIPS_RAC_CONFIG 0x00000000
25#define BMIPS_RAC_ADDRESS_RANGE 0x00000004
26#define BMIPS_RAC_CONFIG_1 0x00000008
27#define BMIPS_L2_CONFIG 0x0000000c
28#define BMIPS_LMB_CONTROL 0x0000001c
29#define BMIPS_SYSTEM_BASE 0x00000020
30#define BMIPS_PERF_GLOBAL_CONTROL 0x00020000
31#define BMIPS_PERF_CONTROL_0 0x00020004
32#define BMIPS_PERF_CONTROL_1 0x00020008
33#define BMIPS_PERF_COUNTER_0 0x00020010
34#define BMIPS_PERF_COUNTER_1 0x00020014
35#define BMIPS_PERF_COUNTER_2 0x00020018
36#define BMIPS_PERF_COUNTER_3 0x0002001c
37#define BMIPS_RELO_VECTOR_CONTROL_0 0x00030000
38#define BMIPS_RELO_VECTOR_CONTROL_1 0x00038000
39
40#define BMIPS_NMI_RESET_VEC 0x80000000
41#define BMIPS_WARM_RESTART_VEC 0x80000380
42
43#define ZSCM_REG_BASE 0x97000000
44
45#if !defined(__ASSEMBLY__)
46
47#include <linux/cpumask.h>
48#include <asm/r4kcache.h>
49#include <asm/smp-ops.h>
50
51extern const struct plat_smp_ops bmips43xx_smp_ops;
52extern const struct plat_smp_ops bmips5000_smp_ops;
53
54static inline int register_bmips_smp_ops(void)
55{
56#if IS_ENABLED(CONFIG_CPU_BMIPS) && IS_ENABLED(CONFIG_SMP)
57 switch (current_cpu_type()) {
58 case CPU_BMIPS32:
59 case CPU_BMIPS3300:
60 return register_up_smp_ops();
61 case CPU_BMIPS4350:
62 case CPU_BMIPS4380:
63 register_smp_ops(&bmips43xx_smp_ops);
64 break;
65 case CPU_BMIPS5000:
66 register_smp_ops(&bmips5000_smp_ops);
67 break;
68 default:
69 return -ENODEV;
70 }
71
72 return 0;
73#else
74 return -ENODEV;
75#endif
76}
77
78extern char bmips_reset_nmi_vec[];
79extern char bmips_reset_nmi_vec_end[];
80extern char bmips_smp_movevec[];
81extern char bmips_smp_int_vec[];
82extern char bmips_smp_int_vec_end[];
83
84extern int bmips_smp_enabled;
85extern int bmips_cpu_offset;
86extern cpumask_t bmips_booted_mask;
87extern unsigned long bmips_tp1_irqs;
88
89extern void bmips_ebase_setup(void);
90extern asmlinkage void plat_wired_tlb_setup(void);
91extern void bmips_cpu_setup(void);
92
93static inline unsigned long bmips_read_zscm_reg(unsigned int offset)
94{
95 unsigned long ret;
96
97 barrier();
98 cache_op(Index_Load_Tag_S, ZSCM_REG_BASE + offset);
99 __sync();
100 _ssnop();
101 _ssnop();
102 _ssnop();
103 _ssnop();
104 _ssnop();
105 _ssnop();
106 _ssnop();
107 ret = read_c0_ddatalo();
108 _ssnop();
109
110 return ret;
111}
112
113static inline void bmips_write_zscm_reg(unsigned int offset, unsigned long data)
114{
115 write_c0_ddatalo(data);
116 _ssnop();
117 _ssnop();
118 _ssnop();
119 cache_op(Index_Store_Tag_S, ZSCM_REG_BASE + offset);
120 _ssnop();
121 _ssnop();
122 _ssnop();
123 barrier();
124}
125
126#endif /* !defined(__ASSEMBLY__) */
127
128#endif /* _ASM_BMIPS_H */
diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
new file mode 100644
index 000000000..aa03b1237
--- /dev/null
+++ b/arch/mips/include/asm/bootinfo.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) 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 * Copyright (C) 2009 Zhang Le
11 */
12#ifndef _ASM_BOOTINFO_H
13#define _ASM_BOOTINFO_H
14
15#include <linux/types.h>
16#include <asm/setup.h>
17
18/*
19 * The MACH_ IDs are sort of equivalent to PCI product IDs. As such the
20 * numbers do not necessarily reflect technical relations or similarities
21 * between systems.
22 */
23
24/*
25 * Valid machtype values for group unknown
26 */
27#define MACH_UNKNOWN 0 /* whatever... */
28
29/*
30 * Valid machtype for group DEC
31 */
32#define MACH_DSUNKNOWN 0
33#define MACH_DS23100 1 /* DECstation 2100 or 3100 */
34#define MACH_DS5100 2 /* DECsystem 5100 */
35#define MACH_DS5000_200 3 /* DECstation 5000/200 */
36#define MACH_DS5000_1XX 4 /* DECstation 5000/120, 125, 133, 150 */
37#define MACH_DS5000_XX 5 /* DECstation 5000/20, 25, 33, 50 */
38#define MACH_DS5000_2X0 6 /* DECstation 5000/240, 260 */
39#define MACH_DS5400 7 /* DECsystem 5400 */
40#define MACH_DS5500 8 /* DECsystem 5500 */
41#define MACH_DS5800 9 /* DECsystem 5800 */
42#define MACH_DS5900 10 /* DECsystem 5900 */
43
44/*
45 * Valid machtype for group Mikrotik
46 */
47#define MACH_MIKROTIK_RB532 0 /* Mikrotik RouterBoard 532 */
48#define MACH_MIKROTIK_RB532A 1 /* Mikrotik RouterBoard 532A */
49
50/*
51 * Valid machtype for Loongson family
52 */
53enum loongson2ef_machine_type {
54 MACH_LOONGSON_UNKNOWN,
55 MACH_LEMOTE_FL2E,
56 MACH_LEMOTE_FL2F,
57 MACH_LEMOTE_ML2F7,
58 MACH_LEMOTE_YL2F89,
59 MACH_DEXXON_GDIUM2F10,
60 MACH_LEMOTE_NAS,
61 MACH_LEMOTE_LL2F,
62 MACH_LOONGSON_END
63};
64
65/*
66 * Valid machtype for group INGENIC
67 */
68enum ingenic_machine_type {
69 MACH_INGENIC_UNKNOWN,
70 MACH_INGENIC_JZ4720,
71 MACH_INGENIC_JZ4725,
72 MACH_INGENIC_JZ4725B,
73 MACH_INGENIC_JZ4730,
74 MACH_INGENIC_JZ4740,
75 MACH_INGENIC_JZ4750,
76 MACH_INGENIC_JZ4755,
77 MACH_INGENIC_JZ4760,
78 MACH_INGENIC_JZ4770,
79 MACH_INGENIC_JZ4775,
80 MACH_INGENIC_JZ4780,
81 MACH_INGENIC_X1000,
82 MACH_INGENIC_X1000E,
83 MACH_INGENIC_X1830,
84 MACH_INGENIC_X2000,
85 MACH_INGENIC_X2000E,
86};
87
88extern char *system_type;
89const char *get_system_type(void);
90
91extern unsigned long mips_machtype;
92
93extern void detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_addr_t sz_max);
94
95extern void prom_init(void);
96extern void prom_free_prom_memory(void);
97extern void prom_cleanup(void);
98
99extern void free_init_pages(const char *what,
100 unsigned long begin, unsigned long end);
101
102extern void (*free_init_pages_eva)(void *begin, void *end);
103
104/*
105 * Initial kernel command line, usually setup by prom_init()
106 */
107extern char arcs_cmdline[COMMAND_LINE_SIZE];
108
109/*
110 * Registers a0, a1, a3 and a4 as passed to the kernel entry by firmware
111 */
112extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
113
114#ifdef CONFIG_USE_OF
115extern unsigned long fw_passed_dtb;
116#endif
117
118/*
119 * Platform memory detection hook called by arch_mem_init()
120 */
121extern void plat_mem_setup(void);
122
123#ifdef CONFIG_SWIOTLB
124/*
125 * Optional platform hook to call swiotlb_setup().
126 */
127extern void plat_swiotlb_setup(void);
128
129#else
130
131static inline void plat_swiotlb_setup(void) {}
132
133#endif /* CONFIG_SWIOTLB */
134
135#ifdef CONFIG_USE_OF
136/**
137 * plat_get_fdt() - Return a pointer to the platform's device tree blob
138 *
139 * This function provides a platform independent API to get a pointer to the
140 * flattened device tree blob. The interface between bootloader and kernel
141 * is not consistent across platforms so it is necessary to provide this
142 * API such that common startup code can locate the FDT.
143 *
144 * This is used by the KASLR code to get command line arguments and random
145 * seed from the device tree. Any platform wishing to use KASLR should
146 * provide this API and select SYS_SUPPORTS_RELOCATABLE.
147 *
148 * Return: Pointer to the flattened device tree blob.
149 */
150extern void *plat_get_fdt(void);
151
152#ifdef CONFIG_RELOCATABLE
153
154/**
155 * plat_fdt_relocated() - Update platform's information about relocated dtb
156 *
157 * This function provides a platform-independent API to set platform's
158 * information about relocated DTB if it needs to be moved due to kernel
159 * relocation occurring at boot.
160 */
161void plat_fdt_relocated(void *new_location);
162
163#endif /* CONFIG_RELOCATABLE */
164#endif /* CONFIG_USE_OF */
165
166#endif /* _ASM_BOOTINFO_H */
diff --git a/arch/mips/include/asm/branch.h b/arch/mips/include/asm/branch.h
new file mode 100644
index 000000000..fa3dcbf56
--- /dev/null
+++ b/arch/mips/include/asm/branch.h
@@ -0,0 +1,103 @@
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/cpu-features.h>
12#include <asm/mipsregs.h>
13#include <asm/ptrace.h>
14#include <asm/inst.h>
15
16extern int __isa_exception_epc(struct pt_regs *regs);
17extern int __compute_return_epc(struct pt_regs *regs);
18extern int __compute_return_epc_for_insn(struct pt_regs *regs,
19 union mips_instruction insn);
20extern int __microMIPS_compute_return_epc(struct pt_regs *regs);
21extern int __MIPS16e_compute_return_epc(struct pt_regs *regs);
22
23/*
24 * microMIPS bitfields
25 */
26#define MM_POOL32A_MINOR_MASK 0x3f
27#define MM_POOL32A_MINOR_SHIFT 0x6
28#define MM_MIPS32_COND_FC 0x30
29
30int isBranchInstr(struct pt_regs *regs,
31 struct mm_decoded_insn dec_insn, unsigned long *contpc);
32
33extern int __mm_isBranchInstr(struct pt_regs *regs,
34 struct mm_decoded_insn dec_insn, unsigned long *contpc);
35
36static inline int mm_isBranchInstr(struct pt_regs *regs,
37 struct mm_decoded_insn dec_insn, unsigned long *contpc)
38{
39 if (!cpu_has_mmips)
40 return 0;
41
42 return __mm_isBranchInstr(regs, dec_insn, contpc);
43}
44
45static inline int delay_slot(struct pt_regs *regs)
46{
47 return regs->cp0_cause & CAUSEF_BD;
48}
49
50static inline void clear_delay_slot(struct pt_regs *regs)
51{
52 regs->cp0_cause &= ~CAUSEF_BD;
53}
54
55static inline void set_delay_slot(struct pt_regs *regs)
56{
57 regs->cp0_cause |= CAUSEF_BD;
58}
59
60static inline unsigned long exception_epc(struct pt_regs *regs)
61{
62 if (likely(!delay_slot(regs)))
63 return regs->cp0_epc;
64
65 if (get_isa16_mode(regs->cp0_epc))
66 return __isa_exception_epc(regs);
67
68 return regs->cp0_epc + 4;
69}
70
71#define BRANCH_LIKELY_TAKEN 0x0001
72
73static inline int compute_return_epc(struct pt_regs *regs)
74{
75 if (get_isa16_mode(regs->cp0_epc)) {
76 if (cpu_has_mmips)
77 return __microMIPS_compute_return_epc(regs);
78 if (cpu_has_mips16)
79 return __MIPS16e_compute_return_epc(regs);
80 } else if (!delay_slot(regs)) {
81 regs->cp0_epc += 4;
82 return 0;
83 }
84
85 return __compute_return_epc(regs);
86}
87
88static inline int MIPS16e_compute_return_epc(struct pt_regs *regs,
89 union mips16e_instruction *inst)
90{
91 if (likely(!delay_slot(regs))) {
92 if (inst->ri.opcode == MIPS16e_extend_op) {
93 regs->cp0_epc += 4;
94 return 0;
95 }
96 regs->cp0_epc += 2;
97 return 0;
98 }
99
100 return __MIPS16e_compute_return_epc(regs);
101}
102
103#endif /* _ASM_BRANCH_H */
diff --git a/arch/mips/include/asm/break.h b/arch/mips/include/asm/break.h
new file mode 100644
index 000000000..0ef11429a
--- /dev/null
+++ b/arch/mips/include/asm/break.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) 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#ifdef __UAPI_ASM_BREAK_H
13#error "Error: Do not directly include <uapi/asm/break.h>"
14#endif
15#include <uapi/asm/break.h>
16
17/*
18 * Break codes used internally to the kernel.
19 */
20#define BRK_KDB 513 /* Used in KDB_ENTER() */
21#define BRK_MEMU 514 /* Used by FPU emulator */
22#define BRK_KPROBE_BP 515 /* Kprobe break */
23#define BRK_KPROBE_SSTEPBP 516 /* Kprobe single step software implementation */
24#define BRK_MULOVF 1023 /* Multiply overflow */
25
26#endif /* __ASM_BREAK_H */
diff --git a/arch/mips/include/asm/bug.h b/arch/mips/include/asm/bug.h
new file mode 100644
index 000000000..745dc160a
--- /dev/null
+++ b/arch/mips/include/asm/bug.h
@@ -0,0 +1,44 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_BUG_H
3#define __ASM_BUG_H
4
5#include <linux/compiler.h>
6#include <asm/sgidefs.h>
7
8#ifdef CONFIG_BUG
9
10#include <asm/break.h>
11
12static inline void __noreturn BUG(void)
13{
14 __asm__ __volatile__("break %0" : : "i" (BRK_BUG));
15 unreachable();
16}
17
18#define HAVE_ARCH_BUG
19
20#if (_MIPS_ISA > _MIPS_ISA_MIPS1)
21
22static inline void __BUG_ON(unsigned long condition)
23{
24 if (__builtin_constant_p(condition)) {
25 if (condition)
26 BUG();
27 else
28 return;
29 }
30 __asm__ __volatile__("tne $0, %0, %1"
31 : : "r" (condition), "i" (BRK_BUG));
32}
33
34#define BUG_ON(C) __BUG_ON((unsigned long)(C))
35
36#define HAVE_ARCH_BUG_ON
37
38#endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
39
40#endif
41
42#include <asm-generic/bug.h>
43
44#endif /* __ASM_BUG_H */
diff --git a/arch/mips/include/asm/bugs.h b/arch/mips/include/asm/bugs.h
new file mode 100644
index 000000000..d72dc6e1c
--- /dev/null
+++ b/arch/mips/include/asm/bugs.h
@@ -0,0 +1,53 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * This is included by init/main.c to check for architecture-dependent bugs.
4 *
5 * Copyright (C) 2007 Maciej W. Rozycki
6 *
7 * Needs:
8 * void check_bugs(void);
9 */
10#ifndef _ASM_BUGS_H
11#define _ASM_BUGS_H
12
13#include <linux/bug.h>
14#include <linux/delay.h>
15#include <linux/smp.h>
16
17#include <asm/cpu.h>
18#include <asm/cpu-info.h>
19
20extern int daddiu_bug;
21
22extern void check_bugs64_early(void);
23
24extern void check_bugs32(void);
25extern void check_bugs64(void);
26
27static inline void check_bugs_early(void)
28{
29 if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
30 check_bugs64_early();
31}
32
33static inline void check_bugs(void)
34{
35 unsigned int cpu = smp_processor_id();
36
37 cpu_data[cpu].udelay_val = loops_per_jiffy;
38 check_bugs32();
39
40 if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
41 check_bugs64();
42}
43
44static inline int r4k_daddiu_bug(void)
45{
46 if (!IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
47 return 0;
48
49 WARN_ON(daddiu_bug < 0);
50 return daddiu_bug != 0;
51}
52
53#endif /* _ASM_BUGS_H */
diff --git a/arch/mips/include/asm/cache.h b/arch/mips/include/asm/cache.h
new file mode 100644
index 000000000..29187e12b
--- /dev/null
+++ b/arch/mips/include/asm/cache.h
@@ -0,0 +1,19 @@
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 <kmalloc.h>
13
14#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT
15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
16
17#define __read_mostly __section(".data..read_mostly")
18
19#endif /* _ASM_CACHE_H */
diff --git a/arch/mips/include/asm/cacheflush.h b/arch/mips/include/asm/cacheflush.h
new file mode 100644
index 000000000..d687b40b9
--- /dev/null
+++ b/arch/mips/include/asm/cacheflush.h
@@ -0,0 +1,153 @@
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_dup mm(mm) handles cache flushing when forking
21 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
22 * - flush_cache_range(vma, start, end) flushes a range of pages
23 * - flush_icache_range(start, end) flush a range of instructions
24 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
25 *
26 * MIPS specific flush operations:
27 *
28 * - flush_icache_all() flush the entire instruction cache
29 * - flush_data_cache_page() flushes a page from the data cache
30 * - __flush_icache_user_range(start, end) flushes range of user instructions
31 */
32
33 /*
34 * This flag is used to indicate that the page pointed to by a pte
35 * is dirty and requires cleaning before returning it to the user.
36 */
37#define PG_dcache_dirty PG_arch_1
38
39#define Page_dcache_dirty(page) \
40 test_bit(PG_dcache_dirty, &(page)->flags)
41#define SetPageDcacheDirty(page) \
42 set_bit(PG_dcache_dirty, &(page)->flags)
43#define ClearPageDcacheDirty(page) \
44 clear_bit(PG_dcache_dirty, &(page)->flags)
45
46extern void (*flush_cache_all)(void);
47extern void (*__flush_cache_all)(void);
48extern void (*flush_cache_mm)(struct mm_struct *mm);
49#define flush_cache_dup_mm(mm) do { (void) (mm); } while (0)
50extern void (*flush_cache_range)(struct vm_area_struct *vma,
51 unsigned long start, unsigned long end);
52extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);
53extern void __flush_dcache_page(struct page *page);
54
55#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
56static inline void flush_dcache_page(struct page *page)
57{
58 if (cpu_has_dc_aliases)
59 __flush_dcache_page(page);
60 else if (!cpu_has_ic_fills_f_dc)
61 SetPageDcacheDirty(page);
62}
63
64#define flush_dcache_mmap_lock(mapping) do { } while (0)
65#define flush_dcache_mmap_unlock(mapping) do { } while (0)
66
67#define ARCH_HAS_FLUSH_ANON_PAGE
68extern void __flush_anon_page(struct page *, unsigned long);
69static inline void flush_anon_page(struct vm_area_struct *vma,
70 struct page *page, unsigned long vmaddr)
71{
72 if (cpu_has_dc_aliases && PageAnon(page))
73 __flush_anon_page(page, vmaddr);
74}
75
76static inline void flush_icache_page(struct vm_area_struct *vma,
77 struct page *page)
78{
79}
80
81extern void (*flush_icache_range)(unsigned long start, unsigned long end);
82extern void (*local_flush_icache_range)(unsigned long start, unsigned long end);
83extern void (*__flush_icache_user_range)(unsigned long start,
84 unsigned long end);
85extern void (*__local_flush_icache_user_range)(unsigned long start,
86 unsigned long end);
87
88extern void (*__flush_cache_vmap)(void);
89
90static inline void flush_cache_vmap(unsigned long start, unsigned long end)
91{
92 if (cpu_has_dc_aliases)
93 __flush_cache_vmap();
94}
95
96extern void (*__flush_cache_vunmap)(void);
97
98static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
99{
100 if (cpu_has_dc_aliases)
101 __flush_cache_vunmap();
102}
103
104extern void copy_to_user_page(struct vm_area_struct *vma,
105 struct page *page, unsigned long vaddr, void *dst, const void *src,
106 unsigned long len);
107
108extern void copy_from_user_page(struct vm_area_struct *vma,
109 struct page *page, unsigned long vaddr, void *dst, const void *src,
110 unsigned long len);
111
112extern void (*flush_icache_all)(void);
113extern void (*local_flush_data_cache_page)(void * addr);
114extern void (*flush_data_cache_page)(unsigned long addr);
115
116/* Run kernel code uncached, useful for cache probing functions. */
117unsigned long run_uncached(void *func);
118
119extern void *kmap_coherent(struct page *page, unsigned long addr);
120extern void kunmap_coherent(void);
121extern void *kmap_noncoherent(struct page *page, unsigned long addr);
122
123static inline void kunmap_noncoherent(void)
124{
125 kunmap_coherent();
126}
127
128#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
129static inline void flush_kernel_dcache_page(struct page *page)
130{
131 BUG_ON(cpu_has_dc_aliases && PageHighMem(page));
132 flush_dcache_page(page);
133}
134
135/*
136 * For now flush_kernel_vmap_range and invalidate_kernel_vmap_range both do a
137 * cache writeback and invalidate operation.
138 */
139extern void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);
140
141static inline void flush_kernel_vmap_range(void *vaddr, int size)
142{
143 if (cpu_has_dc_aliases)
144 __flush_kernel_vmap_range((unsigned long) vaddr, size);
145}
146
147static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
148{
149 if (cpu_has_dc_aliases)
150 __flush_kernel_vmap_range((unsigned long) vaddr, size);
151}
152
153#endif /* _ASM_CACHEFLUSH_H */
diff --git a/arch/mips/include/asm/cacheops.h b/arch/mips/include/asm/cacheops.h
new file mode 100644
index 000000000..50253efec
--- /dev/null
+++ b/arch/mips/include/asm/cacheops.h
@@ -0,0 +1,116 @@
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 * Most cache ops are split into a 2 bit field identifying the cache, and a 3
16 * bit field identifying the cache operation.
17 */
18#define CacheOp_Cache 0x03
19#define CacheOp_Op 0x1c
20
21#define Cache_I 0x00
22#define Cache_D 0x01
23#define Cache_T 0x02
24#define Cache_V 0x02 /* Loongson-3 */
25#define Cache_S 0x03
26
27#define Index_Writeback_Inv 0x00
28#define Index_Load_Tag 0x04
29#define Index_Store_Tag 0x08
30#define Hit_Invalidate 0x10
31#define Hit_Writeback_Inv 0x14 /* not with Cache_I though */
32#define Hit_Writeback 0x18
33
34/*
35 * Cache Operations available on all MIPS processors with R4000-style caches
36 */
37#define Index_Invalidate_I (Cache_I | Index_Writeback_Inv)
38#define Index_Writeback_Inv_D (Cache_D | Index_Writeback_Inv)
39#define Index_Load_Tag_I (Cache_I | Index_Load_Tag)
40#define Index_Load_Tag_D (Cache_D | Index_Load_Tag)
41#define Index_Store_Tag_I (Cache_I | Index_Store_Tag)
42#define Index_Store_Tag_D (Cache_D | Index_Store_Tag)
43#define Hit_Invalidate_I (Cache_I | Hit_Invalidate)
44#define Hit_Invalidate_D (Cache_D | Hit_Invalidate)
45#define Hit_Writeback_Inv_D (Cache_D | Hit_Writeback_Inv)
46
47/*
48 * R4000-specific cacheops
49 */
50#define Create_Dirty_Excl_D (Cache_D | 0x0c)
51#define Fill_I (Cache_I | 0x14)
52#define Hit_Writeback_I (Cache_I | Hit_Writeback)
53#define Hit_Writeback_D (Cache_D | Hit_Writeback)
54
55/*
56 * R4000SC and R4400SC-specific cacheops
57 */
58#define Cache_SI 0x02
59#define Cache_SD 0x03
60
61#define Index_Invalidate_SI (Cache_SI | Index_Writeback_Inv)
62#define Index_Writeback_Inv_SD (Cache_SD | Index_Writeback_Inv)
63#define Index_Load_Tag_SI (Cache_SI | Index_Load_Tag)
64#define Index_Load_Tag_SD (Cache_SD | Index_Load_Tag)
65#define Index_Store_Tag_SI (Cache_SI | Index_Store_Tag)
66#define Index_Store_Tag_SD (Cache_SD | Index_Store_Tag)
67#define Create_Dirty_Excl_SD (Cache_SD | 0x0c)
68#define Hit_Invalidate_SI (Cache_SI | Hit_Invalidate)
69#define Hit_Invalidate_SD (Cache_SD | Hit_Invalidate)
70#define Hit_Writeback_Inv_SD (Cache_SD | Hit_Writeback_Inv)
71#define Hit_Writeback_SD (Cache_SD | Hit_Writeback)
72#define Hit_Set_Virtual_SI (Cache_SI | 0x1c)
73#define Hit_Set_Virtual_SD (Cache_SD | 0x1c)
74
75/*
76 * R5000-specific cacheops
77 */
78#define R5K_Page_Invalidate_S (Cache_S | 0x14)
79
80/*
81 * RM7000-specific cacheops
82 */
83#define Page_Invalidate_T (Cache_T | 0x14)
84#define Index_Store_Tag_T (Cache_T | Index_Store_Tag)
85#define Index_Load_Tag_T (Cache_T | Index_Load_Tag)
86
87/*
88 * R10000-specific cacheops
89 *
90 * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused.
91 * Most of the _S cacheops are identical to the R4000SC _SD cacheops.
92 */
93#define Index_Writeback_Inv_S (Cache_S | Index_Writeback_Inv)
94#define Index_Load_Tag_S (Cache_S | Index_Load_Tag)
95#define Index_Store_Tag_S (Cache_S | Index_Store_Tag)
96#define Hit_Invalidate_S (Cache_S | Hit_Invalidate)
97#define Cache_Barrier 0x14
98#define Hit_Writeback_Inv_S (Cache_S | Hit_Writeback_Inv)
99#define Index_Load_Data_I (Cache_I | 0x18)
100#define Index_Load_Data_D (Cache_D | 0x18)
101#define Index_Load_Data_S (Cache_S | 0x18)
102#define Index_Store_Data_I (Cache_I | 0x1c)
103#define Index_Store_Data_D (Cache_D | 0x1c)
104#define Index_Store_Data_S (Cache_S | 0x1c)
105
106/*
107 * Loongson2-specific cacheops
108 */
109#define Hit_Invalidate_I_Loongson2 (Cache_I | 0x00)
110
111/*
112 * Loongson3-specific cacheops
113 */
114#define Index_Writeback_Inv_V (Cache_V | Index_Writeback_Inv)
115
116#endif /* __ASM_CACHEOPS_H */
diff --git a/arch/mips/include/asm/cdmm.h b/arch/mips/include/asm/cdmm.h
new file mode 100644
index 000000000..c06dbf8ba
--- /dev/null
+++ b/arch/mips/include/asm/cdmm.h
@@ -0,0 +1,109 @@
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) 2014 Imagination Technologies Ltd.
7 */
8#ifndef __ASM_CDMM_H
9#define __ASM_CDMM_H
10
11#include <linux/device.h>
12#include <linux/mod_devicetable.h>
13
14/**
15 * struct mips_cdmm_device - Represents a single device on a CDMM bus.
16 * @dev: Driver model device object.
17 * @cpu: CPU which can access this device.
18 * @res: MMIO resource.
19 * @type: Device type identifier.
20 * @rev: Device revision number.
21 */
22struct mips_cdmm_device {
23 struct device dev;
24 unsigned int cpu;
25 struct resource res;
26 unsigned int type;
27 unsigned int rev;
28};
29
30/**
31 * struct mips_cdmm_driver - Represents a driver for a CDMM device.
32 * @drv: Driver model driver object.
33 * @probe Callback for probing newly discovered devices.
34 * @remove: Callback to remove the device.
35 * @shutdown: Callback on system shutdown.
36 * @cpu_down: Callback when the parent CPU is going down.
37 * Any CPU pinned threads/timers should be disabled.
38 * @cpu_up: Callback when the parent CPU is coming back up again.
39 * CPU pinned threads/timers can be restarted.
40 * @id_table: Table for CDMM IDs to match against.
41 */
42struct mips_cdmm_driver {
43 struct device_driver drv;
44 int (*probe)(struct mips_cdmm_device *);
45 int (*remove)(struct mips_cdmm_device *);
46 void (*shutdown)(struct mips_cdmm_device *);
47 int (*cpu_down)(struct mips_cdmm_device *);
48 int (*cpu_up)(struct mips_cdmm_device *);
49 const struct mips_cdmm_device_id *id_table;
50};
51
52/**
53 * mips_cdmm_phys_base() - Choose a physical base address for CDMM region.
54 *
55 * Picking a suitable physical address at which to map the CDMM region is
56 * platform specific, so this function can be defined by platform code to
57 * pick a suitable value if none is configured by the bootloader.
58 *
59 * This address must be 32kB aligned, and the region occupies a maximum of 32kB
60 * of physical address space which must not be used for anything else.
61 *
62 * Returns: Physical base address for CDMM region, or 0 on failure.
63 */
64phys_addr_t mips_cdmm_phys_base(void);
65
66extern struct bus_type mips_cdmm_bustype;
67void __iomem *mips_cdmm_early_probe(unsigned int dev_type);
68
69#define to_mips_cdmm_device(d) container_of(d, struct mips_cdmm_device, dev)
70
71#define mips_cdmm_get_drvdata(d) dev_get_drvdata(&d->dev)
72#define mips_cdmm_set_drvdata(d, p) dev_set_drvdata(&d->dev, p)
73
74int mips_cdmm_driver_register(struct mips_cdmm_driver *);
75void mips_cdmm_driver_unregister(struct mips_cdmm_driver *);
76
77/*
78 * module_mips_cdmm_driver() - Helper macro for drivers that don't do
79 * anything special in module init/exit. This eliminates a lot of
80 * boilerplate. Each module may only use this macro once, and
81 * calling it replaces module_init() and module_exit()
82 */
83#define module_mips_cdmm_driver(__mips_cdmm_driver) \
84 module_driver(__mips_cdmm_driver, mips_cdmm_driver_register, \
85 mips_cdmm_driver_unregister)
86
87/*
88 * builtin_mips_cdmm_driver() - Helper macro for drivers that don't do anything
89 * special in init and have no exit. This eliminates some boilerplate. Each
90 * driver may only use this macro once, and calling it replaces device_initcall
91 * (or in some cases, the legacy __initcall). This is meant to be a direct
92 * parallel of module_mips_cdmm_driver() above but without the __exit stuff that
93 * is not used for builtin cases.
94 */
95#define builtin_mips_cdmm_driver(__mips_cdmm_driver) \
96 builtin_driver(__mips_cdmm_driver, mips_cdmm_driver_register)
97
98/* drivers/tty/mips_ejtag_fdc.c */
99
100#ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON
101int setup_early_fdc_console(void);
102#else
103static inline int setup_early_fdc_console(void)
104{
105 return -ENODEV;
106}
107#endif
108
109#endif /* __ASM_CDMM_H */
diff --git a/arch/mips/include/asm/cevt-r4k.h b/arch/mips/include/asm/cevt-r4k.h
new file mode 100644
index 000000000..2e13a038d
--- /dev/null
+++ b/arch/mips/include/asm/cevt-r4k.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) 2008 Kevin D. Kissell
7 */
8
9/*
10 * Definitions used for common event timer implementation
11 * for MIPS 4K-type processors and their MIPS MT variants.
12 * Avoids unsightly extern declarations in C files.
13 */
14#ifndef __ASM_CEVT_R4K_H
15#define __ASM_CEVT_R4K_H
16
17#include <linux/clockchips.h>
18#include <asm/time.h>
19
20DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
21
22void mips_event_handler(struct clock_event_device *dev);
23int c0_compare_int_usable(void);
24irqreturn_t c0_compare_interrupt(int, void *);
25
26extern struct irqaction c0_compare_irqaction;
27extern int cp0_timer_irq_installed;
28
29#endif /* __ASM_CEVT_R4K_H */
diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h
new file mode 100644
index 000000000..5f80c28f5
--- /dev/null
+++ b/arch/mips/include/asm/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 * Copyright (C) 2014 Imagination Technologies Ltd.
11 */
12#ifndef _ASM_CHECKSUM_H
13#define _ASM_CHECKSUM_H
14
15#ifdef CONFIG_GENERIC_CSUM
16#include <asm-generic/checksum.h>
17#else
18
19#include <linux/in6.h>
20
21#include <linux/uaccess.h>
22
23/*
24 * computes the checksum of a memory block at buff, length len,
25 * and adds in "sum" (32-bit)
26 *
27 * returns a 32-bit number suitable for feeding into itself
28 * or csum_tcpudp_magic
29 *
30 * this function must be called with even lengths, except
31 * for the last fragment, which may be odd
32 *
33 * it's best to have buff aligned on a 32-bit boundary
34 */
35__wsum csum_partial(const void *buff, int len, __wsum sum);
36
37__wsum __csum_partial_copy_from_user(const void __user *src, void *dst, int len);
38__wsum __csum_partial_copy_to_user(const void *src, void __user *dst, int len);
39
40#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
41static inline
42__wsum csum_and_copy_from_user(const void __user *src, void *dst, int len)
43{
44 might_fault();
45 if (!access_ok(src, len))
46 return 0;
47 return __csum_partial_copy_from_user(src, dst, len);
48}
49
50/*
51 * Copy and checksum to user
52 */
53#define HAVE_CSUM_COPY_USER
54static inline
55__wsum csum_and_copy_to_user(const void *src, void __user *dst, int len)
56{
57 might_fault();
58 if (!access_ok(dst, len))
59 return 0;
60 return __csum_partial_copy_to_user(src, dst, len);
61}
62
63/*
64 * the same as csum_partial, but copies from user space (but on MIPS
65 * we have just one address space, so this is identical to the above)
66 */
67#define _HAVE_ARCH_CSUM_AND_COPY
68__wsum __csum_partial_copy_nocheck(const void *src, void *dst, int len);
69static inline __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len)
70{
71 return __csum_partial_copy_nocheck(src, dst, len);
72}
73
74/*
75 * Fold a partial checksum without adding pseudo headers
76 */
77static inline __sum16 csum_fold(__wsum csum)
78{
79 u32 sum = (__force u32)csum;
80
81 sum += (sum << 16);
82 csum = (__force __wsum)(sum < (__force u32)csum);
83 sum >>= 16;
84 sum += (__force u32)csum;
85
86 return (__force __sum16)~sum;
87}
88#define csum_fold csum_fold
89
90/*
91 * This is a version of ip_compute_csum() optimized for IP headers,
92 * which always checksum on 4 octet boundaries.
93 *
94 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
95 * Arnt Gulbrandsen.
96 */
97static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
98{
99 const unsigned int *word = iph;
100 const unsigned int *stop = word + ihl;
101 unsigned int csum;
102 int carry;
103
104 csum = word[0];
105 csum += word[1];
106 carry = (csum < word[1]);
107 csum += carry;
108
109 csum += word[2];
110 carry = (csum < word[2]);
111 csum += carry;
112
113 csum += word[3];
114 carry = (csum < word[3]);
115 csum += carry;
116
117 word += 4;
118 do {
119 csum += *word;
120 carry = (csum < *word);
121 csum += carry;
122 word++;
123 } while (word != stop);
124
125 return csum_fold(csum);
126}
127#define ip_fast_csum ip_fast_csum
128
129static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
130 __u32 len, __u8 proto,
131 __wsum sum)
132{
133 __asm__(
134 " .set push # csum_tcpudp_nofold\n"
135 " .set noat \n"
136#ifdef CONFIG_32BIT
137 " addu %0, %2 \n"
138 " sltu $1, %0, %2 \n"
139 " addu %0, $1 \n"
140
141 " addu %0, %3 \n"
142 " sltu $1, %0, %3 \n"
143 " addu %0, $1 \n"
144
145 " addu %0, %4 \n"
146 " sltu $1, %0, %4 \n"
147 " addu %0, $1 \n"
148#endif
149#ifdef CONFIG_64BIT
150 " daddu %0, %2 \n"
151 " daddu %0, %3 \n"
152 " daddu %0, %4 \n"
153 " dsll32 $1, %0, 0 \n"
154 " daddu %0, $1 \n"
155 " sltu $1, %0, $1 \n"
156 " dsra32 %0, %0, 0 \n"
157 " addu %0, $1 \n"
158#endif
159 " .set pop"
160 : "=r" (sum)
161 : "0" ((__force unsigned long)daddr),
162 "r" ((__force unsigned long)saddr),
163#ifdef __MIPSEL__
164 "r" ((proto + len) << 8),
165#else
166 "r" (proto + len),
167#endif
168 "r" ((__force unsigned long)sum));
169
170 return sum;
171}
172#define csum_tcpudp_nofold csum_tcpudp_nofold
173
174/*
175 * this routine is used for miscellaneous IP-like checksums, mainly
176 * in icmp.c
177 */
178static inline __sum16 ip_compute_csum(const void *buff, int len)
179{
180 return csum_fold(csum_partial(buff, len, 0));
181}
182
183#define _HAVE_ARCH_IPV6_CSUM
184static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
185 const struct in6_addr *daddr,
186 __u32 len, __u8 proto,
187 __wsum sum)
188{
189 __wsum tmp;
190
191 __asm__(
192 " .set push # csum_ipv6_magic\n"
193 " .set noreorder \n"
194 " .set noat \n"
195 " addu %0, %5 # proto (long in network byte order)\n"
196 " sltu $1, %0, %5 \n"
197 " addu %0, $1 \n"
198
199 " addu %0, %6 # csum\n"
200 " sltu $1, %0, %6 \n"
201 " lw %1, 0(%2) # four words source address\n"
202 " addu %0, $1 \n"
203 " addu %0, %1 \n"
204 " sltu $1, %0, %1 \n"
205
206 " lw %1, 4(%2) \n"
207 " addu %0, $1 \n"
208 " addu %0, %1 \n"
209 " sltu $1, %0, %1 \n"
210
211 " lw %1, 8(%2) \n"
212 " addu %0, $1 \n"
213 " addu %0, %1 \n"
214 " sltu $1, %0, %1 \n"
215
216 " lw %1, 12(%2) \n"
217 " addu %0, $1 \n"
218 " addu %0, %1 \n"
219 " sltu $1, %0, %1 \n"
220
221 " lw %1, 0(%3) \n"
222 " addu %0, $1 \n"
223 " addu %0, %1 \n"
224 " sltu $1, %0, %1 \n"
225
226 " lw %1, 4(%3) \n"
227 " addu %0, $1 \n"
228 " addu %0, %1 \n"
229 " sltu $1, %0, %1 \n"
230
231 " lw %1, 8(%3) \n"
232 " addu %0, $1 \n"
233 " addu %0, %1 \n"
234 " sltu $1, %0, %1 \n"
235
236 " lw %1, 12(%3) \n"
237 " addu %0, $1 \n"
238 " addu %0, %1 \n"
239 " sltu $1, %0, %1 \n"
240
241 " addu %0, $1 # Add final carry\n"
242 " .set pop"
243 : "=&r" (sum), "=&r" (tmp)
244 : "r" (saddr), "r" (daddr),
245 "0" (htonl(len)), "r" (htonl(proto)), "r" (sum));
246
247 return csum_fold(sum);
248}
249
250#include <asm-generic/checksum.h>
251#endif /* CONFIG_GENERIC_CSUM */
252
253#endif /* _ASM_CHECKSUM_H */
diff --git a/arch/mips/include/asm/clocksource.h b/arch/mips/include/asm/clocksource.h
new file mode 100644
index 000000000..2f1ebbea3
--- /dev/null
+++ b/arch/mips/include/asm/clocksource.h
@@ -0,0 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2015 Imagination Technologies
4 * Author: Alex Smith <alex.smith@imgtec.com>
5 */
6#ifndef __ASM_CLOCKSOURCE_H
7#define __ASM_CLOCKSOURCE_H
8
9#include <asm/vdso/clocksource.h>
10
11#endif /* __ASM_CLOCKSOURCE_H */
diff --git a/arch/mips/include/asm/cmp.h b/arch/mips/include/asm/cmp.h
new file mode 100644
index 000000000..e9e87504b
--- /dev/null
+++ b/arch/mips/include/asm/cmp.h
@@ -0,0 +1,18 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_CMP_H
3#define _ASM_CMP_H
4
5/*
6 * Definitions for CMP multitasking on MIPS cores
7 */
8struct task_struct;
9
10extern void cmp_smp_setup(void);
11extern void cmp_smp_finish(void);
12extern void cmp_boot_secondary(int cpu, struct task_struct *t);
13extern void cmp_init_secondary(void);
14extern void cmp_prepare_cpus(unsigned int max_cpus);
15
16/* This is platform specific */
17extern void cmp_send_ipi(int cpu, unsigned int action);
18#endif /* _ASM_CMP_H */
diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
new file mode 100644
index 000000000..3e9c41f69
--- /dev/null
+++ b/arch/mips/include/asm/cmpxchg.h
@@ -0,0 +1,327 @@
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, 06, 07 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_CMPXCHG_H
9#define __ASM_CMPXCHG_H
10
11#include <linux/bug.h>
12#include <linux/irqflags.h>
13#include <asm/compiler.h>
14#include <asm/llsc.h>
15#include <asm/sync.h>
16#include <asm/war.h>
17
18/*
19 * These functions doesn't exist, so if they are called you'll either:
20 *
21 * - Get an error at compile-time due to __compiletime_error, if supported by
22 * your compiler.
23 *
24 * or:
25 *
26 * - Get an error at link-time due to the call to the missing function.
27 */
28extern unsigned long __cmpxchg_called_with_bad_pointer(void)
29 __compiletime_error("Bad argument size for cmpxchg");
30extern unsigned long __cmpxchg64_unsupported(void)
31 __compiletime_error("cmpxchg64 not available; cpu_has_64bits may be false");
32extern unsigned long __xchg_called_with_bad_pointer(void)
33 __compiletime_error("Bad argument size for xchg");
34
35#define __xchg_asm(ld, st, m, val) \
36({ \
37 __typeof(*(m)) __ret; \
38 \
39 if (kernel_uses_llsc) { \
40 __asm__ __volatile__( \
41 " .set push \n" \
42 " .set noat \n" \
43 " .set push \n" \
44 " .set " MIPS_ISA_ARCH_LEVEL " \n" \
45 " " __SYNC(full, loongson3_war) " \n" \
46 "1: " ld " %0, %2 # __xchg_asm \n" \
47 " .set pop \n" \
48 " move $1, %z3 \n" \
49 " .set " MIPS_ISA_ARCH_LEVEL " \n" \
50 " " st " $1, %1 \n" \
51 "\t" __SC_BEQZ "$1, 1b \n" \
52 " .set pop \n" \
53 : "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \
54 : GCC_OFF_SMALL_ASM() (*m), "Jr" (val) \
55 : __LLSC_CLOBBER); \
56 } else { \
57 unsigned long __flags; \
58 \
59 raw_local_irq_save(__flags); \
60 __ret = *m; \
61 *m = val; \
62 raw_local_irq_restore(__flags); \
63 } \
64 \
65 __ret; \
66})
67
68extern unsigned long __xchg_small(volatile void *ptr, unsigned long val,
69 unsigned int size);
70
71static __always_inline
72unsigned long __xchg(volatile void *ptr, unsigned long x, int size)
73{
74 switch (size) {
75 case 1:
76 case 2:
77 return __xchg_small(ptr, x, size);
78
79 case 4:
80 return __xchg_asm("ll", "sc", (volatile u32 *)ptr, x);
81
82 case 8:
83 if (!IS_ENABLED(CONFIG_64BIT))
84 return __xchg_called_with_bad_pointer();
85
86 return __xchg_asm("lld", "scd", (volatile u64 *)ptr, x);
87
88 default:
89 return __xchg_called_with_bad_pointer();
90 }
91}
92
93#define xchg(ptr, x) \
94({ \
95 __typeof__(*(ptr)) __res; \
96 \
97 /* \
98 * In the Loongson3 workaround case __xchg_asm() already \
99 * contains a completion barrier prior to the LL, so we don't \
100 * need to emit an extra one here. \
101 */ \
102 if (__SYNC_loongson3_war == 0) \
103 smp_mb__before_llsc(); \
104 \
105 __res = (__typeof__(*(ptr))) \
106 __xchg((ptr), (unsigned long)(x), sizeof(*(ptr))); \
107 \
108 smp_llsc_mb(); \
109 \
110 __res; \
111})
112
113#define __cmpxchg_asm(ld, st, m, old, new) \
114({ \
115 __typeof(*(m)) __ret; \
116 \
117 if (kernel_uses_llsc) { \
118 __asm__ __volatile__( \
119 " .set push \n" \
120 " .set noat \n" \
121 " .set push \n" \
122 " .set "MIPS_ISA_ARCH_LEVEL" \n" \
123 " " __SYNC(full, loongson3_war) " \n" \
124 "1: " ld " %0, %2 # __cmpxchg_asm \n" \
125 " bne %0, %z3, 2f \n" \
126 " .set pop \n" \
127 " move $1, %z4 \n" \
128 " .set "MIPS_ISA_ARCH_LEVEL" \n" \
129 " " st " $1, %1 \n" \
130 "\t" __SC_BEQZ "$1, 1b \n" \
131 " .set pop \n" \
132 "2: " __SYNC(full, loongson3_war) " \n" \
133 : "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \
134 : GCC_OFF_SMALL_ASM() (*m), "Jr" (old), "Jr" (new) \
135 : __LLSC_CLOBBER); \
136 } else { \
137 unsigned long __flags; \
138 \
139 raw_local_irq_save(__flags); \
140 __ret = *m; \
141 if (__ret == old) \
142 *m = new; \
143 raw_local_irq_restore(__flags); \
144 } \
145 \
146 __ret; \
147})
148
149extern unsigned long __cmpxchg_small(volatile void *ptr, unsigned long old,
150 unsigned long new, unsigned int size);
151
152static __always_inline
153unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
154 unsigned long new, unsigned int size)
155{
156 switch (size) {
157 case 1:
158 case 2:
159 return __cmpxchg_small(ptr, old, new, size);
160
161 case 4:
162 return __cmpxchg_asm("ll", "sc", (volatile u32 *)ptr,
163 (u32)old, new);
164
165 case 8:
166 /* lld/scd are only available for MIPS64 */
167 if (!IS_ENABLED(CONFIG_64BIT))
168 return __cmpxchg_called_with_bad_pointer();
169
170 return __cmpxchg_asm("lld", "scd", (volatile u64 *)ptr,
171 (u64)old, new);
172
173 default:
174 return __cmpxchg_called_with_bad_pointer();
175 }
176}
177
178#define cmpxchg_local(ptr, old, new) \
179 ((__typeof__(*(ptr))) \
180 __cmpxchg((ptr), \
181 (unsigned long)(__typeof__(*(ptr)))(old), \
182 (unsigned long)(__typeof__(*(ptr)))(new), \
183 sizeof(*(ptr))))
184
185#define cmpxchg(ptr, old, new) \
186({ \
187 __typeof__(*(ptr)) __res; \
188 \
189 /* \
190 * In the Loongson3 workaround case __cmpxchg_asm() already \
191 * contains a completion barrier prior to the LL, so we don't \
192 * need to emit an extra one here. \
193 */ \
194 if (__SYNC_loongson3_war == 0) \
195 smp_mb__before_llsc(); \
196 \
197 __res = cmpxchg_local((ptr), (old), (new)); \
198 \
199 /* \
200 * In the Loongson3 workaround case __cmpxchg_asm() already \
201 * contains a completion barrier after the SC, so we don't \
202 * need to emit an extra one here. \
203 */ \
204 if (__SYNC_loongson3_war == 0) \
205 smp_llsc_mb(); \
206 \
207 __res; \
208})
209
210#ifdef CONFIG_64BIT
211#define cmpxchg64_local(ptr, o, n) \
212 ({ \
213 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
214 cmpxchg_local((ptr), (o), (n)); \
215 })
216
217#define cmpxchg64(ptr, o, n) \
218 ({ \
219 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
220 cmpxchg((ptr), (o), (n)); \
221 })
222#else
223
224# include <asm-generic/cmpxchg-local.h>
225# define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
226
227# ifdef CONFIG_SMP
228
229static inline unsigned long __cmpxchg64(volatile void *ptr,
230 unsigned long long old,
231 unsigned long long new)
232{
233 unsigned long long tmp, ret;
234 unsigned long flags;
235
236 /*
237 * The assembly below has to combine 32 bit values into a 64 bit
238 * register, and split 64 bit values from one register into two. If we
239 * were to take an interrupt in the middle of this we'd only save the
240 * least significant 32 bits of each register & probably clobber the
241 * most significant 32 bits of the 64 bit values we're using. In order
242 * to avoid this we must disable interrupts.
243 */
244 local_irq_save(flags);
245
246 asm volatile(
247 " .set push \n"
248 " .set " MIPS_ISA_ARCH_LEVEL " \n"
249 /* Load 64 bits from ptr */
250 " " __SYNC(full, loongson3_war) " \n"
251 "1: lld %L0, %3 # __cmpxchg64 \n"
252 " .set pop \n"
253 /*
254 * Split the 64 bit value we loaded into the 2 registers that hold the
255 * ret variable.
256 */
257 " dsra %M0, %L0, 32 \n"
258 " sll %L0, %L0, 0 \n"
259 /*
260 * Compare ret against old, breaking out of the loop if they don't
261 * match.
262 */
263 " bne %M0, %M4, 2f \n"
264 " bne %L0, %L4, 2f \n"
265 /*
266 * Combine the 32 bit halves from the 2 registers that hold the new
267 * variable into a single 64 bit register.
268 */
269# if MIPS_ISA_REV >= 2
270 " move %L1, %L5 \n"
271 " dins %L1, %M5, 32, 32 \n"
272# else
273 " dsll %L1, %L5, 32 \n"
274 " dsrl %L1, %L1, 32 \n"
275 " .set noat \n"
276 " dsll $at, %M5, 32 \n"
277 " or %L1, %L1, $at \n"
278 " .set at \n"
279# endif
280 " .set push \n"
281 " .set " MIPS_ISA_ARCH_LEVEL " \n"
282 /* Attempt to store new at ptr */
283 " scd %L1, %2 \n"
284 /* If we failed, loop! */
285 "\t" __SC_BEQZ "%L1, 1b \n"
286 "2: " __SYNC(full, loongson3_war) " \n"
287 " .set pop \n"
288 : "=&r"(ret),
289 "=&r"(tmp),
290 "=" GCC_OFF_SMALL_ASM() (*(unsigned long long *)ptr)
291 : GCC_OFF_SMALL_ASM() (*(unsigned long long *)ptr),
292 "r" (old),
293 "r" (new)
294 : "memory");
295
296 local_irq_restore(flags);
297 return ret;
298}
299
300# define cmpxchg64(ptr, o, n) ({ \
301 unsigned long long __old = (__typeof__(*(ptr)))(o); \
302 unsigned long long __new = (__typeof__(*(ptr)))(n); \
303 __typeof__(*(ptr)) __res; \
304 \
305 /* \
306 * We can only use cmpxchg64 if we know that the CPU supports \
307 * 64-bits, ie. lld & scd. Our call to __cmpxchg64_unsupported \
308 * will cause a build error unless cpu_has_64bits is a \
309 * compile-time constant 1. \
310 */ \
311 if (cpu_has_64bits && kernel_uses_llsc) { \
312 smp_mb__before_llsc(); \
313 __res = __cmpxchg64((ptr), __old, __new); \
314 smp_llsc_mb(); \
315 } else { \
316 __res = __cmpxchg64_unsupported(); \
317 } \
318 \
319 __res; \
320})
321
322# else /* !CONFIG_SMP */
323# define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
324# endif /* !CONFIG_SMP */
325#endif /* !CONFIG_64BIT */
326
327#endif /* __ASM_CMPXCHG_H */
diff --git a/arch/mips/include/asm/compat-signal.h b/arch/mips/include/asm/compat-signal.h
new file mode 100644
index 000000000..c3b7a2550
--- /dev/null
+++ b/arch/mips/include/asm/compat-signal.h
@@ -0,0 +1,29 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_COMPAT_SIGNAL_H
3#define __ASM_COMPAT_SIGNAL_H
4
5#include <linux/bug.h>
6#include <linux/compat.h>
7#include <linux/compiler.h>
8
9#include <asm/signal.h>
10#include <asm/siginfo.h>
11
12#include <linux/uaccess.h>
13
14static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d,
15 const sigset_t *s)
16{
17 BUILD_BUG_ON(sizeof(*d) != sizeof(*s));
18 BUILD_BUG_ON(_NSIG_WORDS != 2);
19
20 return put_compat_sigset(d, s, sizeof(*d));
21}
22
23static inline int __copy_conv_sigset_from_user(sigset_t *d,
24 const compat_sigset_t __user *s)
25{
26 return get_compat_sigset(d, s);
27}
28
29#endif /* __ASM_COMPAT_SIGNAL_H */
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
new file mode 100644
index 000000000..65975712a
--- /dev/null
+++ b/arch/mips/include/asm/compat.h
@@ -0,0 +1,191 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_COMPAT_H
3#define _ASM_COMPAT_H
4/*
5 * Architecture specific compatibility types
6 */
7#include <linux/thread_info.h>
8#include <linux/types.h>
9#include <asm/page.h>
10#include <asm/ptrace.h>
11
12#include <asm-generic/compat.h>
13
14#define COMPAT_USER_HZ 100
15#define COMPAT_UTS_MACHINE "mips\0\0\0"
16
17typedef s32 __compat_uid_t;
18typedef s32 __compat_gid_t;
19typedef __compat_uid_t __compat_uid32_t;
20typedef __compat_gid_t __compat_gid32_t;
21typedef u32 compat_mode_t;
22typedef u32 compat_dev_t;
23typedef u32 compat_nlink_t;
24typedef s32 compat_ipc_pid_t;
25typedef s32 compat_caddr_t;
26typedef struct {
27 s32 val[2];
28} compat_fsid_t;
29
30struct compat_stat {
31 compat_dev_t st_dev;
32 s32 st_pad1[3];
33 compat_ino_t st_ino;
34 compat_mode_t st_mode;
35 compat_nlink_t st_nlink;
36 __compat_uid_t st_uid;
37 __compat_gid_t st_gid;
38 compat_dev_t st_rdev;
39 s32 st_pad2[2];
40 compat_off_t st_size;
41 s32 st_pad3;
42 old_time32_t st_atime;
43 s32 st_atime_nsec;
44 old_time32_t st_mtime;
45 s32 st_mtime_nsec;
46 old_time32_t st_ctime;
47 s32 st_ctime_nsec;
48 s32 st_blksize;
49 s32 st_blocks;
50 s32 st_pad4[14];
51};
52
53struct compat_flock {
54 short l_type;
55 short l_whence;
56 compat_off_t l_start;
57 compat_off_t l_len;
58 s32 l_sysid;
59 compat_pid_t l_pid;
60 s32 pad[4];
61};
62
63#define F_GETLK64 33
64#define F_SETLK64 34
65#define F_SETLKW64 35
66
67struct compat_flock64 {
68 short l_type;
69 short l_whence;
70 compat_loff_t l_start;
71 compat_loff_t l_len;
72 compat_pid_t l_pid;
73};
74
75struct compat_statfs {
76 int f_type;
77 int f_bsize;
78 int f_frsize;
79 int f_blocks;
80 int f_bfree;
81 int f_files;
82 int f_ffree;
83 int f_bavail;
84 compat_fsid_t f_fsid;
85 int f_namelen;
86 int f_flags;
87 int f_spare[5];
88};
89
90#define COMPAT_RLIM_INFINITY 0x7fffffffUL
91
92typedef u32 compat_old_sigset_t; /* at least 32 bits */
93
94#define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
95#define _COMPAT_NSIG_BPW 32
96
97typedef u32 compat_sigset_word;
98
99#define COMPAT_OFF_T_MAX 0x7fffffff
100
101static inline void __user *arch_compat_alloc_user_space(long len)
102{
103 struct pt_regs *regs = (struct pt_regs *)
104 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
105
106 return (void __user *) (regs->regs[29] - len);
107}
108
109struct compat_ipc64_perm {
110 compat_key_t key;
111 __compat_uid32_t uid;
112 __compat_gid32_t gid;
113 __compat_uid32_t cuid;
114 __compat_gid32_t cgid;
115 compat_mode_t mode;
116 unsigned short seq;
117 unsigned short __pad2;
118 compat_ulong_t __unused1;
119 compat_ulong_t __unused2;
120};
121
122struct compat_semid64_ds {
123 struct compat_ipc64_perm sem_perm;
124 compat_ulong_t sem_otime;
125 compat_ulong_t sem_ctime;
126 compat_ulong_t sem_nsems;
127 compat_ulong_t sem_otime_high;
128 compat_ulong_t sem_ctime_high;
129};
130
131struct compat_msqid64_ds {
132 struct compat_ipc64_perm msg_perm;
133#ifndef CONFIG_CPU_LITTLE_ENDIAN
134 compat_ulong_t msg_stime_high;
135#endif
136 compat_ulong_t msg_stime;
137#ifdef CONFIG_CPU_LITTLE_ENDIAN
138 compat_ulong_t msg_stime_high;
139#endif
140#ifndef CONFIG_CPU_LITTLE_ENDIAN
141 compat_ulong_t msg_rtime_high;
142#endif
143 compat_ulong_t msg_rtime;
144#ifdef CONFIG_CPU_LITTLE_ENDIAN
145 compat_ulong_t msg_rtime_high;
146#endif
147#ifndef CONFIG_CPU_LITTLE_ENDIAN
148 compat_ulong_t msg_ctime_high;
149#endif
150 compat_ulong_t msg_ctime;
151#ifdef CONFIG_CPU_LITTLE_ENDIAN
152 compat_ulong_t msg_ctime_high;
153#endif
154 compat_ulong_t msg_cbytes;
155 compat_ulong_t msg_qnum;
156 compat_ulong_t msg_qbytes;
157 compat_pid_t msg_lspid;
158 compat_pid_t msg_lrpid;
159 compat_ulong_t __unused4;
160 compat_ulong_t __unused5;
161};
162
163struct compat_shmid64_ds {
164 struct compat_ipc64_perm shm_perm;
165 compat_size_t shm_segsz;
166 compat_ulong_t shm_atime;
167 compat_ulong_t shm_dtime;
168 compat_ulong_t shm_ctime;
169 compat_pid_t shm_cpid;
170 compat_pid_t shm_lpid;
171 compat_ulong_t shm_nattch;
172 compat_ushort_t shm_atime_high;
173 compat_ushort_t shm_dtime_high;
174 compat_ushort_t shm_ctime_high;
175 compat_ushort_t __unused2;
176};
177
178/* MIPS has unusual order of fields in stack_t */
179typedef struct compat_sigaltstack {
180 compat_uptr_t ss_sp;
181 compat_size_t ss_size;
182 int ss_flags;
183} compat_stack_t;
184#define compat_sigaltstack compat_sigaltstack
185
186static inline int is_compat_task(void)
187{
188 return test_thread_flag(TIF_32BIT_ADDR);
189}
190
191#endif /* _ASM_COMPAT_H */
diff --git a/arch/mips/include/asm/compiler.h b/arch/mips/include/asm/compiler.h
new file mode 100644
index 000000000..a2cb2d2b1
--- /dev/null
+++ b/arch/mips/include/asm/compiler.h
@@ -0,0 +1,73 @@
1/*
2 * Copyright (C) 2004, 2007 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/*
12 * With GCC 4.5 onwards we can use __builtin_unreachable to indicate to the
13 * compiler that a particular code path will never be hit. This allows it to be
14 * optimised out of the generated binary.
15 *
16 * Unfortunately at least GCC 4.6.3 through 7.3.0 inclusive suffer from a bug
17 * that can lead to instructions from beyond an unreachable statement being
18 * incorrectly reordered into earlier delay slots if the unreachable statement
19 * is the only content of a case in a switch statement. This can lead to
20 * seemingly random behaviour, such as invalid memory accesses from incorrectly
21 * reordered loads or stores. See this potential GCC fix for details:
22 *
23 * https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00360.html
24 *
25 * It is unclear whether GCC 8 onwards suffer from the same issue - nothing
26 * relevant is mentioned in GCC 8 release notes and nothing obviously relevant
27 * stands out in GCC commit logs, but these newer GCC versions generate very
28 * different code for the testcase which doesn't exhibit the bug.
29 *
30 * GCC also handles stack allocation suboptimally when calling noreturn
31 * functions or calling __builtin_unreachable():
32 *
33 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365
34 *
35 * We work around both of these issues by placing a volatile asm statement,
36 * which GCC is prevented from reordering past, prior to __builtin_unreachable
37 * calls.
38 *
39 * The .insn statement is required to ensure that any branches to the
40 * statement, which sadly must be kept due to the asm statement, are known to
41 * be branches to code and satisfy linker requirements for microMIPS kernels.
42 */
43#undef barrier_before_unreachable
44#define barrier_before_unreachable() asm volatile(".insn")
45
46#if !defined(CONFIG_CC_IS_GCC) || \
47 (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
48# define GCC_OFF_SMALL_ASM() "ZC"
49#elif defined(CONFIG_CPU_MICROMIPS)
50# error "microMIPS compilation unsupported with GCC older than 4.9"
51#else
52# define GCC_OFF_SMALL_ASM() "R"
53#endif
54
55#ifdef CONFIG_CPU_MIPSR6
56#define MIPS_ISA_LEVEL "mips64r6"
57#define MIPS_ISA_ARCH_LEVEL MIPS_ISA_LEVEL
58#define MIPS_ISA_LEVEL_RAW mips64r6
59#define MIPS_ISA_ARCH_LEVEL_RAW MIPS_ISA_LEVEL_RAW
60#elif defined(CONFIG_CPU_MIPSR5)
61#define MIPS_ISA_LEVEL "mips64r5"
62#define MIPS_ISA_ARCH_LEVEL MIPS_ISA_LEVEL
63#define MIPS_ISA_LEVEL_RAW mips64r5
64#define MIPS_ISA_ARCH_LEVEL_RAW MIPS_ISA_LEVEL_RAW
65#else
66/* MIPS64 is a superset of MIPS32 */
67#define MIPS_ISA_LEVEL "mips64r2"
68#define MIPS_ISA_ARCH_LEVEL "arch=r4000"
69#define MIPS_ISA_LEVEL_RAW mips64r2
70#define MIPS_ISA_ARCH_LEVEL_RAW MIPS_ISA_LEVEL_RAW
71#endif /* CONFIG_CPU_MIPSR6 */
72
73#endif /* _ASM_COMPILER_H */
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h
new file mode 100644
index 000000000..6b7396a6a
--- /dev/null
+++ b/arch/mips/include/asm/cop2.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) 2009 Wind River Systems,
7 * written by Ralf Baechle <ralf@linux-mips.org>
8 */
9#ifndef __ASM_COP2_H
10#define __ASM_COP2_H
11
12#include <linux/notifier.h>
13
14#if defined(CONFIG_CPU_CAVIUM_OCTEON)
15
16extern void octeon_cop2_save(struct octeon_cop2_state *);
17extern void octeon_cop2_restore(struct octeon_cop2_state *);
18
19#define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2)
20#define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2)
21
22#define cop2_present 1
23#define cop2_lazy_restore 1
24
25#elif defined(CONFIG_CPU_XLP)
26
27extern void nlm_cop2_save(struct nlm_cop2_state *);
28extern void nlm_cop2_restore(struct nlm_cop2_state *);
29
30#define cop2_save(r) nlm_cop2_save(&(r)->thread.cp2)
31#define cop2_restore(r) nlm_cop2_restore(&(r)->thread.cp2)
32
33#define cop2_present 1
34#define cop2_lazy_restore 0
35
36#elif defined(CONFIG_CPU_LOONGSON64)
37
38#define cop2_present 1
39#define cop2_lazy_restore 1
40#define cop2_save(r) do { (void)(r); } while (0)
41#define cop2_restore(r) do { (void)(r); } while (0)
42
43#else
44
45#define cop2_present 0
46#define cop2_lazy_restore 0
47#define cop2_save(r) do { (void)(r); } while (0)
48#define cop2_restore(r) do { (void)(r); } while (0)
49#endif
50
51enum cu2_ops {
52 CU2_EXCEPTION,
53 CU2_LWC2_OP,
54 CU2_LDC2_OP,
55 CU2_SWC2_OP,
56 CU2_SDC2_OP,
57};
58
59extern int register_cu2_notifier(struct notifier_block *nb);
60extern int cu2_notifier_call_chain(unsigned long val, void *v);
61
62#define cu2_notifier(fn, pri) \
63({ \
64 static struct notifier_block fn##_nb = { \
65 .notifier_call = fn, \
66 .priority = pri \
67 }; \
68 \
69 register_cu2_notifier(&fn##_nb); \
70})
71
72#endif /* __ASM_COP2_H */
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
new file mode 100644
index 000000000..8294eaa6f
--- /dev/null
+++ b/arch/mips/include/asm/cpu-features.h
@@ -0,0 +1,739 @@
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 * Copyright (C) 2004 Maciej W. Rozycki
8 */
9#ifndef __ASM_CPU_FEATURES_H
10#define __ASM_CPU_FEATURES_H
11
12#include <asm/cpu.h>
13#include <asm/cpu-info.h>
14#include <asm/isa-rev.h>
15#include <cpu-feature-overrides.h>
16
17#define __ase(ase) (cpu_data[0].ases & (ase))
18#define __isa(isa) (cpu_data[0].isa_level & (isa))
19#define __opt(opt) (cpu_data[0].options & (opt))
20
21/*
22 * Check if MIPS_ISA_REV is >= isa *and* an option or ASE is detected during
23 * boot (typically by cpu_probe()).
24 *
25 * Note that these should only be used in cases where a kernel built for an
26 * older ISA *cannot* run on a CPU which supports the feature in question. For
27 * example this may be used for features introduced with MIPSr6, since a kernel
28 * built for an older ISA cannot run on a MIPSr6 CPU. This should not be used
29 * for MIPSr2 features however, since a MIPSr1 or earlier kernel might run on a
30 * MIPSr2 CPU.
31 */
32#define __isa_ge_and_ase(isa, ase) ((MIPS_ISA_REV >= (isa)) && __ase(ase))
33#define __isa_ge_and_opt(isa, opt) ((MIPS_ISA_REV >= (isa)) && __opt(opt))
34
35/*
36 * Check if MIPS_ISA_REV is >= isa *or* an option or ASE is detected during
37 * boot (typically by cpu_probe()).
38 *
39 * These are for use with features that are optional up until a particular ISA
40 * revision & then become required.
41 */
42#define __isa_ge_or_ase(isa, ase) ((MIPS_ISA_REV >= (isa)) || __ase(ase))
43#define __isa_ge_or_opt(isa, opt) ((MIPS_ISA_REV >= (isa)) || __opt(opt))
44
45/*
46 * Check if MIPS_ISA_REV is < isa *and* an option or ASE is detected during
47 * boot (typically by cpu_probe()).
48 *
49 * These are for use with features that are optional up until a particular ISA
50 * revision & are then removed - ie. no longer present in any CPU implementing
51 * the given ISA revision.
52 */
53#define __isa_lt_and_ase(isa, ase) ((MIPS_ISA_REV < (isa)) && __ase(ase))
54#define __isa_lt_and_opt(isa, opt) ((MIPS_ISA_REV < (isa)) && __opt(opt))
55
56/*
57 * Similarly allow for ISA level checks that take into account knowledge of the
58 * ISA targeted by the kernel build, provided by MIPS_ISA_REV.
59 */
60#define __isa_ge_and_flag(isa, flag) ((MIPS_ISA_REV >= (isa)) && __isa(flag))
61#define __isa_ge_or_flag(isa, flag) ((MIPS_ISA_REV >= (isa)) || __isa(flag))
62#define __isa_lt_and_flag(isa, flag) ((MIPS_ISA_REV < (isa)) && __isa(flag))
63#define __isa_range(ge, lt) \
64 ((MIPS_ISA_REV >= (ge)) && (MIPS_ISA_REV < (lt)))
65#define __isa_range_or_flag(ge, lt, flag) \
66 (__isa_range(ge, lt) || ((MIPS_ISA_REV < (lt)) && __isa(flag)))
67#define __isa_range_and_ase(ge, lt, ase) \
68 (__isa_range(ge, lt) && __ase(ase))
69
70/*
71 * SMP assumption: Options of CPU 0 are a superset of all processors.
72 * This is true for all known MIPS systems.
73 */
74#ifndef cpu_has_tlb
75#define cpu_has_tlb __opt(MIPS_CPU_TLB)
76#endif
77#ifndef cpu_has_ftlb
78#define cpu_has_ftlb __opt(MIPS_CPU_FTLB)
79#endif
80#ifndef cpu_has_tlbinv
81#define cpu_has_tlbinv __opt(MIPS_CPU_TLBINV)
82#endif
83#ifndef cpu_has_segments
84#define cpu_has_segments __opt(MIPS_CPU_SEGMENTS)
85#endif
86#ifndef cpu_has_eva
87#define cpu_has_eva __opt(MIPS_CPU_EVA)
88#endif
89#ifndef cpu_has_htw
90#define cpu_has_htw __opt(MIPS_CPU_HTW)
91#endif
92#ifndef cpu_has_ldpte
93#define cpu_has_ldpte __opt(MIPS_CPU_LDPTE)
94#endif
95#ifndef cpu_has_rixiex
96#define cpu_has_rixiex __isa_ge_or_opt(6, MIPS_CPU_RIXIEX)
97#endif
98#ifndef cpu_has_maar
99#define cpu_has_maar __opt(MIPS_CPU_MAAR)
100#endif
101#ifndef cpu_has_rw_llb
102#define cpu_has_rw_llb __isa_ge_or_opt(6, MIPS_CPU_RW_LLB)
103#endif
104
105/*
106 * For the moment we don't consider R6000 and R8000 so we can assume that
107 * anything that doesn't support R4000-style exceptions and interrupts is
108 * R3000-like. Users should still treat these two macro definitions as
109 * opaque.
110 */
111#ifndef cpu_has_3kex
112#define cpu_has_3kex (!cpu_has_4kex)
113#endif
114#ifndef cpu_has_4kex
115#define cpu_has_4kex __isa_ge_or_opt(1, MIPS_CPU_4KEX)
116#endif
117#ifndef cpu_has_3k_cache
118#define cpu_has_3k_cache __isa_lt_and_opt(1, MIPS_CPU_3K_CACHE)
119#endif
120#define cpu_has_6k_cache 0
121#define cpu_has_8k_cache 0
122#ifndef cpu_has_4k_cache
123#define cpu_has_4k_cache __isa_ge_or_opt(1, MIPS_CPU_4K_CACHE)
124#endif
125#ifndef cpu_has_tx39_cache
126#define cpu_has_tx39_cache __opt(MIPS_CPU_TX39_CACHE)
127#endif
128#ifndef cpu_has_octeon_cache
129#define cpu_has_octeon_cache 0
130#endif
131/* Don't override `cpu_has_fpu' to 1 or the "nofpu" option won't work. */
132#ifndef cpu_has_fpu
133# ifdef CONFIG_MIPS_FP_SUPPORT
134# define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU)
135# define raw_cpu_has_fpu (raw_current_cpu_data.options & MIPS_CPU_FPU)
136# else
137# define cpu_has_fpu 0
138# define raw_cpu_has_fpu 0
139# endif
140#else
141# define raw_cpu_has_fpu cpu_has_fpu
142#endif
143#ifndef cpu_has_32fpr
144#define cpu_has_32fpr __isa_ge_or_opt(1, MIPS_CPU_32FPR)
145#endif
146#ifndef cpu_has_counter
147#define cpu_has_counter __opt(MIPS_CPU_COUNTER)
148#endif
149#ifndef cpu_has_watch
150#define cpu_has_watch __opt(MIPS_CPU_WATCH)
151#endif
152#ifndef cpu_has_divec
153#define cpu_has_divec __isa_ge_or_opt(1, MIPS_CPU_DIVEC)
154#endif
155#ifndef cpu_has_vce
156#define cpu_has_vce __opt(MIPS_CPU_VCE)
157#endif
158#ifndef cpu_has_cache_cdex_p
159#define cpu_has_cache_cdex_p __opt(MIPS_CPU_CACHE_CDEX_P)
160#endif
161#ifndef cpu_has_cache_cdex_s
162#define cpu_has_cache_cdex_s __opt(MIPS_CPU_CACHE_CDEX_S)
163#endif
164#ifndef cpu_has_prefetch
165#define cpu_has_prefetch __isa_ge_or_opt(1, MIPS_CPU_PREFETCH)
166#endif
167#ifndef cpu_has_mcheck
168#define cpu_has_mcheck __isa_ge_or_opt(1, MIPS_CPU_MCHECK)
169#endif
170#ifndef cpu_has_ejtag
171#define cpu_has_ejtag __opt(MIPS_CPU_EJTAG)
172#endif
173#ifndef cpu_has_llsc
174#define cpu_has_llsc __isa_ge_or_opt(1, MIPS_CPU_LLSC)
175#endif
176#ifndef kernel_uses_llsc
177#define kernel_uses_llsc cpu_has_llsc
178#endif
179#ifndef cpu_has_guestctl0ext
180#define cpu_has_guestctl0ext __opt(MIPS_CPU_GUESTCTL0EXT)
181#endif
182#ifndef cpu_has_guestctl1
183#define cpu_has_guestctl1 __opt(MIPS_CPU_GUESTCTL1)
184#endif
185#ifndef cpu_has_guestctl2
186#define cpu_has_guestctl2 __opt(MIPS_CPU_GUESTCTL2)
187#endif
188#ifndef cpu_has_guestid
189#define cpu_has_guestid __opt(MIPS_CPU_GUESTID)
190#endif
191#ifndef cpu_has_drg
192#define cpu_has_drg __opt(MIPS_CPU_DRG)
193#endif
194#ifndef cpu_has_mips16
195#define cpu_has_mips16 __isa_lt_and_ase(6, MIPS_ASE_MIPS16)
196#endif
197#ifndef cpu_has_mips16e2
198#define cpu_has_mips16e2 __isa_lt_and_ase(6, MIPS_ASE_MIPS16E2)
199#endif
200#ifndef cpu_has_mdmx
201#define cpu_has_mdmx __isa_lt_and_ase(6, MIPS_ASE_MDMX)
202#endif
203#ifndef cpu_has_mips3d
204#define cpu_has_mips3d __isa_lt_and_ase(6, MIPS_ASE_MIPS3D)
205#endif
206#ifndef cpu_has_smartmips
207#define cpu_has_smartmips __isa_lt_and_ase(6, MIPS_ASE_SMARTMIPS)
208#endif
209
210#ifndef cpu_has_rixi
211#define cpu_has_rixi __isa_ge_or_opt(6, MIPS_CPU_RIXI)
212#endif
213
214#ifndef cpu_has_mmips
215# if defined(__mips_micromips)
216# define cpu_has_mmips 1
217# elif defined(CONFIG_SYS_SUPPORTS_MICROMIPS)
218# define cpu_has_mmips __opt(MIPS_CPU_MICROMIPS)
219# else
220# define cpu_has_mmips 0
221# endif
222#endif
223
224#ifndef cpu_has_lpa
225#define cpu_has_lpa __opt(MIPS_CPU_LPA)
226#endif
227#ifndef cpu_has_mvh
228#define cpu_has_mvh __opt(MIPS_CPU_MVH)
229#endif
230#ifndef cpu_has_xpa
231#define cpu_has_xpa (cpu_has_lpa && cpu_has_mvh)
232#endif
233#ifndef cpu_has_vtag_icache
234#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG)
235#endif
236#ifndef cpu_has_dc_aliases
237#define cpu_has_dc_aliases (cpu_data[0].dcache.flags & MIPS_CACHE_ALIASES)
238#endif
239#ifndef cpu_has_ic_fills_f_dc
240#define cpu_has_ic_fills_f_dc (cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC)
241#endif
242#ifndef cpu_has_pindexed_dcache
243#define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
244#endif
245
246/*
247 * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors
248 * such as the R10000 have I-Caches that snoop local stores; the embedded ones
249 * don't. For maintaining I-cache coherency this means we need to flush the
250 * D-cache all the way back to whever the I-cache does refills from, so the
251 * I-cache has a chance to see the new data at all. Then we have to flush the
252 * I-cache also.
253 * Note we may have been rescheduled and may no longer be running on the CPU
254 * that did the store so we can't optimize this into only doing the flush on
255 * the local CPU.
256 */
257#ifndef cpu_icache_snoops_remote_store
258#ifdef CONFIG_SMP
259#define cpu_icache_snoops_remote_store (cpu_data[0].icache.flags & MIPS_IC_SNOOPS_REMOTE)
260#else
261#define cpu_icache_snoops_remote_store 1
262#endif
263#endif
264
265#ifndef cpu_has_mips_1
266# define cpu_has_mips_1 (MIPS_ISA_REV < 6)
267#endif
268#ifndef cpu_has_mips_2
269# define cpu_has_mips_2 __isa_lt_and_flag(6, MIPS_CPU_ISA_II)
270#endif
271#ifndef cpu_has_mips_3
272# define cpu_has_mips_3 __isa_lt_and_flag(6, MIPS_CPU_ISA_III)
273#endif
274#ifndef cpu_has_mips_4
275# define cpu_has_mips_4 __isa_lt_and_flag(6, MIPS_CPU_ISA_IV)
276#endif
277#ifndef cpu_has_mips_5
278# define cpu_has_mips_5 __isa_lt_and_flag(6, MIPS_CPU_ISA_V)
279#endif
280#ifndef cpu_has_mips32r1
281# define cpu_has_mips32r1 __isa_range_or_flag(1, 6, MIPS_CPU_ISA_M32R1)
282#endif
283#ifndef cpu_has_mips32r2
284# define cpu_has_mips32r2 __isa_range_or_flag(2, 6, MIPS_CPU_ISA_M32R2)
285#endif
286#ifndef cpu_has_mips32r5
287# define cpu_has_mips32r5 __isa_range_or_flag(5, 6, MIPS_CPU_ISA_M32R5)
288#endif
289#ifndef cpu_has_mips32r6
290# define cpu_has_mips32r6 __isa_ge_or_flag(6, MIPS_CPU_ISA_M32R6)
291#endif
292#ifndef cpu_has_mips64r1
293# define cpu_has_mips64r1 (cpu_has_64bits && \
294 __isa_range_or_flag(1, 6, MIPS_CPU_ISA_M64R1))
295#endif
296#ifndef cpu_has_mips64r2
297# define cpu_has_mips64r2 (cpu_has_64bits && \
298 __isa_range_or_flag(2, 6, MIPS_CPU_ISA_M64R2))
299#endif
300#ifndef cpu_has_mips64r5
301# define cpu_has_mips64r5 (cpu_has_64bits && \
302 __isa_range_or_flag(5, 6, MIPS_CPU_ISA_M64R5))
303#endif
304#ifndef cpu_has_mips64r6
305# define cpu_has_mips64r6 __isa_ge_and_flag(6, MIPS_CPU_ISA_M64R6)
306#endif
307
308/*
309 * Shortcuts ...
310 */
311#define cpu_has_mips_2_3_4_5 (cpu_has_mips_2 | cpu_has_mips_3_4_5)
312#define cpu_has_mips_3_4_5 (cpu_has_mips_3 | cpu_has_mips_4_5)
313#define cpu_has_mips_4_5 (cpu_has_mips_4 | cpu_has_mips_5)
314
315#define cpu_has_mips_2_3_4_5_r (cpu_has_mips_2 | cpu_has_mips_3_4_5_r)
316#define cpu_has_mips_3_4_5_r (cpu_has_mips_3 | cpu_has_mips_4_5_r)
317#define cpu_has_mips_4_5_r (cpu_has_mips_4 | cpu_has_mips_5_r)
318#define cpu_has_mips_5_r (cpu_has_mips_5 | cpu_has_mips_r)
319
320#define cpu_has_mips_3_4_5_64_r2_r6 \
321 (cpu_has_mips_3 | cpu_has_mips_4_5_64_r2_r6)
322#define cpu_has_mips_4_5_64_r2_r6 \
323 (cpu_has_mips_4_5 | cpu_has_mips64r1 | \
324 cpu_has_mips_r2 | cpu_has_mips_r5 | \
325 cpu_has_mips_r6)
326
327#define cpu_has_mips32 (cpu_has_mips32r1 | cpu_has_mips32r2 | \
328 cpu_has_mips32r5 | cpu_has_mips32r6)
329#define cpu_has_mips64 (cpu_has_mips64r1 | cpu_has_mips64r2 | \
330 cpu_has_mips64r5 | cpu_has_mips64r6)
331#define cpu_has_mips_r1 (cpu_has_mips32r1 | cpu_has_mips64r1)
332#define cpu_has_mips_r2 (cpu_has_mips32r2 | cpu_has_mips64r2)
333#define cpu_has_mips_r5 (cpu_has_mips32r5 | cpu_has_mips64r5)
334#define cpu_has_mips_r6 (cpu_has_mips32r6 | cpu_has_mips64r6)
335#define cpu_has_mips_r (cpu_has_mips32r1 | cpu_has_mips32r2 | \
336 cpu_has_mips32r5 | cpu_has_mips32r6 | \
337 cpu_has_mips64r1 | cpu_has_mips64r2 | \
338 cpu_has_mips64r5 | cpu_has_mips64r6)
339
340/* MIPSR2 - MIPSR6 have a lot of similarities */
341#define cpu_has_mips_r2_r6 (cpu_has_mips_r2 | cpu_has_mips_r5 | \
342 cpu_has_mips_r6)
343
344/*
345 * cpu_has_mips_r2_exec_hazard - return if IHB is required on current processor
346 *
347 * Returns non-zero value if the current processor implementation requires
348 * an IHB instruction to deal with an instruction hazard as per MIPS R2
349 * architecture specification, zero otherwise.
350 */
351#ifndef cpu_has_mips_r2_exec_hazard
352#define cpu_has_mips_r2_exec_hazard \
353({ \
354 int __res; \
355 \
356 switch (current_cpu_type()) { \
357 case CPU_M14KC: \
358 case CPU_74K: \
359 case CPU_1074K: \
360 case CPU_PROAPTIV: \
361 case CPU_P5600: \
362 case CPU_M5150: \
363 case CPU_QEMU_GENERIC: \
364 case CPU_CAVIUM_OCTEON: \
365 case CPU_CAVIUM_OCTEON_PLUS: \
366 case CPU_CAVIUM_OCTEON2: \
367 case CPU_CAVIUM_OCTEON3: \
368 __res = 0; \
369 break; \
370 \
371 default: \
372 __res = 1; \
373 } \
374 \
375 __res; \
376})
377#endif
378
379/*
380 * MIPS32, MIPS64, VR5500, IDT32332, IDT32334 and maybe a few other
381 * pre-MIPS32/MIPS64 processors have CLO, CLZ. The IDT RC64574 is 64-bit and
382 * has CLO and CLZ but not DCLO nor DCLZ. For 64-bit kernels
383 * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ.
384 */
385#ifndef cpu_has_clo_clz
386#define cpu_has_clo_clz cpu_has_mips_r
387#endif
388
389/*
390 * MIPS32 R2, MIPS64 R2, Loongson 3A and Octeon have WSBH.
391 * MIPS64 R2, Loongson 3A and Octeon have WSBH, DSBH and DSHD.
392 * This indicates the availability of WSBH and in case of 64 bit CPUs also
393 * DSBH and DSHD.
394 */
395#ifndef cpu_has_wsbh
396#define cpu_has_wsbh cpu_has_mips_r2
397#endif
398
399#ifndef cpu_has_dsp
400#define cpu_has_dsp __ase(MIPS_ASE_DSP)
401#endif
402
403#ifndef cpu_has_dsp2
404#define cpu_has_dsp2 __ase(MIPS_ASE_DSP2P)
405#endif
406
407#ifndef cpu_has_dsp3
408#define cpu_has_dsp3 __ase(MIPS_ASE_DSP3)
409#endif
410
411#ifndef cpu_has_loongson_mmi
412#define cpu_has_loongson_mmi __ase(MIPS_ASE_LOONGSON_MMI)
413#endif
414
415#ifndef cpu_has_loongson_cam
416#define cpu_has_loongson_cam __ase(MIPS_ASE_LOONGSON_CAM)
417#endif
418
419#ifndef cpu_has_loongson_ext
420#define cpu_has_loongson_ext __ase(MIPS_ASE_LOONGSON_EXT)
421#endif
422
423#ifndef cpu_has_loongson_ext2
424#define cpu_has_loongson_ext2 __ase(MIPS_ASE_LOONGSON_EXT2)
425#endif
426
427#ifndef cpu_has_mipsmt
428#define cpu_has_mipsmt __isa_range_and_ase(2, 6, MIPS_ASE_MIPSMT)
429#endif
430
431#ifndef cpu_has_vp
432#define cpu_has_vp __isa_ge_and_opt(6, MIPS_CPU_VP)
433#endif
434
435#ifndef cpu_has_userlocal
436#define cpu_has_userlocal __isa_ge_or_opt(6, MIPS_CPU_ULRI)
437#endif
438
439#ifdef CONFIG_32BIT
440# ifndef cpu_has_nofpuex
441# define cpu_has_nofpuex __isa_lt_and_opt(1, MIPS_CPU_NOFPUEX)
442# endif
443# ifndef cpu_has_64bits
444# define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
445# endif
446# ifndef cpu_has_64bit_zero_reg
447# define cpu_has_64bit_zero_reg (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
448# endif
449# ifndef cpu_has_64bit_gp_regs
450# define cpu_has_64bit_gp_regs 0
451# endif
452# ifndef cpu_vmbits
453# define cpu_vmbits 31
454# endif
455#endif
456
457#ifdef CONFIG_64BIT
458# ifndef cpu_has_nofpuex
459# define cpu_has_nofpuex 0
460# endif
461# ifndef cpu_has_64bits
462# define cpu_has_64bits 1
463# endif
464# ifndef cpu_has_64bit_zero_reg
465# define cpu_has_64bit_zero_reg 1
466# endif
467# ifndef cpu_has_64bit_gp_regs
468# define cpu_has_64bit_gp_regs 1
469# endif
470# ifndef cpu_vmbits
471# define cpu_vmbits cpu_data[0].vmbits
472# define __NEED_VMBITS_PROBE
473# endif
474#endif
475
476#if defined(CONFIG_CPU_MIPSR2_IRQ_VI) && !defined(cpu_has_vint)
477# define cpu_has_vint __opt(MIPS_CPU_VINT)
478#elif !defined(cpu_has_vint)
479# define cpu_has_vint 0
480#endif
481
482#if defined(CONFIG_CPU_MIPSR2_IRQ_EI) && !defined(cpu_has_veic)
483# define cpu_has_veic __opt(MIPS_CPU_VEIC)
484#elif !defined(cpu_has_veic)
485# define cpu_has_veic 0
486#endif
487
488#ifndef cpu_has_inclusive_pcaches
489#define cpu_has_inclusive_pcaches __opt(MIPS_CPU_INCLUSIVE_CACHES)
490#endif
491
492#ifndef cpu_dcache_line_size
493#define cpu_dcache_line_size() cpu_data[0].dcache.linesz
494#endif
495#ifndef cpu_icache_line_size
496#define cpu_icache_line_size() cpu_data[0].icache.linesz
497#endif
498#ifndef cpu_scache_line_size
499#define cpu_scache_line_size() cpu_data[0].scache.linesz
500#endif
501#ifndef cpu_tcache_line_size
502#define cpu_tcache_line_size() cpu_data[0].tcache.linesz
503#endif
504
505#ifndef cpu_hwrena_impl_bits
506#define cpu_hwrena_impl_bits 0
507#endif
508
509#ifndef cpu_has_perf_cntr_intr_bit
510#define cpu_has_perf_cntr_intr_bit __opt(MIPS_CPU_PCI)
511#endif
512
513#ifndef cpu_has_vz
514#define cpu_has_vz __ase(MIPS_ASE_VZ)
515#endif
516
517#if defined(CONFIG_CPU_HAS_MSA) && !defined(cpu_has_msa)
518# define cpu_has_msa __ase(MIPS_ASE_MSA)
519#elif !defined(cpu_has_msa)
520# define cpu_has_msa 0
521#endif
522
523#ifndef cpu_has_ufr
524# define cpu_has_ufr __opt(MIPS_CPU_UFR)
525#endif
526
527#ifndef cpu_has_fre
528# define cpu_has_fre __opt(MIPS_CPU_FRE)
529#endif
530
531#ifndef cpu_has_cdmm
532# define cpu_has_cdmm __opt(MIPS_CPU_CDMM)
533#endif
534
535#ifndef cpu_has_small_pages
536# define cpu_has_small_pages __opt(MIPS_CPU_SP)
537#endif
538
539#ifndef cpu_has_nan_legacy
540#define cpu_has_nan_legacy __isa_lt_and_opt(6, MIPS_CPU_NAN_LEGACY)
541#endif
542#ifndef cpu_has_nan_2008
543#define cpu_has_nan_2008 __isa_ge_or_opt(6, MIPS_CPU_NAN_2008)
544#endif
545
546#ifndef cpu_has_ebase_wg
547# define cpu_has_ebase_wg __opt(MIPS_CPU_EBASE_WG)
548#endif
549
550#ifndef cpu_has_badinstr
551# define cpu_has_badinstr __isa_ge_or_opt(6, MIPS_CPU_BADINSTR)
552#endif
553
554#ifndef cpu_has_badinstrp
555# define cpu_has_badinstrp __isa_ge_or_opt(6, MIPS_CPU_BADINSTRP)
556#endif
557
558#ifndef cpu_has_contextconfig
559# define cpu_has_contextconfig __opt(MIPS_CPU_CTXTC)
560#endif
561
562#ifndef cpu_has_perf
563# define cpu_has_perf __opt(MIPS_CPU_PERF)
564#endif
565
566#ifndef cpu_has_mac2008_only
567# define cpu_has_mac2008_only __opt(MIPS_CPU_MAC_2008_ONLY)
568#endif
569
570#ifndef cpu_has_ftlbparex
571# define cpu_has_ftlbparex __opt(MIPS_CPU_FTLBPAREX)
572#endif
573
574#ifndef cpu_has_gsexcex
575# define cpu_has_gsexcex __opt(MIPS_CPU_GSEXCEX)
576#endif
577
578#ifdef CONFIG_SMP
579/*
580 * Some systems share FTLB RAMs between threads within a core (siblings in
581 * kernel parlance). This means that FTLB entries may become invalid at almost
582 * any point when an entry is evicted due to a sibling thread writing an entry
583 * to the shared FTLB RAM.
584 *
585 * This is only relevant to SMP systems, and the only systems that exhibit this
586 * property implement MIPSr6 or higher so we constrain support for this to
587 * kernels that will run on such systems.
588 */
589# ifndef cpu_has_shared_ftlb_ram
590# define cpu_has_shared_ftlb_ram \
591 __isa_ge_and_opt(6, MIPS_CPU_SHARED_FTLB_RAM)
592# endif
593
594/*
595 * Some systems take this a step further & share FTLB entries between siblings.
596 * This is implemented as TLB writes happening as usual, but if an entry
597 * written by a sibling exists in the shared FTLB for a translation which would
598 * otherwise cause a TLB refill exception then the CPU will use the entry
599 * written by its sibling rather than triggering a refill & writing a matching
600 * TLB entry for itself.
601 *
602 * This is naturally only valid if a TLB entry is known to be suitable for use
603 * on all siblings in a CPU, and so it only takes effect when MMIDs are in use
604 * rather than ASIDs or when a TLB entry is marked global.
605 */
606# ifndef cpu_has_shared_ftlb_entries
607# define cpu_has_shared_ftlb_entries \
608 __isa_ge_and_opt(6, MIPS_CPU_SHARED_FTLB_ENTRIES)
609# endif
610#endif /* SMP */
611
612#ifndef cpu_has_shared_ftlb_ram
613# define cpu_has_shared_ftlb_ram 0
614#endif
615#ifndef cpu_has_shared_ftlb_entries
616# define cpu_has_shared_ftlb_entries 0
617#endif
618
619#ifdef CONFIG_MIPS_MT_SMP
620# define cpu_has_mipsmt_pertccounters \
621 __isa_lt_and_opt(6, MIPS_CPU_MT_PER_TC_PERF_COUNTERS)
622#else
623# define cpu_has_mipsmt_pertccounters 0
624#endif /* CONFIG_MIPS_MT_SMP */
625
626/*
627 * We only enable MMID support for configurations which natively support 64 bit
628 * atomics because getting good performance from the allocator relies upon
629 * efficient atomic64_*() functions.
630 */
631#ifndef cpu_has_mmid
632# ifdef CONFIG_GENERIC_ATOMIC64
633# define cpu_has_mmid 0
634# else
635# define cpu_has_mmid __isa_ge_and_opt(6, MIPS_CPU_MMID)
636# endif
637#endif
638
639#ifndef cpu_has_mm_sysad
640# define cpu_has_mm_sysad __opt(MIPS_CPU_MM_SYSAD)
641#endif
642
643#ifndef cpu_has_mm_full
644# define cpu_has_mm_full __opt(MIPS_CPU_MM_FULL)
645#endif
646
647/*
648 * Guest capabilities
649 */
650#ifndef cpu_guest_has_conf1
651#define cpu_guest_has_conf1 (cpu_data[0].guest.conf & (1 << 1))
652#endif
653#ifndef cpu_guest_has_conf2
654#define cpu_guest_has_conf2 (cpu_data[0].guest.conf & (1 << 2))
655#endif
656#ifndef cpu_guest_has_conf3
657#define cpu_guest_has_conf3 (cpu_data[0].guest.conf & (1 << 3))
658#endif
659#ifndef cpu_guest_has_conf4
660#define cpu_guest_has_conf4 (cpu_data[0].guest.conf & (1 << 4))
661#endif
662#ifndef cpu_guest_has_conf5
663#define cpu_guest_has_conf5 (cpu_data[0].guest.conf & (1 << 5))
664#endif
665#ifndef cpu_guest_has_conf6
666#define cpu_guest_has_conf6 (cpu_data[0].guest.conf & (1 << 6))
667#endif
668#ifndef cpu_guest_has_conf7
669#define cpu_guest_has_conf7 (cpu_data[0].guest.conf & (1 << 7))
670#endif
671#ifndef cpu_guest_has_fpu
672#define cpu_guest_has_fpu (cpu_data[0].guest.options & MIPS_CPU_FPU)
673#endif
674#ifndef cpu_guest_has_watch
675#define cpu_guest_has_watch (cpu_data[0].guest.options & MIPS_CPU_WATCH)
676#endif
677#ifndef cpu_guest_has_contextconfig
678#define cpu_guest_has_contextconfig (cpu_data[0].guest.options & MIPS_CPU_CTXTC)
679#endif
680#ifndef cpu_guest_has_segments
681#define cpu_guest_has_segments (cpu_data[0].guest.options & MIPS_CPU_SEGMENTS)
682#endif
683#ifndef cpu_guest_has_badinstr
684#define cpu_guest_has_badinstr (cpu_data[0].guest.options & MIPS_CPU_BADINSTR)
685#endif
686#ifndef cpu_guest_has_badinstrp
687#define cpu_guest_has_badinstrp (cpu_data[0].guest.options & MIPS_CPU_BADINSTRP)
688#endif
689#ifndef cpu_guest_has_htw
690#define cpu_guest_has_htw (cpu_data[0].guest.options & MIPS_CPU_HTW)
691#endif
692#ifndef cpu_guest_has_ldpte
693#define cpu_guest_has_ldpte (cpu_data[0].guest.options & MIPS_CPU_LDPTE)
694#endif
695#ifndef cpu_guest_has_mvh
696#define cpu_guest_has_mvh (cpu_data[0].guest.options & MIPS_CPU_MVH)
697#endif
698#ifndef cpu_guest_has_msa
699#define cpu_guest_has_msa (cpu_data[0].guest.ases & MIPS_ASE_MSA)
700#endif
701#ifndef cpu_guest_has_kscr
702#define cpu_guest_has_kscr(n) (cpu_data[0].guest.kscratch_mask & (1u << (n)))
703#endif
704#ifndef cpu_guest_has_rw_llb
705#define cpu_guest_has_rw_llb (cpu_has_mips_r6 || (cpu_data[0].guest.options & MIPS_CPU_RW_LLB))
706#endif
707#ifndef cpu_guest_has_perf
708#define cpu_guest_has_perf (cpu_data[0].guest.options & MIPS_CPU_PERF)
709#endif
710#ifndef cpu_guest_has_maar
711#define cpu_guest_has_maar (cpu_data[0].guest.options & MIPS_CPU_MAAR)
712#endif
713#ifndef cpu_guest_has_userlocal
714#define cpu_guest_has_userlocal (cpu_data[0].guest.options & MIPS_CPU_ULRI)
715#endif
716
717/*
718 * Guest dynamic capabilities
719 */
720#ifndef cpu_guest_has_dyn_fpu
721#define cpu_guest_has_dyn_fpu (cpu_data[0].guest.options_dyn & MIPS_CPU_FPU)
722#endif
723#ifndef cpu_guest_has_dyn_watch
724#define cpu_guest_has_dyn_watch (cpu_data[0].guest.options_dyn & MIPS_CPU_WATCH)
725#endif
726#ifndef cpu_guest_has_dyn_contextconfig
727#define cpu_guest_has_dyn_contextconfig (cpu_data[0].guest.options_dyn & MIPS_CPU_CTXTC)
728#endif
729#ifndef cpu_guest_has_dyn_perf
730#define cpu_guest_has_dyn_perf (cpu_data[0].guest.options_dyn & MIPS_CPU_PERF)
731#endif
732#ifndef cpu_guest_has_dyn_msa
733#define cpu_guest_has_dyn_msa (cpu_data[0].guest.ases_dyn & MIPS_ASE_MSA)
734#endif
735#ifndef cpu_guest_has_dyn_maar
736#define cpu_guest_has_dyn_maar (cpu_data[0].guest.options_dyn & MIPS_CPU_MAAR)
737#endif
738
739#endif /* __ASM_CPU_FEATURES_H */
diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h
new file mode 100644
index 000000000..a600670d0
--- /dev/null
+++ b/arch/mips/include/asm/cpu-info.h
@@ -0,0 +1,219 @@
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 * Copyright (C) 2004 Maciej W. Rozycki
11 */
12#ifndef __ASM_CPU_INFO_H
13#define __ASM_CPU_INFO_H
14
15#include <linux/cache.h>
16#include <linux/types.h>
17
18#include <asm/mipsregs.h>
19
20/*
21 * Descriptor for a cache
22 */
23struct cache_desc {
24 unsigned int waysize; /* Bytes per way */
25 unsigned short sets; /* Number of lines per set */
26 unsigned char ways; /* Number of ways */
27 unsigned char linesz; /* Size of line in bytes */
28 unsigned char waybit; /* Bits to select in a cache set */
29 unsigned char flags; /* Flags describing cache properties */
30};
31
32struct guest_info {
33 unsigned long ases;
34 unsigned long ases_dyn;
35 unsigned long long options;
36 unsigned long long options_dyn;
37 int tlbsize;
38 u8 conf;
39 u8 kscratch_mask;
40};
41
42/*
43 * Flag definitions
44 */
45#define MIPS_CACHE_NOT_PRESENT 0x00000001
46#define MIPS_CACHE_VTAG 0x00000002 /* Virtually tagged cache */
47#define MIPS_CACHE_ALIASES 0x00000004 /* Cache could have aliases */
48#define MIPS_CACHE_IC_F_DC 0x00000008 /* Ic can refill from D-cache */
49#define MIPS_IC_SNOOPS_REMOTE 0x00000010 /* Ic snoops remote stores */
50#define MIPS_CACHE_PINDEX 0x00000020 /* Physically indexed cache */
51
52struct cpuinfo_mips {
53 u64 asid_cache;
54#ifdef CONFIG_MIPS_ASID_BITS_VARIABLE
55 unsigned long asid_mask;
56#endif
57
58 /*
59 * Capability and feature descriptor structure for MIPS CPU
60 */
61 unsigned long ases;
62 unsigned long long options;
63 unsigned int udelay_val;
64 unsigned int processor_id;
65 unsigned int fpu_id;
66 unsigned int fpu_csr31;
67 unsigned int fpu_msk31;
68 unsigned int msa_id;
69 unsigned int cputype;
70 int isa_level;
71 int tlbsize;
72 int tlbsizevtlb;
73 int tlbsizeftlbsets;
74 int tlbsizeftlbways;
75 struct cache_desc icache; /* Primary I-cache */
76 struct cache_desc dcache; /* Primary D or combined I/D cache */
77 struct cache_desc vcache; /* Victim cache, between pcache and scache */
78 struct cache_desc scache; /* Secondary cache */
79 struct cache_desc tcache; /* Tertiary/split secondary cache */
80 int srsets; /* Shadow register sets */
81 int package;/* physical package number */
82 unsigned int globalnumber;
83#ifdef CONFIG_64BIT
84 int vmbits; /* Virtual memory size in bits */
85#endif
86 void *data; /* Additional data */
87 unsigned int watch_reg_count; /* Number that exist */
88 unsigned int watch_reg_use_cnt; /* Usable by ptrace */
89#define NUM_WATCH_REGS 4
90 u16 watch_reg_masks[NUM_WATCH_REGS];
91 unsigned int kscratch_mask; /* Usable KScratch mask. */
92 /*
93 * Cache Coherency attribute for write-combine memory writes.
94 * (shifted by _CACHE_SHIFT)
95 */
96 unsigned int writecombine;
97 /*
98 * Simple counter to prevent enabling HTW in nested
99 * htw_start/htw_stop calls
100 */
101 unsigned int htw_seq;
102
103 /* VZ & Guest features */
104 struct guest_info guest;
105 unsigned int gtoffset_mask;
106 unsigned int guestid_mask;
107 unsigned int guestid_cache;
108
109#ifdef CONFIG_CPU_LOONGSON3_CPUCFG_EMULATION
110 /* CPUCFG data for this CPU, synthesized at probe time.
111 *
112 * CPUCFG select 0 is PRId, 4 and above are unimplemented for now.
113 * So the only stored values are for CPUCFG selects 1-3 inclusive.
114 */
115 u32 loongson3_cpucfg_data[3];
116#endif
117} __attribute__((aligned(SMP_CACHE_BYTES)));
118
119extern struct cpuinfo_mips cpu_data[];
120#define current_cpu_data cpu_data[smp_processor_id()]
121#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
122#define boot_cpu_data cpu_data[0]
123
124extern void cpu_probe(void);
125extern void cpu_report(void);
126
127extern const char *__cpu_name[];
128#define cpu_name_string() __cpu_name[raw_smp_processor_id()]
129
130struct seq_file;
131struct notifier_block;
132
133extern int register_proc_cpuinfo_notifier(struct notifier_block *nb);
134extern int proc_cpuinfo_notifier_call_chain(unsigned long val, void *v);
135
136#define proc_cpuinfo_notifier(fn, pri) \
137({ \
138 static struct notifier_block fn##_nb = { \
139 .notifier_call = fn, \
140 .priority = pri \
141 }; \
142 \
143 register_proc_cpuinfo_notifier(&fn##_nb); \
144})
145
146struct proc_cpuinfo_notifier_args {
147 struct seq_file *m;
148 unsigned long n;
149};
150
151static inline unsigned int cpu_cluster(struct cpuinfo_mips *cpuinfo)
152{
153 /* Optimisation for systems where multiple clusters aren't used */
154 if (!IS_ENABLED(CONFIG_CPU_MIPSR5) && !IS_ENABLED(CONFIG_CPU_MIPSR6))
155 return 0;
156
157 return (cpuinfo->globalnumber & MIPS_GLOBALNUMBER_CLUSTER) >>
158 MIPS_GLOBALNUMBER_CLUSTER_SHF;
159}
160
161static inline unsigned int cpu_core(struct cpuinfo_mips *cpuinfo)
162{
163 return (cpuinfo->globalnumber & MIPS_GLOBALNUMBER_CORE) >>
164 MIPS_GLOBALNUMBER_CORE_SHF;
165}
166
167static inline unsigned int cpu_vpe_id(struct cpuinfo_mips *cpuinfo)
168{
169 /* Optimisation for systems where VP(E)s aren't used */
170 if (!IS_ENABLED(CONFIG_MIPS_MT_SMP) && !IS_ENABLED(CONFIG_CPU_MIPSR6))
171 return 0;
172
173 return (cpuinfo->globalnumber & MIPS_GLOBALNUMBER_VP) >>
174 MIPS_GLOBALNUMBER_VP_SHF;
175}
176
177extern void cpu_set_cluster(struct cpuinfo_mips *cpuinfo, unsigned int cluster);
178extern void cpu_set_core(struct cpuinfo_mips *cpuinfo, unsigned int core);
179extern void cpu_set_vpe_id(struct cpuinfo_mips *cpuinfo, unsigned int vpe);
180
181static inline bool cpus_are_siblings(int cpua, int cpub)
182{
183 struct cpuinfo_mips *infoa = &cpu_data[cpua];
184 struct cpuinfo_mips *infob = &cpu_data[cpub];
185 unsigned int gnuma, gnumb;
186
187 if (infoa->package != infob->package)
188 return false;
189
190 gnuma = infoa->globalnumber & ~MIPS_GLOBALNUMBER_VP;
191 gnumb = infob->globalnumber & ~MIPS_GLOBALNUMBER_VP;
192 if (gnuma != gnumb)
193 return false;
194
195 return true;
196}
197
198static inline unsigned long cpu_asid_inc(void)
199{
200 return 1 << CONFIG_MIPS_ASID_SHIFT;
201}
202
203static inline unsigned long cpu_asid_mask(struct cpuinfo_mips *cpuinfo)
204{
205#ifdef CONFIG_MIPS_ASID_BITS_VARIABLE
206 return cpuinfo->asid_mask;
207#endif
208 return ((1 << CONFIG_MIPS_ASID_BITS) - 1) << CONFIG_MIPS_ASID_SHIFT;
209}
210
211static inline void set_cpu_asid_mask(struct cpuinfo_mips *cpuinfo,
212 unsigned long asid_mask)
213{
214#ifdef CONFIG_MIPS_ASID_BITS_VARIABLE
215 cpuinfo->asid_mask = asid_mask;
216#endif
217}
218
219#endif /* __ASM_CPU_INFO_H */
diff --git a/arch/mips/include/asm/cpu-type.h b/arch/mips/include/asm/cpu-type.h
new file mode 100644
index 000000000..3288cef4b
--- /dev/null
+++ b/arch/mips/include/asm/cpu-type.h
@@ -0,0 +1,223 @@
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 * Copyright (C) 2004 Maciej W. Rozycki
8 */
9#ifndef __ASM_CPU_TYPE_H
10#define __ASM_CPU_TYPE_H
11
12#include <linux/smp.h>
13#include <linux/compiler.h>
14
15static inline int __pure __get_cpu_type(const int cpu_type)
16{
17 switch (cpu_type) {
18#if defined(CONFIG_SYS_HAS_CPU_LOONGSON2E) || \
19 defined(CONFIG_SYS_HAS_CPU_LOONGSON2F)
20 case CPU_LOONGSON2EF:
21#endif
22
23#ifdef CONFIG_SYS_HAS_CPU_LOONGSON64
24 case CPU_LOONGSON64:
25#endif
26
27#if defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \
28 defined(CONFIG_SYS_HAS_CPU_LOONGSON1C)
29 case CPU_LOONGSON32:
30#endif
31
32#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R1
33 case CPU_4KC:
34 case CPU_ALCHEMY:
35 case CPU_PR4450:
36#endif
37
38#if defined(CONFIG_SYS_HAS_CPU_MIPS32_R1) || \
39 defined(CONFIG_SYS_HAS_CPU_MIPS32_R2)
40 case CPU_4KEC:
41 case CPU_XBURST:
42#endif
43
44#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R2
45 case CPU_4KSC:
46 case CPU_24K:
47 case CPU_34K:
48 case CPU_1004K:
49 case CPU_74K:
50 case CPU_1074K:
51 case CPU_M14KC:
52 case CPU_M14KEC:
53 case CPU_INTERAPTIV:
54 case CPU_PROAPTIV:
55#endif
56
57#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R5
58 case CPU_M5150:
59 case CPU_P5600:
60#endif
61
62#if defined(CONFIG_SYS_HAS_CPU_MIPS32_R2) || \
63 defined(CONFIG_SYS_HAS_CPU_MIPS32_R5) || \
64 defined(CONFIG_SYS_HAS_CPU_MIPS32_R6) || \
65 defined(CONFIG_SYS_HAS_CPU_MIPS64_R2) || \
66 defined(CONFIG_SYS_HAS_CPU_MIPS64_R5) || \
67 defined(CONFIG_SYS_HAS_CPU_MIPS64_R6)
68 case CPU_QEMU_GENERIC:
69#endif
70
71#ifdef CONFIG_SYS_HAS_CPU_MIPS64_R1
72 case CPU_5KC:
73 case CPU_5KE:
74 case CPU_20KC:
75 case CPU_25KF:
76 case CPU_SB1:
77 case CPU_SB1A:
78#endif
79
80#ifdef CONFIG_SYS_HAS_CPU_MIPS64_R2
81 /*
82 * All MIPS64 R2 processors have their own special symbols. That is,
83 * there currently is no pure R2 core
84 */
85#endif
86
87#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R6
88 case CPU_M6250:
89#endif
90
91#ifdef CONFIG_SYS_HAS_CPU_MIPS64_R6
92 case CPU_I6400:
93 case CPU_I6500:
94 case CPU_P6600:
95#endif
96
97#ifdef CONFIG_SYS_HAS_CPU_R3000
98 case CPU_R2000:
99 case CPU_R3000:
100 case CPU_R3000A:
101 case CPU_R3041:
102 case CPU_R3051:
103 case CPU_R3052:
104 case CPU_R3081:
105 case CPU_R3081E:
106#endif
107
108#ifdef CONFIG_SYS_HAS_CPU_TX39XX
109 case CPU_TX3912:
110 case CPU_TX3922:
111 case CPU_TX3927:
112#endif
113
114#ifdef CONFIG_SYS_HAS_CPU_VR41XX
115 case CPU_VR41XX:
116 case CPU_VR4111:
117 case CPU_VR4121:
118 case CPU_VR4122:
119 case CPU_VR4131:
120 case CPU_VR4133:
121 case CPU_VR4181:
122 case CPU_VR4181A:
123#endif
124
125#ifdef CONFIG_SYS_HAS_CPU_R4X00
126 case CPU_R4000PC:
127 case CPU_R4000SC:
128 case CPU_R4000MC:
129 case CPU_R4200:
130 case CPU_R4400PC:
131 case CPU_R4400SC:
132 case CPU_R4400MC:
133 case CPU_R4600:
134 case CPU_R4700:
135 case CPU_R4640:
136 case CPU_R4650:
137#endif
138
139#ifdef CONFIG_SYS_HAS_CPU_TX49XX
140 case CPU_TX49XX:
141#endif
142
143#ifdef CONFIG_SYS_HAS_CPU_R5000
144 case CPU_R5000:
145#endif
146
147#ifdef CONFIG_SYS_HAS_CPU_R5500
148 case CPU_R5500:
149#endif
150
151#ifdef CONFIG_SYS_HAS_CPU_NEVADA
152 case CPU_NEVADA:
153#endif
154
155#ifdef CONFIG_SYS_HAS_CPU_R10000
156 case CPU_R10000:
157 case CPU_R12000:
158 case CPU_R14000:
159 case CPU_R16000:
160#endif
161#ifdef CONFIG_SYS_HAS_CPU_RM7000
162 case CPU_RM7000:
163 case CPU_SR71000:
164#endif
165#ifdef CONFIG_SYS_HAS_CPU_SB1
166 case CPU_SB1:
167 case CPU_SB1A:
168#endif
169#ifdef CONFIG_SYS_HAS_CPU_CAVIUM_OCTEON
170 case CPU_CAVIUM_OCTEON:
171 case CPU_CAVIUM_OCTEON_PLUS:
172 case CPU_CAVIUM_OCTEON2:
173 case CPU_CAVIUM_OCTEON3:
174#endif
175
176#if defined(CONFIG_SYS_HAS_CPU_BMIPS32_3300) || \
177 defined (CONFIG_SYS_HAS_CPU_MIPS32_R1)
178 case CPU_BMIPS32:
179 case CPU_BMIPS3300:
180#endif
181
182#ifdef CONFIG_SYS_HAS_CPU_BMIPS4350
183 case CPU_BMIPS4350:
184#endif
185
186#ifdef CONFIG_SYS_HAS_CPU_BMIPS4380
187 case CPU_BMIPS4380:
188#endif
189
190#ifdef CONFIG_SYS_HAS_CPU_BMIPS5000
191 case CPU_BMIPS5000:
192#endif
193
194#ifdef CONFIG_SYS_HAS_CPU_XLP
195 case CPU_XLP:
196#endif
197
198#ifdef CONFIG_SYS_HAS_CPU_XLR
199 case CPU_XLR:
200#endif
201 break;
202 default:
203 unreachable();
204 }
205
206 return cpu_type;
207}
208
209static inline int __pure current_cpu_type(void)
210{
211 const int cpu_type = current_cpu_data.cputype;
212
213 return __get_cpu_type(cpu_type);
214}
215
216static inline int __pure boot_cpu_type(void)
217{
218 const int cpu_type = cpu_data[0].cputype;
219
220 return __get_cpu_type(cpu_type);
221}
222
223#endif /* __ASM_CPU_TYPE_H */
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
new file mode 100644
index 000000000..c9222cc22
--- /dev/null
+++ b/arch/mips/include/asm/cpu.h
@@ -0,0 +1,451 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * cpu.h: Values of the PRId register used to match up
4 * various MIPS cpu types.
5 *
6 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
7 * Copyright (C) 2004, 2013 Maciej W. Rozycki
8 */
9#ifndef _ASM_CPU_H
10#define _ASM_CPU_H
11
12#include <linux/bits.h>
13
14/*
15 As of the MIPS32 and MIPS64 specs from MTI, the PRId register (CP0
16 register 15, select 0) is defined in this (backwards compatible) way:
17
18 +----------------+----------------+----------------+----------------+
19 | Company Options| Company ID | Processor ID | Revision |
20 +----------------+----------------+----------------+----------------+
21 31 24 23 16 15 8 7
22
23 I don't have docs for all the previous processors, but my impression is
24 that bits 16-23 have been 0 for all MIPS processors before the MIPS32/64
25 spec.
26*/
27
28#define PRID_OPT_MASK 0xff000000
29
30/*
31 * Assigned Company values for bits 23:16 of the PRId register.
32 */
33
34#define PRID_COMP_MASK 0xff0000
35
36#define PRID_COMP_LEGACY 0x000000
37#define PRID_COMP_MIPS 0x010000
38#define PRID_COMP_BROADCOM 0x020000
39#define PRID_COMP_ALCHEMY 0x030000
40#define PRID_COMP_SIBYTE 0x040000
41#define PRID_COMP_SANDCRAFT 0x050000
42#define PRID_COMP_NXP 0x060000
43#define PRID_COMP_TOSHIBA 0x070000
44#define PRID_COMP_LSI 0x080000
45#define PRID_COMP_LEXRA 0x0b0000
46#define PRID_COMP_NETLOGIC 0x0c0000
47#define PRID_COMP_CAVIUM 0x0d0000
48#define PRID_COMP_LOONGSON 0x140000
49#define PRID_COMP_INGENIC_13 0x130000 /* X2000 */
50#define PRID_COMP_INGENIC_D0 0xd00000 /* JZ4740, JZ4750, X1830 */
51#define PRID_COMP_INGENIC_D1 0xd10000 /* JZ4770, JZ4775, X1000 */
52#define PRID_COMP_INGENIC_E1 0xe10000 /* JZ4780 */
53
54/*
55 * Assigned Processor ID (implementation) values for bits 15:8 of the PRId
56 * register. In order to detect a certain CPU type exactly eventually
57 * additional registers may need to be examined.
58 */
59
60#define PRID_IMP_MASK 0xff00
61
62/*
63 * These are valid when 23:16 == PRID_COMP_LEGACY
64 */
65
66#define PRID_IMP_R2000 0x0100
67#define PRID_IMP_AU1_REV1 0x0100
68#define PRID_IMP_AU1_REV2 0x0200
69#define PRID_IMP_R3000 0x0200 /* Same as R2000A */
70#define PRID_IMP_R6000 0x0300 /* Same as R3000A */
71#define PRID_IMP_R4000 0x0400
72#define PRID_IMP_R6000A 0x0600
73#define PRID_IMP_R10000 0x0900
74#define PRID_IMP_R4300 0x0b00
75#define PRID_IMP_VR41XX 0x0c00
76#define PRID_IMP_R12000 0x0e00
77#define PRID_IMP_R14000 0x0f00 /* R14K && R16K */
78#define PRID_IMP_R8000 0x1000
79#define PRID_IMP_PR4450 0x1200
80#define PRID_IMP_R4600 0x2000
81#define PRID_IMP_R4700 0x2100
82#define PRID_IMP_TX39 0x2200
83#define PRID_IMP_R4640 0x2200
84#define PRID_IMP_R4650 0x2200 /* Same as R4640 */
85#define PRID_IMP_R5000 0x2300
86#define PRID_IMP_TX49 0x2d00
87#define PRID_IMP_SONIC 0x2400
88#define PRID_IMP_MAGIC 0x2500
89#define PRID_IMP_RM7000 0x2700
90#define PRID_IMP_NEVADA 0x2800 /* RM5260 ??? */
91#define PRID_IMP_RM9000 0x3400
92#define PRID_IMP_LOONGSON_32 0x4200 /* Loongson-1 */
93#define PRID_IMP_R5432 0x5400
94#define PRID_IMP_R5500 0x5500
95#define PRID_IMP_LOONGSON_64R 0x6100 /* Reduced Loongson-2 */
96#define PRID_IMP_LOONGSON_64C 0x6300 /* Classic Loongson-2 and Loongson-3 */
97#define PRID_IMP_LOONGSON_64G 0xc000 /* Generic Loongson-2 and Loongson-3 */
98
99#define PRID_IMP_UNKNOWN 0xff00
100
101/*
102 * These are the PRID's for when 23:16 == PRID_COMP_MIPS
103 */
104
105#define PRID_IMP_QEMU_GENERIC 0x0000
106#define PRID_IMP_4KC 0x8000
107#define PRID_IMP_5KC 0x8100
108#define PRID_IMP_20KC 0x8200
109#define PRID_IMP_4KEC 0x8400
110#define PRID_IMP_4KSC 0x8600
111#define PRID_IMP_25KF 0x8800
112#define PRID_IMP_5KE 0x8900
113#define PRID_IMP_4KECR2 0x9000
114#define PRID_IMP_4KEMPR2 0x9100
115#define PRID_IMP_4KSD 0x9200
116#define PRID_IMP_24K 0x9300
117#define PRID_IMP_34K 0x9500
118#define PRID_IMP_24KE 0x9600
119#define PRID_IMP_74K 0x9700
120#define PRID_IMP_1004K 0x9900
121#define PRID_IMP_1074K 0x9a00
122#define PRID_IMP_M14KC 0x9c00
123#define PRID_IMP_M14KEC 0x9e00
124#define PRID_IMP_INTERAPTIV_UP 0xa000
125#define PRID_IMP_INTERAPTIV_MP 0xa100
126#define PRID_IMP_PROAPTIV_UP 0xa200
127#define PRID_IMP_PROAPTIV_MP 0xa300
128#define PRID_IMP_P6600 0xa400
129#define PRID_IMP_M5150 0xa700
130#define PRID_IMP_P5600 0xa800
131#define PRID_IMP_I6400 0xa900
132#define PRID_IMP_M6250 0xab00
133#define PRID_IMP_I6500 0xb000
134
135/*
136 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
137 */
138
139#define PRID_IMP_SB1 0x0100
140#define PRID_IMP_SB1A 0x1100
141
142/*
143 * These are the PRID's for when 23:16 == PRID_COMP_SANDCRAFT
144 */
145
146#define PRID_IMP_SR71000 0x0400
147
148/*
149 * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
150 */
151
152#define PRID_IMP_BMIPS32_REV4 0x4000
153#define PRID_IMP_BMIPS32_REV8 0x8000
154#define PRID_IMP_BMIPS3300 0x9000
155#define PRID_IMP_BMIPS3300_ALT 0x9100
156#define PRID_IMP_BMIPS3300_BUG 0x0000
157#define PRID_IMP_BMIPS43XX 0xa000
158#define PRID_IMP_BMIPS5000 0x5a00
159#define PRID_IMP_BMIPS5200 0x5b00
160
161#define PRID_REV_BMIPS4380_LO 0x0040
162#define PRID_REV_BMIPS4380_HI 0x006f
163
164/*
165 * These are the PRID's for when 23:16 == PRID_COMP_CAVIUM
166 */
167
168#define PRID_IMP_CAVIUM_CN38XX 0x0000
169#define PRID_IMP_CAVIUM_CN31XX 0x0100
170#define PRID_IMP_CAVIUM_CN30XX 0x0200
171#define PRID_IMP_CAVIUM_CN58XX 0x0300
172#define PRID_IMP_CAVIUM_CN56XX 0x0400
173#define PRID_IMP_CAVIUM_CN50XX 0x0600
174#define PRID_IMP_CAVIUM_CN52XX 0x0700
175#define PRID_IMP_CAVIUM_CN63XX 0x9000
176#define PRID_IMP_CAVIUM_CN68XX 0x9100
177#define PRID_IMP_CAVIUM_CN66XX 0x9200
178#define PRID_IMP_CAVIUM_CN61XX 0x9300
179#define PRID_IMP_CAVIUM_CNF71XX 0x9400
180#define PRID_IMP_CAVIUM_CN78XX 0x9500
181#define PRID_IMP_CAVIUM_CN70XX 0x9600
182#define PRID_IMP_CAVIUM_CN73XX 0x9700
183#define PRID_IMP_CAVIUM_CNF75XX 0x9800
184
185/*
186 * These are the PRID's for when 23:16 == PRID_COMP_INGENIC_*
187 */
188
189#define PRID_IMP_XBURST_REV1 0x0200 /* XBurst®1 with MXU1.0/MXU1.1 SIMD ISA */
190#define PRID_IMP_XBURST_REV2 0x0100 /* XBurst®1 with MXU2.0 SIMD ISA */
191#define PRID_IMP_XBURST2 0x2000 /* XBurst®2 with MXU2.1 SIMD ISA */
192
193/*
194 * These are the PRID's for when 23:16 == PRID_COMP_NETLOGIC
195 */
196#define PRID_IMP_NETLOGIC_XLR732 0x0000
197#define PRID_IMP_NETLOGIC_XLR716 0x0200
198#define PRID_IMP_NETLOGIC_XLR532 0x0900
199#define PRID_IMP_NETLOGIC_XLR308 0x0600
200#define PRID_IMP_NETLOGIC_XLR532C 0x0800
201#define PRID_IMP_NETLOGIC_XLR516C 0x0a00
202#define PRID_IMP_NETLOGIC_XLR508C 0x0b00
203#define PRID_IMP_NETLOGIC_XLR308C 0x0f00
204#define PRID_IMP_NETLOGIC_XLS608 0x8000
205#define PRID_IMP_NETLOGIC_XLS408 0x8800
206#define PRID_IMP_NETLOGIC_XLS404 0x8c00
207#define PRID_IMP_NETLOGIC_XLS208 0x8e00
208#define PRID_IMP_NETLOGIC_XLS204 0x8f00
209#define PRID_IMP_NETLOGIC_XLS108 0xce00
210#define PRID_IMP_NETLOGIC_XLS104 0xcf00
211#define PRID_IMP_NETLOGIC_XLS616B 0x4000
212#define PRID_IMP_NETLOGIC_XLS608B 0x4a00
213#define PRID_IMP_NETLOGIC_XLS416B 0x4400
214#define PRID_IMP_NETLOGIC_XLS412B 0x4c00
215#define PRID_IMP_NETLOGIC_XLS408B 0x4e00
216#define PRID_IMP_NETLOGIC_XLS404B 0x4f00
217#define PRID_IMP_NETLOGIC_AU13XX 0x8000
218
219#define PRID_IMP_NETLOGIC_XLP8XX 0x1000
220#define PRID_IMP_NETLOGIC_XLP3XX 0x1100
221#define PRID_IMP_NETLOGIC_XLP2XX 0x1200
222#define PRID_IMP_NETLOGIC_XLP9XX 0x1500
223#define PRID_IMP_NETLOGIC_XLP5XX 0x1300
224
225/*
226 * Particular Revision values for bits 7:0 of the PRId register.
227 */
228
229#define PRID_REV_MASK 0x00ff
230
231/*
232 * Definitions for 7:0 on legacy processors
233 */
234
235#define PRID_REV_TX4927 0x0022
236#define PRID_REV_TX4937 0x0030
237#define PRID_REV_R4400 0x0040
238#define PRID_REV_R3000A 0x0030
239#define PRID_REV_R3000 0x0020
240#define PRID_REV_R2000A 0x0010
241#define PRID_REV_TX3912 0x0010
242#define PRID_REV_TX3922 0x0030
243#define PRID_REV_TX3927 0x0040
244#define PRID_REV_VR4111 0x0050
245#define PRID_REV_VR4181 0x0050 /* Same as VR4111 */
246#define PRID_REV_VR4121 0x0060
247#define PRID_REV_VR4122 0x0070
248#define PRID_REV_VR4181A 0x0070 /* Same as VR4122 */
249#define PRID_REV_VR4130 0x0080
250#define PRID_REV_34K_V1_0_2 0x0022
251#define PRID_REV_LOONGSON1B 0x0020
252#define PRID_REV_LOONGSON1C 0x0020 /* Same as Loongson-1B */
253#define PRID_REV_LOONGSON2E 0x0002
254#define PRID_REV_LOONGSON2F 0x0003
255#define PRID_REV_LOONGSON2K_R1_0 0x0000
256#define PRID_REV_LOONGSON2K_R1_1 0x0001
257#define PRID_REV_LOONGSON2K_R1_2 0x0002
258#define PRID_REV_LOONGSON2K_R1_3 0x0003
259#define PRID_REV_LOONGSON3A_R1 0x0005
260#define PRID_REV_LOONGSON3B_R1 0x0006
261#define PRID_REV_LOONGSON3B_R2 0x0007
262#define PRID_REV_LOONGSON3A_R2_0 0x0008
263#define PRID_REV_LOONGSON3A_R3_0 0x0009
264#define PRID_REV_LOONGSON3A_R2_1 0x000c
265#define PRID_REV_LOONGSON3A_R3_1 0x000d
266
267/*
268 * Older processors used to encode processor version and revision in two
269 * 4-bit bitfields, the 4K seems to simply count up and even newer MTI cores
270 * have switched to use the 8-bits as 3:3:2 bitfield with the last field as
271 * the patch number. *ARGH*
272 */
273#define PRID_REV_ENCODE_44(ver, rev) \
274 ((ver) << 4 | (rev))
275#define PRID_REV_ENCODE_332(ver, rev, patch) \
276 ((ver) << 5 | (rev) << 2 | (patch))
277
278/*
279 * FPU implementation/revision register (CP1 control register 0).
280 *
281 * +---------------------------------+----------------+----------------+
282 * | 0 | Implementation | Revision |
283 * +---------------------------------+----------------+----------------+
284 * 31 16 15 8 7 0
285 */
286
287#define FPIR_IMP_MASK 0xff00
288
289#define FPIR_IMP_NONE 0x0000
290
291#if !defined(__ASSEMBLY__)
292
293enum cpu_type_enum {
294 CPU_UNKNOWN,
295
296 /*
297 * R2000 class processors
298 */
299 CPU_R2000, CPU_R3000, CPU_R3000A, CPU_R3041, CPU_R3051, CPU_R3052,
300 CPU_R3081, CPU_R3081E,
301
302 /*
303 * R4000 class processors
304 */
305 CPU_R4000PC, CPU_R4000SC, CPU_R4000MC, CPU_R4200,
306 CPU_R4400PC, CPU_R4400SC, CPU_R4400MC, CPU_R4600, CPU_R4640, CPU_R4650,
307 CPU_R4700, CPU_R5000, CPU_R5500, CPU_NEVADA, CPU_R10000,
308 CPU_R12000, CPU_R14000, CPU_R16000, CPU_VR41XX, CPU_VR4111, CPU_VR4121,
309 CPU_VR4122, CPU_VR4131, CPU_VR4133, CPU_VR4181, CPU_VR4181A, CPU_RM7000,
310 CPU_SR71000, CPU_TX49XX,
311
312 /*
313 * TX3900 class processors
314 */
315 CPU_TX3912, CPU_TX3922, CPU_TX3927,
316
317 /*
318 * MIPS32 class processors
319 */
320 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
321 CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350,
322 CPU_BMIPS4380, CPU_BMIPS5000, CPU_XBURST, CPU_LOONGSON32, CPU_M14KC,
323 CPU_M14KEC, CPU_INTERAPTIV, CPU_P5600, CPU_PROAPTIV, CPU_1074K,
324 CPU_M5150, CPU_I6400, CPU_P6600, CPU_M6250,
325
326 /*
327 * MIPS64 class processors
328 */
329 CPU_5KC, CPU_5KE, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2EF,
330 CPU_LOONGSON64, CPU_CAVIUM_OCTEON, CPU_CAVIUM_OCTEON_PLUS,
331 CPU_CAVIUM_OCTEON2, CPU_CAVIUM_OCTEON3, CPU_XLR, CPU_XLP, CPU_I6500,
332
333 CPU_QEMU_GENERIC,
334
335 CPU_LAST
336};
337
338#endif /* !__ASSEMBLY */
339
340/*
341 * ISA Level encodings
342 *
343 */
344#define MIPS_CPU_ISA_II 0x00000001
345#define MIPS_CPU_ISA_III 0x00000002
346#define MIPS_CPU_ISA_IV 0x00000004
347#define MIPS_CPU_ISA_V 0x00000008
348#define MIPS_CPU_ISA_M32R1 0x00000010
349#define MIPS_CPU_ISA_M32R2 0x00000020
350#define MIPS_CPU_ISA_M64R1 0x00000040
351#define MIPS_CPU_ISA_M64R2 0x00000080
352#define MIPS_CPU_ISA_M32R5 0x00000100
353#define MIPS_CPU_ISA_M64R5 0x00000200
354#define MIPS_CPU_ISA_M32R6 0x00000400
355#define MIPS_CPU_ISA_M64R6 0x00000800
356
357#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_II | MIPS_CPU_ISA_M32R1 | \
358 MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M32R5 | MIPS_CPU_ISA_M32R6)
359#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV | \
360 MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2 | \
361 MIPS_CPU_ISA_M64R5 | MIPS_CPU_ISA_M64R6)
362
363/*
364 * CPU Option encodings
365 */
366#define MIPS_CPU_TLB BIT_ULL( 0) /* CPU has TLB */
367#define MIPS_CPU_4KEX BIT_ULL( 1) /* "R4K" exception model */
368#define MIPS_CPU_3K_CACHE BIT_ULL( 2) /* R3000-style caches */
369#define MIPS_CPU_4K_CACHE BIT_ULL( 3) /* R4000-style caches */
370#define MIPS_CPU_TX39_CACHE BIT_ULL( 4) /* TX3900-style caches */
371#define MIPS_CPU_FPU BIT_ULL( 5) /* CPU has FPU */
372#define MIPS_CPU_32FPR BIT_ULL( 6) /* 32 dbl. prec. FP registers */
373#define MIPS_CPU_COUNTER BIT_ULL( 7) /* Cycle count/compare */
374#define MIPS_CPU_WATCH BIT_ULL( 8) /* watchpoint registers */
375#define MIPS_CPU_DIVEC BIT_ULL( 9) /* dedicated interrupt vector */
376#define MIPS_CPU_VCE BIT_ULL(10) /* virt. coherence conflict possible */
377#define MIPS_CPU_CACHE_CDEX_P BIT_ULL(11) /* Create_Dirty_Exclusive CACHE op */
378#define MIPS_CPU_CACHE_CDEX_S BIT_ULL(12) /* ... same for seconary cache ... */
379#define MIPS_CPU_MCHECK BIT_ULL(13) /* Machine check exception */
380#define MIPS_CPU_EJTAG BIT_ULL(14) /* EJTAG exception */
381#define MIPS_CPU_NOFPUEX BIT_ULL(15) /* no FPU exception */
382#define MIPS_CPU_LLSC BIT_ULL(16) /* CPU has ll/sc instructions */
383#define MIPS_CPU_INCLUSIVE_CACHES BIT_ULL(17) /* P-cache subset enforced */
384#define MIPS_CPU_PREFETCH BIT_ULL(18) /* CPU has usable prefetch */
385#define MIPS_CPU_VINT BIT_ULL(19) /* CPU supports MIPSR2 vectored interrupts */
386#define MIPS_CPU_VEIC BIT_ULL(20) /* CPU supports MIPSR2 external interrupt controller mode */
387#define MIPS_CPU_ULRI BIT_ULL(21) /* CPU has ULRI feature */
388#define MIPS_CPU_PCI BIT_ULL(22) /* CPU has Perf Ctr Int indicator */
389#define MIPS_CPU_RIXI BIT_ULL(23) /* CPU has TLB Read/eXec Inhibit */
390#define MIPS_CPU_MICROMIPS BIT_ULL(24) /* CPU has microMIPS capability */
391#define MIPS_CPU_TLBINV BIT_ULL(25) /* CPU supports TLBINV/F */
392#define MIPS_CPU_SEGMENTS BIT_ULL(26) /* CPU supports Segmentation Control registers */
393#define MIPS_CPU_EVA BIT_ULL(27) /* CPU supports Enhanced Virtual Addressing */
394#define MIPS_CPU_HTW BIT_ULL(28) /* CPU support Hardware Page Table Walker */
395#define MIPS_CPU_RIXIEX BIT_ULL(29) /* CPU has unique exception codes for {Read, Execute}-Inhibit exceptions */
396#define MIPS_CPU_MAAR BIT_ULL(30) /* MAAR(I) registers are present */
397#define MIPS_CPU_FRE BIT_ULL(31) /* FRE & UFE bits implemented */
398#define MIPS_CPU_RW_LLB BIT_ULL(32) /* LLADDR/LLB writes are allowed */
399#define MIPS_CPU_LPA BIT_ULL(33) /* CPU supports Large Physical Addressing */
400#define MIPS_CPU_CDMM BIT_ULL(34) /* CPU has Common Device Memory Map */
401#define MIPS_CPU_SP BIT_ULL(36) /* Small (1KB) page support */
402#define MIPS_CPU_FTLB BIT_ULL(37) /* CPU has Fixed-page-size TLB */
403#define MIPS_CPU_NAN_LEGACY BIT_ULL(38) /* Legacy NaN implemented */
404#define MIPS_CPU_NAN_2008 BIT_ULL(39) /* 2008 NaN implemented */
405#define MIPS_CPU_VP BIT_ULL(40) /* MIPSr6 Virtual Processors (multi-threading) */
406#define MIPS_CPU_LDPTE BIT_ULL(41) /* CPU has ldpte/lddir instructions */
407#define MIPS_CPU_MVH BIT_ULL(42) /* CPU supports MFHC0/MTHC0 */
408#define MIPS_CPU_EBASE_WG BIT_ULL(43) /* CPU has EBase.WG */
409#define MIPS_CPU_BADINSTR BIT_ULL(44) /* CPU has BadInstr register */
410#define MIPS_CPU_BADINSTRP BIT_ULL(45) /* CPU has BadInstrP register */
411#define MIPS_CPU_CTXTC BIT_ULL(46) /* CPU has [X]ConfigContext registers */
412#define MIPS_CPU_PERF BIT_ULL(47) /* CPU has MIPS performance counters */
413#define MIPS_CPU_GUESTCTL0EXT BIT_ULL(48) /* CPU has VZ GuestCtl0Ext register */
414#define MIPS_CPU_GUESTCTL1 BIT_ULL(49) /* CPU has VZ GuestCtl1 register */
415#define MIPS_CPU_GUESTCTL2 BIT_ULL(50) /* CPU has VZ GuestCtl2 register */
416#define MIPS_CPU_GUESTID BIT_ULL(51) /* CPU uses VZ ASE GuestID feature */
417#define MIPS_CPU_DRG BIT_ULL(52) /* CPU has VZ Direct Root to Guest (DRG) */
418#define MIPS_CPU_UFR BIT_ULL(53) /* CPU supports User mode FR switching */
419#define MIPS_CPU_SHARED_FTLB_RAM \
420 BIT_ULL(54) /* CPU shares FTLB RAM with another */
421#define MIPS_CPU_SHARED_FTLB_ENTRIES \
422 BIT_ULL(55) /* CPU shares FTLB entries with another */
423#define MIPS_CPU_MT_PER_TC_PERF_COUNTERS \
424 BIT_ULL(56) /* CPU has perf counters implemented per TC (MIPSMT ASE) */
425#define MIPS_CPU_MMID BIT_ULL(57) /* CPU supports MemoryMapIDs */
426#define MIPS_CPU_MM_SYSAD BIT_ULL(58) /* CPU supports write-through SysAD Valid merge */
427#define MIPS_CPU_MM_FULL BIT_ULL(59) /* CPU supports write-through full merge */
428#define MIPS_CPU_MAC_2008_ONLY BIT_ULL(60) /* CPU Only support MAC2008 Fused multiply-add instruction */
429#define MIPS_CPU_FTLBPAREX BIT_ULL(61) /* CPU has FTLB parity exception */
430#define MIPS_CPU_GSEXCEX BIT_ULL(62) /* CPU has GSExc exception */
431
432/*
433 * CPU ASE encodings
434 */
435#define MIPS_ASE_MIPS16 0x00000001 /* code compression */
436#define MIPS_ASE_MDMX 0x00000002 /* MIPS digital media extension */
437#define MIPS_ASE_MIPS3D 0x00000004 /* MIPS-3D */
438#define MIPS_ASE_SMARTMIPS 0x00000008 /* SmartMIPS */
439#define MIPS_ASE_DSP 0x00000010 /* Signal Processing ASE */
440#define MIPS_ASE_MIPSMT 0x00000020 /* CPU supports MIPS MT */
441#define MIPS_ASE_DSP2P 0x00000040 /* Signal Processing ASE Rev 2 */
442#define MIPS_ASE_VZ 0x00000080 /* Virtualization ASE */
443#define MIPS_ASE_MSA 0x00000100 /* MIPS SIMD Architecture */
444#define MIPS_ASE_DSP3 0x00000200 /* Signal Processing ASE Rev 3*/
445#define MIPS_ASE_MIPS16E2 0x00000400 /* MIPS16e2 */
446#define MIPS_ASE_LOONGSON_MMI 0x00000800 /* Loongson MultiMedia extensions Instructions */
447#define MIPS_ASE_LOONGSON_CAM 0x00001000 /* Loongson CAM */
448#define MIPS_ASE_LOONGSON_EXT 0x00002000 /* Loongson EXTensions */
449#define MIPS_ASE_LOONGSON_EXT2 0x00004000 /* Loongson EXTensions R2 */
450
451#endif /* _ASM_CPU_H */
diff --git a/arch/mips/include/asm/cpufeature.h b/arch/mips/include/asm/cpufeature.h
new file mode 100644
index 000000000..ba9e62faf
--- /dev/null
+++ b/arch/mips/include/asm/cpufeature.h
@@ -0,0 +1,22 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * CPU feature definitions for module loading, used by
4 * module_cpu_feature_match(), see uapi/asm/hwcap.h for MIPS CPU features.
5 */
6
7#ifndef __ASM_CPUFEATURE_H
8#define __ASM_CPUFEATURE_H
9
10#include <uapi/asm/hwcap.h>
11#include <asm/elf.h>
12
13#define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap))
14
15#define cpu_feature(x) ilog2(HWCAP_ ## x)
16
17static inline bool cpu_have_feature(unsigned int num)
18{
19 return elf_hwcap & (1UL << num);
20}
21
22#endif /* __ASM_CPUFEATURE_H */
diff --git a/arch/mips/include/asm/debug.h b/arch/mips/include/asm/debug.h
new file mode 100644
index 000000000..c7013e1cb
--- /dev/null
+++ b/arch/mips/include/asm/debug.h
@@ -0,0 +1,18 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2015 Imagination Technologies
4 */
5
6#ifndef __MIPS_ASM_DEBUG_H__
7#define __MIPS_ASM_DEBUG_H__
8
9#include <linux/dcache.h>
10
11/*
12 * mips_debugfs_dir corresponds to the "mips" directory at the top level
13 * of the DebugFS hierarchy. MIPS-specific DebugFS entires should be
14 * placed beneath this directory.
15 */
16extern struct dentry *mips_debugfs_dir;
17
18#endif /* __MIPS_ASM_DEBUG_H__ */
diff --git a/arch/mips/include/asm/dec/ecc.h b/arch/mips/include/asm/dec/ecc.h
new file mode 100644
index 000000000..c3a3f71f1
--- /dev/null
+++ b/arch/mips/include/asm/dec/ecc.h
@@ -0,0 +1,51 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/dec/ecc.h
4 *
5 * ECC handling logic definitions common to DECstation/DECsystem
6 * 5000/200 (KN02), 5000/240 (KN03), 5000/260 (KN05) and
7 * DECsystem 5900 (KN03), 5900/260 (KN05) systems.
8 *
9 * Copyright (C) 2003 Maciej W. Rozycki
10 */
11#ifndef __ASM_MIPS_DEC_ECC_H
12#define __ASM_MIPS_DEC_ECC_H
13
14/*
15 * Error Address Register bits.
16 * The register is r/wc -- any write clears it.
17 */
18#define KN0X_EAR_VALID (1<<31) /* error data valid, bus IRQ */
19#define KN0X_EAR_CPU (1<<30) /* CPU/DMA transaction */
20#define KN0X_EAR_WRITE (1<<29) /* write/read transaction */
21#define KN0X_EAR_ECCERR (1<<28) /* ECC/timeout or overrun */
22#define KN0X_EAR_RES_27 (1<<27) /* unused */
23#define KN0X_EAR_ADDRESS (0x7ffffff<<0) /* address involved */
24
25/*
26 * Error Syndrome Register bits.
27 * The register is frozen when EAR.VALID is set, otherwise it records bits
28 * from the last memory read. The register is r/wc -- any write clears it.
29 */
30#define KN0X_ESR_VLDHI (1<<31) /* error data valid hi word */
31#define KN0X_ESR_CHKHI (0x7f<<24) /* check bits read from mem */
32#define KN0X_ESR_SNGHI (1<<23) /* single/double bit error */
33#define KN0X_ESR_SYNHI (0x7f<<16) /* syndrome from ECC logic */
34#define KN0X_ESR_VLDLO (1<<15) /* error data valid lo word */
35#define KN0X_ESR_CHKLO (0x7f<<8) /* check bits read from mem */
36#define KN0X_ESR_SNGLO (1<<7) /* single/double bit error */
37#define KN0X_ESR_SYNLO (0x7f<<0) /* syndrome from ECC logic */
38
39
40#ifndef __ASSEMBLY__
41
42#include <linux/interrupt.h>
43
44struct pt_regs;
45
46extern void dec_ecc_be_init(void);
47extern int dec_ecc_be_handler(struct pt_regs *regs, int is_fixup);
48extern irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id);
49#endif
50
51#endif /* __ASM_MIPS_DEC_ECC_H */
diff --git a/arch/mips/include/asm/dec/interrupts.h b/arch/mips/include/asm/dec/interrupts.h
new file mode 100644
index 000000000..e10d34106
--- /dev/null
+++ b/arch/mips/include/asm/dec/interrupts.h
@@ -0,0 +1,126 @@
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 <irq.h>
18#include <asm/mipsregs.h>
19
20
21/*
22 * The list of possible system devices which provide an
23 * interrupt. Not all devices exist on a given system.
24 */
25#define DEC_IRQ_CASCADE 0 /* cascade from CSR or I/O ASIC */
26
27/* Ordinary interrupts */
28#define DEC_IRQ_AB_RECV 1 /* ACCESS.bus receive */
29#define DEC_IRQ_AB_XMIT 2 /* ACCESS.bus transmit */
30#define DEC_IRQ_DZ11 3 /* DZ11 (DC7085) serial */
31#define DEC_IRQ_ASC 4 /* ASC (NCR53C94) SCSI */
32#define DEC_IRQ_FLOPPY 5 /* 82077 FDC */
33#define DEC_IRQ_FPU 6 /* R3k FPU */
34#define DEC_IRQ_HALT 7 /* HALT button or from ACCESS.Bus */
35#define DEC_IRQ_ISDN 8 /* Am79C30A ISDN */
36#define DEC_IRQ_LANCE 9 /* LANCE (Am7990) Ethernet */
37#define DEC_IRQ_BUS 10 /* memory, I/O bus read/write errors */
38#define DEC_IRQ_PSU 11 /* power supply unit warning */
39#define DEC_IRQ_RTC 12 /* DS1287 RTC */
40#define DEC_IRQ_SCC0 13 /* SCC (Z85C30) serial #0 */
41#define DEC_IRQ_SCC1 14 /* SCC (Z85C30) serial #1 */
42#define DEC_IRQ_SII 15 /* SII (DC7061) SCSI */
43#define DEC_IRQ_TC0 16 /* TURBOchannel slot #0 */
44#define DEC_IRQ_TC1 17 /* TURBOchannel slot #1 */
45#define DEC_IRQ_TC2 18 /* TURBOchannel slot #2 */
46#define DEC_IRQ_TIMER 19 /* ARC periodic timer */
47#define DEC_IRQ_VIDEO 20 /* framebuffer */
48
49/* I/O ASIC DMA interrupts */
50#define DEC_IRQ_ASC_MERR 21 /* ASC memory read error */
51#define DEC_IRQ_ASC_ERR 22 /* ASC page overrun */
52#define DEC_IRQ_ASC_DMA 23 /* ASC buffer pointer loaded */
53#define DEC_IRQ_FLOPPY_ERR 24 /* FDC error */
54#define DEC_IRQ_ISDN_ERR 25 /* ISDN memory read/overrun error */
55#define DEC_IRQ_ISDN_RXDMA 26 /* ISDN recv buffer pointer loaded */
56#define DEC_IRQ_ISDN_TXDMA 27 /* ISDN xmit buffer pointer loaded */
57#define DEC_IRQ_LANCE_MERR 28 /* LANCE memory read error */
58#define DEC_IRQ_SCC0A_RXERR 29 /* SCC0A (printer) receive overrun */
59#define DEC_IRQ_SCC0A_RXDMA 30 /* SCC0A receive half page */
60#define DEC_IRQ_SCC0A_TXERR 31 /* SCC0A xmit memory read/overrun */
61#define DEC_IRQ_SCC0A_TXDMA 32 /* SCC0A transmit page end */
62#define DEC_IRQ_AB_RXERR 33 /* ACCESS.bus receive overrun */
63#define DEC_IRQ_AB_RXDMA 34 /* ACCESS.bus receive half page */
64#define DEC_IRQ_AB_TXERR 35 /* ACCESS.bus xmit memory read/ovrn */
65#define DEC_IRQ_AB_TXDMA 36 /* ACCESS.bus transmit page end */
66#define DEC_IRQ_SCC1A_RXERR 37 /* SCC1A (modem) receive overrun */
67#define DEC_IRQ_SCC1A_RXDMA 38 /* SCC1A receive half page */
68#define DEC_IRQ_SCC1A_TXERR 39 /* SCC1A xmit memory read/overrun */
69#define DEC_IRQ_SCC1A_TXDMA 40 /* SCC1A transmit page end */
70
71/* TC5 & TC6 are virtual slots for KN02's onboard devices */
72#define DEC_IRQ_TC5 DEC_IRQ_ASC /* virtual PMAZ-AA */
73#define DEC_IRQ_TC6 DEC_IRQ_LANCE /* virtual PMAD-AA */
74
75#define DEC_NR_INTS 41
76
77
78/* Largest of cpu mask_nr tables. */
79#define DEC_MAX_CPU_INTS 6
80/* Largest of asic mask_nr tables. */
81#define DEC_MAX_ASIC_INTS 9
82
83
84/*
85 * CPU interrupt bits common to all systems.
86 */
87#define DEC_CPU_INR_FPU 7 /* R3k FPU */
88#define DEC_CPU_INR_SW1 1 /* software #1 */
89#define DEC_CPU_INR_SW0 0 /* software #0 */
90
91#define DEC_CPU_IRQ_BASE MIPS_CPU_IRQ_BASE /* first IRQ assigned to CPU */
92
93#define DEC_CPU_IRQ_NR(n) ((n) + DEC_CPU_IRQ_BASE)
94#define DEC_CPU_IRQ_MASK(n) (1 << ((n) + CAUSEB_IP))
95#define DEC_CPU_IRQ_ALL (0xff << CAUSEB_IP)
96
97
98#ifndef __ASSEMBLY__
99
100/*
101 * Interrupt table structures to hide differences between systems.
102 */
103typedef union { int i; void *p; } int_ptr;
104extern int dec_interrupt[DEC_NR_INTS];
105extern int_ptr cpu_mask_nr_tbl[DEC_MAX_CPU_INTS][2];
106extern int_ptr asic_mask_nr_tbl[DEC_MAX_ASIC_INTS][2];
107extern int cpu_fpu_mask;
108
109
110/*
111 * Common interrupt routine prototypes for all DECStations
112 */
113extern void kn02_io_int(void);
114extern void kn02xa_io_int(void);
115extern void kn03_io_int(void);
116extern void asic_dma_int(void);
117extern void asic_all_int(void);
118extern void kn02_all_int(void);
119extern void cpu_all_int(void);
120
121extern void dec_intr_unimplemented(void);
122extern void asic_intr_unimplemented(void);
123
124#endif /* __ASSEMBLY__ */
125
126#endif
diff --git a/arch/mips/include/asm/dec/ioasic.h b/arch/mips/include/asm/dec/ioasic.h
new file mode 100644
index 000000000..6d912f095
--- /dev/null
+++ b/arch/mips/include/asm/dec/ioasic.h
@@ -0,0 +1,34 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/dec/ioasic.h
4 *
5 * DEC I/O ASIC access operations.
6 *
7 * Copyright (C) 2000, 2002, 2003 Maciej W. Rozycki
8 */
9
10#ifndef __ASM_DEC_IOASIC_H
11#define __ASM_DEC_IOASIC_H
12
13#include <linux/spinlock.h>
14#include <linux/types.h>
15
16extern spinlock_t ioasic_ssr_lock;
17
18extern volatile u32 *ioasic_base;
19
20static inline void ioasic_write(unsigned int reg, u32 v)
21{
22 ioasic_base[reg / 4] = v;
23}
24
25static inline u32 ioasic_read(unsigned int reg)
26{
27 return ioasic_base[reg / 4];
28}
29
30extern void init_ioasic_irqs(int base);
31
32extern int dec_ioasic_clocksource_init(void);
33
34#endif /* __ASM_DEC_IOASIC_H */
diff --git a/arch/mips/include/asm/dec/ioasic_addrs.h b/arch/mips/include/asm/dec/ioasic_addrs.h
new file mode 100644
index 000000000..8bd95971f
--- /dev/null
+++ b/arch/mips/include/asm/dec/ioasic_addrs.h
@@ -0,0 +1,152 @@
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
49 * (relative to (dec_kn_slot_base + IOASIC_IOCTL)).
50 */
51 /* all systems */
52#define IO_REG_SCSI_DMA_P 0x00 /* SCSI DMA Pointer */
53#define IO_REG_SCSI_DMA_BP 0x10 /* SCSI DMA Buffer Pointer */
54#define IO_REG_LANCE_DMA_P 0x20 /* LANCE DMA Pointer */
55#define IO_REG_SCC0A_T_DMA_P 0x30 /* SCC0A Transmit DMA Pointer */
56#define IO_REG_SCC0A_R_DMA_P 0x40 /* SCC0A Receive DMA Pointer */
57
58 /* except Maxine */
59#define IO_REG_SCC1A_T_DMA_P 0x50 /* SCC1A Transmit DMA Pointer */
60#define IO_REG_SCC1A_R_DMA_P 0x60 /* SCC1A Receive DMA Pointer */
61
62 /* Maxine */
63#define IO_REG_AB_T_DMA_P 0x50 /* ACCESS.bus Transmit DMA Pointer */
64#define IO_REG_AB_R_DMA_P 0x60 /* ACCESS.bus Receive DMA Pointer */
65#define IO_REG_FLOPPY_DMA_P 0x70 /* Floppy DMA Pointer */
66#define IO_REG_ISDN_T_DMA_P 0x80 /* ISDN Transmit DMA Pointer */
67#define IO_REG_ISDN_T_DMA_BP 0x90 /* ISDN Transmit DMA Buffer Pointer */
68#define IO_REG_ISDN_R_DMA_P 0xa0 /* ISDN Receive DMA Pointer */
69#define IO_REG_ISDN_R_DMA_BP 0xb0 /* ISDN Receive DMA Buffer Pointer */
70
71 /* all systems */
72#define IO_REG_DATA_0 0xc0 /* System Data Buffer 0 */
73#define IO_REG_DATA_1 0xd0 /* System Data Buffer 1 */
74#define IO_REG_DATA_2 0xe0 /* System Data Buffer 2 */
75#define IO_REG_DATA_3 0xf0 /* System Data Buffer 3 */
76
77 /* all systems */
78#define IO_REG_SSR 0x100 /* System Support Register */
79#define IO_REG_SIR 0x110 /* System Interrupt Register */
80#define IO_REG_SIMR 0x120 /* System Interrupt Mask Reg. */
81#define IO_REG_SAR 0x130 /* System Address Register */
82
83 /* Maxine */
84#define IO_REG_ISDN_T_DATA 0x140 /* ISDN Xmit Data Register */
85#define IO_REG_ISDN_R_DATA 0x150 /* ISDN Receive Data Register */
86
87 /* all systems */
88#define IO_REG_LANCE_SLOT 0x160 /* LANCE I/O Slot Register */
89#define IO_REG_SCSI_SLOT 0x170 /* SCSI Slot Register */
90#define IO_REG_SCC0A_SLOT 0x180 /* SCC0A DMA Slot Register */
91
92 /* except Maxine */
93#define IO_REG_SCC1A_SLOT 0x190 /* SCC1A DMA Slot Register */
94
95 /* Maxine */
96#define IO_REG_AB_SLOT 0x190 /* ACCESS.bus DMA Slot Register */
97#define IO_REG_FLOPPY_SLOT 0x1a0 /* Floppy Slot Register */
98
99 /* all systems */
100#define IO_REG_SCSI_SCR 0x1b0 /* SCSI Partial-Word DMA Control */
101#define IO_REG_SCSI_SDR0 0x1c0 /* SCSI DMA Partial Word 0 */
102#define IO_REG_SCSI_SDR1 0x1d0 /* SCSI DMA Partial Word 1 */
103#define IO_REG_FCTR 0x1e0 /* Free-Running Counter */
104#define IO_REG_RES_31 0x1f0 /* unused */
105
106
107/*
108 * The upper 16 bits of the System Support Register are a part of the
109 * I/O ASIC's internal DMA engine and thus are common to all I/O ASIC
110 * machines. The exception is the Maxine, which makes use of the
111 * FLOPPY and ISDN bits (otherwise unused) and has a different SCC
112 * wiring.
113 */
114 /* all systems */
115#define IO_SSR_SCC0A_TX_DMA_EN (1<<31) /* SCC0A transmit DMA enable */
116#define IO_SSR_SCC0A_RX_DMA_EN (1<<30) /* SCC0A receive DMA enable */
117#define IO_SSR_RES_27 (1<<27) /* unused */
118#define IO_SSR_RES_26 (1<<26) /* unused */
119#define IO_SSR_RES_25 (1<<25) /* unused */
120#define IO_SSR_RES_24 (1<<24) /* unused */
121#define IO_SSR_RES_23 (1<<23) /* unused */
122#define IO_SSR_SCSI_DMA_DIR (1<<18) /* SCSI DMA direction */
123#define IO_SSR_SCSI_DMA_EN (1<<17) /* SCSI DMA enable */
124#define IO_SSR_LANCE_DMA_EN (1<<16) /* LANCE DMA enable */
125
126 /* except Maxine */
127#define IO_SSR_SCC1A_TX_DMA_EN (1<<29) /* SCC1A transmit DMA enable */
128#define IO_SSR_SCC1A_RX_DMA_EN (1<<28) /* SCC1A receive DMA enable */
129#define IO_SSR_RES_22 (1<<22) /* unused */
130#define IO_SSR_RES_21 (1<<21) /* unused */
131#define IO_SSR_RES_20 (1<<20) /* unused */
132#define IO_SSR_RES_19 (1<<19) /* unused */
133
134 /* Maxine */
135#define IO_SSR_AB_TX_DMA_EN (1<<29) /* ACCESS.bus xmit DMA enable */
136#define IO_SSR_AB_RX_DMA_EN (1<<28) /* ACCESS.bus recv DMA enable */
137#define IO_SSR_FLOPPY_DMA_DIR (1<<22) /* Floppy DMA direction */
138#define IO_SSR_FLOPPY_DMA_EN (1<<21) /* Floppy DMA enable */
139#define IO_SSR_ISDN_TX_DMA_EN (1<<20) /* ISDN transmit DMA enable */
140#define IO_SSR_ISDN_RX_DMA_EN (1<<19) /* ISDN receive DMA enable */
141
142/*
143 * The lower 16 bits are system-specific. Bits 15,11:8 are common and
144 * defined here. The rest is defined in system-specific headers.
145 */
146#define KN0X_IO_SSR_DIAGDN (1<<15) /* diagnostic jumper */
147#define KN0X_IO_SSR_SCC_RST (1<<11) /* ~SCC0,1 (Z85C30) reset */
148#define KN0X_IO_SSR_RTC_RST (1<<10) /* ~RTC (DS1287) reset */
149#define KN0X_IO_SSR_ASC_RST (1<<9) /* ~ASC (NCR53C94) reset */
150#define KN0X_IO_SSR_LANCE_RST (1<<8) /* ~LANCE (Am7990) reset */
151
152#endif /* __ASM_MIPS_DEC_IOASIC_ADDRS_H */
diff --git a/arch/mips/include/asm/dec/ioasic_ints.h b/arch/mips/include/asm/dec/ioasic_ints.h
new file mode 100644
index 000000000..9aaa98696
--- /dev/null
+++ b/arch/mips/include/asm/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/arch/mips/include/asm/dec/kn01.h b/arch/mips/include/asm/dec/kn01.h
new file mode 100644
index 000000000..88d9ffd74
--- /dev/null
+++ b/arch/mips/include/asm/dec/kn01.h
@@ -0,0 +1,89 @@
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, 2005 Maciej W. Rozycki
12 */
13#ifndef __ASM_MIPS_DEC_KN01_H
14#define __ASM_MIPS_DEC_KN01_H
15
16#define KN01_SLOT_BASE 0x10000000
17#define KN01_SLOT_SIZE 0x01000000
18
19/*
20 * Address ranges for devices.
21 */
22#define KN01_PMASK (0*KN01_SLOT_SIZE) /* color plane mask */
23#define KN01_PCC (1*KN01_SLOT_SIZE) /* PCC (DC503) cursor */
24#define KN01_VDAC (2*KN01_SLOT_SIZE) /* color map */
25#define KN01_RES_3 (3*KN01_SLOT_SIZE) /* unused */
26#define KN01_RES_4 (4*KN01_SLOT_SIZE) /* unused */
27#define KN01_RES_5 (5*KN01_SLOT_SIZE) /* unused */
28#define KN01_RES_6 (6*KN01_SLOT_SIZE) /* unused */
29#define KN01_ERRADDR (7*KN01_SLOT_SIZE) /* write error address */
30#define KN01_LANCE (8*KN01_SLOT_SIZE) /* LANCE (Am7990) Ethernet */
31#define KN01_LANCE_MEM (9*KN01_SLOT_SIZE) /* LANCE buffer memory */
32#define KN01_SII (10*KN01_SLOT_SIZE) /* SII (DC7061) SCSI */
33#define KN01_SII_MEM (11*KN01_SLOT_SIZE) /* SII buffer memory */
34#define KN01_DZ11 (12*KN01_SLOT_SIZE) /* DZ11 (DC7085) serial */
35#define KN01_RTC (13*KN01_SLOT_SIZE) /* DS1287 RTC (bytes #0) */
36#define KN01_ESAR (13*KN01_SLOT_SIZE) /* MAC address (bytes #1) */
37#define KN01_CSR (14*KN01_SLOT_SIZE) /* system ctrl & status reg */
38#define KN01_SYS_ROM (15*KN01_SLOT_SIZE) /* system board ROM */
39
40
41/*
42 * Frame buffer memory address.
43 */
44#define KN01_VFB_MEM 0x0fc00000
45
46/*
47 * CPU interrupt bits.
48 */
49#define KN01_CPU_INR_BUS 6 /* memory, I/O bus read/write errors */
50#define KN01_CPU_INR_VIDEO 6 /* PCC area detect #2 */
51#define KN01_CPU_INR_RTC 5 /* DS1287 RTC */
52#define KN01_CPU_INR_DZ11 4 /* DZ11 (DC7085) serial */
53#define KN01_CPU_INR_LANCE 3 /* LANCE (Am7990) Ethernet */
54#define KN01_CPU_INR_SII 2 /* SII (DC7061) SCSI */
55
56
57/*
58 * System Control & Status Register bits.
59 */
60#define KN01_CSR_MNFMOD (1<<15) /* MNFMOD manufacturing jumper */
61#define KN01_CSR_STATUS (1<<14) /* self-test result status output */
62#define KN01_CSR_PARDIS (1<<13) /* parity error disable */
63#define KN01_CSR_CRSRTST (1<<12) /* PCC test output */
64#define KN01_CSR_MONO (1<<11) /* mono/color fb SIMM installed */
65#define KN01_CSR_MEMERR (1<<10) /* write timeout error status & ack*/
66#define KN01_CSR_VINT (1<<9) /* PCC area detect #2 status & ack */
67#define KN01_CSR_TXDIS (1<<8) /* DZ11 transmit disable */
68#define KN01_CSR_VBGTRG (1<<2) /* blue DAC voltage over green (r/o) */
69#define KN01_CSR_VRGTRG (1<<1) /* red DAC voltage over green (r/o) */
70#define KN01_CSR_VRGTRB (1<<0) /* red DAC voltage over blue (r/o) */
71#define KN01_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
72
73
74#ifndef __ASSEMBLY__
75
76#include <linux/interrupt.h>
77#include <linux/spinlock.h>
78#include <linux/types.h>
79
80struct pt_regs;
81
82extern u16 cached_kn01_csr;
83
84extern void dec_kn01_be_init(void);
85extern int dec_kn01_be_handler(struct pt_regs *regs, int is_fixup);
86extern irqreturn_t dec_kn01_be_interrupt(int irq, void *dev_id);
87#endif
88
89#endif /* __ASM_MIPS_DEC_KN01_H */
diff --git a/arch/mips/include/asm/dec/kn02.h b/arch/mips/include/asm/dec/kn02.h
new file mode 100644
index 000000000..93430b5f4
--- /dev/null
+++ b/arch/mips/include/asm/dec/kn02.h
@@ -0,0 +1,91 @@
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, 2005 Maciej W. Rozycki
12 */
13#ifndef __ASM_MIPS_DEC_KN02_H
14#define __ASM_MIPS_DEC_KN02_H
15
16#define KN02_SLOT_BASE 0x1fc00000
17#define KN02_SLOT_SIZE 0x00080000
18
19/*
20 * Address ranges decoded by the "system slot" logic for onboard devices.
21 */
22#define KN02_SYS_ROM (0*KN02_SLOT_SIZE) /* system board ROM */
23#define KN02_RES_1 (1*KN02_SLOT_SIZE) /* unused */
24#define KN02_CHKSYN (2*KN02_SLOT_SIZE) /* ECC syndrome */
25#define KN02_ERRADDR (3*KN02_SLOT_SIZE) /* bus error address */
26#define KN02_DZ11 (4*KN02_SLOT_SIZE) /* DZ11 (DC7085) serial */
27#define KN02_RTC (5*KN02_SLOT_SIZE) /* DS1287 RTC */
28#define KN02_CSR (6*KN02_SLOT_SIZE) /* system ctrl & status reg */
29#define KN02_SYS_ROM_7 (7*KN02_SLOT_SIZE) /* system board ROM (alias) */
30
31
32/*
33 * System Control & Status Register bits.
34 */
35#define KN02_CSR_RES_28 (0xf<<28) /* unused */
36#define KN02_CSR_PSU (1<<27) /* power supply unit warning */
37#define KN02_CSR_NVRAM (1<<26) /* ~NVRAM clear jumper */
38#define KN02_CSR_REFEVEN (1<<25) /* mem refresh bank toggle */
39#define KN02_CSR_NRMOD (1<<24) /* ~NRMOD manufact. jumper */
40#define KN02_CSR_IOINTEN (0xff<<16) /* IRQ mask bits */
41#define KN02_CSR_DIAGCHK (1<<15) /* diagn/norml ECC reads */
42#define KN02_CSR_DIAGGEN (1<<14) /* diagn/norml ECC writes */
43#define KN02_CSR_CORRECT (1<<13) /* ECC correct/check */
44#define KN02_CSR_LEDIAG (1<<12) /* ECC diagn. latch strobe */
45#define KN02_CSR_TXDIS (1<<11) /* DZ11 transmit disable */
46#define KN02_CSR_BNK32M (1<<10) /* 32M/8M stride */
47#define KN02_CSR_DIAGDN (1<<9) /* DIAGDN manufact. jumper */
48#define KN02_CSR_BAUD38 (1<<8) /* DZ11 38/19kbps ext. rate */
49#define KN02_CSR_IOINT (0xff<<0) /* IRQ status bits (r/o) */
50#define KN02_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
51
52
53/*
54 * CPU interrupt bits.
55 */
56#define KN02_CPU_INR_RES_6 6 /* unused */
57#define KN02_CPU_INR_BUS 5 /* memory, I/O bus read/write errors */
58#define KN02_CPU_INR_RES_4 4 /* unused */
59#define KN02_CPU_INR_RTC 3 /* DS1287 RTC */
60#define KN02_CPU_INR_CASCADE 2 /* CSR cascade */
61
62/*
63 * CSR interrupt bits.
64 */
65#define KN02_CSR_INR_DZ11 7 /* DZ11 (DC7085) serial */
66#define KN02_CSR_INR_LANCE 6 /* LANCE (Am7990) Ethernet */
67#define KN02_CSR_INR_ASC 5 /* ASC (NCR53C94) SCSI */
68#define KN02_CSR_INR_RES_4 4 /* unused */
69#define KN02_CSR_INR_RES_3 3 /* unused */
70#define KN02_CSR_INR_TC2 2 /* TURBOchannel slot #2 */
71#define KN02_CSR_INR_TC1 1 /* TURBOchannel slot #1 */
72#define KN02_CSR_INR_TC0 0 /* TURBOchannel slot #0 */
73
74
75#define KN02_IRQ_BASE 8 /* first IRQ assigned to CSR */
76#define KN02_IRQ_LINES 8 /* number of CSR interrupts */
77
78#define KN02_IRQ_NR(n) ((n) + KN02_IRQ_BASE)
79#define KN02_IRQ_MASK(n) (1 << (n))
80#define KN02_IRQ_ALL 0xff
81
82
83#ifndef __ASSEMBLY__
84
85#include <linux/types.h>
86
87extern u32 cached_kn02_csr;
88extern void init_kn02_irqs(int base);
89#endif
90
91#endif /* __ASM_MIPS_DEC_KN02_H */
diff --git a/arch/mips/include/asm/dec/kn02ba.h b/arch/mips/include/asm/dec/kn02ba.h
new file mode 100644
index 000000000..81a6cc1c5
--- /dev/null
+++ b/arch/mips/include/asm/dec/kn02ba.h
@@ -0,0 +1,63 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/dec/kn02ba.h
4 *
5 * DECstation 5000/1xx (3min or KN02-BA) definitions.
6 *
7 * Copyright (C) 2002, 2003 Maciej W. Rozycki
8 */
9#ifndef __ASM_MIPS_DEC_KN02BA_H
10#define __ASM_MIPS_DEC_KN02BA_H
11
12#include <asm/dec/kn02xa.h> /* For common definitions. */
13
14/*
15 * CPU interrupt bits.
16 */
17#define KN02BA_CPU_INR_HALT 6 /* HALT button */
18#define KN02BA_CPU_INR_CASCADE 5 /* I/O ASIC cascade */
19#define KN02BA_CPU_INR_TC2 4 /* TURBOchannel slot #2 */
20#define KN02BA_CPU_INR_TC1 3 /* TURBOchannel slot #1 */
21#define KN02BA_CPU_INR_TC0 2 /* TURBOchannel slot #0 */
22
23/*
24 * I/O ASIC interrupt bits. Star marks denote non-IRQ status bits.
25 */
26#define KN02BA_IO_INR_RES_15 15 /* unused */
27#define KN02BA_IO_INR_NVRAM 14 /* (*) NVRAM clear jumper */
28#define KN02BA_IO_INR_RES_13 13 /* unused */
29#define KN02BA_IO_INR_BUS 12 /* memory, I/O bus read/write errors */
30#define KN02BA_IO_INR_RES_11 11 /* unused */
31#define KN02BA_IO_INR_NRMOD 10 /* (*) NRMOD manufacturing jumper */
32#define KN02BA_IO_INR_ASC 9 /* ASC (NCR53C94) SCSI */
33#define KN02BA_IO_INR_LANCE 8 /* LANCE (Am7990) Ethernet */
34#define KN02BA_IO_INR_SCC1 7 /* SCC (Z85C30) serial #1 */
35#define KN02BA_IO_INR_SCC0 6 /* SCC (Z85C30) serial #0 */
36#define KN02BA_IO_INR_RTC 5 /* DS1287 RTC */
37#define KN02BA_IO_INR_PSU 4 /* power supply unit warning */
38#define KN02BA_IO_INR_RES_3 3 /* unused */
39#define KN02BA_IO_INR_ASC_DATA 2 /* SCSI data ready (for PIO) */
40#define KN02BA_IO_INR_PBNC 1 /* ~HALT button debouncer */
41#define KN02BA_IO_INR_PBNO 0 /* HALT button debouncer */
42
43
44/*
45 * Memory Error Register bits.
46 */
47#define KN02BA_MER_RES_27 (1<<27) /* unused */
48
49/*
50 * Memory Size Register bits.
51 */
52#define KN02BA_MSR_RES_17 (0x3ff<<17) /* unused */
53
54/*
55 * I/O ASIC System Support Register bits.
56 */
57#define KN02BA_IO_SSR_TXDIS1 (1<<14) /* SCC1 transmit disable */
58#define KN02BA_IO_SSR_TXDIS0 (1<<13) /* SCC0 transmit disable */
59#define KN02BA_IO_SSR_RES_12 (1<<12) /* unused */
60
61#define KN02BA_IO_SSR_LEDS (0xff<<0) /* ~diagnostic LEDs */
62
63#endif /* __ASM_MIPS_DEC_KN02BA_H */
diff --git a/arch/mips/include/asm/dec/kn02ca.h b/arch/mips/include/asm/dec/kn02ca.h
new file mode 100644
index 000000000..a466101eb
--- /dev/null
+++ b/arch/mips/include/asm/dec/kn02ca.h
@@ -0,0 +1,75 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/dec/kn02ca.h
4 *
5 * Personal DECstation 5000/xx (Maxine or KN02-CA) definitions.
6 *
7 * Copyright (C) 2002, 2003 Maciej W. Rozycki
8 */
9#ifndef __ASM_MIPS_DEC_KN02CA_H
10#define __ASM_MIPS_DEC_KN02CA_H
11
12#include <asm/dec/kn02xa.h> /* For common definitions. */
13
14/*
15 * CPU interrupt bits.
16 */
17#define KN02CA_CPU_INR_HALT 6 /* HALT from ACCESS.Bus */
18#define KN02CA_CPU_INR_CASCADE 5 /* I/O ASIC cascade */
19#define KN02CA_CPU_INR_BUS 4 /* memory, I/O bus read/write errors */
20#define KN02CA_CPU_INR_RTC 3 /* DS1287 RTC */
21#define KN02CA_CPU_INR_TIMER 2 /* ARC periodic timer */
22
23/*
24 * I/O ASIC interrupt bits. Star marks denote non-IRQ status bits.
25 */
26#define KN02CA_IO_INR_FLOPPY 15 /* 82077 FDC */
27#define KN02CA_IO_INR_NVRAM 14 /* (*) NVRAM clear jumper */
28#define KN02CA_IO_INR_POWERON 13 /* (*) ACCESS.Bus/power-on reset */
29#define KN02CA_IO_INR_TC0 12 /* TURBOchannel slot #0 */
30#define KN02CA_IO_INR_TIMER 12 /* ARC periodic timer (?) */
31#define KN02CA_IO_INR_ISDN 11 /* Am79C30A ISDN */
32#define KN02CA_IO_INR_NRMOD 10 /* (*) NRMOD manufacturing jumper */
33#define KN02CA_IO_INR_ASC 9 /* ASC (NCR53C94) SCSI */
34#define KN02CA_IO_INR_LANCE 8 /* LANCE (Am7990) Ethernet */
35#define KN02CA_IO_INR_HDFLOPPY 7 /* (*) HD (1.44MB) floppy status */
36#define KN02CA_IO_INR_SCC0 6 /* SCC (Z85C30) serial #0 */
37#define KN02CA_IO_INR_TC1 5 /* TURBOchannel slot #1 */
38#define KN02CA_IO_INR_XDFLOPPY 4 /* (*) XD (2.88MB) floppy status */
39#define KN02CA_IO_INR_VIDEO 3 /* framebuffer */
40#define KN02CA_IO_INR_XVIDEO 2 /* ~framebuffer */
41#define KN02CA_IO_INR_AB_XMIT 1 /* ACCESS.bus transmit */
42#define KN02CA_IO_INR_AB_RECV 0 /* ACCESS.bus receive */
43
44
45/*
46 * Memory Error Register bits.
47 */
48#define KN02CA_MER_INTR (1<<27) /* ARC IRQ status & ack */
49
50/*
51 * Memory Size Register bits.
52 */
53#define KN02CA_MSR_INTREN (1<<26) /* ARC periodic IRQ enable */
54#define KN02CA_MSR_MS10EN (1<<25) /* 10/1ms IRQ period select */
55#define KN02CA_MSR_PFORCE (0xf<<21) /* byte lane error force */
56#define KN02CA_MSR_MABEN (1<<20) /* A side VFB address enable */
57#define KN02CA_MSR_LASTBANK (0x7<<17) /* onboard RAM bank # */
58
59/*
60 * I/O ASIC System Support Register bits.
61 */
62#define KN03CA_IO_SSR_RES_14 (1<<14) /* unused */
63#define KN03CA_IO_SSR_RES_13 (1<<13) /* unused */
64#define KN03CA_IO_SSR_ISDN_RST (1<<12) /* ~ISDN (Am79C30A) reset */
65
66#define KN03CA_IO_SSR_FLOPPY_RST (1<<7) /* ~FDC (82077) reset */
67#define KN03CA_IO_SSR_VIDEO_RST (1<<6) /* ~framebuffer reset */
68#define KN03CA_IO_SSR_AB_RST (1<<5) /* ACCESS.bus reset */
69#define KN03CA_IO_SSR_RES_4 (1<<4) /* unused */
70#define KN03CA_IO_SSR_RES_3 (1<<4) /* unused */
71#define KN03CA_IO_SSR_RES_2 (1<<2) /* unused */
72#define KN03CA_IO_SSR_RES_1 (1<<1) /* unused */
73#define KN03CA_IO_SSR_LED (1<<0) /* power LED */
74
75#endif /* __ASM_MIPS_DEC_KN02CA_H */
diff --git a/arch/mips/include/asm/dec/kn02xa.h b/arch/mips/include/asm/dec/kn02xa.h
new file mode 100644
index 000000000..b56b4577f
--- /dev/null
+++ b/arch/mips/include/asm/dec/kn02xa.h
@@ -0,0 +1,84 @@
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, 2005 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/dec/ioasic_addrs.h>
21
22#define KN02XA_SLOT_BASE 0x1c000000
23
24/*
25 * Memory control ASIC registers.
26 */
27#define KN02XA_MER 0x0c400000 /* memory error register */
28#define KN02XA_MSR 0x0c800000 /* memory size register */
29
30/*
31 * CPU control ASIC registers.
32 */
33#define KN02XA_MEM_CONF 0x0e000000 /* write timeout config */
34#define KN02XA_EAR 0x0e000004 /* error address register */
35#define KN02XA_BOOT0 0x0e000008 /* boot 0 register */
36#define KN02XA_MEM_INTR 0x0e00000c /* write err IRQ stat & ack */
37
38/*
39 * Memory Error Register bits, common definitions.
40 * The rest is defined in system-specific headers.
41 */
42#define KN02XA_MER_RES_28 (0xf<<28) /* unused */
43#define KN02XA_MER_RES_17 (0x3ff<<17) /* unused */
44#define KN02XA_MER_PAGERR (1<<16) /* 2k page boundary error */
45#define KN02XA_MER_TRANSERR (1<<15) /* transfer length error */
46#define KN02XA_MER_PARDIS (1<<14) /* parity error disable */
47#define KN02XA_MER_SIZE (1<<13) /* r/o mirror of MSR_SIZE */
48#define KN02XA_MER_RES_12 (1<<12) /* unused */
49#define KN02XA_MER_BYTERR (0xf<<8) /* byte lane error bitmask: */
50#define KN02XA_MER_BYTERR_3 (0x8<<8) /* byte lane #3 */
51#define KN02XA_MER_BYTERR_2 (0x4<<8) /* byte lane #2 */
52#define KN02XA_MER_BYTERR_1 (0x2<<8) /* byte lane #1 */
53#define KN02XA_MER_BYTERR_0 (0x1<<8) /* byte lane #0 */
54#define KN02XA_MER_RES_0 (0xff<<0) /* unused */
55
56/*
57 * Memory Size Register bits, common definitions.
58 * The rest is defined in system-specific headers.
59 */
60#define KN02XA_MSR_RES_27 (0x1f<<27) /* unused */
61#define KN02XA_MSR_RES_14 (0x7<<14) /* unused */
62#define KN02XA_MSR_SIZE (1<<13) /* 16M/4M stride */
63#define KN02XA_MSR_RES_0 (0x1fff<<0) /* unused */
64
65/*
66 * Error Address Register bits.
67 */
68#define KN02XA_EAR_RES_29 (0x7<<29) /* unused */
69#define KN02XA_EAR_ADDRESS (0x7ffffff<<2) /* address involved */
70#define KN02XA_EAR_RES_0 (0x3<<0) /* unused */
71
72
73#ifndef __ASSEMBLY__
74
75#include <linux/interrupt.h>
76
77struct pt_regs;
78
79extern void dec_kn02xa_be_init(void);
80extern int dec_kn02xa_be_handler(struct pt_regs *regs, int is_fixup);
81extern irqreturn_t dec_kn02xa_be_interrupt(int irq, void *dev_id);
82#endif
83
84#endif /* __ASM_MIPS_DEC_KN02XA_H */
diff --git a/arch/mips/include/asm/dec/kn03.h b/arch/mips/include/asm/dec/kn03.h
new file mode 100644
index 000000000..edede923f
--- /dev/null
+++ b/arch/mips/include/asm/dec/kn03.h
@@ -0,0 +1,74 @@
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, 2005 Maciej W. Rozycki
14 */
15#ifndef __ASM_MIPS_DEC_KN03_H
16#define __ASM_MIPS_DEC_KN03_H
17
18#include <asm/dec/ecc.h>
19#include <asm/dec/ioasic_addrs.h>
20
21#define KN03_SLOT_BASE 0x1f800000
22
23/*
24 * CPU interrupt bits.
25 */
26#define KN03_CPU_INR_HALT 6 /* HALT button */
27#define KN03_CPU_INR_BUS 5 /* memory, I/O bus read/write errors */
28#define KN03_CPU_INR_RES_4 4 /* unused */
29#define KN03_CPU_INR_RTC 3 /* DS1287 RTC */
30#define KN03_CPU_INR_CASCADE 2 /* I/O ASIC cascade */
31
32/*
33 * I/O ASIC interrupt bits. Star marks denote non-IRQ status bits.
34 */
35#define KN03_IO_INR_3MAXP 15 /* (*) 3max+/bigmax ID */
36#define KN03_IO_INR_NVRAM 14 /* (*) NVRAM clear jumper */
37#define KN03_IO_INR_TC2 13 /* TURBOchannel slot #2 */
38#define KN03_IO_INR_TC1 12 /* TURBOchannel slot #1 */
39#define KN03_IO_INR_TC0 11 /* TURBOchannel slot #0 */
40#define KN03_IO_INR_NRMOD 10 /* (*) NRMOD manufacturing jumper */
41#define KN03_IO_INR_ASC 9 /* ASC (NCR53C94) SCSI */
42#define KN03_IO_INR_LANCE 8 /* LANCE (Am7990) Ethernet */
43#define KN03_IO_INR_SCC1 7 /* SCC (Z85C30) serial #1 */
44#define KN03_IO_INR_SCC0 6 /* SCC (Z85C30) serial #0 */
45#define KN03_IO_INR_RTC 5 /* DS1287 RTC */
46#define KN03_IO_INR_PSU 4 /* power supply unit warning */
47#define KN03_IO_INR_RES_3 3 /* unused */
48#define KN03_IO_INR_ASC_DATA 2 /* SCSI data ready (for PIO) */
49#define KN03_IO_INR_PBNC 1 /* ~HALT button debouncer */
50#define KN03_IO_INR_PBNO 0 /* HALT button debouncer */
51
52
53/*
54 * Memory Control Register bits.
55 */
56#define KN03_MCR_RES_16 (0xffff<<16) /* unused */
57#define KN03_MCR_DIAGCHK (1<<15) /* diagn/norml ECC reads */
58#define KN03_MCR_DIAGGEN (1<<14) /* diagn/norml ECC writes */
59#define KN03_MCR_CORRECT (1<<13) /* ECC correct/check */
60#define KN03_MCR_RES_11 (0x3<<12) /* unused */
61#define KN03_MCR_BNK32M (1<<10) /* 32M/8M stride */
62#define KN03_MCR_RES_7 (0x7<<7) /* unused */
63#define KN03_MCR_CHECK (0x7f<<0) /* diagnostic check bits */
64
65/*
66 * I/O ASIC System Support Register bits.
67 */
68#define KN03_IO_SSR_TXDIS1 (1<<14) /* SCC1 transmit disable */
69#define KN03_IO_SSR_TXDIS0 (1<<13) /* SCC0 transmit disable */
70#define KN03_IO_SSR_RES_12 (1<<12) /* unused */
71
72#define KN03_IO_SSR_LEDS (0xff<<0) /* ~diagnostic LEDs */
73
74#endif /* __ASM_MIPS_DEC_KN03_H */
diff --git a/arch/mips/include/asm/dec/kn05.h b/arch/mips/include/asm/dec/kn05.h
new file mode 100644
index 000000000..3b1524e9f
--- /dev/null
+++ b/arch/mips/include/asm/dec/kn05.h
@@ -0,0 +1,81 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/dec/kn05.h
4 *
5 * DECstation/DECsystem 5000/260 (4max+ or KN05), 5000/150 (4min
6 * or KN04-BA), Personal DECstation/DECsystem 5000/50 (4maxine or
7 * KN04-CA) and DECsystem 5900/260 (KN05) R4k CPU card MB ASIC
8 * definitions.
9 *
10 * Copyright (C) 2002, 2003, 2005, 2008 Maciej W. Rozycki
11 *
12 * WARNING! All this information is pure guesswork based on the
13 * ROM. It is provided here in hope it will give someone some
14 * food for thought. No documentation for the KN05 nor the KN04
15 * module has been located so far.
16 */
17#ifndef __ASM_MIPS_DEC_KN05_H
18#define __ASM_MIPS_DEC_KN05_H
19
20#include <asm/dec/ioasic_addrs.h>
21
22/*
23 * The oncard MB (Memory Buffer) ASIC provides an additional address
24 * decoder. Certain address ranges within the "high" 16 slots are
25 * passed to the I/O ASIC's decoder like with the KN03 or KN02-BA/CA.
26 * Others are handled locally. "Low" slots are always passed.
27 */
28#define KN4K_SLOT_BASE 0x1fc00000
29
30#define KN4K_MB_ROM (0*IOASIC_SLOT_SIZE) /* KN05/KN04 card ROM */
31#define KN4K_IOCTL (1*IOASIC_SLOT_SIZE) /* I/O ASIC */
32#define KN4K_ESAR (2*IOASIC_SLOT_SIZE) /* LANCE MAC address chip */
33#define KN4K_LANCE (3*IOASIC_SLOT_SIZE) /* LANCE Ethernet */
34#define KN4K_MB_INT (4*IOASIC_SLOT_SIZE) /* MB interrupt register */
35#define KN4K_MB_EA (5*IOASIC_SLOT_SIZE) /* MB error address? */
36#define KN4K_MB_EC (6*IOASIC_SLOT_SIZE) /* MB error ??? */
37#define KN4K_MB_CSR (7*IOASIC_SLOT_SIZE) /* MB control & status */
38#define KN4K_RES_08 (8*IOASIC_SLOT_SIZE) /* unused? */
39#define KN4K_RES_09 (9*IOASIC_SLOT_SIZE) /* unused? */
40#define KN4K_RES_10 (10*IOASIC_SLOT_SIZE) /* unused? */
41#define KN4K_RES_11 (11*IOASIC_SLOT_SIZE) /* unused? */
42#define KN4K_SCSI (12*IOASIC_SLOT_SIZE) /* ASC SCSI */
43#define KN4K_RES_13 (13*IOASIC_SLOT_SIZE) /* unused? */
44#define KN4K_RES_14 (14*IOASIC_SLOT_SIZE) /* unused? */
45#define KN4K_RES_15 (15*IOASIC_SLOT_SIZE) /* unused? */
46
47/*
48 * MB ASIC interrupt bits.
49 */
50#define KN4K_MB_INR_MB 4 /* ??? */
51#define KN4K_MB_INR_MT 3 /* memory, I/O bus read/write errors */
52#define KN4K_MB_INR_RES_2 2 /* unused */
53#define KN4K_MB_INR_RTC 1 /* RTC */
54#define KN4K_MB_INR_TC 0 /* I/O ASIC cascade */
55
56/*
57 * Bits for the MB interrupt register.
58 * The register appears read-only.
59 */
60#define KN4K_MB_INT_IRQ (0x1f<<0) /* CPU Int[4:0] status. */
61#define KN4K_MB_INT_IRQ_N(n) (1<<(n)) /* Individual status bits. */
62
63/*
64 * Bits for the MB control & status register.
65 * Set to 0x00bf8001 for KN05 and to 0x003f8000 for KN04 by the firmware.
66 */
67#define KN4K_MB_CSR_PF (1<<0) /* PreFetching enable? */
68#define KN4K_MB_CSR_F (1<<1) /* ??? */
69#define KN4K_MB_CSR_ECC (0xff<<2) /* ??? */
70#define KN4K_MB_CSR_OD (1<<10) /* ??? */
71#define KN4K_MB_CSR_CP (1<<11) /* ??? */
72#define KN4K_MB_CSR_UNC (1<<12) /* ??? */
73#define KN4K_MB_CSR_IM (1<<13) /* ??? */
74#define KN4K_MB_CSR_NC (1<<14) /* ??? */
75#define KN4K_MB_CSR_EE (1<<15) /* (bus) Exception Enable? */
76#define KN4K_MB_CSR_MSK (0x1f<<16) /* CPU Int[4:0] mask */
77#define KN4K_MB_CSR_MSK_N(n) (1<<((n)+16)) /* Individual mask bits. */
78#define KN4K_MB_CSR_FW (1<<21) /* ??? */
79#define KN4K_MB_CSR_W (1<<31) /* ??? */
80
81#endif /* __ASM_MIPS_DEC_KN05_H */
diff --git a/arch/mips/include/asm/dec/kn230.h b/arch/mips/include/asm/dec/kn230.h
new file mode 100644
index 000000000..cb13a7799
--- /dev/null
+++ b/arch/mips/include/asm/dec/kn230.h
@@ -0,0 +1,22 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/dec/kn230.h
4 *
5 * DECsystem 5100 (MIPSmate or KN230) definitions.
6 *
7 * Copyright (C) 2002, 2003 Maciej W. Rozycki
8 */
9#ifndef __ASM_MIPS_DEC_KN230_H
10#define __ASM_MIPS_DEC_KN230_H
11
12/*
13 * CPU interrupt bits.
14 */
15#define KN230_CPU_INR_HALT 6 /* HALT button */
16#define KN230_CPU_INR_BUS 5 /* memory, I/O bus read/write errors */
17#define KN230_CPU_INR_RTC 4 /* DS1287 RTC */
18#define KN230_CPU_INR_SII 3 /* SII (DC7061) SCSI */
19#define KN230_CPU_INR_LANCE 3 /* LANCE (Am7990) Ethernet */
20#define KN230_CPU_INR_DZ11 2 /* DZ11 (DC7085) serial */
21
22#endif /* __ASM_MIPS_DEC_KN230_H */
diff --git a/arch/mips/include/asm/dec/machtype.h b/arch/mips/include/asm/dec/machtype.h
new file mode 100644
index 000000000..a6ecdebc4
--- /dev/null
+++ b/arch/mips/include/asm/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/arch/mips/include/asm/dec/prom.h b/arch/mips/include/asm/dec/prom.h
new file mode 100644
index 000000000..1e1247add
--- /dev/null
+++ b/arch/mips/include/asm/dec/prom.h
@@ -0,0 +1,165 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/dec/prom.h
4 *
5 * DECstation PROM interface.
6 *
7 * Copyright (C) 2002 Maciej W. Rozycki
8 *
9 * Based on arch/mips/dec/prom/prom.h by the Anonymous.
10 */
11#ifndef _ASM_DEC_PROM_H
12#define _ASM_DEC_PROM_H
13
14#include <linux/types.h>
15
16#include <asm/addrspace.h>
17
18/*
19 * PMAX/3MAX PROM entry points for DS2100/3100's and DS5000/2xx's.
20 * Many of these will work for MIPSen as well!
21 */
22#define VEC_RESET (u64 *)CKSEG1ADDR(0x1fc00000)
23 /* Prom base address */
24
25#define PMAX_PROM_ENTRY(x) (VEC_RESET + (x)) /* Prom jump table */
26
27#define PMAX_PROM_HALT PMAX_PROM_ENTRY(2) /* valid on MIPSen */
28#define PMAX_PROM_AUTOBOOT PMAX_PROM_ENTRY(5) /* valid on MIPSen */
29#define PMAX_PROM_OPEN PMAX_PROM_ENTRY(6)
30#define PMAX_PROM_READ PMAX_PROM_ENTRY(7)
31#define PMAX_PROM_CLOSE PMAX_PROM_ENTRY(10)
32#define PMAX_PROM_LSEEK PMAX_PROM_ENTRY(11)
33#define PMAX_PROM_GETCHAR PMAX_PROM_ENTRY(12)
34#define PMAX_PROM_PUTCHAR PMAX_PROM_ENTRY(13) /* 12 on MIPSen */
35#define PMAX_PROM_GETS PMAX_PROM_ENTRY(15)
36#define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17)
37#define PMAX_PROM_GETENV PMAX_PROM_ENTRY(33) /* valid on MIPSen */
38
39
40/*
41 * Magic number indicating REX PROM available on DECstation. Found in
42 * register a2 on transfer of control to program from PROM.
43 */
44#define REX_PROM_MAGIC 0x30464354
45
46/* KN04 and KN05 are REX PROMs, so only do the check for R3k systems. */
47static inline bool prom_is_rex(u32 magic)
48{
49 return !IS_ENABLED(CONFIG_CPU_R3000) || magic == REX_PROM_MAGIC;
50}
51
52/*
53 * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and
54 * DS5000/2x0.
55 */
56#define REX_PROM_GETBITMAP 0x84/4 /* get mem bitmap */
57#define REX_PROM_GETCHAR 0x24/4 /* getch() */
58#define REX_PROM_GETENV 0x64/4 /* get env. variable */
59#define REX_PROM_GETSYSID 0x80/4 /* get system id */
60#define REX_PROM_GETTCINFO 0xa4/4
61#define REX_PROM_PRINTF 0x30/4 /* printf() */
62#define REX_PROM_SLOTADDR 0x6c/4 /* slotaddr */
63#define REX_PROM_BOOTINIT 0x54/4 /* open() */
64#define REX_PROM_BOOTREAD 0x58/4 /* read() */
65#define REX_PROM_CLEARCACHE 0x7c/4
66
67
68/*
69 * Used by rex_getbitmap().
70 */
71typedef struct {
72 int pagesize;
73 unsigned char bitmap[0];
74} memmap;
75
76
77/*
78 * Function pointers as read from a PROM's callback vector.
79 */
80extern int (*__rex_bootinit)(void);
81extern int (*__rex_bootread)(void);
82extern int (*__rex_getbitmap)(memmap *);
83extern unsigned long *(*__rex_slot_address)(int);
84extern void *(*__rex_gettcinfo)(void);
85extern int (*__rex_getsysid)(void);
86extern void (*__rex_clear_cache)(void);
87
88extern int (*__prom_getchar)(void);
89extern char *(*__prom_getenv)(char *);
90extern int (*__prom_printf)(char *, ...);
91
92extern int (*__pmax_open)(char*, int);
93extern int (*__pmax_lseek)(int, long, int);
94extern int (*__pmax_read)(int, void *, int);
95extern int (*__pmax_close)(int);
96
97
98#ifdef CONFIG_64BIT
99
100/*
101 * On MIPS64 we have to call PROM functions via a helper
102 * dispatcher to accommodate ABI incompatibilities.
103 */
104#define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \
105 __asm__(#fun " = call_o32")
106
107int __DEC_PROM_O32(_rex_bootinit, (int (*)(void), void *));
108int __DEC_PROM_O32(_rex_bootread, (int (*)(void), void *));
109int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), void *, memmap *));
110unsigned long *__DEC_PROM_O32(_rex_slot_address,
111 (unsigned long *(*)(int), void *, int));
112void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void), void *));
113int __DEC_PROM_O32(_rex_getsysid, (int (*)(void), void *));
114void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void), void *));
115
116int __DEC_PROM_O32(_prom_getchar, (int (*)(void), void *));
117char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), void *, char *));
118int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), void *, char *, ...));
119
120
121#define rex_bootinit() _rex_bootinit(__rex_bootinit, NULL)
122#define rex_bootread() _rex_bootread(__rex_bootread, NULL)
123#define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, NULL, x)
124#define rex_slot_address(x) _rex_slot_address(__rex_slot_address, NULL, x)
125#define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo, NULL)
126#define rex_getsysid() _rex_getsysid(__rex_getsysid, NULL)
127#define rex_clear_cache() _rex_clear_cache(__rex_clear_cache, NULL)
128
129#define prom_getchar() _prom_getchar(__prom_getchar, NULL)
130#define prom_getenv(x) _prom_getenv(__prom_getenv, NULL, x)
131#define prom_printf(x...) _prom_printf(__prom_printf, NULL, x)
132
133#else /* !CONFIG_64BIT */
134
135/*
136 * On plain MIPS we just call PROM functions directly.
137 */
138#define rex_bootinit __rex_bootinit
139#define rex_bootread __rex_bootread
140#define rex_getbitmap __rex_getbitmap
141#define rex_slot_address __rex_slot_address
142#define rex_gettcinfo __rex_gettcinfo
143#define rex_getsysid __rex_getsysid
144#define rex_clear_cache __rex_clear_cache
145
146#define prom_getchar __prom_getchar
147#define prom_getenv __prom_getenv
148#define prom_printf __prom_printf
149
150#define pmax_open __pmax_open
151#define pmax_lseek __pmax_lseek
152#define pmax_read __pmax_read
153#define pmax_close __pmax_close
154
155#endif /* !CONFIG_64BIT */
156
157
158extern void prom_meminit(u32);
159extern void prom_identify_arch(u32);
160extern void prom_init_cmdline(s32, s32 *, u32);
161
162extern void register_prom_console(void);
163extern void unregister_prom_console(void);
164
165#endif /* _ASM_DEC_PROM_H */
diff --git a/arch/mips/include/asm/dec/system.h b/arch/mips/include/asm/dec/system.h
new file mode 100644
index 000000000..d0873fd4e
--- /dev/null
+++ b/arch/mips/include/asm/dec/system.h
@@ -0,0 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/dec/system.h
4 *
5 * Generic DECstation/DECsystem bits.
6 *
7 * Copyright (C) 2005, 2006 Maciej W. Rozycki
8 */
9#ifndef __ASM_DEC_SYSTEM_H
10#define __ASM_DEC_SYSTEM_H
11
12extern unsigned long dec_kn_slot_base, dec_kn_slot_size;
13extern int dec_tc_bus;
14
15#endif /* __ASM_DEC_SYSTEM_H */
diff --git a/arch/mips/include/asm/delay.h b/arch/mips/include/asm/delay.h
new file mode 100644
index 000000000..dc0a5f77a
--- /dev/null
+++ b/arch/mips/include/asm/delay.h
@@ -0,0 +1,32 @@
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 * Copyright (C) 2007 Maciej W. Rozycki
10 */
11#ifndef _ASM_DELAY_H
12#define _ASM_DELAY_H
13
14#include <linux/param.h>
15
16extern void __delay(unsigned long loops);
17extern void __ndelay(unsigned long ns);
18extern void __udelay(unsigned long us);
19
20#define ndelay(ns) __ndelay(ns)
21#define udelay(us) __udelay(us)
22
23/* make sure "usecs *= ..." in udelay do not overflow. */
24#if HZ >= 1000
25#define MAX_UDELAY_MS 1
26#elif HZ <= 200
27#define MAX_UDELAY_MS 5
28#else
29#define MAX_UDELAY_MS (1000 / HZ)
30#endif
31
32#endif /* _ASM_DELAY_H */
diff --git a/arch/mips/include/asm/div64.h b/arch/mips/include/asm/div64.h
new file mode 100644
index 000000000..ceece76fc
--- /dev/null
+++ b/arch/mips/include/asm/div64.h
@@ -0,0 +1,91 @@
1/*
2 * Copyright (C) 2000, 2004, 2021 Maciej W. Rozycki
3 * Copyright (C) 2003, 07 Ralf Baechle (ralf@linux-mips.org)
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#include <asm/bitsperlong.h>
13
14#if BITS_PER_LONG == 32
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 __cf, __tmp, __tmp2, __i; \
22 unsigned long __quot32, __mod32; \
23 \
24 __asm__( \
25 " .set push \n" \
26 " .set noat \n" \
27 " .set noreorder \n" \
28 " move %2, $0 \n" \
29 " move %3, $0 \n" \
30 " b 1f \n" \
31 " li %4, 0x21 \n" \
32 "0: \n" \
33 " sll $1, %0, 0x1 \n" \
34 " srl %3, %0, 0x1f \n" \
35 " or %0, $1, %5 \n" \
36 " sll %1, %1, 0x1 \n" \
37 " sll %2, %2, 0x1 \n" \
38 "1: \n" \
39 " bnez %3, 2f \n" \
40 " sltu %5, %0, %z6 \n" \
41 " bnez %5, 3f \n" \
42 "2: \n" \
43 " addiu %4, %4, -1 \n" \
44 " subu %0, %0, %z6 \n" \
45 " addiu %2, %2, 1 \n" \
46 "3: \n" \
47 " bnez %4, 0b \n" \
48 " srl %5, %1, 0x1f \n" \
49 " .set pop" \
50 : "=&r" (__mod32), "=&r" (__tmp), \
51 "=&r" (__quot32), "=&r" (__cf), \
52 "=&r" (__i), "=&r" (__tmp2) \
53 : "Jr" (base), "0" (high), "1" (low)); \
54 \
55 (res) = __quot32; \
56 __mod32; \
57})
58
59#define __div64_32(n, base) ({ \
60 unsigned long __upper, __low, __high, __radix; \
61 unsigned long long __quot; \
62 unsigned long long __div; \
63 unsigned long __mod; \
64 \
65 __div = (*n); \
66 __radix = (base); \
67 \
68 __high = __div >> 32; \
69 __low = __div; \
70 \
71 if (__high < __radix) { \
72 __upper = __high; \
73 __high = 0; \
74 } else { \
75 __upper = __high % __radix; \
76 __high /= __radix; \
77 } \
78 \
79 __mod = do_div64_32(__low, __upper, __low, __radix); \
80 \
81 __quot = __high; \
82 __quot = __quot << 32 | __low; \
83 (*n) = __quot; \
84 __mod; \
85})
86
87#endif /* BITS_PER_LONG == 32 */
88
89#include <asm-generic/div64.h>
90
91#endif /* __ASM_DIV64_H */
diff --git a/arch/mips/include/asm/dma-coherence.h b/arch/mips/include/asm/dma-coherence.h
new file mode 100644
index 000000000..5eaa1fcc8
--- /dev/null
+++ b/arch/mips/include/asm/dma-coherence.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) 2006 Ralf Baechle <ralf@linux-mips.org>
7 *
8 */
9#ifndef __ASM_DMA_COHERENCE_H
10#define __ASM_DMA_COHERENCE_H
11
12enum coherent_io_user_state {
13 IO_COHERENCE_DEFAULT,
14 IO_COHERENCE_ENABLED,
15 IO_COHERENCE_DISABLED,
16};
17
18#if defined(CONFIG_DMA_PERDEV_COHERENT)
19/* Don't provide (hw_)coherentio to avoid misuse */
20#elif defined(CONFIG_DMA_MAYBE_COHERENT)
21extern enum coherent_io_user_state coherentio;
22extern int hw_coherentio;
23
24static inline bool dev_is_dma_coherent(struct device *dev)
25{
26 return coherentio == IO_COHERENCE_ENABLED ||
27 (coherentio == IO_COHERENCE_DEFAULT && hw_coherentio);
28}
29#else
30#ifdef CONFIG_DMA_NONCOHERENT
31#define coherentio IO_COHERENCE_DISABLED
32#else
33#define coherentio IO_COHERENCE_ENABLED
34#endif
35#define hw_coherentio 0
36#endif /* CONFIG_DMA_MAYBE_COHERENT */
37
38#endif
diff --git a/arch/mips/include/asm/dma-direct.h b/arch/mips/include/asm/dma-direct.h
new file mode 100644
index 000000000..9a6401183
--- /dev/null
+++ b/arch/mips/include/asm/dma-direct.h
@@ -0,0 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _MIPS_DMA_DIRECT_H
3#define _MIPS_DMA_DIRECT_H 1
4
5dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
6phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
7
8#endif /* _MIPS_DMA_DIRECT_H */
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
new file mode 100644
index 000000000..34de7b17b
--- /dev/null
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -0,0 +1,18 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_DMA_MAPPING_H
3#define _ASM_DMA_MAPPING_H
4
5#include <linux/swiotlb.h>
6
7extern const struct dma_map_ops jazz_dma_ops;
8
9static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
10{
11#if defined(CONFIG_MACH_JAZZ)
12 return &jazz_dma_ops;
13#else
14 return NULL;
15#endif
16}
17
18#endif /* _ASM_DMA_MAPPING_H */
diff --git a/arch/mips/include/asm/dma.h b/arch/mips/include/asm/dma.h
new file mode 100644
index 000000000..be726b943
--- /dev/null
+++ b/arch/mips/include/asm/dma.h
@@ -0,0 +1,318 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * linux/include/asm/dma.h: Defines for using and allocating dma channels.
4 * Written by Hennus Bergman, 1992.
5 * High DMA channel support & info by Hannu Savolainen
6 * and John Boyd, Nov. 1992.
7 *
8 * NOTE: all this is true *only* for ISA/EISA expansions on Mips boards
9 * and can only be used for expansion cards. Onboard DMA controllers, such
10 * as the R4030 on Jazz boards behave totally different!
11 */
12
13#ifndef _ASM_DMA_H
14#define _ASM_DMA_H
15
16#include <asm/io.h> /* need byte IO */
17#include <linux/spinlock.h> /* And spinlocks */
18#include <linux/delay.h>
19
20
21#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
22#define dma_outb outb_p
23#else
24#define dma_outb outb
25#endif
26
27#define dma_inb inb
28
29/*
30 * NOTES about DMA transfers:
31 *
32 * controller 1: channels 0-3, byte operations, ports 00-1F
33 * controller 2: channels 4-7, word operations, ports C0-DF
34 *
35 * - ALL registers are 8 bits only, regardless of transfer size
36 * - channel 4 is not used - cascades 1 into 2.
37 * - channels 0-3 are byte - addresses/counts are for physical bytes
38 * - channels 5-7 are word - addresses/counts are for physical words
39 * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries
40 * - transfer count loaded to registers is 1 less than actual count
41 * - controller 2 offsets are all even (2x offsets for controller 1)
42 * - page registers for 5-7 don't use data bit 0, represent 128K pages
43 * - page registers for 0-3 use bit 0, represent 64K pages
44 *
45 * DMA transfers are limited to the lower 16MB of _physical_ memory.
46 * Note that addresses loaded into registers must be _physical_ addresses,
47 * not logical addresses (which may differ if paging is active).
48 *
49 * Address mapping for channels 0-3:
50 *
51 * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses)
52 * | ... | | ... | | ... |
53 * | ... | | ... | | ... |
54 * | ... | | ... | | ... |
55 * P7 ... P0 A7 ... A0 A7 ... A0
56 * | Page | Addr MSB | Addr LSB | (DMA registers)
57 *
58 * Address mapping for channels 5-7:
59 *
60 * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses)
61 * | ... | \ \ ... \ \ \ ... \ \
62 * | ... | \ \ ... \ \ \ ... \ (not used)
63 * | ... | \ \ ... \ \ \ ... \
64 * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0
65 * | Page | Addr MSB | Addr LSB | (DMA registers)
66 *
67 * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
68 * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at
69 * the hardware level, so odd-byte transfers aren't possible).
70 *
71 * Transfer count (_not # bytes_) is limited to 64K, represented as actual
72 * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more,
73 * and up to 128K bytes may be transferred on channels 5-7 in one operation.
74 *
75 */
76
77#ifndef CONFIG_GENERIC_ISA_DMA_SUPPORT_BROKEN
78#define MAX_DMA_CHANNELS 8
79#endif
80
81/*
82 * The maximum address in KSEG0 that we can perform a DMA transfer to on this
83 * platform. This describes only the PC style part of the DMA logic like on
84 * Deskstations or Acer PICA but not the much more versatile DMA logic used
85 * for the local devices on Acer PICA or Magnums.
86 */
87#if defined(CONFIG_SGI_IP22) || defined(CONFIG_SGI_IP28)
88/* don't care; ISA bus master won't work, ISA slave DMA supports 32bit addr */
89#define MAX_DMA_ADDRESS PAGE_OFFSET
90#else
91#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
92#endif
93#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS))
94
95#ifndef MAX_DMA32_PFN
96#define MAX_DMA32_PFN (1UL << (32 - PAGE_SHIFT))
97#endif
98
99/* 8237 DMA controllers */
100#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
101#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
102
103/* DMA controller registers */
104#define DMA1_CMD_REG 0x08 /* command register (w) */
105#define DMA1_STAT_REG 0x08 /* status register (r) */
106#define DMA1_REQ_REG 0x09 /* request register (w) */
107#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
108#define DMA1_MODE_REG 0x0B /* mode register (w) */
109#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
110#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
111#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
112#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
113#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
114
115#define DMA2_CMD_REG 0xD0 /* command register (w) */
116#define DMA2_STAT_REG 0xD0 /* status register (r) */
117#define DMA2_REQ_REG 0xD2 /* request register (w) */
118#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
119#define DMA2_MODE_REG 0xD6 /* mode register (w) */
120#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
121#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
122#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
123#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
124#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
125
126#define DMA_ADDR_0 0x00 /* DMA address registers */
127#define DMA_ADDR_1 0x02
128#define DMA_ADDR_2 0x04
129#define DMA_ADDR_3 0x06
130#define DMA_ADDR_4 0xC0
131#define DMA_ADDR_5 0xC4
132#define DMA_ADDR_6 0xC8
133#define DMA_ADDR_7 0xCC
134
135#define DMA_CNT_0 0x01 /* DMA count registers */
136#define DMA_CNT_1 0x03
137#define DMA_CNT_2 0x05
138#define DMA_CNT_3 0x07
139#define DMA_CNT_4 0xC2
140#define DMA_CNT_5 0xC6
141#define DMA_CNT_6 0xCA
142#define DMA_CNT_7 0xCE
143
144#define DMA_PAGE_0 0x87 /* DMA page registers */
145#define DMA_PAGE_1 0x83
146#define DMA_PAGE_2 0x81
147#define DMA_PAGE_3 0x82
148#define DMA_PAGE_5 0x8B
149#define DMA_PAGE_6 0x89
150#define DMA_PAGE_7 0x8A
151
152#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
153#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
154#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
155
156#define DMA_AUTOINIT 0x10
157
158extern spinlock_t dma_spin_lock;
159
160static __inline__ unsigned long claim_dma_lock(void)
161{
162 unsigned long flags;
163 spin_lock_irqsave(&dma_spin_lock, flags);
164 return flags;
165}
166
167static __inline__ void release_dma_lock(unsigned long flags)
168{
169 spin_unlock_irqrestore(&dma_spin_lock, flags);
170}
171
172/* enable/disable a specific DMA channel */
173static __inline__ void enable_dma(unsigned int dmanr)
174{
175 if (dmanr<=3)
176 dma_outb(dmanr, DMA1_MASK_REG);
177 else
178 dma_outb(dmanr & 3, DMA2_MASK_REG);
179}
180
181static __inline__ void disable_dma(unsigned int dmanr)
182{
183 if (dmanr<=3)
184 dma_outb(dmanr | 4, DMA1_MASK_REG);
185 else
186 dma_outb((dmanr & 3) | 4, DMA2_MASK_REG);
187}
188
189/* Clear the 'DMA Pointer Flip Flop'.
190 * Write 0 for LSB/MSB, 1 for MSB/LSB access.
191 * Use this once to initialize the FF to a known state.
192 * After that, keep track of it. :-)
193 * --- In order to do that, the DMA routines below should ---
194 * --- only be used while holding the DMA lock ! ---
195 */
196static __inline__ void clear_dma_ff(unsigned int dmanr)
197{
198 if (dmanr<=3)
199 dma_outb(0, DMA1_CLEAR_FF_REG);
200 else
201 dma_outb(0, DMA2_CLEAR_FF_REG);
202}
203
204/* set mode (above) for a specific DMA channel */
205static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
206{
207 if (dmanr<=3)
208 dma_outb(mode | dmanr, DMA1_MODE_REG);
209 else
210 dma_outb(mode | (dmanr&3), DMA2_MODE_REG);
211}
212
213/* Set only the page register bits of the transfer address.
214 * This is used for successive transfers when we know the contents of
215 * the lower 16 bits of the DMA current address register, but a 64k boundary
216 * may have been crossed.
217 */
218static __inline__ void set_dma_page(unsigned int dmanr, char pagenr)
219{
220 switch(dmanr) {
221 case 0:
222 dma_outb(pagenr, DMA_PAGE_0);
223 break;
224 case 1:
225 dma_outb(pagenr, DMA_PAGE_1);
226 break;
227 case 2:
228 dma_outb(pagenr, DMA_PAGE_2);
229 break;
230 case 3:
231 dma_outb(pagenr, DMA_PAGE_3);
232 break;
233 case 5:
234 dma_outb(pagenr & 0xfe, DMA_PAGE_5);
235 break;
236 case 6:
237 dma_outb(pagenr & 0xfe, DMA_PAGE_6);
238 break;
239 case 7:
240 dma_outb(pagenr & 0xfe, DMA_PAGE_7);
241 break;
242 }
243}
244
245
246/* Set transfer address & page bits for specific DMA channel.
247 * Assumes dma flipflop is clear.
248 */
249static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
250{
251 set_dma_page(dmanr, a>>16);
252 if (dmanr <= 3) {
253 dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
254 dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
255 } else {
256 dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
257 dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
258 }
259}
260
261
262/* Set transfer size (max 64k for DMA0..3, 128k for DMA5..7) for
263 * a specific DMA channel.
264 * You must ensure the parameters are valid.
265 * NOTE: from a manual: "the number of transfers is one more
266 * than the initial word count"! This is taken into account.
267 * Assumes dma flip-flop is clear.
268 * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
269 */
270static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
271{
272 count--;
273 if (dmanr <= 3) {
274 dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
275 dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
276 } else {
277 dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
278 dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
279 }
280}
281
282
283/* Get DMA residue count. After a DMA transfer, this
284 * should return zero. Reading this while a DMA transfer is
285 * still in progress will return unpredictable results.
286 * If called before the channel has been used, it may return 1.
287 * Otherwise, it returns the number of _bytes_ left to transfer.
288 *
289 * Assumes DMA flip-flop is clear.
290 */
291static __inline__ int get_dma_residue(unsigned int dmanr)
292{
293 unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
294 : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
295
296 /* using short to get 16-bit wrap around */
297 unsigned short count;
298
299 count = 1 + dma_inb(io_port);
300 count += dma_inb(io_port) << 8;
301
302 return (dmanr<=3)? count : (count<<1);
303}
304
305
306/* These are in kernel/dma.c: */
307extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
308extern void free_dma(unsigned int dmanr); /* release it again */
309
310/* From PCI */
311
312#ifdef CONFIG_PCI
313extern int isa_dma_bridge_buggy;
314#else
315#define isa_dma_bridge_buggy (0)
316#endif
317
318#endif /* _ASM_DMA_H */
diff --git a/arch/mips/include/asm/dmi.h b/arch/mips/include/asm/dmi.h
new file mode 100644
index 000000000..27415a288
--- /dev/null
+++ b/arch/mips/include/asm/dmi.h
@@ -0,0 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_DMI_H
3#define _ASM_DMI_H
4
5#include <linux/io.h>
6#include <linux/memblock.h>
7
8#define dmi_early_remap(x, l) ioremap_cache(x, l)
9#define dmi_early_unmap(x, l) iounmap(x)
10#define dmi_remap(x, l) ioremap_cache(x, l)
11#define dmi_unmap(x) iounmap(x)
12
13/* MIPS initialize DMI scan before SLAB is ready, so we use memblock here */
14#define dmi_alloc(l) memblock_alloc_low(l, PAGE_SIZE)
15
16#if defined(CONFIG_MACH_LOONGSON64)
17#define SMBIOS_ENTRY_POINT_SCAN_START 0xFFFE000
18#endif
19
20#endif /* _ASM_DMI_H */
diff --git a/arch/mips/include/asm/ds1287.h b/arch/mips/include/asm/ds1287.h
new file mode 100644
index 000000000..46cfb01f9
--- /dev/null
+++ b/arch/mips/include/asm/ds1287.h
@@ -0,0 +1,14 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * DS1287 timer functions.
4 *
5 * Copyright (C) 2008 Yoichi Yuasa <yuasa@linux-mips.org>
6 */
7#ifndef __ASM_DS1287_H
8#define __ASM_DS1287_H
9
10extern int ds1287_timer_state(void);
11extern void ds1287_set_base_clock(unsigned int clock);
12extern int ds1287_clockevent_init(int irq);
13
14#endif
diff --git a/arch/mips/include/asm/dsemul.h b/arch/mips/include/asm/dsemul.h
new file mode 100644
index 000000000..08bfe8fa3
--- /dev/null
+++ b/arch/mips/include/asm/dsemul.h
@@ -0,0 +1,115 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2016 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_DSEMUL_H__
8#define __MIPS_ASM_DSEMUL_H__
9
10#include <asm/break.h>
11#include <asm/inst.h>
12
13/* Break instruction with special math emu break code set */
14#define BREAK_MATH(micromips) (((micromips) ? 0x7 : 0xd) | (BRK_MEMU << 16))
15
16/* When used as a frame index, indicates the lack of a frame */
17#define BD_EMUFRAME_NONE ((int)BIT(31))
18
19struct mm_struct;
20struct pt_regs;
21struct task_struct;
22
23/**
24 * mips_dsemul() - 'Emulate' an instruction from a branch delay slot
25 * @regs: User thread register context.
26 * @ir: The instruction to be 'emulated'.
27 * @branch_pc: The PC of the branch instruction.
28 * @cont_pc: The PC to continue at following 'emulation'.
29 *
30 * Emulate or execute an arbitrary MIPS instruction within the context of
31 * the current user thread. This is used primarily to handle instructions
32 * in the delay slots of emulated branch instructions, for example FP
33 * branch instructions on systems without an FPU.
34 *
35 * Return: Zero on success, negative if ir is a NOP, signal number on failure.
36 */
37extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir,
38 unsigned long branch_pc, unsigned long cont_pc);
39
40/**
41 * do_dsemulret() - Return from a delay slot 'emulation' frame
42 * @xcp: User thread register context.
43 *
44 * Call in response to the BRK_MEMU break instruction used to return to
45 * the kernel from branch delay slot 'emulation' frames following a call
46 * to mips_dsemul(). Restores the user thread PC to the value that was
47 * passed as the cpc parameter to mips_dsemul().
48 *
49 * Return: True if an emulation frame was returned from, else false.
50 */
51#ifdef CONFIG_MIPS_FP_SUPPORT
52extern bool do_dsemulret(struct pt_regs *xcp);
53#else
54static inline bool do_dsemulret(struct pt_regs *xcp)
55{
56 return false;
57}
58#endif
59
60/**
61 * dsemul_thread_cleanup() - Cleanup thread 'emulation' frame
62 * @tsk: The task structure associated with the thread
63 *
64 * If the thread @tsk has a branch delay slot 'emulation' frame
65 * allocated to it then free that frame.
66 *
67 * Return: True if a frame was freed, else false.
68 */
69#ifdef CONFIG_MIPS_FP_SUPPORT
70extern bool dsemul_thread_cleanup(struct task_struct *tsk);
71#else
72static inline bool dsemul_thread_cleanup(struct task_struct *tsk)
73{
74 return false;
75}
76#endif
77/**
78 * dsemul_thread_rollback() - Rollback from an 'emulation' frame
79 * @regs: User thread register context.
80 *
81 * If the current thread, whose register context is represented by @regs,
82 * is executing within a delay slot 'emulation' frame then exit that
83 * frame. The PC will be rolled back to the branch if the instruction
84 * that was being 'emulated' has not yet executed, or advanced to the
85 * continuation PC if it has.
86 *
87 * Return: True if a frame was exited, else false.
88 */
89#ifdef CONFIG_MIPS_FP_SUPPORT
90extern bool dsemul_thread_rollback(struct pt_regs *regs);
91#else
92static inline bool dsemul_thread_rollback(struct pt_regs *regs)
93{
94 return false;
95}
96#endif
97
98/**
99 * dsemul_mm_cleanup() - Cleanup per-mm delay slot 'emulation' state
100 * @mm: The struct mm_struct to cleanup state for.
101 *
102 * Cleanup state for the given @mm, ensuring that any memory allocated
103 * for delay slot 'emulation' book-keeping is freed. This is to be called
104 * before @mm is freed in order to avoid memory leaks.
105 */
106#ifdef CONFIG_MIPS_FP_SUPPORT
107extern void dsemul_mm_cleanup(struct mm_struct *mm);
108#else
109static inline void dsemul_mm_cleanup(struct mm_struct *mm)
110{
111 /* no-op */
112}
113#endif
114
115#endif /* __MIPS_ASM_DSEMUL_H__ */
diff --git a/arch/mips/include/asm/dsp.h b/arch/mips/include/asm/dsp.h
new file mode 100644
index 000000000..77fe0d675
--- /dev/null
+++ b/arch/mips/include/asm/dsp.h
@@ -0,0 +1,81 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2005 Mips Technologies
4 * Author: Chris Dearman, chris@mips.com derived from fpu.h
5 */
6#ifndef _ASM_DSP_H
7#define _ASM_DSP_H
8
9#include <asm/cpu.h>
10#include <asm/cpu-features.h>
11#include <asm/hazards.h>
12#include <asm/mipsregs.h>
13
14#define DSP_DEFAULT 0x00000000
15#define DSP_MASK 0x3f
16
17#define __enable_dsp_hazard() \
18do { \
19 asm("_ehb"); \
20} while (0)
21
22static inline void __init_dsp(void)
23{
24 mthi1(0);
25 mtlo1(0);
26 mthi2(0);
27 mtlo2(0);
28 mthi3(0);
29 mtlo3(0);
30 wrdsp(DSP_DEFAULT, DSP_MASK);
31}
32
33static inline void init_dsp(void)
34{
35 if (cpu_has_dsp)
36 __init_dsp();
37}
38
39#define __save_dsp(tsk) \
40do { \
41 tsk->thread.dsp.dspr[0] = mfhi1(); \
42 tsk->thread.dsp.dspr[1] = mflo1(); \
43 tsk->thread.dsp.dspr[2] = mfhi2(); \
44 tsk->thread.dsp.dspr[3] = mflo2(); \
45 tsk->thread.dsp.dspr[4] = mfhi3(); \
46 tsk->thread.dsp.dspr[5] = mflo3(); \
47 tsk->thread.dsp.dspcontrol = rddsp(DSP_MASK); \
48} while (0)
49
50#define save_dsp(tsk) \
51do { \
52 if (cpu_has_dsp) \
53 __save_dsp(tsk); \
54} while (0)
55
56#define __restore_dsp(tsk) \
57do { \
58 mthi1(tsk->thread.dsp.dspr[0]); \
59 mtlo1(tsk->thread.dsp.dspr[1]); \
60 mthi2(tsk->thread.dsp.dspr[2]); \
61 mtlo2(tsk->thread.dsp.dspr[3]); \
62 mthi3(tsk->thread.dsp.dspr[4]); \
63 mtlo3(tsk->thread.dsp.dspr[5]); \
64 wrdsp(tsk->thread.dsp.dspcontrol, DSP_MASK); \
65} while (0)
66
67#define restore_dsp(tsk) \
68do { \
69 if (cpu_has_dsp) \
70 __restore_dsp(tsk); \
71} while (0)
72
73#define __get_dsp_regs(tsk) \
74({ \
75 if (tsk == current) \
76 __save_dsp(current); \
77 \
78 tsk->thread.dsp.dspr; \
79})
80
81#endif /* _ASM_DSP_H */
diff --git a/arch/mips/include/asm/edac.h b/arch/mips/include/asm/edac.h
new file mode 100644
index 000000000..c5d147744
--- /dev/null
+++ b/arch/mips/include/asm/edac.h
@@ -0,0 +1,38 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef ASM_EDAC_H
3#define ASM_EDAC_H
4
5#include <asm/compiler.h>
6
7/* ECC atomic, DMA, SMP and interrupt safe scrub function */
8
9static inline void edac_atomic_scrub(void *va, u32 size)
10{
11 unsigned long *virt_addr = va;
12 unsigned long temp;
13 u32 i;
14
15 for (i = 0; i < size / sizeof(unsigned long); i++) {
16 /*
17 * Very carefully read and write to memory atomically
18 * so we are interrupt, DMA and SMP safe.
19 *
20 * Intel: asm("lock; addl $0, %0"::"m"(*virt_addr));
21 */
22
23 __asm__ __volatile__ (
24 " .set push \n"
25 " .set mips2 \n"
26 "1: ll %0, %1 # edac_atomic_scrub \n"
27 " addu %0, $0 \n"
28 " sc %0, %1 \n"
29 " beqz %0, 1b \n"
30 " .set pop \n"
31 : "=&r" (temp), "=" GCC_OFF_SMALL_ASM() (*virt_addr)
32 : GCC_OFF_SMALL_ASM() (*virt_addr));
33
34 virt_addr++;
35 }
36}
37
38#endif
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
new file mode 100644
index 000000000..71c762202
--- /dev/null
+++ b/arch/mips/include/asm/elf.h
@@ -0,0 +1,538 @@
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 * Much of this is taken from binutils and GNU libc ...
7 */
8#ifndef _ASM_ELF_H
9#define _ASM_ELF_H
10
11#include <linux/auxvec.h>
12#include <linux/fs.h>
13#include <linux/mm_types.h>
14
15#include <uapi/linux/elf.h>
16
17#include <asm/current.h>
18
19/* ELF header e_flags defines. */
20/* MIPS architecture level. */
21#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
22#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
23#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
24#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
25#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
26#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */
27#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */
28#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32 R2 code. */
29#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64 R2 code. */
30
31/* The ABI of a file. */
32#define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */
33#define EF_MIPS_ABI_O64 0x00002000 /* O32 extended for 64 bit. */
34
35#define PT_MIPS_REGINFO 0x70000000
36#define PT_MIPS_RTPROC 0x70000001
37#define PT_MIPS_OPTIONS 0x70000002
38#define PT_MIPS_ABIFLAGS 0x70000003
39
40/* Flags in the e_flags field of the header */
41#define EF_MIPS_NOREORDER 0x00000001
42#define EF_MIPS_PIC 0x00000002
43#define EF_MIPS_CPIC 0x00000004
44#define EF_MIPS_ABI2 0x00000020
45#define EF_MIPS_OPTIONS_FIRST 0x00000080
46#define EF_MIPS_32BITMODE 0x00000100
47#define EF_MIPS_FP64 0x00000200
48#define EF_MIPS_NAN2008 0x00000400
49#define EF_MIPS_ABI 0x0000f000
50#define EF_MIPS_ARCH 0xf0000000
51
52#define DT_MIPS_RLD_VERSION 0x70000001
53#define DT_MIPS_TIME_STAMP 0x70000002
54#define DT_MIPS_ICHECKSUM 0x70000003
55#define DT_MIPS_IVERSION 0x70000004
56#define DT_MIPS_FLAGS 0x70000005
57 #define RHF_NONE 0x00000000
58 #define RHF_HARDWAY 0x00000001
59 #define RHF_NOTPOT 0x00000002
60 #define RHF_SGI_ONLY 0x00000010
61#define DT_MIPS_BASE_ADDRESS 0x70000006
62#define DT_MIPS_CONFLICT 0x70000008
63#define DT_MIPS_LIBLIST 0x70000009
64#define DT_MIPS_LOCAL_GOTNO 0x7000000a
65#define DT_MIPS_CONFLICTNO 0x7000000b
66#define DT_MIPS_LIBLISTNO 0x70000010
67#define DT_MIPS_SYMTABNO 0x70000011
68#define DT_MIPS_UNREFEXTNO 0x70000012
69#define DT_MIPS_GOTSYM 0x70000013
70#define DT_MIPS_HIPAGENO 0x70000014
71#define DT_MIPS_RLD_MAP 0x70000016
72
73#define R_MIPS_NONE 0
74#define R_MIPS_16 1
75#define R_MIPS_32 2
76#define R_MIPS_REL32 3
77#define R_MIPS_26 4
78#define R_MIPS_HI16 5
79#define R_MIPS_LO16 6
80#define R_MIPS_GPREL16 7
81#define R_MIPS_LITERAL 8
82#define R_MIPS_GOT16 9
83#define R_MIPS_PC16 10
84#define R_MIPS_CALL16 11
85#define R_MIPS_GPREL32 12
86/* The remaining relocs are defined on Irix, although they are not
87 in the MIPS ELF ABI. */
88#define R_MIPS_UNUSED1 13
89#define R_MIPS_UNUSED2 14
90#define R_MIPS_UNUSED3 15
91#define R_MIPS_SHIFT5 16
92#define R_MIPS_SHIFT6 17
93#define R_MIPS_64 18
94#define R_MIPS_GOT_DISP 19
95#define R_MIPS_GOT_PAGE 20
96#define R_MIPS_GOT_OFST 21
97/*
98 * The following two relocation types are specified in the MIPS ABI
99 * conformance guide version 1.2 but not yet in the psABI.
100 */
101#define R_MIPS_GOTHI16 22
102#define R_MIPS_GOTLO16 23
103#define R_MIPS_SUB 24
104#define R_MIPS_INSERT_A 25
105#define R_MIPS_INSERT_B 26
106#define R_MIPS_DELETE 27
107#define R_MIPS_HIGHER 28
108#define R_MIPS_HIGHEST 29
109/*
110 * The following two relocation types are specified in the MIPS ABI
111 * conformance guide version 1.2 but not yet in the psABI.
112 */
113#define R_MIPS_CALLHI16 30
114#define R_MIPS_CALLLO16 31
115/*
116 * Introduced for MIPSr6.
117 */
118#define R_MIPS_PC21_S2 60
119#define R_MIPS_PC26_S2 61
120/*
121 * This range is reserved for vendor specific relocations.
122 */
123#define R_MIPS_LOVENDOR 100
124#define R_MIPS_HIVENDOR 127
125
126#define SHN_MIPS_ACCOMON 0xff00 /* Allocated common symbols */
127#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
128#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
129#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
130#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
131
132#define SHT_MIPS_LIST 0x70000000
133#define SHT_MIPS_CONFLICT 0x70000002
134#define SHT_MIPS_GPTAB 0x70000003
135#define SHT_MIPS_UCODE 0x70000004
136#define SHT_MIPS_DEBUG 0x70000005
137#define SHT_MIPS_REGINFO 0x70000006
138#define SHT_MIPS_PACKAGE 0x70000007
139#define SHT_MIPS_PACKSYM 0x70000008
140#define SHT_MIPS_RELD 0x70000009
141#define SHT_MIPS_IFACE 0x7000000b
142#define SHT_MIPS_CONTENT 0x7000000c
143#define SHT_MIPS_OPTIONS 0x7000000d
144#define SHT_MIPS_SHDR 0x70000010
145#define SHT_MIPS_FDESC 0x70000011
146#define SHT_MIPS_EXTSYM 0x70000012
147#define SHT_MIPS_DENSE 0x70000013
148#define SHT_MIPS_PDESC 0x70000014
149#define SHT_MIPS_LOCSYM 0x70000015
150#define SHT_MIPS_AUXSYM 0x70000016
151#define SHT_MIPS_OPTSYM 0x70000017
152#define SHT_MIPS_LOCSTR 0x70000018
153#define SHT_MIPS_LINE 0x70000019
154#define SHT_MIPS_RFDESC 0x7000001a
155#define SHT_MIPS_DELTASYM 0x7000001b
156#define SHT_MIPS_DELTAINST 0x7000001c
157#define SHT_MIPS_DELTACLASS 0x7000001d
158#define SHT_MIPS_DWARF 0x7000001e
159#define SHT_MIPS_DELTADECL 0x7000001f
160#define SHT_MIPS_SYMBOL_LIB 0x70000020
161#define SHT_MIPS_EVENTS 0x70000021
162#define SHT_MIPS_TRANSLATE 0x70000022
163#define SHT_MIPS_PIXIE 0x70000023
164#define SHT_MIPS_XLATE 0x70000024
165#define SHT_MIPS_XLATE_DEBUG 0x70000025
166#define SHT_MIPS_WHIRL 0x70000026
167#define SHT_MIPS_EH_REGION 0x70000027
168#define SHT_MIPS_XLATE_OLD 0x70000028
169#define SHT_MIPS_PDR_EXCEPTION 0x70000029
170
171#define SHF_MIPS_GPREL 0x10000000
172#define SHF_MIPS_MERGE 0x20000000
173#define SHF_MIPS_ADDR 0x40000000
174#define SHF_MIPS_STRING 0x80000000
175#define SHF_MIPS_NOSTRIP 0x08000000
176#define SHF_MIPS_LOCAL 0x04000000
177#define SHF_MIPS_NAMES 0x02000000
178#define SHF_MIPS_NODUPES 0x01000000
179
180#define MIPS_ABI_FP_ANY 0 /* FP ABI doesn't matter */
181#define MIPS_ABI_FP_DOUBLE 1 /* -mdouble-float */
182#define MIPS_ABI_FP_SINGLE 2 /* -msingle-float */
183#define MIPS_ABI_FP_SOFT 3 /* -msoft-float */
184#define MIPS_ABI_FP_OLD_64 4 /* -mips32r2 -mfp64 */
185#define MIPS_ABI_FP_XX 5 /* -mfpxx */
186#define MIPS_ABI_FP_64 6 /* -mips32r2 -mfp64 */
187#define MIPS_ABI_FP_64A 7 /* -mips32r2 -mfp64 -mno-odd-spreg */
188
189struct mips_elf_abiflags_v0 {
190 uint16_t version; /* Version of flags structure */
191 uint8_t isa_level; /* The level of the ISA: 1-5, 32, 64 */
192 uint8_t isa_rev; /* The revision of ISA: 0 for MIPS V and below,
193 1-n otherwise */
194 uint8_t gpr_size; /* The size of general purpose registers */
195 uint8_t cpr1_size; /* The size of co-processor 1 registers */
196 uint8_t cpr2_size; /* The size of co-processor 2 registers */
197 uint8_t fp_abi; /* The floating-point ABI */
198 uint32_t isa_ext; /* Mask of processor-specific extensions */
199 uint32_t ases; /* Mask of ASEs used */
200 uint32_t flags1; /* Mask of general flags */
201 uint32_t flags2;
202};
203
204#ifndef ELF_ARCH
205/* ELF register definitions */
206#define ELF_NGREG 45
207#define ELF_NFPREG 33
208
209typedef unsigned long elf_greg_t;
210typedef elf_greg_t elf_gregset_t[ELF_NGREG];
211
212typedef double elf_fpreg_t;
213typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
214
215void mips_dump_regs32(u32 *uregs, const struct pt_regs *regs);
216void mips_dump_regs64(u64 *uregs, const struct pt_regs *regs);
217
218#ifdef CONFIG_32BIT
219/*
220 * This is used to ensure we don't load something for the wrong architecture.
221 */
222#define elf_check_arch elfo32_check_arch
223
224/*
225 * These are used to set parameters in the core dumps.
226 */
227#define ELF_CLASS ELFCLASS32
228
229#define ELF_CORE_COPY_REGS(dest, regs) \
230 mips_dump_regs32((u32 *)&(dest), (regs));
231
232#endif /* CONFIG_32BIT */
233
234#ifdef CONFIG_64BIT
235/*
236 * This is used to ensure we don't load something for the wrong architecture.
237 */
238#define elf_check_arch elfn64_check_arch
239
240/*
241 * These are used to set parameters in the core dumps.
242 */
243#define ELF_CLASS ELFCLASS64
244
245#define ELF_CORE_COPY_REGS(dest, regs) \
246 mips_dump_regs64((u64 *)&(dest), (regs));
247
248#endif /* CONFIG_64BIT */
249
250/*
251 * These are used to set parameters in the core dumps.
252 */
253#ifdef __MIPSEB__
254#define ELF_DATA ELFDATA2MSB
255#elif defined(__MIPSEL__)
256#define ELF_DATA ELFDATA2LSB
257#endif
258#define ELF_ARCH EM_MIPS
259
260#endif /* !defined(ELF_ARCH) */
261
262/*
263 * In order to be sure that we don't attempt to execute an O32 binary which
264 * requires 64 bit FP (FR=1) on a system which does not support it we refuse
265 * to execute any binary which has bits specified by the following macro set
266 * in its ELF header flags.
267 */
268#ifdef CONFIG_MIPS_O32_FP64_SUPPORT
269# define __MIPS_O32_FP64_MUST_BE_ZERO 0
270#else
271# define __MIPS_O32_FP64_MUST_BE_ZERO EF_MIPS_FP64
272#endif
273
274#define mips_elf_check_machine(x) ((x)->e_machine == EM_MIPS)
275
276#define vmcore_elf32_check_arch mips_elf_check_machine
277#define vmcore_elf64_check_arch mips_elf_check_machine
278
279/*
280 * Return non-zero if HDR identifies an o32 ELF binary.
281 */
282#define elfo32_check_arch(hdr) \
283({ \
284 int __res = 1; \
285 struct elfhdr *__h = (hdr); \
286 \
287 if (!mips_elf_check_machine(__h)) \
288 __res = 0; \
289 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
290 __res = 0; \
291 if ((__h->e_flags & EF_MIPS_ABI2) != 0) \
292 __res = 0; \
293 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
294 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
295 __res = 0; \
296 if (__h->e_flags & __MIPS_O32_FP64_MUST_BE_ZERO) \
297 __res = 0; \
298 \
299 __res; \
300})
301
302/*
303 * Return non-zero if HDR identifies an n64 ELF binary.
304 */
305#define elfn64_check_arch(hdr) \
306({ \
307 int __res = 1; \
308 struct elfhdr *__h = (hdr); \
309 \
310 if (!mips_elf_check_machine(__h)) \
311 __res = 0; \
312 if (__h->e_ident[EI_CLASS] != ELFCLASS64) \
313 __res = 0; \
314 \
315 __res; \
316})
317
318/*
319 * Return non-zero if HDR identifies an n32 ELF binary.
320 */
321#define elfn32_check_arch(hdr) \
322({ \
323 int __res = 1; \
324 struct elfhdr *__h = (hdr); \
325 \
326 if (!mips_elf_check_machine(__h)) \
327 __res = 0; \
328 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
329 __res = 0; \
330 if (((__h->e_flags & EF_MIPS_ABI2) == 0) || \
331 ((__h->e_flags & EF_MIPS_ABI) != 0)) \
332 __res = 0; \
333 \
334 __res; \
335})
336
337struct mips_abi;
338
339extern struct mips_abi mips_abi;
340extern struct mips_abi mips_abi_32;
341extern struct mips_abi mips_abi_n32;
342
343#ifdef CONFIG_32BIT
344
345#define SET_PERSONALITY2(ex, state) \
346do { \
347 clear_thread_flag(TIF_HYBRID_FPREGS); \
348 set_thread_flag(TIF_32BIT_FPREGS); \
349 \
350 current->thread.abi = &mips_abi; \
351 \
352 mips_set_personality_fp(state); \
353 mips_set_personality_nan(state); \
354 \
355 if (personality(current->personality) != PER_LINUX) \
356 set_personality(PER_LINUX); \
357} while (0)
358
359#endif /* CONFIG_32BIT */
360
361#ifdef CONFIG_64BIT
362
363#ifdef CONFIG_MIPS32_N32
364#define __SET_PERSONALITY32_N32() \
365 do { \
366 set_thread_flag(TIF_32BIT_ADDR); \
367 \
368 current->thread.abi = &mips_abi_n32; \
369 } while (0)
370#else
371#define __SET_PERSONALITY32_N32() \
372 do { } while (0)
373#endif
374
375#ifdef CONFIG_MIPS32_O32
376#define __SET_PERSONALITY32_O32(ex, state) \
377 do { \
378 set_thread_flag(TIF_32BIT_REGS); \
379 set_thread_flag(TIF_32BIT_ADDR); \
380 clear_thread_flag(TIF_HYBRID_FPREGS); \
381 set_thread_flag(TIF_32BIT_FPREGS); \
382 \
383 current->thread.abi = &mips_abi_32; \
384 \
385 mips_set_personality_fp(state); \
386 } while (0)
387#else
388#define __SET_PERSONALITY32_O32(ex, state) \
389 do { } while (0)
390#endif
391
392#ifdef CONFIG_MIPS32_COMPAT
393#define __SET_PERSONALITY32(ex, state) \
394do { \
395 if ((((ex).e_flags & EF_MIPS_ABI2) != 0) && \
396 ((ex).e_flags & EF_MIPS_ABI) == 0) \
397 __SET_PERSONALITY32_N32(); \
398 else \
399 __SET_PERSONALITY32_O32(ex, state); \
400} while (0)
401#else
402#define __SET_PERSONALITY32(ex, state) do { } while (0)
403#endif
404
405#define SET_PERSONALITY2(ex, state) \
406do { \
407 unsigned int p; \
408 \
409 clear_thread_flag(TIF_32BIT_REGS); \
410 clear_thread_flag(TIF_32BIT_FPREGS); \
411 clear_thread_flag(TIF_HYBRID_FPREGS); \
412 clear_thread_flag(TIF_32BIT_ADDR); \
413 current->personality &= ~READ_IMPLIES_EXEC; \
414 \
415 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
416 __SET_PERSONALITY32(ex, state); \
417 else \
418 current->thread.abi = &mips_abi; \
419 \
420 mips_set_personality_nan(state); \
421 \
422 p = personality(current->personality); \
423 if (p != PER_LINUX32 && p != PER_LINUX) \
424 set_personality(PER_LINUX); \
425} while (0)
426
427#endif /* CONFIG_64BIT */
428
429#define CORE_DUMP_USE_REGSET
430#define ELF_EXEC_PAGESIZE PAGE_SIZE
431
432/* This yields a mask that user programs can use to figure out what
433 instruction set this cpu supports. This could be done in userspace,
434 but it's not easy, and we've already done it here. */
435
436#define ELF_HWCAP (elf_hwcap)
437extern unsigned int elf_hwcap;
438#include <asm/hwcap.h>
439
440/*
441 * This yields a string that ld.so will use to load implementation
442 * specific libraries for optimization. This is more specific in
443 * intent than poking at uname or /proc/cpuinfo.
444 */
445
446#define ELF_PLATFORM __elf_platform
447extern const char *__elf_platform;
448
449#define ELF_BASE_PLATFORM __elf_base_platform
450extern const char *__elf_base_platform;
451
452/*
453 * See comments in asm-alpha/elf.h, this is the same thing
454 * on the MIPS.
455 */
456#define ELF_PLAT_INIT(_r, load_addr) do { \
457 _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \
458 _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \
459 _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \
460 _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; \
461 _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; \
462 _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; \
463 _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; \
464 _r->regs[30] = _r->regs[31] = 0; \
465} while (0)
466
467/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
468 use of this is to invoke "./ld.so someprog" to test out a new version of
469 the loader. We need to make sure that it is out of the way of the program
470 that it will "exec", and that there is sufficient room for the brk. */
471
472#ifndef ELF_ET_DYN_BASE
473#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
474#endif
475
476/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
477#define ARCH_DLINFO \
478do { \
479 NEW_AUX_ENT(AT_SYSINFO_EHDR, \
480 (unsigned long)current->mm->context.vdso); \
481} while (0)
482
483#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
484struct linux_binprm;
485extern int arch_setup_additional_pages(struct linux_binprm *bprm,
486 int uses_interp);
487
488#ifdef CONFIG_MIPS_FP_SUPPORT
489
490struct arch_elf_state {
491 int nan_2008;
492 int fp_abi;
493 int interp_fp_abi;
494 int overall_fp_mode;
495};
496
497#define MIPS_ABI_FP_UNKNOWN (-1) /* Unknown FP ABI (kernel internal) */
498
499#define INIT_ARCH_ELF_STATE { \
500 .nan_2008 = -1, \
501 .fp_abi = MIPS_ABI_FP_UNKNOWN, \
502 .interp_fp_abi = MIPS_ABI_FP_UNKNOWN, \
503 .overall_fp_mode = -1, \
504}
505
506extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf,
507 bool is_interp, struct arch_elf_state *state);
508
509extern int arch_check_elf(void *ehdr, bool has_interpreter, void *interp_ehdr,
510 struct arch_elf_state *state);
511
512/* Whether to accept legacy-NaN and 2008-NaN user binaries. */
513extern bool mips_use_nan_legacy;
514extern bool mips_use_nan_2008;
515
516extern void mips_set_personality_nan(struct arch_elf_state *state);
517extern void mips_set_personality_fp(struct arch_elf_state *state);
518
519#else /* !CONFIG_MIPS_FP_SUPPORT */
520
521struct arch_elf_state;
522
523static inline void mips_set_personality_nan(struct arch_elf_state *state)
524{
525 /* no-op */
526}
527
528static inline void mips_set_personality_fp(struct arch_elf_state *state)
529{
530 /* no-op */
531}
532
533#endif /* !CONFIG_MIPS_FP_SUPPORT */
534
535#define elf_read_implies_exec(ex, stk) mips_elf_read_implies_exec(&(ex), stk)
536extern int mips_elf_read_implies_exec(void *elf_ex, int exstack);
537
538#endif /* _ASM_ELF_H */
diff --git a/arch/mips/include/asm/errno.h b/arch/mips/include/asm/errno.h
new file mode 100644
index 000000000..21d91cdfe
--- /dev/null
+++ b/arch/mips/include/asm/errno.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) 1995, 1999, 2001, 2002 by Ralf Baechle
7 */
8#ifndef _ASM_ERRNO_H
9#define _ASM_ERRNO_H
10
11#include <uapi/asm/errno.h>
12
13
14/* The biggest error number defined here or in <linux/errno.h>. */
15#define EMAXERRNO 1133
16
17#endif /* _ASM_ERRNO_H */
diff --git a/arch/mips/include/asm/eva.h b/arch/mips/include/asm/eva.h
new file mode 100644
index 000000000..a3d1807f2
--- /dev/null
+++ b/arch/mips/include/asm/eva.h
@@ -0,0 +1,43 @@
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) 2014, Imagination Technologies Ltd.
7 *
8 * EVA functions for generic code
9 */
10
11#ifndef _ASM_EVA_H
12#define _ASM_EVA_H
13
14#include <kernel-entry-init.h>
15
16#ifdef __ASSEMBLY__
17
18#ifdef CONFIG_EVA
19
20/*
21 * EVA early init code
22 *
23 * Platforms must define their own 'platform_eva_init' macro in
24 * their kernel-entry-init.h header. This macro usually does the
25 * platform specific configuration of the segmentation registers,
26 * and it is normally called from assembly code.
27 *
28 */
29
30.macro eva_init
31platform_eva_init
32.endm
33
34#else
35
36.macro eva_init
37.endm
38
39#endif /* CONFIG_EVA */
40
41#endif /* __ASSEMBLY__ */
42
43#endif
diff --git a/arch/mips/include/asm/exec.h b/arch/mips/include/asm/exec.h
new file mode 100644
index 000000000..c1f6afa4b
--- /dev/null
+++ b/arch/mips/include/asm/exec.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) 1994, 95, 96, 97, 98, 99, 2003, 06 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_EXEC_H
13#define _ASM_EXEC_H
14
15extern unsigned long arch_align_stack(unsigned long sp);
16
17#endif /* _ASM_EXEC_H */
diff --git a/arch/mips/include/asm/extable.h b/arch/mips/include/asm/extable.h
new file mode 100644
index 000000000..78d0ae156
--- /dev/null
+++ b/arch/mips/include/asm/extable.h
@@ -0,0 +1,14 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_EXTABLE_H
3#define _ASM_EXTABLE_H
4
5struct exception_table_entry
6{
7 unsigned long insn;
8 unsigned long nextinsn;
9};
10
11struct pt_regs;
12extern int fixup_exception(struct pt_regs *regs);
13
14#endif
diff --git a/arch/mips/include/asm/fb.h b/arch/mips/include/asm/fb.h
new file mode 100644
index 000000000..bd3f68c9d
--- /dev/null
+++ b/arch/mips/include/asm/fb.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.h
new file mode 100644
index 000000000..743535be7
--- /dev/null
+++ b/arch/mips/include/asm/fixmap.h
@@ -0,0 +1,79 @@
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 <asm/page.h>
17#include <spaces.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#define FIX_N_COLOURS 8
50 FIX_CMAP_BEGIN,
51 FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * 2),
52#ifdef CONFIG_HIGHMEM
53 /* reserved pte's for temporary kernel mappings */
54 FIX_KMAP_BEGIN = FIX_CMAP_END + 1,
55 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
56#endif
57 __end_of_fixed_addresses
58};
59
60/*
61 * used by vmalloc.c.
62 *
63 * Leave one empty page between vmalloc'ed areas and
64 * the start of the fixmap, and leave one page empty
65 * at the top of mem..
66 */
67#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
68#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
69
70#include <asm-generic/fixmap.h>
71
72/*
73 * Called from pgtable_init()
74 */
75extern void fixrange_init(unsigned long start, unsigned long end,
76 pgd_t *pgd_base);
77
78
79#endif
diff --git a/arch/mips/include/asm/floppy.h b/arch/mips/include/asm/floppy.h
new file mode 100644
index 000000000..021d09ae5
--- /dev/null
+++ b/arch/mips/include/asm/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
13#include <asm/io.h>
14
15static inline void fd_cacheflush(char * addr, long size)
16{
17 dma_cache_wback_inv((unsigned long)addr, size);
18}
19
20#define MAX_BUFFER_SECTORS 24
21
22
23/*
24 * And on Mips's the CMOS info fails also ...
25 *
26 * FIXME: This information should come from the ARC configuration tree
27 * or wherever a particular machine has stored this ...
28 */
29#define FLOPPY0_TYPE fd_drive_type(0)
30#define FLOPPY1_TYPE fd_drive_type(1)
31
32#define FDC1 fd_getfdaddr1()
33
34#define N_FDC 1 /* do you *really* want a second controller? */
35#define N_DRIVE 8
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/arch/mips/include/asm/fpregdef.h b/arch/mips/include/asm/fpregdef.h
new file mode 100644
index 000000000..f184ba088
--- /dev/null
+++ b/arch/mips/include/asm/fpregdef.h
@@ -0,0 +1,113 @@
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/*
18 * starting with binutils 2.24.51.20140729, MIPS binutils warn about mixing
19 * hardfloat and softfloat object files. The kernel build uses soft-float by
20 * default, so we also need to pass -msoft-float along to GAS if it supports it.
21 * But this in turn causes assembler errors in files which access hardfloat
22 * registers. We detect if GAS supports "-msoft-float" in the Makefile and
23 * explicitly put ".set hardfloat" where floating point registers are touched.
24 */
25#ifdef GAS_HAS_SET_HARDFLOAT
26#define SET_HARDFLOAT .set hardfloat
27#else
28#define SET_HARDFLOAT
29#endif
30
31#if _MIPS_SIM == _MIPS_SIM_ABI32
32
33/*
34 * These definitions only cover the R3000-ish 16/32 register model.
35 * But we're trying to be R3000 friendly anyway ...
36 */
37#define fv0 $f0 /* return value */
38#define fv0f $f1
39#define fv1 $f2
40#define fv1f $f3
41#define fa0 $f12 /* argument registers */
42#define fa0f $f13
43#define fa1 $f14
44#define fa1f $f15
45#define ft0 $f4 /* caller saved */
46#define ft0f $f5
47#define ft1 $f6
48#define ft1f $f7
49#define ft2 $f8
50#define ft2f $f9
51#define ft3 $f10
52#define ft3f $f11
53#define ft4 $f16
54#define ft4f $f17
55#define ft5 $f18
56#define ft5f $f19
57#define fs0 $f20 /* callee saved */
58#define fs0f $f21
59#define fs1 $f22
60#define fs1f $f23
61#define fs2 $f24
62#define fs2f $f25
63#define fs3 $f26
64#define fs3f $f27
65#define fs4 $f28
66#define fs4f $f29
67#define fs5 $f30
68#define fs5f $f31
69
70#define fcr31 $31 /* FPU status register */
71
72#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
73
74#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
75
76#define fv0 $f0 /* return value */
77#define fv1 $f2
78#define fa0 $f12 /* argument registers */
79#define fa1 $f13
80#define fa2 $f14
81#define fa3 $f15
82#define fa4 $f16
83#define fa5 $f17
84#define fa6 $f18
85#define fa7 $f19
86#define ft0 $f4 /* caller saved */
87#define ft1 $f5
88#define ft2 $f6
89#define ft3 $f7
90#define ft4 $f8
91#define ft5 $f9
92#define ft6 $f10
93#define ft7 $f11
94#define ft8 $f20
95#define ft9 $f21
96#define ft10 $f22
97#define ft11 $f23
98#define ft12 $f1
99#define ft13 $f3
100#define fs0 $f24 /* callee saved */
101#define fs1 $f25
102#define fs2 $f26
103#define fs3 $f27
104#define fs4 $f28
105#define fs5 $f29
106#define fs6 $f30
107#define fs7 $f31
108
109#define fcr31 $31
110
111#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
112
113#endif /* _ASM_FPREGDEF_H */
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
new file mode 100644
index 000000000..08f9dd690
--- /dev/null
+++ b/arch/mips/include/asm/fpu.h
@@ -0,0 +1,328 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2002 MontaVista Software Inc.
4 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
5 */
6#ifndef _ASM_FPU_H
7#define _ASM_FPU_H
8
9#include <linux/sched.h>
10#include <linux/sched/task_stack.h>
11#include <linux/ptrace.h>
12#include <linux/thread_info.h>
13#include <linux/bitops.h>
14
15#include <asm/mipsregs.h>
16#include <asm/cpu.h>
17#include <asm/cpu-features.h>
18#include <asm/fpu_emulator.h>
19#include <asm/hazards.h>
20#include <asm/ptrace.h>
21#include <asm/processor.h>
22#include <asm/current.h>
23#include <asm/msa.h>
24
25#ifdef CONFIG_MIPS_MT_FPAFF
26#include <asm/mips_mt.h>
27#endif
28
29/*
30 * This enum specifies a mode in which we want the FPU to operate, for cores
31 * which implement the Status.FR bit. Note that the bottom bit of the value
32 * purposefully matches the desired value of the Status.FR bit.
33 */
34enum fpu_mode {
35 FPU_32BIT = 0, /* FR = 0 */
36 FPU_64BIT, /* FR = 1, FRE = 0 */
37 FPU_AS_IS,
38 FPU_HYBRID, /* FR = 1, FRE = 1 */
39
40#define FPU_FR_MASK 0x1
41};
42
43#ifdef CONFIG_MIPS_FP_SUPPORT
44
45extern void _save_fp(struct task_struct *);
46extern void _restore_fp(struct task_struct *);
47
48#define __disable_fpu() \
49do { \
50 clear_c0_status(ST0_CU1); \
51 disable_fpu_hazard(); \
52} while (0)
53
54static inline int __enable_fpu(enum fpu_mode mode)
55{
56 int fr;
57
58 switch (mode) {
59 case FPU_AS_IS:
60 /* just enable the FPU in its current mode */
61 set_c0_status(ST0_CU1);
62 enable_fpu_hazard();
63 return 0;
64
65 case FPU_HYBRID:
66 if (!cpu_has_fre)
67 return SIGFPE;
68
69 /* set FRE */
70 set_c0_config5(MIPS_CONF5_FRE);
71 goto fr_common;
72
73 case FPU_64BIT:
74#if !(defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5) || \
75 defined(CONFIG_CPU_MIPSR6) || defined(CONFIG_64BIT))
76 /* we only have a 32-bit FPU */
77 return SIGFPE;
78#endif
79 fallthrough;
80 case FPU_32BIT:
81 if (cpu_has_fre) {
82 /* clear FRE */
83 clear_c0_config5(MIPS_CONF5_FRE);
84 }
85fr_common:
86 /* set CU1 & change FR appropriately */
87 fr = (int)mode & FPU_FR_MASK;
88 change_c0_status(ST0_CU1 | ST0_FR, ST0_CU1 | (fr ? ST0_FR : 0));
89 enable_fpu_hazard();
90
91 /* check FR has the desired value */
92 if (!!(read_c0_status() & ST0_FR) == !!fr)
93 return 0;
94
95 /* unsupported FR value */
96 __disable_fpu();
97 return SIGFPE;
98
99 default:
100 BUG();
101 }
102
103 return SIGFPE;
104}
105
106#define clear_fpu_owner() clear_thread_flag(TIF_USEDFPU)
107
108static inline int __is_fpu_owner(void)
109{
110 return test_thread_flag(TIF_USEDFPU);
111}
112
113static inline int is_fpu_owner(void)
114{
115 return cpu_has_fpu && __is_fpu_owner();
116}
117
118static inline int __own_fpu(void)
119{
120 enum fpu_mode mode;
121 int ret;
122
123 if (test_thread_flag(TIF_HYBRID_FPREGS))
124 mode = FPU_HYBRID;
125 else
126 mode = !test_thread_flag(TIF_32BIT_FPREGS);
127
128 ret = __enable_fpu(mode);
129 if (ret)
130 return ret;
131
132 KSTK_STATUS(current) |= ST0_CU1;
133 if (mode == FPU_64BIT || mode == FPU_HYBRID)
134 KSTK_STATUS(current) |= ST0_FR;
135 else /* mode == FPU_32BIT */
136 KSTK_STATUS(current) &= ~ST0_FR;
137
138 set_thread_flag(TIF_USEDFPU);
139 return 0;
140}
141
142static inline int own_fpu_inatomic(int restore)
143{
144 int ret = 0;
145
146 if (cpu_has_fpu && !__is_fpu_owner()) {
147 ret = __own_fpu();
148 if (restore && !ret)
149 _restore_fp(current);
150 }
151 return ret;
152}
153
154static inline int own_fpu(int restore)
155{
156 int ret;
157
158 preempt_disable();
159 ret = own_fpu_inatomic(restore);
160 preempt_enable();
161 return ret;
162}
163
164static inline void lose_fpu_inatomic(int save, struct task_struct *tsk)
165{
166 if (is_msa_enabled()) {
167 if (save) {
168 save_msa(tsk);
169 tsk->thread.fpu.fcr31 =
170 read_32bit_cp1_register(CP1_STATUS);
171 }
172 disable_msa();
173 clear_tsk_thread_flag(tsk, TIF_USEDMSA);
174 __disable_fpu();
175 } else if (is_fpu_owner()) {
176 if (save)
177 _save_fp(tsk);
178 __disable_fpu();
179 } else {
180 /* FPU should not have been left enabled with no owner */
181 WARN(read_c0_status() & ST0_CU1,
182 "Orphaned FPU left enabled");
183 }
184 KSTK_STATUS(tsk) &= ~ST0_CU1;
185 clear_tsk_thread_flag(tsk, TIF_USEDFPU);
186}
187
188static inline void lose_fpu(int save)
189{
190 preempt_disable();
191 lose_fpu_inatomic(save, current);
192 preempt_enable();
193}
194
195/**
196 * init_fp_ctx() - Initialize task FP context
197 * @target: The task whose FP context should be initialized.
198 *
199 * Initializes the FP context of the target task to sane default values if that
200 * target task does not already have valid FP context. Once the context has
201 * been initialized, the task will be marked as having used FP & thus having
202 * valid FP context.
203 *
204 * Returns: true if context is initialized, else false.
205 */
206static inline bool init_fp_ctx(struct task_struct *target)
207{
208 /* If FP has been used then the target already has context */
209 if (tsk_used_math(target))
210 return false;
211
212 /* Begin with data registers set to all 1s... */
213 memset(&target->thread.fpu.fpr, ~0, sizeof(target->thread.fpu.fpr));
214
215 /* FCSR has been preset by `mips_set_personality_nan'. */
216
217 /*
218 * Record that the target has "used" math, such that the context
219 * just initialised, and any modifications made by the caller,
220 * aren't discarded.
221 */
222 set_stopped_child_used_math(target);
223
224 return true;
225}
226
227static inline void save_fp(struct task_struct *tsk)
228{
229 if (cpu_has_fpu)
230 _save_fp(tsk);
231}
232
233static inline void restore_fp(struct task_struct *tsk)
234{
235 if (cpu_has_fpu)
236 _restore_fp(tsk);
237}
238
239static inline union fpureg *get_fpu_regs(struct task_struct *tsk)
240{
241 if (tsk == current) {
242 preempt_disable();
243 if (is_fpu_owner())
244 _save_fp(current);
245 preempt_enable();
246 }
247
248 return tsk->thread.fpu.fpr;
249}
250
251#else /* !CONFIG_MIPS_FP_SUPPORT */
252
253/*
254 * When FP support is disabled we provide only a minimal set of stub functions
255 * to avoid callers needing to care too much about CONFIG_MIPS_FP_SUPPORT.
256 */
257
258static inline int __enable_fpu(enum fpu_mode mode)
259{
260 return SIGILL;
261}
262
263static inline void __disable_fpu(void)
264{
265 /* no-op */
266}
267
268
269static inline int is_fpu_owner(void)
270{
271 return 0;
272}
273
274static inline void clear_fpu_owner(void)
275{
276 /* no-op */
277}
278
279static inline int own_fpu_inatomic(int restore)
280{
281 return SIGILL;
282}
283
284static inline int own_fpu(int restore)
285{
286 return SIGILL;
287}
288
289static inline void lose_fpu_inatomic(int save, struct task_struct *tsk)
290{
291 /* no-op */
292}
293
294static inline void lose_fpu(int save)
295{
296 /* no-op */
297}
298
299static inline bool init_fp_ctx(struct task_struct *target)
300{
301 return false;
302}
303
304/*
305 * The following functions should only be called in paths where we know that FP
306 * support is enabled, typically a path where own_fpu() or __enable_fpu() have
307 * returned successfully. When CONFIG_MIPS_FP_SUPPORT=n it is known at compile
308 * time that this should never happen, so calls to these functions should be
309 * optimized away & never actually be emitted.
310 */
311
312extern void save_fp(struct task_struct *tsk)
313 __compiletime_error("save_fp() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
314
315extern void _save_fp(struct task_struct *)
316 __compiletime_error("_save_fp() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
317
318extern void restore_fp(struct task_struct *tsk)
319 __compiletime_error("restore_fp() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
320
321extern void _restore_fp(struct task_struct *)
322 __compiletime_error("_restore_fp() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
323
324extern union fpureg *get_fpu_regs(struct task_struct *tsk)
325 __compiletime_error("get_fpu_regs() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
326
327#endif /* !CONFIG_MIPS_FP_SUPPORT */
328#endif /* _ASM_FPU_H */
diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
new file mode 100644
index 000000000..f67759e81
--- /dev/null
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -0,0 +1,187 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Further private data for which no space exists in mips_fpu_struct.
5 * This should be subsumed into the mips_fpu_struct structure as
6 * defined in processor.h as soon as the absurd wired absolute assembler
7 * offsets become dynamic at compile time.
8 *
9 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
11 */
12#ifndef _ASM_FPU_EMULATOR_H
13#define _ASM_FPU_EMULATOR_H
14
15#include <linux/sched.h>
16#include <asm/dsemul.h>
17#include <asm/thread_info.h>
18#include <asm/inst.h>
19#include <asm/local.h>
20#include <asm/processor.h>
21
22#ifdef CONFIG_DEBUG_FS
23
24struct mips_fpu_emulator_stats {
25 unsigned long emulated;
26 unsigned long loads;
27 unsigned long stores;
28 unsigned long branches;
29 unsigned long cp1ops;
30 unsigned long cp1xops;
31 unsigned long errors;
32 unsigned long ieee754_inexact;
33 unsigned long ieee754_underflow;
34 unsigned long ieee754_overflow;
35 unsigned long ieee754_zerodiv;
36 unsigned long ieee754_invalidop;
37 unsigned long ds_emul;
38
39 unsigned long abs_s;
40 unsigned long abs_d;
41 unsigned long add_s;
42 unsigned long add_d;
43 unsigned long bc1eqz;
44 unsigned long bc1nez;
45 unsigned long ceil_w_s;
46 unsigned long ceil_w_d;
47 unsigned long ceil_l_s;
48 unsigned long ceil_l_d;
49 unsigned long class_s;
50 unsigned long class_d;
51 unsigned long cmp_af_s;
52 unsigned long cmp_af_d;
53 unsigned long cmp_eq_s;
54 unsigned long cmp_eq_d;
55 unsigned long cmp_le_s;
56 unsigned long cmp_le_d;
57 unsigned long cmp_lt_s;
58 unsigned long cmp_lt_d;
59 unsigned long cmp_ne_s;
60 unsigned long cmp_ne_d;
61 unsigned long cmp_or_s;
62 unsigned long cmp_or_d;
63 unsigned long cmp_ueq_s;
64 unsigned long cmp_ueq_d;
65 unsigned long cmp_ule_s;
66 unsigned long cmp_ule_d;
67 unsigned long cmp_ult_s;
68 unsigned long cmp_ult_d;
69 unsigned long cmp_un_s;
70 unsigned long cmp_un_d;
71 unsigned long cmp_une_s;
72 unsigned long cmp_une_d;
73 unsigned long cmp_saf_s;
74 unsigned long cmp_saf_d;
75 unsigned long cmp_seq_s;
76 unsigned long cmp_seq_d;
77 unsigned long cmp_sle_s;
78 unsigned long cmp_sle_d;
79 unsigned long cmp_slt_s;
80 unsigned long cmp_slt_d;
81 unsigned long cmp_sne_s;
82 unsigned long cmp_sne_d;
83 unsigned long cmp_sor_s;
84 unsigned long cmp_sor_d;
85 unsigned long cmp_sueq_s;
86 unsigned long cmp_sueq_d;
87 unsigned long cmp_sule_s;
88 unsigned long cmp_sule_d;
89 unsigned long cmp_sult_s;
90 unsigned long cmp_sult_d;
91 unsigned long cmp_sun_s;
92 unsigned long cmp_sun_d;
93 unsigned long cmp_sune_s;
94 unsigned long cmp_sune_d;
95 unsigned long cvt_d_l;
96 unsigned long cvt_d_s;
97 unsigned long cvt_d_w;
98 unsigned long cvt_l_s;
99 unsigned long cvt_l_d;
100 unsigned long cvt_s_d;
101 unsigned long cvt_s_l;
102 unsigned long cvt_s_w;
103 unsigned long cvt_w_s;
104 unsigned long cvt_w_d;
105 unsigned long div_s;
106 unsigned long div_d;
107 unsigned long floor_w_s;
108 unsigned long floor_w_d;
109 unsigned long floor_l_s;
110 unsigned long floor_l_d;
111 unsigned long maddf_s;
112 unsigned long maddf_d;
113 unsigned long max_s;
114 unsigned long max_d;
115 unsigned long maxa_s;
116 unsigned long maxa_d;
117 unsigned long min_s;
118 unsigned long min_d;
119 unsigned long mina_s;
120 unsigned long mina_d;
121 unsigned long mov_s;
122 unsigned long mov_d;
123 unsigned long msubf_s;
124 unsigned long msubf_d;
125 unsigned long mul_s;
126 unsigned long mul_d;
127 unsigned long neg_s;
128 unsigned long neg_d;
129 unsigned long recip_s;
130 unsigned long recip_d;
131 unsigned long rint_s;
132 unsigned long rint_d;
133 unsigned long round_w_s;
134 unsigned long round_w_d;
135 unsigned long round_l_s;
136 unsigned long round_l_d;
137 unsigned long rsqrt_s;
138 unsigned long rsqrt_d;
139 unsigned long sel_s;
140 unsigned long sel_d;
141 unsigned long seleqz_s;
142 unsigned long seleqz_d;
143 unsigned long selnez_s;
144 unsigned long selnez_d;
145 unsigned long sqrt_s;
146 unsigned long sqrt_d;
147 unsigned long sub_s;
148 unsigned long sub_d;
149 unsigned long trunc_w_s;
150 unsigned long trunc_w_d;
151 unsigned long trunc_l_s;
152 unsigned long trunc_l_d;
153};
154
155DECLARE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
156
157#define MIPS_FPU_EMU_INC_STATS(M) \
158do { \
159 preempt_disable(); \
160 __this_cpu_inc(fpuemustats.M); \
161 preempt_enable(); \
162} while (0)
163
164#else
165#define MIPS_FPU_EMU_INC_STATS(M) do { } while (0)
166#endif /* CONFIG_DEBUG_FS */
167
168extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
169 struct mips_fpu_struct *ctx, int has_fpu,
170 void __user **fault_addr);
171void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
172 struct task_struct *tsk);
173int process_fpemu_return(int sig, void __user *fault_addr,
174 unsigned long fcr31);
175
176/*
177 * Mask the FCSR Cause bits according to the Enable bits, observing
178 * that Unimplemented is always enabled.
179 */
180static inline unsigned long mask_fcr31_x(unsigned long fcr31)
181{
182 return fcr31 & (FPU_CSR_UNI_X |
183 ((fcr31 & FPU_CSR_ALL_E) <<
184 (ffs(FPU_CSR_ALL_X) - ffs(FPU_CSR_ALL_E))));
185}
186
187#endif /* _ASM_FPU_EMULATOR_H */
diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h
new file mode 100644
index 000000000..b463f2aa5
--- /dev/null
+++ b/arch/mips/include/asm/ftrace.h
@@ -0,0 +1,90 @@
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 for
4 * more details.
5 *
6 * Copyright (C) 2009 DSLab, Lanzhou University, China
7 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
8 */
9
10#ifndef _ASM_MIPS_FTRACE_H
11#define _ASM_MIPS_FTRACE_H
12
13#ifdef CONFIG_FUNCTION_TRACER
14
15#define MCOUNT_ADDR ((unsigned long)(_mcount))
16#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
17
18#ifndef __ASSEMBLY__
19extern void _mcount(void);
20#define mcount _mcount
21
22#define safe_load(load, src, dst, error) \
23do { \
24 asm volatile ( \
25 "1: " load " %[tmp_dst], 0(%[tmp_src])\n" \
26 " li %[tmp_err], 0\n" \
27 "2: .insn\n" \
28 \
29 ".section .fixup, \"ax\"\n" \
30 "3: li %[tmp_err], 1\n" \
31 " j 2b\n" \
32 ".previous\n" \
33 \
34 ".section\t__ex_table,\"a\"\n\t" \
35 STR(PTR) "\t1b, 3b\n\t" \
36 ".previous\n" \
37 \
38 : [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\
39 : [tmp_src] "r" (src) \
40 : "memory" \
41 ); \
42} while (0)
43
44#define safe_store(store, src, dst, error) \
45do { \
46 asm volatile ( \
47 "1: " store " %[tmp_src], 0(%[tmp_dst])\n"\
48 " li %[tmp_err], 0\n" \
49 "2: .insn\n" \
50 \
51 ".section .fixup, \"ax\"\n" \
52 "3: li %[tmp_err], 1\n" \
53 " j 2b\n" \
54 ".previous\n" \
55 \
56 ".section\t__ex_table,\"a\"\n\t"\
57 STR(PTR) "\t1b, 3b\n\t" \
58 ".previous\n" \
59 \
60 : [tmp_err] "=r" (error) \
61 : [tmp_dst] "r" (dst), [tmp_src] "r" (src)\
62 : "memory" \
63 ); \
64} while (0)
65
66#define safe_load_code(dst, src, error) \
67 safe_load(STR(lw), src, dst, error)
68#define safe_store_code(src, dst, error) \
69 safe_store(STR(sw), src, dst, error)
70
71#define safe_load_stack(dst, src, error) \
72 safe_load(STR(PTR_L), src, dst, error)
73
74#define safe_store_stack(src, dst, error) \
75 safe_store(STR(PTR_S), src, dst, error)
76
77
78#ifdef CONFIG_DYNAMIC_FTRACE
79static inline unsigned long ftrace_call_adjust(unsigned long addr)
80{
81 return addr;
82}
83
84struct dyn_arch_ftrace {
85};
86
87#endif /* CONFIG_DYNAMIC_FTRACE */
88#endif /* __ASSEMBLY__ */
89#endif /* CONFIG_FUNCTION_TRACER */
90#endif /* _ASM_MIPS_FTRACE_H */
diff --git a/arch/mips/include/asm/futex.h b/arch/mips/include/asm/futex.h
new file mode 100644
index 000000000..d85248404
--- /dev/null
+++ b/arch/mips/include/asm/futex.h
@@ -0,0 +1,204 @@
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) 2006 Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef _ASM_FUTEX_H
9#define _ASM_FUTEX_H
10
11#ifdef __KERNEL__
12
13#include <linux/futex.h>
14#include <linux/uaccess.h>
15#include <asm/asm-eva.h>
16#include <asm/barrier.h>
17#include <asm/compiler.h>
18#include <asm/errno.h>
19#include <asm/sync.h>
20#include <asm/war.h>
21
22#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
23{ \
24 if (cpu_has_llsc && IS_ENABLED(CONFIG_WAR_R10000_LLSC)) { \
25 __asm__ __volatile__( \
26 " .set push \n" \
27 " .set noat \n" \
28 " .set push \n" \
29 " .set arch=r4000 \n" \
30 "1: ll %1, %4 # __futex_atomic_op \n" \
31 " .set pop \n" \
32 " " insn " \n" \
33 " .set arch=r4000 \n" \
34 "2: sc $1, %2 \n" \
35 " beqzl $1, 1b \n" \
36 __stringify(__WEAK_LLSC_MB) " \n" \
37 "3: \n" \
38 " .insn \n" \
39 " .set pop \n" \
40 " .section .fixup,\"ax\" \n" \
41 "4: li %0, %6 \n" \
42 " j 3b \n" \
43 " .previous \n" \
44 " .section __ex_table,\"a\" \n" \
45 " "__UA_ADDR "\t1b, 4b \n" \
46 " "__UA_ADDR "\t2b, 4b \n" \
47 " .previous \n" \
48 : "=r" (ret), "=&r" (oldval), \
49 "=" GCC_OFF_SMALL_ASM() (*uaddr) \
50 : "0" (0), GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oparg), \
51 "i" (-EFAULT) \
52 : "memory"); \
53 } else if (cpu_has_llsc) { \
54 __asm__ __volatile__( \
55 " .set push \n" \
56 " .set noat \n" \
57 " .set push \n" \
58 " .set "MIPS_ISA_ARCH_LEVEL" \n" \
59 " " __SYNC(full, loongson3_war) " \n" \
60 "1: "user_ll("%1", "%4")" # __futex_atomic_op\n" \
61 " .set pop \n" \
62 " " insn " \n" \
63 " .set "MIPS_ISA_ARCH_LEVEL" \n" \
64 "2: "user_sc("$1", "%2")" \n" \
65 " beqz $1, 1b \n" \
66 __stringify(__WEAK_LLSC_MB) " \n" \
67 "3: \n" \
68 " .insn \n" \
69 " .set pop \n" \
70 " .section .fixup,\"ax\" \n" \
71 "4: li %0, %6 \n" \
72 " j 3b \n" \
73 " .previous \n" \
74 " .section __ex_table,\"a\" \n" \
75 " "__UA_ADDR "\t1b, 4b \n" \
76 " "__UA_ADDR "\t2b, 4b \n" \
77 " .previous \n" \
78 : "=r" (ret), "=&r" (oldval), \
79 "=" GCC_OFF_SMALL_ASM() (*uaddr) \
80 : "0" (0), GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oparg), \
81 "i" (-EFAULT) \
82 : "memory"); \
83 } else \
84 ret = -ENOSYS; \
85}
86
87static inline int
88arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)
89{
90 int oldval = 0, ret;
91
92 if (!access_ok(uaddr, sizeof(u32)))
93 return -EFAULT;
94
95 switch (op) {
96 case FUTEX_OP_SET:
97 __futex_atomic_op("move $1, %z5", ret, oldval, uaddr, oparg);
98 break;
99
100 case FUTEX_OP_ADD:
101 __futex_atomic_op("addu $1, %1, %z5",
102 ret, oldval, uaddr, oparg);
103 break;
104 case FUTEX_OP_OR:
105 __futex_atomic_op("or $1, %1, %z5",
106 ret, oldval, uaddr, oparg);
107 break;
108 case FUTEX_OP_ANDN:
109 __futex_atomic_op("and $1, %1, %z5",
110 ret, oldval, uaddr, ~oparg);
111 break;
112 case FUTEX_OP_XOR:
113 __futex_atomic_op("xor $1, %1, %z5",
114 ret, oldval, uaddr, oparg);
115 break;
116 default:
117 ret = -ENOSYS;
118 }
119
120 if (!ret)
121 *oval = oldval;
122
123 return ret;
124}
125
126static inline int
127futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
128 u32 oldval, u32 newval)
129{
130 int ret = 0;
131 u32 val;
132
133 if (!access_ok(uaddr, sizeof(u32)))
134 return -EFAULT;
135
136 if (cpu_has_llsc && IS_ENABLED(CONFIG_WAR_R10000_LLSC)) {
137 __asm__ __volatile__(
138 "# futex_atomic_cmpxchg_inatomic \n"
139 " .set push \n"
140 " .set noat \n"
141 " .set push \n"
142 " .set arch=r4000 \n"
143 "1: ll %1, %3 \n"
144 " bne %1, %z4, 3f \n"
145 " .set pop \n"
146 " move $1, %z5 \n"
147 " .set arch=r4000 \n"
148 "2: sc $1, %2 \n"
149 " beqzl $1, 1b \n"
150 __stringify(__WEAK_LLSC_MB) " \n"
151 "3: \n"
152 " .insn \n"
153 " .set pop \n"
154 " .section .fixup,\"ax\" \n"
155 "4: li %0, %6 \n"
156 " j 3b \n"
157 " .previous \n"
158 " .section __ex_table,\"a\" \n"
159 " "__UA_ADDR "\t1b, 4b \n"
160 " "__UA_ADDR "\t2b, 4b \n"
161 " .previous \n"
162 : "+r" (ret), "=&r" (val), "=" GCC_OFF_SMALL_ASM() (*uaddr)
163 : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval),
164 "i" (-EFAULT)
165 : "memory");
166 } else if (cpu_has_llsc) {
167 __asm__ __volatile__(
168 "# futex_atomic_cmpxchg_inatomic \n"
169 " .set push \n"
170 " .set noat \n"
171 " .set push \n"
172 " .set "MIPS_ISA_ARCH_LEVEL" \n"
173 " " __SYNC(full, loongson3_war) " \n"
174 "1: "user_ll("%1", "%3")" \n"
175 " bne %1, %z4, 3f \n"
176 " .set pop \n"
177 " move $1, %z5 \n"
178 " .set "MIPS_ISA_ARCH_LEVEL" \n"
179 "2: "user_sc("$1", "%2")" \n"
180 " beqz $1, 1b \n"
181 "3: " __SYNC_ELSE(full, loongson3_war, __WEAK_LLSC_MB) "\n"
182 " .insn \n"
183 " .set pop \n"
184 " .section .fixup,\"ax\" \n"
185 "4: li %0, %6 \n"
186 " j 3b \n"
187 " .previous \n"
188 " .section __ex_table,\"a\" \n"
189 " "__UA_ADDR "\t1b, 4b \n"
190 " "__UA_ADDR "\t2b, 4b \n"
191 " .previous \n"
192 : "+r" (ret), "=&r" (val), "=" GCC_OFF_SMALL_ASM() (*uaddr)
193 : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval),
194 "i" (-EFAULT)
195 : "memory");
196 } else
197 return -ENOSYS;
198
199 *uval = val;
200 return ret;
201}
202
203#endif
204#endif /* _ASM_FUTEX_H */
diff --git a/arch/mips/include/asm/fw/arc/hinv.h b/arch/mips/include/asm/fw/arc/hinv.h
new file mode 100644
index 000000000..d67b6a90f
--- /dev/null
+++ b/arch/mips/include/asm/fw/arc/hinv.h
@@ -0,0 +1,176 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * ARCS hardware/memory inventory/configuration and system ID definitions.
4 */
5#ifndef _ASM_ARC_HINV_H
6#define _ASM_ARC_HINV_H
7
8#include <asm/sgidefs.h>
9#include <asm/fw/arc/types.h>
10
11/* configuration query defines */
12typedef enum configclass {
13 SystemClass,
14 ProcessorClass,
15 CacheClass,
16#ifndef _NT_PROM
17 MemoryClass,
18 AdapterClass,
19 ControllerClass,
20 PeripheralClass
21#else /* _NT_PROM */
22 AdapterClass,
23 ControllerClass,
24 PeripheralClass,
25 MemoryClass
26#endif /* _NT_PROM */
27} CONFIGCLASS;
28
29typedef enum configtype {
30 ARC,
31 CPU,
32 FPU,
33 PrimaryICache,
34 PrimaryDCache,
35 SecondaryICache,
36 SecondaryDCache,
37 SecondaryCache,
38#ifndef _NT_PROM
39 Memory,
40#endif
41 EISAAdapter,
42 TCAdapter,
43 SCSIAdapter,
44 DTIAdapter,
45 MultiFunctionAdapter,
46 DiskController,
47 TapeController,
48 CDROMController,
49 WORMController,
50 SerialController,
51 NetworkController,
52 DisplayController,
53 ParallelController,
54 PointerController,
55 KeyboardController,
56 AudioController,
57 OtherController,
58 DiskPeripheral,
59 FloppyDiskPeripheral,
60 TapePeripheral,
61 ModemPeripheral,
62 MonitorPeripheral,
63 PrinterPeripheral,
64 PointerPeripheral,
65 KeyboardPeripheral,
66 TerminalPeripheral,
67 LinePeripheral,
68 NetworkPeripheral,
69#ifdef _NT_PROM
70 Memory,
71#endif
72 OtherPeripheral,
73
74 /* new stuff for IP30 */
75 /* added without moving anything */
76 /* except ANONYMOUS. */
77
78 XTalkAdapter,
79 PCIAdapter,
80 GIOAdapter,
81 TPUAdapter,
82
83 Anonymous
84} CONFIGTYPE;
85
86typedef enum {
87 Failed = 1,
88 ReadOnly = 2,
89 Removable = 4,
90 ConsoleIn = 8,
91 ConsoleOut = 16,
92 Input = 32,
93 Output = 64
94} IDENTIFIERFLAG;
95
96#ifndef NULL /* for GetChild(NULL); */
97#define NULL 0
98#endif
99
100union key_u {
101 struct {
102#ifdef _MIPSEB
103 unsigned char c_bsize; /* block size in lines */
104 unsigned char c_lsize; /* line size in bytes/tag */
105 unsigned short c_size; /* cache size in 4K pages */
106#else /* _MIPSEL */
107 unsigned short c_size; /* cache size in 4K pages */
108 unsigned char c_lsize; /* line size in bytes/tag */
109 unsigned char c_bsize; /* block size in lines */
110#endif /* _MIPSEL */
111 } cache;
112 ULONG FullKey;
113};
114
115#if _MIPS_SIM == _MIPS_SIM_ABI64
116#define SGI_ARCS_VERS 64 /* sgi 64-bit version */
117#define SGI_ARCS_REV 0 /* rev .00 */
118#else
119#define SGI_ARCS_VERS 1 /* first version */
120#define SGI_ARCS_REV 10 /* rev .10, 3/04/92 */
121#endif
122
123typedef struct {
124 CONFIGCLASS Class;
125 CONFIGTYPE Type;
126 IDENTIFIERFLAG Flags;
127 USHORT Version;
128 USHORT Revision;
129 ULONG Key;
130 ULONG AffinityMask;
131 ULONG ConfigurationDataSize;
132 ULONG IdentifierLength;
133 char *Identifier;
134} COMPONENT;
135
136/* internal structure that holds pathname parsing data */
137struct cfgdata {
138 char *name; /* full name */
139 int minlen; /* minimum length to match */
140 CONFIGTYPE type; /* type of token */
141};
142
143/* System ID */
144typedef struct {
145 CHAR VendorId[8];
146 CHAR ProductId[8];
147} SYSTEMID;
148
149/* memory query functions */
150typedef enum memorytype {
151 ExceptionBlock,
152 SPBPage, /* ARCS == SystemParameterBlock */
153#ifndef _NT_PROM
154 FreeContiguous,
155 FreeMemory,
156 BadMemory,
157 LoadedProgram,
158 FirmwareTemporary,
159 FirmwarePermanent
160#else /* _NT_PROM */
161 FreeMemory,
162 BadMemory,
163 LoadedProgram,
164 FirmwareTemporary,
165 FirmwarePermanent,
166 FreeContiguous
167#endif /* _NT_PROM */
168} MEMORYTYPE;
169
170typedef struct {
171 MEMORYTYPE Type;
172 LONG BasePage;
173 LONG PageCount;
174} MEMORYDESCRIPTOR;
175
176#endif /* _ASM_ARC_HINV_H */
diff --git a/arch/mips/include/asm/fw/arc/types.h b/arch/mips/include/asm/fw/arc/types.h
new file mode 100644
index 000000000..ad1638061
--- /dev/null
+++ b/arch/mips/include/asm/fw/arc/types.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 * 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
13#ifdef CONFIG_FW_ARC32
14
15typedef char CHAR;
16typedef short SHORT;
17typedef long LARGE_INTEGER __attribute__ ((__mode__ (__DI__)));
18typedef long LONG __attribute__ ((__mode__ (__SI__)));
19typedef unsigned char UCHAR;
20typedef unsigned short USHORT;
21typedef unsigned long ULONG __attribute__ ((__mode__ (__SI__)));
22typedef void VOID;
23
24/* The pointer types. Note that we're using a 64-bit compiler but all
25 pointer in the ARC structures are only 32-bit, so we need some disgusting
26 workarounds. Keep your vomit bag handy. */
27typedef LONG _PCHAR;
28typedef LONG _PSHORT;
29typedef LONG _PLARGE_INTEGER;
30typedef LONG _PLONG;
31typedef LONG _PUCHAR;
32typedef LONG _PUSHORT;
33typedef LONG _PULONG;
34typedef LONG _PVOID;
35
36#endif /* CONFIG_FW_ARC32 */
37
38#ifdef CONFIG_FW_ARC64
39
40typedef char CHAR;
41typedef short SHORT;
42typedef long LARGE_INTEGER __attribute__ ((__mode__ (__DI__)));
43typedef long LONG __attribute__ ((__mode__ (__DI__)));
44typedef unsigned char UCHAR;
45typedef unsigned short USHORT;
46typedef unsigned long ULONG __attribute__ ((__mode__ (__DI__)));
47typedef void VOID;
48
49/* The pointer types. We're 64-bit and the firmware is also 64-bit, so
50 live is sane ... */
51typedef CHAR *_PCHAR;
52typedef SHORT *_PSHORT;
53typedef LARGE_INTEGER *_PLARGE_INTEGER;
54typedef LONG *_PLONG;
55typedef UCHAR *_PUCHAR;
56typedef USHORT *_PUSHORT;
57typedef ULONG *_PULONG;
58typedef VOID *_PVOID;
59
60#endif /* CONFIG_FW_ARC64 */
61
62typedef CHAR *PCHAR;
63typedef SHORT *PSHORT;
64typedef LARGE_INTEGER *PLARGE_INTEGER;
65typedef LONG *PLONG;
66typedef UCHAR *PUCHAR;
67typedef USHORT *PUSHORT;
68typedef ULONG *PULONG;
69typedef VOID *PVOID;
70
71/*
72 * Return type of ArcGetDisplayStatus()
73 */
74typedef struct {
75 USHORT CursorXPosition;
76 USHORT CursorYPosition;
77 USHORT CursorMaxXPosition;
78 USHORT CursorMaxYPosition;
79 USHORT ForegroundColor;
80 USHORT BackgroundColor;
81 UCHAR HighIntensity;
82 UCHAR Underscored;
83 UCHAR ReverseVideo;
84} DISPLAY_STATUS;
85
86#endif /* _ASM_ARC_TYPES_H */
diff --git a/arch/mips/include/asm/fw/cfe/cfe_api.h b/arch/mips/include/asm/fw/cfe/cfe_api.h
new file mode 100644
index 000000000..6457f3689
--- /dev/null
+++ b/arch/mips/include/asm/fw/cfe/cfe_api.h
@@ -0,0 +1,109 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2000, 2001, 2002 Broadcom Corporation
4 */
5/*
6 * Broadcom Common Firmware Environment (CFE)
7 *
8 * This file contains declarations for doing callbacks to
9 * cfe from an application. It should be the only header
10 * needed by the application to use this library
11 *
12 * Authors: Mitch Lichtenberg, Chris Demetriou
13 */
14#ifndef CFE_API_H
15#define CFE_API_H
16
17#include <linux/types.h>
18#include <linux/string.h>
19
20typedef long intptr_t;
21
22
23/*
24 * Constants
25 */
26
27/* Seal indicating CFE's presence, passed to user program. */
28#define CFE_EPTSEAL 0x43464531
29
30#define CFE_MI_RESERVED 0 /* memory is reserved, do not use */
31#define CFE_MI_AVAILABLE 1 /* memory is available */
32
33#define CFE_FLG_WARMSTART 0x00000001
34#define CFE_FLG_FULL_ARENA 0x00000001
35#define CFE_FLG_ENV_PERMANENT 0x00000001
36
37#define CFE_CPU_CMD_START 1
38#define CFE_CPU_CMD_STOP 0
39
40#define CFE_STDHANDLE_CONSOLE 0
41
42#define CFE_DEV_NETWORK 1
43#define CFE_DEV_DISK 2
44#define CFE_DEV_FLASH 3
45#define CFE_DEV_SERIAL 4
46#define CFE_DEV_CPU 5
47#define CFE_DEV_NVRAM 6
48#define CFE_DEV_CLOCK 7
49#define CFE_DEV_OTHER 8
50#define CFE_DEV_MASK 0x0F
51
52#define CFE_CACHE_FLUSH_D 1
53#define CFE_CACHE_INVAL_I 2
54#define CFE_CACHE_INVAL_D 4
55#define CFE_CACHE_INVAL_L2 8
56
57#define CFE_FWI_64BIT 0x00000001
58#define CFE_FWI_32BIT 0x00000002
59#define CFE_FWI_RELOC 0x00000004
60#define CFE_FWI_UNCACHED 0x00000008
61#define CFE_FWI_MULTICPU 0x00000010
62#define CFE_FWI_FUNCSIM 0x00000020
63#define CFE_FWI_RTLSIM 0x00000040
64
65typedef struct {
66 int64_t fwi_version; /* major, minor, eco version */
67 int64_t fwi_totalmem; /* total installed mem */
68 int64_t fwi_flags; /* various flags */
69 int64_t fwi_boardid; /* board ID */
70 int64_t fwi_bootarea_va; /* VA of boot area */
71 int64_t fwi_bootarea_pa; /* PA of boot area */
72 int64_t fwi_bootarea_size; /* size of boot area */
73} cfe_fwinfo_t;
74
75
76/*
77 * Defines and prototypes for functions which take no arguments.
78 */
79int64_t cfe_getticks(void);
80
81/*
82 * Defines and prototypes for the rest of the functions.
83 */
84int cfe_close(int handle);
85int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1);
86int cfe_cpu_stop(int cpu);
87int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen);
88int cfe_enummem(int idx, int flags, uint64_t * start, uint64_t * length,
89 uint64_t * type);
90int cfe_exit(int warm, int status);
91int cfe_flushcache(int flg);
92int cfe_getdevinfo(char *name);
93int cfe_getenv(char *name, char *dest, int destlen);
94int cfe_getfwinfo(cfe_fwinfo_t * info);
95int cfe_getstdhandle(int flg);
96int cfe_init(uint64_t handle, uint64_t ept);
97int cfe_inpstat(int handle);
98int cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer,
99 int length, int *retlen, uint64_t offset);
100int cfe_open(char *name);
101int cfe_read(int handle, unsigned char *buffer, int length);
102int cfe_readblk(int handle, int64_t offset, unsigned char *buffer,
103 int length);
104int cfe_setenv(char *name, char *val);
105int cfe_write(int handle, const char *buffer, int length);
106int cfe_writeblk(int handle, int64_t offset, const char *buffer,
107 int length);
108
109#endif /* CFE_API_H */
diff --git a/arch/mips/include/asm/fw/cfe/cfe_error.h b/arch/mips/include/asm/fw/cfe/cfe_error.h
new file mode 100644
index 000000000..2f04a39fd
--- /dev/null
+++ b/arch/mips/include/asm/fw/cfe/cfe_error.h
@@ -0,0 +1,67 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2000, 2001, 2002 Broadcom Corporation
4 */
5
6/*
7 * Broadcom Common Firmware Environment (CFE)
8 *
9 * CFE's global error code list is here.
10 *
11 * Author: Mitch Lichtenberg
12 */
13
14#define CFE_OK 0
15#define CFE_ERR -1 /* generic error */
16#define CFE_ERR_INV_COMMAND -2
17#define CFE_ERR_EOF -3
18#define CFE_ERR_IOERR -4
19#define CFE_ERR_NOMEM -5
20#define CFE_ERR_DEVNOTFOUND -6
21#define CFE_ERR_DEVOPEN -7
22#define CFE_ERR_INV_PARAM -8
23#define CFE_ERR_ENVNOTFOUND -9
24#define CFE_ERR_ENVREADONLY -10
25
26#define CFE_ERR_NOTELF -11
27#define CFE_ERR_NOT32BIT -12
28#define CFE_ERR_WRONGENDIAN -13
29#define CFE_ERR_BADELFVERS -14
30#define CFE_ERR_NOTMIPS -15
31#define CFE_ERR_BADELFFMT -16
32#define CFE_ERR_BADADDR -17
33
34#define CFE_ERR_FILENOTFOUND -18
35#define CFE_ERR_UNSUPPORTED -19
36
37#define CFE_ERR_HOSTUNKNOWN -20
38
39#define CFE_ERR_TIMEOUT -21
40
41#define CFE_ERR_PROTOCOLERR -22
42
43#define CFE_ERR_NETDOWN -23
44#define CFE_ERR_NONAMESERVER -24
45
46#define CFE_ERR_NOHANDLES -25
47#define CFE_ERR_ALREADYBOUND -26
48
49#define CFE_ERR_CANNOTSET -27
50#define CFE_ERR_NOMORE -28
51#define CFE_ERR_BADFILESYS -29
52#define CFE_ERR_FSNOTAVAIL -30
53
54#define CFE_ERR_INVBOOTBLOCK -31
55#define CFE_ERR_WRONGDEVTYPE -32
56#define CFE_ERR_BBCHECKSUM -33
57#define CFE_ERR_BOOTPROGCHKSUM -34
58
59#define CFE_ERR_LDRNOTAVAIL -35
60
61#define CFE_ERR_NOTREADY -36
62
63#define CFE_ERR_GETMEM -37
64#define CFE_ERR_SETMEM -38
65
66#define CFE_ERR_NOTCONN -39
67#define CFE_ERR_ADDRINUSE -40
diff --git a/arch/mips/include/asm/fw/fw.h b/arch/mips/include/asm/fw/fw.h
new file mode 100644
index 000000000..d0494ce4b
--- /dev/null
+++ b/arch/mips/include/asm/fw/fw.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) 2012 MIPS Technologies, Inc.
7 */
8#ifndef __ASM_FW_H_
9#define __ASM_FW_H_
10
11#include <asm/bootinfo.h> /* For cleaner code... */
12
13extern int fw_argc;
14extern int *_fw_argv;
15extern int *_fw_envp;
16
17/*
18 * Most firmware like YAMON, PMON, etc. pass arguments and environment
19 * variables as 32-bit pointers. These take care of sign extension.
20 */
21#define fw_argv(index) ((char *)(long)_fw_argv[(index)])
22#define fw_envp(index) ((char *)(long)_fw_envp[(index)])
23
24extern void fw_init_cmdline(void);
25extern char *fw_getcmdline(void);
26extern void fw_meminit(void);
27extern char *fw_getenv(char *name);
28extern unsigned long fw_getenvl(char *name);
29extern void fw_init_early_console(void);
30
31#endif /* __ASM_FW_H_ */
diff --git a/arch/mips/include/asm/ginvt.h b/arch/mips/include/asm/ginvt.h
new file mode 100644
index 000000000..6eb7c2b94
--- /dev/null
+++ b/arch/mips/include/asm/ginvt.h
@@ -0,0 +1,56 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __MIPS_ASM_GINVT_H__
3#define __MIPS_ASM_GINVT_H__
4
5#include <asm/mipsregs.h>
6
7enum ginvt_type {
8 GINVT_FULL,
9 GINVT_VA,
10 GINVT_MMID,
11};
12
13#ifdef TOOLCHAIN_SUPPORTS_GINV
14# define _ASM_SET_GINV ".set ginv\n"
15#else
16_ASM_MACRO_1R1I(ginvt, rs, type,
17 _ASM_INSN_IF_MIPS(0x7c0000bd | (__rs << 21) | (\\type << 8))
18 _ASM_INSN32_IF_MM(0x0000717c | (__rs << 16) | (\\type << 9)));
19# define _ASM_SET_GINV
20#endif
21
22static __always_inline void ginvt(unsigned long addr, enum ginvt_type type)
23{
24 asm volatile(
25 ".set push\n"
26 _ASM_SET_GINV
27 " ginvt %0, %1\n"
28 ".set pop"
29 : /* no outputs */
30 : "r"(addr), "i"(type)
31 : "memory");
32}
33
34static inline void ginvt_full(void)
35{
36 ginvt(0, GINVT_FULL);
37}
38
39static inline void ginvt_va(unsigned long addr)
40{
41 addr &= PAGE_MASK << 1;
42 ginvt(addr, GINVT_VA);
43}
44
45static inline void ginvt_mmid(void)
46{
47 ginvt(0, GINVT_MMID);
48}
49
50static inline void ginvt_va_mmid(unsigned long addr)
51{
52 addr &= PAGE_MASK << 1;
53 ginvt(addr, GINVT_VA | GINVT_MMID);
54}
55
56#endif /* __MIPS_ASM_GINVT_H__ */
diff --git a/arch/mips/include/asm/gio_device.h b/arch/mips/include/asm/gio_device.h
new file mode 100644
index 000000000..159087f53
--- /dev/null
+++ b/arch/mips/include/asm/gio_device.h
@@ -0,0 +1,53 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#include <linux/device.h>
3#include <linux/mod_devicetable.h>
4
5struct gio_device_id {
6 __u8 id;
7};
8
9struct gio_device {
10 struct device dev;
11 struct resource resource;
12 unsigned int irq;
13 unsigned int slotno;
14
15 const char *name;
16 struct gio_device_id id;
17 unsigned id32:1;
18 unsigned gio64:1;
19};
20#define to_gio_device(d) container_of(d, struct gio_device, dev)
21
22struct gio_driver {
23 const char *name;
24 struct module *owner;
25 const struct gio_device_id *id_table;
26
27 int (*probe)(struct gio_device *, const struct gio_device_id *);
28 void (*remove)(struct gio_device *);
29 void (*shutdown)(struct gio_device *);
30
31 struct device_driver driver;
32};
33#define to_gio_driver(drv) container_of(drv, struct gio_driver, driver)
34
35extern struct gio_device *gio_dev_get(struct gio_device *);
36extern void gio_dev_put(struct gio_device *);
37
38extern int gio_device_register(struct gio_device *);
39extern void gio_device_unregister(struct gio_device *);
40extern void gio_release_dev(struct device *);
41
42static inline void gio_device_free(struct gio_device *dev)
43{
44 gio_release_dev(&dev->dev);
45}
46
47extern int gio_register_driver(struct gio_driver *);
48extern void gio_unregister_driver(struct gio_driver *);
49
50#define gio_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
51#define gio_set_drvdata(_dev, data) dev_set_drvdata(&(_dev)->dev, (data))
52
53extern void gio_set_master(struct gio_device *);
diff --git a/arch/mips/include/asm/gt64120.h b/arch/mips/include/asm/gt64120.h
new file mode 100644
index 000000000..5d68d7265
--- /dev/null
+++ b/arch/mips/include/asm/gt64120.h
@@ -0,0 +1,566 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2000, 2004, 2005 MIPS Technologies, Inc.
4 * All rights reserved.
5 * Authors: Carsten Langgaard <carstenl@mips.com>
6 * Maciej W. Rozycki <macro@mips.com>
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef _ASM_GT64120_H
10#define _ASM_GT64120_H
11
12#include <asm/addrspace.h>
13#include <asm/byteorder.h>
14
15#define MSK(n) ((1 << (n)) - 1)
16
17/*
18 * Register offset addresses
19 */
20/* CPU Configuration. */
21#define GT_CPU_OFS 0x000
22
23#define GT_MULTI_OFS 0x120
24
25/* CPU Address Decode. */
26#define GT_SCS10LD_OFS 0x008
27#define GT_SCS10HD_OFS 0x010
28#define GT_SCS32LD_OFS 0x018
29#define GT_SCS32HD_OFS 0x020
30#define GT_CS20LD_OFS 0x028
31#define GT_CS20HD_OFS 0x030
32#define GT_CS3BOOTLD_OFS 0x038
33#define GT_CS3BOOTHD_OFS 0x040
34#define GT_PCI0IOLD_OFS 0x048
35#define GT_PCI0IOHD_OFS 0x050
36#define GT_PCI0M0LD_OFS 0x058
37#define GT_PCI0M0HD_OFS 0x060
38#define GT_ISD_OFS 0x068
39
40#define GT_PCI0M1LD_OFS 0x080
41#define GT_PCI0M1HD_OFS 0x088
42#define GT_PCI1IOLD_OFS 0x090
43#define GT_PCI1IOHD_OFS 0x098
44#define GT_PCI1M0LD_OFS 0x0a0
45#define GT_PCI1M0HD_OFS 0x0a8
46#define GT_PCI1M1LD_OFS 0x0b0
47#define GT_PCI1M1HD_OFS 0x0b8
48#define GT_PCI1M1LD_OFS 0x0b0
49#define GT_PCI1M1HD_OFS 0x0b8
50
51#define GT_SCS10AR_OFS 0x0d0
52#define GT_SCS32AR_OFS 0x0d8
53#define GT_CS20R_OFS 0x0e0
54#define GT_CS3BOOTR_OFS 0x0e8
55
56#define GT_PCI0IOREMAP_OFS 0x0f0
57#define GT_PCI0M0REMAP_OFS 0x0f8
58#define GT_PCI0M1REMAP_OFS 0x100
59#define GT_PCI1IOREMAP_OFS 0x108
60#define GT_PCI1M0REMAP_OFS 0x110
61#define GT_PCI1M1REMAP_OFS 0x118
62
63/* CPU Error Report. */
64#define GT_CPUERR_ADDRLO_OFS 0x070
65#define GT_CPUERR_ADDRHI_OFS 0x078
66
67#define GT_CPUERR_DATALO_OFS 0x128 /* GT-64120A only */
68#define GT_CPUERR_DATAHI_OFS 0x130 /* GT-64120A only */
69#define GT_CPUERR_PARITY_OFS 0x138 /* GT-64120A only */
70
71/* CPU Sync Barrier. */
72#define GT_PCI0SYNC_OFS 0x0c0
73#define GT_PCI1SYNC_OFS 0x0c8
74
75/* SDRAM and Device Address Decode. */
76#define GT_SCS0LD_OFS 0x400
77#define GT_SCS0HD_OFS 0x404
78#define GT_SCS1LD_OFS 0x408
79#define GT_SCS1HD_OFS 0x40c
80#define GT_SCS2LD_OFS 0x410
81#define GT_SCS2HD_OFS 0x414
82#define GT_SCS3LD_OFS 0x418
83#define GT_SCS3HD_OFS 0x41c
84#define GT_CS0LD_OFS 0x420
85#define GT_CS0HD_OFS 0x424
86#define GT_CS1LD_OFS 0x428
87#define GT_CS1HD_OFS 0x42c
88#define GT_CS2LD_OFS 0x430
89#define GT_CS2HD_OFS 0x434
90#define GT_CS3LD_OFS 0x438
91#define GT_CS3HD_OFS 0x43c
92#define GT_BOOTLD_OFS 0x440
93#define GT_BOOTHD_OFS 0x444
94
95#define GT_ADERR_OFS 0x470
96
97/* SDRAM Configuration. */
98#define GT_SDRAM_CFG_OFS 0x448
99
100#define GT_SDRAM_OPMODE_OFS 0x474
101#define GT_SDRAM_BM_OFS 0x478
102#define GT_SDRAM_ADDRDECODE_OFS 0x47c
103
104/* SDRAM Parameters. */
105#define GT_SDRAM_B0_OFS 0x44c
106#define GT_SDRAM_B1_OFS 0x450
107#define GT_SDRAM_B2_OFS 0x454
108#define GT_SDRAM_B3_OFS 0x458
109
110/* Device Parameters. */
111#define GT_DEV_B0_OFS 0x45c
112#define GT_DEV_B1_OFS 0x460
113#define GT_DEV_B2_OFS 0x464
114#define GT_DEV_B3_OFS 0x468
115#define GT_DEV_BOOT_OFS 0x46c
116
117/* ECC. */
118#define GT_ECC_ERRDATALO 0x480 /* GT-64120A only */
119#define GT_ECC_ERRDATAHI 0x484 /* GT-64120A only */
120#define GT_ECC_MEM 0x488 /* GT-64120A only */
121#define GT_ECC_CALC 0x48c /* GT-64120A only */
122#define GT_ECC_ERRADDR 0x490 /* GT-64120A only */
123
124/* DMA Record. */
125#define GT_DMA0_CNT_OFS 0x800
126#define GT_DMA1_CNT_OFS 0x804
127#define GT_DMA2_CNT_OFS 0x808
128#define GT_DMA3_CNT_OFS 0x80c
129#define GT_DMA0_SA_OFS 0x810
130#define GT_DMA1_SA_OFS 0x814
131#define GT_DMA2_SA_OFS 0x818
132#define GT_DMA3_SA_OFS 0x81c
133#define GT_DMA0_DA_OFS 0x820
134#define GT_DMA1_DA_OFS 0x824
135#define GT_DMA2_DA_OFS 0x828
136#define GT_DMA3_DA_OFS 0x82c
137#define GT_DMA0_NEXT_OFS 0x830
138#define GT_DMA1_NEXT_OFS 0x834
139#define GT_DMA2_NEXT_OFS 0x838
140#define GT_DMA3_NEXT_OFS 0x83c
141
142#define GT_DMA0_CUR_OFS 0x870
143#define GT_DMA1_CUR_OFS 0x874
144#define GT_DMA2_CUR_OFS 0x878
145#define GT_DMA3_CUR_OFS 0x87c
146
147/* DMA Channel Control. */
148#define GT_DMA0_CTRL_OFS 0x840
149#define GT_DMA1_CTRL_OFS 0x844
150#define GT_DMA2_CTRL_OFS 0x848
151#define GT_DMA3_CTRL_OFS 0x84c
152
153/* DMA Arbiter. */
154#define GT_DMA_ARB_OFS 0x860
155
156/* Timer/Counter. */
157#define GT_TC0_OFS 0x850
158#define GT_TC1_OFS 0x854
159#define GT_TC2_OFS 0x858
160#define GT_TC3_OFS 0x85c
161
162#define GT_TC_CONTROL_OFS 0x864
163
164/* PCI Internal. */
165#define GT_PCI0_CMD_OFS 0xc00
166#define GT_PCI0_TOR_OFS 0xc04
167#define GT_PCI0_BS_SCS10_OFS 0xc08
168#define GT_PCI0_BS_SCS32_OFS 0xc0c
169#define GT_PCI0_BS_CS20_OFS 0xc10
170#define GT_PCI0_BS_CS3BT_OFS 0xc14
171
172#define GT_PCI1_IACK_OFS 0xc30
173#define GT_PCI0_IACK_OFS 0xc34
174
175#define GT_PCI0_BARE_OFS 0xc3c
176#define GT_PCI0_PREFMBR_OFS 0xc40
177
178#define GT_PCI0_SCS10_BAR_OFS 0xc48
179#define GT_PCI0_SCS32_BAR_OFS 0xc4c
180#define GT_PCI0_CS20_BAR_OFS 0xc50
181#define GT_PCI0_CS3BT_BAR_OFS 0xc54
182#define GT_PCI0_SSCS10_BAR_OFS 0xc58
183#define GT_PCI0_SSCS32_BAR_OFS 0xc5c
184
185#define GT_PCI0_SCS3BT_BAR_OFS 0xc64
186
187#define GT_PCI1_CMD_OFS 0xc80
188#define GT_PCI1_TOR_OFS 0xc84
189#define GT_PCI1_BS_SCS10_OFS 0xc88
190#define GT_PCI1_BS_SCS32_OFS 0xc8c
191#define GT_PCI1_BS_CS20_OFS 0xc90
192#define GT_PCI1_BS_CS3BT_OFS 0xc94
193
194#define GT_PCI1_BARE_OFS 0xcbc
195#define GT_PCI1_PREFMBR_OFS 0xcc0
196
197#define GT_PCI1_SCS10_BAR_OFS 0xcc8
198#define GT_PCI1_SCS32_BAR_OFS 0xccc
199#define GT_PCI1_CS20_BAR_OFS 0xcd0
200#define GT_PCI1_CS3BT_BAR_OFS 0xcd4
201#define GT_PCI1_SSCS10_BAR_OFS 0xcd8
202#define GT_PCI1_SSCS32_BAR_OFS 0xcdc
203
204#define GT_PCI1_SCS3BT_BAR_OFS 0xce4
205
206#define GT_PCI1_CFGADDR_OFS 0xcf0
207#define GT_PCI1_CFGDATA_OFS 0xcf4
208#define GT_PCI0_CFGADDR_OFS 0xcf8
209#define GT_PCI0_CFGDATA_OFS 0xcfc
210
211/* Interrupts. */
212#define GT_INTRCAUSE_OFS 0xc18
213#define GT_INTRMASK_OFS 0xc1c
214
215#define GT_PCI0_ICMASK_OFS 0xc24
216#define GT_PCI0_SERR0MASK_OFS 0xc28
217
218#define GT_CPU_INTSEL_OFS 0xc70
219#define GT_PCI0_INTSEL_OFS 0xc74
220
221#define GT_HINTRCAUSE_OFS 0xc98
222#define GT_HINTRMASK_OFS 0xc9c
223
224#define GT_PCI0_HICMASK_OFS 0xca4
225#define GT_PCI1_SERR1MASK_OFS 0xca8
226
227
228/*
229 * I2O Support Registers
230 */
231#define INBOUND_MESSAGE_REGISTER0_PCI_SIDE 0x010
232#define INBOUND_MESSAGE_REGISTER1_PCI_SIDE 0x014
233#define OUTBOUND_MESSAGE_REGISTER0_PCI_SIDE 0x018
234#define OUTBOUND_MESSAGE_REGISTER1_PCI_SIDE 0x01c
235#define INBOUND_DOORBELL_REGISTER_PCI_SIDE 0x020
236#define INBOUND_INTERRUPT_CAUSE_REGISTER_PCI_SIDE 0x024
237#define INBOUND_INTERRUPT_MASK_REGISTER_PCI_SIDE 0x028
238#define OUTBOUND_DOORBELL_REGISTER_PCI_SIDE 0x02c
239#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_PCI_SIDE 0x030
240#define OUTBOUND_INTERRUPT_MASK_REGISTER_PCI_SIDE 0x034
241#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI_SIDE 0x040
242#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI_SIDE 0x044
243#define QUEUE_CONTROL_REGISTER_PCI_SIDE 0x050
244#define QUEUE_BASE_ADDRESS_REGISTER_PCI_SIDE 0x054
245#define INBOUND_FREE_HEAD_POINTER_REGISTER_PCI_SIDE 0x060
246#define INBOUND_FREE_TAIL_POINTER_REGISTER_PCI_SIDE 0x064
247#define INBOUND_POST_HEAD_POINTER_REGISTER_PCI_SIDE 0x068
248#define INBOUND_POST_TAIL_POINTER_REGISTER_PCI_SIDE 0x06c
249#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_PCI_SIDE 0x070
250#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_PCI_SIDE 0x074
251#define OUTBOUND_POST_HEAD_POINTER_REGISTER_PCI_SIDE 0x078
252#define OUTBOUND_POST_TAIL_POINTER_REGISTER_PCI_SIDE 0x07c
253
254#define INBOUND_MESSAGE_REGISTER0_CPU_SIDE 0x1c10
255#define INBOUND_MESSAGE_REGISTER1_CPU_SIDE 0x1c14
256#define OUTBOUND_MESSAGE_REGISTER0_CPU_SIDE 0x1c18
257#define OUTBOUND_MESSAGE_REGISTER1_CPU_SIDE 0x1c1c
258#define INBOUND_DOORBELL_REGISTER_CPU_SIDE 0x1c20
259#define INBOUND_INTERRUPT_CAUSE_REGISTER_CPU_SIDE 0x1c24
260#define INBOUND_INTERRUPT_MASK_REGISTER_CPU_SIDE 0x1c28
261#define OUTBOUND_DOORBELL_REGISTER_CPU_SIDE 0x1c2c
262#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_CPU_SIDE 0x1c30
263#define OUTBOUND_INTERRUPT_MASK_REGISTER_CPU_SIDE 0x1c34
264#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU_SIDE 0x1c40
265#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU_SIDE 0x1c44
266#define QUEUE_CONTROL_REGISTER_CPU_SIDE 0x1c50
267#define QUEUE_BASE_ADDRESS_REGISTER_CPU_SIDE 0x1c54
268#define INBOUND_FREE_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c60
269#define INBOUND_FREE_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c64
270#define INBOUND_POST_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c68
271#define INBOUND_POST_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c6c
272#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c70
273#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c74
274#define OUTBOUND_POST_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c78
275#define OUTBOUND_POST_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c7c
276
277/*
278 * Register encodings
279 */
280#define GT_CPU_ENDIAN_SHF 12
281#define GT_CPU_ENDIAN_MSK (MSK(1) << GT_CPU_ENDIAN_SHF)
282#define GT_CPU_ENDIAN_BIT GT_CPU_ENDIAN_MSK
283#define GT_CPU_WR_SHF 16
284#define GT_CPU_WR_MSK (MSK(1) << GT_CPU_WR_SHF)
285#define GT_CPU_WR_BIT GT_CPU_WR_MSK
286#define GT_CPU_WR_DXDXDXDX 0
287#define GT_CPU_WR_DDDD 1
288
289
290#define GT_PCI_DCRM_SHF 21
291#define GT_PCI_LD_SHF 0
292#define GT_PCI_LD_MSK (MSK(15) << GT_PCI_LD_SHF)
293#define GT_PCI_HD_SHF 0
294#define GT_PCI_HD_MSK (MSK(7) << GT_PCI_HD_SHF)
295#define GT_PCI_REMAP_SHF 0
296#define GT_PCI_REMAP_MSK (MSK(11) << GT_PCI_REMAP_SHF)
297
298
299#define GT_CFGADDR_CFGEN_SHF 31
300#define GT_CFGADDR_CFGEN_MSK (MSK(1) << GT_CFGADDR_CFGEN_SHF)
301#define GT_CFGADDR_CFGEN_BIT GT_CFGADDR_CFGEN_MSK
302
303#define GT_CFGADDR_BUSNUM_SHF 16
304#define GT_CFGADDR_BUSNUM_MSK (MSK(8) << GT_CFGADDR_BUSNUM_SHF)
305
306#define GT_CFGADDR_DEVNUM_SHF 11
307#define GT_CFGADDR_DEVNUM_MSK (MSK(5) << GT_CFGADDR_DEVNUM_SHF)
308
309#define GT_CFGADDR_FUNCNUM_SHF 8
310#define GT_CFGADDR_FUNCNUM_MSK (MSK(3) << GT_CFGADDR_FUNCNUM_SHF)
311
312#define GT_CFGADDR_REGNUM_SHF 2
313#define GT_CFGADDR_REGNUM_MSK (MSK(6) << GT_CFGADDR_REGNUM_SHF)
314
315
316#define GT_SDRAM_BM_ORDER_SHF 2
317#define GT_SDRAM_BM_ORDER_MSK (MSK(1) << GT_SDRAM_BM_ORDER_SHF)
318#define GT_SDRAM_BM_ORDER_BIT GT_SDRAM_BM_ORDER_MSK
319#define GT_SDRAM_BM_ORDER_SUB 1
320#define GT_SDRAM_BM_ORDER_LIN 0
321
322#define GT_SDRAM_BM_RSVD_ALL1 0xffb
323
324
325#define GT_SDRAM_ADDRDECODE_ADDR_SHF 0
326#define GT_SDRAM_ADDRDECODE_ADDR_MSK (MSK(3) << GT_SDRAM_ADDRDECODE_ADDR_SHF)
327#define GT_SDRAM_ADDRDECODE_ADDR_0 0
328#define GT_SDRAM_ADDRDECODE_ADDR_1 1
329#define GT_SDRAM_ADDRDECODE_ADDR_2 2
330#define GT_SDRAM_ADDRDECODE_ADDR_3 3
331#define GT_SDRAM_ADDRDECODE_ADDR_4 4
332#define GT_SDRAM_ADDRDECODE_ADDR_5 5
333#define GT_SDRAM_ADDRDECODE_ADDR_6 6
334#define GT_SDRAM_ADDRDECODE_ADDR_7 7
335
336
337#define GT_SDRAM_B0_CASLAT_SHF 0
338#define GT_SDRAM_B0_CASLAT_MSK (MSK(2) << GT_SDRAM_B0__SHF)
339#define GT_SDRAM_B0_CASLAT_2 1
340#define GT_SDRAM_B0_CASLAT_3 2
341
342#define GT_SDRAM_B0_FTDIS_SHF 2
343#define GT_SDRAM_B0_FTDIS_MSK (MSK(1) << GT_SDRAM_B0_FTDIS_SHF)
344#define GT_SDRAM_B0_FTDIS_BIT GT_SDRAM_B0_FTDIS_MSK
345
346#define GT_SDRAM_B0_SRASPRCHG_SHF 3
347#define GT_SDRAM_B0_SRASPRCHG_MSK (MSK(1) << GT_SDRAM_B0_SRASPRCHG_SHF)
348#define GT_SDRAM_B0_SRASPRCHG_BIT GT_SDRAM_B0_SRASPRCHG_MSK
349#define GT_SDRAM_B0_SRASPRCHG_2 0
350#define GT_SDRAM_B0_SRASPRCHG_3 1
351
352#define GT_SDRAM_B0_B0COMPAB_SHF 4
353#define GT_SDRAM_B0_B0COMPAB_MSK (MSK(1) << GT_SDRAM_B0_B0COMPAB_SHF)
354#define GT_SDRAM_B0_B0COMPAB_BIT GT_SDRAM_B0_B0COMPAB_MSK
355
356#define GT_SDRAM_B0_64BITINT_SHF 5
357#define GT_SDRAM_B0_64BITINT_MSK (MSK(1) << GT_SDRAM_B0_64BITINT_SHF)
358#define GT_SDRAM_B0_64BITINT_BIT GT_SDRAM_B0_64BITINT_MSK
359#define GT_SDRAM_B0_64BITINT_2 0
360#define GT_SDRAM_B0_64BITINT_4 1
361
362#define GT_SDRAM_B0_BW_SHF 6
363#define GT_SDRAM_B0_BW_MSK (MSK(1) << GT_SDRAM_B0_BW_SHF)
364#define GT_SDRAM_B0_BW_BIT GT_SDRAM_B0_BW_MSK
365#define GT_SDRAM_B0_BW_32 0
366#define GT_SDRAM_B0_BW_64 1
367
368#define GT_SDRAM_B0_BLODD_SHF 7
369#define GT_SDRAM_B0_BLODD_MSK (MSK(1) << GT_SDRAM_B0_BLODD_SHF)
370#define GT_SDRAM_B0_BLODD_BIT GT_SDRAM_B0_BLODD_MSK
371
372#define GT_SDRAM_B0_PAR_SHF 8
373#define GT_SDRAM_B0_PAR_MSK (MSK(1) << GT_SDRAM_B0_PAR_SHF)
374#define GT_SDRAM_B0_PAR_BIT GT_SDRAM_B0_PAR_MSK
375
376#define GT_SDRAM_B0_BYPASS_SHF 9
377#define GT_SDRAM_B0_BYPASS_MSK (MSK(1) << GT_SDRAM_B0_BYPASS_SHF)
378#define GT_SDRAM_B0_BYPASS_BIT GT_SDRAM_B0_BYPASS_MSK
379
380#define GT_SDRAM_B0_SRAS2SCAS_SHF 10
381#define GT_SDRAM_B0_SRAS2SCAS_MSK (MSK(1) << GT_SDRAM_B0_SRAS2SCAS_SHF)
382#define GT_SDRAM_B0_SRAS2SCAS_BIT GT_SDRAM_B0_SRAS2SCAS_MSK
383#define GT_SDRAM_B0_SRAS2SCAS_2 0
384#define GT_SDRAM_B0_SRAS2SCAS_3 1
385
386#define GT_SDRAM_B0_SIZE_SHF 11
387#define GT_SDRAM_B0_SIZE_MSK (MSK(1) << GT_SDRAM_B0_SIZE_SHF)
388#define GT_SDRAM_B0_SIZE_BIT GT_SDRAM_B0_SIZE_MSK
389#define GT_SDRAM_B0_SIZE_16M 0
390#define GT_SDRAM_B0_SIZE_64M 1
391
392#define GT_SDRAM_B0_EXTPAR_SHF 12
393#define GT_SDRAM_B0_EXTPAR_MSK (MSK(1) << GT_SDRAM_B0_EXTPAR_SHF)
394#define GT_SDRAM_B0_EXTPAR_BIT GT_SDRAM_B0_EXTPAR_MSK
395
396#define GT_SDRAM_B0_BLEN_SHF 13
397#define GT_SDRAM_B0_BLEN_MSK (MSK(1) << GT_SDRAM_B0_BLEN_SHF)
398#define GT_SDRAM_B0_BLEN_BIT GT_SDRAM_B0_BLEN_MSK
399#define GT_SDRAM_B0_BLEN_8 0
400#define GT_SDRAM_B0_BLEN_4 1
401
402
403#define GT_SDRAM_CFG_REFINT_SHF 0
404#define GT_SDRAM_CFG_REFINT_MSK (MSK(14) << GT_SDRAM_CFG_REFINT_SHF)
405
406#define GT_SDRAM_CFG_NINTERLEAVE_SHF 14
407#define GT_SDRAM_CFG_NINTERLEAVE_MSK (MSK(1) << GT_SDRAM_CFG_NINTERLEAVE_SHF)
408#define GT_SDRAM_CFG_NINTERLEAVE_BIT GT_SDRAM_CFG_NINTERLEAVE_MSK
409
410#define GT_SDRAM_CFG_RMW_SHF 15
411#define GT_SDRAM_CFG_RMW_MSK (MSK(1) << GT_SDRAM_CFG_RMW_SHF)
412#define GT_SDRAM_CFG_RMW_BIT GT_SDRAM_CFG_RMW_MSK
413
414#define GT_SDRAM_CFG_NONSTAGREF_SHF 16
415#define GT_SDRAM_CFG_NONSTAGREF_MSK (MSK(1) << GT_SDRAM_CFG_NONSTAGREF_SHF)
416#define GT_SDRAM_CFG_NONSTAGREF_BIT GT_SDRAM_CFG_NONSTAGREF_MSK
417
418#define GT_SDRAM_CFG_DUPCNTL_SHF 19
419#define GT_SDRAM_CFG_DUPCNTL_MSK (MSK(1) << GT_SDRAM_CFG_DUPCNTL_SHF)
420#define GT_SDRAM_CFG_DUPCNTL_BIT GT_SDRAM_CFG_DUPCNTL_MSK
421
422#define GT_SDRAM_CFG_DUPBA_SHF 20
423#define GT_SDRAM_CFG_DUPBA_MSK (MSK(1) << GT_SDRAM_CFG_DUPBA_SHF)
424#define GT_SDRAM_CFG_DUPBA_BIT GT_SDRAM_CFG_DUPBA_MSK
425
426#define GT_SDRAM_CFG_DUPEOT0_SHF 21
427#define GT_SDRAM_CFG_DUPEOT0_MSK (MSK(1) << GT_SDRAM_CFG_DUPEOT0_SHF)
428#define GT_SDRAM_CFG_DUPEOT0_BIT GT_SDRAM_CFG_DUPEOT0_MSK
429
430#define GT_SDRAM_CFG_DUPEOT1_SHF 22
431#define GT_SDRAM_CFG_DUPEOT1_MSK (MSK(1) << GT_SDRAM_CFG_DUPEOT1_SHF)
432#define GT_SDRAM_CFG_DUPEOT1_BIT GT_SDRAM_CFG_DUPEOT1_MSK
433
434#define GT_SDRAM_OPMODE_OP_SHF 0
435#define GT_SDRAM_OPMODE_OP_MSK (MSK(3) << GT_SDRAM_OPMODE_OP_SHF)
436#define GT_SDRAM_OPMODE_OP_NORMAL 0
437#define GT_SDRAM_OPMODE_OP_NOP 1
438#define GT_SDRAM_OPMODE_OP_PRCHG 2
439#define GT_SDRAM_OPMODE_OP_MODE 3
440#define GT_SDRAM_OPMODE_OP_CBR 4
441
442#define GT_TC_CONTROL_ENTC0_SHF 0
443#define GT_TC_CONTROL_ENTC0_MSK (MSK(1) << GT_TC_CONTROL_ENTC0_SHF)
444#define GT_TC_CONTROL_ENTC0_BIT GT_TC_CONTROL_ENTC0_MSK
445#define GT_TC_CONTROL_SELTC0_SHF 1
446#define GT_TC_CONTROL_SELTC0_MSK (MSK(1) << GT_TC_CONTROL_SELTC0_SHF)
447#define GT_TC_CONTROL_SELTC0_BIT GT_TC_CONTROL_SELTC0_MSK
448
449
450#define GT_PCI0_BARE_SWSCS3BOOTDIS_SHF 0
451#define GT_PCI0_BARE_SWSCS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS3BOOTDIS_SHF)
452#define GT_PCI0_BARE_SWSCS3BOOTDIS_BIT GT_PCI0_BARE_SWSCS3BOOTDIS_MSK
453
454#define GT_PCI0_BARE_SWSCS32DIS_SHF 1
455#define GT_PCI0_BARE_SWSCS32DIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS32DIS_SHF)
456#define GT_PCI0_BARE_SWSCS32DIS_BIT GT_PCI0_BARE_SWSCS32DIS_MSK
457
458#define GT_PCI0_BARE_SWSCS10DIS_SHF 2
459#define GT_PCI0_BARE_SWSCS10DIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS10DIS_SHF)
460#define GT_PCI0_BARE_SWSCS10DIS_BIT GT_PCI0_BARE_SWSCS10DIS_MSK
461
462#define GT_PCI0_BARE_INTIODIS_SHF 3
463#define GT_PCI0_BARE_INTIODIS_MSK (MSK(1) << GT_PCI0_BARE_INTIODIS_SHF)
464#define GT_PCI0_BARE_INTIODIS_BIT GT_PCI0_BARE_INTIODIS_MSK
465
466#define GT_PCI0_BARE_INTMEMDIS_SHF 4
467#define GT_PCI0_BARE_INTMEMDIS_MSK (MSK(1) << GT_PCI0_BARE_INTMEMDIS_SHF)
468#define GT_PCI0_BARE_INTMEMDIS_BIT GT_PCI0_BARE_INTMEMDIS_MSK
469
470#define GT_PCI0_BARE_CS3BOOTDIS_SHF 5
471#define GT_PCI0_BARE_CS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_CS3BOOTDIS_SHF)
472#define GT_PCI0_BARE_CS3BOOTDIS_BIT GT_PCI0_BARE_CS3BOOTDIS_MSK
473
474#define GT_PCI0_BARE_CS20DIS_SHF 6
475#define GT_PCI0_BARE_CS20DIS_MSK (MSK(1) << GT_PCI0_BARE_CS20DIS_SHF)
476#define GT_PCI0_BARE_CS20DIS_BIT GT_PCI0_BARE_CS20DIS_MSK
477
478#define GT_PCI0_BARE_SCS32DIS_SHF 7
479#define GT_PCI0_BARE_SCS32DIS_MSK (MSK(1) << GT_PCI0_BARE_SCS32DIS_SHF)
480#define GT_PCI0_BARE_SCS32DIS_BIT GT_PCI0_BARE_SCS32DIS_MSK
481
482#define GT_PCI0_BARE_SCS10DIS_SHF 8
483#define GT_PCI0_BARE_SCS10DIS_MSK (MSK(1) << GT_PCI0_BARE_SCS10DIS_SHF)
484#define GT_PCI0_BARE_SCS10DIS_BIT GT_PCI0_BARE_SCS10DIS_MSK
485
486
487#define GT_INTRCAUSE_MASABORT0_SHF 18
488#define GT_INTRCAUSE_MASABORT0_MSK (MSK(1) << GT_INTRCAUSE_MASABORT0_SHF)
489#define GT_INTRCAUSE_MASABORT0_BIT GT_INTRCAUSE_MASABORT0_MSK
490
491#define GT_INTRCAUSE_TARABORT0_SHF 19
492#define GT_INTRCAUSE_TARABORT0_MSK (MSK(1) << GT_INTRCAUSE_TARABORT0_SHF)
493#define GT_INTRCAUSE_TARABORT0_BIT GT_INTRCAUSE_TARABORT0_MSK
494
495
496#define GT_PCI0_CFGADDR_REGNUM_SHF 2
497#define GT_PCI0_CFGADDR_REGNUM_MSK (MSK(6) << GT_PCI0_CFGADDR_REGNUM_SHF)
498#define GT_PCI0_CFGADDR_FUNCTNUM_SHF 8
499#define GT_PCI0_CFGADDR_FUNCTNUM_MSK (MSK(3) << GT_PCI0_CFGADDR_FUNCTNUM_SHF)
500#define GT_PCI0_CFGADDR_DEVNUM_SHF 11
501#define GT_PCI0_CFGADDR_DEVNUM_MSK (MSK(5) << GT_PCI0_CFGADDR_DEVNUM_SHF)
502#define GT_PCI0_CFGADDR_BUSNUM_SHF 16
503#define GT_PCI0_CFGADDR_BUSNUM_MSK (MSK(8) << GT_PCI0_CFGADDR_BUSNUM_SHF)
504#define GT_PCI0_CFGADDR_CONFIGEN_SHF 31
505#define GT_PCI0_CFGADDR_CONFIGEN_MSK (MSK(1) << GT_PCI0_CFGADDR_CONFIGEN_SHF)
506#define GT_PCI0_CFGADDR_CONFIGEN_BIT GT_PCI0_CFGADDR_CONFIGEN_MSK
507
508#define GT_PCI0_CMD_MBYTESWAP_SHF 0
509#define GT_PCI0_CMD_MBYTESWAP_MSK (MSK(1) << GT_PCI0_CMD_MBYTESWAP_SHF)
510#define GT_PCI0_CMD_MBYTESWAP_BIT GT_PCI0_CMD_MBYTESWAP_MSK
511#define GT_PCI0_CMD_MWORDSWAP_SHF 10
512#define GT_PCI0_CMD_MWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_MWORDSWAP_SHF)
513#define GT_PCI0_CMD_MWORDSWAP_BIT GT_PCI0_CMD_MWORDSWAP_MSK
514#define GT_PCI0_CMD_SBYTESWAP_SHF 16
515#define GT_PCI0_CMD_SBYTESWAP_MSK (MSK(1) << GT_PCI0_CMD_SBYTESWAP_SHF)
516#define GT_PCI0_CMD_SBYTESWAP_BIT GT_PCI0_CMD_SBYTESWAP_MSK
517#define GT_PCI0_CMD_SWORDSWAP_SHF 11
518#define GT_PCI0_CMD_SWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_SWORDSWAP_SHF)
519#define GT_PCI0_CMD_SWORDSWAP_BIT GT_PCI0_CMD_SWORDSWAP_MSK
520
521#define GT_INTR_T0EXP_SHF 8
522#define GT_INTR_T0EXP_MSK (MSK(1) << GT_INTR_T0EXP_SHF)
523#define GT_INTR_T0EXP_BIT GT_INTR_T0EXP_MSK
524#define GT_INTR_RETRYCTR0_SHF 20
525#define GT_INTR_RETRYCTR0_MSK (MSK(1) << GT_INTR_RETRYCTR0_SHF)
526#define GT_INTR_RETRYCTR0_BIT GT_INTR_RETRYCTR0_MSK
527
528/*
529 * Misc
530 */
531#define GT_DEF_PCI0_IO_BASE 0x10000000UL
532#define GT_DEF_PCI0_IO_SIZE 0x02000000UL
533#define GT_DEF_PCI0_MEM0_BASE 0x12000000UL
534#define GT_DEF_PCI0_MEM0_SIZE 0x02000000UL
535#define GT_DEF_BASE 0x14000000UL
536
537#define GT_MAX_BANKSIZE (256 * 1024 * 1024) /* Max 256MB bank */
538#define GT_LATTIM_MIN 6 /* Minimum lat */
539
540/*
541 * The gt64120_dep.h file must define the following macros
542 *
543 * GT_READ(ofs, data_pointer)
544 * GT_WRITE(ofs, data) - read/write GT64120 registers in 32bit
545 *
546 * TIMER - gt64120 timer irq, temporary solution until
547 * full gt64120 cascade interrupt support is in place
548 */
549
550#include <mach-gt64120.h>
551
552/*
553 * Because of an error/peculiarity in the Galileo chip, we need to swap the
554 * bytes when running bigendian. We also provide non-swapping versions.
555 */
556#define __GT_READ(ofs) \
557 (*(volatile u32 *)(GT64120_BASE+(ofs)))
558#define __GT_WRITE(ofs, data) \
559 do { *(volatile u32 *)(GT64120_BASE+(ofs)) = (data); } while (0)
560#define GT_READ(ofs) le32_to_cpu(__GT_READ(ofs))
561#define GT_WRITE(ofs, data) __GT_WRITE(ofs, cpu_to_le32(data))
562
563extern void gt641xx_set_base_clock(unsigned int clock);
564extern int gt641xx_timer0_state(void);
565
566#endif /* _ASM_GT64120_H */
diff --git a/arch/mips/include/asm/hardirq.h b/arch/mips/include/asm/hardirq.h
new file mode 100644
index 000000000..c977a86c2
--- /dev/null
+++ b/arch/mips/include/asm/hardirq.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) 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
13extern void ack_bad_irq(unsigned int irq);
14#define ack_bad_irq ack_bad_irq
15
16#include <asm-generic/hardirq.h>
17
18#endif /* _ASM_HARDIRQ_H */
diff --git a/arch/mips/include/asm/hazards.h b/arch/mips/include/asm/hazards.h
new file mode 100644
index 000000000..f855478d1
--- /dev/null
+++ b/arch/mips/include/asm/hazards.h
@@ -0,0 +1,422 @@
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, 04, 07 Ralf Baechle <ralf@linux-mips.org>
7 * Copyright (C) MIPS Technologies, Inc.
8 * written by Ralf Baechle <ralf@linux-mips.org>
9 */
10#ifndef _ASM_HAZARDS_H
11#define _ASM_HAZARDS_H
12
13#include <linux/stringify.h>
14#include <asm/compiler.h>
15
16#define ___ssnop \
17 sll $0, $0, 1
18
19#define ___ehb \
20 sll $0, $0, 3
21
22/*
23 * TLB hazards
24 */
25#if (defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5) || \
26 defined(CONFIG_CPU_MIPSR6)) && \
27 !defined(CONFIG_CPU_CAVIUM_OCTEON) && !defined(CONFIG_CPU_LOONGSON64)
28
29/*
30 * MIPSR2 defines ehb for hazard avoidance
31 */
32
33#define __mtc0_tlbw_hazard \
34 ___ehb
35
36#define __mtc0_tlbr_hazard \
37 ___ehb
38
39#define __tlbw_use_hazard \
40 ___ehb
41
42#define __tlb_read_hazard \
43 ___ehb
44
45#define __tlb_probe_hazard \
46 ___ehb
47
48#define __irq_enable_hazard \
49 ___ehb
50
51#define __irq_disable_hazard \
52 ___ehb
53
54#define __back_to_back_c0_hazard \
55 ___ehb
56
57/*
58 * gcc has a tradition of misscompiling the previous construct using the
59 * address of a label as argument to inline assembler. Gas otoh has the
60 * annoying difference between la and dla which are only usable for 32-bit
61 * rsp. 64-bit code, so can't be used without conditional compilation.
62 * The alternative is switching the assembler to 64-bit code which happens
63 * to work right even for 32-bit code...
64 */
65#define instruction_hazard() \
66do { \
67 unsigned long tmp; \
68 \
69 __asm__ __volatile__( \
70 " .set push \n" \
71 " .set "MIPS_ISA_LEVEL" \n" \
72 " dla %0, 1f \n" \
73 " jr.hb %0 \n" \
74 " .set pop \n" \
75 "1: \n" \
76 : "=r" (tmp)); \
77} while (0)
78
79#elif (defined(CONFIG_CPU_MIPSR1) && !defined(CONFIG_MIPS_ALCHEMY)) || \
80 defined(CONFIG_CPU_BMIPS)
81
82/*
83 * These are slightly complicated by the fact that we guarantee R1 kernels to
84 * run fine on R2 processors.
85 */
86
87#define __mtc0_tlbw_hazard \
88 ___ssnop; \
89 ___ssnop; \
90 ___ehb
91
92#define __mtc0_tlbr_hazard \
93 ___ssnop; \
94 ___ssnop; \
95 ___ehb
96
97#define __tlbw_use_hazard \
98 ___ssnop; \
99 ___ssnop; \
100 ___ssnop; \
101 ___ehb
102
103#define __tlb_read_hazard \
104 ___ssnop; \
105 ___ssnop; \
106 ___ssnop; \
107 ___ehb
108
109#define __tlb_probe_hazard \
110 ___ssnop; \
111 ___ssnop; \
112 ___ssnop; \
113 ___ehb
114
115#define __irq_enable_hazard \
116 ___ssnop; \
117 ___ssnop; \
118 ___ssnop; \
119 ___ehb
120
121#define __irq_disable_hazard \
122 ___ssnop; \
123 ___ssnop; \
124 ___ssnop; \
125 ___ehb
126
127#define __back_to_back_c0_hazard \
128 ___ssnop; \
129 ___ssnop; \
130 ___ssnop; \
131 ___ehb
132
133/*
134 * gcc has a tradition of misscompiling the previous construct using the
135 * address of a label as argument to inline assembler. Gas otoh has the
136 * annoying difference between la and dla which are only usable for 32-bit
137 * rsp. 64-bit code, so can't be used without conditional compilation.
138 * The alternative is switching the assembler to 64-bit code which happens
139 * to work right even for 32-bit code...
140 */
141#define __instruction_hazard() \
142do { \
143 unsigned long tmp; \
144 \
145 __asm__ __volatile__( \
146 " .set push \n" \
147 " .set mips64r2 \n" \
148 " dla %0, 1f \n" \
149 " jr.hb %0 \n" \
150 " .set pop \n" \
151 "1: \n" \
152 : "=r" (tmp)); \
153} while (0)
154
155#define instruction_hazard() \
156do { \
157 if (cpu_has_mips_r2_r6) \
158 __instruction_hazard(); \
159} while (0)
160
161#elif defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \
162 defined(CONFIG_CPU_LOONGSON2EF) || defined(CONFIG_CPU_LOONGSON64) || \
163 defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_R5500) || defined(CONFIG_CPU_XLR)
164
165/*
166 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
167 */
168
169#define __mtc0_tlbw_hazard
170
171#define __mtc0_tlbr_hazard
172
173#define __tlbw_use_hazard
174
175#define __tlb_read_hazard
176
177#define __tlb_probe_hazard
178
179#define __irq_enable_hazard
180
181#define __irq_disable_hazard
182
183#define __back_to_back_c0_hazard
184
185#define instruction_hazard() do { } while (0)
186
187#elif defined(CONFIG_CPU_SB1)
188
189/*
190 * Mostly like R4000 for historic reasons
191 */
192#define __mtc0_tlbw_hazard
193
194#define __mtc0_tlbr_hazard
195
196#define __tlbw_use_hazard
197
198#define __tlb_read_hazard
199
200#define __tlb_probe_hazard
201
202#define __irq_enable_hazard
203
204#define __irq_disable_hazard \
205 ___ssnop; \
206 ___ssnop; \
207 ___ssnop
208
209#define __back_to_back_c0_hazard
210
211#define instruction_hazard() do { } while (0)
212
213#else
214
215/*
216 * Finally the catchall case for all other processors including R4000, R4400,
217 * R4600, R4700, R5000, RM7000, NEC VR41xx etc.
218 *
219 * The taken branch will result in a two cycle penalty for the two killed
220 * instructions on R4000 / R4400. Other processors only have a single cycle
221 * hazard so this is nice trick to have an optimal code for a range of
222 * processors.
223 */
224#define __mtc0_tlbw_hazard \
225 nop; \
226 nop
227
228#define __mtc0_tlbr_hazard \
229 nop; \
230 nop
231
232#define __tlbw_use_hazard \
233 nop; \
234 nop; \
235 nop
236
237#define __tlb_read_hazard \
238 nop; \
239 nop; \
240 nop
241
242#define __tlb_probe_hazard \
243 nop; \
244 nop; \
245 nop
246
247#define __irq_enable_hazard \
248 ___ssnop; \
249 ___ssnop; \
250 ___ssnop
251
252#define __irq_disable_hazard \
253 nop; \
254 nop; \
255 nop
256
257#define __back_to_back_c0_hazard \
258 ___ssnop; \
259 ___ssnop; \
260 ___ssnop
261
262#define instruction_hazard() do { } while (0)
263
264#endif
265
266
267/* FPU hazards */
268
269#if defined(CONFIG_CPU_SB1)
270
271#define __enable_fpu_hazard \
272 .set push; \
273 .set mips64; \
274 .set noreorder; \
275 ___ssnop; \
276 bnezl $0, .+4; \
277 ___ssnop; \
278 .set pop
279
280#define __disable_fpu_hazard
281
282#elif defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5) || \
283 defined(CONFIG_CPU_MIPSR6)
284
285#define __enable_fpu_hazard \
286 ___ehb
287
288#define __disable_fpu_hazard \
289 ___ehb
290
291#else
292
293#define __enable_fpu_hazard \
294 nop; \
295 nop; \
296 nop; \
297 nop
298
299#define __disable_fpu_hazard \
300 ___ehb
301
302#endif
303
304#ifdef __ASSEMBLY__
305
306#define _ssnop ___ssnop
307#define _ehb ___ehb
308#define mtc0_tlbw_hazard __mtc0_tlbw_hazard
309#define mtc0_tlbr_hazard __mtc0_tlbr_hazard
310#define tlbw_use_hazard __tlbw_use_hazard
311#define tlb_read_hazard __tlb_read_hazard
312#define tlb_probe_hazard __tlb_probe_hazard
313#define irq_enable_hazard __irq_enable_hazard
314#define irq_disable_hazard __irq_disable_hazard
315#define back_to_back_c0_hazard __back_to_back_c0_hazard
316#define enable_fpu_hazard __enable_fpu_hazard
317#define disable_fpu_hazard __disable_fpu_hazard
318
319#else
320
321#define _ssnop() \
322do { \
323 __asm__ __volatile__( \
324 __stringify(___ssnop) \
325 ); \
326} while (0)
327
328#define _ehb() \
329do { \
330 __asm__ __volatile__( \
331 __stringify(___ehb) \
332 ); \
333} while (0)
334
335
336#define mtc0_tlbw_hazard() \
337do { \
338 __asm__ __volatile__( \
339 __stringify(__mtc0_tlbw_hazard) \
340 ); \
341} while (0)
342
343
344#define mtc0_tlbr_hazard() \
345do { \
346 __asm__ __volatile__( \
347 __stringify(__mtc0_tlbr_hazard) \
348 ); \
349} while (0)
350
351
352#define tlbw_use_hazard() \
353do { \
354 __asm__ __volatile__( \
355 __stringify(__tlbw_use_hazard) \
356 ); \
357} while (0)
358
359
360#define tlb_read_hazard() \
361do { \
362 __asm__ __volatile__( \
363 __stringify(__tlb_read_hazard) \
364 ); \
365} while (0)
366
367
368#define tlb_probe_hazard() \
369do { \
370 __asm__ __volatile__( \
371 __stringify(__tlb_probe_hazard) \
372 ); \
373} while (0)
374
375
376#define irq_enable_hazard() \
377do { \
378 __asm__ __volatile__( \
379 __stringify(__irq_enable_hazard) \
380 ); \
381} while (0)
382
383
384#define irq_disable_hazard() \
385do { \
386 __asm__ __volatile__( \
387 __stringify(__irq_disable_hazard) \
388 ); \
389} while (0)
390
391
392#define back_to_back_c0_hazard() \
393do { \
394 __asm__ __volatile__( \
395 __stringify(__back_to_back_c0_hazard) \
396 ); \
397} while (0)
398
399
400#define enable_fpu_hazard() \
401do { \
402 __asm__ __volatile__( \
403 __stringify(__enable_fpu_hazard) \
404 ); \
405} while (0)
406
407
408#define disable_fpu_hazard() \
409do { \
410 __asm__ __volatile__( \
411 __stringify(__disable_fpu_hazard) \
412 ); \
413} while (0)
414
415/*
416 * MIPS R2 instruction hazard barrier. Needs to be called as a subroutine.
417 */
418extern void mips_ihb(void);
419
420#endif /* __ASSEMBLY__ */
421
422#endif /* _ASM_HAZARDS_H */
diff --git a/arch/mips/include/asm/highmem.h b/arch/mips/include/asm/highmem.h
new file mode 100644
index 000000000..9f021cf51
--- /dev/null
+++ b/arch/mips/include/asm/highmem.h
@@ -0,0 +1,59 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * highmem.h: virtual kernel memory mappings for high memory
4 *
5 * Used in CONFIG_HIGHMEM systems for memory pages which
6 * are not addressable by direct kernel virtual addresses.
7 *
8 * Copyright (C) 1999 Gerhard Wichert, Siemens AG
9 * Gerhard.Wichert@pdb.siemens.de
10 *
11 *
12 * Redesigned the x86 32-bit VM architecture to deal with
13 * up to 16 Terabyte physical memory. With current x86 CPUs
14 * we now support up to 64 Gigabytes physical RAM.
15 *
16 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
17 */
18#ifndef _ASM_HIGHMEM_H
19#define _ASM_HIGHMEM_H
20
21#ifdef __KERNEL__
22
23#include <linux/bug.h>
24#include <linux/interrupt.h>
25#include <linux/uaccess.h>
26#include <asm/cpu-features.h>
27#include <asm/kmap_types.h>
28
29/* declarations for highmem.c */
30extern unsigned long highstart_pfn, highend_pfn;
31
32extern pte_t *pkmap_page_table;
33
34/*
35 * Right now we initialize only a single pte table. It can be extended
36 * easily, subsequent pte tables have to be allocated in one physical
37 * chunk of RAM.
38 */
39#if defined(CONFIG_PHYS_ADDR_T_64BIT) || defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
40#define LAST_PKMAP 512
41#else
42#define LAST_PKMAP 1024
43#endif
44
45#define LAST_PKMAP_MASK (LAST_PKMAP-1)
46#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
47#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
48
49#define ARCH_HAS_KMAP_FLUSH_TLB
50extern void kmap_flush_tlb(unsigned long addr);
51extern void *kmap_atomic_pfn(unsigned long pfn);
52
53#define flush_cache_kmaps() BUG_ON(cpu_has_dc_aliases)
54
55extern void kmap_init(void);
56
57#endif /* __KERNEL__ */
58
59#endif /* _ASM_HIGHMEM_H */
diff --git a/arch/mips/include/asm/hpet.h b/arch/mips/include/asm/hpet.h
new file mode 100644
index 000000000..d47268ece
--- /dev/null
+++ b/arch/mips/include/asm/hpet.h
@@ -0,0 +1,74 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_HPET_H
3#define _ASM_HPET_H
4
5#ifdef CONFIG_RS780_HPET
6
7#define HPET_MMAP_SIZE 1024
8
9#define HPET_ID 0x000
10#define HPET_PERIOD 0x004
11#define HPET_CFG 0x010
12#define HPET_STATUS 0x020
13#define HPET_COUNTER 0x0f0
14
15#define HPET_Tn_CFG(n) (0x100 + 0x20 * n)
16#define HPET_Tn_CMP(n) (0x108 + 0x20 * n)
17#define HPET_Tn_ROUTE(n) (0x110 + 0x20 * n)
18
19#define HPET_T0_IRS 0x001
20#define HPET_T1_IRS 0x002
21#define HPET_T3_IRS 0x004
22
23#define HPET_T0_CFG 0x100
24#define HPET_T0_CMP 0x108
25#define HPET_T0_ROUTE 0x110
26#define HPET_T1_CFG 0x120
27#define HPET_T1_CMP 0x128
28#define HPET_T1_ROUTE 0x130
29#define HPET_T2_CFG 0x140
30#define HPET_T2_CMP 0x148
31#define HPET_T2_ROUTE 0x150
32
33#define HPET_ID_REV 0x000000ff
34#define HPET_ID_NUMBER 0x00001f00
35#define HPET_ID_64BIT 0x00002000
36#define HPET_ID_LEGSUP 0x00008000
37#define HPET_ID_VENDOR 0xffff0000
38#define HPET_ID_NUMBER_SHIFT 8
39#define HPET_ID_VENDOR_SHIFT 16
40
41#define HPET_CFG_ENABLE 0x001
42#define HPET_CFG_LEGACY 0x002
43#define HPET_LEGACY_8254 2
44#define HPET_LEGACY_RTC 8
45
46#define HPET_TN_LEVEL 0x0002
47#define HPET_TN_ENABLE 0x0004
48#define HPET_TN_PERIODIC 0x0008
49#define HPET_TN_PERIODIC_CAP 0x0010
50#define HPET_TN_64BIT_CAP 0x0020
51#define HPET_TN_SETVAL 0x0040
52#define HPET_TN_32BIT 0x0100
53#define HPET_TN_ROUTE 0x3e00
54#define HPET_TN_FSB 0x4000
55#define HPET_TN_FSB_CAP 0x8000
56#define HPET_TN_ROUTE_SHIFT 9
57
58/* Max HPET Period is 10^8 femto sec as in HPET spec */
59#define HPET_MAX_PERIOD 100000000UL
60/*
61 * Min HPET period is 10^5 femto sec just for safety. If it is less than this,
62 * then 32 bit HPET counter wrapsaround in less than 0.5 sec.
63 */
64#define HPET_MIN_PERIOD 100000UL
65
66#define HPET_ADDR 0x20000
67#define HPET_MMIO_ADDR 0x90000e0000020000
68#define HPET_FREQ 14318780
69#define HPET_COMPARE_VAL ((HPET_FREQ + HZ / 2) / HZ)
70#define HPET_T0_IRQ 0
71
72extern void __init setup_hpet_timer(void);
73#endif /* CONFIG_RS780_HPET */
74#endif /* _ASM_HPET_H */
diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h
new file mode 100644
index 000000000..c2144409c
--- /dev/null
+++ b/arch/mips/include/asm/hugetlb.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 * Copyright (C) 2008, 2009 Cavium Networks, Inc.
7 */
8
9#ifndef __ASM_HUGETLB_H
10#define __ASM_HUGETLB_H
11
12#include <asm/page.h>
13
14#define __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE
15static inline int prepare_hugepage_range(struct file *file,
16 unsigned long addr,
17 unsigned long len)
18{
19 unsigned long task_size = STACK_TOP;
20 struct hstate *h = hstate_file(file);
21
22 if (len & ~huge_page_mask(h))
23 return -EINVAL;
24 if (addr & ~huge_page_mask(h))
25 return -EINVAL;
26 if (len > task_size)
27 return -ENOMEM;
28 if (task_size - len < addr)
29 return -EINVAL;
30 return 0;
31}
32
33#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
34static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
35 unsigned long addr, pte_t *ptep)
36{
37 pte_t clear;
38 pte_t pte = *ptep;
39
40 pte_val(clear) = (unsigned long)invalid_pte_table;
41 set_pte_at(mm, addr, ptep, clear);
42 return pte;
43}
44
45#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
46static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
47 unsigned long addr, pte_t *ptep)
48{
49 /*
50 * clear the huge pte entry firstly, so that the other smp threads will
51 * not get old pte entry after finishing flush_tlb_page and before
52 * setting new huge pte entry
53 */
54 huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
55 flush_tlb_page(vma, addr);
56}
57
58#define __HAVE_ARCH_HUGE_PTE_NONE
59static inline int huge_pte_none(pte_t pte)
60{
61 unsigned long val = pte_val(pte) & ~_PAGE_GLOBAL;
62 return !val || (val == (unsigned long)invalid_pte_table);
63}
64
65#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
66static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
67 unsigned long addr,
68 pte_t *ptep, pte_t pte,
69 int dirty)
70{
71 int changed = !pte_same(*ptep, pte);
72
73 if (changed) {
74 set_pte_at(vma->vm_mm, addr, ptep, pte);
75 /*
76 * There could be some standard sized pages in there,
77 * get them all.
78 */
79 flush_tlb_range(vma, addr, addr + HPAGE_SIZE);
80 }
81 return changed;
82}
83
84#include <asm-generic/hugetlb.h>
85
86#endif /* __ASM_HUGETLB_H */
diff --git a/arch/mips/include/asm/hw_irq.h b/arch/mips/include/asm/hw_irq.h
new file mode 100644
index 000000000..9e8ef5994
--- /dev/null
+++ b/arch/mips/include/asm/hw_irq.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) 2000, 2001, 2002 by Ralf Baechle
7 */
8#ifndef __ASM_HW_IRQ_H
9#define __ASM_HW_IRQ_H
10
11#include <linux/atomic.h>
12
13extern atomic_t irq_err_count;
14
15/*
16 * interrupt-retrigger: NOP for now. This may not be appropriate for all
17 * machines, we'll see ...
18 */
19
20#endif /* __ASM_HW_IRQ_H */
diff --git a/arch/mips/include/asm/i8259.h b/arch/mips/include/asm/i8259.h
new file mode 100644
index 000000000..a54b9649d
--- /dev/null
+++ b/arch/mips/include/asm/i8259.h
@@ -0,0 +1,93 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/i8259.h
4 *
5 * i8259A interrupt definitions.
6 *
7 * Copyright (C) 2003 Maciej W. Rozycki
8 * Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org>
9 */
10#ifndef _ASM_I8259_H
11#define _ASM_I8259_H
12
13#include <linux/compiler.h>
14#include <linux/spinlock.h>
15
16#include <asm/io.h>
17#include <irq.h>
18
19/* i8259A PIC registers */
20#define PIC_MASTER_CMD 0x20
21#define PIC_MASTER_IMR 0x21
22#define PIC_MASTER_ISR PIC_MASTER_CMD
23#define PIC_MASTER_POLL PIC_MASTER_ISR
24#define PIC_MASTER_OCW3 PIC_MASTER_ISR
25#define PIC_SLAVE_CMD 0xa0
26#define PIC_SLAVE_IMR 0xa1
27
28/* i8259A PIC related value */
29#define PIC_CASCADE_IR 2
30#define MASTER_ICW4_DEFAULT 0x01
31#define SLAVE_ICW4_DEFAULT 0x01
32#define PIC_ICW4_AEOI 2
33
34extern raw_spinlock_t i8259A_lock;
35
36extern void make_8259A_irq(unsigned int irq);
37
38extern void init_i8259_irqs(void);
39extern struct irq_domain *__init_i8259_irqs(struct device_node *node);
40
41/**
42 * i8159_set_poll() - Override the i8259 polling function
43 * @poll: pointer to platform-specific polling function
44 *
45 * Call this to override the generic i8259 polling function, which directly
46 * accesses i8259 registers, with a platform specific one which may be faster
47 * in cases where hardware provides a more optimal means of polling for an
48 * interrupt.
49 */
50extern void i8259_set_poll(int (*poll)(void));
51
52/*
53 * Do the traditional i8259 interrupt polling thing. This is for the few
54 * cases where no better interrupt acknowledge method is available and we
55 * absolutely must touch the i8259.
56 */
57static inline int i8259_irq(void)
58{
59 int irq;
60
61 raw_spin_lock(&i8259A_lock);
62
63 /* Perform an interrupt acknowledge cycle on controller 1. */
64 outb(0x0C, PIC_MASTER_CMD); /* prepare for poll */
65 irq = inb(PIC_MASTER_CMD) & 7;
66 if (irq == PIC_CASCADE_IR) {
67 /*
68 * Interrupt is cascaded so perform interrupt
69 * acknowledge on controller 2.
70 */
71 outb(0x0C, PIC_SLAVE_CMD); /* prepare for poll */
72 irq = (inb(PIC_SLAVE_CMD) & 7) + 8;
73 }
74
75 if (unlikely(irq == 7)) {
76 /*
77 * This may be a spurious interrupt.
78 *
79 * Read the interrupt status register (ISR). If the most
80 * significant bit is not set then there is no valid
81 * interrupt.
82 */
83 outb(0x0B, PIC_MASTER_ISR); /* ISR register */
84 if(~inb(PIC_MASTER_ISR) & 0x80)
85 irq = -1;
86 }
87
88 raw_spin_unlock(&i8259A_lock);
89
90 return likely(irq >= 0) ? irq + I8259A_IRQ_BASE : irq;
91}
92
93#endif /* _ASM_I8259_H */
diff --git a/arch/mips/include/asm/ide.h b/arch/mips/include/asm/ide.h
new file mode 100644
index 000000000..bb674c3b0
--- /dev/null
+++ b/arch/mips/include/asm/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/arch/mips/include/asm/idle.h b/arch/mips/include/asm/idle.h
new file mode 100644
index 000000000..0992cad9c
--- /dev/null
+++ b/arch/mips/include/asm/idle.h
@@ -0,0 +1,32 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_IDLE_H
3#define __ASM_IDLE_H
4
5#include <linux/cpuidle.h>
6#include <linux/linkage.h>
7
8extern void (*cpu_wait)(void);
9extern void r4k_wait(void);
10extern asmlinkage void __r4k_wait(void);
11extern void r4k_wait_irqoff(void);
12
13static inline int using_rollback_handler(void)
14{
15 return cpu_wait == r4k_wait;
16}
17
18extern void __init check_wait(void);
19
20extern int mips_cpuidle_wait_enter(struct cpuidle_device *dev,
21 struct cpuidle_driver *drv, int index);
22
23#define MIPS_CPUIDLE_WAIT_STATE {\
24 .enter = mips_cpuidle_wait_enter,\
25 .exit_latency = 1,\
26 .target_residency = 1,\
27 .power_usage = UINT_MAX,\
28 .name = "wait",\
29 .desc = "MIPS wait",\
30}
31
32#endif /* __ASM_IDLE_H */
diff --git a/arch/mips/include/asm/inst.h b/arch/mips/include/asm/inst.h
new file mode 100644
index 000000000..22912f784
--- /dev/null
+++ b/arch/mips/include/asm/inst.h
@@ -0,0 +1,88 @@
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 * Copyright (C) 2006 by Thiemo Seufer
10 */
11#ifndef _ASM_INST_H
12#define _ASM_INST_H
13
14#include <uapi/asm/inst.h>
15
16/* HACHACHAHCAHC ... */
17
18/* In case some other massaging is needed, keep MIPSInst as wrapper */
19
20#define MIPSInst(x) x
21
22#define I_OPCODE_SFT 26
23#define MIPSInst_OPCODE(x) (MIPSInst(x) >> I_OPCODE_SFT)
24
25#define I_JTARGET_SFT 0
26#define MIPSInst_JTARGET(x) (MIPSInst(x) & 0x03ffffff)
27
28#define I_RS_SFT 21
29#define MIPSInst_RS(x) ((MIPSInst(x) & 0x03e00000) >> I_RS_SFT)
30
31#define I_RT_SFT 16
32#define MIPSInst_RT(x) ((MIPSInst(x) & 0x001f0000) >> I_RT_SFT)
33
34#define I_IMM_SFT 0
35#define MIPSInst_SIMM(x) ((int)((short)(MIPSInst(x) & 0xffff)))
36#define MIPSInst_UIMM(x) (MIPSInst(x) & 0xffff)
37
38#define I_CACHEOP_SFT 18
39#define MIPSInst_CACHEOP(x) ((MIPSInst(x) & 0x001c0000) >> I_CACHEOP_SFT)
40
41#define I_CACHESEL_SFT 16
42#define MIPSInst_CACHESEL(x) ((MIPSInst(x) & 0x00030000) >> I_CACHESEL_SFT)
43
44#define I_RD_SFT 11
45#define MIPSInst_RD(x) ((MIPSInst(x) & 0x0000f800) >> I_RD_SFT)
46
47#define I_RE_SFT 6
48#define MIPSInst_RE(x) ((MIPSInst(x) & 0x000007c0) >> I_RE_SFT)
49
50#define I_FUNC_SFT 0
51#define MIPSInst_FUNC(x) (MIPSInst(x) & 0x0000003f)
52
53#define I_FFMT_SFT 21
54#define MIPSInst_FFMT(x) ((MIPSInst(x) & 0x01e00000) >> I_FFMT_SFT)
55
56#define I_FT_SFT 16
57#define MIPSInst_FT(x) ((MIPSInst(x) & 0x001f0000) >> I_FT_SFT)
58
59#define I_FS_SFT 11
60#define MIPSInst_FS(x) ((MIPSInst(x) & 0x0000f800) >> I_FS_SFT)
61
62#define I_FD_SFT 6
63#define MIPSInst_FD(x) ((MIPSInst(x) & 0x000007c0) >> I_FD_SFT)
64
65#define I_FR_SFT 21
66#define MIPSInst_FR(x) ((MIPSInst(x) & 0x03e00000) >> I_FR_SFT)
67
68#define I_FMA_FUNC_SFT 2
69#define MIPSInst_FMA_FUNC(x) ((MIPSInst(x) & 0x0000003c) >> I_FMA_FUNC_SFT)
70
71#define I_FMA_FFMT_SFT 0
72#define MIPSInst_FMA_FFMT(x) (MIPSInst(x) & 0x00000003)
73
74typedef unsigned int mips_instruction;
75
76/* microMIPS instruction decode structure. Do NOT export!!! */
77struct mm_decoded_insn {
78 mips_instruction insn;
79 mips_instruction next_insn;
80 int pc_inc;
81 int next_pc_inc;
82 int micro_mips_mode;
83};
84
85/* Recode table from 16-bit register notation to 32-bit GPR. Do NOT export!!! */
86extern const int reg16to32[];
87
88#endif /* _ASM_INST_H */
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
new file mode 100644
index 000000000..78537aa23
--- /dev/null
+++ b/arch/mips/include/asm/io.h
@@ -0,0 +1,562 @@
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, 06 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#define ARCH_HAS_IOREMAP_WC
16
17#include <linux/compiler.h>
18#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/irqflags.h>
21
22#include <asm/addrspace.h>
23#include <asm/barrier.h>
24#include <asm/bug.h>
25#include <asm/byteorder.h>
26#include <asm/cpu.h>
27#include <asm/cpu-features.h>
28#include <asm-generic/iomap.h>
29#include <asm/page.h>
30#include <asm/pgtable-bits.h>
31#include <asm/processor.h>
32#include <asm/string.h>
33#include <mangle-port.h>
34
35/*
36 * Raw operations are never swapped in software. OTOH values that raw
37 * operations are working on may or may not have been swapped by the bus
38 * hardware. An example use would be for flash memory that's used for
39 * execute in place.
40 */
41# define __raw_ioswabb(a, x) (x)
42# define __raw_ioswabw(a, x) (x)
43# define __raw_ioswabl(a, x) (x)
44# define __raw_ioswabq(a, x) (x)
45# define ____raw_ioswabq(a, x) (x)
46
47# define __relaxed_ioswabb ioswabb
48# define __relaxed_ioswabw ioswabw
49# define __relaxed_ioswabl ioswabl
50# define __relaxed_ioswabq ioswabq
51
52/* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */
53
54/*
55 * On MIPS I/O ports are memory mapped, so we access them using normal
56 * load/store instructions. mips_io_port_base is the virtual address to
57 * which all ports are being mapped. For sake of efficiency some code
58 * assumes that this is an address that can be loaded with a single lui
59 * instruction, so the lower 16 bits must be zero. Should be true on
60 * any sane architecture; generic code does not use this assumption.
61 */
62extern unsigned long mips_io_port_base;
63
64static inline void set_io_port_base(unsigned long base)
65{
66 mips_io_port_base = base;
67}
68
69/*
70 * Provide the necessary definitions for generic iomap. We make use of
71 * mips_io_port_base for iomap(), but we don't reserve any low addresses for
72 * use with I/O ports.
73 */
74
75#define HAVE_ARCH_PIO_SIZE
76#define PIO_OFFSET mips_io_port_base
77#define PIO_MASK IO_SPACE_LIMIT
78#define PIO_RESERVED 0x0UL
79
80/*
81 * Enforce in-order execution of data I/O. In the MIPS architecture
82 * these are equivalent to corresponding platform-specific memory
83 * barriers defined in <asm/barrier.h>. API pinched from PowerPC,
84 * with sync additionally defined.
85 */
86#define iobarrier_rw() mb()
87#define iobarrier_r() rmb()
88#define iobarrier_w() wmb()
89#define iobarrier_sync() iob()
90
91/*
92 * virt_to_phys - map virtual addresses to physical
93 * @address: address to remap
94 *
95 * The returned physical address is the physical (CPU) mapping for
96 * the memory address given. It is only valid to use this function on
97 * addresses directly mapped or allocated via kmalloc.
98 *
99 * This function does not give bus mappings for DMA transfers. In
100 * almost all conceivable cases a device driver should not be using
101 * this function
102 */
103static inline unsigned long virt_to_phys(volatile const void *address)
104{
105 return __pa(address);
106}
107
108/*
109 * phys_to_virt - map physical address to virtual
110 * @address: address to remap
111 *
112 * The returned virtual address is a current CPU mapping for
113 * the memory address given. It is only valid to use this function on
114 * addresses that have a kernel mapping
115 *
116 * This function does not handle bus mappings for DMA transfers. In
117 * almost all conceivable cases a device driver should not be using
118 * this function
119 */
120static inline void * phys_to_virt(unsigned long address)
121{
122 return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
123}
124
125/*
126 * ISA I/O bus memory addresses are 1:1 with the physical address.
127 */
128static inline unsigned long isa_virt_to_bus(volatile void *address)
129{
130 return virt_to_phys(address);
131}
132
133static inline void *isa_bus_to_virt(unsigned long address)
134{
135 return phys_to_virt(address);
136}
137
138/*
139 * However PCI ones are not necessarily 1:1 and therefore these interfaces
140 * are forbidden in portable PCI drivers.
141 *
142 * Allow them for x86 for legacy drivers, though.
143 */
144#define virt_to_bus virt_to_phys
145#define bus_to_virt phys_to_virt
146
147/*
148 * Change "struct page" to physical address.
149 */
150#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
151
152void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
153 unsigned long prot_val);
154void iounmap(const volatile void __iomem *addr);
155
156/*
157 * ioremap - map bus memory into CPU space
158 * @offset: bus address of the memory
159 * @size: size of the resource to map
160 *
161 * ioremap performs a platform specific sequence of operations to
162 * make bus memory CPU accessible via the readb/readw/readl/writeb/
163 * writew/writel functions and the other mmio helpers. The returned
164 * address is not guaranteed to be usable directly as a virtual
165 * address.
166 */
167#define ioremap(offset, size) \
168 ioremap_prot((offset), (size), _CACHE_UNCACHED)
169#define ioremap_uc ioremap
170
171/*
172 * ioremap_cache - map bus memory into CPU space
173 * @offset: bus address of the memory
174 * @size: size of the resource to map
175 *
176 * ioremap_cache performs a platform specific sequence of operations to
177 * make bus memory CPU accessible via the readb/readw/readl/writeb/
178 * writew/writel functions and the other mmio helpers. The returned
179 * address is not guaranteed to be usable directly as a virtual
180 * address.
181 *
182 * This version of ioremap ensures that the memory is marked cachable by
183 * the CPU. Also enables full write-combining. Useful for some
184 * memory-like regions on I/O busses.
185 */
186#define ioremap_cache(offset, size) \
187 ioremap_prot((offset), (size), _page_cachable_default)
188
189/*
190 * ioremap_wc - map bus memory into CPU space
191 * @offset: bus address of the memory
192 * @size: size of the resource to map
193 *
194 * ioremap_wc performs a platform specific sequence of operations to
195 * make bus memory CPU accessible via the readb/readw/readl/writeb/
196 * writew/writel functions and the other mmio helpers. The returned
197 * address is not guaranteed to be usable directly as a virtual
198 * address.
199 *
200 * This version of ioremap ensures that the memory is marked uncachable
201 * but accelerated by means of write-combining feature. It is specifically
202 * useful for PCIe prefetchable windows, which may vastly improve a
203 * communications performance. If it was determined on boot stage, what
204 * CPU CCA doesn't support UCA, the method shall fall-back to the
205 * _CACHE_UNCACHED option (see cpu_probe() method).
206 */
207#define ioremap_wc(offset, size) \
208 ioremap_prot((offset), (size), boot_cpu_data.writecombine)
209
210#if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_CPU_LOONGSON64)
211#define war_io_reorder_wmb() wmb()
212#else
213#define war_io_reorder_wmb() barrier()
214#endif
215
216#define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, barrier, relax, irq) \
217 \
218static inline void pfx##write##bwlq(type val, \
219 volatile void __iomem *mem) \
220{ \
221 volatile type *__mem; \
222 type __val; \
223 \
224 if (barrier) \
225 iobarrier_rw(); \
226 else \
227 war_io_reorder_wmb(); \
228 \
229 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
230 \
231 __val = pfx##ioswab##bwlq(__mem, val); \
232 \
233 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
234 *__mem = __val; \
235 else if (cpu_has_64bits) { \
236 unsigned long __flags; \
237 type __tmp; \
238 \
239 if (irq) \
240 local_irq_save(__flags); \
241 __asm__ __volatile__( \
242 ".set push" "\t\t# __writeq""\n\t" \
243 ".set arch=r4000" "\n\t" \
244 "dsll32 %L0, %L0, 0" "\n\t" \
245 "dsrl32 %L0, %L0, 0" "\n\t" \
246 "dsll32 %M0, %M0, 0" "\n\t" \
247 "or %L0, %L0, %M0" "\n\t" \
248 "sd %L0, %2" "\n\t" \
249 ".set pop" "\n" \
250 : "=r" (__tmp) \
251 : "0" (__val), "m" (*__mem)); \
252 if (irq) \
253 local_irq_restore(__flags); \
254 } else \
255 BUG(); \
256} \
257 \
258static inline type pfx##read##bwlq(const volatile void __iomem *mem) \
259{ \
260 volatile type *__mem; \
261 type __val; \
262 \
263 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
264 \
265 if (barrier) \
266 iobarrier_rw(); \
267 \
268 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
269 __val = *__mem; \
270 else if (cpu_has_64bits) { \
271 unsigned long __flags; \
272 \
273 if (irq) \
274 local_irq_save(__flags); \
275 __asm__ __volatile__( \
276 ".set push" "\t\t# __readq" "\n\t" \
277 ".set arch=r4000" "\n\t" \
278 "ld %L0, %1" "\n\t" \
279 "dsra32 %M0, %L0, 0" "\n\t" \
280 "sll %L0, %L0, 0" "\n\t" \
281 ".set pop" "\n" \
282 : "=r" (__val) \
283 : "m" (*__mem)); \
284 if (irq) \
285 local_irq_restore(__flags); \
286 } else { \
287 __val = 0; \
288 BUG(); \
289 } \
290 \
291 /* prevent prefetching of coherent DMA data prematurely */ \
292 if (!relax) \
293 rmb(); \
294 return pfx##ioswab##bwlq(__mem, __val); \
295}
296
297#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax, p) \
298 \
299static inline void pfx##out##bwlq##p(type val, unsigned long port) \
300{ \
301 volatile type *__addr; \
302 type __val; \
303 \
304 if (barrier) \
305 iobarrier_rw(); \
306 else \
307 war_io_reorder_wmb(); \
308 \
309 __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
310 \
311 __val = pfx##ioswab##bwlq(__addr, val); \
312 \
313 /* Really, we want this to be atomic */ \
314 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
315 \
316 *__addr = __val; \
317} \
318 \
319static inline type pfx##in##bwlq##p(unsigned long port) \
320{ \
321 volatile type *__addr; \
322 type __val; \
323 \
324 __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
325 \
326 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
327 \
328 if (barrier) \
329 iobarrier_rw(); \
330 \
331 __val = *__addr; \
332 \
333 /* prevent prefetching of coherent DMA data prematurely */ \
334 if (!relax) \
335 rmb(); \
336 return pfx##ioswab##bwlq(__addr, __val); \
337}
338
339#define __BUILD_MEMORY_PFX(bus, bwlq, type, relax) \
340 \
341__BUILD_MEMORY_SINGLE(bus, bwlq, type, 1, relax, 1)
342
343#define BUILDIO_MEM(bwlq, type) \
344 \
345__BUILD_MEMORY_PFX(__raw_, bwlq, type, 0) \
346__BUILD_MEMORY_PFX(__relaxed_, bwlq, type, 1) \
347__BUILD_MEMORY_PFX(__mem_, bwlq, type, 0) \
348__BUILD_MEMORY_PFX(, bwlq, type, 0)
349
350BUILDIO_MEM(b, u8)
351BUILDIO_MEM(w, u16)
352BUILDIO_MEM(l, u32)
353#ifdef CONFIG_64BIT
354BUILDIO_MEM(q, u64)
355#else
356__BUILD_MEMORY_PFX(__raw_, q, u64, 0)
357__BUILD_MEMORY_PFX(__mem_, q, u64, 0)
358#endif
359
360#define __BUILD_IOPORT_PFX(bus, bwlq, type) \
361 __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0,) \
362 __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0, _p)
363
364#define BUILDIO_IOPORT(bwlq, type) \
365 __BUILD_IOPORT_PFX(, bwlq, type) \
366 __BUILD_IOPORT_PFX(__mem_, bwlq, type)
367
368BUILDIO_IOPORT(b, u8)
369BUILDIO_IOPORT(w, u16)
370BUILDIO_IOPORT(l, u32)
371#ifdef CONFIG_64BIT
372BUILDIO_IOPORT(q, u64)
373#endif
374
375#define __BUILDIO(bwlq, type) \
376 \
377__BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 1, 0, 0)
378
379__BUILDIO(q, u64)
380
381#define readb_relaxed __relaxed_readb
382#define readw_relaxed __relaxed_readw
383#define readl_relaxed __relaxed_readl
384#ifdef CONFIG_64BIT
385#define readq_relaxed __relaxed_readq
386#endif
387
388#define writeb_relaxed __relaxed_writeb
389#define writew_relaxed __relaxed_writew
390#define writel_relaxed __relaxed_writel
391#ifdef CONFIG_64BIT
392#define writeq_relaxed __relaxed_writeq
393#endif
394
395#define readb_be(addr) \
396 __raw_readb((__force unsigned *)(addr))
397#define readw_be(addr) \
398 be16_to_cpu(__raw_readw((__force unsigned *)(addr)))
399#define readl_be(addr) \
400 be32_to_cpu(__raw_readl((__force unsigned *)(addr)))
401#define readq_be(addr) \
402 be64_to_cpu(__raw_readq((__force unsigned *)(addr)))
403
404#define writeb_be(val, addr) \
405 __raw_writeb((val), (__force unsigned *)(addr))
406#define writew_be(val, addr) \
407 __raw_writew(cpu_to_be16((val)), (__force unsigned *)(addr))
408#define writel_be(val, addr) \
409 __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr))
410#define writeq_be(val, addr) \
411 __raw_writeq(cpu_to_be64((val)), (__force unsigned *)(addr))
412
413/*
414 * Some code tests for these symbols
415 */
416#ifdef CONFIG_64BIT
417#define readq readq
418#define writeq writeq
419#endif
420
421#define __BUILD_MEMORY_STRING(bwlq, type) \
422 \
423static inline void writes##bwlq(volatile void __iomem *mem, \
424 const void *addr, unsigned int count) \
425{ \
426 const volatile type *__addr = addr; \
427 \
428 while (count--) { \
429 __mem_write##bwlq(*__addr, mem); \
430 __addr++; \
431 } \
432} \
433 \
434static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
435 unsigned int count) \
436{ \
437 volatile type *__addr = addr; \
438 \
439 while (count--) { \
440 *__addr = __mem_read##bwlq(mem); \
441 __addr++; \
442 } \
443}
444
445#define __BUILD_IOPORT_STRING(bwlq, type) \
446 \
447static inline void outs##bwlq(unsigned long port, const void *addr, \
448 unsigned int count) \
449{ \
450 const volatile type *__addr = addr; \
451 \
452 while (count--) { \
453 __mem_out##bwlq(*__addr, port); \
454 __addr++; \
455 } \
456} \
457 \
458static inline void ins##bwlq(unsigned long port, void *addr, \
459 unsigned int count) \
460{ \
461 volatile type *__addr = addr; \
462 \
463 while (count--) { \
464 *__addr = __mem_in##bwlq(port); \
465 __addr++; \
466 } \
467}
468
469#define BUILDSTRING(bwlq, type) \
470 \
471__BUILD_MEMORY_STRING(bwlq, type) \
472__BUILD_IOPORT_STRING(bwlq, type)
473
474BUILDSTRING(b, u8)
475BUILDSTRING(w, u16)
476BUILDSTRING(l, u32)
477#ifdef CONFIG_64BIT
478BUILDSTRING(q, u64)
479#endif
480
481static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
482{
483 memset((void __force *) addr, val, count);
484}
485static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
486{
487 memcpy(dst, (void __force *) src, count);
488}
489static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count)
490{
491 memcpy((void __force *) dst, src, count);
492}
493
494/*
495 * The caches on some architectures aren't dma-coherent and have need to
496 * handle this in software. There are three types of operations that
497 * can be applied to dma buffers.
498 *
499 * - dma_cache_wback_inv(start, size) makes caches and coherent by
500 * writing the content of the caches back to memory, if necessary.
501 * The function also invalidates the affected part of the caches as
502 * necessary before DMA transfers from outside to memory.
503 * - dma_cache_wback(start, size) makes caches and coherent by
504 * writing the content of the caches back to memory, if necessary.
505 * The function also invalidates the affected part of the caches as
506 * necessary before DMA transfers from outside to memory.
507 * - dma_cache_inv(start, size) invalidates the affected parts of the
508 * caches. Dirty lines of the caches may be written back or simply
509 * be discarded. This operation is necessary before dma operations
510 * to the memory.
511 *
512 * This API used to be exported; it now is for arch code internal use only.
513 */
514#ifdef CONFIG_DMA_NONCOHERENT
515
516extern void (*_dma_cache_wback_inv)(unsigned long start, unsigned long size);
517extern void (*_dma_cache_wback)(unsigned long start, unsigned long size);
518extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);
519
520#define dma_cache_wback_inv(start, size) _dma_cache_wback_inv(start, size)
521#define dma_cache_wback(start, size) _dma_cache_wback(start, size)
522#define dma_cache_inv(start, size) _dma_cache_inv(start, size)
523
524#else /* Sane hardware */
525
526#define dma_cache_wback_inv(start,size) \
527 do { (void) (start); (void) (size); } while (0)
528#define dma_cache_wback(start,size) \
529 do { (void) (start); (void) (size); } while (0)
530#define dma_cache_inv(start,size) \
531 do { (void) (start); (void) (size); } while (0)
532
533#endif /* CONFIG_DMA_NONCOHERENT */
534
535/*
536 * Read a 32-bit register that requires a 64-bit read cycle on the bus.
537 * Avoid interrupt mucking, just adjust the address for 4-byte access.
538 * Assume the addresses are 8-byte aligned.
539 */
540#ifdef __MIPSEB__
541#define __CSR_32_ADJUST 4
542#else
543#define __CSR_32_ADJUST 0
544#endif
545
546#define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v))
547#define csr_in32(a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST))
548
549/*
550 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
551 * access
552 */
553#define xlate_dev_mem_ptr(p) __va(p)
554
555/*
556 * Convert a virtual cached pointer to an uncached pointer
557 */
558#define xlate_dev_kmem_ptr(p) p
559
560void __ioread64_copy(void *to, const void __iomem *from, size_t count);
561
562#endif /* _ASM_IO_H */
diff --git a/arch/mips/include/asm/ip32/crime.h b/arch/mips/include/asm/ip32/crime.h
new file mode 100644
index 000000000..16c94a27b
--- /dev/null
+++ b/arch/mips/include/asm/ip32/crime.h
@@ -0,0 +1,158 @@
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
20struct sgi_crime {
21 volatile unsigned long id;
22#define CRIME_ID_MASK 0xff
23#define CRIME_ID_IDBITS 0xf0
24#define CRIME_ID_IDVALUE 0xa0
25#define CRIME_ID_REV 0x0f
26#define CRIME_REV_PETTY 0x00
27#define CRIME_REV_11 0x11
28#define CRIME_REV_13 0x13
29#define CRIME_REV_14 0x14
30
31 volatile unsigned long control;
32#define CRIME_CONTROL_MASK 0x3fff
33#define CRIME_CONTROL_TRITON_SYSADC 0x2000
34#define CRIME_CONTROL_CRIME_SYSADC 0x1000
35#define CRIME_CONTROL_HARD_RESET 0x0800
36#define CRIME_CONTROL_SOFT_RESET 0x0400
37#define CRIME_CONTROL_DOG_ENA 0x0200
38#define CRIME_CONTROL_ENDIANESS 0x0100
39#define CRIME_CONTROL_ENDIAN_BIG 0x0100
40#define CRIME_CONTROL_ENDIAN_LITTLE 0x0000
41#define CRIME_CONTROL_CQUEUE_HWM 0x000f
42#define CRIME_CONTROL_CQUEUE_SHFT 0
43#define CRIME_CONTROL_WBUF_HWM 0x00f0
44#define CRIME_CONTROL_WBUF_SHFT 8
45
46 volatile unsigned long istat;
47 volatile unsigned long imask;
48 volatile unsigned long soft_int;
49 volatile unsigned long hard_int;
50#define MACE_VID_IN1_INT BIT(0)
51#define MACE_VID_IN2_INT BIT(1)
52#define MACE_VID_OUT_INT BIT(2)
53#define MACE_ETHERNET_INT BIT(3)
54#define MACE_SUPERIO_INT BIT(4)
55#define MACE_MISC_INT BIT(5)
56#define MACE_AUDIO_INT BIT(6)
57#define MACE_PCI_BRIDGE_INT BIT(7)
58#define MACEPCI_SCSI0_INT BIT(8)
59#define MACEPCI_SCSI1_INT BIT(9)
60#define MACEPCI_SLOT0_INT BIT(10)
61#define MACEPCI_SLOT1_INT BIT(11)
62#define MACEPCI_SLOT2_INT BIT(12)
63#define MACEPCI_SHARED0_INT BIT(13)
64#define MACEPCI_SHARED1_INT BIT(14)
65#define MACEPCI_SHARED2_INT BIT(15)
66#define CRIME_GBE0_INT BIT(16)
67#define CRIME_GBE1_INT BIT(17)
68#define CRIME_GBE2_INT BIT(18)
69#define CRIME_GBE3_INT BIT(19)
70#define CRIME_CPUERR_INT BIT(20)
71#define CRIME_MEMERR_INT BIT(21)
72#define CRIME_RE_EMPTY_E_INT BIT(22)
73#define CRIME_RE_FULL_E_INT BIT(23)
74#define CRIME_RE_IDLE_E_INT BIT(24)
75#define CRIME_RE_EMPTY_L_INT BIT(25)
76#define CRIME_RE_FULL_L_INT BIT(26)
77#define CRIME_RE_IDLE_L_INT BIT(27)
78#define CRIME_SOFT0_INT BIT(28)
79#define CRIME_SOFT1_INT BIT(29)
80#define CRIME_SOFT2_INT BIT(30)
81#define CRIME_SYSCORERR_INT CRIME_SOFT2_INT
82#define CRIME_VICE_INT BIT(31)
83/* Masks for deciding who handles the interrupt */
84#define CRIME_MACE_INT_MASK 0x8f
85#define CRIME_MACEISA_INT_MASK 0x70
86#define CRIME_MACEPCI_INT_MASK 0xff00
87#define CRIME_CRIME_INT_MASK 0xffff0000
88
89 volatile unsigned long watchdog;
90#define CRIME_DOG_POWER_ON_RESET 0x00010000
91#define CRIME_DOG_WARM_RESET 0x00080000
92#define CRIME_DOG_TIMEOUT (CRIME_DOG_POWER_ON_RESET|CRIME_DOG_WARM_RESET)
93#define CRIME_DOG_VALUE 0x00007fff
94
95 volatile unsigned long timer;
96#define CRIME_MASTER_FREQ 66666500 /* Crime upcounter frequency */
97#define CRIME_NS_PER_TICK 15 /* for delay_calibrate */
98
99 volatile unsigned long cpu_error_addr;
100#define CRIME_CPU_ERROR_ADDR_MASK 0x3ffffffff
101
102 volatile unsigned long cpu_error_stat;
103#define CRIME_CPU_ERROR_MASK 0x7 /* cpu error stat is 3 bits */
104#define CRIME_CPU_ERROR_CPU_ILL_ADDR 0x4
105#define CRIME_CPU_ERROR_VICE_WRT_PRTY 0x2
106#define CRIME_CPU_ERROR_CPU_WRT_PRTY 0x1
107
108 unsigned long _pad0[54];
109
110 volatile unsigned long mc_ctrl;
111 volatile unsigned long bank_ctrl[8];
112#define CRIME_MEM_BANK_CONTROL_MASK 0x11f /* 9 bits 7:5 reserved */
113#define CRIME_MEM_BANK_CONTROL_ADDR 0x01f
114#define CRIME_MEM_BANK_CONTROL_SDRAM_SIZE 0x100
115#define CRIME_MAXBANKS 8
116
117 volatile unsigned long mem_ref_counter;
118#define CRIME_MEM_REF_COUNTER_MASK 0x3ff /* 10bit */
119
120 volatile unsigned long mem_error_stat;
121#define CRIME_MEM_ERROR_STAT_MASK 0x0ff7ffff /* 28-bit register */
122#define CRIME_MEM_ERROR_MACE_ID 0x0000007f
123#define CRIME_MEM_ERROR_MACE_ACCESS 0x00000080
124#define CRIME_MEM_ERROR_RE_ID 0x00007f00
125#define CRIME_MEM_ERROR_RE_ACCESS 0x00008000
126#define CRIME_MEM_ERROR_GBE_ACCESS 0x00010000
127#define CRIME_MEM_ERROR_VICE_ACCESS 0x00020000
128#define CRIME_MEM_ERROR_CPU_ACCESS 0x00040000
129#define CRIME_MEM_ERROR_RESERVED 0x00080000
130#define CRIME_MEM_ERROR_SOFT_ERR 0x00100000
131#define CRIME_MEM_ERROR_HARD_ERR 0x00200000
132#define CRIME_MEM_ERROR_MULTIPLE 0x00400000
133#define CRIME_MEM_ERROR_ECC 0x01800000
134#define CRIME_MEM_ERROR_MEM_ECC_RD 0x00800000
135#define CRIME_MEM_ERROR_MEM_ECC_RMW 0x01000000
136#define CRIME_MEM_ERROR_INV 0x0e000000
137#define CRIME_MEM_ERROR_INV_MEM_ADDR_RD 0x02000000
138#define CRIME_MEM_ERROR_INV_MEM_ADDR_WR 0x04000000
139#define CRIME_MEM_ERROR_INV_MEM_ADDR_RMW 0x08000000
140
141 volatile unsigned long mem_error_addr;
142#define CRIME_MEM_ERROR_ADDR_MASK 0x3fffffff
143
144 volatile unsigned long mem_ecc_syn;
145#define CRIME_MEM_ERROR_ECC_SYN_MASK 0xffffffff
146
147 volatile unsigned long mem_ecc_chk;
148#define CRIME_MEM_ERROR_ECC_CHK_MASK 0xffffffff
149
150 volatile unsigned long mem_ecc_repl;
151#define CRIME_MEM_ERROR_ECC_REPL_MASK 0xffffffff
152};
153
154extern struct sgi_crime __iomem *crime;
155
156#define CRIME_HI_MEM_BASE 0x40000000 /* this is where whole 1G of RAM is mapped */
157
158#endif /* __ASM_CRIME_H__ */
diff --git a/arch/mips/include/asm/ip32/ip32_ints.h b/arch/mips/include/asm/ip32/ip32_ints.h
new file mode 100644
index 000000000..72e3368de
--- /dev/null
+++ b/arch/mips/include/asm/ip32/ip32_ints.h
@@ -0,0 +1,114 @@
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#include <asm/irq.h>
13
14/*
15 * This list reflects the assignment of interrupt numbers to
16 * interrupting events. Order is fairly irrelevant to handling
17 * priority. This differs from irix.
18 */
19
20enum ip32_irq_no {
21 /*
22 * CPU interrupts are 0 ... 7
23 */
24
25 CRIME_IRQ_BASE = MIPS_CPU_IRQ_BASE + 8,
26
27 /*
28 * MACE
29 */
30 MACE_VID_IN1_IRQ = CRIME_IRQ_BASE,
31 MACE_VID_IN2_IRQ,
32 MACE_VID_OUT_IRQ,
33 MACE_ETHERNET_IRQ,
34 /* SUPERIO, MISC, and AUDIO are MACEISA */
35 __MACE_SUPERIO,
36 __MACE_MISC,
37 __MACE_AUDIO,
38 MACE_PCI_BRIDGE_IRQ,
39
40 /*
41 * MACEPCI
42 */
43 MACEPCI_SCSI0_IRQ,
44 MACEPCI_SCSI1_IRQ,
45 MACEPCI_SLOT0_IRQ,
46 MACEPCI_SLOT1_IRQ,
47 MACEPCI_SLOT2_IRQ,
48 MACEPCI_SHARED0_IRQ,
49 MACEPCI_SHARED1_IRQ,
50 MACEPCI_SHARED2_IRQ,
51
52 /*
53 * CRIME
54 */
55 CRIME_GBE0_IRQ,
56 CRIME_GBE1_IRQ,
57 CRIME_GBE2_IRQ,
58 CRIME_GBE3_IRQ,
59 CRIME_CPUERR_IRQ,
60 CRIME_MEMERR_IRQ,
61 CRIME_RE_EMPTY_E_IRQ,
62 CRIME_RE_FULL_E_IRQ,
63 CRIME_RE_IDLE_E_IRQ,
64 CRIME_RE_EMPTY_L_IRQ,
65 CRIME_RE_FULL_L_IRQ,
66 CRIME_RE_IDLE_L_IRQ,
67 CRIME_SOFT0_IRQ,
68 CRIME_SOFT1_IRQ,
69 CRIME_SOFT2_IRQ,
70 CRIME_SYSCORERR_IRQ = CRIME_SOFT2_IRQ,
71 CRIME_VICE_IRQ,
72
73 /*
74 * MACEISA
75 */
76 MACEISA_AUDIO_SW_IRQ,
77 MACEISA_AUDIO_SC_IRQ,
78 MACEISA_AUDIO1_DMAT_IRQ,
79 MACEISA_AUDIO1_OF_IRQ,
80 MACEISA_AUDIO2_DMAT_IRQ,
81 MACEISA_AUDIO2_MERR_IRQ,
82 MACEISA_AUDIO3_DMAT_IRQ,
83 MACEISA_AUDIO3_MERR_IRQ,
84 MACEISA_RTC_IRQ,
85 MACEISA_KEYB_IRQ,
86 /* MACEISA_KEYB_POLL is not an IRQ */
87 __MACEISA_KEYB_POLL,
88 MACEISA_MOUSE_IRQ,
89 /* MACEISA_MOUSE_POLL is not an IRQ */
90 __MACEISA_MOUSE_POLL,
91 MACEISA_TIMER0_IRQ,
92 MACEISA_TIMER1_IRQ,
93 MACEISA_TIMER2_IRQ,
94 MACEISA_PARALLEL_IRQ,
95 MACEISA_PAR_CTXA_IRQ,
96 MACEISA_PAR_CTXB_IRQ,
97 MACEISA_PAR_MERR_IRQ,
98 MACEISA_SERIAL1_IRQ,
99 MACEISA_SERIAL1_TDMAT_IRQ,
100 MACEISA_SERIAL1_TDMAPR_IRQ,
101 MACEISA_SERIAL1_TDMAME_IRQ,
102 MACEISA_SERIAL1_RDMAT_IRQ,
103 MACEISA_SERIAL1_RDMAOR_IRQ,
104 MACEISA_SERIAL2_IRQ,
105 MACEISA_SERIAL2_TDMAT_IRQ,
106 MACEISA_SERIAL2_TDMAPR_IRQ,
107 MACEISA_SERIAL2_TDMAME_IRQ,
108 MACEISA_SERIAL2_RDMAT_IRQ,
109 MACEISA_SERIAL2_RDMAOR_IRQ,
110
111 IP32_IRQ_MAX = MACEISA_SERIAL2_RDMAOR_IRQ
112};
113
114#endif /* __ASM_IP32_INTS_H */
diff --git a/arch/mips/include/asm/ip32/mace.h b/arch/mips/include/asm/ip32/mace.h
new file mode 100644
index 000000000..253ed7ea8
--- /dev/null
+++ b/arch/mips/include/asm/ip32/mace.h
@@ -0,0 +1,365 @@
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/*
21 * PCI interface
22 */
23struct mace_pci {
24 volatile unsigned int error_addr;
25 volatile unsigned int error;
26#define MACEPCI_ERROR_MASTER_ABORT BIT(31)
27#define MACEPCI_ERROR_TARGET_ABORT BIT(30)
28#define MACEPCI_ERROR_DATA_PARITY_ERR BIT(29)
29#define MACEPCI_ERROR_RETRY_ERR BIT(28)
30#define MACEPCI_ERROR_ILLEGAL_CMD BIT(27)
31#define MACEPCI_ERROR_SYSTEM_ERR BIT(26)
32#define MACEPCI_ERROR_INTERRUPT_TEST BIT(25)
33#define MACEPCI_ERROR_PARITY_ERR BIT(24)
34#define MACEPCI_ERROR_OVERRUN BIT(23)
35#define MACEPCI_ERROR_RSVD BIT(22)
36#define MACEPCI_ERROR_MEMORY_ADDR BIT(21)
37#define MACEPCI_ERROR_CONFIG_ADDR BIT(20)
38#define MACEPCI_ERROR_MASTER_ABORT_ADDR_VALID BIT(19)
39#define MACEPCI_ERROR_TARGET_ABORT_ADDR_VALID BIT(18)
40#define MACEPCI_ERROR_DATA_PARITY_ADDR_VALID BIT(17)
41#define MACEPCI_ERROR_RETRY_ADDR_VALID BIT(16)
42#define MACEPCI_ERROR_SIG_TABORT BIT(4)
43#define MACEPCI_ERROR_DEVSEL_MASK 0xc0
44#define MACEPCI_ERROR_DEVSEL_FAST 0
45#define MACEPCI_ERROR_DEVSEL_MED 0x40
46#define MACEPCI_ERROR_DEVSEL_SLOW 0x80
47#define MACEPCI_ERROR_FBB BIT(1)
48#define MACEPCI_ERROR_66MHZ BIT(0)
49 volatile unsigned int control;
50#define MACEPCI_CONTROL_INT(x) BIT(x)
51#define MACEPCI_CONTROL_INT_MASK 0xff
52#define MACEPCI_CONTROL_SERR_ENA BIT(8)
53#define MACEPCI_CONTROL_ARB_N6 BIT(9)
54#define MACEPCI_CONTROL_PARITY_ERR BIT(10)
55#define MACEPCI_CONTROL_MRMRA_ENA BIT(11)
56#define MACEPCI_CONTROL_ARB_N3 BIT(12)
57#define MACEPCI_CONTROL_ARB_N4 BIT(13)
58#define MACEPCI_CONTROL_ARB_N5 BIT(14)
59#define MACEPCI_CONTROL_PARK_LIU BIT(15)
60#define MACEPCI_CONTROL_INV_INT(x) BIT(16+x)
61#define MACEPCI_CONTROL_INV_INT_MASK 0x00ff0000
62#define MACEPCI_CONTROL_OVERRUN_INT BIT(24)
63#define MACEPCI_CONTROL_PARITY_INT BIT(25)
64#define MACEPCI_CONTROL_SERR_INT BIT(26)
65#define MACEPCI_CONTROL_IT_INT BIT(27)
66#define MACEPCI_CONTROL_RE_INT BIT(28)
67#define MACEPCI_CONTROL_DPED_INT BIT(29)
68#define MACEPCI_CONTROL_TAR_INT BIT(30)
69#define MACEPCI_CONTROL_MAR_INT BIT(31)
70 volatile unsigned int rev;
71 unsigned int _pad[0xcf8/4 - 4];
72 volatile unsigned int config_addr;
73 union {
74 volatile unsigned char b[4];
75 volatile unsigned short w[2];
76 volatile unsigned int l;
77 } config_data;
78};
79#define MACEPCI_LOW_MEMORY 0x1a000000
80#define MACEPCI_LOW_IO 0x18000000
81#define MACEPCI_SWAPPED_VIEW 0
82#define MACEPCI_NATIVE_VIEW 0x40000000
83#define MACEPCI_IO 0x80000000
84#define MACEPCI_HI_MEMORY 0x280000000
85#define MACEPCI_HI_IO 0x100000000
86
87/*
88 * Video interface
89 */
90struct mace_video {
91 unsigned long xxx; /* later... */
92};
93
94/*
95 * Ethernet interface
96 */
97struct mace_ethernet {
98 volatile u64 mac_ctrl;
99 volatile unsigned long int_stat;
100 volatile unsigned long dma_ctrl;
101 volatile unsigned long timer;
102 volatile unsigned long tx_int_al;
103 volatile unsigned long rx_int_al;
104 volatile unsigned long tx_info;
105 volatile unsigned long tx_info_al;
106 volatile unsigned long rx_buff;
107 volatile unsigned long rx_buff_al1;
108 volatile unsigned long rx_buff_al2;
109 volatile unsigned long diag;
110 volatile unsigned long phy_data;
111 volatile unsigned long phy_regs;
112 volatile unsigned long phy_trans_go;
113 volatile unsigned long backoff_seed;
114 /*===================================*/
115 volatile unsigned long imq_reserved[4];
116 volatile unsigned long mac_addr;
117 volatile unsigned long mac_addr2;
118 volatile unsigned long mcast_filter;
119 volatile unsigned long tx_ring_base;
120 /* Following are read-only registers for debugging */
121 volatile unsigned long tx_pkt1_hdr;
122 volatile unsigned long tx_pkt1_ptr[3];
123 volatile unsigned long tx_pkt2_hdr;
124 volatile unsigned long tx_pkt2_ptr[3];
125 /*===================================*/
126 volatile unsigned long rx_fifo;
127};
128
129/*
130 * Peripherals
131 */
132
133/* Audio registers */
134struct mace_audio {
135 volatile unsigned long control;
136 volatile unsigned long codec_control; /* codec status control */
137 volatile unsigned long codec_mask; /* codec status input mask */
138 volatile unsigned long codec_read; /* codec status read data */
139 struct {
140 volatile unsigned long control; /* channel control */
141 volatile unsigned long read_ptr; /* channel read pointer */
142 volatile unsigned long write_ptr; /* channel write pointer */
143 volatile unsigned long depth; /* channel depth */
144 } chan[3];
145};
146
147
148/* register definitions for parallel port DMA */
149struct mace_parport {
150 /* 0 - do nothing,
151 * 1 - pulse terminal count to the device after buffer is drained */
152#define MACEPAR_CONTEXT_LASTFLAG BIT(63)
153 /* Should not cross 4K page boundary */
154#define MACEPAR_CONTEXT_DATA_BOUND 0x0000000000001000UL
155#define MACEPAR_CONTEXT_DATALEN_MASK 0x00000fff00000000UL
156#define MACEPAR_CONTEXT_DATALEN_SHIFT 32
157 /* Can be arbitrarily aligned on any byte boundary on output,
158 * 64 byte aligned on input */
159#define MACEPAR_CONTEXT_BASEADDR_MASK 0x00000000ffffffffUL
160 volatile u64 context_a;
161 volatile u64 context_b;
162 /* 0 - mem->device, 1 - device->mem */
163#define MACEPAR_CTLSTAT_DIRECTION BIT(0)
164 /* 0 - channel frozen, 1 - channel enabled */
165#define MACEPAR_CTLSTAT_ENABLE BIT(1)
166 /* 0 - channel active, 1 - complete channel reset */
167#define MACEPAR_CTLSTAT_RESET BIT(2)
168#define MACEPAR_CTLSTAT_CTXB_VALID BIT(3)
169#define MACEPAR_CTLSTAT_CTXA_VALID BIT(4)
170 volatile u64 cntlstat; /* Control/Status register */
171#define MACEPAR_DIAG_CTXINUSE BIT(0)
172 /* 1 - Dma engine is enabled and processing something */
173#define MACEPAR_DIAG_DMACTIVE BIT(1)
174 /* Counter of bytes left */
175#define MACEPAR_DIAG_CTRMASK 0x0000000000003ffcUL
176#define MACEPAR_DIAG_CTRSHIFT 2
177 volatile u64 diagnostic; /* RO: diagnostic register */
178};
179
180/* ISA Control and DMA registers */
181struct mace_isactrl {
182 volatile unsigned long ringbase;
183#define MACEISA_RINGBUFFERS_SIZE (8 * 4096)
184
185 volatile unsigned long misc;
186#define MACEISA_FLASH_WE BIT(0) /* 1=> Enable FLASH writes */
187#define MACEISA_PWD_CLEAR BIT(1) /* 1=> PWD CLEAR jumper detected */
188#define MACEISA_NIC_DEASSERT BIT(2)
189#define MACEISA_NIC_DATA BIT(3)
190#define MACEISA_LED_RED BIT(4) /* 0=> Illuminate red LED */
191#define MACEISA_LED_GREEN BIT(5) /* 0=> Illuminate green LED */
192#define MACEISA_DP_RAM_ENABLE BIT(6)
193
194 volatile unsigned long istat;
195 volatile unsigned long imask;
196#define MACEISA_AUDIO_SW_INT BIT(0)
197#define MACEISA_AUDIO_SC_INT BIT(1)
198#define MACEISA_AUDIO1_DMAT_INT BIT(2)
199#define MACEISA_AUDIO1_OF_INT BIT(3)
200#define MACEISA_AUDIO2_DMAT_INT BIT(4)
201#define MACEISA_AUDIO2_MERR_INT BIT(5)
202#define MACEISA_AUDIO3_DMAT_INT BIT(6)
203#define MACEISA_AUDIO3_MERR_INT BIT(7)
204#define MACEISA_RTC_INT BIT(8)
205#define MACEISA_KEYB_INT BIT(9)
206#define MACEISA_KEYB_POLL_INT BIT(10)
207#define MACEISA_MOUSE_INT BIT(11)
208#define MACEISA_MOUSE_POLL_INT BIT(12)
209#define MACEISA_TIMER0_INT BIT(13)
210#define MACEISA_TIMER1_INT BIT(14)
211#define MACEISA_TIMER2_INT BIT(15)
212#define MACEISA_PARALLEL_INT BIT(16)
213#define MACEISA_PAR_CTXA_INT BIT(17)
214#define MACEISA_PAR_CTXB_INT BIT(18)
215#define MACEISA_PAR_MERR_INT BIT(19)
216#define MACEISA_SERIAL1_INT BIT(20)
217#define MACEISA_SERIAL1_TDMAT_INT BIT(21)
218#define MACEISA_SERIAL1_TDMAPR_INT BIT(22)
219#define MACEISA_SERIAL1_TDMAME_INT BIT(23)
220#define MACEISA_SERIAL1_RDMAT_INT BIT(24)
221#define MACEISA_SERIAL1_RDMAOR_INT BIT(25)
222#define MACEISA_SERIAL2_INT BIT(26)
223#define MACEISA_SERIAL2_TDMAT_INT BIT(27)
224#define MACEISA_SERIAL2_TDMAPR_INT BIT(28)
225#define MACEISA_SERIAL2_TDMAME_INT BIT(29)
226#define MACEISA_SERIAL2_RDMAT_INT BIT(30)
227#define MACEISA_SERIAL2_RDMAOR_INT BIT(31)
228
229 volatile unsigned long _pad[0x2000/8 - 4];
230
231 volatile unsigned long dp_ram[0x400];
232 struct mace_parport parport;
233};
234
235/* Keyboard & Mouse registers
236 * -> drivers/input/serio/maceps2.c */
237struct mace_ps2port {
238 volatile unsigned long tx;
239 volatile unsigned long rx;
240 volatile unsigned long control;
241 volatile unsigned long status;
242};
243
244struct mace_ps2 {
245 struct mace_ps2port keyb;
246 struct mace_ps2port mouse;
247};
248
249/* I2C registers
250 * -> drivers/i2c/algos/i2c-algo-sgi.c */
251struct mace_i2c {
252 volatile unsigned long config;
253#define MACEI2C_RESET BIT(0)
254#define MACEI2C_FAST BIT(1)
255#define MACEI2C_DATA_OVERRIDE BIT(2)
256#define MACEI2C_CLOCK_OVERRIDE BIT(3)
257#define MACEI2C_DATA_STATUS BIT(4)
258#define MACEI2C_CLOCK_STATUS BIT(5)
259 volatile unsigned long control;
260 volatile unsigned long data;
261};
262
263/* Timer registers */
264typedef union {
265 volatile unsigned long ust_msc;
266 struct reg {
267 volatile unsigned int ust;
268 volatile unsigned int msc;
269 } reg;
270} timer_reg;
271
272struct mace_timers {
273 volatile unsigned long ust;
274#define MACE_UST_PERIOD_NS 960
275
276 volatile unsigned long compare1;
277 volatile unsigned long compare2;
278 volatile unsigned long compare3;
279
280 timer_reg audio_in;
281 timer_reg audio_out1;
282 timer_reg audio_out2;
283 timer_reg video_in1;
284 timer_reg video_in2;
285 timer_reg video_out;
286};
287
288struct mace_perif {
289 struct mace_audio audio;
290 char _pad0[0x10000 - sizeof(struct mace_audio)];
291
292 struct mace_isactrl ctrl;
293 char _pad1[0x10000 - sizeof(struct mace_isactrl)];
294
295 struct mace_ps2 ps2;
296 char _pad2[0x10000 - sizeof(struct mace_ps2)];
297
298 struct mace_i2c i2c;
299 char _pad3[0x10000 - sizeof(struct mace_i2c)];
300
301 struct mace_timers timers;
302 char _pad4[0x10000 - sizeof(struct mace_timers)];
303};
304
305
306/*
307 * ISA peripherals
308 */
309
310/* Parallel port */
311struct mace_parallel {
312};
313
314struct mace_ecp1284 { /* later... */
315};
316
317/* Serial port */
318struct mace_serial {
319 volatile unsigned long xxx; /* later... */
320};
321
322struct mace_isa {
323 struct mace_parallel parallel;
324 char _pad1[0x8000 - sizeof(struct mace_parallel)];
325
326 struct mace_ecp1284 ecp1284;
327 char _pad2[0x8000 - sizeof(struct mace_ecp1284)];
328
329 struct mace_serial serial1;
330 char _pad3[0x8000 - sizeof(struct mace_serial)];
331
332 struct mace_serial serial2;
333 char _pad4[0x8000 - sizeof(struct mace_serial)];
334
335 volatile unsigned char rtc[0x10000];
336};
337
338struct sgi_mace {
339 char _reserved[0x80000];
340
341 struct mace_pci pci;
342 char _pad0[0x80000 - sizeof(struct mace_pci)];
343
344 struct mace_video video_in1;
345 char _pad1[0x80000 - sizeof(struct mace_video)];
346
347 struct mace_video video_in2;
348 char _pad2[0x80000 - sizeof(struct mace_video)];
349
350 struct mace_video video_out;
351 char _pad3[0x80000 - sizeof(struct mace_video)];
352
353 struct mace_ethernet eth;
354 char _pad4[0x80000 - sizeof(struct mace_ethernet)];
355
356 struct mace_perif perif;
357 char _pad5[0x80000 - sizeof(struct mace_perif)];
358
359 struct mace_isa isa;
360 char _pad6[0x80000 - sizeof(struct mace_isa)];
361};
362
363extern struct sgi_mace __iomem *mace;
364
365#endif /* __ASM_MACE_H__ */
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
new file mode 100644
index 000000000..c5d351786
--- /dev/null
+++ b/arch/mips/include/asm/irq.h
@@ -0,0 +1,85 @@
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/linkage.h>
13#include <linux/smp.h>
14#include <linux/irqdomain.h>
15
16#include <asm/mipsmtregs.h>
17
18#include <irq.h>
19
20#define IRQ_STACK_SIZE THREAD_SIZE
21#define IRQ_STACK_START (IRQ_STACK_SIZE - 16)
22
23extern void *irq_stack[NR_CPUS];
24
25/*
26 * The highest address on the IRQ stack contains a dummy frame put down in
27 * genex.S (handle_int & except_vec_vi_handler) which is structured as follows:
28 *
29 * top ------------
30 * | task sp | <- irq_stack[cpu] + IRQ_STACK_START
31 * ------------
32 * | | <- First frame of IRQ context
33 * ------------
34 *
35 * task sp holds a copy of the task stack pointer where the struct pt_regs
36 * from exception entry can be found.
37 */
38
39static inline bool on_irq_stack(int cpu, unsigned long sp)
40{
41 unsigned long low = (unsigned long)irq_stack[cpu];
42 unsigned long high = low + IRQ_STACK_SIZE;
43
44 return (low <= sp && sp <= high);
45}
46
47#ifdef CONFIG_I8259
48static inline int irq_canonicalize(int irq)
49{
50 return ((irq == I8259A_IRQ_BASE + 2) ? I8259A_IRQ_BASE + 9 : irq);
51}
52#else
53#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
54#endif
55
56asmlinkage void plat_irq_dispatch(void);
57
58extern void do_IRQ(unsigned int irq);
59
60extern void arch_init_irq(void);
61extern void spurious_interrupt(void);
62
63extern int allocate_irqno(void);
64extern void alloc_legacy_irqno(void);
65extern void free_irqno(unsigned int irq);
66
67/*
68 * Before R2 the timer and performance counter interrupts were both fixed to
69 * IE7. Since R2 their number has to be read from the c0_intctl register.
70 */
71#define CP0_LEGACY_COMPARE_IRQ 7
72#define CP0_LEGACY_PERFCNT_IRQ 7
73
74extern int cp0_compare_irq;
75extern int cp0_compare_irq_shift;
76extern int cp0_perfcount_irq;
77extern int cp0_fdc_irq;
78
79extern int get_c0_fdc_int(void);
80
81void arch_trigger_cpumask_backtrace(const struct cpumask *mask,
82 bool exclude_self);
83#define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace
84
85#endif /* _ASM_IRQ_H */
diff --git a/arch/mips/include/asm/irq_cpu.h b/arch/mips/include/asm/irq_cpu.h
new file mode 100644
index 000000000..8d321180b
--- /dev/null
+++ b/arch/mips/include/asm/irq_cpu.h
@@ -0,0 +1,22 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/irq_cpu.h
4 *
5 * MIPS CPU interrupt definitions.
6 *
7 * Copyright (C) 2002 Maciej W. Rozycki
8 */
9#ifndef _ASM_IRQ_CPU_H
10#define _ASM_IRQ_CPU_H
11
12extern void mips_cpu_irq_init(void);
13extern void rm7k_cpu_irq_init(void);
14extern void rm9k_cpu_irq_init(void);
15
16#ifdef CONFIG_IRQ_DOMAIN
17struct device_node;
18extern int mips_cpu_irq_of_init(struct device_node *of_node,
19 struct device_node *parent);
20#endif
21
22#endif /* _ASM_IRQ_CPU_H */
diff --git a/arch/mips/include/asm/irq_gt641xx.h b/arch/mips/include/asm/irq_gt641xx.h
new file mode 100644
index 000000000..d689c1c6c
--- /dev/null
+++ b/arch/mips/include/asm/irq_gt641xx.h
@@ -0,0 +1,47 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Galileo/Marvell GT641xx IRQ definitions.
4 *
5 * Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
6 */
7#ifndef _ASM_IRQ_GT641XX_H
8#define _ASM_IRQ_GT641XX_H
9
10#ifndef GT641XX_IRQ_BASE
11#define GT641XX_IRQ_BASE 8
12#endif
13
14#define GT641XX_MEMORY_OUT_OF_RANGE_IRQ (GT641XX_IRQ_BASE + 1)
15#define GT641XX_DMA_OUT_OF_RANGE_IRQ (GT641XX_IRQ_BASE + 2)
16#define GT641XX_CPU_ACCESS_OUT_OF_RANGE_IRQ (GT641XX_IRQ_BASE + 3)
17#define GT641XX_DMA0_IRQ (GT641XX_IRQ_BASE + 4)
18#define GT641XX_DMA1_IRQ (GT641XX_IRQ_BASE + 5)
19#define GT641XX_DMA2_IRQ (GT641XX_IRQ_BASE + 6)
20#define GT641XX_DMA3_IRQ (GT641XX_IRQ_BASE + 7)
21#define GT641XX_TIMER0_IRQ (GT641XX_IRQ_BASE + 8)
22#define GT641XX_TIMER1_IRQ (GT641XX_IRQ_BASE + 9)
23#define GT641XX_TIMER2_IRQ (GT641XX_IRQ_BASE + 10)
24#define GT641XX_TIMER3_IRQ (GT641XX_IRQ_BASE + 11)
25#define GT641XX_PCI_0_MASTER_READ_ERROR_IRQ (GT641XX_IRQ_BASE + 12)
26#define GT641XX_PCI_0_SLAVE_WRITE_ERROR_IRQ (GT641XX_IRQ_BASE + 13)
27#define GT641XX_PCI_0_MASTER_WRITE_ERROR_IRQ (GT641XX_IRQ_BASE + 14)
28#define GT641XX_PCI_0_SLAVE_READ_ERROR_IRQ (GT641XX_IRQ_BASE + 15)
29#define GT641XX_PCI_0_ADDRESS_ERROR_IRQ (GT641XX_IRQ_BASE + 16)
30#define GT641XX_MEMORY_ERROR_IRQ (GT641XX_IRQ_BASE + 17)
31#define GT641XX_PCI_0_MASTER_ABORT_IRQ (GT641XX_IRQ_BASE + 18)
32#define GT641XX_PCI_0_TARGET_ABORT_IRQ (GT641XX_IRQ_BASE + 19)
33#define GT641XX_PCI_0_RETRY_TIMEOUT_IRQ (GT641XX_IRQ_BASE + 20)
34#define GT641XX_CPU_INT0_IRQ (GT641XX_IRQ_BASE + 21)
35#define GT641XX_CPU_INT1_IRQ (GT641XX_IRQ_BASE + 22)
36#define GT641XX_CPU_INT2_IRQ (GT641XX_IRQ_BASE + 23)
37#define GT641XX_CPU_INT3_IRQ (GT641XX_IRQ_BASE + 24)
38#define GT641XX_CPU_INT4_IRQ (GT641XX_IRQ_BASE + 25)
39#define GT641XX_PCI_INT0_IRQ (GT641XX_IRQ_BASE + 26)
40#define GT641XX_PCI_INT1_IRQ (GT641XX_IRQ_BASE + 27)
41#define GT641XX_PCI_INT2_IRQ (GT641XX_IRQ_BASE + 28)
42#define GT641XX_PCI_INT3_IRQ (GT641XX_IRQ_BASE + 29)
43
44extern void gt641xx_irq_dispatch(void);
45extern void gt641xx_irq_init(void);
46
47#endif /* _ASM_IRQ_GT641XX_H */
diff --git a/arch/mips/include/asm/irq_regs.h b/arch/mips/include/asm/irq_regs.h
new file mode 100644
index 000000000..7795dc02c
--- /dev/null
+++ b/arch/mips/include/asm/irq_regs.h
@@ -0,0 +1,28 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 *
4 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
5 */
6#ifndef __ASM_IRQ_REGS_H
7#define __ASM_IRQ_REGS_H
8
9#define ARCH_HAS_OWN_IRQ_REGS
10
11#include <linux/thread_info.h>
12
13static inline struct pt_regs *get_irq_regs(void)
14{
15 return current_thread_info()->regs;
16}
17
18static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs)
19{
20 struct pt_regs *old_regs;
21
22 old_regs = get_irq_regs();
23 current_thread_info()->regs = new_regs;
24
25 return old_regs;
26}
27
28#endif /* __ASM_IRQ_REGS_H */
diff --git a/arch/mips/include/asm/irqflags.h b/arch/mips/include/asm/irqflags.h
new file mode 100644
index 000000000..f5b8300f4
--- /dev/null
+++ b/arch/mips/include/asm/irqflags.h
@@ -0,0 +1,185 @@
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_IRQFLAGS_H
12#define _ASM_IRQFLAGS_H
13
14#ifndef __ASSEMBLY__
15
16#include <linux/compiler.h>
17#include <linux/stringify.h>
18#include <asm/compiler.h>
19#include <asm/hazards.h>
20
21#if defined(CONFIG_CPU_HAS_DIEI)
22
23static inline void arch_local_irq_disable(void)
24{
25 __asm__ __volatile__(
26 " .set push \n"
27 " .set noat \n"
28 " di \n"
29 " " __stringify(__irq_disable_hazard) " \n"
30 " .set pop \n"
31 : /* no outputs */
32 : /* no inputs */
33 : "memory");
34}
35
36static inline unsigned long arch_local_irq_save(void)
37{
38 unsigned long flags;
39
40 asm __volatile__(
41 " .set push \n"
42 " .set reorder \n"
43 " .set noat \n"
44#if defined(CONFIG_CPU_LOONGSON64) || defined(CONFIG_CPU_LOONGSON32)
45 " mfc0 %[flags], $12 \n"
46 " di \n"
47#else
48 " di %[flags] \n"
49#endif
50 " andi %[flags], 1 \n"
51 " " __stringify(__irq_disable_hazard) " \n"
52 " .set pop \n"
53 : [flags] "=r" (flags)
54 : /* no inputs */
55 : "memory");
56
57 return flags;
58}
59
60static inline void arch_local_irq_restore(unsigned long flags)
61{
62 unsigned long __tmp1;
63
64 __asm__ __volatile__(
65 " .set push \n"
66 " .set noreorder \n"
67 " .set noat \n"
68#if defined(CONFIG_IRQ_MIPS_CPU)
69 /*
70 * Slow, but doesn't suffer from a relatively unlikely race
71 * condition we're having since days 1.
72 */
73 " beqz %[flags], 1f \n"
74 " di \n"
75 " ei \n"
76 "1: \n"
77#else
78 /*
79 * Fast, dangerous. Life is fun, life is good.
80 */
81 " mfc0 $1, $12 \n"
82 " ins $1, %[flags], 0, 1 \n"
83 " mtc0 $1, $12 \n"
84#endif
85 " " __stringify(__irq_disable_hazard) " \n"
86 " .set pop \n"
87 : [flags] "=r" (__tmp1)
88 : "0" (flags)
89 : "memory");
90}
91
92#else
93/* Functions that require preempt_{dis,en}able() are in mips-atomic.c */
94void arch_local_irq_disable(void);
95unsigned long arch_local_irq_save(void);
96void arch_local_irq_restore(unsigned long flags);
97#endif /* CONFIG_CPU_HAS_DIEI */
98
99static inline void arch_local_irq_enable(void)
100{
101 __asm__ __volatile__(
102 " .set push \n"
103 " .set reorder \n"
104 " .set noat \n"
105#if defined(CONFIG_CPU_HAS_DIEI)
106 " ei \n"
107#else
108 " mfc0 $1,$12 \n"
109 " ori $1,0x1f \n"
110 " xori $1,0x1e \n"
111 " mtc0 $1,$12 \n"
112#endif
113 " " __stringify(__irq_enable_hazard) " \n"
114 " .set pop \n"
115 : /* no outputs */
116 : /* no inputs */
117 : "memory");
118}
119
120static inline unsigned long arch_local_save_flags(void)
121{
122 unsigned long flags;
123
124 asm __volatile__(
125 " .set push \n"
126 " .set reorder \n"
127 " mfc0 %[flags], $12 \n"
128 " .set pop \n"
129 : [flags] "=r" (flags));
130
131 return flags;
132}
133
134
135static inline int arch_irqs_disabled_flags(unsigned long flags)
136{
137 return !(flags & 1);
138}
139
140static inline int arch_irqs_disabled(void)
141{
142 return arch_irqs_disabled_flags(arch_local_save_flags());
143}
144
145#endif /* #ifndef __ASSEMBLY__ */
146
147/*
148 * Do the CPU's IRQ-state tracing from assembly code.
149 */
150#ifdef CONFIG_TRACE_IRQFLAGS
151/* Reload some registers clobbered by trace_hardirqs_on */
152#ifdef CONFIG_64BIT
153# define TRACE_IRQS_RELOAD_REGS \
154 LONG_L $11, PT_R11(sp); \
155 LONG_L $10, PT_R10(sp); \
156 LONG_L $9, PT_R9(sp); \
157 LONG_L $8, PT_R8(sp); \
158 LONG_L $7, PT_R7(sp); \
159 LONG_L $6, PT_R6(sp); \
160 LONG_L $5, PT_R5(sp); \
161 LONG_L $4, PT_R4(sp); \
162 LONG_L $2, PT_R2(sp)
163#else
164# define TRACE_IRQS_RELOAD_REGS \
165 LONG_L $7, PT_R7(sp); \
166 LONG_L $6, PT_R6(sp); \
167 LONG_L $5, PT_R5(sp); \
168 LONG_L $4, PT_R4(sp); \
169 LONG_L $2, PT_R2(sp)
170#endif
171# define TRACE_IRQS_ON \
172 CLI; /* make sure trace_hardirqs_on() is called in kernel level */ \
173 jal trace_hardirqs_on
174# define TRACE_IRQS_ON_RELOAD \
175 TRACE_IRQS_ON; \
176 TRACE_IRQS_RELOAD_REGS
177# define TRACE_IRQS_OFF \
178 jal trace_hardirqs_off
179#else
180# define TRACE_IRQS_ON
181# define TRACE_IRQS_ON_RELOAD
182# define TRACE_IRQS_OFF
183#endif
184
185#endif /* _ASM_IRQFLAGS_H */
diff --git a/arch/mips/include/asm/isa-rev.h b/arch/mips/include/asm/isa-rev.h
new file mode 100644
index 000000000..683ea3454
--- /dev/null
+++ b/arch/mips/include/asm/isa-rev.h
@@ -0,0 +1,24 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2018 MIPS Tech, LLC
4 * Author: Matt Redfearn <matt.redfearn@mips.com>
5 */
6
7#ifndef __MIPS_ASM_ISA_REV_H__
8#define __MIPS_ASM_ISA_REV_H__
9
10/*
11 * The ISA revision level. This is 0 for MIPS I to V and N for
12 * MIPS{32,64}rN.
13 */
14
15/* If the compiler has defined __mips_isa_rev, believe it. */
16#ifdef __mips_isa_rev
17#define MIPS_ISA_REV __mips_isa_rev
18#else
19/* The compiler hasn't defined the isa rev so assume it's MIPS I - V (0) */
20#define MIPS_ISA_REV 0
21#endif
22
23
24#endif /* __MIPS_ASM_ISA_REV_H__ */
diff --git a/arch/mips/include/asm/isadep.h b/arch/mips/include/asm/isadep.h
new file mode 100644
index 000000000..d16832023
--- /dev/null
+++ b/arch/mips/include/asm/isadep.h
@@ -0,0 +1,35 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Various ISA level dependent constants.
4 * Most of the following constants reflect the different layout
5 * of Coprocessor 0 registers.
6 *
7 * Copyright (c) 1998 Harald Koerfgen
8 */
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/arch/mips/include/asm/jazz.h b/arch/mips/include/asm/jazz.h
new file mode 100644
index 000000000..a61970d01
--- /dev/null
+++ b/arch/mips/include/asm/jazz.h
@@ -0,0 +1,310 @@
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 Level definitions
189 *
190 * This is somewhat broken. For reasons which nobody can remember anymore
191 * we remap the Jazz interrupts to the usual ISA style interrupt numbers.
192 */
193#define JAZZ_IRQ_START 24
194#define JAZZ_IRQ_END (24 + 9)
195#define JAZZ_PARALLEL_IRQ (JAZZ_IRQ_START + 0)
196#define JAZZ_FLOPPY_IRQ (JAZZ_IRQ_START + 1)
197#define JAZZ_SOUND_IRQ (JAZZ_IRQ_START + 2)
198#define JAZZ_VIDEO_IRQ (JAZZ_IRQ_START + 3)
199#define JAZZ_ETHERNET_IRQ (JAZZ_IRQ_START + 4)
200#define JAZZ_SCSI_IRQ (JAZZ_IRQ_START + 5)
201#define JAZZ_KEYBOARD_IRQ (JAZZ_IRQ_START + 6)
202#define JAZZ_MOUSE_IRQ (JAZZ_IRQ_START + 7)
203#define JAZZ_SERIAL1_IRQ (JAZZ_IRQ_START + 8)
204#define JAZZ_SERIAL2_IRQ (JAZZ_IRQ_START + 9)
205
206#define JAZZ_TIMER_IRQ (MIPS_CPU_IRQ_BASE+6)
207
208
209/*
210 * JAZZ DMA Channels
211 * Note: Channels 4...7 are not used with respect to the Acer PICA-61
212 * chipset which does not provide these DMA channels.
213 */
214#define JAZZ_SCSI_DMA 0 /* SCSI */
215#define JAZZ_FLOPPY_DMA 1 /* FLOPPY */
216#define JAZZ_AUDIOL_DMA 2 /* AUDIO L */
217#define JAZZ_AUDIOR_DMA 3 /* AUDIO R */
218
219/*
220 * JAZZ R4030 MCT_ADR chip (DMA controller)
221 * Note: Virtual Addresses !
222 */
223#define JAZZ_R4030_CONFIG 0xE0000000 /* R4030 config register */
224#define JAZZ_R4030_REVISION 0xE0000008 /* same as PICA_ASIC_REVISION */
225#define JAZZ_R4030_INV_ADDR 0xE0000010 /* Invalid Address register */
226
227#define JAZZ_R4030_TRSTBL_BASE 0xE0000018 /* Translation Table Base */
228#define JAZZ_R4030_TRSTBL_LIM 0xE0000020 /* Translation Table Limit */
229#define JAZZ_R4030_TRSTBL_INV 0xE0000028 /* Translation Table Invalidate */
230
231#define JAZZ_R4030_CACHE_MTNC 0xE0000030 /* Cache Maintenance */
232#define JAZZ_R4030_R_FAIL_ADDR 0xE0000038 /* Remote Failed Address */
233#define JAZZ_R4030_M_FAIL_ADDR 0xE0000040 /* Memory Failed Address */
234
235#define JAZZ_R4030_CACHE_PTAG 0xE0000048 /* I/O Cache Physical Tag */
236#define JAZZ_R4030_CACHE_LTAG 0xE0000050 /* I/O Cache Logical Tag */
237#define JAZZ_R4030_CACHE_BMASK 0xE0000058 /* I/O Cache Byte Mask */
238#define JAZZ_R4030_CACHE_BWIN 0xE0000060 /* I/O Cache Buffer Window */
239
240/*
241 * Remote Speed Registers.
242 *
243 * 0: free, 1: Ethernet, 2: SCSI, 3: Floppy,
244 * 4: RTC, 5: Kb./Mouse 6: serial 1, 7: serial 2,
245 * 8: parallel, 9: NVRAM, 10: CPU, 11: PROM,
246 * 12: reserved, 13: free, 14: 7seg LED, 15: ???
247 */
248#define JAZZ_R4030_REM_SPEED 0xE0000070 /* 16 Remote Speed Registers */
249 /* 0xE0000070,78,80... 0xE00000E8 */
250#define JAZZ_R4030_IRQ_ENABLE 0xE00000E8 /* Internal Interrupt Enable */
251#define JAZZ_R4030_INVAL_ADDR 0xE0000010 /* Invalid address Register */
252#define JAZZ_R4030_IRQ_SOURCE 0xE0000200 /* Interrupt Source Register */
253#define JAZZ_R4030_I386_ERROR 0xE0000208 /* i386/EISA Bus Error */
254
255/*
256 * Virtual (E)ISA controller address
257 */
258#define JAZZ_EISA_IRQ_ACK 0xE0000238 /* EISA interrupt acknowledge */
259
260/*
261 * Access the R4030 DMA and I/O Controller
262 */
263#ifndef __ASSEMBLY__
264
265static inline void r4030_delay(void)
266{
267__asm__ __volatile__(
268 ".set\tnoreorder\n\t"
269 "nop\n\t"
270 "nop\n\t"
271 "nop\n\t"
272 "nop\n\t"
273 ".set\treorder");
274}
275
276static inline unsigned short r4030_read_reg16(unsigned long addr)
277{
278 unsigned short ret = *((volatile unsigned short *)addr);
279 r4030_delay();
280 return ret;
281}
282
283static inline unsigned int r4030_read_reg32(unsigned long addr)
284{
285 unsigned int ret = *((volatile unsigned int *)addr);
286 r4030_delay();
287 return ret;
288}
289
290static inline void r4030_write_reg16(unsigned long addr, unsigned val)
291{
292 *((volatile unsigned short *)addr) = val;
293 r4030_delay();
294}
295
296static inline void r4030_write_reg32(unsigned long addr, unsigned val)
297{
298 *((volatile unsigned int *)addr) = val;
299 r4030_delay();
300}
301
302#endif /* !__ASSEMBLY__ */
303
304#define JAZZ_FDC_BASE 0xe0003000
305#define JAZZ_RTC_BASE 0xe0004000
306#define JAZZ_PORT_BASE 0xe2000000
307
308#define JAZZ_EISA_BASE 0xe3000000
309
310#endif /* __ASM_JAZZ_H */
diff --git a/arch/mips/include/asm/jazzdma.h b/arch/mips/include/asm/jazzdma.h
new file mode 100644
index 000000000..c831da7fa
--- /dev/null
+++ b/arch/mips/include/asm/jazzdma.h
@@ -0,0 +1,88 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Helpfile for jazzdma.c -- Mips Jazz R4030 DMA controller support
4 */
5#ifndef _ASM_JAZZDMA_H
6#define _ASM_JAZZDMA_H
7
8/*
9 * Prototypes and macros
10 */
11extern unsigned long vdma_alloc(unsigned long paddr, unsigned long size);
12extern int vdma_free(unsigned long laddr);
13extern unsigned long vdma_phys2log(unsigned long paddr);
14extern unsigned long vdma_log2phys(unsigned long laddr);
15extern void vdma_stats(void); /* for debugging only */
16
17extern void vdma_enable(int channel);
18extern void vdma_disable(int channel);
19extern void vdma_set_mode(int channel, int mode);
20extern void vdma_set_addr(int channel, long addr);
21extern void vdma_set_count(int channel, int count);
22extern int vdma_get_residue(int channel);
23extern int vdma_get_enable(int channel);
24
25/*
26 * some definitions used by the driver functions
27 */
28#define VDMA_PAGESIZE 4096
29#define VDMA_PGTBL_ENTRIES 4096
30#define VDMA_PGTBL_SIZE (sizeof(VDMA_PGTBL_ENTRY) * VDMA_PGTBL_ENTRIES)
31#define VDMA_PAGE_EMPTY 0xff000000
32
33/*
34 * Macros to get page no. and offset of a given address
35 * Note that VDMA_PAGE() works for physical addresses only
36 */
37#define VDMA_PAGE(a) ((unsigned int)(a) >> 12)
38#define VDMA_OFFSET(a) ((unsigned int)(a) & (VDMA_PAGESIZE-1))
39
40/*
41 * VDMA pagetable entry description
42 */
43typedef volatile struct VDMA_PGTBL_ENTRY {
44 unsigned int frame; /* physical frame no. */
45 unsigned int owner; /* owner of this entry (0=free) */
46} VDMA_PGTBL_ENTRY;
47
48
49/*
50 * DMA channel control registers
51 * in the R4030 MCT_ADR chip
52 */
53#define JAZZ_R4030_CHNL_MODE 0xE0000100 /* 8 DMA Channel Mode Registers, */
54 /* 0xE0000100,120,140... */
55#define JAZZ_R4030_CHNL_ENABLE 0xE0000108 /* 8 DMA Channel Enable Regs, */
56 /* 0xE0000108,128,148... */
57#define JAZZ_R4030_CHNL_COUNT 0xE0000110 /* 8 DMA Channel Byte Cnt Regs, */
58 /* 0xE0000110,130,150... */
59#define JAZZ_R4030_CHNL_ADDR 0xE0000118 /* 8 DMA Channel Address Regs, */
60 /* 0xE0000118,138,158... */
61
62/* channel enable register bits */
63
64#define R4030_CHNL_ENABLE (1<<0)
65#define R4030_CHNL_WRITE (1<<1)
66#define R4030_TC_INTR (1<<8)
67#define R4030_MEM_INTR (1<<9)
68#define R4030_ADDR_INTR (1<<10)
69
70/*
71 * Channel mode register bits
72 */
73#define R4030_MODE_ATIME_40 (0) /* device access time on remote bus */
74#define R4030_MODE_ATIME_80 (1)
75#define R4030_MODE_ATIME_120 (2)
76#define R4030_MODE_ATIME_160 (3)
77#define R4030_MODE_ATIME_200 (4)
78#define R4030_MODE_ATIME_240 (5)
79#define R4030_MODE_ATIME_280 (6)
80#define R4030_MODE_ATIME_320 (7)
81#define R4030_MODE_WIDTH_8 (1<<3) /* device data bus width */
82#define R4030_MODE_WIDTH_16 (2<<3)
83#define R4030_MODE_WIDTH_32 (3<<3)
84#define R4030_MODE_INTR_EN (1<<5)
85#define R4030_MODE_BURST (1<<6) /* Rev. 2 only */
86#define R4030_MODE_FAST_ACK (1<<7) /* Rev. 2 only */
87
88#endif /* _ASM_JAZZDMA_H */
diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h
new file mode 100644
index 000000000..3185fd322
--- /dev/null
+++ b/arch/mips/include/asm/jump_label.h
@@ -0,0 +1,75 @@
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) 2010 Cavium Networks, Inc.
7 */
8#ifndef _ASM_MIPS_JUMP_LABEL_H
9#define _ASM_MIPS_JUMP_LABEL_H
10
11#ifndef __ASSEMBLY__
12
13#include <linux/types.h>
14#include <asm/isa-rev.h>
15
16#define JUMP_LABEL_NOP_SIZE 4
17
18#ifdef CONFIG_64BIT
19#define WORD_INSN ".dword"
20#else
21#define WORD_INSN ".word"
22#endif
23
24#ifdef CONFIG_CPU_MICROMIPS
25# define B_INSN "b32"
26# define J_INSN "j32"
27#elif MIPS_ISA_REV >= 6
28# define B_INSN "bc"
29# define J_INSN "bc"
30#else
31# define B_INSN "b"
32# define J_INSN "j"
33#endif
34
35static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
36{
37 asm_volatile_goto("1:\t" B_INSN " 2f\n\t"
38 "2:\t.insn\n\t"
39 ".pushsection __jump_table, \"aw\"\n\t"
40 WORD_INSN " 1b, %l[l_yes], %0\n\t"
41 ".popsection\n\t"
42 : : "i" (&((char *)key)[branch]) : : l_yes);
43
44 return false;
45l_yes:
46 return true;
47}
48
49static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
50{
51 asm_volatile_goto("1:\t" J_INSN " %l[l_yes]\n\t"
52 ".pushsection __jump_table, \"aw\"\n\t"
53 WORD_INSN " 1b, %l[l_yes], %0\n\t"
54 ".popsection\n\t"
55 : : "i" (&((char *)key)[branch]) : : l_yes);
56
57 return false;
58l_yes:
59 return true;
60}
61
62#ifdef CONFIG_64BIT
63typedef u64 jump_label_t;
64#else
65typedef u32 jump_label_t;
66#endif
67
68struct jump_entry {
69 jump_label_t code;
70 jump_label_t target;
71 jump_label_t key;
72};
73
74#endif /* __ASSEMBLY__ */
75#endif /* _ASM_MIPS_JUMP_LABEL_H */
diff --git a/arch/mips/include/asm/kdebug.h b/arch/mips/include/asm/kdebug.h
new file mode 100644
index 000000000..a55a207cf
--- /dev/null
+++ b/arch/mips/include/asm/kdebug.h
@@ -0,0 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_MIPS_KDEBUG_H
3#define _ASM_MIPS_KDEBUG_H
4
5#include <linux/notifier.h>
6
7enum die_val {
8 DIE_OOPS = 1,
9 DIE_FP,
10 DIE_TRAP,
11 DIE_RI,
12 DIE_PAGE_FAULT,
13 DIE_BREAK,
14 DIE_SSTEPBP,
15 DIE_MSAFP,
16 DIE_UPROBE,
17 DIE_UPROBE_XOL,
18};
19
20#endif /* _ASM_MIPS_KDEBUG_H */
diff --git a/arch/mips/include/asm/kexec.h b/arch/mips/include/asm/kexec.h
new file mode 100644
index 000000000..d6d5fa5cc
--- /dev/null
+++ b/arch/mips/include/asm/kexec.h
@@ -0,0 +1,51 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * kexec.h for kexec
4 * Created by <nschichan@corp.free.fr> on Thu Oct 12 14:59:34 2006
5 */
6
7#ifndef _MIPS_KEXEC
8# define _MIPS_KEXEC
9
10#include <asm/stacktrace.h>
11
12/* Maximum physical address we can use pages from */
13#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
14/* Maximum address we can reach in physical address mode */
15#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
16 /* Maximum address we can use for the control code buffer */
17#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
18/* Reserve 3*4096 bytes for board-specific info */
19#define KEXEC_CONTROL_PAGE_SIZE (4096 + 3*4096)
20
21/* The native architecture */
22#define KEXEC_ARCH KEXEC_ARCH_MIPS
23#define MAX_NOTE_BYTES 1024
24
25static inline void crash_setup_regs(struct pt_regs *newregs,
26 struct pt_regs *oldregs)
27{
28 if (oldregs)
29 memcpy(newregs, oldregs, sizeof(*newregs));
30 else
31 prepare_frametrace(newregs);
32}
33
34#ifdef CONFIG_KEXEC
35struct kimage;
36extern unsigned long kexec_args[4];
37extern int (*_machine_kexec_prepare)(struct kimage *);
38extern void (*_machine_kexec_shutdown)(void);
39extern void (*_machine_crash_shutdown)(struct pt_regs *regs);
40void default_machine_crash_shutdown(struct pt_regs *regs);
41void kexec_nonboot_cpu_jump(void);
42void kexec_reboot(void);
43#ifdef CONFIG_SMP
44extern const unsigned char kexec_smp_wait[];
45extern unsigned long secondary_kexec_args[4];
46extern atomic_t kexec_ready_to_reboot;
47extern void (*_crash_smp_send_stop)(void);
48#endif
49#endif
50
51#endif /* !_MIPS_KEXEC */
diff --git a/arch/mips/include/asm/kgdb.h b/arch/mips/include/asm/kgdb.h
new file mode 100644
index 000000000..4f2302267
--- /dev/null
+++ b/arch/mips/include/asm/kgdb.h
@@ -0,0 +1,45 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_KGDB_H_
3#define __ASM_KGDB_H_
4
5#ifdef __KERNEL__
6
7#include <asm/sgidefs.h>
8
9#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
10 (_MIPS_ISA == _MIPS_ISA_MIPS32)
11
12#define KGDB_GDB_REG_SIZE 32
13#define GDB_SIZEOF_REG sizeof(u32)
14
15#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
16 (_MIPS_ISA == _MIPS_ISA_MIPS64)
17
18#ifdef CONFIG_32BIT
19#define KGDB_GDB_REG_SIZE 32
20#define GDB_SIZEOF_REG sizeof(u32)
21#else /* CONFIG_CPU_32BIT */
22#define KGDB_GDB_REG_SIZE 64
23#define GDB_SIZEOF_REG sizeof(u64)
24#endif
25#else
26#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA"
27#endif /* _MIPS_ISA */
28
29#define BUFMAX 2048
30#define DBG_MAX_REG_NUM 72
31#define NUMREGBYTES (DBG_MAX_REG_NUM * sizeof(GDB_SIZEOF_REG))
32#define NUMCRITREGBYTES (12 * sizeof(GDB_SIZEOF_REG))
33#define BREAK_INSTR_SIZE 4
34#define CACHE_FLUSH_IS_SAFE 0
35
36extern void arch_kgdb_breakpoint(void);
37extern void *saved_vectors[32];
38extern void handle_exception(struct pt_regs *regs);
39extern void breakinst(void);
40extern int kgdb_ll_trap(int cmd, const char *str,
41 struct pt_regs *regs, long err, int trap, int sig);
42
43#endif /* __KERNEL__ */
44
45#endif /* __ASM_KGDB_H_ */
diff --git a/arch/mips/include/asm/kmap_types.h b/arch/mips/include/asm/kmap_types.h
new file mode 100644
index 000000000..16665dc24
--- /dev/null
+++ b/arch/mips/include/asm/kmap_types.h
@@ -0,0 +1,13 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_KMAP_TYPES_H
3#define _ASM_KMAP_TYPES_H
4
5#ifdef CONFIG_DEBUG_HIGHMEM
6#define __WITH_KM_FENCE
7#endif
8
9#include <asm-generic/kmap_types.h>
10
11#undef __WITH_KM_FENCE
12
13#endif
diff --git a/arch/mips/include/asm/kprobes.h b/arch/mips/include/asm/kprobes.h
new file mode 100644
index 000000000..68b1e5d45
--- /dev/null
+++ b/arch/mips/include/asm/kprobes.h
@@ -0,0 +1,78 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Kernel Probes (KProbes)
4 * include/asm-mips/kprobes.h
5 *
6 * Copyright 2006 Sony Corp.
7 * Copyright 2010 Cavium Networks
8 */
9
10#ifndef _ASM_KPROBES_H
11#define _ASM_KPROBES_H
12
13#include <asm-generic/kprobes.h>
14
15#ifdef CONFIG_KPROBES
16#include <linux/ptrace.h>
17#include <linux/types.h>
18
19#include <asm/cacheflush.h>
20#include <asm/kdebug.h>
21#include <asm/inst.h>
22
23#define __ARCH_WANT_KPROBES_INSN_SLOT
24
25struct kprobe;
26struct pt_regs;
27
28typedef union mips_instruction kprobe_opcode_t;
29
30#define MAX_INSN_SIZE 2
31
32#define flush_insn_slot(p) \
33do { \
34 if (p->addr) \
35 flush_icache_range((unsigned long)p->addr, \
36 (unsigned long)p->addr + \
37 (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \
38} while (0)
39
40
41#define kretprobe_blacklist_size 0
42
43void arch_remove_kprobe(struct kprobe *p);
44int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
45
46/* Architecture specific copy of original instruction*/
47struct arch_specific_insn {
48 /* copy of the original instruction */
49 kprobe_opcode_t *insn;
50};
51
52struct prev_kprobe {
53 struct kprobe *kp;
54 unsigned long status;
55 unsigned long old_SR;
56 unsigned long saved_SR;
57 unsigned long saved_epc;
58};
59
60#define SKIP_DELAYSLOT 0x0001
61
62/* per-cpu kprobe control block */
63struct kprobe_ctlblk {
64 unsigned long kprobe_status;
65 unsigned long kprobe_old_SR;
66 unsigned long kprobe_saved_SR;
67 unsigned long kprobe_saved_epc;
68 /* Per-thread fields, used while emulating branches */
69 unsigned long flags;
70 unsigned long target_epc;
71 struct prev_kprobe prev_kprobe;
72};
73
74extern int kprobe_exceptions_notify(struct notifier_block *self,
75 unsigned long val, void *data);
76
77#endif /* CONFIG_KPROBES */
78#endif /* _ASM_KPROBES_H */
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
new file mode 100644
index 000000000..24f3d0f99
--- /dev/null
+++ b/arch/mips/include/asm/kvm_host.h
@@ -0,0 +1,1158 @@
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) 2012 MIPS Technologies, Inc. All rights reserved.
7* Authors: Sanjay Lal <sanjayl@kymasys.com>
8*/
9
10#ifndef __MIPS_KVM_HOST_H__
11#define __MIPS_KVM_HOST_H__
12
13#include <linux/cpumask.h>
14#include <linux/mutex.h>
15#include <linux/hrtimer.h>
16#include <linux/interrupt.h>
17#include <linux/types.h>
18#include <linux/kvm.h>
19#include <linux/kvm_types.h>
20#include <linux/threads.h>
21#include <linux/spinlock.h>
22
23#include <asm/inst.h>
24#include <asm/mipsregs.h>
25
26#include <kvm/iodev.h>
27
28/* MIPS KVM register ids */
29#define MIPS_CP0_32(_R, _S) \
30 (KVM_REG_MIPS_CP0 | KVM_REG_SIZE_U32 | (8 * (_R) + (_S)))
31
32#define MIPS_CP0_64(_R, _S) \
33 (KVM_REG_MIPS_CP0 | KVM_REG_SIZE_U64 | (8 * (_R) + (_S)))
34
35#define KVM_REG_MIPS_CP0_INDEX MIPS_CP0_32(0, 0)
36#define KVM_REG_MIPS_CP0_ENTRYLO0 MIPS_CP0_64(2, 0)
37#define KVM_REG_MIPS_CP0_ENTRYLO1 MIPS_CP0_64(3, 0)
38#define KVM_REG_MIPS_CP0_CONTEXT MIPS_CP0_64(4, 0)
39#define KVM_REG_MIPS_CP0_CONTEXTCONFIG MIPS_CP0_32(4, 1)
40#define KVM_REG_MIPS_CP0_USERLOCAL MIPS_CP0_64(4, 2)
41#define KVM_REG_MIPS_CP0_XCONTEXTCONFIG MIPS_CP0_64(4, 3)
42#define KVM_REG_MIPS_CP0_PAGEMASK MIPS_CP0_32(5, 0)
43#define KVM_REG_MIPS_CP0_PAGEGRAIN MIPS_CP0_32(5, 1)
44#define KVM_REG_MIPS_CP0_SEGCTL0 MIPS_CP0_64(5, 2)
45#define KVM_REG_MIPS_CP0_SEGCTL1 MIPS_CP0_64(5, 3)
46#define KVM_REG_MIPS_CP0_SEGCTL2 MIPS_CP0_64(5, 4)
47#define KVM_REG_MIPS_CP0_PWBASE MIPS_CP0_64(5, 5)
48#define KVM_REG_MIPS_CP0_PWFIELD MIPS_CP0_64(5, 6)
49#define KVM_REG_MIPS_CP0_PWSIZE MIPS_CP0_64(5, 7)
50#define KVM_REG_MIPS_CP0_WIRED MIPS_CP0_32(6, 0)
51#define KVM_REG_MIPS_CP0_PWCTL MIPS_CP0_32(6, 6)
52#define KVM_REG_MIPS_CP0_HWRENA MIPS_CP0_32(7, 0)
53#define KVM_REG_MIPS_CP0_BADVADDR MIPS_CP0_64(8, 0)
54#define KVM_REG_MIPS_CP0_BADINSTR MIPS_CP0_32(8, 1)
55#define KVM_REG_MIPS_CP0_BADINSTRP MIPS_CP0_32(8, 2)
56#define KVM_REG_MIPS_CP0_COUNT MIPS_CP0_32(9, 0)
57#define KVM_REG_MIPS_CP0_ENTRYHI MIPS_CP0_64(10, 0)
58#define KVM_REG_MIPS_CP0_COMPARE MIPS_CP0_32(11, 0)
59#define KVM_REG_MIPS_CP0_STATUS MIPS_CP0_32(12, 0)
60#define KVM_REG_MIPS_CP0_INTCTL MIPS_CP0_32(12, 1)
61#define KVM_REG_MIPS_CP0_CAUSE MIPS_CP0_32(13, 0)
62#define KVM_REG_MIPS_CP0_EPC MIPS_CP0_64(14, 0)
63#define KVM_REG_MIPS_CP0_PRID MIPS_CP0_32(15, 0)
64#define KVM_REG_MIPS_CP0_EBASE MIPS_CP0_64(15, 1)
65#define KVM_REG_MIPS_CP0_CONFIG MIPS_CP0_32(16, 0)
66#define KVM_REG_MIPS_CP0_CONFIG1 MIPS_CP0_32(16, 1)
67#define KVM_REG_MIPS_CP0_CONFIG2 MIPS_CP0_32(16, 2)
68#define KVM_REG_MIPS_CP0_CONFIG3 MIPS_CP0_32(16, 3)
69#define KVM_REG_MIPS_CP0_CONFIG4 MIPS_CP0_32(16, 4)
70#define KVM_REG_MIPS_CP0_CONFIG5 MIPS_CP0_32(16, 5)
71#define KVM_REG_MIPS_CP0_CONFIG6 MIPS_CP0_32(16, 6)
72#define KVM_REG_MIPS_CP0_CONFIG7 MIPS_CP0_32(16, 7)
73#define KVM_REG_MIPS_CP0_MAARI MIPS_CP0_64(17, 2)
74#define KVM_REG_MIPS_CP0_XCONTEXT MIPS_CP0_64(20, 0)
75#define KVM_REG_MIPS_CP0_DIAG MIPS_CP0_32(22, 0)
76#define KVM_REG_MIPS_CP0_ERROREPC MIPS_CP0_64(30, 0)
77#define KVM_REG_MIPS_CP0_KSCRATCH1 MIPS_CP0_64(31, 2)
78#define KVM_REG_MIPS_CP0_KSCRATCH2 MIPS_CP0_64(31, 3)
79#define KVM_REG_MIPS_CP0_KSCRATCH3 MIPS_CP0_64(31, 4)
80#define KVM_REG_MIPS_CP0_KSCRATCH4 MIPS_CP0_64(31, 5)
81#define KVM_REG_MIPS_CP0_KSCRATCH5 MIPS_CP0_64(31, 6)
82#define KVM_REG_MIPS_CP0_KSCRATCH6 MIPS_CP0_64(31, 7)
83
84
85#define KVM_MAX_VCPUS 16
86#define KVM_USER_MEM_SLOTS 16
87/* memory slots that does not exposed to userspace */
88#define KVM_PRIVATE_MEM_SLOTS 0
89
90#define KVM_HALT_POLL_NS_DEFAULT 500000
91
92#ifdef CONFIG_KVM_MIPS_VZ
93extern unsigned long GUESTID_MASK;
94extern unsigned long GUESTID_FIRST_VERSION;
95extern unsigned long GUESTID_VERSION_MASK;
96#endif
97
98
99/*
100 * Special address that contains the comm page, used for reducing # of traps
101 * This needs to be within 32Kb of 0x0 (so the zero register can be used), but
102 * preferably not at 0x0 so that most kernel NULL pointer dereferences can be
103 * caught.
104 */
105#define KVM_GUEST_COMMPAGE_ADDR ((PAGE_SIZE > 0x8000) ? 0 : \
106 (0x8000 - PAGE_SIZE))
107
108#define KVM_GUEST_KERNEL_MODE(vcpu) ((kvm_read_c0_guest_status(vcpu->arch.cop0) & (ST0_EXL | ST0_ERL)) || \
109 ((kvm_read_c0_guest_status(vcpu->arch.cop0) & KSU_USER) == 0))
110
111#define KVM_GUEST_KUSEG 0x00000000UL
112#define KVM_GUEST_KSEG0 0x40000000UL
113#define KVM_GUEST_KSEG1 0x40000000UL
114#define KVM_GUEST_KSEG23 0x60000000UL
115#define KVM_GUEST_KSEGX(a) ((_ACAST32_(a)) & 0xe0000000)
116#define KVM_GUEST_CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
117
118#define KVM_GUEST_CKSEG0ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG0)
119#define KVM_GUEST_CKSEG1ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG1)
120#define KVM_GUEST_CKSEG23ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG23)
121
122/*
123 * Map an address to a certain kernel segment
124 */
125#define KVM_GUEST_KSEG0ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG0)
126#define KVM_GUEST_KSEG1ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG1)
127#define KVM_GUEST_KSEG23ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG23)
128
129#define KVM_INVALID_PAGE 0xdeadbeef
130#define KVM_INVALID_ADDR 0xdeadbeef
131
132/*
133 * EVA has overlapping user & kernel address spaces, so user VAs may be >
134 * PAGE_OFFSET. For this reason we can't use the default KVM_HVA_ERR_BAD of
135 * PAGE_OFFSET.
136 */
137
138#define KVM_HVA_ERR_BAD (-1UL)
139#define KVM_HVA_ERR_RO_BAD (-2UL)
140
141static inline bool kvm_is_error_hva(unsigned long addr)
142{
143 return IS_ERR_VALUE(addr);
144}
145
146struct kvm_vm_stat {
147 ulong remote_tlb_flush;
148};
149
150struct kvm_vcpu_stat {
151 u64 wait_exits;
152 u64 cache_exits;
153 u64 signal_exits;
154 u64 int_exits;
155 u64 cop_unusable_exits;
156 u64 tlbmod_exits;
157 u64 tlbmiss_ld_exits;
158 u64 tlbmiss_st_exits;
159 u64 addrerr_st_exits;
160 u64 addrerr_ld_exits;
161 u64 syscall_exits;
162 u64 resvd_inst_exits;
163 u64 break_inst_exits;
164 u64 trap_inst_exits;
165 u64 msa_fpe_exits;
166 u64 fpe_exits;
167 u64 msa_disabled_exits;
168 u64 flush_dcache_exits;
169#ifdef CONFIG_KVM_MIPS_VZ
170 u64 vz_gpsi_exits;
171 u64 vz_gsfc_exits;
172 u64 vz_hc_exits;
173 u64 vz_grr_exits;
174 u64 vz_gva_exits;
175 u64 vz_ghfc_exits;
176 u64 vz_gpa_exits;
177 u64 vz_resvd_exits;
178#ifdef CONFIG_CPU_LOONGSON64
179 u64 vz_cpucfg_exits;
180#endif
181#endif
182 u64 halt_successful_poll;
183 u64 halt_attempted_poll;
184 u64 halt_poll_success_ns;
185 u64 halt_poll_fail_ns;
186 u64 halt_poll_invalid;
187 u64 halt_wakeup;
188};
189
190struct kvm_arch_memory_slot {
191};
192
193#ifdef CONFIG_CPU_LOONGSON64
194struct ipi_state {
195 uint32_t status;
196 uint32_t en;
197 uint32_t set;
198 uint32_t clear;
199 uint64_t buf[4];
200};
201
202struct loongson_kvm_ipi;
203
204struct ipi_io_device {
205 int node_id;
206 struct loongson_kvm_ipi *ipi;
207 struct kvm_io_device device;
208};
209
210struct loongson_kvm_ipi {
211 spinlock_t lock;
212 struct kvm *kvm;
213 struct ipi_state ipistate[16];
214 struct ipi_io_device dev_ipi[4];
215};
216#endif
217
218struct kvm_arch {
219 /* Guest physical mm */
220 struct mm_struct gpa_mm;
221 /* Mask of CPUs needing GPA ASID flush */
222 cpumask_t asid_flush_mask;
223#ifdef CONFIG_CPU_LOONGSON64
224 struct loongson_kvm_ipi ipi;
225#endif
226};
227
228#define N_MIPS_COPROC_REGS 32
229#define N_MIPS_COPROC_SEL 8
230
231struct mips_coproc {
232 unsigned long reg[N_MIPS_COPROC_REGS][N_MIPS_COPROC_SEL];
233#ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS
234 unsigned long stat[N_MIPS_COPROC_REGS][N_MIPS_COPROC_SEL];
235#endif
236};
237
238/*
239 * Coprocessor 0 register names
240 */
241#define MIPS_CP0_TLB_INDEX 0
242#define MIPS_CP0_TLB_RANDOM 1
243#define MIPS_CP0_TLB_LOW 2
244#define MIPS_CP0_TLB_LO0 2
245#define MIPS_CP0_TLB_LO1 3
246#define MIPS_CP0_TLB_CONTEXT 4
247#define MIPS_CP0_TLB_PG_MASK 5
248#define MIPS_CP0_TLB_WIRED 6
249#define MIPS_CP0_HWRENA 7
250#define MIPS_CP0_BAD_VADDR 8
251#define MIPS_CP0_COUNT 9
252#define MIPS_CP0_TLB_HI 10
253#define MIPS_CP0_COMPARE 11
254#define MIPS_CP0_STATUS 12
255#define MIPS_CP0_CAUSE 13
256#define MIPS_CP0_EXC_PC 14
257#define MIPS_CP0_PRID 15
258#define MIPS_CP0_CONFIG 16
259#define MIPS_CP0_LLADDR 17
260#define MIPS_CP0_WATCH_LO 18
261#define MIPS_CP0_WATCH_HI 19
262#define MIPS_CP0_TLB_XCONTEXT 20
263#define MIPS_CP0_DIAG 22
264#define MIPS_CP0_ECC 26
265#define MIPS_CP0_CACHE_ERR 27
266#define MIPS_CP0_TAG_LO 28
267#define MIPS_CP0_TAG_HI 29
268#define MIPS_CP0_ERROR_PC 30
269#define MIPS_CP0_DEBUG 23
270#define MIPS_CP0_DEPC 24
271#define MIPS_CP0_PERFCNT 25
272#define MIPS_CP0_ERRCTL 26
273#define MIPS_CP0_DATA_LO 28
274#define MIPS_CP0_DATA_HI 29
275#define MIPS_CP0_DESAVE 31
276
277#define MIPS_CP0_CONFIG_SEL 0
278#define MIPS_CP0_CONFIG1_SEL 1
279#define MIPS_CP0_CONFIG2_SEL 2
280#define MIPS_CP0_CONFIG3_SEL 3
281#define MIPS_CP0_CONFIG4_SEL 4
282#define MIPS_CP0_CONFIG5_SEL 5
283
284#define MIPS_CP0_GUESTCTL2 10
285#define MIPS_CP0_GUESTCTL2_SEL 5
286#define MIPS_CP0_GTOFFSET 12
287#define MIPS_CP0_GTOFFSET_SEL 7
288
289/* Resume Flags */
290#define RESUME_FLAG_DR (1<<0) /* Reload guest nonvolatile state? */
291#define RESUME_FLAG_HOST (1<<1) /* Resume host? */
292
293#define RESUME_GUEST 0
294#define RESUME_GUEST_DR RESUME_FLAG_DR
295#define RESUME_HOST RESUME_FLAG_HOST
296
297enum emulation_result {
298 EMULATE_DONE, /* no further processing */
299 EMULATE_DO_MMIO, /* kvm_run filled with MMIO request */
300 EMULATE_FAIL, /* can't emulate this instruction */
301 EMULATE_WAIT, /* WAIT instruction */
302 EMULATE_PRIV_FAIL,
303 EMULATE_EXCEPT, /* A guest exception has been generated */
304 EMULATE_HYPERCALL, /* HYPCALL instruction */
305};
306
307#define mips3_paddr_to_tlbpfn(x) \
308 (((unsigned long)(x) >> MIPS3_PG_SHIFT) & MIPS3_PG_FRAME)
309#define mips3_tlbpfn_to_paddr(x) \
310 ((unsigned long)((x) & MIPS3_PG_FRAME) << MIPS3_PG_SHIFT)
311
312#define MIPS3_PG_SHIFT 6
313#define MIPS3_PG_FRAME 0x3fffffc0
314
315#if defined(CONFIG_64BIT)
316#define VPN2_MASK GENMASK(cpu_vmbits - 1, 13)
317#else
318#define VPN2_MASK 0xffffe000
319#endif
320#define KVM_ENTRYHI_ASID cpu_asid_mask(&boot_cpu_data)
321#define TLB_IS_GLOBAL(x) ((x).tlb_lo[0] & (x).tlb_lo[1] & ENTRYLO_G)
322#define TLB_VPN2(x) ((x).tlb_hi & VPN2_MASK)
323#define TLB_ASID(x) ((x).tlb_hi & KVM_ENTRYHI_ASID)
324#define TLB_LO_IDX(x, va) (((va) >> PAGE_SHIFT) & 1)
325#define TLB_IS_VALID(x, va) ((x).tlb_lo[TLB_LO_IDX(x, va)] & ENTRYLO_V)
326#define TLB_IS_DIRTY(x, va) ((x).tlb_lo[TLB_LO_IDX(x, va)] & ENTRYLO_D)
327#define TLB_HI_VPN2_HIT(x, y) ((TLB_VPN2(x) & ~(x).tlb_mask) == \
328 ((y) & VPN2_MASK & ~(x).tlb_mask))
329#define TLB_HI_ASID_HIT(x, y) (TLB_IS_GLOBAL(x) || \
330 TLB_ASID(x) == ((y) & KVM_ENTRYHI_ASID))
331
332struct kvm_mips_tlb {
333 long tlb_mask;
334 long tlb_hi;
335 long tlb_lo[2];
336};
337
338#define KVM_MIPS_AUX_FPU 0x1
339#define KVM_MIPS_AUX_MSA 0x2
340
341#define KVM_MIPS_GUEST_TLB_SIZE 64
342struct kvm_vcpu_arch {
343 void *guest_ebase;
344 int (*vcpu_run)(struct kvm_vcpu *vcpu);
345
346 /* Host registers preserved across guest mode execution */
347 unsigned long host_stack;
348 unsigned long host_gp;
349 unsigned long host_pgd;
350 unsigned long host_entryhi;
351
352 /* Host CP0 registers used when handling exits from guest */
353 unsigned long host_cp0_badvaddr;
354 unsigned long host_cp0_epc;
355 u32 host_cp0_cause;
356 u32 host_cp0_guestctl0;
357 u32 host_cp0_badinstr;
358 u32 host_cp0_badinstrp;
359
360 /* GPRS */
361 unsigned long gprs[32];
362 unsigned long hi;
363 unsigned long lo;
364 unsigned long pc;
365
366 /* FPU State */
367 struct mips_fpu_struct fpu;
368 /* Which auxiliary state is loaded (KVM_MIPS_AUX_*) */
369 unsigned int aux_inuse;
370
371 /* COP0 State */
372 struct mips_coproc *cop0;
373
374 /* Host KSEG0 address of the EI/DI offset */
375 void *kseg0_commpage;
376
377 /* Resume PC after MMIO completion */
378 unsigned long io_pc;
379 /* GPR used as IO source/target */
380 u32 io_gpr;
381
382 struct hrtimer comparecount_timer;
383 /* Count timer control KVM register */
384 u32 count_ctl;
385 /* Count bias from the raw time */
386 u32 count_bias;
387 /* Frequency of timer in Hz */
388 u32 count_hz;
389 /* Dynamic nanosecond bias (multiple of count_period) to avoid overflow */
390 s64 count_dyn_bias;
391 /* Resume time */
392 ktime_t count_resume;
393 /* Period of timer tick in ns */
394 u64 count_period;
395
396 /* Bitmask of exceptions that are pending */
397 unsigned long pending_exceptions;
398
399 /* Bitmask of pending exceptions to be cleared */
400 unsigned long pending_exceptions_clr;
401
402 /* S/W Based TLB for guest */
403 struct kvm_mips_tlb guest_tlb[KVM_MIPS_GUEST_TLB_SIZE];
404
405 /* Guest kernel/user [partial] mm */
406 struct mm_struct guest_kernel_mm, guest_user_mm;
407
408 /* Guest ASID of last user mode execution */
409 unsigned int last_user_gasid;
410
411 /* Cache some mmu pages needed inside spinlock regions */
412 struct kvm_mmu_memory_cache mmu_page_cache;
413
414#ifdef CONFIG_KVM_MIPS_VZ
415 /* vcpu's vzguestid is different on each host cpu in an smp system */
416 u32 vzguestid[NR_CPUS];
417
418 /* wired guest TLB entries */
419 struct kvm_mips_tlb *wired_tlb;
420 unsigned int wired_tlb_limit;
421 unsigned int wired_tlb_used;
422
423 /* emulated guest MAAR registers */
424 unsigned long maar[6];
425#endif
426
427 /* Last CPU the VCPU state was loaded on */
428 int last_sched_cpu;
429 /* Last CPU the VCPU actually executed guest code on */
430 int last_exec_cpu;
431
432 /* WAIT executed */
433 int wait;
434
435 u8 fpu_enabled;
436 u8 msa_enabled;
437};
438
439static inline void _kvm_atomic_set_c0_guest_reg(unsigned long *reg,
440 unsigned long val)
441{
442 unsigned long temp;
443 do {
444 __asm__ __volatile__(
445 " .set push \n"
446 " .set "MIPS_ISA_ARCH_LEVEL" \n"
447 " " __LL "%0, %1 \n"
448 " or %0, %2 \n"
449 " " __SC "%0, %1 \n"
450 " .set pop \n"
451 : "=&r" (temp), "+m" (*reg)
452 : "r" (val));
453 } while (unlikely(!temp));
454}
455
456static inline void _kvm_atomic_clear_c0_guest_reg(unsigned long *reg,
457 unsigned long val)
458{
459 unsigned long temp;
460 do {
461 __asm__ __volatile__(
462 " .set push \n"
463 " .set "MIPS_ISA_ARCH_LEVEL" \n"
464 " " __LL "%0, %1 \n"
465 " and %0, %2 \n"
466 " " __SC "%0, %1 \n"
467 " .set pop \n"
468 : "=&r" (temp), "+m" (*reg)
469 : "r" (~val));
470 } while (unlikely(!temp));
471}
472
473static inline void _kvm_atomic_change_c0_guest_reg(unsigned long *reg,
474 unsigned long change,
475 unsigned long val)
476{
477 unsigned long temp;
478 do {
479 __asm__ __volatile__(
480 " .set push \n"
481 " .set "MIPS_ISA_ARCH_LEVEL" \n"
482 " " __LL "%0, %1 \n"
483 " and %0, %2 \n"
484 " or %0, %3 \n"
485 " " __SC "%0, %1 \n"
486 " .set pop \n"
487 : "=&r" (temp), "+m" (*reg)
488 : "r" (~change), "r" (val & change));
489 } while (unlikely(!temp));
490}
491
492/* Guest register types, used in accessor build below */
493#define __KVMT32 u32
494#define __KVMTl unsigned long
495
496/*
497 * __BUILD_KVM_$ops_SAVED(): kvm_$op_sw_gc0_$reg()
498 * These operate on the saved guest C0 state in RAM.
499 */
500
501/* Generate saved context simple accessors */
502#define __BUILD_KVM_RW_SAVED(name, type, _reg, sel) \
503static inline __KVMT##type kvm_read_sw_gc0_##name(struct mips_coproc *cop0) \
504{ \
505 return cop0->reg[(_reg)][(sel)]; \
506} \
507static inline void kvm_write_sw_gc0_##name(struct mips_coproc *cop0, \
508 __KVMT##type val) \
509{ \
510 cop0->reg[(_reg)][(sel)] = val; \
511}
512
513/* Generate saved context bitwise modifiers */
514#define __BUILD_KVM_SET_SAVED(name, type, _reg, sel) \
515static inline void kvm_set_sw_gc0_##name(struct mips_coproc *cop0, \
516 __KVMT##type val) \
517{ \
518 cop0->reg[(_reg)][(sel)] |= val; \
519} \
520static inline void kvm_clear_sw_gc0_##name(struct mips_coproc *cop0, \
521 __KVMT##type val) \
522{ \
523 cop0->reg[(_reg)][(sel)] &= ~val; \
524} \
525static inline void kvm_change_sw_gc0_##name(struct mips_coproc *cop0, \
526 __KVMT##type mask, \
527 __KVMT##type val) \
528{ \
529 unsigned long _mask = mask; \
530 cop0->reg[(_reg)][(sel)] &= ~_mask; \
531 cop0->reg[(_reg)][(sel)] |= val & _mask; \
532}
533
534/* Generate saved context atomic bitwise modifiers */
535#define __BUILD_KVM_ATOMIC_SAVED(name, type, _reg, sel) \
536static inline void kvm_set_sw_gc0_##name(struct mips_coproc *cop0, \
537 __KVMT##type val) \
538{ \
539 _kvm_atomic_set_c0_guest_reg(&cop0->reg[(_reg)][(sel)], val); \
540} \
541static inline void kvm_clear_sw_gc0_##name(struct mips_coproc *cop0, \
542 __KVMT##type val) \
543{ \
544 _kvm_atomic_clear_c0_guest_reg(&cop0->reg[(_reg)][(sel)], val); \
545} \
546static inline void kvm_change_sw_gc0_##name(struct mips_coproc *cop0, \
547 __KVMT##type mask, \
548 __KVMT##type val) \
549{ \
550 _kvm_atomic_change_c0_guest_reg(&cop0->reg[(_reg)][(sel)], mask, \
551 val); \
552}
553
554/*
555 * __BUILD_KVM_$ops_VZ(): kvm_$op_vz_gc0_$reg()
556 * These operate on the VZ guest C0 context in hardware.
557 */
558
559/* Generate VZ guest context simple accessors */
560#define __BUILD_KVM_RW_VZ(name, type, _reg, sel) \
561static inline __KVMT##type kvm_read_vz_gc0_##name(struct mips_coproc *cop0) \
562{ \
563 return read_gc0_##name(); \
564} \
565static inline void kvm_write_vz_gc0_##name(struct mips_coproc *cop0, \
566 __KVMT##type val) \
567{ \
568 write_gc0_##name(val); \
569}
570
571/* Generate VZ guest context bitwise modifiers */
572#define __BUILD_KVM_SET_VZ(name, type, _reg, sel) \
573static inline void kvm_set_vz_gc0_##name(struct mips_coproc *cop0, \
574 __KVMT##type val) \
575{ \
576 set_gc0_##name(val); \
577} \
578static inline void kvm_clear_vz_gc0_##name(struct mips_coproc *cop0, \
579 __KVMT##type val) \
580{ \
581 clear_gc0_##name(val); \
582} \
583static inline void kvm_change_vz_gc0_##name(struct mips_coproc *cop0, \
584 __KVMT##type mask, \
585 __KVMT##type val) \
586{ \
587 change_gc0_##name(mask, val); \
588}
589
590/* Generate VZ guest context save/restore to/from saved context */
591#define __BUILD_KVM_SAVE_VZ(name, _reg, sel) \
592static inline void kvm_restore_gc0_##name(struct mips_coproc *cop0) \
593{ \
594 write_gc0_##name(cop0->reg[(_reg)][(sel)]); \
595} \
596static inline void kvm_save_gc0_##name(struct mips_coproc *cop0) \
597{ \
598 cop0->reg[(_reg)][(sel)] = read_gc0_##name(); \
599}
600
601/*
602 * __BUILD_KVM_$ops_WRAP(): kvm_$op_$name1() -> kvm_$op_$name2()
603 * These wrap a set of operations to provide them with a different name.
604 */
605
606/* Generate simple accessor wrapper */
607#define __BUILD_KVM_RW_WRAP(name1, name2, type) \
608static inline __KVMT##type kvm_read_##name1(struct mips_coproc *cop0) \
609{ \
610 return kvm_read_##name2(cop0); \
611} \
612static inline void kvm_write_##name1(struct mips_coproc *cop0, \
613 __KVMT##type val) \
614{ \
615 kvm_write_##name2(cop0, val); \
616}
617
618/* Generate bitwise modifier wrapper */
619#define __BUILD_KVM_SET_WRAP(name1, name2, type) \
620static inline void kvm_set_##name1(struct mips_coproc *cop0, \
621 __KVMT##type val) \
622{ \
623 kvm_set_##name2(cop0, val); \
624} \
625static inline void kvm_clear_##name1(struct mips_coproc *cop0, \
626 __KVMT##type val) \
627{ \
628 kvm_clear_##name2(cop0, val); \
629} \
630static inline void kvm_change_##name1(struct mips_coproc *cop0, \
631 __KVMT##type mask, \
632 __KVMT##type val) \
633{ \
634 kvm_change_##name2(cop0, mask, val); \
635}
636
637/*
638 * __BUILD_KVM_$ops_SW(): kvm_$op_c0_guest_$reg() -> kvm_$op_sw_gc0_$reg()
639 * These generate accessors operating on the saved context in RAM, and wrap them
640 * with the common guest C0 accessors (for use by common emulation code).
641 */
642
643#define __BUILD_KVM_RW_SW(name, type, _reg, sel) \
644 __BUILD_KVM_RW_SAVED(name, type, _reg, sel) \
645 __BUILD_KVM_RW_WRAP(c0_guest_##name, sw_gc0_##name, type)
646
647#define __BUILD_KVM_SET_SW(name, type, _reg, sel) \
648 __BUILD_KVM_SET_SAVED(name, type, _reg, sel) \
649 __BUILD_KVM_SET_WRAP(c0_guest_##name, sw_gc0_##name, type)
650
651#define __BUILD_KVM_ATOMIC_SW(name, type, _reg, sel) \
652 __BUILD_KVM_ATOMIC_SAVED(name, type, _reg, sel) \
653 __BUILD_KVM_SET_WRAP(c0_guest_##name, sw_gc0_##name, type)
654
655#ifndef CONFIG_KVM_MIPS_VZ
656
657/*
658 * T&E (trap & emulate software based virtualisation)
659 * We generate the common accessors operating exclusively on the saved context
660 * in RAM.
661 */
662
663#define __BUILD_KVM_RW_HW __BUILD_KVM_RW_SW
664#define __BUILD_KVM_SET_HW __BUILD_KVM_SET_SW
665#define __BUILD_KVM_ATOMIC_HW __BUILD_KVM_ATOMIC_SW
666
667#else
668
669/*
670 * VZ (hardware assisted virtualisation)
671 * These macros use the active guest state in VZ mode (hardware registers),
672 */
673
674/*
675 * __BUILD_KVM_$ops_HW(): kvm_$op_c0_guest_$reg() -> kvm_$op_vz_gc0_$reg()
676 * These generate accessors operating on the VZ guest context in hardware, and
677 * wrap them with the common guest C0 accessors (for use by common emulation
678 * code).
679 *
680 * Accessors operating on the saved context in RAM are also generated to allow
681 * convenient explicit saving and restoring of the state.
682 */
683
684#define __BUILD_KVM_RW_HW(name, type, _reg, sel) \
685 __BUILD_KVM_RW_SAVED(name, type, _reg, sel) \
686 __BUILD_KVM_RW_VZ(name, type, _reg, sel) \
687 __BUILD_KVM_RW_WRAP(c0_guest_##name, vz_gc0_##name, type) \
688 __BUILD_KVM_SAVE_VZ(name, _reg, sel)
689
690#define __BUILD_KVM_SET_HW(name, type, _reg, sel) \
691 __BUILD_KVM_SET_SAVED(name, type, _reg, sel) \
692 __BUILD_KVM_SET_VZ(name, type, _reg, sel) \
693 __BUILD_KVM_SET_WRAP(c0_guest_##name, vz_gc0_##name, type)
694
695/*
696 * We can't do atomic modifications of COP0 state if hardware can modify it.
697 * Races must be handled explicitly.
698 */
699#define __BUILD_KVM_ATOMIC_HW __BUILD_KVM_SET_HW
700
701#endif
702
703/*
704 * Define accessors for CP0 registers that are accessible to the guest. These
705 * are primarily used by common emulation code, which may need to access the
706 * registers differently depending on the implementation.
707 *
708 * fns_hw/sw name type reg num select
709 */
710__BUILD_KVM_RW_HW(index, 32, MIPS_CP0_TLB_INDEX, 0)
711__BUILD_KVM_RW_HW(entrylo0, l, MIPS_CP0_TLB_LO0, 0)
712__BUILD_KVM_RW_HW(entrylo1, l, MIPS_CP0_TLB_LO1, 0)
713__BUILD_KVM_RW_HW(context, l, MIPS_CP0_TLB_CONTEXT, 0)
714__BUILD_KVM_RW_HW(contextconfig, 32, MIPS_CP0_TLB_CONTEXT, 1)
715__BUILD_KVM_RW_HW(userlocal, l, MIPS_CP0_TLB_CONTEXT, 2)
716__BUILD_KVM_RW_HW(xcontextconfig, l, MIPS_CP0_TLB_CONTEXT, 3)
717__BUILD_KVM_RW_HW(pagemask, l, MIPS_CP0_TLB_PG_MASK, 0)
718__BUILD_KVM_RW_HW(pagegrain, 32, MIPS_CP0_TLB_PG_MASK, 1)
719__BUILD_KVM_RW_HW(segctl0, l, MIPS_CP0_TLB_PG_MASK, 2)
720__BUILD_KVM_RW_HW(segctl1, l, MIPS_CP0_TLB_PG_MASK, 3)
721__BUILD_KVM_RW_HW(segctl2, l, MIPS_CP0_TLB_PG_MASK, 4)
722__BUILD_KVM_RW_HW(pwbase, l, MIPS_CP0_TLB_PG_MASK, 5)
723__BUILD_KVM_RW_HW(pwfield, l, MIPS_CP0_TLB_PG_MASK, 6)
724__BUILD_KVM_RW_HW(pwsize, l, MIPS_CP0_TLB_PG_MASK, 7)
725__BUILD_KVM_RW_HW(wired, 32, MIPS_CP0_TLB_WIRED, 0)
726__BUILD_KVM_RW_HW(pwctl, 32, MIPS_CP0_TLB_WIRED, 6)
727__BUILD_KVM_RW_HW(hwrena, 32, MIPS_CP0_HWRENA, 0)
728__BUILD_KVM_RW_HW(badvaddr, l, MIPS_CP0_BAD_VADDR, 0)
729__BUILD_KVM_RW_HW(badinstr, 32, MIPS_CP0_BAD_VADDR, 1)
730__BUILD_KVM_RW_HW(badinstrp, 32, MIPS_CP0_BAD_VADDR, 2)
731__BUILD_KVM_RW_SW(count, 32, MIPS_CP0_COUNT, 0)
732__BUILD_KVM_RW_HW(entryhi, l, MIPS_CP0_TLB_HI, 0)
733__BUILD_KVM_RW_HW(compare, 32, MIPS_CP0_COMPARE, 0)
734__BUILD_KVM_RW_HW(status, 32, MIPS_CP0_STATUS, 0)
735__BUILD_KVM_RW_HW(intctl, 32, MIPS_CP0_STATUS, 1)
736__BUILD_KVM_RW_HW(cause, 32, MIPS_CP0_CAUSE, 0)
737__BUILD_KVM_RW_HW(epc, l, MIPS_CP0_EXC_PC, 0)
738__BUILD_KVM_RW_SW(prid, 32, MIPS_CP0_PRID, 0)
739__BUILD_KVM_RW_HW(ebase, l, MIPS_CP0_PRID, 1)
740__BUILD_KVM_RW_HW(config, 32, MIPS_CP0_CONFIG, 0)
741__BUILD_KVM_RW_HW(config1, 32, MIPS_CP0_CONFIG, 1)
742__BUILD_KVM_RW_HW(config2, 32, MIPS_CP0_CONFIG, 2)
743__BUILD_KVM_RW_HW(config3, 32, MIPS_CP0_CONFIG, 3)
744__BUILD_KVM_RW_HW(config4, 32, MIPS_CP0_CONFIG, 4)
745__BUILD_KVM_RW_HW(config5, 32, MIPS_CP0_CONFIG, 5)
746__BUILD_KVM_RW_HW(config6, 32, MIPS_CP0_CONFIG, 6)
747__BUILD_KVM_RW_HW(config7, 32, MIPS_CP0_CONFIG, 7)
748__BUILD_KVM_RW_SW(maari, l, MIPS_CP0_LLADDR, 2)
749__BUILD_KVM_RW_HW(xcontext, l, MIPS_CP0_TLB_XCONTEXT, 0)
750__BUILD_KVM_RW_HW(errorepc, l, MIPS_CP0_ERROR_PC, 0)
751__BUILD_KVM_RW_HW(kscratch1, l, MIPS_CP0_DESAVE, 2)
752__BUILD_KVM_RW_HW(kscratch2, l, MIPS_CP0_DESAVE, 3)
753__BUILD_KVM_RW_HW(kscratch3, l, MIPS_CP0_DESAVE, 4)
754__BUILD_KVM_RW_HW(kscratch4, l, MIPS_CP0_DESAVE, 5)
755__BUILD_KVM_RW_HW(kscratch5, l, MIPS_CP0_DESAVE, 6)
756__BUILD_KVM_RW_HW(kscratch6, l, MIPS_CP0_DESAVE, 7)
757
758/* Bitwise operations (on HW state) */
759__BUILD_KVM_SET_HW(status, 32, MIPS_CP0_STATUS, 0)
760/* Cause can be modified asynchronously from hardirq hrtimer callback */
761__BUILD_KVM_ATOMIC_HW(cause, 32, MIPS_CP0_CAUSE, 0)
762__BUILD_KVM_SET_HW(ebase, l, MIPS_CP0_PRID, 1)
763
764/* Bitwise operations (on saved state) */
765__BUILD_KVM_SET_SAVED(config, 32, MIPS_CP0_CONFIG, 0)
766__BUILD_KVM_SET_SAVED(config1, 32, MIPS_CP0_CONFIG, 1)
767__BUILD_KVM_SET_SAVED(config2, 32, MIPS_CP0_CONFIG, 2)
768__BUILD_KVM_SET_SAVED(config3, 32, MIPS_CP0_CONFIG, 3)
769__BUILD_KVM_SET_SAVED(config4, 32, MIPS_CP0_CONFIG, 4)
770__BUILD_KVM_SET_SAVED(config5, 32, MIPS_CP0_CONFIG, 5)
771
772/* Helpers */
773
774static inline bool kvm_mips_guest_can_have_fpu(struct kvm_vcpu_arch *vcpu)
775{
776 return (!__builtin_constant_p(raw_cpu_has_fpu) || raw_cpu_has_fpu) &&
777 vcpu->fpu_enabled;
778}
779
780static inline bool kvm_mips_guest_has_fpu(struct kvm_vcpu_arch *vcpu)
781{
782 return kvm_mips_guest_can_have_fpu(vcpu) &&
783 kvm_read_c0_guest_config1(vcpu->cop0) & MIPS_CONF1_FP;
784}
785
786static inline bool kvm_mips_guest_can_have_msa(struct kvm_vcpu_arch *vcpu)
787{
788 return (!__builtin_constant_p(cpu_has_msa) || cpu_has_msa) &&
789 vcpu->msa_enabled;
790}
791
792static inline bool kvm_mips_guest_has_msa(struct kvm_vcpu_arch *vcpu)
793{
794 return kvm_mips_guest_can_have_msa(vcpu) &&
795 kvm_read_c0_guest_config3(vcpu->cop0) & MIPS_CONF3_MSA;
796}
797
798struct kvm_mips_callbacks {
799 int (*handle_cop_unusable)(struct kvm_vcpu *vcpu);
800 int (*handle_tlb_mod)(struct kvm_vcpu *vcpu);
801 int (*handle_tlb_ld_miss)(struct kvm_vcpu *vcpu);
802 int (*handle_tlb_st_miss)(struct kvm_vcpu *vcpu);
803 int (*handle_addr_err_st)(struct kvm_vcpu *vcpu);
804 int (*handle_addr_err_ld)(struct kvm_vcpu *vcpu);
805 int (*handle_syscall)(struct kvm_vcpu *vcpu);
806 int (*handle_res_inst)(struct kvm_vcpu *vcpu);
807 int (*handle_break)(struct kvm_vcpu *vcpu);
808 int (*handle_trap)(struct kvm_vcpu *vcpu);
809 int (*handle_msa_fpe)(struct kvm_vcpu *vcpu);
810 int (*handle_fpe)(struct kvm_vcpu *vcpu);
811 int (*handle_msa_disabled)(struct kvm_vcpu *vcpu);
812 int (*handle_guest_exit)(struct kvm_vcpu *vcpu);
813 int (*hardware_enable)(void);
814 void (*hardware_disable)(void);
815 int (*check_extension)(struct kvm *kvm, long ext);
816 int (*vcpu_init)(struct kvm_vcpu *vcpu);
817 void (*vcpu_uninit)(struct kvm_vcpu *vcpu);
818 int (*vcpu_setup)(struct kvm_vcpu *vcpu);
819 void (*flush_shadow_all)(struct kvm *kvm);
820 /*
821 * Must take care of flushing any cached GPA PTEs (e.g. guest entries in
822 * VZ root TLB, or T&E GVA page tables and corresponding root TLB
823 * mappings).
824 */
825 void (*flush_shadow_memslot)(struct kvm *kvm,
826 const struct kvm_memory_slot *slot);
827 gpa_t (*gva_to_gpa)(gva_t gva);
828 void (*queue_timer_int)(struct kvm_vcpu *vcpu);
829 void (*dequeue_timer_int)(struct kvm_vcpu *vcpu);
830 void (*queue_io_int)(struct kvm_vcpu *vcpu,
831 struct kvm_mips_interrupt *irq);
832 void (*dequeue_io_int)(struct kvm_vcpu *vcpu,
833 struct kvm_mips_interrupt *irq);
834 int (*irq_deliver)(struct kvm_vcpu *vcpu, unsigned int priority,
835 u32 cause);
836 int (*irq_clear)(struct kvm_vcpu *vcpu, unsigned int priority,
837 u32 cause);
838 unsigned long (*num_regs)(struct kvm_vcpu *vcpu);
839 int (*copy_reg_indices)(struct kvm_vcpu *vcpu, u64 __user *indices);
840 int (*get_one_reg)(struct kvm_vcpu *vcpu,
841 const struct kvm_one_reg *reg, s64 *v);
842 int (*set_one_reg)(struct kvm_vcpu *vcpu,
843 const struct kvm_one_reg *reg, s64 v);
844 int (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
845 int (*vcpu_put)(struct kvm_vcpu *vcpu, int cpu);
846 int (*vcpu_run)(struct kvm_vcpu *vcpu);
847 void (*vcpu_reenter)(struct kvm_vcpu *vcpu);
848};
849extern struct kvm_mips_callbacks *kvm_mips_callbacks;
850int kvm_mips_emulation_init(struct kvm_mips_callbacks **install_callbacks);
851
852/* Debug: dump vcpu state */
853int kvm_arch_vcpu_dump_regs(struct kvm_vcpu *vcpu);
854
855extern int kvm_mips_handle_exit(struct kvm_vcpu *vcpu);
856
857/* Building of entry/exception code */
858int kvm_mips_entry_setup(void);
859void *kvm_mips_build_vcpu_run(void *addr);
860void *kvm_mips_build_tlb_refill_exception(void *addr, void *handler);
861void *kvm_mips_build_exception(void *addr, void *handler);
862void *kvm_mips_build_exit(void *addr);
863
864/* FPU/MSA context management */
865void __kvm_save_fpu(struct kvm_vcpu_arch *vcpu);
866void __kvm_restore_fpu(struct kvm_vcpu_arch *vcpu);
867void __kvm_restore_fcsr(struct kvm_vcpu_arch *vcpu);
868void __kvm_save_msa(struct kvm_vcpu_arch *vcpu);
869void __kvm_restore_msa(struct kvm_vcpu_arch *vcpu);
870void __kvm_restore_msa_upper(struct kvm_vcpu_arch *vcpu);
871void __kvm_restore_msacsr(struct kvm_vcpu_arch *vcpu);
872void kvm_own_fpu(struct kvm_vcpu *vcpu);
873void kvm_own_msa(struct kvm_vcpu *vcpu);
874void kvm_drop_fpu(struct kvm_vcpu *vcpu);
875void kvm_lose_fpu(struct kvm_vcpu *vcpu);
876
877/* TLB handling */
878u32 kvm_get_kernel_asid(struct kvm_vcpu *vcpu);
879
880u32 kvm_get_user_asid(struct kvm_vcpu *vcpu);
881
882u32 kvm_get_commpage_asid (struct kvm_vcpu *vcpu);
883
884#ifdef CONFIG_KVM_MIPS_VZ
885int kvm_mips_handle_vz_root_tlb_fault(unsigned long badvaddr,
886 struct kvm_vcpu *vcpu, bool write_fault);
887#endif
888extern int kvm_mips_handle_kseg0_tlb_fault(unsigned long badbaddr,
889 struct kvm_vcpu *vcpu,
890 bool write_fault);
891
892extern int kvm_mips_handle_commpage_tlb_fault(unsigned long badvaddr,
893 struct kvm_vcpu *vcpu);
894
895extern int kvm_mips_handle_mapped_seg_tlb_fault(struct kvm_vcpu *vcpu,
896 struct kvm_mips_tlb *tlb,
897 unsigned long gva,
898 bool write_fault);
899
900extern enum emulation_result kvm_mips_handle_tlbmiss(u32 cause,
901 u32 *opc,
902 struct kvm_vcpu *vcpu,
903 bool write_fault);
904
905extern void kvm_mips_dump_host_tlbs(void);
906extern void kvm_mips_dump_guest_tlbs(struct kvm_vcpu *vcpu);
907extern int kvm_mips_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long entryhi,
908 bool user, bool kernel);
909
910extern int kvm_mips_guest_tlb_lookup(struct kvm_vcpu *vcpu,
911 unsigned long entryhi);
912
913#ifdef CONFIG_KVM_MIPS_VZ
914int kvm_vz_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long entryhi);
915int kvm_vz_guest_tlb_lookup(struct kvm_vcpu *vcpu, unsigned long gva,
916 unsigned long *gpa);
917void kvm_vz_local_flush_roottlb_all_guests(void);
918void kvm_vz_local_flush_guesttlb_all(void);
919void kvm_vz_save_guesttlb(struct kvm_mips_tlb *buf, unsigned int index,
920 unsigned int count);
921void kvm_vz_load_guesttlb(const struct kvm_mips_tlb *buf, unsigned int index,
922 unsigned int count);
923#ifdef CONFIG_CPU_LOONGSON64
924void kvm_loongson_clear_guest_vtlb(void);
925void kvm_loongson_clear_guest_ftlb(void);
926#endif
927#endif
928
929void kvm_mips_suspend_mm(int cpu);
930void kvm_mips_resume_mm(int cpu);
931
932/* MMU handling */
933
934/**
935 * enum kvm_mips_flush - Types of MMU flushes.
936 * @KMF_USER: Flush guest user virtual memory mappings.
937 * Guest USeg only.
938 * @KMF_KERN: Flush guest kernel virtual memory mappings.
939 * Guest USeg and KSeg2/3.
940 * @KMF_GPA: Flush guest physical memory mappings.
941 * Also includes KSeg0 if KMF_KERN is set.
942 */
943enum kvm_mips_flush {
944 KMF_USER = 0x0,
945 KMF_KERN = 0x1,
946 KMF_GPA = 0x2,
947};
948void kvm_mips_flush_gva_pt(pgd_t *pgd, enum kvm_mips_flush flags);
949bool kvm_mips_flush_gpa_pt(struct kvm *kvm, gfn_t start_gfn, gfn_t end_gfn);
950int kvm_mips_mkclean_gpa_pt(struct kvm *kvm, gfn_t start_gfn, gfn_t end_gfn);
951pgd_t *kvm_pgd_alloc(void);
952void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu);
953void kvm_trap_emul_invalidate_gva(struct kvm_vcpu *vcpu, unsigned long addr,
954 bool user);
955void kvm_trap_emul_gva_lockless_begin(struct kvm_vcpu *vcpu);
956void kvm_trap_emul_gva_lockless_end(struct kvm_vcpu *vcpu);
957
958enum kvm_mips_fault_result {
959 KVM_MIPS_MAPPED = 0,
960 KVM_MIPS_GVA,
961 KVM_MIPS_GPA,
962 KVM_MIPS_TLB,
963 KVM_MIPS_TLBINV,
964 KVM_MIPS_TLBMOD,
965};
966enum kvm_mips_fault_result kvm_trap_emul_gva_fault(struct kvm_vcpu *vcpu,
967 unsigned long gva,
968 bool write);
969
970#define KVM_ARCH_WANT_MMU_NOTIFIER
971int kvm_unmap_hva_range(struct kvm *kvm,
972 unsigned long start, unsigned long end, unsigned flags);
973int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
974int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
975int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
976
977/* Emulation */
978int kvm_get_inst(u32 *opc, struct kvm_vcpu *vcpu, u32 *out);
979enum emulation_result update_pc(struct kvm_vcpu *vcpu, u32 cause);
980int kvm_get_badinstr(u32 *opc, struct kvm_vcpu *vcpu, u32 *out);
981int kvm_get_badinstrp(u32 *opc, struct kvm_vcpu *vcpu, u32 *out);
982
983/**
984 * kvm_is_ifetch_fault() - Find whether a TLBL exception is due to ifetch fault.
985 * @vcpu: Virtual CPU.
986 *
987 * Returns: Whether the TLBL exception was likely due to an instruction
988 * fetch fault rather than a data load fault.
989 */
990static inline bool kvm_is_ifetch_fault(struct kvm_vcpu_arch *vcpu)
991{
992 unsigned long badvaddr = vcpu->host_cp0_badvaddr;
993 unsigned long epc = msk_isa16_mode(vcpu->pc);
994 u32 cause = vcpu->host_cp0_cause;
995
996 if (epc == badvaddr)
997 return true;
998
999 /*
1000 * Branches may be 32-bit or 16-bit instructions.
1001 * This isn't exact, but we don't really support MIPS16 or microMIPS yet
1002 * in KVM anyway.
1003 */
1004 if ((cause & CAUSEF_BD) && badvaddr - epc <= 4)
1005 return true;
1006
1007 return false;
1008}
1009
1010extern enum emulation_result kvm_mips_emulate_inst(u32 cause,
1011 u32 *opc,
1012 struct kvm_vcpu *vcpu);
1013
1014long kvm_mips_guest_exception_base(struct kvm_vcpu *vcpu);
1015
1016extern enum emulation_result kvm_mips_emulate_syscall(u32 cause,
1017 u32 *opc,
1018 struct kvm_vcpu *vcpu);
1019
1020extern enum emulation_result kvm_mips_emulate_tlbmiss_ld(u32 cause,
1021 u32 *opc,
1022 struct kvm_vcpu *vcpu);
1023
1024extern enum emulation_result kvm_mips_emulate_tlbinv_ld(u32 cause,
1025 u32 *opc,
1026 struct kvm_vcpu *vcpu);
1027
1028extern enum emulation_result kvm_mips_emulate_tlbmiss_st(u32 cause,
1029 u32 *opc,
1030 struct kvm_vcpu *vcpu);
1031
1032extern enum emulation_result kvm_mips_emulate_tlbinv_st(u32 cause,
1033 u32 *opc,
1034 struct kvm_vcpu *vcpu);
1035
1036extern enum emulation_result kvm_mips_emulate_tlbmod(u32 cause,
1037 u32 *opc,
1038 struct kvm_vcpu *vcpu);
1039
1040extern enum emulation_result kvm_mips_emulate_fpu_exc(u32 cause,
1041 u32 *opc,
1042 struct kvm_vcpu *vcpu);
1043
1044extern enum emulation_result kvm_mips_handle_ri(u32 cause,
1045 u32 *opc,
1046 struct kvm_vcpu *vcpu);
1047
1048extern enum emulation_result kvm_mips_emulate_ri_exc(u32 cause,
1049 u32 *opc,
1050 struct kvm_vcpu *vcpu);
1051
1052extern enum emulation_result kvm_mips_emulate_bp_exc(u32 cause,
1053 u32 *opc,
1054 struct kvm_vcpu *vcpu);
1055
1056extern enum emulation_result kvm_mips_emulate_trap_exc(u32 cause,
1057 u32 *opc,
1058 struct kvm_vcpu *vcpu);
1059
1060extern enum emulation_result kvm_mips_emulate_msafpe_exc(u32 cause,
1061 u32 *opc,
1062 struct kvm_vcpu *vcpu);
1063
1064extern enum emulation_result kvm_mips_emulate_fpe_exc(u32 cause,
1065 u32 *opc,
1066 struct kvm_vcpu *vcpu);
1067
1068extern enum emulation_result kvm_mips_emulate_msadis_exc(u32 cause,
1069 u32 *opc,
1070 struct kvm_vcpu *vcpu);
1071
1072extern enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu);
1073
1074u32 kvm_mips_read_count(struct kvm_vcpu *vcpu);
1075void kvm_mips_write_count(struct kvm_vcpu *vcpu, u32 count);
1076void kvm_mips_write_compare(struct kvm_vcpu *vcpu, u32 compare, bool ack);
1077void kvm_mips_init_count(struct kvm_vcpu *vcpu, unsigned long count_hz);
1078int kvm_mips_set_count_ctl(struct kvm_vcpu *vcpu, s64 count_ctl);
1079int kvm_mips_set_count_resume(struct kvm_vcpu *vcpu, s64 count_resume);
1080int kvm_mips_set_count_hz(struct kvm_vcpu *vcpu, s64 count_hz);
1081void kvm_mips_count_enable_cause(struct kvm_vcpu *vcpu);
1082void kvm_mips_count_disable_cause(struct kvm_vcpu *vcpu);
1083enum hrtimer_restart kvm_mips_count_timeout(struct kvm_vcpu *vcpu);
1084
1085/* fairly internal functions requiring some care to use */
1086int kvm_mips_count_disabled(struct kvm_vcpu *vcpu);
1087ktime_t kvm_mips_freeze_hrtimer(struct kvm_vcpu *vcpu, u32 *count);
1088int kvm_mips_restore_hrtimer(struct kvm_vcpu *vcpu, ktime_t before,
1089 u32 count, int min_drift);
1090
1091#ifdef CONFIG_KVM_MIPS_VZ
1092void kvm_vz_acquire_htimer(struct kvm_vcpu *vcpu);
1093void kvm_vz_lose_htimer(struct kvm_vcpu *vcpu);
1094#else
1095static inline void kvm_vz_acquire_htimer(struct kvm_vcpu *vcpu) {}
1096static inline void kvm_vz_lose_htimer(struct kvm_vcpu *vcpu) {}
1097#endif
1098
1099enum emulation_result kvm_mips_check_privilege(u32 cause,
1100 u32 *opc,
1101 struct kvm_vcpu *vcpu);
1102
1103enum emulation_result kvm_mips_emulate_cache(union mips_instruction inst,
1104 u32 *opc,
1105 u32 cause,
1106 struct kvm_vcpu *vcpu);
1107enum emulation_result kvm_mips_emulate_CP0(union mips_instruction inst,
1108 u32 *opc,
1109 u32 cause,
1110 struct kvm_vcpu *vcpu);
1111enum emulation_result kvm_mips_emulate_store(union mips_instruction inst,
1112 u32 cause,
1113 struct kvm_vcpu *vcpu);
1114enum emulation_result kvm_mips_emulate_load(union mips_instruction inst,
1115 u32 cause,
1116 struct kvm_vcpu *vcpu);
1117
1118/* COP0 */
1119enum emulation_result kvm_mips_emul_wait(struct kvm_vcpu *vcpu);
1120
1121unsigned int kvm_mips_config1_wrmask(struct kvm_vcpu *vcpu);
1122unsigned int kvm_mips_config3_wrmask(struct kvm_vcpu *vcpu);
1123unsigned int kvm_mips_config4_wrmask(struct kvm_vcpu *vcpu);
1124unsigned int kvm_mips_config5_wrmask(struct kvm_vcpu *vcpu);
1125
1126/* Hypercalls (hypcall.c) */
1127
1128enum emulation_result kvm_mips_emul_hypcall(struct kvm_vcpu *vcpu,
1129 union mips_instruction inst);
1130int kvm_mips_handle_hypcall(struct kvm_vcpu *vcpu);
1131
1132/* Dynamic binary translation */
1133extern int kvm_mips_trans_cache_index(union mips_instruction inst,
1134 u32 *opc, struct kvm_vcpu *vcpu);
1135extern int kvm_mips_trans_cache_va(union mips_instruction inst, u32 *opc,
1136 struct kvm_vcpu *vcpu);
1137extern int kvm_mips_trans_mfc0(union mips_instruction inst, u32 *opc,
1138 struct kvm_vcpu *vcpu);
1139extern int kvm_mips_trans_mtc0(union mips_instruction inst, u32 *opc,
1140 struct kvm_vcpu *vcpu);
1141
1142/* Misc */
1143extern void kvm_mips_dump_stats(struct kvm_vcpu *vcpu);
1144extern unsigned long kvm_mips_get_ramsize(struct kvm *kvm);
1145extern int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
1146 struct kvm_mips_interrupt *irq);
1147
1148static inline void kvm_arch_hardware_unsetup(void) {}
1149static inline void kvm_arch_sync_events(struct kvm *kvm) {}
1150static inline void kvm_arch_free_memslot(struct kvm *kvm,
1151 struct kvm_memory_slot *slot) {}
1152static inline void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen) {}
1153static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
1154static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {}
1155static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
1156static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {}
1157
1158#endif /* __MIPS_KVM_HOST_H__ */
diff --git a/arch/mips/include/asm/kvm_types.h b/arch/mips/include/asm/kvm_types.h
new file mode 100644
index 000000000..213754d9e
--- /dev/null
+++ b/arch/mips/include/asm/kvm_types.h
@@ -0,0 +1,7 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_MIPS_KVM_TYPES_H
3#define _ASM_MIPS_KVM_TYPES_H
4
5#define KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE 4
6
7#endif /* _ASM_MIPS_KVM_TYPES_H */
diff --git a/arch/mips/include/asm/linkage.h b/arch/mips/include/asm/linkage.h
new file mode 100644
index 000000000..1829c2b6d
--- /dev/null
+++ b/arch/mips/include/asm/linkage.h
@@ -0,0 +1,13 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_LINKAGE_H
3#define __ASM_LINKAGE_H
4
5#ifdef __ASSEMBLY__
6#include <asm/asm.h>
7#endif
8
9#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
10#define SYSCALL_ALIAS(alias, name) \
11 asm ( #alias " = " #name "\n\t.globl " #alias)
12
13#endif
diff --git a/arch/mips/include/asm/llsc.h b/arch/mips/include/asm/llsc.h
new file mode 100644
index 000000000..ec09fe5d6
--- /dev/null
+++ b/arch/mips/include/asm/llsc.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 * Macros for 32/64-bit neutral inline assembler
7 */
8
9#ifndef __ASM_LLSC_H
10#define __ASM_LLSC_H
11
12#include <asm/isa-rev.h>
13
14#if _MIPS_SZLONG == 32
15#define __LL "ll "
16#define __SC "sc "
17#define __INS "ins "
18#define __EXT "ext "
19#elif _MIPS_SZLONG == 64
20#define __LL "lld "
21#define __SC "scd "
22#define __INS "dins "
23#define __EXT "dext "
24#endif
25
26/*
27 * Using a branch-likely instruction to check the result of an sc instruction
28 * works around a bug present in R10000 CPUs prior to revision 3.0 that could
29 * cause ll-sc sequences to execute non-atomically.
30 */
31#ifdef CONFIG_WAR_R10000_LLSC
32# define __SC_BEQZ "beqzl "
33#elif MIPS_ISA_REV >= 6
34# define __SC_BEQZ "beqzc "
35#else
36# define __SC_BEQZ "beqz "
37#endif
38
39#endif /* __ASM_LLSC_H */
diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
new file mode 100644
index 000000000..ecda7295d
--- /dev/null
+++ b/arch/mips/include/asm/local.h
@@ -0,0 +1,206 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ARCH_MIPS_LOCAL_H
3#define _ARCH_MIPS_LOCAL_H
4
5#include <linux/percpu.h>
6#include <linux/bitops.h>
7#include <linux/atomic.h>
8#include <asm/cmpxchg.h>
9#include <asm/compiler.h>
10#include <asm/war.h>
11
12typedef struct
13{
14 atomic_long_t a;
15} local_t;
16
17#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
18
19#define local_read(l) atomic_long_read(&(l)->a)
20#define local_set(l, i) atomic_long_set(&(l)->a, (i))
21
22#define local_add(i, l) atomic_long_add((i), (&(l)->a))
23#define local_sub(i, l) atomic_long_sub((i), (&(l)->a))
24#define local_inc(l) atomic_long_inc(&(l)->a)
25#define local_dec(l) atomic_long_dec(&(l)->a)
26
27/*
28 * Same as above, but return the result value
29 */
30static __inline__ long local_add_return(long i, local_t * l)
31{
32 unsigned long result;
33
34 if (kernel_uses_llsc && IS_ENABLED(CONFIG_WAR_R10000_LLSC)) {
35 unsigned long temp;
36
37 __asm__ __volatile__(
38 " .set push \n"
39 " .set arch=r4000 \n"
40 __SYNC(full, loongson3_war) " \n"
41 "1:" __LL "%1, %2 # local_add_return \n"
42 " addu %0, %1, %3 \n"
43 __SC "%0, %2 \n"
44 " beqzl %0, 1b \n"
45 " addu %0, %1, %3 \n"
46 " .set pop \n"
47 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
48 : "Ir" (i), "m" (l->a.counter)
49 : "memory");
50 } else if (kernel_uses_llsc) {
51 unsigned long temp;
52
53 __asm__ __volatile__(
54 " .set push \n"
55 " .set "MIPS_ISA_ARCH_LEVEL" \n"
56 __SYNC(full, loongson3_war) " \n"
57 "1:" __LL "%1, %2 # local_add_return \n"
58 " addu %0, %1, %3 \n"
59 __SC "%0, %2 \n"
60 " beqz %0, 1b \n"
61 " addu %0, %1, %3 \n"
62 " .set pop \n"
63 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
64 : "Ir" (i), "m" (l->a.counter)
65 : "memory");
66 } else {
67 unsigned long flags;
68
69 local_irq_save(flags);
70 result = l->a.counter;
71 result += i;
72 l->a.counter = result;
73 local_irq_restore(flags);
74 }
75
76 return result;
77}
78
79static __inline__ long local_sub_return(long i, local_t * l)
80{
81 unsigned long result;
82
83 if (kernel_uses_llsc && IS_ENABLED(CONFIG_WAR_R10000_LLSC)) {
84 unsigned long temp;
85
86 __asm__ __volatile__(
87 " .set push \n"
88 " .set arch=r4000 \n"
89 __SYNC(full, loongson3_war) " \n"
90 "1:" __LL "%1, %2 # local_sub_return \n"
91 " subu %0, %1, %3 \n"
92 __SC "%0, %2 \n"
93 " beqzl %0, 1b \n"
94 " subu %0, %1, %3 \n"
95 " .set pop \n"
96 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
97 : "Ir" (i), "m" (l->a.counter)
98 : "memory");
99 } else if (kernel_uses_llsc) {
100 unsigned long temp;
101
102 __asm__ __volatile__(
103 " .set push \n"
104 " .set "MIPS_ISA_ARCH_LEVEL" \n"
105 __SYNC(full, loongson3_war) " \n"
106 "1:" __LL "%1, %2 # local_sub_return \n"
107 " subu %0, %1, %3 \n"
108 __SC "%0, %2 \n"
109 " beqz %0, 1b \n"
110 " subu %0, %1, %3 \n"
111 " .set pop \n"
112 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
113 : "Ir" (i), "m" (l->a.counter)
114 : "memory");
115 } else {
116 unsigned long flags;
117
118 local_irq_save(flags);
119 result = l->a.counter;
120 result -= i;
121 l->a.counter = result;
122 local_irq_restore(flags);
123 }
124
125 return result;
126}
127
128#define local_cmpxchg(l, o, n) \
129 ((long)cmpxchg_local(&((l)->a.counter), (o), (n)))
130#define local_xchg(l, n) (atomic_long_xchg((&(l)->a), (n)))
131
132/**
133 * local_add_unless - add unless the number is a given value
134 * @l: pointer of type local_t
135 * @a: the amount to add to l...
136 * @u: ...unless l is equal to u.
137 *
138 * Atomically adds @a to @l, so long as it was not @u.
139 * Returns non-zero if @l was not @u, and zero otherwise.
140 */
141#define local_add_unless(l, a, u) \
142({ \
143 long c, old; \
144 c = local_read(l); \
145 while (c != (u) && (old = local_cmpxchg((l), c, c + (a))) != c) \
146 c = old; \
147 c != (u); \
148})
149#define local_inc_not_zero(l) local_add_unless((l), 1, 0)
150
151#define local_dec_return(l) local_sub_return(1, (l))
152#define local_inc_return(l) local_add_return(1, (l))
153
154/*
155 * local_sub_and_test - subtract value from variable and test result
156 * @i: integer value to subtract
157 * @l: pointer of type local_t
158 *
159 * Atomically subtracts @i from @l and returns
160 * true if the result is zero, or false for all
161 * other cases.
162 */
163#define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0)
164
165/*
166 * local_inc_and_test - increment and test
167 * @l: pointer of type local_t
168 *
169 * Atomically increments @l by 1
170 * and returns true if the result is zero, or false for all
171 * other cases.
172 */
173#define local_inc_and_test(l) (local_inc_return(l) == 0)
174
175/*
176 * local_dec_and_test - decrement by 1 and test
177 * @l: pointer of type local_t
178 *
179 * Atomically decrements @l by 1 and
180 * returns true if the result is 0, or false for all other
181 * cases.
182 */
183#define local_dec_and_test(l) (local_sub_return(1, (l)) == 0)
184
185/*
186 * local_add_negative - add and test if negative
187 * @l: pointer of type local_t
188 * @i: integer value to add
189 *
190 * Atomically adds @i to @l and returns true
191 * if the result is negative, or false when
192 * result is greater than or equal to zero.
193 */
194#define local_add_negative(i, l) (local_add_return(i, (l)) < 0)
195
196/* Use these for per-cpu local_t variables: on some archs they are
197 * much more efficient than these naive implementations. Note they take
198 * a variable, not an address.
199 */
200
201#define __local_inc(l) ((l)->a.counter++)
202#define __local_dec(l) ((l)->a.counter++)
203#define __local_add(i, l) ((l)->a.counter+=(i))
204#define __local_sub(i, l) ((l)->a.counter-=(i))
205
206#endif /* _ARCH_MIPS_LOCAL_H */
diff --git a/arch/mips/include/asm/maar.h b/arch/mips/include/asm/maar.h
new file mode 100644
index 000000000..99f1c3e4b
--- /dev/null
+++ b/arch/mips/include/asm/maar.h
@@ -0,0 +1,127 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2014 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_MIPS_MAAR_H__
8#define __MIPS_ASM_MIPS_MAAR_H__
9
10#include <asm/hazards.h>
11#include <asm/mipsregs.h>
12
13/**
14 * platform_maar_init() - perform platform-level MAAR configuration
15 * @num_pairs: The number of MAAR pairs present in the system.
16 *
17 * Platforms should implement this function such that it configures as many
18 * MAAR pairs as required, from 0 up to the maximum of num_pairs-1, and returns
19 * the number that were used. Any further MAARs will be configured to be
20 * invalid. The default implementation of this function will simply indicate
21 * that it has configured 0 MAAR pairs.
22 *
23 * Return: The number of MAAR pairs configured.
24 */
25unsigned platform_maar_init(unsigned num_pairs);
26
27/**
28 * write_maar_pair() - write to a pair of MAARs
29 * @idx: The index of the pair (ie. use MAARs idx*2 & (idx*2)+1).
30 * @lower: The lowest address that the MAAR pair will affect. Must be
31 * aligned to a 2^16 byte boundary.
32 * @upper: The highest address that the MAAR pair will affect. Must be
33 * aligned to one byte before a 2^16 byte boundary.
34 * @attrs: The accessibility attributes to program, eg. MIPS_MAAR_S. The
35 * MIPS_MAAR_VL/MIPS_MAAR_VH attributes will automatically be set.
36 *
37 * Program the pair of MAAR registers specified by idx to apply the attributes
38 * specified by attrs to the range of addresses from lower to higher.
39 */
40static inline void write_maar_pair(unsigned idx, phys_addr_t lower,
41 phys_addr_t upper, unsigned attrs)
42{
43 /* Addresses begin at bit 16, but are shifted right 4 bits */
44 BUG_ON(lower & (0xffff | ~(MIPS_MAAR_ADDR << 4)));
45 BUG_ON(((upper & 0xffff) != 0xffff)
46 || ((upper & ~0xffffull) & ~(MIPS_MAAR_ADDR << 4)));
47
48 /* Automatically set MIPS_MAAR_VL */
49 attrs |= MIPS_MAAR_VL;
50
51 /*
52 * Write the upper address & attributes (both MIPS_MAAR_VL and
53 * MIPS_MAAR_VH matter)
54 */
55 write_c0_maari(idx << 1);
56 back_to_back_c0_hazard();
57 write_c0_maar(((upper >> 4) & MIPS_MAAR_ADDR) | attrs);
58 back_to_back_c0_hazard();
59#ifdef CONFIG_XPA
60 upper >>= MIPS_MAARX_ADDR_SHIFT;
61 writex_c0_maar(((upper >> 4) & MIPS_MAARX_ADDR) | MIPS_MAARX_VH);
62 back_to_back_c0_hazard();
63#endif
64
65 /* Write the lower address & attributes */
66 write_c0_maari((idx << 1) | 0x1);
67 back_to_back_c0_hazard();
68 write_c0_maar((lower >> 4) | attrs);
69 back_to_back_c0_hazard();
70#ifdef CONFIG_XPA
71 lower >>= MIPS_MAARX_ADDR_SHIFT;
72 writex_c0_maar(((lower >> 4) & MIPS_MAARX_ADDR) | MIPS_MAARX_VH);
73 back_to_back_c0_hazard();
74#endif
75}
76
77/**
78 * maar_init() - initialise MAARs
79 *
80 * Performs initialisation of MAARs for the current CPU, making use of the
81 * platforms implementation of platform_maar_init where necessary and
82 * duplicating the setup it provides on secondary CPUs.
83 */
84extern void maar_init(void);
85
86/**
87 * struct maar_config - MAAR configuration data
88 * @lower: The lowest address that the MAAR pair will affect. Must be
89 * aligned to a 2^16 byte boundary.
90 * @upper: The highest address that the MAAR pair will affect. Must be
91 * aligned to one byte before a 2^16 byte boundary.
92 * @attrs: The accessibility attributes to program, eg. MIPS_MAAR_S. The
93 * MIPS_MAAR_VL attribute will automatically be set.
94 *
95 * Describes the configuration of a pair of Memory Accessibility Attribute
96 * Registers - applying attributes from attrs to the range of physical
97 * addresses from lower to upper inclusive.
98 */
99struct maar_config {
100 phys_addr_t lower;
101 phys_addr_t upper;
102 unsigned attrs;
103};
104
105/**
106 * maar_config() - configure MAARs according to provided data
107 * @cfg: Pointer to an array of struct maar_config.
108 * @num_cfg: The number of structs in the cfg array.
109 * @num_pairs: The number of MAAR pairs present in the system.
110 *
111 * Configures as many MAARs as are present and specified in the cfg
112 * array with the values taken from the cfg array.
113 *
114 * Return: The number of MAAR pairs configured.
115 */
116static inline unsigned maar_config(const struct maar_config *cfg,
117 unsigned num_cfg, unsigned num_pairs)
118{
119 unsigned i;
120
121 for (i = 0; i < min(num_cfg, num_pairs); i++)
122 write_maar_pair(i, cfg[i].lower, cfg[i].upper, cfg[i].attrs);
123
124 return i;
125}
126
127#endif /* __MIPS_ASM_MIPS_MAAR_H__ */
diff --git a/arch/mips/include/asm/mach-ar7/ar7.h b/arch/mips/include/asm/mach-ar7/ar7.h
new file mode 100644
index 000000000..dd09c3bf0
--- /dev/null
+++ b/arch/mips/include/asm/mach-ar7/ar7.h
@@ -0,0 +1,197 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2006,2007 Felix Fietkau <nbd@openwrt.org>
4 * Copyright (C) 2006,2007 Eugene Konev <ejka@openwrt.org>
5 */
6
7#ifndef __AR7_H__
8#define __AR7_H__
9
10#include <linux/delay.h>
11#include <linux/io.h>
12#include <linux/errno.h>
13
14#include <asm/addrspace.h>
15
16#define AR7_SDRAM_BASE 0x14000000
17
18#define AR7_REGS_BASE 0x08610000
19
20#define AR7_REGS_MAC0 (AR7_REGS_BASE + 0x0000)
21#define AR7_REGS_GPIO (AR7_REGS_BASE + 0x0900)
22/* 0x08610A00 - 0x08610BFF (512 bytes, 128 bytes / clock) */
23#define AR7_REGS_POWER (AR7_REGS_BASE + 0x0a00)
24#define AR7_REGS_CLOCKS (AR7_REGS_POWER + 0x80)
25#define UR8_REGS_CLOCKS (AR7_REGS_POWER + 0x20)
26#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00)
27#define AR7_REGS_USB (AR7_REGS_BASE + 0x1200)
28#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600)
29#define AR7_REGS_PINSEL (AR7_REGS_BASE + 0x160C)
30#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
31#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00)
32#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00)
33#define AR7_REGS_MDIO (AR7_REGS_BASE + 0x1e00)
34#define AR7_REGS_IRQ (AR7_REGS_BASE + 0x2400)
35#define AR7_REGS_MAC1 (AR7_REGS_BASE + 0x2800)
36
37#define AR7_REGS_WDT (AR7_REGS_BASE + 0x1f00)
38#define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00)
39#define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00)
40
41/* Titan registers */
42#define TITAN_REGS_ESWITCH_BASE (0x08640000)
43#define TITAN_REGS_MAC0 (TITAN_REGS_ESWITCH_BASE)
44#define TITAN_REGS_MAC1 (TITAN_REGS_ESWITCH_BASE + 0x0800)
45#define TITAN_REGS_MDIO (TITAN_REGS_ESWITCH_BASE + 0x02000)
46#define TITAN_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1c00)
47#define TITAN_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1300)
48
49#define AR7_RESET_PERIPHERAL 0x0
50#define AR7_RESET_SOFTWARE 0x4
51#define AR7_RESET_STATUS 0x8
52
53#define AR7_RESET_BIT_CPMAC_LO 17
54#define AR7_RESET_BIT_CPMAC_HI 21
55#define AR7_RESET_BIT_MDIO 22
56#define AR7_RESET_BIT_EPHY 26
57
58#define TITAN_RESET_BIT_EPHY1 28
59
60/* GPIO control registers */
61#define AR7_GPIO_INPUT 0x0
62#define AR7_GPIO_OUTPUT 0x4
63#define AR7_GPIO_DIR 0x8
64#define AR7_GPIO_ENABLE 0xc
65#define TITAN_GPIO_INPUT_0 0x0
66#define TITAN_GPIO_INPUT_1 0x4
67#define TITAN_GPIO_OUTPUT_0 0x8
68#define TITAN_GPIO_OUTPUT_1 0xc
69#define TITAN_GPIO_DIR_0 0x10
70#define TITAN_GPIO_DIR_1 0x14
71#define TITAN_GPIO_ENBL_0 0x18
72#define TITAN_GPIO_ENBL_1 0x1c
73
74#define AR7_CHIP_7100 0x18
75#define AR7_CHIP_7200 0x2b
76#define AR7_CHIP_7300 0x05
77#define AR7_CHIP_TITAN 0x07
78#define TITAN_CHIP_1050 0x0f
79#define TITAN_CHIP_1055 0x0e
80#define TITAN_CHIP_1056 0x0d
81#define TITAN_CHIP_1060 0x07
82
83/* Interrupts */
84#define AR7_IRQ_UART0 15
85#define AR7_IRQ_UART1 16
86
87/* Clocks */
88#define AR7_AFE_CLOCK 35328000
89#define AR7_REF_CLOCK 25000000
90#define AR7_XTAL_CLOCK 24000000
91
92/* DCL */
93#define AR7_WDT_HW_ENA 0x10
94
95struct plat_cpmac_data {
96 int reset_bit;
97 int power_bit;
98 u32 phy_mask;
99 char dev_addr[6];
100};
101
102struct plat_dsl_data {
103 int reset_bit_dsl;
104 int reset_bit_sar;
105};
106
107extern int ar7_cpu_clock, ar7_bus_clock, ar7_dsp_clock;
108
109static inline int ar7_is_titan(void)
110{
111 return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x24)) & 0xffff) ==
112 AR7_CHIP_TITAN;
113}
114
115static inline u16 ar7_chip_id(void)
116{
117 return ar7_is_titan() ? AR7_CHIP_TITAN : (readl((void *)
118 KSEG1ADDR(AR7_REGS_GPIO + 0x14)) & 0xffff);
119}
120
121static inline u16 titan_chip_id(void)
122{
123 unsigned int val = readl((void *)KSEG1ADDR(AR7_REGS_GPIO +
124 TITAN_GPIO_INPUT_1));
125 return ((val >> 12) & 0x0f);
126}
127
128static inline u8 ar7_chip_rev(void)
129{
130 return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + (ar7_is_titan() ? 0x24 :
131 0x14))) >> 16) & 0xff;
132}
133
134struct clk {
135 unsigned int rate;
136};
137
138static inline int ar7_has_high_cpmac(void)
139{
140 u16 chip_id = ar7_chip_id();
141 switch (chip_id) {
142 case AR7_CHIP_7100:
143 case AR7_CHIP_7200:
144 return 0;
145 case AR7_CHIP_7300:
146 return 1;
147 default:
148 return -ENXIO;
149 }
150}
151#define ar7_has_high_vlynq ar7_has_high_cpmac
152#define ar7_has_second_uart ar7_has_high_cpmac
153
154static inline void ar7_device_enable(u32 bit)
155{
156 void *reset_reg =
157 (void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PERIPHERAL);
158 writel(readl(reset_reg) | (1 << bit), reset_reg);
159 msleep(20);
160}
161
162static inline void ar7_device_disable(u32 bit)
163{
164 void *reset_reg =
165 (void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PERIPHERAL);
166 writel(readl(reset_reg) & ~(1 << bit), reset_reg);
167 msleep(20);
168}
169
170static inline void ar7_device_reset(u32 bit)
171{
172 ar7_device_disable(bit);
173 ar7_device_enable(bit);
174}
175
176static inline void ar7_device_on(u32 bit)
177{
178 void *power_reg = (void *)KSEG1ADDR(AR7_REGS_POWER);
179 writel(readl(power_reg) | (1 << bit), power_reg);
180 msleep(20);
181}
182
183static inline void ar7_device_off(u32 bit)
184{
185 void *power_reg = (void *)KSEG1ADDR(AR7_REGS_POWER);
186 writel(readl(power_reg) & ~(1 << bit), power_reg);
187 msleep(20);
188}
189
190int __init ar7_gpio_init(void);
191void __init ar7_init_clocks(void);
192
193/* Board specific GPIO functions */
194int ar7_gpio_enable(unsigned gpio);
195int ar7_gpio_disable(unsigned gpio);
196
197#endif /* __AR7_H__ */
diff --git a/arch/mips/include/asm/mach-ar7/irq.h b/arch/mips/include/asm/mach-ar7/irq.h
new file mode 100644
index 000000000..46bb730ea
--- /dev/null
+++ b/arch/mips/include/asm/mach-ar7/irq.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 * Shamelessly copied from asm-mips/mach-emma2rh/
7 * Copyright (C) 2003 by Ralf Baechle
8 */
9#ifndef __ASM_AR7_IRQ_H
10#define __ASM_AR7_IRQ_H
11
12#define NR_IRQS 256
13
14#include <asm/mach-generic/irq.h>
15
16#endif /* __ASM_AR7_IRQ_H */
diff --git a/arch/mips/include/asm/mach-ar7/prom.h b/arch/mips/include/asm/mach-ar7/prom.h
new file mode 100644
index 000000000..9e1d20b06
--- /dev/null
+++ b/arch/mips/include/asm/mach-ar7/prom.h
@@ -0,0 +1,12 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2006, 2007 Florian Fainelli <florian@openwrt.org>
4 */
5
6#ifndef __PROM_H__
7#define __PROM_H__
8
9extern char *prom_getenv(const char *name);
10extern void prom_meminit(void);
11
12#endif /* __PROM_H__ */
diff --git a/arch/mips/include/asm/mach-ar7/spaces.h b/arch/mips/include/asm/mach-ar7/spaces.h
new file mode 100644
index 000000000..a004d94df
--- /dev/null
+++ b/arch/mips/include/asm/mach-ar7/spaces.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) 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_AR7_SPACES_H
11#define _ASM_AR7_SPACES_H
12
13/*
14 * This handles the memory map.
15 * We handle pages at KSEG0 for kernels with 32 bit address space.
16 */
17#define PAGE_OFFSET _AC(0x94000000, UL)
18#define PHYS_OFFSET _AC(0x14000000, UL)
19
20#include <asm/mach-generic/spaces.h>
21
22#endif /* __ASM_AR7_SPACES_H */
diff --git a/arch/mips/include/asm/mach-ath25/ath25_platform.h b/arch/mips/include/asm/mach-ath25/ath25_platform.h
new file mode 100644
index 000000000..0aacc55aa
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath25/ath25_platform.h
@@ -0,0 +1,74 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_ATH25_PLATFORM_H
3#define __ASM_MACH_ATH25_PLATFORM_H
4
5#include <linux/etherdevice.h>
6
7/*
8 * This is board-specific data that is stored in a "fixed" location in flash.
9 * It is shared across operating systems, so it should not be changed lightly.
10 * The main reason we need it is in order to extract the ethernet MAC
11 * address(es).
12 */
13struct ath25_boarddata {
14 u32 magic; /* board data is valid */
15#define ATH25_BD_MAGIC 0x35333131 /* "5311", for all 531x/231x platforms */
16 u16 cksum; /* checksum (starting with BD_REV 2) */
17 u16 rev; /* revision of this struct */
18#define BD_REV 4
19 char board_name[64]; /* Name of board */
20 u16 major; /* Board major number */
21 u16 minor; /* Board minor number */
22 u32 flags; /* Board configuration */
23#define BD_ENET0 0x00000001 /* ENET0 is stuffed */
24#define BD_ENET1 0x00000002 /* ENET1 is stuffed */
25#define BD_UART1 0x00000004 /* UART1 is stuffed */
26#define BD_UART0 0x00000008 /* UART0 is stuffed (dma) */
27#define BD_RSTFACTORY 0x00000010 /* Reset factory defaults stuffed */
28#define BD_SYSLED 0x00000020 /* System LED stuffed */
29#define BD_EXTUARTCLK 0x00000040 /* External UART clock */
30#define BD_CPUFREQ 0x00000080 /* cpu freq is valid in nvram */
31#define BD_SYSFREQ 0x00000100 /* sys freq is set in nvram */
32#define BD_WLAN0 0x00000200 /* Enable WLAN0 */
33#define BD_MEMCAP 0x00000400 /* CAP SDRAM @ mem_cap for testing */
34#define BD_DISWATCHDOG 0x00000800 /* disable system watchdog */
35#define BD_WLAN1 0x00001000 /* Enable WLAN1 (ar5212) */
36#define BD_ISCASPER 0x00002000 /* FLAG for AR2312 */
37#define BD_WLAN0_2G_EN 0x00004000 /* FLAG for radio0_2G */
38#define BD_WLAN0_5G_EN 0x00008000 /* FLAG for radio0_2G */
39#define BD_WLAN1_2G_EN 0x00020000 /* FLAG for radio0_2G */
40#define BD_WLAN1_5G_EN 0x00040000 /* FLAG for radio0_2G */
41 u16 reset_config_gpio; /* Reset factory GPIO pin */
42 u16 sys_led_gpio; /* System LED GPIO pin */
43
44 u32 cpu_freq; /* CPU core frequency in Hz */
45 u32 sys_freq; /* System frequency in Hz */
46 u32 cnt_freq; /* Calculated C0_COUNT frequency */
47
48 u8 wlan0_mac[ETH_ALEN];
49 u8 enet0_mac[ETH_ALEN];
50 u8 enet1_mac[ETH_ALEN];
51
52 u16 pci_id; /* Pseudo PCIID for common code */
53 u16 mem_cap; /* cap bank1 in MB */
54
55 /* version 3 */
56 u8 wlan1_mac[ETH_ALEN]; /* (ar5212) */
57};
58
59#define BOARD_CONFIG_BUFSZ 0x1000
60
61/*
62 * Platform device information for the Wireless MAC
63 */
64struct ar231x_board_config {
65 u16 devid;
66
67 /* board config data */
68 struct ath25_boarddata *config;
69
70 /* radio calibration data */
71 const char *radio;
72};
73
74#endif /* __ASM_MACH_ATH25_PLATFORM_H */
diff --git a/arch/mips/include/asm/mach-ath25/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ath25/cpu-feature-overrides.h
new file mode 100644
index 000000000..a54f20d95
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath25/cpu-feature-overrides.h
@@ -0,0 +1,60 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Atheros AR231x/AR531x SoC specific CPU feature overrides
4 *
5 * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
6 *
7 * This file was derived from: include/asm-mips/cpu-features.h
8 * Copyright (C) 2003, 2004 Ralf Baechle
9 * Copyright (C) 2004 Maciej W. Rozycki
10 */
11#ifndef __ASM_MACH_ATH25_CPU_FEATURE_OVERRIDES_H
12#define __ASM_MACH_ATH25_CPU_FEATURE_OVERRIDES_H
13
14/*
15 * The Atheros AR531x/AR231x SoCs have MIPS 4Kc/4KEc core.
16 */
17#define cpu_has_tlb 1
18#define cpu_has_4kex 1
19#define cpu_has_3k_cache 0
20#define cpu_has_4k_cache 1
21#define cpu_has_tx39_cache 0
22#define cpu_has_sb1_cache 0
23#define cpu_has_fpu 0
24#define cpu_has_32fpr 0
25#define cpu_has_counter 1
26#define cpu_has_ejtag 1
27
28#if !defined(CONFIG_SOC_AR5312)
29# define cpu_has_llsc 1
30#else
31/*
32 * The MIPS 4Kc V0.9 core in the AR5312/AR2312 have problems with the
33 * ll/sc instructions.
34 */
35# define cpu_has_llsc 0
36#endif
37
38#define cpu_has_mips16 0
39#define cpu_has_mips16e2 0
40#define cpu_has_mdmx 0
41#define cpu_has_mips3d 0
42#define cpu_has_smartmips 0
43
44#define cpu_has_mips32r1 1
45
46#if !defined(CONFIG_SOC_AR5312)
47# define cpu_has_mips32r2 1
48#endif
49
50#define cpu_has_mips64r1 0
51#define cpu_has_mips64r2 0
52
53#define cpu_has_dsp 0
54#define cpu_has_mipsmt 0
55
56#define cpu_has_64bits 0
57#define cpu_has_64bit_zero_reg 0
58#define cpu_has_64bit_gp_regs 0
59
60#endif /* __ASM_MACH_ATH25_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
new file mode 100644
index 000000000..1f9e571af
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
@@ -0,0 +1,1321 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Atheros AR71XX/AR724X/AR913X SoC register definitions
4 *
5 * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
6 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
7 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8 *
9 * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP
10 */
11
12#ifndef __ASM_MACH_AR71XX_REGS_H
13#define __ASM_MACH_AR71XX_REGS_H
14
15#include <linux/types.h>
16#include <linux/io.h>
17#include <linux/bitops.h>
18
19#define AR71XX_APB_BASE 0x18000000
20#define AR71XX_GE0_BASE 0x19000000
21#define AR71XX_GE0_SIZE 0x10000
22#define AR71XX_GE1_BASE 0x1a000000
23#define AR71XX_GE1_SIZE 0x10000
24#define AR71XX_EHCI_BASE 0x1b000000
25#define AR71XX_EHCI_SIZE 0x1000
26#define AR71XX_OHCI_BASE 0x1c000000
27#define AR71XX_OHCI_SIZE 0x1000
28#define AR71XX_SPI_BASE 0x1f000000
29#define AR71XX_SPI_SIZE 0x01000000
30
31#define AR71XX_DDR_CTRL_BASE (AR71XX_APB_BASE + 0x00000000)
32#define AR71XX_DDR_CTRL_SIZE 0x100
33#define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000)
34#define AR71XX_UART_SIZE 0x100
35#define AR71XX_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000)
36#define AR71XX_USB_CTRL_SIZE 0x100
37#define AR71XX_GPIO_BASE (AR71XX_APB_BASE + 0x00040000)
38#define AR71XX_GPIO_SIZE 0x100
39#define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000)
40#define AR71XX_PLL_SIZE 0x100
41#define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000)
42#define AR71XX_RESET_SIZE 0x100
43#define AR71XX_MII_BASE (AR71XX_APB_BASE + 0x00070000)
44#define AR71XX_MII_SIZE 0x100
45
46#define AR71XX_PCI_MEM_BASE 0x10000000
47#define AR71XX_PCI_MEM_SIZE 0x07000000
48
49#define AR71XX_PCI_WIN0_OFFS 0x10000000
50#define AR71XX_PCI_WIN1_OFFS 0x11000000
51#define AR71XX_PCI_WIN2_OFFS 0x12000000
52#define AR71XX_PCI_WIN3_OFFS 0x13000000
53#define AR71XX_PCI_WIN4_OFFS 0x14000000
54#define AR71XX_PCI_WIN5_OFFS 0x15000000
55#define AR71XX_PCI_WIN6_OFFS 0x16000000
56#define AR71XX_PCI_WIN7_OFFS 0x07000000
57
58#define AR71XX_PCI_CFG_BASE \
59 (AR71XX_PCI_MEM_BASE + AR71XX_PCI_WIN7_OFFS + 0x10000)
60#define AR71XX_PCI_CFG_SIZE 0x100
61
62#define AR7240_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000)
63#define AR7240_USB_CTRL_SIZE 0x100
64#define AR7240_OHCI_BASE 0x1b000000
65#define AR7240_OHCI_SIZE 0x1000
66
67#define AR724X_PCI_MEM_BASE 0x10000000
68#define AR724X_PCI_MEM_SIZE 0x04000000
69
70#define AR724X_PCI_CFG_BASE 0x14000000
71#define AR724X_PCI_CFG_SIZE 0x1000
72#define AR724X_PCI_CRP_BASE (AR71XX_APB_BASE + 0x000c0000)
73#define AR724X_PCI_CRP_SIZE 0x1000
74#define AR724X_PCI_CTRL_BASE (AR71XX_APB_BASE + 0x000f0000)
75#define AR724X_PCI_CTRL_SIZE 0x100
76
77#define AR724X_EHCI_BASE 0x1b000000
78#define AR724X_EHCI_SIZE 0x1000
79
80#define AR913X_EHCI_BASE 0x1b000000
81#define AR913X_EHCI_SIZE 0x1000
82#define AR913X_WMAC_BASE (AR71XX_APB_BASE + 0x000C0000)
83#define AR913X_WMAC_SIZE 0x30000
84
85#define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000)
86#define AR933X_UART_SIZE 0x14
87#define AR933X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
88#define AR933X_GMAC_SIZE 0x04
89#define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
90#define AR933X_WMAC_SIZE 0x20000
91#define AR933X_EHCI_BASE 0x1b000000
92#define AR933X_EHCI_SIZE 0x1000
93
94#define AR934X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
95#define AR934X_GMAC_SIZE 0x14
96#define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
97#define AR934X_WMAC_SIZE 0x20000
98#define AR934X_EHCI_BASE 0x1b000000
99#define AR934X_EHCI_SIZE 0x200
100#define AR934X_NFC_BASE 0x1b000200
101#define AR934X_NFC_SIZE 0xb8
102#define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000)
103#define AR934X_SRIF_SIZE 0x1000
104
105#define QCA953X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
106#define QCA953X_GMAC_SIZE 0x14
107#define QCA953X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
108#define QCA953X_WMAC_SIZE 0x20000
109#define QCA953X_EHCI_BASE 0x1b000000
110#define QCA953X_EHCI_SIZE 0x200
111#define QCA953X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000)
112#define QCA953X_SRIF_SIZE 0x1000
113
114#define QCA953X_PCI_CFG_BASE0 0x14000000
115#define QCA953X_PCI_CTRL_BASE0 (AR71XX_APB_BASE + 0x000f0000)
116#define QCA953X_PCI_CRP_BASE0 (AR71XX_APB_BASE + 0x000c0000)
117#define QCA953X_PCI_MEM_BASE0 0x10000000
118#define QCA953X_PCI_MEM_SIZE 0x02000000
119
120#define QCA955X_PCI_MEM_BASE0 0x10000000
121#define QCA955X_PCI_MEM_BASE1 0x12000000
122#define QCA955X_PCI_MEM_SIZE 0x02000000
123#define QCA955X_PCI_CFG_BASE0 0x14000000
124#define QCA955X_PCI_CFG_BASE1 0x16000000
125#define QCA955X_PCI_CFG_SIZE 0x1000
126#define QCA955X_PCI_CRP_BASE0 (AR71XX_APB_BASE + 0x000c0000)
127#define QCA955X_PCI_CRP_BASE1 (AR71XX_APB_BASE + 0x00250000)
128#define QCA955X_PCI_CRP_SIZE 0x1000
129#define QCA955X_PCI_CTRL_BASE0 (AR71XX_APB_BASE + 0x000f0000)
130#define QCA955X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000)
131#define QCA955X_PCI_CTRL_SIZE 0x100
132
133#define QCA955X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
134#define QCA955X_GMAC_SIZE 0x40
135#define QCA955X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
136#define QCA955X_WMAC_SIZE 0x20000
137#define QCA955X_EHCI0_BASE 0x1b000000
138#define QCA955X_EHCI1_BASE 0x1b400000
139#define QCA955X_EHCI_SIZE 0x1000
140#define QCA955X_NFC_BASE 0x1b800200
141#define QCA955X_NFC_SIZE 0xb8
142
143#define QCA956X_PCI_MEM_BASE1 0x12000000
144#define QCA956X_PCI_MEM_SIZE 0x02000000
145#define QCA956X_PCI_CFG_BASE1 0x16000000
146#define QCA956X_PCI_CFG_SIZE 0x1000
147#define QCA956X_PCI_CRP_BASE1 (AR71XX_APB_BASE + 0x00250000)
148#define QCA956X_PCI_CRP_SIZE 0x1000
149#define QCA956X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000)
150#define QCA956X_PCI_CTRL_SIZE 0x100
151
152#define QCA956X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
153#define QCA956X_WMAC_SIZE 0x20000
154#define QCA956X_EHCI0_BASE 0x1b000000
155#define QCA956X_EHCI1_BASE 0x1b400000
156#define QCA956X_EHCI_SIZE 0x200
157#define QCA956X_GMAC_SGMII_BASE (AR71XX_APB_BASE + 0x00070000)
158#define QCA956X_GMAC_SGMII_SIZE 0x64
159#define QCA956X_PLL_BASE (AR71XX_APB_BASE + 0x00050000)
160#define QCA956X_PLL_SIZE 0x50
161#define QCA956X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000)
162#define QCA956X_GMAC_SIZE 0x64
163
164/*
165 * Hidden Registers
166 */
167#define QCA956X_MAC_CFG_BASE 0xb9000000
168#define QCA956X_MAC_CFG_SIZE 0x64
169
170#define QCA956X_MAC_CFG1_REG 0x00
171#define QCA956X_MAC_CFG1_SOFT_RST BIT(31)
172#define QCA956X_MAC_CFG1_RX_RST BIT(19)
173#define QCA956X_MAC_CFG1_TX_RST BIT(18)
174#define QCA956X_MAC_CFG1_LOOPBACK BIT(8)
175#define QCA956X_MAC_CFG1_RX_EN BIT(2)
176#define QCA956X_MAC_CFG1_TX_EN BIT(0)
177
178#define QCA956X_MAC_CFG2_REG 0x04
179#define QCA956X_MAC_CFG2_IF_1000 BIT(9)
180#define QCA956X_MAC_CFG2_IF_10_100 BIT(8)
181#define QCA956X_MAC_CFG2_HUGE_FRAME_EN BIT(5)
182#define QCA956X_MAC_CFG2_LEN_CHECK BIT(4)
183#define QCA956X_MAC_CFG2_PAD_CRC_EN BIT(2)
184#define QCA956X_MAC_CFG2_FDX BIT(0)
185
186#define QCA956X_MAC_MII_MGMT_CFG_REG 0x20
187#define QCA956X_MGMT_CFG_CLK_DIV_20 0x07
188
189#define QCA956X_MAC_FIFO_CFG0_REG 0x48
190#define QCA956X_MAC_FIFO_CFG1_REG 0x4c
191#define QCA956X_MAC_FIFO_CFG2_REG 0x50
192#define QCA956X_MAC_FIFO_CFG3_REG 0x54
193#define QCA956X_MAC_FIFO_CFG4_REG 0x58
194#define QCA956X_MAC_FIFO_CFG5_REG 0x5c
195
196#define QCA956X_DAM_RESET_OFFSET 0xb90001bc
197#define QCA956X_DAM_RESET_SIZE 0x4
198#define QCA956X_INLINE_CHKSUM_ENG BIT(27)
199
200/*
201 * DDR_CTRL block
202 */
203#define AR71XX_DDR_REG_PCI_WIN0 0x7c
204#define AR71XX_DDR_REG_PCI_WIN1 0x80
205#define AR71XX_DDR_REG_PCI_WIN2 0x84
206#define AR71XX_DDR_REG_PCI_WIN3 0x88
207#define AR71XX_DDR_REG_PCI_WIN4 0x8c
208#define AR71XX_DDR_REG_PCI_WIN5 0x90
209#define AR71XX_DDR_REG_PCI_WIN6 0x94
210#define AR71XX_DDR_REG_PCI_WIN7 0x98
211#define AR71XX_DDR_REG_FLUSH_GE0 0x9c
212#define AR71XX_DDR_REG_FLUSH_GE1 0xa0
213#define AR71XX_DDR_REG_FLUSH_USB 0xa4
214#define AR71XX_DDR_REG_FLUSH_PCI 0xa8
215
216#define AR724X_DDR_REG_FLUSH_GE0 0x7c
217#define AR724X_DDR_REG_FLUSH_GE1 0x80
218#define AR724X_DDR_REG_FLUSH_USB 0x84
219#define AR724X_DDR_REG_FLUSH_PCIE 0x88
220
221#define AR913X_DDR_REG_FLUSH_GE0 0x7c
222#define AR913X_DDR_REG_FLUSH_GE1 0x80
223#define AR913X_DDR_REG_FLUSH_USB 0x84
224#define AR913X_DDR_REG_FLUSH_WMAC 0x88
225
226#define AR933X_DDR_REG_FLUSH_GE0 0x7c
227#define AR933X_DDR_REG_FLUSH_GE1 0x80
228#define AR933X_DDR_REG_FLUSH_USB 0x84
229#define AR933X_DDR_REG_FLUSH_WMAC 0x88
230
231#define AR934X_DDR_REG_FLUSH_GE0 0x9c
232#define AR934X_DDR_REG_FLUSH_GE1 0xa0
233#define AR934X_DDR_REG_FLUSH_USB 0xa4
234#define AR934X_DDR_REG_FLUSH_PCIE 0xa8
235#define AR934X_DDR_REG_FLUSH_WMAC 0xac
236
237#define QCA953X_DDR_REG_FLUSH_GE0 0x9c
238#define QCA953X_DDR_REG_FLUSH_GE1 0xa0
239#define QCA953X_DDR_REG_FLUSH_USB 0xa4
240#define QCA953X_DDR_REG_FLUSH_PCIE 0xa8
241#define QCA953X_DDR_REG_FLUSH_WMAC 0xac
242
243/*
244 * PLL block
245 */
246#define AR71XX_PLL_REG_CPU_CONFIG 0x00
247#define AR71XX_PLL_REG_SEC_CONFIG 0x04
248#define AR71XX_PLL_REG_ETH0_INT_CLOCK 0x10
249#define AR71XX_PLL_REG_ETH1_INT_CLOCK 0x14
250
251#define AR71XX_PLL_FB_SHIFT 3
252#define AR71XX_PLL_FB_MASK 0x1f
253#define AR71XX_CPU_DIV_SHIFT 16
254#define AR71XX_CPU_DIV_MASK 0x3
255#define AR71XX_DDR_DIV_SHIFT 18
256#define AR71XX_DDR_DIV_MASK 0x3
257#define AR71XX_AHB_DIV_SHIFT 20
258#define AR71XX_AHB_DIV_MASK 0x7
259
260#define AR71XX_ETH0_PLL_SHIFT 17
261#define AR71XX_ETH1_PLL_SHIFT 19
262
263#define AR724X_PLL_REG_CPU_CONFIG 0x00
264#define AR724X_PLL_REG_PCIE_CONFIG 0x10
265
266#define AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS BIT(16)
267#define AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET BIT(25)
268
269#define AR724X_PLL_FB_SHIFT 0
270#define AR724X_PLL_FB_MASK 0x3ff
271#define AR724X_PLL_REF_DIV_SHIFT 10
272#define AR724X_PLL_REF_DIV_MASK 0xf
273#define AR724X_AHB_DIV_SHIFT 19
274#define AR724X_AHB_DIV_MASK 0x1
275#define AR724X_DDR_DIV_SHIFT 22
276#define AR724X_DDR_DIV_MASK 0x3
277
278#define AR7242_PLL_REG_ETH0_INT_CLOCK 0x2c
279
280#define AR913X_PLL_REG_CPU_CONFIG 0x00
281#define AR913X_PLL_REG_ETH_CONFIG 0x04
282#define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14
283#define AR913X_PLL_REG_ETH1_INT_CLOCK 0x18
284
285#define AR913X_PLL_FB_SHIFT 0
286#define AR913X_PLL_FB_MASK 0x3ff
287#define AR913X_DDR_DIV_SHIFT 22
288#define AR913X_DDR_DIV_MASK 0x3
289#define AR913X_AHB_DIV_SHIFT 19
290#define AR913X_AHB_DIV_MASK 0x1
291
292#define AR913X_ETH0_PLL_SHIFT 20
293#define AR913X_ETH1_PLL_SHIFT 22
294
295#define AR933X_PLL_CPU_CONFIG_REG 0x00
296#define AR933X_PLL_CLOCK_CTRL_REG 0x08
297
298#define AR933X_PLL_CPU_CONFIG_NINT_SHIFT 10
299#define AR933X_PLL_CPU_CONFIG_NINT_MASK 0x3f
300#define AR933X_PLL_CPU_CONFIG_REFDIV_SHIFT 16
301#define AR933X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
302#define AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT 23
303#define AR933X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7
304
305#define AR933X_PLL_CLOCK_CTRL_BYPASS BIT(2)
306#define AR933X_PLL_CLOCK_CTRL_CPU_DIV_SHIFT 5
307#define AR933X_PLL_CLOCK_CTRL_CPU_DIV_MASK 0x3
308#define AR933X_PLL_CLOCK_CTRL_DDR_DIV_SHIFT 10
309#define AR933X_PLL_CLOCK_CTRL_DDR_DIV_MASK 0x3
310#define AR933X_PLL_CLOCK_CTRL_AHB_DIV_SHIFT 15
311#define AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK 0x7
312
313#define AR934X_PLL_CPU_CONFIG_REG 0x00
314#define AR934X_PLL_DDR_CONFIG_REG 0x04
315#define AR934X_PLL_CPU_DDR_CLK_CTRL_REG 0x08
316#define AR934X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24
317#define AR934X_PLL_ETH_XMII_CONTROL_REG 0x2c
318
319#define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
320#define AR934X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
321#define AR934X_PLL_CPU_CONFIG_NINT_SHIFT 6
322#define AR934X_PLL_CPU_CONFIG_NINT_MASK 0x3f
323#define AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
324#define AR934X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
325#define AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19
326#define AR934X_PLL_CPU_CONFIG_OUTDIV_MASK 0x3
327
328#define AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT 0
329#define AR934X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff
330#define AR934X_PLL_DDR_CONFIG_NINT_SHIFT 10
331#define AR934X_PLL_DDR_CONFIG_NINT_MASK 0x3f
332#define AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT 16
333#define AR934X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f
334#define AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23
335#define AR934X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7
336
337#define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_PLL_BYPASS BIT(2)
338#define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_PLL_BYPASS BIT(3)
339#define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_PLL_BYPASS BIT(4)
340#define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SHIFT 5
341#define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK 0x1f
342#define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_SHIFT 10
343#define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK 0x1f
344#define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_SHIFT 15
345#define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK 0x1f
346#define AR934X_PLL_CPU_DDR_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20)
347#define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
348#define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
349
350#define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6)
351
352#define QCA953X_PLL_CPU_CONFIG_REG 0x00
353#define QCA953X_PLL_DDR_CONFIG_REG 0x04
354#define QCA953X_PLL_CLK_CTRL_REG 0x08
355#define QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24
356#define QCA953X_PLL_ETH_XMII_CONTROL_REG 0x2c
357#define QCA953X_PLL_ETH_SGMII_CONTROL_REG 0x48
358
359#define QCA953X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
360#define QCA953X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
361#define QCA953X_PLL_CPU_CONFIG_NINT_SHIFT 6
362#define QCA953X_PLL_CPU_CONFIG_NINT_MASK 0x3f
363#define QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
364#define QCA953X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
365#define QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19
366#define QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7
367
368#define QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT 0
369#define QCA953X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff
370#define QCA953X_PLL_DDR_CONFIG_NINT_SHIFT 10
371#define QCA953X_PLL_DDR_CONFIG_NINT_MASK 0x3f
372#define QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT 16
373#define QCA953X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f
374#define QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23
375#define QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7
376
377#define QCA953X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2)
378#define QCA953X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3)
379#define QCA953X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4)
380#define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5
381#define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f
382#define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10
383#define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f
384#define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15
385#define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f
386#define QCA953X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20)
387#define QCA953X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
388#define QCA953X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
389
390#define QCA955X_PLL_CPU_CONFIG_REG 0x00
391#define QCA955X_PLL_DDR_CONFIG_REG 0x04
392#define QCA955X_PLL_CLK_CTRL_REG 0x08
393#define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28
394#define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48
395#define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c
396
397#define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
398#define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
399#define QCA955X_PLL_CPU_CONFIG_NINT_SHIFT 6
400#define QCA955X_PLL_CPU_CONFIG_NINT_MASK 0x3f
401#define QCA955X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
402#define QCA955X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
403#define QCA955X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19
404#define QCA955X_PLL_CPU_CONFIG_OUTDIV_MASK 0x3
405
406#define QCA955X_PLL_DDR_CONFIG_NFRAC_SHIFT 0
407#define QCA955X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff
408#define QCA955X_PLL_DDR_CONFIG_NINT_SHIFT 10
409#define QCA955X_PLL_DDR_CONFIG_NINT_MASK 0x3f
410#define QCA955X_PLL_DDR_CONFIG_REFDIV_SHIFT 16
411#define QCA955X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f
412#define QCA955X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23
413#define QCA955X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7
414
415#define QCA955X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2)
416#define QCA955X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3)
417#define QCA955X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4)
418#define QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5
419#define QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f
420#define QCA955X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10
421#define QCA955X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f
422#define QCA955X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15
423#define QCA955X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f
424#define QCA955X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20)
425#define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
426#define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
427
428#define QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2)
429#define QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1)
430#define QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0)
431
432#define QCA956X_PLL_CPU_CONFIG_REG 0x00
433#define QCA956X_PLL_CPU_CONFIG1_REG 0x04
434#define QCA956X_PLL_DDR_CONFIG_REG 0x08
435#define QCA956X_PLL_DDR_CONFIG1_REG 0x0c
436#define QCA956X_PLL_CLK_CTRL_REG 0x10
437#define QCA956X_PLL_SWITCH_CLOCK_CONTROL_REG 0x28
438#define QCA956X_PLL_ETH_XMII_CONTROL_REG 0x30
439#define QCA956X_PLL_ETH_SGMII_SERDES_REG 0x4c
440
441#define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT 12
442#define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f
443#define QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19
444#define QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7
445
446#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT 0
447#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK 0x1f
448#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT 5
449#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x1fff
450#define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT 18
451#define QCA956X_PLL_CPU_CONFIG1_NINT_MASK 0x1ff
452
453#define QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT 16
454#define QCA956X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f
455#define QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23
456#define QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7
457
458#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT 0
459#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK 0x1f
460#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT 5
461#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x1fff
462#define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT 18
463#define QCA956X_PLL_DDR_CONFIG1_NINT_MASK 0x1ff
464
465#define QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2)
466#define QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3)
467#define QCA956X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4)
468#define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5
469#define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f
470#define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10
471#define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f
472#define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15
473#define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f
474#define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL BIT(20)
475#define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL BIT(21)
476#define QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
477
478#define QCA956X_PLL_SWITCH_CLOCK_SPARE_I2C_CLK_SELB BIT(5)
479#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1 BIT(6)
480#define QCA956X_PLL_SWITCH_CLOCK_SPARE_UART1_CLK_SEL BIT(7)
481#define QCA956X_PLL_SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_SHIFT 8
482#define QCA956X_PLL_SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_MASK 0xf
483#define QCA956X_PLL_SWITCH_CLOCK_SPARE_EN_PLL_TOP BIT(12)
484#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2 BIT(13)
485#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1 BIT(14)
486#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2 BIT(15)
487#define QCA956X_PLL_SWITCH_CLOCK_SPARE_SWITCH_FUNC_TST_MODE BIT(16)
488#define QCA956X_PLL_SWITCH_CLOCK_SPARE_EEE_ENABLE BIT(17)
489#define QCA956X_PLL_SWITCH_CLOCK_SPARE_OEN_CLK125M_PLL BIT(18)
490#define QCA956X_PLL_SWITCH_CLOCK_SPARE_SWITCHCLK_SEL BIT(19)
491
492#define QCA956X_PLL_ETH_XMII_TX_INVERT BIT(1)
493#define QCA956X_PLL_ETH_XMII_GIGE BIT(25)
494#define QCA956X_PLL_ETH_XMII_RX_DELAY_SHIFT 28
495#define QCA956X_PLL_ETH_XMII_RX_DELAY_MASK 0x3
496#define QCA956X_PLL_ETH_XMII_TX_DELAY_SHIFT 26
497#define QCA956X_PLL_ETH_XMII_TX_DELAY_MASK 3
498
499#define QCA956X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2)
500#define QCA956X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1)
501#define QCA956X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0)
502
503/*
504 * USB_CONFIG block
505 */
506#define AR71XX_USB_CTRL_REG_FLADJ 0x00
507#define AR71XX_USB_CTRL_REG_CONFIG 0x04
508
509/*
510 * RESET block
511 */
512#define AR71XX_RESET_REG_TIMER 0x00
513#define AR71XX_RESET_REG_TIMER_RELOAD 0x04
514#define AR71XX_RESET_REG_WDOG_CTRL 0x08
515#define AR71XX_RESET_REG_WDOG 0x0c
516#define AR71XX_RESET_REG_MISC_INT_STATUS 0x10
517#define AR71XX_RESET_REG_MISC_INT_ENABLE 0x14
518#define AR71XX_RESET_REG_PCI_INT_STATUS 0x18
519#define AR71XX_RESET_REG_PCI_INT_ENABLE 0x1c
520#define AR71XX_RESET_REG_GLOBAL_INT_STATUS 0x20
521#define AR71XX_RESET_REG_RESET_MODULE 0x24
522#define AR71XX_RESET_REG_PERFC_CTRL 0x2c
523#define AR71XX_RESET_REG_PERFC0 0x30
524#define AR71XX_RESET_REG_PERFC1 0x34
525#define AR71XX_RESET_REG_REV_ID 0x90
526
527#define AR913X_RESET_REG_GLOBAL_INT_STATUS 0x18
528#define AR913X_RESET_REG_RESET_MODULE 0x1c
529#define AR913X_RESET_REG_PERF_CTRL 0x20
530#define AR913X_RESET_REG_PERFC0 0x24
531#define AR913X_RESET_REG_PERFC1 0x28
532
533#define AR724X_RESET_REG_RESET_MODULE 0x1c
534
535#define AR933X_RESET_REG_RESET_MODULE 0x1c
536#define AR933X_RESET_REG_BOOTSTRAP 0xac
537
538#define AR934X_RESET_REG_RESET_MODULE 0x1c
539#define AR934X_RESET_REG_BOOTSTRAP 0xb0
540#define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac
541
542#define QCA953X_RESET_REG_RESET_MODULE 0x1c
543#define QCA953X_RESET_REG_BOOTSTRAP 0xb0
544#define QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac
545
546#define QCA955X_RESET_REG_RESET_MODULE 0x1c
547#define QCA955X_RESET_REG_BOOTSTRAP 0xb0
548#define QCA955X_RESET_REG_EXT_INT_STATUS 0xac
549
550#define QCA956X_RESET_REG_RESET_MODULE 0x1c
551#define QCA956X_RESET_REG_BOOTSTRAP 0xb0
552#define QCA956X_RESET_REG_EXT_INT_STATUS 0xac
553
554#define MISC_INT_MIPS_SI_TIMERINT_MASK BIT(28)
555#define MISC_INT_ETHSW BIT(12)
556#define MISC_INT_TIMER4 BIT(10)
557#define MISC_INT_TIMER3 BIT(9)
558#define MISC_INT_TIMER2 BIT(8)
559#define MISC_INT_DMA BIT(7)
560#define MISC_INT_OHCI BIT(6)
561#define MISC_INT_PERFC BIT(5)
562#define MISC_INT_WDOG BIT(4)
563#define MISC_INT_UART BIT(3)
564#define MISC_INT_GPIO BIT(2)
565#define MISC_INT_ERROR BIT(1)
566#define MISC_INT_TIMER BIT(0)
567
568#define AR71XX_RESET_EXTERNAL BIT(28)
569#define AR71XX_RESET_FULL_CHIP BIT(24)
570#define AR71XX_RESET_CPU_NMI BIT(21)
571#define AR71XX_RESET_CPU_COLD BIT(20)
572#define AR71XX_RESET_DMA BIT(19)
573#define AR71XX_RESET_SLIC BIT(18)
574#define AR71XX_RESET_STEREO BIT(17)
575#define AR71XX_RESET_DDR BIT(16)
576#define AR71XX_RESET_GE1_MAC BIT(13)
577#define AR71XX_RESET_GE1_PHY BIT(12)
578#define AR71XX_RESET_USBSUS_OVERRIDE BIT(10)
579#define AR71XX_RESET_GE0_MAC BIT(9)
580#define AR71XX_RESET_GE0_PHY BIT(8)
581#define AR71XX_RESET_USB_OHCI_DLL BIT(6)
582#define AR71XX_RESET_USB_HOST BIT(5)
583#define AR71XX_RESET_USB_PHY BIT(4)
584#define AR71XX_RESET_PCI_BUS BIT(1)
585#define AR71XX_RESET_PCI_CORE BIT(0)
586
587#define AR7240_RESET_USB_HOST BIT(5)
588#define AR7240_RESET_OHCI_DLL BIT(3)
589
590#define AR724X_RESET_GE1_MDIO BIT(23)
591#define AR724X_RESET_GE0_MDIO BIT(22)
592#define AR724X_RESET_PCIE_PHY_SERIAL BIT(10)
593#define AR724X_RESET_PCIE_PHY BIT(7)
594#define AR724X_RESET_PCIE BIT(6)
595#define AR724X_RESET_USB_HOST BIT(5)
596#define AR724X_RESET_USB_PHY BIT(4)
597#define AR724X_RESET_USBSUS_OVERRIDE BIT(3)
598
599#define AR913X_RESET_AMBA2WMAC BIT(22)
600#define AR913X_RESET_USBSUS_OVERRIDE BIT(10)
601#define AR913X_RESET_USB_HOST BIT(5)
602#define AR913X_RESET_USB_PHY BIT(4)
603
604#define AR933X_RESET_GE1_MDIO BIT(23)
605#define AR933X_RESET_GE0_MDIO BIT(22)
606#define AR933X_RESET_GE1_MAC BIT(13)
607#define AR933X_RESET_WMAC BIT(11)
608#define AR933X_RESET_GE0_MAC BIT(9)
609#define AR933X_RESET_USB_HOST BIT(5)
610#define AR933X_RESET_USB_PHY BIT(4)
611#define AR933X_RESET_USBSUS_OVERRIDE BIT(3)
612
613#define AR934X_RESET_HOST BIT(31)
614#define AR934X_RESET_SLIC BIT(30)
615#define AR934X_RESET_HDMA BIT(29)
616#define AR934X_RESET_EXTERNAL BIT(28)
617#define AR934X_RESET_RTC BIT(27)
618#define AR934X_RESET_PCIE_EP_INT BIT(26)
619#define AR934X_RESET_CHKSUM_ACC BIT(25)
620#define AR934X_RESET_FULL_CHIP BIT(24)
621#define AR934X_RESET_GE1_MDIO BIT(23)
622#define AR934X_RESET_GE0_MDIO BIT(22)
623#define AR934X_RESET_CPU_NMI BIT(21)
624#define AR934X_RESET_CPU_COLD BIT(20)
625#define AR934X_RESET_HOST_RESET_INT BIT(19)
626#define AR934X_RESET_PCIE_EP BIT(18)
627#define AR934X_RESET_UART1 BIT(17)
628#define AR934X_RESET_DDR BIT(16)
629#define AR934X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
630#define AR934X_RESET_NANDF BIT(14)
631#define AR934X_RESET_GE1_MAC BIT(13)
632#define AR934X_RESET_ETH_SWITCH_ANALOG BIT(12)
633#define AR934X_RESET_USB_PHY_ANALOG BIT(11)
634#define AR934X_RESET_HOST_DMA_INT BIT(10)
635#define AR934X_RESET_GE0_MAC BIT(9)
636#define AR934X_RESET_ETH_SWITCH BIT(8)
637#define AR934X_RESET_PCIE_PHY BIT(7)
638#define AR934X_RESET_PCIE BIT(6)
639#define AR934X_RESET_USB_HOST BIT(5)
640#define AR934X_RESET_USB_PHY BIT(4)
641#define AR934X_RESET_USBSUS_OVERRIDE BIT(3)
642#define AR934X_RESET_LUT BIT(2)
643#define AR934X_RESET_MBOX BIT(1)
644#define AR934X_RESET_I2S BIT(0)
645
646#define QCA953X_RESET_USB_EXT_PWR BIT(29)
647#define QCA953X_RESET_EXTERNAL BIT(28)
648#define QCA953X_RESET_RTC BIT(27)
649#define QCA953X_RESET_FULL_CHIP BIT(24)
650#define QCA953X_RESET_GE1_MDIO BIT(23)
651#define QCA953X_RESET_GE0_MDIO BIT(22)
652#define QCA953X_RESET_CPU_NMI BIT(21)
653#define QCA953X_RESET_CPU_COLD BIT(20)
654#define QCA953X_RESET_DDR BIT(16)
655#define QCA953X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
656#define QCA953X_RESET_GE1_MAC BIT(13)
657#define QCA953X_RESET_ETH_SWITCH_ANALOG BIT(12)
658#define QCA953X_RESET_USB_PHY_ANALOG BIT(11)
659#define QCA953X_RESET_GE0_MAC BIT(9)
660#define QCA953X_RESET_ETH_SWITCH BIT(8)
661#define QCA953X_RESET_PCIE_PHY BIT(7)
662#define QCA953X_RESET_PCIE BIT(6)
663#define QCA953X_RESET_USB_HOST BIT(5)
664#define QCA953X_RESET_USB_PHY BIT(4)
665#define QCA953X_RESET_USBSUS_OVERRIDE BIT(3)
666
667#define QCA955X_RESET_HOST BIT(31)
668#define QCA955X_RESET_SLIC BIT(30)
669#define QCA955X_RESET_HDMA BIT(29)
670#define QCA955X_RESET_EXTERNAL BIT(28)
671#define QCA955X_RESET_RTC BIT(27)
672#define QCA955X_RESET_PCIE_EP_INT BIT(26)
673#define QCA955X_RESET_CHKSUM_ACC BIT(25)
674#define QCA955X_RESET_FULL_CHIP BIT(24)
675#define QCA955X_RESET_GE1_MDIO BIT(23)
676#define QCA955X_RESET_GE0_MDIO BIT(22)
677#define QCA955X_RESET_CPU_NMI BIT(21)
678#define QCA955X_RESET_CPU_COLD BIT(20)
679#define QCA955X_RESET_HOST_RESET_INT BIT(19)
680#define QCA955X_RESET_PCIE_EP BIT(18)
681#define QCA955X_RESET_UART1 BIT(17)
682#define QCA955X_RESET_DDR BIT(16)
683#define QCA955X_RESET_USB_PHY_PLL_PWD_EXT BIT(15)
684#define QCA955X_RESET_NANDF BIT(14)
685#define QCA955X_RESET_GE1_MAC BIT(13)
686#define QCA955X_RESET_SGMII_ANALOG BIT(12)
687#define QCA955X_RESET_USB_PHY_ANALOG BIT(11)
688#define QCA955X_RESET_HOST_DMA_INT BIT(10)
689#define QCA955X_RESET_GE0_MAC BIT(9)
690#define QCA955X_RESET_SGMII BIT(8)
691#define QCA955X_RESET_PCIE_PHY BIT(7)
692#define QCA955X_RESET_PCIE BIT(6)
693#define QCA955X_RESET_USB_HOST BIT(5)
694#define QCA955X_RESET_USB_PHY BIT(4)
695#define QCA955X_RESET_USBSUS_OVERRIDE BIT(3)
696#define QCA955X_RESET_LUT BIT(2)
697#define QCA955X_RESET_MBOX BIT(1)
698#define QCA955X_RESET_I2S BIT(0)
699
700#define QCA956X_RESET_EXTERNAL BIT(28)
701#define QCA956X_RESET_FULL_CHIP BIT(24)
702#define QCA956X_RESET_GE1_MDIO BIT(23)
703#define QCA956X_RESET_GE0_MDIO BIT(22)
704#define QCA956X_RESET_CPU_NMI BIT(21)
705#define QCA956X_RESET_CPU_COLD BIT(20)
706#define QCA956X_RESET_DMA BIT(19)
707#define QCA956X_RESET_DDR BIT(16)
708#define QCA956X_RESET_GE1_MAC BIT(13)
709#define QCA956X_RESET_SGMII_ANALOG BIT(12)
710#define QCA956X_RESET_USB_PHY_ANALOG BIT(11)
711#define QCA956X_RESET_GE0_MAC BIT(9)
712#define QCA956X_RESET_SGMII BIT(8)
713#define QCA956X_RESET_USB_HOST BIT(5)
714#define QCA956X_RESET_USB_PHY BIT(4)
715#define QCA956X_RESET_USBSUS_OVERRIDE BIT(3)
716#define QCA956X_RESET_SWITCH_ANALOG BIT(2)
717#define QCA956X_RESET_SWITCH BIT(0)
718
719#define AR933X_BOOTSTRAP_MDIO_GPIO_EN BIT(18)
720#define AR933X_BOOTSTRAP_EEPBUSY BIT(4)
721#define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0)
722
723#define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23)
724#define AR934X_BOOTSTRAP_SW_OPTION7 BIT(22)
725#define AR934X_BOOTSTRAP_SW_OPTION6 BIT(21)
726#define AR934X_BOOTSTRAP_SW_OPTION5 BIT(20)
727#define AR934X_BOOTSTRAP_SW_OPTION4 BIT(19)
728#define AR934X_BOOTSTRAP_SW_OPTION3 BIT(18)
729#define AR934X_BOOTSTRAP_SW_OPTION2 BIT(17)
730#define AR934X_BOOTSTRAP_SW_OPTION1 BIT(16)
731#define AR934X_BOOTSTRAP_USB_MODE_DEVICE BIT(7)
732#define AR934X_BOOTSTRAP_PCIE_RC BIT(6)
733#define AR934X_BOOTSTRAP_EJTAG_MODE BIT(5)
734#define AR934X_BOOTSTRAP_REF_CLK_40 BIT(4)
735#define AR934X_BOOTSTRAP_BOOT_FROM_SPI BIT(2)
736#define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1)
737#define AR934X_BOOTSTRAP_DDR1 BIT(0)
738
739#define QCA953X_BOOTSTRAP_SW_OPTION2 BIT(12)
740#define QCA953X_BOOTSTRAP_SW_OPTION1 BIT(11)
741#define QCA953X_BOOTSTRAP_EJTAG_MODE BIT(5)
742#define QCA953X_BOOTSTRAP_REF_CLK_40 BIT(4)
743#define QCA953X_BOOTSTRAP_SDRAM_DISABLED BIT(1)
744#define QCA953X_BOOTSTRAP_DDR1 BIT(0)
745
746#define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4)
747
748#define QCA956X_BOOTSTRAP_REF_CLK_40 BIT(2)
749
750#define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
751#define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1)
752#define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2)
753#define AR934X_PCIE_WMAC_INT_WMAC_RXHP BIT(3)
754#define AR934X_PCIE_WMAC_INT_PCIE_RC BIT(4)
755#define AR934X_PCIE_WMAC_INT_PCIE_RC0 BIT(5)
756#define AR934X_PCIE_WMAC_INT_PCIE_RC1 BIT(6)
757#define AR934X_PCIE_WMAC_INT_PCIE_RC2 BIT(7)
758#define AR934X_PCIE_WMAC_INT_PCIE_RC3 BIT(8)
759#define AR934X_PCIE_WMAC_INT_WMAC_ALL \
760 (AR934X_PCIE_WMAC_INT_WMAC_MISC | AR934X_PCIE_WMAC_INT_WMAC_TX | \
761 AR934X_PCIE_WMAC_INT_WMAC_RXLP | AR934X_PCIE_WMAC_INT_WMAC_RXHP)
762
763#define AR934X_PCIE_WMAC_INT_PCIE_ALL \
764 (AR934X_PCIE_WMAC_INT_PCIE_RC | AR934X_PCIE_WMAC_INT_PCIE_RC0 | \
765 AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \
766 AR934X_PCIE_WMAC_INT_PCIE_RC3)
767
768#define QCA953X_PCIE_WMAC_INT_WMAC_MISC BIT(0)
769#define QCA953X_PCIE_WMAC_INT_WMAC_TX BIT(1)
770#define QCA953X_PCIE_WMAC_INT_WMAC_RXLP BIT(2)
771#define QCA953X_PCIE_WMAC_INT_WMAC_RXHP BIT(3)
772#define QCA953X_PCIE_WMAC_INT_PCIE_RC BIT(4)
773#define QCA953X_PCIE_WMAC_INT_PCIE_RC0 BIT(5)
774#define QCA953X_PCIE_WMAC_INT_PCIE_RC1 BIT(6)
775#define QCA953X_PCIE_WMAC_INT_PCIE_RC2 BIT(7)
776#define QCA953X_PCIE_WMAC_INT_PCIE_RC3 BIT(8)
777#define QCA953X_PCIE_WMAC_INT_WMAC_ALL \
778 (QCA953X_PCIE_WMAC_INT_WMAC_MISC | QCA953X_PCIE_WMAC_INT_WMAC_TX | \
779 QCA953X_PCIE_WMAC_INT_WMAC_RXLP | QCA953X_PCIE_WMAC_INT_WMAC_RXHP)
780
781#define QCA953X_PCIE_WMAC_INT_PCIE_ALL \
782 (QCA953X_PCIE_WMAC_INT_PCIE_RC | QCA953X_PCIE_WMAC_INT_PCIE_RC0 | \
783 QCA953X_PCIE_WMAC_INT_PCIE_RC1 | QCA953X_PCIE_WMAC_INT_PCIE_RC2 | \
784 QCA953X_PCIE_WMAC_INT_PCIE_RC3)
785
786#define QCA955X_EXT_INT_WMAC_MISC BIT(0)
787#define QCA955X_EXT_INT_WMAC_TX BIT(1)
788#define QCA955X_EXT_INT_WMAC_RXLP BIT(2)
789#define QCA955X_EXT_INT_WMAC_RXHP BIT(3)
790#define QCA955X_EXT_INT_PCIE_RC1 BIT(4)
791#define QCA955X_EXT_INT_PCIE_RC1_INT0 BIT(5)
792#define QCA955X_EXT_INT_PCIE_RC1_INT1 BIT(6)
793#define QCA955X_EXT_INT_PCIE_RC1_INT2 BIT(7)
794#define QCA955X_EXT_INT_PCIE_RC1_INT3 BIT(8)
795#define QCA955X_EXT_INT_PCIE_RC2 BIT(12)
796#define QCA955X_EXT_INT_PCIE_RC2_INT0 BIT(13)
797#define QCA955X_EXT_INT_PCIE_RC2_INT1 BIT(14)
798#define QCA955X_EXT_INT_PCIE_RC2_INT2 BIT(15)
799#define QCA955X_EXT_INT_PCIE_RC2_INT3 BIT(16)
800#define QCA955X_EXT_INT_USB1 BIT(24)
801#define QCA955X_EXT_INT_USB2 BIT(28)
802
803#define QCA955X_EXT_INT_WMAC_ALL \
804 (QCA955X_EXT_INT_WMAC_MISC | QCA955X_EXT_INT_WMAC_TX | \
805 QCA955X_EXT_INT_WMAC_RXLP | QCA955X_EXT_INT_WMAC_RXHP)
806
807#define QCA955X_EXT_INT_PCIE_RC1_ALL \
808 (QCA955X_EXT_INT_PCIE_RC1 | QCA955X_EXT_INT_PCIE_RC1_INT0 | \
809 QCA955X_EXT_INT_PCIE_RC1_INT1 | QCA955X_EXT_INT_PCIE_RC1_INT2 | \
810 QCA955X_EXT_INT_PCIE_RC1_INT3)
811
812#define QCA955X_EXT_INT_PCIE_RC2_ALL \
813 (QCA955X_EXT_INT_PCIE_RC2 | QCA955X_EXT_INT_PCIE_RC2_INT0 | \
814 QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \
815 QCA955X_EXT_INT_PCIE_RC2_INT3)
816
817#define QCA956X_EXT_INT_WMAC_MISC BIT(0)
818#define QCA956X_EXT_INT_WMAC_TX BIT(1)
819#define QCA956X_EXT_INT_WMAC_RXLP BIT(2)
820#define QCA956X_EXT_INT_WMAC_RXHP BIT(3)
821#define QCA956X_EXT_INT_PCIE_RC1 BIT(4)
822#define QCA956X_EXT_INT_PCIE_RC1_INT0 BIT(5)
823#define QCA956X_EXT_INT_PCIE_RC1_INT1 BIT(6)
824#define QCA956X_EXT_INT_PCIE_RC1_INT2 BIT(7)
825#define QCA956X_EXT_INT_PCIE_RC1_INT3 BIT(8)
826#define QCA956X_EXT_INT_PCIE_RC2 BIT(12)
827#define QCA956X_EXT_INT_PCIE_RC2_INT0 BIT(13)
828#define QCA956X_EXT_INT_PCIE_RC2_INT1 BIT(14)
829#define QCA956X_EXT_INT_PCIE_RC2_INT2 BIT(15)
830#define QCA956X_EXT_INT_PCIE_RC2_INT3 BIT(16)
831#define QCA956X_EXT_INT_USB1 BIT(24)
832#define QCA956X_EXT_INT_USB2 BIT(28)
833
834#define QCA956X_EXT_INT_WMAC_ALL \
835 (QCA956X_EXT_INT_WMAC_MISC | QCA956X_EXT_INT_WMAC_TX | \
836 QCA956X_EXT_INT_WMAC_RXLP | QCA956X_EXT_INT_WMAC_RXHP)
837
838#define QCA956X_EXT_INT_PCIE_RC1_ALL \
839 (QCA956X_EXT_INT_PCIE_RC1 | QCA956X_EXT_INT_PCIE_RC1_INT0 | \
840 QCA956X_EXT_INT_PCIE_RC1_INT1 | QCA956X_EXT_INT_PCIE_RC1_INT2 | \
841 QCA956X_EXT_INT_PCIE_RC1_INT3)
842
843#define QCA956X_EXT_INT_PCIE_RC2_ALL \
844 (QCA956X_EXT_INT_PCIE_RC2 | QCA956X_EXT_INT_PCIE_RC2_INT0 | \
845 QCA956X_EXT_INT_PCIE_RC2_INT1 | QCA956X_EXT_INT_PCIE_RC2_INT2 | \
846 QCA956X_EXT_INT_PCIE_RC2_INT3)
847
848#define REV_ID_MAJOR_MASK 0xfff0
849#define REV_ID_MAJOR_AR71XX 0x00a0
850#define REV_ID_MAJOR_AR913X 0x00b0
851#define REV_ID_MAJOR_AR7240 0x00c0
852#define REV_ID_MAJOR_AR7241 0x0100
853#define REV_ID_MAJOR_AR7242 0x1100
854#define REV_ID_MAJOR_AR9330 0x0110
855#define REV_ID_MAJOR_AR9331 0x1110
856#define REV_ID_MAJOR_AR9341 0x0120
857#define REV_ID_MAJOR_AR9342 0x1120
858#define REV_ID_MAJOR_AR9344 0x2120
859#define REV_ID_MAJOR_QCA9533 0x0140
860#define REV_ID_MAJOR_QCA9533_V2 0x0160
861#define REV_ID_MAJOR_QCA9556 0x0130
862#define REV_ID_MAJOR_QCA9558 0x1130
863#define REV_ID_MAJOR_TP9343 0x0150
864#define REV_ID_MAJOR_QCA956X 0x1150
865
866#define AR71XX_REV_ID_MINOR_MASK 0x3
867#define AR71XX_REV_ID_MINOR_AR7130 0x0
868#define AR71XX_REV_ID_MINOR_AR7141 0x1
869#define AR71XX_REV_ID_MINOR_AR7161 0x2
870#define AR71XX_REV_ID_REVISION_MASK 0x3
871#define AR71XX_REV_ID_REVISION_SHIFT 2
872
873#define AR913X_REV_ID_MINOR_MASK 0x3
874#define AR913X_REV_ID_MINOR_AR9130 0x0
875#define AR913X_REV_ID_MINOR_AR9132 0x1
876#define AR913X_REV_ID_REVISION_MASK 0x3
877#define AR913X_REV_ID_REVISION_SHIFT 2
878
879#define AR933X_REV_ID_REVISION_MASK 0x3
880
881#define AR724X_REV_ID_REVISION_MASK 0x3
882
883#define AR934X_REV_ID_REVISION_MASK 0xf
884
885#define QCA953X_REV_ID_REVISION_MASK 0xf
886
887#define QCA955X_REV_ID_REVISION_MASK 0xf
888
889#define QCA956X_REV_ID_REVISION_MASK 0xf
890
891/*
892 * SPI block
893 */
894#define AR71XX_SPI_REG_FS 0x00 /* Function Select */
895#define AR71XX_SPI_REG_CTRL 0x04 /* SPI Control */
896#define AR71XX_SPI_REG_IOC 0x08 /* SPI I/O Control */
897#define AR71XX_SPI_REG_RDS 0x0c /* Read Data Shift */
898
899#define AR71XX_SPI_FS_GPIO BIT(0) /* Enable GPIO mode */
900
901#define AR71XX_SPI_CTRL_RD BIT(6) /* Remap Disable */
902#define AR71XX_SPI_CTRL_DIV_MASK 0x3f
903
904#define AR71XX_SPI_IOC_DO BIT(0) /* Data Out pin */
905#define AR71XX_SPI_IOC_CLK BIT(8) /* CLK pin */
906#define AR71XX_SPI_IOC_CS(n) BIT(16 + (n))
907#define AR71XX_SPI_IOC_CS0 AR71XX_SPI_IOC_CS(0)
908#define AR71XX_SPI_IOC_CS1 AR71XX_SPI_IOC_CS(1)
909#define AR71XX_SPI_IOC_CS2 AR71XX_SPI_IOC_CS(2)
910#define AR71XX_SPI_IOC_CS_ALL (AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \
911 AR71XX_SPI_IOC_CS2)
912
913/*
914 * GPIO block
915 */
916#define AR71XX_GPIO_REG_OE 0x00
917#define AR71XX_GPIO_REG_IN 0x04
918#define AR71XX_GPIO_REG_OUT 0x08
919#define AR71XX_GPIO_REG_SET 0x0c
920#define AR71XX_GPIO_REG_CLEAR 0x10
921#define AR71XX_GPIO_REG_INT_MODE 0x14
922#define AR71XX_GPIO_REG_INT_TYPE 0x18
923#define AR71XX_GPIO_REG_INT_POLARITY 0x1c
924#define AR71XX_GPIO_REG_INT_PENDING 0x20
925#define AR71XX_GPIO_REG_INT_ENABLE 0x24
926#define AR71XX_GPIO_REG_FUNC 0x28
927
928#define AR934X_GPIO_REG_OUT_FUNC0 0x2c
929#define AR934X_GPIO_REG_OUT_FUNC1 0x30
930#define AR934X_GPIO_REG_OUT_FUNC2 0x34
931#define AR934X_GPIO_REG_OUT_FUNC3 0x38
932#define AR934X_GPIO_REG_OUT_FUNC4 0x3c
933#define AR934X_GPIO_REG_OUT_FUNC5 0x40
934#define AR934X_GPIO_REG_FUNC 0x6c
935
936#define QCA953X_GPIO_REG_OUT_FUNC0 0x2c
937#define QCA953X_GPIO_REG_OUT_FUNC1 0x30
938#define QCA953X_GPIO_REG_OUT_FUNC2 0x34
939#define QCA953X_GPIO_REG_OUT_FUNC3 0x38
940#define QCA953X_GPIO_REG_OUT_FUNC4 0x3c
941#define QCA953X_GPIO_REG_IN_ENABLE0 0x44
942#define QCA953X_GPIO_REG_FUNC 0x6c
943
944#define QCA953X_GPIO_OUT_MUX_SPI_CS1 10
945#define QCA953X_GPIO_OUT_MUX_SPI_CS2 11
946#define QCA953X_GPIO_OUT_MUX_SPI_CS0 9
947#define QCA953X_GPIO_OUT_MUX_SPI_CLK 8
948#define QCA953X_GPIO_OUT_MUX_SPI_MOSI 12
949#define QCA953X_GPIO_OUT_MUX_LED_LINK1 41
950#define QCA953X_GPIO_OUT_MUX_LED_LINK2 42
951#define QCA953X_GPIO_OUT_MUX_LED_LINK3 43
952#define QCA953X_GPIO_OUT_MUX_LED_LINK4 44
953#define QCA953X_GPIO_OUT_MUX_LED_LINK5 45
954
955#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c
956#define QCA955X_GPIO_REG_OUT_FUNC1 0x30
957#define QCA955X_GPIO_REG_OUT_FUNC2 0x34
958#define QCA955X_GPIO_REG_OUT_FUNC3 0x38
959#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c
960#define QCA955X_GPIO_REG_OUT_FUNC5 0x40
961#define QCA955X_GPIO_REG_FUNC 0x6c
962
963#define QCA956X_GPIO_REG_OUT_FUNC0 0x2c
964#define QCA956X_GPIO_REG_OUT_FUNC1 0x30
965#define QCA956X_GPIO_REG_OUT_FUNC2 0x34
966#define QCA956X_GPIO_REG_OUT_FUNC3 0x38
967#define QCA956X_GPIO_REG_OUT_FUNC4 0x3c
968#define QCA956X_GPIO_REG_OUT_FUNC5 0x40
969#define QCA956X_GPIO_REG_IN_ENABLE0 0x44
970#define QCA956X_GPIO_REG_IN_ENABLE3 0x50
971#define QCA956X_GPIO_REG_FUNC 0x6c
972
973#define QCA956X_GPIO_OUT_MUX_GE0_MDO 32
974#define QCA956X_GPIO_OUT_MUX_GE0_MDC 33
975
976#define AR71XX_GPIO_COUNT 16
977#define AR7240_GPIO_COUNT 18
978#define AR7241_GPIO_COUNT 20
979#define AR913X_GPIO_COUNT 22
980#define AR933X_GPIO_COUNT 30
981#define AR934X_GPIO_COUNT 23
982#define QCA953X_GPIO_COUNT 18
983#define QCA955X_GPIO_COUNT 24
984#define QCA956X_GPIO_COUNT 23
985
986/*
987 * SRIF block
988 */
989#define AR934X_SRIF_CPU_DPLL1_REG 0x1c0
990#define AR934X_SRIF_CPU_DPLL2_REG 0x1c4
991#define AR934X_SRIF_CPU_DPLL3_REG 0x1c8
992
993#define AR934X_SRIF_DDR_DPLL1_REG 0x240
994#define AR934X_SRIF_DDR_DPLL2_REG 0x244
995#define AR934X_SRIF_DDR_DPLL3_REG 0x248
996
997#define AR934X_SRIF_DPLL1_REFDIV_SHIFT 27
998#define AR934X_SRIF_DPLL1_REFDIV_MASK 0x1f
999#define AR934X_SRIF_DPLL1_NINT_SHIFT 18
1000#define AR934X_SRIF_DPLL1_NINT_MASK 0x1ff
1001#define AR934X_SRIF_DPLL1_NFRAC_MASK 0x0003ffff
1002
1003#define AR934X_SRIF_DPLL2_LOCAL_PLL BIT(30)
1004#define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13
1005#define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7
1006
1007#define QCA953X_SRIF_CPU_DPLL1_REG 0x1c0
1008#define QCA953X_SRIF_CPU_DPLL2_REG 0x1c4
1009#define QCA953X_SRIF_CPU_DPLL3_REG 0x1c8
1010
1011#define QCA953X_SRIF_DDR_DPLL1_REG 0x240
1012#define QCA953X_SRIF_DDR_DPLL2_REG 0x244
1013#define QCA953X_SRIF_DDR_DPLL3_REG 0x248
1014
1015#define QCA953X_SRIF_DPLL1_REFDIV_SHIFT 27
1016#define QCA953X_SRIF_DPLL1_REFDIV_MASK 0x1f
1017#define QCA953X_SRIF_DPLL1_NINT_SHIFT 18
1018#define QCA953X_SRIF_DPLL1_NINT_MASK 0x1ff
1019#define QCA953X_SRIF_DPLL1_NFRAC_MASK 0x0003ffff
1020
1021#define QCA953X_SRIF_DPLL2_LOCAL_PLL BIT(30)
1022#define QCA953X_SRIF_DPLL2_OUTDIV_SHIFT 13
1023#define QCA953X_SRIF_DPLL2_OUTDIV_MASK 0x7
1024
1025#define AR71XX_GPIO_FUNC_STEREO_EN BIT(17)
1026#define AR71XX_GPIO_FUNC_SLIC_EN BIT(16)
1027#define AR71XX_GPIO_FUNC_SPI_CS2_EN BIT(13)
1028#define AR71XX_GPIO_FUNC_SPI_CS1_EN BIT(12)
1029#define AR71XX_GPIO_FUNC_UART_EN BIT(8)
1030#define AR71XX_GPIO_FUNC_USB_OC_EN BIT(4)
1031#define AR71XX_GPIO_FUNC_USB_CLK_EN BIT(0)
1032
1033#define AR724X_GPIO_FUNC_GE0_MII_CLK_EN BIT(19)
1034#define AR724X_GPIO_FUNC_SPI_EN BIT(18)
1035#define AR724X_GPIO_FUNC_SPI_CS_EN2 BIT(14)
1036#define AR724X_GPIO_FUNC_SPI_CS_EN1 BIT(13)
1037#define AR724X_GPIO_FUNC_CLK_OBS5_EN BIT(12)
1038#define AR724X_GPIO_FUNC_CLK_OBS4_EN BIT(11)
1039#define AR724X_GPIO_FUNC_CLK_OBS3_EN BIT(10)
1040#define AR724X_GPIO_FUNC_CLK_OBS2_EN BIT(9)
1041#define AR724X_GPIO_FUNC_CLK_OBS1_EN BIT(8)
1042#define AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7)
1043#define AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6)
1044#define AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5)
1045#define AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4)
1046#define AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3)
1047#define AR724X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2)
1048#define AR724X_GPIO_FUNC_UART_EN BIT(1)
1049#define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0)
1050
1051#define AR913X_GPIO_FUNC_WMAC_LED_EN BIT(22)
1052#define AR913X_GPIO_FUNC_EXP_PORT_CS_EN BIT(21)
1053#define AR913X_GPIO_FUNC_I2S_REFCLKEN BIT(20)
1054#define AR913X_GPIO_FUNC_I2S_MCKEN BIT(19)
1055#define AR913X_GPIO_FUNC_I2S1_EN BIT(18)
1056#define AR913X_GPIO_FUNC_I2S0_EN BIT(17)
1057#define AR913X_GPIO_FUNC_SLIC_EN BIT(16)
1058#define AR913X_GPIO_FUNC_UART_RTSCTS_EN BIT(9)
1059#define AR913X_GPIO_FUNC_UART_EN BIT(8)
1060#define AR913X_GPIO_FUNC_USB_CLK_EN BIT(4)
1061
1062#define AR933X_GPIO_FUNC_SPDIF2TCK BIT(31)
1063#define AR933X_GPIO_FUNC_SPDIF_EN BIT(30)
1064#define AR933X_GPIO_FUNC_I2SO_22_18_EN BIT(29)
1065#define AR933X_GPIO_FUNC_I2S_MCK_EN BIT(27)
1066#define AR933X_GPIO_FUNC_I2SO_EN BIT(26)
1067#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_DUPL BIT(25)
1068#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_COLL BIT(24)
1069#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_ACT BIT(23)
1070#define AR933X_GPIO_FUNC_SPI_EN BIT(18)
1071#define AR933X_GPIO_FUNC_SPI_CS_EN2 BIT(14)
1072#define AR933X_GPIO_FUNC_SPI_CS_EN1 BIT(13)
1073#define AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7)
1074#define AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6)
1075#define AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5)
1076#define AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4)
1077#define AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3)
1078#define AR933X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2)
1079#define AR933X_GPIO_FUNC_UART_EN BIT(1)
1080#define AR933X_GPIO_FUNC_JTAG_DISABLE BIT(0)
1081
1082#define AR934X_GPIO_FUNC_CLK_OBS7_EN BIT(9)
1083#define AR934X_GPIO_FUNC_CLK_OBS6_EN BIT(8)
1084#define AR934X_GPIO_FUNC_CLK_OBS5_EN BIT(7)
1085#define AR934X_GPIO_FUNC_CLK_OBS4_EN BIT(6)
1086#define AR934X_GPIO_FUNC_CLK_OBS3_EN BIT(5)
1087#define AR934X_GPIO_FUNC_CLK_OBS2_EN BIT(4)
1088#define AR934X_GPIO_FUNC_CLK_OBS1_EN BIT(3)
1089#define AR934X_GPIO_FUNC_CLK_OBS0_EN BIT(2)
1090#define AR934X_GPIO_FUNC_JTAG_DISABLE BIT(1)
1091
1092#define AR934X_GPIO_OUT_GPIO 0
1093#define AR934X_GPIO_OUT_SPI_CS1 7
1094#define AR934X_GPIO_OUT_LED_LINK0 41
1095#define AR934X_GPIO_OUT_LED_LINK1 42
1096#define AR934X_GPIO_OUT_LED_LINK2 43
1097#define AR934X_GPIO_OUT_LED_LINK3 44
1098#define AR934X_GPIO_OUT_LED_LINK4 45
1099#define AR934X_GPIO_OUT_EXT_LNA0 46
1100#define AR934X_GPIO_OUT_EXT_LNA1 47
1101
1102#define QCA955X_GPIO_FUNC_CLK_OBS7_EN BIT(9)
1103#define QCA955X_GPIO_FUNC_CLK_OBS6_EN BIT(8)
1104#define QCA955X_GPIO_FUNC_CLK_OBS5_EN BIT(7)
1105#define QCA955X_GPIO_FUNC_CLK_OBS4_EN BIT(6)
1106#define QCA955X_GPIO_FUNC_CLK_OBS3_EN BIT(5)
1107#define QCA955X_GPIO_FUNC_CLK_OBS2_EN BIT(4)
1108#define QCA955X_GPIO_FUNC_CLK_OBS1_EN BIT(3)
1109#define QCA955X_GPIO_FUNC_JTAG_DISABLE BIT(1)
1110
1111#define QCA955X_GPIO_OUT_GPIO 0
1112#define QCA955X_MII_EXT_MDI 1
1113#define QCA955X_SLIC_DATA_OUT 3
1114#define QCA955X_SLIC_PCM_FS 4
1115#define QCA955X_SLIC_PCM_CLK 5
1116#define QCA955X_SPI_CLK 8
1117#define QCA955X_SPI_CS_0 9
1118#define QCA955X_SPI_CS_1 10
1119#define QCA955X_SPI_CS_2 11
1120#define QCA955X_SPI_MISO 12
1121#define QCA955X_I2S_CLK 13
1122#define QCA955X_I2S_WS 14
1123#define QCA955X_I2S_SD 15
1124#define QCA955X_I2S_MCK 16
1125#define QCA955X_SPDIF_OUT 17
1126#define QCA955X_UART1_TD 18
1127#define QCA955X_UART1_RTS 19
1128#define QCA955X_UART1_RD 20
1129#define QCA955X_UART1_CTS 21
1130#define QCA955X_UART0_SOUT 22
1131#define QCA955X_SPDIF2_OUT 23
1132#define QCA955X_LED_SGMII_SPEED0 24
1133#define QCA955X_LED_SGMII_SPEED1 25
1134#define QCA955X_LED_SGMII_DUPLEX 26
1135#define QCA955X_LED_SGMII_LINK_UP 27
1136#define QCA955X_SGMII_SPEED0_INVERT 28
1137#define QCA955X_SGMII_SPEED1_INVERT 29
1138#define QCA955X_SGMII_DUPLEX_INVERT 30
1139#define QCA955X_SGMII_LINK_UP_INVERT 31
1140#define QCA955X_GE1_MII_MDO 32
1141#define QCA955X_GE1_MII_MDC 33
1142#define QCA955X_SWCOM2 38
1143#define QCA955X_SWCOM3 39
1144#define QCA955X_MAC2_GPIO 40
1145#define QCA955X_MAC3_GPIO 41
1146#define QCA955X_ATT_LED 42
1147#define QCA955X_PWR_LED 43
1148#define QCA955X_TX_FRAME 44
1149#define QCA955X_RX_CLEAR_EXTERNAL 45
1150#define QCA955X_LED_NETWORK_EN 46
1151#define QCA955X_LED_POWER_EN 47
1152#define QCA955X_WMAC_GLUE_WOW 68
1153#define QCA955X_RX_CLEAR_EXTENSION 70
1154#define QCA955X_CP_NAND_CS1 73
1155#define QCA955X_USB_SUSPEND 74
1156#define QCA955X_ETH_TX_ERR 75
1157#define QCA955X_DDR_DQ_OE 76
1158#define QCA955X_CLKREQ_N_EP 77
1159#define QCA955X_CLKREQ_N_RC 78
1160#define QCA955X_CLK_OBS0 79
1161#define QCA955X_CLK_OBS1 80
1162#define QCA955X_CLK_OBS2 81
1163#define QCA955X_CLK_OBS3 82
1164#define QCA955X_CLK_OBS4 83
1165#define QCA955X_CLK_OBS5 84
1166
1167/*
1168 * MII_CTRL block
1169 */
1170#define AR71XX_MII_REG_MII0_CTRL 0x00
1171#define AR71XX_MII_REG_MII1_CTRL 0x04
1172
1173#define AR71XX_MII_CTRL_IF_MASK 3
1174#define AR71XX_MII_CTRL_SPEED_SHIFT 4
1175#define AR71XX_MII_CTRL_SPEED_MASK 3
1176#define AR71XX_MII_CTRL_SPEED_10 0
1177#define AR71XX_MII_CTRL_SPEED_100 1
1178#define AR71XX_MII_CTRL_SPEED_1000 2
1179
1180#define AR71XX_MII0_CTRL_IF_GMII 0
1181#define AR71XX_MII0_CTRL_IF_MII 1
1182#define AR71XX_MII0_CTRL_IF_RGMII 2
1183#define AR71XX_MII0_CTRL_IF_RMII 3
1184
1185#define AR71XX_MII1_CTRL_IF_RGMII 0
1186#define AR71XX_MII1_CTRL_IF_RMII 1
1187
1188/*
1189 * AR933X GMAC interface
1190 */
1191#define AR933X_GMAC_REG_ETH_CFG 0x00
1192
1193#define AR933X_ETH_CFG_RGMII_GE0 BIT(0)
1194#define AR933X_ETH_CFG_MII_GE0 BIT(1)
1195#define AR933X_ETH_CFG_GMII_GE0 BIT(2)
1196#define AR933X_ETH_CFG_MII_GE0_MASTER BIT(3)
1197#define AR933X_ETH_CFG_MII_GE0_SLAVE BIT(4)
1198#define AR933X_ETH_CFG_MII_GE0_ERR_EN BIT(5)
1199#define AR933X_ETH_CFG_SW_PHY_SWAP BIT(7)
1200#define AR933X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(8)
1201#define AR933X_ETH_CFG_RMII_GE0 BIT(9)
1202#define AR933X_ETH_CFG_RMII_GE0_SPD_10 0
1203#define AR933X_ETH_CFG_RMII_GE0_SPD_100 BIT(10)
1204
1205/*
1206 * AR934X GMAC Interface
1207 */
1208#define AR934X_GMAC_REG_ETH_CFG 0x00
1209
1210#define AR934X_ETH_CFG_RGMII_GMAC0 BIT(0)
1211#define AR934X_ETH_CFG_MII_GMAC0 BIT(1)
1212#define AR934X_ETH_CFG_GMII_GMAC0 BIT(2)
1213#define AR934X_ETH_CFG_MII_GMAC0_MASTER BIT(3)
1214#define AR934X_ETH_CFG_MII_GMAC0_SLAVE BIT(4)
1215#define AR934X_ETH_CFG_MII_GMAC0_ERR_EN BIT(5)
1216#define AR934X_ETH_CFG_SW_ONLY_MODE BIT(6)
1217#define AR934X_ETH_CFG_SW_PHY_SWAP BIT(7)
1218#define AR934X_ETH_CFG_SW_APB_ACCESS BIT(9)
1219#define AR934X_ETH_CFG_RMII_GMAC0 BIT(10)
1220#define AR933X_ETH_CFG_MII_CNTL_SPEED BIT(11)
1221#define AR934X_ETH_CFG_RMII_GMAC0_MASTER BIT(12)
1222#define AR933X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13)
1223#define AR934X_ETH_CFG_RXD_DELAY BIT(14)
1224#define AR934X_ETH_CFG_RXD_DELAY_MASK 0x3
1225#define AR934X_ETH_CFG_RXD_DELAY_SHIFT 14
1226#define AR934X_ETH_CFG_RDV_DELAY BIT(16)
1227#define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3
1228#define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16
1229
1230/*
1231 * QCA953X GMAC Interface
1232 */
1233#define QCA953X_GMAC_REG_ETH_CFG 0x00
1234
1235#define QCA953X_ETH_CFG_SW_ONLY_MODE BIT(6)
1236#define QCA953X_ETH_CFG_SW_PHY_SWAP BIT(7)
1237#define QCA953X_ETH_CFG_SW_APB_ACCESS BIT(9)
1238#define QCA953X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13)
1239
1240/*
1241 * QCA955X GMAC Interface
1242 */
1243
1244#define QCA955X_GMAC_REG_ETH_CFG 0x00
1245#define QCA955X_GMAC_REG_SGMII_SERDES 0x18
1246
1247#define QCA955X_ETH_CFG_RGMII_EN BIT(0)
1248#define QCA955X_ETH_CFG_MII_GE0 BIT(1)
1249#define QCA955X_ETH_CFG_GMII_GE0 BIT(2)
1250#define QCA955X_ETH_CFG_MII_GE0_MASTER BIT(3)
1251#define QCA955X_ETH_CFG_MII_GE0_SLAVE BIT(4)
1252#define QCA955X_ETH_CFG_GE0_ERR_EN BIT(5)
1253#define QCA955X_ETH_CFG_GE0_SGMII BIT(6)
1254#define QCA955X_ETH_CFG_RMII_GE0 BIT(10)
1255#define QCA955X_ETH_CFG_MII_CNTL_SPEED BIT(11)
1256#define QCA955X_ETH_CFG_RMII_GE0_MASTER BIT(12)
1257#define QCA955X_ETH_CFG_RXD_DELAY_MASK 0x3
1258#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT 14
1259#define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
1260#define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3
1261#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16
1262#define QCA955X_ETH_CFG_TXD_DELAY_MASK 0x3
1263#define QCA955X_ETH_CFG_TXD_DELAY_SHIFT 18
1264#define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3
1265#define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20
1266
1267#define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15)
1268#define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23
1269#define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf
1270/*
1271 * QCA956X GMAC Interface
1272 */
1273
1274#define QCA956X_GMAC_REG_ETH_CFG 0x00
1275#define QCA956X_GMAC_REG_SGMII_RESET 0x14
1276#define QCA956X_GMAC_REG_SGMII_SERDES 0x18
1277#define QCA956X_GMAC_REG_MR_AN_CONTROL 0x1c
1278#define QCA956X_GMAC_REG_SGMII_CONFIG 0x34
1279#define QCA956X_GMAC_REG_SGMII_DEBUG 0x58
1280
1281#define QCA956X_ETH_CFG_RGMII_EN BIT(0)
1282#define QCA956X_ETH_CFG_GE0_SGMII BIT(6)
1283#define QCA956X_ETH_CFG_SW_ONLY_MODE BIT(7)
1284#define QCA956X_ETH_CFG_SW_PHY_SWAP BIT(8)
1285#define QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(9)
1286#define QCA956X_ETH_CFG_SW_APB_ACCESS BIT(10)
1287#define QCA956X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13)
1288#define QCA956X_ETH_CFG_RXD_DELAY_MASK 0x3
1289#define QCA956X_ETH_CFG_RXD_DELAY_SHIFT 14
1290#define QCA956X_ETH_CFG_RDV_DELAY_MASK 0x3
1291#define QCA956X_ETH_CFG_RDV_DELAY_SHIFT 16
1292
1293#define QCA956X_SGMII_RESET_RX_CLK_N_RESET 0x0
1294#define QCA956X_SGMII_RESET_RX_CLK_N BIT(0)
1295#define QCA956X_SGMII_RESET_TX_CLK_N BIT(1)
1296#define QCA956X_SGMII_RESET_RX_125M_N BIT(2)
1297#define QCA956X_SGMII_RESET_TX_125M_N BIT(3)
1298#define QCA956X_SGMII_RESET_HW_RX_125M_N BIT(4)
1299
1300#define QCA956X_SGMII_SERDES_CDR_BW_MASK 0x3
1301#define QCA956X_SGMII_SERDES_CDR_BW_SHIFT 1
1302#define QCA956X_SGMII_SERDES_TX_DR_CTRL_MASK 0x7
1303#define QCA956X_SGMII_SERDES_TX_DR_CTRL_SHIFT 4
1304#define QCA956X_SGMII_SERDES_PLL_BW BIT(8)
1305#define QCA956X_SGMII_SERDES_VCO_FAST BIT(9)
1306#define QCA956X_SGMII_SERDES_VCO_SLOW BIT(10)
1307#define QCA956X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15)
1308#define QCA956X_SGMII_SERDES_EN_SIGNAL_DETECT BIT(16)
1309#define QCA956X_SGMII_SERDES_FIBER_SDO BIT(17)
1310#define QCA956X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23
1311#define QCA956X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf
1312#define QCA956X_SGMII_SERDES_VCO_REG_SHIFT 27
1313#define QCA956X_SGMII_SERDES_VCO_REG_MASK 0xf
1314
1315#define QCA956X_MR_AN_CONTROL_AN_ENABLE BIT(12)
1316#define QCA956X_MR_AN_CONTROL_PHY_RESET BIT(15)
1317
1318#define QCA956X_SGMII_CONFIG_MODE_CTRL_SHIFT 0
1319#define QCA956X_SGMII_CONFIG_MODE_CTRL_MASK 0x7
1320
1321#endif /* __ASM_MACH_AR71XX_REGS_H */
diff --git a/arch/mips/include/asm/mach-ath79/ar933x_uart.h b/arch/mips/include/asm/mach-ath79/ar933x_uart.h
new file mode 100644
index 000000000..cacf3545e
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/ar933x_uart.h
@@ -0,0 +1,64 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Atheros AR933X UART defines
4 *
5 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
6 */
7
8#ifndef __AR933X_UART_H
9#define __AR933X_UART_H
10
11#define AR933X_UART_REGS_SIZE 20
12#define AR933X_UART_FIFO_SIZE 16
13
14#define AR933X_UART_DATA_REG 0x00
15#define AR933X_UART_CS_REG 0x04
16#define AR933X_UART_CLOCK_REG 0x08
17#define AR933X_UART_INT_REG 0x0c
18#define AR933X_UART_INT_EN_REG 0x10
19
20#define AR933X_UART_DATA_TX_RX_MASK 0xff
21#define AR933X_UART_DATA_RX_CSR BIT(8)
22#define AR933X_UART_DATA_TX_CSR BIT(9)
23
24#define AR933X_UART_CS_PARITY_S 0
25#define AR933X_UART_CS_PARITY_M 0x3
26#define AR933X_UART_CS_PARITY_NONE 0
27#define AR933X_UART_CS_PARITY_ODD 2
28#define AR933X_UART_CS_PARITY_EVEN 3
29#define AR933X_UART_CS_IF_MODE_S 2
30#define AR933X_UART_CS_IF_MODE_M 0x3
31#define AR933X_UART_CS_IF_MODE_NONE 0
32#define AR933X_UART_CS_IF_MODE_DTE 1
33#define AR933X_UART_CS_IF_MODE_DCE 2
34#define AR933X_UART_CS_FLOW_CTRL_S 4
35#define AR933X_UART_CS_FLOW_CTRL_M 0x3
36#define AR933X_UART_CS_DMA_EN BIT(6)
37#define AR933X_UART_CS_TX_READY_ORIDE BIT(7)
38#define AR933X_UART_CS_RX_READY_ORIDE BIT(8)
39#define AR933X_UART_CS_TX_READY BIT(9)
40#define AR933X_UART_CS_RX_BREAK BIT(10)
41#define AR933X_UART_CS_TX_BREAK BIT(11)
42#define AR933X_UART_CS_HOST_INT BIT(12)
43#define AR933X_UART_CS_HOST_INT_EN BIT(13)
44#define AR933X_UART_CS_TX_BUSY BIT(14)
45#define AR933X_UART_CS_RX_BUSY BIT(15)
46
47#define AR933X_UART_CLOCK_STEP_M 0xffff
48#define AR933X_UART_CLOCK_SCALE_M 0xfff
49#define AR933X_UART_CLOCK_SCALE_S 16
50#define AR933X_UART_CLOCK_STEP_M 0xffff
51
52#define AR933X_UART_INT_RX_VALID BIT(0)
53#define AR933X_UART_INT_TX_READY BIT(1)
54#define AR933X_UART_INT_RX_FRAMING_ERR BIT(2)
55#define AR933X_UART_INT_RX_OFLOW_ERR BIT(3)
56#define AR933X_UART_INT_TX_OFLOW_ERR BIT(4)
57#define AR933X_UART_INT_RX_PARITY_ERR BIT(5)
58#define AR933X_UART_INT_RX_BREAK_ON BIT(6)
59#define AR933X_UART_INT_RX_BREAK_OFF BIT(7)
60#define AR933X_UART_INT_RX_FULL BIT(8)
61#define AR933X_UART_INT_TX_EMPTY BIT(9)
62#define AR933X_UART_INT_ALLINTS 0x3ff
63
64#endif /* __AR933X_UART_H */
diff --git a/arch/mips/include/asm/mach-ath79/ath79.h b/arch/mips/include/asm/mach-ath79/ath79.h
new file mode 100644
index 000000000..70cda7449
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/ath79.h
@@ -0,0 +1,178 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Atheros AR71XX/AR724X/AR913X common definitions
4 *
5 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 *
8 * Parts of this file are based on Atheros' 2.6.15 BSP
9 */
10
11#ifndef __ASM_MACH_ATH79_H
12#define __ASM_MACH_ATH79_H
13
14#include <linux/types.h>
15#include <linux/io.h>
16
17enum ath79_soc_type {
18 ATH79_SOC_UNKNOWN,
19 ATH79_SOC_AR7130,
20 ATH79_SOC_AR7141,
21 ATH79_SOC_AR7161,
22 ATH79_SOC_AR7240,
23 ATH79_SOC_AR7241,
24 ATH79_SOC_AR7242,
25 ATH79_SOC_AR9130,
26 ATH79_SOC_AR9132,
27 ATH79_SOC_AR9330,
28 ATH79_SOC_AR9331,
29 ATH79_SOC_AR9341,
30 ATH79_SOC_AR9342,
31 ATH79_SOC_AR9344,
32 ATH79_SOC_QCA9533,
33 ATH79_SOC_QCA9556,
34 ATH79_SOC_QCA9558,
35 ATH79_SOC_TP9343,
36 ATH79_SOC_QCA956X,
37};
38
39extern enum ath79_soc_type ath79_soc;
40extern unsigned int ath79_soc_rev;
41
42static inline int soc_is_ar71xx(void)
43{
44 return (ath79_soc == ATH79_SOC_AR7130 ||
45 ath79_soc == ATH79_SOC_AR7141 ||
46 ath79_soc == ATH79_SOC_AR7161);
47}
48
49static inline int soc_is_ar724x(void)
50{
51 return (ath79_soc == ATH79_SOC_AR7240 ||
52 ath79_soc == ATH79_SOC_AR7241 ||
53 ath79_soc == ATH79_SOC_AR7242);
54}
55
56static inline int soc_is_ar7240(void)
57{
58 return (ath79_soc == ATH79_SOC_AR7240);
59}
60
61static inline int soc_is_ar7241(void)
62{
63 return (ath79_soc == ATH79_SOC_AR7241);
64}
65
66static inline int soc_is_ar7242(void)
67{
68 return (ath79_soc == ATH79_SOC_AR7242);
69}
70
71static inline int soc_is_ar913x(void)
72{
73 return (ath79_soc == ATH79_SOC_AR9130 ||
74 ath79_soc == ATH79_SOC_AR9132);
75}
76
77static inline int soc_is_ar933x(void)
78{
79 return (ath79_soc == ATH79_SOC_AR9330 ||
80 ath79_soc == ATH79_SOC_AR9331);
81}
82
83static inline int soc_is_ar9341(void)
84{
85 return (ath79_soc == ATH79_SOC_AR9341);
86}
87
88static inline int soc_is_ar9342(void)
89{
90 return (ath79_soc == ATH79_SOC_AR9342);
91}
92
93static inline int soc_is_ar9344(void)
94{
95 return (ath79_soc == ATH79_SOC_AR9344);
96}
97
98static inline int soc_is_ar934x(void)
99{
100 return soc_is_ar9341() || soc_is_ar9342() || soc_is_ar9344();
101}
102
103static inline int soc_is_qca9533(void)
104{
105 return ath79_soc == ATH79_SOC_QCA9533;
106}
107
108static inline int soc_is_qca953x(void)
109{
110 return soc_is_qca9533();
111}
112
113static inline int soc_is_qca9556(void)
114{
115 return ath79_soc == ATH79_SOC_QCA9556;
116}
117
118static inline int soc_is_qca9558(void)
119{
120 return ath79_soc == ATH79_SOC_QCA9558;
121}
122
123static inline int soc_is_qca955x(void)
124{
125 return soc_is_qca9556() || soc_is_qca9558();
126}
127
128static inline int soc_is_tp9343(void)
129{
130 return ath79_soc == ATH79_SOC_TP9343;
131}
132
133static inline int soc_is_qca9561(void)
134{
135 return ath79_soc == ATH79_SOC_QCA956X;
136}
137
138static inline int soc_is_qca9563(void)
139{
140 return ath79_soc == ATH79_SOC_QCA956X;
141}
142
143static inline int soc_is_qca956x(void)
144{
145 return soc_is_qca9561() || soc_is_qca9563();
146}
147
148void ath79_ddr_wb_flush(unsigned int reg);
149void ath79_ddr_set_pci_windows(void);
150
151extern void __iomem *ath79_pll_base;
152extern void __iomem *ath79_reset_base;
153
154static inline void ath79_pll_wr(unsigned reg, u32 val)
155{
156 __raw_writel(val, ath79_pll_base + reg);
157}
158
159static inline u32 ath79_pll_rr(unsigned reg)
160{
161 return __raw_readl(ath79_pll_base + reg);
162}
163
164static inline void ath79_reset_wr(unsigned reg, u32 val)
165{
166 __raw_writel(val, ath79_reset_base + reg);
167 (void) __raw_readl(ath79_reset_base + reg); /* flush */
168}
169
170static inline u32 ath79_reset_rr(unsigned reg)
171{
172 return __raw_readl(ath79_reset_base + reg);
173}
174
175void ath79_device_reset_set(u32 mask);
176void ath79_device_reset_clear(u32 mask);
177
178#endif /* __ASM_MACH_ATH79_H */
diff --git a/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h
new file mode 100644
index 000000000..79ab3ad9f
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h
@@ -0,0 +1,56 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Atheros AR71XX/AR724X/AR913X specific CPU feature overrides
4 *
5 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 *
8 * This file was derived from: include/asm-mips/cpu-features.h
9 * Copyright (C) 2003, 2004 Ralf Baechle
10 * Copyright (C) 2004 Maciej W. Rozycki
11 */
12#ifndef __ASM_MACH_ATH79_CPU_FEATURE_OVERRIDES_H
13#define __ASM_MACH_ATH79_CPU_FEATURE_OVERRIDES_H
14
15#define cpu_has_tlb 1
16#define cpu_has_4kex 1
17#define cpu_has_3k_cache 0
18#define cpu_has_4k_cache 1
19#define cpu_has_tx39_cache 0
20#define cpu_has_sb1_cache 0
21#define cpu_has_fpu 0
22#define cpu_has_32fpr 0
23#define cpu_has_counter 1
24#define cpu_has_watch 1
25#define cpu_has_divec 1
26
27#define cpu_has_prefetch 1
28#define cpu_has_ejtag 1
29#define cpu_has_llsc 1
30
31#define cpu_has_mips16 1
32#define cpu_has_mdmx 0
33#define cpu_has_mips3d 0
34#define cpu_has_smartmips 0
35#define cpu_has_rixi 0
36
37#define cpu_has_mips32r1 1
38#define cpu_has_mips32r2 1
39#define cpu_has_mips64r1 0
40#define cpu_has_mips64r2 0
41
42#define cpu_has_mipsmt 0
43#define cpu_has_userlocal 0
44
45#define cpu_has_64bits 0
46#define cpu_has_64bit_zero_reg 0
47#define cpu_has_64bit_gp_regs 0
48
49#define cpu_dcache_line_size() 32
50#define cpu_icache_line_size() 32
51#define cpu_has_vtag_icache 0
52#define cpu_has_dc_aliases 1
53#define cpu_has_ic_fills_f_dc 0
54#define cpu_has_pindexed_dcache 0
55
56#endif /* __ASM_MACH_ATH79_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ath79/irq.h b/arch/mips/include/asm/mach-ath79/irq.h
new file mode 100644
index 000000000..882534be0
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/irq.h
@@ -0,0 +1,32 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
4 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
5 */
6#ifndef __ASM_MACH_ATH79_IRQ_H
7#define __ASM_MACH_ATH79_IRQ_H
8
9#define MIPS_CPU_IRQ_BASE 0
10#define NR_IRQS 51
11
12#define ATH79_CPU_IRQ(_x) (MIPS_CPU_IRQ_BASE + (_x))
13
14#define ATH79_MISC_IRQ_BASE 8
15#define ATH79_MISC_IRQ_COUNT 32
16#define ATH79_MISC_IRQ(_x) (ATH79_MISC_IRQ_BASE + (_x))
17
18#define ATH79_PCI_IRQ_BASE (ATH79_MISC_IRQ_BASE + ATH79_MISC_IRQ_COUNT)
19#define ATH79_PCI_IRQ_COUNT 6
20#define ATH79_PCI_IRQ(_x) (ATH79_PCI_IRQ_BASE + (_x))
21
22#define ATH79_IP2_IRQ_BASE (ATH79_PCI_IRQ_BASE + ATH79_PCI_IRQ_COUNT)
23#define ATH79_IP2_IRQ_COUNT 2
24#define ATH79_IP2_IRQ(_x) (ATH79_IP2_IRQ_BASE + (_x))
25
26#define ATH79_IP3_IRQ_BASE (ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT)
27#define ATH79_IP3_IRQ_COUNT 3
28#define ATH79_IP3_IRQ(_x) (ATH79_IP3_IRQ_BASE + (_x))
29
30#include <asm/mach-generic/irq.h>
31
32#endif /* __ASM_MACH_ATH79_IRQ_H */
diff --git a/arch/mips/include/asm/mach-ath79/kernel-entry-init.h b/arch/mips/include/asm/mach-ath79/kernel-entry-init.h
new file mode 100644
index 000000000..88db67bf4
--- /dev/null
+++ b/arch/mips/include/asm/mach-ath79/kernel-entry-init.h
@@ -0,0 +1,28 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Atheros AR71XX/AR724X/AR913X specific kernel entry setup
4 *
5 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
6 */
7#ifndef __ASM_MACH_ATH79_KERNEL_ENTRY_H
8#define __ASM_MACH_ATH79_KERNEL_ENTRY_H
9
10 /*
11 * Some bootloaders set the 'Kseg0 coherency algorithm' to
12 * 'Cacheable, noncoherent, write-through, no write allocate'
13 * and this cause performance issues. Let's go and change it to
14 * 'Cacheable, noncoherent, write-back, write allocate'
15 */
16 .macro kernel_entry_setup
17 mfc0 t0, CP0_CONFIG
18 li t1, ~CONF_CM_CMASK
19 and t0, t1
20 ori t0, CONF_CM_CACHABLE_NONCOHERENT
21 mtc0 t0, CP0_CONFIG
22 nop
23 .endm
24
25 .macro smp_slave_setup
26 .endm
27
28#endif /* __ASM_MACH_ATH79_KERNEL_ENTRY_H */
diff --git a/arch/mips/include/asm/mach-au1x00/au1000.h b/arch/mips/include/asm/mach-au1x00/au1000.h
new file mode 100644
index 000000000..a7eec3364
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/au1000.h
@@ -0,0 +1,1211 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Include file for Alchemy Semiconductor's Au1k CPU.
5 *
6 * Copyright 2000-2001, 2006-2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. <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 /*
31 * some definitions add by takuzo@sm.sony.co.jp and sato@sm.sony.co.jp
32 */
33
34#ifndef _AU1000_H_
35#define _AU1000_H_
36
37/* SOC Interrupt numbers */
38/* Au1000-style (IC0/1): 2 controllers with 32 sources each */
39#define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
40#define AU1000_INTC0_INT_LAST (AU1000_INTC0_INT_BASE + 31)
41#define AU1000_INTC1_INT_BASE (AU1000_INTC0_INT_LAST + 1)
42#define AU1000_INTC1_INT_LAST (AU1000_INTC1_INT_BASE + 31)
43#define AU1000_MAX_INTR AU1000_INTC1_INT_LAST
44
45/* Au1300-style (GPIC): 1 controller with up to 128 sources */
46#define ALCHEMY_GPIC_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
47#define ALCHEMY_GPIC_INT_NUM 128
48#define ALCHEMY_GPIC_INT_LAST (ALCHEMY_GPIC_INT_BASE + ALCHEMY_GPIC_INT_NUM - 1)
49
50/* common clock names, shared among all variants. AUXPLL2 is Au1300 */
51#define ALCHEMY_ROOT_CLK "root_clk"
52#define ALCHEMY_CPU_CLK "cpu_clk"
53#define ALCHEMY_AUXPLL_CLK "auxpll_clk"
54#define ALCHEMY_AUXPLL2_CLK "auxpll2_clk"
55#define ALCHEMY_SYSBUS_CLK "sysbus_clk"
56#define ALCHEMY_PERIPH_CLK "periph_clk"
57#define ALCHEMY_MEM_CLK "mem_clk"
58#define ALCHEMY_LR_CLK "lr_clk"
59#define ALCHEMY_FG0_CLK "fg0_clk"
60#define ALCHEMY_FG1_CLK "fg1_clk"
61#define ALCHEMY_FG2_CLK "fg2_clk"
62#define ALCHEMY_FG3_CLK "fg3_clk"
63#define ALCHEMY_FG4_CLK "fg4_clk"
64#define ALCHEMY_FG5_CLK "fg5_clk"
65
66/* Au1300 peripheral interrupt numbers */
67#define AU1300_FIRST_INT (ALCHEMY_GPIC_INT_BASE)
68#define AU1300_UART1_INT (AU1300_FIRST_INT + 17)
69#define AU1300_UART2_INT (AU1300_FIRST_INT + 25)
70#define AU1300_UART3_INT (AU1300_FIRST_INT + 27)
71#define AU1300_SD1_INT (AU1300_FIRST_INT + 32)
72#define AU1300_SD2_INT (AU1300_FIRST_INT + 38)
73#define AU1300_PSC0_INT (AU1300_FIRST_INT + 48)
74#define AU1300_PSC1_INT (AU1300_FIRST_INT + 52)
75#define AU1300_PSC2_INT (AU1300_FIRST_INT + 56)
76#define AU1300_PSC3_INT (AU1300_FIRST_INT + 60)
77#define AU1300_NAND_INT (AU1300_FIRST_INT + 62)
78#define AU1300_DDMA_INT (AU1300_FIRST_INT + 75)
79#define AU1300_MMU_INT (AU1300_FIRST_INT + 76)
80#define AU1300_MPU_INT (AU1300_FIRST_INT + 77)
81#define AU1300_GPU_INT (AU1300_FIRST_INT + 78)
82#define AU1300_UDMA_INT (AU1300_FIRST_INT + 79)
83#define AU1300_TOY_INT (AU1300_FIRST_INT + 80)
84#define AU1300_TOY_MATCH0_INT (AU1300_FIRST_INT + 81)
85#define AU1300_TOY_MATCH1_INT (AU1300_FIRST_INT + 82)
86#define AU1300_TOY_MATCH2_INT (AU1300_FIRST_INT + 83)
87#define AU1300_RTC_INT (AU1300_FIRST_INT + 84)
88#define AU1300_RTC_MATCH0_INT (AU1300_FIRST_INT + 85)
89#define AU1300_RTC_MATCH1_INT (AU1300_FIRST_INT + 86)
90#define AU1300_RTC_MATCH2_INT (AU1300_FIRST_INT + 87)
91#define AU1300_UART0_INT (AU1300_FIRST_INT + 88)
92#define AU1300_SD0_INT (AU1300_FIRST_INT + 89)
93#define AU1300_USB_INT (AU1300_FIRST_INT + 90)
94#define AU1300_LCD_INT (AU1300_FIRST_INT + 91)
95#define AU1300_BSA_INT (AU1300_FIRST_INT + 92)
96#define AU1300_MPE_INT (AU1300_FIRST_INT + 93)
97#define AU1300_ITE_INT (AU1300_FIRST_INT + 94)
98#define AU1300_AES_INT (AU1300_FIRST_INT + 95)
99#define AU1300_CIM_INT (AU1300_FIRST_INT + 96)
100
101/**********************************************************************/
102
103/*
104 * Physical base addresses for integrated peripherals
105 * 0..au1000 1..au1500 2..au1100 3..au1550 4..au1200 5..au1300
106 */
107
108#define AU1000_AC97_PHYS_ADDR 0x10000000 /* 012 */
109#define AU1300_ROM_PHYS_ADDR 0x10000000 /* 5 */
110#define AU1300_OTP_PHYS_ADDR 0x10002000 /* 5 */
111#define AU1300_VSS_PHYS_ADDR 0x10003000 /* 5 */
112#define AU1300_UART0_PHYS_ADDR 0x10100000 /* 5 */
113#define AU1300_UART1_PHYS_ADDR 0x10101000 /* 5 */
114#define AU1300_UART2_PHYS_ADDR 0x10102000 /* 5 */
115#define AU1300_UART3_PHYS_ADDR 0x10103000 /* 5 */
116#define AU1000_USB_OHCI_PHYS_ADDR 0x10100000 /* 012 */
117#define AU1000_USB_UDC_PHYS_ADDR 0x10200000 /* 0123 */
118#define AU1300_GPIC_PHYS_ADDR 0x10200000 /* 5 */
119#define AU1000_IRDA_PHYS_ADDR 0x10300000 /* 02 */
120#define AU1200_AES_PHYS_ADDR 0x10300000 /* 45 */
121#define AU1000_IC0_PHYS_ADDR 0x10400000 /* 01234 */
122#define AU1300_GPU_PHYS_ADDR 0x10500000 /* 5 */
123#define AU1000_MAC0_PHYS_ADDR 0x10500000 /* 023 */
124#define AU1000_MAC1_PHYS_ADDR 0x10510000 /* 023 */
125#define AU1000_MACEN_PHYS_ADDR 0x10520000 /* 023 */
126#define AU1100_SD0_PHYS_ADDR 0x10600000 /* 245 */
127#define AU1300_SD1_PHYS_ADDR 0x10601000 /* 5 */
128#define AU1300_SD2_PHYS_ADDR 0x10602000 /* 5 */
129#define AU1100_SD1_PHYS_ADDR 0x10680000 /* 24 */
130#define AU1300_SYS_PHYS_ADDR 0x10900000 /* 5 */
131#define AU1550_PSC2_PHYS_ADDR 0x10A00000 /* 3 */
132#define AU1550_PSC3_PHYS_ADDR 0x10B00000 /* 3 */
133#define AU1300_PSC0_PHYS_ADDR 0x10A00000 /* 5 */
134#define AU1300_PSC1_PHYS_ADDR 0x10A01000 /* 5 */
135#define AU1300_PSC2_PHYS_ADDR 0x10A02000 /* 5 */
136#define AU1300_PSC3_PHYS_ADDR 0x10A03000 /* 5 */
137#define AU1000_I2S_PHYS_ADDR 0x11000000 /* 02 */
138#define AU1500_MAC0_PHYS_ADDR 0x11500000 /* 1 */
139#define AU1500_MAC1_PHYS_ADDR 0x11510000 /* 1 */
140#define AU1500_MACEN_PHYS_ADDR 0x11520000 /* 1 */
141#define AU1000_UART0_PHYS_ADDR 0x11100000 /* 01234 */
142#define AU1200_SWCNT_PHYS_ADDR 0x1110010C /* 4 */
143#define AU1000_UART1_PHYS_ADDR 0x11200000 /* 0234 */
144#define AU1000_UART2_PHYS_ADDR 0x11300000 /* 0 */
145#define AU1000_UART3_PHYS_ADDR 0x11400000 /* 0123 */
146#define AU1000_SSI0_PHYS_ADDR 0x11600000 /* 02 */
147#define AU1000_SSI1_PHYS_ADDR 0x11680000 /* 02 */
148#define AU1500_GPIO2_PHYS_ADDR 0x11700000 /* 1234 */
149#define AU1000_IC1_PHYS_ADDR 0x11800000 /* 01234 */
150#define AU1000_SYS_PHYS_ADDR 0x11900000 /* 012345 */
151#define AU1550_PSC0_PHYS_ADDR 0x11A00000 /* 34 */
152#define AU1550_PSC1_PHYS_ADDR 0x11B00000 /* 34 */
153#define AU1000_MEM_PHYS_ADDR 0x14000000 /* 01234 */
154#define AU1000_STATIC_MEM_PHYS_ADDR 0x14001000 /* 01234 */
155#define AU1300_UDMA_PHYS_ADDR 0x14001800 /* 5 */
156#define AU1000_DMA_PHYS_ADDR 0x14002000 /* 012 */
157#define AU1550_DBDMA_PHYS_ADDR 0x14002000 /* 345 */
158#define AU1550_DBDMA_CONF_PHYS_ADDR 0x14003000 /* 345 */
159#define AU1000_MACDMA0_PHYS_ADDR 0x14004000 /* 0123 */
160#define AU1000_MACDMA1_PHYS_ADDR 0x14004200 /* 0123 */
161#define AU1200_CIM_PHYS_ADDR 0x14004000 /* 45 */
162#define AU1500_PCI_PHYS_ADDR 0x14005000 /* 13 */
163#define AU1550_PE_PHYS_ADDR 0x14008000 /* 3 */
164#define AU1200_MAEBE_PHYS_ADDR 0x14010000 /* 4 */
165#define AU1200_MAEFE_PHYS_ADDR 0x14012000 /* 4 */
166#define AU1300_MAEITE_PHYS_ADDR 0x14010000 /* 5 */
167#define AU1300_MAEMPE_PHYS_ADDR 0x14014000 /* 5 */
168#define AU1550_USB_OHCI_PHYS_ADDR 0x14020000 /* 3 */
169#define AU1200_USB_CTL_PHYS_ADDR 0x14020000 /* 4 */
170#define AU1200_USB_OTG_PHYS_ADDR 0x14020020 /* 4 */
171#define AU1200_USB_OHCI_PHYS_ADDR 0x14020100 /* 4 */
172#define AU1200_USB_EHCI_PHYS_ADDR 0x14020200 /* 4 */
173#define AU1200_USB_UDC_PHYS_ADDR 0x14022000 /* 4 */
174#define AU1300_USB_EHCI_PHYS_ADDR 0x14020000 /* 5 */
175#define AU1300_USB_OHCI0_PHYS_ADDR 0x14020400 /* 5 */
176#define AU1300_USB_OHCI1_PHYS_ADDR 0x14020800 /* 5 */
177#define AU1300_USB_CTL_PHYS_ADDR 0x14021000 /* 5 */
178#define AU1300_USB_OTG_PHYS_ADDR 0x14022000 /* 5 */
179#define AU1300_MAEBSA_PHYS_ADDR 0x14030000 /* 5 */
180#define AU1100_LCD_PHYS_ADDR 0x15000000 /* 2 */
181#define AU1200_LCD_PHYS_ADDR 0x15000000 /* 45 */
182#define AU1500_PCI_MEM_PHYS_ADDR 0x400000000ULL /* 13 */
183#define AU1500_PCI_IO_PHYS_ADDR 0x500000000ULL /* 13 */
184#define AU1500_PCI_CONFIG0_PHYS_ADDR 0x600000000ULL /* 13 */
185#define AU1500_PCI_CONFIG1_PHYS_ADDR 0x680000000ULL /* 13 */
186#define AU1000_PCMCIA_IO_PHYS_ADDR 0xF00000000ULL /* 012345 */
187#define AU1000_PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL /* 012345 */
188#define AU1000_PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL /* 012345 */
189
190/**********************************************************************/
191
192
193/*
194 * Au1300 GPIO+INT controller (GPIC) register offsets and bits
195 * Registers are 128bits (0x10 bytes), divided into 4 "banks".
196 */
197#define AU1300_GPIC_PINVAL 0x0000
198#define AU1300_GPIC_PINVALCLR 0x0010
199#define AU1300_GPIC_IPEND 0x0020
200#define AU1300_GPIC_PRIENC 0x0030
201#define AU1300_GPIC_IEN 0x0040 /* int_mask in manual */
202#define AU1300_GPIC_IDIS 0x0050 /* int_maskclr in manual */
203#define AU1300_GPIC_DMASEL 0x0060
204#define AU1300_GPIC_DEVSEL 0x0080
205#define AU1300_GPIC_DEVCLR 0x0090
206#define AU1300_GPIC_RSTVAL 0x00a0
207/* pin configuration space. one 32bit register for up to 128 IRQs */
208#define AU1300_GPIC_PINCFG 0x1000
209
210#define GPIC_GPIO_TO_BIT(gpio) \
211 (1 << ((gpio) & 0x1f))
212
213#define GPIC_GPIO_BANKOFF(gpio) \
214 (((gpio) >> 5) * 4)
215
216/* Pin Control bits: who owns the pin, what does it do */
217#define GPIC_CFG_PC_GPIN 0
218#define GPIC_CFG_PC_DEV 1
219#define GPIC_CFG_PC_GPOLOW 2
220#define GPIC_CFG_PC_GPOHIGH 3
221#define GPIC_CFG_PC_MASK 3
222
223/* assign pin to MIPS IRQ line */
224#define GPIC_CFG_IL_SET(x) (((x) & 3) << 2)
225#define GPIC_CFG_IL_MASK (3 << 2)
226
227/* pin interrupt type setup */
228#define GPIC_CFG_IC_OFF (0 << 4)
229#define GPIC_CFG_IC_LEVEL_LOW (1 << 4)
230#define GPIC_CFG_IC_LEVEL_HIGH (2 << 4)
231#define GPIC_CFG_IC_EDGE_FALL (5 << 4)
232#define GPIC_CFG_IC_EDGE_RISE (6 << 4)
233#define GPIC_CFG_IC_EDGE_BOTH (7 << 4)
234#define GPIC_CFG_IC_MASK (7 << 4)
235
236/* allow interrupt to wake cpu from 'wait' */
237#define GPIC_CFG_IDLEWAKE (1 << 7)
238
239/***********************************************************************/
240
241/* Au1000 SDRAM memory controller register offsets */
242#define AU1000_MEM_SDMODE0 0x0000
243#define AU1000_MEM_SDMODE1 0x0004
244#define AU1000_MEM_SDMODE2 0x0008
245#define AU1000_MEM_SDADDR0 0x000C
246#define AU1000_MEM_SDADDR1 0x0010
247#define AU1000_MEM_SDADDR2 0x0014
248#define AU1000_MEM_SDREFCFG 0x0018
249#define AU1000_MEM_SDPRECMD 0x001C
250#define AU1000_MEM_SDAUTOREF 0x0020
251#define AU1000_MEM_SDWRMD0 0x0024
252#define AU1000_MEM_SDWRMD1 0x0028
253#define AU1000_MEM_SDWRMD2 0x002C
254#define AU1000_MEM_SDSLEEP 0x0030
255#define AU1000_MEM_SDSMCKE 0x0034
256
257/* MEM_SDMODE register content definitions */
258#define MEM_SDMODE_F (1 << 22)
259#define MEM_SDMODE_SR (1 << 21)
260#define MEM_SDMODE_BS (1 << 20)
261#define MEM_SDMODE_RS (3 << 18)
262#define MEM_SDMODE_CS (7 << 15)
263#define MEM_SDMODE_TRAS (15 << 11)
264#define MEM_SDMODE_TMRD (3 << 9)
265#define MEM_SDMODE_TWR (3 << 7)
266#define MEM_SDMODE_TRP (3 << 5)
267#define MEM_SDMODE_TRCD (3 << 3)
268#define MEM_SDMODE_TCL (7 << 0)
269
270#define MEM_SDMODE_BS_2Bank (0 << 20)
271#define MEM_SDMODE_BS_4Bank (1 << 20)
272#define MEM_SDMODE_RS_11Row (0 << 18)
273#define MEM_SDMODE_RS_12Row (1 << 18)
274#define MEM_SDMODE_RS_13Row (2 << 18)
275#define MEM_SDMODE_RS_N(N) ((N) << 18)
276#define MEM_SDMODE_CS_7Col (0 << 15)
277#define MEM_SDMODE_CS_8Col (1 << 15)
278#define MEM_SDMODE_CS_9Col (2 << 15)
279#define MEM_SDMODE_CS_10Col (3 << 15)
280#define MEM_SDMODE_CS_11Col (4 << 15)
281#define MEM_SDMODE_CS_N(N) ((N) << 15)
282#define MEM_SDMODE_TRAS_N(N) ((N) << 11)
283#define MEM_SDMODE_TMRD_N(N) ((N) << 9)
284#define MEM_SDMODE_TWR_N(N) ((N) << 7)
285#define MEM_SDMODE_TRP_N(N) ((N) << 5)
286#define MEM_SDMODE_TRCD_N(N) ((N) << 3)
287#define MEM_SDMODE_TCL_N(N) ((N) << 0)
288
289/* MEM_SDADDR register contents definitions */
290#define MEM_SDADDR_E (1 << 20)
291#define MEM_SDADDR_CSBA (0x03FF << 10)
292#define MEM_SDADDR_CSMASK (0x03FF << 0)
293#define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
294#define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
295
296/* MEM_SDREFCFG register content definitions */
297#define MEM_SDREFCFG_TRC (15 << 28)
298#define MEM_SDREFCFG_TRPM (3 << 26)
299#define MEM_SDREFCFG_E (1 << 25)
300#define MEM_SDREFCFG_RE (0x1ffffff << 0)
301#define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
302#define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
303#define MEM_SDREFCFG_REF_N(N) (N)
304
305/* Au1550 SDRAM Register Offsets */
306#define AU1550_MEM_SDMODE0 0x0800
307#define AU1550_MEM_SDMODE1 0x0808
308#define AU1550_MEM_SDMODE2 0x0810
309#define AU1550_MEM_SDADDR0 0x0820
310#define AU1550_MEM_SDADDR1 0x0828
311#define AU1550_MEM_SDADDR2 0x0830
312#define AU1550_MEM_SDCONFIGA 0x0840
313#define AU1550_MEM_SDCONFIGB 0x0848
314#define AU1550_MEM_SDSTAT 0x0850
315#define AU1550_MEM_SDERRADDR 0x0858
316#define AU1550_MEM_SDSTRIDE0 0x0860
317#define AU1550_MEM_SDSTRIDE1 0x0868
318#define AU1550_MEM_SDSTRIDE2 0x0870
319#define AU1550_MEM_SDWRMD0 0x0880
320#define AU1550_MEM_SDWRMD1 0x0888
321#define AU1550_MEM_SDWRMD2 0x0890
322#define AU1550_MEM_SDPRECMD 0x08C0
323#define AU1550_MEM_SDAUTOREF 0x08C8
324#define AU1550_MEM_SDSREF 0x08D0
325#define AU1550_MEM_SDSLEEP MEM_SDSREF
326
327/* Static Bus Controller register offsets */
328#define AU1000_MEM_STCFG0 0x000
329#define AU1000_MEM_STTIME0 0x004
330#define AU1000_MEM_STADDR0 0x008
331#define AU1000_MEM_STCFG1 0x010
332#define AU1000_MEM_STTIME1 0x014
333#define AU1000_MEM_STADDR1 0x018
334#define AU1000_MEM_STCFG2 0x020
335#define AU1000_MEM_STTIME2 0x024
336#define AU1000_MEM_STADDR2 0x028
337#define AU1000_MEM_STCFG3 0x030
338#define AU1000_MEM_STTIME3 0x034
339#define AU1000_MEM_STADDR3 0x038
340#define AU1000_MEM_STNDCTL 0x100
341#define AU1000_MEM_STSTAT 0x104
342
343#define MEM_STNAND_CMD 0x0
344#define MEM_STNAND_ADDR 0x4
345#define MEM_STNAND_DATA 0x20
346
347
348/* Programmable Counters 0 and 1 */
349#define AU1000_SYS_CNTRCTRL 0x14
350# define SYS_CNTRL_E1S (1 << 23)
351# define SYS_CNTRL_T1S (1 << 20)
352# define SYS_CNTRL_M21 (1 << 19)
353# define SYS_CNTRL_M11 (1 << 18)
354# define SYS_CNTRL_M01 (1 << 17)
355# define SYS_CNTRL_C1S (1 << 16)
356# define SYS_CNTRL_BP (1 << 14)
357# define SYS_CNTRL_EN1 (1 << 13)
358# define SYS_CNTRL_BT1 (1 << 12)
359# define SYS_CNTRL_EN0 (1 << 11)
360# define SYS_CNTRL_BT0 (1 << 10)
361# define SYS_CNTRL_E0 (1 << 8)
362# define SYS_CNTRL_E0S (1 << 7)
363# define SYS_CNTRL_32S (1 << 5)
364# define SYS_CNTRL_T0S (1 << 4)
365# define SYS_CNTRL_M20 (1 << 3)
366# define SYS_CNTRL_M10 (1 << 2)
367# define SYS_CNTRL_M00 (1 << 1)
368# define SYS_CNTRL_C0S (1 << 0)
369
370/* Programmable Counter 0 Registers */
371#define AU1000_SYS_TOYTRIM 0x00
372#define AU1000_SYS_TOYWRITE 0x04
373#define AU1000_SYS_TOYMATCH0 0x08
374#define AU1000_SYS_TOYMATCH1 0x0c
375#define AU1000_SYS_TOYMATCH2 0x10
376#define AU1000_SYS_TOYREAD 0x40
377
378/* Programmable Counter 1 Registers */
379#define AU1000_SYS_RTCTRIM 0x44
380#define AU1000_SYS_RTCWRITE 0x48
381#define AU1000_SYS_RTCMATCH0 0x4c
382#define AU1000_SYS_RTCMATCH1 0x50
383#define AU1000_SYS_RTCMATCH2 0x54
384#define AU1000_SYS_RTCREAD 0x58
385
386
387/* GPIO */
388#define AU1000_SYS_PINFUNC 0x2C
389# define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
390# define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
391# define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
392# define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
393# define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
394# define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
395# define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
396# define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
397# define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
398# define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
399# define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
400# define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
401# define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
402# define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
403# define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
404# define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
405
406/* Au1100 only */
407# define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
408# define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
409# define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
410# define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
411
412/* Au1550 only. Redefines lots of pins */
413# define SYS_PF_PSC2_MASK (7 << 17)
414# define SYS_PF_PSC2_AC97 0
415# define SYS_PF_PSC2_SPI 0
416# define SYS_PF_PSC2_I2S (1 << 17)
417# define SYS_PF_PSC2_SMBUS (3 << 17)
418# define SYS_PF_PSC2_GPIO (7 << 17)
419# define SYS_PF_PSC3_MASK (7 << 20)
420# define SYS_PF_PSC3_AC97 0
421# define SYS_PF_PSC3_SPI 0
422# define SYS_PF_PSC3_I2S (1 << 20)
423# define SYS_PF_PSC3_SMBUS (3 << 20)
424# define SYS_PF_PSC3_GPIO (7 << 20)
425# define SYS_PF_PSC1_S1 (1 << 1)
426# define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
427
428/* Au1200 only */
429#define SYS_PINFUNC_DMA (1 << 31)
430#define SYS_PINFUNC_S0A (1 << 30)
431#define SYS_PINFUNC_S1A (1 << 29)
432#define SYS_PINFUNC_LP0 (1 << 28)
433#define SYS_PINFUNC_LP1 (1 << 27)
434#define SYS_PINFUNC_LD16 (1 << 26)
435#define SYS_PINFUNC_LD8 (1 << 25)
436#define SYS_PINFUNC_LD1 (1 << 24)
437#define SYS_PINFUNC_LD0 (1 << 23)
438#define SYS_PINFUNC_P1A (3 << 21)
439#define SYS_PINFUNC_P1B (1 << 20)
440#define SYS_PINFUNC_FS3 (1 << 19)
441#define SYS_PINFUNC_P0A (3 << 17)
442#define SYS_PINFUNC_CS (1 << 16)
443#define SYS_PINFUNC_CIM (1 << 15)
444#define SYS_PINFUNC_P1C (1 << 14)
445#define SYS_PINFUNC_U1T (1 << 12)
446#define SYS_PINFUNC_U1R (1 << 11)
447#define SYS_PINFUNC_EX1 (1 << 10)
448#define SYS_PINFUNC_EX0 (1 << 9)
449#define SYS_PINFUNC_U0R (1 << 8)
450#define SYS_PINFUNC_MC (1 << 7)
451#define SYS_PINFUNC_S0B (1 << 6)
452#define SYS_PINFUNC_S0C (1 << 5)
453#define SYS_PINFUNC_P0B (1 << 4)
454#define SYS_PINFUNC_U0T (1 << 3)
455#define SYS_PINFUNC_S1B (1 << 2)
456
457/* Power Management */
458#define AU1000_SYS_SCRATCH0 0x18
459#define AU1000_SYS_SCRATCH1 0x1c
460#define AU1000_SYS_WAKEMSK 0x34
461#define AU1000_SYS_ENDIAN 0x38
462#define AU1000_SYS_POWERCTRL 0x3c
463#define AU1000_SYS_WAKESRC 0x5c
464#define AU1000_SYS_SLPPWR 0x78
465#define AU1000_SYS_SLEEP 0x7c
466
467#define SYS_WAKEMSK_D2 (1 << 9)
468#define SYS_WAKEMSK_M2 (1 << 8)
469#define SYS_WAKEMSK_GPIO(x) (1 << (x))
470
471/* Clock Controller */
472#define AU1000_SYS_FREQCTRL0 0x20
473#define AU1000_SYS_FREQCTRL1 0x24
474#define AU1000_SYS_CLKSRC 0x28
475#define AU1000_SYS_CPUPLL 0x60
476#define AU1000_SYS_AUXPLL 0x64
477#define AU1300_SYS_AUXPLL2 0x68
478
479
480/**********************************************************************/
481
482
483/* The PCI chip selects are outside the 32bit space, and since we can't
484 * just program the 36bit addresses into BARs, we have to take a chunk
485 * out of the 32bit space and reserve it for PCI. When these addresses
486 * are ioremap()ed, they'll be fixed up to the real 36bit address before
487 * being passed to the real ioremap function.
488 */
489#define ALCHEMY_PCI_MEMWIN_START (AU1500_PCI_MEM_PHYS_ADDR >> 4)
490#define ALCHEMY_PCI_MEMWIN_END (ALCHEMY_PCI_MEMWIN_START + 0x0FFFFFFF)
491
492/* for PCI IO it's simpler because we get to do the ioremap ourselves and then
493 * adjust the device's resources.
494 */
495#define ALCHEMY_PCI_IOWIN_START 0x00001000
496#define ALCHEMY_PCI_IOWIN_END 0x0000FFFF
497
498#ifdef CONFIG_PCI
499
500#define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
501#define IOPORT_RESOURCE_END 0xffffffff
502#define IOMEM_RESOURCE_START 0x10000000
503#define IOMEM_RESOURCE_END 0xfffffffffULL
504
505#else
506
507/* Don't allow any legacy ports probing */
508#define IOPORT_RESOURCE_START 0x10000000
509#define IOPORT_RESOURCE_END 0xffffffff
510#define IOMEM_RESOURCE_START 0x10000000
511#define IOMEM_RESOURCE_END 0xfffffffffULL
512
513#endif
514
515/* PCI controller block register offsets */
516#define PCI_REG_CMEM 0x0000
517#define PCI_REG_CONFIG 0x0004
518#define PCI_REG_B2BMASK_CCH 0x0008
519#define PCI_REG_B2BBASE0_VID 0x000C
520#define PCI_REG_B2BBASE1_SID 0x0010
521#define PCI_REG_MWMASK_DEV 0x0014
522#define PCI_REG_MWBASE_REV_CCL 0x0018
523#define PCI_REG_ERR_ADDR 0x001C
524#define PCI_REG_SPEC_INTACK 0x0020
525#define PCI_REG_ID 0x0100
526#define PCI_REG_STATCMD 0x0104
527#define PCI_REG_CLASSREV 0x0108
528#define PCI_REG_PARAM 0x010C
529#define PCI_REG_MBAR 0x0110
530#define PCI_REG_TIMEOUT 0x0140
531
532/* PCI controller block register bits */
533#define PCI_CMEM_E (1 << 28) /* enable cacheable memory */
534#define PCI_CMEM_CMBASE(x) (((x) & 0x3fff) << 14)
535#define PCI_CMEM_CMMASK(x) ((x) & 0x3fff)
536#define PCI_CONFIG_ERD (1 << 27) /* pci error during R/W */
537#define PCI_CONFIG_ET (1 << 26) /* error in target mode */
538#define PCI_CONFIG_EF (1 << 25) /* fatal error */
539#define PCI_CONFIG_EP (1 << 24) /* parity error */
540#define PCI_CONFIG_EM (1 << 23) /* multiple errors */
541#define PCI_CONFIG_BM (1 << 22) /* bad master error */
542#define PCI_CONFIG_PD (1 << 20) /* PCI Disable */
543#define PCI_CONFIG_BME (1 << 19) /* Byte Mask Enable for reads */
544#define PCI_CONFIG_NC (1 << 16) /* mark mem access non-coherent */
545#define PCI_CONFIG_IA (1 << 15) /* INTA# enabled (target mode) */
546#define PCI_CONFIG_IP (1 << 13) /* int on PCI_PERR# */
547#define PCI_CONFIG_IS (1 << 12) /* int on PCI_SERR# */
548#define PCI_CONFIG_IMM (1 << 11) /* int on master abort */
549#define PCI_CONFIG_ITM (1 << 10) /* int on target abort (as master) */
550#define PCI_CONFIG_ITT (1 << 9) /* int on target abort (as target) */
551#define PCI_CONFIG_IPB (1 << 8) /* int on PERR# in bus master acc */
552#define PCI_CONFIG_SIC_NO (0 << 6) /* no byte mask changes */
553#define PCI_CONFIG_SIC_BA_ADR (1 << 6) /* on byte/hw acc, invert adr bits */
554#define PCI_CONFIG_SIC_HWA_DAT (2 << 6) /* on halfword acc, swap data */
555#define PCI_CONFIG_SIC_ALL (3 << 6) /* swap data bytes on all accesses */
556#define PCI_CONFIG_ST (1 << 5) /* swap data by target transactions */
557#define PCI_CONFIG_SM (1 << 4) /* swap data from PCI ctl */
558#define PCI_CONFIG_AEN (1 << 3) /* enable internal arbiter */
559#define PCI_CONFIG_R2H (1 << 2) /* REQ2# to hi-prio arbiter */
560#define PCI_CONFIG_R1H (1 << 1) /* REQ1# to hi-prio arbiter */
561#define PCI_CONFIG_CH (1 << 0) /* PCI ctl to hi-prio arbiter */
562#define PCI_B2BMASK_B2BMASK(x) (((x) & 0xffff) << 16)
563#define PCI_B2BMASK_CCH(x) ((x) & 0xffff) /* 16 upper bits of class code */
564#define PCI_B2BBASE0_VID_B0(x) (((x) & 0xffff) << 16)
565#define PCI_B2BBASE0_VID_SV(x) ((x) & 0xffff)
566#define PCI_B2BBASE1_SID_B1(x) (((x) & 0xffff) << 16)
567#define PCI_B2BBASE1_SID_SI(x) ((x) & 0xffff)
568#define PCI_MWMASKDEV_MWMASK(x) (((x) & 0xffff) << 16)
569#define PCI_MWMASKDEV_DEVID(x) ((x) & 0xffff)
570#define PCI_MWBASEREVCCL_BASE(x) (((x) & 0xffff) << 16)
571#define PCI_MWBASEREVCCL_REV(x) (((x) & 0xff) << 8)
572#define PCI_MWBASEREVCCL_CCL(x) ((x) & 0xff)
573#define PCI_ID_DID(x) (((x) & 0xffff) << 16)
574#define PCI_ID_VID(x) ((x) & 0xffff)
575#define PCI_STATCMD_STATUS(x) (((x) & 0xffff) << 16)
576#define PCI_STATCMD_CMD(x) ((x) & 0xffff)
577#define PCI_CLASSREV_CLASS(x) (((x) & 0x00ffffff) << 8)
578#define PCI_CLASSREV_REV(x) ((x) & 0xff)
579#define PCI_PARAM_BIST(x) (((x) & 0xff) << 24)
580#define PCI_PARAM_HT(x) (((x) & 0xff) << 16)
581#define PCI_PARAM_LT(x) (((x) & 0xff) << 8)
582#define PCI_PARAM_CLS(x) ((x) & 0xff)
583#define PCI_TIMEOUT_RETRIES(x) (((x) & 0xff) << 8) /* max retries */
584#define PCI_TIMEOUT_TO(x) ((x) & 0xff) /* target ready timeout */
585
586
587/**********************************************************************/
588
589
590#ifndef _LANGUAGE_ASSEMBLY
591
592#include <linux/delay.h>
593#include <linux/types.h>
594
595#include <linux/io.h>
596#include <linux/irq.h>
597
598#include <asm/cpu.h>
599
600/* helpers to access the SYS_* registers */
601static inline unsigned long alchemy_rdsys(int regofs)
602{
603 void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
604
605 return __raw_readl(b + regofs);
606}
607
608static inline void alchemy_wrsys(unsigned long v, int regofs)
609{
610 void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
611
612 __raw_writel(v, b + regofs);
613 wmb(); /* drain writebuffer */
614}
615
616/* helpers to access static memctrl registers */
617static inline unsigned long alchemy_rdsmem(int regofs)
618{
619 void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_STATIC_MEM_PHYS_ADDR);
620
621 return __raw_readl(b + regofs);
622}
623
624static inline void alchemy_wrsmem(unsigned long v, int regofs)
625{
626 void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_STATIC_MEM_PHYS_ADDR);
627
628 __raw_writel(v, b + regofs);
629 wmb(); /* drain writebuffer */
630}
631
632/* Early Au1000 have a write-only SYS_CPUPLL register. */
633static inline int au1xxx_cpu_has_pll_wo(void)
634{
635 switch (read_c0_prid()) {
636 case 0x00030100: /* Au1000 DA */
637 case 0x00030201: /* Au1000 HA */
638 case 0x00030202: /* Au1000 HB */
639 return 1;
640 }
641 return 0;
642}
643
644/* does CPU need CONFIG[OD] set to fix tons of errata? */
645static inline int au1xxx_cpu_needs_config_od(void)
646{
647 /*
648 * c0_config.od (bit 19) was write only (and read as 0) on the
649 * early revisions of Alchemy SOCs. It disables the bus trans-
650 * action overlapping and needs to be set to fix various errata.
651 */
652 switch (read_c0_prid()) {
653 case 0x00030100: /* Au1000 DA */
654 case 0x00030201: /* Au1000 HA */
655 case 0x00030202: /* Au1000 HB */
656 case 0x01030200: /* Au1500 AB */
657 /*
658 * Au1100/Au1200 errata actually keep silence about this bit,
659 * so we set it just in case for those revisions that require
660 * it to be set according to the (now gone) cpu_table.
661 */
662 case 0x02030200: /* Au1100 AB */
663 case 0x02030201: /* Au1100 BA */
664 case 0x02030202: /* Au1100 BC */
665 case 0x04030201: /* Au1200 AC */
666 return 1;
667 }
668 return 0;
669}
670
671#define ALCHEMY_CPU_UNKNOWN -1
672#define ALCHEMY_CPU_AU1000 0
673#define ALCHEMY_CPU_AU1500 1
674#define ALCHEMY_CPU_AU1100 2
675#define ALCHEMY_CPU_AU1550 3
676#define ALCHEMY_CPU_AU1200 4
677#define ALCHEMY_CPU_AU1300 5
678
679static inline int alchemy_get_cputype(void)
680{
681 switch (read_c0_prid() & (PRID_OPT_MASK | PRID_COMP_MASK)) {
682 case 0x00030000:
683 return ALCHEMY_CPU_AU1000;
684 break;
685 case 0x01030000:
686 return ALCHEMY_CPU_AU1500;
687 break;
688 case 0x02030000:
689 return ALCHEMY_CPU_AU1100;
690 break;
691 case 0x03030000:
692 return ALCHEMY_CPU_AU1550;
693 break;
694 case 0x04030000:
695 case 0x05030000:
696 return ALCHEMY_CPU_AU1200;
697 break;
698 case 0x800c0000:
699 return ALCHEMY_CPU_AU1300;
700 break;
701 }
702
703 return ALCHEMY_CPU_UNKNOWN;
704}
705
706/* return number of uarts on a given cputype */
707static inline int alchemy_get_uarts(int type)
708{
709 switch (type) {
710 case ALCHEMY_CPU_AU1000:
711 case ALCHEMY_CPU_AU1300:
712 return 4;
713 case ALCHEMY_CPU_AU1500:
714 case ALCHEMY_CPU_AU1200:
715 return 2;
716 case ALCHEMY_CPU_AU1100:
717 case ALCHEMY_CPU_AU1550:
718 return 3;
719 }
720 return 0;
721}
722
723/* enable an UART block if it isn't already */
724static inline void alchemy_uart_enable(u32 uart_phys)
725{
726 void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
727
728 /* reset, enable clock, deassert reset */
729 if ((__raw_readl(addr + 0x100) & 3) != 3) {
730 __raw_writel(0, addr + 0x100);
731 wmb(); /* drain writebuffer */
732 __raw_writel(1, addr + 0x100);
733 wmb(); /* drain writebuffer */
734 }
735 __raw_writel(3, addr + 0x100);
736 wmb(); /* drain writebuffer */
737}
738
739static inline void alchemy_uart_disable(u32 uart_phys)
740{
741 void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
742
743 __raw_writel(0, addr + 0x100); /* UART_MOD_CNTRL */
744 wmb(); /* drain writebuffer */
745}
746
747static inline void alchemy_uart_putchar(u32 uart_phys, u8 c)
748{
749 void __iomem *base = (void __iomem *)KSEG1ADDR(uart_phys);
750 int timeout, i;
751
752 /* check LSR TX_EMPTY bit */
753 timeout = 0xffffff;
754 do {
755 if (__raw_readl(base + 0x1c) & 0x20)
756 break;
757 /* slow down */
758 for (i = 10000; i; i--)
759 asm volatile ("nop");
760 } while (--timeout);
761
762 __raw_writel(c, base + 0x04); /* tx */
763 wmb(); /* drain writebuffer */
764}
765
766/* return number of ethernet MACs on a given cputype */
767static inline int alchemy_get_macs(int type)
768{
769 switch (type) {
770 case ALCHEMY_CPU_AU1000:
771 case ALCHEMY_CPU_AU1500:
772 case ALCHEMY_CPU_AU1550:
773 return 2;
774 case ALCHEMY_CPU_AU1100:
775 return 1;
776 }
777 return 0;
778}
779
780/* PM: arch/mips/alchemy/common/sleeper.S, power.c, irq.c */
781void alchemy_sleep_au1000(void);
782void alchemy_sleep_au1550(void);
783void alchemy_sleep_au1300(void);
784void au_sleep(void);
785
786/* USB: arch/mips/alchemy/common/usb.c */
787enum alchemy_usb_block {
788 ALCHEMY_USB_OHCI0,
789 ALCHEMY_USB_UDC0,
790 ALCHEMY_USB_EHCI0,
791 ALCHEMY_USB_OTG0,
792 ALCHEMY_USB_OHCI1,
793};
794int alchemy_usb_control(int block, int enable);
795
796/* PCI controller platform data */
797struct alchemy_pci_platdata {
798 int (*board_map_irq)(const struct pci_dev *d, u8 slot, u8 pin);
799 int (*board_pci_idsel)(unsigned int devsel, int assert);
800 /* bits to set/clear in PCI_CONFIG register */
801 unsigned long pci_cfg_set;
802 unsigned long pci_cfg_clr;
803};
804
805/* The IrDA peripheral has an IRFIRSEL pin, but on the DB/PB boards it's
806 * not used to select FIR/SIR mode on the transceiver but as a GPIO.
807 * Instead a CPLD has to be told about the mode. The driver calls the
808 * set_phy_mode() function in addition to driving the IRFIRSEL pin.
809 */
810#define AU1000_IRDA_PHY_MODE_OFF 0
811#define AU1000_IRDA_PHY_MODE_SIR 1
812#define AU1000_IRDA_PHY_MODE_FIR 2
813
814struct au1k_irda_platform_data {
815 void (*set_phy_mode)(int mode);
816};
817
818
819/* Multifunction pins: Each of these pins can either be assigned to the
820 * GPIO controller or a on-chip peripheral.
821 * Call "au1300_pinfunc_to_dev()" or "au1300_pinfunc_to_gpio()" to
822 * assign one of these to either the GPIO controller or the device.
823 */
824enum au1300_multifunc_pins {
825 /* wake-from-str pins 0-3 */
826 AU1300_PIN_WAKE0 = 0, AU1300_PIN_WAKE1, AU1300_PIN_WAKE2,
827 AU1300_PIN_WAKE3,
828 /* external clock sources for PSCs: 4-5 */
829 AU1300_PIN_EXTCLK0, AU1300_PIN_EXTCLK1,
830 /* 8bit MMC interface on SD0: 6-9 */
831 AU1300_PIN_SD0DAT4, AU1300_PIN_SD0DAT5, AU1300_PIN_SD0DAT6,
832 AU1300_PIN_SD0DAT7,
833 /* aux clk input for freqgen 3: 10 */
834 AU1300_PIN_FG3AUX,
835 /* UART1 pins: 11-18 */
836 AU1300_PIN_U1RI, AU1300_PIN_U1DCD, AU1300_PIN_U1DSR,
837 AU1300_PIN_U1CTS, AU1300_PIN_U1RTS, AU1300_PIN_U1DTR,
838 AU1300_PIN_U1RX, AU1300_PIN_U1TX,
839 /* UART0 pins: 19-24 */
840 AU1300_PIN_U0RI, AU1300_PIN_U0DCD, AU1300_PIN_U0DSR,
841 AU1300_PIN_U0CTS, AU1300_PIN_U0RTS, AU1300_PIN_U0DTR,
842 /* UART2: 25-26 */
843 AU1300_PIN_U2RX, AU1300_PIN_U2TX,
844 /* UART3: 27-28 */
845 AU1300_PIN_U3RX, AU1300_PIN_U3TX,
846 /* LCD controller PWMs, ext pixclock: 29-31 */
847 AU1300_PIN_LCDPWM0, AU1300_PIN_LCDPWM1, AU1300_PIN_LCDCLKIN,
848 /* SD1 interface: 32-37 */
849 AU1300_PIN_SD1DAT0, AU1300_PIN_SD1DAT1, AU1300_PIN_SD1DAT2,
850 AU1300_PIN_SD1DAT3, AU1300_PIN_SD1CMD, AU1300_PIN_SD1CLK,
851 /* SD2 interface: 38-43 */
852 AU1300_PIN_SD2DAT0, AU1300_PIN_SD2DAT1, AU1300_PIN_SD2DAT2,
853 AU1300_PIN_SD2DAT3, AU1300_PIN_SD2CMD, AU1300_PIN_SD2CLK,
854 /* PSC0/1 clocks: 44-45 */
855 AU1300_PIN_PSC0CLK, AU1300_PIN_PSC1CLK,
856 /* PSCs: 46-49/50-53/54-57/58-61 */
857 AU1300_PIN_PSC0SYNC0, AU1300_PIN_PSC0SYNC1, AU1300_PIN_PSC0D0,
858 AU1300_PIN_PSC0D1,
859 AU1300_PIN_PSC1SYNC0, AU1300_PIN_PSC1SYNC1, AU1300_PIN_PSC1D0,
860 AU1300_PIN_PSC1D1,
861 AU1300_PIN_PSC2SYNC0, AU1300_PIN_PSC2SYNC1, AU1300_PIN_PSC2D0,
862 AU1300_PIN_PSC2D1,
863 AU1300_PIN_PSC3SYNC0, AU1300_PIN_PSC3SYNC1, AU1300_PIN_PSC3D0,
864 AU1300_PIN_PSC3D1,
865 /* PCMCIA interface: 62-70 */
866 AU1300_PIN_PCE2, AU1300_PIN_PCE1, AU1300_PIN_PIOS16,
867 AU1300_PIN_PIOR, AU1300_PIN_PWE, AU1300_PIN_PWAIT,
868 AU1300_PIN_PREG, AU1300_PIN_POE, AU1300_PIN_PIOW,
869 /* camera interface H/V sync inputs: 71-72 */
870 AU1300_PIN_CIMLS, AU1300_PIN_CIMFS,
871 /* PSC2/3 clocks: 73-74 */
872 AU1300_PIN_PSC2CLK, AU1300_PIN_PSC3CLK,
873};
874
875/* GPIC (Au1300) pin management: arch/mips/alchemy/common/gpioint.c */
876extern void au1300_pinfunc_to_gpio(enum au1300_multifunc_pins gpio);
877extern void au1300_pinfunc_to_dev(enum au1300_multifunc_pins gpio);
878extern void au1300_set_irq_priority(unsigned int irq, int p);
879extern void au1300_set_dbdma_gpio(int dchan, unsigned int gpio);
880
881/* Au1300 allows to disconnect certain blocks from internal power supply */
882enum au1300_vss_block {
883 AU1300_VSS_MPE = 0,
884 AU1300_VSS_BSA,
885 AU1300_VSS_GPE,
886 AU1300_VSS_MGP,
887};
888
889extern void au1300_vss_block_control(int block, int enable);
890
891enum soc_au1000_ints {
892 AU1000_FIRST_INT = AU1000_INTC0_INT_BASE,
893 AU1000_UART0_INT = AU1000_FIRST_INT,
894 AU1000_UART1_INT,
895 AU1000_UART2_INT,
896 AU1000_UART3_INT,
897 AU1000_SSI0_INT,
898 AU1000_SSI1_INT,
899 AU1000_DMA_INT_BASE,
900
901 AU1000_TOY_INT = AU1000_FIRST_INT + 14,
902 AU1000_TOY_MATCH0_INT,
903 AU1000_TOY_MATCH1_INT,
904 AU1000_TOY_MATCH2_INT,
905 AU1000_RTC_INT,
906 AU1000_RTC_MATCH0_INT,
907 AU1000_RTC_MATCH1_INT,
908 AU1000_RTC_MATCH2_INT,
909 AU1000_IRDA_TX_INT,
910 AU1000_IRDA_RX_INT,
911 AU1000_USB_DEV_REQ_INT,
912 AU1000_USB_DEV_SUS_INT,
913 AU1000_USB_HOST_INT,
914 AU1000_ACSYNC_INT,
915 AU1000_MAC0_DMA_INT,
916 AU1000_MAC1_DMA_INT,
917 AU1000_I2S_UO_INT,
918 AU1000_AC97C_INT,
919 AU1000_GPIO0_INT,
920 AU1000_GPIO1_INT,
921 AU1000_GPIO2_INT,
922 AU1000_GPIO3_INT,
923 AU1000_GPIO4_INT,
924 AU1000_GPIO5_INT,
925 AU1000_GPIO6_INT,
926 AU1000_GPIO7_INT,
927 AU1000_GPIO8_INT,
928 AU1000_GPIO9_INT,
929 AU1000_GPIO10_INT,
930 AU1000_GPIO11_INT,
931 AU1000_GPIO12_INT,
932 AU1000_GPIO13_INT,
933 AU1000_GPIO14_INT,
934 AU1000_GPIO15_INT,
935 AU1000_GPIO16_INT,
936 AU1000_GPIO17_INT,
937 AU1000_GPIO18_INT,
938 AU1000_GPIO19_INT,
939 AU1000_GPIO20_INT,
940 AU1000_GPIO21_INT,
941 AU1000_GPIO22_INT,
942 AU1000_GPIO23_INT,
943 AU1000_GPIO24_INT,
944 AU1000_GPIO25_INT,
945 AU1000_GPIO26_INT,
946 AU1000_GPIO27_INT,
947 AU1000_GPIO28_INT,
948 AU1000_GPIO29_INT,
949 AU1000_GPIO30_INT,
950 AU1000_GPIO31_INT,
951};
952
953enum soc_au1100_ints {
954 AU1100_FIRST_INT = AU1000_INTC0_INT_BASE,
955 AU1100_UART0_INT = AU1100_FIRST_INT,
956 AU1100_UART1_INT,
957 AU1100_SD_INT,
958 AU1100_UART3_INT,
959 AU1100_SSI0_INT,
960 AU1100_SSI1_INT,
961 AU1100_DMA_INT_BASE,
962
963 AU1100_TOY_INT = AU1100_FIRST_INT + 14,
964 AU1100_TOY_MATCH0_INT,
965 AU1100_TOY_MATCH1_INT,
966 AU1100_TOY_MATCH2_INT,
967 AU1100_RTC_INT,
968 AU1100_RTC_MATCH0_INT,
969 AU1100_RTC_MATCH1_INT,
970 AU1100_RTC_MATCH2_INT,
971 AU1100_IRDA_TX_INT,
972 AU1100_IRDA_RX_INT,
973 AU1100_USB_DEV_REQ_INT,
974 AU1100_USB_DEV_SUS_INT,
975 AU1100_USB_HOST_INT,
976 AU1100_ACSYNC_INT,
977 AU1100_MAC0_DMA_INT,
978 AU1100_GPIO208_215_INT,
979 AU1100_LCD_INT,
980 AU1100_AC97C_INT,
981 AU1100_GPIO0_INT,
982 AU1100_GPIO1_INT,
983 AU1100_GPIO2_INT,
984 AU1100_GPIO3_INT,
985 AU1100_GPIO4_INT,
986 AU1100_GPIO5_INT,
987 AU1100_GPIO6_INT,
988 AU1100_GPIO7_INT,
989 AU1100_GPIO8_INT,
990 AU1100_GPIO9_INT,
991 AU1100_GPIO10_INT,
992 AU1100_GPIO11_INT,
993 AU1100_GPIO12_INT,
994 AU1100_GPIO13_INT,
995 AU1100_GPIO14_INT,
996 AU1100_GPIO15_INT,
997 AU1100_GPIO16_INT,
998 AU1100_GPIO17_INT,
999 AU1100_GPIO18_INT,
1000 AU1100_GPIO19_INT,
1001 AU1100_GPIO20_INT,
1002 AU1100_GPIO21_INT,
1003 AU1100_GPIO22_INT,
1004 AU1100_GPIO23_INT,
1005 AU1100_GPIO24_INT,
1006 AU1100_GPIO25_INT,
1007 AU1100_GPIO26_INT,
1008 AU1100_GPIO27_INT,
1009 AU1100_GPIO28_INT,
1010 AU1100_GPIO29_INT,
1011 AU1100_GPIO30_INT,
1012 AU1100_GPIO31_INT,
1013};
1014
1015enum soc_au1500_ints {
1016 AU1500_FIRST_INT = AU1000_INTC0_INT_BASE,
1017 AU1500_UART0_INT = AU1500_FIRST_INT,
1018 AU1500_PCI_INTA,
1019 AU1500_PCI_INTB,
1020 AU1500_UART3_INT,
1021 AU1500_PCI_INTC,
1022 AU1500_PCI_INTD,
1023 AU1500_DMA_INT_BASE,
1024
1025 AU1500_TOY_INT = AU1500_FIRST_INT + 14,
1026 AU1500_TOY_MATCH0_INT,
1027 AU1500_TOY_MATCH1_INT,
1028 AU1500_TOY_MATCH2_INT,
1029 AU1500_RTC_INT,
1030 AU1500_RTC_MATCH0_INT,
1031 AU1500_RTC_MATCH1_INT,
1032 AU1500_RTC_MATCH2_INT,
1033 AU1500_PCI_ERR_INT,
1034 AU1500_RESERVED_INT,
1035 AU1500_USB_DEV_REQ_INT,
1036 AU1500_USB_DEV_SUS_INT,
1037 AU1500_USB_HOST_INT,
1038 AU1500_ACSYNC_INT,
1039 AU1500_MAC0_DMA_INT,
1040 AU1500_MAC1_DMA_INT,
1041 AU1500_AC97C_INT = AU1500_FIRST_INT + 31,
1042 AU1500_GPIO0_INT,
1043 AU1500_GPIO1_INT,
1044 AU1500_GPIO2_INT,
1045 AU1500_GPIO3_INT,
1046 AU1500_GPIO4_INT,
1047 AU1500_GPIO5_INT,
1048 AU1500_GPIO6_INT,
1049 AU1500_GPIO7_INT,
1050 AU1500_GPIO8_INT,
1051 AU1500_GPIO9_INT,
1052 AU1500_GPIO10_INT,
1053 AU1500_GPIO11_INT,
1054 AU1500_GPIO12_INT,
1055 AU1500_GPIO13_INT,
1056 AU1500_GPIO14_INT,
1057 AU1500_GPIO15_INT,
1058 AU1500_GPIO200_INT,
1059 AU1500_GPIO201_INT,
1060 AU1500_GPIO202_INT,
1061 AU1500_GPIO203_INT,
1062 AU1500_GPIO20_INT,
1063 AU1500_GPIO204_INT,
1064 AU1500_GPIO205_INT,
1065 AU1500_GPIO23_INT,
1066 AU1500_GPIO24_INT,
1067 AU1500_GPIO25_INT,
1068 AU1500_GPIO26_INT,
1069 AU1500_GPIO27_INT,
1070 AU1500_GPIO28_INT,
1071 AU1500_GPIO206_INT,
1072 AU1500_GPIO207_INT,
1073 AU1500_GPIO208_215_INT,
1074};
1075
1076enum soc_au1550_ints {
1077 AU1550_FIRST_INT = AU1000_INTC0_INT_BASE,
1078 AU1550_UART0_INT = AU1550_FIRST_INT,
1079 AU1550_PCI_INTA,
1080 AU1550_PCI_INTB,
1081 AU1550_DDMA_INT,
1082 AU1550_CRYPTO_INT,
1083 AU1550_PCI_INTC,
1084 AU1550_PCI_INTD,
1085 AU1550_PCI_RST_INT,
1086 AU1550_UART1_INT,
1087 AU1550_UART3_INT,
1088 AU1550_PSC0_INT,
1089 AU1550_PSC1_INT,
1090 AU1550_PSC2_INT,
1091 AU1550_PSC3_INT,
1092 AU1550_TOY_INT,
1093 AU1550_TOY_MATCH0_INT,
1094 AU1550_TOY_MATCH1_INT,
1095 AU1550_TOY_MATCH2_INT,
1096 AU1550_RTC_INT,
1097 AU1550_RTC_MATCH0_INT,
1098 AU1550_RTC_MATCH1_INT,
1099 AU1550_RTC_MATCH2_INT,
1100
1101 AU1550_NAND_INT = AU1550_FIRST_INT + 23,
1102 AU1550_USB_DEV_REQ_INT,
1103 AU1550_USB_DEV_SUS_INT,
1104 AU1550_USB_HOST_INT,
1105 AU1550_MAC0_DMA_INT,
1106 AU1550_MAC1_DMA_INT,
1107 AU1550_GPIO0_INT = AU1550_FIRST_INT + 32,
1108 AU1550_GPIO1_INT,
1109 AU1550_GPIO2_INT,
1110 AU1550_GPIO3_INT,
1111 AU1550_GPIO4_INT,
1112 AU1550_GPIO5_INT,
1113 AU1550_GPIO6_INT,
1114 AU1550_GPIO7_INT,
1115 AU1550_GPIO8_INT,
1116 AU1550_GPIO9_INT,
1117 AU1550_GPIO10_INT,
1118 AU1550_GPIO11_INT,
1119 AU1550_GPIO12_INT,
1120 AU1550_GPIO13_INT,
1121 AU1550_GPIO14_INT,
1122 AU1550_GPIO15_INT,
1123 AU1550_GPIO200_INT,
1124 AU1550_GPIO201_205_INT, /* Logical or of GPIO201:205 */
1125 AU1550_GPIO16_INT,
1126 AU1550_GPIO17_INT,
1127 AU1550_GPIO20_INT,
1128 AU1550_GPIO21_INT,
1129 AU1550_GPIO22_INT,
1130 AU1550_GPIO23_INT,
1131 AU1550_GPIO24_INT,
1132 AU1550_GPIO25_INT,
1133 AU1550_GPIO26_INT,
1134 AU1550_GPIO27_INT,
1135 AU1550_GPIO28_INT,
1136 AU1550_GPIO206_INT,
1137 AU1550_GPIO207_INT,
1138 AU1550_GPIO208_215_INT, /* Logical or of GPIO208:215 */
1139};
1140
1141enum soc_au1200_ints {
1142 AU1200_FIRST_INT = AU1000_INTC0_INT_BASE,
1143 AU1200_UART0_INT = AU1200_FIRST_INT,
1144 AU1200_SWT_INT,
1145 AU1200_SD_INT,
1146 AU1200_DDMA_INT,
1147 AU1200_MAE_BE_INT,
1148 AU1200_GPIO200_INT,
1149 AU1200_GPIO201_INT,
1150 AU1200_GPIO202_INT,
1151 AU1200_UART1_INT,
1152 AU1200_MAE_FE_INT,
1153 AU1200_PSC0_INT,
1154 AU1200_PSC1_INT,
1155 AU1200_AES_INT,
1156 AU1200_CAMERA_INT,
1157 AU1200_TOY_INT,
1158 AU1200_TOY_MATCH0_INT,
1159 AU1200_TOY_MATCH1_INT,
1160 AU1200_TOY_MATCH2_INT,
1161 AU1200_RTC_INT,
1162 AU1200_RTC_MATCH0_INT,
1163 AU1200_RTC_MATCH1_INT,
1164 AU1200_RTC_MATCH2_INT,
1165 AU1200_GPIO203_INT,
1166 AU1200_NAND_INT,
1167 AU1200_GPIO204_INT,
1168 AU1200_GPIO205_INT,
1169 AU1200_GPIO206_INT,
1170 AU1200_GPIO207_INT,
1171 AU1200_GPIO208_215_INT, /* Logical OR of 208:215 */
1172 AU1200_USB_INT,
1173 AU1200_LCD_INT,
1174 AU1200_MAE_BOTH_INT,
1175 AU1200_GPIO0_INT,
1176 AU1200_GPIO1_INT,
1177 AU1200_GPIO2_INT,
1178 AU1200_GPIO3_INT,
1179 AU1200_GPIO4_INT,
1180 AU1200_GPIO5_INT,
1181 AU1200_GPIO6_INT,
1182 AU1200_GPIO7_INT,
1183 AU1200_GPIO8_INT,
1184 AU1200_GPIO9_INT,
1185 AU1200_GPIO10_INT,
1186 AU1200_GPIO11_INT,
1187 AU1200_GPIO12_INT,
1188 AU1200_GPIO13_INT,
1189 AU1200_GPIO14_INT,
1190 AU1200_GPIO15_INT,
1191 AU1200_GPIO16_INT,
1192 AU1200_GPIO17_INT,
1193 AU1200_GPIO18_INT,
1194 AU1200_GPIO19_INT,
1195 AU1200_GPIO20_INT,
1196 AU1200_GPIO21_INT,
1197 AU1200_GPIO22_INT,
1198 AU1200_GPIO23_INT,
1199 AU1200_GPIO24_INT,
1200 AU1200_GPIO25_INT,
1201 AU1200_GPIO26_INT,
1202 AU1200_GPIO27_INT,
1203 AU1200_GPIO28_INT,
1204 AU1200_GPIO29_INT,
1205 AU1200_GPIO30_INT,
1206 AU1200_GPIO31_INT,
1207};
1208
1209#endif /* !defined (_LANGUAGE_ASSEMBLY) */
1210
1211#endif
diff --git a/arch/mips/include/asm/mach-au1x00/au1000_dma.h b/arch/mips/include/asm/mach-au1x00/au1000_dma.h
new file mode 100644
index 000000000..0a0cd4270
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/au1000_dma.h
@@ -0,0 +1,453 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Defines for using and allocating DMA channels on the Alchemy
4 * Au1x00 MIPS processors.
5 *
6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. <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#ifndef __ASM_AU1000_DMA_H
31#define __ASM_AU1000_DMA_H
32
33#include <linux/io.h> /* need byte IO */
34#include <linux/spinlock.h> /* And spinlocks */
35#include <linux/delay.h>
36
37#define NUM_AU1000_DMA_CHANNELS 8
38
39/* DMA Channel Register Offsets */
40#define DMA_MODE_SET 0x00000000
41#define DMA_MODE_READ DMA_MODE_SET
42#define DMA_MODE_CLEAR 0x00000004
43/* DMA Mode register bits follow */
44#define DMA_DAH_MASK (0x0f << 20)
45#define DMA_DID_BIT 16
46#define DMA_DID_MASK (0x0f << DMA_DID_BIT)
47#define DMA_DS (1 << 15)
48#define DMA_BE (1 << 13)
49#define DMA_DR (1 << 12)
50#define DMA_TS8 (1 << 11)
51#define DMA_DW_BIT 9
52#define DMA_DW_MASK (0x03 << DMA_DW_BIT)
53#define DMA_DW8 (0 << DMA_DW_BIT)
54#define DMA_DW16 (1 << DMA_DW_BIT)
55#define DMA_DW32 (2 << DMA_DW_BIT)
56#define DMA_NC (1 << 8)
57#define DMA_IE (1 << 7)
58#define DMA_HALT (1 << 6)
59#define DMA_GO (1 << 5)
60#define DMA_AB (1 << 4)
61#define DMA_D1 (1 << 3)
62#define DMA_BE1 (1 << 2)
63#define DMA_D0 (1 << 1)
64#define DMA_BE0 (1 << 0)
65
66#define DMA_PERIPHERAL_ADDR 0x00000008
67#define DMA_BUFFER0_START 0x0000000C
68#define DMA_BUFFER1_START 0x00000014
69#define DMA_BUFFER0_COUNT 0x00000010
70#define DMA_BUFFER1_COUNT 0x00000018
71#define DMA_BAH_BIT 16
72#define DMA_BAH_MASK (0x0f << DMA_BAH_BIT)
73#define DMA_COUNT_BIT 0
74#define DMA_COUNT_MASK (0xffff << DMA_COUNT_BIT)
75
76/* DMA Device IDs follow */
77enum {
78 DMA_ID_UART0_TX = 0,
79 DMA_ID_UART0_RX,
80 DMA_ID_GP04,
81 DMA_ID_GP05,
82 DMA_ID_AC97C_TX,
83 DMA_ID_AC97C_RX,
84 DMA_ID_UART3_TX,
85 DMA_ID_UART3_RX,
86 DMA_ID_USBDEV_EP0_RX,
87 DMA_ID_USBDEV_EP0_TX,
88 DMA_ID_USBDEV_EP2_TX,
89 DMA_ID_USBDEV_EP3_TX,
90 DMA_ID_USBDEV_EP4_RX,
91 DMA_ID_USBDEV_EP5_RX,
92 DMA_ID_I2S_TX,
93 DMA_ID_I2S_RX,
94 DMA_NUM_DEV
95};
96
97/* DMA Device ID's for 2nd bank (AU1100) follow */
98enum {
99 DMA_ID_SD0_TX = 0,
100 DMA_ID_SD0_RX,
101 DMA_ID_SD1_TX,
102 DMA_ID_SD1_RX,
103 DMA_NUM_DEV_BANK2
104};
105
106struct dma_chan {
107 int dev_id; /* this channel is allocated if >= 0, */
108 /* free otherwise */
109 void __iomem *io;
110 const char *dev_str;
111 int irq;
112 void *irq_dev;
113 unsigned int fifo_addr;
114 unsigned int mode;
115};
116
117/* These are in arch/mips/au1000/common/dma.c */
118extern struct dma_chan au1000_dma_table[];
119extern int request_au1000_dma(int dev_id,
120 const char *dev_str,
121 irq_handler_t irqhandler,
122 unsigned long irqflags,
123 void *irq_dev_id);
124extern void free_au1000_dma(unsigned int dmanr);
125extern int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
126 int length, int *eof, void *data);
127extern void dump_au1000_dma_channel(unsigned int dmanr);
128extern spinlock_t au1000_dma_spin_lock;
129
130static inline struct dma_chan *get_dma_chan(unsigned int dmanr)
131{
132 if (dmanr >= NUM_AU1000_DMA_CHANNELS ||
133 au1000_dma_table[dmanr].dev_id < 0)
134 return NULL;
135 return &au1000_dma_table[dmanr];
136}
137
138static inline unsigned long claim_dma_lock(void)
139{
140 unsigned long flags;
141
142 spin_lock_irqsave(&au1000_dma_spin_lock, flags);
143 return flags;
144}
145
146static inline void release_dma_lock(unsigned long flags)
147{
148 spin_unlock_irqrestore(&au1000_dma_spin_lock, flags);
149}
150
151/*
152 * Set the DMA buffer enable bits in the mode register.
153 */
154static inline void enable_dma_buffer0(unsigned int dmanr)
155{
156 struct dma_chan *chan = get_dma_chan(dmanr);
157
158 if (!chan)
159 return;
160 __raw_writel(DMA_BE0, chan->io + DMA_MODE_SET);
161}
162
163static inline void enable_dma_buffer1(unsigned int dmanr)
164{
165 struct dma_chan *chan = get_dma_chan(dmanr);
166
167 if (!chan)
168 return;
169 __raw_writel(DMA_BE1, chan->io + DMA_MODE_SET);
170}
171static inline void enable_dma_buffers(unsigned int dmanr)
172{
173 struct dma_chan *chan = get_dma_chan(dmanr);
174
175 if (!chan)
176 return;
177 __raw_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET);
178}
179
180static inline void start_dma(unsigned int dmanr)
181{
182 struct dma_chan *chan = get_dma_chan(dmanr);
183
184 if (!chan)
185 return;
186 __raw_writel(DMA_GO, chan->io + DMA_MODE_SET);
187}
188
189#define DMA_HALT_POLL 0x5000
190
191static inline void halt_dma(unsigned int dmanr)
192{
193 struct dma_chan *chan = get_dma_chan(dmanr);
194 int i;
195
196 if (!chan)
197 return;
198 __raw_writel(DMA_GO, chan->io + DMA_MODE_CLEAR);
199
200 /* Poll the halt bit */
201 for (i = 0; i < DMA_HALT_POLL; i++)
202 if (__raw_readl(chan->io + DMA_MODE_READ) & DMA_HALT)
203 break;
204 if (i == DMA_HALT_POLL)
205 printk(KERN_INFO "halt_dma: HALT poll expired!\n");
206}
207
208static inline void disable_dma(unsigned int dmanr)
209{
210 struct dma_chan *chan = get_dma_chan(dmanr);
211
212 if (!chan)
213 return;
214
215 halt_dma(dmanr);
216
217 /* Now we can disable the buffers */
218 __raw_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR);
219}
220
221static inline int dma_halted(unsigned int dmanr)
222{
223 struct dma_chan *chan = get_dma_chan(dmanr);
224
225 if (!chan)
226 return 1;
227 return (__raw_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
236 if (!chan)
237 return;
238
239 disable_dma(dmanr);
240
241 /* Set device FIFO address */
242 __raw_writel(CPHYSADDR(chan->fifo_addr), 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 __raw_writel(~mode, chan->io + DMA_MODE_CLEAR);
249 __raw_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
259 if (!chan)
260 return;
261 /*
262 * set_dma_mode is only allowed to change endianess, direction,
263 * transfer size, device FIFO width, and coherency settings.
264 * Make sure anything else is masked off.
265 */
266 mode &= (DMA_BE | DMA_DR | DMA_TS8 | DMA_DW_MASK | DMA_NC);
267 chan->mode &= ~(DMA_BE | DMA_DR | DMA_TS8 | DMA_DW_MASK | DMA_NC);
268 chan->mode |= mode;
269}
270
271static inline unsigned int get_dma_mode(unsigned int dmanr)
272{
273 struct dma_chan *chan = get_dma_chan(dmanr);
274
275 if (!chan)
276 return 0;
277 return chan->mode;
278}
279
280static inline int get_dma_active_buffer(unsigned int dmanr)
281{
282 struct dma_chan *chan = get_dma_chan(dmanr);
283
284 if (!chan)
285 return -1;
286 return (__raw_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0;
287}
288
289/*
290 * Set the device FIFO address for a specific DMA channel - only
291 * applicable to GPO4 and GPO5. All the other devices have fixed
292 * FIFO addresses.
293 */
294static inline void set_dma_fifo_addr(unsigned int dmanr, unsigned int a)
295{
296 struct dma_chan *chan = get_dma_chan(dmanr);
297
298 if (!chan)
299 return;
300
301 if (chan->mode & DMA_DS) /* second bank of device IDs */
302 return;
303
304 if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05)
305 return;
306
307 __raw_writel(CPHYSADDR(a), chan->io + DMA_PERIPHERAL_ADDR);
308}
309
310/*
311 * Clear the DMA buffer done bits in the mode register.
312 */
313static inline void clear_dma_done0(unsigned int dmanr)
314{
315 struct dma_chan *chan = get_dma_chan(dmanr);
316
317 if (!chan)
318 return;
319 __raw_writel(DMA_D0, chan->io + DMA_MODE_CLEAR);
320}
321
322static inline void clear_dma_done1(unsigned int dmanr)
323{
324 struct dma_chan *chan = get_dma_chan(dmanr);
325
326 if (!chan)
327 return;
328 __raw_writel(DMA_D1, chan->io + DMA_MODE_CLEAR);
329}
330
331/*
332 * This does nothing - not applicable to Au1000 DMA.
333 */
334static inline void set_dma_page(unsigned int dmanr, char pagenr)
335{
336}
337
338/*
339 * Set Buffer 0 transfer address for specific DMA channel.
340 */
341static inline void set_dma_addr0(unsigned int dmanr, unsigned int a)
342{
343 struct dma_chan *chan = get_dma_chan(dmanr);
344
345 if (!chan)
346 return;
347 __raw_writel(a, chan->io + DMA_BUFFER0_START);
348}
349
350/*
351 * Set Buffer 1 transfer address for specific DMA channel.
352 */
353static inline void set_dma_addr1(unsigned int dmanr, unsigned int a)
354{
355 struct dma_chan *chan = get_dma_chan(dmanr);
356
357 if (!chan)
358 return;
359 __raw_writel(a, chan->io + DMA_BUFFER1_START);
360}
361
362
363/*
364 * Set Buffer 0 transfer size (max 64k) for a specific DMA channel.
365 */
366static inline void set_dma_count0(unsigned int dmanr, unsigned int count)
367{
368 struct dma_chan *chan = get_dma_chan(dmanr);
369
370 if (!chan)
371 return;
372 count &= DMA_COUNT_MASK;
373 __raw_writel(count, chan->io + DMA_BUFFER0_COUNT);
374}
375
376/*
377 * Set Buffer 1 transfer size (max 64k) for a specific DMA channel.
378 */
379static inline void set_dma_count1(unsigned int dmanr, unsigned int count)
380{
381 struct dma_chan *chan = get_dma_chan(dmanr);
382
383 if (!chan)
384 return;
385 count &= DMA_COUNT_MASK;
386 __raw_writel(count, chan->io + DMA_BUFFER1_COUNT);
387}
388
389/*
390 * Set both buffer transfer sizes (max 64k) for a specific DMA channel.
391 */
392static inline void set_dma_count(unsigned int dmanr, unsigned int count)
393{
394 struct dma_chan *chan = get_dma_chan(dmanr);
395
396 if (!chan)
397 return;
398 count &= DMA_COUNT_MASK;
399 __raw_writel(count, chan->io + DMA_BUFFER0_COUNT);
400 __raw_writel(count, chan->io + DMA_BUFFER1_COUNT);
401}
402
403/*
404 * Returns which buffer has its done bit set in the mode register.
405 * Returns -1 if neither or both done bits set.
406 */
407static inline unsigned int get_dma_buffer_done(unsigned int dmanr)
408{
409 struct dma_chan *chan = get_dma_chan(dmanr);
410
411 if (!chan)
412 return 0;
413 return __raw_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1);
414}
415
416
417/*
418 * Returns the DMA channel's Buffer Done IRQ number.
419 */
420static inline int get_dma_done_irq(unsigned int dmanr)
421{
422 struct dma_chan *chan = get_dma_chan(dmanr);
423
424 if (!chan)
425 return -1;
426 return chan->irq;
427}
428
429/*
430 * Get DMA residue count. Returns the number of _bytes_ left to transfer.
431 */
432static inline int get_dma_residue(unsigned int dmanr)
433{
434 int curBufCntReg, count;
435 struct dma_chan *chan = get_dma_chan(dmanr);
436
437 if (!chan)
438 return 0;
439
440 curBufCntReg = (__raw_readl(chan->io + DMA_MODE_READ) & DMA_AB) ?
441 DMA_BUFFER1_COUNT : DMA_BUFFER0_COUNT;
442
443 count = __raw_readl(chan->io + curBufCntReg) & DMA_COUNT_MASK;
444
445 if ((chan->mode & DMA_DW_MASK) == DMA_DW16)
446 count <<= 1;
447 else if ((chan->mode & DMA_DW_MASK) == DMA_DW32)
448 count <<= 2;
449
450 return count;
451}
452
453#endif /* __ASM_AU1000_DMA_H */
diff --git a/arch/mips/include/asm/mach-au1x00/au1100_mmc.h b/arch/mips/include/asm/mach-au1x00/au1100_mmc.h
new file mode 100644
index 000000000..cadab91ce
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/au1100_mmc.h
@@ -0,0 +1,210 @@
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#include <linux/leds.h>
42
43struct au1xmmc_platform_data {
44 int(*cd_setup)(void *mmc_host, int on);
45 int(*card_inserted)(void *mmc_host);
46 int(*card_readonly)(void *mmc_host);
47 void(*set_power)(void *mmc_host, int state);
48 struct led_classdev *led;
49 unsigned long mask_host_caps;
50};
51
52#define SD0_BASE 0xB0600000
53#define SD1_BASE 0xB0680000
54
55
56/*
57 * Register offsets.
58 */
59#define SD_TXPORT (0x0000)
60#define SD_RXPORT (0x0004)
61#define SD_CONFIG (0x0008)
62#define SD_ENABLE (0x000C)
63#define SD_CONFIG2 (0x0010)
64#define SD_BLKSIZE (0x0014)
65#define SD_STATUS (0x0018)
66#define SD_DEBUG (0x001C)
67#define SD_CMD (0x0020)
68#define SD_CMDARG (0x0024)
69#define SD_RESP3 (0x0028)
70#define SD_RESP2 (0x002C)
71#define SD_RESP1 (0x0030)
72#define SD_RESP0 (0x0034)
73#define SD_TIMEOUT (0x0038)
74
75
76/*
77 * SD_TXPORT bit definitions.
78 */
79#define SD_TXPORT_TXD (0x000000ff)
80
81
82/*
83 * SD_RXPORT bit definitions.
84 */
85#define SD_RXPORT_RXD (0x000000ff)
86
87
88/*
89 * SD_CONFIG bit definitions.
90 */
91#define SD_CONFIG_DIV (0x000001ff)
92#define SD_CONFIG_DE (0x00000200)
93#define SD_CONFIG_NE (0x00000400)
94#define SD_CONFIG_TU (0x00000800)
95#define SD_CONFIG_TO (0x00001000)
96#define SD_CONFIG_RU (0x00002000)
97#define SD_CONFIG_RO (0x00004000)
98#define SD_CONFIG_I (0x00008000)
99#define SD_CONFIG_CR (0x00010000)
100#define SD_CONFIG_RAT (0x00020000)
101#define SD_CONFIG_DD (0x00040000)
102#define SD_CONFIG_DT (0x00080000)
103#define SD_CONFIG_SC (0x00100000)
104#define SD_CONFIG_RC (0x00200000)
105#define SD_CONFIG_WC (0x00400000)
106#define SD_CONFIG_xxx (0x00800000)
107#define SD_CONFIG_TH (0x01000000)
108#define SD_CONFIG_TE (0x02000000)
109#define SD_CONFIG_TA (0x04000000)
110#define SD_CONFIG_RH (0x08000000)
111#define SD_CONFIG_RA (0x10000000)
112#define SD_CONFIG_RF (0x20000000)
113#define SD_CONFIG_CD (0x40000000)
114#define SD_CONFIG_SI (0x80000000)
115
116
117/*
118 * SD_ENABLE bit definitions.
119 */
120#define SD_ENABLE_CE (0x00000001)
121#define SD_ENABLE_R (0x00000002)
122
123
124/*
125 * SD_CONFIG2 bit definitions.
126 */
127#define SD_CONFIG2_EN (0x00000001)
128#define SD_CONFIG2_FF (0x00000002)
129#define SD_CONFIG2_xx1 (0x00000004)
130#define SD_CONFIG2_DF (0x00000008)
131#define SD_CONFIG2_DC (0x00000010)
132#define SD_CONFIG2_xx2 (0x000000e0)
133#define SD_CONFIG2_BB (0x00000080)
134#define SD_CONFIG2_WB (0x00000100)
135#define SD_CONFIG2_RW (0x00000200)
136#define SD_CONFIG2_DP (0x00000400)
137
138
139/*
140 * SD_BLKSIZE bit definitions.
141 */
142#define SD_BLKSIZE_BS (0x000007ff)
143#define SD_BLKSIZE_BS_SHIFT (0)
144#define SD_BLKSIZE_BC (0x01ff0000)
145#define SD_BLKSIZE_BC_SHIFT (16)
146
147
148/*
149 * SD_STATUS bit definitions.
150 */
151#define SD_STATUS_DCRCW (0x00000007)
152#define SD_STATUS_xx1 (0x00000008)
153#define SD_STATUS_CB (0x00000010)
154#define SD_STATUS_DB (0x00000020)
155#define SD_STATUS_CF (0x00000040)
156#define SD_STATUS_D3 (0x00000080)
157#define SD_STATUS_xx2 (0x00000300)
158#define SD_STATUS_NE (0x00000400)
159#define SD_STATUS_TU (0x00000800)
160#define SD_STATUS_TO (0x00001000)
161#define SD_STATUS_RU (0x00002000)
162#define SD_STATUS_RO (0x00004000)
163#define SD_STATUS_I (0x00008000)
164#define SD_STATUS_CR (0x00010000)
165#define SD_STATUS_RAT (0x00020000)
166#define SD_STATUS_DD (0x00040000)
167#define SD_STATUS_DT (0x00080000)
168#define SD_STATUS_SC (0x00100000)
169#define SD_STATUS_RC (0x00200000)
170#define SD_STATUS_WC (0x00400000)
171#define SD_STATUS_xx3 (0x00800000)
172#define SD_STATUS_TH (0x01000000)
173#define SD_STATUS_TE (0x02000000)
174#define SD_STATUS_TA (0x04000000)
175#define SD_STATUS_RH (0x08000000)
176#define SD_STATUS_RA (0x10000000)
177#define SD_STATUS_RF (0x20000000)
178#define SD_STATUS_CD (0x40000000)
179#define SD_STATUS_SI (0x80000000)
180
181
182/*
183 * SD_CMD bit definitions.
184 */
185#define SD_CMD_GO (0x00000001)
186#define SD_CMD_RY (0x00000002)
187#define SD_CMD_xx1 (0x0000000c)
188#define SD_CMD_CT_MASK (0x000000f0)
189#define SD_CMD_CT_0 (0x00000000)
190#define SD_CMD_CT_1 (0x00000010)
191#define SD_CMD_CT_2 (0x00000020)
192#define SD_CMD_CT_3 (0x00000030)
193#define SD_CMD_CT_4 (0x00000040)
194#define SD_CMD_CT_5 (0x00000050)
195#define SD_CMD_CT_6 (0x00000060)
196#define SD_CMD_CT_7 (0x00000070)
197#define SD_CMD_CI (0x0000ff00)
198#define SD_CMD_CI_SHIFT (8)
199#define SD_CMD_RT_MASK (0x00ff0000)
200#define SD_CMD_RT_0 (0x00000000)
201#define SD_CMD_RT_1 (0x00010000)
202#define SD_CMD_RT_2 (0x00020000)
203#define SD_CMD_RT_3 (0x00030000)
204#define SD_CMD_RT_4 (0x00040000)
205#define SD_CMD_RT_5 (0x00050000)
206#define SD_CMD_RT_6 (0x00060000)
207#define SD_CMD_RT_1B (0x00810000)
208
209
210#endif /* __ASM_AU1100_MMC_H */
diff --git a/arch/mips/include/asm/mach-au1x00/au1200fb.h b/arch/mips/include/asm/mach-au1x00/au1200fb.h
new file mode 100644
index 000000000..e0e98f06c
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/au1200fb.h
@@ -0,0 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * platform data for au1200fb driver.
4 */
5
6#ifndef _AU1200FB_PLAT_H_
7#define _AU1200FB_PLAT_H_
8
9struct au1200fb_platdata {
10 int (*panel_index)(void);
11 int (*panel_init)(void);
12 int (*panel_shutdown)(void);
13};
14
15#endif
diff --git a/arch/mips/include/asm/mach-au1x00/au1550_spi.h b/arch/mips/include/asm/mach-au1x00/au1550_spi.h
new file mode 100644
index 000000000..fe6ca4606
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/au1550_spi.h
@@ -0,0 +1,16 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * au1550_spi.h - Au1550 PSC SPI controller driver - platform data structure
4 */
5
6#ifndef _AU1550_SPI_H_
7#define _AU1550_SPI_H_
8
9struct au1550_spi_info {
10 u32 mainclk_hz; /* main input clock frequency of PSC */
11 u16 num_chipselect; /* number of chipselects supported */
12 void (*activate_cs)(struct au1550_spi_info *spi, int cs, int polarity);
13 void (*deactivate_cs)(struct au1550_spi_info *spi, int cs, int polarity);
14};
15
16#endif
diff --git a/arch/mips/include/asm/mach-au1x00/au1550nd.h b/arch/mips/include/asm/mach-au1x00/au1550nd.h
new file mode 100644
index 000000000..d26dc1dad
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/au1550nd.h
@@ -0,0 +1,17 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * platform data for the Au1550 NAND driver
4 */
5
6#ifndef _AU1550ND_H_
7#define _AU1550ND_H_
8
9#include <linux/mtd/partitions.h>
10
11struct au1550nd_platdata {
12 struct mtd_partition *parts;
13 int num_parts;
14 int devwidth; /* 0 = 8bit device, 1 = 16bit device */
15};
16
17#endif
diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_dbdma.h b/arch/mips/include/asm/mach-au1x00/au1xxx_dbdma.h
new file mode 100644
index 000000000..456ddba15
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/au1xxx_dbdma.h
@@ -0,0 +1,388 @@
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/*
32 * Specifics for the Au1xxx Descriptor-Based DMA Controller,
33 * first seen in the AU1550 part.
34 */
35#ifndef _AU1000_DBDMA_H_
36#define _AU1000_DBDMA_H_
37
38#ifndef _LANGUAGE_ASSEMBLY
39
40typedef volatile struct dbdma_global {
41 u32 ddma_config;
42 u32 ddma_intstat;
43 u32 ddma_throttle;
44 u32 ddma_inten;
45} dbdma_global_t;
46
47/* General Configuration. */
48#define DDMA_CONFIG_AF (1 << 2)
49#define DDMA_CONFIG_AH (1 << 1)
50#define DDMA_CONFIG_AL (1 << 0)
51
52#define DDMA_THROTTLE_EN (1 << 31)
53
54/* The structure of a DMA Channel. */
55typedef volatile struct au1xxx_dma_channel {
56 u32 ddma_cfg; /* See below */
57 u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */
58 u32 ddma_statptr; /* word aligned pointer to status word */
59 u32 ddma_dbell; /* A write activates channel operation */
60 u32 ddma_irq; /* If bit 0 set, interrupt pending */
61 u32 ddma_stat; /* See below */
62 u32 ddma_bytecnt; /* Byte count, valid only when chan idle */
63 /* Remainder, up to the 256 byte boundary, is reserved. */
64} au1x_dma_chan_t;
65
66#define DDMA_CFG_SED (1 << 9) /* source DMA level/edge detect */
67#define DDMA_CFG_SP (1 << 8) /* source DMA polarity */
68#define DDMA_CFG_DED (1 << 7) /* destination DMA level/edge detect */
69#define DDMA_CFG_DP (1 << 6) /* destination DMA polarity */
70#define DDMA_CFG_SYNC (1 << 5) /* Sync static bus controller */
71#define DDMA_CFG_PPR (1 << 4) /* PCI posted read/write control */
72#define DDMA_CFG_DFN (1 << 3) /* Descriptor fetch non-coherent */
73#define DDMA_CFG_SBE (1 << 2) /* Source big endian */
74#define DDMA_CFG_DBE (1 << 1) /* Destination big endian */
75#define DDMA_CFG_EN (1 << 0) /* Channel enable */
76
77/*
78 * Always set when descriptor processing done, regardless of
79 * interrupt enable state. Reflected in global intstat, don't
80 * clear this until global intstat is read/used.
81 */
82#define DDMA_IRQ_IN (1 << 0)
83
84#define DDMA_STAT_DB (1 << 2) /* Doorbell pushed */
85#define DDMA_STAT_V (1 << 1) /* Descriptor valid */
86#define DDMA_STAT_H (1 << 0) /* Channel Halted */
87
88/*
89 * "Standard" DDMA Descriptor.
90 * Must be 32-byte aligned.
91 */
92typedef volatile struct au1xxx_ddma_desc {
93 u32 dscr_cmd0; /* See below */
94 u32 dscr_cmd1; /* See below */
95 u32 dscr_source0; /* source phys address */
96 u32 dscr_source1; /* See below */
97 u32 dscr_dest0; /* Destination address */
98 u32 dscr_dest1; /* See below */
99 u32 dscr_stat; /* completion status */
100 u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */
101 /*
102 * First 32 bytes are HW specific!!!
103 * Let's have some SW data following -- make sure it's 32 bytes.
104 */
105 u32 sw_status;
106 u32 sw_context;
107 u32 sw_reserved[6];
108} au1x_ddma_desc_t;
109
110#define DSCR_CMD0_V (1 << 31) /* Descriptor valid */
111#define DSCR_CMD0_MEM (1 << 30) /* mem-mem transfer */
112#define DSCR_CMD0_SID_MASK (0x1f << 25) /* Source ID */
113#define DSCR_CMD0_DID_MASK (0x1f << 20) /* Destination ID */
114#define DSCR_CMD0_SW_MASK (0x3 << 18) /* Source Width */
115#define DSCR_CMD0_DW_MASK (0x3 << 16) /* Destination Width */
116#define DSCR_CMD0_ARB (0x1 << 15) /* Set for Hi Pri */
117#define DSCR_CMD0_DT_MASK (0x3 << 13) /* Descriptor Type */
118#define DSCR_CMD0_SN (0x1 << 12) /* Source non-coherent */
119#define DSCR_CMD0_DN (0x1 << 11) /* Destination non-coherent */
120#define DSCR_CMD0_SM (0x1 << 10) /* Stride mode */
121#define DSCR_CMD0_IE (0x1 << 8) /* Interrupt Enable */
122#define DSCR_CMD0_SP (0x1 << 4) /* Status pointer select */
123#define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */
124#define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */
125
126#define SW_STATUS_INUSE (1 << 0)
127
128/* Command 0 device IDs. */
129#define AU1550_DSCR_CMD0_UART0_TX 0
130#define AU1550_DSCR_CMD0_UART0_RX 1
131#define AU1550_DSCR_CMD0_UART3_TX 2
132#define AU1550_DSCR_CMD0_UART3_RX 3
133#define AU1550_DSCR_CMD0_DMA_REQ0 4
134#define AU1550_DSCR_CMD0_DMA_REQ1 5
135#define AU1550_DSCR_CMD0_DMA_REQ2 6
136#define AU1550_DSCR_CMD0_DMA_REQ3 7
137#define AU1550_DSCR_CMD0_USBDEV_RX0 8
138#define AU1550_DSCR_CMD0_USBDEV_TX0 9
139#define AU1550_DSCR_CMD0_USBDEV_TX1 10
140#define AU1550_DSCR_CMD0_USBDEV_TX2 11
141#define AU1550_DSCR_CMD0_USBDEV_RX3 12
142#define AU1550_DSCR_CMD0_USBDEV_RX4 13
143#define AU1550_DSCR_CMD0_PSC0_TX 14
144#define AU1550_DSCR_CMD0_PSC0_RX 15
145#define AU1550_DSCR_CMD0_PSC1_TX 16
146#define AU1550_DSCR_CMD0_PSC1_RX 17
147#define AU1550_DSCR_CMD0_PSC2_TX 18
148#define AU1550_DSCR_CMD0_PSC2_RX 19
149#define AU1550_DSCR_CMD0_PSC3_TX 20
150#define AU1550_DSCR_CMD0_PSC3_RX 21
151#define AU1550_DSCR_CMD0_PCI_WRITE 22
152#define AU1550_DSCR_CMD0_NAND_FLASH 23
153#define AU1550_DSCR_CMD0_MAC0_RX 24
154#define AU1550_DSCR_CMD0_MAC0_TX 25
155#define AU1550_DSCR_CMD0_MAC1_RX 26
156#define AU1550_DSCR_CMD0_MAC1_TX 27
157
158#define AU1200_DSCR_CMD0_UART0_TX 0
159#define AU1200_DSCR_CMD0_UART0_RX 1
160#define AU1200_DSCR_CMD0_UART1_TX 2
161#define AU1200_DSCR_CMD0_UART1_RX 3
162#define AU1200_DSCR_CMD0_DMA_REQ0 4
163#define AU1200_DSCR_CMD0_DMA_REQ1 5
164#define AU1200_DSCR_CMD0_MAE_BE 6
165#define AU1200_DSCR_CMD0_MAE_FE 7
166#define AU1200_DSCR_CMD0_SDMS_TX0 8
167#define AU1200_DSCR_CMD0_SDMS_RX0 9
168#define AU1200_DSCR_CMD0_SDMS_TX1 10
169#define AU1200_DSCR_CMD0_SDMS_RX1 11
170#define AU1200_DSCR_CMD0_AES_TX 13
171#define AU1200_DSCR_CMD0_AES_RX 12
172#define AU1200_DSCR_CMD0_PSC0_TX 14
173#define AU1200_DSCR_CMD0_PSC0_RX 15
174#define AU1200_DSCR_CMD0_PSC1_TX 16
175#define AU1200_DSCR_CMD0_PSC1_RX 17
176#define AU1200_DSCR_CMD0_CIM_RXA 18
177#define AU1200_DSCR_CMD0_CIM_RXB 19
178#define AU1200_DSCR_CMD0_CIM_RXC 20
179#define AU1200_DSCR_CMD0_MAE_BOTH 21
180#define AU1200_DSCR_CMD0_LCD 22
181#define AU1200_DSCR_CMD0_NAND_FLASH 23
182#define AU1200_DSCR_CMD0_PSC0_SYNC 24
183#define AU1200_DSCR_CMD0_PSC1_SYNC 25
184#define AU1200_DSCR_CMD0_CIM_SYNC 26
185
186#define AU1300_DSCR_CMD0_UART0_TX 0
187#define AU1300_DSCR_CMD0_UART0_RX 1
188#define AU1300_DSCR_CMD0_UART1_TX 2
189#define AU1300_DSCR_CMD0_UART1_RX 3
190#define AU1300_DSCR_CMD0_UART2_TX 4
191#define AU1300_DSCR_CMD0_UART2_RX 5
192#define AU1300_DSCR_CMD0_UART3_TX 6
193#define AU1300_DSCR_CMD0_UART3_RX 7
194#define AU1300_DSCR_CMD0_SDMS_TX0 8
195#define AU1300_DSCR_CMD0_SDMS_RX0 9
196#define AU1300_DSCR_CMD0_SDMS_TX1 10
197#define AU1300_DSCR_CMD0_SDMS_RX1 11
198#define AU1300_DSCR_CMD0_AES_TX 12
199#define AU1300_DSCR_CMD0_AES_RX 13
200#define AU1300_DSCR_CMD0_PSC0_TX 14
201#define AU1300_DSCR_CMD0_PSC0_RX 15
202#define AU1300_DSCR_CMD0_PSC1_TX 16
203#define AU1300_DSCR_CMD0_PSC1_RX 17
204#define AU1300_DSCR_CMD0_PSC2_TX 18
205#define AU1300_DSCR_CMD0_PSC2_RX 19
206#define AU1300_DSCR_CMD0_PSC3_TX 20
207#define AU1300_DSCR_CMD0_PSC3_RX 21
208#define AU1300_DSCR_CMD0_LCD 22
209#define AU1300_DSCR_CMD0_NAND_FLASH 23
210#define AU1300_DSCR_CMD0_SDMS_TX2 24
211#define AU1300_DSCR_CMD0_SDMS_RX2 25
212#define AU1300_DSCR_CMD0_CIM_SYNC 26
213#define AU1300_DSCR_CMD0_UDMA 27
214#define AU1300_DSCR_CMD0_DMA_REQ0 28
215#define AU1300_DSCR_CMD0_DMA_REQ1 29
216
217#define DSCR_CMD0_THROTTLE 30
218#define DSCR_CMD0_ALWAYS 31
219#define DSCR_NDEV_IDS 32
220/* This macro is used to find/create custom device types */
221#define DSCR_DEV2CUSTOM_ID(x, d) (((((x) & 0xFFFF) << 8) | 0x32000000) | \
222 ((d) & 0xFF))
223#define DSCR_CUSTOM2DEV_ID(x) ((x) & 0xFF)
224
225#define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25)
226#define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20)
227
228/* Source/Destination transfer width. */
229#define DSCR_CMD0_BYTE 0
230#define DSCR_CMD0_HALFWORD 1
231#define DSCR_CMD0_WORD 2
232
233#define DSCR_CMD0_SW(x) (((x) & 0x3) << 18)
234#define DSCR_CMD0_DW(x) (((x) & 0x3) << 16)
235
236/* DDMA Descriptor Type. */
237#define DSCR_CMD0_STANDARD 0
238#define DSCR_CMD0_LITERAL 1
239#define DSCR_CMD0_CMP_BRANCH 2
240
241#define DSCR_CMD0_DT(x) (((x) & 0x3) << 13)
242
243/* Status Instruction. */
244#define DSCR_CMD0_ST_NOCHANGE 0 /* Don't change */
245#define DSCR_CMD0_ST_CURRENT 1 /* Write current status */
246#define DSCR_CMD0_ST_CMD0 2 /* Write cmd0 with V cleared */
247#define DSCR_CMD0_ST_BYTECNT 3 /* Write remaining byte count */
248
249#define DSCR_CMD0_ST(x) (((x) & 0x3) << 0)
250
251/* Descriptor Command 1. */
252#define DSCR_CMD1_SUPTR_MASK (0xf << 28) /* upper 4 bits of src addr */
253#define DSCR_CMD1_DUPTR_MASK (0xf << 24) /* upper 4 bits of dest addr */
254#define DSCR_CMD1_FL_MASK (0x3 << 22) /* Flag bits */
255#define DSCR_CMD1_BC_MASK (0x3fffff) /* Byte count */
256
257/* Flag description. */
258#define DSCR_CMD1_FL_MEM_STRIDE0 0
259#define DSCR_CMD1_FL_MEM_STRIDE1 1
260#define DSCR_CMD1_FL_MEM_STRIDE2 2
261
262#define DSCR_CMD1_FL(x) (((x) & 0x3) << 22)
263
264/* Source1, 1-dimensional stride. */
265#define DSCR_SRC1_STS_MASK (3 << 30) /* Src xfer size */
266#define DSCR_SRC1_SAM_MASK (3 << 28) /* Src xfer movement */
267#define DSCR_SRC1_SB_MASK (0x3fff << 14) /* Block size */
268#define DSCR_SRC1_SB(x) (((x) & 0x3fff) << 14)
269#define DSCR_SRC1_SS_MASK (0x3fff << 0) /* Stride */
270#define DSCR_SRC1_SS(x) (((x) & 0x3fff) << 0)
271
272/* Dest1, 1-dimensional stride. */
273#define DSCR_DEST1_DTS_MASK (3 << 30) /* Dest xfer size */
274#define DSCR_DEST1_DAM_MASK (3 << 28) /* Dest xfer movement */
275#define DSCR_DEST1_DB_MASK (0x3fff << 14) /* Block size */
276#define DSCR_DEST1_DB(x) (((x) & 0x3fff) << 14)
277#define DSCR_DEST1_DS_MASK (0x3fff << 0) /* Stride */
278#define DSCR_DEST1_DS(x) (((x) & 0x3fff) << 0)
279
280#define DSCR_xTS_SIZE1 0
281#define DSCR_xTS_SIZE2 1
282#define DSCR_xTS_SIZE4 2
283#define DSCR_xTS_SIZE8 3
284#define DSCR_SRC1_STS(x) (((x) & 3) << 30)
285#define DSCR_DEST1_DTS(x) (((x) & 3) << 30)
286
287#define DSCR_xAM_INCREMENT 0
288#define DSCR_xAM_DECREMENT 1
289#define DSCR_xAM_STATIC 2
290#define DSCR_xAM_BURST 3
291#define DSCR_SRC1_SAM(x) (((x) & 3) << 28)
292#define DSCR_DEST1_DAM(x) (((x) & 3) << 28)
293
294/* The next descriptor pointer. */
295#define DSCR_NXTPTR_MASK (0x07ffffff)
296#define DSCR_NXTPTR(x) ((x) >> 5)
297#define DSCR_GET_NXTPTR(x) ((x) << 5)
298#define DSCR_NXTPTR_MS (1 << 27)
299
300/* The number of DBDMA channels. */
301#define NUM_DBDMA_CHANS 16
302
303/*
304 * DDMA API definitions
305 * FIXME: may not fit to this header file
306 */
307typedef struct dbdma_device_table {
308 u32 dev_id;
309 u32 dev_flags;
310 u32 dev_tsize;
311 u32 dev_devwidth;
312 u32 dev_physaddr; /* If FIFO */
313 u32 dev_intlevel;
314 u32 dev_intpolarity;
315} dbdev_tab_t;
316
317
318typedef struct dbdma_chan_config {
319 spinlock_t lock;
320
321 u32 chan_flags;
322 u32 chan_index;
323 dbdev_tab_t *chan_src;
324 dbdev_tab_t *chan_dest;
325 au1x_dma_chan_t *chan_ptr;
326 au1x_ddma_desc_t *chan_desc_base;
327 u32 cdb_membase; /* kmalloc base of above */
328 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr;
329 void *chan_callparam;
330 void (*chan_callback)(int, void *);
331} chan_tab_t;
332
333#define DEV_FLAGS_INUSE (1 << 0)
334#define DEV_FLAGS_ANYUSE (1 << 1)
335#define DEV_FLAGS_OUT (1 << 2)
336#define DEV_FLAGS_IN (1 << 3)
337#define DEV_FLAGS_BURSTABLE (1 << 4)
338#define DEV_FLAGS_SYNC (1 << 5)
339/* end DDMA API definitions */
340
341/*
342 * External functions for drivers to use.
343 * Use this to allocate a DBDMA channel. The device IDs are one of
344 * the DSCR_CMD0 devices IDs, which is usually redefined to a more
345 * meaningful name. The 'callback' is called during DMA completion
346 * interrupt.
347 */
348extern u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
349 void (*callback)(int, void *),
350 void *callparam);
351
352#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS
353
354/* Set the device width of an in/out FIFO. */
355u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits);
356
357/* Allocate a ring of descriptors for DBDMA. */
358u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries);
359
360/* Put buffers on source/destination descriptors. */
361u32 au1xxx_dbdma_put_source(u32 chanid, dma_addr_t buf, int nbytes, u32 flags);
362u32 au1xxx_dbdma_put_dest(u32 chanid, dma_addr_t buf, int nbytes, u32 flags);
363
364/* Get a buffer from the destination descriptor. */
365u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes);
366
367void au1xxx_dbdma_stop(u32 chanid);
368void au1xxx_dbdma_start(u32 chanid);
369void au1xxx_dbdma_reset(u32 chanid);
370u32 au1xxx_get_dma_residue(u32 chanid);
371
372void au1xxx_dbdma_chan_free(u32 chanid);
373void au1xxx_dbdma_dump(u32 chanid);
374
375u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr);
376
377u32 au1xxx_ddma_add_device(dbdev_tab_t *dev);
378extern void au1xxx_ddma_del_device(u32 devid);
379void *au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp);
380
381/*
382 * Flags for the put_source/put_dest functions.
383 */
384#define DDMA_FLAGS_IE (1 << 0)
385#define DDMA_FLAGS_NOIE (1 << 1)
386
387#endif /* _LANGUAGE_ASSEMBLY */
388#endif /* _AU1000_DBDMA_H_ */
diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
new file mode 100644
index 000000000..9d1c8d5ed
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
@@ -0,0 +1,19 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __AU1X00_ETH_DATA_H
3#define __AU1X00_ETH_DATA_H
4
5/* Platform specific PHY configuration passed to the MAC driver */
6struct au1000_eth_platform_data {
7 int phy_static_config;
8 int phy_search_highest_addr;
9 int phy1_search_mac0;
10 int phy_addr;
11 int phy_busid;
12 int phy_irq;
13 char mac[6];
14};
15
16void __init au1xxx_override_eth_cfg(unsigned port,
17 struct au1000_eth_platform_data *eth_data);
18
19#endif /* __AU1X00_ETH_DATA_H */
diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_psc.h b/arch/mips/include/asm/mach-au1x00/au1xxx_psc.h
new file mode 100644
index 000000000..8a9cd754b
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/au1xxx_psc.h
@@ -0,0 +1,466 @@
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/*
37 * The PSC select and control registers are common to all protocols.
38 */
39#define PSC_SEL_OFFSET 0x00000000
40#define PSC_CTRL_OFFSET 0x00000004
41
42#define PSC_SEL_CLK_MASK (3 << 4)
43#define PSC_SEL_CLK_INTCLK (0 << 4)
44#define PSC_SEL_CLK_EXTCLK (1 << 4)
45#define PSC_SEL_CLK_SERCLK (2 << 4)
46
47#define PSC_SEL_PS_MASK 0x00000007
48#define PSC_SEL_PS_DISABLED 0
49#define PSC_SEL_PS_SPIMODE 2
50#define PSC_SEL_PS_I2SMODE 3
51#define PSC_SEL_PS_AC97MODE 4
52#define PSC_SEL_PS_SMBUSMODE 5
53
54#define PSC_CTRL_DISABLE 0
55#define PSC_CTRL_SUSPEND 2
56#define PSC_CTRL_ENABLE 3
57
58/* AC97 Registers. */
59#define PSC_AC97CFG_OFFSET 0x00000008
60#define PSC_AC97MSK_OFFSET 0x0000000c
61#define PSC_AC97PCR_OFFSET 0x00000010
62#define PSC_AC97STAT_OFFSET 0x00000014
63#define PSC_AC97EVNT_OFFSET 0x00000018
64#define PSC_AC97TXRX_OFFSET 0x0000001c
65#define PSC_AC97CDC_OFFSET 0x00000020
66#define PSC_AC97RST_OFFSET 0x00000024
67#define PSC_AC97GPO_OFFSET 0x00000028
68#define PSC_AC97GPI_OFFSET 0x0000002c
69
70/* AC97 Config Register. */
71#define PSC_AC97CFG_RT_MASK (3 << 30)
72#define PSC_AC97CFG_RT_FIFO1 (0 << 30)
73#define PSC_AC97CFG_RT_FIFO2 (1 << 30)
74#define PSC_AC97CFG_RT_FIFO4 (2 << 30)
75#define PSC_AC97CFG_RT_FIFO8 (3 << 30)
76
77#define PSC_AC97CFG_TT_MASK (3 << 28)
78#define PSC_AC97CFG_TT_FIFO1 (0 << 28)
79#define PSC_AC97CFG_TT_FIFO2 (1 << 28)
80#define PSC_AC97CFG_TT_FIFO4 (2 << 28)
81#define PSC_AC97CFG_TT_FIFO8 (3 << 28)
82
83#define PSC_AC97CFG_DD_DISABLE (1 << 27)
84#define PSC_AC97CFG_DE_ENABLE (1 << 26)
85#define PSC_AC97CFG_SE_ENABLE (1 << 25)
86
87#define PSC_AC97CFG_LEN_MASK (0xf << 21)
88#define PSC_AC97CFG_TXSLOT_MASK (0x3ff << 11)
89#define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1)
90#define PSC_AC97CFG_GE_ENABLE (1)
91
92/* Enable slots 3-12. */
93#define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11))
94#define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1))
95
96/*
97 * The word length equation is ((x) * 2) + 2, so choose 'x' appropriately.
98 * The only sensible numbers are 7, 9, or possibly 11. Nah, just do the
99 * arithmetic in the macro.
100 */
101#define PSC_AC97CFG_SET_LEN(x) (((((x) - 2) / 2) & 0xf) << 21)
102#define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2)
103
104/* AC97 Mask Register. */
105#define PSC_AC97MSK_GR (1 << 25)
106#define PSC_AC97MSK_CD (1 << 24)
107#define PSC_AC97MSK_RR (1 << 13)
108#define PSC_AC97MSK_RO (1 << 12)
109#define PSC_AC97MSK_RU (1 << 11)
110#define PSC_AC97MSK_TR (1 << 10)
111#define PSC_AC97MSK_TO (1 << 9)
112#define PSC_AC97MSK_TU (1 << 8)
113#define PSC_AC97MSK_RD (1 << 5)
114#define PSC_AC97MSK_TD (1 << 4)
115#define PSC_AC97MSK_ALLMASK (PSC_AC97MSK_GR | PSC_AC97MSK_CD | \
116 PSC_AC97MSK_RR | PSC_AC97MSK_RO | \
117 PSC_AC97MSK_RU | PSC_AC97MSK_TR | \
118 PSC_AC97MSK_TO | PSC_AC97MSK_TU | \
119 PSC_AC97MSK_RD | PSC_AC97MSK_TD)
120
121/* AC97 Protocol Control Register. */
122#define PSC_AC97PCR_RC (1 << 6)
123#define PSC_AC97PCR_RP (1 << 5)
124#define PSC_AC97PCR_RS (1 << 4)
125#define PSC_AC97PCR_TC (1 << 2)
126#define PSC_AC97PCR_TP (1 << 1)
127#define PSC_AC97PCR_TS (1 << 0)
128
129/* AC97 Status register (read only). */
130#define PSC_AC97STAT_CB (1 << 26)
131#define PSC_AC97STAT_CP (1 << 25)
132#define PSC_AC97STAT_CR (1 << 24)
133#define PSC_AC97STAT_RF (1 << 13)
134#define PSC_AC97STAT_RE (1 << 12)
135#define PSC_AC97STAT_RR (1 << 11)
136#define PSC_AC97STAT_TF (1 << 10)
137#define PSC_AC97STAT_TE (1 << 9)
138#define PSC_AC97STAT_TR (1 << 8)
139#define PSC_AC97STAT_RB (1 << 5)
140#define PSC_AC97STAT_TB (1 << 4)
141#define PSC_AC97STAT_DI (1 << 2)
142#define PSC_AC97STAT_DR (1 << 1)
143#define PSC_AC97STAT_SR (1 << 0)
144
145/* AC97 Event Register. */
146#define PSC_AC97EVNT_GR (1 << 25)
147#define PSC_AC97EVNT_CD (1 << 24)
148#define PSC_AC97EVNT_RR (1 << 13)
149#define PSC_AC97EVNT_RO (1 << 12)
150#define PSC_AC97EVNT_RU (1 << 11)
151#define PSC_AC97EVNT_TR (1 << 10)
152#define PSC_AC97EVNT_TO (1 << 9)
153#define PSC_AC97EVNT_TU (1 << 8)
154#define PSC_AC97EVNT_RD (1 << 5)
155#define PSC_AC97EVNT_TD (1 << 4)
156
157/* CODEC Command Register. */
158#define PSC_AC97CDC_RD (1 << 25)
159#define PSC_AC97CDC_ID_MASK (3 << 23)
160#define PSC_AC97CDC_INDX_MASK (0x7f << 16)
161#define PSC_AC97CDC_ID(x) (((x) & 0x03) << 23)
162#define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16)
163
164/* AC97 Reset Control Register. */
165#define PSC_AC97RST_RST (1 << 1)
166#define PSC_AC97RST_SNC (1 << 0)
167
168/* PSC in I2S Mode. */
169typedef struct psc_i2s {
170 u32 psc_sel;
171 u32 psc_ctrl;
172 u32 psc_i2scfg;
173 u32 psc_i2smsk;
174 u32 psc_i2spcr;
175 u32 psc_i2sstat;
176 u32 psc_i2sevent;
177 u32 psc_i2stxrx;
178 u32 psc_i2sudf;
179} psc_i2s_t;
180
181#define PSC_I2SCFG_OFFSET 0x08
182#define PSC_I2SMASK_OFFSET 0x0C
183#define PSC_I2SPCR_OFFSET 0x10
184#define PSC_I2SSTAT_OFFSET 0x14
185#define PSC_I2SEVENT_OFFSET 0x18
186#define PSC_I2SRXTX_OFFSET 0x1C
187#define PSC_I2SUDF_OFFSET 0x20
188
189/* I2S Config Register. */
190#define PSC_I2SCFG_RT_MASK (3 << 30)
191#define PSC_I2SCFG_RT_FIFO1 (0 << 30)
192#define PSC_I2SCFG_RT_FIFO2 (1 << 30)
193#define PSC_I2SCFG_RT_FIFO4 (2 << 30)
194#define PSC_I2SCFG_RT_FIFO8 (3 << 30)
195
196#define PSC_I2SCFG_TT_MASK (3 << 28)
197#define PSC_I2SCFG_TT_FIFO1 (0 << 28)
198#define PSC_I2SCFG_TT_FIFO2 (1 << 28)
199#define PSC_I2SCFG_TT_FIFO4 (2 << 28)
200#define PSC_I2SCFG_TT_FIFO8 (3 << 28)
201
202#define PSC_I2SCFG_DD_DISABLE (1 << 27)
203#define PSC_I2SCFG_DE_ENABLE (1 << 26)
204#define PSC_I2SCFG_SET_WS(x) (((((x) / 2) - 1) & 0x7f) << 16)
205#define PSC_I2SCFG_WS(n) ((n & 0xFF) << 16)
206#define PSC_I2SCFG_WS_MASK (PSC_I2SCFG_WS(0x3F))
207#define PSC_I2SCFG_WI (1 << 15)
208
209#define PSC_I2SCFG_DIV_MASK (3 << 13)
210#define PSC_I2SCFG_DIV2 (0 << 13)
211#define PSC_I2SCFG_DIV4 (1 << 13)
212#define PSC_I2SCFG_DIV8 (2 << 13)
213#define PSC_I2SCFG_DIV16 (3 << 13)
214
215#define PSC_I2SCFG_BI (1 << 12)
216#define PSC_I2SCFG_BUF (1 << 11)
217#define PSC_I2SCFG_MLJ (1 << 10)
218#define PSC_I2SCFG_XM (1 << 9)
219
220/* The word length equation is simply LEN+1. */
221#define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4)
222#define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1)
223
224#define PSC_I2SCFG_LB (1 << 2)
225#define PSC_I2SCFG_MLF (1 << 1)
226#define PSC_I2SCFG_MS (1 << 0)
227
228/* I2S Mask Register. */
229#define PSC_I2SMSK_RR (1 << 13)
230#define PSC_I2SMSK_RO (1 << 12)
231#define PSC_I2SMSK_RU (1 << 11)
232#define PSC_I2SMSK_TR (1 << 10)
233#define PSC_I2SMSK_TO (1 << 9)
234#define PSC_I2SMSK_TU (1 << 8)
235#define PSC_I2SMSK_RD (1 << 5)
236#define PSC_I2SMSK_TD (1 << 4)
237#define PSC_I2SMSK_ALLMASK (PSC_I2SMSK_RR | PSC_I2SMSK_RO | \
238 PSC_I2SMSK_RU | PSC_I2SMSK_TR | \
239 PSC_I2SMSK_TO | PSC_I2SMSK_TU | \
240 PSC_I2SMSK_RD | PSC_I2SMSK_TD)
241
242/* I2S Protocol Control Register. */
243#define PSC_I2SPCR_RC (1 << 6)
244#define PSC_I2SPCR_RP (1 << 5)
245#define PSC_I2SPCR_RS (1 << 4)
246#define PSC_I2SPCR_TC (1 << 2)
247#define PSC_I2SPCR_TP (1 << 1)
248#define PSC_I2SPCR_TS (1 << 0)
249
250/* I2S Status register (read only). */
251#define PSC_I2SSTAT_RF (1 << 13)
252#define PSC_I2SSTAT_RE (1 << 12)
253#define PSC_I2SSTAT_RR (1 << 11)
254#define PSC_I2SSTAT_TF (1 << 10)
255#define PSC_I2SSTAT_TE (1 << 9)
256#define PSC_I2SSTAT_TR (1 << 8)
257#define PSC_I2SSTAT_RB (1 << 5)
258#define PSC_I2SSTAT_TB (1 << 4)
259#define PSC_I2SSTAT_DI (1 << 2)
260#define PSC_I2SSTAT_DR (1 << 1)
261#define PSC_I2SSTAT_SR (1 << 0)
262
263/* I2S Event Register. */
264#define PSC_I2SEVNT_RR (1 << 13)
265#define PSC_I2SEVNT_RO (1 << 12)
266#define PSC_I2SEVNT_RU (1 << 11)
267#define PSC_I2SEVNT_TR (1 << 10)
268#define PSC_I2SEVNT_TO (1 << 9)
269#define PSC_I2SEVNT_TU (1 << 8)
270#define PSC_I2SEVNT_RD (1 << 5)
271#define PSC_I2SEVNT_TD (1 << 4)
272
273/* PSC in SPI Mode. */
274typedef struct psc_spi {
275 u32 psc_sel;
276 u32 psc_ctrl;
277 u32 psc_spicfg;
278 u32 psc_spimsk;
279 u32 psc_spipcr;
280 u32 psc_spistat;
281 u32 psc_spievent;
282 u32 psc_spitxrx;
283} psc_spi_t;
284
285/* SPI Config Register. */
286#define PSC_SPICFG_RT_MASK (3 << 30)
287#define PSC_SPICFG_RT_FIFO1 (0 << 30)
288#define PSC_SPICFG_RT_FIFO2 (1 << 30)
289#define PSC_SPICFG_RT_FIFO4 (2 << 30)
290#define PSC_SPICFG_RT_FIFO8 (3 << 30)
291
292#define PSC_SPICFG_TT_MASK (3 << 28)
293#define PSC_SPICFG_TT_FIFO1 (0 << 28)
294#define PSC_SPICFG_TT_FIFO2 (1 << 28)
295#define PSC_SPICFG_TT_FIFO4 (2 << 28)
296#define PSC_SPICFG_TT_FIFO8 (3 << 28)
297
298#define PSC_SPICFG_DD_DISABLE (1 << 27)
299#define PSC_SPICFG_DE_ENABLE (1 << 26)
300#define PSC_SPICFG_CLR_BAUD(x) ((x) & ~((0x3f) << 15))
301#define PSC_SPICFG_SET_BAUD(x) (((x) & 0x3f) << 15)
302
303#define PSC_SPICFG_SET_DIV(x) (((x) & 0x03) << 13)
304#define PSC_SPICFG_DIV2 0
305#define PSC_SPICFG_DIV4 1
306#define PSC_SPICFG_DIV8 2
307#define PSC_SPICFG_DIV16 3
308
309#define PSC_SPICFG_BI (1 << 12)
310#define PSC_SPICFG_PSE (1 << 11)
311#define PSC_SPICFG_CGE (1 << 10)
312#define PSC_SPICFG_CDE (1 << 9)
313
314#define PSC_SPICFG_CLR_LEN(x) ((x) & ~((0x1f) << 4))
315#define PSC_SPICFG_SET_LEN(x) (((x-1) & 0x1f) << 4)
316
317#define PSC_SPICFG_LB (1 << 3)
318#define PSC_SPICFG_MLF (1 << 1)
319#define PSC_SPICFG_MO (1 << 0)
320
321/* SPI Mask Register. */
322#define PSC_SPIMSK_MM (1 << 16)
323#define PSC_SPIMSK_RR (1 << 13)
324#define PSC_SPIMSK_RO (1 << 12)
325#define PSC_SPIMSK_RU (1 << 11)
326#define PSC_SPIMSK_TR (1 << 10)
327#define PSC_SPIMSK_TO (1 << 9)
328#define PSC_SPIMSK_TU (1 << 8)
329#define PSC_SPIMSK_SD (1 << 5)
330#define PSC_SPIMSK_MD (1 << 4)
331#define PSC_SPIMSK_ALLMASK (PSC_SPIMSK_MM | PSC_SPIMSK_RR | \
332 PSC_SPIMSK_RO | PSC_SPIMSK_TO | \
333 PSC_SPIMSK_TU | PSC_SPIMSK_SD | \
334 PSC_SPIMSK_MD)
335
336/* SPI Protocol Control Register. */
337#define PSC_SPIPCR_RC (1 << 6)
338#define PSC_SPIPCR_SP (1 << 5)
339#define PSC_SPIPCR_SS (1 << 4)
340#define PSC_SPIPCR_TC (1 << 2)
341#define PSC_SPIPCR_MS (1 << 0)
342
343/* SPI Status register (read only). */
344#define PSC_SPISTAT_RF (1 << 13)
345#define PSC_SPISTAT_RE (1 << 12)
346#define PSC_SPISTAT_RR (1 << 11)
347#define PSC_SPISTAT_TF (1 << 10)
348#define PSC_SPISTAT_TE (1 << 9)
349#define PSC_SPISTAT_TR (1 << 8)
350#define PSC_SPISTAT_SB (1 << 5)
351#define PSC_SPISTAT_MB (1 << 4)
352#define PSC_SPISTAT_DI (1 << 2)
353#define PSC_SPISTAT_DR (1 << 1)
354#define PSC_SPISTAT_SR (1 << 0)
355
356/* SPI Event Register. */
357#define PSC_SPIEVNT_MM (1 << 16)
358#define PSC_SPIEVNT_RR (1 << 13)
359#define PSC_SPIEVNT_RO (1 << 12)
360#define PSC_SPIEVNT_RU (1 << 11)
361#define PSC_SPIEVNT_TR (1 << 10)
362#define PSC_SPIEVNT_TO (1 << 9)
363#define PSC_SPIEVNT_TU (1 << 8)
364#define PSC_SPIEVNT_SD (1 << 5)
365#define PSC_SPIEVNT_MD (1 << 4)
366
367/* Transmit register control. */
368#define PSC_SPITXRX_LC (1 << 29)
369#define PSC_SPITXRX_SR (1 << 28)
370
371/* SMBus Config Register. */
372#define PSC_SMBCFG_RT_MASK (3 << 30)
373#define PSC_SMBCFG_RT_FIFO1 (0 << 30)
374#define PSC_SMBCFG_RT_FIFO2 (1 << 30)
375#define PSC_SMBCFG_RT_FIFO4 (2 << 30)
376#define PSC_SMBCFG_RT_FIFO8 (3 << 30)
377
378#define PSC_SMBCFG_TT_MASK (3 << 28)
379#define PSC_SMBCFG_TT_FIFO1 (0 << 28)
380#define PSC_SMBCFG_TT_FIFO2 (1 << 28)
381#define PSC_SMBCFG_TT_FIFO4 (2 << 28)
382#define PSC_SMBCFG_TT_FIFO8 (3 << 28)
383
384#define PSC_SMBCFG_DD_DISABLE (1 << 27)
385#define PSC_SMBCFG_DE_ENABLE (1 << 26)
386
387#define PSC_SMBCFG_SET_DIV(x) (((x) & 0x03) << 13)
388#define PSC_SMBCFG_DIV2 0
389#define PSC_SMBCFG_DIV4 1
390#define PSC_SMBCFG_DIV8 2
391#define PSC_SMBCFG_DIV16 3
392
393#define PSC_SMBCFG_GCE (1 << 9)
394#define PSC_SMBCFG_SFM (1 << 8)
395
396#define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1)
397
398/* SMBus Mask Register. */
399#define PSC_SMBMSK_DN (1 << 30)
400#define PSC_SMBMSK_AN (1 << 29)
401#define PSC_SMBMSK_AL (1 << 28)
402#define PSC_SMBMSK_RR (1 << 13)
403#define PSC_SMBMSK_RO (1 << 12)
404#define PSC_SMBMSK_RU (1 << 11)
405#define PSC_SMBMSK_TR (1 << 10)
406#define PSC_SMBMSK_TO (1 << 9)
407#define PSC_SMBMSK_TU (1 << 8)
408#define PSC_SMBMSK_SD (1 << 5)
409#define PSC_SMBMSK_MD (1 << 4)
410#define PSC_SMBMSK_ALLMASK (PSC_SMBMSK_DN | PSC_SMBMSK_AN | \
411 PSC_SMBMSK_AL | PSC_SMBMSK_RR | \
412 PSC_SMBMSK_RO | PSC_SMBMSK_TO | \
413 PSC_SMBMSK_TU | PSC_SMBMSK_SD | \
414 PSC_SMBMSK_MD)
415
416/* SMBus Protocol Control Register. */
417#define PSC_SMBPCR_DC (1 << 2)
418#define PSC_SMBPCR_MS (1 << 0)
419
420/* SMBus Status register (read only). */
421#define PSC_SMBSTAT_BB (1 << 28)
422#define PSC_SMBSTAT_RF (1 << 13)
423#define PSC_SMBSTAT_RE (1 << 12)
424#define PSC_SMBSTAT_RR (1 << 11)
425#define PSC_SMBSTAT_TF (1 << 10)
426#define PSC_SMBSTAT_TE (1 << 9)
427#define PSC_SMBSTAT_TR (1 << 8)
428#define PSC_SMBSTAT_SB (1 << 5)
429#define PSC_SMBSTAT_MB (1 << 4)
430#define PSC_SMBSTAT_DI (1 << 2)
431#define PSC_SMBSTAT_DR (1 << 1)
432#define PSC_SMBSTAT_SR (1 << 0)
433
434/* SMBus Event Register. */
435#define PSC_SMBEVNT_DN (1 << 30)
436#define PSC_SMBEVNT_AN (1 << 29)
437#define PSC_SMBEVNT_AL (1 << 28)
438#define PSC_SMBEVNT_RR (1 << 13)
439#define PSC_SMBEVNT_RO (1 << 12)
440#define PSC_SMBEVNT_RU (1 << 11)
441#define PSC_SMBEVNT_TR (1 << 10)
442#define PSC_SMBEVNT_TO (1 << 9)
443#define PSC_SMBEVNT_TU (1 << 8)
444#define PSC_SMBEVNT_SD (1 << 5)
445#define PSC_SMBEVNT_MD (1 << 4)
446#define PSC_SMBEVNT_ALLCLR (PSC_SMBEVNT_DN | PSC_SMBEVNT_AN | \
447 PSC_SMBEVNT_AL | PSC_SMBEVNT_RR | \
448 PSC_SMBEVNT_RO | PSC_SMBEVNT_TO | \
449 PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \
450 PSC_SMBEVNT_MD)
451
452/* Transmit register control. */
453#define PSC_SMBTXRX_RSR (1 << 28)
454#define PSC_SMBTXRX_STP (1 << 29)
455#define PSC_SMBTXRX_DATAMASK 0xff
456
457/* SMBus protocol timers register. */
458#define PSC_SMBTMR_SET_TH(x) (((x) & 0x03) << 30)
459#define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25)
460#define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20)
461#define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15)
462#define PSC_SMBTMR_SET_SU(x) (((x) & 0x1f) << 10)
463#define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5)
464#define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0)
465
466#endif /* _AU1000_PSC_H_ */
diff --git a/arch/mips/include/asm/mach-au1x00/cpu-feature-overrides.h b/arch/mips/include/asm/mach-au1x00/cpu-feature-overrides.h
new file mode 100644
index 000000000..e6e527224
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/cpu-feature-overrides.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
7#ifndef __ASM_MACH_AU1X00_CPU_FEATURE_OVERRIDES_H
8#define __ASM_MACH_AU1X00_CPU_FEATURE_OVERRIDES_H
9
10#define cpu_has_tlb 1
11#define cpu_has_ftlb 0
12#define cpu_has_tlbinv 0
13#define cpu_has_segments 0
14#define cpu_has_eva 0
15#define cpu_has_htw 0
16#define cpu_has_ldpte 0
17#define cpu_has_rixiex 0
18#define cpu_has_maar 0
19#define cpu_has_rw_llb 0
20#define cpu_has_3kex 0
21#define cpu_has_4kex 1
22#define cpu_has_3k_cache 0
23#define cpu_has_4k_cache 1
24#define cpu_has_tx39_cache 0
25#define cpu_has_fpu 0
26#define cpu_has_32fpr 0
27#define cpu_has_counter 1
28#define cpu_has_watch 1
29#define cpu_has_divec 1
30#define cpu_has_vce 0
31#define cpu_has_cache_cdex_p 0
32#define cpu_has_cache_cdex_s 0
33#define cpu_has_prefetch 1
34#define cpu_has_mcheck 1
35#define cpu_has_ejtag 1
36#define cpu_has_llsc 1
37#define cpu_has_guestctl0ext 0
38#define cpu_has_guestctl1 0
39#define cpu_has_guestctl2 0
40#define cpu_has_guestid 0
41#define cpu_has_drg 0
42#define cpu_has_mips16 0
43#define cpu_has_mips16e2 0
44#define cpu_has_mdmx 0
45#define cpu_has_mips3d 0
46#define cpu_has_smartmips 0
47#define cpu_has_rixi 0
48#define cpu_has_mmips 0
49#define cpu_has_lpa 0
50#define cpu_has_mhv 0
51#define cpu_has_vtag_icache 0
52#define cpu_has_dc_aliases 0
53#define cpu_has_ic_fills_f_dc 1
54#define cpu_has_pindexed_dcache 0
55#define cpu_has_mips32r1 1
56#define cpu_has_mips32r2 0
57#define cpu_has_mips32r6 0
58#define cpu_has_mips64r1 0
59#define cpu_has_mips64r2 0
60#define cpu_has_mips64r6 0
61#define cpu_has_dsp 0
62#define cpu_has_dsp2 0
63#define cpu_has_dsp3 0
64#define cpu_has_mipsmt 0
65#define cpu_has_vp 0
66#define cpu_has_userlocal 0
67#define cpu_has_nofpuex 0
68#define cpu_has_64bits 0
69#define cpu_has_64bit_zero_reg 0
70#define cpu_has_vint 0
71#define cpu_has_veic 0
72#define cpu_has_inclusive_pcaches 0
73
74#define cpu_dcache_line_size() 32
75#define cpu_icache_line_size() 32
76#define cpu_scache_line_size() 0
77#define cpu_tcache_line_size() 0
78
79#define cpu_has_perf_cntr_intr_bit 0
80#define cpu_has_vz 0
81#define cpu_has_msa 0
82#define cpu_has_ufr 0
83#define cpu_has_fre 0
84#define cpu_has_cdmm 0
85#define cpu_has_small_pages 0
86#define cpu_has_nan_legacy 1
87#define cpu_has_nan_2008 1
88#define cpu_has_ebase_wg 0
89#define cpu_has_badinstr 0
90#define cpu_has_badinstrp 0
91#define cpu_has_contextconfig 0
92#define cpu_has_perf 0
93
94#endif /* __ASM_MACH_AU1X00_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h
new file mode 100644
index 000000000..adde1fa50
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h
@@ -0,0 +1,532 @@
1/*
2 * GPIO functions for Au1000, Au1500, Au1100, Au1550, Au1200
3 *
4 * Copyright (c) 2009 Manuel Lauss.
5 *
6 * Licensed under the terms outlined in the file COPYING.
7 */
8
9#ifndef _ALCHEMY_GPIO_AU1000_H_
10#define _ALCHEMY_GPIO_AU1000_H_
11
12#include <asm/mach-au1x00/au1000.h>
13
14/* The default GPIO numberspace as documented in the Alchemy manuals.
15 * GPIO0-31 from GPIO1 block, GPIO200-215 from GPIO2 block.
16 */
17#define ALCHEMY_GPIO1_BASE 0
18#define ALCHEMY_GPIO2_BASE 200
19
20#define ALCHEMY_GPIO1_NUM 32
21#define ALCHEMY_GPIO2_NUM 16
22#define ALCHEMY_GPIO1_MAX (ALCHEMY_GPIO1_BASE + ALCHEMY_GPIO1_NUM - 1)
23#define ALCHEMY_GPIO2_MAX (ALCHEMY_GPIO2_BASE + ALCHEMY_GPIO2_NUM - 1)
24
25#define MAKE_IRQ(intc, off) (AU1000_INTC##intc##_INT_BASE + (off))
26
27/* GPIO1 registers within SYS_ area */
28#define AU1000_SYS_TRIOUTRD 0x100
29#define AU1000_SYS_TRIOUTCLR 0x100
30#define AU1000_SYS_OUTPUTRD 0x108
31#define AU1000_SYS_OUTPUTSET 0x108
32#define AU1000_SYS_OUTPUTCLR 0x10C
33#define AU1000_SYS_PINSTATERD 0x110
34#define AU1000_SYS_PININPUTEN 0x110
35
36/* register offsets within GPIO2 block */
37#define AU1000_GPIO2_DIR 0x00
38#define AU1000_GPIO2_OUTPUT 0x08
39#define AU1000_GPIO2_PINSTATE 0x0C
40#define AU1000_GPIO2_INTENABLE 0x10
41#define AU1000_GPIO2_ENABLE 0x14
42
43struct gpio;
44
45static inline int au1000_gpio1_to_irq(int gpio)
46{
47 return MAKE_IRQ(1, gpio - ALCHEMY_GPIO1_BASE);
48}
49
50static inline int au1000_gpio2_to_irq(int gpio)
51{
52 return -ENXIO;
53}
54
55static inline int au1000_irq_to_gpio(int irq)
56{
57 if ((irq >= AU1000_GPIO0_INT) && (irq <= AU1000_GPIO31_INT))
58 return ALCHEMY_GPIO1_BASE + (irq - AU1000_GPIO0_INT) + 0;
59
60 return -ENXIO;
61}
62
63static inline int au1500_gpio1_to_irq(int gpio)
64{
65 gpio -= ALCHEMY_GPIO1_BASE;
66
67 switch (gpio) {
68 case 0 ... 15:
69 case 20:
70 case 23 ... 28: return MAKE_IRQ(1, gpio);
71 }
72
73 return -ENXIO;
74}
75
76static inline int au1500_gpio2_to_irq(int gpio)
77{
78 gpio -= ALCHEMY_GPIO2_BASE;
79
80 switch (gpio) {
81 case 0 ... 3: return MAKE_IRQ(1, 16 + gpio - 0);
82 case 4 ... 5: return MAKE_IRQ(1, 21 + gpio - 4);
83 case 6 ... 7: return MAKE_IRQ(1, 29 + gpio - 6);
84 }
85
86 return -ENXIO;
87}
88
89static inline int au1500_irq_to_gpio(int irq)
90{
91 switch (irq) {
92 case AU1500_GPIO0_INT ... AU1500_GPIO15_INT:
93 case AU1500_GPIO20_INT:
94 case AU1500_GPIO23_INT ... AU1500_GPIO28_INT:
95 return ALCHEMY_GPIO1_BASE + (irq - AU1500_GPIO0_INT) + 0;
96 case AU1500_GPIO200_INT ... AU1500_GPIO203_INT:
97 return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO200_INT) + 0;
98 case AU1500_GPIO204_INT ... AU1500_GPIO205_INT:
99 return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO204_INT) + 4;
100 case AU1500_GPIO206_INT ... AU1500_GPIO207_INT:
101 return ALCHEMY_GPIO2_BASE + (irq - AU1500_GPIO206_INT) + 6;
102 case AU1500_GPIO208_215_INT:
103 return ALCHEMY_GPIO2_BASE + 8;
104 }
105
106 return -ENXIO;
107}
108
109static inline int au1100_gpio1_to_irq(int gpio)
110{
111 return MAKE_IRQ(1, gpio - ALCHEMY_GPIO1_BASE);
112}
113
114static inline int au1100_gpio2_to_irq(int gpio)
115{
116 gpio -= ALCHEMY_GPIO2_BASE;
117
118 if ((gpio >= 8) && (gpio <= 15))
119 return MAKE_IRQ(0, 29); /* shared GPIO208_215 */
120
121 return -ENXIO;
122}
123
124static inline int au1100_irq_to_gpio(int irq)
125{
126 switch (irq) {
127 case AU1100_GPIO0_INT ... AU1100_GPIO31_INT:
128 return ALCHEMY_GPIO1_BASE + (irq - AU1100_GPIO0_INT) + 0;
129 case AU1100_GPIO208_215_INT:
130 return ALCHEMY_GPIO2_BASE + 8;
131 }
132
133 return -ENXIO;
134}
135
136static inline int au1550_gpio1_to_irq(int gpio)
137{
138 gpio -= ALCHEMY_GPIO1_BASE;
139
140 switch (gpio) {
141 case 0 ... 15:
142 case 20 ... 28: return MAKE_IRQ(1, gpio);
143 case 16 ... 17: return MAKE_IRQ(1, 18 + gpio - 16);
144 }
145
146 return -ENXIO;
147}
148
149static inline int au1550_gpio2_to_irq(int gpio)
150{
151 gpio -= ALCHEMY_GPIO2_BASE;
152
153 switch (gpio) {
154 case 0: return MAKE_IRQ(1, 16);
155 case 1 ... 5: return MAKE_IRQ(1, 17); /* shared GPIO201_205 */
156 case 6 ... 7: return MAKE_IRQ(1, 29 + gpio - 6);
157 case 8 ... 15: return MAKE_IRQ(1, 31); /* shared GPIO208_215 */
158 }
159
160 return -ENXIO;
161}
162
163static inline int au1550_irq_to_gpio(int irq)
164{
165 switch (irq) {
166 case AU1550_GPIO0_INT ... AU1550_GPIO15_INT:
167 return ALCHEMY_GPIO1_BASE + (irq - AU1550_GPIO0_INT) + 0;
168 case AU1550_GPIO200_INT:
169 case AU1550_GPIO201_205_INT:
170 return ALCHEMY_GPIO2_BASE + (irq - AU1550_GPIO200_INT) + 0;
171 case AU1550_GPIO16_INT ... AU1550_GPIO28_INT:
172 return ALCHEMY_GPIO1_BASE + (irq - AU1550_GPIO16_INT) + 16;
173 case AU1550_GPIO206_INT ... AU1550_GPIO208_215_INT:
174 return ALCHEMY_GPIO2_BASE + (irq - AU1550_GPIO206_INT) + 6;
175 }
176
177 return -ENXIO;
178}
179
180static inline int au1200_gpio1_to_irq(int gpio)
181{
182 return MAKE_IRQ(1, gpio - ALCHEMY_GPIO1_BASE);
183}
184
185static inline int au1200_gpio2_to_irq(int gpio)
186{
187 gpio -= ALCHEMY_GPIO2_BASE;
188
189 switch (gpio) {
190 case 0 ... 2: return MAKE_IRQ(0, 5 + gpio - 0);
191 case 3: return MAKE_IRQ(0, 22);
192 case 4 ... 7: return MAKE_IRQ(0, 24 + gpio - 4);
193 case 8 ... 15: return MAKE_IRQ(0, 28); /* shared GPIO208_215 */
194 }
195
196 return -ENXIO;
197}
198
199static inline int au1200_irq_to_gpio(int irq)
200{
201 switch (irq) {
202 case AU1200_GPIO0_INT ... AU1200_GPIO31_INT:
203 return ALCHEMY_GPIO1_BASE + (irq - AU1200_GPIO0_INT) + 0;
204 case AU1200_GPIO200_INT ... AU1200_GPIO202_INT:
205 return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO200_INT) + 0;
206 case AU1200_GPIO203_INT:
207 return ALCHEMY_GPIO2_BASE + 3;
208 case AU1200_GPIO204_INT ... AU1200_GPIO208_215_INT:
209 return ALCHEMY_GPIO2_BASE + (irq - AU1200_GPIO204_INT) + 4;
210 }
211
212 return -ENXIO;
213}
214
215/*
216 * GPIO1 block macros for common linux gpio functions.
217 */
218static inline void alchemy_gpio1_set_value(int gpio, int v)
219{
220 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE);
221 unsigned long r = v ? AU1000_SYS_OUTPUTSET : AU1000_SYS_OUTPUTCLR;
222 alchemy_wrsys(mask, r);
223}
224
225static inline int alchemy_gpio1_get_value(int gpio)
226{
227 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE);
228 return alchemy_rdsys(AU1000_SYS_PINSTATERD) & mask;
229}
230
231static inline int alchemy_gpio1_direction_input(int gpio)
232{
233 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO1_BASE);
234 alchemy_wrsys(mask, AU1000_SYS_TRIOUTCLR);
235 return 0;
236}
237
238static inline int alchemy_gpio1_direction_output(int gpio, int v)
239{
240 /* hardware switches to "output" mode when one of the two
241 * "set_value" registers is accessed.
242 */
243 alchemy_gpio1_set_value(gpio, v);
244 return 0;
245}
246
247static inline int alchemy_gpio1_is_valid(int gpio)
248{
249 return ((gpio >= ALCHEMY_GPIO1_BASE) && (gpio <= ALCHEMY_GPIO1_MAX));
250}
251
252static inline int alchemy_gpio1_to_irq(int gpio)
253{
254 switch (alchemy_get_cputype()) {
255 case ALCHEMY_CPU_AU1000:
256 return au1000_gpio1_to_irq(gpio);
257 case ALCHEMY_CPU_AU1100:
258 return au1100_gpio1_to_irq(gpio);
259 case ALCHEMY_CPU_AU1500:
260 return au1500_gpio1_to_irq(gpio);
261 case ALCHEMY_CPU_AU1550:
262 return au1550_gpio1_to_irq(gpio);
263 case ALCHEMY_CPU_AU1200:
264 return au1200_gpio1_to_irq(gpio);
265 }
266 return -ENXIO;
267}
268
269/* On Au1000, Au1500 and Au1100 GPIOs won't work as inputs before
270 * SYS_PININPUTEN is written to at least once. On Au1550/Au1200/Au1300 this
271 * register enables use of GPIOs as wake source.
272 */
273static inline void alchemy_gpio1_input_enable(void)
274{
275 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
276 __raw_writel(0, base + 0x110); /* the write op is key */
277 wmb();
278}
279
280/*
281 * GPIO2 block macros for common linux GPIO functions. The 'gpio'
282 * parameter must be in range of ALCHEMY_GPIO2_BASE..ALCHEMY_GPIO2_MAX.
283 */
284static inline void __alchemy_gpio2_mod_dir(int gpio, int to_out)
285{
286 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
287 unsigned long mask = 1 << (gpio - ALCHEMY_GPIO2_BASE);
288 unsigned long d = __raw_readl(base + AU1000_GPIO2_DIR);
289
290 if (to_out)
291 d |= mask;
292 else
293 d &= ~mask;
294 __raw_writel(d, base + AU1000_GPIO2_DIR);
295 wmb();
296}
297
298static inline void alchemy_gpio2_set_value(int gpio, int v)
299{
300 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
301 unsigned long mask;
302 mask = ((v) ? 0x00010001 : 0x00010000) << (gpio - ALCHEMY_GPIO2_BASE);
303 __raw_writel(mask, base + AU1000_GPIO2_OUTPUT);
304 wmb();
305}
306
307static inline int alchemy_gpio2_get_value(int gpio)
308{
309 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
310 return __raw_readl(base + AU1000_GPIO2_PINSTATE) &
311 (1 << (gpio - ALCHEMY_GPIO2_BASE));
312}
313
314static inline int alchemy_gpio2_direction_input(int gpio)
315{
316 unsigned long flags;
317 local_irq_save(flags);
318 __alchemy_gpio2_mod_dir(gpio, 0);
319 local_irq_restore(flags);
320 return 0;
321}
322
323static inline int alchemy_gpio2_direction_output(int gpio, int v)
324{
325 unsigned long flags;
326 alchemy_gpio2_set_value(gpio, v);
327 local_irq_save(flags);
328 __alchemy_gpio2_mod_dir(gpio, 1);
329 local_irq_restore(flags);
330 return 0;
331}
332
333static inline int alchemy_gpio2_is_valid(int gpio)
334{
335 return ((gpio >= ALCHEMY_GPIO2_BASE) && (gpio <= ALCHEMY_GPIO2_MAX));
336}
337
338static inline int alchemy_gpio2_to_irq(int gpio)
339{
340 switch (alchemy_get_cputype()) {
341 case ALCHEMY_CPU_AU1000:
342 return au1000_gpio2_to_irq(gpio);
343 case ALCHEMY_CPU_AU1100:
344 return au1100_gpio2_to_irq(gpio);
345 case ALCHEMY_CPU_AU1500:
346 return au1500_gpio2_to_irq(gpio);
347 case ALCHEMY_CPU_AU1550:
348 return au1550_gpio2_to_irq(gpio);
349 case ALCHEMY_CPU_AU1200:
350 return au1200_gpio2_to_irq(gpio);
351 }
352 return -ENXIO;
353}
354
355/**********************************************************************/
356
357/* GPIO2 shared interrupts and control */
358
359static inline void __alchemy_gpio2_mod_int(int gpio2, int en)
360{
361 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
362 unsigned long r = __raw_readl(base + AU1000_GPIO2_INTENABLE);
363 if (en)
364 r |= 1 << gpio2;
365 else
366 r &= ~(1 << gpio2);
367 __raw_writel(r, base + AU1000_GPIO2_INTENABLE);
368 wmb();
369}
370
371/**
372 * alchemy_gpio2_enable_int - Enable a GPIO2 pins' shared irq contribution.
373 * @gpio2: The GPIO2 pin to activate (200...215).
374 *
375 * GPIO208-215 have one shared interrupt line to the INTC. They are
376 * and'ed with a per-pin enable bit and finally or'ed together to form
377 * a single irq request (useful for active-high sources).
378 * With this function, a pins' individual contribution to the int request
379 * can be enabled. As with all other GPIO-based interrupts, the INTC
380 * must be programmed to accept the GPIO208_215 interrupt as well.
381 *
382 * NOTE: Calling this macro is only necessary for GPIO208-215; all other
383 * GPIO2-based interrupts have their own request to the INTC. Please
384 * consult your Alchemy databook for more information!
385 *
386 * NOTE: On the Au1550, GPIOs 201-205 also have a shared interrupt request
387 * line to the INTC, GPIO201_205. This function can be used for those
388 * as well.
389 *
390 * NOTE: 'gpio2' parameter must be in range of the GPIO2 numberspace
391 * (200-215 by default). No sanity checks are made,
392 */
393static inline void alchemy_gpio2_enable_int(int gpio2)
394{
395 unsigned long flags;
396
397 gpio2 -= ALCHEMY_GPIO2_BASE;
398
399 /* Au1100/Au1500 have GPIO208-215 enable bits at 0..7 */
400 switch (alchemy_get_cputype()) {
401 case ALCHEMY_CPU_AU1100:
402 case ALCHEMY_CPU_AU1500:
403 gpio2 -= 8;
404 }
405
406 local_irq_save(flags);
407 __alchemy_gpio2_mod_int(gpio2, 1);
408 local_irq_restore(flags);
409}
410
411/**
412 * alchemy_gpio2_disable_int - Disable a GPIO2 pins' shared irq contribution.
413 * @gpio2: The GPIO2 pin to activate (200...215).
414 *
415 * see function alchemy_gpio2_enable_int() for more information.
416 */
417static inline void alchemy_gpio2_disable_int(int gpio2)
418{
419 unsigned long flags;
420
421 gpio2 -= ALCHEMY_GPIO2_BASE;
422
423 /* Au1100/Au1500 have GPIO208-215 enable bits at 0..7 */
424 switch (alchemy_get_cputype()) {
425 case ALCHEMY_CPU_AU1100:
426 case ALCHEMY_CPU_AU1500:
427 gpio2 -= 8;
428 }
429
430 local_irq_save(flags);
431 __alchemy_gpio2_mod_int(gpio2, 0);
432 local_irq_restore(flags);
433}
434
435/**
436 * alchemy_gpio2_enable - Activate GPIO2 block.
437 *
438 * The GPIO2 block must be enabled excplicitly to work. On systems
439 * where this isn't done by the bootloader, this macro can be used.
440 */
441static inline void alchemy_gpio2_enable(void)
442{
443 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
444 __raw_writel(3, base + AU1000_GPIO2_ENABLE); /* reset, clock enabled */
445 wmb();
446 __raw_writel(1, base + AU1000_GPIO2_ENABLE); /* clock enabled */
447 wmb();
448}
449
450/**
451 * alchemy_gpio2_disable - disable GPIO2 block.
452 *
453 * Disable and put GPIO2 block in low-power mode.
454 */
455static inline void alchemy_gpio2_disable(void)
456{
457 void __iomem *base = (void __iomem *)KSEG1ADDR(AU1500_GPIO2_PHYS_ADDR);
458 __raw_writel(2, base + AU1000_GPIO2_ENABLE); /* reset, clock disabled */
459 wmb();
460}
461
462/**********************************************************************/
463
464/* wrappers for on-chip gpios; can be used before gpio chips have been
465 * registered with gpiolib.
466 */
467static inline int alchemy_gpio_direction_input(int gpio)
468{
469 return (gpio >= ALCHEMY_GPIO2_BASE) ?
470 alchemy_gpio2_direction_input(gpio) :
471 alchemy_gpio1_direction_input(gpio);
472}
473
474static inline int alchemy_gpio_direction_output(int gpio, int v)
475{
476 return (gpio >= ALCHEMY_GPIO2_BASE) ?
477 alchemy_gpio2_direction_output(gpio, v) :
478 alchemy_gpio1_direction_output(gpio, v);
479}
480
481static inline int alchemy_gpio_get_value(int gpio)
482{
483 return (gpio >= ALCHEMY_GPIO2_BASE) ?
484 alchemy_gpio2_get_value(gpio) :
485 alchemy_gpio1_get_value(gpio);
486}
487
488static inline void alchemy_gpio_set_value(int gpio, int v)
489{
490 if (gpio >= ALCHEMY_GPIO2_BASE)
491 alchemy_gpio2_set_value(gpio, v);
492 else
493 alchemy_gpio1_set_value(gpio, v);
494}
495
496static inline int alchemy_gpio_is_valid(int gpio)
497{
498 return (gpio >= ALCHEMY_GPIO2_BASE) ?
499 alchemy_gpio2_is_valid(gpio) :
500 alchemy_gpio1_is_valid(gpio);
501}
502
503static inline int alchemy_gpio_cansleep(int gpio)
504{
505 return 0; /* Alchemy never gets tired */
506}
507
508static inline int alchemy_gpio_to_irq(int gpio)
509{
510 return (gpio >= ALCHEMY_GPIO2_BASE) ?
511 alchemy_gpio2_to_irq(gpio) :
512 alchemy_gpio1_to_irq(gpio);
513}
514
515static inline int alchemy_irq_to_gpio(int irq)
516{
517 switch (alchemy_get_cputype()) {
518 case ALCHEMY_CPU_AU1000:
519 return au1000_irq_to_gpio(irq);
520 case ALCHEMY_CPU_AU1100:
521 return au1100_irq_to_gpio(irq);
522 case ALCHEMY_CPU_AU1500:
523 return au1500_irq_to_gpio(irq);
524 case ALCHEMY_CPU_AU1550:
525 return au1550_irq_to_gpio(irq);
526 case ALCHEMY_CPU_AU1200:
527 return au1200_irq_to_gpio(irq);
528 }
529 return -ENXIO;
530}
531
532#endif /* _ALCHEMY_GPIO_AU1000_H_ */
diff --git a/arch/mips/include/asm/mach-au1x00/gpio-au1300.h b/arch/mips/include/asm/mach-au1x00/gpio-au1300.h
new file mode 100644
index 000000000..d16add7ba
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/gpio-au1300.h
@@ -0,0 +1,123 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * gpio-au1300.h -- GPIO control for Au1300 GPIC and compatibles.
4 *
5 * Copyright (c) 2009-2011 Manuel Lauss <manuel.lauss@googlemail.com>
6 */
7
8#ifndef _GPIO_AU1300_H_
9#define _GPIO_AU1300_H_
10
11#include <asm/addrspace.h>
12#include <asm/io.h>
13#include <asm/mach-au1x00/au1000.h>
14
15struct gpio;
16struct gpio_chip;
17
18/* with the current GPIC design, up to 128 GPIOs are possible.
19 * The only implementation so far is in the Au1300, which has 75 externally
20 * available GPIOs.
21 */
22#define AU1300_GPIO_BASE 0
23#define AU1300_GPIO_NUM 75
24#define AU1300_GPIO_MAX (AU1300_GPIO_BASE + AU1300_GPIO_NUM - 1)
25
26#define AU1300_GPIC_ADDR \
27 (void __iomem *)KSEG1ADDR(AU1300_GPIC_PHYS_ADDR)
28
29static inline int au1300_gpio_get_value(unsigned int gpio)
30{
31 void __iomem *roff = AU1300_GPIC_ADDR;
32 int bit;
33
34 gpio -= AU1300_GPIO_BASE;
35 roff += GPIC_GPIO_BANKOFF(gpio);
36 bit = GPIC_GPIO_TO_BIT(gpio);
37 return __raw_readl(roff + AU1300_GPIC_PINVAL) & bit;
38}
39
40static inline int au1300_gpio_direction_input(unsigned int gpio)
41{
42 void __iomem *roff = AU1300_GPIC_ADDR;
43 unsigned long bit;
44
45 gpio -= AU1300_GPIO_BASE;
46
47 roff += GPIC_GPIO_BANKOFF(gpio);
48 bit = GPIC_GPIO_TO_BIT(gpio);
49 __raw_writel(bit, roff + AU1300_GPIC_DEVCLR);
50 wmb();
51
52 return 0;
53}
54
55static inline int au1300_gpio_set_value(unsigned int gpio, int v)
56{
57 void __iomem *roff = AU1300_GPIC_ADDR;
58 unsigned long bit;
59
60 gpio -= AU1300_GPIO_BASE;
61
62 roff += GPIC_GPIO_BANKOFF(gpio);
63 bit = GPIC_GPIO_TO_BIT(gpio);
64 __raw_writel(bit, roff + (v ? AU1300_GPIC_PINVAL
65 : AU1300_GPIC_PINVALCLR));
66 wmb();
67
68 return 0;
69}
70
71static inline int au1300_gpio_direction_output(unsigned int gpio, int v)
72{
73 /* hw switches to output automatically */
74 return au1300_gpio_set_value(gpio, v);
75}
76
77static inline int au1300_gpio_to_irq(unsigned int gpio)
78{
79 return AU1300_FIRST_INT + (gpio - AU1300_GPIO_BASE);
80}
81
82static inline int au1300_irq_to_gpio(unsigned int irq)
83{
84 return (irq - AU1300_FIRST_INT) + AU1300_GPIO_BASE;
85}
86
87static inline int au1300_gpio_is_valid(unsigned int gpio)
88{
89 int ret;
90
91 switch (alchemy_get_cputype()) {
92 case ALCHEMY_CPU_AU1300:
93 ret = ((gpio >= AU1300_GPIO_BASE) && (gpio <= AU1300_GPIO_MAX));
94 break;
95 default:
96 ret = 0;
97 }
98 return ret;
99}
100
101static inline int au1300_gpio_cansleep(unsigned int gpio)
102{
103 return 0;
104}
105
106/* hardware remembers gpio 0-63 levels on powerup */
107static inline int au1300_gpio_getinitlvl(unsigned int gpio)
108{
109 void __iomem *roff = AU1300_GPIC_ADDR;
110 unsigned long v;
111
112 if (unlikely(gpio > 63))
113 return 0;
114 else if (gpio > 31) {
115 gpio -= 32;
116 roff += 4;
117 }
118
119 v = __raw_readl(roff + AU1300_GPIC_RSTVAL);
120 return (v >> gpio) & 1;
121}
122
123#endif /* _GPIO_AU1300_H_ */
diff --git a/arch/mips/include/asm/mach-au1x00/prom.h b/arch/mips/include/asm/mach-au1x00/prom.h
new file mode 100644
index 000000000..c62ee0246
--- /dev/null
+++ b/arch/mips/include/asm/mach-au1x00/prom.h
@@ -0,0 +1,13 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __AU1X00_PROM_H
3#define __AU1X00_PROM_H
4
5extern int prom_argc;
6extern char **prom_argv;
7extern char **prom_envp;
8
9extern void prom_init_cmdline(void);
10extern char *prom_getenv(char *envname);
11extern int prom_get_ethernet_addr(char *ethernet_addr);
12
13#endif
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
new file mode 100644
index 000000000..93817bfb7
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
@@ -0,0 +1,38 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
4 */
5
6#ifndef __ASM_BCM47XX_H
7#define __ASM_BCM47XX_H
8
9#include <linux/ssb/ssb.h>
10#include <linux/bcma/bcma.h>
11#include <linux/bcma/bcma_soc.h>
12#include <linux/bcm47xx_nvram.h>
13#include <linux/bcm47xx_sprom.h>
14
15enum bcm47xx_bus_type {
16#ifdef CONFIG_BCM47XX_SSB
17 BCM47XX_BUS_TYPE_SSB,
18#endif
19#ifdef CONFIG_BCM47XX_BCMA
20 BCM47XX_BUS_TYPE_BCMA,
21#endif
22};
23
24union bcm47xx_bus {
25#ifdef CONFIG_BCM47XX_SSB
26 struct ssb_bus ssb;
27#endif
28#ifdef CONFIG_BCM47XX_BCMA
29 struct bcma_soc bcma;
30#endif
31};
32
33extern union bcm47xx_bus bcm47xx_bus;
34extern enum bcm47xx_bus_type bcm47xx_bus_type;
35
36void bcm47xx_set_system_type(u16 chip_id);
37
38#endif /* __ASM_BCM47XX_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
new file mode 100644
index 000000000..f879be3e8
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
@@ -0,0 +1,140 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __BCM47XX_BOARD_H
3#define __BCM47XX_BOARD_H
4
5enum bcm47xx_board {
6 BCM47XX_BOARD_ASUS_RTAC66U,
7 BCM47XX_BOARD_ASUS_RTN10,
8 BCM47XX_BOARD_ASUS_RTN10D,
9 BCM47XX_BOARD_ASUS_RTN10U,
10 BCM47XX_BOARD_ASUS_RTN12,
11 BCM47XX_BOARD_ASUS_RTN12B1,
12 BCM47XX_BOARD_ASUS_RTN12C1,
13 BCM47XX_BOARD_ASUS_RTN12D1,
14 BCM47XX_BOARD_ASUS_RTN12HP,
15 BCM47XX_BOARD_ASUS_RTN15U,
16 BCM47XX_BOARD_ASUS_RTN16,
17 BCM47XX_BOARD_ASUS_RTN53,
18 BCM47XX_BOARD_ASUS_RTN66U,
19 BCM47XX_BOARD_ASUS_WL300G,
20 BCM47XX_BOARD_ASUS_WL320GE,
21 BCM47XX_BOARD_ASUS_WL330GE,
22 BCM47XX_BOARD_ASUS_WL500G,
23 BCM47XX_BOARD_ASUS_WL500GD,
24 BCM47XX_BOARD_ASUS_WL500GPV1,
25 BCM47XX_BOARD_ASUS_WL500GPV2,
26 BCM47XX_BOARD_ASUS_WL500W,
27 BCM47XX_BOARD_ASUS_WL520GC,
28 BCM47XX_BOARD_ASUS_WL520GU,
29 BCM47XX_BOARD_ASUS_WL700GE,
30 BCM47XX_BOARD_ASUS_WLHDD,
31
32 BCM47XX_BOARD_BELKIN_F7D3301,
33 BCM47XX_BOARD_BELKIN_F7D3302,
34 BCM47XX_BOARD_BELKIN_F7D4301,
35 BCM47XX_BOARD_BELKIN_F7D4302,
36 BCM47XX_BOARD_BELKIN_F7D4401,
37
38 BCM47XX_BOARD_BUFFALO_WBR2_G54,
39 BCM47XX_BOARD_BUFFALO_WHR2_A54G54,
40 BCM47XX_BOARD_BUFFALO_WHR_G125,
41 BCM47XX_BOARD_BUFFALO_WHR_G54S,
42 BCM47XX_BOARD_BUFFALO_WHR_HP_G54,
43 BCM47XX_BOARD_BUFFALO_WLA2_G54L,
44 BCM47XX_BOARD_BUFFALO_WZR_G300N,
45 BCM47XX_BOARD_BUFFALO_WZR_RS_G54,
46 BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP,
47
48 BCM47XX_BOARD_CISCO_M10V1,
49 BCM47XX_BOARD_CISCO_M20V1,
50
51 BCM47XX_BOARD_DELL_TM2300,
52
53 BCM47XX_BOARD_DLINK_DIR130,
54 BCM47XX_BOARD_DLINK_DIR330,
55
56 BCM47XX_BOARD_HUAWEI_E970,
57
58 BCM47XX_BOARD_LINKSYS_E900V1,
59 BCM47XX_BOARD_LINKSYS_E1000V1,
60 BCM47XX_BOARD_LINKSYS_E1000V2,
61 BCM47XX_BOARD_LINKSYS_E1000V21,
62 BCM47XX_BOARD_LINKSYS_E1200V2,
63 BCM47XX_BOARD_LINKSYS_E2000V1,
64 BCM47XX_BOARD_LINKSYS_E3000V1,
65 BCM47XX_BOARD_LINKSYS_E3200V1,
66 BCM47XX_BOARD_LINKSYS_E4200V1,
67 BCM47XX_BOARD_LINKSYS_WRT150NV1,
68 BCM47XX_BOARD_LINKSYS_WRT150NV11,
69 BCM47XX_BOARD_LINKSYS_WRT160NV1,
70 BCM47XX_BOARD_LINKSYS_WRT160NV3,
71 BCM47XX_BOARD_LINKSYS_WRT300N_V1,
72 BCM47XX_BOARD_LINKSYS_WRT300NV11,
73 BCM47XX_BOARD_LINKSYS_WRT310NV1,
74 BCM47XX_BOARD_LINKSYS_WRT310NV2,
75 BCM47XX_BOARD_LINKSYS_WRT54G3GV2,
76 BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101,
77 BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467,
78 BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708,
79 BCM47XX_BOARD_LINKSYS_WRT600N_V11,
80 BCM47XX_BOARD_LINKSYS_WRT610NV1,
81 BCM47XX_BOARD_LINKSYS_WRT610NV2,
82 BCM47XX_BOARD_LINKSYS_WRTSL54GS,
83
84 BCM47XX_BOARD_LUXUL_ABR_4400_V1,
85 BCM47XX_BOARD_LUXUL_XAP_310_V1,
86 BCM47XX_BOARD_LUXUL_XAP_1210_V1,
87 BCM47XX_BOARD_LUXUL_XAP_1230_V1,
88 BCM47XX_BOARD_LUXUL_XAP_1240_V1,
89 BCM47XX_BOARD_LUXUL_XAP_1500_V1,
90 BCM47XX_BOARD_LUXUL_XBR_4400_V1,
91 BCM47XX_BOARD_LUXUL_XVW_P30_V1,
92 BCM47XX_BOARD_LUXUL_XWR_600_V1,
93 BCM47XX_BOARD_LUXUL_XWR_1750_V1,
94
95 BCM47XX_BOARD_MICROSOFT_MN700,
96
97 BCM47XX_BOARD_MOTOROLA_WE800G,
98 BCM47XX_BOARD_MOTOROLA_WR850GP,
99 BCM47XX_BOARD_MOTOROLA_WR850GV2V3,
100
101 BCM47XX_BOARD_NETGEAR_R6200_V1,
102 BCM47XX_BOARD_NETGEAR_WGR614V8,
103 BCM47XX_BOARD_NETGEAR_WGR614V9,
104 BCM47XX_BOARD_NETGEAR_WGR614_V10,
105 BCM47XX_BOARD_NETGEAR_WNDR3300,
106 BCM47XX_BOARD_NETGEAR_WNDR3400V1,
107 BCM47XX_BOARD_NETGEAR_WNDR3400V2,
108 BCM47XX_BOARD_NETGEAR_WNDR3400_V3,
109 BCM47XX_BOARD_NETGEAR_WNDR3400VCNA,
110 BCM47XX_BOARD_NETGEAR_WNDR3700V3,
111 BCM47XX_BOARD_NETGEAR_WNDR4000,
112 BCM47XX_BOARD_NETGEAR_WNDR4500V1,
113 BCM47XX_BOARD_NETGEAR_WNDR4500V2,
114 BCM47XX_BOARD_NETGEAR_WNR1000_V3,
115 BCM47XX_BOARD_NETGEAR_WNR2000,
116 BCM47XX_BOARD_NETGEAR_WNR3500L,
117 BCM47XX_BOARD_NETGEAR_WNR3500U,
118 BCM47XX_BOARD_NETGEAR_WNR3500V2,
119 BCM47XX_BOARD_NETGEAR_WNR3500V2VC,
120 BCM47XX_BOARD_NETGEAR_WNR834BV2,
121
122 BCM47XX_BOARD_PHICOMM_M1,
123
124 BCM47XX_BOARD_SIEMENS_SE505V2,
125
126 BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE,
127
128 BCM47XX_BOARD_ZTE_H218N,
129
130 BCM47XX_BOARD_UNKNOWN,
131 BCM47XX_BOARD_NO,
132};
133
134#define BCM47XX_BOARD_MAX_NAME 30
135
136void bcm47xx_board_detect(void);
137enum bcm47xx_board bcm47xx_board_get(void);
138const char *bcm47xx_board_get_name(void);
139
140#endif /* __BCM47XX_BOARD_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
new file mode 100644
index 000000000..b23ff47ea
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
@@ -0,0 +1,83 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
3#define __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
4
5#define cpu_has_tlb 1
6#define cpu_has_4kex 1
7#define cpu_has_3k_cache 0
8#define cpu_has_4k_cache 1
9#define cpu_has_tx39_cache 0
10#define cpu_has_fpu 0
11#define cpu_has_32fpr 0
12#define cpu_has_counter 1
13#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
14#define cpu_has_watch 1
15#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
16#define cpu_has_watch 0
17#endif
18#define cpu_has_divec 1
19#define cpu_has_vce 0
20#define cpu_has_cache_cdex_p 0
21#define cpu_has_cache_cdex_s 0
22#define cpu_has_prefetch 1
23#define cpu_has_mcheck 1
24#define cpu_has_ejtag 1
25#define cpu_has_llsc 1
26
27/* cpu_has_mips16 */
28#define cpu_has_mdmx 0
29#define cpu_has_mips3d 0
30#define cpu_has_rixi 0
31#define cpu_has_mmips 0
32#define cpu_has_smartmips 0
33#define cpu_has_vtag_icache 0
34/* cpu_has_dc_aliases */
35#define cpu_has_ic_fills_f_dc 0
36#define cpu_has_pindexed_dcache 0
37#define cpu_icache_snoops_remote_store 0
38
39#define cpu_has_mips_2 1
40#define cpu_has_mips_3 0
41#define cpu_has_mips32r1 1
42#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
43#define cpu_has_mips32r2 1
44#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
45#define cpu_has_mips32r2 0
46#endif
47#define cpu_has_mips64r1 0
48#define cpu_has_mips64r2 0
49
50#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
51#define cpu_has_dsp 1
52#define cpu_has_dsp2 1
53#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
54#define cpu_has_dsp 0
55#define cpu_has_dsp2 0
56#endif
57#define cpu_has_mipsmt 0
58/* cpu_has_userlocal */
59
60#define cpu_has_nofpuex 0
61#define cpu_has_64bits 0
62#define cpu_has_64bit_zero_reg 0
63#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
64#define cpu_has_vint 1
65#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
66#define cpu_has_vint 0
67#endif
68#define cpu_has_veic 0
69#define cpu_has_inclusive_pcaches 0
70
71#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
72#define cpu_dcache_line_size() 32
73#define cpu_icache_line_size() 32
74#define cpu_has_perf_cntr_intr_bit 1
75#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
76#define cpu_dcache_line_size() 16
77#define cpu_icache_line_size() 16
78#define cpu_has_perf_cntr_intr_bit 0
79#endif
80#define cpu_scache_line_size() 0
81#define cpu_has_vz 0
82
83#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h
new file mode 100644
index 000000000..1d19a726f
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h
@@ -0,0 +1,13 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_BOARD_H_
3#define BCM63XX_BOARD_H_
4
5const char *board_get_name(void);
6
7void board_prom_init(void);
8
9void board_setup(void);
10
11int board_register_devices(void);
12
13#endif /* ! BCM63XX_BOARD_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
new file mode 100644
index 000000000..1cad18e66
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
@@ -0,0 +1,1068 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_CPU_H_
3#define BCM63XX_CPU_H_
4
5#include <linux/types.h>
6#include <linux/init.h>
7
8/*
9 * Macro to fetch bcm63xx cpu id and revision, should be optimized at
10 * compile time if only one CPU support is enabled (idea stolen from
11 * arm mach-types)
12 */
13#define BCM3368_CPU_ID 0x3368
14#define BCM6328_CPU_ID 0x6328
15#define BCM6338_CPU_ID 0x6338
16#define BCM6345_CPU_ID 0x6345
17#define BCM6348_CPU_ID 0x6348
18#define BCM6358_CPU_ID 0x6358
19#define BCM6362_CPU_ID 0x6362
20#define BCM6368_CPU_ID 0x6368
21
22void __init bcm63xx_cpu_init(void);
23u8 bcm63xx_get_cpu_rev(void);
24unsigned int bcm63xx_get_cpu_freq(void);
25
26static inline u16 __pure __bcm63xx_get_cpu_id(const u16 cpu_id)
27{
28 switch (cpu_id) {
29#ifdef CONFIG_BCM63XX_CPU_3368
30 case BCM3368_CPU_ID:
31#endif
32
33#ifdef CONFIG_BCM63XX_CPU_6328
34 case BCM6328_CPU_ID:
35#endif
36
37#ifdef CONFIG_BCM63XX_CPU_6338
38 case BCM6338_CPU_ID:
39#endif
40
41#ifdef CONFIG_BCM63XX_CPU_6345
42 case BCM6345_CPU_ID:
43#endif
44
45#ifdef CONFIG_BCM63XX_CPU_6348
46 case BCM6348_CPU_ID:
47#endif
48
49#ifdef CONFIG_BCM63XX_CPU_6358
50 case BCM6358_CPU_ID:
51#endif
52
53#ifdef CONFIG_BCM63XX_CPU_6362
54 case BCM6362_CPU_ID:
55#endif
56
57#ifdef CONFIG_BCM63XX_CPU_6368
58 case BCM6368_CPU_ID:
59#endif
60 break;
61 default:
62 unreachable();
63 }
64
65 return cpu_id;
66}
67
68extern u16 bcm63xx_cpu_id;
69
70static inline u16 __pure bcm63xx_get_cpu_id(void)
71{
72 const u16 cpu_id = bcm63xx_cpu_id;
73
74 return __bcm63xx_get_cpu_id(cpu_id);
75}
76
77#define BCMCPU_IS_3368() (bcm63xx_get_cpu_id() == BCM3368_CPU_ID)
78#define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID)
79#define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID)
80#define BCMCPU_IS_6345() (bcm63xx_get_cpu_id() == BCM6345_CPU_ID)
81#define BCMCPU_IS_6348() (bcm63xx_get_cpu_id() == BCM6348_CPU_ID)
82#define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID)
83#define BCMCPU_IS_6362() (bcm63xx_get_cpu_id() == BCM6362_CPU_ID)
84#define BCMCPU_IS_6368() (bcm63xx_get_cpu_id() == BCM6368_CPU_ID)
85
86/*
87 * While registers sets are (mostly) the same across 63xx CPU, base
88 * address of these sets do change.
89 */
90enum bcm63xx_regs_set {
91 RSET_DSL_LMEM = 0,
92 RSET_PERF,
93 RSET_TIMER,
94 RSET_WDT,
95 RSET_UART0,
96 RSET_UART1,
97 RSET_GPIO,
98 RSET_SPI,
99 RSET_HSSPI,
100 RSET_UDC0,
101 RSET_OHCI0,
102 RSET_OHCI_PRIV,
103 RSET_USBH_PRIV,
104 RSET_USBD,
105 RSET_USBDMA,
106 RSET_MPI,
107 RSET_PCMCIA,
108 RSET_PCIE,
109 RSET_DSL,
110 RSET_ENET0,
111 RSET_ENET1,
112 RSET_ENETDMA,
113 RSET_ENETDMAC,
114 RSET_ENETDMAS,
115 RSET_ENETSW,
116 RSET_EHCI0,
117 RSET_SDRAM,
118 RSET_MEMC,
119 RSET_DDR,
120 RSET_M2M,
121 RSET_ATM,
122 RSET_XTM,
123 RSET_XTMDMA,
124 RSET_XTMDMAC,
125 RSET_XTMDMAS,
126 RSET_PCM,
127 RSET_PCMDMA,
128 RSET_PCMDMAC,
129 RSET_PCMDMAS,
130 RSET_RNG,
131 RSET_MISC
132};
133
134#define RSET_DSL_LMEM_SIZE (64 * 1024 * 4)
135#define RSET_DSL_SIZE 4096
136#define RSET_WDT_SIZE 12
137#define BCM_6338_RSET_SPI_SIZE 64
138#define BCM_6348_RSET_SPI_SIZE 64
139#define BCM_6358_RSET_SPI_SIZE 1804
140#define BCM_6368_RSET_SPI_SIZE 1804
141#define RSET_ENET_SIZE 2048
142#define RSET_ENETDMA_SIZE 256
143#define RSET_6345_ENETDMA_SIZE 64
144#define RSET_ENETDMAC_SIZE(chans) (16 * (chans))
145#define RSET_ENETDMAS_SIZE(chans) (16 * (chans))
146#define RSET_ENETSW_SIZE 65536
147#define RSET_UART_SIZE 24
148#define RSET_HSSPI_SIZE 1536
149#define RSET_UDC_SIZE 256
150#define RSET_OHCI_SIZE 256
151#define RSET_EHCI_SIZE 256
152#define RSET_USBD_SIZE 256
153#define RSET_USBDMA_SIZE 1280
154#define RSET_PCMCIA_SIZE 12
155#define RSET_M2M_SIZE 256
156#define RSET_ATM_SIZE 4096
157#define RSET_XTM_SIZE 10240
158#define RSET_XTMDMA_SIZE 256
159#define RSET_XTMDMAC_SIZE(chans) (16 * (chans))
160#define RSET_XTMDMAS_SIZE(chans) (16 * (chans))
161#define RSET_RNG_SIZE 20
162
163/*
164 * 3368 register sets base address
165 */
166#define BCM_3368_DSL_LMEM_BASE (0xdeadbeef)
167#define BCM_3368_PERF_BASE (0xfff8c000)
168#define BCM_3368_TIMER_BASE (0xfff8c040)
169#define BCM_3368_WDT_BASE (0xfff8c080)
170#define BCM_3368_UART0_BASE (0xfff8c100)
171#define BCM_3368_UART1_BASE (0xfff8c120)
172#define BCM_3368_GPIO_BASE (0xfff8c080)
173#define BCM_3368_SPI_BASE (0xfff8c800)
174#define BCM_3368_HSSPI_BASE (0xdeadbeef)
175#define BCM_3368_UDC0_BASE (0xdeadbeef)
176#define BCM_3368_USBDMA_BASE (0xdeadbeef)
177#define BCM_3368_OHCI0_BASE (0xdeadbeef)
178#define BCM_3368_OHCI_PRIV_BASE (0xdeadbeef)
179#define BCM_3368_USBH_PRIV_BASE (0xdeadbeef)
180#define BCM_3368_USBD_BASE (0xdeadbeef)
181#define BCM_3368_MPI_BASE (0xfff80000)
182#define BCM_3368_PCMCIA_BASE (0xfff80054)
183#define BCM_3368_PCIE_BASE (0xdeadbeef)
184#define BCM_3368_SDRAM_REGS_BASE (0xdeadbeef)
185#define BCM_3368_DSL_BASE (0xdeadbeef)
186#define BCM_3368_UBUS_BASE (0xdeadbeef)
187#define BCM_3368_ENET0_BASE (0xfff98000)
188#define BCM_3368_ENET1_BASE (0xfff98800)
189#define BCM_3368_ENETDMA_BASE (0xfff99800)
190#define BCM_3368_ENETDMAC_BASE (0xfff99900)
191#define BCM_3368_ENETDMAS_BASE (0xfff99a00)
192#define BCM_3368_ENETSW_BASE (0xdeadbeef)
193#define BCM_3368_EHCI0_BASE (0xdeadbeef)
194#define BCM_3368_SDRAM_BASE (0xdeadbeef)
195#define BCM_3368_MEMC_BASE (0xfff84000)
196#define BCM_3368_DDR_BASE (0xdeadbeef)
197#define BCM_3368_M2M_BASE (0xdeadbeef)
198#define BCM_3368_ATM_BASE (0xdeadbeef)
199#define BCM_3368_XTM_BASE (0xdeadbeef)
200#define BCM_3368_XTMDMA_BASE (0xdeadbeef)
201#define BCM_3368_XTMDMAC_BASE (0xdeadbeef)
202#define BCM_3368_XTMDMAS_BASE (0xdeadbeef)
203#define BCM_3368_PCM_BASE (0xfff9c200)
204#define BCM_3368_PCMDMA_BASE (0xdeadbeef)
205#define BCM_3368_PCMDMAC_BASE (0xdeadbeef)
206#define BCM_3368_PCMDMAS_BASE (0xdeadbeef)
207#define BCM_3368_RNG_BASE (0xdeadbeef)
208#define BCM_3368_MISC_BASE (0xdeadbeef)
209
210/*
211 * 6328 register sets base address
212 */
213#define BCM_6328_DSL_LMEM_BASE (0xdeadbeef)
214#define BCM_6328_PERF_BASE (0xb0000000)
215#define BCM_6328_TIMER_BASE (0xb0000040)
216#define BCM_6328_WDT_BASE (0xb000005c)
217#define BCM_6328_UART0_BASE (0xb0000100)
218#define BCM_6328_UART1_BASE (0xb0000120)
219#define BCM_6328_GPIO_BASE (0xb0000080)
220#define BCM_6328_SPI_BASE (0xdeadbeef)
221#define BCM_6328_HSSPI_BASE (0xb0001000)
222#define BCM_6328_UDC0_BASE (0xdeadbeef)
223#define BCM_6328_USBDMA_BASE (0xb000c000)
224#define BCM_6328_OHCI0_BASE (0xb0002600)
225#define BCM_6328_OHCI_PRIV_BASE (0xdeadbeef)
226#define BCM_6328_USBH_PRIV_BASE (0xb0002700)
227#define BCM_6328_USBD_BASE (0xb0002400)
228#define BCM_6328_MPI_BASE (0xdeadbeef)
229#define BCM_6328_PCMCIA_BASE (0xdeadbeef)
230#define BCM_6328_PCIE_BASE (0xb0e40000)
231#define BCM_6328_SDRAM_REGS_BASE (0xdeadbeef)
232#define BCM_6328_DSL_BASE (0xb0001900)
233#define BCM_6328_UBUS_BASE (0xdeadbeef)
234#define BCM_6328_ENET0_BASE (0xdeadbeef)
235#define BCM_6328_ENET1_BASE (0xdeadbeef)
236#define BCM_6328_ENETDMA_BASE (0xb000d800)
237#define BCM_6328_ENETDMAC_BASE (0xb000da00)
238#define BCM_6328_ENETDMAS_BASE (0xb000dc00)
239#define BCM_6328_ENETSW_BASE (0xb0e00000)
240#define BCM_6328_EHCI0_BASE (0xb0002500)
241#define BCM_6328_SDRAM_BASE (0xdeadbeef)
242#define BCM_6328_MEMC_BASE (0xdeadbeef)
243#define BCM_6328_DDR_BASE (0xb0003000)
244#define BCM_6328_M2M_BASE (0xdeadbeef)
245#define BCM_6328_ATM_BASE (0xdeadbeef)
246#define BCM_6328_XTM_BASE (0xdeadbeef)
247#define BCM_6328_XTMDMA_BASE (0xb000b800)
248#define BCM_6328_XTMDMAC_BASE (0xdeadbeef)
249#define BCM_6328_XTMDMAS_BASE (0xdeadbeef)
250#define BCM_6328_PCM_BASE (0xb000a800)
251#define BCM_6328_PCMDMA_BASE (0xdeadbeef)
252#define BCM_6328_PCMDMAC_BASE (0xdeadbeef)
253#define BCM_6328_PCMDMAS_BASE (0xdeadbeef)
254#define BCM_6328_RNG_BASE (0xdeadbeef)
255#define BCM_6328_MISC_BASE (0xb0001800)
256#define BCM_6328_OTP_BASE (0xb0000600)
257
258/*
259 * 6338 register sets base address
260 */
261#define BCM_6338_DSL_LMEM_BASE (0xfff00000)
262#define BCM_6338_PERF_BASE (0xfffe0000)
263#define BCM_6338_BB_BASE (0xfffe0100)
264#define BCM_6338_TIMER_BASE (0xfffe0200)
265#define BCM_6338_WDT_BASE (0xfffe021c)
266#define BCM_6338_UART0_BASE (0xfffe0300)
267#define BCM_6338_UART1_BASE (0xdeadbeef)
268#define BCM_6338_GPIO_BASE (0xfffe0400)
269#define BCM_6338_SPI_BASE (0xfffe0c00)
270#define BCM_6338_HSSPI_BASE (0xdeadbeef)
271#define BCM_6338_UDC0_BASE (0xdeadbeef)
272#define BCM_6338_USBDMA_BASE (0xfffe2400)
273#define BCM_6338_OHCI0_BASE (0xdeadbeef)
274#define BCM_6338_OHCI_PRIV_BASE (0xfffe3000)
275#define BCM_6338_USBH_PRIV_BASE (0xdeadbeef)
276#define BCM_6338_USBD_BASE (0xdeadbeef)
277#define BCM_6338_MPI_BASE (0xfffe3160)
278#define BCM_6338_PCMCIA_BASE (0xdeadbeef)
279#define BCM_6338_PCIE_BASE (0xdeadbeef)
280#define BCM_6338_SDRAM_REGS_BASE (0xfffe3100)
281#define BCM_6338_DSL_BASE (0xfffe1000)
282#define BCM_6338_UBUS_BASE (0xdeadbeef)
283#define BCM_6338_ENET0_BASE (0xfffe2800)
284#define BCM_6338_ENET1_BASE (0xdeadbeef)
285#define BCM_6338_ENETDMA_BASE (0xfffe2400)
286#define BCM_6338_ENETDMAC_BASE (0xfffe2500)
287#define BCM_6338_ENETDMAS_BASE (0xfffe2600)
288#define BCM_6338_ENETSW_BASE (0xdeadbeef)
289#define BCM_6338_EHCI0_BASE (0xdeadbeef)
290#define BCM_6338_SDRAM_BASE (0xfffe3100)
291#define BCM_6338_MEMC_BASE (0xdeadbeef)
292#define BCM_6338_DDR_BASE (0xdeadbeef)
293#define BCM_6338_M2M_BASE (0xdeadbeef)
294#define BCM_6338_ATM_BASE (0xfffe2000)
295#define BCM_6338_XTM_BASE (0xdeadbeef)
296#define BCM_6338_XTMDMA_BASE (0xdeadbeef)
297#define BCM_6338_XTMDMAC_BASE (0xdeadbeef)
298#define BCM_6338_XTMDMAS_BASE (0xdeadbeef)
299#define BCM_6338_PCM_BASE (0xdeadbeef)
300#define BCM_6338_PCMDMA_BASE (0xdeadbeef)
301#define BCM_6338_PCMDMAC_BASE (0xdeadbeef)
302#define BCM_6338_PCMDMAS_BASE (0xdeadbeef)
303#define BCM_6338_RNG_BASE (0xdeadbeef)
304#define BCM_6338_MISC_BASE (0xdeadbeef)
305
306/*
307 * 6345 register sets base address
308 */
309#define BCM_6345_DSL_LMEM_BASE (0xfff00000)
310#define BCM_6345_PERF_BASE (0xfffe0000)
311#define BCM_6345_BB_BASE (0xfffe0100)
312#define BCM_6345_TIMER_BASE (0xfffe0200)
313#define BCM_6345_WDT_BASE (0xfffe021c)
314#define BCM_6345_UART0_BASE (0xfffe0300)
315#define BCM_6345_UART1_BASE (0xdeadbeef)
316#define BCM_6345_GPIO_BASE (0xfffe0400)
317#define BCM_6345_SPI_BASE (0xdeadbeef)
318#define BCM_6345_HSSPI_BASE (0xdeadbeef)
319#define BCM_6345_UDC0_BASE (0xdeadbeef)
320#define BCM_6345_USBDMA_BASE (0xfffe2800)
321#define BCM_6345_ENET0_BASE (0xfffe1800)
322#define BCM_6345_ENETDMA_BASE (0xfffe2800)
323#define BCM_6345_ENETDMAC_BASE (0xfffe2840)
324#define BCM_6345_ENETDMAS_BASE (0xfffe2a00)
325#define BCM_6345_ENETSW_BASE (0xdeadbeef)
326#define BCM_6345_PCMCIA_BASE (0xfffe2028)
327#define BCM_6345_MPI_BASE (0xfffe2000)
328#define BCM_6345_PCIE_BASE (0xdeadbeef)
329#define BCM_6345_OHCI0_BASE (0xfffe2100)
330#define BCM_6345_OHCI_PRIV_BASE (0xfffe2200)
331#define BCM_6345_USBH_PRIV_BASE (0xdeadbeef)
332#define BCM_6345_USBD_BASE (0xdeadbeef)
333#define BCM_6345_SDRAM_REGS_BASE (0xfffe2300)
334#define BCM_6345_DSL_BASE (0xdeadbeef)
335#define BCM_6345_UBUS_BASE (0xdeadbeef)
336#define BCM_6345_ENET1_BASE (0xdeadbeef)
337#define BCM_6345_EHCI0_BASE (0xdeadbeef)
338#define BCM_6345_SDRAM_BASE (0xfffe2300)
339#define BCM_6345_MEMC_BASE (0xdeadbeef)
340#define BCM_6345_DDR_BASE (0xdeadbeef)
341#define BCM_6345_M2M_BASE (0xdeadbeef)
342#define BCM_6345_ATM_BASE (0xfffe4000)
343#define BCM_6345_XTM_BASE (0xdeadbeef)
344#define BCM_6345_XTMDMA_BASE (0xdeadbeef)
345#define BCM_6345_XTMDMAC_BASE (0xdeadbeef)
346#define BCM_6345_XTMDMAS_BASE (0xdeadbeef)
347#define BCM_6345_PCM_BASE (0xdeadbeef)
348#define BCM_6345_PCMDMA_BASE (0xdeadbeef)
349#define BCM_6345_PCMDMAC_BASE (0xdeadbeef)
350#define BCM_6345_PCMDMAS_BASE (0xdeadbeef)
351#define BCM_6345_RNG_BASE (0xdeadbeef)
352#define BCM_6345_MISC_BASE (0xdeadbeef)
353
354/*
355 * 6348 register sets base address
356 */
357#define BCM_6348_DSL_LMEM_BASE (0xfff00000)
358#define BCM_6348_PERF_BASE (0xfffe0000)
359#define BCM_6348_TIMER_BASE (0xfffe0200)
360#define BCM_6348_WDT_BASE (0xfffe021c)
361#define BCM_6348_UART0_BASE (0xfffe0300)
362#define BCM_6348_UART1_BASE (0xdeadbeef)
363#define BCM_6348_GPIO_BASE (0xfffe0400)
364#define BCM_6348_SPI_BASE (0xfffe0c00)
365#define BCM_6348_HSSPI_BASE (0xdeadbeef)
366#define BCM_6348_UDC0_BASE (0xfffe1000)
367#define BCM_6348_USBDMA_BASE (0xdeadbeef)
368#define BCM_6348_OHCI0_BASE (0xfffe1b00)
369#define BCM_6348_OHCI_PRIV_BASE (0xfffe1c00)
370#define BCM_6348_USBH_PRIV_BASE (0xdeadbeef)
371#define BCM_6348_USBD_BASE (0xdeadbeef)
372#define BCM_6348_MPI_BASE (0xfffe2000)
373#define BCM_6348_PCMCIA_BASE (0xfffe2054)
374#define BCM_6348_PCIE_BASE (0xdeadbeef)
375#define BCM_6348_SDRAM_REGS_BASE (0xfffe2300)
376#define BCM_6348_M2M_BASE (0xfffe2800)
377#define BCM_6348_DSL_BASE (0xfffe3000)
378#define BCM_6348_ENET0_BASE (0xfffe6000)
379#define BCM_6348_ENET1_BASE (0xfffe6800)
380#define BCM_6348_ENETDMA_BASE (0xfffe7000)
381#define BCM_6348_ENETDMAC_BASE (0xfffe7100)
382#define BCM_6348_ENETDMAS_BASE (0xfffe7200)
383#define BCM_6348_ENETSW_BASE (0xdeadbeef)
384#define BCM_6348_EHCI0_BASE (0xdeadbeef)
385#define BCM_6348_SDRAM_BASE (0xfffe2300)
386#define BCM_6348_MEMC_BASE (0xdeadbeef)
387#define BCM_6348_DDR_BASE (0xdeadbeef)
388#define BCM_6348_ATM_BASE (0xfffe4000)
389#define BCM_6348_XTM_BASE (0xdeadbeef)
390#define BCM_6348_XTMDMA_BASE (0xdeadbeef)
391#define BCM_6348_XTMDMAC_BASE (0xdeadbeef)
392#define BCM_6348_XTMDMAS_BASE (0xdeadbeef)
393#define BCM_6348_PCM_BASE (0xdeadbeef)
394#define BCM_6348_PCMDMA_BASE (0xdeadbeef)
395#define BCM_6348_PCMDMAC_BASE (0xdeadbeef)
396#define BCM_6348_PCMDMAS_BASE (0xdeadbeef)
397#define BCM_6348_RNG_BASE (0xdeadbeef)
398#define BCM_6348_MISC_BASE (0xdeadbeef)
399
400/*
401 * 6358 register sets base address
402 */
403#define BCM_6358_DSL_LMEM_BASE (0xfff00000)
404#define BCM_6358_PERF_BASE (0xfffe0000)
405#define BCM_6358_TIMER_BASE (0xfffe0040)
406#define BCM_6358_WDT_BASE (0xfffe005c)
407#define BCM_6358_UART0_BASE (0xfffe0100)
408#define BCM_6358_UART1_BASE (0xfffe0120)
409#define BCM_6358_GPIO_BASE (0xfffe0080)
410#define BCM_6358_SPI_BASE (0xfffe0800)
411#define BCM_6358_HSSPI_BASE (0xdeadbeef)
412#define BCM_6358_UDC0_BASE (0xfffe0800)
413#define BCM_6358_USBDMA_BASE (0xdeadbeef)
414#define BCM_6358_OHCI0_BASE (0xfffe1400)
415#define BCM_6358_OHCI_PRIV_BASE (0xdeadbeef)
416#define BCM_6358_USBH_PRIV_BASE (0xfffe1500)
417#define BCM_6358_USBD_BASE (0xdeadbeef)
418#define BCM_6358_MPI_BASE (0xfffe1000)
419#define BCM_6358_PCMCIA_BASE (0xfffe1054)
420#define BCM_6358_PCIE_BASE (0xdeadbeef)
421#define BCM_6358_SDRAM_REGS_BASE (0xfffe2300)
422#define BCM_6358_M2M_BASE (0xdeadbeef)
423#define BCM_6358_DSL_BASE (0xfffe3000)
424#define BCM_6358_ENET0_BASE (0xfffe4000)
425#define BCM_6358_ENET1_BASE (0xfffe4800)
426#define BCM_6358_ENETDMA_BASE (0xfffe5000)
427#define BCM_6358_ENETDMAC_BASE (0xfffe5100)
428#define BCM_6358_ENETDMAS_BASE (0xfffe5200)
429#define BCM_6358_ENETSW_BASE (0xdeadbeef)
430#define BCM_6358_EHCI0_BASE (0xfffe1300)
431#define BCM_6358_SDRAM_BASE (0xdeadbeef)
432#define BCM_6358_MEMC_BASE (0xfffe1200)
433#define BCM_6358_DDR_BASE (0xfffe12a0)
434#define BCM_6358_ATM_BASE (0xfffe2000)
435#define BCM_6358_XTM_BASE (0xdeadbeef)
436#define BCM_6358_XTMDMA_BASE (0xdeadbeef)
437#define BCM_6358_XTMDMAC_BASE (0xdeadbeef)
438#define BCM_6358_XTMDMAS_BASE (0xdeadbeef)
439#define BCM_6358_PCM_BASE (0xfffe1600)
440#define BCM_6358_PCMDMA_BASE (0xfffe1800)
441#define BCM_6358_PCMDMAC_BASE (0xfffe1900)
442#define BCM_6358_PCMDMAS_BASE (0xfffe1a00)
443#define BCM_6358_RNG_BASE (0xdeadbeef)
444#define BCM_6358_MISC_BASE (0xdeadbeef)
445
446
447/*
448 * 6362 register sets base address
449 */
450#define BCM_6362_DSL_LMEM_BASE (0xdeadbeef)
451#define BCM_6362_PERF_BASE (0xb0000000)
452#define BCM_6362_TIMER_BASE (0xb0000040)
453#define BCM_6362_WDT_BASE (0xb000005c)
454#define BCM_6362_UART0_BASE (0xb0000100)
455#define BCM_6362_UART1_BASE (0xb0000120)
456#define BCM_6362_GPIO_BASE (0xb0000080)
457#define BCM_6362_SPI_BASE (0xb0000800)
458#define BCM_6362_HSSPI_BASE (0xb0001000)
459#define BCM_6362_UDC0_BASE (0xdeadbeef)
460#define BCM_6362_USBDMA_BASE (0xb000c000)
461#define BCM_6362_OHCI0_BASE (0xb0002600)
462#define BCM_6362_OHCI_PRIV_BASE (0xdeadbeef)
463#define BCM_6362_USBH_PRIV_BASE (0xb0002700)
464#define BCM_6362_USBD_BASE (0xb0002400)
465#define BCM_6362_MPI_BASE (0xdeadbeef)
466#define BCM_6362_PCMCIA_BASE (0xdeadbeef)
467#define BCM_6362_PCIE_BASE (0xb0e40000)
468#define BCM_6362_SDRAM_REGS_BASE (0xdeadbeef)
469#define BCM_6362_DSL_BASE (0xdeadbeef)
470#define BCM_6362_UBUS_BASE (0xdeadbeef)
471#define BCM_6362_ENET0_BASE (0xdeadbeef)
472#define BCM_6362_ENET1_BASE (0xdeadbeef)
473#define BCM_6362_ENETDMA_BASE (0xb000d800)
474#define BCM_6362_ENETDMAC_BASE (0xb000da00)
475#define BCM_6362_ENETDMAS_BASE (0xb000dc00)
476#define BCM_6362_ENETSW_BASE (0xb0e00000)
477#define BCM_6362_EHCI0_BASE (0xb0002500)
478#define BCM_6362_SDRAM_BASE (0xdeadbeef)
479#define BCM_6362_MEMC_BASE (0xdeadbeef)
480#define BCM_6362_DDR_BASE (0xb0003000)
481#define BCM_6362_M2M_BASE (0xdeadbeef)
482#define BCM_6362_ATM_BASE (0xdeadbeef)
483#define BCM_6362_XTM_BASE (0xb0007800)
484#define BCM_6362_XTMDMA_BASE (0xb000b800)
485#define BCM_6362_XTMDMAC_BASE (0xdeadbeef)
486#define BCM_6362_XTMDMAS_BASE (0xdeadbeef)
487#define BCM_6362_PCM_BASE (0xb000a800)
488#define BCM_6362_PCMDMA_BASE (0xdeadbeef)
489#define BCM_6362_PCMDMAC_BASE (0xdeadbeef)
490#define BCM_6362_PCMDMAS_BASE (0xdeadbeef)
491#define BCM_6362_RNG_BASE (0xdeadbeef)
492#define BCM_6362_MISC_BASE (0xb0001800)
493
494#define BCM_6362_NAND_REG_BASE (0xb0000200)
495#define BCM_6362_NAND_CACHE_BASE (0xb0000600)
496#define BCM_6362_LED_BASE (0xb0001900)
497#define BCM_6362_IPSEC_BASE (0xb0002800)
498#define BCM_6362_IPSEC_DMA_BASE (0xb000d000)
499#define BCM_6362_WLAN_CHIPCOMMON_BASE (0xb0004000)
500#define BCM_6362_WLAN_D11_BASE (0xb0005000)
501#define BCM_6362_WLAN_SHIM_BASE (0xb0007000)
502
503/*
504 * 6368 register sets base address
505 */
506#define BCM_6368_DSL_LMEM_BASE (0xdeadbeef)
507#define BCM_6368_PERF_BASE (0xb0000000)
508#define BCM_6368_TIMER_BASE (0xb0000040)
509#define BCM_6368_WDT_BASE (0xb000005c)
510#define BCM_6368_UART0_BASE (0xb0000100)
511#define BCM_6368_UART1_BASE (0xb0000120)
512#define BCM_6368_GPIO_BASE (0xb0000080)
513#define BCM_6368_SPI_BASE (0xb0000800)
514#define BCM_6368_HSSPI_BASE (0xdeadbeef)
515#define BCM_6368_UDC0_BASE (0xdeadbeef)
516#define BCM_6368_USBDMA_BASE (0xb0004800)
517#define BCM_6368_OHCI0_BASE (0xb0001600)
518#define BCM_6368_OHCI_PRIV_BASE (0xdeadbeef)
519#define BCM_6368_USBH_PRIV_BASE (0xb0001700)
520#define BCM_6368_USBD_BASE (0xb0001400)
521#define BCM_6368_MPI_BASE (0xb0001000)
522#define BCM_6368_PCMCIA_BASE (0xb0001054)
523#define BCM_6368_PCIE_BASE (0xdeadbeef)
524#define BCM_6368_SDRAM_REGS_BASE (0xdeadbeef)
525#define BCM_6368_M2M_BASE (0xdeadbeef)
526#define BCM_6368_DSL_BASE (0xdeadbeef)
527#define BCM_6368_ENET0_BASE (0xdeadbeef)
528#define BCM_6368_ENET1_BASE (0xdeadbeef)
529#define BCM_6368_ENETDMA_BASE (0xb0006800)
530#define BCM_6368_ENETDMAC_BASE (0xb0006a00)
531#define BCM_6368_ENETDMAS_BASE (0xb0006c00)
532#define BCM_6368_ENETSW_BASE (0xb0f00000)
533#define BCM_6368_EHCI0_BASE (0xb0001500)
534#define BCM_6368_SDRAM_BASE (0xdeadbeef)
535#define BCM_6368_MEMC_BASE (0xb0001200)
536#define BCM_6368_DDR_BASE (0xb0001280)
537#define BCM_6368_ATM_BASE (0xdeadbeef)
538#define BCM_6368_XTM_BASE (0xb0001800)
539#define BCM_6368_XTMDMA_BASE (0xb0005000)
540#define BCM_6368_XTMDMAC_BASE (0xb0005200)
541#define BCM_6368_XTMDMAS_BASE (0xb0005400)
542#define BCM_6368_PCM_BASE (0xb0004000)
543#define BCM_6368_PCMDMA_BASE (0xb0005800)
544#define BCM_6368_PCMDMAC_BASE (0xb0005a00)
545#define BCM_6368_PCMDMAS_BASE (0xb0005c00)
546#define BCM_6368_RNG_BASE (0xb0004180)
547#define BCM_6368_MISC_BASE (0xdeadbeef)
548
549
550extern const unsigned long *bcm63xx_regs_base;
551
552#define __GEN_CPU_REGS_TABLE(__cpu) \
553 [RSET_DSL_LMEM] = BCM_## __cpu ##_DSL_LMEM_BASE, \
554 [RSET_PERF] = BCM_## __cpu ##_PERF_BASE, \
555 [RSET_TIMER] = BCM_## __cpu ##_TIMER_BASE, \
556 [RSET_WDT] = BCM_## __cpu ##_WDT_BASE, \
557 [RSET_UART0] = BCM_## __cpu ##_UART0_BASE, \
558 [RSET_UART1] = BCM_## __cpu ##_UART1_BASE, \
559 [RSET_GPIO] = BCM_## __cpu ##_GPIO_BASE, \
560 [RSET_SPI] = BCM_## __cpu ##_SPI_BASE, \
561 [RSET_HSSPI] = BCM_## __cpu ##_HSSPI_BASE, \
562 [RSET_UDC0] = BCM_## __cpu ##_UDC0_BASE, \
563 [RSET_OHCI0] = BCM_## __cpu ##_OHCI0_BASE, \
564 [RSET_OHCI_PRIV] = BCM_## __cpu ##_OHCI_PRIV_BASE, \
565 [RSET_USBH_PRIV] = BCM_## __cpu ##_USBH_PRIV_BASE, \
566 [RSET_USBD] = BCM_## __cpu ##_USBD_BASE, \
567 [RSET_USBDMA] = BCM_## __cpu ##_USBDMA_BASE, \
568 [RSET_MPI] = BCM_## __cpu ##_MPI_BASE, \
569 [RSET_PCMCIA] = BCM_## __cpu ##_PCMCIA_BASE, \
570 [RSET_PCIE] = BCM_## __cpu ##_PCIE_BASE, \
571 [RSET_DSL] = BCM_## __cpu ##_DSL_BASE, \
572 [RSET_ENET0] = BCM_## __cpu ##_ENET0_BASE, \
573 [RSET_ENET1] = BCM_## __cpu ##_ENET1_BASE, \
574 [RSET_ENETDMA] = BCM_## __cpu ##_ENETDMA_BASE, \
575 [RSET_ENETDMAC] = BCM_## __cpu ##_ENETDMAC_BASE, \
576 [RSET_ENETDMAS] = BCM_## __cpu ##_ENETDMAS_BASE, \
577 [RSET_ENETSW] = BCM_## __cpu ##_ENETSW_BASE, \
578 [RSET_EHCI0] = BCM_## __cpu ##_EHCI0_BASE, \
579 [RSET_SDRAM] = BCM_## __cpu ##_SDRAM_BASE, \
580 [RSET_MEMC] = BCM_## __cpu ##_MEMC_BASE, \
581 [RSET_DDR] = BCM_## __cpu ##_DDR_BASE, \
582 [RSET_M2M] = BCM_## __cpu ##_M2M_BASE, \
583 [RSET_ATM] = BCM_## __cpu ##_ATM_BASE, \
584 [RSET_XTM] = BCM_## __cpu ##_XTM_BASE, \
585 [RSET_XTMDMA] = BCM_## __cpu ##_XTMDMA_BASE, \
586 [RSET_XTMDMAC] = BCM_## __cpu ##_XTMDMAC_BASE, \
587 [RSET_XTMDMAS] = BCM_## __cpu ##_XTMDMAS_BASE, \
588 [RSET_PCM] = BCM_## __cpu ##_PCM_BASE, \
589 [RSET_PCMDMA] = BCM_## __cpu ##_PCMDMA_BASE, \
590 [RSET_PCMDMAC] = BCM_## __cpu ##_PCMDMAC_BASE, \
591 [RSET_PCMDMAS] = BCM_## __cpu ##_PCMDMAS_BASE, \
592 [RSET_RNG] = BCM_## __cpu ##_RNG_BASE, \
593 [RSET_MISC] = BCM_## __cpu ##_MISC_BASE, \
594
595
596static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set)
597{
598 return bcm63xx_regs_base[set];
599}
600
601/*
602 * IRQ number changes across CPU too
603 */
604enum bcm63xx_irq {
605 IRQ_TIMER = 0,
606 IRQ_SPI,
607 IRQ_UART0,
608 IRQ_UART1,
609 IRQ_DSL,
610 IRQ_ENET0,
611 IRQ_ENET1,
612 IRQ_ENET_PHY,
613 IRQ_HSSPI,
614 IRQ_OHCI0,
615 IRQ_EHCI0,
616 IRQ_USBD,
617 IRQ_USBD_RXDMA0,
618 IRQ_USBD_TXDMA0,
619 IRQ_USBD_RXDMA1,
620 IRQ_USBD_TXDMA1,
621 IRQ_USBD_RXDMA2,
622 IRQ_USBD_TXDMA2,
623 IRQ_ENET0_RXDMA,
624 IRQ_ENET0_TXDMA,
625 IRQ_ENET1_RXDMA,
626 IRQ_ENET1_TXDMA,
627 IRQ_PCI,
628 IRQ_PCMCIA,
629 IRQ_ATM,
630 IRQ_ENETSW_RXDMA0,
631 IRQ_ENETSW_RXDMA1,
632 IRQ_ENETSW_RXDMA2,
633 IRQ_ENETSW_RXDMA3,
634 IRQ_ENETSW_TXDMA0,
635 IRQ_ENETSW_TXDMA1,
636 IRQ_ENETSW_TXDMA2,
637 IRQ_ENETSW_TXDMA3,
638 IRQ_XTM,
639 IRQ_XTM_DMA0,
640};
641
642/*
643 * 3368 irqs
644 */
645#define BCM_3368_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
646#define BCM_3368_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
647#define BCM_3368_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
648#define BCM_3368_UART1_IRQ (IRQ_INTERNAL_BASE + 3)
649#define BCM_3368_DSL_IRQ 0
650#define BCM_3368_UDC0_IRQ 0
651#define BCM_3368_OHCI0_IRQ 0
652#define BCM_3368_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
653#define BCM_3368_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)
654#define BCM_3368_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
655#define BCM_3368_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
656#define BCM_3368_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
657#define BCM_3368_HSSPI_IRQ 0
658#define BCM_3368_EHCI0_IRQ 0
659#define BCM_3368_USBD_IRQ 0
660#define BCM_3368_USBD_RXDMA0_IRQ 0
661#define BCM_3368_USBD_TXDMA0_IRQ 0
662#define BCM_3368_USBD_RXDMA1_IRQ 0
663#define BCM_3368_USBD_TXDMA1_IRQ 0
664#define BCM_3368_USBD_RXDMA2_IRQ 0
665#define BCM_3368_USBD_TXDMA2_IRQ 0
666#define BCM_3368_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 17)
667#define BCM_3368_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 18)
668#define BCM_3368_PCI_IRQ (IRQ_INTERNAL_BASE + 31)
669#define BCM_3368_PCMCIA_IRQ 0
670#define BCM_3368_ATM_IRQ 0
671#define BCM_3368_ENETSW_RXDMA0_IRQ 0
672#define BCM_3368_ENETSW_RXDMA1_IRQ 0
673#define BCM_3368_ENETSW_RXDMA2_IRQ 0
674#define BCM_3368_ENETSW_RXDMA3_IRQ 0
675#define BCM_3368_ENETSW_TXDMA0_IRQ 0
676#define BCM_3368_ENETSW_TXDMA1_IRQ 0
677#define BCM_3368_ENETSW_TXDMA2_IRQ 0
678#define BCM_3368_ENETSW_TXDMA3_IRQ 0
679#define BCM_3368_XTM_IRQ 0
680#define BCM_3368_XTM_DMA0_IRQ 0
681
682#define BCM_3368_EXT_IRQ0 (IRQ_INTERNAL_BASE + 25)
683#define BCM_3368_EXT_IRQ1 (IRQ_INTERNAL_BASE + 26)
684#define BCM_3368_EXT_IRQ2 (IRQ_INTERNAL_BASE + 27)
685#define BCM_3368_EXT_IRQ3 (IRQ_INTERNAL_BASE + 28)
686
687
688/*
689 * 6328 irqs
690 */
691#define BCM_6328_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32)
692
693#define BCM_6328_TIMER_IRQ (IRQ_INTERNAL_BASE + 31)
694#define BCM_6328_SPI_IRQ 0
695#define BCM_6328_UART0_IRQ (IRQ_INTERNAL_BASE + 28)
696#define BCM_6328_UART1_IRQ (BCM_6328_HIGH_IRQ_BASE + 7)
697#define BCM_6328_DSL_IRQ (IRQ_INTERNAL_BASE + 4)
698#define BCM_6328_UDC0_IRQ 0
699#define BCM_6328_ENET0_IRQ 0
700#define BCM_6328_ENET1_IRQ 0
701#define BCM_6328_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12)
702#define BCM_6328_HSSPI_IRQ (IRQ_INTERNAL_BASE + 29)
703#define BCM_6328_OHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 9)
704#define BCM_6328_EHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 10)
705#define BCM_6328_USBD_IRQ (IRQ_INTERNAL_BASE + 4)
706#define BCM_6328_USBD_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 5)
707#define BCM_6328_USBD_TXDMA0_IRQ (IRQ_INTERNAL_BASE + 6)
708#define BCM_6328_USBD_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 7)
709#define BCM_6328_USBD_TXDMA1_IRQ (IRQ_INTERNAL_BASE + 8)
710#define BCM_6328_USBD_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 9)
711#define BCM_6328_USBD_TXDMA2_IRQ (IRQ_INTERNAL_BASE + 10)
712#define BCM_6328_PCMCIA_IRQ 0
713#define BCM_6328_ENET0_RXDMA_IRQ 0
714#define BCM_6328_ENET0_TXDMA_IRQ 0
715#define BCM_6328_ENET1_RXDMA_IRQ 0
716#define BCM_6328_ENET1_TXDMA_IRQ 0
717#define BCM_6328_PCI_IRQ (IRQ_INTERNAL_BASE + 23)
718#define BCM_6328_ATM_IRQ 0
719#define BCM_6328_ENETSW_RXDMA0_IRQ (BCM_6328_HIGH_IRQ_BASE + 0)
720#define BCM_6328_ENETSW_RXDMA1_IRQ (BCM_6328_HIGH_IRQ_BASE + 1)
721#define BCM_6328_ENETSW_RXDMA2_IRQ (BCM_6328_HIGH_IRQ_BASE + 2)
722#define BCM_6328_ENETSW_RXDMA3_IRQ (BCM_6328_HIGH_IRQ_BASE + 3)
723#define BCM_6328_ENETSW_TXDMA0_IRQ 0
724#define BCM_6328_ENETSW_TXDMA1_IRQ 0
725#define BCM_6328_ENETSW_TXDMA2_IRQ 0
726#define BCM_6328_ENETSW_TXDMA3_IRQ 0
727#define BCM_6328_XTM_IRQ (BCM_6328_HIGH_IRQ_BASE + 31)
728#define BCM_6328_XTM_DMA0_IRQ (BCM_6328_HIGH_IRQ_BASE + 11)
729
730#define BCM_6328_PCM_DMA0_IRQ (IRQ_INTERNAL_BASE + 2)
731#define BCM_6328_PCM_DMA1_IRQ (IRQ_INTERNAL_BASE + 3)
732#define BCM_6328_EXT_IRQ0 (IRQ_INTERNAL_BASE + 24)
733#define BCM_6328_EXT_IRQ1 (IRQ_INTERNAL_BASE + 25)
734#define BCM_6328_EXT_IRQ2 (IRQ_INTERNAL_BASE + 26)
735#define BCM_6328_EXT_IRQ3 (IRQ_INTERNAL_BASE + 27)
736
737/*
738 * 6338 irqs
739 */
740#define BCM_6338_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
741#define BCM_6338_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
742#define BCM_6338_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
743#define BCM_6338_UART1_IRQ 0
744#define BCM_6338_DSL_IRQ (IRQ_INTERNAL_BASE + 5)
745#define BCM_6338_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
746#define BCM_6338_ENET1_IRQ 0
747#define BCM_6338_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
748#define BCM_6338_HSSPI_IRQ 0
749#define BCM_6338_OHCI0_IRQ 0
750#define BCM_6338_EHCI0_IRQ 0
751#define BCM_6338_USBD_IRQ 0
752#define BCM_6338_USBD_RXDMA0_IRQ 0
753#define BCM_6338_USBD_TXDMA0_IRQ 0
754#define BCM_6338_USBD_RXDMA1_IRQ 0
755#define BCM_6338_USBD_TXDMA1_IRQ 0
756#define BCM_6338_USBD_RXDMA2_IRQ 0
757#define BCM_6338_USBD_TXDMA2_IRQ 0
758#define BCM_6338_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
759#define BCM_6338_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
760#define BCM_6338_ENET1_RXDMA_IRQ 0
761#define BCM_6338_ENET1_TXDMA_IRQ 0
762#define BCM_6338_PCI_IRQ 0
763#define BCM_6338_PCMCIA_IRQ 0
764#define BCM_6338_ATM_IRQ 0
765#define BCM_6338_ENETSW_RXDMA0_IRQ 0
766#define BCM_6338_ENETSW_RXDMA1_IRQ 0
767#define BCM_6338_ENETSW_RXDMA2_IRQ 0
768#define BCM_6338_ENETSW_RXDMA3_IRQ 0
769#define BCM_6338_ENETSW_TXDMA0_IRQ 0
770#define BCM_6338_ENETSW_TXDMA1_IRQ 0
771#define BCM_6338_ENETSW_TXDMA2_IRQ 0
772#define BCM_6338_ENETSW_TXDMA3_IRQ 0
773#define BCM_6338_XTM_IRQ 0
774#define BCM_6338_XTM_DMA0_IRQ 0
775
776/*
777 * 6345 irqs
778 */
779#define BCM_6345_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
780#define BCM_6345_SPI_IRQ 0
781#define BCM_6345_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
782#define BCM_6345_UART1_IRQ 0
783#define BCM_6345_DSL_IRQ (IRQ_INTERNAL_BASE + 3)
784#define BCM_6345_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
785#define BCM_6345_ENET1_IRQ 0
786#define BCM_6345_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12)
787#define BCM_6345_HSSPI_IRQ 0
788#define BCM_6345_OHCI0_IRQ 0
789#define BCM_6345_EHCI0_IRQ 0
790#define BCM_6345_USBD_IRQ 0
791#define BCM_6345_USBD_RXDMA0_IRQ 0
792#define BCM_6345_USBD_TXDMA0_IRQ 0
793#define BCM_6345_USBD_RXDMA1_IRQ 0
794#define BCM_6345_USBD_TXDMA1_IRQ 0
795#define BCM_6345_USBD_RXDMA2_IRQ 0
796#define BCM_6345_USBD_TXDMA2_IRQ 0
797#define BCM_6345_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 13 + 1)
798#define BCM_6345_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 13 + 2)
799#define BCM_6345_ENET1_RXDMA_IRQ 0
800#define BCM_6345_ENET1_TXDMA_IRQ 0
801#define BCM_6345_PCI_IRQ 0
802#define BCM_6345_PCMCIA_IRQ 0
803#define BCM_6345_ATM_IRQ 0
804#define BCM_6345_ENETSW_RXDMA0_IRQ 0
805#define BCM_6345_ENETSW_RXDMA1_IRQ 0
806#define BCM_6345_ENETSW_RXDMA2_IRQ 0
807#define BCM_6345_ENETSW_RXDMA3_IRQ 0
808#define BCM_6345_ENETSW_TXDMA0_IRQ 0
809#define BCM_6345_ENETSW_TXDMA1_IRQ 0
810#define BCM_6345_ENETSW_TXDMA2_IRQ 0
811#define BCM_6345_ENETSW_TXDMA3_IRQ 0
812#define BCM_6345_XTM_IRQ 0
813#define BCM_6345_XTM_DMA0_IRQ 0
814
815/*
816 * 6348 irqs
817 */
818#define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
819#define BCM_6348_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
820#define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
821#define BCM_6348_UART1_IRQ 0
822#define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4)
823#define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
824#define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7)
825#define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
826#define BCM_6348_HSSPI_IRQ 0
827#define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12)
828#define BCM_6348_EHCI0_IRQ 0
829#define BCM_6348_USBD_IRQ 0
830#define BCM_6348_USBD_RXDMA0_IRQ 0
831#define BCM_6348_USBD_TXDMA0_IRQ 0
832#define BCM_6348_USBD_RXDMA1_IRQ 0
833#define BCM_6348_USBD_TXDMA1_IRQ 0
834#define BCM_6348_USBD_RXDMA2_IRQ 0
835#define BCM_6348_USBD_TXDMA2_IRQ 0
836#define BCM_6348_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 20)
837#define BCM_6348_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 21)
838#define BCM_6348_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 22)
839#define BCM_6348_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 23)
840#define BCM_6348_PCI_IRQ (IRQ_INTERNAL_BASE + 24)
841#define BCM_6348_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
842#define BCM_6348_ATM_IRQ (IRQ_INTERNAL_BASE + 5)
843#define BCM_6348_ENETSW_RXDMA0_IRQ 0
844#define BCM_6348_ENETSW_RXDMA1_IRQ 0
845#define BCM_6348_ENETSW_RXDMA2_IRQ 0
846#define BCM_6348_ENETSW_RXDMA3_IRQ 0
847#define BCM_6348_ENETSW_TXDMA0_IRQ 0
848#define BCM_6348_ENETSW_TXDMA1_IRQ 0
849#define BCM_6348_ENETSW_TXDMA2_IRQ 0
850#define BCM_6348_ENETSW_TXDMA3_IRQ 0
851#define BCM_6348_XTM_IRQ 0
852#define BCM_6348_XTM_DMA0_IRQ 0
853
854/*
855 * 6358 irqs
856 */
857#define BCM_6358_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
858#define BCM_6358_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
859#define BCM_6358_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
860#define BCM_6358_UART1_IRQ (IRQ_INTERNAL_BASE + 3)
861#define BCM_6358_DSL_IRQ (IRQ_INTERNAL_BASE + 29)
862#define BCM_6358_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
863#define BCM_6358_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)
864#define BCM_6358_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
865#define BCM_6358_HSSPI_IRQ 0
866#define BCM_6358_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
867#define BCM_6358_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10)
868#define BCM_6358_USBD_IRQ 0
869#define BCM_6358_USBD_RXDMA0_IRQ 0
870#define BCM_6358_USBD_TXDMA0_IRQ 0
871#define BCM_6358_USBD_RXDMA1_IRQ 0
872#define BCM_6358_USBD_TXDMA1_IRQ 0
873#define BCM_6358_USBD_RXDMA2_IRQ 0
874#define BCM_6358_USBD_TXDMA2_IRQ 0
875#define BCM_6358_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
876#define BCM_6358_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
877#define BCM_6358_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 17)
878#define BCM_6358_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 18)
879#define BCM_6358_PCI_IRQ (IRQ_INTERNAL_BASE + 31)
880#define BCM_6358_PCMCIA_IRQ (IRQ_INTERNAL_BASE + 24)
881#define BCM_6358_ATM_IRQ (IRQ_INTERNAL_BASE + 19)
882#define BCM_6358_ENETSW_RXDMA0_IRQ 0
883#define BCM_6358_ENETSW_RXDMA1_IRQ 0
884#define BCM_6358_ENETSW_RXDMA2_IRQ 0
885#define BCM_6358_ENETSW_RXDMA3_IRQ 0
886#define BCM_6358_ENETSW_TXDMA0_IRQ 0
887#define BCM_6358_ENETSW_TXDMA1_IRQ 0
888#define BCM_6358_ENETSW_TXDMA2_IRQ 0
889#define BCM_6358_ENETSW_TXDMA3_IRQ 0
890#define BCM_6358_XTM_IRQ 0
891#define BCM_6358_XTM_DMA0_IRQ 0
892
893#define BCM_6358_PCM_DMA0_IRQ (IRQ_INTERNAL_BASE + 23)
894#define BCM_6358_PCM_DMA1_IRQ (IRQ_INTERNAL_BASE + 24)
895#define BCM_6358_EXT_IRQ0 (IRQ_INTERNAL_BASE + 25)
896#define BCM_6358_EXT_IRQ1 (IRQ_INTERNAL_BASE + 26)
897#define BCM_6358_EXT_IRQ2 (IRQ_INTERNAL_BASE + 27)
898#define BCM_6358_EXT_IRQ3 (IRQ_INTERNAL_BASE + 28)
899
900/*
901 * 6362 irqs
902 */
903#define BCM_6362_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32)
904
905#define BCM_6362_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
906#define BCM_6362_SPI_IRQ (IRQ_INTERNAL_BASE + 2)
907#define BCM_6362_UART0_IRQ (IRQ_INTERNAL_BASE + 3)
908#define BCM_6362_UART1_IRQ (IRQ_INTERNAL_BASE + 4)
909#define BCM_6362_DSL_IRQ (IRQ_INTERNAL_BASE + 28)
910#define BCM_6362_UDC0_IRQ 0
911#define BCM_6362_ENET0_IRQ 0
912#define BCM_6362_ENET1_IRQ 0
913#define BCM_6362_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 14)
914#define BCM_6362_HSSPI_IRQ (IRQ_INTERNAL_BASE + 5)
915#define BCM_6362_OHCI0_IRQ (IRQ_INTERNAL_BASE + 9)
916#define BCM_6362_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10)
917#define BCM_6362_USBD_IRQ (IRQ_INTERNAL_BASE + 11)
918#define BCM_6362_USBD_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 20)
919#define BCM_6362_USBD_TXDMA0_IRQ (IRQ_INTERNAL_BASE + 21)
920#define BCM_6362_USBD_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 22)
921#define BCM_6362_USBD_TXDMA1_IRQ (IRQ_INTERNAL_BASE + 23)
922#define BCM_6362_USBD_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 24)
923#define BCM_6362_USBD_TXDMA2_IRQ (IRQ_INTERNAL_BASE + 25)
924#define BCM_6362_PCMCIA_IRQ 0
925#define BCM_6362_ENET0_RXDMA_IRQ 0
926#define BCM_6362_ENET0_TXDMA_IRQ 0
927#define BCM_6362_ENET1_RXDMA_IRQ 0
928#define BCM_6362_ENET1_TXDMA_IRQ 0
929#define BCM_6362_PCI_IRQ (IRQ_INTERNAL_BASE + 30)
930#define BCM_6362_ATM_IRQ 0
931#define BCM_6362_ENETSW_RXDMA0_IRQ (BCM_6362_HIGH_IRQ_BASE + 0)
932#define BCM_6362_ENETSW_RXDMA1_IRQ (BCM_6362_HIGH_IRQ_BASE + 1)
933#define BCM_6362_ENETSW_RXDMA2_IRQ (BCM_6362_HIGH_IRQ_BASE + 2)
934#define BCM_6362_ENETSW_RXDMA3_IRQ (BCM_6362_HIGH_IRQ_BASE + 3)
935#define BCM_6362_ENETSW_TXDMA0_IRQ 0
936#define BCM_6362_ENETSW_TXDMA1_IRQ 0
937#define BCM_6362_ENETSW_TXDMA2_IRQ 0
938#define BCM_6362_ENETSW_TXDMA3_IRQ 0
939#define BCM_6362_XTM_IRQ 0
940#define BCM_6362_XTM_DMA0_IRQ (BCM_6362_HIGH_IRQ_BASE + 12)
941
942#define BCM_6362_RING_OSC_IRQ (IRQ_INTERNAL_BASE + 1)
943#define BCM_6362_WLAN_GPIO_IRQ (IRQ_INTERNAL_BASE + 6)
944#define BCM_6362_WLAN_IRQ (IRQ_INTERNAL_BASE + 7)
945#define BCM_6362_IPSEC_IRQ (IRQ_INTERNAL_BASE + 8)
946#define BCM_6362_NAND_IRQ (IRQ_INTERNAL_BASE + 12)
947#define BCM_6362_PCM_IRQ (IRQ_INTERNAL_BASE + 13)
948#define BCM_6362_DG_IRQ (IRQ_INTERNAL_BASE + 15)
949#define BCM_6362_EPHY_ENERGY0_IRQ (IRQ_INTERNAL_BASE + 16)
950#define BCM_6362_EPHY_ENERGY1_IRQ (IRQ_INTERNAL_BASE + 17)
951#define BCM_6362_EPHY_ENERGY2_IRQ (IRQ_INTERNAL_BASE + 18)
952#define BCM_6362_EPHY_ENERGY3_IRQ (IRQ_INTERNAL_BASE + 19)
953#define BCM_6362_IPSEC_DMA0_IRQ (IRQ_INTERNAL_BASE + 26)
954#define BCM_6362_IPSEC_DMA1_IRQ (IRQ_INTERNAL_BASE + 27)
955#define BCM_6362_FAP0_IRQ (IRQ_INTERNAL_BASE + 29)
956#define BCM_6362_PCM_DMA0_IRQ (BCM_6362_HIGH_IRQ_BASE + 4)
957#define BCM_6362_PCM_DMA1_IRQ (BCM_6362_HIGH_IRQ_BASE + 5)
958#define BCM_6362_DECT0_IRQ (BCM_6362_HIGH_IRQ_BASE + 6)
959#define BCM_6362_DECT1_IRQ (BCM_6362_HIGH_IRQ_BASE + 7)
960#define BCM_6362_EXT_IRQ0 (BCM_6362_HIGH_IRQ_BASE + 8)
961#define BCM_6362_EXT_IRQ1 (BCM_6362_HIGH_IRQ_BASE + 9)
962#define BCM_6362_EXT_IRQ2 (BCM_6362_HIGH_IRQ_BASE + 10)
963#define BCM_6362_EXT_IRQ3 (BCM_6362_HIGH_IRQ_BASE + 11)
964
965/*
966 * 6368 irqs
967 */
968#define BCM_6368_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32)
969
970#define BCM_6368_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
971#define BCM_6368_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
972#define BCM_6368_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
973#define BCM_6368_UART1_IRQ (IRQ_INTERNAL_BASE + 3)
974#define BCM_6368_DSL_IRQ (IRQ_INTERNAL_BASE + 4)
975#define BCM_6368_ENET0_IRQ 0
976#define BCM_6368_ENET1_IRQ 0
977#define BCM_6368_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 15)
978#define BCM_6368_HSSPI_IRQ 0
979#define BCM_6368_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
980#define BCM_6368_EHCI0_IRQ (IRQ_INTERNAL_BASE + 7)
981#define BCM_6368_USBD_IRQ (IRQ_INTERNAL_BASE + 8)
982#define BCM_6368_USBD_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 26)
983#define BCM_6368_USBD_TXDMA0_IRQ (IRQ_INTERNAL_BASE + 27)
984#define BCM_6368_USBD_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 28)
985#define BCM_6368_USBD_TXDMA1_IRQ (IRQ_INTERNAL_BASE + 29)
986#define BCM_6368_USBD_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 30)
987#define BCM_6368_USBD_TXDMA2_IRQ (IRQ_INTERNAL_BASE + 31)
988#define BCM_6368_PCMCIA_IRQ 0
989#define BCM_6368_ENET0_RXDMA_IRQ 0
990#define BCM_6368_ENET0_TXDMA_IRQ 0
991#define BCM_6368_ENET1_RXDMA_IRQ 0
992#define BCM_6368_ENET1_TXDMA_IRQ 0
993#define BCM_6368_PCI_IRQ (IRQ_INTERNAL_BASE + 13)
994#define BCM_6368_ATM_IRQ 0
995#define BCM_6368_ENETSW_RXDMA0_IRQ (BCM_6368_HIGH_IRQ_BASE + 0)
996#define BCM_6368_ENETSW_RXDMA1_IRQ (BCM_6368_HIGH_IRQ_BASE + 1)
997#define BCM_6368_ENETSW_RXDMA2_IRQ (BCM_6368_HIGH_IRQ_BASE + 2)
998#define BCM_6368_ENETSW_RXDMA3_IRQ (BCM_6368_HIGH_IRQ_BASE + 3)
999#define BCM_6368_ENETSW_TXDMA0_IRQ (BCM_6368_HIGH_IRQ_BASE + 4)
1000#define BCM_6368_ENETSW_TXDMA1_IRQ (BCM_6368_HIGH_IRQ_BASE + 5)
1001#define BCM_6368_ENETSW_TXDMA2_IRQ (BCM_6368_HIGH_IRQ_BASE + 6)
1002#define BCM_6368_ENETSW_TXDMA3_IRQ (BCM_6368_HIGH_IRQ_BASE + 7)
1003#define BCM_6368_XTM_IRQ (IRQ_INTERNAL_BASE + 11)
1004#define BCM_6368_XTM_DMA0_IRQ (BCM_6368_HIGH_IRQ_BASE + 8)
1005
1006#define BCM_6368_PCM_DMA0_IRQ (BCM_6368_HIGH_IRQ_BASE + 30)
1007#define BCM_6368_PCM_DMA1_IRQ (BCM_6368_HIGH_IRQ_BASE + 31)
1008#define BCM_6368_EXT_IRQ0 (IRQ_INTERNAL_BASE + 20)
1009#define BCM_6368_EXT_IRQ1 (IRQ_INTERNAL_BASE + 21)
1010#define BCM_6368_EXT_IRQ2 (IRQ_INTERNAL_BASE + 22)
1011#define BCM_6368_EXT_IRQ3 (IRQ_INTERNAL_BASE + 23)
1012#define BCM_6368_EXT_IRQ4 (IRQ_INTERNAL_BASE + 24)
1013#define BCM_6368_EXT_IRQ5 (IRQ_INTERNAL_BASE + 25)
1014
1015extern const int *bcm63xx_irqs;
1016
1017#define __GEN_CPU_IRQ_TABLE(__cpu) \
1018 [IRQ_TIMER] = BCM_## __cpu ##_TIMER_IRQ, \
1019 [IRQ_SPI] = BCM_## __cpu ##_SPI_IRQ, \
1020 [IRQ_UART0] = BCM_## __cpu ##_UART0_IRQ, \
1021 [IRQ_UART1] = BCM_## __cpu ##_UART1_IRQ, \
1022 [IRQ_DSL] = BCM_## __cpu ##_DSL_IRQ, \
1023 [IRQ_ENET0] = BCM_## __cpu ##_ENET0_IRQ, \
1024 [IRQ_ENET1] = BCM_## __cpu ##_ENET1_IRQ, \
1025 [IRQ_ENET_PHY] = BCM_## __cpu ##_ENET_PHY_IRQ, \
1026 [IRQ_HSSPI] = BCM_## __cpu ##_HSSPI_IRQ, \
1027 [IRQ_OHCI0] = BCM_## __cpu ##_OHCI0_IRQ, \
1028 [IRQ_EHCI0] = BCM_## __cpu ##_EHCI0_IRQ, \
1029 [IRQ_USBD] = BCM_## __cpu ##_USBD_IRQ, \
1030 [IRQ_USBD_RXDMA0] = BCM_## __cpu ##_USBD_RXDMA0_IRQ, \
1031 [IRQ_USBD_TXDMA0] = BCM_## __cpu ##_USBD_TXDMA0_IRQ, \
1032 [IRQ_USBD_RXDMA1] = BCM_## __cpu ##_USBD_RXDMA1_IRQ, \
1033 [IRQ_USBD_TXDMA1] = BCM_## __cpu ##_USBD_TXDMA1_IRQ, \
1034 [IRQ_USBD_RXDMA2] = BCM_## __cpu ##_USBD_RXDMA2_IRQ, \
1035 [IRQ_USBD_TXDMA2] = BCM_## __cpu ##_USBD_TXDMA2_IRQ, \
1036 [IRQ_ENET0_RXDMA] = BCM_## __cpu ##_ENET0_RXDMA_IRQ, \
1037 [IRQ_ENET0_TXDMA] = BCM_## __cpu ##_ENET0_TXDMA_IRQ, \
1038 [IRQ_ENET1_RXDMA] = BCM_## __cpu ##_ENET1_RXDMA_IRQ, \
1039 [IRQ_ENET1_TXDMA] = BCM_## __cpu ##_ENET1_TXDMA_IRQ, \
1040 [IRQ_PCI] = BCM_## __cpu ##_PCI_IRQ, \
1041 [IRQ_PCMCIA] = BCM_## __cpu ##_PCMCIA_IRQ, \
1042 [IRQ_ATM] = BCM_## __cpu ##_ATM_IRQ, \
1043 [IRQ_ENETSW_RXDMA0] = BCM_## __cpu ##_ENETSW_RXDMA0_IRQ, \
1044 [IRQ_ENETSW_RXDMA1] = BCM_## __cpu ##_ENETSW_RXDMA1_IRQ, \
1045 [IRQ_ENETSW_RXDMA2] = BCM_## __cpu ##_ENETSW_RXDMA2_IRQ, \
1046 [IRQ_ENETSW_RXDMA3] = BCM_## __cpu ##_ENETSW_RXDMA3_IRQ, \
1047 [IRQ_ENETSW_TXDMA0] = BCM_## __cpu ##_ENETSW_TXDMA0_IRQ, \
1048 [IRQ_ENETSW_TXDMA1] = BCM_## __cpu ##_ENETSW_TXDMA1_IRQ, \
1049 [IRQ_ENETSW_TXDMA2] = BCM_## __cpu ##_ENETSW_TXDMA2_IRQ, \
1050 [IRQ_ENETSW_TXDMA3] = BCM_## __cpu ##_ENETSW_TXDMA3_IRQ, \
1051 [IRQ_XTM] = BCM_## __cpu ##_XTM_IRQ, \
1052 [IRQ_XTM_DMA0] = BCM_## __cpu ##_XTM_DMA0_IRQ, \
1053
1054static inline int bcm63xx_get_irq_number(enum bcm63xx_irq irq)
1055{
1056 return bcm63xx_irqs[irq];
1057}
1058
1059/*
1060 * return installed memory size
1061 */
1062unsigned int bcm63xx_get_memory_size(void);
1063
1064void bcm63xx_machine_halt(void);
1065
1066void bcm63xx_machine_reboot(void);
1067
1068#endif /* !BCM63XX_CPU_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cs.h
new file mode 100644
index 000000000..1c634d7c1
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cs.h
@@ -0,0 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_CS_H
3#define BCM63XX_CS_H
4
5int bcm63xx_set_cs_base(unsigned int cs, u32 base, unsigned int size);
6int bcm63xx_set_cs_timing(unsigned int cs, unsigned int wait,
7 unsigned int setup, unsigned int hold);
8int bcm63xx_set_cs_param(unsigned int cs, u32 flags);
9int bcm63xx_set_cs_status(unsigned int cs, int enable);
10
11#endif /* !BCM63XX_CS_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
new file mode 100644
index 000000000..da39e4d32
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
@@ -0,0 +1,126 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_DEV_ENET_H_
3#define BCM63XX_DEV_ENET_H_
4
5#include <linux/if_ether.h>
6#include <linux/init.h>
7
8#include <bcm63xx_regs.h>
9
10/*
11 * on board ethernet platform data
12 */
13struct bcm63xx_enet_platform_data {
14 char mac_addr[ETH_ALEN];
15
16 int has_phy;
17
18 /* if has_phy, then set use_internal_phy */
19 int use_internal_phy;
20
21 /* or fill phy info to use an external one */
22 int phy_id;
23 int has_phy_interrupt;
24 int phy_interrupt;
25
26 /* if has_phy, use autonegotiated pause parameters or force
27 * them */
28 int pause_auto;
29 int pause_rx;
30 int pause_tx;
31
32 /* if !has_phy, set desired forced speed/duplex */
33 int force_speed_100;
34 int force_duplex_full;
35
36 /* if !has_phy, set callback to perform mii device
37 * init/remove */
38 int (*mii_config)(struct net_device *dev, int probe,
39 int (*mii_read)(struct net_device *dev,
40 int phy_id, int reg),
41 void (*mii_write)(struct net_device *dev,
42 int phy_id, int reg, int val));
43
44 /* DMA channel enable mask */
45 u32 dma_chan_en_mask;
46
47 /* DMA channel interrupt mask */
48 u32 dma_chan_int_mask;
49
50 /* DMA engine has internal SRAM */
51 bool dma_has_sram;
52
53 /* DMA channel register width */
54 unsigned int dma_chan_width;
55
56 /* DMA descriptor shift */
57 unsigned int dma_desc_shift;
58
59 /* dma channel ids */
60 int rx_chan;
61 int tx_chan;
62};
63
64/*
65 * on board ethernet switch platform data
66 */
67#define ENETSW_MAX_PORT 8
68#define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */
69#define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
70
71#define ENETSW_RGMII_PORT0 4
72
73struct bcm63xx_enetsw_port {
74 int used;
75 int phy_id;
76
77 int bypass_link;
78 int force_speed;
79 int force_duplex_full;
80
81 const char *name;
82};
83
84struct bcm63xx_enetsw_platform_data {
85 char mac_addr[ETH_ALEN];
86 int num_ports;
87 struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
88
89 /* DMA channel enable mask */
90 u32 dma_chan_en_mask;
91
92 /* DMA channel interrupt mask */
93 u32 dma_chan_int_mask;
94
95 /* DMA channel register width */
96 unsigned int dma_chan_width;
97
98 /* DMA engine has internal SRAM */
99 bool dma_has_sram;
100};
101
102int __init bcm63xx_enet_register(int unit,
103 const struct bcm63xx_enet_platform_data *pd);
104
105int bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
106
107enum bcm63xx_regs_enetdmac {
108 ENETDMAC_CHANCFG,
109 ENETDMAC_IR,
110 ENETDMAC_IRMASK,
111 ENETDMAC_MAXBURST,
112 ENETDMAC_BUFALLOC,
113 ENETDMAC_RSTART,
114 ENETDMAC_FC,
115 ENETDMAC_LEN,
116};
117
118static inline unsigned long bcm63xx_enetdmacreg(enum bcm63xx_regs_enetdmac reg)
119{
120 extern const unsigned long *bcm63xx_regs_enetdmac;
121
122 return bcm63xx_regs_enetdmac[reg];
123}
124
125
126#endif /* ! BCM63XX_DEV_ENET_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
new file mode 100644
index 000000000..4d5005f2b
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
@@ -0,0 +1,13 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __BCM63XX_FLASH_H
3#define __BCM63XX_FLASH_H
4
5enum {
6 BCM63XX_FLASH_TYPE_PARALLEL,
7 BCM63XX_FLASH_TYPE_SERIAL,
8 BCM63XX_FLASH_TYPE_NAND,
9};
10
11int __init bcm63xx_flash_register(void);
12
13#endif /* __BCM63XX_FLASH_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
new file mode 100644
index 000000000..f93f176c1
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_DEV_HSSPI_H
3#define BCM63XX_DEV_HSSPI_H
4
5#include <linux/types.h>
6
7int bcm63xx_hsspi_register(void);
8
9#endif /* BCM63XX_DEV_HSSPI_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pci.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pci.h
new file mode 100644
index 000000000..1951c125c
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pci.h
@@ -0,0 +1,7 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_DEV_PCI_H_
3#define BCM63XX_DEV_PCI_H_
4
5extern int bcm63xx_pci_enabled;
6
7#endif /* BCM63XX_DEV_PCI_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h
new file mode 100644
index 000000000..01674ac58
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h
@@ -0,0 +1,14 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_DEV_PCMCIA_H_
3#define BCM63XX_DEV_PCMCIA_H_
4
5/*
6 * PCMCIA driver platform data
7 */
8struct bcm63xx_pcmcia_platform_data {
9 unsigned int ready_gpio;
10};
11
12int bcm63xx_pcmcia_register(void);
13
14#endif /* BCM63XX_DEV_PCMCIA_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
new file mode 100644
index 000000000..0ab750522
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
@@ -0,0 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_DEV_SPI_H
3#define BCM63XX_DEV_SPI_H
4
5#include <linux/types.h>
6#include <bcm63xx_io.h>
7#include <bcm63xx_regs.h>
8
9int __init bcm63xx_spi_register(void);
10
11#endif /* BCM63XX_DEV_SPI_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h
new file mode 100644
index 000000000..88f8cf1c7
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h
@@ -0,0 +1,7 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_DEV_UART_H_
3#define BCM63XX_DEV_UART_H_
4
5int bcm63xx_uart_register(unsigned int id);
6
7#endif /* BCM63XX_DEV_UART_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_usbd.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_usbd.h
new file mode 100644
index 000000000..3f920baff
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_usbd.h
@@ -0,0 +1,18 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_DEV_USB_USBD_H_
3#define BCM63XX_DEV_USB_USBD_H_
4
5/*
6 * usb device platform data
7 */
8struct bcm63xx_usbd_platform_data {
9 /* board can only support full speed (USB 1.1) */
10 int use_fullspeed;
11
12 /* 0-based port index, for chips with >1 USB PHY */
13 int port_no;
14};
15
16int bcm63xx_usbd_register(const struct bcm63xx_usbd_platform_data *pd);
17
18#endif /* BCM63XX_DEV_USB_USBD_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
new file mode 100644
index 000000000..9212429d5
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
@@ -0,0 +1,35 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_GPIO_H
3#define BCM63XX_GPIO_H
4
5#include <linux/init.h>
6#include <bcm63xx_cpu.h>
7
8int __init bcm63xx_gpio_init(void);
9
10static inline unsigned long bcm63xx_gpio_count(void)
11{
12 switch (bcm63xx_get_cpu_id()) {
13 case BCM6328_CPU_ID:
14 return 32;
15 case BCM3368_CPU_ID:
16 return 40;
17 case BCM6338_CPU_ID:
18 return 8;
19 case BCM6345_CPU_ID:
20 return 16;
21 case BCM6358_CPU_ID:
22 case BCM6368_CPU_ID:
23 return 38;
24 case BCM6362_CPU_ID:
25 return 48;
26 case BCM6348_CPU_ID:
27 default:
28 return 37;
29 }
30}
31
32#define BCM63XX_GPIO_DIR_OUT 0x0
33#define BCM63XX_GPIO_DIR_IN 0x1
34
35#endif /* !BCM63XX_GPIO_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h
new file mode 100644
index 000000000..31c692433
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h
@@ -0,0 +1,104 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_IO_H_
3#define BCM63XX_IO_H_
4
5#include <asm/mach-bcm63xx/bcm63xx_cpu.h>
6
7/*
8 * Physical memory map, RAM is mapped at 0x0.
9 *
10 * Note that size MUST be a power of two.
11 */
12#define BCM_PCMCIA_COMMON_BASE_PA (0x20000000)
13#define BCM_PCMCIA_COMMON_SIZE (16 * 1024 * 1024)
14#define BCM_PCMCIA_COMMON_END_PA (BCM_PCMCIA_COMMON_BASE_PA + \
15 BCM_PCMCIA_COMMON_SIZE - 1)
16
17#define BCM_PCMCIA_ATTR_BASE_PA (0x21000000)
18#define BCM_PCMCIA_ATTR_SIZE (16 * 1024 * 1024)
19#define BCM_PCMCIA_ATTR_END_PA (BCM_PCMCIA_ATTR_BASE_PA + \
20 BCM_PCMCIA_ATTR_SIZE - 1)
21
22#define BCM_PCMCIA_IO_BASE_PA (0x22000000)
23#define BCM_PCMCIA_IO_SIZE (64 * 1024)
24#define BCM_PCMCIA_IO_END_PA (BCM_PCMCIA_IO_BASE_PA + \
25 BCM_PCMCIA_IO_SIZE - 1)
26
27#define BCM_PCI_MEM_BASE_PA (0x30000000)
28#define BCM_PCI_MEM_SIZE (128 * 1024 * 1024)
29#define BCM_PCI_MEM_END_PA (BCM_PCI_MEM_BASE_PA + \
30 BCM_PCI_MEM_SIZE - 1)
31
32#define BCM_PCI_IO_BASE_PA (0x08000000)
33#define BCM_PCI_IO_SIZE (64 * 1024)
34#define BCM_PCI_IO_END_PA (BCM_PCI_IO_BASE_PA + \
35 BCM_PCI_IO_SIZE - 1)
36#define BCM_PCI_IO_HALF_PA (BCM_PCI_IO_BASE_PA + \
37 (BCM_PCI_IO_SIZE / 2) - 1)
38
39#define BCM_CB_MEM_BASE_PA (0x38000000)
40#define BCM_CB_MEM_SIZE (128 * 1024 * 1024)
41#define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \
42 BCM_CB_MEM_SIZE - 1)
43
44#define BCM_PCIE_MEM_BASE_PA 0x10f00000
45#define BCM_PCIE_MEM_SIZE (16 * 1024 * 1024)
46#define BCM_PCIE_MEM_END_PA (BCM_PCIE_MEM_BASE_PA + \
47 BCM_PCIE_MEM_SIZE - 1)
48
49/*
50 * Internal registers are accessed through KSEG3
51 */
52#define BCM_REGS_VA(x) ((void __iomem *)(x))
53
54#define bcm_readb(a) (*(volatile unsigned char *) BCM_REGS_VA(a))
55#define bcm_readw(a) (*(volatile unsigned short *) BCM_REGS_VA(a))
56#define bcm_readl(a) (*(volatile unsigned int *) BCM_REGS_VA(a))
57#define bcm_readq(a) (*(volatile u64 *) BCM_REGS_VA(a))
58#define bcm_writeb(v, a) (*(volatile unsigned char *) BCM_REGS_VA((a)) = (v))
59#define bcm_writew(v, a) (*(volatile unsigned short *) BCM_REGS_VA((a)) = (v))
60#define bcm_writel(v, a) (*(volatile unsigned int *) BCM_REGS_VA((a)) = (v))
61#define bcm_writeq(v, a) (*(volatile u64 *) BCM_REGS_VA((a)) = (v))
62
63/*
64 * IO helpers to access register set for current CPU
65 */
66#define bcm_rset_readb(s, o) bcm_readb(bcm63xx_regset_address(s) + (o))
67#define bcm_rset_readw(s, o) bcm_readw(bcm63xx_regset_address(s) + (o))
68#define bcm_rset_readl(s, o) bcm_readl(bcm63xx_regset_address(s) + (o))
69#define bcm_rset_writeb(s, v, o) bcm_writeb((v), \
70 bcm63xx_regset_address(s) + (o))
71#define bcm_rset_writew(s, v, o) bcm_writew((v), \
72 bcm63xx_regset_address(s) + (o))
73#define bcm_rset_writel(s, v, o) bcm_writel((v), \
74 bcm63xx_regset_address(s) + (o))
75
76/*
77 * helpers for frequently used register sets
78 */
79#define bcm_perf_readl(o) bcm_rset_readl(RSET_PERF, (o))
80#define bcm_perf_writel(v, o) bcm_rset_writel(RSET_PERF, (v), (o))
81#define bcm_timer_readl(o) bcm_rset_readl(RSET_TIMER, (o))
82#define bcm_timer_writel(v, o) bcm_rset_writel(RSET_TIMER, (v), (o))
83#define bcm_wdt_readl(o) bcm_rset_readl(RSET_WDT, (o))
84#define bcm_wdt_writel(v, o) bcm_rset_writel(RSET_WDT, (v), (o))
85#define bcm_gpio_readl(o) bcm_rset_readl(RSET_GPIO, (o))
86#define bcm_gpio_writel(v, o) bcm_rset_writel(RSET_GPIO, (v), (o))
87#define bcm_uart0_readl(o) bcm_rset_readl(RSET_UART0, (o))
88#define bcm_uart0_writel(v, o) bcm_rset_writel(RSET_UART0, (v), (o))
89#define bcm_mpi_readl(o) bcm_rset_readl(RSET_MPI, (o))
90#define bcm_mpi_writel(v, o) bcm_rset_writel(RSET_MPI, (v), (o))
91#define bcm_pcmcia_readl(o) bcm_rset_readl(RSET_PCMCIA, (o))
92#define bcm_pcmcia_writel(v, o) bcm_rset_writel(RSET_PCMCIA, (v), (o))
93#define bcm_pcie_readl(o) bcm_rset_readl(RSET_PCIE, (o))
94#define bcm_pcie_writel(v, o) bcm_rset_writel(RSET_PCIE, (v), (o))
95#define bcm_sdram_readl(o) bcm_rset_readl(RSET_SDRAM, (o))
96#define bcm_sdram_writel(v, o) bcm_rset_writel(RSET_SDRAM, (v), (o))
97#define bcm_memc_readl(o) bcm_rset_readl(RSET_MEMC, (o))
98#define bcm_memc_writel(v, o) bcm_rset_writel(RSET_MEMC, (v), (o))
99#define bcm_ddr_readl(o) bcm_rset_readl(RSET_DDR, (o))
100#define bcm_ddr_writel(v, o) bcm_rset_writel(RSET_DDR, (v), (o))
101#define bcm_misc_readl(o) bcm_rset_readl(RSET_MISC, (o))
102#define bcm_misc_writel(v, o) bcm_rset_writel(RSET_MISC, (v), (o))
103
104#endif /* ! BCM63XX_IO_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h
new file mode 100644
index 000000000..7887bc690
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h
@@ -0,0 +1,14 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_IRQ_H_
3#define BCM63XX_IRQ_H_
4
5#include <bcm63xx_cpu.h>
6
7#define IRQ_INTERNAL_BASE 8
8#define IRQ_EXTERNAL_BASE 100
9#define IRQ_EXT_0 (IRQ_EXTERNAL_BASE + 0)
10#define IRQ_EXT_1 (IRQ_EXTERNAL_BASE + 1)
11#define IRQ_EXT_2 (IRQ_EXTERNAL_BASE + 2)
12#define IRQ_EXT_3 (IRQ_EXTERNAL_BASE + 3)
13
14#endif /* ! BCM63XX_IRQ_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_iudma.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_iudma.h
new file mode 100644
index 000000000..73df916e4
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_iudma.h
@@ -0,0 +1,39 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_IUDMA_H_
3#define BCM63XX_IUDMA_H_
4
5#include <linux/types.h>
6
7/*
8 * rx/tx dma descriptor
9 */
10struct bcm_enet_desc {
11 u32 len_stat;
12 u32 address;
13};
14
15/* control */
16#define DMADESC_LENGTH_SHIFT 16
17#define DMADESC_LENGTH_MASK (0xfff << DMADESC_LENGTH_SHIFT)
18#define DMADESC_OWNER_MASK (1 << 15)
19#define DMADESC_EOP_MASK (1 << 14)
20#define DMADESC_SOP_MASK (1 << 13)
21#define DMADESC_ESOP_MASK (DMADESC_EOP_MASK | DMADESC_SOP_MASK)
22#define DMADESC_WRAP_MASK (1 << 12)
23#define DMADESC_USB_NOZERO_MASK (1 << 1)
24#define DMADESC_USB_ZERO_MASK (1 << 0)
25
26/* status */
27#define DMADESC_UNDER_MASK (1 << 9)
28#define DMADESC_APPEND_CRC (1 << 8)
29#define DMADESC_OVSIZE_MASK (1 << 4)
30#define DMADESC_RXER_MASK (1 << 2)
31#define DMADESC_CRC_MASK (1 << 1)
32#define DMADESC_OV_MASK (1 << 0)
33#define DMADESC_ERR_MASK (DMADESC_UNDER_MASK | \
34 DMADESC_OVSIZE_MASK | \
35 DMADESC_RXER_MASK | \
36 DMADESC_CRC_MASK | \
37 DMADESC_OV_MASK)
38
39#endif /* ! BCM63XX_IUDMA_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
new file mode 100644
index 000000000..f78d725f2
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_NVRAM_H
3#define BCM63XX_NVRAM_H
4
5#include <linux/types.h>
6
7/**
8 * bcm63xx_nvram_init() - initializes nvram
9 * @nvram: address of the nvram data
10 *
11 * Initialized the local nvram copy from the target address and checks
12 * its checksum.
13 */
14void bcm63xx_nvram_init(void *nvram);
15
16/**
17 * bcm63xx_nvram_get_name() - returns the board name according to nvram
18 *
19 * Returns the board name field from nvram. Note that it might not be
20 * null terminated if it is exactly 16 bytes long.
21 */
22u8 *bcm63xx_nvram_get_name(void);
23
24/**
25 * bcm63xx_nvram_get_mac_address() - register & return a new mac address
26 * @mac: pointer to array for allocated mac
27 *
28 * Registers and returns a mac address from the allocated macs from nvram.
29 *
30 * Returns 0 on success.
31 */
32int bcm63xx_nvram_get_mac_address(u8 *mac);
33
34int bcm63xx_nvram_get_psi_size(void);
35
36#endif /* BCM63XX_NVRAM_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
new file mode 100644
index 000000000..9ceb5e728
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -0,0 +1,1431 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_REGS_H_
3#define BCM63XX_REGS_H_
4
5/*************************************************************************
6 * _REG relative to RSET_PERF
7 *************************************************************************/
8
9/* Chip Identifier / Revision register */
10#define PERF_REV_REG 0x0
11#define REV_CHIPID_SHIFT 16
12#define REV_CHIPID_MASK (0xffff << REV_CHIPID_SHIFT)
13#define REV_REVID_SHIFT 0
14#define REV_REVID_MASK (0xff << REV_REVID_SHIFT)
15
16/* Clock Control register */
17#define PERF_CKCTL_REG 0x4
18
19#define CKCTL_3368_MAC_EN (1 << 3)
20#define CKCTL_3368_TC_EN (1 << 5)
21#define CKCTL_3368_US_TOP_EN (1 << 6)
22#define CKCTL_3368_DS_TOP_EN (1 << 7)
23#define CKCTL_3368_APM_EN (1 << 8)
24#define CKCTL_3368_SPI_EN (1 << 9)
25#define CKCTL_3368_USBS_EN (1 << 10)
26#define CKCTL_3368_BMU_EN (1 << 11)
27#define CKCTL_3368_PCM_EN (1 << 12)
28#define CKCTL_3368_NTP_EN (1 << 13)
29#define CKCTL_3368_ACP_B_EN (1 << 14)
30#define CKCTL_3368_ACP_A_EN (1 << 15)
31#define CKCTL_3368_EMUSB_EN (1 << 17)
32#define CKCTL_3368_ENET0_EN (1 << 18)
33#define CKCTL_3368_ENET1_EN (1 << 19)
34#define CKCTL_3368_USBU_EN (1 << 20)
35#define CKCTL_3368_EPHY_EN (1 << 21)
36
37#define CKCTL_3368_ALL_SAFE_EN (CKCTL_3368_MAC_EN | \
38 CKCTL_3368_TC_EN | \
39 CKCTL_3368_US_TOP_EN | \
40 CKCTL_3368_DS_TOP_EN | \
41 CKCTL_3368_APM_EN | \
42 CKCTL_3368_SPI_EN | \
43 CKCTL_3368_USBS_EN | \
44 CKCTL_3368_BMU_EN | \
45 CKCTL_3368_PCM_EN | \
46 CKCTL_3368_NTP_EN | \
47 CKCTL_3368_ACP_B_EN | \
48 CKCTL_3368_ACP_A_EN | \
49 CKCTL_3368_EMUSB_EN | \
50 CKCTL_3368_USBU_EN)
51
52#define CKCTL_6328_PHYMIPS_EN (1 << 0)
53#define CKCTL_6328_ADSL_QPROC_EN (1 << 1)
54#define CKCTL_6328_ADSL_AFE_EN (1 << 2)
55#define CKCTL_6328_ADSL_EN (1 << 3)
56#define CKCTL_6328_MIPS_EN (1 << 4)
57#define CKCTL_6328_SAR_EN (1 << 5)
58#define CKCTL_6328_PCM_EN (1 << 6)
59#define CKCTL_6328_USBD_EN (1 << 7)
60#define CKCTL_6328_USBH_EN (1 << 8)
61#define CKCTL_6328_HSSPI_EN (1 << 9)
62#define CKCTL_6328_PCIE_EN (1 << 10)
63#define CKCTL_6328_ROBOSW_EN (1 << 11)
64
65#define CKCTL_6328_ALL_SAFE_EN (CKCTL_6328_PHYMIPS_EN | \
66 CKCTL_6328_ADSL_QPROC_EN | \
67 CKCTL_6328_ADSL_AFE_EN | \
68 CKCTL_6328_ADSL_EN | \
69 CKCTL_6328_SAR_EN | \
70 CKCTL_6328_PCM_EN | \
71 CKCTL_6328_USBD_EN | \
72 CKCTL_6328_USBH_EN | \
73 CKCTL_6328_ROBOSW_EN | \
74 CKCTL_6328_PCIE_EN)
75
76#define CKCTL_6338_ADSLPHY_EN (1 << 0)
77#define CKCTL_6338_MPI_EN (1 << 1)
78#define CKCTL_6338_DRAM_EN (1 << 2)
79#define CKCTL_6338_ENET_EN (1 << 4)
80#define CKCTL_6338_USBS_EN (1 << 4)
81#define CKCTL_6338_SAR_EN (1 << 5)
82#define CKCTL_6338_SPI_EN (1 << 9)
83
84#define CKCTL_6338_ALL_SAFE_EN (CKCTL_6338_ADSLPHY_EN | \
85 CKCTL_6338_MPI_EN | \
86 CKCTL_6338_ENET_EN | \
87 CKCTL_6338_SAR_EN | \
88 CKCTL_6338_SPI_EN)
89
90/* BCM6345 clock bits are shifted by 16 on the left, because of the test
91 * control register which is 16-bits wide. That way we do not have any
92 * specific BCM6345 code for handling clocks, and writing 0 to the test
93 * control register is fine.
94 */
95#define CKCTL_6345_CPU_EN (1 << 16)
96#define CKCTL_6345_BUS_EN (1 << 17)
97#define CKCTL_6345_EBI_EN (1 << 18)
98#define CKCTL_6345_UART_EN (1 << 19)
99#define CKCTL_6345_ADSLPHY_EN (1 << 20)
100#define CKCTL_6345_ENET_EN (1 << 23)
101#define CKCTL_6345_USBH_EN (1 << 24)
102
103#define CKCTL_6345_ALL_SAFE_EN (CKCTL_6345_ENET_EN | \
104 CKCTL_6345_USBH_EN | \
105 CKCTL_6345_ADSLPHY_EN)
106
107#define CKCTL_6348_ADSLPHY_EN (1 << 0)
108#define CKCTL_6348_MPI_EN (1 << 1)
109#define CKCTL_6348_SDRAM_EN (1 << 2)
110#define CKCTL_6348_M2M_EN (1 << 3)
111#define CKCTL_6348_ENET_EN (1 << 4)
112#define CKCTL_6348_SAR_EN (1 << 5)
113#define CKCTL_6348_USBS_EN (1 << 6)
114#define CKCTL_6348_USBH_EN (1 << 8)
115#define CKCTL_6348_SPI_EN (1 << 9)
116
117#define CKCTL_6348_ALL_SAFE_EN (CKCTL_6348_ADSLPHY_EN | \
118 CKCTL_6348_M2M_EN | \
119 CKCTL_6348_ENET_EN | \
120 CKCTL_6348_SAR_EN | \
121 CKCTL_6348_USBS_EN | \
122 CKCTL_6348_USBH_EN | \
123 CKCTL_6348_SPI_EN)
124
125#define CKCTL_6358_ENET_EN (1 << 4)
126#define CKCTL_6358_ADSLPHY_EN (1 << 5)
127#define CKCTL_6358_PCM_EN (1 << 8)
128#define CKCTL_6358_SPI_EN (1 << 9)
129#define CKCTL_6358_USBS_EN (1 << 10)
130#define CKCTL_6358_SAR_EN (1 << 11)
131#define CKCTL_6358_EMUSB_EN (1 << 17)
132#define CKCTL_6358_ENET0_EN (1 << 18)
133#define CKCTL_6358_ENET1_EN (1 << 19)
134#define CKCTL_6358_USBSU_EN (1 << 20)
135#define CKCTL_6358_EPHY_EN (1 << 21)
136
137#define CKCTL_6358_ALL_SAFE_EN (CKCTL_6358_ENET_EN | \
138 CKCTL_6358_ADSLPHY_EN | \
139 CKCTL_6358_PCM_EN | \
140 CKCTL_6358_SPI_EN | \
141 CKCTL_6358_USBS_EN | \
142 CKCTL_6358_SAR_EN | \
143 CKCTL_6358_EMUSB_EN | \
144 CKCTL_6358_ENET0_EN | \
145 CKCTL_6358_ENET1_EN | \
146 CKCTL_6358_USBSU_EN | \
147 CKCTL_6358_EPHY_EN)
148
149#define CKCTL_6362_ADSL_QPROC_EN (1 << 1)
150#define CKCTL_6362_ADSL_AFE_EN (1 << 2)
151#define CKCTL_6362_ADSL_EN (1 << 3)
152#define CKCTL_6362_MIPS_EN (1 << 4)
153#define CKCTL_6362_WLAN_OCP_EN (1 << 5)
154#define CKCTL_6362_SWPKT_USB_EN (1 << 7)
155#define CKCTL_6362_SWPKT_SAR_EN (1 << 8)
156#define CKCTL_6362_SAR_EN (1 << 9)
157#define CKCTL_6362_ROBOSW_EN (1 << 10)
158#define CKCTL_6362_PCM_EN (1 << 11)
159#define CKCTL_6362_USBD_EN (1 << 12)
160#define CKCTL_6362_USBH_EN (1 << 13)
161#define CKCTL_6362_IPSEC_EN (1 << 14)
162#define CKCTL_6362_SPI_EN (1 << 15)
163#define CKCTL_6362_HSSPI_EN (1 << 16)
164#define CKCTL_6362_PCIE_EN (1 << 17)
165#define CKCTL_6362_FAP_EN (1 << 18)
166#define CKCTL_6362_PHYMIPS_EN (1 << 19)
167#define CKCTL_6362_NAND_EN (1 << 20)
168
169#define CKCTL_6362_ALL_SAFE_EN (CKCTL_6362_PHYMIPS_EN | \
170 CKCTL_6362_ADSL_QPROC_EN | \
171 CKCTL_6362_ADSL_AFE_EN | \
172 CKCTL_6362_ADSL_EN | \
173 CKCTL_6362_SAR_EN | \
174 CKCTL_6362_PCM_EN | \
175 CKCTL_6362_IPSEC_EN | \
176 CKCTL_6362_USBD_EN | \
177 CKCTL_6362_USBH_EN | \
178 CKCTL_6362_ROBOSW_EN | \
179 CKCTL_6362_PCIE_EN)
180
181
182#define CKCTL_6368_VDSL_QPROC_EN (1 << 2)
183#define CKCTL_6368_VDSL_AFE_EN (1 << 3)
184#define CKCTL_6368_VDSL_BONDING_EN (1 << 4)
185#define CKCTL_6368_VDSL_EN (1 << 5)
186#define CKCTL_6368_PHYMIPS_EN (1 << 6)
187#define CKCTL_6368_SWPKT_USB_EN (1 << 7)
188#define CKCTL_6368_SWPKT_SAR_EN (1 << 8)
189#define CKCTL_6368_SPI_EN (1 << 9)
190#define CKCTL_6368_USBD_EN (1 << 10)
191#define CKCTL_6368_SAR_EN (1 << 11)
192#define CKCTL_6368_ROBOSW_EN (1 << 12)
193#define CKCTL_6368_UTOPIA_EN (1 << 13)
194#define CKCTL_6368_PCM_EN (1 << 14)
195#define CKCTL_6368_USBH_EN (1 << 15)
196#define CKCTL_6368_DISABLE_GLESS_EN (1 << 16)
197#define CKCTL_6368_NAND_EN (1 << 17)
198#define CKCTL_6368_IPSEC_EN (1 << 18)
199
200#define CKCTL_6368_ALL_SAFE_EN (CKCTL_6368_SWPKT_USB_EN | \
201 CKCTL_6368_SWPKT_SAR_EN | \
202 CKCTL_6368_SPI_EN | \
203 CKCTL_6368_USBD_EN | \
204 CKCTL_6368_SAR_EN | \
205 CKCTL_6368_ROBOSW_EN | \
206 CKCTL_6368_UTOPIA_EN | \
207 CKCTL_6368_PCM_EN | \
208 CKCTL_6368_USBH_EN | \
209 CKCTL_6368_DISABLE_GLESS_EN | \
210 CKCTL_6368_NAND_EN | \
211 CKCTL_6368_IPSEC_EN)
212
213/* System PLL Control register */
214#define PERF_SYS_PLL_CTL_REG 0x8
215#define SYS_PLL_SOFT_RESET 0x1
216
217/* Interrupt Mask register */
218#define PERF_IRQMASK_3368_REG 0xc
219#define PERF_IRQMASK_6328_REG(x) (0x20 + (x) * 0x10)
220#define PERF_IRQMASK_6338_REG 0xc
221#define PERF_IRQMASK_6345_REG 0xc
222#define PERF_IRQMASK_6348_REG 0xc
223#define PERF_IRQMASK_6358_REG(x) (0xc + (x) * 0x2c)
224#define PERF_IRQMASK_6362_REG(x) (0x20 + (x) * 0x10)
225#define PERF_IRQMASK_6368_REG(x) (0x20 + (x) * 0x10)
226
227/* Interrupt Status register */
228#define PERF_IRQSTAT_3368_REG 0x10
229#define PERF_IRQSTAT_6328_REG(x) (0x28 + (x) * 0x10)
230#define PERF_IRQSTAT_6338_REG 0x10
231#define PERF_IRQSTAT_6345_REG 0x10
232#define PERF_IRQSTAT_6348_REG 0x10
233#define PERF_IRQSTAT_6358_REG(x) (0x10 + (x) * 0x2c)
234#define PERF_IRQSTAT_6362_REG(x) (0x28 + (x) * 0x10)
235#define PERF_IRQSTAT_6368_REG(x) (0x28 + (x) * 0x10)
236
237/* External Interrupt Configuration register */
238#define PERF_EXTIRQ_CFG_REG_3368 0x14
239#define PERF_EXTIRQ_CFG_REG_6328 0x18
240#define PERF_EXTIRQ_CFG_REG_6338 0x14
241#define PERF_EXTIRQ_CFG_REG_6345 0x14
242#define PERF_EXTIRQ_CFG_REG_6348 0x14
243#define PERF_EXTIRQ_CFG_REG_6358 0x14
244#define PERF_EXTIRQ_CFG_REG_6362 0x18
245#define PERF_EXTIRQ_CFG_REG_6368 0x18
246
247#define PERF_EXTIRQ_CFG_REG2_6368 0x1c
248
249/* for 6348 only */
250#define EXTIRQ_CFG_SENSE_6348(x) (1 << (x))
251#define EXTIRQ_CFG_STAT_6348(x) (1 << (x + 5))
252#define EXTIRQ_CFG_CLEAR_6348(x) (1 << (x + 10))
253#define EXTIRQ_CFG_MASK_6348(x) (1 << (x + 15))
254#define EXTIRQ_CFG_BOTHEDGE_6348(x) (1 << (x + 20))
255#define EXTIRQ_CFG_LEVELSENSE_6348(x) (1 << (x + 25))
256#define EXTIRQ_CFG_CLEAR_ALL_6348 (0xf << 10)
257#define EXTIRQ_CFG_MASK_ALL_6348 (0xf << 15)
258
259/* for all others */
260#define EXTIRQ_CFG_SENSE(x) (1 << (x))
261#define EXTIRQ_CFG_STAT(x) (1 << (x + 4))
262#define EXTIRQ_CFG_CLEAR(x) (1 << (x + 8))
263#define EXTIRQ_CFG_MASK(x) (1 << (x + 12))
264#define EXTIRQ_CFG_BOTHEDGE(x) (1 << (x + 16))
265#define EXTIRQ_CFG_LEVELSENSE(x) (1 << (x + 20))
266#define EXTIRQ_CFG_CLEAR_ALL (0xf << 8)
267#define EXTIRQ_CFG_MASK_ALL (0xf << 12)
268
269/* Soft Reset register */
270#define PERF_SOFTRESET_REG 0x28
271#define PERF_SOFTRESET_6328_REG 0x10
272#define PERF_SOFTRESET_6358_REG 0x34
273#define PERF_SOFTRESET_6362_REG 0x10
274#define PERF_SOFTRESET_6368_REG 0x10
275
276#define SOFTRESET_3368_SPI_MASK (1 << 0)
277#define SOFTRESET_3368_ENET_MASK (1 << 2)
278#define SOFTRESET_3368_MPI_MASK (1 << 3)
279#define SOFTRESET_3368_EPHY_MASK (1 << 6)
280#define SOFTRESET_3368_USBS_MASK (1 << 11)
281#define SOFTRESET_3368_PCM_MASK (1 << 13)
282
283#define SOFTRESET_6328_SPI_MASK (1 << 0)
284#define SOFTRESET_6328_EPHY_MASK (1 << 1)
285#define SOFTRESET_6328_SAR_MASK (1 << 2)
286#define SOFTRESET_6328_ENETSW_MASK (1 << 3)
287#define SOFTRESET_6328_USBS_MASK (1 << 4)
288#define SOFTRESET_6328_USBH_MASK (1 << 5)
289#define SOFTRESET_6328_PCM_MASK (1 << 6)
290#define SOFTRESET_6328_PCIE_CORE_MASK (1 << 7)
291#define SOFTRESET_6328_PCIE_MASK (1 << 8)
292#define SOFTRESET_6328_PCIE_EXT_MASK (1 << 9)
293#define SOFTRESET_6328_PCIE_HARD_MASK (1 << 10)
294
295#define SOFTRESET_6338_SPI_MASK (1 << 0)
296#define SOFTRESET_6338_ENET_MASK (1 << 2)
297#define SOFTRESET_6338_USBH_MASK (1 << 3)
298#define SOFTRESET_6338_USBS_MASK (1 << 4)
299#define SOFTRESET_6338_ADSL_MASK (1 << 5)
300#define SOFTRESET_6338_DMAMEM_MASK (1 << 6)
301#define SOFTRESET_6338_SAR_MASK (1 << 7)
302#define SOFTRESET_6338_ACLC_MASK (1 << 8)
303#define SOFTRESET_6338_ADSLMIPSPLL_MASK (1 << 10)
304#define SOFTRESET_6338_ALL (SOFTRESET_6338_SPI_MASK | \
305 SOFTRESET_6338_ENET_MASK | \
306 SOFTRESET_6338_USBH_MASK | \
307 SOFTRESET_6338_USBS_MASK | \
308 SOFTRESET_6338_ADSL_MASK | \
309 SOFTRESET_6338_DMAMEM_MASK | \
310 SOFTRESET_6338_SAR_MASK | \
311 SOFTRESET_6338_ACLC_MASK | \
312 SOFTRESET_6338_ADSLMIPSPLL_MASK)
313
314#define SOFTRESET_6348_SPI_MASK (1 << 0)
315#define SOFTRESET_6348_ENET_MASK (1 << 2)
316#define SOFTRESET_6348_USBH_MASK (1 << 3)
317#define SOFTRESET_6348_USBS_MASK (1 << 4)
318#define SOFTRESET_6348_ADSL_MASK (1 << 5)
319#define SOFTRESET_6348_DMAMEM_MASK (1 << 6)
320#define SOFTRESET_6348_SAR_MASK (1 << 7)
321#define SOFTRESET_6348_ACLC_MASK (1 << 8)
322#define SOFTRESET_6348_ADSLMIPSPLL_MASK (1 << 10)
323
324#define SOFTRESET_6348_ALL (SOFTRESET_6348_SPI_MASK | \
325 SOFTRESET_6348_ENET_MASK | \
326 SOFTRESET_6348_USBH_MASK | \
327 SOFTRESET_6348_USBS_MASK | \
328 SOFTRESET_6348_ADSL_MASK | \
329 SOFTRESET_6348_DMAMEM_MASK | \
330 SOFTRESET_6348_SAR_MASK | \
331 SOFTRESET_6348_ACLC_MASK | \
332 SOFTRESET_6348_ADSLMIPSPLL_MASK)
333
334#define SOFTRESET_6358_SPI_MASK (1 << 0)
335#define SOFTRESET_6358_ENET_MASK (1 << 2)
336#define SOFTRESET_6358_MPI_MASK (1 << 3)
337#define SOFTRESET_6358_EPHY_MASK (1 << 6)
338#define SOFTRESET_6358_SAR_MASK (1 << 7)
339#define SOFTRESET_6358_USBH_MASK (1 << 12)
340#define SOFTRESET_6358_PCM_MASK (1 << 13)
341#define SOFTRESET_6358_ADSL_MASK (1 << 14)
342
343#define SOFTRESET_6362_SPI_MASK (1 << 0)
344#define SOFTRESET_6362_IPSEC_MASK (1 << 1)
345#define SOFTRESET_6362_EPHY_MASK (1 << 2)
346#define SOFTRESET_6362_SAR_MASK (1 << 3)
347#define SOFTRESET_6362_ENETSW_MASK (1 << 4)
348#define SOFTRESET_6362_USBS_MASK (1 << 5)
349#define SOFTRESET_6362_USBH_MASK (1 << 6)
350#define SOFTRESET_6362_PCM_MASK (1 << 7)
351#define SOFTRESET_6362_PCIE_CORE_MASK (1 << 8)
352#define SOFTRESET_6362_PCIE_MASK (1 << 9)
353#define SOFTRESET_6362_PCIE_EXT_MASK (1 << 10)
354#define SOFTRESET_6362_WLAN_SHIM_MASK (1 << 11)
355#define SOFTRESET_6362_DDR_PHY_MASK (1 << 12)
356#define SOFTRESET_6362_FAP_MASK (1 << 13)
357#define SOFTRESET_6362_WLAN_UBUS_MASK (1 << 14)
358
359#define SOFTRESET_6368_SPI_MASK (1 << 0)
360#define SOFTRESET_6368_MPI_MASK (1 << 3)
361#define SOFTRESET_6368_EPHY_MASK (1 << 6)
362#define SOFTRESET_6368_SAR_MASK (1 << 7)
363#define SOFTRESET_6368_ENETSW_MASK (1 << 10)
364#define SOFTRESET_6368_USBS_MASK (1 << 11)
365#define SOFTRESET_6368_USBH_MASK (1 << 12)
366#define SOFTRESET_6368_PCM_MASK (1 << 13)
367
368/* MIPS PLL control register */
369#define PERF_MIPSPLLCTL_REG 0x34
370#define MIPSPLLCTL_N1_SHIFT 20
371#define MIPSPLLCTL_N1_MASK (0x7 << MIPSPLLCTL_N1_SHIFT)
372#define MIPSPLLCTL_N2_SHIFT 15
373#define MIPSPLLCTL_N2_MASK (0x1f << MIPSPLLCTL_N2_SHIFT)
374#define MIPSPLLCTL_M1REF_SHIFT 12
375#define MIPSPLLCTL_M1REF_MASK (0x7 << MIPSPLLCTL_M1REF_SHIFT)
376#define MIPSPLLCTL_M2REF_SHIFT 9
377#define MIPSPLLCTL_M2REF_MASK (0x7 << MIPSPLLCTL_M2REF_SHIFT)
378#define MIPSPLLCTL_M1CPU_SHIFT 6
379#define MIPSPLLCTL_M1CPU_MASK (0x7 << MIPSPLLCTL_M1CPU_SHIFT)
380#define MIPSPLLCTL_M1BUS_SHIFT 3
381#define MIPSPLLCTL_M1BUS_MASK (0x7 << MIPSPLLCTL_M1BUS_SHIFT)
382#define MIPSPLLCTL_M2BUS_SHIFT 0
383#define MIPSPLLCTL_M2BUS_MASK (0x7 << MIPSPLLCTL_M2BUS_SHIFT)
384
385/* ADSL PHY PLL Control register */
386#define PERF_ADSLPLLCTL_REG 0x38
387#define ADSLPLLCTL_N1_SHIFT 20
388#define ADSLPLLCTL_N1_MASK (0x7 << ADSLPLLCTL_N1_SHIFT)
389#define ADSLPLLCTL_N2_SHIFT 15
390#define ADSLPLLCTL_N2_MASK (0x1f << ADSLPLLCTL_N2_SHIFT)
391#define ADSLPLLCTL_M1REF_SHIFT 12
392#define ADSLPLLCTL_M1REF_MASK (0x7 << ADSLPLLCTL_M1REF_SHIFT)
393#define ADSLPLLCTL_M2REF_SHIFT 9
394#define ADSLPLLCTL_M2REF_MASK (0x7 << ADSLPLLCTL_M2REF_SHIFT)
395#define ADSLPLLCTL_M1CPU_SHIFT 6
396#define ADSLPLLCTL_M1CPU_MASK (0x7 << ADSLPLLCTL_M1CPU_SHIFT)
397#define ADSLPLLCTL_M1BUS_SHIFT 3
398#define ADSLPLLCTL_M1BUS_MASK (0x7 << ADSLPLLCTL_M1BUS_SHIFT)
399#define ADSLPLLCTL_M2BUS_SHIFT 0
400#define ADSLPLLCTL_M2BUS_MASK (0x7 << ADSLPLLCTL_M2BUS_SHIFT)
401
402#define ADSLPLLCTL_VAL(n1, n2, m1ref, m2ref, m1cpu, m1bus, m2bus) \
403 (((n1) << ADSLPLLCTL_N1_SHIFT) | \
404 ((n2) << ADSLPLLCTL_N2_SHIFT) | \
405 ((m1ref) << ADSLPLLCTL_M1REF_SHIFT) | \
406 ((m2ref) << ADSLPLLCTL_M2REF_SHIFT) | \
407 ((m1cpu) << ADSLPLLCTL_M1CPU_SHIFT) | \
408 ((m1bus) << ADSLPLLCTL_M1BUS_SHIFT) | \
409 ((m2bus) << ADSLPLLCTL_M2BUS_SHIFT))
410
411
412/*************************************************************************
413 * _REG relative to RSET_TIMER
414 *************************************************************************/
415
416#define BCM63XX_TIMER_COUNT 4
417#define TIMER_T0_ID 0
418#define TIMER_T1_ID 1
419#define TIMER_T2_ID 2
420#define TIMER_WDT_ID 3
421
422/* Timer irqstat register */
423#define TIMER_IRQSTAT_REG 0
424#define TIMER_IRQSTAT_TIMER_CAUSE(x) (1 << (x))
425#define TIMER_IRQSTAT_TIMER0_CAUSE (1 << 0)
426#define TIMER_IRQSTAT_TIMER1_CAUSE (1 << 1)
427#define TIMER_IRQSTAT_TIMER2_CAUSE (1 << 2)
428#define TIMER_IRQSTAT_WDT_CAUSE (1 << 3)
429#define TIMER_IRQSTAT_TIMER_IR_EN(x) (1 << ((x) + 8))
430#define TIMER_IRQSTAT_TIMER0_IR_EN (1 << 8)
431#define TIMER_IRQSTAT_TIMER1_IR_EN (1 << 9)
432#define TIMER_IRQSTAT_TIMER2_IR_EN (1 << 10)
433
434/* Timer control register */
435#define TIMER_CTLx_REG(x) (0x4 + (x * 4))
436#define TIMER_CTL0_REG 0x4
437#define TIMER_CTL1_REG 0x8
438#define TIMER_CTL2_REG 0xC
439#define TIMER_CTL_COUNTDOWN_MASK (0x3fffffff)
440#define TIMER_CTL_MONOTONIC_MASK (1 << 30)
441#define TIMER_CTL_ENABLE_MASK (1 << 31)
442
443
444/*************************************************************************
445 * _REG relative to RSET_WDT
446 *************************************************************************/
447
448/* Watchdog default count register */
449#define WDT_DEFVAL_REG 0x0
450
451/* Watchdog control register */
452#define WDT_CTL_REG 0x4
453
454/* Watchdog control register constants */
455#define WDT_START_1 (0xff00)
456#define WDT_START_2 (0x00ff)
457#define WDT_STOP_1 (0xee00)
458#define WDT_STOP_2 (0x00ee)
459
460/* Watchdog reset length register */
461#define WDT_RSTLEN_REG 0x8
462
463/* Watchdog soft reset register (BCM6328 only) */
464#define WDT_SOFTRESET_REG 0xc
465
466/*************************************************************************
467 * _REG relative to RSET_GPIO
468 *************************************************************************/
469
470/* GPIO registers */
471#define GPIO_CTL_HI_REG 0x0
472#define GPIO_CTL_LO_REG 0x4
473#define GPIO_DATA_HI_REG 0x8
474#define GPIO_DATA_LO_REG 0xC
475#define GPIO_DATA_LO_REG_6345 0x8
476
477/* GPIO mux registers and constants */
478#define GPIO_MODE_REG 0x18
479
480#define GPIO_MODE_6348_G4_DIAG 0x00090000
481#define GPIO_MODE_6348_G4_UTOPIA 0x00080000
482#define GPIO_MODE_6348_G4_LEGACY_LED 0x00030000
483#define GPIO_MODE_6348_G4_MII_SNOOP 0x00020000
484#define GPIO_MODE_6348_G4_EXT_EPHY 0x00010000
485#define GPIO_MODE_6348_G3_DIAG 0x00009000
486#define GPIO_MODE_6348_G3_UTOPIA 0x00008000
487#define GPIO_MODE_6348_G3_EXT_MII 0x00007000
488#define GPIO_MODE_6348_G2_DIAG 0x00000900
489#define GPIO_MODE_6348_G2_PCI 0x00000500
490#define GPIO_MODE_6348_G1_DIAG 0x00000090
491#define GPIO_MODE_6348_G1_UTOPIA 0x00000080
492#define GPIO_MODE_6348_G1_SPI_UART 0x00000060
493#define GPIO_MODE_6348_G1_SPI_MASTER 0x00000060
494#define GPIO_MODE_6348_G1_MII_PCCARD 0x00000040
495#define GPIO_MODE_6348_G1_MII_SNOOP 0x00000020
496#define GPIO_MODE_6348_G1_EXT_EPHY 0x00000010
497#define GPIO_MODE_6348_G0_DIAG 0x00000009
498#define GPIO_MODE_6348_G0_EXT_MII 0x00000007
499
500#define GPIO_MODE_6358_EXTRACS (1 << 5)
501#define GPIO_MODE_6358_UART1 (1 << 6)
502#define GPIO_MODE_6358_EXTRA_SPI_SS (1 << 7)
503#define GPIO_MODE_6358_SERIAL_LED (1 << 10)
504#define GPIO_MODE_6358_UTOPIA (1 << 12)
505
506#define GPIO_MODE_6368_ANALOG_AFE_0 (1 << 0)
507#define GPIO_MODE_6368_ANALOG_AFE_1 (1 << 1)
508#define GPIO_MODE_6368_SYS_IRQ (1 << 2)
509#define GPIO_MODE_6368_SERIAL_LED_DATA (1 << 3)
510#define GPIO_MODE_6368_SERIAL_LED_CLK (1 << 4)
511#define GPIO_MODE_6368_INET_LED (1 << 5)
512#define GPIO_MODE_6368_EPHY0_LED (1 << 6)
513#define GPIO_MODE_6368_EPHY1_LED (1 << 7)
514#define GPIO_MODE_6368_EPHY2_LED (1 << 8)
515#define GPIO_MODE_6368_EPHY3_LED (1 << 9)
516#define GPIO_MODE_6368_ROBOSW_LED_DAT (1 << 10)
517#define GPIO_MODE_6368_ROBOSW_LED_CLK (1 << 11)
518#define GPIO_MODE_6368_ROBOSW_LED0 (1 << 12)
519#define GPIO_MODE_6368_ROBOSW_LED1 (1 << 13)
520#define GPIO_MODE_6368_USBD_LED (1 << 14)
521#define GPIO_MODE_6368_NTR_PULSE (1 << 15)
522#define GPIO_MODE_6368_PCI_REQ1 (1 << 16)
523#define GPIO_MODE_6368_PCI_GNT1 (1 << 17)
524#define GPIO_MODE_6368_PCI_INTB (1 << 18)
525#define GPIO_MODE_6368_PCI_REQ0 (1 << 19)
526#define GPIO_MODE_6368_PCI_GNT0 (1 << 20)
527#define GPIO_MODE_6368_PCMCIA_CD1 (1 << 22)
528#define GPIO_MODE_6368_PCMCIA_CD2 (1 << 23)
529#define GPIO_MODE_6368_PCMCIA_VS1 (1 << 24)
530#define GPIO_MODE_6368_PCMCIA_VS2 (1 << 25)
531#define GPIO_MODE_6368_EBI_CS2 (1 << 26)
532#define GPIO_MODE_6368_EBI_CS3 (1 << 27)
533#define GPIO_MODE_6368_SPI_SSN2 (1 << 28)
534#define GPIO_MODE_6368_SPI_SSN3 (1 << 29)
535#define GPIO_MODE_6368_SPI_SSN4 (1 << 30)
536#define GPIO_MODE_6368_SPI_SSN5 (1 << 31)
537
538
539#define GPIO_PINMUX_OTHR_REG 0x24
540#define GPIO_PINMUX_OTHR_6328_USB_SHIFT 12
541#define GPIO_PINMUX_OTHR_6328_USB_MASK (3 << GPIO_PINMUX_OTHR_6328_USB_SHIFT)
542#define GPIO_PINMUX_OTHR_6328_USB_HOST (1 << GPIO_PINMUX_OTHR_6328_USB_SHIFT)
543#define GPIO_PINMUX_OTHR_6328_USB_DEV (2 << GPIO_PINMUX_OTHR_6328_USB_SHIFT)
544
545#define GPIO_BASEMODE_6368_REG 0x38
546#define GPIO_BASEMODE_6368_UART2 0x1
547#define GPIO_BASEMODE_6368_GPIO 0x0
548#define GPIO_BASEMODE_6368_MASK 0x7
549/* those bits must be kept as read in gpio basemode register*/
550
551#define GPIO_STRAPBUS_REG 0x40
552#define STRAPBUS_6358_BOOT_SEL_PARALLEL (1 << 1)
553#define STRAPBUS_6358_BOOT_SEL_SERIAL (0 << 1)
554#define STRAPBUS_6368_BOOT_SEL_MASK 0x3
555#define STRAPBUS_6368_BOOT_SEL_NAND 0
556#define STRAPBUS_6368_BOOT_SEL_SERIAL 1
557#define STRAPBUS_6368_BOOT_SEL_PARALLEL 3
558
559
560/*************************************************************************
561 * _REG relative to RSET_ENET
562 *************************************************************************/
563
564/* Receiver Configuration register */
565#define ENET_RXCFG_REG 0x0
566#define ENET_RXCFG_ALLMCAST_SHIFT 1
567#define ENET_RXCFG_ALLMCAST_MASK (1 << ENET_RXCFG_ALLMCAST_SHIFT)
568#define ENET_RXCFG_PROMISC_SHIFT 3
569#define ENET_RXCFG_PROMISC_MASK (1 << ENET_RXCFG_PROMISC_SHIFT)
570#define ENET_RXCFG_LOOPBACK_SHIFT 4
571#define ENET_RXCFG_LOOPBACK_MASK (1 << ENET_RXCFG_LOOPBACK_SHIFT)
572#define ENET_RXCFG_ENFLOW_SHIFT 5
573#define ENET_RXCFG_ENFLOW_MASK (1 << ENET_RXCFG_ENFLOW_SHIFT)
574
575/* Receive Maximum Length register */
576#define ENET_RXMAXLEN_REG 0x4
577#define ENET_RXMAXLEN_SHIFT 0
578#define ENET_RXMAXLEN_MASK (0x7ff << ENET_RXMAXLEN_SHIFT)
579
580/* Transmit Maximum Length register */
581#define ENET_TXMAXLEN_REG 0x8
582#define ENET_TXMAXLEN_SHIFT 0
583#define ENET_TXMAXLEN_MASK (0x7ff << ENET_TXMAXLEN_SHIFT)
584
585/* MII Status/Control register */
586#define ENET_MIISC_REG 0x10
587#define ENET_MIISC_MDCFREQDIV_SHIFT 0
588#define ENET_MIISC_MDCFREQDIV_MASK (0x7f << ENET_MIISC_MDCFREQDIV_SHIFT)
589#define ENET_MIISC_PREAMBLEEN_SHIFT 7
590#define ENET_MIISC_PREAMBLEEN_MASK (1 << ENET_MIISC_PREAMBLEEN_SHIFT)
591
592/* MII Data register */
593#define ENET_MIIDATA_REG 0x14
594#define ENET_MIIDATA_DATA_SHIFT 0
595#define ENET_MIIDATA_DATA_MASK (0xffff << ENET_MIIDATA_DATA_SHIFT)
596#define ENET_MIIDATA_TA_SHIFT 16
597#define ENET_MIIDATA_TA_MASK (0x3 << ENET_MIIDATA_TA_SHIFT)
598#define ENET_MIIDATA_REG_SHIFT 18
599#define ENET_MIIDATA_REG_MASK (0x1f << ENET_MIIDATA_REG_SHIFT)
600#define ENET_MIIDATA_PHYID_SHIFT 23
601#define ENET_MIIDATA_PHYID_MASK (0x1f << ENET_MIIDATA_PHYID_SHIFT)
602#define ENET_MIIDATA_OP_READ_MASK (0x6 << 28)
603#define ENET_MIIDATA_OP_WRITE_MASK (0x5 << 28)
604
605/* Ethernet Interrupt Mask register */
606#define ENET_IRMASK_REG 0x18
607
608/* Ethernet Interrupt register */
609#define ENET_IR_REG 0x1c
610#define ENET_IR_MII (1 << 0)
611#define ENET_IR_MIB (1 << 1)
612#define ENET_IR_FLOWC (1 << 2)
613
614/* Ethernet Control register */
615#define ENET_CTL_REG 0x2c
616#define ENET_CTL_ENABLE_SHIFT 0
617#define ENET_CTL_ENABLE_MASK (1 << ENET_CTL_ENABLE_SHIFT)
618#define ENET_CTL_DISABLE_SHIFT 1
619#define ENET_CTL_DISABLE_MASK (1 << ENET_CTL_DISABLE_SHIFT)
620#define ENET_CTL_SRESET_SHIFT 2
621#define ENET_CTL_SRESET_MASK (1 << ENET_CTL_SRESET_SHIFT)
622#define ENET_CTL_EPHYSEL_SHIFT 3
623#define ENET_CTL_EPHYSEL_MASK (1 << ENET_CTL_EPHYSEL_SHIFT)
624
625/* Transmit Control register */
626#define ENET_TXCTL_REG 0x30
627#define ENET_TXCTL_FD_SHIFT 0
628#define ENET_TXCTL_FD_MASK (1 << ENET_TXCTL_FD_SHIFT)
629
630/* Transmit Watermask register */
631#define ENET_TXWMARK_REG 0x34
632#define ENET_TXWMARK_WM_SHIFT 0
633#define ENET_TXWMARK_WM_MASK (0x3f << ENET_TXWMARK_WM_SHIFT)
634
635/* MIB Control register */
636#define ENET_MIBCTL_REG 0x38
637#define ENET_MIBCTL_RDCLEAR_SHIFT 0
638#define ENET_MIBCTL_RDCLEAR_MASK (1 << ENET_MIBCTL_RDCLEAR_SHIFT)
639
640/* Perfect Match Data Low register */
641#define ENET_PML_REG(x) (0x58 + (x) * 8)
642#define ENET_PMH_REG(x) (0x5c + (x) * 8)
643#define ENET_PMH_DATAVALID_SHIFT 16
644#define ENET_PMH_DATAVALID_MASK (1 << ENET_PMH_DATAVALID_SHIFT)
645
646/* MIB register */
647#define ENET_MIB_REG(x) (0x200 + (x) * 4)
648#define ENET_MIB_REG_COUNT 55
649
650
651/*************************************************************************
652 * _REG relative to RSET_ENETDMA
653 *************************************************************************/
654#define ENETDMA_CHAN_WIDTH 0x10
655#define ENETDMA_6345_CHAN_WIDTH 0x40
656
657/* Controller Configuration Register */
658#define ENETDMA_CFG_REG (0x0)
659#define ENETDMA_CFG_EN_SHIFT 0
660#define ENETDMA_CFG_EN_MASK (1 << ENETDMA_CFG_EN_SHIFT)
661#define ENETDMA_CFG_FLOWCH_MASK(x) (1 << ((x >> 1) + 1))
662
663/* Flow Control Descriptor Low Threshold register */
664#define ENETDMA_FLOWCL_REG(x) (0x4 + (x) * 6)
665
666/* Flow Control Descriptor High Threshold register */
667#define ENETDMA_FLOWCH_REG(x) (0x8 + (x) * 6)
668
669/* Flow Control Descriptor Buffer Alloca Threshold register */
670#define ENETDMA_BUFALLOC_REG(x) (0xc + (x) * 6)
671#define ENETDMA_BUFALLOC_FORCE_SHIFT 31
672#define ENETDMA_BUFALLOC_FORCE_MASK (1 << ENETDMA_BUFALLOC_FORCE_SHIFT)
673
674/* Global interrupt status */
675#define ENETDMA_GLB_IRQSTAT_REG (0x40)
676
677/* Global interrupt mask */
678#define ENETDMA_GLB_IRQMASK_REG (0x44)
679
680/* Channel Configuration register */
681#define ENETDMA_CHANCFG_REG(x) (0x100 + (x) * 0x10)
682#define ENETDMA_CHANCFG_EN_SHIFT 0
683#define ENETDMA_CHANCFG_EN_MASK (1 << ENETDMA_CHANCFG_EN_SHIFT)
684#define ENETDMA_CHANCFG_PKTHALT_SHIFT 1
685#define ENETDMA_CHANCFG_PKTHALT_MASK (1 << ENETDMA_CHANCFG_PKTHALT_SHIFT)
686
687/* Interrupt Control/Status register */
688#define ENETDMA_IR_REG(x) (0x104 + (x) * 0x10)
689#define ENETDMA_IR_BUFDONE_MASK (1 << 0)
690#define ENETDMA_IR_PKTDONE_MASK (1 << 1)
691#define ENETDMA_IR_NOTOWNER_MASK (1 << 2)
692
693/* Interrupt Mask register */
694#define ENETDMA_IRMASK_REG(x) (0x108 + (x) * 0x10)
695
696/* Maximum Burst Length */
697#define ENETDMA_MAXBURST_REG(x) (0x10C + (x) * 0x10)
698
699/* Ring Start Address register */
700#define ENETDMA_RSTART_REG(x) (0x200 + (x) * 0x10)
701
702/* State Ram Word 2 */
703#define ENETDMA_SRAM2_REG(x) (0x204 + (x) * 0x10)
704
705/* State Ram Word 3 */
706#define ENETDMA_SRAM3_REG(x) (0x208 + (x) * 0x10)
707
708/* State Ram Word 4 */
709#define ENETDMA_SRAM4_REG(x) (0x20c + (x) * 0x10)
710
711/* Broadcom 6345 ENET DMA definitions */
712#define ENETDMA_6345_CHANCFG_REG (0x00)
713
714#define ENETDMA_6345_MAXBURST_REG (0x04)
715
716#define ENETDMA_6345_RSTART_REG (0x08)
717
718#define ENETDMA_6345_LEN_REG (0x0C)
719
720#define ENETDMA_6345_IR_REG (0x14)
721
722#define ENETDMA_6345_IRMASK_REG (0x18)
723
724#define ENETDMA_6345_FC_REG (0x1C)
725
726#define ENETDMA_6345_BUFALLOC_REG (0x20)
727
728/* Shift down for EOP, SOP and WRAP bits */
729#define ENETDMA_6345_DESC_SHIFT (3)
730
731/*************************************************************************
732 * _REG relative to RSET_ENETDMAC
733 *************************************************************************/
734
735/* Channel Configuration register */
736#define ENETDMAC_CHANCFG_REG (0x0)
737#define ENETDMAC_CHANCFG_EN_SHIFT 0
738#define ENETDMAC_CHANCFG_EN_MASK (1 << ENETDMAC_CHANCFG_EN_SHIFT)
739#define ENETDMAC_CHANCFG_PKTHALT_SHIFT 1
740#define ENETDMAC_CHANCFG_PKTHALT_MASK (1 << ENETDMAC_CHANCFG_PKTHALT_SHIFT)
741#define ENETDMAC_CHANCFG_BUFHALT_SHIFT 2
742#define ENETDMAC_CHANCFG_BUFHALT_MASK (1 << ENETDMAC_CHANCFG_BUFHALT_SHIFT)
743#define ENETDMAC_CHANCFG_CHAINING_SHIFT 2
744#define ENETDMAC_CHANCFG_CHAINING_MASK (1 << ENETDMAC_CHANCFG_CHAINING_SHIFT)
745#define ENETDMAC_CHANCFG_WRAP_EN_SHIFT 3
746#define ENETDMAC_CHANCFG_WRAP_EN_MASK (1 << ENETDMAC_CHANCFG_WRAP_EN_SHIFT)
747#define ENETDMAC_CHANCFG_FLOWC_EN_SHIFT 4
748#define ENETDMAC_CHANCFG_FLOWC_EN_MASK (1 << ENETDMAC_CHANCFG_FLOWC_EN_SHIFT)
749
750/* Interrupt Control/Status register */
751#define ENETDMAC_IR_REG (0x4)
752#define ENETDMAC_IR_BUFDONE_MASK (1 << 0)
753#define ENETDMAC_IR_PKTDONE_MASK (1 << 1)
754#define ENETDMAC_IR_NOTOWNER_MASK (1 << 2)
755
756/* Interrupt Mask register */
757#define ENETDMAC_IRMASK_REG (0x8)
758
759/* Maximum Burst Length */
760#define ENETDMAC_MAXBURST_REG (0xc)
761
762
763/*************************************************************************
764 * _REG relative to RSET_ENETDMAS
765 *************************************************************************/
766
767/* Ring Start Address register */
768#define ENETDMAS_RSTART_REG (0x0)
769
770/* State Ram Word 2 */
771#define ENETDMAS_SRAM2_REG (0x4)
772
773/* State Ram Word 3 */
774#define ENETDMAS_SRAM3_REG (0x8)
775
776/* State Ram Word 4 */
777#define ENETDMAS_SRAM4_REG (0xc)
778
779
780/*************************************************************************
781 * _REG relative to RSET_ENETSW
782 *************************************************************************/
783
784/* Port traffic control */
785#define ENETSW_PTCTRL_REG(x) (0x0 + (x))
786#define ENETSW_PTCTRL_RXDIS_MASK (1 << 0)
787#define ENETSW_PTCTRL_TXDIS_MASK (1 << 1)
788
789/* Switch mode register */
790#define ENETSW_SWMODE_REG (0xb)
791#define ENETSW_SWMODE_FWD_EN_MASK (1 << 1)
792
793/* IMP override Register */
794#define ENETSW_IMPOV_REG (0xe)
795#define ENETSW_IMPOV_FORCE_MASK (1 << 7)
796#define ENETSW_IMPOV_TXFLOW_MASK (1 << 5)
797#define ENETSW_IMPOV_RXFLOW_MASK (1 << 4)
798#define ENETSW_IMPOV_1000_MASK (1 << 3)
799#define ENETSW_IMPOV_100_MASK (1 << 2)
800#define ENETSW_IMPOV_FDX_MASK (1 << 1)
801#define ENETSW_IMPOV_LINKUP_MASK (1 << 0)
802
803/* Port override Register */
804#define ENETSW_PORTOV_REG(x) (0x58 + (x))
805#define ENETSW_PORTOV_ENABLE_MASK (1 << 6)
806#define ENETSW_PORTOV_TXFLOW_MASK (1 << 5)
807#define ENETSW_PORTOV_RXFLOW_MASK (1 << 4)
808#define ENETSW_PORTOV_1000_MASK (1 << 3)
809#define ENETSW_PORTOV_100_MASK (1 << 2)
810#define ENETSW_PORTOV_FDX_MASK (1 << 1)
811#define ENETSW_PORTOV_LINKUP_MASK (1 << 0)
812
813/* MDIO control register */
814#define ENETSW_MDIOC_REG (0xb0)
815#define ENETSW_MDIOC_EXT_MASK (1 << 16)
816#define ENETSW_MDIOC_REG_SHIFT 20
817#define ENETSW_MDIOC_PHYID_SHIFT 25
818#define ENETSW_MDIOC_RD_MASK (1 << 30)
819#define ENETSW_MDIOC_WR_MASK (1 << 31)
820
821/* MDIO data register */
822#define ENETSW_MDIOD_REG (0xb4)
823
824/* Global Management Configuration Register */
825#define ENETSW_GMCR_REG (0x200)
826#define ENETSW_GMCR_RST_MIB_MASK (1 << 0)
827
828/* MIB register */
829#define ENETSW_MIB_REG(x) (0x2800 + (x) * 4)
830#define ENETSW_MIB_REG_COUNT 47
831
832/* Jumbo control register port mask register */
833#define ENETSW_JMBCTL_PORT_REG (0x4004)
834
835/* Jumbo control mib good frame register */
836#define ENETSW_JMBCTL_MAXSIZE_REG (0x4008)
837
838
839/*************************************************************************
840 * _REG relative to RSET_OHCI_PRIV
841 *************************************************************************/
842
843#define OHCI_PRIV_REG 0x0
844#define OHCI_PRIV_PORT1_HOST_SHIFT 0
845#define OHCI_PRIV_PORT1_HOST_MASK (1 << OHCI_PRIV_PORT1_HOST_SHIFT)
846#define OHCI_PRIV_REG_SWAP_SHIFT 3
847#define OHCI_PRIV_REG_SWAP_MASK (1 << OHCI_PRIV_REG_SWAP_SHIFT)
848
849
850/*************************************************************************
851 * _REG relative to RSET_USBH_PRIV
852 *************************************************************************/
853
854#define USBH_PRIV_SWAP_6358_REG 0x0
855#define USBH_PRIV_SWAP_6368_REG 0x1c
856
857#define USBH_PRIV_SWAP_USBD_SHIFT 6
858#define USBH_PRIV_SWAP_USBD_MASK (1 << USBH_PRIV_SWAP_USBD_SHIFT)
859#define USBH_PRIV_SWAP_EHCI_ENDN_SHIFT 4
860#define USBH_PRIV_SWAP_EHCI_ENDN_MASK (1 << USBH_PRIV_SWAP_EHCI_ENDN_SHIFT)
861#define USBH_PRIV_SWAP_EHCI_DATA_SHIFT 3
862#define USBH_PRIV_SWAP_EHCI_DATA_MASK (1 << USBH_PRIV_SWAP_EHCI_DATA_SHIFT)
863#define USBH_PRIV_SWAP_OHCI_ENDN_SHIFT 1
864#define USBH_PRIV_SWAP_OHCI_ENDN_MASK (1 << USBH_PRIV_SWAP_OHCI_ENDN_SHIFT)
865#define USBH_PRIV_SWAP_OHCI_DATA_SHIFT 0
866#define USBH_PRIV_SWAP_OHCI_DATA_MASK (1 << USBH_PRIV_SWAP_OHCI_DATA_SHIFT)
867
868#define USBH_PRIV_UTMI_CTL_6368_REG 0x10
869#define USBH_PRIV_UTMI_CTL_NODRIV_SHIFT 12
870#define USBH_PRIV_UTMI_CTL_NODRIV_MASK (0xf << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT)
871#define USBH_PRIV_UTMI_CTL_HOSTB_SHIFT 0
872#define USBH_PRIV_UTMI_CTL_HOSTB_MASK (0xf << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT)
873
874#define USBH_PRIV_TEST_6358_REG 0x24
875#define USBH_PRIV_TEST_6368_REG 0x14
876
877#define USBH_PRIV_SETUP_6368_REG 0x28
878#define USBH_PRIV_SETUP_IOC_SHIFT 4
879#define USBH_PRIV_SETUP_IOC_MASK (1 << USBH_PRIV_SETUP_IOC_SHIFT)
880
881
882/*************************************************************************
883 * _REG relative to RSET_USBD
884 *************************************************************************/
885
886/* General control */
887#define USBD_CONTROL_REG 0x00
888#define USBD_CONTROL_TXZLENINS_SHIFT 14
889#define USBD_CONTROL_TXZLENINS_MASK (1 << USBD_CONTROL_TXZLENINS_SHIFT)
890#define USBD_CONTROL_AUTO_CSRS_SHIFT 13
891#define USBD_CONTROL_AUTO_CSRS_MASK (1 << USBD_CONTROL_AUTO_CSRS_SHIFT)
892#define USBD_CONTROL_RXZSCFG_SHIFT 12
893#define USBD_CONTROL_RXZSCFG_MASK (1 << USBD_CONTROL_RXZSCFG_SHIFT)
894#define USBD_CONTROL_INIT_SEL_SHIFT 8
895#define USBD_CONTROL_INIT_SEL_MASK (0xf << USBD_CONTROL_INIT_SEL_SHIFT)
896#define USBD_CONTROL_FIFO_RESET_SHIFT 6
897#define USBD_CONTROL_FIFO_RESET_MASK (3 << USBD_CONTROL_FIFO_RESET_SHIFT)
898#define USBD_CONTROL_SETUPERRLOCK_SHIFT 5
899#define USBD_CONTROL_SETUPERRLOCK_MASK (1 << USBD_CONTROL_SETUPERRLOCK_SHIFT)
900#define USBD_CONTROL_DONE_CSRS_SHIFT 0
901#define USBD_CONTROL_DONE_CSRS_MASK (1 << USBD_CONTROL_DONE_CSRS_SHIFT)
902
903/* Strap options */
904#define USBD_STRAPS_REG 0x04
905#define USBD_STRAPS_APP_SELF_PWR_SHIFT 10
906#define USBD_STRAPS_APP_SELF_PWR_MASK (1 << USBD_STRAPS_APP_SELF_PWR_SHIFT)
907#define USBD_STRAPS_APP_DISCON_SHIFT 9
908#define USBD_STRAPS_APP_DISCON_MASK (1 << USBD_STRAPS_APP_DISCON_SHIFT)
909#define USBD_STRAPS_APP_CSRPRGSUP_SHIFT 8
910#define USBD_STRAPS_APP_CSRPRGSUP_MASK (1 << USBD_STRAPS_APP_CSRPRGSUP_SHIFT)
911#define USBD_STRAPS_APP_RMTWKUP_SHIFT 6
912#define USBD_STRAPS_APP_RMTWKUP_MASK (1 << USBD_STRAPS_APP_RMTWKUP_SHIFT)
913#define USBD_STRAPS_APP_RAM_IF_SHIFT 7
914#define USBD_STRAPS_APP_RAM_IF_MASK (1 << USBD_STRAPS_APP_RAM_IF_SHIFT)
915#define USBD_STRAPS_APP_8BITPHY_SHIFT 2
916#define USBD_STRAPS_APP_8BITPHY_MASK (1 << USBD_STRAPS_APP_8BITPHY_SHIFT)
917#define USBD_STRAPS_SPEED_SHIFT 0
918#define USBD_STRAPS_SPEED_MASK (3 << USBD_STRAPS_SPEED_SHIFT)
919
920/* Stall control */
921#define USBD_STALL_REG 0x08
922#define USBD_STALL_UPDATE_SHIFT 7
923#define USBD_STALL_UPDATE_MASK (1 << USBD_STALL_UPDATE_SHIFT)
924#define USBD_STALL_ENABLE_SHIFT 6
925#define USBD_STALL_ENABLE_MASK (1 << USBD_STALL_ENABLE_SHIFT)
926#define USBD_STALL_EPNUM_SHIFT 0
927#define USBD_STALL_EPNUM_MASK (0xf << USBD_STALL_EPNUM_SHIFT)
928
929/* General status */
930#define USBD_STATUS_REG 0x0c
931#define USBD_STATUS_SOF_SHIFT 16
932#define USBD_STATUS_SOF_MASK (0x7ff << USBD_STATUS_SOF_SHIFT)
933#define USBD_STATUS_SPD_SHIFT 12
934#define USBD_STATUS_SPD_MASK (3 << USBD_STATUS_SPD_SHIFT)
935#define USBD_STATUS_ALTINTF_SHIFT 8
936#define USBD_STATUS_ALTINTF_MASK (0xf << USBD_STATUS_ALTINTF_SHIFT)
937#define USBD_STATUS_INTF_SHIFT 4
938#define USBD_STATUS_INTF_MASK (0xf << USBD_STATUS_INTF_SHIFT)
939#define USBD_STATUS_CFG_SHIFT 0
940#define USBD_STATUS_CFG_MASK (0xf << USBD_STATUS_CFG_SHIFT)
941
942/* Other events */
943#define USBD_EVENTS_REG 0x10
944#define USBD_EVENTS_USB_LINK_SHIFT 10
945#define USBD_EVENTS_USB_LINK_MASK (1 << USBD_EVENTS_USB_LINK_SHIFT)
946
947/* IRQ status */
948#define USBD_EVENT_IRQ_STATUS_REG 0x14
949
950/* IRQ level (2 bits per IRQ event) */
951#define USBD_EVENT_IRQ_CFG_HI_REG 0x18
952
953#define USBD_EVENT_IRQ_CFG_LO_REG 0x1c
954
955#define USBD_EVENT_IRQ_CFG_SHIFT(x) ((x & 0xf) << 1)
956#define USBD_EVENT_IRQ_CFG_MASK(x) (3 << USBD_EVENT_IRQ_CFG_SHIFT(x))
957#define USBD_EVENT_IRQ_CFG_RISING(x) (0 << USBD_EVENT_IRQ_CFG_SHIFT(x))
958#define USBD_EVENT_IRQ_CFG_FALLING(x) (1 << USBD_EVENT_IRQ_CFG_SHIFT(x))
959
960/* IRQ mask (1=unmasked) */
961#define USBD_EVENT_IRQ_MASK_REG 0x20
962
963/* IRQ bits */
964#define USBD_EVENT_IRQ_USB_LINK 10
965#define USBD_EVENT_IRQ_SETCFG 9
966#define USBD_EVENT_IRQ_SETINTF 8
967#define USBD_EVENT_IRQ_ERRATIC_ERR 7
968#define USBD_EVENT_IRQ_SET_CSRS 6
969#define USBD_EVENT_IRQ_SUSPEND 5
970#define USBD_EVENT_IRQ_EARLY_SUSPEND 4
971#define USBD_EVENT_IRQ_SOF 3
972#define USBD_EVENT_IRQ_ENUM_ON 2
973#define USBD_EVENT_IRQ_SETUP 1
974#define USBD_EVENT_IRQ_USB_RESET 0
975
976/* TX FIFO partitioning */
977#define USBD_TXFIFO_CONFIG_REG 0x40
978#define USBD_TXFIFO_CONFIG_END_SHIFT 16
979#define USBD_TXFIFO_CONFIG_END_MASK (0xff << USBD_TXFIFO_CONFIG_END_SHIFT)
980#define USBD_TXFIFO_CONFIG_START_SHIFT 0
981#define USBD_TXFIFO_CONFIG_START_MASK (0xff << USBD_TXFIFO_CONFIG_START_SHIFT)
982
983/* RX FIFO partitioning */
984#define USBD_RXFIFO_CONFIG_REG 0x44
985#define USBD_RXFIFO_CONFIG_END_SHIFT 16
986#define USBD_RXFIFO_CONFIG_END_MASK (0xff << USBD_TXFIFO_CONFIG_END_SHIFT)
987#define USBD_RXFIFO_CONFIG_START_SHIFT 0
988#define USBD_RXFIFO_CONFIG_START_MASK (0xff << USBD_TXFIFO_CONFIG_START_SHIFT)
989
990/* TX FIFO/endpoint configuration */
991#define USBD_TXFIFO_EPSIZE_REG 0x48
992
993/* RX FIFO/endpoint configuration */
994#define USBD_RXFIFO_EPSIZE_REG 0x4c
995
996/* Endpoint<->DMA mappings */
997#define USBD_EPNUM_TYPEMAP_REG 0x50
998#define USBD_EPNUM_TYPEMAP_TYPE_SHIFT 8
999#define USBD_EPNUM_TYPEMAP_TYPE_MASK (0x3 << USBD_EPNUM_TYPEMAP_TYPE_SHIFT)
1000#define USBD_EPNUM_TYPEMAP_DMA_CH_SHIFT 0
1001#define USBD_EPNUM_TYPEMAP_DMA_CH_MASK (0xf << USBD_EPNUM_TYPEMAP_DMACH_SHIFT)
1002
1003/* Misc per-endpoint settings */
1004#define USBD_CSR_SETUPADDR_REG 0x80
1005#define USBD_CSR_SETUPADDR_DEF 0xb550
1006
1007#define USBD_CSR_EP_REG(x) (0x84 + (x) * 4)
1008#define USBD_CSR_EP_MAXPKT_SHIFT 19
1009#define USBD_CSR_EP_MAXPKT_MASK (0x7ff << USBD_CSR_EP_MAXPKT_SHIFT)
1010#define USBD_CSR_EP_ALTIFACE_SHIFT 15
1011#define USBD_CSR_EP_ALTIFACE_MASK (0xf << USBD_CSR_EP_ALTIFACE_SHIFT)
1012#define USBD_CSR_EP_IFACE_SHIFT 11
1013#define USBD_CSR_EP_IFACE_MASK (0xf << USBD_CSR_EP_IFACE_SHIFT)
1014#define USBD_CSR_EP_CFG_SHIFT 7
1015#define USBD_CSR_EP_CFG_MASK (0xf << USBD_CSR_EP_CFG_SHIFT)
1016#define USBD_CSR_EP_TYPE_SHIFT 5
1017#define USBD_CSR_EP_TYPE_MASK (3 << USBD_CSR_EP_TYPE_SHIFT)
1018#define USBD_CSR_EP_DIR_SHIFT 4
1019#define USBD_CSR_EP_DIR_MASK (1 << USBD_CSR_EP_DIR_SHIFT)
1020#define USBD_CSR_EP_LOG_SHIFT 0
1021#define USBD_CSR_EP_LOG_MASK (0xf << USBD_CSR_EP_LOG_SHIFT)
1022
1023
1024/*************************************************************************
1025 * _REG relative to RSET_MPI
1026 *************************************************************************/
1027
1028/* well known (hard wired) chip select */
1029#define MPI_CS_PCMCIA_COMMON 4
1030#define MPI_CS_PCMCIA_ATTR 5
1031#define MPI_CS_PCMCIA_IO 6
1032
1033/* Chip select base register */
1034#define MPI_CSBASE_REG(x) (0x0 + (x) * 8)
1035#define MPI_CSBASE_BASE_SHIFT 13
1036#define MPI_CSBASE_BASE_MASK (0x1ffff << MPI_CSBASE_BASE_SHIFT)
1037#define MPI_CSBASE_SIZE_SHIFT 0
1038#define MPI_CSBASE_SIZE_MASK (0xf << MPI_CSBASE_SIZE_SHIFT)
1039
1040#define MPI_CSBASE_SIZE_8K 0
1041#define MPI_CSBASE_SIZE_16K 1
1042#define MPI_CSBASE_SIZE_32K 2
1043#define MPI_CSBASE_SIZE_64K 3
1044#define MPI_CSBASE_SIZE_128K 4
1045#define MPI_CSBASE_SIZE_256K 5
1046#define MPI_CSBASE_SIZE_512K 6
1047#define MPI_CSBASE_SIZE_1M 7
1048#define MPI_CSBASE_SIZE_2M 8
1049#define MPI_CSBASE_SIZE_4M 9
1050#define MPI_CSBASE_SIZE_8M 10
1051#define MPI_CSBASE_SIZE_16M 11
1052#define MPI_CSBASE_SIZE_32M 12
1053#define MPI_CSBASE_SIZE_64M 13
1054#define MPI_CSBASE_SIZE_128M 14
1055#define MPI_CSBASE_SIZE_256M 15
1056
1057/* Chip select control register */
1058#define MPI_CSCTL_REG(x) (0x4 + (x) * 8)
1059#define MPI_CSCTL_ENABLE_MASK (1 << 0)
1060#define MPI_CSCTL_WAIT_SHIFT 1
1061#define MPI_CSCTL_WAIT_MASK (0x7 << MPI_CSCTL_WAIT_SHIFT)
1062#define MPI_CSCTL_DATA16_MASK (1 << 4)
1063#define MPI_CSCTL_SYNCMODE_MASK (1 << 7)
1064#define MPI_CSCTL_TSIZE_MASK (1 << 8)
1065#define MPI_CSCTL_ENDIANSWAP_MASK (1 << 10)
1066#define MPI_CSCTL_SETUP_SHIFT 16
1067#define MPI_CSCTL_SETUP_MASK (0xf << MPI_CSCTL_SETUP_SHIFT)
1068#define MPI_CSCTL_HOLD_SHIFT 20
1069#define MPI_CSCTL_HOLD_MASK (0xf << MPI_CSCTL_HOLD_SHIFT)
1070
1071/* PCI registers */
1072#define MPI_SP0_RANGE_REG 0x100
1073#define MPI_SP0_REMAP_REG 0x104
1074#define MPI_SP0_REMAP_ENABLE_MASK (1 << 0)
1075#define MPI_SP1_RANGE_REG 0x10C
1076#define MPI_SP1_REMAP_REG 0x110
1077#define MPI_SP1_REMAP_ENABLE_MASK (1 << 0)
1078
1079#define MPI_L2PCFG_REG 0x11C
1080#define MPI_L2PCFG_CFG_TYPE_SHIFT 0
1081#define MPI_L2PCFG_CFG_TYPE_MASK (0x3 << MPI_L2PCFG_CFG_TYPE_SHIFT)
1082#define MPI_L2PCFG_REG_SHIFT 2
1083#define MPI_L2PCFG_REG_MASK (0x3f << MPI_L2PCFG_REG_SHIFT)
1084#define MPI_L2PCFG_FUNC_SHIFT 8
1085#define MPI_L2PCFG_FUNC_MASK (0x7 << MPI_L2PCFG_FUNC_SHIFT)
1086#define MPI_L2PCFG_DEVNUM_SHIFT 11
1087#define MPI_L2PCFG_DEVNUM_MASK (0x1f << MPI_L2PCFG_DEVNUM_SHIFT)
1088#define MPI_L2PCFG_CFG_USEREG_MASK (1 << 30)
1089#define MPI_L2PCFG_CFG_SEL_MASK (1 << 31)
1090
1091#define MPI_L2PMEMRANGE1_REG 0x120
1092#define MPI_L2PMEMBASE1_REG 0x124
1093#define MPI_L2PMEMREMAP1_REG 0x128
1094#define MPI_L2PMEMRANGE2_REG 0x12C
1095#define MPI_L2PMEMBASE2_REG 0x130
1096#define MPI_L2PMEMREMAP2_REG 0x134
1097#define MPI_L2PIORANGE_REG 0x138
1098#define MPI_L2PIOBASE_REG 0x13C
1099#define MPI_L2PIOREMAP_REG 0x140
1100#define MPI_L2P_BASE_MASK (0xffff8000)
1101#define MPI_L2PREMAP_ENABLED_MASK (1 << 0)
1102#define MPI_L2PREMAP_IS_CARDBUS_MASK (1 << 2)
1103
1104#define MPI_PCIMODESEL_REG 0x144
1105#define MPI_PCIMODESEL_BAR1_NOSWAP_MASK (1 << 0)
1106#define MPI_PCIMODESEL_BAR2_NOSWAP_MASK (1 << 1)
1107#define MPI_PCIMODESEL_EXT_ARB_MASK (1 << 2)
1108#define MPI_PCIMODESEL_PREFETCH_SHIFT 4
1109#define MPI_PCIMODESEL_PREFETCH_MASK (0xf << MPI_PCIMODESEL_PREFETCH_SHIFT)
1110
1111#define MPI_LOCBUSCTL_REG 0x14C
1112#define MPI_LOCBUSCTL_EN_PCI_GPIO_MASK (1 << 0)
1113#define MPI_LOCBUSCTL_U2P_NOSWAP_MASK (1 << 1)
1114
1115#define MPI_LOCINT_REG 0x150
1116#define MPI_LOCINT_MASK(x) (1 << (x + 16))
1117#define MPI_LOCINT_STAT(x) (1 << (x))
1118#define MPI_LOCINT_DIR_FAILED 6
1119#define MPI_LOCINT_EXT_PCI_INT 7
1120#define MPI_LOCINT_SERR 8
1121#define MPI_LOCINT_CSERR 9
1122
1123#define MPI_PCICFGCTL_REG 0x178
1124#define MPI_PCICFGCTL_CFGADDR_SHIFT 2
1125#define MPI_PCICFGCTL_CFGADDR_MASK (0x1f << MPI_PCICFGCTL_CFGADDR_SHIFT)
1126#define MPI_PCICFGCTL_WRITEEN_MASK (1 << 7)
1127
1128#define MPI_PCICFGDATA_REG 0x17C
1129
1130/* PCI host bridge custom register */
1131#define BCMPCI_REG_TIMERS 0x40
1132#define REG_TIMER_TRDY_SHIFT 0
1133#define REG_TIMER_TRDY_MASK (0xff << REG_TIMER_TRDY_SHIFT)
1134#define REG_TIMER_RETRY_SHIFT 8
1135#define REG_TIMER_RETRY_MASK (0xff << REG_TIMER_RETRY_SHIFT)
1136
1137
1138/*************************************************************************
1139 * _REG relative to RSET_PCMCIA
1140 *************************************************************************/
1141
1142#define PCMCIA_C1_REG 0x0
1143#define PCMCIA_C1_CD1_MASK (1 << 0)
1144#define PCMCIA_C1_CD2_MASK (1 << 1)
1145#define PCMCIA_C1_VS1_MASK (1 << 2)
1146#define PCMCIA_C1_VS2_MASK (1 << 3)
1147#define PCMCIA_C1_VS1OE_MASK (1 << 6)
1148#define PCMCIA_C1_VS2OE_MASK (1 << 7)
1149#define PCMCIA_C1_CBIDSEL_SHIFT (8)
1150#define PCMCIA_C1_CBIDSEL_MASK (0x1f << PCMCIA_C1_CBIDSEL_SHIFT)
1151#define PCMCIA_C1_EN_PCMCIA_GPIO_MASK (1 << 13)
1152#define PCMCIA_C1_EN_PCMCIA_MASK (1 << 14)
1153#define PCMCIA_C1_EN_CARDBUS_MASK (1 << 15)
1154#define PCMCIA_C1_RESET_MASK (1 << 18)
1155
1156#define PCMCIA_C2_REG 0x8
1157#define PCMCIA_C2_DATA16_MASK (1 << 0)
1158#define PCMCIA_C2_BYTESWAP_MASK (1 << 1)
1159#define PCMCIA_C2_RWCOUNT_SHIFT 2
1160#define PCMCIA_C2_RWCOUNT_MASK (0x3f << PCMCIA_C2_RWCOUNT_SHIFT)
1161#define PCMCIA_C2_INACTIVE_SHIFT 8
1162#define PCMCIA_C2_INACTIVE_MASK (0x3f << PCMCIA_C2_INACTIVE_SHIFT)
1163#define PCMCIA_C2_SETUP_SHIFT 16
1164#define PCMCIA_C2_SETUP_MASK (0x3f << PCMCIA_C2_SETUP_SHIFT)
1165#define PCMCIA_C2_HOLD_SHIFT 24
1166#define PCMCIA_C2_HOLD_MASK (0x3f << PCMCIA_C2_HOLD_SHIFT)
1167
1168
1169/*************************************************************************
1170 * _REG relative to RSET_SDRAM
1171 *************************************************************************/
1172
1173#define SDRAM_CFG_REG 0x0
1174#define SDRAM_CFG_ROW_SHIFT 4
1175#define SDRAM_CFG_ROW_MASK (0x3 << SDRAM_CFG_ROW_SHIFT)
1176#define SDRAM_CFG_COL_SHIFT 6
1177#define SDRAM_CFG_COL_MASK (0x3 << SDRAM_CFG_COL_SHIFT)
1178#define SDRAM_CFG_32B_SHIFT 10
1179#define SDRAM_CFG_32B_MASK (1 << SDRAM_CFG_32B_SHIFT)
1180#define SDRAM_CFG_BANK_SHIFT 13
1181#define SDRAM_CFG_BANK_MASK (1 << SDRAM_CFG_BANK_SHIFT)
1182
1183#define SDRAM_MBASE_REG 0xc
1184
1185#define SDRAM_PRIO_REG 0x2C
1186#define SDRAM_PRIO_MIPS_SHIFT 29
1187#define SDRAM_PRIO_MIPS_MASK (1 << SDRAM_PRIO_MIPS_SHIFT)
1188#define SDRAM_PRIO_ADSL_SHIFT 30
1189#define SDRAM_PRIO_ADSL_MASK (1 << SDRAM_PRIO_ADSL_SHIFT)
1190#define SDRAM_PRIO_EN_SHIFT 31
1191#define SDRAM_PRIO_EN_MASK (1 << SDRAM_PRIO_EN_SHIFT)
1192
1193
1194/*************************************************************************
1195 * _REG relative to RSET_MEMC
1196 *************************************************************************/
1197
1198#define MEMC_CFG_REG 0x4
1199#define MEMC_CFG_32B_SHIFT 1
1200#define MEMC_CFG_32B_MASK (1 << MEMC_CFG_32B_SHIFT)
1201#define MEMC_CFG_COL_SHIFT 3
1202#define MEMC_CFG_COL_MASK (0x3 << MEMC_CFG_COL_SHIFT)
1203#define MEMC_CFG_ROW_SHIFT 6
1204#define MEMC_CFG_ROW_MASK (0x3 << MEMC_CFG_ROW_SHIFT)
1205
1206
1207/*************************************************************************
1208 * _REG relative to RSET_DDR
1209 *************************************************************************/
1210
1211#define DDR_CSEND_REG 0x8
1212
1213#define DDR_DMIPSPLLCFG_REG 0x18
1214#define DMIPSPLLCFG_M1_SHIFT 0
1215#define DMIPSPLLCFG_M1_MASK (0xff << DMIPSPLLCFG_M1_SHIFT)
1216#define DMIPSPLLCFG_N1_SHIFT 23
1217#define DMIPSPLLCFG_N1_MASK (0x3f << DMIPSPLLCFG_N1_SHIFT)
1218#define DMIPSPLLCFG_N2_SHIFT 29
1219#define DMIPSPLLCFG_N2_MASK (0x7 << DMIPSPLLCFG_N2_SHIFT)
1220
1221#define DDR_DMIPSPLLCFG_6368_REG 0x20
1222#define DMIPSPLLCFG_6368_P1_SHIFT 0
1223#define DMIPSPLLCFG_6368_P1_MASK (0xf << DMIPSPLLCFG_6368_P1_SHIFT)
1224#define DMIPSPLLCFG_6368_P2_SHIFT 4
1225#define DMIPSPLLCFG_6368_P2_MASK (0xf << DMIPSPLLCFG_6368_P2_SHIFT)
1226#define DMIPSPLLCFG_6368_NDIV_SHIFT 16
1227#define DMIPSPLLCFG_6368_NDIV_MASK (0x1ff << DMIPSPLLCFG_6368_NDIV_SHIFT)
1228
1229#define DDR_DMIPSPLLDIV_6368_REG 0x24
1230#define DMIPSPLLDIV_6368_MDIV_SHIFT 0
1231#define DMIPSPLLDIV_6368_MDIV_MASK (0xff << DMIPSPLLDIV_6368_MDIV_SHIFT)
1232
1233
1234/*************************************************************************
1235 * _REG relative to RSET_M2M
1236 *************************************************************************/
1237
1238#define M2M_RX 0
1239#define M2M_TX 1
1240
1241#define M2M_SRC_REG(x) ((x) * 0x40 + 0x00)
1242#define M2M_DST_REG(x) ((x) * 0x40 + 0x04)
1243#define M2M_SIZE_REG(x) ((x) * 0x40 + 0x08)
1244
1245#define M2M_CTRL_REG(x) ((x) * 0x40 + 0x0c)
1246#define M2M_CTRL_ENABLE_MASK (1 << 0)
1247#define M2M_CTRL_IRQEN_MASK (1 << 1)
1248#define M2M_CTRL_ERROR_CLR_MASK (1 << 6)
1249#define M2M_CTRL_DONE_CLR_MASK (1 << 7)
1250#define M2M_CTRL_NOINC_MASK (1 << 8)
1251#define M2M_CTRL_PCMCIASWAP_MASK (1 << 9)
1252#define M2M_CTRL_SWAPBYTE_MASK (1 << 10)
1253#define M2M_CTRL_ENDIAN_MASK (1 << 11)
1254
1255#define M2M_STAT_REG(x) ((x) * 0x40 + 0x10)
1256#define M2M_STAT_DONE (1 << 0)
1257#define M2M_STAT_ERROR (1 << 1)
1258
1259#define M2M_SRCID_REG(x) ((x) * 0x40 + 0x14)
1260#define M2M_DSTID_REG(x) ((x) * 0x40 + 0x18)
1261
1262/*************************************************************************
1263 * _REG relative to RSET_SPI
1264 *************************************************************************/
1265
1266/* BCM 6338/6348 SPI core */
1267#define SPI_6348_CMD 0x00 /* 16-bits register */
1268#define SPI_6348_INT_STATUS 0x02
1269#define SPI_6348_INT_MASK_ST 0x03
1270#define SPI_6348_INT_MASK 0x04
1271#define SPI_6348_ST 0x05
1272#define SPI_6348_CLK_CFG 0x06
1273#define SPI_6348_FILL_BYTE 0x07
1274#define SPI_6348_MSG_TAIL 0x09
1275#define SPI_6348_RX_TAIL 0x0b
1276#define SPI_6348_MSG_CTL 0x40 /* 8-bits register */
1277#define SPI_6348_MSG_CTL_WIDTH 8
1278#define SPI_6348_MSG_DATA 0x41
1279#define SPI_6348_MSG_DATA_SIZE 0x3f
1280#define SPI_6348_RX_DATA 0x80
1281#define SPI_6348_RX_DATA_SIZE 0x3f
1282
1283/* BCM 3368/6358/6262/6368 SPI core */
1284#define SPI_6358_MSG_CTL 0x00 /* 16-bits register */
1285#define SPI_6358_MSG_CTL_WIDTH 16
1286#define SPI_6358_MSG_DATA 0x02
1287#define SPI_6358_MSG_DATA_SIZE 0x21e
1288#define SPI_6358_RX_DATA 0x400
1289#define SPI_6358_RX_DATA_SIZE 0x220
1290#define SPI_6358_CMD 0x700 /* 16-bits register */
1291#define SPI_6358_INT_STATUS 0x702
1292#define SPI_6358_INT_MASK_ST 0x703
1293#define SPI_6358_INT_MASK 0x704
1294#define SPI_6358_ST 0x705
1295#define SPI_6358_CLK_CFG 0x706
1296#define SPI_6358_FILL_BYTE 0x707
1297#define SPI_6358_MSG_TAIL 0x709
1298#define SPI_6358_RX_TAIL 0x70B
1299
1300/* Shared SPI definitions */
1301
1302/* Message configuration */
1303#define SPI_FD_RW 0x00
1304#define SPI_HD_W 0x01
1305#define SPI_HD_R 0x02
1306#define SPI_BYTE_CNT_SHIFT 0
1307#define SPI_6348_MSG_TYPE_SHIFT 6
1308#define SPI_6358_MSG_TYPE_SHIFT 14
1309
1310/* Command */
1311#define SPI_CMD_NOOP 0x00
1312#define SPI_CMD_SOFT_RESET 0x01
1313#define SPI_CMD_HARD_RESET 0x02
1314#define SPI_CMD_START_IMMEDIATE 0x03
1315#define SPI_CMD_COMMAND_SHIFT 0
1316#define SPI_CMD_COMMAND_MASK 0x000f
1317#define SPI_CMD_DEVICE_ID_SHIFT 4
1318#define SPI_CMD_PREPEND_BYTE_CNT_SHIFT 8
1319#define SPI_CMD_ONE_BYTE_SHIFT 11
1320#define SPI_CMD_ONE_WIRE_SHIFT 12
1321#define SPI_DEV_ID_0 0
1322#define SPI_DEV_ID_1 1
1323#define SPI_DEV_ID_2 2
1324#define SPI_DEV_ID_3 3
1325
1326/* Interrupt mask */
1327#define SPI_INTR_CMD_DONE 0x01
1328#define SPI_INTR_RX_OVERFLOW 0x02
1329#define SPI_INTR_TX_UNDERFLOW 0x04
1330#define SPI_INTR_TX_OVERFLOW 0x08
1331#define SPI_INTR_RX_UNDERFLOW 0x10
1332#define SPI_INTR_CLEAR_ALL 0x1f
1333
1334/* Status */
1335#define SPI_RX_EMPTY 0x02
1336#define SPI_CMD_BUSY 0x04
1337#define SPI_SERIAL_BUSY 0x08
1338
1339/* Clock configuration */
1340#define SPI_CLK_20MHZ 0x00
1341#define SPI_CLK_0_391MHZ 0x01
1342#define SPI_CLK_0_781MHZ 0x02 /* default */
1343#define SPI_CLK_1_563MHZ 0x03
1344#define SPI_CLK_3_125MHZ 0x04
1345#define SPI_CLK_6_250MHZ 0x05
1346#define SPI_CLK_12_50MHZ 0x06
1347#define SPI_CLK_MASK 0x07
1348#define SPI_SSOFFTIME_MASK 0x38
1349#define SPI_SSOFFTIME_SHIFT 3
1350#define SPI_BYTE_SWAP 0x80
1351
1352/*************************************************************************
1353 * _REG relative to RSET_MISC
1354 *************************************************************************/
1355#define MISC_SERDES_CTRL_6328_REG 0x0
1356#define MISC_SERDES_CTRL_6362_REG 0x4
1357#define SERDES_PCIE_EN (1 << 0)
1358#define SERDES_PCIE_EXD_EN (1 << 15)
1359
1360#define MISC_STRAPBUS_6362_REG 0x14
1361#define STRAPBUS_6362_FCVO_SHIFT 1
1362#define STRAPBUS_6362_HSSPI_CLK_FAST (1 << 13)
1363#define STRAPBUS_6362_FCVO_MASK (0x1f << STRAPBUS_6362_FCVO_SHIFT)
1364#define STRAPBUS_6362_BOOT_SEL_SERIAL (1 << 15)
1365#define STRAPBUS_6362_BOOT_SEL_NAND (0 << 15)
1366
1367#define MISC_STRAPBUS_6328_REG 0x240
1368#define STRAPBUS_6328_FCVO_SHIFT 7
1369#define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT)
1370#define STRAPBUS_6328_BOOT_SEL_SERIAL (1 << 18)
1371#define STRAPBUS_6328_BOOT_SEL_NAND (0 << 18)
1372
1373/*************************************************************************
1374 * _REG relative to RSET_PCIE
1375 *************************************************************************/
1376
1377#define PCIE_CONFIG2_REG 0x408
1378#define CONFIG2_BAR1_SIZE_EN 1
1379#define CONFIG2_BAR1_SIZE_MASK 0xf
1380
1381#define PCIE_IDVAL3_REG 0x43c
1382#define IDVAL3_CLASS_CODE_MASK 0xffffff
1383#define IDVAL3_SUBCLASS_SHIFT 8
1384#define IDVAL3_CLASS_SHIFT 16
1385
1386#define PCIE_DLSTATUS_REG 0x1048
1387#define DLSTATUS_PHYLINKUP (1 << 13)
1388
1389#define PCIE_BRIDGE_OPT1_REG 0x2820
1390#define OPT1_RD_BE_OPT_EN (1 << 7)
1391#define OPT1_RD_REPLY_BE_FIX_EN (1 << 9)
1392#define OPT1_PCIE_BRIDGE_HOLE_DET_EN (1 << 11)
1393#define OPT1_L1_INT_STATUS_MASK_POL (1 << 12)
1394
1395#define PCIE_BRIDGE_OPT2_REG 0x2824
1396#define OPT2_UBUS_UR_DECODE_DIS (1 << 2)
1397#define OPT2_TX_CREDIT_CHK_EN (1 << 4)
1398#define OPT2_CFG_TYPE1_BD_SEL (1 << 7)
1399#define OPT2_CFG_TYPE1_BUS_NO_SHIFT 16
1400#define OPT2_CFG_TYPE1_BUS_NO_MASK (0xff << OPT2_CFG_TYPE1_BUS_NO_SHIFT)
1401
1402#define PCIE_BRIDGE_BAR0_BASEMASK_REG 0x2828
1403#define PCIE_BRIDGE_BAR1_BASEMASK_REG 0x2830
1404#define BASEMASK_REMAP_EN (1 << 0)
1405#define BASEMASK_SWAP_EN (1 << 1)
1406#define BASEMASK_MASK_SHIFT 4
1407#define BASEMASK_MASK_MASK (0xfff << BASEMASK_MASK_SHIFT)
1408#define BASEMASK_BASE_SHIFT 20
1409#define BASEMASK_BASE_MASK (0xfff << BASEMASK_BASE_SHIFT)
1410
1411#define PCIE_BRIDGE_BAR0_REBASE_ADDR_REG 0x282c
1412#define PCIE_BRIDGE_BAR1_REBASE_ADDR_REG 0x2834
1413#define REBASE_ADDR_BASE_SHIFT 20
1414#define REBASE_ADDR_BASE_MASK (0xfff << REBASE_ADDR_BASE_SHIFT)
1415
1416#define PCIE_BRIDGE_RC_INT_MASK_REG 0x2854
1417#define PCIE_RC_INT_A (1 << 0)
1418#define PCIE_RC_INT_B (1 << 1)
1419#define PCIE_RC_INT_C (1 << 2)
1420#define PCIE_RC_INT_D (1 << 3)
1421
1422#define PCIE_DEVICE_OFFSET 0x8000
1423
1424/*************************************************************************
1425 * _REG relative to RSET_OTP
1426 *************************************************************************/
1427
1428#define OTP_USER_BITS_6328_REG(i) (0x20 + (i) * 4)
1429#define OTP_6328_REG3_TP1_DISABLED BIT(9)
1430
1431#endif /* BCM63XX_REGS_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h
new file mode 100644
index 000000000..2c0645b7d
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h
@@ -0,0 +1,22 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __BCM63XX_RESET_H
3#define __BCM63XX_RESET_H
4
5enum bcm63xx_core_reset {
6 BCM63XX_RESET_SPI,
7 BCM63XX_RESET_ENET,
8 BCM63XX_RESET_USBH,
9 BCM63XX_RESET_USBD,
10 BCM63XX_RESET_SAR,
11 BCM63XX_RESET_DSL,
12 BCM63XX_RESET_EPHY,
13 BCM63XX_RESET_ENETSW,
14 BCM63XX_RESET_PCM,
15 BCM63XX_RESET_MPI,
16 BCM63XX_RESET_PCIE,
17 BCM63XX_RESET_PCIE_EXT,
18};
19
20void bcm63xx_core_set_reset(enum bcm63xx_core_reset, int reset);
21
22#endif
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_timer.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_timer.h
new file mode 100644
index 000000000..bcbece793
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_timer.h
@@ -0,0 +1,12 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_TIMER_H_
3#define BCM63XX_TIMER_H_
4
5int bcm63xx_timer_register(int id, void (*callback)(void *data), void *data);
6void bcm63xx_timer_unregister(int id);
7int bcm63xx_timer_set(int id, int monotonic, unsigned int countdown_us);
8int bcm63xx_timer_enable(int id);
9int bcm63xx_timer_disable(int id);
10unsigned int bcm63xx_timer_countdown(unsigned int countdown_us);
11
12#endif /* !BCM63XX_TIMER_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
new file mode 100644
index 000000000..830f53f28
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
@@ -0,0 +1,54 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BOARD_BCM963XX_H_
3#define BOARD_BCM963XX_H_
4
5#include <linux/types.h>
6#include <linux/gpio.h>
7#include <linux/leds.h>
8#include <bcm63xx_dev_enet.h>
9#include <bcm63xx_dev_usb_usbd.h>
10
11/*
12 * flash mapping
13 */
14#define BCM963XX_CFE_VERSION_OFFSET 0x570
15#define BCM963XX_NVRAM_OFFSET 0x580
16
17/*
18 * board definition
19 */
20struct board_info {
21 u8 name[16];
22 unsigned int expected_cpu_id;
23
24 /* enabled feature/device */
25 unsigned int has_enet0:1;
26 unsigned int has_enet1:1;
27 unsigned int has_enetsw:1;
28 unsigned int has_pci:1;
29 unsigned int has_pccard:1;
30 unsigned int has_ohci0:1;
31 unsigned int has_ehci0:1;
32 unsigned int has_usbd:1;
33 unsigned int has_uart0:1;
34 unsigned int has_uart1:1;
35
36 /* ethernet config */
37 struct bcm63xx_enet_platform_data enet0;
38 struct bcm63xx_enet_platform_data enet1;
39 struct bcm63xx_enetsw_platform_data enetsw;
40
41 /* USB config */
42 struct bcm63xx_usbd_platform_data usbd;
43
44 /* GPIO LEDs */
45 struct gpio_led leds[5];
46
47 /* External PHY reset GPIO */
48 unsigned int ephy_reset_gpio;
49
50 /* External PHY reset GPIO flags from gpio.h */
51 unsigned long ephy_reset_gpio_flags;
52};
53
54#endif /* ! BOARD_BCM963XX_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h b/arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h
new file mode 100644
index 000000000..0ebecbdb9
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h
@@ -0,0 +1,54 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
3#define __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
4
5#include <bcm63xx_cpu.h>
6
7#define cpu_has_tlb 1
8#define cpu_has_4kex 1
9#define cpu_has_4k_cache 1
10#define cpu_has_fpu 0
11#define cpu_has_32fpr 0
12#define cpu_has_counter 1
13#define cpu_has_watch 0
14#define cpu_has_divec 1
15#define cpu_has_vce 0
16#define cpu_has_cache_cdex_p 0
17#define cpu_has_cache_cdex_s 0
18#define cpu_has_prefetch 1
19#define cpu_has_mcheck 1
20#define cpu_has_ejtag 1
21#define cpu_has_llsc 1
22#define cpu_has_mips16 0
23#define cpu_has_mips16e2 0
24#define cpu_has_mdmx 0
25#define cpu_has_mips3d 0
26#define cpu_has_smartmips 0
27#define cpu_has_vtag_icache 0
28
29#if !defined(CONFIG_SYS_HAS_CPU_BMIPS4350)
30#define cpu_has_dc_aliases 0
31#endif
32
33#define cpu_has_ic_fills_f_dc 0
34#define cpu_has_pindexed_dcache 0
35
36#define cpu_has_mips32r1 1
37#define cpu_has_mips32r2 0
38#define cpu_has_mips64r1 0
39#define cpu_has_mips64r2 0
40
41#define cpu_has_dsp 0
42#define cpu_has_dsp2 0
43#define cpu_has_mipsmt 0
44#define cpu_has_userlocal 0
45
46#define cpu_has_nofpuex 0
47#define cpu_has_64bits 0
48#define cpu_has_64bit_zero_reg 0
49
50#define cpu_dcache_line_size() 16
51#define cpu_icache_line_size() 16
52#define cpu_scache_line_size() 0
53
54#endif /* __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/ioremap.h b/arch/mips/include/asm/mach-bcm63xx/ioremap.h
new file mode 100644
index 000000000..73f31825b
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/ioremap.h
@@ -0,0 +1,44 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef BCM63XX_IOREMAP_H_
3#define BCM63XX_IOREMAP_H_
4
5#include <bcm63xx_cpu.h>
6
7static inline int is_bcm63xx_internal_registers(phys_addr_t offset)
8{
9 switch (bcm63xx_get_cpu_id()) {
10 case BCM3368_CPU_ID:
11 if (offset >= 0xfff80000)
12 return 1;
13 break;
14 case BCM6338_CPU_ID:
15 case BCM6345_CPU_ID:
16 case BCM6348_CPU_ID:
17 case BCM6358_CPU_ID:
18 if (offset >= 0xfff00000)
19 return 1;
20 break;
21 case BCM6328_CPU_ID:
22 case BCM6362_CPU_ID:
23 case BCM6368_CPU_ID:
24 if (offset >= 0xb0000000 && offset < 0xb1000000)
25 return 1;
26 break;
27 }
28 return 0;
29}
30
31static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
32 unsigned long flags)
33{
34 if (is_bcm63xx_internal_registers(offset))
35 return (void __iomem *)offset;
36 return NULL;
37}
38
39static inline int plat_iounmap(const volatile void __iomem *addr)
40{
41 return is_bcm63xx_internal_registers((unsigned long)addr);
42}
43
44#endif /* BCM63XX_IOREMAP_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/irq.h b/arch/mips/include/asm/mach-bcm63xx/irq.h
new file mode 100644
index 000000000..b016f0615
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/irq.h
@@ -0,0 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_BCM63XX_IRQ_H
3#define __ASM_MACH_BCM63XX_IRQ_H
4
5#define NR_IRQS 128
6#define MIPS_CPU_IRQ_BASE 0
7
8#endif
diff --git a/arch/mips/include/asm/mach-bcm63xx/spaces.h b/arch/mips/include/asm/mach-bcm63xx/spaces.h
new file mode 100644
index 000000000..1410ed0da
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/spaces.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) 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_BCM63XX_SPACES_H
11#define _ASM_BCM63XX_SPACES_H
12
13#include <asm/bmips-spaces.h>
14
15#include <asm/mach-generic/spaces.h>
16
17#endif /* __ASM_BCM63XX_SPACES_H */
diff --git a/arch/mips/include/asm/mach-bmips/cpu-feature-overrides.h b/arch/mips/include/asm/mach-bmips/cpu-feature-overrides.h
new file mode 100644
index 000000000..68a219d80
--- /dev/null
+++ b/arch/mips/include/asm/mach-bmips/cpu-feature-overrides.h
@@ -0,0 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_BMIPS_CPU_FEATURE_OVERRIDES_H
3#define __ASM_MACH_BMIPS_CPU_FEATURE_OVERRIDES_H
4
5/* Invariants across all BMIPS processors */
6#define cpu_has_vtag_icache 0
7#define cpu_icache_snoops_remote_store 1
8
9/* Processor ISA compatibility is MIPS32R1 */
10#define cpu_has_mips32r1 1
11#define cpu_has_mips32r2 0
12#define cpu_has_mips64r1 0
13#define cpu_has_mips64r2 0
14
15#endif /* __ASM_MACH_BMIPS_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-bmips/ioremap.h b/arch/mips/include/asm/mach-bmips/ioremap.h
new file mode 100644
index 000000000..63b4af991
--- /dev/null
+++ b/arch/mips/include/asm/mach-bmips/ioremap.h
@@ -0,0 +1,29 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_BMIPS_IOREMAP_H
3#define __ASM_MACH_BMIPS_IOREMAP_H
4
5#include <linux/types.h>
6
7static inline int is_bmips_internal_registers(phys_addr_t offset)
8{
9 if (offset >= 0xfff80000)
10 return 1;
11
12 return 0;
13}
14
15static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
16 unsigned long flags)
17{
18 if (is_bmips_internal_registers(offset))
19 return (void __iomem *)offset;
20
21 return NULL;
22}
23
24static inline int plat_iounmap(const volatile void __iomem *addr)
25{
26 return is_bmips_internal_registers((unsigned long)addr);
27}
28
29#endif /* __ASM_MACH_BMIPS_IOREMAP_H */
diff --git a/arch/mips/include/asm/mach-bmips/spaces.h b/arch/mips/include/asm/mach-bmips/spaces.h
new file mode 100644
index 000000000..c59b28fd9
--- /dev/null
+++ b/arch/mips/include/asm/mach-bmips/spaces.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) 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_BMIPS_SPACES_H
11#define _ASM_BMIPS_SPACES_H
12
13/* Avoid collisions with system base register (SBR) region on BMIPS3300 */
14#include <asm/bmips-spaces.h>
15
16#include <asm/mach-generic/spaces.h>
17
18#endif /* __ASM_BMIPS_SPACES_H */
diff --git a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
new file mode 100644
index 000000000..513270c8a
--- /dev/null
+++ b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
@@ -0,0 +1,80 @@
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 Cavium Networks
7 */
8#ifndef __ASM_MACH_CAVIUM_OCTEON_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_CAVIUM_OCTEON_CPU_FEATURE_OVERRIDES_H
10
11#include <linux/types.h>
12#include <asm/mipsregs.h>
13
14/*
15 * Cavium Octeons are MIPS64v2 processors
16 */
17#define cpu_dcache_line_size() 128
18#define cpu_icache_line_size() 128
19
20
21#define cpu_has_4kex 1
22#define cpu_has_3k_cache 0
23#define cpu_has_4k_cache 0
24#define cpu_has_tx39_cache 0
25#define cpu_has_counter 1
26#define cpu_has_watch 1
27#define cpu_has_divec 1
28#define cpu_has_vce 0
29#define cpu_has_cache_cdex_p 0
30#define cpu_has_cache_cdex_s 0
31#define cpu_has_prefetch 1
32
33#define cpu_has_llsc 1
34/*
35 * We Disable LL/SC on non SMP systems as it is faster to disable
36 * interrupts for atomic access than a LL/SC.
37 */
38#ifdef CONFIG_SMP
39# define kernel_uses_llsc 1
40#else
41# define kernel_uses_llsc 0
42#endif
43#define cpu_has_vtag_icache 1
44#define cpu_has_dc_aliases 0
45#define cpu_has_ic_fills_f_dc 0
46#define cpu_has_64bits 1
47#define cpu_has_octeon_cache 1
48#define cpu_has_mips32r1 1
49#define cpu_has_mips32r2 1
50#define cpu_has_mips64r1 1
51#define cpu_has_mips64r2 1
52#define cpu_has_dsp 0
53#define cpu_has_dsp2 0
54#define cpu_has_mipsmt 0
55#define cpu_has_vint 0
56#define cpu_has_veic 0
57#define cpu_hwrena_impl_bits (MIPS_HWRENA_IMPL1 | MIPS_HWRENA_IMPL2)
58#define cpu_has_wsbh 1
59
60#define cpu_has_rixi (cpu_data[0].cputype != CPU_CAVIUM_OCTEON)
61
62#define ARCH_HAS_SPINLOCK_PREFETCH 1
63#define spin_lock_prefetch(x) prefetch(x)
64#define PREFETCH_STRIDE 128
65
66#ifdef __OCTEON__
67/*
68 * All gcc versions that have OCTEON support define __OCTEON__ and have the
69 * __builtin_popcount support.
70 */
71#define ARCH_HAS_USABLE_BUILTIN_POPCOUNT 1
72#endif
73
74/*
75 * The last 256MB are reserved for device to device mappings and the
76 * BAR1 hole.
77 */
78#define MAX_DMA32_PFN (((1ULL << 32) - (1ULL << 28)) >> PAGE_SHIFT)
79
80#endif
diff --git a/arch/mips/include/asm/mach-cavium-octeon/irq.h b/arch/mips/include/asm/mach-cavium-octeon/irq.h
new file mode 100644
index 000000000..64b86b9d3
--- /dev/null
+++ b/arch/mips/include/asm/mach-cavium-octeon/irq.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) 2004-2008 Cavium Networks
7 */
8#ifndef __OCTEON_IRQ_H__
9#define __OCTEON_IRQ_H__
10
11#define NR_IRQS OCTEON_IRQ_LAST
12#define MIPS_CPU_IRQ_BASE OCTEON_IRQ_SW0
13
14enum octeon_irq {
15/* 1 - 8 represent the 8 MIPS standard interrupt sources */
16 OCTEON_IRQ_SW0 = 1,
17 OCTEON_IRQ_SW1,
18/* CIU0, CUI2, CIU4 are 3, 4, 5 */
19 OCTEON_IRQ_5 = 6,
20 OCTEON_IRQ_PERF,
21 OCTEON_IRQ_TIMER,
22/* sources in CIU_INTX_EN0 */
23 OCTEON_IRQ_WORKQ0,
24 OCTEON_IRQ_WDOG0 = OCTEON_IRQ_WORKQ0 + 64,
25 OCTEON_IRQ_MBOX0 = OCTEON_IRQ_WDOG0 + 32,
26 OCTEON_IRQ_MBOX1,
27 OCTEON_IRQ_MBOX2,
28 OCTEON_IRQ_MBOX3,
29 OCTEON_IRQ_PCI_INT0,
30 OCTEON_IRQ_PCI_INT1,
31 OCTEON_IRQ_PCI_INT2,
32 OCTEON_IRQ_PCI_INT3,
33 OCTEON_IRQ_PCI_MSI0,
34 OCTEON_IRQ_PCI_MSI1,
35 OCTEON_IRQ_PCI_MSI2,
36 OCTEON_IRQ_PCI_MSI3,
37
38 OCTEON_IRQ_TWSI,
39 OCTEON_IRQ_TWSI2,
40 OCTEON_IRQ_RML,
41 OCTEON_IRQ_TIMER0,
42 OCTEON_IRQ_TIMER1,
43 OCTEON_IRQ_TIMER2,
44 OCTEON_IRQ_TIMER3,
45#ifndef CONFIG_PCI_MSI
46 OCTEON_IRQ_LAST = 127
47#endif
48};
49
50#ifdef CONFIG_PCI_MSI
51/* 256 - 511 represent the MSI interrupts 0-255 */
52#define OCTEON_IRQ_MSI_BIT0 (256)
53
54#define OCTEON_IRQ_MSI_LAST (OCTEON_IRQ_MSI_BIT0 + 255)
55#define OCTEON_IRQ_LAST (OCTEON_IRQ_MSI_LAST + 1)
56#endif
57
58#endif
diff --git a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h
new file mode 100644
index 000000000..c38b38ce5
--- /dev/null
+++ b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.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 * Copyright (C) 2005-2008 Cavium Networks, Inc
7 */
8#ifndef __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H
9#define __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H
10
11#define CP0_CVMCTL_REG $9, 7
12#define CP0_CVMMEMCTL_REG $11,7
13#define CP0_PRID_REG $15, 0
14#define CP0_DCACHE_ERR_REG $27, 1
15#define CP0_PRID_OCTEON_PASS1 0x000d0000
16#define CP0_PRID_OCTEON_CN30XX 0x000d0200
17
18.macro kernel_entry_setup
19 # Registers set by bootloader:
20 # (only 32 bits set by bootloader, all addresses are physical
21 # addresses, and need to have the appropriate memory region set
22 # by the kernel
23 # a0 = argc
24 # a1 = argv (kseg0 compat addr)
25 # a2 = 1 if init core, zero otherwise
26 # a3 = address of boot descriptor block
27 .set push
28 .set arch=octeon
29 # Read the cavium mem control register
30 dmfc0 v0, CP0_CVMMEMCTL_REG
31 # Clear the lower 6 bits, the CVMSEG size
32 dins v0, $0, 0, 6
33 ori v0, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE
34 dmtc0 v0, CP0_CVMMEMCTL_REG # Write the cavium mem control register
35 dmfc0 v0, CP0_CVMCTL_REG # Read the cavium control register
36 # Disable unaligned load/store support but leave HW fixup enabled
37 # Needed for octeon specific memcpy
38 or v0, v0, 0x5001
39 xor v0, v0, 0x1001
40 # First clear off CvmCtl[IPPCI] bit and move the performance
41 # counters interrupt to IRQ 6
42 dli v1, ~(7 << 7)
43 and v0, v0, v1
44 ori v0, v0, (6 << 7)
45
46 mfc0 v1, CP0_PRID_REG
47 and t1, v1, 0xfff8
48 xor t1, t1, 0x9000 # 63-P1
49 beqz t1, 4f
50 and t1, v1, 0xfff8
51 xor t1, t1, 0x9008 # 63-P2
52 beqz t1, 4f
53 and t1, v1, 0xfff8
54 xor t1, t1, 0x9100 # 68-P1
55 beqz t1, 4f
56 and t1, v1, 0xff00
57 xor t1, t1, 0x9200 # 66-PX
58 bnez t1, 5f # Skip WAR for others.
59 and t1, v1, 0x00ff
60 slti t1, t1, 2 # 66-P1.2 and later good.
61 beqz t1, 5f
62
634: # core-16057 work around
64 or v0, v0, 0x2000 # Set IPREF bit.
65
665: # No core-16057 work around
67 # Write the cavium control register
68 dmtc0 v0, CP0_CVMCTL_REG
69 sync
70 # Flush dcache after config change
71 cache 9, 0($0)
72 # Zero all of CVMSEG to make sure parity is correct
73 dli v0, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE
74 dsll v0, 7
75 beqz v0, 2f
761: dsubu v0, 8
77 sd $0, -32768(v0)
78 bnez v0, 1b
792:
80 mfc0 v0, CP0_PRID_REG
81 bbit0 v0, 15, 1f
82 # OCTEON II or better have bit 15 set. Clear the error bits.
83 and t1, v0, 0xff00
84 dli v0, 0x9500
85 bge t1, v0, 1f # OCTEON III has no DCACHE_ERR_REG COP0
86 dli v0, 0x27
87 dmtc0 v0, CP0_DCACHE_ERR_REG
881:
89 # Get my core id
90 rdhwr v0, $0
91 # Jump the master to kernel_entry
92 bne a2, zero, octeon_main_processor
93 nop
94
95#ifdef CONFIG_SMP
96
97 #
98 # All cores other than the master need to wait here for SMP bootstrap
99 # to begin
100 #
101
102octeon_spin_wait_boot:
103#ifdef CONFIG_RELOCATABLE
104 PTR_LA t0, octeon_processor_relocated_kernel_entry
105 LONG_L t0, (t0)
106 beq zero, t0, 1f
107 nop
108
109 jr t0
110 nop
1111:
112#endif /* CONFIG_RELOCATABLE */
113
114 # This is the variable where the next core to boot is stored
115 PTR_LA t0, octeon_processor_boot
116 # Get the core id of the next to be booted
117 LONG_L t1, (t0)
118 # Keep looping if it isn't me
119 bne t1, v0, octeon_spin_wait_boot
120 nop
121 # Get my GP from the global variable
122 PTR_LA t0, octeon_processor_gp
123 LONG_L gp, (t0)
124 # Get my SP from the global variable
125 PTR_LA t0, octeon_processor_sp
126 LONG_L sp, (t0)
127 # Set the SP global variable to zero so the master knows we've started
128 LONG_S zero, (t0)
129#ifdef __OCTEON__
130 syncw
131 syncw
132#else
133 sync
134#endif
135 # Jump to the normal Linux SMP entry point
136 j smp_bootstrap
137 nop
138#else /* CONFIG_SMP */
139
140 #
141 # Someone tried to boot SMP with a non SMP kernel. All extra cores
142 # will halt here.
143 #
144octeon_wait_forever:
145 wait
146 b octeon_wait_forever
147 nop
148
149#endif /* CONFIG_SMP */
150octeon_main_processor:
151 .set pop
152.endm
153
154/*
155 * Do SMP slave processor setup necessary before we can safely execute C code.
156 */
157 .macro smp_slave_setup
158 .endm
159
160#endif /* __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H */
diff --git a/arch/mips/include/asm/mach-cavium-octeon/mangle-port.h b/arch/mips/include/asm/mach-cavium-octeon/mangle-port.h
new file mode 100644
index 000000000..239fcc874
--- /dev/null
+++ b/arch/mips/include/asm/mach-cavium-octeon/mangle-port.h
@@ -0,0 +1,64 @@
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#include <asm/byteorder.h>
12
13#ifdef __BIG_ENDIAN
14
15static inline bool __should_swizzle_bits(volatile void *a)
16{
17 extern const bool octeon_should_swizzle_table[];
18 u64 did = ((u64)(uintptr_t)a >> 40) & 0xff;
19
20 return octeon_should_swizzle_table[did];
21}
22
23# define __swizzle_addr_b(port) (port)
24# define __swizzle_addr_w(port) (port)
25# define __swizzle_addr_l(port) (port)
26# define __swizzle_addr_q(port) (port)
27
28#else /* __LITTLE_ENDIAN */
29
30#define __should_swizzle_bits(a) false
31
32static inline bool __should_swizzle_addr(u64 p)
33{
34 /* boot bus? */
35 return ((p >> 40) & 0xff) == 0;
36}
37
38# define __swizzle_addr_b(port) \
39 (__should_swizzle_addr(port) ? (port) ^ 7 : (port))
40# define __swizzle_addr_w(port) \
41 (__should_swizzle_addr(port) ? (port) ^ 6 : (port))
42# define __swizzle_addr_l(port) \
43 (__should_swizzle_addr(port) ? (port) ^ 4 : (port))
44# define __swizzle_addr_q(port) (port)
45
46#endif /* __BIG_ENDIAN */
47
48
49# define ioswabb(a, x) (x)
50# define __mem_ioswabb(a, x) (x)
51# define ioswabw(a, x) (__should_swizzle_bits(a) ? \
52 le16_to_cpu((__force __le16)(x)) : \
53 (x))
54# define __mem_ioswabw(a, x) (x)
55# define ioswabl(a, x) (__should_swizzle_bits(a) ? \
56 le32_to_cpu((__force __le32)(x)) : \
57 (x))
58# define __mem_ioswabl(a, x) (x)
59# define ioswabq(a, x) (__should_swizzle_bits(a) ? \
60 le64_to_cpu((__force __le64)(x)) : \
61 (x))
62# define __mem_ioswabq(a, x) (x)
63
64#endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
diff --git a/arch/mips/include/asm/mach-cavium-octeon/spaces.h b/arch/mips/include/asm/mach-cavium-octeon/spaces.h
new file mode 100644
index 000000000..daa91accf
--- /dev/null
+++ b/arch/mips/include/asm/mach-cavium-octeon/spaces.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) 2012 Cavium, Inc.
7 */
8#ifndef _ASM_MACH_CAVIUM_OCTEON_SPACES_H
9#define _ASM_MACH_CAVIUM_OCTEON_SPACES_H
10
11#include <linux/const.h>
12
13#ifdef CONFIG_64BIT
14/* They are all the same and some OCTEON II cores cannot handle 0xa8.. */
15#define CAC_BASE _AC(0x8000000000000000, UL)
16#define UNCAC_BASE _AC(0x8000000000000000, UL)
17#define IO_BASE _AC(0x8000000000000000, UL)
18
19
20#endif /* CONFIG_64BIT */
21
22#include <asm/mach-generic/spaces.h>
23
24#endif /* _ASM_MACH_CAVIUM_OCTEON_SPACES_H */
diff --git a/arch/mips/include/asm/mach-cobalt/cobalt.h b/arch/mips/include/asm/mach-cobalt/cobalt.h
new file mode 100644
index 000000000..5b9fce73f
--- /dev/null
+++ b/arch/mips/include/asm/mach-cobalt/cobalt.h
@@ -0,0 +1,22 @@
1/*
2 * The Cobalt board ID information.
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
15extern int cobalt_board_id;
16
17#define COBALT_BRD_ID_QUBE1 0x3
18#define COBALT_BRD_ID_RAQ1 0x4
19#define COBALT_BRD_ID_QUBE2 0x5
20#define COBALT_BRD_ID_RAQ2 0x6
21
22#endif /* __ASM_COBALT_H */
diff --git a/arch/mips/include/asm/mach-cobalt/cpu-feature-overrides.h b/arch/mips/include/asm/mach-cobalt/cpu-feature-overrides.h
new file mode 100644
index 000000000..291fe90aa
--- /dev/null
+++ b/arch/mips/include/asm/mach-cobalt/cpu-feature-overrides.h
@@ -0,0 +1,57 @@
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) 2006, 07 Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_COBALT_CPU_FEATURE_OVERRIDES_H
9#define __ASM_COBALT_CPU_FEATURE_OVERRIDES_H
10
11
12#define cpu_has_tlb 1
13#define cpu_has_4kex 1
14#define cpu_has_3k_cache 0
15#define cpu_has_4k_cache 1
16#define cpu_has_tx39_cache 0
17#define cpu_has_32fpr 1
18#define cpu_has_counter 1
19#define cpu_has_watch 0
20#define cpu_has_divec 1
21#define cpu_has_vce 0
22#define cpu_has_cache_cdex_p 0
23#define cpu_has_cache_cdex_s 0
24#define cpu_has_prefetch 0
25#define cpu_has_mcheck 0
26#define cpu_has_ejtag 0
27
28#define cpu_has_inclusive_pcaches 0
29#define cpu_dcache_line_size() 32
30#define cpu_icache_line_size() 32
31#define cpu_scache_line_size() 0
32
33#ifdef CONFIG_64BIT
34#define cpu_has_llsc 0
35#else
36#define cpu_has_llsc 1
37#endif
38
39#define cpu_has_mips16 0
40#define cpu_has_mips16e2 0
41#define cpu_has_mdmx 0
42#define cpu_has_mips3d 0
43#define cpu_has_smartmips 0
44#define cpu_has_vtag_icache 0
45#define cpu_has_ic_fills_f_dc 0
46#define cpu_icache_snoops_remote_store 0
47#define cpu_has_dsp 0
48#define cpu_has_dsp2 0
49#define cpu_has_mipsmt 0
50#define cpu_has_userlocal 0
51
52#define cpu_has_mips32r1 0
53#define cpu_has_mips32r2 0
54#define cpu_has_mips64r1 0
55#define cpu_has_mips64r2 0
56
57#endif /* __ASM_COBALT_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-cobalt/irq.h b/arch/mips/include/asm/mach-cobalt/irq.h
new file mode 100644
index 000000000..9da9acf5d
--- /dev/null
+++ b/arch/mips/include/asm/mach-cobalt/irq.h
@@ -0,0 +1,57 @@
1/*
2 * Cobalt IRQ 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 Cobalt Microserver
9 * Copyright (C) 1997, 2003 Ralf Baechle
10 * Copyright (C) 2001-2003 Liam Davies (ldavies@agile.tv)
11 * Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
12 */
13#ifndef _ASM_COBALT_IRQ_H
14#define _ASM_COBALT_IRQ_H
15
16/*
17 * i8259 interrupts used on Cobalt:
18 *
19 * 8 - RTC
20 * 9 - PCI slot
21 * 14 - IDE0
22 * 15 - IDE1(no connector on board)
23 */
24#define I8259A_IRQ_BASE 0
25
26#define PCISLOT_IRQ (I8259A_IRQ_BASE + 9)
27
28/*
29 * CPU interrupts used on Cobalt:
30 *
31 * 0 - Software interrupt 0 (unused)
32 * 1 - Software interrupt 0 (unused)
33 * 2 - cascade GT64111
34 * 3 - ethernet or SCSI host controller
35 * 4 - ethernet
36 * 5 - 16550 UART
37 * 6 - cascade i8259
38 * 7 - CP0 counter
39 */
40#define MIPS_CPU_IRQ_BASE 16
41
42#define GT641XX_CASCADE_IRQ (MIPS_CPU_IRQ_BASE + 2)
43#define RAQ2_SCSI_IRQ (MIPS_CPU_IRQ_BASE + 3)
44#define ETH0_IRQ (MIPS_CPU_IRQ_BASE + 3)
45#define QUBE1_ETH0_IRQ (MIPS_CPU_IRQ_BASE + 4)
46#define ETH1_IRQ (MIPS_CPU_IRQ_BASE + 4)
47#define SERIAL_IRQ (MIPS_CPU_IRQ_BASE + 5)
48#define SCSI_IRQ (MIPS_CPU_IRQ_BASE + 5)
49#define I8259_CASCADE_IRQ (MIPS_CPU_IRQ_BASE + 6)
50
51#define GT641XX_IRQ_BASE 24
52
53#include <asm/irq_gt641xx.h>
54
55#define NR_IRQS (GT641XX_PCI_INT3_IRQ + 1)
56
57#endif /* _ASM_COBALT_IRQ_H */
diff --git a/arch/mips/include/asm/mach-cobalt/mach-gt64120.h b/arch/mips/include/asm/mach-cobalt/mach-gt64120.h
new file mode 100644
index 000000000..ddb968a55
--- /dev/null
+++ b/arch/mips/include/asm/mach-cobalt/mach-gt64120.h
@@ -0,0 +1,14 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2006 Yoichi Yuasa <yuasa@linux-mips.org>
4 */
5#ifndef _COBALT_MACH_GT64120_H
6#define _COBALT_MACH_GT64120_H
7
8/*
9 * Cobalt uses GT64111. GT64111 is almost the same as GT64120.
10 */
11
12#define GT64120_BASE CKSEG1ADDR(GT_DEF_BASE)
13
14#endif /* _COBALT_MACH_GT64120_H */
diff --git a/arch/mips/include/asm/mach-db1x00/bcsr.h b/arch/mips/include/asm/mach-db1x00/bcsr.h
new file mode 100644
index 000000000..4a27738e8
--- /dev/null
+++ b/arch/mips/include/asm/mach-db1x00/bcsr.h
@@ -0,0 +1,261 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * bcsr.h -- Db1xxx/Pb1xxx Devboard CPLD registers ("BCSR") abstraction.
4 *
5 * All Alchemy development boards (except, of course, the weird PB1000)
6 * have a few registers in a CPLD with standardised layout; they mostly
7 * only differ in base address and bit meanings in the RESETS and BOARD
8 * registers.
9 *
10 * All data taken from the official AMD board documentation sheets.
11 */
12
13#ifndef _DB1XXX_BCSR_H_
14#define _DB1XXX_BCSR_H_
15
16
17/* BCSR base addresses on various boards. BCSR base 2 refers to the
18 * physical address of the first HEXLEDS register, which is usually
19 * a variable offset from the WHOAMI register.
20 */
21
22/* DB1000, DB1100, DB1500, PB1100, PB1500 */
23#define DB1000_BCSR_PHYS_ADDR 0x0E000000
24#define DB1000_BCSR_HEXLED_OFS 0x01000000
25
26#define DB1550_BCSR_PHYS_ADDR 0x0F000000
27#define DB1550_BCSR_HEXLED_OFS 0x00400000
28
29#define PB1550_BCSR_PHYS_ADDR 0x0F000000
30#define PB1550_BCSR_HEXLED_OFS 0x00800000
31
32#define DB1200_BCSR_PHYS_ADDR 0x19800000
33#define DB1200_BCSR_HEXLED_OFS 0x00400000
34
35#define PB1200_BCSR_PHYS_ADDR 0x0D800000
36#define PB1200_BCSR_HEXLED_OFS 0x00400000
37
38#define DB1300_BCSR_PHYS_ADDR 0x19800000
39#define DB1300_BCSR_HEXLED_OFS 0x00400000
40
41enum bcsr_id {
42 /* BCSR base 1 */
43 BCSR_WHOAMI = 0,
44 BCSR_STATUS,
45 BCSR_SWITCHES,
46 BCSR_RESETS,
47 BCSR_PCMCIA,
48 BCSR_BOARD,
49 BCSR_LEDS,
50 BCSR_SYSTEM,
51 /* Au1200/1300 based boards */
52 BCSR_INTCLR,
53 BCSR_INTSET,
54 BCSR_MASKCLR,
55 BCSR_MASKSET,
56 BCSR_SIGSTAT,
57 BCSR_INTSTAT,
58
59 /* BCSR base 2 */
60 BCSR_HEXLEDS,
61 BCSR_RSVD1,
62 BCSR_HEXCLEAR,
63
64 BCSR_CNT,
65};
66
67/* register offsets, valid for all Db1xxx/Pb1xxx boards */
68#define BCSR_REG_WHOAMI 0x00
69#define BCSR_REG_STATUS 0x04
70#define BCSR_REG_SWITCHES 0x08
71#define BCSR_REG_RESETS 0x0c
72#define BCSR_REG_PCMCIA 0x10
73#define BCSR_REG_BOARD 0x14
74#define BCSR_REG_LEDS 0x18
75#define BCSR_REG_SYSTEM 0x1c
76/* Au1200/Au1300 based boards: CPLD IRQ muxer */
77#define BCSR_REG_INTCLR 0x20
78#define BCSR_REG_INTSET 0x24
79#define BCSR_REG_MASKCLR 0x28
80#define BCSR_REG_MASKSET 0x2c
81#define BCSR_REG_SIGSTAT 0x30
82#define BCSR_REG_INTSTAT 0x34
83
84/* hexled control, offset from BCSR base 2 */
85#define BCSR_REG_HEXLEDS 0x00
86#define BCSR_REG_HEXCLEAR 0x08
87
88/*
89 * Register Bits and Pieces.
90 */
91#define BCSR_WHOAMI_DCID(x) ((x) & 0xf)
92#define BCSR_WHOAMI_CPLD(x) (((x) >> 4) & 0xf)
93#define BCSR_WHOAMI_BOARD(x) (((x) >> 8) & 0xf)
94
95/* register "WHOAMI" bits 11:8 identify the board */
96enum bcsr_whoami_boards {
97 BCSR_WHOAMI_PB1500 = 1,
98 BCSR_WHOAMI_PB1500R2,
99 BCSR_WHOAMI_PB1100,
100 BCSR_WHOAMI_DB1000,
101 BCSR_WHOAMI_DB1100,
102 BCSR_WHOAMI_DB1500,
103 BCSR_WHOAMI_DB1550,
104 BCSR_WHOAMI_PB1550_DDR,
105 BCSR_WHOAMI_PB1550 = BCSR_WHOAMI_PB1550_DDR,
106 BCSR_WHOAMI_PB1550_SDR,
107 BCSR_WHOAMI_PB1200_DDR1,
108 BCSR_WHOAMI_PB1200 = BCSR_WHOAMI_PB1200_DDR1,
109 BCSR_WHOAMI_PB1200_DDR2,
110 BCSR_WHOAMI_DB1200,
111 BCSR_WHOAMI_DB1300,
112};
113
114/* STATUS reg. Unless otherwise noted, they're valid on all boards.
115 * PB1200 = DB1200.
116 */
117#define BCSR_STATUS_PC0VS 0x0003
118#define BCSR_STATUS_PC1VS 0x000C
119#define BCSR_STATUS_PC0FI 0x0010
120#define BCSR_STATUS_PC1FI 0x0020
121#define BCSR_STATUS_PB1550_SWAPBOOT 0x0040
122#define BCSR_STATUS_SRAMWIDTH 0x0080
123#define BCSR_STATUS_FLASHBUSY 0x0100
124#define BCSR_STATUS_ROMBUSY 0x0400
125#define BCSR_STATUS_SD0WP 0x0400 /* DB1200/DB1300:SD1 */
126#define BCSR_STATUS_SD1WP 0x0800
127#define BCSR_STATUS_USBOTGID 0x0800 /* PB/DB1550 */
128#define BCSR_STATUS_DB1000_SWAPBOOT 0x2000
129#define BCSR_STATUS_DB1200_SWAPBOOT 0x0040 /* DB1200/1300 */
130#define BCSR_STATUS_IDECBLID 0x0200 /* DB1200/1300 */
131#define BCSR_STATUS_DB1200_U0RXD 0x1000 /* DB1200 */
132#define BCSR_STATUS_DB1200_U1RXD 0x2000 /* DB1200 */
133#define BCSR_STATUS_FLASHDEN 0xC000
134#define BCSR_STATUS_DB1550_U0RXD 0x1000 /* DB1550 */
135#define BCSR_STATUS_DB1550_U3RXD 0x2000 /* DB1550 */
136#define BCSR_STATUS_PB1550_U0RXD 0x1000 /* PB1550 */
137#define BCSR_STATUS_PB1550_U1RXD 0x2000 /* PB1550 */
138#define BCSR_STATUS_PB1550_U3RXD 0x8000 /* PB1550 */
139
140#define BCSR_STATUS_CFWP 0x4000 /* DB1300 */
141#define BCSR_STATUS_USBOCn 0x2000 /* DB1300 */
142#define BCSR_STATUS_OTGOCn 0x1000 /* DB1300 */
143#define BCSR_STATUS_DCDMARQ 0x0010 /* DB1300 */
144#define BCSR_STATUS_IDEDMARQ 0x0020 /* DB1300 */
145
146/* DB/PB1000,1100,1500,1550 */
147#define BCSR_RESETS_PHY0 0x0001
148#define BCSR_RESETS_PHY1 0x0002
149#define BCSR_RESETS_DC 0x0004
150#define BCSR_RESETS_FIR_SEL 0x2000
151#define BCSR_RESETS_IRDA_MODE_MASK 0xC000
152#define BCSR_RESETS_IRDA_MODE_FULL 0x0000
153#define BCSR_RESETS_PB1550_WSCFSM 0x2000
154#define BCSR_RESETS_IRDA_MODE_OFF 0x4000
155#define BCSR_RESETS_IRDA_MODE_2_3 0x8000
156#define BCSR_RESETS_IRDA_MODE_1_3 0xC000
157#define BCSR_RESETS_DMAREQ 0x8000 /* PB1550 */
158
159#define BCSR_BOARD_PCIM66EN 0x0001
160#define BCSR_BOARD_SD0PWR 0x0040
161#define BCSR_BOARD_SD1PWR 0x0080
162#define BCSR_BOARD_PCIM33 0x0100
163#define BCSR_BOARD_PCIEXTARB 0x0200
164#define BCSR_BOARD_GPIO200RST 0x0400
165#define BCSR_BOARD_PCICLKOUT 0x0800
166#define BCSR_BOARD_PB1100_SD0PWR 0x0400
167#define BCSR_BOARD_PB1100_SD1PWR 0x0800
168#define BCSR_BOARD_PCICFG 0x1000
169#define BCSR_BOARD_SPISEL 0x2000 /* PB/DB1550 */
170#define BCSR_BOARD_SD0WP 0x4000 /* DB1100 */
171#define BCSR_BOARD_SD1WP 0x8000 /* DB1100 */
172
173
174/* DB/PB1200/1300 */
175#define BCSR_RESETS_ETH 0x0001
176#define BCSR_RESETS_CAMERA 0x0002
177#define BCSR_RESETS_DC 0x0004
178#define BCSR_RESETS_IDE 0x0008
179#define BCSR_RESETS_TV 0x0010 /* DB1200/1300 */
180/* Not resets but in the same register */
181#define BCSR_RESETS_PWMR1MUX 0x0800 /* DB1200 */
182#define BCSR_RESETS_PB1200_WSCFSM 0x0800 /* PB1200 */
183#define BCSR_RESETS_PSC0MUX 0x1000
184#define BCSR_RESETS_PSC1MUX 0x2000
185#define BCSR_RESETS_SPISEL 0x4000
186#define BCSR_RESETS_SD1MUX 0x8000 /* PB1200 */
187
188#define BCSR_RESETS_VDDQSHDN 0x0200 /* DB1300 */
189#define BCSR_RESETS_OTPPGM 0x0400 /* DB1300 */
190#define BCSR_RESETS_OTPSCLK 0x0800 /* DB1300 */
191#define BCSR_RESETS_OTPWRPROT 0x1000 /* DB1300 */
192#define BCSR_RESETS_OTPCSB 0x2000 /* DB1300 */
193#define BCSR_RESETS_OTGPWR 0x4000 /* DB1300 */
194#define BCSR_RESETS_USBHPWR 0x8000 /* DB1300 */
195
196#define BCSR_BOARD_LCDVEE 0x0001
197#define BCSR_BOARD_LCDVDD 0x0002
198#define BCSR_BOARD_LCDBL 0x0004
199#define BCSR_BOARD_CAMSNAP 0x0010
200#define BCSR_BOARD_CAMPWR 0x0020
201#define BCSR_BOARD_SD0PWR 0x0040
202#define BCSR_BOARD_CAMCS 0x0010 /* DB1300 */
203#define BCSR_BOARD_HDMI_DE 0x0040 /* DB1300 */
204
205#define BCSR_SWITCHES_DIP 0x00FF
206#define BCSR_SWITCHES_DIP_1 0x0080
207#define BCSR_SWITCHES_DIP_2 0x0040
208#define BCSR_SWITCHES_DIP_3 0x0020
209#define BCSR_SWITCHES_DIP_4 0x0010
210#define BCSR_SWITCHES_DIP_5 0x0008
211#define BCSR_SWITCHES_DIP_6 0x0004
212#define BCSR_SWITCHES_DIP_7 0x0002
213#define BCSR_SWITCHES_DIP_8 0x0001
214#define BCSR_SWITCHES_ROTARY 0x0F00
215
216
217#define BCSR_PCMCIA_PC0VPP 0x0003
218#define BCSR_PCMCIA_PC0VCC 0x000C
219#define BCSR_PCMCIA_PC0DRVEN 0x0010
220#define BCSR_PCMCIA_PC0RST 0x0080
221#define BCSR_PCMCIA_PC1VPP 0x0300
222#define BCSR_PCMCIA_PC1VCC 0x0C00
223#define BCSR_PCMCIA_PC1DRVEN 0x1000
224#define BCSR_PCMCIA_PC1RST 0x8000
225
226
227#define BCSR_LEDS_DECIMALS 0x0003
228#define BCSR_LEDS_LED0 0x0100
229#define BCSR_LEDS_LED1 0x0200
230#define BCSR_LEDS_LED2 0x0400
231#define BCSR_LEDS_LED3 0x0800
232
233
234#define BCSR_SYSTEM_RESET 0x8000 /* clear to reset */
235#define BCSR_SYSTEM_PWROFF 0x4000 /* set to power off */
236#define BCSR_SYSTEM_VDDI 0x001F /* PB1xxx boards */
237#define BCSR_SYSTEM_DEBUGCSMASK 0x003F /* DB1300 */
238#define BCSR_SYSTEM_UDMAMODE 0x0100 /* DB1300 */
239#define BCSR_SYSTEM_WAKEONIRQ 0x0200 /* DB1300 */
240#define BCSR_SYSTEM_VDDI1300 0x3C00 /* DB1300 */
241
242
243
244/* initialize BCSR for a board. Provide the PHYSICAL addresses of both
245 * BCSR spaces.
246 */
247void __init bcsr_init(unsigned long bcsr1_phys, unsigned long bcsr2_phys);
248
249/* read a board register */
250unsigned short bcsr_read(enum bcsr_id reg);
251
252/* write to a board register */
253void bcsr_write(enum bcsr_id reg, unsigned short val);
254
255/* modify a register. clear bits set in 'clr', set bits set in 'set' */
256void bcsr_mod(enum bcsr_id reg, unsigned short clr, unsigned short set);
257
258/* install CPLD IRQ demuxer (DB1200/PB1200) */
259void __init bcsr_init_irq(int csc_start, int csc_end, int hook_irq);
260
261#endif
diff --git a/arch/mips/include/asm/mach-db1x00/irq.h b/arch/mips/include/asm/mach-db1x00/irq.h
new file mode 100644
index 000000000..15b266932
--- /dev/null
+++ b/arch/mips/include/asm/mach-db1x00/irq.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) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_IRQ_H
9#define __ASM_MACH_GENERIC_IRQ_H
10
11
12#ifdef NR_IRQS
13#undef NR_IRQS
14#endif
15
16#ifndef MIPS_CPU_IRQ_BASE
17#define MIPS_CPU_IRQ_BASE 0
18#endif
19
20/* 8 (MIPS) + 128 (au1300) + 16 (cpld) */
21#define NR_IRQS 152
22
23#endif /* __ASM_MACH_GENERIC_IRQ_H */
diff --git a/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h b/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h
new file mode 100644
index 000000000..1896e88f6
--- /dev/null
+++ b/arch/mips/include/asm/mach-dec/cpu-feature-overrides.h
@@ -0,0 +1,97 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * CPU feature overrides for DECstation systems. Two variations
4 * are generally applicable.
5 *
6 * Copyright (C) 2013 Maciej W. Rozycki
7 */
8#ifndef __ASM_MACH_DEC_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_DEC_CPU_FEATURE_OVERRIDES_H
10
11/* Generic ones first. */
12#define cpu_has_tlb 1
13#define cpu_has_tlbinv 0
14#define cpu_has_segments 0
15#define cpu_has_eva 0
16#define cpu_has_htw 0
17#define cpu_has_rixiex 0
18#define cpu_has_maar 0
19#define cpu_has_rw_llb 0
20#define cpu_has_tx39_cache 0
21#define cpu_has_divec 0
22#define cpu_has_prefetch 0
23#define cpu_has_mcheck 0
24#define cpu_has_ejtag 0
25#define cpu_has_mips16 0
26#define cpu_has_mips16e2 0
27#define cpu_has_mdmx 0
28#define cpu_has_mips3d 0
29#define cpu_has_smartmips 0
30#define cpu_has_rixi 0
31#define cpu_has_xpa 0
32#define cpu_has_vtag_icache 0
33#define cpu_has_ic_fills_f_dc 0
34#define cpu_has_pindexed_dcache 0
35#define cpu_icache_snoops_remote_store 1
36#define cpu_has_mips_4 0
37#define cpu_has_mips_5 0
38#define cpu_has_mips32r1 0
39#define cpu_has_mips32r2 0
40#define cpu_has_mips64r1 0
41#define cpu_has_mips64r2 0
42#define cpu_has_dsp 0
43#define cpu_has_dsp2 0
44#define cpu_has_mipsmt 0
45#define cpu_has_userlocal 0
46#define cpu_has_perf_cntr_intr_bit 0
47#define cpu_has_vz 0
48#define cpu_has_fre 0
49#define cpu_has_cdmm 0
50
51/* R3k-specific ones. */
52#ifdef CONFIG_CPU_R3000
53#define cpu_has_3kex 1
54#define cpu_has_4kex 0
55#define cpu_has_3k_cache 1
56#define cpu_has_4k_cache 0
57#define cpu_has_32fpr 0
58#define cpu_has_counter 0
59#define cpu_has_watch 0
60#define cpu_has_vce 0
61#define cpu_has_cache_cdex_p 0
62#define cpu_has_cache_cdex_s 0
63#define cpu_has_llsc 0
64#define cpu_has_dc_aliases 0
65#define cpu_has_mips_2 0
66#define cpu_has_mips_3 0
67#define cpu_has_nofpuex 1
68#define cpu_has_inclusive_pcaches 0
69#define cpu_dcache_line_size() 4
70#define cpu_icache_line_size() 4
71#define cpu_scache_line_size() 0
72#endif /* CONFIG_CPU_R3000 */
73
74/* R4k-specific ones. */
75#ifdef CONFIG_CPU_R4X00
76#define cpu_has_3kex 0
77#define cpu_has_4kex 1
78#define cpu_has_3k_cache 0
79#define cpu_has_4k_cache 1
80#define cpu_has_32fpr 1
81#define cpu_has_counter 1
82#define cpu_has_watch 1
83#define cpu_has_vce 1
84#define cpu_has_cache_cdex_p 1
85#define cpu_has_cache_cdex_s 1
86#define cpu_has_llsc 1
87#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
88#define cpu_has_mips_2 1
89#define cpu_has_mips_3 1
90#define cpu_has_nofpuex 0
91#define cpu_has_inclusive_pcaches 1
92#define cpu_dcache_line_size() 16
93#define cpu_icache_line_size() 16
94#define cpu_scache_line_size() 32
95#endif /* CONFIG_CPU_R4X00 */
96
97#endif /* __ASM_MACH_DEC_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-dec/mc146818rtc.h b/arch/mips/include/asm/mach-dec/mc146818rtc.h
new file mode 100644
index 000000000..d4614e2a8
--- /dev/null
+++ b/arch/mips/include/asm/mach-dec/mc146818rtc.h
@@ -0,0 +1,39 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * RTC definitions for DECstation style attached Dallas DS1287 chip.
4 *
5 * Copyright (C) 1998, 2001 by Ralf Baechle
6 * Copyright (C) 1998 by Harald Koerfgen
7 * Copyright (C) 2002, 2005 Maciej W. Rozycki
8 */
9#ifndef __ASM_MIPS_DEC_RTC_DEC_H
10#define __ASM_MIPS_DEC_RTC_DEC_H
11
12#include <linux/types.h>
13#include <asm/addrspace.h>
14#include <asm/dec/system.h>
15
16extern volatile u8 *dec_rtc_base;
17
18#define ARCH_RTC_LOCATION
19
20#define RTC_PORT(x) CPHYSADDR((long)dec_rtc_base)
21#define RTC_IO_EXTENT dec_kn_slot_size
22#define RTC_IOMAPPED 0
23#undef RTC_IRQ
24
25#define RTC_DEC_YEAR 0x3f /* Where we store the real year on DECs. */
26
27static inline unsigned char CMOS_READ(unsigned long addr)
28{
29 return dec_rtc_base[addr * 4];
30}
31
32static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
33{
34 dec_rtc_base[addr * 4] = data;
35}
36
37#define RTC_ALWAYS_BCD 0
38
39#endif /* __ASM_MIPS_DEC_RTC_DEC_H */
diff --git a/arch/mips/include/asm/mach-generic/cpu-feature-overrides.h b/arch/mips/include/asm/mach-generic/cpu-feature-overrides.h
new file mode 100644
index 000000000..42be9e9ce
--- /dev/null
+++ b/arch/mips/include/asm/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/* Intentionally empty file ... */
12
13#endif /* __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-generic/floppy.h b/arch/mips/include/asm/mach-generic/floppy.h
new file mode 100644
index 000000000..e0c9cd41f
--- /dev/null
+++ b/arch/mips/include/asm/mach-generic/floppy.h
@@ -0,0 +1,133 @@
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/ioport.h>
13#include <linux/sched.h>
14#include <linux/linkage.h>
15#include <linux/types.h>
16#include <linux/mm.h>
17
18#include <asm/bootinfo.h>
19#include <asm/cachectl.h>
20#include <asm/dma.h>
21#include <asm/floppy.h>
22#include <asm/io.h>
23#include <asm/irq.h>
24
25/*
26 * How to access the FDC's registers.
27 */
28static inline unsigned char fd_inb(unsigned int base, unsigned int reg)
29{
30 return inb_p(base + reg);
31}
32
33static inline void fd_outb(unsigned char value, unsigned int base, unsigned int reg)
34{
35 outb_p(value, base + reg);
36}
37
38/*
39 * How to access the floppy DMA functions.
40 */
41static inline void fd_enable_dma(void)
42{
43 enable_dma(FLOPPY_DMA);
44}
45
46static inline void fd_disable_dma(void)
47{
48 disable_dma(FLOPPY_DMA);
49}
50
51static inline int fd_request_dma(void)
52{
53 return request_dma(FLOPPY_DMA, "floppy");
54}
55
56static inline void fd_free_dma(void)
57{
58 free_dma(FLOPPY_DMA);
59}
60
61static inline void fd_clear_dma_ff(void)
62{
63 clear_dma_ff(FLOPPY_DMA);
64}
65
66static inline void fd_set_dma_mode(char mode)
67{
68 set_dma_mode(FLOPPY_DMA, mode);
69}
70
71static inline void fd_set_dma_addr(char *addr)
72{
73 set_dma_addr(FLOPPY_DMA, (unsigned long) addr);
74}
75
76static inline void fd_set_dma_count(unsigned int count)
77{
78 set_dma_count(FLOPPY_DMA, count);
79}
80
81static inline int fd_get_dma_residue(void)
82{
83 return get_dma_residue(FLOPPY_DMA);
84}
85
86static inline void fd_enable_irq(void)
87{
88 enable_irq(FLOPPY_IRQ);
89}
90
91static inline void fd_disable_irq(void)
92{
93 disable_irq(FLOPPY_IRQ);
94}
95
96static inline int fd_request_irq(void)
97{
98 return request_irq(FLOPPY_IRQ, floppy_interrupt,
99 0, "floppy", NULL);
100}
101
102static inline void fd_free_irq(void)
103{
104 free_irq(FLOPPY_IRQ, NULL);
105}
106
107#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
108
109
110static inline unsigned long fd_getfdaddr1(void)
111{
112 return 0x3f0;
113}
114
115static inline unsigned long fd_dma_mem_alloc(unsigned long size)
116{
117 return __get_dma_pages(GFP_KERNEL, get_order(size));
118}
119
120static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
121{
122 free_pages(addr, get_order(size));
123}
124
125static inline unsigned long fd_drive_type(unsigned long n)
126{
127 if (n == 0)
128 return 4; /* 3,5", 1.44mb */
129
130 return 0;
131}
132
133#endif /* __ASM_MACH_GENERIC_FLOPPY_H */
diff --git a/arch/mips/include/asm/mach-generic/ide.h b/arch/mips/include/asm/mach-generic/ide.h
new file mode 100644
index 000000000..4ae5fbcb1
--- /dev/null
+++ b/arch/mips/include/asm/mach-generic/ide.h
@@ -0,0 +1,138 @@
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/pci.h>
19#include <linux/stddef.h>
20#include <asm/processor.h>
21
22/* MIPS port and memory-mapped I/O string operations. */
23static inline void __ide_flush_prologue(void)
24{
25#ifdef CONFIG_SMP
26 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)
27 preempt_disable();
28#endif
29}
30
31static inline void __ide_flush_epilogue(void)
32{
33#ifdef CONFIG_SMP
34 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)
35 preempt_enable();
36#endif
37}
38
39static inline void __ide_flush_dcache_range(unsigned long addr, unsigned long size)
40{
41 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) {
42 unsigned long end = addr + size;
43
44 while (addr < end) {
45 local_flush_data_cache_page((void *)addr);
46 addr += PAGE_SIZE;
47 }
48 }
49}
50
51/*
52 * insw() and gang might be called with interrupts disabled, so we can't
53 * send IPIs for flushing due to the potencial of deadlocks, see the comment
54 * above smp_call_function() in arch/mips/kernel/smp.c. We work around the
55 * problem by disabling preemption so we know we actually perform the flush
56 * on the processor that actually has the lines to be flushed which hopefully
57 * is even better for performance anyway.
58 */
59static inline void __ide_insw(unsigned long port, void *addr,
60 unsigned int count)
61{
62 __ide_flush_prologue();
63 insw(port, addr, count);
64 __ide_flush_dcache_range((unsigned long)addr, count * 2);
65 __ide_flush_epilogue();
66}
67
68static inline void __ide_insl(unsigned long port, void *addr, unsigned int count)
69{
70 __ide_flush_prologue();
71 insl(port, addr, count);
72 __ide_flush_dcache_range((unsigned long)addr, count * 4);
73 __ide_flush_epilogue();
74}
75
76static inline void __ide_outsw(unsigned long port, const void *addr,
77 unsigned long count)
78{
79 __ide_flush_prologue();
80 outsw(port, addr, count);
81 __ide_flush_dcache_range((unsigned long)addr, count * 2);
82 __ide_flush_epilogue();
83}
84
85static inline void __ide_outsl(unsigned long port, const void *addr,
86 unsigned long count)
87{
88 __ide_flush_prologue();
89 outsl(port, addr, count);
90 __ide_flush_dcache_range((unsigned long)addr, count * 4);
91 __ide_flush_epilogue();
92}
93
94static inline void __ide_mm_insw(void __iomem *port, void *addr, u32 count)
95{
96 __ide_flush_prologue();
97 readsw(port, addr, count);
98 __ide_flush_dcache_range((unsigned long)addr, count * 2);
99 __ide_flush_epilogue();
100}
101
102static inline void __ide_mm_insl(void __iomem *port, void *addr, u32 count)
103{
104 __ide_flush_prologue();
105 readsl(port, addr, count);
106 __ide_flush_dcache_range((unsigned long)addr, count * 4);
107 __ide_flush_epilogue();
108}
109
110static inline void __ide_mm_outsw(void __iomem *port, void *addr, u32 count)
111{
112 __ide_flush_prologue();
113 writesw(port, addr, count);
114 __ide_flush_dcache_range((unsigned long)addr, count * 2);
115 __ide_flush_epilogue();
116}
117
118static inline void __ide_mm_outsl(void __iomem * port, void *addr, u32 count)
119{
120 __ide_flush_prologue();
121 writesl(port, addr, count);
122 __ide_flush_dcache_range((unsigned long)addr, count * 4);
123 __ide_flush_epilogue();
124}
125
126/* ide_insw calls insw, not __ide_insw. Why? */
127#undef insw
128#undef insl
129#undef outsw
130#undef outsl
131#define insw(port, addr, count) __ide_insw(port, addr, count)
132#define insl(port, addr, count) __ide_insl(port, addr, count)
133#define outsw(port, addr, count) __ide_outsw(port, addr, count)
134#define outsl(port, addr, count) __ide_outsl(port, addr, count)
135
136#endif /* __KERNEL__ */
137
138#endif /* __ASM_MACH_GENERIC_IDE_H */
diff --git a/arch/mips/include/asm/mach-generic/ioremap.h b/arch/mips/include/asm/mach-generic/ioremap.h
new file mode 100644
index 000000000..f2442b845
--- /dev/null
+++ b/arch/mips/include/asm/mach-generic/ioremap.h
@@ -0,0 +1,21 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/mach-generic/ioremap.h
4 */
5#ifndef __ASM_MACH_GENERIC_IOREMAP_H
6#define __ASM_MACH_GENERIC_IOREMAP_H
7
8#include <linux/types.h>
9
10static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
11 unsigned long flags)
12{
13 return NULL;
14}
15
16static inline int plat_iounmap(const volatile void __iomem *addr)
17{
18 return 0;
19}
20
21#endif /* __ASM_MACH_GENERIC_IOREMAP_H */
diff --git a/arch/mips/include/asm/mach-generic/irq.h b/arch/mips/include/asm/mach-generic/irq.h
new file mode 100644
index 000000000..079889ced
--- /dev/null
+++ b/arch/mips/include/asm/mach-generic/irq.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 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_IRQ_H
9#define __ASM_MACH_GENERIC_IRQ_H
10
11#ifndef NR_IRQS
12#define NR_IRQS 256
13#endif
14
15#ifdef CONFIG_I8259
16#ifndef I8259A_IRQ_BASE
17#define I8259A_IRQ_BASE 0
18#endif
19#endif
20
21#ifdef CONFIG_IRQ_MIPS_CPU
22
23#ifndef MIPS_CPU_IRQ_BASE
24#ifdef CONFIG_I8259
25#define MIPS_CPU_IRQ_BASE 16
26#else
27#define MIPS_CPU_IRQ_BASE 0
28#endif /* CONFIG_I8259 */
29#endif
30
31#ifdef CONFIG_IRQ_CPU_RM7K
32#ifndef RM7K_CPU_IRQ_BASE
33#define RM7K_CPU_IRQ_BASE (MIPS_CPU_IRQ_BASE+8)
34#endif
35#endif
36
37#endif /* CONFIG_IRQ_MIPS_CPU */
38
39#endif /* __ASM_MACH_GENERIC_IRQ_H */
diff --git a/arch/mips/include/asm/mach-generic/kernel-entry-init.h b/arch/mips/include/asm/mach-generic/kernel-entry-init.h
new file mode 100644
index 000000000..a229297c8
--- /dev/null
+++ b/arch/mips/include/asm/mach-generic/kernel-entry-init.h
@@ -0,0 +1,25 @@
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 Embedded Alley Solutions, Inc
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_GENERIC_KERNEL_ENTRY_H
10#define __ASM_MACH_GENERIC_KERNEL_ENTRY_H
11
12/* Intentionally empty macro, used in head.S. Override in
13 * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
14 */
15 .macro kernel_entry_setup
16 .endm
17
18/*
19 * Do SMP slave processor setup necessary before we can safely execute C code.
20 */
21 .macro smp_slave_setup
22 .endm
23
24
25#endif /* __ASM_MACH_GENERIC_KERNEL_ENTRY_H */
diff --git a/arch/mips/include/asm/mach-generic/kmalloc.h b/arch/mips/include/asm/mach-generic/kmalloc.h
new file mode 100644
index 000000000..649a98338
--- /dev/null
+++ b/arch/mips/include/asm/mach-generic/kmalloc.h
@@ -0,0 +1,13 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_GENERIC_KMALLOC_H
3#define __ASM_MACH_GENERIC_KMALLOC_H
4
5#ifdef CONFIG_DMA_NONCOHERENT
6/*
7 * Total overkill for most systems but need as a safe default.
8 * Set this one if any device in the system might do non-coherent DMA.
9 */
10#define ARCH_DMA_MINALIGN 128
11#endif
12
13#endif /* __ASM_MACH_GENERIC_KMALLOC_H */
diff --git a/arch/mips/include/asm/mach-generic/mangle-port.h b/arch/mips/include/asm/mach-generic/mangle-port.h
new file mode 100644
index 000000000..77c65c294
--- /dev/null
+++ b/arch/mips/include/asm/mach-generic/mangle-port.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 * 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/*
17 * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
18 * less sane hardware forces software to fiddle with this...
19 *
20 * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
21 * you can't have the numerical value of data and byte addresses within
22 * multibyte quantities both preserved at the same time. Hence two
23 * variations of functions: non-prefixed ones that preserve the value
24 * and prefixed ones that preserve byte addresses. The latters are
25 * typically used for moving raw data between a peripheral and memory (cf.
26 * string I/O functions), hence the "__mem_" prefix.
27 */
28#if defined(CONFIG_SWAP_IO_SPACE)
29
30# define ioswabb(a, x) (x)
31# define __mem_ioswabb(a, x) (x)
32# define ioswabw(a, x) le16_to_cpu((__force __le16)(x))
33# define __mem_ioswabw(a, x) (x)
34# define ioswabl(a, x) le32_to_cpu((__force __le32)(x))
35# define __mem_ioswabl(a, x) (x)
36# define ioswabq(a, x) le64_to_cpu((__force __le64)(x))
37# define __mem_ioswabq(a, x) (x)
38
39#else
40
41# define ioswabb(a, x) (x)
42# define __mem_ioswabb(a, x) (x)
43# define ioswabw(a, x) (x)
44# define __mem_ioswabw(a, x) ((__force u16)cpu_to_le16(x))
45# define ioswabl(a, x) (x)
46# define __mem_ioswabl(a, x) ((__force u32)cpu_to_le32(x))
47# define ioswabq(a, x) (x)
48# define __mem_ioswabq(a, x) ((__force u64)cpu_to_le64(x))
49
50#endif
51
52#endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
diff --git a/arch/mips/include/asm/mach-generic/mc146818rtc.h b/arch/mips/include/asm/mach-generic/mc146818rtc.h
new file mode 100644
index 000000000..9c72e540f
--- /dev/null
+++ b/arch/mips/include/asm/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 0
31
32#ifndef mc146818_decode_year
33#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
34#endif
35
36#endif /* __ASM_MACH_GENERIC_MC146818RTC_H */
diff --git a/arch/mips/include/asm/mach-generic/spaces.h b/arch/mips/include/asm/mach-generic/spaces.h
new file mode 100644
index 000000000..c3ac06a6a
--- /dev/null
+++ b/arch/mips/include/asm/mach-generic/spaces.h
@@ -0,0 +1,110 @@
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/const.h>
14
15#include <asm/mipsregs.h>
16
17#ifndef IO_SPACE_LIMIT
18#define IO_SPACE_LIMIT 0xffff
19#endif
20
21/*
22 * This gives the physical RAM offset.
23 */
24#ifndef __ASSEMBLY__
25# if defined(CONFIG_MIPS_AUTO_PFN_OFFSET)
26# define PHYS_OFFSET ((unsigned long)PFN_PHYS(ARCH_PFN_OFFSET))
27# elif !defined(PHYS_OFFSET)
28# define PHYS_OFFSET _AC(0, UL)
29# endif
30#endif /* __ASSEMBLY__ */
31
32#ifdef CONFIG_32BIT
33#ifdef CONFIG_KVM_GUEST
34#define CAC_BASE _AC(0x40000000, UL)
35#else
36#define CAC_BASE _AC(0x80000000, UL)
37#endif
38#ifndef IO_BASE
39#define IO_BASE _AC(0xa0000000, UL)
40#endif
41#ifndef UNCAC_BASE
42#define UNCAC_BASE _AC(0xa0000000, UL)
43#endif
44
45#ifndef MAP_BASE
46#ifdef CONFIG_KVM_GUEST
47#define MAP_BASE _AC(0x60000000, UL)
48#else
49#define MAP_BASE _AC(0xc0000000, UL)
50#endif
51#endif
52
53/*
54 * Memory above this physical address will be considered highmem.
55 */
56#ifndef HIGHMEM_START
57#define HIGHMEM_START _AC(0x20000000, UL)
58#endif
59
60#endif /* CONFIG_32BIT */
61
62#ifdef CONFIG_64BIT
63
64#ifndef CAC_BASE
65#define CAC_BASE PHYS_TO_XKPHYS(read_c0_config() & CONF_CM_CMASK, 0)
66#endif
67
68#ifndef IO_BASE
69#define IO_BASE _AC(0x9000000000000000, UL)
70#endif
71
72#ifndef UNCAC_BASE
73#define UNCAC_BASE _AC(0x9000000000000000, UL)
74#endif
75
76#ifndef MAP_BASE
77#define MAP_BASE _AC(0xc000000000000000, UL)
78#endif
79
80/*
81 * Memory above this physical address will be considered highmem.
82 * Fixme: 59 bits is a fictive number and makes assumptions about processors
83 * in the distant future. Nobody will care for a few years :-)
84 */
85#ifndef HIGHMEM_START
86#define HIGHMEM_START (_AC(1, UL) << _AC(59, UL))
87#endif
88
89#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
90#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
91#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
92
93#endif /* CONFIG_64BIT */
94
95/*
96 * This handles the memory map.
97 */
98#ifndef PAGE_OFFSET
99#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
100#endif
101
102#ifndef FIXADDR_TOP
103#ifdef CONFIG_KVM_GUEST
104#define FIXADDR_TOP ((unsigned long)(long)(int)0x7ffe0000)
105#else
106#define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)
107#endif
108#endif
109
110#endif /* __ASM_MACH_GENERIC_SPACES_H */
diff --git a/arch/mips/include/asm/mach-generic/topology.h b/arch/mips/include/asm/mach-generic/topology.h
new file mode 100644
index 000000000..5428f333a
--- /dev/null
+++ b/arch/mips/include/asm/mach-generic/topology.h
@@ -0,0 +1 @@
#include <asm-generic/topology.h>
diff --git a/arch/mips/include/asm/mach-ingenic/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ingenic/cpu-feature-overrides.h
new file mode 100644
index 000000000..7c5e576f9
--- /dev/null
+++ b/arch/mips/include/asm/mach-ingenic/cpu-feature-overrides.h
@@ -0,0 +1,50 @@
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 */
7#ifndef __ASM_MACH_JZ4740_CPU_FEATURE_OVERRIDES_H
8#define __ASM_MACH_JZ4740_CPU_FEATURE_OVERRIDES_H
9
10#define cpu_has_tlb 1
11#define cpu_has_4kex 1
12#define cpu_has_3k_cache 0
13#define cpu_has_4k_cache 1
14#define cpu_has_tx39_cache 0
15#define cpu_has_counter 0
16#define cpu_has_watch 1
17#define cpu_has_divec 1
18#define cpu_has_vce 0
19#define cpu_has_cache_cdex_p 0
20#define cpu_has_cache_cdex_s 0
21#define cpu_has_prefetch 1
22#define cpu_has_mcheck 1
23#define cpu_has_ejtag 1
24#define cpu_has_llsc 1
25#define cpu_has_mips16 0
26#define cpu_has_mips16e2 0
27#define cpu_has_mdmx 0
28#define cpu_has_mips3d 0
29#define cpu_has_smartmips 0
30#define kernel_uses_llsc 1
31#define cpu_has_vtag_icache 1
32#define cpu_has_dc_aliases 0
33#define cpu_has_ic_fills_f_dc 0
34#define cpu_has_pindexed_dcache 0
35#define cpu_has_mips32r1 1
36#define cpu_has_mips64r1 0
37#define cpu_has_mips64r2 0
38#define cpu_has_dsp 0
39#define cpu_has_dsp2 0
40#define cpu_has_mipsmt 0
41#define cpu_has_userlocal 0
42#define cpu_has_nofpuex 0
43#define cpu_has_64bits 0
44#define cpu_has_64bit_zero_reg 0
45#define cpu_has_inclusive_pcaches 0
46
47#define cpu_dcache_line_size() 32
48#define cpu_icache_line_size() 32
49
50#endif
diff --git a/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h
new file mode 100644
index 000000000..b80d5eafc
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.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, 07 Ralf Baechle
7 */
8#ifndef __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
10
11#include <asm/cpu.h>
12
13/*
14 * IP22 with a variety of processors so we can't use defaults for everything.
15 */
16#define cpu_has_tlb 1
17#define cpu_has_4kex 1
18#define cpu_has_4k_cache 1
19#define cpu_has_32fpr 1
20#define cpu_has_counter 1
21#define cpu_has_mips16 0
22#define cpu_has_mips16e2 0
23#define cpu_has_divec 0
24#define cpu_has_cache_cdex_p 1
25#define cpu_has_prefetch 0
26#define cpu_has_mcheck 0
27#define cpu_has_ejtag 0
28
29#define cpu_has_llsc 1
30#define cpu_has_vtag_icache 0 /* Needs to change for R8000 */
31#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
32#define cpu_has_ic_fills_f_dc 0
33
34#define cpu_has_dsp 0
35#define cpu_has_dsp2 0
36#define cpu_has_mipsmt 0
37#define cpu_has_userlocal 0
38
39#define cpu_has_nofpuex 0
40#define cpu_has_64bits 1
41
42#define cpu_has_mips_2 1
43#define cpu_has_mips_3 1
44#define cpu_has_mips_5 0
45
46#define cpu_has_mips32r1 0
47#define cpu_has_mips32r2 0
48#define cpu_has_mips64r1 0
49#define cpu_has_mips64r2 0
50
51#endif /* __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ip22/spaces.h b/arch/mips/include/asm/mach-ip22/spaces.h
new file mode 100644
index 000000000..24fe92cb5
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip22/spaces.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) 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#define PHYS_OFFSET _AC(0x08000000, UL)
14
15#include <asm/mach-generic/spaces.h>
16
17#endif /* __ASM_MACH_IP22_SPACES_H */
diff --git a/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h
new file mode 100644
index 000000000..79d6fd249
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h
@@ -0,0 +1,76 @@
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, 07 Ralf Baechle
7 */
8#ifndef __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
10
11#include <asm/cpu.h>
12
13/*
14 * IP27 only comes with R1x000 family processors, all using the same config
15 */
16#define cpu_has_tlb 1
17#define cpu_has_tlbinv 0
18#define cpu_has_segments 0
19#define cpu_has_eva 0
20#define cpu_has_htw 0
21#define cpu_has_rixiex 0
22#define cpu_has_maar 0
23#define cpu_has_rw_llb 0
24#define cpu_has_3kex 0
25#define cpu_has_4kex 1
26#define cpu_has_3k_cache 0
27#define cpu_has_4k_cache 1
28#define cpu_has_tx39_cache 0
29#define cpu_has_nofpuex 0
30#define cpu_has_32fpr 1
31#define cpu_has_counter 1
32#define cpu_has_watch 1
33#define cpu_has_64bits 1
34#define cpu_has_divec 0
35#define cpu_has_vce 0
36#define cpu_has_cache_cdex_p 0
37#define cpu_has_cache_cdex_s 0
38#define cpu_has_prefetch 1
39#define cpu_has_mcheck 0
40#define cpu_has_ejtag 0
41#define cpu_has_llsc 1
42#define cpu_has_mips16 0
43#define cpu_has_mips16e2 0
44#define cpu_has_mdmx 0
45#define cpu_has_mips3d 0
46#define cpu_has_smartmips 0
47#define cpu_has_rixi 0
48#define cpu_has_xpa 0
49#define cpu_has_vtag_icache 0
50#define cpu_has_dc_aliases 0
51#define cpu_has_ic_fills_f_dc 0
52
53#define cpu_icache_snoops_remote_store 1
54
55#define cpu_has_mips32r1 0
56#define cpu_has_mips32r2 0
57#define cpu_has_mips64r1 0
58#define cpu_has_mips64r2 0
59#define cpu_has_mips32r6 0
60#define cpu_has_mips64r6 0
61
62#define cpu_has_dsp 0
63#define cpu_has_dsp2 0
64#define cpu_has_mipsmt 0
65#define cpu_has_userlocal 0
66#define cpu_has_inclusive_pcaches 1
67#define cpu_has_perf_cntr_intr_bit 0
68#define cpu_has_vz 0
69#define cpu_has_fre 0
70#define cpu_has_cdmm 0
71
72#define cpu_dcache_line_size() 32
73#define cpu_icache_line_size() 64
74#define cpu_scache_line_size() 128
75
76#endif /* __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ip27/irq.h b/arch/mips/include/asm/mach-ip27/irq.h
new file mode 100644
index 000000000..f45d7999f
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip27/irq.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) 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#define NR_IRQS 256
14
15#include <asm/mach-generic/irq.h>
16
17#define IP27_HUB_PEND0_IRQ (MIPS_CPU_IRQ_BASE + 2)
18#define IP27_HUB_PEND1_IRQ (MIPS_CPU_IRQ_BASE + 3)
19#define IP27_RT_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 4)
20
21#define IP27_HUB_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
22#define IP27_HUB_IRQ_COUNT 128
23
24#endif /* __ASM_MACH_IP27_IRQ_H */
diff --git a/arch/mips/include/asm/mach-ip27/kernel-entry-init.h b/arch/mips/include/asm/mach-ip27/kernel-entry-init.h
new file mode 100644
index 000000000..3e54f605a
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip27/kernel-entry-init.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) 2000 Silicon Graphics, Inc.
7 * Copyright (C) 2005 Ralf Baechle <ralf@linux-mips.org>
8 */
9#ifndef __ASM_MACH_IP27_KERNEL_ENTRY_H
10#define __ASM_MACH_IP27_KERNEL_ENTRY_H
11
12#include <asm/sn/addrs.h>
13#include <asm/sn/agent.h>
14#include <asm/sn/klkernvars.h>
15
16/*
17 * TLB bits
18 */
19#define PAGE_GLOBAL (1 << 6)
20#define PAGE_VALID (1 << 7)
21#define PAGE_DIRTY (1 << 8)
22#define CACHE_CACHABLE_COW (5 << 9)
23
24 /*
25 * inputs are the text nasid in t1, data nasid in t2.
26 */
27 .macro MAPPED_KERNEL_SETUP_TLB
28#ifdef CONFIG_MAPPED_KERNEL
29 /*
30 * This needs to read the nasid - assume 0 for now.
31 * Drop in 0xffffffffc0000000 in tlbhi, 0+VG in tlblo_0,
32 * 0+DVG in tlblo_1.
33 */
34 dli t0, 0xffffffffc0000000
35 dmtc0 t0, CP0_ENTRYHI
36 li t0, 0x1c000 # Offset of text into node memory
37 dsll t1, NASID_SHFT # Shift text nasid into place
38 dsll t2, NASID_SHFT # Same for data nasid
39 or t1, t1, t0 # Physical load address of kernel text
40 or t2, t2, t0 # Physical load address of kernel data
41 dsrl t1, 12 # 4K pfn
42 dsrl t2, 12 # 4K pfn
43 dsll t1, 6 # Get pfn into place
44 dsll t2, 6 # Get pfn into place
45 li t0, ((PAGE_GLOBAL | PAGE_VALID | CACHE_CACHABLE_COW) >> 6)
46 or t0, t0, t1
47 mtc0 t0, CP0_ENTRYLO0 # physaddr, VG, cach exlwr
48 li t0, ((PAGE_GLOBAL | PAGE_VALID | PAGE_DIRTY | CACHE_CACHABLE_COW) >> 6)
49 or t0, t0, t2
50 mtc0 t0, CP0_ENTRYLO1 # physaddr, DVG, cach exlwr
51 li t0, 0x1ffe000 # MAPPED_KERN_TLBMASK, TLBPGMASK_16M
52 mtc0 t0, CP0_PAGEMASK
53 li t0, 0 # KMAP_INX
54 mtc0 t0, CP0_INDEX
55 li t0, 1
56 mtc0 t0, CP0_WIRED
57 tlbwi
58#else
59 mtc0 zero, CP0_WIRED
60#endif
61 .endm
62
63/*
64 * Intentionally empty macro, used in head.S. Override in
65 * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
66 */
67 .macro kernel_entry_setup
68 GET_NASID_ASM t1
69 move t2, t1 # text and data are here
70 MAPPED_KERNEL_SETUP_TLB
71 .endm
72
73/*
74 * Do SMP slave processor setup necessary before we can safely execute C code.
75 */
76 .macro smp_slave_setup
77 GET_NASID_ASM t1
78 dli t0, KLDIR_OFFSET + (KLI_KERN_VARS * KLDIR_ENT_SIZE) + \
79 KLDIR_OFF_POINTER + CAC_BASE
80 dsll t1, NASID_SHFT
81 or t0, t0, t1
82 ld t0, 0(t0) # t0 points to kern_vars struct
83 lh t1, KV_RO_NASID_OFFSET(t0)
84 lh t2, KV_RW_NASID_OFFSET(t0)
85 MAPPED_KERNEL_SETUP_TLB
86
87 /*
88 * We might not get launched at the address the kernel is linked to,
89 * so we jump there.
90 */
91 PTR_LA t0, 0f
92 jr t0
930:
94 .endm
95
96#endif /* __ASM_MACH_IP27_KERNEL_ENTRY_H */
diff --git a/arch/mips/include/asm/mach-ip27/mangle-port.h b/arch/mips/include/asm/mach-ip27/mangle-port.h
new file mode 100644
index 000000000..f71c38bbf
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip27/mangle-port.h
@@ -0,0 +1,25 @@
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) ^ 3)
12#define __swizzle_addr_w(port) ((port) ^ 2)
13#define __swizzle_addr_l(port) (port)
14#define __swizzle_addr_q(port) (port)
15
16# define ioswabb(a, x) (x)
17# define __mem_ioswabb(a, x) (x)
18# define ioswabw(a, x) (x)
19# define __mem_ioswabw(a, x) ((__force u16)cpu_to_le16(x))
20# define ioswabl(a, x) (x)
21# define __mem_ioswabl(a, x) ((__force u32)cpu_to_le32(x))
22# define ioswabq(a, x) (x)
23# define __mem_ioswabq(a, x) ((__force u64)cpu_to_le64(x))
24
25#endif /* __ASM_MACH_IP27_MANGLE_PORT_H */
diff --git a/arch/mips/include/asm/mach-ip27/mmzone.h b/arch/mips/include/asm/mach-ip27/mmzone.h
new file mode 100644
index 000000000..08c36e50a
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip27/mmzone.h
@@ -0,0 +1,28 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_MACH_MMZONE_H
3#define _ASM_MACH_MMZONE_H
4
5#include <asm/sn/addrs.h>
6#include <asm/sn/arch.h>
7#include <asm/sn/agent.h>
8#include <asm/sn/klkernvars.h>
9
10#define pa_to_nid(addr) NASID_GET(addr)
11
12struct hub_data {
13 kern_vars_t kern_vars;
14 DECLARE_BITMAP(h_bigwin_used, HUB_NUM_BIG_WINDOW);
15 cpumask_t h_cpus;
16};
17
18struct node_data {
19 struct pglist_data pglist;
20 struct hub_data hub;
21};
22
23extern struct node_data *__node_data[];
24
25#define NODE_DATA(n) (&__node_data[(n)]->pglist)
26#define hub_data(n) (&__node_data[(n)]->hub)
27
28#endif /* _ASM_MACH_MMZONE_H */
diff --git a/arch/mips/include/asm/mach-ip27/spaces.h b/arch/mips/include/asm/mach-ip27/spaces.h
new file mode 100644
index 000000000..66421e9a6
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip27/spaces.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, 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#include <linux/const.h>
14
15/*
16 * IP27 uses the R10000's uncached attribute feature. Attribute 3 selects
17 * uncached memory addressing. Hide the definitions on 32-bit compilation
18 * of the compat-vdso code.
19 */
20#ifdef CONFIG_64BIT
21#define HSPEC_BASE _AC(0x9000000000000000, UL)
22#define IO_BASE _AC(0x9200000000000000, UL)
23#define MSPEC_BASE _AC(0x9400000000000000, UL)
24#define UNCAC_BASE _AC(0x9600000000000000, UL)
25#define CAC_BASE _AC(0xa800000000000000, UL)
26#endif
27
28#define TO_MSPEC(x) (MSPEC_BASE | ((x) & TO_PHYS_MASK))
29#define TO_HSPEC(x) (HSPEC_BASE | ((x) & TO_PHYS_MASK))
30
31#define HIGHMEM_START (~0UL)
32
33#include <asm/mach-generic/spaces.h>
34
35#endif /* _ASM_MACH_IP27_SPACES_H */
diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h
new file mode 100644
index 000000000..d66cc53fe
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip27/topology.h
@@ -0,0 +1,31 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_MACH_TOPOLOGY_H
3#define _ASM_MACH_TOPOLOGY_H 1
4
5#include <asm/sn/types.h>
6#include <asm/mmzone.h>
7
8struct cpuinfo_ip27 {
9 nasid_t p_nasid; /* my node ID in numa-as-id-space */
10 unsigned short p_speed; /* cpu speed in MHz */
11 unsigned char p_slice; /* Physical position on node board */
12};
13
14extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
15
16#define cpu_to_node(cpu) (cputonasid(cpu))
17#define cpumask_of_node(node) ((node) == -1 ? \
18 cpu_all_mask : \
19 &hub_data(node)->h_cpus)
20struct pci_bus;
21extern int pcibus_to_node(struct pci_bus *);
22
23#define cpumask_of_pcibus(bus) (cpumask_of_node(pcibus_to_node(bus)))
24
25extern unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
26
27#define node_distance(from, to) (__node_distances[(from)][(to)])
28
29#include <asm-generic/topology.h>
30
31#endif /* _ASM_MACH_TOPOLOGY_H */
diff --git a/arch/mips/include/asm/mach-ip28/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip28/cpu-feature-overrides.h
new file mode 100644
index 000000000..613bbc10c
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip28/cpu-feature-overrides.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) 2003 Ralf Baechle
7 * 6/2004 pf
8 */
9#ifndef __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H
11
12#include <asm/cpu.h>
13
14/*
15 * IP28 only comes with R10000 family processors all using the same config
16 */
17#define cpu_has_watch 1
18#define cpu_has_mips16 0
19#define cpu_has_mips16e2 0
20#define cpu_has_divec 0
21#define cpu_has_vce 0
22#define cpu_has_cache_cdex_p 0
23#define cpu_has_cache_cdex_s 0
24#define cpu_has_prefetch 1
25#define cpu_has_mcheck 0
26#define cpu_has_ejtag 0
27
28#define cpu_has_llsc 0
29#define cpu_has_vtag_icache 0
30#define cpu_has_dc_aliases 0 /* see probe_pcache() */
31#define cpu_has_ic_fills_f_dc 0
32#define cpu_has_dsp 0
33#define cpu_has_dsp2 0
34#define cpu_icache_snoops_remote_store 1
35#define cpu_has_mipsmt 0
36#define cpu_has_userlocal 0
37
38#define cpu_has_nofpuex 0
39#define cpu_has_64bits 1
40
41#define cpu_has_4kex 1
42#define cpu_has_4k_cache 1
43
44#define cpu_has_inclusive_pcaches 1
45
46#define cpu_dcache_line_size() 32
47#define cpu_icache_line_size() 64
48
49#define cpu_has_mips32r1 0
50#define cpu_has_mips32r2 0
51#define cpu_has_mips64r1 0
52#define cpu_has_mips64r2 0
53
54#endif /* __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ip28/spaces.h b/arch/mips/include/asm/mach-ip28/spaces.h
new file mode 100644
index 000000000..c4a912733
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip28/spaces.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) 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 * 2004 pf
10 */
11#ifndef _ASM_MACH_IP28_SPACES_H
12#define _ASM_MACH_IP28_SPACES_H
13
14#define PHYS_OFFSET _AC(0x20000000, UL)
15
16#include <asm/mach-generic/spaces.h>
17
18#endif /* _ASM_MACH_IP28_SPACES_H */
diff --git a/arch/mips/include/asm/mach-ip30/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip30/cpu-feature-overrides.h
new file mode 100644
index 000000000..2635b6ba1
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip30/cpu-feature-overrides.h
@@ -0,0 +1,79 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * IP30/Octane cpu-features overrides.
4 *
5 * Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org>
6 * 2004-2007 Stanislaw Skowronek <skylark@unaligned.org>
7 * 2009 Johannes Dickgreber <tanzy@gmx.de>
8 * 2015 Joshua Kinard <kumba@gentoo.org>
9 *
10 */
11#ifndef __ASM_MACH_IP30_CPU_FEATURE_OVERRIDES_H
12#define __ASM_MACH_IP30_CPU_FEATURE_OVERRIDES_H
13
14#include <asm/cpu.h>
15
16/*
17 * IP30 only supports R1[024]000 processors, all using the same config
18 */
19#define cpu_has_tlb 1
20#define cpu_has_tlbinv 0
21#define cpu_has_segments 0
22#define cpu_has_eva 0
23#define cpu_has_htw 0
24#define cpu_has_rixiex 0
25#define cpu_has_maar 0
26#define cpu_has_rw_llb 0
27#define cpu_has_3kex 0
28#define cpu_has_4kex 1
29#define cpu_has_3k_cache 0
30#define cpu_has_4k_cache 1
31#define cpu_has_tx39_cache 0
32#define cpu_has_nofpuex 0
33#define cpu_has_32fpr 1
34#define cpu_has_counter 1
35#define cpu_has_watch 1
36#define cpu_has_64bits 1
37#define cpu_has_divec 0
38#define cpu_has_vce 0
39#define cpu_has_cache_cdex_p 0
40#define cpu_has_cache_cdex_s 0
41#define cpu_has_prefetch 1
42#define cpu_has_mcheck 0
43#define cpu_has_ejtag 0
44#define cpu_has_llsc 1
45#define cpu_has_mips16 0
46#define cpu_has_mdmx 0
47#define cpu_has_mips3d 0
48#define cpu_has_smartmips 0
49#define cpu_has_rixi 0
50#define cpu_has_xpa 0
51#define cpu_has_vtag_icache 0
52#define cpu_has_dc_aliases 0
53#define cpu_has_ic_fills_f_dc 0
54
55#define cpu_icache_snoops_remote_store 1
56
57#define cpu_has_mips32r1 0
58#define cpu_has_mips32r2 0
59#define cpu_has_mips64r1 0
60#define cpu_has_mips64r2 0
61#define cpu_has_mips32r6 0
62#define cpu_has_mips64r6 0
63
64#define cpu_has_dsp 0
65#define cpu_has_dsp2 0
66#define cpu_has_mipsmt 0
67#define cpu_has_userlocal 0
68#define cpu_has_inclusive_pcaches 1
69#define cpu_has_perf_cntr_intr_bit 0
70#define cpu_has_vz 0
71#define cpu_has_fre 0
72#define cpu_has_cdmm 0
73
74#define cpu_dcache_line_size() 32
75#define cpu_icache_line_size() 64
76#define cpu_scache_line_size() 128
77
78#endif /* __ASM_MACH_IP30_CPU_FEATURE_OVERRIDES_H */
79
diff --git a/arch/mips/include/asm/mach-ip30/kernel-entry-init.h b/arch/mips/include/asm/mach-ip30/kernel-entry-init.h
new file mode 100644
index 000000000..be0472c97
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip30/kernel-entry-init.h
@@ -0,0 +1,13 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef __ASM_MACH_IP30_KERNEL_ENTRY_H
4#define __ASM_MACH_IP30_KERNEL_ENTRY_H
5
6 .macro kernel_entry_setup
7 .endm
8
9 .macro smp_slave_setup
10 move gp, a0
11 .endm
12
13#endif /* __ASM_MACH_IP30_KERNEL_ENTRY_H */
diff --git a/arch/mips/include/asm/mach-ip30/mangle-port.h b/arch/mips/include/asm/mach-ip30/mangle-port.h
new file mode 100644
index 000000000..439c6a601
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip30/mangle-port.h
@@ -0,0 +1,22 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2003, 2004 Ralf Baechle
4 */
5#ifndef __ASM_MACH_IP30_MANGLE_PORT_H
6#define __ASM_MACH_IP30_MANGLE_PORT_H
7
8#define __swizzle_addr_b(port) ((port)^3)
9#define __swizzle_addr_w(port) ((port)^2)
10#define __swizzle_addr_l(port) (port)
11#define __swizzle_addr_q(port) (port)
12
13#define ioswabb(a, x) (x)
14#define __mem_ioswabb(a, x) (x)
15#define ioswabw(a, x) (x)
16#define __mem_ioswabw(a, x) ((__force u16)cpu_to_le16(x))
17#define ioswabl(a, x) (x)
18#define __mem_ioswabl(a, x) ((__force u32)cpu_to_le32(x))
19#define ioswabq(a, x) (x)
20#define __mem_ioswabq(a, x) ((__force u64)cpu_to_le64(x))
21
22#endif /* __ASM_MACH_IP30_MANGLE_PORT_H */
diff --git a/arch/mips/include/asm/mach-ip30/spaces.h b/arch/mips/include/asm/mach-ip30/spaces.h
new file mode 100644
index 000000000..c8a302dfb
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip30/spaces.h
@@ -0,0 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2016 Joshua Kinard <kumba@gentoo.org>
4 *
5 */
6#ifndef _ASM_MACH_IP30_SPACES_H
7#define _ASM_MACH_IP30_SPACES_H
8
9/*
10 * Memory in IP30/Octane is offset 512MB in the physical address space.
11 */
12#define PHYS_OFFSET _AC(0x20000000, UL)
13
14#ifdef CONFIG_64BIT
15#define CAC_BASE _AC(0xA800000000000000, UL)
16#endif
17
18#include <asm/mach-generic/spaces.h>
19
20#endif /* _ASM_MACH_IP30_SPACES_H */
diff --git a/arch/mips/include/asm/mach-ip32/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip32/cpu-feature-overrides.h
new file mode 100644
index 000000000..63b4c8890
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip32/cpu-feature-overrides.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) 2005 Ilya A. Volynets-Evenbakh
7 * Copyright (C) 2005, 07 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
13/*
14 * R5000 has an interesting "restriction": ll(d)/sc(d)
15 * instructions to XKPHYS region simply do uncached bus
16 * requests. This breaks all the atomic bitops functions.
17 * so, for 64bit IP32 kernel we just don't use ll/sc.
18 * This does not affect luserland.
19 */
20#if (defined(CONFIG_CPU_R5000) || defined(CONFIG_CPU_NEVADA)) && defined(CONFIG_64BIT)
21#define cpu_has_llsc 0
22#else
23#define cpu_has_llsc 1
24#endif
25
26/* Settings which are common for all ip32 CPUs */
27#define cpu_has_tlb 1
28#define cpu_has_4kex 1
29#define cpu_has_32fpr 1
30#define cpu_has_counter 1
31#define cpu_has_mips16 0
32#define cpu_has_mips16e2 0
33#define cpu_has_vce 0
34#define cpu_has_cache_cdex_s 0
35#define cpu_has_mcheck 0
36#define cpu_has_ejtag 0
37#define cpu_has_vtag_icache 0
38#define cpu_has_ic_fills_f_dc 0
39#define cpu_has_dsp 0
40#define cpu_has_dsp2 0
41#define cpu_has_4k_cache 1
42#define cpu_has_mipsmt 0
43#define cpu_has_userlocal 0
44
45
46#define cpu_has_mips32r1 0
47#define cpu_has_mips32r2 0
48#define cpu_has_mips64r1 0
49#define cpu_has_mips64r2 0
50
51#endif /* __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ip32/kmalloc.h b/arch/mips/include/asm/mach-ip32/kmalloc.h
new file mode 100644
index 000000000..07a0146ea
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip32/kmalloc.h
@@ -0,0 +1,12 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_IP32_KMALLOC_H
3#define __ASM_MACH_IP32_KMALLOC_H
4
5
6#if defined(CONFIG_CPU_R5000) || defined(CONFIG_CPU_RM7000)
7#define ARCH_DMA_MINALIGN 32
8#else
9#define ARCH_DMA_MINALIGN 128
10#endif
11
12#endif /* __ASM_MACH_IP32_KMALLOC_H */
diff --git a/arch/mips/include/asm/mach-ip32/mangle-port.h b/arch/mips/include/asm/mach-ip32/mangle-port.h
new file mode 100644
index 000000000..4bc3d20e8
--- /dev/null
+++ b/arch/mips/include/asm/mach-ip32/mangle-port.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) 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# define ioswabb(a, x) (x)
18# define __mem_ioswabb(a, x) (x)
19# define ioswabw(a, x) (x)
20# define __mem_ioswabw(a, x) ((__force u16)cpu_to_le16(x))
21# define ioswabl(a, x) (x)
22# define __mem_ioswabl(a, x) ((__force u32)cpu_to_le32(x))
23# define ioswabq(a, x) (x)
24# define __mem_ioswabq(a, x) ((__force u64)cpu_to_le64(x))
25
26#endif /* __ASM_MACH_IP32_MANGLE_PORT_H */
diff --git a/arch/mips/include/asm/mach-jazz/floppy.h b/arch/mips/include/asm/mach-jazz/floppy.h
new file mode 100644
index 000000000..294ebb834
--- /dev/null
+++ b/arch/mips/include/asm/mach-jazz/floppy.h
@@ -0,0 +1,133 @@
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/linkage.h>
13#include <linux/types.h>
14#include <linux/mm.h>
15#include <asm/addrspace.h>
16#include <asm/jazz.h>
17#include <asm/jazzdma.h>
18
19static inline unsigned char fd_inb(unsigned int base, unsigned int reg)
20{
21 unsigned char c;
22
23 c = *(volatile unsigned char *) (base + reg);
24 udelay(1);
25
26 return c;
27}
28
29static inline void fd_outb(unsigned char value, unsigned int base, unsigned int reg)
30{
31 *(volatile unsigned char *) (base + reg) = value;
32}
33
34/*
35 * How to access the floppy DMA functions.
36 */
37static inline void fd_enable_dma(void)
38{
39 vdma_enable(JAZZ_FLOPPY_DMA);
40}
41
42static inline void fd_disable_dma(void)
43{
44 vdma_disable(JAZZ_FLOPPY_DMA);
45}
46
47static inline int fd_request_dma(void)
48{
49 return 0;
50}
51
52static inline void fd_free_dma(void)
53{
54}
55
56static inline void fd_clear_dma_ff(void)
57{
58}
59
60static inline void fd_set_dma_mode(char mode)
61{
62 vdma_set_mode(JAZZ_FLOPPY_DMA, mode);
63}
64
65static inline void fd_set_dma_addr(char *a)
66{
67 vdma_set_addr(JAZZ_FLOPPY_DMA, vdma_phys2log(CPHYSADDR((unsigned long)a)));
68}
69
70static inline void fd_set_dma_count(unsigned int count)
71{
72 vdma_set_count(JAZZ_FLOPPY_DMA, count);
73}
74
75static inline int fd_get_dma_residue(void)
76{
77 return vdma_get_residue(JAZZ_FLOPPY_DMA);
78}
79
80static inline void fd_enable_irq(void)
81{
82}
83
84static inline void fd_disable_irq(void)
85{
86}
87
88static inline int fd_request_irq(void)
89{
90 return request_irq(FLOPPY_IRQ, floppy_interrupt,
91 0, "floppy", NULL);
92}
93
94static inline void fd_free_irq(void)
95{
96 free_irq(FLOPPY_IRQ, NULL);
97}
98
99static inline unsigned long fd_getfdaddr1(void)
100{
101 return JAZZ_FDC_BASE;
102}
103
104static inline unsigned long fd_dma_mem_alloc(unsigned long size)
105{
106 unsigned long mem;
107
108 mem = __get_dma_pages(GFP_KERNEL, get_order(size));
109 if(!mem)
110 return 0;
111 vdma_alloc(CPHYSADDR(mem), size); /* XXX error checking */
112
113 return mem;
114}
115
116static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
117{
118 vdma_free(vdma_phys2log(CPHYSADDR(addr)));
119 free_pages(addr, get_order(size));
120}
121
122static inline unsigned long fd_drive_type(unsigned long n)
123{
124 /* XXX This is wrong for machines with ED 2.88mb disk drives like the
125 Olivetti M700. Anyway, we should suck this from the ARC
126 firmware. */
127 if (n == 0)
128 return 4; /* 3,5", 1.44mb */
129
130 return 0;
131}
132
133#endif /* __ASM_MACH_JAZZ_FLOPPY_H */
diff --git a/arch/mips/include/asm/mach-jazz/mc146818rtc.h b/arch/mips/include/asm/mach-jazz/mc146818rtc.h
new file mode 100644
index 000000000..987f727af
--- /dev/null
+++ b/arch/mips/include/asm/mach-jazz/mc146818rtc.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) 1998, 2001, 03 by Ralf Baechle
7 * Copyright (C) 2007 Thomas Bogendoerfer
8 *
9 * RTC routines for Jazz style attached Dallas chip.
10 */
11#ifndef __ASM_MACH_JAZZ_MC146818RTC_H
12#define __ASM_MACH_JAZZ_MC146818RTC_H
13
14#include <linux/delay.h>
15
16#include <asm/io.h>
17#include <asm/jazz.h>
18
19#define RTC_PORT(x) (0x70 + (x))
20#define RTC_IRQ 8
21
22static inline unsigned char CMOS_READ(unsigned long addr)
23{
24 outb_p(addr, RTC_PORT(0));
25 return *(volatile char *)JAZZ_RTC_BASE;
26}
27
28static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
29{
30 outb_p(addr, RTC_PORT(0));
31 *(volatile char *)JAZZ_RTC_BASE = data;
32}
33
34#define RTC_ALWAYS_BCD 0
35
36#define mc146818_decode_year(year) ((year) + 1980)
37
38#endif /* __ASM_MACH_JAZZ_MC146818RTC_H */
diff --git a/arch/mips/include/asm/mach-lantiq/falcon/cpu-feature-overrides.h b/arch/mips/include/asm/mach-lantiq/falcon/cpu-feature-overrides.h
new file mode 100644
index 000000000..10226976f
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/falcon/cpu-feature-overrides.h
@@ -0,0 +1,53 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Lantiq FALCON specific CPU feature overrides
4 *
5 * Copyright (C) 2013 Thomas Langer, Lantiq Deutschland
6 *
7 * This file was derived from: include/asm-mips/cpu-features.h
8 * Copyright (C) 2003, 2004 Ralf Baechle
9 * Copyright (C) 2004 Maciej W. Rozycki
10 */
11#ifndef __ASM_MACH_FALCON_CPU_FEATURE_OVERRIDES_H
12#define __ASM_MACH_FALCON_CPU_FEATURE_OVERRIDES_H
13
14#define cpu_has_tlb 1
15#define cpu_has_4kex 1
16#define cpu_has_3k_cache 0
17#define cpu_has_4k_cache 1
18#define cpu_has_tx39_cache 0
19#define cpu_has_sb1_cache 0
20#define cpu_has_fpu 0
21#define cpu_has_32fpr 0
22#define cpu_has_counter 1
23#define cpu_has_watch 1
24#define cpu_has_divec 1
25
26#define cpu_has_prefetch 1
27#define cpu_has_ejtag 1
28#define cpu_has_llsc 1
29
30#define cpu_has_mips16 1
31#define cpu_has_mdmx 0
32#define cpu_has_mips3d 0
33#define cpu_has_smartmips 0
34
35#define cpu_has_mips32r1 1
36#define cpu_has_mips32r2 1
37#define cpu_has_mips64r1 0
38#define cpu_has_mips64r2 0
39
40#define cpu_has_dsp 1
41#define cpu_has_mipsmt 1
42
43#define cpu_has_vint 1
44#define cpu_has_veic 1
45
46#define cpu_has_64bits 0
47#define cpu_has_64bit_zero_reg 0
48#define cpu_has_64bit_gp_regs 0
49
50#define cpu_dcache_line_size() 32
51#define cpu_icache_line_size() 32
52
53#endif /* __ASM_MACH_FALCON_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-lantiq/falcon/falcon_irq.h b/arch/mips/include/asm/mach-lantiq/falcon/falcon_irq.h
new file mode 100644
index 000000000..6eeda90f7
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/falcon/falcon_irq.h
@@ -0,0 +1,21 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2010 Thomas Langer <thomas.langer@lantiq.com>
5 */
6
7#ifndef _FALCON_IRQ__
8#define _FALCON_IRQ__
9
10#define INT_NUM_IRQ0 8
11#define INT_NUM_IM0_IRL0 (INT_NUM_IRQ0 + 0)
12#define INT_NUM_IM1_IRL0 (INT_NUM_IM0_IRL0 + 32)
13#define INT_NUM_IM2_IRL0 (INT_NUM_IM1_IRL0 + 32)
14#define INT_NUM_IM3_IRL0 (INT_NUM_IM2_IRL0 + 32)
15#define INT_NUM_IM4_IRL0 (INT_NUM_IM3_IRL0 + 32)
16#define INT_NUM_EXTRA_START (INT_NUM_IM4_IRL0 + 32)
17#define INT_NUM_IM_OFFSET (INT_NUM_IM1_IRL0 - INT_NUM_IM0_IRL0)
18
19#define MAX_IM 5
20
21#endif /* _FALCON_IRQ__ */
diff --git a/arch/mips/include/asm/mach-lantiq/falcon/irq.h b/arch/mips/include/asm/mach-lantiq/falcon/irq.h
new file mode 100644
index 000000000..c14312fb0
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/falcon/irq.h
@@ -0,0 +1,16 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com>
5 */
6
7#ifndef __FALCON_IRQ_H
8#define __FALCON_IRQ_H
9
10#include <falcon_irq.h>
11
12#define NR_IRQS 328
13
14#include <asm/mach-generic/irq.h>
15
16#endif
diff --git a/arch/mips/include/asm/mach-lantiq/falcon/lantiq_soc.h b/arch/mips/include/asm/mach-lantiq/falcon/lantiq_soc.h
new file mode 100644
index 000000000..5855ba1bd
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/falcon/lantiq_soc.h
@@ -0,0 +1,69 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2010 John Crispin <john@phrozen.org>
5 */
6
7#ifndef _LTQ_FALCON_H__
8#define _LTQ_FALCON_H__
9
10#ifdef CONFIG_SOC_FALCON
11
12#include <linux/pinctrl/pinctrl.h>
13#include <lantiq.h>
14
15/* Chip IDs */
16#define SOC_ID_FALCON 0x01B8
17
18/* SoC Types */
19#define SOC_TYPE_FALCON 0x01
20
21/*
22 * during early_printk no ioremap possible at this early stage
23 * let's use KSEG1 instead
24 */
25#define LTQ_ASC0_BASE_ADDR 0x1E100C00
26#define LTQ_EARLY_ASC KSEG1ADDR(LTQ_ASC0_BASE_ADDR)
27
28/* WDT */
29#define LTQ_RST_CAUSE_WDTRST 0x0002
30
31/* CHIP ID */
32#define LTQ_STATUS_BASE_ADDR 0x1E802000
33
34#define FALCON_CHIPID ((u32 *)(KSEG1 + LTQ_STATUS_BASE_ADDR + 0x0c))
35#define FALCON_CHIPTYPE ((u32 *)(KSEG1 + LTQ_STATUS_BASE_ADDR + 0x38))
36#define FALCON_CHIPCONF ((u32 *)(KSEG1 + LTQ_STATUS_BASE_ADDR + 0x40))
37
38/* SYSCTL - start/stop/restart/configure/... different parts of the Soc */
39#define SYSCTL_SYS1 0
40#define SYSCTL_SYSETH 1
41#define SYSCTL_SYSGPE 2
42
43/* BOOT_SEL - find what boot media we have */
44#define BS_FLASH 0x1
45#define BS_SPI 0x4
46
47/* global register ranges */
48extern __iomem void *ltq_ebu_membase;
49extern __iomem void *ltq_sys1_membase;
50#define ltq_ebu_w32(x, y) ltq_w32((x), ltq_ebu_membase + (y))
51#define ltq_ebu_r32(x) ltq_r32(ltq_ebu_membase + (x))
52
53#define ltq_sys1_w32(x, y) ltq_w32((x), ltq_sys1_membase + (y))
54#define ltq_sys1_r32(x) ltq_r32(ltq_sys1_membase + (x))
55#define ltq_sys1_w32_mask(clear, set, reg) \
56 ltq_sys1_w32((ltq_sys1_r32(reg) & ~(clear)) | (set), reg)
57
58/* allow the gpio and pinctrl drivers to talk to eachother */
59extern int pinctrl_falcon_get_range_size(int id);
60extern void pinctrl_falcon_add_gpio_range(struct pinctrl_gpio_range *range);
61
62/*
63 * to keep the irq code generic we need to define this to 0 as falcon
64 * has no EIU/EBU
65 */
66#define LTQ_EBU_PCC_ISTAT 0
67
68#endif /* CONFIG_SOC_FALCON */
69#endif /* _LTQ_XWAY_H__ */
diff --git a/arch/mips/include/asm/mach-lantiq/lantiq.h b/arch/mips/include/asm/mach-lantiq/lantiq.h
new file mode 100644
index 000000000..6ceb0287d
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/lantiq.h
@@ -0,0 +1,55 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2010 John Crispin <john@phrozen.org>
5 */
6#ifndef _LANTIQ_H__
7#define _LANTIQ_H__
8
9#include <linux/irq.h>
10#include <linux/device.h>
11#include <linux/clk.h>
12
13/* generic reg access functions */
14#define ltq_r32(reg) __raw_readl(reg)
15#define ltq_w32(val, reg) __raw_writel(val, reg)
16#define ltq_w32_mask(clear, set, reg) \
17 ltq_w32((ltq_r32(reg) & ~(clear)) | (set), reg)
18#define ltq_r8(reg) __raw_readb(reg)
19#define ltq_w8(val, reg) __raw_writeb(val, reg)
20
21/* register access macros for EBU and CGU */
22#define ltq_ebu_w32(x, y) ltq_w32((x), ltq_ebu_membase + (y))
23#define ltq_ebu_r32(x) ltq_r32(ltq_ebu_membase + (x))
24#define ltq_ebu_w32_mask(x, y, z) \
25 ltq_w32_mask(x, y, ltq_ebu_membase + (z))
26extern __iomem void *ltq_ebu_membase;
27
28/* spinlock all ebu i/o */
29extern spinlock_t ebu_lock;
30
31/* some irq helpers */
32extern void ltq_disable_irq(struct irq_data *data);
33extern void ltq_mask_and_ack_irq(struct irq_data *data);
34extern void ltq_enable_irq(struct irq_data *data);
35extern int ltq_eiu_get_irq(int exin);
36
37/* clock handling */
38extern int clk_activate(struct clk *clk);
39extern void clk_deactivate(struct clk *clk);
40extern struct clk *clk_get_cpu(void);
41extern struct clk *clk_get_fpi(void);
42extern struct clk *clk_get_io(void);
43extern struct clk *clk_get_ppe(void);
44
45/* find out what bootsource we have */
46extern unsigned char ltq_boot_select(void);
47/* find out the soc type */
48extern int ltq_soc_type(void);
49
50#define IOPORT_RESOURCE_START 0x10000000
51#define IOPORT_RESOURCE_END 0xffffffff
52#define IOMEM_RESOURCE_START 0x10000000
53#define IOMEM_RESOURCE_END 0xffffffff
54
55#endif
diff --git a/arch/mips/include/asm/mach-lantiq/lantiq_platform.h b/arch/mips/include/asm/mach-lantiq/lantiq_platform.h
new file mode 100644
index 000000000..70ebb4d6f
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/lantiq_platform.h
@@ -0,0 +1,18 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2010 John Crispin <john@phrozen.org>
5 */
6
7#ifndef _LANTIQ_PLATFORM_H__
8#define _LANTIQ_PLATFORM_H__
9
10#include <linux/socket.h>
11
12/* struct used to pass info to network drivers */
13struct ltq_eth_data {
14 struct sockaddr mac;
15 int mii_mode;
16};
17
18#endif
diff --git a/arch/mips/include/asm/mach-lantiq/xway/irq.h b/arch/mips/include/asm/mach-lantiq/xway/irq.h
new file mode 100644
index 000000000..2980e7771
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/xway/irq.h
@@ -0,0 +1,16 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2010 John Crispin <john@phrozen.org>
5 */
6
7#ifndef __LANTIQ_IRQ_H
8#define __LANTIQ_IRQ_H
9
10#include <lantiq_irq.h>
11
12#define NR_IRQS 256
13
14#include <asm/mach-generic/irq.h>
15
16#endif
diff --git a/arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h b/arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h
new file mode 100644
index 000000000..5f0d0ba99
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h
@@ -0,0 +1,22 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2010 John Crispin <john@phrozen.org>
5 */
6
7#ifndef _LANTIQ_XWAY_IRQ_H__
8#define _LANTIQ_XWAY_IRQ_H__
9
10#define INT_NUM_IRQ0 8
11#define INT_NUM_IM0_IRL0 (INT_NUM_IRQ0 + 0)
12#define INT_NUM_IM1_IRL0 (INT_NUM_IRQ0 + 32)
13#define INT_NUM_IM2_IRL0 (INT_NUM_IRQ0 + 64)
14#define INT_NUM_IM3_IRL0 (INT_NUM_IRQ0 + 96)
15#define INT_NUM_IM4_IRL0 (INT_NUM_IRQ0 + 128)
16#define INT_NUM_IM_OFFSET (INT_NUM_IM1_IRL0 - INT_NUM_IM0_IRL0)
17
18#define LTQ_DMA_CH0_INT (INT_NUM_IM2_IRL0)
19
20#define MAX_IM 5
21
22#endif
diff --git a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
new file mode 100644
index 000000000..4790cfa19
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
@@ -0,0 +1,106 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2010 John Crispin <john@phrozen.org>
5 */
6
7#ifndef _LTQ_XWAY_H__
8#define _LTQ_XWAY_H__
9
10#ifdef CONFIG_SOC_TYPE_XWAY
11
12#include <lantiq.h>
13
14/* Chip IDs */
15#define SOC_ID_DANUBE1 0x129
16#define SOC_ID_DANUBE2 0x12B
17#define SOC_ID_TWINPASS 0x12D
18#define SOC_ID_AMAZON_SE_1 0x152 /* 50601 */
19#define SOC_ID_AMAZON_SE_2 0x153 /* 50600 */
20#define SOC_ID_ARX188 0x16C
21#define SOC_ID_ARX168_1 0x16D
22#define SOC_ID_ARX168_2 0x16E
23#define SOC_ID_ARX182 0x16F
24#define SOC_ID_GRX188 0x170
25#define SOC_ID_GRX168 0x171
26
27#define SOC_ID_VRX288 0x1C0 /* v1.1 */
28#define SOC_ID_VRX282 0x1C1 /* v1.1 */
29#define SOC_ID_VRX268 0x1C2 /* v1.1 */
30#define SOC_ID_GRX268 0x1C8 /* v1.1 */
31#define SOC_ID_GRX288 0x1C9 /* v1.1 */
32#define SOC_ID_VRX288_2 0x00B /* v1.2 */
33#define SOC_ID_VRX268_2 0x00C /* v1.2 */
34#define SOC_ID_GRX288_2 0x00D /* v1.2 */
35#define SOC_ID_GRX282_2 0x00E /* v1.2 */
36#define SOC_ID_VRX220 0x000
37
38#define SOC_ID_ARX362 0x004
39#define SOC_ID_ARX368 0x005
40#define SOC_ID_ARX382 0x007
41#define SOC_ID_ARX388 0x008
42#define SOC_ID_URX388 0x009
43#define SOC_ID_GRX383 0x010
44#define SOC_ID_GRX369 0x011
45#define SOC_ID_GRX387 0x00F
46#define SOC_ID_GRX389 0x012
47
48 /* SoC Types */
49#define SOC_TYPE_DANUBE 0x01
50#define SOC_TYPE_TWINPASS 0x02
51#define SOC_TYPE_AR9 0x03
52#define SOC_TYPE_VR9 0x04 /* v1.1 */
53#define SOC_TYPE_VR9_2 0x05 /* v1.2 */
54#define SOC_TYPE_AMAZON_SE 0x06
55#define SOC_TYPE_AR10 0x07
56#define SOC_TYPE_GRX390 0x08
57#define SOC_TYPE_VRX220 0x09
58
59/* BOOT_SEL - find what boot media we have */
60#define BS_EXT_ROM 0x0
61#define BS_FLASH 0x1
62#define BS_MII0 0x2
63#define BS_PCI 0x3
64#define BS_UART1 0x4
65#define BS_SPI 0x5
66#define BS_NAND 0x6
67#define BS_RMII0 0x7
68
69/* helpers used to access the cgu */
70#define ltq_cgu_w32(x, y) ltq_w32((x), ltq_cgu_membase + (y))
71#define ltq_cgu_r32(x) ltq_r32(ltq_cgu_membase + (x))
72extern __iomem void *ltq_cgu_membase;
73
74/*
75 * during early_printk no ioremap is possible
76 * let's use KSEG1 instead
77 */
78#define LTQ_ASC1_BASE_ADDR 0x1E100C00
79#define LTQ_EARLY_ASC KSEG1ADDR(LTQ_ASC1_BASE_ADDR)
80
81/* EBU - external bus unit */
82#define LTQ_EBU_BUSCON0 0x0060
83#define LTQ_EBU_PCC_CON 0x0090
84#define LTQ_EBU_PCC_IEN 0x00A4
85#define LTQ_EBU_PCC_ISTAT 0x00A0
86#define LTQ_EBU_BUSCON1 0x0064
87#define LTQ_EBU_ADDRSEL1 0x0024
88#define EBU_WRDIS 0x80000000
89
90/* WDT */
91#define LTQ_RST_CAUSE_WDTRST 0x20
92
93/* MPS - multi processor unit (voice) */
94#define LTQ_MPS_BASE_ADDR (KSEG1 + 0x1F107000)
95#define LTQ_MPS_CHIPID ((u32 *)(LTQ_MPS_BASE_ADDR + 0x0344))
96
97/* allow booting xrx200 phys */
98int xrx200_gphy_boot(struct device *dev, unsigned int id, dma_addr_t dev_addr);
99
100/* request a non-gpio and set the PIO config */
101#define PMU_PPE BIT(13)
102extern void ltq_pmu_enable(unsigned int module);
103extern void ltq_pmu_disable(unsigned int module);
104
105#endif /* CONFIG_SOC_TYPE_XWAY */
106#endif /* _LTQ_XWAY_H__ */
diff --git a/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h
new file mode 100644
index 000000000..8218a1356
--- /dev/null
+++ b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h
@@ -0,0 +1,50 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2011 John Crispin <john@phrozen.org>
5 */
6
7#ifndef LTQ_DMA_H__
8#define LTQ_DMA_H__
9
10#define LTQ_DESC_SIZE 0x08 /* each descriptor is 64bit */
11#define LTQ_DESC_NUM 0x40 /* 64 descriptors / channel */
12
13#define LTQ_DMA_OWN BIT(31) /* owner bit */
14#define LTQ_DMA_C BIT(30) /* complete bit */
15#define LTQ_DMA_SOP BIT(29) /* start of packet */
16#define LTQ_DMA_EOP BIT(28) /* end of packet */
17#define LTQ_DMA_TX_OFFSET(x) ((x & 0x1f) << 23) /* data bytes offset */
18#define LTQ_DMA_RX_OFFSET(x) ((x & 0x7) << 23) /* data bytes offset */
19#define LTQ_DMA_SIZE_MASK (0xffff) /* the size field is 16 bit */
20
21struct ltq_dma_desc {
22 u32 ctl;
23 u32 addr;
24};
25
26struct ltq_dma_channel {
27 int nr; /* the channel number */
28 int irq; /* the mapped irq */
29 int desc; /* the current descriptor */
30 struct ltq_dma_desc *desc_base; /* the descriptor base */
31 int phys; /* physical addr */
32 struct device *dev;
33};
34
35enum {
36 DMA_PORT_ETOP = 0,
37 DMA_PORT_DEU,
38};
39
40extern void ltq_dma_enable_irq(struct ltq_dma_channel *ch);
41extern void ltq_dma_disable_irq(struct ltq_dma_channel *ch);
42extern void ltq_dma_ack_irq(struct ltq_dma_channel *ch);
43extern void ltq_dma_open(struct ltq_dma_channel *ch);
44extern void ltq_dma_close(struct ltq_dma_channel *ch);
45extern void ltq_dma_alloc_tx(struct ltq_dma_channel *ch);
46extern void ltq_dma_alloc_rx(struct ltq_dma_channel *ch);
47extern void ltq_dma_free(struct ltq_dma_channel *ch);
48extern void ltq_dma_init_port(int p);
49
50#endif
diff --git a/arch/mips/include/asm/mach-loongson2ef/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson2ef/cpu-feature-overrides.h
new file mode 100644
index 000000000..b2ee859ca
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/cpu-feature-overrides.h
@@ -0,0 +1,44 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
4 * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
5 * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
6 *
7 * reference: /proc/cpuinfo,
8 * arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
9 * arch/mips/kernel/proc.c(show_cpuinfo),
10 * loongson2f user manual.
11 */
12
13#ifndef __ASM_MACH_LOONGSON2EF_CPU_FEATURE_OVERRIDES_H
14#define __ASM_MACH_LOONGSON2EF_CPU_FEATURE_OVERRIDES_H
15
16#define cpu_has_32fpr 1
17#define cpu_has_3k_cache 0
18#define cpu_has_4k_cache 1
19#define cpu_has_4kex 1
20#define cpu_has_64bits 1
21#define cpu_has_cache_cdex_p 0
22#define cpu_has_cache_cdex_s 0
23#define cpu_has_counter 1
24#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
25#define cpu_has_divec 0
26#define cpu_has_ejtag 0
27#define cpu_has_inclusive_pcaches 1
28#define cpu_has_llsc 1
29#define cpu_has_mcheck 0
30#define cpu_has_mdmx 0
31#define cpu_has_mips16 0
32#define cpu_has_mips16e2 0
33#define cpu_has_mips3d 0
34#define cpu_has_mipsmt 0
35#define cpu_has_smartmips 0
36#define cpu_has_tlb 1
37#define cpu_has_tx39_cache 0
38#define cpu_has_vce 0
39#define cpu_has_veic 0
40#define cpu_has_vint 0
41#define cpu_has_vtag_icache 0
42#define cpu_has_watch 1
43
44#endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536.h b/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536.h
new file mode 100644
index 000000000..9795b3361
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536.h
@@ -0,0 +1,306 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * The header file of cs5536 south bridge.
4 *
5 * Copyright (C) 2007 Lemote, Inc.
6 * Author : jlliu <liujl@lemote.com>
7 */
8
9#ifndef _CS5536_H
10#define _CS5536_H
11
12#include <linux/types.h>
13
14extern void _rdmsr(u32 msr, u32 *hi, u32 *lo);
15extern void _wrmsr(u32 msr, u32 hi, u32 lo);
16
17/*
18 * MSR module base
19 */
20#define CS5536_SB_MSR_BASE (0x00000000)
21#define CS5536_GLIU_MSR_BASE (0x10000000)
22#define CS5536_ILLEGAL_MSR_BASE (0x20000000)
23#define CS5536_USB_MSR_BASE (0x40000000)
24#define CS5536_IDE_MSR_BASE (0x60000000)
25#define CS5536_DIVIL_MSR_BASE (0x80000000)
26#define CS5536_ACC_MSR_BASE (0xa0000000)
27#define CS5536_UNUSED_MSR_BASE (0xc0000000)
28#define CS5536_GLCP_MSR_BASE (0xe0000000)
29
30#define SB_MSR_REG(offset) (CS5536_SB_MSR_BASE | (offset))
31#define GLIU_MSR_REG(offset) (CS5536_GLIU_MSR_BASE | (offset))
32#define ILLEGAL_MSR_REG(offset) (CS5536_ILLEGAL_MSR_BASE | (offset))
33#define USB_MSR_REG(offset) (CS5536_USB_MSR_BASE | (offset))
34#define IDE_MSR_REG(offset) (CS5536_IDE_MSR_BASE | (offset))
35#define DIVIL_MSR_REG(offset) (CS5536_DIVIL_MSR_BASE | (offset))
36#define ACC_MSR_REG(offset) (CS5536_ACC_MSR_BASE | (offset))
37#define UNUSED_MSR_REG(offset) (CS5536_UNUSED_MSR_BASE | (offset))
38#define GLCP_MSR_REG(offset) (CS5536_GLCP_MSR_BASE | (offset))
39
40/*
41 * BAR SPACE OF VIRTUAL PCI :
42 * range for pci probe use, length is the actual size.
43 */
44/* IO space for all DIVIL modules */
45#define CS5536_IRQ_RANGE 0xffffffe0 /* USERD FOR PCI PROBE */
46#define CS5536_IRQ_LENGTH 0x20 /* THE REGS ACTUAL LENGTH */
47#define CS5536_SMB_RANGE 0xfffffff8
48#define CS5536_SMB_LENGTH 0x08
49#define CS5536_GPIO_RANGE 0xffffff00
50#define CS5536_GPIO_LENGTH 0x100
51#define CS5536_MFGPT_RANGE 0xffffffc0
52#define CS5536_MFGPT_LENGTH 0x40
53#define CS5536_ACPI_RANGE 0xffffffe0
54#define CS5536_ACPI_LENGTH 0x20
55#define CS5536_PMS_RANGE 0xffffff80
56#define CS5536_PMS_LENGTH 0x80
57/* IO space for IDE */
58#define CS5536_IDE_RANGE 0xfffffff0
59#define CS5536_IDE_LENGTH 0x10
60/* IO space for ACC */
61#define CS5536_ACC_RANGE 0xffffff80
62#define CS5536_ACC_LENGTH 0x80
63/* MEM space for ALL USB modules */
64#define CS5536_OHCI_RANGE 0xfffff000
65#define CS5536_OHCI_LENGTH 0x1000
66#define CS5536_EHCI_RANGE 0xfffff000
67#define CS5536_EHCI_LENGTH 0x1000
68
69/*
70 * PCI MSR ACCESS
71 */
72#define PCI_MSR_CTRL 0xF0
73#define PCI_MSR_ADDR 0xF4
74#define PCI_MSR_DATA_LO 0xF8
75#define PCI_MSR_DATA_HI 0xFC
76
77/**************** MSR *****************************/
78
79/*
80 * GLIU STANDARD MSR
81 */
82#define GLIU_CAP 0x00
83#define GLIU_CONFIG 0x01
84#define GLIU_SMI 0x02
85#define GLIU_ERROR 0x03
86#define GLIU_PM 0x04
87#define GLIU_DIAG 0x05
88
89/*
90 * GLIU SPEC. MSR
91 */
92#define GLIU_P2D_BM0 0x20
93#define GLIU_P2D_BM1 0x21
94#define GLIU_P2D_BM2 0x22
95#define GLIU_P2D_BMK0 0x23
96#define GLIU_P2D_BMK1 0x24
97#define GLIU_P2D_BM3 0x25
98#define GLIU_P2D_BM4 0x26
99#define GLIU_COH 0x80
100#define GLIU_PAE 0x81
101#define GLIU_ARB 0x82
102#define GLIU_ASMI 0x83
103#define GLIU_AERR 0x84
104#define GLIU_DEBUG 0x85
105#define GLIU_PHY_CAP 0x86
106#define GLIU_NOUT_RESP 0x87
107#define GLIU_NOUT_WDATA 0x88
108#define GLIU_WHOAMI 0x8B
109#define GLIU_SLV_DIS 0x8C
110#define GLIU_IOD_BM0 0xE0
111#define GLIU_IOD_BM1 0xE1
112#define GLIU_IOD_BM2 0xE2
113#define GLIU_IOD_BM3 0xE3
114#define GLIU_IOD_BM4 0xE4
115#define GLIU_IOD_BM5 0xE5
116#define GLIU_IOD_BM6 0xE6
117#define GLIU_IOD_BM7 0xE7
118#define GLIU_IOD_BM8 0xE8
119#define GLIU_IOD_BM9 0xE9
120#define GLIU_IOD_SC0 0xEA
121#define GLIU_IOD_SC1 0xEB
122#define GLIU_IOD_SC2 0xEC
123#define GLIU_IOD_SC3 0xED
124#define GLIU_IOD_SC4 0xEE
125#define GLIU_IOD_SC5 0xEF
126#define GLIU_IOD_SC6 0xF0
127#define GLIU_IOD_SC7 0xF1
128
129/*
130 * SB STANDARD
131 */
132#define SB_CAP 0x00
133#define SB_CONFIG 0x01
134#define SB_SMI 0x02
135#define SB_ERROR 0x03
136#define SB_MAR_ERR_EN 0x00000001
137#define SB_TAR_ERR_EN 0x00000002
138#define SB_RSVD_BIT1 0x00000004
139#define SB_EXCEP_ERR_EN 0x00000008
140#define SB_SYSE_ERR_EN 0x00000010
141#define SB_PARE_ERR_EN 0x00000020
142#define SB_TAS_ERR_EN 0x00000040
143#define SB_MAR_ERR_FLAG 0x00010000
144#define SB_TAR_ERR_FLAG 0x00020000
145#define SB_RSVD_BIT2 0x00040000
146#define SB_EXCEP_ERR_FLAG 0x00080000
147#define SB_SYSE_ERR_FLAG 0x00100000
148#define SB_PARE_ERR_FLAG 0x00200000
149#define SB_TAS_ERR_FLAG 0x00400000
150#define SB_PM 0x04
151#define SB_DIAG 0x05
152
153/*
154 * SB SPEC.
155 */
156#define SB_CTRL 0x10
157#define SB_R0 0x20
158#define SB_R1 0x21
159#define SB_R2 0x22
160#define SB_R3 0x23
161#define SB_R4 0x24
162#define SB_R5 0x25
163#define SB_R6 0x26
164#define SB_R7 0x27
165#define SB_R8 0x28
166#define SB_R9 0x29
167#define SB_R10 0x2A
168#define SB_R11 0x2B
169#define SB_R12 0x2C
170#define SB_R13 0x2D
171#define SB_R14 0x2E
172#define SB_R15 0x2F
173
174/*
175 * GLCP STANDARD
176 */
177#define GLCP_CAP 0x00
178#define GLCP_CONFIG 0x01
179#define GLCP_SMI 0x02
180#define GLCP_ERROR 0x03
181#define GLCP_PM 0x04
182#define GLCP_DIAG 0x05
183
184/*
185 * GLCP SPEC.
186 */
187#define GLCP_CLK_DIS_DELAY 0x08
188#define GLCP_PM_CLK_DISABLE 0x09
189#define GLCP_GLB_PM 0x0B
190#define GLCP_DBG_OUT 0x0C
191#define GLCP_RSVD1 0x0D
192#define GLCP_SOFT_COM 0x0E
193#define SOFT_BAR_SMB_FLAG 0x00000001
194#define SOFT_BAR_GPIO_FLAG 0x00000002
195#define SOFT_BAR_MFGPT_FLAG 0x00000004
196#define SOFT_BAR_IRQ_FLAG 0x00000008
197#define SOFT_BAR_PMS_FLAG 0x00000010
198#define SOFT_BAR_ACPI_FLAG 0x00000020
199#define SOFT_BAR_IDE_FLAG 0x00000400
200#define SOFT_BAR_ACC_FLAG 0x00000800
201#define SOFT_BAR_OHCI_FLAG 0x00001000
202#define SOFT_BAR_EHCI_FLAG 0x00002000
203#define GLCP_RSVD2 0x0F
204#define GLCP_CLK_OFF 0x10
205#define GLCP_CLK_ACTIVE 0x11
206#define GLCP_CLK_DISABLE 0x12
207#define GLCP_CLK4ACK 0x13
208#define GLCP_SYS_RST 0x14
209#define GLCP_RSVD3 0x15
210#define GLCP_DBG_CLK_CTRL 0x16
211#define GLCP_CHIP_REV_ID 0x17
212
213/* PIC */
214#define PIC_YSEL_LOW 0x20
215#define PIC_YSEL_LOW_USB_SHIFT 8
216#define PIC_YSEL_LOW_ACC_SHIFT 16
217#define PIC_YSEL_LOW_FLASH_SHIFT 24
218#define PIC_YSEL_HIGH 0x21
219#define PIC_ZSEL_LOW 0x22
220#define PIC_ZSEL_HIGH 0x23
221#define PIC_IRQM_PRIM 0x24
222#define PIC_IRQM_LPC 0x25
223#define PIC_XIRR_STS_LOW 0x26
224#define PIC_XIRR_STS_HIGH 0x27
225#define PCI_SHDW 0x34
226
227/*
228 * DIVIL STANDARD
229 */
230#define DIVIL_CAP 0x00
231#define DIVIL_CONFIG 0x01
232#define DIVIL_SMI 0x02
233#define DIVIL_ERROR 0x03
234#define DIVIL_PM 0x04
235#define DIVIL_DIAG 0x05
236
237/*
238 * DIVIL SPEC.
239 */
240#define DIVIL_LBAR_IRQ 0x08
241#define DIVIL_LBAR_KEL 0x09
242#define DIVIL_LBAR_SMB 0x0B
243#define DIVIL_LBAR_GPIO 0x0C
244#define DIVIL_LBAR_MFGPT 0x0D
245#define DIVIL_LBAR_ACPI 0x0E
246#define DIVIL_LBAR_PMS 0x0F
247#define DIVIL_LEG_IO 0x14
248#define DIVIL_BALL_OPTS 0x15
249#define DIVIL_SOFT_IRQ 0x16
250#define DIVIL_SOFT_RESET 0x17
251
252/* MFGPT */
253#define MFGPT_IRQ 0x28
254
255/*
256 * IDE STANDARD
257 */
258#define IDE_CAP 0x00
259#define IDE_CONFIG 0x01
260#define IDE_SMI 0x02
261#define IDE_ERROR 0x03
262#define IDE_PM 0x04
263#define IDE_DIAG 0x05
264
265/*
266 * IDE SPEC.
267 */
268#define IDE_IO_BAR 0x08
269#define IDE_CFG 0x10
270#define IDE_DTC 0x12
271#define IDE_CAST 0x13
272#define IDE_ETC 0x14
273#define IDE_INTERNAL_PM 0x15
274
275/*
276 * ACC STANDARD
277 */
278#define ACC_CAP 0x00
279#define ACC_CONFIG 0x01
280#define ACC_SMI 0x02
281#define ACC_ERROR 0x03
282#define ACC_PM 0x04
283#define ACC_DIAG 0x05
284
285/*
286 * USB STANDARD
287 */
288#define USB_CAP 0x00
289#define USB_CONFIG 0x01
290#define USB_SMI 0x02
291#define USB_ERROR 0x03
292#define USB_PM 0x04
293#define USB_DIAG 0x05
294
295/*
296 * USB SPEC.
297 */
298#define USB_OHCI 0x08
299#define USB_EHCI 0x09
300
301/****************** NATIVE ***************************/
302/* GPIO : I/O SPACE; REG : 32BITS */
303#define GPIOL_OUT_VAL 0x00
304#define GPIOL_OUT_EN 0x04
305
306#endif /* _CS5536_H */
diff --git a/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_mfgpt.h b/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_mfgpt.h
new file mode 100644
index 000000000..52e8bb0fc
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_mfgpt.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * cs5536 mfgpt header file
4 */
5
6#ifndef _CS5536_MFGPT_H
7#define _CS5536_MFGPT_H
8
9#include <cs5536/cs5536.h>
10#include <cs5536/cs5536_pci.h>
11
12#ifdef CONFIG_CS5536_MFGPT
13extern void setup_mfgpt0_timer(void);
14extern void disable_mfgpt0_counter(void);
15extern void enable_mfgpt0_counter(void);
16#else
17static inline void __maybe_unused setup_mfgpt0_timer(void)
18{
19}
20static inline void __maybe_unused disable_mfgpt0_counter(void)
21{
22}
23static inline void __maybe_unused enable_mfgpt0_counter(void)
24{
25}
26#endif
27
28#define MFGPT_TICK_RATE 14318000
29#define COMPARE ((MFGPT_TICK_RATE + HZ/2) / HZ)
30
31#define MFGPT_BASE mfgpt_base
32#define MFGPT0_CMP2 (MFGPT_BASE + 2)
33#define MFGPT0_CNT (MFGPT_BASE + 4)
34#define MFGPT0_SETUP (MFGPT_BASE + 6)
35
36#endif /*!_CS5536_MFGPT_H */
diff --git a/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_pci.h b/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_pci.h
new file mode 100644
index 000000000..a0d4b7528
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_pci.h
@@ -0,0 +1,153 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * the definition file of cs5536 Virtual Support Module(VSM).
4 * pci configuration space can be accessed through the VSM, so
5 * there is no need of the MSR read/write now, except the spec.
6 * MSR registers which are not implemented yet.
7 *
8 * Copyright (C) 2007 Lemote Inc.
9 * Author : jlliu, liujl@lemote.com
10 */
11
12#ifndef _CS5536_PCI_H
13#define _CS5536_PCI_H
14
15#include <linux/types.h>
16#include <linux/pci_regs.h>
17
18extern void cs5536_pci_conf_write4(int function, int reg, u32 value);
19extern u32 cs5536_pci_conf_read4(int function, int reg);
20
21#define CS5536_ACC_INTR 9
22#define CS5536_IDE_INTR 14
23#define CS5536_USB_INTR 11
24#define CS5536_MFGPT_INTR 5
25#define CS5536_UART1_INTR 4
26#define CS5536_UART2_INTR 3
27
28/************** PCI BUS DEVICE FUNCTION ***************/
29
30/*
31 * PCI bus device function
32 */
33#define PCI_BUS_CS5536 0
34#define PCI_IDSEL_CS5536 14
35
36/********** STANDARD PCI-2.2 EXPANSION ****************/
37
38/*
39 * PCI configuration space
40 * we have to virtualize the PCI configure space head, so we should
41 * define the necessary IDs and some others.
42 */
43
44/* CONFIG of PCI VENDOR ID*/
45#define CFG_PCI_VENDOR_ID(mod_dev_id, sys_vendor_id) \
46 (((mod_dev_id) << 16) | (sys_vendor_id))
47
48/* VENDOR ID */
49#define CS5536_VENDOR_ID 0x1022
50
51/* DEVICE ID */
52#define CS5536_ISA_DEVICE_ID 0x2090
53#define CS5536_IDE_DEVICE_ID 0x209a
54#define CS5536_ACC_DEVICE_ID 0x2093
55#define CS5536_OHCI_DEVICE_ID 0x2094
56#define CS5536_EHCI_DEVICE_ID 0x2095
57
58/* CLASS CODE : CLASS SUB-CLASS INTERFACE */
59#define CS5536_ISA_CLASS_CODE 0x060100
60#define CS5536_IDE_CLASS_CODE 0x010180
61#define CS5536_ACC_CLASS_CODE 0x040100
62#define CS5536_OHCI_CLASS_CODE 0x0C0310
63#define CS5536_EHCI_CLASS_CODE 0x0C0320
64
65/* BHLC : BIST HEADER-TYPE LATENCY-TIMER CACHE-LINE-SIZE */
66
67#define CFG_PCI_CACHE_LINE_SIZE(header_type, latency_timer) \
68 ((PCI_NONE_BIST << 24) | ((header_type) << 16) \
69 | ((latency_timer) << 8) | PCI_NORMAL_CACHE_LINE_SIZE);
70
71#define PCI_NONE_BIST 0x00 /* RO not implemented yet. */
72#define PCI_BRIDGE_HEADER_TYPE 0x80 /* RO */
73#define PCI_NORMAL_HEADER_TYPE 0x00
74#define PCI_NORMAL_LATENCY_TIMER 0x00
75#define PCI_NORMAL_CACHE_LINE_SIZE 0x08 /* RW */
76
77/* BAR */
78#define PCI_BAR0_REG 0x10
79#define PCI_BAR1_REG 0x14
80#define PCI_BAR2_REG 0x18
81#define PCI_BAR3_REG 0x1c
82#define PCI_BAR4_REG 0x20
83#define PCI_BAR5_REG 0x24
84#define PCI_BAR_RANGE_MASK 0xFFFFFFFF
85
86/* CARDBUS CIS POINTER */
87#define PCI_CARDBUS_CIS_POINTER 0x00000000
88
89/* SUBSYSTEM VENDOR ID */
90#define CS5536_SUB_VENDOR_ID CS5536_VENDOR_ID
91
92/* SUBSYSTEM ID */
93#define CS5536_ISA_SUB_ID CS5536_ISA_DEVICE_ID
94#define CS5536_IDE_SUB_ID CS5536_IDE_DEVICE_ID
95#define CS5536_ACC_SUB_ID CS5536_ACC_DEVICE_ID
96#define CS5536_OHCI_SUB_ID CS5536_OHCI_DEVICE_ID
97#define CS5536_EHCI_SUB_ID CS5536_EHCI_DEVICE_ID
98
99/* EXPANSION ROM BAR */
100#define PCI_EXPANSION_ROM_BAR 0x00000000
101
102/* CAPABILITIES POINTER */
103#define PCI_CAPLIST_POINTER 0x00000000
104#define PCI_CAPLIST_USB_POINTER 0x40
105/* INTERRUPT */
106
107#define CFG_PCI_INTERRUPT_LINE(pin, mod_intr) \
108 ((PCI_MAX_LATENCY << 24) | (PCI_MIN_GRANT << 16) | \
109 ((pin) << 8) | (mod_intr))
110
111#define PCI_MAX_LATENCY 0x40
112#define PCI_MIN_GRANT 0x00
113#define PCI_DEFAULT_PIN 0x01
114
115/*********** EXPANSION PCI REG ************************/
116
117/*
118 * ISA EXPANSION
119 */
120#define PCI_UART1_INT_REG 0x50
121#define PCI_UART2_INT_REG 0x54
122#define PCI_ISA_FIXUP_REG 0x58
123
124/*
125 * IDE EXPANSION
126 */
127#define PCI_IDE_CFG_REG 0x40
128#define CS5536_IDE_FLASH_SIGNATURE 0xDEADBEEF
129#define PCI_IDE_DTC_REG 0x48
130#define PCI_IDE_CAST_REG 0x4C
131#define PCI_IDE_ETC_REG 0x50
132#define PCI_IDE_PM_REG 0x54
133#define PCI_IDE_INT_REG 0x60
134
135/*
136 * ACC EXPANSION
137 */
138#define PCI_ACC_INT_REG 0x50
139
140/*
141 * OHCI EXPANSION : INTTERUPT IS IMPLEMENTED BY THE OHCI
142 */
143#define PCI_OHCI_PM_REG 0x40
144#define PCI_OHCI_INT_REG 0x50
145
146/*
147 * EHCI EXPANSION
148 */
149#define PCI_EHCI_LEGSMIEN_REG 0x50
150#define PCI_EHCI_LEGSMISTS_REG 0x54
151#define PCI_EHCI_FLADJ_REG 0x60
152
153#endif /* _CS5536_PCI_H_ */
diff --git a/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_vsm.h b/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_vsm.h
new file mode 100644
index 000000000..70d0153cc
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/cs5536/cs5536_vsm.h
@@ -0,0 +1,32 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * the read/write interfaces for Virtual Support Module(VSM)
4 *
5 * Copyright (C) 2009 Lemote, Inc.
6 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
7 */
8
9#ifndef _CS5536_VSM_H
10#define _CS5536_VSM_H
11
12#include <linux/types.h>
13
14typedef void (*cs5536_pci_vsm_write)(int reg, u32 value);
15typedef u32 (*cs5536_pci_vsm_read)(int reg);
16
17#define DECLARE_CS5536_MODULE(name) \
18extern void pci_##name##_write_reg(int reg, u32 value); \
19extern u32 pci_##name##_read_reg(int reg);
20
21/* ide module */
22DECLARE_CS5536_MODULE(ide)
23/* acc module */
24DECLARE_CS5536_MODULE(acc)
25/* ohci module */
26DECLARE_CS5536_MODULE(ohci)
27/* isa module */
28DECLARE_CS5536_MODULE(isa)
29/* ehci module */
30DECLARE_CS5536_MODULE(ehci)
31
32#endif /* _CS5536_VSM_H */
diff --git a/arch/mips/include/asm/mach-loongson2ef/loongson.h b/arch/mips/include/asm/mach-loongson2ef/loongson.h
new file mode 100644
index 000000000..57e571128
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/loongson.h
@@ -0,0 +1,327 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2009 Lemote, Inc.
4 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
5 */
6
7#ifndef __ASM_MACH_LOONGSON2EF_LOONGSON_H
8#define __ASM_MACH_LOONGSON2EF_LOONGSON_H
9
10#include <linux/io.h>
11#include <linux/init.h>
12#include <linux/irq.h>
13
14/* loongson internal northbridge initialization */
15extern void bonito_irq_init(void);
16
17/* machine-specific reboot/halt operation */
18extern void mach_prepare_reboot(void);
19extern void mach_prepare_shutdown(void);
20
21/* environment arguments from bootloader */
22extern u32 cpu_clock_freq;
23extern u32 memsize, highmemsize;
24
25/* loongson-specific command line, env and memory initialization */
26extern void __init prom_init_memory(void);
27extern void __init prom_init_machtype(void);
28extern void __init prom_init_env(void);
29#ifdef CONFIG_LOONGSON_UART_BASE
30extern unsigned long _loongson_uart_base, loongson_uart_base;
31extern void prom_init_loongson_uart_base(void);
32#endif
33
34static inline void prom_init_uart_base(void)
35{
36#ifdef CONFIG_LOONGSON_UART_BASE
37 prom_init_loongson_uart_base();
38#endif
39}
40
41/* irq operation functions */
42extern void bonito_irqdispatch(void);
43extern void __init bonito_irq_init(void);
44extern void __init mach_init_irq(void);
45extern void mach_irq_dispatch(unsigned int pending);
46extern int mach_i8259_irq(void);
47
48/* We need this in some places... */
49#define delay() ({ \
50 int x; \
51 for (x = 0; x < 100000; x++) \
52 __asm__ __volatile__(""); \
53})
54
55#define LOONGSON_REG(x) \
56 (*(volatile u32 *)((char *)CKSEG1ADDR(LOONGSON_REG_BASE) + (x)))
57
58#define LOONGSON_IRQ_BASE 32
59#define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */
60
61#include <linux/interrupt.h>
62static inline void do_perfcnt_IRQ(void)
63{
64#if IS_ENABLED(CONFIG_OPROFILE)
65 do_IRQ(LOONGSON2_PERFCNT_IRQ);
66#endif
67}
68
69#define LOONGSON_FLASH_BASE 0x1c000000
70#define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */
71#define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1)
72
73#define LOONGSON_LIO0_BASE 0x1e000000
74#define LOONGSON_LIO0_SIZE 0x01C00000 /* 28M */
75#define LOONGSON_LIO0_TOP (LOONGSON_LIO0_BASE+LOONGSON_LIO0_SIZE-1)
76
77#define LOONGSON_BOOT_BASE 0x1fc00000
78#define LOONGSON_BOOT_SIZE 0x00100000 /* 1M */
79#define LOONGSON_BOOT_TOP (LOONGSON_BOOT_BASE+LOONGSON_BOOT_SIZE-1)
80#define LOONGSON_REG_BASE 0x1fe00000
81#define LOONGSON_REG_SIZE 0x00100000 /* 256Bytes + 256Bytes + ??? */
82#define LOONGSON_REG_TOP (LOONGSON_REG_BASE+LOONGSON_REG_SIZE-1)
83
84#define LOONGSON_LIO1_BASE 0x1ff00000
85#define LOONGSON_LIO1_SIZE 0x00100000 /* 1M */
86#define LOONGSON_LIO1_TOP (LOONGSON_LIO1_BASE+LOONGSON_LIO1_SIZE-1)
87
88#define LOONGSON_PCILO0_BASE 0x10000000
89#define LOONGSON_PCILO1_BASE 0x14000000
90#define LOONGSON_PCILO2_BASE 0x18000000
91#define LOONGSON_PCILO_BASE LOONGSON_PCILO0_BASE
92#define LOONGSON_PCILO_SIZE 0x0c000000 /* 64M * 3 */
93#define LOONGSON_PCILO_TOP (LOONGSON_PCILO0_BASE+LOONGSON_PCILO_SIZE-1)
94
95#define LOONGSON_PCICFG_BASE 0x1fe80000
96#define LOONGSON_PCICFG_SIZE 0x00000800 /* 2K */
97#define LOONGSON_PCICFG_TOP (LOONGSON_PCICFG_BASE+LOONGSON_PCICFG_SIZE-1)
98#define LOONGSON_PCIIO_BASE 0x1fd00000
99
100#define LOONGSON_PCIIO_SIZE 0x00100000 /* 1M */
101#define LOONGSON_PCIIO_TOP (LOONGSON_PCIIO_BASE+LOONGSON_PCIIO_SIZE-1)
102
103/* Loongson Register Bases */
104
105#define LOONGSON_PCICONFIGBASE 0x00
106#define LOONGSON_REGBASE 0x100
107
108/* PCI Configuration Registers */
109
110#define LOONGSON_PCI_REG(x) LOONGSON_REG(LOONGSON_PCICONFIGBASE + (x))
111#define LOONGSON_PCIDID LOONGSON_PCI_REG(0x00)
112#define LOONGSON_PCICMD LOONGSON_PCI_REG(0x04)
113#define LOONGSON_PCICLASS LOONGSON_PCI_REG(0x08)
114#define LOONGSON_PCILTIMER LOONGSON_PCI_REG(0x0c)
115#define LOONGSON_PCIBASE0 LOONGSON_PCI_REG(0x10)
116#define LOONGSON_PCIBASE1 LOONGSON_PCI_REG(0x14)
117#define LOONGSON_PCIBASE2 LOONGSON_PCI_REG(0x18)
118#define LOONGSON_PCIBASE3 LOONGSON_PCI_REG(0x1c)
119#define LOONGSON_PCIBASE4 LOONGSON_PCI_REG(0x20)
120#define LOONGSON_PCIEXPRBASE LOONGSON_PCI_REG(0x30)
121#define LOONGSON_PCIINT LOONGSON_PCI_REG(0x3c)
122
123#define LOONGSON_PCI_ISR4C LOONGSON_PCI_REG(0x4c)
124
125#define LOONGSON_PCICMD_PERR_CLR 0x80000000
126#define LOONGSON_PCICMD_SERR_CLR 0x40000000
127#define LOONGSON_PCICMD_MABORT_CLR 0x20000000
128#define LOONGSON_PCICMD_MTABORT_CLR 0x10000000
129#define LOONGSON_PCICMD_TABORT_CLR 0x08000000
130#define LOONGSON_PCICMD_MPERR_CLR 0x01000000
131#define LOONGSON_PCICMD_PERRRESPEN 0x00000040
132#define LOONGSON_PCICMD_ASTEPEN 0x00000080
133#define LOONGSON_PCICMD_SERREN 0x00000100
134#define LOONGSON_PCILTIMER_BUSLATENCY 0x0000ff00
135#define LOONGSON_PCILTIMER_BUSLATENCY_SHIFT 8
136
137/* Loongson h/w Configuration */
138
139#define LOONGSON_GENCFG_OFFSET 0x4
140#define LOONGSON_GENCFG LOONGSON_REG(LOONGSON_REGBASE + LOONGSON_GENCFG_OFFSET)
141
142#define LOONGSON_GENCFG_DEBUGMODE 0x00000001
143#define LOONGSON_GENCFG_SNOOPEN 0x00000002
144#define LOONGSON_GENCFG_CPUSELFRESET 0x00000004
145
146#define LOONGSON_GENCFG_FORCE_IRQA 0x00000008
147#define LOONGSON_GENCFG_IRQA_ISOUT 0x00000010
148#define LOONGSON_GENCFG_IRQA_FROM_INT1 0x00000020
149#define LOONGSON_GENCFG_BYTESWAP 0x00000040
150
151#define LOONGSON_GENCFG_UNCACHED 0x00000080
152#define LOONGSON_GENCFG_PREFETCHEN 0x00000100
153#define LOONGSON_GENCFG_WBEHINDEN 0x00000200
154#define LOONGSON_GENCFG_CACHEALG 0x00000c00
155#define LOONGSON_GENCFG_CACHEALG_SHIFT 10
156#define LOONGSON_GENCFG_PCIQUEUE 0x00001000
157#define LOONGSON_GENCFG_CACHESTOP 0x00002000
158#define LOONGSON_GENCFG_MSTRBYTESWAP 0x00004000
159#define LOONGSON_GENCFG_BUSERREN 0x00008000
160#define LOONGSON_GENCFG_NORETRYTIMEOUT 0x00010000
161#define LOONGSON_GENCFG_SHORTCOPYTIMEOUT 0x00020000
162
163/* PCI address map control */
164
165#define LOONGSON_PCIMAP LOONGSON_REG(LOONGSON_REGBASE + 0x10)
166#define LOONGSON_PCIMEMBASECFG LOONGSON_REG(LOONGSON_REGBASE + 0x14)
167#define LOONGSON_PCIMAP_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x18)
168
169/* GPIO Regs - r/w */
170
171#define LOONGSON_GPIODATA LOONGSON_REG(LOONGSON_REGBASE + 0x1c)
172#define LOONGSON_GPIOIE LOONGSON_REG(LOONGSON_REGBASE + 0x20)
173
174/* ICU Configuration Regs - r/w */
175
176#define LOONGSON_INTEDGE LOONGSON_REG(LOONGSON_REGBASE + 0x24)
177#define LOONGSON_INTSTEER LOONGSON_REG(LOONGSON_REGBASE + 0x28)
178#define LOONGSON_INTPOL LOONGSON_REG(LOONGSON_REGBASE + 0x2c)
179
180/* ICU Enable Regs - IntEn & IntISR are r/o. */
181
182#define LOONGSON_INTENSET LOONGSON_REG(LOONGSON_REGBASE + 0x30)
183#define LOONGSON_INTENCLR LOONGSON_REG(LOONGSON_REGBASE + 0x34)
184#define LOONGSON_INTEN LOONGSON_REG(LOONGSON_REGBASE + 0x38)
185#define LOONGSON_INTISR LOONGSON_REG(LOONGSON_REGBASE + 0x3c)
186
187/* ICU */
188#define LOONGSON_ICU_MBOXES 0x0000000f
189#define LOONGSON_ICU_MBOXES_SHIFT 0
190#define LOONGSON_ICU_DMARDY 0x00000010
191#define LOONGSON_ICU_DMAEMPTY 0x00000020
192#define LOONGSON_ICU_COPYRDY 0x00000040
193#define LOONGSON_ICU_COPYEMPTY 0x00000080
194#define LOONGSON_ICU_COPYERR 0x00000100
195#define LOONGSON_ICU_PCIIRQ 0x00000200
196#define LOONGSON_ICU_MASTERERR 0x00000400
197#define LOONGSON_ICU_SYSTEMERR 0x00000800
198#define LOONGSON_ICU_DRAMPERR 0x00001000
199#define LOONGSON_ICU_RETRYERR 0x00002000
200#define LOONGSON_ICU_GPIOS 0x01ff0000
201#define LOONGSON_ICU_GPIOS_SHIFT 16
202#define LOONGSON_ICU_GPINS 0x7e000000
203#define LOONGSON_ICU_GPINS_SHIFT 25
204#define LOONGSON_ICU_MBOX(N) (1<<(LOONGSON_ICU_MBOXES_SHIFT+(N)))
205#define LOONGSON_ICU_GPIO(N) (1<<(LOONGSON_ICU_GPIOS_SHIFT+(N)))
206#define LOONGSON_ICU_GPIN(N) (1<<(LOONGSON_ICU_GPINS_SHIFT+(N)))
207
208/* PCI prefetch window base & mask */
209
210#define LOONGSON_MEM_WIN_BASE_L LOONGSON_REG(LOONGSON_REGBASE + 0x40)
211#define LOONGSON_MEM_WIN_BASE_H LOONGSON_REG(LOONGSON_REGBASE + 0x44)
212#define LOONGSON_MEM_WIN_MASK_L LOONGSON_REG(LOONGSON_REGBASE + 0x48)
213#define LOONGSON_MEM_WIN_MASK_H LOONGSON_REG(LOONGSON_REGBASE + 0x4c)
214
215/* PCI_Hit*_Sel_* */
216
217#define LOONGSON_PCI_HIT0_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x50)
218#define LOONGSON_PCI_HIT0_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x54)
219#define LOONGSON_PCI_HIT1_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x58)
220#define LOONGSON_PCI_HIT1_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x5c)
221#define LOONGSON_PCI_HIT2_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x60)
222#define LOONGSON_PCI_HIT2_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x64)
223
224/* PXArb Config & Status */
225
226#define LOONGSON_PXARB_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x68)
227#define LOONGSON_PXARB_STATUS LOONGSON_REG(LOONGSON_REGBASE + 0x6c)
228
229/* Chip Config registor of each physical cpu package, PRid >= Loongson-2F */
230#define LOONGSON_CHIPCFG (void __iomem *)TO_UNCAC(0x1fc00180)
231
232/* pcimap */
233
234#define LOONGSON_PCIMAP_PCIMAP_LO0 0x0000003f
235#define LOONGSON_PCIMAP_PCIMAP_LO0_SHIFT 0
236#define LOONGSON_PCIMAP_PCIMAP_LO1 0x00000fc0
237#define LOONGSON_PCIMAP_PCIMAP_LO1_SHIFT 6
238#define LOONGSON_PCIMAP_PCIMAP_LO2 0x0003f000
239#define LOONGSON_PCIMAP_PCIMAP_LO2_SHIFT 12
240#define LOONGSON_PCIMAP_PCIMAP_2 0x00040000
241#define LOONGSON_PCIMAP_WIN(WIN, ADDR) \
242 ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
243
244#ifdef CONFIG_CPU_SUPPORTS_CPUFREQ
245#include <linux/cpufreq.h>
246extern struct cpufreq_frequency_table loongson2_clockmod_table[];
247extern int loongson2_cpu_set_rate(unsigned long rate_khz);
248#endif
249
250/*
251 * address windows configuration module
252 *
253 * loongson2e do not have this module
254 */
255#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
256
257/* address window config module base address */
258#define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul
259#define LOONGSON_ADDRWINCFG_SIZE 0x180
260
261extern unsigned long _loongson_addrwincfg_base;
262#define LOONGSON_ADDRWINCFG(offset) \
263 (*(volatile u64 *)(_loongson_addrwincfg_base + (offset)))
264
265#define CPU_WIN0_BASE LOONGSON_ADDRWINCFG(0x00)
266#define CPU_WIN1_BASE LOONGSON_ADDRWINCFG(0x08)
267#define CPU_WIN2_BASE LOONGSON_ADDRWINCFG(0x10)
268#define CPU_WIN3_BASE LOONGSON_ADDRWINCFG(0x18)
269
270#define CPU_WIN0_MASK LOONGSON_ADDRWINCFG(0x20)
271#define CPU_WIN1_MASK LOONGSON_ADDRWINCFG(0x28)
272#define CPU_WIN2_MASK LOONGSON_ADDRWINCFG(0x30)
273#define CPU_WIN3_MASK LOONGSON_ADDRWINCFG(0x38)
274
275#define CPU_WIN0_MMAP LOONGSON_ADDRWINCFG(0x40)
276#define CPU_WIN1_MMAP LOONGSON_ADDRWINCFG(0x48)
277#define CPU_WIN2_MMAP LOONGSON_ADDRWINCFG(0x50)
278#define CPU_WIN3_MMAP LOONGSON_ADDRWINCFG(0x58)
279
280#define PCIDMA_WIN0_BASE LOONGSON_ADDRWINCFG(0x60)
281#define PCIDMA_WIN1_BASE LOONGSON_ADDRWINCFG(0x68)
282#define PCIDMA_WIN2_BASE LOONGSON_ADDRWINCFG(0x70)
283#define PCIDMA_WIN3_BASE LOONGSON_ADDRWINCFG(0x78)
284
285#define PCIDMA_WIN0_MASK LOONGSON_ADDRWINCFG(0x80)
286#define PCIDMA_WIN1_MASK LOONGSON_ADDRWINCFG(0x88)
287#define PCIDMA_WIN2_MASK LOONGSON_ADDRWINCFG(0x90)
288#define PCIDMA_WIN3_MASK LOONGSON_ADDRWINCFG(0x98)
289
290#define PCIDMA_WIN0_MMAP LOONGSON_ADDRWINCFG(0xa0)
291#define PCIDMA_WIN1_MMAP LOONGSON_ADDRWINCFG(0xa8)
292#define PCIDMA_WIN2_MMAP LOONGSON_ADDRWINCFG(0xb0)
293#define PCIDMA_WIN3_MMAP LOONGSON_ADDRWINCFG(0xb8)
294
295#define ADDRWIN_WIN0 0
296#define ADDRWIN_WIN1 1
297#define ADDRWIN_WIN2 2
298#define ADDRWIN_WIN3 3
299
300#define ADDRWIN_MAP_DST_DDR 0
301#define ADDRWIN_MAP_DST_PCI 1
302#define ADDRWIN_MAP_DST_LIO 1
303
304/*
305 * s: CPU, PCIDMA
306 * d: DDR, PCI, LIO
307 * win: 0, 1, 2, 3
308 * src: map source
309 * dst: map destination
310 * size: ~mask + 1
311 */
312#define LOONGSON_ADDRWIN_CFG(s, d, w, src, dst, size) do {\
313 s##_WIN##w##_BASE = (src); \
314 s##_WIN##w##_MMAP = (dst) | ADDRWIN_MAP_DST_##d; \
315 s##_WIN##w##_MASK = ~(size-1); \
316} while (0)
317
318#define LOONGSON_ADDRWIN_CPUTOPCI(win, src, dst, size) \
319 LOONGSON_ADDRWIN_CFG(CPU, PCI, win, src, dst, size)
320#define LOONGSON_ADDRWIN_CPUTODDR(win, src, dst, size) \
321 LOONGSON_ADDRWIN_CFG(CPU, DDR, win, src, dst, size)
322#define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \
323 LOONGSON_ADDRWIN_CFG(PCIDMA, DDR, win, src, dst, size)
324
325#endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */
326
327#endif /* __ASM_MACH_LOONGSON2EF_LOONGSON_H */
diff --git a/arch/mips/include/asm/mach-loongson2ef/machine.h b/arch/mips/include/asm/mach-loongson2ef/machine.h
new file mode 100644
index 000000000..4097267ef
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/machine.h
@@ -0,0 +1,23 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2009 Lemote, Inc.
4 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
5 */
6
7#ifndef __ASM_MACH_LOONGSON2EF_MACHINE_H
8#define __ASM_MACH_LOONGSON2EF_MACHINE_H
9
10#ifdef CONFIG_LEMOTE_FULOONG2E
11
12#define LOONGSON_MACHTYPE MACH_LEMOTE_FL2E
13
14#endif
15
16/* use fuloong2f as the default machine of LEMOTE_MACH2F */
17#ifdef CONFIG_LEMOTE_MACH2F
18
19#define LOONGSON_MACHTYPE MACH_LEMOTE_FL2F
20
21#endif
22
23#endif /* __ASM_MACH_LOONGSON2EF_MACHINE_H */
diff --git a/arch/mips/include/asm/mach-loongson2ef/mem.h b/arch/mips/include/asm/mach-loongson2ef/mem.h
new file mode 100644
index 000000000..d1d759b89
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/mem.h
@@ -0,0 +1,37 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2009 Lemote, Inc.
4 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
5 */
6
7#ifndef __ASM_MACH_LOONGSON2EF_MEM_H
8#define __ASM_MACH_LOONGSON2EF_MEM_H
9
10/*
11 * high memory space
12 *
13 * in loongson2e, starts from 512M
14 * in loongson2f, starts from 2G 256M
15 */
16#ifdef CONFIG_CPU_LOONGSON2E
17#define LOONGSON_HIGHMEM_START 0x20000000
18#else
19#define LOONGSON_HIGHMEM_START 0x90000000
20#endif
21
22/*
23 * the peripheral registers(MMIO):
24 *
25 * On the Lemote Loongson 2e system, reside between 0x1000:0000 and 0x2000:0000.
26 * On the Lemote Loongson 2f system, reside between 0x1000:0000 and 0x8000:0000.
27 */
28
29#define LOONGSON_MMIO_MEM_START 0x10000000
30
31#ifdef CONFIG_CPU_LOONGSON2E
32#define LOONGSON_MMIO_MEM_END 0x20000000
33#else
34#define LOONGSON_MMIO_MEM_END 0x80000000
35#endif
36
37#endif /* __ASM_MACH_LOONGSON2EF_MEM_H */
diff --git a/arch/mips/include/asm/mach-loongson2ef/pci.h b/arch/mips/include/asm/mach-loongson2ef/pci.h
new file mode 100644
index 000000000..5588c5bc5
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/pci.h
@@ -0,0 +1,46 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2008 Zhang Le <r0bertz@gentoo.org>
4 * Copyright (c) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
5 */
6
7#ifndef __ASM_MACH_LOONGSON2EF_PCI_H_
8#define __ASM_MACH_LOONGSON2EF_PCI_H_
9
10extern struct pci_ops loongson_pci_ops;
11
12/* this is an offset from mips_io_port_base */
13#define LOONGSON_PCI_IO_START 0x00004000UL
14
15#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
16
17/*
18 * we use address window2 to map cpu address space to pci space
19 * window2: cpu [1G, 2G] -> pci [1G, 2G]
20 * why not use window 0 & 1? because they are used by cpu when booting.
21 * window0: cpu [0, 256M] -> ddr [0, 256M]
22 * window1: cpu [256M, 512M] -> pci [256M, 512M]
23 */
24
25/* the smallest LOONGSON_CPU_MEM_SRC can be 512M */
26#define LOONGSON_CPU_MEM_SRC 0x40000000ul /* 1G */
27#define LOONGSON_PCI_MEM_DST LOONGSON_CPU_MEM_SRC
28
29#define LOONGSON_PCI_MEM_START LOONGSON_PCI_MEM_DST
30#define LOONGSON_PCI_MEM_END (0x80000000ul-1) /* 2G */
31
32#define MMAP_CPUTOPCI_SIZE (LOONGSON_PCI_MEM_END - \
33 LOONGSON_PCI_MEM_START + 1)
34
35#else /* loongson2f/32bit & loongson2e */
36
37/* this pci memory space is mapped by pcimap in pci.c */
38#define LOONGSON_PCI_MEM_START LOONGSON_PCILO1_BASE
39#define LOONGSON_PCI_MEM_END (LOONGSON_PCILO1_BASE + 0x04000000 * 2)
40
41/* this is an offset from mips_io_port_base */
42#define LOONGSON_PCI_IO_START 0x00004000UL
43
44#endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */
45
46#endif /* !__ASM_MACH_LOONGSON2EF_PCI_H_ */
diff --git a/arch/mips/include/asm/mach-loongson2ef/spaces.h b/arch/mips/include/asm/mach-loongson2ef/spaces.h
new file mode 100644
index 000000000..ba4e8e9b6
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson2ef/spaces.h
@@ -0,0 +1,10 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_LOONGSON2EF_SPACES_H_
3#define __ASM_MACH_LOONGSON2EF_SPACES_H_
4
5#if defined(CONFIG_64BIT)
6#define CAC_BASE _AC(0x9800000000000000, UL)
7#endif /* CONFIG_64BIT */
8
9#include <asm/mach-generic/spaces.h>
10#endif
diff --git a/arch/mips/include/asm/mach-loongson32/cpufreq.h b/arch/mips/include/asm/mach-loongson32/cpufreq.h
new file mode 100644
index 000000000..e422a3288
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/cpufreq.h
@@ -0,0 +1,18 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com>
4 *
5 * Loongson 1 CPUFreq platform support.
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_CPUFREQ_H
9#define __ASM_MACH_LOONGSON32_CPUFREQ_H
10
11struct plat_ls1x_cpufreq {
12 const char *clk_name; /* CPU clk */
13 const char *osc_clk_name; /* OSC clk */
14 unsigned int max_freq; /* in kHz */
15 unsigned int min_freq; /* in kHz */
16};
17
18#endif /* __ASM_MACH_LOONGSON32_CPUFREQ_H */
diff --git a/arch/mips/include/asm/mach-loongson32/dma.h b/arch/mips/include/asm/mach-loongson32/dma.h
new file mode 100644
index 000000000..e917b3ccb
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/dma.h
@@ -0,0 +1,21 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2015 Zhang, Keguang <keguang.zhang@gmail.com>
4 *
5 * Loongson 1 NAND platform support.
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_DMA_H
9#define __ASM_MACH_LOONGSON32_DMA_H
10
11#define LS1X_DMA_CHANNEL0 0
12#define LS1X_DMA_CHANNEL1 1
13#define LS1X_DMA_CHANNEL2 2
14
15struct plat_ls1x_dma {
16 int nr_channels;
17};
18
19extern struct plat_ls1x_dma ls1b_dma_pdata;
20
21#endif /* __ASM_MACH_LOONGSON32_DMA_H */
diff --git a/arch/mips/include/asm/mach-loongson32/irq.h b/arch/mips/include/asm/mach-loongson32/irq.h
new file mode 100644
index 000000000..6115f025b
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/irq.h
@@ -0,0 +1,107 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
4 *
5 * IRQ mappings for Loongson 1
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_IRQ_H
9#define __ASM_MACH_LOONGSON32_IRQ_H
10
11/*
12 * CPU core Interrupt Numbers
13 */
14#define MIPS_CPU_IRQ_BASE 0
15#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
16
17#define SOFTINT0_IRQ MIPS_CPU_IRQ(0)
18#define SOFTINT1_IRQ MIPS_CPU_IRQ(1)
19#define INT0_IRQ MIPS_CPU_IRQ(2)
20#define INT1_IRQ MIPS_CPU_IRQ(3)
21#define INT2_IRQ MIPS_CPU_IRQ(4)
22#define INT3_IRQ MIPS_CPU_IRQ(5)
23#define INT4_IRQ MIPS_CPU_IRQ(6)
24#define TIMER_IRQ MIPS_CPU_IRQ(7) /* cpu timer */
25
26#define MIPS_CPU_IRQS (MIPS_CPU_IRQ(7) + 1 - MIPS_CPU_IRQ_BASE)
27
28/*
29 * INT0~3 Interrupt Numbers
30 */
31#define LS1X_IRQ_BASE MIPS_CPU_IRQS
32#define LS1X_IRQ(n, x) (LS1X_IRQ_BASE + (n << 5) + (x))
33
34#define LS1X_UART0_IRQ LS1X_IRQ(0, 2)
35#if defined(CONFIG_LOONGSON1_LS1B)
36#define LS1X_UART1_IRQ LS1X_IRQ(0, 3)
37#define LS1X_UART2_IRQ LS1X_IRQ(0, 4)
38#define LS1X_UART3_IRQ LS1X_IRQ(0, 5)
39#elif defined(CONFIG_LOONGSON1_LS1C)
40#define LS1X_UART1_IRQ LS1X_IRQ(0, 4)
41#define LS1X_UART2_IRQ LS1X_IRQ(0, 5)
42#endif
43#define LS1X_CAN0_IRQ LS1X_IRQ(0, 6)
44#define LS1X_CAN1_IRQ LS1X_IRQ(0, 7)
45#define LS1X_SPI0_IRQ LS1X_IRQ(0, 8)
46#define LS1X_SPI1_IRQ LS1X_IRQ(0, 9)
47#define LS1X_AC97_IRQ LS1X_IRQ(0, 10)
48#define LS1X_DMA0_IRQ LS1X_IRQ(0, 13)
49#define LS1X_DMA1_IRQ LS1X_IRQ(0, 14)
50#define LS1X_DMA2_IRQ LS1X_IRQ(0, 15)
51#if defined(CONFIG_LOONGSON1_LS1C)
52#define LS1X_NAND_IRQ LS1X_IRQ(0, 16)
53#endif
54#define LS1X_PWM0_IRQ LS1X_IRQ(0, 17)
55#define LS1X_PWM1_IRQ LS1X_IRQ(0, 18)
56#define LS1X_PWM2_IRQ LS1X_IRQ(0, 19)
57#define LS1X_PWM3_IRQ LS1X_IRQ(0, 20)
58#define LS1X_RTC_INT0_IRQ LS1X_IRQ(0, 21)
59#define LS1X_RTC_INT1_IRQ LS1X_IRQ(0, 22)
60#define LS1X_RTC_INT2_IRQ LS1X_IRQ(0, 23)
61#if defined(CONFIG_LOONGSON1_LS1B)
62#define LS1X_TOY_INT0_IRQ LS1X_IRQ(0, 24)
63#define LS1X_TOY_INT1_IRQ LS1X_IRQ(0, 25)
64#define LS1X_TOY_INT2_IRQ LS1X_IRQ(0, 26)
65#define LS1X_RTC_TICK_IRQ LS1X_IRQ(0, 27)
66#define LS1X_TOY_TICK_IRQ LS1X_IRQ(0, 28)
67#define LS1X_UART4_IRQ LS1X_IRQ(0, 29)
68#define LS1X_UART5_IRQ LS1X_IRQ(0, 30)
69#elif defined(CONFIG_LOONGSON1_LS1C)
70#define LS1X_UART3_IRQ LS1X_IRQ(0, 29)
71#define LS1X_ADC_IRQ LS1X_IRQ(0, 30)
72#define LS1X_SDIO_IRQ LS1X_IRQ(0, 31)
73#endif
74
75#define LS1X_EHCI_IRQ LS1X_IRQ(1, 0)
76#define LS1X_OHCI_IRQ LS1X_IRQ(1, 1)
77#if defined(CONFIG_LOONGSON1_LS1B)
78#define LS1X_GMAC0_IRQ LS1X_IRQ(1, 2)
79#define LS1X_GMAC1_IRQ LS1X_IRQ(1, 3)
80#elif defined(CONFIG_LOONGSON1_LS1C)
81#define LS1X_OTG_IRQ LS1X_IRQ(1, 2)
82#define LS1X_GMAC0_IRQ LS1X_IRQ(1, 3)
83#define LS1X_CAM_IRQ LS1X_IRQ(1, 4)
84#define LS1X_UART4_IRQ LS1X_IRQ(1, 5)
85#define LS1X_UART5_IRQ LS1X_IRQ(1, 6)
86#define LS1X_UART6_IRQ LS1X_IRQ(1, 7)
87#define LS1X_UART7_IRQ LS1X_IRQ(1, 8)
88#define LS1X_UART8_IRQ LS1X_IRQ(1, 9)
89#define LS1X_UART9_IRQ LS1X_IRQ(1, 13)
90#define LS1X_UART10_IRQ LS1X_IRQ(1, 14)
91#define LS1X_UART11_IRQ LS1X_IRQ(1, 15)
92#define LS1X_I2C0_IRQ LS1X_IRQ(1, 17)
93#define LS1X_I2C1_IRQ LS1X_IRQ(1, 18)
94#define LS1X_I2C2_IRQ LS1X_IRQ(1, 19)
95#endif
96
97#if defined(CONFIG_LOONGSON1_LS1B)
98#define INTN 4
99#elif defined(CONFIG_LOONGSON1_LS1C)
100#define INTN 5
101#endif
102
103#define LS1X_IRQS (LS1X_IRQ(INTN, 31) + 1 - LS1X_IRQ_BASE)
104
105#define NR_IRQS (MIPS_CPU_IRQS + LS1X_IRQS)
106
107#endif /* __ASM_MACH_LOONGSON32_IRQ_H */
diff --git a/arch/mips/include/asm/mach-loongson32/loongson1.h b/arch/mips/include/asm/mach-loongson32/loongson1.h
new file mode 100644
index 000000000..eb3ddbec1
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/loongson1.h
@@ -0,0 +1,54 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
4 *
5 * Register mappings for Loongson 1
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_LOONGSON1_H
9#define __ASM_MACH_LOONGSON32_LOONGSON1_H
10
11#if defined(CONFIG_LOONGSON1_LS1B)
12#define DEFAULT_MEMSIZE 64 /* If no memsize provided */
13#elif defined(CONFIG_LOONGSON1_LS1C)
14#define DEFAULT_MEMSIZE 32
15#endif
16
17/* Loongson 1 Register Bases */
18#define LS1X_MUX_BASE 0x1fd00420
19#define LS1X_INTC_BASE 0x1fd01040
20#define LS1X_GPIO0_BASE 0x1fd010c0
21#define LS1X_GPIO1_BASE 0x1fd010c4
22#define LS1X_DMAC_BASE 0x1fd01160
23#define LS1X_CBUS_BASE 0x1fd011c0
24#define LS1X_EHCI_BASE 0x1fe00000
25#define LS1X_OHCI_BASE 0x1fe08000
26#define LS1X_GMAC0_BASE 0x1fe10000
27#define LS1X_GMAC1_BASE 0x1fe20000
28
29#define LS1X_UART0_BASE 0x1fe40000
30#define LS1X_UART1_BASE 0x1fe44000
31#define LS1X_UART2_BASE 0x1fe48000
32#define LS1X_UART3_BASE 0x1fe4c000
33#define LS1X_CAN0_BASE 0x1fe50000
34#define LS1X_CAN1_BASE 0x1fe54000
35#define LS1X_I2C0_BASE 0x1fe58000
36#define LS1X_I2C1_BASE 0x1fe68000
37#define LS1X_I2C2_BASE 0x1fe70000
38#define LS1X_PWM0_BASE 0x1fe5c000
39#define LS1X_PWM1_BASE 0x1fe5c010
40#define LS1X_PWM2_BASE 0x1fe5c020
41#define LS1X_PWM3_BASE 0x1fe5c030
42#define LS1X_WDT_BASE 0x1fe5c060
43#define LS1X_RTC_BASE 0x1fe64000
44#define LS1X_AC97_BASE 0x1fe74000
45#define LS1X_NAND_BASE 0x1fe78000
46#define LS1X_CLK_BASE 0x1fe78030
47
48#include <regs-clk.h>
49#include <regs-mux.h>
50#include <regs-pwm.h>
51#include <regs-rtc.h>
52#include <regs-wdt.h>
53
54#endif /* __ASM_MACH_LOONGSON32_LOONGSON1_H */
diff --git a/arch/mips/include/asm/mach-loongson32/nand.h b/arch/mips/include/asm/mach-loongson32/nand.h
new file mode 100644
index 000000000..aaf5ed19d
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/nand.h
@@ -0,0 +1,26 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2015 Zhang, Keguang <keguang.zhang@gmail.com>
4 *
5 * Loongson 1 NAND platform support.
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_NAND_H
9#define __ASM_MACH_LOONGSON32_NAND_H
10
11#include <linux/dmaengine.h>
12#include <linux/mtd/partitions.h>
13
14struct plat_ls1x_nand {
15 struct mtd_partition *parts;
16 unsigned int nr_parts;
17
18 int hold_cycle;
19 int wait_cycle;
20};
21
22extern struct plat_ls1x_nand ls1b_nand_pdata;
23
24bool ls1x_dma_filter_fn(struct dma_chan *chan, void *param);
25
26#endif /* __ASM_MACH_LOONGSON32_NAND_H */
diff --git a/arch/mips/include/asm/mach-loongson32/platform.h b/arch/mips/include/asm/mach-loongson32/platform.h
new file mode 100644
index 000000000..eb83e2741
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/platform.h
@@ -0,0 +1,28 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
4 */
5
6#ifndef __ASM_MACH_LOONGSON32_PLATFORM_H
7#define __ASM_MACH_LOONGSON32_PLATFORM_H
8
9#include <linux/platform_device.h>
10
11#include <dma.h>
12#include <nand.h>
13
14extern struct platform_device ls1x_uart_pdev;
15extern struct platform_device ls1x_cpufreq_pdev;
16extern struct platform_device ls1x_eth0_pdev;
17extern struct platform_device ls1x_eth1_pdev;
18extern struct platform_device ls1x_ehci_pdev;
19extern struct platform_device ls1x_gpio0_pdev;
20extern struct platform_device ls1x_gpio1_pdev;
21extern struct platform_device ls1x_rtc_pdev;
22extern struct platform_device ls1x_wdt_pdev;
23
24void __init ls1x_clk_init(void);
25void __init ls1x_rtc_set_extclk(struct platform_device *pdev);
26void __init ls1x_serial_set_uartclk(struct platform_device *pdev);
27
28#endif /* __ASM_MACH_LOONGSON32_PLATFORM_H */
diff --git a/arch/mips/include/asm/mach-loongson32/regs-clk.h b/arch/mips/include/asm/mach-loongson32/regs-clk.h
new file mode 100644
index 000000000..98136fa8b
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/regs-clk.h
@@ -0,0 +1,81 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
4 *
5 * Loongson 1 Clock Register Definitions.
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_REGS_CLK_H
9#define __ASM_MACH_LOONGSON32_REGS_CLK_H
10
11#define LS1X_CLK_REG(x) \
12 ((void __iomem *)KSEG1ADDR(LS1X_CLK_BASE + (x)))
13
14#define LS1X_CLK_PLL_FREQ LS1X_CLK_REG(0x0)
15#define LS1X_CLK_PLL_DIV LS1X_CLK_REG(0x4)
16
17#if defined(CONFIG_LOONGSON1_LS1B)
18/* Clock PLL Divisor Register Bits */
19#define DIV_DC_EN BIT(31)
20#define DIV_DC_RST BIT(30)
21#define DIV_CPU_EN BIT(25)
22#define DIV_CPU_RST BIT(24)
23#define DIV_DDR_EN BIT(19)
24#define DIV_DDR_RST BIT(18)
25#define RST_DC_EN BIT(5)
26#define RST_DC BIT(4)
27#define RST_DDR_EN BIT(3)
28#define RST_DDR BIT(2)
29#define RST_CPU_EN BIT(1)
30#define RST_CPU BIT(0)
31
32#define DIV_DC_SHIFT 26
33#define DIV_CPU_SHIFT 20
34#define DIV_DDR_SHIFT 14
35
36#define DIV_DC_WIDTH 4
37#define DIV_CPU_WIDTH 4
38#define DIV_DDR_WIDTH 4
39
40#define BYPASS_DC_SHIFT 12
41#define BYPASS_DDR_SHIFT 10
42#define BYPASS_CPU_SHIFT 8
43
44#define BYPASS_DC_WIDTH 1
45#define BYPASS_DDR_WIDTH 1
46#define BYPASS_CPU_WIDTH 1
47
48#elif defined(CONFIG_LOONGSON1_LS1C)
49/* PLL/SDRAM Frequency configuration register Bits */
50#define PLL_VALID BIT(31)
51#define FRAC_N GENMASK(23, 16)
52#define RST_TIME GENMASK(3, 2)
53#define SDRAM_DIV GENMASK(1, 0)
54
55/* CPU/CAMERA/DC Frequency configuration register Bits */
56#define DIV_DC_EN BIT(31)
57#define DIV_DC GENMASK(30, 24)
58#define DIV_CAM_EN BIT(23)
59#define DIV_CAM GENMASK(22, 16)
60#define DIV_CPU_EN BIT(15)
61#define DIV_CPU GENMASK(14, 8)
62#define DIV_DC_SEL_EN BIT(5)
63#define DIV_DC_SEL BIT(4)
64#define DIV_CAM_SEL_EN BIT(3)
65#define DIV_CAM_SEL BIT(2)
66#define DIV_CPU_SEL_EN BIT(1)
67#define DIV_CPU_SEL BIT(0)
68
69#define DIV_DC_SHIFT 24
70#define DIV_CAM_SHIFT 16
71#define DIV_CPU_SHIFT 8
72#define DIV_DDR_SHIFT 0
73
74#define DIV_DC_WIDTH 7
75#define DIV_CAM_WIDTH 7
76#define DIV_CPU_WIDTH 7
77#define DIV_DDR_WIDTH 2
78
79#endif
80
81#endif /* __ASM_MACH_LOONGSON32_REGS_CLK_H */
diff --git a/arch/mips/include/asm/mach-loongson32/regs-mux.h b/arch/mips/include/asm/mach-loongson32/regs-mux.h
new file mode 100644
index 000000000..95788a4f0
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/regs-mux.h
@@ -0,0 +1,124 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com>
4 *
5 * Loongson 1 MUX Register Definitions.
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_REGS_MUX_H
9#define __ASM_MACH_LOONGSON32_REGS_MUX_H
10
11#define LS1X_MUX_REG(x) \
12 ((void __iomem *)KSEG1ADDR(LS1X_MUX_BASE + (x)))
13
14#define LS1X_MUX_CTRL0 LS1X_MUX_REG(0x0)
15#define LS1X_MUX_CTRL1 LS1X_MUX_REG(0x4)
16
17#if defined(CONFIG_LOONGSON1_LS1B)
18/* MUX CTRL0 Register Bits */
19#define UART0_USE_PWM23 BIT(28)
20#define UART0_USE_PWM01 BIT(27)
21#define UART1_USE_LCD0_5_6_11 BIT(26)
22#define I2C2_USE_CAN1 BIT(25)
23#define I2C1_USE_CAN0 BIT(24)
24#define NAND3_USE_UART5 BIT(23)
25#define NAND3_USE_UART4 BIT(22)
26#define NAND3_USE_UART1_DAT BIT(21)
27#define NAND3_USE_UART1_CTS BIT(20)
28#define NAND3_USE_PWM23 BIT(19)
29#define NAND3_USE_PWM01 BIT(18)
30#define NAND2_USE_UART5 BIT(17)
31#define NAND2_USE_UART4 BIT(16)
32#define NAND2_USE_UART1_DAT BIT(15)
33#define NAND2_USE_UART1_CTS BIT(14)
34#define NAND2_USE_PWM23 BIT(13)
35#define NAND2_USE_PWM01 BIT(12)
36#define NAND1_USE_UART5 BIT(11)
37#define NAND1_USE_UART4 BIT(10)
38#define NAND1_USE_UART1_DAT BIT(9)
39#define NAND1_USE_UART1_CTS BIT(8)
40#define NAND1_USE_PWM23 BIT(7)
41#define NAND1_USE_PWM01 BIT(6)
42#define GMAC1_USE_UART1 BIT(4)
43#define GMAC1_USE_UART0 BIT(3)
44#define LCD_USE_UART0_DAT BIT(2)
45#define LCD_USE_UART15 BIT(1)
46#define LCD_USE_UART0 BIT(0)
47
48/* MUX CTRL1 Register Bits */
49#define USB_RESET BIT(31)
50#define SPI1_CS_USE_PWM01 BIT(24)
51#define SPI1_USE_CAN BIT(23)
52#define DISABLE_DDR_CONFSPACE BIT(20)
53#define DDR32TO16EN BIT(16)
54#define GMAC1_SHUT BIT(13)
55#define GMAC0_SHUT BIT(12)
56#define USB_SHUT BIT(11)
57#define UART1_3_USE_CAN1 BIT(5)
58#define UART1_2_USE_CAN0 BIT(4)
59#define GMAC1_USE_TXCLK BIT(3)
60#define GMAC0_USE_TXCLK BIT(2)
61#define GMAC1_USE_PWM23 BIT(1)
62#define GMAC0_USE_PWM01 BIT(0)
63
64#elif defined(CONFIG_LOONGSON1_LS1C)
65
66/* SHUT_CTRL Register Bits */
67#define UART_SPLIT GENMASK(31, 30)
68#define OUTPUT_CLK GENMASK(29, 26)
69#define ADC_SHUT BIT(25)
70#define SDIO_SHUT BIT(24)
71#define DMA2_SHUT BIT(23)
72#define DMA1_SHUT BIT(22)
73#define DMA0_SHUT BIT(21)
74#define SPI1_SHUT BIT(20)
75#define SPI0_SHUT BIT(19)
76#define I2C2_SHUT BIT(18)
77#define I2C1_SHUT BIT(17)
78#define I2C0_SHUT BIT(16)
79#define AC97_SHUT BIT(15)
80#define I2S_SHUT BIT(14)
81#define UART3_SHUT BIT(13)
82#define UART2_SHUT BIT(12)
83#define UART1_SHUT BIT(11)
84#define UART0_SHUT BIT(10)
85#define CAN1_SHUT BIT(9)
86#define CAN0_SHUT BIT(8)
87#define ECC_SHUT BIT(7)
88#define GMAC_SHUT BIT(6)
89#define USBHOST_SHUT BIT(5)
90#define USBOTG_SHUT BIT(4)
91#define SDRAM_SHUT BIT(3)
92#define SRAM_SHUT BIT(2)
93#define CAM_SHUT BIT(1)
94#define LCD_SHUT BIT(0)
95
96#define UART_SPLIT_SHIFT 30
97#define OUTPUT_CLK_SHIFT 26
98
99/* MISC_CTRL Register Bits */
100#define USBHOST_RSTN BIT(31)
101#define PHY_INTF_SELI GENMASK(30, 28)
102#define AC97_EN BIT(25)
103#define SDIO_DMA_EN GENMASK(24, 23)
104#define ADC_DMA_EN BIT(22)
105#define SDIO_USE_SPI1 BIT(17)
106#define SDIO_USE_SPI0 BIT(16)
107#define SRAM_CTRL GENMASK(15, 0)
108
109#define PHY_INTF_SELI_SHIFT 28
110#define SDIO_DMA_EN_SHIFT 23
111#define SRAM_CTRL_SHIFT 0
112
113#define LS1X_CBUS_REG(n, x) \
114 ((void __iomem *)KSEG1ADDR(LS1X_CBUS_BASE + (n * 0x04) + (x)))
115
116#define LS1X_CBUS_FIRST(n) LS1X_CBUS_REG(n, 0x00)
117#define LS1X_CBUS_SECOND(n) LS1X_CBUS_REG(n, 0x10)
118#define LS1X_CBUS_THIRD(n) LS1X_CBUS_REG(n, 0x20)
119#define LS1X_CBUS_FOURTHT(n) LS1X_CBUS_REG(n, 0x30)
120#define LS1X_CBUS_FIFTHT(n) LS1X_CBUS_REG(n, 0x40)
121
122#endif
123
124#endif /* __ASM_MACH_LOONGSON32_REGS_MUX_H */
diff --git a/arch/mips/include/asm/mach-loongson32/regs-pwm.h b/arch/mips/include/asm/mach-loongson32/regs-pwm.h
new file mode 100644
index 000000000..ec870c82d
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/regs-pwm.h
@@ -0,0 +1,25 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com>
4 *
5 * Loongson 1 PWM Register Definitions.
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_REGS_PWM_H
9#define __ASM_MACH_LOONGSON32_REGS_PWM_H
10
11/* Loongson 1 PWM Timer Register Definitions */
12#define PWM_CNT 0x0
13#define PWM_HRC 0x4
14#define PWM_LRC 0x8
15#define PWM_CTRL 0xc
16
17/* PWM Control Register Bits */
18#define CNT_RST BIT(7)
19#define INT_SR BIT(6)
20#define INT_EN BIT(5)
21#define PWM_SINGLE BIT(4)
22#define PWM_OE BIT(3)
23#define CNT_EN BIT(0)
24
25#endif /* __ASM_MACH_LOONGSON32_REGS_PWM_H */
diff --git a/arch/mips/include/asm/mach-loongson32/regs-rtc.h b/arch/mips/include/asm/mach-loongson32/regs-rtc.h
new file mode 100644
index 000000000..a3d096be1
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/regs-rtc.h
@@ -0,0 +1,19 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2016 Yang Ling <gnaygnil@gmail.com>
4 *
5 * Loongson 1 RTC timer Register Definitions.
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_REGS_RTC_H
9#define __ASM_MACH_LOONGSON32_REGS_RTC_H
10
11#define LS1X_RTC_REG(x) \
12 ((void __iomem *)KSEG1ADDR(LS1X_RTC_BASE + (x)))
13
14#define LS1X_RTC_CTRL LS1X_RTC_REG(0x40)
15
16#define RTC_EXTCLK_OK (BIT(5) | BIT(8))
17#define RTC_EXTCLK_EN BIT(8)
18
19#endif /* __ASM_MACH_LOONGSON32_REGS_RTC_H */
diff --git a/arch/mips/include/asm/mach-loongson32/regs-wdt.h b/arch/mips/include/asm/mach-loongson32/regs-wdt.h
new file mode 100644
index 000000000..c6d345fe1
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson32/regs-wdt.h
@@ -0,0 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
4 *
5 * Loongson 1 Watchdog Register Definitions.
6 */
7
8#ifndef __ASM_MACH_LOONGSON32_REGS_WDT_H
9#define __ASM_MACH_LOONGSON32_REGS_WDT_H
10
11#define WDT_EN 0x0
12#define WDT_TIMER 0x4
13#define WDT_SET 0x8
14
15#endif /* __ASM_MACH_LOONGSON32_REGS_WDT_H */
diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
new file mode 100644
index 000000000..afc92b7a6
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
@@ -0,0 +1,236 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
3#define __ASM_MACH_LOONGSON64_BOOT_PARAM_H_
4
5#include <linux/types.h>
6
7#define SYSTEM_RAM_LOW 1
8#define SYSTEM_RAM_HIGH 2
9#define SYSTEM_RAM_RESERVED 3
10#define PCI_IO 4
11#define PCI_MEM 5
12#define LOONGSON_CFG_REG 6
13#define VIDEO_ROM 7
14#define ADAPTER_ROM 8
15#define ACPI_TABLE 9
16#define SMBIOS_TABLE 10
17#define MAX_MEMORY_TYPE 11
18
19#define LOONGSON3_BOOT_MEM_MAP_MAX 128
20struct efi_memory_map_loongson {
21 u16 vers; /* version of efi_memory_map */
22 u32 nr_map; /* number of memory_maps */
23 u32 mem_freq; /* memory frequence */
24 struct mem_map {
25 u32 node_id; /* node_id which memory attached to */
26 u32 mem_type; /* system memory, pci memory, pci io, etc. */
27 u64 mem_start; /* memory map start address */
28 u32 mem_size; /* each memory_map size, not the total size */
29 } map[LOONGSON3_BOOT_MEM_MAP_MAX];
30} __packed;
31
32enum loongson_cpu_type {
33 Legacy_2E = 0x0,
34 Legacy_2F = 0x1,
35 Legacy_3A = 0x2,
36 Legacy_3B = 0x3,
37 Legacy_1A = 0x4,
38 Legacy_1B = 0x5,
39 Legacy_2G = 0x6,
40 Legacy_2H = 0x7,
41 Loongson_1A = 0x100,
42 Loongson_1B = 0x101,
43 Loongson_2E = 0x200,
44 Loongson_2F = 0x201,
45 Loongson_2G = 0x202,
46 Loongson_2H = 0x203,
47 Loongson_3A = 0x300,
48 Loongson_3B = 0x301
49};
50
51/*
52 * Capability and feature descriptor structure for MIPS CPU
53 */
54struct efi_cpuinfo_loongson {
55 u16 vers; /* version of efi_cpuinfo_loongson */
56 u32 processor_id; /* PRID, e.g. 6305, 6306 */
57 u32 cputype; /* Loongson_3A/3B, etc. */
58 u32 total_node; /* num of total numa nodes */
59 u16 cpu_startup_core_id; /* Boot core id */
60 u16 reserved_cores_mask;
61 u32 cpu_clock_freq; /* cpu_clock */
62 u32 nr_cpus;
63} __packed;
64
65#define MAX_UARTS 64
66struct uart_device {
67 u32 iotype; /* see include/linux/serial_core.h */
68 u32 uartclk;
69 u32 int_offset;
70 u64 uart_base;
71} __packed;
72
73#define MAX_SENSORS 64
74#define SENSOR_TEMPER 0x00000001
75#define SENSOR_VOLTAGE 0x00000002
76#define SENSOR_FAN 0x00000004
77struct sensor_device {
78 char name[32]; /* a formal name */
79 char label[64]; /* a flexible description */
80 u32 type; /* SENSOR_* */
81 u32 id; /* instance id of a sensor-class */
82 u32 fan_policy; /* see loongson_hwmon.h */
83 u32 fan_percent;/* only for constant speed policy */
84 u64 base_addr; /* base address of device registers */
85} __packed;
86
87struct system_loongson {
88 u16 vers; /* version of system_loongson */
89 u32 ccnuma_smp; /* 0: no numa; 1: has numa */
90 u32 sing_double_channel; /* 1:single; 2:double */
91 u32 nr_uarts;
92 struct uart_device uarts[MAX_UARTS];
93 u32 nr_sensors;
94 struct sensor_device sensors[MAX_SENSORS];
95 char has_ec;
96 char ec_name[32];
97 u64 ec_base_addr;
98 char has_tcm;
99 char tcm_name[32];
100 u64 tcm_base_addr;
101 u64 workarounds; /* see workarounds.h */
102} __packed;
103
104struct irq_source_routing_table {
105 u16 vers;
106 u16 size;
107 u16 rtr_bus;
108 u16 rtr_devfn;
109 u32 vendor;
110 u32 device;
111 u32 PIC_type; /* conform use HT or PCI to route to CPU-PIC */
112 u64 ht_int_bit; /* 3A: 1<<24; 3B: 1<<16 */
113 u64 ht_enable; /* irqs used in this PIC */
114 u32 node_id; /* node id: 0x0-0; 0x1-1; 0x10-2; 0x11-3 */
115 u64 pci_mem_start_addr;
116 u64 pci_mem_end_addr;
117 u64 pci_io_start_addr;
118 u64 pci_io_end_addr;
119 u64 pci_config_addr;
120 u32 dma_mask_bits;
121} __packed;
122
123struct interface_info {
124 u16 vers; /* version of the specificition */
125 u16 size;
126 u8 flag;
127 char description[64];
128} __packed;
129
130#define MAX_RESOURCE_NUMBER 128
131struct resource_loongson {
132 u64 start; /* resource start address */
133 u64 end; /* resource end address */
134 char name[64];
135 u32 flags;
136};
137
138struct archdev_data {}; /* arch specific additions */
139
140struct board_devices {
141 char name[64]; /* hold the device name */
142 u32 num_resources; /* number of device_resource */
143 /* for each device's resource */
144 struct resource_loongson resource[MAX_RESOURCE_NUMBER];
145 /* arch specific additions */
146 struct archdev_data archdata;
147};
148
149struct loongson_special_attribute {
150 u16 vers; /* version of this special */
151 char special_name[64]; /* special_atribute_name */
152 u32 loongson_special_type; /* type of special device */
153 /* for each device's resource */
154 struct resource_loongson resource[MAX_RESOURCE_NUMBER];
155};
156
157struct loongson_params {
158 u64 memory_offset; /* efi_memory_map_loongson struct offset */
159 u64 cpu_offset; /* efi_cpuinfo_loongson struct offset */
160 u64 system_offset; /* system_loongson struct offset */
161 u64 irq_offset; /* irq_source_routing_table struct offset */
162 u64 interface_offset; /* interface_info struct offset */
163 u64 special_offset; /* loongson_special_attribute struct offset */
164 u64 boarddev_table_offset; /* board_devices offset */
165};
166
167struct smbios_tables {
168 u16 vers; /* version of smbios */
169 u64 vga_bios; /* vga_bios address */
170 struct loongson_params lp;
171};
172
173struct efi_reset_system_t {
174 u64 ResetCold;
175 u64 ResetWarm;
176 u64 ResetType;
177 u64 Shutdown;
178 u64 DoSuspend; /* NULL if not support */
179};
180
181struct efi_loongson {
182 u64 mps; /* MPS table */
183 u64 acpi; /* ACPI table (IA64 ext 0.71) */
184 u64 acpi20; /* ACPI table (ACPI 2.0) */
185 struct smbios_tables smbios; /* SM BIOS table */
186 u64 sal_systab; /* SAL system table */
187 u64 boot_info; /* boot info table */
188};
189
190struct boot_params {
191 struct efi_loongson efi;
192 struct efi_reset_system_t reset_system;
193};
194
195enum loongson_bridge_type {
196 LS7A = 1,
197 RS780E = 2,
198 VIRTUAL = 3
199};
200
201struct loongson_system_configuration {
202 u32 nr_cpus;
203 u32 nr_nodes;
204 int cores_per_node;
205 int cores_per_package;
206 u16 boot_cpu_id;
207 u16 reserved_cpus_mask;
208 enum loongson_cpu_type cputype;
209 enum loongson_bridge_type bridgetype;
210 u64 ht_control_base;
211 u64 pci_mem_start_addr;
212 u64 pci_mem_end_addr;
213 u64 pci_io_base;
214 u64 restart_addr;
215 u64 poweroff_addr;
216 u64 suspend_addr;
217 u64 vgabios_addr;
218 u32 dma_mask_bits;
219 char ecname[32];
220 u32 nr_uarts;
221 struct uart_device uarts[MAX_UARTS];
222 u32 nr_sensors;
223 struct sensor_device sensors[MAX_SENSORS];
224 u64 workarounds;
225 void (*early_config)(void);
226};
227
228extern struct efi_memory_map_loongson *loongson_memmap;
229extern struct loongson_system_configuration loongson_sysconf;
230
231extern u32 node_id_offset;
232extern void ls7a_early_config(void);
233extern void rs780e_early_config(void);
234extern void virtual_early_config(void);
235
236#endif
diff --git a/arch/mips/include/asm/mach-loongson64/builtin_dtbs.h b/arch/mips/include/asm/mach-loongson64/builtin_dtbs.h
new file mode 100644
index 000000000..839410cda
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/builtin_dtbs.h
@@ -0,0 +1,16 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2019 Jiaxun Yang <jiaxun.yang@flygoat.com>
4 *
5 * Built-in Generic dtbs for MACH_LOONGSON64
6 */
7
8#ifndef __ASM_MACH_LOONGSON64_BUILTIN_DTBS_H_
9#define __ASM_MACH_LOONGSON64_BUILTIN_DTBS_H_
10
11extern u32 __dtb_loongson64c_4core_ls7a_begin[];
12extern u32 __dtb_loongson64c_4core_rs780e_begin[];
13extern u32 __dtb_loongson64c_8core_rs780e_begin[];
14extern u32 __dtb_loongson64g_4core_ls7a_begin[];
15extern u32 __dtb_loongson64v_4core_virtio_begin[];
16#endif
diff --git a/arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h
new file mode 100644
index 000000000..eb181224e
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.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) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
7 * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
8 * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
9 *
10 * reference: /proc/cpuinfo,
11 * arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12 * arch/mips/kernel/proc.c(show_cpuinfo),
13 * loongson2f user manual.
14 */
15
16#ifndef __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H
17#define __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H
18
19#define cpu_has_32fpr 1
20#define cpu_has_3k_cache 0
21#define cpu_has_4k_cache 1
22#define cpu_has_4kex 1
23#define cpu_has_64bits 1
24#define cpu_has_cache_cdex_p 0
25#define cpu_has_cache_cdex_s 0
26#define cpu_has_counter 1
27#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
28#define cpu_has_divec 0
29#define cpu_has_inclusive_pcaches 1
30#define cpu_has_llsc 1
31#define cpu_has_mcheck 0
32#define cpu_has_mdmx 0
33#define cpu_has_mips16 0
34#define cpu_has_mips16e2 0
35#define cpu_has_mips3d 0
36#define cpu_has_mipsmt 0
37#define cpu_has_smartmips 0
38#define cpu_has_tlb 1
39#define cpu_has_tx39_cache 0
40#define cpu_has_vce 0
41#define cpu_has_veic 0
42#define cpu_has_vint 0
43#define cpu_has_vtag_icache 0
44#define cpu_has_wsbh 1
45#define cpu_has_ic_fills_f_dc 1
46#define cpu_hwrena_impl_bits 0xc0000000
47#define cpu_has_mac2008_only 1
48#define cpu_has_mips_r2_exec_hazard 0
49#define cpu_has_perf_cntr_intr_bit 0
50
51#endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-loongson64/cpucfg-emul.h b/arch/mips/include/asm/mach-loongson64/cpucfg-emul.h
new file mode 100644
index 000000000..d64af19c2
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/cpucfg-emul.h
@@ -0,0 +1,74 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_MACH_LOONGSON64_CPUCFG_EMUL_H_
3#define _ASM_MACH_LOONGSON64_CPUCFG_EMUL_H_
4
5#include <asm/cpu-info.h>
6
7#ifdef CONFIG_CPU_LOONGSON3_CPUCFG_EMULATION
8
9#include <loongson_regs.h>
10
11#define LOONGSON_FPREV_MASK 0x7
12
13void loongson3_cpucfg_synthesize_data(struct cpuinfo_mips *c);
14
15static inline bool loongson3_cpucfg_emulation_enabled(struct cpuinfo_mips *c)
16{
17 /* All supported cores have non-zero LOONGSON_CFG1 data. */
18 return c->loongson3_cpucfg_data[0] != 0;
19}
20
21static inline u32 loongson3_cpucfg_read_synthesized(struct cpuinfo_mips *c,
22 __u64 sel)
23{
24 switch (sel) {
25 case LOONGSON_CFG0:
26 return c->processor_id;
27 case LOONGSON_CFG1:
28 case LOONGSON_CFG2:
29 case LOONGSON_CFG3:
30 return c->loongson3_cpucfg_data[sel - 1];
31 case LOONGSON_CFG4:
32 case LOONGSON_CFG5:
33 /* CPUCFG selects 4 and 5 are related to the input clock
34 * signal.
35 *
36 * Unimplemented for now.
37 */
38 return 0;
39 case LOONGSON_CFG6:
40 /* CPUCFG select 6 is for the undocumented Safe Extension. */
41 return 0;
42 case LOONGSON_CFG7:
43 /* CPUCFG select 7 is for the virtualization extension.
44 * We don't know if the two currently known features are
45 * supported on older cores according to the public
46 * documentation, so leave this at zero.
47 */
48 return 0;
49 }
50
51 /*
52 * Return 0 for unrecognized CPUCFG selects, which is real hardware
53 * behavior observed on Loongson 3A R4.
54 */
55 return 0;
56}
57#else
58static inline void loongson3_cpucfg_synthesize_data(struct cpuinfo_mips *c)
59{
60}
61
62static inline bool loongson3_cpucfg_emulation_enabled(struct cpuinfo_mips *c)
63{
64 return false;
65}
66
67static inline u32 loongson3_cpucfg_read_synthesized(struct cpuinfo_mips *c,
68 __u64 sel)
69{
70 return 0;
71}
72#endif
73
74#endif /* _ASM_MACH_LOONGSON64_CPUCFG_EMUL_H_ */
diff --git a/arch/mips/include/asm/mach-loongson64/irq.h b/arch/mips/include/asm/mach-loongson64/irq.h
new file mode 100644
index 000000000..98ea977cf
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/irq.h
@@ -0,0 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_LOONGSON64_IRQ_H_
3#define __ASM_MACH_LOONGSON64_IRQ_H_
4
5/* cpu core interrupt numbers */
6#define NR_IRQS_LEGACY 16
7#define NR_MIPS_CPU_IRQS 8
8#define NR_MAX_CHAINED_IRQS 40 /* Chained IRQs means those not directly used by devices */
9#define NR_IRQS (NR_IRQS_LEGACY + NR_MIPS_CPU_IRQS + NR_MAX_CHAINED_IRQS + 256)
10
11#define MIPS_CPU_IRQ_BASE NR_IRQS_LEGACY
12
13#include <asm/mach-generic/irq.h>
14
15#endif /* __ASM_MACH_LOONGSON64_IRQ_H_ */
diff --git a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
new file mode 100644
index 000000000..28572ddfb
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.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 * Copyright (C) 2005 Embedded Alley Solutions, Inc
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 2009 Jiajie Chen (chenjiajie@cse.buaa.edu.cn)
9 * Copyright (C) 2012 Huacai Chen (chenhc@lemote.com)
10 */
11#ifndef __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
12#define __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
13
14#include <asm/cpu.h>
15
16/*
17 * Override macros used in arch/mips/kernel/head.S.
18 */
19 .macro kernel_entry_setup
20 .set push
21 .set mips64
22 /* Set LPA on LOONGSON3 config3 */
23 mfc0 t0, CP0_CONFIG3
24 or t0, (0x1 << 7)
25 mtc0 t0, CP0_CONFIG3
26 /* Set ELPA on LOONGSON3 pagegrain */
27 mfc0 t0, CP0_PAGEGRAIN
28 or t0, (0x1 << 29)
29 mtc0 t0, CP0_PAGEGRAIN
30 /* Enable STFill Buffer */
31 mfc0 t0, CP0_PRID
32 /* Loongson-3A R4+ */
33 andi t1, t0, PRID_IMP_MASK
34 li t2, PRID_IMP_LOONGSON_64G
35 beq t1, t2, 1f
36 nop
37 /* Loongson-3A R2/R3 */
38 andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
39 slti t0, t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0)
40 bnez t0, 2f
41 nop
421:
43 mfc0 t0, CP0_CONFIG6
44 or t0, 0x100
45 mtc0 t0, CP0_CONFIG6
462:
47 _ehb
48 .set pop
49 .endm
50
51/*
52 * Do SMP slave processor setup.
53 */
54 .macro smp_slave_setup
55 .set push
56 .set mips64
57 /* Set LPA on LOONGSON3 config3 */
58 mfc0 t0, CP0_CONFIG3
59 or t0, (0x1 << 7)
60 mtc0 t0, CP0_CONFIG3
61 /* Set ELPA on LOONGSON3 pagegrain */
62 mfc0 t0, CP0_PAGEGRAIN
63 or t0, (0x1 << 29)
64 mtc0 t0, CP0_PAGEGRAIN
65 /* Enable STFill Buffer */
66 mfc0 t0, CP0_PRID
67 /* Loongson-3A R4+ */
68 andi t1, t0, PRID_IMP_MASK
69 li t2, PRID_IMP_LOONGSON_64G
70 beq t1, t2, 1f
71 nop
72 /* Loongson-3A R2/R3 */
73 andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
74 slti t0, t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0)
75 bnez t0, 2f
76 nop
771:
78 mfc0 t0, CP0_CONFIG6
79 or t0, 0x100
80 mtc0 t0, CP0_CONFIG6
812:
82 _ehb
83 .set pop
84 .endm
85
86#endif /* __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H */
diff --git a/arch/mips/include/asm/mach-loongson64/loongson.h b/arch/mips/include/asm/mach-loongson64/loongson.h
new file mode 100644
index 000000000..fde1b75c4
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/loongson.h
@@ -0,0 +1,241 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2009 Lemote, Inc.
4 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
5 */
6
7#ifndef __ASM_MACH_LOONGSON64_LOONGSON_H
8#define __ASM_MACH_LOONGSON64_LOONGSON_H
9
10#include <linux/io.h>
11#include <linux/init.h>
12#include <linux/irq.h>
13#include <boot_param.h>
14
15
16/* machine-specific reboot/halt operation */
17extern void mach_prepare_reboot(void);
18extern void mach_prepare_shutdown(void);
19
20/* environment arguments from bootloader */
21extern u32 cpu_clock_freq;
22extern u32 memsize, highmemsize;
23extern const struct plat_smp_ops loongson3_smp_ops;
24
25/* loongson-specific command line, env and memory initialization */
26extern void __init prom_init_memory(void);
27extern void __init prom_init_env(void);
28extern void *loongson_fdt_blob;
29
30/* irq operation functions */
31extern void mach_irq_dispatch(unsigned int pending);
32extern int mach_i8259_irq(void);
33
34/* We need this in some places... */
35#define delay() ({ \
36 int x; \
37 for (x = 0; x < 100000; x++) \
38 __asm__ __volatile__(""); \
39})
40
41#define LOONGSON_REG(x) \
42 (*(volatile u32 *)((char *)CKSEG1ADDR(LOONGSON_REG_BASE) + (x)))
43
44#define LOONGSON3_REG8(base, x) \
45 (*(volatile u8 *)((char *)TO_UNCAC(base) + (x)))
46
47#define LOONGSON3_REG32(base, x) \
48 (*(volatile u32 *)((char *)TO_UNCAC(base) + (x)))
49
50#define LOONGSON_FLASH_BASE 0x1c000000
51#define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */
52#define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1)
53
54#define LOONGSON_LIO0_BASE 0x1e000000
55#define LOONGSON_LIO0_SIZE 0x01C00000 /* 28M */
56#define LOONGSON_LIO0_TOP (LOONGSON_LIO0_BASE+LOONGSON_LIO0_SIZE-1)
57
58#define LOONGSON_BOOT_BASE 0x1fc00000
59#define LOONGSON_BOOT_SIZE 0x00100000 /* 1M */
60#define LOONGSON_BOOT_TOP (LOONGSON_BOOT_BASE+LOONGSON_BOOT_SIZE-1)
61#define LOONGSON_REG_BASE 0x1fe00000
62#define LOONGSON_REG_SIZE 0x00100000 /* 256Bytes + 256Bytes + ??? */
63#define LOONGSON_REG_TOP (LOONGSON_REG_BASE+LOONGSON_REG_SIZE-1)
64/* Loongson-3 specific registers */
65#define LOONGSON3_REG_BASE 0x3ff00000
66#define LOONGSON3_REG_SIZE 0x00100000 /* 256Bytes + 256Bytes + ??? */
67#define LOONGSON3_REG_TOP (LOONGSON3_REG_BASE+LOONGSON3_REG_SIZE-1)
68
69#define LOONGSON_LIO1_BASE 0x1ff00000
70#define LOONGSON_LIO1_SIZE 0x00100000 /* 1M */
71#define LOONGSON_LIO1_TOP (LOONGSON_LIO1_BASE+LOONGSON_LIO1_SIZE-1)
72
73#define LOONGSON_PCILO0_BASE 0x10000000
74#define LOONGSON_PCILO1_BASE 0x14000000
75#define LOONGSON_PCILO2_BASE 0x18000000
76#define LOONGSON_PCILO_BASE LOONGSON_PCILO0_BASE
77#define LOONGSON_PCILO_SIZE 0x0c000000 /* 64M * 3 */
78#define LOONGSON_PCILO_TOP (LOONGSON_PCILO0_BASE+LOONGSON_PCILO_SIZE-1)
79
80#define LOONGSON_PCICFG_BASE 0x1fe80000
81#define LOONGSON_PCICFG_SIZE 0x00000800 /* 2K */
82#define LOONGSON_PCICFG_TOP (LOONGSON_PCICFG_BASE+LOONGSON_PCICFG_SIZE-1)
83
84#define LOONGSON_PCIIO_BASE loongson_sysconf.pci_io_base
85
86#define LOONGSON_PCIIO_SIZE 0x00100000 /* 1M */
87#define LOONGSON_PCIIO_TOP (LOONGSON_PCIIO_BASE+LOONGSON_PCIIO_SIZE-1)
88
89/* Loongson Register Bases */
90
91#define LOONGSON_PCICONFIGBASE 0x00
92#define LOONGSON_REGBASE 0x100
93
94/* PCI Configuration Registers */
95
96#define LOONGSON_PCI_REG(x) LOONGSON_REG(LOONGSON_PCICONFIGBASE + (x))
97#define LOONGSON_PCIDID LOONGSON_PCI_REG(0x00)
98#define LOONGSON_PCICMD LOONGSON_PCI_REG(0x04)
99#define LOONGSON_PCICLASS LOONGSON_PCI_REG(0x08)
100#define LOONGSON_PCILTIMER LOONGSON_PCI_REG(0x0c)
101#define LOONGSON_PCIBASE0 LOONGSON_PCI_REG(0x10)
102#define LOONGSON_PCIBASE1 LOONGSON_PCI_REG(0x14)
103#define LOONGSON_PCIBASE2 LOONGSON_PCI_REG(0x18)
104#define LOONGSON_PCIBASE3 LOONGSON_PCI_REG(0x1c)
105#define LOONGSON_PCIBASE4 LOONGSON_PCI_REG(0x20)
106#define LOONGSON_PCIEXPRBASE LOONGSON_PCI_REG(0x30)
107#define LOONGSON_PCIINT LOONGSON_PCI_REG(0x3c)
108
109#define LOONGSON_PCI_ISR4C LOONGSON_PCI_REG(0x4c)
110
111#define LOONGSON_PCICMD_PERR_CLR 0x80000000
112#define LOONGSON_PCICMD_SERR_CLR 0x40000000
113#define LOONGSON_PCICMD_MABORT_CLR 0x20000000
114#define LOONGSON_PCICMD_MTABORT_CLR 0x10000000
115#define LOONGSON_PCICMD_TABORT_CLR 0x08000000
116#define LOONGSON_PCICMD_MPERR_CLR 0x01000000
117#define LOONGSON_PCICMD_PERRRESPEN 0x00000040
118#define LOONGSON_PCICMD_ASTEPEN 0x00000080
119#define LOONGSON_PCICMD_SERREN 0x00000100
120#define LOONGSON_PCILTIMER_BUSLATENCY 0x0000ff00
121#define LOONGSON_PCILTIMER_BUSLATENCY_SHIFT 8
122
123/* Loongson h/w Configuration */
124
125#define LOONGSON_GENCFG_OFFSET 0x4
126#define LOONGSON_GENCFG LOONGSON_REG(LOONGSON_REGBASE + LOONGSON_GENCFG_OFFSET)
127
128#define LOONGSON_GENCFG_DEBUGMODE 0x00000001
129#define LOONGSON_GENCFG_SNOOPEN 0x00000002
130#define LOONGSON_GENCFG_CPUSELFRESET 0x00000004
131
132#define LOONGSON_GENCFG_FORCE_IRQA 0x00000008
133#define LOONGSON_GENCFG_IRQA_ISOUT 0x00000010
134#define LOONGSON_GENCFG_IRQA_FROM_INT1 0x00000020
135#define LOONGSON_GENCFG_BYTESWAP 0x00000040
136
137#define LOONGSON_GENCFG_UNCACHED 0x00000080
138#define LOONGSON_GENCFG_PREFETCHEN 0x00000100
139#define LOONGSON_GENCFG_WBEHINDEN 0x00000200
140#define LOONGSON_GENCFG_CACHEALG 0x00000c00
141#define LOONGSON_GENCFG_CACHEALG_SHIFT 10
142#define LOONGSON_GENCFG_PCIQUEUE 0x00001000
143#define LOONGSON_GENCFG_CACHESTOP 0x00002000
144#define LOONGSON_GENCFG_MSTRBYTESWAP 0x00004000
145#define LOONGSON_GENCFG_BUSERREN 0x00008000
146#define LOONGSON_GENCFG_NORETRYTIMEOUT 0x00010000
147#define LOONGSON_GENCFG_SHORTCOPYTIMEOUT 0x00020000
148
149/* PCI address map control */
150
151#define LOONGSON_PCIMAP LOONGSON_REG(LOONGSON_REGBASE + 0x10)
152#define LOONGSON_PCIMEMBASECFG LOONGSON_REG(LOONGSON_REGBASE + 0x14)
153#define LOONGSON_PCIMAP_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x18)
154
155/* GPIO Regs - r/w */
156
157#define LOONGSON_GPIODATA LOONGSON_REG(LOONGSON_REGBASE + 0x1c)
158#define LOONGSON_GPIOIE LOONGSON_REG(LOONGSON_REGBASE + 0x20)
159
160/* ICU Configuration Regs - r/w */
161
162#define LOONGSON_INTEDGE LOONGSON_REG(LOONGSON_REGBASE + 0x24)
163#define LOONGSON_INTSTEER LOONGSON_REG(LOONGSON_REGBASE + 0x28)
164#define LOONGSON_INTPOL LOONGSON_REG(LOONGSON_REGBASE + 0x2c)
165
166/* ICU Enable Regs - IntEn & IntISR are r/o. */
167
168#define LOONGSON_INTENSET LOONGSON_REG(LOONGSON_REGBASE + 0x30)
169#define LOONGSON_INTENCLR LOONGSON_REG(LOONGSON_REGBASE + 0x34)
170#define LOONGSON_INTEN LOONGSON_REG(LOONGSON_REGBASE + 0x38)
171#define LOONGSON_INTISR LOONGSON_REG(LOONGSON_REGBASE + 0x3c)
172
173/* ICU */
174#define LOONGSON_ICU_MBOXES 0x0000000f
175#define LOONGSON_ICU_MBOXES_SHIFT 0
176#define LOONGSON_ICU_DMARDY 0x00000010
177#define LOONGSON_ICU_DMAEMPTY 0x00000020
178#define LOONGSON_ICU_COPYRDY 0x00000040
179#define LOONGSON_ICU_COPYEMPTY 0x00000080
180#define LOONGSON_ICU_COPYERR 0x00000100
181#define LOONGSON_ICU_PCIIRQ 0x00000200
182#define LOONGSON_ICU_MASTERERR 0x00000400
183#define LOONGSON_ICU_SYSTEMERR 0x00000800
184#define LOONGSON_ICU_DRAMPERR 0x00001000
185#define LOONGSON_ICU_RETRYERR 0x00002000
186#define LOONGSON_ICU_GPIOS 0x01ff0000
187#define LOONGSON_ICU_GPIOS_SHIFT 16
188#define LOONGSON_ICU_GPINS 0x7e000000
189#define LOONGSON_ICU_GPINS_SHIFT 25
190#define LOONGSON_ICU_MBOX(N) (1<<(LOONGSON_ICU_MBOXES_SHIFT+(N)))
191#define LOONGSON_ICU_GPIO(N) (1<<(LOONGSON_ICU_GPIOS_SHIFT+(N)))
192#define LOONGSON_ICU_GPIN(N) (1<<(LOONGSON_ICU_GPINS_SHIFT+(N)))
193
194/* PCI prefetch window base & mask */
195
196#define LOONGSON_MEM_WIN_BASE_L LOONGSON_REG(LOONGSON_REGBASE + 0x40)
197#define LOONGSON_MEM_WIN_BASE_H LOONGSON_REG(LOONGSON_REGBASE + 0x44)
198#define LOONGSON_MEM_WIN_MASK_L LOONGSON_REG(LOONGSON_REGBASE + 0x48)
199#define LOONGSON_MEM_WIN_MASK_H LOONGSON_REG(LOONGSON_REGBASE + 0x4c)
200
201/* PCI_Hit*_Sel_* */
202
203#define LOONGSON_PCI_HIT0_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x50)
204#define LOONGSON_PCI_HIT0_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x54)
205#define LOONGSON_PCI_HIT1_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x58)
206#define LOONGSON_PCI_HIT1_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x5c)
207#define LOONGSON_PCI_HIT2_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x60)
208#define LOONGSON_PCI_HIT2_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x64)
209
210/* PXArb Config & Status */
211
212#define LOONGSON_PXARB_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x68)
213#define LOONGSON_PXARB_STATUS LOONGSON_REG(LOONGSON_REGBASE + 0x6c)
214
215#define MAX_PACKAGES 4
216
217/* Chip Config registor of each physical cpu package, PRid >= Loongson-2F */
218extern u64 loongson_chipcfg[MAX_PACKAGES];
219#define LOONGSON_CHIPCFG(id) (*(volatile u32 *)(loongson_chipcfg[id]))
220
221/* Chip Temperature registor of each physical cpu package, PRid >= Loongson-3A */
222extern u64 loongson_chiptemp[MAX_PACKAGES];
223#define LOONGSON_CHIPTEMP(id) (*(volatile u32 *)(loongson_chiptemp[id]))
224
225/* Freq Control register of each physical cpu package, PRid >= Loongson-3B */
226extern u64 loongson_freqctrl[MAX_PACKAGES];
227#define LOONGSON_FREQCTRL(id) (*(volatile u32 *)(loongson_freqctrl[id]))
228
229/* pcimap */
230
231#define LOONGSON_PCIMAP_PCIMAP_LO0 0x0000003f
232#define LOONGSON_PCIMAP_PCIMAP_LO0_SHIFT 0
233#define LOONGSON_PCIMAP_PCIMAP_LO1 0x00000fc0
234#define LOONGSON_PCIMAP_PCIMAP_LO1_SHIFT 6
235#define LOONGSON_PCIMAP_PCIMAP_LO2 0x0003f000
236#define LOONGSON_PCIMAP_PCIMAP_LO2_SHIFT 12
237#define LOONGSON_PCIMAP_PCIMAP_2 0x00040000
238#define LOONGSON_PCIMAP_WIN(WIN, ADDR) \
239 ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
240
241#endif /* __ASM_MACH_LOONGSON64_LOONGSON_H */
diff --git a/arch/mips/include/asm/mach-loongson64/loongson_hwmon.h b/arch/mips/include/asm/mach-loongson64/loongson_hwmon.h
new file mode 100644
index 000000000..545f91f2a
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/loongson_hwmon.h
@@ -0,0 +1,56 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LOONGSON_HWMON_H_
3#define __LOONGSON_HWMON_H_
4
5#include <linux/types.h>
6
7#define MIN_TEMP 0
8#define MAX_TEMP 255
9#define NOT_VALID_TEMP 999
10
11typedef int (*get_temp_fun)(int);
12extern int loongson3_cpu_temp(int);
13
14/* 0:Max speed, 1:Manual, 2:Auto */
15enum fan_control_mode {
16 FAN_FULL_MODE = 0,
17 FAN_MANUAL_MODE = 1,
18 FAN_AUTO_MODE = 2,
19 FAN_MODE_END
20};
21
22struct temp_range {
23 u8 low;
24 u8 high;
25 u8 level;
26};
27
28#define CONSTANT_SPEED_POLICY 0 /* at constant speed */
29#define STEP_SPEED_POLICY 1 /* use up/down arrays to describe policy */
30#define KERNEL_HELPER_POLICY 2 /* kernel as a helper to fan control */
31
32#define MAX_STEP_NUM 16
33#define MAX_FAN_LEVEL 255
34
35/* loongson_fan_policy works when fan work at FAN_AUTO_MODE */
36struct loongson_fan_policy {
37 u8 type;
38
39 /* percent only used when type is CONSTANT_SPEED_POLICY */
40 u8 percent;
41
42 /* period between two check. (Unit: S) */
43 u8 adjust_period;
44
45 /* fan adjust usually depend on a temprature input */
46 get_temp_fun depend_temp;
47
48 /* up_step/down_step used when type is STEP_SPEED_POLICY */
49 u8 up_step_num;
50 u8 down_step_num;
51 struct temp_range up_step[MAX_STEP_NUM];
52 struct temp_range down_step[MAX_STEP_NUM];
53 struct delayed_work work;
54};
55
56#endif /* __LOONGSON_HWMON_H_*/
diff --git a/arch/mips/include/asm/mach-loongson64/loongson_regs.h b/arch/mips/include/asm/mach-loongson64/loongson_regs.h
new file mode 100644
index 000000000..83dbb9fdf
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/loongson_regs.h
@@ -0,0 +1,246 @@
1/*
2 * Read/Write Loongson Extension Registers
3 */
4
5#ifndef _LOONGSON_REGS_H_
6#define _LOONGSON_REGS_H_
7
8#include <linux/types.h>
9#include <linux/bits.h>
10
11#include <asm/mipsregs.h>
12#include <asm/cpu.h>
13
14static inline bool cpu_has_cfg(void)
15{
16 return ((read_c0_prid() & PRID_IMP_MASK) == PRID_IMP_LOONGSON_64G);
17}
18
19static inline u32 read_cpucfg(u32 reg)
20{
21 u32 __res;
22
23 __asm__ __volatile__(
24 "parse_r __res,%0\n\t"
25 "parse_r reg,%1\n\t"
26 ".insn \n\t"
27 ".word (0xc8080118 | (reg << 21) | (__res << 11))\n\t"
28 :"=r"(__res)
29 :"r"(reg)
30 :
31 );
32 return __res;
33}
34
35/* Bit Domains for CFG registers */
36#define LOONGSON_CFG0 0x0
37#define LOONGSON_CFG0_PRID GENMASK(31, 0)
38
39#define LOONGSON_CFG1 0x1
40#define LOONGSON_CFG1_FP BIT(0)
41#define LOONGSON_CFG1_FPREV GENMASK(3, 1)
42#define LOONGSON_CFG1_MMI BIT(4)
43#define LOONGSON_CFG1_MSA1 BIT(5)
44#define LOONGSON_CFG1_MSA2 BIT(6)
45#define LOONGSON_CFG1_CGP BIT(7)
46#define LOONGSON_CFG1_WRP BIT(8)
47#define LOONGSON_CFG1_LSX1 BIT(9)
48#define LOONGSON_CFG1_LSX2 BIT(10)
49#define LOONGSON_CFG1_LASX BIT(11)
50#define LOONGSON_CFG1_R6FXP BIT(12)
51#define LOONGSON_CFG1_R6CRCP BIT(13)
52#define LOONGSON_CFG1_R6FPP BIT(14)
53#define LOONGSON_CFG1_CNT64 BIT(15)
54#define LOONGSON_CFG1_LSLDR0 BIT(16)
55#define LOONGSON_CFG1_LSPREF BIT(17)
56#define LOONGSON_CFG1_LSPREFX BIT(18)
57#define LOONGSON_CFG1_LSSYNCI BIT(19)
58#define LOONGSON_CFG1_LSUCA BIT(20)
59#define LOONGSON_CFG1_LLSYNC BIT(21)
60#define LOONGSON_CFG1_TGTSYNC BIT(22)
61#define LOONGSON_CFG1_LLEXC BIT(23)
62#define LOONGSON_CFG1_SCRAND BIT(24)
63#define LOONGSON_CFG1_MUALP BIT(25)
64#define LOONGSON_CFG1_KMUALEN BIT(26)
65#define LOONGSON_CFG1_ITLBT BIT(27)
66#define LOONGSON_CFG1_LSUPERF BIT(28)
67#define LOONGSON_CFG1_SFBP BIT(29)
68#define LOONGSON_CFG1_CDMAP BIT(30)
69
70#define LOONGSON_CFG1_FPREV_OFFSET 1
71
72#define LOONGSON_CFG2 0x2
73#define LOONGSON_CFG2_LEXT1 BIT(0)
74#define LOONGSON_CFG2_LEXT2 BIT(1)
75#define LOONGSON_CFG2_LEXT3 BIT(2)
76#define LOONGSON_CFG2_LSPW BIT(3)
77#define LOONGSON_CFG2_LBT1 BIT(4)
78#define LOONGSON_CFG2_LBT2 BIT(5)
79#define LOONGSON_CFG2_LBT3 BIT(6)
80#define LOONGSON_CFG2_LBTMMU BIT(7)
81#define LOONGSON_CFG2_LPMP BIT(8)
82#define LOONGSON_CFG2_LPMREV GENMASK(11, 9)
83#define LOONGSON_CFG2_LAMO BIT(12)
84#define LOONGSON_CFG2_LPIXU BIT(13)
85#define LOONGSON_CFG2_LPIXNU BIT(14)
86#define LOONGSON_CFG2_LVZP BIT(15)
87#define LOONGSON_CFG2_LVZREV GENMASK(18, 16)
88#define LOONGSON_CFG2_LGFTP BIT(19)
89#define LOONGSON_CFG2_LGFTPREV GENMASK(22, 20)
90#define LOONGSON_CFG2_LLFTP BIT(23)
91#define LOONGSON_CFG2_LLFTPREV GENMASK(26, 24)
92#define LOONGSON_CFG2_LCSRP BIT(27)
93#define LOONGSON_CFG2_LDISBLIKELY BIT(28)
94
95#define LOONGSON_CFG2_LPMREV_OFFSET 9
96#define LOONGSON_CFG2_LPM_REV1 (1 << LOONGSON_CFG2_LPMREV_OFFSET)
97#define LOONGSON_CFG2_LPM_REV2 (2 << LOONGSON_CFG2_LPMREV_OFFSET)
98#define LOONGSON_CFG2_LVZREV_OFFSET 16
99#define LOONGSON_CFG2_LVZ_REV1 (1 << LOONGSON_CFG2_LVZREV_OFFSET)
100#define LOONGSON_CFG2_LVZ_REV2 (2 << LOONGSON_CFG2_LVZREV_OFFSET)
101
102#define LOONGSON_CFG3 0x3
103#define LOONGSON_CFG3_LCAMP BIT(0)
104#define LOONGSON_CFG3_LCAMREV GENMASK(3, 1)
105#define LOONGSON_CFG3_LCAMNUM GENMASK(11, 4)
106#define LOONGSON_CFG3_LCAMKW GENMASK(19, 12)
107#define LOONGSON_CFG3_LCAMVW GENMASK(27, 20)
108
109#define LOONGSON_CFG3_LCAMREV_OFFSET 1
110#define LOONGSON_CFG3_LCAM_REV1 (1 << LOONGSON_CFG3_LCAMREV_OFFSET)
111#define LOONGSON_CFG3_LCAM_REV2 (2 << LOONGSON_CFG3_LCAMREV_OFFSET)
112#define LOONGSON_CFG3_LCAMNUM_OFFSET 4
113#define LOONGSON_CFG3_LCAMNUM_REV1 (0x3f << LOONGSON_CFG3_LCAMNUM_OFFSET)
114#define LOONGSON_CFG3_LCAMKW_OFFSET 12
115#define LOONGSON_CFG3_LCAMKW_REV1 (0x27 << LOONGSON_CFG3_LCAMKW_OFFSET)
116#define LOONGSON_CFG3_LCAMVW_OFFSET 20
117#define LOONGSON_CFG3_LCAMVW_REV1 (0x3f << LOONGSON_CFG3_LCAMVW_OFFSET)
118
119#define LOONGSON_CFG4 0x4
120#define LOONGSON_CFG4_CCFREQ GENMASK(31, 0)
121
122#define LOONGSON_CFG5 0x5
123#define LOONGSON_CFG5_CFM GENMASK(15, 0)
124#define LOONGSON_CFG5_CFD GENMASK(31, 16)
125
126#define LOONGSON_CFG6 0x6
127
128#define LOONGSON_CFG7 0x7
129#define LOONGSON_CFG7_GCCAEQRP BIT(0)
130#define LOONGSON_CFG7_UCAWINP BIT(1)
131
132static inline bool cpu_has_csr(void)
133{
134 if (cpu_has_cfg())
135 return (read_cpucfg(LOONGSON_CFG2) & LOONGSON_CFG2_LCSRP);
136
137 return false;
138}
139
140static inline u32 csr_readl(u32 reg)
141{
142 u32 __res;
143
144 /* RDCSR reg, val */
145 __asm__ __volatile__(
146 "parse_r __res,%0\n\t"
147 "parse_r reg,%1\n\t"
148 ".insn \n\t"
149 ".word (0xc8000118 | (reg << 21) | (__res << 11))\n\t"
150 :"=r"(__res)
151 :"r"(reg)
152 :
153 );
154 return __res;
155}
156
157static inline u64 csr_readq(u32 reg)
158{
159 u64 __res;
160
161 /* DRDCSR reg, val */
162 __asm__ __volatile__(
163 "parse_r __res,%0\n\t"
164 "parse_r reg,%1\n\t"
165 ".insn \n\t"
166 ".word (0xc8020118 | (reg << 21) | (__res << 11))\n\t"
167 :"=r"(__res)
168 :"r"(reg)
169 :
170 );
171 return __res;
172}
173
174static inline void csr_writel(u32 val, u32 reg)
175{
176 /* WRCSR reg, val */
177 __asm__ __volatile__(
178 "parse_r reg,%0\n\t"
179 "parse_r val,%1\n\t"
180 ".insn \n\t"
181 ".word (0xc8010118 | (reg << 21) | (val << 11))\n\t"
182 :
183 :"r"(reg),"r"(val)
184 :
185 );
186}
187
188static inline void csr_writeq(u64 val, u32 reg)
189{
190 /* DWRCSR reg, val */
191 __asm__ __volatile__(
192 "parse_r reg,%0\n\t"
193 "parse_r val,%1\n\t"
194 ".insn \n\t"
195 ".word (0xc8030118 | (reg << 21) | (val << 11))\n\t"
196 :
197 :"r"(reg),"r"(val)
198 :
199 );
200}
201
202/* Public CSR Register can also be accessed with regular addresses */
203#define CSR_PUBLIC_MMIO_BASE 0x1fe00000
204
205#define MMIO_CSR(x) (void *)TO_UNCAC(CSR_PUBLIC_MMIO_BASE + x)
206
207#define LOONGSON_CSR_FEATURES 0x8
208#define LOONGSON_CSRF_TEMP BIT(0)
209#define LOONGSON_CSRF_NODECNT BIT(1)
210#define LOONGSON_CSRF_MSI BIT(2)
211#define LOONGSON_CSRF_EXTIOI BIT(3)
212#define LOONGSON_CSRF_IPI BIT(4)
213#define LOONGSON_CSRF_FREQ BIT(5)
214
215#define LOONGSON_CSR_VENDOR 0x10 /* Vendor name string, should be "Loongson" */
216#define LOONGSON_CSR_CPUNAME 0x20 /* Processor name string */
217#define LOONGSON_CSR_NODECNT 0x408
218#define LOONGSON_CSR_CPUTEMP 0x428
219
220/* PerCore CSR, only accessable by local cores */
221#define LOONGSON_CSR_IPI_STATUS 0x1000
222#define LOONGSON_CSR_IPI_EN 0x1004
223#define LOONGSON_CSR_IPI_SET 0x1008
224#define LOONGSON_CSR_IPI_CLEAR 0x100c
225#define LOONGSON_CSR_IPI_SEND 0x1040
226#define CSR_IPI_SEND_IP_SHIFT 0
227#define CSR_IPI_SEND_CPU_SHIFT 16
228#define CSR_IPI_SEND_BLOCK BIT(31)
229
230static inline u64 drdtime(void)
231{
232 int rID = 0;
233 u64 val = 0;
234
235 __asm__ __volatile__(
236 "parse_r rID,%0\n\t"
237 "parse_r val,%1\n\t"
238 ".insn \n\t"
239 ".word (0xc8090118 | (rID << 21) | (val << 11))\n\t"
240 :"=r"(rID),"=r"(val)
241 :
242 );
243 return val;
244}
245
246#endif
diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h
new file mode 100644
index 000000000..ebb1deaa7
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/mmzone.h
@@ -0,0 +1,24 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2010 Loongson Inc. & Lemote Inc. &
4 * Institute of Computing Technology
5 * Author: Xiang Gao, gaoxiang@ict.ac.cn
6 * Huacai Chen, chenhc@lemote.com
7 * Xiaofu Meng, Shuangshuang Zhang
8 */
9#ifndef _ASM_MACH_LOONGSON64_MMZONE_H
10#define _ASM_MACH_LOONGSON64_MMZONE_H
11
12#define NODE_ADDRSPACE_SHIFT 44
13
14#define pa_to_nid(addr) (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT)
15#define nid_to_addrbase(nid) ((unsigned long)(nid) << NODE_ADDRSPACE_SHIFT)
16
17extern struct pglist_data *__node_data[];
18
19#define NODE_DATA(n) (__node_data[n])
20
21extern void setup_zero_pages(void);
22extern void __init prom_init_numa_memory(void);
23
24#endif /* _ASM_MACH_MMZONE_H */
diff --git a/arch/mips/include/asm/mach-loongson64/pci.h b/arch/mips/include/asm/mach-loongson64/pci.h
new file mode 100644
index 000000000..8b59d64a2
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/pci.h
@@ -0,0 +1,19 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2008 Zhang Le <r0bertz@gentoo.org>
4 * Copyright (c) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
5 */
6
7#ifndef __ASM_MACH_LOONGSON64_PCI_H_
8#define __ASM_MACH_LOONGSON64_PCI_H_
9
10extern struct pci_ops loongson_pci_ops;
11
12/* this is an offset from mips_io_port_base */
13#define LOONGSON_PCI_IO_START 0x00004000UL
14
15#define LOONGSON_PCI_MEM_START 0x40000000UL
16#define LOONGSON_PCI_MEM_END 0x7effffffUL
17
18
19#endif /* !__ASM_MACH_LOONGSON64_PCI_H_ */
diff --git a/arch/mips/include/asm/mach-loongson64/spaces.h b/arch/mips/include/asm/mach-loongson64/spaces.h
new file mode 100644
index 000000000..ce04e998a
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/spaces.h
@@ -0,0 +1,17 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_LOONGSON64_SPACES_H_
3#define __ASM_MACH_LOONGSON64_SPACES_H_
4
5#if defined(CONFIG_64BIT)
6#define CAC_BASE _AC(0x9800000000000000, UL)
7#endif /* CONFIG_64BIT */
8
9/* Skip 128k to trap NULL pointer dereferences */
10#define PCI_IOBASE _AC(0xc000000000000000 + SZ_128K, UL)
11#define PCI_IOSIZE SZ_16M
12#define MAP_BASE (PCI_IOBASE + PCI_IOSIZE)
13
14#define IO_SPACE_LIMIT (PCI_IOSIZE - 1)
15
16#include <asm/mach-generic/spaces.h>
17#endif
diff --git a/arch/mips/include/asm/mach-loongson64/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h
new file mode 100644
index 000000000..3414a1fd1
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/topology.h
@@ -0,0 +1,25 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_MACH_TOPOLOGY_H
3#define _ASM_MACH_TOPOLOGY_H
4
5#ifdef CONFIG_NUMA
6
7#define cpu_to_node(cpu) (cpu_logical_map(cpu) >> 2)
8
9extern cpumask_t __node_cpumask[];
10#define cpumask_of_node(node) (&__node_cpumask[node])
11
12struct pci_bus;
13extern int pcibus_to_node(struct pci_bus *);
14
15#define cpumask_of_pcibus(bus) (cpu_online_mask)
16
17extern unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
18
19#define node_distance(from, to) (__node_distances[(from)][(to)])
20
21#endif
22
23#include <asm-generic/topology.h>
24
25#endif /* _ASM_MACH_TOPOLOGY_H */
diff --git a/arch/mips/include/asm/mach-loongson64/workarounds.h b/arch/mips/include/asm/mach-loongson64/workarounds.h
new file mode 100644
index 000000000..17b71172a
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson64/workarounds.h
@@ -0,0 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_LOONGSON64_WORKAROUNDS_H_
3#define __ASM_MACH_LOONGSON64_WORKAROUNDS_H_
4
5#define WORKAROUND_CPUFREQ 0x00000001
6#define WORKAROUND_CPUHOTPLUG 0x00000002
7
8#endif
diff --git a/arch/mips/include/asm/mach-malta/cpu-feature-overrides.h b/arch/mips/include/asm/mach-malta/cpu-feature-overrides.h
new file mode 100644
index 000000000..de3b66a37
--- /dev/null
+++ b/arch/mips/include/asm/mach-malta/cpu-feature-overrides.h
@@ -0,0 +1,70 @@
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
13/*
14 * CPU feature overrides for MIPS boards
15 */
16#ifdef CONFIG_CPU_MIPS32
17#define cpu_has_tlb 1
18#define cpu_has_4kex 1
19#define cpu_has_4k_cache 1
20/* #define cpu_has_fpu ? */
21/* #define cpu_has_32fpr ? */
22#define cpu_has_counter 1
23/* #define cpu_has_watch ? */
24#define cpu_has_divec 1
25#define cpu_has_vce 0
26/* #define cpu_has_cache_cdex_p ? */
27/* #define cpu_has_cache_cdex_s ? */
28/* #define cpu_has_prefetch ? */
29#define cpu_has_mcheck 1
30/* #define cpu_has_ejtag ? */
31#define cpu_has_llsc 1
32/* #define cpu_has_vtag_icache ? */
33/* #define cpu_has_dc_aliases ? */
34/* #define cpu_has_ic_fills_f_dc ? */
35#define cpu_has_clo_clz 1
36#define cpu_has_nofpuex 0
37/* #define cpu_has_64bits ? */
38/* #define cpu_has_64bit_zero_reg ? */
39/* #define cpu_has_inclusive_pcaches ? */
40#define cpu_icache_snoops_remote_store 1
41#endif
42
43#ifdef CONFIG_CPU_MIPS64
44#define cpu_has_tlb 1
45#define cpu_has_4kex 1
46#define cpu_has_4k_cache 1
47/* #define cpu_has_fpu ? */
48/* #define cpu_has_32fpr ? */
49#define cpu_has_counter 1
50/* #define cpu_has_watch ? */
51#define cpu_has_divec 1
52#define cpu_has_vce 0
53/* #define cpu_has_cache_cdex_p ? */
54/* #define cpu_has_cache_cdex_s ? */
55/* #define cpu_has_prefetch ? */
56#define cpu_has_mcheck 1
57/* #define cpu_has_ejtag ? */
58#define cpu_has_llsc 1
59/* #define cpu_has_vtag_icache ? */
60/* #define cpu_has_dc_aliases ? */
61/* #define cpu_has_ic_fills_f_dc ? */
62#define cpu_has_clo_clz 1
63#define cpu_has_nofpuex 0
64/* #define cpu_has_64bits ? */
65/* #define cpu_has_64bit_zero_reg ? */
66/* #define cpu_has_inclusive_pcaches ? */
67#define cpu_icache_snoops_remote_store 1
68#endif
69
70#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-malta/irq.h b/arch/mips/include/asm/mach-malta/irq.h
new file mode 100644
index 000000000..e1bd4298b
--- /dev/null
+++ b/arch/mips/include/asm/mach-malta/irq.h
@@ -0,0 +1,10 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_MIPS_IRQ_H
3#define __ASM_MACH_MIPS_IRQ_H
4
5
6#define NR_IRQS 256
7
8#include <asm/mach-generic/irq.h>
9
10#endif /* __ASM_MACH_MIPS_IRQ_H */
diff --git a/arch/mips/include/asm/mach-malta/kernel-entry-init.h b/arch/mips/include/asm/mach-malta/kernel-entry-init.h
new file mode 100644
index 000000000..ab03eb3fa
--- /dev/null
+++ b/arch/mips/include/asm/mach-malta/kernel-entry-init.h
@@ -0,0 +1,145 @@
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 * Chris Dearman (chris@mips.com)
7 * Copyright (C) 2007 Mips Technologies, Inc.
8 * Copyright (C) 2014 Imagination Technologies Ltd.
9 */
10#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
11#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
12
13#include <asm/regdef.h>
14#include <asm/mipsregs.h>
15
16 /*
17 * Prepare segments for EVA boot:
18 *
19 * This is in case the processor boots in legacy configuration
20 * (SI_EVAReset is de-asserted and CONFIG5.K == 0)
21 *
22 * ========================= Mappings =============================
23 * Virtual memory Physical memory Mapping
24 * 0x00000000 - 0x7fffffff 0x80000000 - 0xfffffffff MUSUK (kuseg)
25 * Flat 2GB physical memory
26 *
27 * 0x80000000 - 0x9fffffff 0x00000000 - 0x1ffffffff MUSUK (kseg0)
28 * 0xa0000000 - 0xbf000000 0x00000000 - 0x1ffffffff MUSUK (kseg1)
29 * 0xc0000000 - 0xdfffffff - MK (kseg2)
30 * 0xe0000000 - 0xffffffff - MK (kseg3)
31 *
32 *
33 * Lowmem is expanded to 2GB
34 *
35 * The following code uses the t0, t1, t2 and ra registers without
36 * previously preserving them.
37 *
38 */
39 .macro platform_eva_init
40
41 .set push
42 .set reorder
43 /*
44 * Get Config.K0 value and use it to program
45 * the segmentation registers
46 */
47 mfc0 t1, CP0_CONFIG
48 andi t1, 0x7 /* CCA */
49 move t2, t1
50 ins t2, t1, 16, 3
51 /* SegCtl0 */
52 li t0, ((MIPS_SEGCFG_MK << MIPS_SEGCFG_AM_SHIFT) | \
53 (0 << MIPS_SEGCFG_PA_SHIFT) | \
54 (1 << MIPS_SEGCFG_EU_SHIFT)) | \
55 (((MIPS_SEGCFG_MK << MIPS_SEGCFG_AM_SHIFT) | \
56 (0 << MIPS_SEGCFG_PA_SHIFT) | \
57 (1 << MIPS_SEGCFG_EU_SHIFT)) << 16)
58 or t0, t2
59 mtc0 t0, CP0_SEGCTL0
60
61 /* SegCtl1 */
62 li t0, ((MIPS_SEGCFG_MUSUK << MIPS_SEGCFG_AM_SHIFT) | \
63 (0 << MIPS_SEGCFG_PA_SHIFT) | \
64 (2 << MIPS_SEGCFG_C_SHIFT) | \
65 (1 << MIPS_SEGCFG_EU_SHIFT)) | \
66 (((MIPS_SEGCFG_MUSUK << MIPS_SEGCFG_AM_SHIFT) | \
67 (0 << MIPS_SEGCFG_PA_SHIFT) | \
68 (1 << MIPS_SEGCFG_EU_SHIFT)) << 16)
69 ins t0, t1, 16, 3
70 mtc0 t0, CP0_SEGCTL1
71
72 /* SegCtl2 */
73 li t0, ((MIPS_SEGCFG_MUSUK << MIPS_SEGCFG_AM_SHIFT) | \
74 (6 << MIPS_SEGCFG_PA_SHIFT) | \
75 (1 << MIPS_SEGCFG_EU_SHIFT)) | \
76 (((MIPS_SEGCFG_MUSUK << MIPS_SEGCFG_AM_SHIFT) | \
77 (4 << MIPS_SEGCFG_PA_SHIFT) | \
78 (1 << MIPS_SEGCFG_EU_SHIFT)) << 16)
79 or t0, t2
80 mtc0 t0, CP0_SEGCTL2
81
82 jal mips_ihb
83 mfc0 t0, $16, 5
84 li t2, 0x40000000 /* K bit */
85 or t0, t0, t2
86 mtc0 t0, $16, 5
87 sync
88 jal mips_ihb
89
90 .set pop
91 .endm
92
93 .macro kernel_entry_setup
94
95#ifdef CONFIG_EVA
96 sync
97 ehb
98
99 mfc0 t1, CP0_CONFIG
100 bgez t1, 9f
101 mfc0 t0, CP0_CONFIG, 1
102 bgez t0, 9f
103 mfc0 t0, CP0_CONFIG, 2
104 bgez t0, 9f
105 mfc0 t0, CP0_CONFIG, 3
106 sll t0, t0, 6 /* SC bit */
107 bgez t0, 9f
108
109 platform_eva_init
110 b 0f
1119:
112 /* Assume we came from YAMON... */
113 PTR_LA v0, 0x9fc00534 /* YAMON print */
114 lw v0, (v0)
115 move a0, zero
116 PTR_LA a1, nonsc_processor
117 jal v0
118
119 PTR_LA v0, 0x9fc00520 /* YAMON exit */
120 lw v0, (v0)
121 li a0, 1
122 jal v0
123
1241: b 1b
125 nop
126 __INITDATA
127nonsc_processor:
128 .asciz "EVA kernel requires a MIPS core with Segment Control implemented\n"
129 __FINIT
130#endif /* CONFIG_EVA */
1310:
132 .endm
133
134/*
135 * Do SMP slave processor setup necessary before we can safely execute C code.
136 */
137 .macro smp_slave_setup
138#ifdef CONFIG_EVA
139 sync
140 ehb
141 platform_eva_init
142#endif
143 .endm
144
145#endif /* __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H */
diff --git a/arch/mips/include/asm/mach-malta/mach-gt64120.h b/arch/mips/include/asm/mach-malta/mach-gt64120.h
new file mode 100644
index 000000000..b9dee7c3e
--- /dev/null
+++ b/arch/mips/include/asm/mach-malta/mach-gt64120.h
@@ -0,0 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * This is a direct copy of the ev96100.h file, with a global
4 * search and replace. The numbers are the same.
5 *
6 * The reason I'm duplicating this is so that the 64120/96100
7 * defines won't be confusing in the source code.
8 */
9#ifndef _ASM_MACH_MIPS_MACH_GT64120_DEP_H
10#define _ASM_MACH_MIPS_MACH_GT64120_DEP_H
11
12#define MIPS_GT_BASE 0x1be00000
13
14extern unsigned long _pcictrl_gt64120;
15/*
16 * GT64120 config space base address
17 */
18#define GT64120_BASE _pcictrl_gt64120
19
20#endif /* _ASM_MACH_MIPS_MACH_GT64120_DEP_H */
diff --git a/arch/mips/include/asm/mach-malta/mc146818rtc.h b/arch/mips/include/asm/mach-malta/mc146818rtc.h
new file mode 100644
index 000000000..e8cc7fdf7
--- /dev/null
+++ b/arch/mips/include/asm/mach-malta/mc146818rtc.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Carsten Langgaard, carstenl@mips.com
4 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
5 * Copyright (C) 2003 by Ralf Baechle
6 *
7 * RTC routines for Malta style attached PIIX4 device, which contains a
8 * Motorola MC146818A-compatible Real Time Clock.
9 */
10#ifndef __ASM_MACH_MALTA_MC146818RTC_H
11#define __ASM_MACH_MALTA_MC146818RTC_H
12
13#include <asm/io.h>
14#include <asm/mips-boards/generic.h>
15#include <asm/mips-boards/malta.h>
16
17#define RTC_PORT(x) (0x70 + (x))
18#define RTC_IRQ 8
19
20static inline unsigned char CMOS_READ(unsigned long addr)
21{
22 outb(addr, MALTA_RTC_ADR_REG);
23 return inb(MALTA_RTC_DAT_REG);
24}
25
26static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
27{
28 outb(addr, MALTA_RTC_ADR_REG);
29 outb(data, MALTA_RTC_DAT_REG);
30}
31
32#define RTC_ALWAYS_BCD 0
33
34#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
35
36#endif /* __ASM_MACH_MALTA_MC146818RTC_H */
diff --git a/arch/mips/include/asm/mach-malta/spaces.h b/arch/mips/include/asm/mach-malta/spaces.h
new file mode 100644
index 000000000..d7e54971e
--- /dev/null
+++ b/arch/mips/include/asm/mach-malta/spaces.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) 2014 Imagination Technologies Ltd.
7 */
8
9#ifndef _ASM_MALTA_SPACES_H
10#define _ASM_MALTA_SPACES_H
11
12#ifdef CONFIG_EVA
13
14/*
15 * Traditional Malta Board Memory Map for EVA
16 *
17 * 0x00000000 - 0x0fffffff: 1st RAM region, 256MB
18 * 0x10000000 - 0x1bffffff: GIC and CPC Control Registers
19 * 0x1c000000 - 0x1fffffff: I/O And Flash
20 * 0x20000000 - 0x7fffffff: 2nd RAM region, 1.5GB
21 * 0x80000000 - 0xffffffff: Physical memory aliases to 0x0 (2GB)
22 *
23 * The kernel is still located in 0x80000000(kseg0). However,
24 * the physical mask has been shifted to 0x80000000 which exploits the alias
25 * on the Malta board. As a result of which, we override the __pa_symbol
26 * to peform direct mapping from virtual to physical addresses. In other
27 * words, the 0x80000000 virtual address maps to 0x80000000 physical address
28 * which in turn aliases to 0x0. We do this in order to be able to use a flat
29 * 2GB of memory (0x80000000 - 0xffffffff) so we can avoid the I/O hole in
30 * 0x10000000 - 0x1fffffff.
31 * The last 64KB of physical memory are reserved for correct HIGHMEM
32 * macros arithmetics.
33 *
34 */
35
36#define PAGE_OFFSET _AC(0x0, UL)
37#define PHYS_OFFSET _AC(0x80000000, UL)
38#define HIGHMEM_START _AC(0xffff0000, UL)
39
40#define __pa_symbol(x) (RELOC_HIDE((unsigned long)(x), 0))
41
42#endif /* CONFIG_EVA */
43
44#include <asm/mach-generic/spaces.h>
45
46#endif /* _ASM_MALTA_SPACES_H */
diff --git a/arch/mips/include/asm/mach-netlogic/cpu-feature-overrides.h b/arch/mips/include/asm/mach-netlogic/cpu-feature-overrides.h
new file mode 100644
index 000000000..0c29ff820
--- /dev/null
+++ b/arch/mips/include/asm/mach-netlogic/cpu-feature-overrides.h
@@ -0,0 +1,57 @@
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) 2011 Netlogic Microsystems
7 * Copyright (C) 2003 Ralf Baechle
8 */
9#ifndef __ASM_MACH_NETLOGIC_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_NETLOGIC_CPU_FEATURE_OVERRIDES_H
11
12#define cpu_has_4kex 1
13#define cpu_has_4k_cache 1
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_mips16e2 0
17#define cpu_has_counter 1
18#define cpu_has_divec 1
19#define cpu_has_vce 0
20#define cpu_has_cache_cdex_p 0
21#define cpu_has_cache_cdex_s 0
22#define cpu_has_prefetch 1
23#define cpu_has_mcheck 1
24#define cpu_has_ejtag 1
25
26#define cpu_has_llsc 1
27#define cpu_has_vtag_icache 0
28#define cpu_has_ic_fills_f_dc 1
29#define cpu_has_dsp 0
30#define cpu_has_dsp2 0
31#define cpu_has_mipsmt 0
32#define cpu_icache_snoops_remote_store 1
33
34#define cpu_has_64bits 1
35
36#define cpu_has_mips32r1 1
37#define cpu_has_mips64r1 1
38
39#define cpu_has_inclusive_pcaches 0
40
41#define cpu_dcache_line_size() 32
42#define cpu_icache_line_size() 32
43
44#if defined(CONFIG_CPU_XLR)
45#define cpu_has_userlocal 0
46#define cpu_has_dc_aliases 0
47#define cpu_has_mips32r2 0
48#define cpu_has_mips64r2 0
49#elif defined(CONFIG_CPU_XLP)
50#define cpu_has_userlocal 1
51#define cpu_has_mips32r2 1
52#define cpu_has_mips64r2 1
53#else
54#error "Unknown Netlogic CPU"
55#endif
56
57#endif /* __ASM_MACH_NETLOGIC_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-netlogic/irq.h b/arch/mips/include/asm/mach-netlogic/irq.h
new file mode 100644
index 000000000..c0dbd530c
--- /dev/null
+++ b/arch/mips/include/asm/mach-netlogic/irq.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) 2011 Netlogic Microsystems.
7 */
8#ifndef __ASM_NETLOGIC_IRQ_H
9#define __ASM_NETLOGIC_IRQ_H
10
11#include <asm/mach-netlogic/multi-node.h>
12#define NLM_IRQS_PER_NODE 1024
13#define NR_IRQS (NLM_IRQS_PER_NODE * NLM_NR_NODES)
14
15#define MIPS_CPU_IRQ_BASE 0
16
17#endif /* __ASM_NETLOGIC_IRQ_H */
diff --git a/arch/mips/include/asm/mach-netlogic/multi-node.h b/arch/mips/include/asm/mach-netlogic/multi-node.h
new file mode 100644
index 000000000..8bdf47e29
--- /dev/null
+++ b/arch/mips/include/asm/mach-netlogic/multi-node.h
@@ -0,0 +1,74 @@
1/*
2 * Copyright (c) 2003-2012 Broadcom Corporation
3 * All Rights Reserved
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the Broadcom
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _NETLOGIC_MULTI_NODE_H_
36#define _NETLOGIC_MULTI_NODE_H_
37
38#ifndef CONFIG_NLM_MULTINODE
39#define NLM_NR_NODES 1
40#else
41#if defined(CONFIG_NLM_MULTINODE_2)
42#define NLM_NR_NODES 2
43#elif defined(CONFIG_NLM_MULTINODE_4)
44#define NLM_NR_NODES 4
45#else
46#define NLM_NR_NODES 1
47#endif
48#endif
49
50#define NLM_THREADS_PER_CORE 4
51
52struct nlm_soc_info {
53 unsigned long coremask; /* cores enabled on the soc */
54 unsigned long ebase; /* not used now */
55 uint64_t irqmask; /* EIMR for the node */
56 uint64_t sysbase; /* only for XLP - sys block base */
57 uint64_t picbase; /* PIC block base */
58 spinlock_t piclock; /* lock for PIC access */
59 cpumask_t cpumask; /* logical cpu mask for node */
60 unsigned int socbus;
61};
62
63extern struct nlm_soc_info nlm_nodes[NLM_NR_NODES];
64#define nlm_get_node(i) (&nlm_nodes[i])
65#define nlm_node_present(n) ((n) >= 0 && (n) < NLM_NR_NODES && \
66 nlm_get_node(n)->coremask != 0)
67#ifdef CONFIG_CPU_XLR
68#define nlm_current_node() (&nlm_nodes[0])
69#else
70#define nlm_current_node() (&nlm_nodes[nlm_nodeid()])
71#endif
72void nlm_node_init(int node);
73
74#endif
diff --git a/arch/mips/include/asm/mach-pic32/cpu-feature-overrides.h b/arch/mips/include/asm/mach-pic32/cpu-feature-overrides.h
new file mode 100644
index 000000000..468230834
--- /dev/null
+++ b/arch/mips/include/asm/mach-pic32/cpu-feature-overrides.h
@@ -0,0 +1,32 @@
1/*
2 * Joshua Henderson <joshua.henderson@microchip.com>
3 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
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_MACH_PIC32_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_PIC32_CPU_FEATURE_OVERRIDES_H
11
12/*
13 * CPU feature overrides for PIC32 boards
14 */
15#ifdef CONFIG_CPU_MIPS32
16#define cpu_has_vint 1
17#define cpu_has_veic 0
18#define cpu_has_tlb 1
19#define cpu_has_4kex 1
20#define cpu_has_4k_cache 1
21#define cpu_has_fpu 0
22#define cpu_has_counter 1
23#define cpu_has_llsc 1
24#define cpu_has_nofpuex 0
25#define cpu_icache_snoops_remote_store 1
26#endif
27
28#ifdef CONFIG_CPU_MIPS64
29#error This platform does not support 64bit.
30#endif
31
32#endif /* __ASM_MACH_PIC32_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-pic32/irq.h b/arch/mips/include/asm/mach-pic32/irq.h
new file mode 100644
index 000000000..ddaf999bc
--- /dev/null
+++ b/arch/mips/include/asm/mach-pic32/irq.h
@@ -0,0 +1,14 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Joshua Henderson <joshua.henderson@microchip.com>
4 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
5 */
6#ifndef __ASM_MACH_PIC32_IRQ_H
7#define __ASM_MACH_PIC32_IRQ_H
8
9#define NR_IRQS 256
10#define MIPS_CPU_IRQ_BASE 0
11
12#include <asm/mach-generic/irq.h>
13
14#endif /* __ASM_MACH_PIC32_IRQ_H */
diff --git a/arch/mips/include/asm/mach-pic32/pic32.h b/arch/mips/include/asm/mach-pic32/pic32.h
new file mode 100644
index 000000000..53918a671
--- /dev/null
+++ b/arch/mips/include/asm/mach-pic32/pic32.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Joshua Henderson <joshua.henderson@microchip.com>
4 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
5 */
6#ifndef _ASM_MACH_PIC32_H
7#define _ASM_MACH_PIC32_H
8
9#include <linux/io.h>
10
11/*
12 * PIC32 register offsets for SET/CLR/INV where supported.
13 */
14#define PIC32_CLR(_reg) ((_reg) + 0x04)
15#define PIC32_SET(_reg) ((_reg) + 0x08)
16#define PIC32_INV(_reg) ((_reg) + 0x0C)
17
18/*
19 * PIC32 Base Register Offsets
20 */
21#define PIC32_BASE_CONFIG 0x1f800000
22#define PIC32_BASE_OSC 0x1f801200
23#define PIC32_BASE_RESET 0x1f801240
24#define PIC32_BASE_PPS 0x1f801400
25#define PIC32_BASE_UART 0x1f822000
26#define PIC32_BASE_PORT 0x1f860000
27#define PIC32_BASE_DEVCFG2 0x1fc4ff44
28
29/*
30 * Register unlock sequence required for some register access.
31 */
32void pic32_syskey_unlock_debug(const char *fn, const ulong ln);
33#define pic32_syskey_unlock() \
34 pic32_syskey_unlock_debug(__func__, __LINE__)
35
36#endif /* _ASM_MACH_PIC32_H */
diff --git a/arch/mips/include/asm/mach-pic32/spaces.h b/arch/mips/include/asm/mach-pic32/spaces.h
new file mode 100644
index 000000000..eb557b52c
--- /dev/null
+++ b/arch/mips/include/asm/mach-pic32/spaces.h
@@ -0,0 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Joshua Henderson <joshua.henderson@microchip.com>
4 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
5 */
6#ifndef _ASM_MACH_PIC32_SPACES_H
7#define _ASM_MACH_PIC32_SPACES_H
8
9#ifdef CONFIG_PIC32MZDA
10#define PHYS_OFFSET _AC(0x08000000, UL)
11#endif
12
13#include <asm/mach-generic/spaces.h>
14
15#endif /* __ASM_MACH_PIC32_SPACES_H */
diff --git a/arch/mips/include/asm/mach-pistachio/irq.h b/arch/mips/include/asm/mach-pistachio/irq.h
new file mode 100644
index 000000000..74ac01650
--- /dev/null
+++ b/arch/mips/include/asm/mach-pistachio/irq.h
@@ -0,0 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Pistachio IRQ setup
4 *
5 * Copyright (C) 2014 Google, Inc.
6 */
7
8#ifndef __ASM_MACH_PISTACHIO_IRQ_H
9#define __ASM_MACH_PISTACHIO_IRQ_H
10
11#define NR_IRQS 256
12
13#include <asm/mach-generic/irq.h>
14
15#endif /* __ASM_MACH_PISTACHIO_IRQ_H */
diff --git a/arch/mips/include/asm/mach-ralink/irq.h b/arch/mips/include/asm/mach-ralink/irq.h
new file mode 100644
index 000000000..2262243d1
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/irq.h
@@ -0,0 +1,10 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_RALINK_IRQ_H
3#define __ASM_MACH_RALINK_IRQ_H
4
5#define GIC_NUM_INTRS 64
6#define NR_IRQS 256
7
8#include <asm/mach-generic/irq.h>
9
10#endif
diff --git a/arch/mips/include/asm/mach-ralink/mt7620.h b/arch/mips/include/asm/mach-ralink/mt7620.h
new file mode 100644
index 000000000..757ce53d0
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/mt7620.h
@@ -0,0 +1,138 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Parts of this file are based on Ralink's 2.6.21 BSP
5 *
6 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
7 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8 * Copyright (C) 2013 John Crispin <john@phrozen.org>
9 */
10
11#ifndef _MT7620_REGS_H_
12#define _MT7620_REGS_H_
13
14#define MT7620_SYSC_BASE 0x10000000
15
16#define SYSC_REG_CHIP_NAME0 0x00
17#define SYSC_REG_CHIP_NAME1 0x04
18#define SYSC_REG_EFUSE_CFG 0x08
19#define SYSC_REG_CHIP_REV 0x0c
20#define SYSC_REG_SYSTEM_CONFIG0 0x10
21#define SYSC_REG_SYSTEM_CONFIG1 0x14
22#define SYSC_REG_CLKCFG0 0x2c
23#define SYSC_REG_CPU_SYS_CLKCFG 0x3c
24#define SYSC_REG_CPLL_CONFIG0 0x54
25#define SYSC_REG_CPLL_CONFIG1 0x58
26
27#define MT7620_CHIP_NAME0 0x3637544d
28#define MT7620_CHIP_NAME1 0x20203032
29#define MT7628_CHIP_NAME1 0x20203832
30
31#define SYSCFG0_XTAL_FREQ_SEL BIT(6)
32
33#define CHIP_REV_PKG_MASK 0x1
34#define CHIP_REV_PKG_SHIFT 16
35#define CHIP_REV_VER_MASK 0xf
36#define CHIP_REV_VER_SHIFT 8
37#define CHIP_REV_ECO_MASK 0xf
38
39#define CLKCFG0_PERI_CLK_SEL BIT(4)
40
41#define CPU_SYS_CLKCFG_OCP_RATIO_SHIFT 16
42#define CPU_SYS_CLKCFG_OCP_RATIO_MASK 0xf
43#define CPU_SYS_CLKCFG_OCP_RATIO_1 0 /* 1:1 (Reserved) */
44#define CPU_SYS_CLKCFG_OCP_RATIO_1_5 1 /* 1:1.5 (Reserved) */
45#define CPU_SYS_CLKCFG_OCP_RATIO_2 2 /* 1:2 */
46#define CPU_SYS_CLKCFG_OCP_RATIO_2_5 3 /* 1:2.5 (Reserved) */
47#define CPU_SYS_CLKCFG_OCP_RATIO_3 4 /* 1:3 */
48#define CPU_SYS_CLKCFG_OCP_RATIO_3_5 5 /* 1:3.5 (Reserved) */
49#define CPU_SYS_CLKCFG_OCP_RATIO_4 6 /* 1:4 */
50#define CPU_SYS_CLKCFG_OCP_RATIO_5 7 /* 1:5 */
51#define CPU_SYS_CLKCFG_OCP_RATIO_10 8 /* 1:10 */
52#define CPU_SYS_CLKCFG_CPU_FDIV_SHIFT 8
53#define CPU_SYS_CLKCFG_CPU_FDIV_MASK 0x1f
54#define CPU_SYS_CLKCFG_CPU_FFRAC_SHIFT 0
55#define CPU_SYS_CLKCFG_CPU_FFRAC_MASK 0x1f
56
57#define CPLL_CFG0_SW_CFG BIT(31)
58#define CPLL_CFG0_PLL_MULT_RATIO_SHIFT 16
59#define CPLL_CFG0_PLL_MULT_RATIO_MASK 0x7
60#define CPLL_CFG0_LC_CURFCK BIT(15)
61#define CPLL_CFG0_BYPASS_REF_CLK BIT(14)
62#define CPLL_CFG0_PLL_DIV_RATIO_SHIFT 10
63#define CPLL_CFG0_PLL_DIV_RATIO_MASK 0x3
64
65#define CPLL_CFG1_CPU_AUX1 BIT(25)
66#define CPLL_CFG1_CPU_AUX0 BIT(24)
67
68#define SYSCFG0_DRAM_TYPE_MASK 0x3
69#define SYSCFG0_DRAM_TYPE_SHIFT 4
70#define SYSCFG0_DRAM_TYPE_SDRAM 0
71#define SYSCFG0_DRAM_TYPE_DDR1 1
72#define SYSCFG0_DRAM_TYPE_DDR2 2
73#define SYSCFG0_DRAM_TYPE_UNKNOWN 3
74
75#define SYSCFG0_DRAM_TYPE_DDR2_MT7628 0
76#define SYSCFG0_DRAM_TYPE_DDR1_MT7628 1
77
78#define MT7620_DRAM_BASE 0x0
79#define MT7620_SDRAM_SIZE_MIN 2
80#define MT7620_SDRAM_SIZE_MAX 64
81#define MT7620_DDR1_SIZE_MIN 32
82#define MT7620_DDR1_SIZE_MAX 128
83#define MT7620_DDR2_SIZE_MIN 32
84#define MT7620_DDR2_SIZE_MAX 256
85
86#define MT7620_GPIO_MODE_UART0_SHIFT 2
87#define MT7620_GPIO_MODE_UART0_MASK 0x7
88#define MT7620_GPIO_MODE_UART0(x) ((x) << MT7620_GPIO_MODE_UART0_SHIFT)
89#define MT7620_GPIO_MODE_UARTF 0x0
90#define MT7620_GPIO_MODE_PCM_UARTF 0x1
91#define MT7620_GPIO_MODE_PCM_I2S 0x2
92#define MT7620_GPIO_MODE_I2S_UARTF 0x3
93#define MT7620_GPIO_MODE_PCM_GPIO 0x4
94#define MT7620_GPIO_MODE_GPIO_UARTF 0x5
95#define MT7620_GPIO_MODE_GPIO_I2S 0x6
96#define MT7620_GPIO_MODE_GPIO 0x7
97
98#define MT7620_GPIO_MODE_NAND 0
99#define MT7620_GPIO_MODE_SD 1
100#define MT7620_GPIO_MODE_ND_SD_GPIO 2
101#define MT7620_GPIO_MODE_ND_SD_MASK 0x3
102#define MT7620_GPIO_MODE_ND_SD_SHIFT 18
103
104#define MT7620_GPIO_MODE_PCIE_RST 0
105#define MT7620_GPIO_MODE_PCIE_REF 1
106#define MT7620_GPIO_MODE_PCIE_GPIO 2
107#define MT7620_GPIO_MODE_PCIE_MASK 0x3
108#define MT7620_GPIO_MODE_PCIE_SHIFT 16
109
110#define MT7620_GPIO_MODE_WDT_RST 0
111#define MT7620_GPIO_MODE_WDT_REF 1
112#define MT7620_GPIO_MODE_WDT_GPIO 2
113#define MT7620_GPIO_MODE_WDT_MASK 0x3
114#define MT7620_GPIO_MODE_WDT_SHIFT 21
115
116#define MT7620_GPIO_MODE_MDIO 0
117#define MT7620_GPIO_MODE_MDIO_REFCLK 1
118#define MT7620_GPIO_MODE_MDIO_GPIO 2
119#define MT7620_GPIO_MODE_MDIO_MASK 0x3
120#define MT7620_GPIO_MODE_MDIO_SHIFT 7
121
122#define MT7620_GPIO_MODE_I2C 0
123#define MT7620_GPIO_MODE_UART1 5
124#define MT7620_GPIO_MODE_RGMII1 9
125#define MT7620_GPIO_MODE_RGMII2 10
126#define MT7620_GPIO_MODE_SPI 11
127#define MT7620_GPIO_MODE_SPI_REF_CLK 12
128#define MT7620_GPIO_MODE_WLED 13
129#define MT7620_GPIO_MODE_JTAG 15
130#define MT7620_GPIO_MODE_EPHY 15
131#define MT7620_GPIO_MODE_PA 20
132
133static inline int mt7620_get_eco(void)
134{
135 return rt_sysc_r32(SYSC_REG_CHIP_REV) & CHIP_REV_ECO_MASK;
136}
137
138#endif
diff --git a/arch/mips/include/asm/mach-ralink/mt7620/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ralink/mt7620/cpu-feature-overrides.h
new file mode 100644
index 000000000..c4579f170
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/mt7620/cpu-feature-overrides.h
@@ -0,0 +1,52 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Ralink MT7620 specific CPU feature overrides
4 *
5 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 *
8 * This file was derived from: include/asm-mips/cpu-features.h
9 * Copyright (C) 2003, 2004 Ralf Baechle
10 * Copyright (C) 2004 Maciej W. Rozycki
11 */
12#ifndef _MT7620_CPU_FEATURE_OVERRIDES_H
13#define _MT7620_CPU_FEATURE_OVERRIDES_H
14
15#define cpu_has_tlb 1
16#define cpu_has_4kex 1
17#define cpu_has_3k_cache 0
18#define cpu_has_4k_cache 1
19#define cpu_has_tx39_cache 0
20#define cpu_has_sb1_cache 0
21#define cpu_has_fpu 0
22#define cpu_has_32fpr 0
23#define cpu_has_counter 1
24#define cpu_has_watch 1
25#define cpu_has_divec 1
26
27#define cpu_has_prefetch 1
28#define cpu_has_ejtag 1
29#define cpu_has_llsc 1
30
31#define cpu_has_mips16 1
32#define cpu_has_mdmx 0
33#define cpu_has_mips3d 0
34#define cpu_has_smartmips 0
35
36#define cpu_has_mips32r1 1
37#define cpu_has_mips32r2 1
38#define cpu_has_mips64r1 0
39#define cpu_has_mips64r2 0
40
41#define cpu_has_dsp 1
42#define cpu_has_dsp2 0
43#define cpu_has_mipsmt 0
44
45#define cpu_has_64bits 0
46#define cpu_has_64bit_zero_reg 0
47#define cpu_has_64bit_gp_regs 0
48
49#define cpu_dcache_line_size() 32
50#define cpu_icache_line_size() 32
51
52#endif /* _MT7620_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ralink/mt7621.h b/arch/mips/include/asm/mach-ralink/mt7621.h
new file mode 100644
index 000000000..e1af1ba50
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/mt7621.h
@@ -0,0 +1,34 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Copyright (C) 2015 John Crispin <john@phrozen.org>
5 */
6
7#ifndef _MT7621_REGS_H_
8#define _MT7621_REGS_H_
9
10#define MT7621_PALMBUS_BASE 0x1C000000
11#define MT7621_PALMBUS_SIZE 0x03FFFFFF
12
13#define MT7621_SYSC_BASE 0x1E000000
14
15#define SYSC_REG_CHIP_NAME0 0x00
16#define SYSC_REG_CHIP_NAME1 0x04
17#define SYSC_REG_CHIP_REV 0x0c
18#define SYSC_REG_SYSTEM_CONFIG0 0x10
19#define SYSC_REG_SYSTEM_CONFIG1 0x14
20
21#define CHIP_REV_PKG_MASK 0x1
22#define CHIP_REV_PKG_SHIFT 16
23#define CHIP_REV_VER_MASK 0xf
24#define CHIP_REV_VER_SHIFT 8
25#define CHIP_REV_ECO_MASK 0xf
26
27#define MT7621_DRAM_BASE 0x0
28#define MT7621_DDR2_SIZE_MIN 32
29#define MT7621_DDR2_SIZE_MAX 256
30
31#define MT7621_CHIP_NAME0 0x3637544D
32#define MT7621_CHIP_NAME1 0x20203132
33
34#endif
diff --git a/arch/mips/include/asm/mach-ralink/mt7621/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ralink/mt7621/cpu-feature-overrides.h
new file mode 100644
index 000000000..168359a0a
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/mt7621/cpu-feature-overrides.h
@@ -0,0 +1,60 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Ralink MT7621 specific CPU feature overrides
4 *
5 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 * Copyright (C) 2015 Felix Fietkau <nbd@openwrt.org>
8 *
9 * This file was derived from: include/asm-mips/cpu-features.h
10 * Copyright (C) 2003, 2004 Ralf Baechle
11 * Copyright (C) 2004 Maciej W. Rozycki
12 */
13#ifndef _MT7621_CPU_FEATURE_OVERRIDES_H
14#define _MT7621_CPU_FEATURE_OVERRIDES_H
15
16#define cpu_has_tlb 1
17#define cpu_has_4kex 1
18#define cpu_has_3k_cache 0
19#define cpu_has_4k_cache 1
20#define cpu_has_tx39_cache 0
21#define cpu_has_sb1_cache 0
22#define cpu_has_fpu 0
23#define cpu_has_32fpr 0
24#define cpu_has_counter 1
25#define cpu_has_watch 1
26#define cpu_has_divec 1
27
28#define cpu_has_prefetch 1
29#define cpu_has_ejtag 1
30#define cpu_has_llsc 1
31
32#define cpu_has_mips16 1
33#define cpu_has_mdmx 0
34#define cpu_has_mips3d 0
35#define cpu_has_smartmips 0
36
37#define cpu_has_mips32r1 1
38#define cpu_has_mips32r2 1
39#define cpu_has_mips64r1 0
40#define cpu_has_mips64r2 0
41
42#define cpu_has_dsp 1
43#define cpu_has_dsp2 0
44#define cpu_has_mipsmt 1
45
46#define cpu_has_64bits 0
47#define cpu_has_64bit_zero_reg 0
48#define cpu_has_64bit_gp_regs 0
49
50#define cpu_dcache_line_size() 32
51#define cpu_icache_line_size() 32
52
53#define cpu_has_dc_aliases 0
54#define cpu_has_vtag_icache 0
55
56#define cpu_has_rixi 0
57#define cpu_has_tlbinv 0
58#define cpu_has_userlocal 1
59
60#endif /* _MT7621_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ralink/pinmux.h b/arch/mips/include/asm/mach-ralink/pinmux.h
new file mode 100644
index 000000000..048309348
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/pinmux.h
@@ -0,0 +1,52 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2012 John Crispin <john@phrozen.org>
4 */
5
6#ifndef _RT288X_PINMUX_H__
7#define _RT288X_PINMUX_H__
8
9#define FUNC(name, value, pin_first, pin_count) \
10 { name, value, pin_first, pin_count }
11
12#define GRP(_name, _func, _mask, _shift) \
13 { .name = _name, .mask = _mask, .shift = _shift, \
14 .func = _func, .gpio = _mask, \
15 .func_count = ARRAY_SIZE(_func) }
16
17#define GRP_G(_name, _func, _mask, _gpio, _shift) \
18 { .name = _name, .mask = _mask, .shift = _shift, \
19 .func = _func, .gpio = _gpio, \
20 .func_count = ARRAY_SIZE(_func) }
21
22struct rt2880_pmx_group;
23
24struct rt2880_pmx_func {
25 const char *name;
26 const char value;
27
28 int pin_first;
29 int pin_count;
30 int *pins;
31
32 int *groups;
33 int group_count;
34
35 int enabled;
36};
37
38struct rt2880_pmx_group {
39 const char *name;
40 int enabled;
41
42 const u32 shift;
43 const char mask;
44 const char gpio;
45
46 struct rt2880_pmx_func *func;
47 int func_count;
48};
49
50extern struct rt2880_pmx_group *rt2880_pinmux_data;
51
52#endif
diff --git a/arch/mips/include/asm/mach-ralink/ralink_regs.h b/arch/mips/include/asm/mach-ralink/ralink_regs.h
new file mode 100644
index 000000000..9dbd9f087
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/ralink_regs.h
@@ -0,0 +1,62 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Ralink SoC register definitions
4 *
5 * Copyright (C) 2013 John Crispin <john@phrozen.org>
6 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
7 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8 */
9
10#ifndef _RALINK_REGS_H_
11#define _RALINK_REGS_H_
12
13#include <linux/io.h>
14
15enum ralink_soc_type {
16 RALINK_UNKNOWN = 0,
17 RT2880_SOC,
18 RT3883_SOC,
19 RT305X_SOC_RT3050,
20 RT305X_SOC_RT3052,
21 RT305X_SOC_RT3350,
22 RT305X_SOC_RT3352,
23 RT305X_SOC_RT5350,
24 MT762X_SOC_MT7620A,
25 MT762X_SOC_MT7620N,
26 MT762X_SOC_MT7621AT,
27 MT762X_SOC_MT7628AN,
28 MT762X_SOC_MT7688,
29};
30extern enum ralink_soc_type ralink_soc;
31
32extern __iomem void *rt_sysc_membase;
33extern __iomem void *rt_memc_membase;
34
35static inline void rt_sysc_w32(u32 val, unsigned reg)
36{
37 __raw_writel(val, rt_sysc_membase + reg);
38}
39
40static inline u32 rt_sysc_r32(unsigned reg)
41{
42 return __raw_readl(rt_sysc_membase + reg);
43}
44
45static inline void rt_sysc_m32(u32 clr, u32 set, unsigned reg)
46{
47 u32 val = rt_sysc_r32(reg) & ~clr;
48
49 __raw_writel(val | set, rt_sysc_membase + reg);
50}
51
52static inline void rt_memc_w32(u32 val, unsigned reg)
53{
54 __raw_writel(val, rt_memc_membase + reg);
55}
56
57static inline u32 rt_memc_r32(unsigned reg)
58{
59 return __raw_readl(rt_memc_membase + reg);
60}
61
62#endif /* _RALINK_REGS_H_ */
diff --git a/arch/mips/include/asm/mach-ralink/rt288x.h b/arch/mips/include/asm/mach-ralink/rt288x.h
new file mode 100644
index 000000000..5d10178f2
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/rt288x.h
@@ -0,0 +1,51 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Parts of this file are based on Ralink's 2.6.21 BSP
5 *
6 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
7 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8 * Copyright (C) 2013 John Crispin <john@phrozen.org>
9 */
10
11#ifndef _RT288X_REGS_H_
12#define _RT288X_REGS_H_
13
14#define RT2880_SYSC_BASE 0x00300000
15
16#define SYSC_REG_CHIP_NAME0 0x00
17#define SYSC_REG_CHIP_NAME1 0x04
18#define SYSC_REG_CHIP_ID 0x0c
19#define SYSC_REG_SYSTEM_CONFIG 0x10
20#define SYSC_REG_CLKCFG 0x30
21
22#define RT2880_CHIP_NAME0 0x38325452
23#define RT2880_CHIP_NAME1 0x20203038
24
25#define CHIP_ID_ID_MASK 0xff
26#define CHIP_ID_ID_SHIFT 8
27#define CHIP_ID_REV_MASK 0xff
28
29#define SYSTEM_CONFIG_CPUCLK_SHIFT 20
30#define SYSTEM_CONFIG_CPUCLK_MASK 0x3
31#define SYSTEM_CONFIG_CPUCLK_250 0x0
32#define SYSTEM_CONFIG_CPUCLK_266 0x1
33#define SYSTEM_CONFIG_CPUCLK_280 0x2
34#define SYSTEM_CONFIG_CPUCLK_300 0x3
35
36#define RT2880_GPIO_MODE_I2C BIT(0)
37#define RT2880_GPIO_MODE_UART0 BIT(1)
38#define RT2880_GPIO_MODE_SPI BIT(2)
39#define RT2880_GPIO_MODE_UART1 BIT(3)
40#define RT2880_GPIO_MODE_JTAG BIT(4)
41#define RT2880_GPIO_MODE_MDIO BIT(5)
42#define RT2880_GPIO_MODE_SDRAM BIT(6)
43#define RT2880_GPIO_MODE_PCI BIT(7)
44
45#define CLKCFG_SRAM_CS_N_WDT BIT(9)
46
47#define RT2880_SDRAM_BASE 0x08000000
48#define RT2880_MEM_SIZE_MIN 2
49#define RT2880_MEM_SIZE_MAX 128
50
51#endif
diff --git a/arch/mips/include/asm/mach-ralink/rt288x/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ralink/rt288x/cpu-feature-overrides.h
new file mode 100644
index 000000000..fdaf8c918
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/rt288x/cpu-feature-overrides.h
@@ -0,0 +1,51 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Ralink RT288x specific CPU feature overrides
4 *
5 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 *
8 * This file was derived from: include/asm-mips/cpu-features.h
9 * Copyright (C) 2003, 2004 Ralf Baechle
10 * Copyright (C) 2004 Maciej W. Rozycki
11 */
12#ifndef _RT288X_CPU_FEATURE_OVERRIDES_H
13#define _RT288X_CPU_FEATURE_OVERRIDES_H
14
15#define cpu_has_tlb 1
16#define cpu_has_4kex 1
17#define cpu_has_3k_cache 0
18#define cpu_has_4k_cache 1
19#define cpu_has_tx39_cache 0
20#define cpu_has_sb1_cache 0
21#define cpu_has_fpu 0
22#define cpu_has_32fpr 0
23#define cpu_has_counter 1
24#define cpu_has_watch 1
25#define cpu_has_divec 1
26
27#define cpu_has_prefetch 1
28#define cpu_has_ejtag 1
29#define cpu_has_llsc 1
30
31#define cpu_has_mips16 1
32#define cpu_has_mdmx 0
33#define cpu_has_mips3d 0
34#define cpu_has_smartmips 0
35
36#define cpu_has_mips32r1 1
37#define cpu_has_mips32r2 1
38#define cpu_has_mips64r1 0
39#define cpu_has_mips64r2 0
40
41#define cpu_has_dsp 0
42#define cpu_has_mipsmt 0
43
44#define cpu_has_64bits 0
45#define cpu_has_64bit_zero_reg 0
46#define cpu_has_64bit_gp_regs 0
47
48#define cpu_dcache_line_size() 16
49#define cpu_icache_line_size() 16
50
51#endif /* _RT288X_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ralink/rt305x.h b/arch/mips/include/asm/mach-ralink/rt305x.h
new file mode 100644
index 000000000..b54619dc4
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/rt305x.h
@@ -0,0 +1,160 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *
4 * Parts of this file are based on Ralink's 2.6.21 BSP
5 *
6 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
7 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8 * Copyright (C) 2013 John Crispin <john@phrozen.org>
9 */
10
11#ifndef _RT305X_REGS_H_
12#define _RT305X_REGS_H_
13
14extern enum ralink_soc_type ralink_soc;
15
16static inline int soc_is_rt3050(void)
17{
18 return ralink_soc == RT305X_SOC_RT3050;
19}
20
21static inline int soc_is_rt3052(void)
22{
23 return ralink_soc == RT305X_SOC_RT3052;
24}
25
26static inline int soc_is_rt305x(void)
27{
28 return soc_is_rt3050() || soc_is_rt3052();
29}
30
31static inline int soc_is_rt3350(void)
32{
33 return ralink_soc == RT305X_SOC_RT3350;
34}
35
36static inline int soc_is_rt3352(void)
37{
38 return ralink_soc == RT305X_SOC_RT3352;
39}
40
41static inline int soc_is_rt5350(void)
42{
43 return ralink_soc == RT305X_SOC_RT5350;
44}
45
46#define RT305X_SYSC_BASE 0x10000000
47
48#define SYSC_REG_CHIP_NAME0 0x00
49#define SYSC_REG_CHIP_NAME1 0x04
50#define SYSC_REG_CHIP_ID 0x0c
51#define SYSC_REG_SYSTEM_CONFIG 0x10
52
53#define RT3052_CHIP_NAME0 0x30335452
54#define RT3052_CHIP_NAME1 0x20203235
55
56#define RT3350_CHIP_NAME0 0x33335452
57#define RT3350_CHIP_NAME1 0x20203035
58
59#define RT3352_CHIP_NAME0 0x33335452
60#define RT3352_CHIP_NAME1 0x20203235
61
62#define RT5350_CHIP_NAME0 0x33355452
63#define RT5350_CHIP_NAME1 0x20203035
64
65#define CHIP_ID_ID_MASK 0xff
66#define CHIP_ID_ID_SHIFT 8
67#define CHIP_ID_REV_MASK 0xff
68
69#define RT305X_SYSCFG_CPUCLK_SHIFT 18
70#define RT305X_SYSCFG_CPUCLK_MASK 0x1
71#define RT305X_SYSCFG_CPUCLK_LOW 0x0
72#define RT305X_SYSCFG_CPUCLK_HIGH 0x1
73
74#define RT305X_SYSCFG_SRAM_CS0_MODE_SHIFT 2
75#define RT305X_SYSCFG_CPUCLK_MASK 0x1
76#define RT305X_SYSCFG_SRAM_CS0_MODE_WDT 0x1
77
78#define RT3352_SYSCFG0_CPUCLK_SHIFT 8
79#define RT3352_SYSCFG0_CPUCLK_MASK 0x1
80#define RT3352_SYSCFG0_CPUCLK_LOW 0x0
81#define RT3352_SYSCFG0_CPUCLK_HIGH 0x1
82
83#define RT5350_SYSCFG0_CPUCLK_SHIFT 8
84#define RT5350_SYSCFG0_CPUCLK_MASK 0x3
85#define RT5350_SYSCFG0_CPUCLK_360 0x0
86#define RT5350_SYSCFG0_CPUCLK_320 0x2
87#define RT5350_SYSCFG0_CPUCLK_300 0x3
88
89#define RT5350_SYSCFG0_DRAM_SIZE_SHIFT 12
90#define RT5350_SYSCFG0_DRAM_SIZE_MASK 7
91#define RT5350_SYSCFG0_DRAM_SIZE_2M 0
92#define RT5350_SYSCFG0_DRAM_SIZE_8M 1
93#define RT5350_SYSCFG0_DRAM_SIZE_16M 2
94#define RT5350_SYSCFG0_DRAM_SIZE_32M 3
95#define RT5350_SYSCFG0_DRAM_SIZE_64M 4
96
97/* multi function gpio pins */
98#define RT305X_GPIO_I2C_SD 1
99#define RT305X_GPIO_I2C_SCLK 2
100#define RT305X_GPIO_SPI_EN 3
101#define RT305X_GPIO_SPI_CLK 4
102/* GPIO 7-14 is shared between UART0, PCM and I2S interfaces */
103#define RT305X_GPIO_7 7
104#define RT305X_GPIO_10 10
105#define RT305X_GPIO_14 14
106#define RT305X_GPIO_UART1_TXD 15
107#define RT305X_GPIO_UART1_RXD 16
108#define RT305X_GPIO_JTAG_TDO 17
109#define RT305X_GPIO_JTAG_TDI 18
110#define RT305X_GPIO_MDIO_MDC 22
111#define RT305X_GPIO_MDIO_MDIO 23
112#define RT305X_GPIO_SDRAM_MD16 24
113#define RT305X_GPIO_SDRAM_MD31 39
114#define RT305X_GPIO_GE0_TXD0 40
115#define RT305X_GPIO_GE0_RXCLK 51
116
117#define RT305X_GPIO_MODE_UART0_SHIFT 2
118#define RT305X_GPIO_MODE_UART0_MASK 0x7
119#define RT305X_GPIO_MODE_UART0(x) ((x) << RT305X_GPIO_MODE_UART0_SHIFT)
120#define RT305X_GPIO_MODE_UARTF 0
121#define RT305X_GPIO_MODE_PCM_UARTF 1
122#define RT305X_GPIO_MODE_PCM_I2S 2
123#define RT305X_GPIO_MODE_I2S_UARTF 3
124#define RT305X_GPIO_MODE_PCM_GPIO 4
125#define RT305X_GPIO_MODE_GPIO_UARTF 5
126#define RT305X_GPIO_MODE_GPIO_I2S 6
127#define RT305X_GPIO_MODE_GPIO 7
128
129#define RT305X_GPIO_MODE_I2C 0
130#define RT305X_GPIO_MODE_SPI 1
131#define RT305X_GPIO_MODE_UART1 5
132#define RT305X_GPIO_MODE_JTAG 6
133#define RT305X_GPIO_MODE_MDIO 7
134#define RT305X_GPIO_MODE_SDRAM 8
135#define RT305X_GPIO_MODE_RGMII 9
136#define RT5350_GPIO_MODE_PHY_LED 14
137#define RT5350_GPIO_MODE_SPI_CS1 21
138#define RT3352_GPIO_MODE_LNA 18
139#define RT3352_GPIO_MODE_PA 20
140
141#define RT3352_SYSC_REG_SYSCFG0 0x010
142#define RT3352_SYSC_REG_SYSCFG1 0x014
143#define RT3352_SYSC_REG_CLKCFG1 0x030
144#define RT3352_SYSC_REG_RSTCTRL 0x034
145#define RT3352_SYSC_REG_USB_PS 0x05c
146
147#define RT3352_CLKCFG0_XTAL_SEL BIT(20)
148#define RT3352_CLKCFG1_UPHY0_CLK_EN BIT(18)
149#define RT3352_CLKCFG1_UPHY1_CLK_EN BIT(20)
150#define RT3352_RSTCTRL_UHST BIT(22)
151#define RT3352_RSTCTRL_UDEV BIT(25)
152#define RT3352_SYSCFG1_USB0_HOST_MODE BIT(10)
153
154#define RT305X_SDRAM_BASE 0x00000000
155#define RT305X_MEM_SIZE_MIN 2
156#define RT305X_MEM_SIZE_MAX 64
157#define RT3352_MEM_SIZE_MIN 2
158#define RT3352_MEM_SIZE_MAX 256
159
160#endif
diff --git a/arch/mips/include/asm/mach-ralink/rt305x/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ralink/rt305x/cpu-feature-overrides.h
new file mode 100644
index 000000000..7a385fe78
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/rt305x/cpu-feature-overrides.h
@@ -0,0 +1,51 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Ralink RT305x specific CPU feature overrides
4 *
5 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 *
8 * This file was derived from: include/asm-mips/cpu-features.h
9 * Copyright (C) 2003, 2004 Ralf Baechle
10 * Copyright (C) 2004 Maciej W. Rozycki
11 */
12#ifndef _RT305X_CPU_FEATURE_OVERRIDES_H
13#define _RT305X_CPU_FEATURE_OVERRIDES_H
14
15#define cpu_has_tlb 1
16#define cpu_has_4kex 1
17#define cpu_has_3k_cache 0
18#define cpu_has_4k_cache 1
19#define cpu_has_tx39_cache 0
20#define cpu_has_sb1_cache 0
21#define cpu_has_fpu 0
22#define cpu_has_32fpr 0
23#define cpu_has_counter 1
24#define cpu_has_watch 1
25#define cpu_has_divec 1
26
27#define cpu_has_prefetch 1
28#define cpu_has_ejtag 1
29#define cpu_has_llsc 1
30
31#define cpu_has_mips16 1
32#define cpu_has_mdmx 0
33#define cpu_has_mips3d 0
34#define cpu_has_smartmips 0
35
36#define cpu_has_mips32r1 1
37#define cpu_has_mips32r2 1
38#define cpu_has_mips64r1 0
39#define cpu_has_mips64r2 0
40
41#define cpu_has_dsp 1
42#define cpu_has_mipsmt 0
43
44#define cpu_has_64bits 0
45#define cpu_has_64bit_zero_reg 0
46#define cpu_has_64bit_gp_regs 0
47
48#define cpu_dcache_line_size() 32
49#define cpu_icache_line_size() 32
50
51#endif /* _RT305X_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-ralink/rt3883.h b/arch/mips/include/asm/mach-ralink/rt3883.h
new file mode 100644
index 000000000..565f25484
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/rt3883.h
@@ -0,0 +1,251 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Ralink RT3662/RT3883 SoC register definitions
4 *
5 * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
6 */
7
8#ifndef _RT3883_REGS_H_
9#define _RT3883_REGS_H_
10
11#include <linux/bitops.h>
12
13#define RT3883_SDRAM_BASE 0x00000000
14#define RT3883_SYSC_BASE 0x10000000
15#define RT3883_TIMER_BASE 0x10000100
16#define RT3883_INTC_BASE 0x10000200
17#define RT3883_MEMC_BASE 0x10000300
18#define RT3883_UART0_BASE 0x10000500
19#define RT3883_PIO_BASE 0x10000600
20#define RT3883_FSCC_BASE 0x10000700
21#define RT3883_NANDC_BASE 0x10000810
22#define RT3883_I2C_BASE 0x10000900
23#define RT3883_I2S_BASE 0x10000a00
24#define RT3883_SPI_BASE 0x10000b00
25#define RT3883_UART1_BASE 0x10000c00
26#define RT3883_PCM_BASE 0x10002000
27#define RT3883_GDMA_BASE 0x10002800
28#define RT3883_CODEC1_BASE 0x10003000
29#define RT3883_CODEC2_BASE 0x10003800
30#define RT3883_FE_BASE 0x10100000
31#define RT3883_ROM_BASE 0x10118000
32#define RT3883_USBDEV_BASE 0x10112000
33#define RT3883_PCI_BASE 0x10140000
34#define RT3883_WLAN_BASE 0x10180000
35#define RT3883_USBHOST_BASE 0x101c0000
36#define RT3883_BOOT_BASE 0x1c000000
37#define RT3883_SRAM_BASE 0x1e000000
38#define RT3883_PCIMEM_BASE 0x20000000
39
40#define RT3883_EHCI_BASE (RT3883_USBHOST_BASE)
41#define RT3883_OHCI_BASE (RT3883_USBHOST_BASE + 0x1000)
42
43#define RT3883_SYSC_SIZE 0x100
44#define RT3883_TIMER_SIZE 0x100
45#define RT3883_INTC_SIZE 0x100
46#define RT3883_MEMC_SIZE 0x100
47#define RT3883_UART0_SIZE 0x100
48#define RT3883_UART1_SIZE 0x100
49#define RT3883_PIO_SIZE 0x100
50#define RT3883_FSCC_SIZE 0x100
51#define RT3883_NANDC_SIZE 0x0f0
52#define RT3883_I2C_SIZE 0x100
53#define RT3883_I2S_SIZE 0x100
54#define RT3883_SPI_SIZE 0x100
55#define RT3883_PCM_SIZE 0x800
56#define RT3883_GDMA_SIZE 0x800
57#define RT3883_CODEC1_SIZE 0x800
58#define RT3883_CODEC2_SIZE 0x800
59#define RT3883_FE_SIZE 0x10000
60#define RT3883_ROM_SIZE 0x4000
61#define RT3883_USBDEV_SIZE 0x4000
62#define RT3883_PCI_SIZE 0x40000
63#define RT3883_WLAN_SIZE 0x40000
64#define RT3883_USBHOST_SIZE 0x40000
65#define RT3883_BOOT_SIZE (32 * 1024 * 1024)
66#define RT3883_SRAM_SIZE (32 * 1024 * 1024)
67
68/* SYSC registers */
69#define RT3883_SYSC_REG_CHIPID0_3 0x00 /* Chip ID 0 */
70#define RT3883_SYSC_REG_CHIPID4_7 0x04 /* Chip ID 1 */
71#define RT3883_SYSC_REG_REVID 0x0c /* Chip Revision Identification */
72#define RT3883_SYSC_REG_SYSCFG0 0x10 /* System Configuration 0 */
73#define RT3883_SYSC_REG_SYSCFG1 0x14 /* System Configuration 1 */
74#define RT3883_SYSC_REG_CLKCFG0 0x2c /* Clock Configuration 0 */
75#define RT3883_SYSC_REG_CLKCFG1 0x30 /* Clock Configuration 1 */
76#define RT3883_SYSC_REG_RSTCTRL 0x34 /* Reset Control*/
77#define RT3883_SYSC_REG_RSTSTAT 0x38 /* Reset Status*/
78#define RT3883_SYSC_REG_USB_PS 0x5c /* USB Power saving control */
79#define RT3883_SYSC_REG_GPIO_MODE 0x60 /* GPIO Purpose Select */
80#define RT3883_SYSC_REG_PCIE_CLK_GEN0 0x7c
81#define RT3883_SYSC_REG_PCIE_CLK_GEN1 0x80
82#define RT3883_SYSC_REG_PCIE_CLK_GEN2 0x84
83#define RT3883_SYSC_REG_PMU 0x88
84#define RT3883_SYSC_REG_PMU1 0x8c
85
86#define RT3883_CHIP_NAME0 0x38335452
87#define RT3883_CHIP_NAME1 0x20203338
88
89#define RT3883_REVID_VER_ID_MASK 0x0f
90#define RT3883_REVID_VER_ID_SHIFT 8
91#define RT3883_REVID_ECO_ID_MASK 0x0f
92
93#define RT3883_SYSCFG0_DRAM_TYPE_DDR2 BIT(17)
94#define RT3883_SYSCFG0_CPUCLK_SHIFT 8
95#define RT3883_SYSCFG0_CPUCLK_MASK 0x3
96#define RT3883_SYSCFG0_CPUCLK_250 0x0
97#define RT3883_SYSCFG0_CPUCLK_384 0x1
98#define RT3883_SYSCFG0_CPUCLK_480 0x2
99#define RT3883_SYSCFG0_CPUCLK_500 0x3
100
101#define RT3883_SYSCFG1_USB0_HOST_MODE BIT(10)
102#define RT3883_SYSCFG1_PCIE_RC_MODE BIT(8)
103#define RT3883_SYSCFG1_PCI_HOST_MODE BIT(7)
104#define RT3883_SYSCFG1_PCI_66M_MODE BIT(6)
105#define RT3883_SYSCFG1_GPIO2_AS_WDT_OUT BIT(2)
106
107#define RT3883_CLKCFG1_PCIE_CLK_EN BIT(21)
108#define RT3883_CLKCFG1_UPHY1_CLK_EN BIT(20)
109#define RT3883_CLKCFG1_PCI_CLK_EN BIT(19)
110#define RT3883_CLKCFG1_UPHY0_CLK_EN BIT(18)
111
112#define RT3883_GPIO_MODE_UART0_SHIFT 2
113#define RT3883_GPIO_MODE_UART0_MASK 0x7
114#define RT3883_GPIO_MODE_UART0(x) ((x) << RT3883_GPIO_MODE_UART0_SHIFT)
115#define RT3883_GPIO_MODE_UARTF 0x0
116#define RT3883_GPIO_MODE_PCM_UARTF 0x1
117#define RT3883_GPIO_MODE_PCM_I2S 0x2
118#define RT3883_GPIO_MODE_I2S_UARTF 0x3
119#define RT3883_GPIO_MODE_PCM_GPIO 0x4
120#define RT3883_GPIO_MODE_GPIO_UARTF 0x5
121#define RT3883_GPIO_MODE_GPIO_I2S 0x6
122#define RT3883_GPIO_MODE_GPIO 0x7
123
124#define RT3883_GPIO_MODE_I2C 0
125#define RT3883_GPIO_MODE_SPI 1
126#define RT3883_GPIO_MODE_UART1 5
127#define RT3883_GPIO_MODE_JTAG 6
128#define RT3883_GPIO_MODE_MDIO 7
129#define RT3883_GPIO_MODE_GE1 9
130#define RT3883_GPIO_MODE_GE2 10
131
132#define RT3883_GPIO_MODE_PCI_SHIFT 11
133#define RT3883_GPIO_MODE_PCI_MASK 0x7
134#define RT3883_GPIO_MODE_PCI (RT3883_GPIO_MODE_PCI_MASK << RT3883_GPIO_MODE_PCI_SHIFT)
135#define RT3883_GPIO_MODE_LNA_A_SHIFT 16
136#define RT3883_GPIO_MODE_LNA_A_MASK 0x3
137#define _RT3883_GPIO_MODE_LNA_A(_x) ((_x) << RT3883_GPIO_MODE_LNA_A_SHIFT)
138#define RT3883_GPIO_MODE_LNA_A_GPIO 0x3
139#define RT3883_GPIO_MODE_LNA_A _RT3883_GPIO_MODE_LNA_A(RT3883_GPIO_MODE_LNA_A_MASK)
140#define RT3883_GPIO_MODE_LNA_G_SHIFT 18
141#define RT3883_GPIO_MODE_LNA_G_MASK 0x3
142#define _RT3883_GPIO_MODE_LNA_G(_x) ((_x) << RT3883_GPIO_MODE_LNA_G_SHIFT)
143#define RT3883_GPIO_MODE_LNA_G_GPIO 0x3
144#define RT3883_GPIO_MODE_LNA_G _RT3883_GPIO_MODE_LNA_G(RT3883_GPIO_MODE_LNA_G_MASK)
145
146#define RT3883_GPIO_I2C_SD 1
147#define RT3883_GPIO_I2C_SCLK 2
148#define RT3883_GPIO_SPI_CS0 3
149#define RT3883_GPIO_SPI_CLK 4
150#define RT3883_GPIO_SPI_MOSI 5
151#define RT3883_GPIO_SPI_MISO 6
152#define RT3883_GPIO_7 7
153#define RT3883_GPIO_10 10
154#define RT3883_GPIO_11 11
155#define RT3883_GPIO_14 14
156#define RT3883_GPIO_UART1_TXD 15
157#define RT3883_GPIO_UART1_RXD 16
158#define RT3883_GPIO_JTAG_TDO 17
159#define RT3883_GPIO_JTAG_TDI 18
160#define RT3883_GPIO_JTAG_TMS 19
161#define RT3883_GPIO_JTAG_TCLK 20
162#define RT3883_GPIO_JTAG_TRST_N 21
163#define RT3883_GPIO_MDIO_MDC 22
164#define RT3883_GPIO_MDIO_MDIO 23
165#define RT3883_GPIO_LNA_PE_A0 32
166#define RT3883_GPIO_LNA_PE_A1 33
167#define RT3883_GPIO_LNA_PE_A2 34
168#define RT3883_GPIO_LNA_PE_G0 35
169#define RT3883_GPIO_LNA_PE_G1 36
170#define RT3883_GPIO_LNA_PE_G2 37
171#define RT3883_GPIO_PCI_AD0 40
172#define RT3883_GPIO_PCI_AD31 71
173#define RT3883_GPIO_GE2_TXD0 72
174#define RT3883_GPIO_GE2_TXD1 73
175#define RT3883_GPIO_GE2_TXD2 74
176#define RT3883_GPIO_GE2_TXD3 75
177#define RT3883_GPIO_GE2_TXEN 76
178#define RT3883_GPIO_GE2_TXCLK 77
179#define RT3883_GPIO_GE2_RXD0 78
180#define RT3883_GPIO_GE2_RXD1 79
181#define RT3883_GPIO_GE2_RXD2 80
182#define RT3883_GPIO_GE2_RXD3 81
183#define RT3883_GPIO_GE2_RXDV 82
184#define RT3883_GPIO_GE2_RXCLK 83
185#define RT3883_GPIO_GE1_TXD0 84
186#define RT3883_GPIO_GE1_TXD1 85
187#define RT3883_GPIO_GE1_TXD2 86
188#define RT3883_GPIO_GE1_TXD3 87
189#define RT3883_GPIO_GE1_TXEN 88
190#define RT3883_GPIO_GE1_TXCLK 89
191#define RT3883_GPIO_GE1_RXD0 90
192#define RT3883_GPIO_GE1_RXD1 91
193#define RT3883_GPIO_GE1_RXD2 92
194#define RT3883_GPIO_GE1_RXD3 93
195#define RT3883_GPIO_GE1_RXDV 94
196#define RT3883_GPIO_GE1_RXCLK 95
197
198#define RT3883_RSTCTRL_PCIE_PCI_PDM BIT(27)
199#define RT3883_RSTCTRL_FLASH BIT(26)
200#define RT3883_RSTCTRL_UDEV BIT(25)
201#define RT3883_RSTCTRL_PCI BIT(24)
202#define RT3883_RSTCTRL_PCIE BIT(23)
203#define RT3883_RSTCTRL_UHST BIT(22)
204#define RT3883_RSTCTRL_FE BIT(21)
205#define RT3883_RSTCTRL_WLAN BIT(20)
206#define RT3883_RSTCTRL_UART1 BIT(29)
207#define RT3883_RSTCTRL_SPI BIT(18)
208#define RT3883_RSTCTRL_I2S BIT(17)
209#define RT3883_RSTCTRL_I2C BIT(16)
210#define RT3883_RSTCTRL_NAND BIT(15)
211#define RT3883_RSTCTRL_DMA BIT(14)
212#define RT3883_RSTCTRL_PIO BIT(13)
213#define RT3883_RSTCTRL_UART BIT(12)
214#define RT3883_RSTCTRL_PCM BIT(11)
215#define RT3883_RSTCTRL_MC BIT(10)
216#define RT3883_RSTCTRL_INTC BIT(9)
217#define RT3883_RSTCTRL_TIMER BIT(8)
218#define RT3883_RSTCTRL_SYS BIT(0)
219
220#define RT3883_INTC_INT_SYSCTL BIT(0)
221#define RT3883_INTC_INT_TIMER0 BIT(1)
222#define RT3883_INTC_INT_TIMER1 BIT(2)
223#define RT3883_INTC_INT_IA BIT(3)
224#define RT3883_INTC_INT_PCM BIT(4)
225#define RT3883_INTC_INT_UART0 BIT(5)
226#define RT3883_INTC_INT_PIO BIT(6)
227#define RT3883_INTC_INT_DMA BIT(7)
228#define RT3883_INTC_INT_NAND BIT(8)
229#define RT3883_INTC_INT_PERFC BIT(9)
230#define RT3883_INTC_INT_I2S BIT(10)
231#define RT3883_INTC_INT_UART1 BIT(12)
232#define RT3883_INTC_INT_UHST BIT(18)
233#define RT3883_INTC_INT_UDEV BIT(19)
234
235/* FLASH/SRAM/Codec Controller registers */
236#define RT3883_FSCC_REG_FLASH_CFG0 0x00
237#define RT3883_FSCC_REG_FLASH_CFG1 0x04
238#define RT3883_FSCC_REG_CODEC_CFG0 0x40
239#define RT3883_FSCC_REG_CODEC_CFG1 0x44
240
241#define RT3883_FLASH_CFG_WIDTH_SHIFT 26
242#define RT3883_FLASH_CFG_WIDTH_MASK 0x3
243#define RT3883_FLASH_CFG_WIDTH_8BIT 0x0
244#define RT3883_FLASH_CFG_WIDTH_16BIT 0x1
245#define RT3883_FLASH_CFG_WIDTH_32BIT 0x2
246
247#define RT3883_SDRAM_BASE 0x00000000
248#define RT3883_MEM_SIZE_MIN 2
249#define RT3883_MEM_SIZE_MAX 256
250
251#endif /* _RT3883_REGS_H_ */
diff --git a/arch/mips/include/asm/mach-ralink/rt3883/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ralink/rt3883/cpu-feature-overrides.h
new file mode 100644
index 000000000..0a61910f6
--- /dev/null
+++ b/arch/mips/include/asm/mach-ralink/rt3883/cpu-feature-overrides.h
@@ -0,0 +1,50 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Ralink RT3662/RT3883 specific CPU feature overrides
4 *
5 * Copyright (C) 2011-2013 Gabor Juhos <juhosg@openwrt.org>
6 *
7 * This file was derived from: include/asm-mips/cpu-features.h
8 * Copyright (C) 2003, 2004 Ralf Baechle
9 * Copyright (C) 2004 Maciej W. Rozycki
10 */
11#ifndef _RT3883_CPU_FEATURE_OVERRIDES_H
12#define _RT3883_CPU_FEATURE_OVERRIDES_H
13
14#define cpu_has_tlb 1
15#define cpu_has_4kex 1
16#define cpu_has_3k_cache 0
17#define cpu_has_4k_cache 1
18#define cpu_has_tx39_cache 0
19#define cpu_has_sb1_cache 0
20#define cpu_has_fpu 0
21#define cpu_has_32fpr 0
22#define cpu_has_counter 1
23#define cpu_has_watch 1
24#define cpu_has_divec 1
25
26#define cpu_has_prefetch 1
27#define cpu_has_ejtag 1
28#define cpu_has_llsc 1
29
30#define cpu_has_mips16 1
31#define cpu_has_mdmx 0
32#define cpu_has_mips3d 0
33#define cpu_has_smartmips 0
34
35#define cpu_has_mips32r1 1
36#define cpu_has_mips32r2 1
37#define cpu_has_mips64r1 0
38#define cpu_has_mips64r2 0
39
40#define cpu_has_dsp 1
41#define cpu_has_mipsmt 0
42
43#define cpu_has_64bits 0
44#define cpu_has_64bit_zero_reg 0
45#define cpu_has_64bit_gp_regs 0
46
47#define cpu_dcache_line_size() 32
48#define cpu_icache_line_size() 32
49
50#endif /* _RT3883_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-rc32434/cpu-feature-overrides.h b/arch/mips/include/asm/mach-rc32434/cpu-feature-overrides.h
new file mode 100644
index 000000000..8539ccfb6
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/cpu-feature-overrides.h
@@ -0,0 +1,63 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * IDT RC32434 specific CPU feature overrides
4 *
5 * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This file was derived from: include/asm-mips/cpu-features.h
8 * Copyright (C) 2003, 2004 Ralf Baechle
9 * Copyright (C) 2004 Maciej W. Rozycki
10 */
11#ifndef __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H
12#define __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H
13
14/*
15 * The IDT RC32434 SOC has a built-in MIPS 4Kc core.
16 */
17#define cpu_has_tlb 1
18#define cpu_has_4kex 1
19#define cpu_has_3k_cache 0
20#define cpu_has_4k_cache 1
21#define cpu_has_tx39_cache 0
22#define cpu_has_sb1_cache 0
23#define cpu_has_fpu 0
24#define cpu_has_32fpr 0
25#define cpu_has_counter 1
26#define cpu_has_watch 1
27#define cpu_has_divec 1
28#define cpu_has_vce 0
29#define cpu_has_cache_cdex_p 0
30#define cpu_has_cache_cdex_s 0
31#define cpu_has_prefetch 1
32#define cpu_has_mcheck 1
33#define cpu_has_ejtag 1
34#define cpu_has_llsc 1
35
36#define cpu_has_mips16 0
37#define cpu_has_mips16e2 0
38#define cpu_has_mdmx 0
39#define cpu_has_mips3d 0
40#define cpu_has_smartmips 0
41
42#define cpu_has_vtag_icache 0
43
44#define cpu_has_mips32r1 1
45#define cpu_has_mips32r2 0
46#define cpu_has_mips64r1 0
47#define cpu_has_mips64r2 0
48
49#define cpu_has_dsp 0
50#define cpu_has_dsp2 0
51#define cpu_has_mipsmt 0
52
53/* #define cpu_has_nofpuex ? */
54#define cpu_has_64bits 0
55#define cpu_has_64bit_zero_reg 0
56#define cpu_has_64bit_gp_regs 0
57
58#define cpu_has_inclusive_pcaches 0
59
60#define cpu_dcache_line_size() 16
61#define cpu_icache_line_size() 16
62
63#endif /* __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-rc32434/ddr.h b/arch/mips/include/asm/mach-rc32434/ddr.h
new file mode 100644
index 000000000..e1cad0c7f
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/ddr.h
@@ -0,0 +1,141 @@
1/*
2 * Definitions for the DDR registers
3 *
4 * Copyright 2002 Ryan Holm <ryan.holmQVist@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * 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. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * 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 */
28
29#ifndef _ASM_RC32434_DDR_H_
30#define _ASM_RC32434_DDR_H_
31
32#include <asm/mach-rc32434/rb.h>
33
34/* DDR register structure */
35struct ddr_ram {
36 u32 ddrbase;
37 u32 ddrmask;
38 u32 res1;
39 u32 res2;
40 u32 ddrc;
41 u32 ddrabase;
42 u32 ddramask;
43 u32 ddramap;
44 u32 ddrcust;
45 u32 ddrrdc;
46 u32 ddrspare;
47};
48
49#define DDR0_PHYS_ADDR 0x18018000
50
51/* DDR banks masks */
52#define DDR_MASK 0xffff0000
53#define DDR0_BASE_MSK DDR_MASK
54#define DDR1_BASE_MSK DDR_MASK
55
56/* DDR bank0 registers */
57#define RC32434_DDR0_ATA_BIT 5
58#define RC32434_DDR0_ATA_MSK 0x000000E0
59#define RC32434_DDR0_DBW_BIT 8
60#define RC32434_DDR0_DBW_MSK 0x00000100
61#define RC32434_DDR0_WR_BIT 9
62#define RC32434_DDR0_WR_MSK 0x00000600
63#define RC32434_DDR0_PS_BIT 11
64#define RC32434_DDR0_PS_MSK 0x00001800
65#define RC32434_DDR0_DTYPE_BIT 13
66#define RC32434_DDR0_DTYPE_MSK 0x0000e000
67#define RC32434_DDR0_RFC_BIT 16
68#define RC32434_DDR0_RFC_MSK 0x000f0000
69#define RC32434_DDR0_RP_BIT 20
70#define RC32434_DDR0_RP_MSK 0x00300000
71#define RC32434_DDR0_AP_BIT 22
72#define RC32434_DDR0_AP_MSK 0x00400000
73#define RC32434_DDR0_RCD_BIT 23
74#define RC32434_DDR0_RCD_MSK 0x01800000
75#define RC32434_DDR0_CL_BIT 25
76#define RC32434_DDR0_CL_MSK 0x06000000
77#define RC32434_DDR0_DBM_BIT 27
78#define RC32434_DDR0_DBM_MSK 0x08000000
79#define RC32434_DDR0_SDS_BIT 28
80#define RC32434_DDR0_SDS_MSK 0x10000000
81#define RC32434_DDR0_ATP_BIT 29
82#define RC32434_DDR0_ATP_MSK 0x60000000
83#define RC32434_DDR0_RE_BIT 31
84#define RC32434_DDR0_RE_MSK 0x80000000
85
86/* DDR bank C registers */
87#define RC32434_DDRC_MSK(x) BIT_TO_MASK(x)
88#define RC32434_DDRC_CES_BIT 0
89#define RC32434_DDRC_ACE_BIT 1
90
91/* Custom DDR bank registers */
92#define RC32434_DCST_MSK(x) BIT_TO_MASK(x)
93#define RC32434_DCST_CS_BIT 0
94#define RC32434_DCST_CS_MSK 0x00000003
95#define RC32434_DCST_WE_BIT 2
96#define RC32434_DCST_RAS_BIT 3
97#define RC32434_DCST_CAS_BIT 4
98#define RC32434_DSCT_CKE_BIT 5
99#define RC32434_DSCT_BA_BIT 6
100#define RC32434_DSCT_BA_MSK 0x000000c0
101
102/* DDR QSC registers */
103#define RC32434_QSC_DM_BIT 0
104#define RC32434_QSC_DM_MSK 0x00000003
105#define RC32434_QSC_DQSBS_BIT 2
106#define RC32434_QSC_DQSBS_MSK 0x000000fc
107#define RC32434_QSC_DB_BIT 8
108#define RC32434_QSC_DB_MSK 0x00000100
109#define RC32434_QSC_DBSP_BIT 9
110#define RC32434_QSC_DBSP_MSK 0x01fffe00
111#define RC32434_QSC_BDP_BIT 25
112#define RC32434_QSC_BDP_MSK 0x7e000000
113
114/* DDR LLC registers */
115#define RC32434_LLC_EAO_BIT 0
116#define RC32434_LLC_EAO_MSK 0x00000001
117#define RC32434_LLC_EO_BIT 1
118#define RC32434_LLC_EO_MSK 0x0000003e
119#define RC32434_LLC_FS_BIT 6
120#define RC32434_LLC_FS_MSK 0x000000c0
121#define RC32434_LLC_AS_BIT 8
122#define RC32434_LLC_AS_MSK 0x00000700
123#define RC32434_LLC_SP_BIT 11
124#define RC32434_LLC_SP_MSK 0x001ff800
125
126/* DDR LLFC registers */
127#define RC32434_LLFC_MSK(x) BIT_TO_MASK(x)
128#define RC32434_LLFC_MEN_BIT 0
129#define RC32434_LLFC_EAN_BIT 1
130#define RC32434_LLFC_FF_BIT 2
131
132/* DDR DLLTA registers */
133#define RC32434_DLLTA_ADDR_BIT 2
134#define RC32434_DLLTA_ADDR_MSK 0xfffffffc
135
136/* DDR DLLED registers */
137#define RC32434_DLLED_MSK(x) BIT_TO_MASK(x)
138#define RC32434_DLLED_DBE_BIT 0
139#define RC32434_DLLED_DTE_BIT 1
140
141#endif /* _ASM_RC32434_DDR_H_ */
diff --git a/arch/mips/include/asm/mach-rc32434/dma.h b/arch/mips/include/asm/mach-rc32434/dma.h
new file mode 100644
index 000000000..44dc87bb8
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/dma.h
@@ -0,0 +1,104 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright 2002 Integrated Device Technology, Inc.
4 * All rights reserved.
5 *
6 * DMA register definition.
7 *
8 * Author : ryan.holmQVist@idt.com
9 * Date : 20011005
10 */
11
12#ifndef __ASM_RC32434_DMA_H
13#define __ASM_RC32434_DMA_H
14
15#include <asm/mach-rc32434/rb.h>
16
17#define DMA0_BASE_ADDR 0x18040000
18
19/*
20 * DMA descriptor (in physical memory).
21 */
22
23struct dma_desc {
24 u32 control; /* Control. use DMAD_* */
25 u32 ca; /* Current Address. */
26 u32 devcs; /* Device control and status. */
27 u32 link; /* Next descriptor in chain. */
28};
29
30#define DMA_DESC_SIZ sizeof(struct dma_desc)
31#define DMA_DESC_COUNT_BIT 0
32#define DMA_DESC_COUNT_MSK 0x0003ffff
33#define DMA_DESC_DS_BIT 20
34#define DMA_DESC_DS_MSK 0x00300000
35
36#define DMA_DESC_DEV_CMD_BIT 22
37#define DMA_DESC_DEV_CMD_MSK 0x01c00000
38
39/* DMA command sizes */
40#define DMA_DESC_DEV_CMD_BYTE 0
41#define DMA_DESC_DEV_CMD_HLF_WD 1
42#define DMA_DESC_DEV_CMD_WORD 2
43#define DMA_DESC_DEV_CMD_2WORDS 3
44#define DMA_DESC_DEV_CMD_4WORDS 4
45#define DMA_DESC_DEV_CMD_6WORDS 5
46#define DMA_DESC_DEV_CMD_8WORDS 6
47#define DMA_DESC_DEV_CMD_16WORDS 7
48
49/* DMA descriptors interrupts */
50#define DMA_DESC_COF (1 << 25) /* Chain on finished */
51#define DMA_DESC_COD (1 << 26) /* Chain on done */
52#define DMA_DESC_IOF (1 << 27) /* Interrupt on finished */
53#define DMA_DESC_IOD (1 << 28) /* Interrupt on done */
54#define DMA_DESC_TERM (1 << 29) /* Terminated */
55#define DMA_DESC_DONE (1 << 30) /* Done */
56#define DMA_DESC_FINI (1 << 31) /* Finished */
57
58/*
59 * DMA register (within Internal Register Map).
60 */
61
62struct dma_reg {
63 u32 dmac; /* Control. */
64 u32 dmas; /* Status. */
65 u32 dmasm; /* Mask. */
66 u32 dmadptr; /* Descriptor pointer. */
67 u32 dmandptr; /* Next descriptor pointer. */
68};
69
70/* DMA channels specific registers */
71#define DMA_CHAN_RUN_BIT (1 << 0)
72#define DMA_CHAN_DONE_BIT (1 << 1)
73#define DMA_CHAN_MODE_BIT (1 << 2)
74#define DMA_CHAN_MODE_MSK 0x0000000c
75#define DMA_CHAN_MODE_AUTO 0
76#define DMA_CHAN_MODE_BURST 1
77#define DMA_CHAN_MODE_XFRT 2
78#define DMA_CHAN_MODE_RSVD 3
79#define DMA_CHAN_ACT_BIT (1 << 4)
80
81/* DMA status registers */
82#define DMA_STAT_FINI (1 << 0)
83#define DMA_STAT_DONE (1 << 1)
84#define DMA_STAT_CHAIN (1 << 2)
85#define DMA_STAT_ERR (1 << 3)
86#define DMA_STAT_HALT (1 << 4)
87
88/*
89 * DMA channel definitions
90 */
91
92#define DMA_CHAN_ETH_RCV 0
93#define DMA_CHAN_ETH_XMT 1
94#define DMA_CHAN_MEM_TO_FIFO 2
95#define DMA_CHAN_FIFO_TO_MEM 3
96#define DMA_CHAN_PCI_TO_MEM 4
97#define DMA_CHAN_MEM_TO_PCI 5
98#define DMA_CHAN_COUNT 6
99
100struct dma_channel {
101 struct dma_reg ch[DMA_CHAN_COUNT];
102};
103
104#endif /* __ASM_RC32434_DMA_H */
diff --git a/arch/mips/include/asm/mach-rc32434/dma_v.h b/arch/mips/include/asm/mach-rc32434/dma_v.h
new file mode 100644
index 000000000..37d73b987
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/dma_v.h
@@ -0,0 +1,53 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright 2002 Integrated Device Technology, Inc.
4 * All rights reserved.
5 *
6 * DMA register definition.
7 *
8 * Author : ryan.holmQVist@idt.com
9 * Date : 20011005
10 */
11
12#ifndef _ASM_RC32434_DMA_V_H_
13#define _ASM_RC32434_DMA_V_H_
14
15#include <asm/mach-rc32434/dma.h>
16#include <asm/mach-rc32434/rc32434.h>
17
18#define DMA_CHAN_OFFSET 0x14
19#define IS_DMA_USED(X) (((X) & \
20 (DMA_DESC_FINI | DMA_DESC_DONE | DMA_DESC_TERM)) \
21 != 0)
22#define DMA_COUNT(count) ((count) & DMA_DESC_COUNT_MSK)
23
24#define DMA_HALT_TIMEOUT 500
25
26static inline int rc32434_halt_dma(struct dma_reg *ch)
27{
28 int timeout = 1;
29 if (__raw_readl(&ch->dmac) & DMA_CHAN_RUN_BIT) {
30 __raw_writel(0, &ch->dmac);
31 for (timeout = DMA_HALT_TIMEOUT; timeout > 0; timeout--) {
32 if (__raw_readl(&ch->dmas) & DMA_STAT_HALT) {
33 __raw_writel(0, &ch->dmas);
34 break;
35 }
36 }
37 }
38
39 return timeout ? 0 : 1;
40}
41
42static inline void rc32434_start_dma(struct dma_reg *ch, u32 dma_addr)
43{
44 __raw_writel(0, &ch->dmandptr);
45 __raw_writel(dma_addr, &ch->dmadptr);
46}
47
48static inline void rc32434_chain_dma(struct dma_reg *ch, u32 dma_addr)
49{
50 __raw_writel(dma_addr, &ch->dmandptr);
51}
52
53#endif /* _ASM_RC32434_DMA_V_H_ */
diff --git a/arch/mips/include/asm/mach-rc32434/eth.h b/arch/mips/include/asm/mach-rc32434/eth.h
new file mode 100644
index 000000000..c2645faad
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/eth.h
@@ -0,0 +1,220 @@
1/*
2 * Definitions for the Ethernet registers
3 *
4 * Copyright 2002 Allend Stichter <allen.stichter@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * 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. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * 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 */
28
29#ifndef __ASM_RC32434_ETH_H
30#define __ASM_RC32434_ETH_H
31
32
33#define ETH0_BASE_ADDR 0x18060000
34
35struct eth_regs {
36 u32 ethintfc;
37 u32 ethfifott;
38 u32 etharc;
39 u32 ethhash0;
40 u32 ethhash1;
41 u32 ethu0[4]; /* Reserved. */
42 u32 ethpfs;
43 u32 ethmcp;
44 u32 eth_u1[10]; /* Reserved. */
45 u32 ethspare;
46 u32 eth_u2[42]; /* Reserved. */
47 u32 ethsal0;
48 u32 ethsah0;
49 u32 ethsal1;
50 u32 ethsah1;
51 u32 ethsal2;
52 u32 ethsah2;
53 u32 ethsal3;
54 u32 ethsah3;
55 u32 ethrbc;
56 u32 ethrpc;
57 u32 ethrupc;
58 u32 ethrfc;
59 u32 ethtbc;
60 u32 ethgpf;
61 u32 eth_u9[50]; /* Reserved. */
62 u32 ethmac1;
63 u32 ethmac2;
64 u32 ethipgt;
65 u32 ethipgr;
66 u32 ethclrt;
67 u32 ethmaxf;
68 u32 eth_u10; /* Reserved. */
69 u32 ethmtest;
70 u32 miimcfg;
71 u32 miimcmd;
72 u32 miimaddr;
73 u32 miimwtd;
74 u32 miimrdd;
75 u32 miimind;
76 u32 eth_u11; /* Reserved. */
77 u32 eth_u12; /* Reserved. */
78 u32 ethcfsa0;
79 u32 ethcfsa1;
80 u32 ethcfsa2;
81};
82
83/* Ethernet interrupt registers */
84#define ETH_INT_FC_EN (1 << 0)
85#define ETH_INT_FC_ITS (1 << 1)
86#define ETH_INT_FC_RIP (1 << 2)
87#define ETH_INT_FC_JAM (1 << 3)
88#define ETH_INT_FC_OVR (1 << 4)
89#define ETH_INT_FC_UND (1 << 5)
90#define ETH_INT_FC_IOC 0x000000c0
91
92/* Ethernet FIFO registers */
93#define ETH_FIFI_TT_TTH_BIT 0
94#define ETH_FIFO_TT_TTH 0x0000007f
95
96/* Ethernet ARC/multicast registers */
97#define ETH_ARC_PRO (1 << 0)
98#define ETH_ARC_AM (1 << 1)
99#define ETH_ARC_AFM (1 << 2)
100#define ETH_ARC_AB (1 << 3)
101
102/* Ethernet SAL registers */
103#define ETH_SAL_BYTE_5 0x000000ff
104#define ETH_SAL_BYTE_4 0x0000ff00
105#define ETH_SAL_BYTE_3 0x00ff0000
106#define ETH_SAL_BYTE_2 0xff000000
107
108/* Ethernet SAH registers */
109#define ETH_SAH_BYTE1 0x000000ff
110#define ETH_SAH_BYTE0 0x0000ff00
111
112/* Ethernet GPF register */
113#define ETH_GPF_PTV 0x0000ffff
114
115/* Ethernet PFG register */
116#define ETH_PFS_PFD (1 << 0)
117
118/* Ethernet CFSA[0-3] registers */
119#define ETH_CFSA0_CFSA4 0x000000ff
120#define ETH_CFSA0_CFSA5 0x0000ff00
121#define ETH_CFSA1_CFSA2 0x000000ff
122#define ETH_CFSA1_CFSA3 0x0000ff00
123#define ETH_CFSA1_CFSA0 0x000000ff
124#define ETH_CFSA1_CFSA1 0x0000ff00
125
126/* Ethernet MAC1 registers */
127#define ETH_MAC1_RE (1 << 0)
128#define ETH_MAC1_PAF (1 << 1)
129#define ETH_MAC1_RFC (1 << 2)
130#define ETH_MAC1_TFC (1 << 3)
131#define ETH_MAC1_LB (1 << 4)
132#define ETH_MAC1_MR (1 << 31)
133
134/* Ethernet MAC2 registers */
135#define ETH_MAC2_FD (1 << 0)
136#define ETH_MAC2_FLC (1 << 1)
137#define ETH_MAC2_HFE (1 << 2)
138#define ETH_MAC2_DC (1 << 3)
139#define ETH_MAC2_CEN (1 << 4)
140#define ETH_MAC2_PE (1 << 5)
141#define ETH_MAC2_VPE (1 << 6)
142#define ETH_MAC2_APE (1 << 7)
143#define ETH_MAC2_PPE (1 << 8)
144#define ETH_MAC2_LPE (1 << 9)
145#define ETH_MAC2_NB (1 << 12)
146#define ETH_MAC2_BP (1 << 13)
147#define ETH_MAC2_ED (1 << 14)
148
149/* Ethernet IPGT register */
150#define ETH_IPGT 0x0000007f
151
152/* Ethernet IPGR registers */
153#define ETH_IPGR_IPGR2 0x0000007f
154#define ETH_IPGR_IPGR1 0x00007f00
155
156/* Ethernet CLRT registers */
157#define ETH_CLRT_MAX_RET 0x0000000f
158#define ETH_CLRT_COL_WIN 0x00003f00
159
160/* Ethernet MAXF register */
161#define ETH_MAXF 0x0000ffff
162
163/* Ethernet test registers */
164#define ETH_TEST_REG (1 << 2)
165#define ETH_MCP_DIV 0x000000ff
166
167/* MII registers */
168#define ETH_MII_CFG_RSVD 0x0000000c
169#define ETH_MII_CMD_RD (1 << 0)
170#define ETH_MII_CMD_SCN (1 << 1)
171#define ETH_MII_REG_ADDR 0x0000001f
172#define ETH_MII_PHY_ADDR 0x00001f00
173#define ETH_MII_WTD_DATA 0x0000ffff
174#define ETH_MII_RDD_DATA 0x0000ffff
175#define ETH_MII_IND_BSY (1 << 0)
176#define ETH_MII_IND_SCN (1 << 1)
177#define ETH_MII_IND_NV (1 << 2)
178
179/*
180 * Values for the DEVCS field of the Ethernet DMA Rx and Tx descriptors.
181 */
182
183#define ETH_RX_FD (1 << 0)
184#define ETH_RX_LD (1 << 1)
185#define ETH_RX_ROK (1 << 2)
186#define ETH_RX_FM (1 << 3)
187#define ETH_RX_MP (1 << 4)
188#define ETH_RX_BP (1 << 5)
189#define ETH_RX_VLT (1 << 6)
190#define ETH_RX_CF (1 << 7)
191#define ETH_RX_OVR (1 << 8)
192#define ETH_RX_CRC (1 << 9)
193#define ETH_RX_CV (1 << 10)
194#define ETH_RX_DB (1 << 11)
195#define ETH_RX_LE (1 << 12)
196#define ETH_RX_LOR (1 << 13)
197#define ETH_RX_CES (1 << 14)
198#define ETH_RX_LEN_BIT 16
199#define ETH_RX_LEN 0xffff0000
200
201#define ETH_TX_FD (1 << 0)
202#define ETH_TX_LD (1 << 1)
203#define ETH_TX_OEN (1 << 2)
204#define ETH_TX_PEN (1 << 3)
205#define ETH_TX_CEN (1 << 4)
206#define ETH_TX_HEN (1 << 5)
207#define ETH_TX_TOK (1 << 6)
208#define ETH_TX_MP (1 << 7)
209#define ETH_TX_BP (1 << 8)
210#define ETH_TX_UND (1 << 9)
211#define ETH_TX_OF (1 << 10)
212#define ETH_TX_ED (1 << 11)
213#define ETH_TX_EC (1 << 12)
214#define ETH_TX_LC (1 << 13)
215#define ETH_TX_TD (1 << 14)
216#define ETH_TX_CRC (1 << 15)
217#define ETH_TX_LE (1 << 16)
218#define ETH_TX_CC 0x001E0000
219
220#endif /* __ASM_RC32434_ETH_H */
diff --git a/arch/mips/include/asm/mach-rc32434/gpio.h b/arch/mips/include/asm/mach-rc32434/gpio.h
new file mode 100644
index 000000000..a3192da9f
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/gpio.h
@@ -0,0 +1,79 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright 2002 Integrated Device Technology, Inc.
4 * All rights reserved.
5 *
6 * GPIO register definition.
7 *
8 * Author : ryan.holmQVist@idt.com
9 * Date : 20011005
10 * Copyright (C) 2001, 2002 Ryan Holm <ryan.holmQVist@idt.com>
11 * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
12 */
13
14#ifndef _RC32434_GPIO_H_
15#define _RC32434_GPIO_H_
16
17struct rb532_gpio_reg {
18 u32 gpiofunc; /* GPIO Function Register
19 * gpiofunc[x]==0 bit = gpio
20 * func[x]==1 bit = altfunc
21 */
22 u32 gpiocfg; /* GPIO Configuration Register
23 * gpiocfg[x]==0 bit = input
24 * gpiocfg[x]==1 bit = output
25 */
26 u32 gpiod; /* GPIO Data Register
27 * gpiod[x] read/write gpio pinX status
28 */
29 u32 gpioilevel; /* GPIO Interrupt Status Register
30 * interrupt level (see gpioistat)
31 */
32 u32 gpioistat; /* Gpio Interrupt Status Register
33 * istat[x] = (gpiod[x] == level[x])
34 * cleared in ISR (STICKY bits)
35 */
36 u32 gpionmien; /* GPIO Non-maskable Interrupt Enable Register */
37};
38
39/* UART GPIO signals */
40#define RC32434_UART0_SOUT (1 << 0)
41#define RC32434_UART0_SIN (1 << 1)
42#define RC32434_UART0_RTS (1 << 2)
43#define RC32434_UART0_CTS (1 << 3)
44
45/* M & P bus GPIO signals */
46#define RC32434_MP_BIT_22 (1 << 4)
47#define RC32434_MP_BIT_23 (1 << 5)
48#define RC32434_MP_BIT_24 (1 << 6)
49#define RC32434_MP_BIT_25 (1 << 7)
50
51/* CPU GPIO signals */
52#define RC32434_CPU_GPIO (1 << 8)
53
54/* Reserved GPIO signals */
55#define RC32434_AF_SPARE_6 (1 << 9)
56#define RC32434_AF_SPARE_4 (1 << 10)
57#define RC32434_AF_SPARE_3 (1 << 11)
58#define RC32434_AF_SPARE_2 (1 << 12)
59
60/* PCI messaging unit */
61#define RC32434_PCI_MSU_GPIO (1 << 13)
62
63/* NAND GPIO signals */
64#define GPIO_RDY 8
65#define GPIO_WPX 9
66#define GPIO_ALE 10
67#define GPIO_CLE 11
68
69/* Compact Flash GPIO pin */
70#define CF_GPIO_NUM 13
71
72/* S1 button GPIO (shared with UART0_SIN) */
73#define GPIO_BTN_S1 1
74
75extern void rb532_gpio_set_ilevel(int bit, unsigned gpio);
76extern void rb532_gpio_set_istat(int bit, unsigned gpio);
77extern void rb532_gpio_set_func(unsigned gpio);
78
79#endif /* _RC32434_GPIO_H_ */
diff --git a/arch/mips/include/asm/mach-rc32434/integ.h b/arch/mips/include/asm/mach-rc32434/integ.h
new file mode 100644
index 000000000..fa65bc3d8
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/integ.h
@@ -0,0 +1,59 @@
1/*
2 * Definitions for the Watchdog registers
3 *
4 * Copyright 2002 Ryan Holm <ryan.holmQVist@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * 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. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * 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 */
28
29#ifndef __RC32434_INTEG_H__
30#define __RC32434_INTEG_H__
31
32#include <asm/mach-rc32434/rb.h>
33
34#define INTEG0_BASE_ADDR 0x18030030
35
36struct integ {
37 u32 errcs; /* sticky use ERRCS_ */
38 u32 wtcount; /* Watchdog timer count reg. */
39 u32 wtcompare; /* Watchdog timer timeout value. */
40 u32 wtc; /* Watchdog timer control. use WTC_ */
41};
42
43/* Error counters */
44#define RC32434_ERR_WTO 0
45#define RC32434_ERR_WNE 1
46#define RC32434_ERR_UCW 2
47#define RC32434_ERR_UCR 3
48#define RC32434_ERR_UPW 4
49#define RC32434_ERR_UPR 5
50#define RC32434_ERR_UDW 6
51#define RC32434_ERR_UDR 7
52#define RC32434_ERR_SAE 8
53#define RC32434_ERR_WRE 9
54
55/* Watchdog control bits */
56#define RC32434_WTC_EN 0
57#define RC32434_WTC_TO 1
58
59#endif /* __RC32434_INTEG_H__ */
diff --git a/arch/mips/include/asm/mach-rc32434/irq.h b/arch/mips/include/asm/mach-rc32434/irq.h
new file mode 100644
index 000000000..ebe32bd5a
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/irq.h
@@ -0,0 +1,37 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_RC32434_IRQ_H
3#define __ASM_RC32434_IRQ_H
4
5#define NR_IRQS 256
6
7#include <asm/mach-generic/irq.h>
8#include <asm/mach-rc32434/rb.h>
9
10/* Interrupt Controller */
11#define IC_GROUP0_PEND (REGBASE + 0x38000)
12#define IC_GROUP0_MASK (REGBASE + 0x38008)
13#define IC_GROUP_OFFSET 0x0C
14
15#define NUM_INTR_GROUPS 5
16
17/* 16550 UARTs */
18#define GROUP0_IRQ_BASE 8 /* GRP2 IRQ numbers start here */
19 /* GRP3 IRQ numbers start here */
20#define GROUP1_IRQ_BASE (GROUP0_IRQ_BASE + 32)
21 /* GRP4 IRQ numbers start here */
22#define GROUP2_IRQ_BASE (GROUP1_IRQ_BASE + 32)
23 /* GRP5 IRQ numbers start here */
24#define GROUP3_IRQ_BASE (GROUP2_IRQ_BASE + 32)
25#define GROUP4_IRQ_BASE (GROUP3_IRQ_BASE + 32)
26
27#define UART0_IRQ (GROUP3_IRQ_BASE + 0)
28
29#define ETH0_DMA_RX_IRQ (GROUP1_IRQ_BASE + 0)
30#define ETH0_DMA_TX_IRQ (GROUP1_IRQ_BASE + 1)
31#define ETH0_RX_OVR_IRQ (GROUP3_IRQ_BASE + 9)
32#define ETH0_TX_UND_IRQ (GROUP3_IRQ_BASE + 10)
33
34#define GPIO_MAPPED_IRQ_BASE GROUP4_IRQ_BASE
35#define GPIO_MAPPED_IRQ_GROUP 4
36
37#endif /* __ASM_RC32434_IRQ_H */
diff --git a/arch/mips/include/asm/mach-rc32434/pci.h b/arch/mips/include/asm/mach-rc32434/pci.h
new file mode 100644
index 000000000..9a6eefd12
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/pci.h
@@ -0,0 +1,478 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
8 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
10 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
13 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
16 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Copyright 2004 IDT Inc. (rischelp@idt.com)
23 *
24 * Initial Release
25 */
26
27#ifndef _ASM_RC32434_PCI_H_
28#define _ASM_RC32434_PCI_H_
29
30#define epld_mask ((volatile unsigned char *)0xB900000d)
31
32#define PCI0_BASE_ADDR 0x18080000
33#define PCI_LBA_COUNT 4
34
35struct pci_map {
36 u32 address; /* Address. */
37 u32 control; /* Control. */
38 u32 mapping; /* mapping. */
39};
40
41struct pci_reg {
42 u32 pcic;
43 u32 pcis;
44 u32 pcism;
45 u32 pcicfga;
46 u32 pcicfgd;
47 volatile struct pci_map pcilba[PCI_LBA_COUNT];
48 u32 pcidac;
49 u32 pcidas;
50 u32 pcidasm;
51 u32 pcidad;
52 u32 pcidma8c;
53 u32 pcidma9c;
54 u32 pcitc;
55};
56
57#define PCI_MSU_COUNT 2
58
59struct pci_msu {
60 u32 pciim[PCI_MSU_COUNT];
61 u32 pciom[PCI_MSU_COUNT];
62 u32 pciid;
63 u32 pciiic;
64 u32 pciiim;
65 u32 pciiod;
66 u32 pciioic;
67 u32 pciioim;
68};
69
70/*
71 * PCI Control Register
72 */
73
74#define PCI_CTL_EN (1 << 0)
75#define PCI_CTL_TNR (1 << 1)
76#define PCI_CTL_SCE (1 << 2)
77#define PCI_CTL_IEN (1 << 3)
78#define PCI_CTL_AAA (1 << 4)
79#define PCI_CTL_EAP (1 << 5)
80#define PCI_CTL_PCIM_BIT 6
81#define PCI_CTL_PCIM 0x000001c0
82
83#define PCI_CTL_PCIM_DIS 0
84#define PCI_CTL_PCIM_TNR 1 /* Satellite - target not ready */
85#define PCI_CTL_PCIM_SUS 2 /* Satellite - suspended CPU. */
86#define PCI_CTL_PCIM_EXT 3 /* Host - external arbiter. */
87#define PCI_CTL PCIM_PRIO 4 /* Host - fixed priority arb. */
88#define PCI_CTL_PCIM_RR 5 /* Host - round robin priority. */
89#define PCI_CTL_PCIM_RSVD6 6
90#define PCI_CTL_PCIM_RSVD7 7
91
92#define PCI_CTL_IGM (1 << 9)
93
94/*
95 * PCI Status Register
96 */
97
98#define PCI_STAT_EED (1 << 0)
99#define PCI_STAT_WR (1 << 1)
100#define PCI_STAT_NMI (1 << 2)
101#define PCI_STAT_II (1 << 3)
102#define PCI_STAT_CWE (1 << 4)
103#define PCI_STAT_CRE (1 << 5)
104#define PCI_STAT_MDPE (1 << 6)
105#define PCI_STAT_STA (1 << 7)
106#define PCI_STAT_RTA (1 << 8)
107#define PCI_STAT_RMA (1 << 9)
108#define PCI_STAT_SSE (1 << 10)
109#define PCI_STAT_OSE (1 << 11)
110#define PCI_STAT_PE (1 << 12)
111#define PCI_STAT_TAE (1 << 13)
112#define PCI_STAT_RLE (1 << 14)
113#define PCI_STAT_BME (1 << 15)
114#define PCI_STAT_PRD (1 << 16)
115#define PCI_STAT_RIP (1 << 17)
116
117/*
118 * PCI Status Mask Register
119 */
120
121#define PCI_STATM_EED PCI_STAT_EED
122#define PCI_STATM_WR PCI_STAT_WR
123#define PCI_STATM_NMI PCI_STAT_NMI
124#define PCI_STATM_II PCI_STAT_II
125#define PCI_STATM_CWE PCI_STAT_CWE
126#define PCI_STATM_CRE PCI_STAT_CRE
127#define PCI_STATM_MDPE PCI_STAT_MDPE
128#define PCI_STATM_STA PCI_STAT_STA
129#define PCI_STATM_RTA PCI_STAT_RTA
130#define PCI_STATM_RMA PCI_STAT_RMA
131#define PCI_STATM_SSE PCI_STAT_SSE
132#define PCI_STATM_OSE PCI_STAT_OSE
133#define PCI_STATM_PE PCI_STAT_PE
134#define PCI_STATM_TAE PCI_STAT_TAE
135#define PCI_STATM_RLE PCI_STAT_RLE
136#define PCI_STATM_BME PCI_STAT_BME
137#define PCI_STATM_PRD PCI_STAT_PRD
138#define PCI_STATM_RIP PCI_STAT_RIP
139
140/*
141 * PCI Configuration Address Register
142 */
143#define PCI_CFGA_REG_BIT 2
144#define PCI_CFGA_REG 0x000000fc
145#define PCI_CFGA_REG_ID (0x00 >> 2) /* use PCFGID */
146#define PCI_CFGA_REG_04 (0x04 >> 2) /* use PCFG04_ */
147#define PCI_CFGA_REG_08 (0x08 >> 2) /* use PCFG08_ */
148#define PCI_CFGA_REG_0C (0x0C >> 2) /* use PCFG0C_ */
149#define PCI_CFGA_REG_PBA0 (0x10 >> 2) /* use PCIPBA_ */
150#define PCI_CFGA_REG_PBA1 (0x14 >> 2) /* use PCIPBA_ */
151#define PCI_CFGA_REG_PBA2 (0x18 >> 2) /* use PCIPBA_ */
152#define PCI_CFGA_REG_PBA3 (0x1c >> 2) /* use PCIPBA_ */
153#define PCI_CFGA_REG_SUBSYS (0x2c >> 2) /* use PCFGSS_ */
154#define PCI_CFGA_REG_3C (0x3C >> 2) /* use PCFG3C_ */
155#define PCI_CFGA_REG_PBBA0C (0x44 >> 2) /* use PCIPBAC_ */
156#define PCI_CFGA_REG_PBA0M (0x48 >> 2)
157#define PCI_CFGA_REG_PBA1C (0x4c >> 2) /* use PCIPBAC_ */
158#define PCI_CFGA_REG_PBA1M (0x50 >> 2)
159#define PCI_CFGA_REG_PBA2C (0x54 >> 2) /* use PCIPBAC_ */
160#define PCI_CFGA_REG_PBA2M (0x58 >> 2)
161#define PCI_CFGA_REG_PBA3C (0x5c >> 2) /* use PCIPBAC_ */
162#define PCI_CFGA_REG_PBA3M (0x60 >> 2)
163#define PCI_CFGA_REG_PMGT (0x64 >> 2)
164#define PCI_CFGA_FUNC_BIT 8
165#define PCI_CFGA_FUNC 0x00000700
166#define PCI_CFGA_DEV_BIT 11
167#define PCI_CFGA_DEV 0x0000f800
168#define PCI_CFGA_DEV_INTERN 0
169#define PCI_CFGA_BUS_BIT 16
170#define PCI CFGA_BUS 0x00ff0000
171#define PCI_CFGA_BUS_TYPE0 0
172#define PCI_CFGA_EN (1 << 31)
173
174/* PCI CFG04 commands */
175#define PCI_CFG04_CMD_IO_ENA (1 << 0)
176#define PCI_CFG04_CMD_MEM_ENA (1 << 1)
177#define PCI_CFG04_CMD_BM_ENA (1 << 2)
178#define PCI_CFG04_CMD_MW_INV (1 << 4)
179#define PCI_CFG04_CMD_PAR_ENA (1 << 6)
180#define PCI_CFG04_CMD_SER_ENA (1 << 8)
181#define PCI_CFG04_CMD_FAST_ENA (1 << 9)
182
183/* PCI CFG04 status fields */
184#define PCI_CFG04_STAT_BIT 16
185#define PCI_CFG04_STAT 0xffff0000
186#define PCI_CFG04_STAT_66_MHZ (1 << 21)
187#define PCI_CFG04_STAT_FBB (1 << 23)
188#define PCI_CFG04_STAT_MDPE (1 << 24)
189#define PCI_CFG04_STAT_DST (1 << 25)
190#define PCI_CFG04_STAT_STA (1 << 27)
191#define PCI_CFG04_STAT_RTA (1 << 28)
192#define PCI_CFG04_STAT_RMA (1 << 29)
193#define PCI_CFG04_STAT_SSE (1 << 30)
194#define PCI_CFG04_STAT_PE (1 << 31)
195
196#define PCI_PBA_MSI (1 << 0)
197#define PCI_PBA_P (1 << 2)
198
199/* PCI PBAC registers */
200#define PCI_PBAC_MSI (1 << 0)
201#define PCI_PBAC_P (1 << 1)
202#define PCI_PBAC_SIZE_BIT 2
203#define PCI_PBAC_SIZE 0x0000007c
204#define PCI_PBAC_SB (1 << 7)
205#define PCI_PBAC_PP (1 << 8)
206#define PCI_PBAC_MR_BIT 9
207#define PCI_PBAC_MR 0x00000600
208#define PCI_PBAC_MR_RD 0
209#define PCI_PBAC_MR_RD_LINE 1
210#define PCI_PBAC_MR_RD_MULT 2
211#define PCI_PBAC_MRL (1 << 11)
212#define PCI_PBAC_MRM (1 << 12)
213#define PCI_PBAC_TRP (1 << 13)
214
215#define PCI_CFG40_TRDY_TIM 0x000000ff
216#define PCI_CFG40_RET_LIM 0x0000ff00
217
218/*
219 * PCI Local Base Address [0|1|2|3] Register
220 */
221
222#define PCI_LBA_BADDR_BIT 0
223#define PCI_LBA_BADDR 0xffffff00
224
225/*
226 * PCI Local Base Address Control Register
227 */
228
229#define PCI_LBAC_MSI (1 << 0)
230#define PCI_LBAC_MSI_MEM 0
231#define PCI_LBAC_MSI_IO 1
232#define PCI_LBAC_SIZE_BIT 2
233#define PCI_LBAC_SIZE 0x0000007c
234#define PCI_LBAC_SB (1 << 7)
235#define PCI_LBAC_RT (1 << 8)
236#define PCI_LBAC_RT_NO_PREF 0
237#define PCI_LBAC_RT_PREF 1
238
239/*
240 * PCI Local Base Address [0|1|2|3] Mapping Register
241 */
242#define PCI_LBAM_MADDR_BIT 8
243#define PCI_LBAM_MADDR 0xffffff00
244
245/*
246 * PCI Decoupled Access Control Register
247 */
248#define PCI_DAC_DEN (1 << 0)
249
250/*
251 * PCI Decoupled Access Status Register
252 */
253#define PCI_DAS_D (1 << 0)
254#define PCI_DAS_B (1 << 1)
255#define PCI_DAS_E (1 << 2)
256#define PCI_DAS_OFE (1 << 3)
257#define PCI_DAS_OFF (1 << 4)
258#define PCI_DAS_IFE (1 << 5)
259#define PCI_DAS_IFF (1 << 6)
260
261/*
262 * PCI DMA Channel 8 Configuration Register
263 */
264#define PCI_DMA8C_MBS_BIT 0
265#define PCI_DMA8C_MBS 0x00000fff /* Maximum Burst Size. */
266#define PCI_DMA8C_OUR (1 << 12)
267
268/*
269 * PCI DMA Channel 9 Configuration Register
270 */
271#define PCI_DMA9C_MBS_BIT 0 /* Maximum Burst Size. */
272#define PCI_DMA9C_MBS 0x00000fff
273
274/*
275 * PCI to Memory(DMA Channel 8) AND Memory to PCI DMA(DMA Channel 9)Descriptors
276 */
277
278#define PCI_DMAD_PT_BIT 22 /* in DEVCMD field (descriptor) */
279#define PCI_DMAD_PT 0x00c00000 /* preferred transaction field */
280/* These are for reads (DMA channel 8) */
281#define PCI_DMAD_DEVCMD_MR 0 /* memory read */
282#define PCI_DMAD_DEVCMD_MRL 1 /* memory read line */
283#define PCI_DMAD_DEVCMD_MRM 2 /* memory read multiple */
284#define PCI_DMAD_DEVCMD_IOR 3 /* I/O read */
285/* These are for writes (DMA channel 9) */
286#define PCI_DMAD_DEVCMD_MW 0 /* memory write */
287#define PCI_DMAD_DEVCMD_MWI 1 /* memory write invalidate */
288#define PCI_DMAD_DEVCMD_IOW 3 /* I/O write */
289
290/* Swap byte field applies to both DMA channel 8 and 9 */
291#define PCI_DMAD_SB (1 << 24) /* swap byte field */
292
293
294/*
295 * PCI Target Control Register
296 */
297
298#define PCI_TC_RTIMER_BIT 0
299#define PCI_TC_RTIMER 0x000000ff
300#define PCI_TC_DTIMER_BIT 8
301#define PCI_TC_DTIMER 0x0000ff00
302#define PCI_TC_RDR (1 << 18)
303#define PCI_TC_DDT (1 << 19)
304
305/*
306 * PCI messaging unit [applies to both inbound and outbound registers ]
307 */
308#define PCI_MSU_M0 (1 << 0)
309#define PCI_MSU_M1 (1 << 1)
310#define PCI_MSU_DB (1 << 2)
311
312#define PCI_MSG_ADDR 0xB8088010
313#define PCI0_ADDR 0xB8080000
314#define rc32434_pci ((struct pci_reg *) PCI0_ADDR)
315#define rc32434_pci_msg ((struct pci_msu *) PCI_MSG_ADDR)
316
317#define PCIM_SHFT 0x6
318#define PCIM_BIT_LEN 0x7
319#define PCIM_H_EA 0x3
320#define PCIM_H_IA_FIX 0x4
321#define PCIM_H_IA_RR 0x5
322
323#define PCI_ADDR_START 0x50000000
324
325#define CPUTOPCI_MEM_WIN 0x02000000
326#define CPUTOPCI_IO_WIN 0x00100000
327#define PCILBA_SIZE_SHFT 2
328#define PCILBA_SIZE_MASK 0x1F
329#define SIZE_256MB 0x1C
330#define SIZE_128MB 0x1B
331#define SIZE_64MB 0x1A
332#define SIZE_32MB 0x19
333#define SIZE_16MB 0x18
334#define SIZE_4MB 0x16
335#define SIZE_2MB 0x15
336#define SIZE_1MB 0x14
337#define KORINA_CONFIG0_ADDR 0x80000000
338#define KORINA_CONFIG1_ADDR 0x80000004
339#define KORINA_CONFIG2_ADDR 0x80000008
340#define KORINA_CONFIG3_ADDR 0x8000000C
341#define KORINA_CONFIG4_ADDR 0x80000010
342#define KORINA_CONFIG5_ADDR 0x80000014
343#define KORINA_CONFIG6_ADDR 0x80000018
344#define KORINA_CONFIG7_ADDR 0x8000001C
345#define KORINA_CONFIG8_ADDR 0x80000020
346#define KORINA_CONFIG9_ADDR 0x80000024
347#define KORINA_CONFIG10_ADDR 0x80000028
348#define KORINA_CONFIG11_ADDR 0x8000002C
349#define KORINA_CONFIG12_ADDR 0x80000030
350#define KORINA_CONFIG13_ADDR 0x80000034
351#define KORINA_CONFIG14_ADDR 0x80000038
352#define KORINA_CONFIG15_ADDR 0x8000003C
353#define KORINA_CONFIG16_ADDR 0x80000040
354#define KORINA_CONFIG17_ADDR 0x80000044
355#define KORINA_CONFIG18_ADDR 0x80000048
356#define KORINA_CONFIG19_ADDR 0x8000004C
357#define KORINA_CONFIG20_ADDR 0x80000050
358#define KORINA_CONFIG21_ADDR 0x80000054
359#define KORINA_CONFIG22_ADDR 0x80000058
360#define KORINA_CONFIG23_ADDR 0x8000005C
361#define KORINA_CONFIG24_ADDR 0x80000060
362#define KORINA_CONFIG25_ADDR 0x80000064
363#define KORINA_CMD (PCI_CFG04_CMD_IO_ENA | \
364 PCI_CFG04_CMD_MEM_ENA | \
365 PCI_CFG04_CMD_BM_ENA | \
366 PCI_CFG04_CMD_MW_INV | \
367 PCI_CFG04_CMD_PAR_ENA | \
368 PCI_CFG04_CMD_SER_ENA)
369
370#define KORINA_STAT (PCI_CFG04_STAT_MDPE | \
371 PCI_CFG04_STAT_STA | \
372 PCI_CFG04_STAT_RTA | \
373 PCI_CFG04_STAT_RMA | \
374 PCI_CFG04_STAT_SSE | \
375 PCI_CFG04_STAT_PE)
376
377#define KORINA_CNFG1 ((KORINA_STAT<<16)|KORINA_CMD)
378
379#define KORINA_REVID 0
380#define KORINA_CLASS_CODE 0
381#define KORINA_CNFG2 ((KORINA_CLASS_CODE<<8) | \
382 KORINA_REVID)
383
384#define KORINA_CACHE_LINE_SIZE 4
385#define KORINA_MASTER_LAT 0x3c
386#define KORINA_HEADER_TYPE 0
387#define KORINA_BIST 0
388
389#define KORINA_CNFG3 ((KORINA_BIST << 24) | \
390 (KORINA_HEADER_TYPE<<16) | \
391 (KORINA_MASTER_LAT<<8) | \
392 KORINA_CACHE_LINE_SIZE)
393
394#define KORINA_BAR0 0x00000008 /* 128 MB Memory */
395#define KORINA_BAR1 0x18800001 /* 1 MB IO */
396#define KORINA_BAR2 0x18000001 /* 2 MB IO window for Korina
397 internal Registers */
398#define KORINA_BAR3 0x48000008 /* Spare 128 MB Memory */
399
400#define KORINA_CNFG4 KORINA_BAR0
401#define KORINA_CNFG5 KORINA_BAR1
402#define KORINA_CNFG6 KORINA_BAR2
403#define KORINA_CNFG7 KORINA_BAR3
404
405#define KORINA_SUBSYS_VENDOR_ID 0x011d
406#define KORINA_SUBSYSTEM_ID 0x0214
407#define KORINA_CNFG8 0
408#define KORINA_CNFG9 0
409#define KORINA_CNFG10 0
410#define KORINA_CNFG11 ((KORINA_SUBSYS_VENDOR_ID<<16) | \
411 KORINA_SUBSYSTEM_ID)
412#define KORINA_INT_LINE 1
413#define KORINA_INT_PIN 1
414#define KORINA_MIN_GNT 8
415#define KORINA_MAX_LAT 0x38
416#define KORINA_CNFG12 0
417#define KORINA_CNFG13 0
418#define KORINA_CNFG14 0
419#define KORINA_CNFG15 ((KORINA_MAX_LAT<<24) | \
420 (KORINA_MIN_GNT<<16) | \
421 (KORINA_INT_PIN<<8) | \
422 KORINA_INT_LINE)
423#define KORINA_RETRY_LIMIT 0x80
424#define KORINA_TRDY_LIMIT 0x80
425#define KORINA_CNFG16 ((KORINA_RETRY_LIMIT<<8) | \
426 KORINA_TRDY_LIMIT)
427#define PCI_PBAxC_R 0x0
428#define PCI_PBAxC_RL 0x1
429#define PCI_PBAxC_RM 0x2
430#define SIZE_SHFT 2
431
432#if defined(__MIPSEB__)
433#define KORINA_PBA0C (PCI_PBAC_MRL | PCI_PBAC_SB | \
434 ((PCI_PBAxC_RM & 0x3) << PCI_PBAC_MR_BIT) | \
435 PCI_PBAC_PP | \
436 (SIZE_128MB<<SIZE_SHFT) | \
437 PCI_PBAC_P)
438#else
439#define KORINA_PBA0C (PCI_PBAC_MRL | \
440 ((PCI_PBAxC_RM & 0x3) << PCI_PBAC_MR_BIT) | \
441 PCI_PBAC_PP | \
442 (SIZE_128MB<<SIZE_SHFT) | \
443 PCI_PBAC_P)
444#endif
445#define KORINA_CNFG17 KORINA_PBA0C
446#define KORINA_PBA0M 0x0
447#define KORINA_CNFG18 KORINA_PBA0M
448
449#if defined(__MIPSEB__)
450#define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | PCI_PBAC_SB | \
451 PCI_PBAC_MSI)
452#else
453#define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | \
454 PCI_PBAC_MSI)
455#endif
456#define KORINA_CNFG19 KORINA_PBA1C
457#define KORINA_PBA1M 0x0
458#define KORINA_CNFG20 KORINA_PBA1M
459
460#if defined(__MIPSEB__)
461#define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | PCI_PBAC_SB | \
462 PCI_PBAC_MSI)
463#else
464#define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | \
465 PCI_PBAC_MSI)
466#endif
467#define KORINA_CNFG21 KORINA_PBA2C
468#define KORINA_PBA2M 0x18000000
469#define KORINA_CNFG22 KORINA_PBA2M
470#define KORINA_PBA3C 0
471#define KORINA_CNFG23 KORINA_PBA3C
472#define KORINA_PBA3M 0
473#define KORINA_CNFG24 KORINA_PBA3M
474
475#define PCITC_DTIMER_VAL 8
476#define PCITC_RTIMER_VAL 0x10
477
478#endif /* __ASM_RC32434_PCI_H */
diff --git a/arch/mips/include/asm/mach-rc32434/prom.h b/arch/mips/include/asm/mach-rc32434/prom.h
new file mode 100644
index 000000000..660707f1b
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/prom.h
@@ -0,0 +1,40 @@
1/*
2 * Definitions for the PROM
3 *
4 * Copyright 2002 Ryan Holm <ryan.holmQVist@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * 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. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * 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 */
28
29#define PROM_ENTRY(x) (0xbfc00000 + ((x) * 8))
30
31#define SR_NMI 0x00180000
32#define SERIAL_SPEED_ENTRY 0x00000001
33
34#define FREQ_TAG "HZ="
35#define KMAC_TAG "kmac="
36#define MEM_TAG "mem="
37#define BOARD_TAG "board="
38
39#define BOARD_RB532 "500"
40#define BOARD_RB532A "500r5"
diff --git a/arch/mips/include/asm/mach-rc32434/rb.h b/arch/mips/include/asm/mach-rc32434/rb.h
new file mode 100644
index 000000000..d502673a4
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/rb.h
@@ -0,0 +1,75 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 *
4 * Copyright (C) 2004 IDT Inc.
5 * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
6 */
7#ifndef __ASM_RC32434_RB_H
8#define __ASM_RC32434_RB_H
9
10#include <linux/genhd.h>
11
12#define REGBASE 0x18000000
13#define IDT434_REG_BASE ((volatile void *) KSEG1ADDR(REGBASE))
14#define UART0BASE 0x58000
15#define RST (1 << 15)
16#define DEV0BASE 0x010000
17#define DEV0MASK 0x010004
18#define DEV0C 0x010008
19#define DEV0T 0x01000C
20#define DEV1BASE 0x010010
21#define DEV1MASK 0x010014
22#define DEV1C 0x010018
23#define DEV1TC 0x01001C
24#define DEV2BASE 0x010020
25#define DEV2MASK 0x010024
26#define DEV2C 0x010028
27#define DEV2TC 0x01002C
28#define DEV3BASE 0x010030
29#define DEV3MASK 0x010034
30#define DEV3C 0x010038
31#define DEV3TC 0x01003C
32#define BTCS 0x010040
33#define BTCOMPARE 0x010044
34#define GPIOBASE 0x050000
35/* Offsets relative to GPIOBASE */
36#define GPIOFUNC 0x00
37#define GPIOCFG 0x04
38#define GPIOD 0x08
39#define GPIOILEVEL 0x0C
40#define GPIOISTAT 0x10
41#define GPIONMIEN 0x14
42#define IMASK6 0x38
43#define LO_WPX (1 << 0)
44#define LO_ALE (1 << 1)
45#define LO_CLE (1 << 2)
46#define LO_CEX (1 << 3)
47#define LO_FOFF (1 << 5)
48#define LO_SPICS (1 << 6)
49#define LO_ULED (1 << 7)
50
51#define BIT_TO_MASK(x) (1 << x)
52
53struct dev_reg {
54 u32 base;
55 u32 mask;
56 u32 ctl;
57 u32 timing;
58};
59
60struct korina_device {
61 char *name;
62 unsigned char mac[6];
63 struct net_device *dev;
64};
65
66struct mpmc_device {
67 unsigned char state;
68 spinlock_t lock;
69 void __iomem *base;
70};
71
72extern void set_latch_u5(unsigned char or_mask, unsigned char nand_mask);
73extern unsigned char get_latch_u5(void);
74
75#endif /* __ASM_RC32434_RB_H */
diff --git a/arch/mips/include/asm/mach-rc32434/rc32434.h b/arch/mips/include/asm/mach-rc32434/rc32434.h
new file mode 100644
index 000000000..1bec6cc8a
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/rc32434.h
@@ -0,0 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Definitions for IDT RC323434 CPU.
4 */
5
6#ifndef _ASM_RC32434_RC32434_H_
7#define _ASM_RC32434_RC32434_H_
8
9#include <linux/delay.h>
10#include <linux/io.h>
11
12#define IDT_CLOCK_MULT 2
13
14/* cpu pipeline flush */
15static inline void rc32434_sync(void)
16{
17 __asm__ volatile ("sync");
18}
19
20#endif /* _ASM_RC32434_RC32434_H_ */
diff --git a/arch/mips/include/asm/mach-rc32434/timer.h b/arch/mips/include/asm/mach-rc32434/timer.h
new file mode 100644
index 000000000..cda26bb9e
--- /dev/null
+++ b/arch/mips/include/asm/mach-rc32434/timer.h
@@ -0,0 +1,65 @@
1/*
2 * Definitions for timer registers
3 *
4 * Copyright 2004 Philip Rischel <rischelp@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * 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. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * 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 */
28
29#ifndef __ASM_RC32434_TIMER_H
30#define __ASM_RC32434_TIMER_H
31
32#include <asm/mach-rc32434/rb.h>
33
34#define TIMER0_BASE_ADDR 0x18028000
35#define TIMER_COUNT 3
36
37struct timer_counter {
38 u32 count;
39 u32 compare;
40 u32 ctc; /*use CTC_ */
41};
42
43struct timer {
44 struct timer_counter tim[TIMER_COUNT];
45 u32 rcount; /* use RCOUNT_ */
46 u32 rcompare; /* use RCOMPARE_ */
47 u32 rtc; /* use RTC_ */
48};
49
50#define RC32434_CTC_EN_BIT 0
51#define RC32434_CTC_TO_BIT 1
52
53/* Real time clock registers */
54#define RC32434_RTC_MSK(x) BIT_TO_MASK(x)
55#define RC32434_RTC_CE_BIT 0
56#define RC32434_RTC_TO_BIT 1
57#define RC32434_RTC_RQE_BIT 2
58
59/* Counter registers */
60#define RC32434_RCOUNT_BIT 0
61#define RC32434_RCOUNT_MSK 0x0000ffff
62#define RC32434_RCOMP_BIT 0
63#define RC32434_RCOMP_MSK 0x0000ffff
64
65#endif /* __ASM_RC32434_TIMER_H */
diff --git a/arch/mips/include/asm/mach-rm/cpu-feature-overrides.h b/arch/mips/include/asm/mach-rm/cpu-feature-overrides.h
new file mode 100644
index 000000000..e1e182300
--- /dev/null
+++ b/arch/mips/include/asm/mach-rm/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, 04, 07 Ralf Baechle (ralf@linux-mips.org)
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#define cpu_has_tlb 1
14#define cpu_has_4kex 1
15#define cpu_has_4k_cache 1
16#define cpu_has_32fpr 1
17#define cpu_has_counter 1
18#define cpu_has_watch 0
19#define cpu_has_mips16 0
20#define cpu_has_mips16e2 0
21#define cpu_has_divec 0
22#define cpu_has_cache_cdex_p 1
23#define cpu_has_prefetch 0
24#define cpu_has_mcheck 0
25#define cpu_has_ejtag 0
26#define cpu_has_llsc 1
27#define cpu_has_vtag_icache 0
28#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
29#define cpu_has_ic_fills_f_dc 0
30#define cpu_has_dsp 0
31#define cpu_has_dsp2 0
32#define cpu_has_nofpuex 0
33#define cpu_has_64bits 1
34#define cpu_has_mipsmt 0
35#define cpu_has_userlocal 0
36
37#define cpu_has_mips32r1 0
38#define cpu_has_mips32r2 0
39#define cpu_has_mips64r1 0
40#define cpu_has_mips64r2 0
41
42#endif /* __ASM_MACH_RM200_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-rm/mc146818rtc.h b/arch/mips/include/asm/mach-rm/mc146818rtc.h
new file mode 100644
index 000000000..a074f4f84
--- /dev/null
+++ b/arch/mips/include/asm/mach-rm/mc146818rtc.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 * Copyright (C) 2004 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip with ARC epoch.
9 */
10#ifndef __ASM_MACH_RM_MC146818RTC_H
11#define __ASM_MACH_RM_MC146818RTC_H
12
13#ifdef CONFIG_CPU_BIG_ENDIAN
14#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
15#else
16#define mc146818_decode_year(year) ((year) + 1980)
17#endif
18
19#include <asm/mach-generic/mc146818rtc.h>
20
21#endif /* __ASM_MACH_RM_MC146818RTC_H */
diff --git a/arch/mips/include/asm/mach-sibyte/cpu-feature-overrides.h b/arch/mips/include/asm/mach-sibyte/cpu-feature-overrides.h
new file mode 100644
index 000000000..702235805
--- /dev/null
+++ b/arch/mips/include/asm/mach-sibyte/cpu-feature-overrides.h
@@ -0,0 +1,49 @@
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, 04, 07 Ralf Baechle (ralf@linux-mips.org)
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 wired to a specific configuration
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_mips16e2 0
17#define cpu_has_divec 1
18#define cpu_has_vce 0
19#define cpu_has_cache_cdex_p 0
20#define cpu_has_cache_cdex_s 0
21#define cpu_has_prefetch 1
22#define cpu_has_mcheck 1
23#define cpu_has_ejtag 1
24
25#define cpu_has_llsc 1
26#define cpu_has_vtag_icache 1
27#define cpu_has_dc_aliases 0
28#define cpu_has_ic_fills_f_dc 0
29#define cpu_has_dsp 0
30#define cpu_has_dsp2 0
31#define cpu_has_mipsmt 0
32#define cpu_has_userlocal 0
33#define cpu_icache_snoops_remote_store 0
34
35#define cpu_has_nofpuex 0
36#define cpu_has_64bits 1
37
38#define cpu_has_mips32r1 1
39#define cpu_has_mips32r2 0
40#define cpu_has_mips64r1 1
41#define cpu_has_mips64r2 0
42
43#define cpu_has_inclusive_pcaches 0
44
45#define cpu_dcache_line_size() 32
46#define cpu_icache_line_size() 32
47#define cpu_scache_line_size() 32
48
49#endif /* __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-tx39xx/ioremap.h b/arch/mips/include/asm/mach-tx39xx/ioremap.h
new file mode 100644
index 000000000..157a72923
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx39xx/ioremap.h
@@ -0,0 +1,25 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/mach-tx39xx/ioremap.h
4 */
5#ifndef __ASM_MACH_TX39XX_IOREMAP_H
6#define __ASM_MACH_TX39XX_IOREMAP_H
7
8#include <linux/types.h>
9
10static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
11 unsigned long flags)
12{
13#define TXX9_DIRECTMAP_BASE 0xff000000ul
14 if (offset >= TXX9_DIRECTMAP_BASE &&
15 offset < TXX9_DIRECTMAP_BASE + 0xff0000)
16 return (void __iomem *)offset;
17 return NULL;
18}
19
20static inline int plat_iounmap(const volatile void __iomem *addr)
21{
22 return (unsigned long)addr >= TXX9_DIRECTMAP_BASE;
23}
24
25#endif /* __ASM_MACH_TX39XX_IOREMAP_H */
diff --git a/arch/mips/include/asm/mach-tx39xx/mangle-port.h b/arch/mips/include/asm/mach-tx39xx/mangle-port.h
new file mode 100644
index 000000000..95be45995
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx39xx/mangle-port.h
@@ -0,0 +1,24 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_TX39XX_MANGLE_PORT_H
3#define __ASM_MACH_TX39XX_MANGLE_PORT_H
4
5#if defined(CONFIG_TOSHIBA_JMR3927)
6extern unsigned long (*__swizzle_addr_b)(unsigned long port);
7#define NEEDS_TXX9_SWIZZLE_ADDR_B
8#else
9#define __swizzle_addr_b(port) (port)
10#endif
11#define __swizzle_addr_w(port) (port)
12#define __swizzle_addr_l(port) (port)
13#define __swizzle_addr_q(port) (port)
14
15#define ioswabb(a, x) (x)
16#define __mem_ioswabb(a, x) (x)
17#define ioswabw(a, x) le16_to_cpu((__force __le16)(x))
18#define __mem_ioswabw(a, x) (x)
19#define ioswabl(a, x) le32_to_cpu((__force __le32)(x))
20#define __mem_ioswabl(a, x) (x)
21#define ioswabq(a, x) le64_to_cpu((__force __le64)(x))
22#define __mem_ioswabq(a, x) (x)
23
24#endif /* __ASM_MACH_TX39XX_MANGLE_PORT_H */
diff --git a/arch/mips/include/asm/mach-tx39xx/spaces.h b/arch/mips/include/asm/mach-tx39xx/spaces.h
new file mode 100644
index 000000000..151fe7a1c
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx39xx/spaces.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) 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_TX39XX_SPACES_H
11#define _ASM_TX39XX_SPACES_H
12
13#define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000)
14
15#include <asm/mach-generic/spaces.h>
16
17#endif /* __ASM_TX39XX_SPACES_H */
diff --git a/arch/mips/include/asm/mach-tx49xx/cpu-feature-overrides.h b/arch/mips/include/asm/mach-tx49xx/cpu-feature-overrides.h
new file mode 100644
index 000000000..04e424725
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx49xx/cpu-feature-overrides.h
@@ -0,0 +1,26 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_TX49XX_CPU_FEATURE_OVERRIDES_H
3#define __ASM_MACH_TX49XX_CPU_FEATURE_OVERRIDES_H
4
5#define cpu_has_llsc 1
6#define cpu_has_64bits 1
7#define cpu_has_inclusive_pcaches 0
8
9#define cpu_has_mips16 0
10#define cpu_has_mips16e2 0
11#define cpu_has_mdmx 0
12#define cpu_has_mips3d 0
13#define cpu_has_smartmips 0
14#define cpu_has_vtag_icache 0
15#define cpu_has_ic_fills_f_dc 0
16#define cpu_has_dsp 0
17#define cpu_has_dsp2 0
18#define cpu_has_mipsmt 0
19#define cpu_has_userlocal 0
20
21#define cpu_has_mips32r1 0
22#define cpu_has_mips32r2 0
23#define cpu_has_mips64r1 0
24#define cpu_has_mips64r2 0
25
26#endif /* __ASM_MACH_TX49XX_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-tx49xx/ioremap.h b/arch/mips/include/asm/mach-tx49xx/ioremap.h
new file mode 100644
index 000000000..b1f3710ac
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx49xx/ioremap.h
@@ -0,0 +1,30 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/mach-tx49xx/ioremap.h
4 */
5#ifndef __ASM_MACH_TX49XX_IOREMAP_H
6#define __ASM_MACH_TX49XX_IOREMAP_H
7
8#include <linux/types.h>
9
10static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
11 unsigned long flags)
12{
13#ifdef CONFIG_64BIT
14#define TXX9_DIRECTMAP_BASE 0xfff000000ul
15#else
16#define TXX9_DIRECTMAP_BASE 0xff000000ul
17#endif
18 if (offset >= TXX9_DIRECTMAP_BASE &&
19 offset < TXX9_DIRECTMAP_BASE + 0x400000)
20 return (void __iomem *)(unsigned long)(int)offset;
21 return NULL;
22}
23
24static inline int plat_iounmap(const volatile void __iomem *addr)
25{
26 return (unsigned long)addr >=
27 (unsigned long)(int)(TXX9_DIRECTMAP_BASE & 0xffffffff);
28}
29
30#endif /* __ASM_MACH_TX49XX_IOREMAP_H */
diff --git a/arch/mips/include/asm/mach-tx49xx/kmalloc.h b/arch/mips/include/asm/mach-tx49xx/kmalloc.h
new file mode 100644
index 000000000..c2a0a6fa4
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx49xx/kmalloc.h
@@ -0,0 +1,7 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_TX49XX_KMALLOC_H
3#define __ASM_MACH_TX49XX_KMALLOC_H
4
5#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
6
7#endif /* __ASM_MACH_TX49XX_KMALLOC_H */
diff --git a/arch/mips/include/asm/mach-tx49xx/mangle-port.h b/arch/mips/include/asm/mach-tx49xx/mangle-port.h
new file mode 100644
index 000000000..98c7abf44
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx49xx/mangle-port.h
@@ -0,0 +1,27 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_TX49XX_MANGLE_PORT_H
3#define __ASM_MACH_TX49XX_MANGLE_PORT_H
4
5#define __swizzle_addr_b(port) (port)
6#define __swizzle_addr_w(port) (port)
7#define __swizzle_addr_l(port) (port)
8#define __swizzle_addr_q(port) (port)
9
10#define ioswabb(a, x) (x)
11#define __mem_ioswabb(a, x) (x)
12#if defined(CONFIG_TOSHIBA_RBTX4939) && \
13 IS_ENABLED(CONFIG_SMC91X) && \
14 defined(__BIG_ENDIAN)
15#define NEEDS_TXX9_IOSWABW
16extern u16 (*ioswabw)(volatile u16 *a, u16 x);
17extern u16 (*__mem_ioswabw)(volatile u16 *a, u16 x);
18#else
19#define ioswabw(a, x) le16_to_cpu((__force __le16)(x))
20#define __mem_ioswabw(a, x) (x)
21#endif
22#define ioswabl(a, x) le32_to_cpu((__force __le32)(x))
23#define __mem_ioswabl(a, x) (x)
24#define ioswabq(a, x) le64_to_cpu((__force __le64)(x))
25#define __mem_ioswabq(a, x) (x)
26
27#endif /* __ASM_MACH_TX49XX_MANGLE_PORT_H */
diff --git a/arch/mips/include/asm/mach-tx49xx/spaces.h b/arch/mips/include/asm/mach-tx49xx/spaces.h
new file mode 100644
index 000000000..0cb10a6f4
--- /dev/null
+++ b/arch/mips/include/asm/mach-tx49xx/spaces.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) 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_TX49XX_SPACES_H
11#define _ASM_TX49XX_SPACES_H
12
13#define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000)
14
15#include <asm/mach-generic/spaces.h>
16
17#endif /* __ASM_TX49XX_SPACES_H */
diff --git a/arch/mips/include/asm/mach-vr41xx/irq.h b/arch/mips/include/asm/mach-vr41xx/irq.h
new file mode 100644
index 000000000..4281b2b93
--- /dev/null
+++ b/arch/mips/include/asm/mach-vr41xx/irq.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MACH_VR41XX_IRQ_H
3#define __ASM_MACH_VR41XX_IRQ_H
4
5#include <asm/vr41xx/irq.h> /* for MIPS_CPU_IRQ_BASE */
6
7#include <asm/mach-generic/irq.h>
8
9#endif /* __ASM_MACH_VR41XX_IRQ_H */
diff --git a/arch/mips/include/asm/machine.h b/arch/mips/include/asm/machine.h
new file mode 100644
index 000000000..fc64cce27
--- /dev/null
+++ b/arch/mips/include/asm/machine.h
@@ -0,0 +1,90 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2016 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_MACHINE_H__
8#define __MIPS_ASM_MACHINE_H__
9
10#include <linux/libfdt.h>
11#include <linux/of.h>
12
13struct mips_machine {
14 const struct of_device_id *matches;
15 const void *fdt;
16 bool (*detect)(void);
17 const void *(*fixup_fdt)(const void *fdt, const void *match_data);
18 unsigned int (*measure_hpt_freq)(void);
19};
20
21extern long __mips_machines_start;
22extern long __mips_machines_end;
23
24#define MIPS_MACHINE(name) \
25 static const struct mips_machine __mips_mach_##name \
26 __used __section(".mips.machines.init")
27
28#define for_each_mips_machine(mach) \
29 for ((mach) = (struct mips_machine *)&__mips_machines_start; \
30 (mach) < (struct mips_machine *)&__mips_machines_end; \
31 (mach)++)
32
33/**
34 * mips_machine_is_compatible() - check if a machine is compatible with an FDT
35 * @mach: the machine struct to check
36 * @fdt: the FDT to check for compatibility with
37 *
38 * Check whether the given machine @mach is compatible with the given flattened
39 * device tree @fdt, based upon the compatibility property of the root node.
40 *
41 * Return: the device id matched if any, else NULL
42 */
43static inline const struct of_device_id *
44mips_machine_is_compatible(const struct mips_machine *mach, const void *fdt)
45{
46 const struct of_device_id *match;
47
48 if (!mach->matches)
49 return NULL;
50
51 for (match = mach->matches; match->compatible[0]; match++) {
52 if (fdt_node_check_compatible(fdt, 0, match->compatible) == 0)
53 return match;
54 }
55
56 return NULL;
57}
58
59/**
60 * struct mips_fdt_fixup - Describe a fixup to apply to an FDT
61 * @apply: applies the fixup to @fdt, returns zero on success else -errno
62 * @description: a short description of the fixup
63 *
64 * Describes a fixup applied to an FDT blob by the @apply function. The
65 * @description field provides a short description of the fixup intended for
66 * use in error messages if the @apply function returns non-zero.
67 */
68struct mips_fdt_fixup {
69 int (*apply)(void *fdt);
70 const char *description;
71};
72
73/**
74 * apply_mips_fdt_fixups() - apply fixups to an FDT blob
75 * @fdt_out: buffer in which to place the fixed-up FDT
76 * @fdt_out_size: the size of the @fdt_out buffer
77 * @fdt_in: the FDT blob
78 * @fixups: pointer to an array of fixups to be applied
79 *
80 * Loop through the array of fixups pointed to by @fixups, calling the apply
81 * function on each until either one returns an error or we reach the end of
82 * the list as indicated by an entry with a NULL apply field.
83 *
84 * Return: zero on success, else -errno
85 */
86extern int __init apply_mips_fdt_fixups(void *fdt_out, size_t fdt_out_size,
87 const void *fdt_in,
88 const struct mips_fdt_fixup *fixups);
89
90#endif /* __MIPS_ASM_MACHINE_H__ */
diff --git a/arch/mips/include/asm/mc146818-time.h b/arch/mips/include/asm/mc146818-time.h
new file mode 100644
index 000000000..cbf5cec34
--- /dev/null
+++ b/arch/mips/include/asm/mc146818-time.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 * 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 unsigned long flags;
37
38 spin_lock_irqsave(&rtc_lock, flags);
39 save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */
40 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
41
42 save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */
43 CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
44
45 cmos_minutes = CMOS_READ(RTC_MINUTES);
46 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
47 cmos_minutes = bcd2bin(cmos_minutes);
48
49 /*
50 * since we're only adjusting minutes and seconds,
51 * don't interfere with hour overflow. This avoids
52 * messing with unknown time zones but requires your
53 * RTC not to be off by more than 15 minutes
54 */
55 real_seconds = nowtime % 60;
56 real_minutes = nowtime / 60;
57 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
58 real_minutes += 30; /* correct for half hour time zone */
59 real_minutes %= 60;
60
61 if (abs(real_minutes - cmos_minutes) < 30) {
62 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
63 real_seconds = bin2bcd(real_seconds);
64 real_minutes = bin2bcd(real_minutes);
65 }
66 CMOS_WRITE(real_seconds, RTC_SECONDS);
67 CMOS_WRITE(real_minutes, RTC_MINUTES);
68 } else {
69 printk_once(KERN_NOTICE
70 "set_rtc_mmss: can't update from %d to %d\n",
71 cmos_minutes, real_minutes);
72 retval = -1;
73 }
74
75 /* The following flags have to be released exactly in this order,
76 * otherwise the DS12887 (popular MC146818A clone with integrated
77 * battery and quartz) will not reset the oscillator and will not
78 * update precisely 500 ms later. You won't find this mentioned in
79 * the Dallas Semiconductor data sheets, but who believes data
80 * sheets anyway ... -- Markus Kuhn
81 */
82 CMOS_WRITE(save_control, RTC_CONTROL);
83 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
84 spin_unlock_irqrestore(&rtc_lock, flags);
85
86 return retval;
87}
88
89static inline time64_t mc146818_get_cmos_time(void)
90{
91 unsigned int year, mon, day, hour, min, sec;
92 unsigned long flags;
93
94 spin_lock_irqsave(&rtc_lock, flags);
95
96 do {
97 sec = CMOS_READ(RTC_SECONDS);
98 min = CMOS_READ(RTC_MINUTES);
99 hour = CMOS_READ(RTC_HOURS);
100 day = CMOS_READ(RTC_DAY_OF_MONTH);
101 mon = CMOS_READ(RTC_MONTH);
102 year = CMOS_READ(RTC_YEAR);
103 } while (sec != CMOS_READ(RTC_SECONDS));
104
105 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
106 sec = bcd2bin(sec);
107 min = bcd2bin(min);
108 hour = bcd2bin(hour);
109 day = bcd2bin(day);
110 mon = bcd2bin(mon);
111 year = bcd2bin(year);
112 }
113 spin_unlock_irqrestore(&rtc_lock, flags);
114 year = mc146818_decode_year(year);
115
116 return mktime64(year, mon, day, hour, min, sec);
117}
118
119#endif /* __ASM_MC146818_TIME_H */
diff --git a/arch/mips/include/asm/mc146818rtc.h b/arch/mips/include/asm/mc146818rtc.h
new file mode 100644
index 000000000..68b4da6d5
--- /dev/null
+++ b/arch/mips/include/asm/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/arch/mips/include/asm/mips-boards/bonito64.h b/arch/mips/include/asm/mips-boards/bonito64.h
new file mode 100644
index 000000000..5368891d4
--- /dev/null
+++ b/arch/mips/include/asm/mips-boards/bonito64.h
@@ -0,0 +1,430 @@
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
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_ADDRTRANS(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
418
419#define BONITO_PCITOPHYS(WIN, ADDR, CFG) ( \
420 (((ADDR) & (~(BONITO_PCIMEMBASECFG_MASK))) & (~(BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG)))) | \
421 (BONITO_PCIMEMBASECFG_ADDRTRANS(WIN, CFG)) \
422 )
423
424/* PCICmd */
425
426#define BONITO_PCICMD_MEMEN 0x00000002
427#define BONITO_PCICMD_MSTREN 0x00000004
428
429
430#endif /* _ASM_MIPS_BOARDS_BONITO64_H */
diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h
new file mode 100644
index 000000000..c904c2455
--- /dev/null
+++ b/arch/mips/include/asm/mips-boards/generic.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 * Defines of the MIPS boards specific address-MAP, registers, etc.
7 *
8 * Copyright (C) 2000,2012 MIPS Technologies, Inc.
9 * All rights reserved.
10 * Authors: Carsten Langgaard <carstenl@mips.com>
11 * Steven J. Hill <sjhill@mips.com>
12 */
13#ifndef __ASM_MIPS_BOARDS_GENERIC_H
14#define __ASM_MIPS_BOARDS_GENERIC_H
15
16#include <asm/addrspace.h>
17#include <asm/byteorder.h>
18#include <asm/mips-boards/bonito64.h>
19
20/*
21 * Display register base.
22 */
23#define ASCII_DISPLAY_WORD_BASE 0x1f000410
24#define ASCII_DISPLAY_POS_BASE 0x1f000418
25
26/*
27 * Revision register.
28 */
29#define MIPS_REVISION_REG 0x1fc00010
30#define MIPS_REVISION_CORID_QED_RM5261 0
31#define MIPS_REVISION_CORID_CORE_LV 1
32#define MIPS_REVISION_CORID_BONITO64 2
33#define MIPS_REVISION_CORID_CORE_20K 3
34#define MIPS_REVISION_CORID_CORE_FPGA 4
35#define MIPS_REVISION_CORID_CORE_MSC 5
36#define MIPS_REVISION_CORID_CORE_EMUL 6
37#define MIPS_REVISION_CORID_CORE_FPGA2 7
38#define MIPS_REVISION_CORID_CORE_FPGAR2 8
39#define MIPS_REVISION_CORID_CORE_FPGA3 9
40#define MIPS_REVISION_CORID_CORE_24K 10
41#define MIPS_REVISION_CORID_CORE_FPGA4 11
42#define MIPS_REVISION_CORID_CORE_FPGA5 12
43
44/**** Artificial corid defines ****/
45/*
46 * CoreEMUL with Bonito System Controller is treated like a Core20K
47 * CoreEMUL with SOC-it 101 System Controller is treated like a CoreMSC
48 */
49#define MIPS_REVISION_CORID_CORE_EMUL_BON -1
50#define MIPS_REVISION_CORID_CORE_EMUL_MSC -2
51
52#define MIPS_REVISION_CORID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 10) & 0x3f)
53
54#define MIPS_REVISION_SCON_OTHER 0
55#define MIPS_REVISION_SCON_SOCITSC 1
56#define MIPS_REVISION_SCON_SOCITSCP 2
57
58/* Artificial SCON defines for MIPS_REVISION_SCON_OTHER */
59#define MIPS_REVISION_SCON_UNKNOWN -1
60#define MIPS_REVISION_SCON_GT64120 -2
61#define MIPS_REVISION_SCON_BONITO -3
62#define MIPS_REVISION_SCON_BRTL -4
63#define MIPS_REVISION_SCON_SOCIT -5
64#define MIPS_REVISION_SCON_ROCIT -6
65
66#define MIPS_REVISION_SCONID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 24) & 0xff)
67
68extern int mips_revision_sconid;
69
70#ifdef CONFIG_PCI
71extern void mips_pcibios_init(void);
72#else
73#define mips_pcibios_init() do { } while (0)
74#endif
75
76extern void mips_scroll_message(void);
77extern void mips_display_message(const char *str);
78
79#endif /* __ASM_MIPS_BOARDS_GENERIC_H */
diff --git a/arch/mips/include/asm/mips-boards/launch.h b/arch/mips/include/asm/mips-boards/launch.h
new file mode 100644
index 000000000..f93aa5ee2
--- /dev/null
+++ b/arch/mips/include/asm/mips-boards/launch.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 *
4 */
5
6#ifndef _ASSEMBLER_
7
8struct cpulaunch {
9 unsigned long pc;
10 unsigned long gp;
11 unsigned long sp;
12 unsigned long a0;
13 unsigned long _pad[3]; /* pad to cache line size to avoid thrashing */
14 unsigned long flags;
15};
16
17#else
18
19#define LOG2CPULAUNCH 5
20#define LAUNCH_PC 0
21#define LAUNCH_GP 4
22#define LAUNCH_SP 8
23#define LAUNCH_A0 12
24#define LAUNCH_FLAGS 28
25
26#endif
27
28#define LAUNCH_FREADY 1
29#define LAUNCH_FGO 2
30#define LAUNCH_FGONE 4
31
32#define CPULAUNCH 0x00000f00
33#define NCPULAUNCH 8
34
35/* Polling period in count cycles for secondary CPU's */
36#define LAUNCHPERIOD 10000
diff --git a/arch/mips/include/asm/mips-boards/malta.h b/arch/mips/include/asm/mips-boards/malta.h
new file mode 100644
index 000000000..254be3d62
--- /dev/null
+++ b/arch/mips/include/asm/mips-boards/malta.h
@@ -0,0 +1,97 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Carsten Langgaard, carstenl@mips.com
4 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
5 *
6 * Defines of the Malta board specific address-MAP, registers, etc.
7 */
8#ifndef __ASM_MIPS_BOARDS_MALTA_H
9#define __ASM_MIPS_BOARDS_MALTA_H
10
11#include <asm/addrspace.h>
12#include <asm/io.h>
13#include <asm/mips-boards/msc01_pci.h>
14#include <asm/gt64120.h>
15
16/* Mips interrupt controller found in SOCit variations */
17#define MIPS_MSC01_IC_REG_BASE 0x1bc40000
18#define MIPS_SOCITSC_IC_REG_BASE 0x1ffa0000
19
20/*
21 * Malta I/O ports base address for the Galileo GT64120 and Algorithmics
22 * Bonito system controllers.
23 */
24#define MALTA_GT_PORT_BASE get_gt_port_base(GT_PCI0IOLD_OFS)
25#define MALTA_BONITO_PORT_BASE ((unsigned long)ioremap (0x1fd00000, 0x10000))
26#define MALTA_MSC_PORT_BASE get_msc_port_base(MSC01_PCI_SC2PIOBASL)
27
28static inline unsigned long get_gt_port_base(unsigned long reg)
29{
30 unsigned long addr;
31 addr = GT_READ(reg);
32 return (unsigned long) ioremap (((addr & 0xffff) << 21), 0x10000);
33}
34
35static inline unsigned long get_msc_port_base(unsigned long reg)
36{
37 unsigned long addr;
38 MSC_READ(reg, addr);
39 return (unsigned long) ioremap(addr, 0x10000);
40}
41
42/*
43 * GCMP Specific definitions
44 */
45#define GCMP_BASE_ADDR 0x1fbf8000
46#define GCMP_ADDRSPACE_SZ (256 * 1024)
47
48/*
49 * GIC Specific definitions
50 */
51#define GIC_BASE_ADDR 0x1bdc0000
52#define GIC_ADDRSPACE_SZ (128 * 1024)
53
54/*
55 * CPC Specific definitions
56 */
57#define CPC_BASE_ADDR 0x1bde0000
58
59/*
60 * MSC01 BIU Specific definitions
61 * FIXME : These should be elsewhere ?
62 */
63#define MSC01_BIU_REG_BASE 0x1bc80000
64#define MSC01_BIU_ADDRSPACE_SZ (256 * 1024)
65#define MSC01_SC_CFG_OFS 0x0110
66#define MSC01_SC_CFG_GICPRES_MSK 0x00000004
67#define MSC01_SC_CFG_GICPRES_SHF 2
68#define MSC01_SC_CFG_GICENA_SHF 3
69
70/*
71 * Malta RTC-device indirect register access.
72 */
73#define MALTA_RTC_ADR_REG 0x70
74#define MALTA_RTC_DAT_REG 0x71
75
76/*
77 * Malta SMSC FDC37M817 Super I/O Controller register.
78 */
79#define SMSC_CONFIG_REG 0x3f0
80#define SMSC_DATA_REG 0x3f1
81
82#define SMSC_CONFIG_DEVNUM 0x7
83#define SMSC_CONFIG_ACTIVATE 0x30
84#define SMSC_CONFIG_ENTER 0x55
85#define SMSC_CONFIG_EXIT 0xaa
86
87#define SMSC_CONFIG_DEVNUM_FLOPPY 0
88
89#define SMSC_CONFIG_ACTIVATE_ENABLE 1
90
91#define SMSC_WRITE(x, a) outb(x, a)
92
93#define MALTA_JMPRS_REG 0x1f000210
94
95extern void __init *malta_dt_shim(void *fdt);
96
97#endif /* __ASM_MIPS_BOARDS_MALTA_H */
diff --git a/arch/mips/include/asm/mips-boards/maltaint.h b/arch/mips/include/asm/mips-boards/maltaint.h
new file mode 100644
index 000000000..817698abf
--- /dev/null
+++ b/arch/mips/include/asm/mips-boards/maltaint.h
@@ -0,0 +1,63 @@
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,2012 MIPS Technologies, Inc. All rights reserved.
7 * Carsten Langgaard <carstenl@mips.com>
8 * Steven J. Hill <sjhill@mips.com>
9 */
10#ifndef _MIPS_MALTAINT_H
11#define _MIPS_MALTAINT_H
12
13/*
14 * Interrupts 0..15 are used for Malta ISA compatible interrupts
15 */
16#define MALTA_INT_BASE 0
17
18/* CPU interrupt offsets */
19#define MIPSCPU_INT_SW0 0
20#define MIPSCPU_INT_SW1 1
21#define MIPSCPU_INT_MB0 2
22#define MIPSCPU_INT_I8259A MIPSCPU_INT_MB0
23#define MIPSCPU_INT_GIC MIPSCPU_INT_MB0 /* GIC chained interrupt */
24#define MIPSCPU_INT_MB1 3
25#define MIPSCPU_INT_SMI MIPSCPU_INT_MB1
26#define MIPSCPU_INT_MB2 4
27#define MIPSCPU_INT_MB3 5
28#define MIPSCPU_INT_COREHI MIPSCPU_INT_MB3
29#define MIPSCPU_INT_MB4 6
30#define MIPSCPU_INT_CORELO MIPSCPU_INT_MB4
31
32/*
33 * Interrupts 96..127 are used for Soc-it Classic interrupts
34 */
35#define MSC01C_INT_BASE 96
36
37/* SOC-it Classic interrupt offsets */
38#define MSC01C_INT_TMR 0
39#define MSC01C_INT_PCI 1
40
41/*
42 * Interrupts 96..127 are used for Soc-it EIC interrupts
43 */
44#define MSC01E_INT_BASE 96
45
46/* SOC-it EIC interrupt offsets */
47#define MSC01E_INT_SW0 1
48#define MSC01E_INT_SW1 2
49#define MSC01E_INT_MB0 3
50#define MSC01E_INT_I8259A MSC01E_INT_MB0
51#define MSC01E_INT_MB1 4
52#define MSC01E_INT_SMI MSC01E_INT_MB1
53#define MSC01E_INT_MB2 5
54#define MSC01E_INT_MB3 6
55#define MSC01E_INT_COREHI MSC01E_INT_MB3
56#define MSC01E_INT_MB4 7
57#define MSC01E_INT_CORELO MSC01E_INT_MB4
58#define MSC01E_INT_TMR 8
59#define MSC01E_INT_PCI 9
60#define MSC01E_INT_PERFCTR 10
61#define MSC01E_INT_CPUCTR 11
62
63#endif /* !(_MIPS_MALTAINT_H) */
diff --git a/arch/mips/include/asm/mips-boards/msc01_pci.h b/arch/mips/include/asm/mips-boards/msc01_pci.h
new file mode 100644
index 000000000..e036b7dd6
--- /dev/null
+++ b/arch/mips/include/asm/mips-boards/msc01_pci.h
@@ -0,0 +1,258 @@
1/*
2 * PCI Register definitions for the MIPS System Controller.
3 *
4 * Copyright (C) 2002, 2005 MIPS Technologies, Inc. All rights reserved.
5 * Authors: Carsten Langgaard <carstenl@mips.com>
6 * Maciej W. Rozycki <macro@mips.com>
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#ifndef __ASM_MIPS_BOARDS_MSC01_PCI_H
13#define __ASM_MIPS_BOARDS_MSC01_PCI_H
14
15/*
16 * Register offset addresses
17 */
18
19#define MSC01_PCI_ID_OFS 0x0000
20#define MSC01_PCI_SC2PMBASL_OFS 0x0208
21#define MSC01_PCI_SC2PMMSKL_OFS 0x0218
22#define MSC01_PCI_SC2PMMAPL_OFS 0x0228
23#define MSC01_PCI_SC2PIOBASL_OFS 0x0248
24#define MSC01_PCI_SC2PIOMSKL_OFS 0x0258
25#define MSC01_PCI_SC2PIOMAPL_OFS 0x0268
26#define MSC01_PCI_P2SCMSKL_OFS 0x0308
27#define MSC01_PCI_P2SCMAPL_OFS 0x0318
28#define MSC01_PCI_INTCFG_OFS 0x0600
29#define MSC01_PCI_INTSTAT_OFS 0x0608
30#define MSC01_PCI_CFGADDR_OFS 0x0610
31#define MSC01_PCI_CFGDATA_OFS 0x0618
32#define MSC01_PCI_IACK_OFS 0x0620
33#define MSC01_PCI_HEAD0_OFS 0x2000 /* DevID, VendorID */
34#define MSC01_PCI_HEAD1_OFS 0x2008 /* Status, Command */
35#define MSC01_PCI_HEAD2_OFS 0x2010 /* Class code, RevID */
36#define MSC01_PCI_HEAD3_OFS 0x2018 /* bist, header, latency */
37#define MSC01_PCI_HEAD4_OFS 0x2020 /* BAR 0 */
38#define MSC01_PCI_HEAD5_OFS 0x2028 /* BAR 1 */
39#define MSC01_PCI_HEAD6_OFS 0x2030 /* BAR 2 */
40#define MSC01_PCI_HEAD7_OFS 0x2038 /* BAR 3 */
41#define MSC01_PCI_HEAD8_OFS 0x2040 /* BAR 4 */
42#define MSC01_PCI_HEAD9_OFS 0x2048 /* BAR 5 */
43#define MSC01_PCI_HEAD10_OFS 0x2050 /* CardBus CIS Ptr */
44#define MSC01_PCI_HEAD11_OFS 0x2058 /* SubSystem ID, -VendorID */
45#define MSC01_PCI_HEAD12_OFS 0x2060 /* ROM BAR */
46#define MSC01_PCI_HEAD13_OFS 0x2068 /* Capabilities ptr */
47#define MSC01_PCI_HEAD14_OFS 0x2070 /* reserved */
48#define MSC01_PCI_HEAD15_OFS 0x2078 /* Maxl, ming, intpin, int */
49#define MSC01_PCI_BAR0_OFS 0x2220
50#define MSC01_PCI_CFG_OFS 0x2380
51#define MSC01_PCI_SWAP_OFS 0x2388
52
53
54/*****************************************************************************
55 * Register encodings
56 ****************************************************************************/
57
58#define MSC01_PCI_ID_ID_SHF 16
59#define MSC01_PCI_ID_ID_MSK 0x00ff0000
60#define MSC01_PCI_ID_ID_HOSTBRIDGE 82
61#define MSC01_PCI_ID_MAR_SHF 8
62#define MSC01_PCI_ID_MAR_MSK 0x0000ff00
63#define MSC01_PCI_ID_MIR_SHF 0
64#define MSC01_PCI_ID_MIR_MSK 0x000000ff
65
66#define MSC01_PCI_SC2PMBASL_BAS_SHF 24
67#define MSC01_PCI_SC2PMBASL_BAS_MSK 0xff000000
68
69#define MSC01_PCI_SC2PMMSKL_MSK_SHF 24
70#define MSC01_PCI_SC2PMMSKL_MSK_MSK 0xff000000
71
72#define MSC01_PCI_SC2PMMAPL_MAP_SHF 24
73#define MSC01_PCI_SC2PMMAPL_MAP_MSK 0xff000000
74
75#define MSC01_PCI_SC2PIOBASL_BAS_SHF 24
76#define MSC01_PCI_SC2PIOBASL_BAS_MSK 0xff000000
77
78#define MSC01_PCI_SC2PIOMSKL_MSK_SHF 24
79#define MSC01_PCI_SC2PIOMSKL_MSK_MSK 0xff000000
80
81#define MSC01_PCI_SC2PIOMAPL_MAP_SHF 24
82#define MSC01_PCI_SC2PIOMAPL_MAP_MSK 0xff000000
83
84#define MSC01_PCI_P2SCMSKL_MSK_SHF 24
85#define MSC01_PCI_P2SCMSKL_MSK_MSK 0xff000000
86
87#define MSC01_PCI_P2SCMAPL_MAP_SHF 24
88#define MSC01_PCI_P2SCMAPL_MAP_MSK 0xff000000
89
90#define MSC01_PCI_INTCFG_RST_SHF 10
91#define MSC01_PCI_INTCFG_RST_MSK 0x00000400
92#define MSC01_PCI_INTCFG_RST_BIT 0x00000400
93#define MSC01_PCI_INTCFG_MWE_SHF 9
94#define MSC01_PCI_INTCFG_MWE_MSK 0x00000200
95#define MSC01_PCI_INTCFG_MWE_BIT 0x00000200
96#define MSC01_PCI_INTCFG_DTO_SHF 8
97#define MSC01_PCI_INTCFG_DTO_MSK 0x00000100
98#define MSC01_PCI_INTCFG_DTO_BIT 0x00000100
99#define MSC01_PCI_INTCFG_MA_SHF 7
100#define MSC01_PCI_INTCFG_MA_MSK 0x00000080
101#define MSC01_PCI_INTCFG_MA_BIT 0x00000080
102#define MSC01_PCI_INTCFG_TA_SHF 6
103#define MSC01_PCI_INTCFG_TA_MSK 0x00000040
104#define MSC01_PCI_INTCFG_TA_BIT 0x00000040
105#define MSC01_PCI_INTCFG_RTY_SHF 5
106#define MSC01_PCI_INTCFG_RTY_MSK 0x00000020
107#define MSC01_PCI_INTCFG_RTY_BIT 0x00000020
108#define MSC01_PCI_INTCFG_MWP_SHF 4
109#define MSC01_PCI_INTCFG_MWP_MSK 0x00000010
110#define MSC01_PCI_INTCFG_MWP_BIT 0x00000010
111#define MSC01_PCI_INTCFG_MRP_SHF 3
112#define MSC01_PCI_INTCFG_MRP_MSK 0x00000008
113#define MSC01_PCI_INTCFG_MRP_BIT 0x00000008
114#define MSC01_PCI_INTCFG_SWP_SHF 2
115#define MSC01_PCI_INTCFG_SWP_MSK 0x00000004
116#define MSC01_PCI_INTCFG_SWP_BIT 0x00000004
117#define MSC01_PCI_INTCFG_SRP_SHF 1
118#define MSC01_PCI_INTCFG_SRP_MSK 0x00000002
119#define MSC01_PCI_INTCFG_SRP_BIT 0x00000002
120#define MSC01_PCI_INTCFG_SE_SHF 0
121#define MSC01_PCI_INTCFG_SE_MSK 0x00000001
122#define MSC01_PCI_INTCFG_SE_BIT 0x00000001
123
124#define MSC01_PCI_INTSTAT_RST_SHF 10
125#define MSC01_PCI_INTSTAT_RST_MSK 0x00000400
126#define MSC01_PCI_INTSTAT_RST_BIT 0x00000400
127#define MSC01_PCI_INTSTAT_MWE_SHF 9
128#define MSC01_PCI_INTSTAT_MWE_MSK 0x00000200
129#define MSC01_PCI_INTSTAT_MWE_BIT 0x00000200
130#define MSC01_PCI_INTSTAT_DTO_SHF 8
131#define MSC01_PCI_INTSTAT_DTO_MSK 0x00000100
132#define MSC01_PCI_INTSTAT_DTO_BIT 0x00000100
133#define MSC01_PCI_INTSTAT_MA_SHF 7
134#define MSC01_PCI_INTSTAT_MA_MSK 0x00000080
135#define MSC01_PCI_INTSTAT_MA_BIT 0x00000080
136#define MSC01_PCI_INTSTAT_TA_SHF 6
137#define MSC01_PCI_INTSTAT_TA_MSK 0x00000040
138#define MSC01_PCI_INTSTAT_TA_BIT 0x00000040
139#define MSC01_PCI_INTSTAT_RTY_SHF 5
140#define MSC01_PCI_INTSTAT_RTY_MSK 0x00000020
141#define MSC01_PCI_INTSTAT_RTY_BIT 0x00000020
142#define MSC01_PCI_INTSTAT_MWP_SHF 4
143#define MSC01_PCI_INTSTAT_MWP_MSK 0x00000010
144#define MSC01_PCI_INTSTAT_MWP_BIT 0x00000010
145#define MSC01_PCI_INTSTAT_MRP_SHF 3
146#define MSC01_PCI_INTSTAT_MRP_MSK 0x00000008
147#define MSC01_PCI_INTSTAT_MRP_BIT 0x00000008
148#define MSC01_PCI_INTSTAT_SWP_SHF 2
149#define MSC01_PCI_INTSTAT_SWP_MSK 0x00000004
150#define MSC01_PCI_INTSTAT_SWP_BIT 0x00000004
151#define MSC01_PCI_INTSTAT_SRP_SHF 1
152#define MSC01_PCI_INTSTAT_SRP_MSK 0x00000002
153#define MSC01_PCI_INTSTAT_SRP_BIT 0x00000002
154#define MSC01_PCI_INTSTAT_SE_SHF 0
155#define MSC01_PCI_INTSTAT_SE_MSK 0x00000001
156#define MSC01_PCI_INTSTAT_SE_BIT 0x00000001
157
158#define MSC01_PCI_CFGADDR_BNUM_SHF 16
159#define MSC01_PCI_CFGADDR_BNUM_MSK 0x00ff0000
160#define MSC01_PCI_CFGADDR_DNUM_SHF 11
161#define MSC01_PCI_CFGADDR_DNUM_MSK 0x0000f800
162#define MSC01_PCI_CFGADDR_FNUM_SHF 8
163#define MSC01_PCI_CFGADDR_FNUM_MSK 0x00000700
164#define MSC01_PCI_CFGADDR_RNUM_SHF 2
165#define MSC01_PCI_CFGADDR_RNUM_MSK 0x000000fc
166
167#define MSC01_PCI_CFGDATA_DATA_SHF 0
168#define MSC01_PCI_CFGDATA_DATA_MSK 0xffffffff
169
170/* The defines below are ONLY valid for a MEM bar! */
171#define MSC01_PCI_BAR0_SIZE_SHF 4
172#define MSC01_PCI_BAR0_SIZE_MSK 0xfffffff0
173#define MSC01_PCI_BAR0_P_SHF 3
174#define MSC01_PCI_BAR0_P_MSK 0x00000008
175#define MSC01_PCI_BAR0_P_BIT MSC01_PCI_BAR0_P_MSK
176#define MSC01_PCI_BAR0_D_SHF 1
177#define MSC01_PCI_BAR0_D_MSK 0x00000006
178#define MSC01_PCI_BAR0_T_SHF 0
179#define MSC01_PCI_BAR0_T_MSK 0x00000001
180#define MSC01_PCI_BAR0_T_BIT MSC01_PCI_BAR0_T_MSK
181
182
183#define MSC01_PCI_CFG_RA_SHF 17
184#define MSC01_PCI_CFG_RA_MSK 0x00020000
185#define MSC01_PCI_CFG_RA_BIT MSC01_PCI_CFG_RA_MSK
186#define MSC01_PCI_CFG_G_SHF 16
187#define MSC01_PCI_CFG_G_MSK 0x00010000
188#define MSC01_PCI_CFG_G_BIT MSC01_PCI_CFG_G_MSK
189#define MSC01_PCI_CFG_EN_SHF 15
190#define MSC01_PCI_CFG_EN_MSK 0x00008000
191#define MSC01_PCI_CFG_EN_BIT MSC01_PCI_CFG_EN_MSK
192#define MSC01_PCI_CFG_MAXRTRY_SHF 0
193#define MSC01_PCI_CFG_MAXRTRY_MSK 0x00000fff
194
195#define MSC01_PCI_SWAP_IO_SHF 18
196#define MSC01_PCI_SWAP_IO_MSK 0x000c0000
197#define MSC01_PCI_SWAP_MEM_SHF 16
198#define MSC01_PCI_SWAP_MEM_MSK 0x00030000
199#define MSC01_PCI_SWAP_BAR0_SHF 0
200#define MSC01_PCI_SWAP_BAR0_MSK 0x00000003
201#define MSC01_PCI_SWAP_NOSWAP 0
202#define MSC01_PCI_SWAP_BYTESWAP 1
203
204/*
205 * MIPS System controller PCI register base.
206 *
207 * FIXME - are these macros specific to Malta and co or to the MSC? If the
208 * latter, they should be moved elsewhere.
209 */
210#define MIPS_MSC01_PCI_REG_BASE 0x1bd00000
211#define MIPS_SOCITSC_PCI_REG_BASE 0x1ff10000
212
213extern unsigned long _pcictrl_msc;
214
215#define MSC01_PCI_REG_BASE _pcictrl_msc
216
217#define MSC_WRITE(reg, data) do { *(volatile u32 *)(reg) = data; } while (0)
218#define MSC_READ(reg, data) do { data = *(volatile u32 *)(reg); } while (0)
219
220/*
221 * Registers absolute addresses
222 */
223
224#define MSC01_PCI_ID (MSC01_PCI_REG_BASE + MSC01_PCI_ID_OFS)
225#define MSC01_PCI_SC2PMBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMBASL_OFS)
226#define MSC01_PCI_SC2PMMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMSKL_OFS)
227#define MSC01_PCI_SC2PMMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMAPL_OFS)
228#define MSC01_PCI_SC2PIOBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOBASL_OFS)
229#define MSC01_PCI_SC2PIOMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMSKL_OFS)
230#define MSC01_PCI_SC2PIOMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMAPL_OFS)
231#define MSC01_PCI_P2SCMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMSKL_OFS)
232#define MSC01_PCI_P2SCMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMAPL_OFS)
233#define MSC01_PCI_INTCFG (MSC01_PCI_REG_BASE + MSC01_PCI_INTCFG_OFS)
234#define MSC01_PCI_INTSTAT (MSC01_PCI_REG_BASE + MSC01_PCI_INTSTAT_OFS)
235#define MSC01_PCI_CFGADDR (MSC01_PCI_REG_BASE + MSC01_PCI_CFGADDR_OFS)
236#define MSC01_PCI_CFGDATA (MSC01_PCI_REG_BASE + MSC01_PCI_CFGDATA_OFS)
237#define MSC01_PCI_IACK (MSC01_PCI_REG_BASE + MSC01_PCI_IACK_OFS)
238#define MSC01_PCI_HEAD0 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD0_OFS)
239#define MSC01_PCI_HEAD1 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD1_OFS)
240#define MSC01_PCI_HEAD2 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD2_OFS)
241#define MSC01_PCI_HEAD3 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD3_OFS)
242#define MSC01_PCI_HEAD4 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD4_OFS)
243#define MSC01_PCI_HEAD5 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD5_OFS)
244#define MSC01_PCI_HEAD6 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD6_OFS)
245#define MSC01_PCI_HEAD7 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD7_OFS)
246#define MSC01_PCI_HEAD8 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD8_OFS)
247#define MSC01_PCI_HEAD9 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD9_OFS)
248#define MSC01_PCI_HEAD10 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD10_OFS)
249#define MSC01_PCI_HEAD11 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
250#define MSC01_PCI_HEAD12 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
251#define MSC01_PCI_HEAD13 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
252#define MSC01_PCI_HEAD14 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
253#define MSC01_PCI_HEAD15 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
254#define MSC01_PCI_BAR0 (MSC01_PCI_REG_BASE + MSC01_PCI_BAR0_OFS)
255#define MSC01_PCI_CFG (MSC01_PCI_REG_BASE + MSC01_PCI_CFG_OFS)
256#define MSC01_PCI_SWAP (MSC01_PCI_REG_BASE + MSC01_PCI_SWAP_OFS)
257
258#endif /* __ASM_MIPS_BOARDS_MSC01_PCI_H */
diff --git a/arch/mips/include/asm/mips-boards/piix4.h b/arch/mips/include/asm/mips-boards/piix4.h
new file mode 100644
index 000000000..e174bc7c8
--- /dev/null
+++ b/arch/mips/include/asm/mips-boards/piix4.h
@@ -0,0 +1,58 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Carsten Langgaard, carstenl@mips.com
4 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
5 * Copyright (C) 2013 Imagination Technologies Ltd.
6 *
7 * Register definitions for Intel PIIX4 South Bridge Device.
8 */
9#ifndef __ASM_MIPS_BOARDS_PIIX4_H
10#define __ASM_MIPS_BOARDS_PIIX4_H
11
12/* PIRQX Route Control */
13#define PIIX4_FUNC0_PIRQRC 0x60
14#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_DISABLE (1 << 7)
15#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MASK 0xf
16#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MAX 16
17/* SERIRQ Control */
18#define PIIX4_FUNC0_SERIRQC 0x64
19#define PIIX4_FUNC0_SERIRQC_EN (1 << 7)
20#define PIIX4_FUNC0_SERIRQC_CONT (1 << 6)
21/* Top Of Memory */
22#define PIIX4_FUNC0_TOM 0x69
23#define PIIX4_FUNC0_TOM_TOP_OF_MEMORY_MASK 0xf0
24/* Deterministic Latency Control */
25#define PIIX4_FUNC0_DLC 0x82
26#define PIIX4_FUNC0_DLC_USBPR_EN (1 << 2)
27#define PIIX4_FUNC0_DLC_PASSIVE_RELEASE_EN (1 << 1)
28#define PIIX4_FUNC0_DLC_DELAYED_TRANSACTION_EN (1 << 0)
29/* General Configuration */
30#define PIIX4_FUNC0_GENCFG 0xb0
31#define PIIX4_FUNC0_GENCFG_SERIRQ (1 << 16)
32
33/* IDE Timing */
34#define PIIX4_FUNC1_IDETIM_PRIMARY_LO 0x40
35#define PIIX4_FUNC1_IDETIM_PRIMARY_HI 0x41
36#define PIIX4_FUNC1_IDETIM_PRIMARY_HI_IDE_DECODE_EN (1 << 7)
37#define PIIX4_FUNC1_IDETIM_SECONDARY_LO 0x42
38#define PIIX4_FUNC1_IDETIM_SECONDARY_HI 0x43
39#define PIIX4_FUNC1_IDETIM_SECONDARY_HI_IDE_DECODE_EN (1 << 7)
40
41/* Power Management Configuration Space */
42#define PIIX4_FUNC3_PMBA 0x40
43#define PIIX4_FUNC3_PMREGMISC 0x80
44#define PIIX4_FUNC3_PMREGMISC_EN (1 << 0)
45
46/* Power Management IO Space */
47#define PIIX4_FUNC3IO_PMSTS 0x00
48#define PIIX4_FUNC3IO_PMSTS_PWRBTN_STS (1 << 8)
49#define PIIX4_FUNC3IO_PMCNTRL 0x04
50#define PIIX4_FUNC3IO_PMCNTRL_SUS_EN (1 << 13)
51#define PIIX4_FUNC3IO_PMCNTRL_SUS_TYP (0x7 << 10)
52#define PIIX4_FUNC3IO_PMCNTRL_SUS_TYP_SOFF (0x0 << 10)
53#define PIIX4_FUNC3IO_PMCNTRL_SUS_TYP_STR (0x1 << 10)
54
55/* Data for magic special PCI cycle */
56#define PIIX4_SUSPEND_MAGIC 0x00120002
57
58#endif /* __ASM_MIPS_BOARDS_PIIX4_H */
diff --git a/arch/mips/include/asm/mips-boards/sead3-addr.h b/arch/mips/include/asm/mips-boards/sead3-addr.h
new file mode 100644
index 000000000..c0db57802
--- /dev/null
+++ b/arch/mips/include/asm/mips-boards/sead3-addr.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) 2015 Imagination Technologies, Inc.
7 * written by Ralf Baechle <ralf@linux-mips.org>
8 */
9#ifndef __ASM_MIPS_BOARDS_SEAD3_ADDR_H
10#define __ASM_MIPS_BOARDS_SEAD3_ADDR_H
11
12/*
13 * Target #0 Register Decode
14 */
15#define SEAD3_SD_SPDCNF 0xbb000040
16#define SEAD3_SD_SPADDR 0xbb000048
17#define SEAD3_SD_DATA 0xbb000050
18
19/*
20 * Target #1 Register Decode
21 */
22#define SEAD3_CFG 0xbb100110
23#define SEAD3_GIC_BASE_ADDRESS 0xbb1c0000
24#define SEAD3_SHARED_SECTION 0xbb1c0000
25#define SEAD3_VPE_LOCAL_SECTION 0xbb1c8000
26#define SEAD3_VPE_OTHER_SECTION 0xbb1cc000
27#define SEAD3_USER_MODE_VISIBLE_SECTION 0xbb1d0000
28
29/*
30 * Target #3 Register Decode
31 */
32#define SEAD3_USB_HS_BASE 0xbb200000
33#define SEAD3_USB_HS_IDENTIFICATION_REGS 0xbb200000
34#define SEAD3_USB_HS_CAPABILITY_REGS 0xbb200100
35#define SEAD3_USB_HS_OPERATIONAL_REGS 0xbb200140
36#define SEAD3_RESERVED 0xbe800000
37
38/*
39 * Target #3 Register Decode
40 */
41#define SEAD3_SRAM 0xbe000000
42#define SEAD3_OPTIONAL_SRAM 0xbe400000
43#define SEAD3_FPGA 0xbf000000
44
45#define SEAD3_PI_PIC32_USB_STATUS 0xbf000060
46#define SEAD3_PI_PIC32_USB_STATUS_IO_RDY (1 << 0)
47#define SEAD3_PI_PIC32_USB_STATUS_SPL_INT (1 << 1)
48#define SEAD3_PI_PIC32_USB_STATUS_GPIOA_INT (1 << 2)
49#define SEAD3_PI_PIC32_USB_STATUS_GPIOB_INT (1 << 3)
50
51#define SEAD3_PI_SOFT_ENDIAN 0xbf000070
52
53#define SEAD3_CPLD_P_SWITCH 0xbf000200
54#define SEAD3_CPLD_F_SWITCH 0xbf000208
55#define SEAD3_CPLD_P_LED 0xbf000210
56#define SEAD3_CPLD_F_LED 0xbf000218
57#define SEAD3_NEWSC_LIVE 0xbf000220
58#define SEAD3_NEWSC_REG 0xbf000228
59#define SEAD3_NEWSC_CTRL 0xbf000230
60
61#define SEAD3_LCD_CONTROL 0xbf000400
62#define SEAD3_LCD_DATA 0xbf000408
63#define SEAD3_CPLD_LCD_STATUS 0xbf000410
64#define SEAD3_CPLD_LCD_DATA 0xbf000418
65
66#define SEAD3_CPLD_PI_DEVRST 0xbf000480
67#define SEAD3_CPLD_PI_DEVRST_IC32_RST (1 << 0)
68#define SEAD3_RESERVED_0 0xbf000500
69
70#define SEAD3_PIC32_REGISTERS 0xbf000600
71#define SEAD3_RESERVED_1 0xbf000700
72#define SEAD3_UART_CH_0 0xbf000800
73#define SEAD3_UART_CH_1 0xbf000900
74#define SEAD3_RESERVED_2 0xbf000a00
75#define SEAD3_ETHERNET 0xbf010000
76#define SEAD3_RESERVED_3 0xbf020000
77#define SEAD3_USER_EXPANSION 0xbf400000
78#define SEAD3_RESERVED_4 0xbf800000
79#define SEAD3_BOOT_FLASH_EXTENSION 0xbfa00000
80#define SEAD3_BOOT_FLASH 0xbfc00000
81#define SEAD3_REVISION_REGISTER 0xbfc00010
82
83#endif /* __ASM_MIPS_BOARDS_SEAD3_ADDR_H */
diff --git a/arch/mips/include/asm/mips-boards/sim.h b/arch/mips/include/asm/mips-boards/sim.h
new file mode 100644
index 000000000..ca37a4f32
--- /dev/null
+++ b/arch/mips/include/asm/mips-boards/sim.h
@@ -0,0 +1,27 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
4 */
5
6#ifndef _ASM_MIPS_BOARDS_SIM_H
7#define _ASM_MIPS_BOARDS_SIM_H
8
9#define STATS_ON 1
10#define STATS_OFF 2
11#define STATS_CLEAR 3
12#define STATS_DUMP 4
13#define TRACE_ON 5
14#define TRACE_OFF 6
15
16
17#define simcfg(code) \
18({ \
19 __asm__ __volatile__( \
20 "sltiu $0,$0, %0" \
21 ::"i"(code) \
22 ); \
23})
24
25
26
27#endif
diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
new file mode 100644
index 000000000..23c67c087
--- /dev/null
+++ b/arch/mips/include/asm/mips-cm.h
@@ -0,0 +1,459 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2013 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_MIPS_CPS_H__
8# error Please include asm/mips-cps.h rather than asm/mips-cm.h
9#endif
10
11#ifndef __MIPS_ASM_MIPS_CM_H__
12#define __MIPS_ASM_MIPS_CM_H__
13
14#include <linux/bitfield.h>
15#include <linux/bitops.h>
16#include <linux/errno.h>
17
18/* The base address of the CM GCR block */
19extern void __iomem *mips_gcr_base;
20
21/* The base address of the CM L2-only sync region */
22extern void __iomem *mips_cm_l2sync_base;
23
24/**
25 * __mips_cm_phys_base - retrieve the physical base address of the CM
26 *
27 * This function returns the physical base address of the Coherence Manager
28 * global control block, or 0 if no Coherence Manager is present. It provides
29 * a default implementation which reads the CMGCRBase register where available,
30 * and may be overridden by platforms which determine this address in a
31 * different way by defining a function with the same prototype except for the
32 * name mips_cm_phys_base (without underscores).
33 */
34extern phys_addr_t __mips_cm_phys_base(void);
35
36/*
37 * mips_cm_is64 - determine CM register width
38 *
39 * The CM register width is determined by the version of the CM, with CM3
40 * introducing 64 bit GCRs and all prior CM versions having 32 bit GCRs.
41 * However we may run a kernel built for MIPS32 on a system with 64 bit GCRs,
42 * or vice-versa. This variable indicates the width of the memory accesses
43 * that the kernel will perform to GCRs, which may differ from the actual
44 * width of the GCRs.
45 *
46 * It's set to 0 for 32-bit accesses and 1 for 64-bit accesses.
47 */
48extern int mips_cm_is64;
49
50/**
51 * mips_cm_error_report - Report CM cache errors
52 */
53#ifdef CONFIG_MIPS_CM
54extern void mips_cm_error_report(void);
55#else
56static inline void mips_cm_error_report(void) {}
57#endif
58
59/**
60 * mips_cm_probe - probe for a Coherence Manager
61 *
62 * Attempt to detect the presence of a Coherence Manager. Returns 0 if a CM
63 * is successfully detected, else -errno.
64 */
65#ifdef CONFIG_MIPS_CM
66extern int mips_cm_probe(void);
67#else
68static inline int mips_cm_probe(void)
69{
70 return -ENODEV;
71}
72#endif
73
74/**
75 * mips_cm_present - determine whether a Coherence Manager is present
76 *
77 * Returns true if a CM is present in the system, else false.
78 */
79static inline bool mips_cm_present(void)
80{
81#ifdef CONFIG_MIPS_CM
82 return mips_gcr_base != NULL;
83#else
84 return false;
85#endif
86}
87
88/**
89 * mips_cm_has_l2sync - determine whether an L2-only sync region is present
90 *
91 * Returns true if the system implements an L2-only sync region, else false.
92 */
93static inline bool mips_cm_has_l2sync(void)
94{
95#ifdef CONFIG_MIPS_CM
96 return mips_cm_l2sync_base != NULL;
97#else
98 return false;
99#endif
100}
101
102/* Offsets to register blocks from the CM base address */
103#define MIPS_CM_GCB_OFS 0x0000 /* Global Control Block */
104#define MIPS_CM_CLCB_OFS 0x2000 /* Core Local Control Block */
105#define MIPS_CM_COCB_OFS 0x4000 /* Core Other Control Block */
106#define MIPS_CM_GDB_OFS 0x6000 /* Global Debug Block */
107
108/* Total size of the CM memory mapped registers */
109#define MIPS_CM_GCR_SIZE 0x8000
110
111/* Size of the L2-only sync region */
112#define MIPS_CM_L2SYNC_SIZE 0x1000
113
114#define GCR_ACCESSOR_RO(sz, off, name) \
115 CPS_ACCESSOR_RO(gcr, sz, MIPS_CM_GCB_OFS + off, name) \
116 CPS_ACCESSOR_RO(gcr, sz, MIPS_CM_COCB_OFS + off, redir_##name)
117
118#define GCR_ACCESSOR_RW(sz, off, name) \
119 CPS_ACCESSOR_RW(gcr, sz, MIPS_CM_GCB_OFS + off, name) \
120 CPS_ACCESSOR_RW(gcr, sz, MIPS_CM_COCB_OFS + off, redir_##name)
121
122#define GCR_CX_ACCESSOR_RO(sz, off, name) \
123 CPS_ACCESSOR_RO(gcr, sz, MIPS_CM_CLCB_OFS + off, cl_##name) \
124 CPS_ACCESSOR_RO(gcr, sz, MIPS_CM_COCB_OFS + off, co_##name)
125
126#define GCR_CX_ACCESSOR_RW(sz, off, name) \
127 CPS_ACCESSOR_RW(gcr, sz, MIPS_CM_CLCB_OFS + off, cl_##name) \
128 CPS_ACCESSOR_RW(gcr, sz, MIPS_CM_COCB_OFS + off, co_##name)
129
130/* GCR_CONFIG - Information about the system */
131GCR_ACCESSOR_RO(64, 0x000, config)
132#define CM_GCR_CONFIG_CLUSTER_COH_CAPABLE BIT_ULL(43)
133#define CM_GCR_CONFIG_CLUSTER_ID GENMASK_ULL(39, 32)
134#define CM_GCR_CONFIG_NUM_CLUSTERS GENMASK(29, 23)
135#define CM_GCR_CONFIG_NUMIOCU GENMASK(15, 8)
136#define CM_GCR_CONFIG_PCORES GENMASK(7, 0)
137
138/* GCR_BASE - Base address of the Global Configuration Registers (GCRs) */
139GCR_ACCESSOR_RW(64, 0x008, base)
140#define CM_GCR_BASE_GCRBASE GENMASK_ULL(47, 15)
141#define CM_GCR_BASE_CMDEFTGT GENMASK(1, 0)
142#define CM_GCR_BASE_CMDEFTGT_MEM 0
143#define CM_GCR_BASE_CMDEFTGT_RESERVED 1
144#define CM_GCR_BASE_CMDEFTGT_IOCU0 2
145#define CM_GCR_BASE_CMDEFTGT_IOCU1 3
146
147/* GCR_ACCESS - Controls core/IOCU access to GCRs */
148GCR_ACCESSOR_RW(32, 0x020, access)
149#define CM_GCR_ACCESS_ACCESSEN GENMASK(7, 0)
150
151/* GCR_REV - Indicates the Coherence Manager revision */
152GCR_ACCESSOR_RO(32, 0x030, rev)
153#define CM_GCR_REV_MAJOR GENMASK(15, 8)
154#define CM_GCR_REV_MINOR GENMASK(7, 0)
155
156#define CM_ENCODE_REV(major, minor) \
157 (FIELD_PREP(CM_GCR_REV_MAJOR, major) | \
158 FIELD_PREP(CM_GCR_REV_MINOR, minor))
159
160#define CM_REV_CM2 CM_ENCODE_REV(6, 0)
161#define CM_REV_CM2_5 CM_ENCODE_REV(7, 0)
162#define CM_REV_CM3 CM_ENCODE_REV(8, 0)
163#define CM_REV_CM3_5 CM_ENCODE_REV(9, 0)
164
165/* GCR_ERR_CONTROL - Control error checking logic */
166GCR_ACCESSOR_RW(32, 0x038, err_control)
167#define CM_GCR_ERR_CONTROL_L2_ECC_EN BIT(1)
168#define CM_GCR_ERR_CONTROL_L2_ECC_SUPPORT BIT(0)
169
170/* GCR_ERR_MASK - Control which errors are reported as interrupts */
171GCR_ACCESSOR_RW(64, 0x040, error_mask)
172
173/* GCR_ERR_CAUSE - Indicates the type of error that occurred */
174GCR_ACCESSOR_RW(64, 0x048, error_cause)
175#define CM_GCR_ERROR_CAUSE_ERRTYPE GENMASK(31, 27)
176#define CM3_GCR_ERROR_CAUSE_ERRTYPE GENMASK_ULL(63, 58)
177#define CM_GCR_ERROR_CAUSE_ERRINFO GENMASK(26, 0)
178
179/* GCR_ERR_ADDR - Indicates the address associated with an error */
180GCR_ACCESSOR_RW(64, 0x050, error_addr)
181
182/* GCR_ERR_MULT - Indicates when multiple errors have occurred */
183GCR_ACCESSOR_RW(64, 0x058, error_mult)
184#define CM_GCR_ERROR_MULT_ERR2ND GENMASK(4, 0)
185
186/* GCR_L2_ONLY_SYNC_BASE - Base address of the L2 cache-only sync region */
187GCR_ACCESSOR_RW(64, 0x070, l2_only_sync_base)
188#define CM_GCR_L2_ONLY_SYNC_BASE_SYNCBASE GENMASK(31, 12)
189#define CM_GCR_L2_ONLY_SYNC_BASE_SYNCEN BIT(0)
190
191/* GCR_GIC_BASE - Base address of the Global Interrupt Controller (GIC) */
192GCR_ACCESSOR_RW(64, 0x080, gic_base)
193#define CM_GCR_GIC_BASE_GICBASE GENMASK(31, 17)
194#define CM_GCR_GIC_BASE_GICEN BIT(0)
195
196/* GCR_CPC_BASE - Base address of the Cluster Power Controller (CPC) */
197GCR_ACCESSOR_RW(64, 0x088, cpc_base)
198#define CM_GCR_CPC_BASE_CPCBASE GENMASK(31, 15)
199#define CM_GCR_CPC_BASE_CPCEN BIT(0)
200
201/* GCR_REGn_BASE - Base addresses of CM address regions */
202GCR_ACCESSOR_RW(64, 0x090, reg0_base)
203GCR_ACCESSOR_RW(64, 0x0a0, reg1_base)
204GCR_ACCESSOR_RW(64, 0x0b0, reg2_base)
205GCR_ACCESSOR_RW(64, 0x0c0, reg3_base)
206#define CM_GCR_REGn_BASE_BASEADDR GENMASK(31, 16)
207
208/* GCR_REGn_MASK - Size & destination of CM address regions */
209GCR_ACCESSOR_RW(64, 0x098, reg0_mask)
210GCR_ACCESSOR_RW(64, 0x0a8, reg1_mask)
211GCR_ACCESSOR_RW(64, 0x0b8, reg2_mask)
212GCR_ACCESSOR_RW(64, 0x0c8, reg3_mask)
213#define CM_GCR_REGn_MASK_ADDRMASK GENMASK(31, 16)
214#define CM_GCR_REGn_MASK_CCAOVR GENMASK(7, 5)
215#define CM_GCR_REGn_MASK_CCAOVREN BIT(4)
216#define CM_GCR_REGn_MASK_DROPL2 BIT(2)
217#define CM_GCR_REGn_MASK_CMTGT GENMASK(1, 0)
218#define CM_GCR_REGn_MASK_CMTGT_DISABLED 0x0
219#define CM_GCR_REGn_MASK_CMTGT_MEM 0x1
220#define CM_GCR_REGn_MASK_CMTGT_IOCU0 0x2
221#define CM_GCR_REGn_MASK_CMTGT_IOCU1 0x3
222
223/* GCR_GIC_STATUS - Indicates presence of a Global Interrupt Controller (GIC) */
224GCR_ACCESSOR_RO(32, 0x0d0, gic_status)
225#define CM_GCR_GIC_STATUS_EX BIT(0)
226
227/* GCR_CPC_STATUS - Indicates presence of a Cluster Power Controller (CPC) */
228GCR_ACCESSOR_RO(32, 0x0f0, cpc_status)
229#define CM_GCR_CPC_STATUS_EX BIT(0)
230
231/* GCR_L2_CONFIG - Indicates L2 cache configuration when Config5.L2C=1 */
232GCR_ACCESSOR_RW(32, 0x130, l2_config)
233#define CM_GCR_L2_CONFIG_BYPASS BIT(20)
234#define CM_GCR_L2_CONFIG_SET_SIZE GENMASK(15, 12)
235#define CM_GCR_L2_CONFIG_LINE_SIZE GENMASK(11, 8)
236#define CM_GCR_L2_CONFIG_ASSOC GENMASK(7, 0)
237
238/* GCR_SYS_CONFIG2 - Further information about the system */
239GCR_ACCESSOR_RO(32, 0x150, sys_config2)
240#define CM_GCR_SYS_CONFIG2_MAXVPW GENMASK(3, 0)
241
242/* GCR_L2_PFT_CONTROL - Controls hardware L2 prefetching */
243GCR_ACCESSOR_RW(32, 0x300, l2_pft_control)
244#define CM_GCR_L2_PFT_CONTROL_PAGEMASK GENMASK(31, 12)
245#define CM_GCR_L2_PFT_CONTROL_PFTEN BIT(8)
246#define CM_GCR_L2_PFT_CONTROL_NPFT GENMASK(7, 0)
247
248/* GCR_L2_PFT_CONTROL_B - Controls hardware L2 prefetching */
249GCR_ACCESSOR_RW(32, 0x308, l2_pft_control_b)
250#define CM_GCR_L2_PFT_CONTROL_B_CEN BIT(8)
251#define CM_GCR_L2_PFT_CONTROL_B_PORTID GENMASK(7, 0)
252
253/* GCR_L2SM_COP - L2 cache op state machine control */
254GCR_ACCESSOR_RW(32, 0x620, l2sm_cop)
255#define CM_GCR_L2SM_COP_PRESENT BIT(31)
256#define CM_GCR_L2SM_COP_RESULT GENMASK(8, 6)
257#define CM_GCR_L2SM_COP_RESULT_DONTCARE 0
258#define CM_GCR_L2SM_COP_RESULT_DONE_OK 1
259#define CM_GCR_L2SM_COP_RESULT_DONE_ERROR 2
260#define CM_GCR_L2SM_COP_RESULT_ABORT_OK 3
261#define CM_GCR_L2SM_COP_RESULT_ABORT_ERROR 4
262#define CM_GCR_L2SM_COP_RUNNING BIT(5)
263#define CM_GCR_L2SM_COP_TYPE GENMASK(4, 2)
264#define CM_GCR_L2SM_COP_TYPE_IDX_WBINV 0
265#define CM_GCR_L2SM_COP_TYPE_IDX_STORETAG 1
266#define CM_GCR_L2SM_COP_TYPE_IDX_STORETAGDATA 2
267#define CM_GCR_L2SM_COP_TYPE_HIT_INV 4
268#define CM_GCR_L2SM_COP_TYPE_HIT_WBINV 5
269#define CM_GCR_L2SM_COP_TYPE_HIT_WB 6
270#define CM_GCR_L2SM_COP_TYPE_FETCHLOCK 7
271#define CM_GCR_L2SM_COP_CMD GENMASK(1, 0)
272#define CM_GCR_L2SM_COP_CMD_START 1 /* only when idle */
273#define CM_GCR_L2SM_COP_CMD_ABORT 3 /* only when running */
274
275/* GCR_L2SM_TAG_ADDR_COP - L2 cache op state machine address control */
276GCR_ACCESSOR_RW(64, 0x628, l2sm_tag_addr_cop)
277#define CM_GCR_L2SM_TAG_ADDR_COP_NUM_LINES GENMASK_ULL(63, 48)
278#define CM_GCR_L2SM_TAG_ADDR_COP_START_TAG GENMASK_ULL(47, 6)
279
280/* GCR_BEV_BASE - Controls the location of the BEV for powered up cores */
281GCR_ACCESSOR_RW(64, 0x680, bev_base)
282
283/* GCR_Cx_RESET_RELEASE - Controls core reset for CM 1.x */
284GCR_CX_ACCESSOR_RW(32, 0x000, reset_release)
285
286/* GCR_Cx_COHERENCE - Controls core coherence */
287GCR_CX_ACCESSOR_RW(32, 0x008, coherence)
288#define CM_GCR_Cx_COHERENCE_COHDOMAINEN GENMASK(7, 0)
289#define CM3_GCR_Cx_COHERENCE_COHEN BIT(0)
290
291/* GCR_Cx_CONFIG - Information about a core's configuration */
292GCR_CX_ACCESSOR_RO(32, 0x010, config)
293#define CM_GCR_Cx_CONFIG_IOCUTYPE GENMASK(11, 10)
294#define CM_GCR_Cx_CONFIG_PVPE GENMASK(9, 0)
295
296/* GCR_Cx_OTHER - Configure the core-other/redirect GCR block */
297GCR_CX_ACCESSOR_RW(32, 0x018, other)
298#define CM_GCR_Cx_OTHER_CORENUM GENMASK(31, 16) /* CM < 3 */
299#define CM_GCR_Cx_OTHER_CLUSTER_EN BIT(31) /* CM >= 3.5 */
300#define CM_GCR_Cx_OTHER_GIC_EN BIT(30) /* CM >= 3.5 */
301#define CM_GCR_Cx_OTHER_BLOCK GENMASK(25, 24) /* CM >= 3.5 */
302#define CM_GCR_Cx_OTHER_BLOCK_LOCAL 0
303#define CM_GCR_Cx_OTHER_BLOCK_GLOBAL 1
304#define CM_GCR_Cx_OTHER_BLOCK_USER 2
305#define CM_GCR_Cx_OTHER_BLOCK_GLOBAL_HIGH 3
306#define CM_GCR_Cx_OTHER_CLUSTER GENMASK(21, 16) /* CM >= 3.5 */
307#define CM3_GCR_Cx_OTHER_CORE GENMASK(13, 8) /* CM >= 3 */
308#define CM_GCR_Cx_OTHER_CORE_CM 32
309#define CM3_GCR_Cx_OTHER_VP GENMASK(2, 0) /* CM >= 3 */
310
311/* GCR_Cx_RESET_BASE - Configure where powered up cores will fetch from */
312GCR_CX_ACCESSOR_RW(32, 0x020, reset_base)
313#define CM_GCR_Cx_RESET_BASE_BEVEXCBASE GENMASK(31, 12)
314
315/* GCR_Cx_ID - Identify the current core */
316GCR_CX_ACCESSOR_RO(32, 0x028, id)
317#define CM_GCR_Cx_ID_CLUSTER GENMASK(15, 8)
318#define CM_GCR_Cx_ID_CORE GENMASK(7, 0)
319
320/* GCR_Cx_RESET_EXT_BASE - Configure behaviour when cores reset or power up */
321GCR_CX_ACCESSOR_RW(32, 0x030, reset_ext_base)
322#define CM_GCR_Cx_RESET_EXT_BASE_EVARESET BIT(31)
323#define CM_GCR_Cx_RESET_EXT_BASE_UEB BIT(30)
324#define CM_GCR_Cx_RESET_EXT_BASE_BEVEXCMASK GENMASK(27, 20)
325#define CM_GCR_Cx_RESET_EXT_BASE_BEVEXCPA GENMASK(7, 1)
326#define CM_GCR_Cx_RESET_EXT_BASE_PRESENT BIT(0)
327
328/**
329 * mips_cm_l2sync - perform an L2-only sync operation
330 *
331 * If an L2-only sync region is present in the system then this function
332 * performs and L2-only sync and returns zero. Otherwise it returns -ENODEV.
333 */
334static inline int mips_cm_l2sync(void)
335{
336 if (!mips_cm_has_l2sync())
337 return -ENODEV;
338
339 writel(0, mips_cm_l2sync_base);
340 return 0;
341}
342
343/**
344 * mips_cm_revision() - return CM revision
345 *
346 * Return: The revision of the CM, from GCR_REV, or 0 if no CM is present. The
347 * return value should be checked against the CM_REV_* macros.
348 */
349static inline int mips_cm_revision(void)
350{
351 if (!mips_cm_present())
352 return 0;
353
354 return read_gcr_rev();
355}
356
357/**
358 * mips_cm_max_vp_width() - return the width in bits of VP indices
359 *
360 * Return: the width, in bits, of VP indices in fields that combine core & VP
361 * indices.
362 */
363static inline unsigned int mips_cm_max_vp_width(void)
364{
365 extern int smp_num_siblings;
366
367 if (mips_cm_revision() >= CM_REV_CM3)
368 return FIELD_GET(CM_GCR_SYS_CONFIG2_MAXVPW,
369 read_gcr_sys_config2());
370
371 if (mips_cm_present()) {
372 /*
373 * We presume that all cores in the system will have the same
374 * number of VP(E)s, and if that ever changes then this will
375 * need revisiting.
376 */
377 return FIELD_GET(CM_GCR_Cx_CONFIG_PVPE, read_gcr_cl_config()) + 1;
378 }
379
380 if (IS_ENABLED(CONFIG_SMP))
381 return smp_num_siblings;
382
383 return 1;
384}
385
386/**
387 * mips_cm_vp_id() - calculate the hardware VP ID for a CPU
388 * @cpu: the CPU whose VP ID to calculate
389 *
390 * Hardware such as the GIC uses identifiers for VPs which may not match the
391 * CPU numbers used by Linux. This function calculates the hardware VP
392 * identifier corresponding to a given CPU.
393 *
394 * Return: the VP ID for the CPU.
395 */
396static inline unsigned int mips_cm_vp_id(unsigned int cpu)
397{
398 unsigned int core = cpu_core(&cpu_data[cpu]);
399 unsigned int vp = cpu_vpe_id(&cpu_data[cpu]);
400
401 return (core * mips_cm_max_vp_width()) + vp;
402}
403
404#ifdef CONFIG_MIPS_CM
405
406/**
407 * mips_cm_lock_other - lock access to redirect/other region
408 * @cluster: the other cluster to be accessed
409 * @core: the other core to be accessed
410 * @vp: the VP within the other core to be accessed
411 * @block: the register block to be accessed
412 *
413 * Configure the redirect/other region for the local core/VP (depending upon
414 * the CM revision) to target the specified @cluster, @core, @vp & register
415 * @block. Must be called before using the redirect/other region, and followed
416 * by a call to mips_cm_unlock_other() when access to the redirect/other region
417 * is complete.
418 *
419 * This function acquires a spinlock such that code between it &
420 * mips_cm_unlock_other() calls cannot be pre-empted by anything which may
421 * reconfigure the redirect/other region, and cannot be interfered with by
422 * another VP in the core. As such calls to this function should not be nested.
423 */
424extern void mips_cm_lock_other(unsigned int cluster, unsigned int core,
425 unsigned int vp, unsigned int block);
426
427/**
428 * mips_cm_unlock_other - unlock access to redirect/other region
429 *
430 * Must be called after mips_cm_lock_other() once all required access to the
431 * redirect/other region has been completed.
432 */
433extern void mips_cm_unlock_other(void);
434
435#else /* !CONFIG_MIPS_CM */
436
437static inline void mips_cm_lock_other(unsigned int cluster, unsigned int core,
438 unsigned int vp, unsigned int block) { }
439static inline void mips_cm_unlock_other(void) { }
440
441#endif /* !CONFIG_MIPS_CM */
442
443/**
444 * mips_cm_lock_other_cpu - lock access to redirect/other region
445 * @cpu: the other CPU whose register we want to access
446 *
447 * Configure the redirect/other region for the local core/VP (depending upon
448 * the CM revision) to target the specified @cpu & register @block. This is
449 * equivalent to calling mips_cm_lock_other() but accepts a Linux CPU number
450 * for convenience.
451 */
452static inline void mips_cm_lock_other_cpu(unsigned int cpu, unsigned int block)
453{
454 struct cpuinfo_mips *d = &cpu_data[cpu];
455
456 mips_cm_lock_other(cpu_cluster(d), cpu_core(d), cpu_vpe_id(d), block);
457}
458
459#endif /* __MIPS_ASM_MIPS_CM_H__ */
diff --git a/arch/mips/include/asm/mips-cpc.h b/arch/mips/include/asm/mips-cpc.h
new file mode 100644
index 000000000..b54453f16
--- /dev/null
+++ b/arch/mips/include/asm/mips-cpc.h
@@ -0,0 +1,179 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2013 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_MIPS_CPS_H__
8# error Please include asm/mips-cps.h rather than asm/mips-cpc.h
9#endif
10
11#ifndef __MIPS_ASM_MIPS_CPC_H__
12#define __MIPS_ASM_MIPS_CPC_H__
13
14#include <linux/bitops.h>
15#include <linux/errno.h>
16
17/* The base address of the CPC registers */
18extern void __iomem *mips_cpc_base;
19
20/**
21 * mips_cpc_default_phys_base - retrieve the default physical base address of
22 * the CPC
23 *
24 * Returns the default physical base address of the Cluster Power Controller
25 * memory mapped registers. This is platform dependant & must therefore be
26 * implemented per-platform.
27 */
28extern phys_addr_t mips_cpc_default_phys_base(void);
29
30/**
31 * mips_cpc_probe - probe for a Cluster Power Controller
32 *
33 * Attempt to detect the presence of a Cluster Power Controller. Returns 0 if
34 * a CPC is successfully detected, else -errno.
35 */
36#ifdef CONFIG_MIPS_CPC
37extern int mips_cpc_probe(void);
38#else
39static inline int mips_cpc_probe(void)
40{
41 return -ENODEV;
42}
43#endif
44
45/**
46 * mips_cpc_present - determine whether a Cluster Power Controller is present
47 *
48 * Returns true if a CPC is present in the system, else false.
49 */
50static inline bool mips_cpc_present(void)
51{
52#ifdef CONFIG_MIPS_CPC
53 return mips_cpc_base != NULL;
54#else
55 return false;
56#endif
57}
58
59/* Offsets from the CPC base address to various control blocks */
60#define MIPS_CPC_GCB_OFS 0x0000
61#define MIPS_CPC_CLCB_OFS 0x2000
62#define MIPS_CPC_COCB_OFS 0x4000
63
64#define CPC_ACCESSOR_RO(sz, off, name) \
65 CPS_ACCESSOR_RO(cpc, sz, MIPS_CPC_GCB_OFS + off, name) \
66 CPS_ACCESSOR_RO(cpc, sz, MIPS_CPC_COCB_OFS + off, redir_##name)
67
68#define CPC_ACCESSOR_RW(sz, off, name) \
69 CPS_ACCESSOR_RW(cpc, sz, MIPS_CPC_GCB_OFS + off, name) \
70 CPS_ACCESSOR_RW(cpc, sz, MIPS_CPC_COCB_OFS + off, redir_##name)
71
72#define CPC_CX_ACCESSOR_RO(sz, off, name) \
73 CPS_ACCESSOR_RO(cpc, sz, MIPS_CPC_CLCB_OFS + off, cl_##name) \
74 CPS_ACCESSOR_RO(cpc, sz, MIPS_CPC_COCB_OFS + off, co_##name)
75
76#define CPC_CX_ACCESSOR_RW(sz, off, name) \
77 CPS_ACCESSOR_RW(cpc, sz, MIPS_CPC_CLCB_OFS + off, cl_##name) \
78 CPS_ACCESSOR_RW(cpc, sz, MIPS_CPC_COCB_OFS + off, co_##name)
79
80/* CPC_ACCESS - Control core/IOCU access to CPC registers prior to CM 3 */
81CPC_ACCESSOR_RW(32, 0x000, access)
82
83/* CPC_SEQDEL - Configure delays between command sequencer steps */
84CPC_ACCESSOR_RW(32, 0x008, seqdel)
85
86/* CPC_RAIL - Configure the delay from rail power-up to stability */
87CPC_ACCESSOR_RW(32, 0x010, rail)
88
89/* CPC_RESETLEN - Configure the length of reset sequences */
90CPC_ACCESSOR_RW(32, 0x018, resetlen)
91
92/* CPC_REVISION - Indicates the revisison of the CPC */
93CPC_ACCESSOR_RO(32, 0x020, revision)
94
95/* CPC_PWRUP_CTL - Control power to the Coherence Manager (CM) */
96CPC_ACCESSOR_RW(32, 0x030, pwrup_ctl)
97#define CPC_PWRUP_CTL_CM_PWRUP BIT(0)
98
99/* CPC_CONFIG - Mirrors GCR_CONFIG */
100CPC_ACCESSOR_RW(64, 0x138, config)
101
102/* CPC_SYS_CONFIG - Control cluster endianness */
103CPC_ACCESSOR_RW(32, 0x140, sys_config)
104#define CPC_SYS_CONFIG_BE_IMMEDIATE BIT(2)
105#define CPC_SYS_CONFIG_BE_STATUS BIT(1)
106#define CPC_SYS_CONFIG_BE BIT(0)
107
108/* CPC_Cx_CMD - Instruct the CPC to take action on a core */
109CPC_CX_ACCESSOR_RW(32, 0x000, cmd)
110#define CPC_Cx_CMD GENMASK(3, 0)
111#define CPC_Cx_CMD_CLOCKOFF 0x1
112#define CPC_Cx_CMD_PWRDOWN 0x2
113#define CPC_Cx_CMD_PWRUP 0x3
114#define CPC_Cx_CMD_RESET 0x4
115
116/* CPC_Cx_STAT_CONF - Indicates core configuration & state */
117CPC_CX_ACCESSOR_RW(32, 0x008, stat_conf)
118#define CPC_Cx_STAT_CONF_PWRUPE BIT(23)
119#define CPC_Cx_STAT_CONF_SEQSTATE GENMASK(22, 19)
120#define CPC_Cx_STAT_CONF_SEQSTATE_D0 0x0
121#define CPC_Cx_STAT_CONF_SEQSTATE_U0 0x1
122#define CPC_Cx_STAT_CONF_SEQSTATE_U1 0x2
123#define CPC_Cx_STAT_CONF_SEQSTATE_U2 0x3
124#define CPC_Cx_STAT_CONF_SEQSTATE_U3 0x4
125#define CPC_Cx_STAT_CONF_SEQSTATE_U4 0x5
126#define CPC_Cx_STAT_CONF_SEQSTATE_U5 0x6
127#define CPC_Cx_STAT_CONF_SEQSTATE_U6 0x7
128#define CPC_Cx_STAT_CONF_SEQSTATE_D1 0x8
129#define CPC_Cx_STAT_CONF_SEQSTATE_D3 0x9
130#define CPC_Cx_STAT_CONF_SEQSTATE_D2 0xa
131#define CPC_Cx_STAT_CONF_CLKGAT_IMPL BIT(17)
132#define CPC_Cx_STAT_CONF_PWRDN_IMPL BIT(16)
133#define CPC_Cx_STAT_CONF_EJTAG_PROBE BIT(15)
134
135/* CPC_Cx_OTHER - Configure the core-other register block prior to CM 3 */
136CPC_CX_ACCESSOR_RW(32, 0x010, other)
137#define CPC_Cx_OTHER_CORENUM GENMASK(23, 16)
138
139/* CPC_Cx_VP_STOP - Stop Virtual Processors (VPs) within a core from running */
140CPC_CX_ACCESSOR_RW(32, 0x020, vp_stop)
141
142/* CPC_Cx_VP_START - Start Virtual Processors (VPs) within a core running */
143CPC_CX_ACCESSOR_RW(32, 0x028, vp_run)
144
145/* CPC_Cx_VP_RUNNING - Indicate which Virtual Processors (VPs) are running */
146CPC_CX_ACCESSOR_RW(32, 0x030, vp_running)
147
148/* CPC_Cx_CONFIG - Mirrors GCR_Cx_CONFIG */
149CPC_CX_ACCESSOR_RW(32, 0x090, config)
150
151#ifdef CONFIG_MIPS_CPC
152
153/**
154 * mips_cpc_lock_other - lock access to another core
155 * core: the other core to be accessed
156 *
157 * Call before operating upon a core via the 'other' register region in
158 * order to prevent the region being moved during access. Must be called
159 * within the bounds of a mips_cm_{lock,unlock}_other pair, and followed
160 * by a call to mips_cpc_unlock_other.
161 */
162extern void mips_cpc_lock_other(unsigned int core);
163
164/**
165 * mips_cpc_unlock_other - unlock access to another core
166 *
167 * Call after operating upon another core via the 'other' register region.
168 * Must be called after mips_cpc_lock_other.
169 */
170extern void mips_cpc_unlock_other(void);
171
172#else /* !CONFIG_MIPS_CPC */
173
174static inline void mips_cpc_lock_other(unsigned int core) { }
175static inline void mips_cpc_unlock_other(void) { }
176
177#endif /* !CONFIG_MIPS_CPC */
178
179#endif /* __MIPS_ASM_MIPS_CPC_H__ */
diff --git a/arch/mips/include/asm/mips-cps.h b/arch/mips/include/asm/mips-cps.h
new file mode 100644
index 000000000..fd43d8768
--- /dev/null
+++ b/arch/mips/include/asm/mips-cps.h
@@ -0,0 +1,236 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2017 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_MIPS_CPS_H__
8#define __MIPS_ASM_MIPS_CPS_H__
9
10#include <linux/io.h>
11#include <linux/types.h>
12
13extern unsigned long __cps_access_bad_size(void)
14 __compiletime_error("Bad size for CPS accessor");
15
16#define CPS_ACCESSOR_A(unit, off, name) \
17static inline void *addr_##unit##_##name(void) \
18{ \
19 return mips_##unit##_base + (off); \
20}
21
22#define CPS_ACCESSOR_R(unit, sz, name) \
23static inline uint##sz##_t read_##unit##_##name(void) \
24{ \
25 uint64_t val64; \
26 \
27 switch (sz) { \
28 case 32: \
29 return __raw_readl(addr_##unit##_##name()); \
30 \
31 case 64: \
32 if (mips_cm_is64) \
33 return __raw_readq(addr_##unit##_##name()); \
34 \
35 val64 = __raw_readl(addr_##unit##_##name() + 4); \
36 val64 <<= 32; \
37 val64 |= __raw_readl(addr_##unit##_##name()); \
38 return val64; \
39 \
40 default: \
41 return __cps_access_bad_size(); \
42 } \
43}
44
45#define CPS_ACCESSOR_W(unit, sz, name) \
46static inline void write_##unit##_##name(uint##sz##_t val) \
47{ \
48 switch (sz) { \
49 case 32: \
50 __raw_writel(val, addr_##unit##_##name()); \
51 break; \
52 \
53 case 64: \
54 if (mips_cm_is64) { \
55 __raw_writeq(val, addr_##unit##_##name()); \
56 break; \
57 } \
58 \
59 __raw_writel((uint64_t)val >> 32, \
60 addr_##unit##_##name() + 4); \
61 __raw_writel(val, addr_##unit##_##name()); \
62 break; \
63 \
64 default: \
65 __cps_access_bad_size(); \
66 break; \
67 } \
68}
69
70#define CPS_ACCESSOR_M(unit, sz, name) \
71static inline void change_##unit##_##name(uint##sz##_t mask, \
72 uint##sz##_t val) \
73{ \
74 uint##sz##_t reg_val = read_##unit##_##name(); \
75 reg_val &= ~mask; \
76 reg_val |= val; \
77 write_##unit##_##name(reg_val); \
78} \
79 \
80static inline void set_##unit##_##name(uint##sz##_t val) \
81{ \
82 change_##unit##_##name(val, val); \
83} \
84 \
85static inline void clear_##unit##_##name(uint##sz##_t val) \
86{ \
87 change_##unit##_##name(val, 0); \
88}
89
90#define CPS_ACCESSOR_RO(unit, sz, off, name) \
91 CPS_ACCESSOR_A(unit, off, name) \
92 CPS_ACCESSOR_R(unit, sz, name)
93
94#define CPS_ACCESSOR_WO(unit, sz, off, name) \
95 CPS_ACCESSOR_A(unit, off, name) \
96 CPS_ACCESSOR_W(unit, sz, name)
97
98#define CPS_ACCESSOR_RW(unit, sz, off, name) \
99 CPS_ACCESSOR_A(unit, off, name) \
100 CPS_ACCESSOR_R(unit, sz, name) \
101 CPS_ACCESSOR_W(unit, sz, name) \
102 CPS_ACCESSOR_M(unit, sz, name)
103
104#include <asm/mips-cm.h>
105#include <asm/mips-cpc.h>
106#include <asm/mips-gic.h>
107
108/**
109 * mips_cps_numclusters - return the number of clusters present in the system
110 *
111 * Returns the number of clusters in the system.
112 */
113static inline unsigned int mips_cps_numclusters(void)
114{
115 unsigned int num_clusters;
116
117 if (mips_cm_revision() < CM_REV_CM3_5)
118 return 1;
119
120 num_clusters = read_gcr_config() & CM_GCR_CONFIG_NUM_CLUSTERS;
121 num_clusters >>= __ffs(CM_GCR_CONFIG_NUM_CLUSTERS);
122 return num_clusters;
123}
124
125/**
126 * mips_cps_cluster_config - return (GCR|CPC)_CONFIG from a cluster
127 * @cluster: the ID of the cluster whose config we want
128 *
129 * Read the value of GCR_CONFIG (or its CPC_CONFIG mirror) from a @cluster.
130 *
131 * Returns the value of GCR_CONFIG.
132 */
133static inline uint64_t mips_cps_cluster_config(unsigned int cluster)
134{
135 uint64_t config;
136
137 if (mips_cm_revision() < CM_REV_CM3_5) {
138 /*
139 * Prior to CM 3.5 we don't have the notion of multiple
140 * clusters so we can trivially read the GCR_CONFIG register
141 * within this cluster.
142 */
143 WARN_ON(cluster != 0);
144 config = read_gcr_config();
145 } else {
146 /*
147 * From CM 3.5 onwards we read the CPC_CONFIG mirror of
148 * GCR_CONFIG via the redirect region, since the CPC is always
149 * powered up allowing us not to need to power up the CM.
150 */
151 mips_cm_lock_other(cluster, 0, 0, CM_GCR_Cx_OTHER_BLOCK_GLOBAL);
152 config = read_cpc_redir_config();
153 mips_cm_unlock_other();
154 }
155
156 return config;
157}
158
159/**
160 * mips_cps_numcores - return the number of cores present in a cluster
161 * @cluster: the ID of the cluster whose core count we want
162 *
163 * Returns the value of the PCORES field of the GCR_CONFIG register plus 1, or
164 * zero if no Coherence Manager is present.
165 */
166static inline unsigned int mips_cps_numcores(unsigned int cluster)
167{
168 if (!mips_cm_present())
169 return 0;
170
171 /* Add one before masking to handle 0xff indicating no cores */
172 return (mips_cps_cluster_config(cluster) + 1) & CM_GCR_CONFIG_PCORES;
173}
174
175/**
176 * mips_cps_numiocu - return the number of IOCUs present in a cluster
177 * @cluster: the ID of the cluster whose IOCU count we want
178 *
179 * Returns the value of the NUMIOCU field of the GCR_CONFIG register, or zero
180 * if no Coherence Manager is present.
181 */
182static inline unsigned int mips_cps_numiocu(unsigned int cluster)
183{
184 unsigned int num_iocu;
185
186 if (!mips_cm_present())
187 return 0;
188
189 num_iocu = mips_cps_cluster_config(cluster) & CM_GCR_CONFIG_NUMIOCU;
190 num_iocu >>= __ffs(CM_GCR_CONFIG_NUMIOCU);
191 return num_iocu;
192}
193
194/**
195 * mips_cps_numvps - return the number of VPs (threads) supported by a core
196 * @cluster: the ID of the cluster containing the core we want to examine
197 * @core: the ID of the core whose VP count we want
198 *
199 * Returns the number of Virtual Processors (VPs, ie. hardware threads) that
200 * are supported by the given @core in the given @cluster. If the core or the
201 * kernel do not support hardware mutlti-threading this returns 1.
202 */
203static inline unsigned int mips_cps_numvps(unsigned int cluster, unsigned int core)
204{
205 unsigned int cfg;
206
207 if (!mips_cm_present())
208 return 1;
209
210 if ((!IS_ENABLED(CONFIG_MIPS_MT_SMP) || !cpu_has_mipsmt)
211 && (!IS_ENABLED(CONFIG_CPU_MIPSR6) || !cpu_has_vp))
212 return 1;
213
214 mips_cm_lock_other(cluster, core, 0, CM_GCR_Cx_OTHER_BLOCK_LOCAL);
215
216 if (mips_cm_revision() < CM_REV_CM3_5) {
217 /*
218 * Prior to CM 3.5 we can only have one cluster & don't have
219 * CPC_Cx_CONFIG, so we read GCR_Cx_CONFIG.
220 */
221 cfg = read_gcr_co_config();
222 } else {
223 /*
224 * From CM 3.5 onwards we read CPC_Cx_CONFIG because the CPC is
225 * always powered, which allows us to not worry about powering
226 * up the cluster's CM here.
227 */
228 cfg = read_cpc_co_config();
229 }
230
231 mips_cm_unlock_other();
232
233 return (cfg + 1) & CM_GCR_Cx_CONFIG_PVPE;
234}
235
236#endif /* __MIPS_ASM_MIPS_CPS_H__ */
diff --git a/arch/mips/include/asm/mips-gic.h b/arch/mips/include/asm/mips-gic.h
new file mode 100644
index 000000000..084cac1c5
--- /dev/null
+++ b/arch/mips/include/asm/mips-gic.h
@@ -0,0 +1,373 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2017 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_MIPS_CPS_H__
8# error Please include asm/mips-cps.h rather than asm/mips-gic.h
9#endif
10
11#ifndef __MIPS_ASM_MIPS_GIC_H__
12#define __MIPS_ASM_MIPS_GIC_H__
13
14#include <linux/bitops.h>
15
16/* The base address of the GIC registers */
17extern void __iomem *mips_gic_base;
18
19/* Offsets from the GIC base address to various control blocks */
20#define MIPS_GIC_SHARED_OFS 0x00000
21#define MIPS_GIC_SHARED_SZ 0x08000
22#define MIPS_GIC_LOCAL_OFS 0x08000
23#define MIPS_GIC_LOCAL_SZ 0x04000
24#define MIPS_GIC_REDIR_OFS 0x0c000
25#define MIPS_GIC_REDIR_SZ 0x04000
26#define MIPS_GIC_USER_OFS 0x10000
27#define MIPS_GIC_USER_SZ 0x10000
28
29/* For read-only shared registers */
30#define GIC_ACCESSOR_RO(sz, off, name) \
31 CPS_ACCESSOR_RO(gic, sz, MIPS_GIC_SHARED_OFS + off, name)
32
33/* For read-write shared registers */
34#define GIC_ACCESSOR_RW(sz, off, name) \
35 CPS_ACCESSOR_RW(gic, sz, MIPS_GIC_SHARED_OFS + off, name)
36
37/* For read-only local registers */
38#define GIC_VX_ACCESSOR_RO(sz, off, name) \
39 CPS_ACCESSOR_RO(gic, sz, MIPS_GIC_LOCAL_OFS + off, vl_##name) \
40 CPS_ACCESSOR_RO(gic, sz, MIPS_GIC_REDIR_OFS + off, vo_##name)
41
42/* For read-write local registers */
43#define GIC_VX_ACCESSOR_RW(sz, off, name) \
44 CPS_ACCESSOR_RW(gic, sz, MIPS_GIC_LOCAL_OFS + off, vl_##name) \
45 CPS_ACCESSOR_RW(gic, sz, MIPS_GIC_REDIR_OFS + off, vo_##name)
46
47/* For read-only shared per-interrupt registers */
48#define GIC_ACCESSOR_RO_INTR_REG(sz, off, stride, name) \
49static inline void __iomem *addr_gic_##name(unsigned int intr) \
50{ \
51 return mips_gic_base + (off) + (intr * (stride)); \
52} \
53 \
54static inline unsigned int read_gic_##name(unsigned int intr) \
55{ \
56 BUILD_BUG_ON(sz != 32); \
57 return __raw_readl(addr_gic_##name(intr)); \
58}
59
60/* For read-write shared per-interrupt registers */
61#define GIC_ACCESSOR_RW_INTR_REG(sz, off, stride, name) \
62 GIC_ACCESSOR_RO_INTR_REG(sz, off, stride, name) \
63 \
64static inline void write_gic_##name(unsigned int intr, \
65 unsigned int val) \
66{ \
67 BUILD_BUG_ON(sz != 32); \
68 __raw_writel(val, addr_gic_##name(intr)); \
69}
70
71/* For read-only local per-interrupt registers */
72#define GIC_VX_ACCESSOR_RO_INTR_REG(sz, off, stride, name) \
73 GIC_ACCESSOR_RO_INTR_REG(sz, MIPS_GIC_LOCAL_OFS + off, \
74 stride, vl_##name) \
75 GIC_ACCESSOR_RO_INTR_REG(sz, MIPS_GIC_REDIR_OFS + off, \
76 stride, vo_##name)
77
78/* For read-write local per-interrupt registers */
79#define GIC_VX_ACCESSOR_RW_INTR_REG(sz, off, stride, name) \
80 GIC_ACCESSOR_RW_INTR_REG(sz, MIPS_GIC_LOCAL_OFS + off, \
81 stride, vl_##name) \
82 GIC_ACCESSOR_RW_INTR_REG(sz, MIPS_GIC_REDIR_OFS + off, \
83 stride, vo_##name)
84
85/* For read-only shared bit-per-interrupt registers */
86#define GIC_ACCESSOR_RO_INTR_BIT(off, name) \
87static inline void __iomem *addr_gic_##name(void) \
88{ \
89 return mips_gic_base + (off); \
90} \
91 \
92static inline unsigned int read_gic_##name(unsigned int intr) \
93{ \
94 void __iomem *addr = addr_gic_##name(); \
95 unsigned int val; \
96 \
97 if (mips_cm_is64) { \
98 addr += (intr / 64) * sizeof(uint64_t); \
99 val = __raw_readq(addr) >> intr % 64; \
100 } else { \
101 addr += (intr / 32) * sizeof(uint32_t); \
102 val = __raw_readl(addr) >> intr % 32; \
103 } \
104 \
105 return val & 0x1; \
106}
107
108/* For read-write shared bit-per-interrupt registers */
109#define GIC_ACCESSOR_RW_INTR_BIT(off, name) \
110 GIC_ACCESSOR_RO_INTR_BIT(off, name) \
111 \
112static inline void write_gic_##name(unsigned int intr) \
113{ \
114 void __iomem *addr = addr_gic_##name(); \
115 \
116 if (mips_cm_is64) { \
117 addr += (intr / 64) * sizeof(uint64_t); \
118 __raw_writeq(BIT(intr % 64), addr); \
119 } else { \
120 addr += (intr / 32) * sizeof(uint32_t); \
121 __raw_writel(BIT(intr % 32), addr); \
122 } \
123} \
124 \
125static inline void change_gic_##name(unsigned int intr, \
126 unsigned int val) \
127{ \
128 void __iomem *addr = addr_gic_##name(); \
129 \
130 if (mips_cm_is64) { \
131 uint64_t _val; \
132 \
133 addr += (intr / 64) * sizeof(uint64_t); \
134 _val = __raw_readq(addr); \
135 _val &= ~BIT_ULL(intr % 64); \
136 _val |= (uint64_t)val << (intr % 64); \
137 __raw_writeq(_val, addr); \
138 } else { \
139 uint32_t _val; \
140 \
141 addr += (intr / 32) * sizeof(uint32_t); \
142 _val = __raw_readl(addr); \
143 _val &= ~BIT(intr % 32); \
144 _val |= val << (intr % 32); \
145 __raw_writel(_val, addr); \
146 } \
147}
148
149/* For read-only local bit-per-interrupt registers */
150#define GIC_VX_ACCESSOR_RO_INTR_BIT(sz, off, name) \
151 GIC_ACCESSOR_RO_INTR_BIT(sz, MIPS_GIC_LOCAL_OFS + off, \
152 vl_##name) \
153 GIC_ACCESSOR_RO_INTR_BIT(sz, MIPS_GIC_REDIR_OFS + off, \
154 vo_##name)
155
156/* For read-write local bit-per-interrupt registers */
157#define GIC_VX_ACCESSOR_RW_INTR_BIT(sz, off, name) \
158 GIC_ACCESSOR_RW_INTR_BIT(sz, MIPS_GIC_LOCAL_OFS + off, \
159 vl_##name) \
160 GIC_ACCESSOR_RW_INTR_BIT(sz, MIPS_GIC_REDIR_OFS + off, \
161 vo_##name)
162
163/* GIC_SH_CONFIG - Information about the GIC configuration */
164GIC_ACCESSOR_RW(32, 0x000, config)
165#define GIC_CONFIG_COUNTSTOP BIT(28)
166#define GIC_CONFIG_COUNTBITS GENMASK(27, 24)
167#define GIC_CONFIG_NUMINTERRUPTS GENMASK(23, 16)
168#define GIC_CONFIG_PVPS GENMASK(6, 0)
169
170/* GIC_SH_COUNTER - Shared global counter value */
171GIC_ACCESSOR_RW(64, 0x010, counter)
172GIC_ACCESSOR_RW(32, 0x010, counter_32l)
173GIC_ACCESSOR_RW(32, 0x014, counter_32h)
174
175/* GIC_SH_POL_* - Configures interrupt polarity */
176GIC_ACCESSOR_RW_INTR_BIT(0x100, pol)
177#define GIC_POL_ACTIVE_LOW 0 /* when level triggered */
178#define GIC_POL_ACTIVE_HIGH 1 /* when level triggered */
179#define GIC_POL_FALLING_EDGE 0 /* when single-edge triggered */
180#define GIC_POL_RISING_EDGE 1 /* when single-edge triggered */
181
182/* GIC_SH_TRIG_* - Configures interrupts to be edge or level triggered */
183GIC_ACCESSOR_RW_INTR_BIT(0x180, trig)
184#define GIC_TRIG_LEVEL 0
185#define GIC_TRIG_EDGE 1
186
187/* GIC_SH_DUAL_* - Configures whether interrupts trigger on both edges */
188GIC_ACCESSOR_RW_INTR_BIT(0x200, dual)
189#define GIC_DUAL_SINGLE 0 /* when edge-triggered */
190#define GIC_DUAL_DUAL 1 /* when edge-triggered */
191
192/* GIC_SH_WEDGE - Write an 'edge', ie. trigger an interrupt */
193GIC_ACCESSOR_RW(32, 0x280, wedge)
194#define GIC_WEDGE_RW BIT(31)
195#define GIC_WEDGE_INTR GENMASK(7, 0)
196
197/* GIC_SH_RMASK_* - Reset/clear shared interrupt mask bits */
198GIC_ACCESSOR_RW_INTR_BIT(0x300, rmask)
199
200/* GIC_SH_SMASK_* - Set shared interrupt mask bits */
201GIC_ACCESSOR_RW_INTR_BIT(0x380, smask)
202
203/* GIC_SH_MASK_* - Read the current shared interrupt mask */
204GIC_ACCESSOR_RO_INTR_BIT(0x400, mask)
205
206/* GIC_SH_PEND_* - Read currently pending shared interrupts */
207GIC_ACCESSOR_RO_INTR_BIT(0x480, pend)
208
209/* GIC_SH_MAPx_PIN - Map shared interrupts to a particular CPU pin */
210GIC_ACCESSOR_RW_INTR_REG(32, 0x500, 0x4, map_pin)
211#define GIC_MAP_PIN_MAP_TO_PIN BIT(31)
212#define GIC_MAP_PIN_MAP_TO_NMI BIT(30)
213#define GIC_MAP_PIN_MAP GENMASK(5, 0)
214
215/* GIC_SH_MAPx_VP - Map shared interrupts to a particular Virtual Processor */
216GIC_ACCESSOR_RW_INTR_REG(32, 0x2000, 0x20, map_vp)
217
218/* GIC_Vx_CTL - VP-level interrupt control */
219GIC_VX_ACCESSOR_RW(32, 0x000, ctl)
220#define GIC_VX_CTL_FDC_ROUTABLE BIT(4)
221#define GIC_VX_CTL_SWINT_ROUTABLE BIT(3)
222#define GIC_VX_CTL_PERFCNT_ROUTABLE BIT(2)
223#define GIC_VX_CTL_TIMER_ROUTABLE BIT(1)
224#define GIC_VX_CTL_EIC BIT(0)
225
226/* GIC_Vx_PEND - Read currently pending local interrupts */
227GIC_VX_ACCESSOR_RO(32, 0x004, pend)
228
229/* GIC_Vx_MASK - Read the current local interrupt mask */
230GIC_VX_ACCESSOR_RO(32, 0x008, mask)
231
232/* GIC_Vx_RMASK - Reset/clear local interrupt mask bits */
233GIC_VX_ACCESSOR_RW(32, 0x00c, rmask)
234
235/* GIC_Vx_SMASK - Set local interrupt mask bits */
236GIC_VX_ACCESSOR_RW(32, 0x010, smask)
237
238/* GIC_Vx_*_MAP - Route local interrupts to the desired pins */
239GIC_VX_ACCESSOR_RW_INTR_REG(32, 0x040, 0x4, map)
240
241/* GIC_Vx_WD_MAP - Route the local watchdog timer interrupt */
242GIC_VX_ACCESSOR_RW(32, 0x040, wd_map)
243
244/* GIC_Vx_COMPARE_MAP - Route the local count/compare interrupt */
245GIC_VX_ACCESSOR_RW(32, 0x044, compare_map)
246
247/* GIC_Vx_TIMER_MAP - Route the local CPU timer (cp0 count/compare) interrupt */
248GIC_VX_ACCESSOR_RW(32, 0x048, timer_map)
249
250/* GIC_Vx_FDC_MAP - Route the local fast debug channel interrupt */
251GIC_VX_ACCESSOR_RW(32, 0x04c, fdc_map)
252
253/* GIC_Vx_PERFCTR_MAP - Route the local performance counter interrupt */
254GIC_VX_ACCESSOR_RW(32, 0x050, perfctr_map)
255
256/* GIC_Vx_SWINT0_MAP - Route the local software interrupt 0 */
257GIC_VX_ACCESSOR_RW(32, 0x054, swint0_map)
258
259/* GIC_Vx_SWINT1_MAP - Route the local software interrupt 1 */
260GIC_VX_ACCESSOR_RW(32, 0x058, swint1_map)
261
262/* GIC_Vx_OTHER - Configure access to other Virtual Processor registers */
263GIC_VX_ACCESSOR_RW(32, 0x080, other)
264#define GIC_VX_OTHER_VPNUM GENMASK(5, 0)
265
266/* GIC_Vx_IDENT - Retrieve the local Virtual Processor's ID */
267GIC_VX_ACCESSOR_RO(32, 0x088, ident)
268#define GIC_VX_IDENT_VPNUM GENMASK(5, 0)
269
270/* GIC_Vx_COMPARE - Value to compare with GIC_SH_COUNTER */
271GIC_VX_ACCESSOR_RW(64, 0x0a0, compare)
272
273/* GIC_Vx_EIC_SHADOW_SET_BASE - Set shadow register set for each interrupt */
274GIC_VX_ACCESSOR_RW_INTR_REG(32, 0x100, 0x4, eic_shadow_set)
275
276/**
277 * enum mips_gic_local_interrupt - GIC local interrupts
278 * @GIC_LOCAL_INT_WD: GIC watchdog timer interrupt
279 * @GIC_LOCAL_INT_COMPARE: GIC count/compare interrupt
280 * @GIC_LOCAL_INT_TIMER: CP0 count/compare interrupt
281 * @GIC_LOCAL_INT_PERFCTR: Performance counter interrupt
282 * @GIC_LOCAL_INT_SWINT0: Software interrupt 0
283 * @GIC_LOCAL_INT_SWINT1: Software interrupt 1
284 * @GIC_LOCAL_INT_FDC: Fast debug channel interrupt
285 * @GIC_NUM_LOCAL_INTRS: The number of local interrupts
286 *
287 * Enumerates interrupts provided by the GIC that are local to a VP.
288 */
289enum mips_gic_local_interrupt {
290 GIC_LOCAL_INT_WD,
291 GIC_LOCAL_INT_COMPARE,
292 GIC_LOCAL_INT_TIMER,
293 GIC_LOCAL_INT_PERFCTR,
294 GIC_LOCAL_INT_SWINT0,
295 GIC_LOCAL_INT_SWINT1,
296 GIC_LOCAL_INT_FDC,
297 GIC_NUM_LOCAL_INTRS
298};
299
300/**
301 * mips_gic_present() - Determine whether a GIC is present
302 *
303 * Determines whether a MIPS Global Interrupt Controller (GIC) is present in
304 * the system that the kernel is running on.
305 *
306 * Return true if a GIC is present, else false.
307 */
308static inline bool mips_gic_present(void)
309{
310 return IS_ENABLED(CONFIG_MIPS_GIC) && mips_gic_base;
311}
312
313/**
314 * mips_gic_vx_map_reg() - Return GIC_Vx_<intr>_MAP register offset
315 * @intr: A GIC local interrupt
316 *
317 * Determine the index of the GIC_VL_<intr>_MAP or GIC_VO_<intr>_MAP register
318 * within the block of GIC map registers. This is almost the same as the order
319 * of interrupts in the pending & mask registers, as used by enum
320 * mips_gic_local_interrupt, but moves the FDC interrupt & thus offsets the
321 * interrupts after it...
322 *
323 * Return: The map register index corresponding to @intr.
324 *
325 * The return value is suitable for use with the (read|write)_gic_v[lo]_map
326 * accessor functions.
327 */
328static inline unsigned int
329mips_gic_vx_map_reg(enum mips_gic_local_interrupt intr)
330{
331 /* WD, Compare & Timer are 1:1 */
332 if (intr <= GIC_LOCAL_INT_TIMER)
333 return intr;
334
335 /* FDC moves to after Timer... */
336 if (intr == GIC_LOCAL_INT_FDC)
337 return GIC_LOCAL_INT_TIMER + 1;
338
339 /* As a result everything else is offset by 1 */
340 return intr + 1;
341}
342
343/**
344 * gic_get_c0_compare_int() - Return cp0 count/compare interrupt virq
345 *
346 * Determine the virq number to use for the coprocessor 0 count/compare
347 * interrupt, which may be routed via the GIC.
348 *
349 * Returns the virq number or a negative error number.
350 */
351extern int gic_get_c0_compare_int(void);
352
353/**
354 * gic_get_c0_perfcount_int() - Return performance counter interrupt virq
355 *
356 * Determine the virq number to use for CPU performance counter interrupts,
357 * which may be routed via the GIC.
358 *
359 * Returns the virq number or a negative error number.
360 */
361extern int gic_get_c0_perfcount_int(void);
362
363/**
364 * gic_get_c0_fdc_int() - Return fast debug channel interrupt virq
365 *
366 * Determine the virq number to use for fast debug channel (FDC) interrupts,
367 * which may be routed via the GIC.
368 *
369 * Returns the virq number or a negative error number.
370 */
371extern int gic_get_c0_fdc_int(void);
372
373#endif /* __MIPS_ASM_MIPS_CPS_H__ */
diff --git a/arch/mips/include/asm/mips-r2-to-r6-emul.h b/arch/mips/include/asm/mips-r2-to-r6-emul.h
new file mode 100644
index 000000000..20621e1ca
--- /dev/null
+++ b/arch/mips/include/asm/mips-r2-to-r6-emul.h
@@ -0,0 +1,101 @@
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) 2014 Imagination Technologies Ltd.
7 * Author: Markos Chandras <markos.chandras@imgtec.com>
8 */
9
10#ifndef __ASM_MIPS_R2_TO_R6_EMUL_H
11#define __ASM_MIPS_R2_TO_R6_EMUL_H
12
13struct mips_r2_emulator_stats {
14 u64 movs;
15 u64 hilo;
16 u64 muls;
17 u64 divs;
18 u64 dsps;
19 u64 bops;
20 u64 traps;
21 u64 fpus;
22 u64 loads;
23 u64 stores;
24 u64 llsc;
25 u64 dsemul;
26};
27
28struct mips_r2br_emulator_stats {
29 u64 jrs;
30 u64 bltzl;
31 u64 bgezl;
32 u64 bltzll;
33 u64 bgezll;
34 u64 bltzall;
35 u64 bgezall;
36 u64 bltzal;
37 u64 bgezal;
38 u64 beql;
39 u64 bnel;
40 u64 blezl;
41 u64 bgtzl;
42};
43
44#ifdef CONFIG_DEBUG_FS
45
46#define MIPS_R2_STATS(M) \
47do { \
48 u32 nir; \
49 int err; \
50 \
51 preempt_disable(); \
52 __this_cpu_inc(mipsr2emustats.M); \
53 err = __get_user(nir, (u32 __user *)regs->cp0_epc); \
54 if (!err) { \
55 if (nir == BREAK_MATH(0)) \
56 __this_cpu_inc(mipsr2bdemustats.M); \
57 } \
58 preempt_enable(); \
59} while (0)
60
61#define MIPS_R2BR_STATS(M) \
62do { \
63 preempt_disable(); \
64 __this_cpu_inc(mipsr2bremustats.M); \
65 preempt_enable(); \
66} while (0)
67
68#else
69
70#define MIPS_R2_STATS(M) do { } while (0)
71#define MIPS_R2BR_STATS(M) do { } while (0)
72
73#endif /* CONFIG_DEBUG_FS */
74
75struct r2_decoder_table {
76 u32 mask;
77 u32 code;
78 int (*func)(struct pt_regs *regs, u32 inst);
79};
80
81
82extern void do_trap_or_bp(struct pt_regs *regs, unsigned int code, int si_code,
83 const char *str);
84
85#ifndef CONFIG_MIPSR2_TO_R6_EMULATOR
86static int mipsr2_emulation;
87static inline int mipsr2_decoder(struct pt_regs *regs, u32 inst,
88 unsigned long *fcr31)
89{
90 return 0;
91};
92#else
93/* MIPS R2 Emulator ON/OFF */
94extern int mipsr2_emulation;
95extern int mipsr2_decoder(struct pt_regs *regs, u32 inst,
96 unsigned long *fcr31);
97#endif /* CONFIG_MIPSR2_TO_R6_EMULATOR */
98
99#define NO_R6EMU (cpu_has_mips_r6 && !mipsr2_emulation)
100
101#endif /* __ASM_MIPS_R2_TO_R6_EMUL_H */
diff --git a/arch/mips/include/asm/mips_mt.h b/arch/mips/include/asm/mips_mt.h
new file mode 100644
index 000000000..b444523ec
--- /dev/null
+++ b/arch/mips/include/asm/mips_mt.h
@@ -0,0 +1,31 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Definitions and declarations for MIPS MT support that are common between
4 * the VSMP, and AP/SP kernel models.
5 */
6#ifndef __ASM_MIPS_MT_H
7#define __ASM_MIPS_MT_H
8
9#include <linux/cpumask.h>
10
11/*
12 * How many VPEs and TCs is Linux allowed to use? 0 means no limit.
13 */
14extern int tclimit;
15extern int vpelimit;
16
17extern cpumask_t mt_fpu_cpumask;
18extern unsigned long mt_fpemul_threshold;
19
20extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value);
21
22#ifdef CONFIG_MIPS_MT
23extern void mips_mt_set_cpuoptions(void);
24#else
25static inline void mips_mt_set_cpuoptions(void) { }
26#endif
27
28struct class;
29extern struct class *mt_class;
30
31#endif /* __ASM_MIPS_MT_H */
diff --git a/arch/mips/include/asm/mipsmtregs.h b/arch/mips/include/asm/mipsmtregs.h
new file mode 100644
index 000000000..be4cf9d47
--- /dev/null
+++ b/arch/mips/include/asm/mipsmtregs.h
@@ -0,0 +1,423 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * MT regs definitions, follows on from mipsregs.h
4 * Copyright (C) 2004 - 2005 MIPS Technologies, Inc. All rights reserved.
5 * Elizabeth Clarke et. al.
6 *
7 */
8#ifndef _ASM_MIPSMTREGS_H
9#define _ASM_MIPSMTREGS_H
10
11#include <asm/mipsregs.h>
12#include <asm/war.h>
13
14#ifndef __ASSEMBLY__
15
16/*
17 * C macros
18 */
19
20#define read_c0_mvpcontrol() __read_32bit_c0_register($0, 1)
21#define write_c0_mvpcontrol(val) __write_32bit_c0_register($0, 1, val)
22
23#define read_c0_mvpconf0() __read_32bit_c0_register($0, 2)
24#define read_c0_mvpconf1() __read_32bit_c0_register($0, 3)
25
26#define read_c0_vpecontrol() __read_32bit_c0_register($1, 1)
27#define write_c0_vpecontrol(val) __write_32bit_c0_register($1, 1, val)
28
29#define read_c0_vpeconf0() __read_32bit_c0_register($1, 2)
30#define write_c0_vpeconf0(val) __write_32bit_c0_register($1, 2, val)
31
32#define read_c0_vpeconf1() __read_32bit_c0_register($1, 3)
33#define write_c0_vpeconf1(val) __write_32bit_c0_register($1, 3, val)
34
35#define read_c0_tcstatus() __read_32bit_c0_register($2, 1)
36#define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val)
37
38#define read_c0_tcbind() __read_32bit_c0_register($2, 2)
39
40#define write_c0_tchalt(val) __write_32bit_c0_register($2, 4, val)
41
42#define read_c0_tccontext() __read_32bit_c0_register($2, 5)
43#define write_c0_tccontext(val) __write_32bit_c0_register($2, 5, val)
44
45#else /* Assembly */
46/*
47 * Macros for use in assembly language code
48 */
49
50#define CP0_MVPCONTROL $0, 1
51#define CP0_MVPCONF0 $0, 2
52#define CP0_MVPCONF1 $0, 3
53#define CP0_VPECONTROL $1, 1
54#define CP0_VPECONF0 $1, 2
55#define CP0_VPECONF1 $1, 3
56#define CP0_YQMASK $1, 4
57#define CP0_VPESCHEDULE $1, 5
58#define CP0_VPESCHEFBK $1, 6
59#define CP0_TCSTATUS $2, 1
60#define CP0_TCBIND $2, 2
61#define CP0_TCRESTART $2, 3
62#define CP0_TCHALT $2, 4
63#define CP0_TCCONTEXT $2, 5
64#define CP0_TCSCHEDULE $2, 6
65#define CP0_TCSCHEFBK $2, 7
66#define CP0_SRSCONF0 $6, 1
67#define CP0_SRSCONF1 $6, 2
68#define CP0_SRSCONF2 $6, 3
69#define CP0_SRSCONF3 $6, 4
70#define CP0_SRSCONF4 $6, 5
71
72#endif
73
74/* MVPControl fields */
75#define MVPCONTROL_EVP (_ULCAST_(1))
76
77#define MVPCONTROL_VPC_SHIFT 1
78#define MVPCONTROL_VPC (_ULCAST_(1) << MVPCONTROL_VPC_SHIFT)
79
80#define MVPCONTROL_STLB_SHIFT 2
81#define MVPCONTROL_STLB (_ULCAST_(1) << MVPCONTROL_STLB_SHIFT)
82
83
84/* MVPConf0 fields */
85#define MVPCONF0_PTC_SHIFT 0
86#define MVPCONF0_PTC ( _ULCAST_(0xff))
87#define MVPCONF0_PVPE_SHIFT 10
88#define MVPCONF0_PVPE ( _ULCAST_(0xf) << MVPCONF0_PVPE_SHIFT)
89#define MVPCONF0_TCA_SHIFT 15
90#define MVPCONF0_TCA ( _ULCAST_(1) << MVPCONF0_TCA_SHIFT)
91#define MVPCONF0_PTLBE_SHIFT 16
92#define MVPCONF0_PTLBE (_ULCAST_(0x3ff) << MVPCONF0_PTLBE_SHIFT)
93#define MVPCONF0_TLBS_SHIFT 29
94#define MVPCONF0_TLBS (_ULCAST_(1) << MVPCONF0_TLBS_SHIFT)
95#define MVPCONF0_M_SHIFT 31
96#define MVPCONF0_M (_ULCAST_(0x1) << MVPCONF0_M_SHIFT)
97
98
99/* config3 fields */
100#define CONFIG3_MT_SHIFT 2
101#define CONFIG3_MT (_ULCAST_(1) << CONFIG3_MT_SHIFT)
102
103
104/* VPEControl fields (per VPE) */
105#define VPECONTROL_TARGTC (_ULCAST_(0xff))
106
107#define VPECONTROL_TE_SHIFT 15
108#define VPECONTROL_TE (_ULCAST_(1) << VPECONTROL_TE_SHIFT)
109#define VPECONTROL_EXCPT_SHIFT 16
110#define VPECONTROL_EXCPT (_ULCAST_(0x7) << VPECONTROL_EXCPT_SHIFT)
111
112/* Thread Exception Codes for EXCPT field */
113#define THREX_TU 0
114#define THREX_TO 1
115#define THREX_IYQ 2
116#define THREX_GSX 3
117#define THREX_YSCH 4
118#define THREX_GSSCH 5
119
120#define VPECONTROL_GSI_SHIFT 20
121#define VPECONTROL_GSI (_ULCAST_(1) << VPECONTROL_GSI_SHIFT)
122#define VPECONTROL_YSI_SHIFT 21
123#define VPECONTROL_YSI (_ULCAST_(1) << VPECONTROL_YSI_SHIFT)
124
125/* VPEConf0 fields (per VPE) */
126#define VPECONF0_VPA_SHIFT 0
127#define VPECONF0_VPA (_ULCAST_(1) << VPECONF0_VPA_SHIFT)
128#define VPECONF0_MVP_SHIFT 1
129#define VPECONF0_MVP (_ULCAST_(1) << VPECONF0_MVP_SHIFT)
130#define VPECONF0_XTC_SHIFT 21
131#define VPECONF0_XTC (_ULCAST_(0xff) << VPECONF0_XTC_SHIFT)
132
133/* VPEConf1 fields (per VPE) */
134#define VPECONF1_NCP1_SHIFT 0
135#define VPECONF1_NCP1 (_ULCAST_(0xff) << VPECONF1_NCP1_SHIFT)
136#define VPECONF1_NCP2_SHIFT 10
137#define VPECONF1_NCP2 (_ULCAST_(0xff) << VPECONF1_NCP2_SHIFT)
138#define VPECONF1_NCX_SHIFT 20
139#define VPECONF1_NCX (_ULCAST_(0xff) << VPECONF1_NCX_SHIFT)
140
141/* TCStatus fields (per TC) */
142#define TCSTATUS_TASID (_ULCAST_(0xff))
143#define TCSTATUS_IXMT_SHIFT 10
144#define TCSTATUS_IXMT (_ULCAST_(1) << TCSTATUS_IXMT_SHIFT)
145#define TCSTATUS_TKSU_SHIFT 11
146#define TCSTATUS_TKSU (_ULCAST_(3) << TCSTATUS_TKSU_SHIFT)
147#define TCSTATUS_A_SHIFT 13
148#define TCSTATUS_A (_ULCAST_(1) << TCSTATUS_A_SHIFT)
149#define TCSTATUS_DA_SHIFT 15
150#define TCSTATUS_DA (_ULCAST_(1) << TCSTATUS_DA_SHIFT)
151#define TCSTATUS_DT_SHIFT 20
152#define TCSTATUS_DT (_ULCAST_(1) << TCSTATUS_DT_SHIFT)
153#define TCSTATUS_TDS_SHIFT 21
154#define TCSTATUS_TDS (_ULCAST_(1) << TCSTATUS_TDS_SHIFT)
155#define TCSTATUS_TSST_SHIFT 22
156#define TCSTATUS_TSST (_ULCAST_(1) << TCSTATUS_TSST_SHIFT)
157#define TCSTATUS_RNST_SHIFT 23
158#define TCSTATUS_RNST (_ULCAST_(3) << TCSTATUS_RNST_SHIFT)
159/* Codes for RNST */
160#define TC_RUNNING 0
161#define TC_WAITING 1
162#define TC_YIELDING 2
163#define TC_GATED 3
164
165#define TCSTATUS_TMX_SHIFT 27
166#define TCSTATUS_TMX (_ULCAST_(1) << TCSTATUS_TMX_SHIFT)
167/* TCStatus TCU bits can use same definitions/offsets as CU bits in Status */
168
169/* TCBind */
170#define TCBIND_CURVPE_SHIFT 0
171#define TCBIND_CURVPE (_ULCAST_(0xf))
172
173#define TCBIND_CURTC_SHIFT 21
174
175#define TCBIND_CURTC (_ULCAST_(0xff) << TCBIND_CURTC_SHIFT)
176
177/* TCHalt */
178#define TCHALT_H (_ULCAST_(1))
179
180#ifndef __ASSEMBLY__
181
182static inline unsigned core_nvpes(void)
183{
184 unsigned conf0;
185
186 if (!cpu_has_mipsmt)
187 return 1;
188
189 conf0 = read_c0_mvpconf0();
190 return ((conf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
191}
192
193static inline unsigned int dvpe(void)
194{
195 int res = 0;
196
197 __asm__ __volatile__(
198 " .set push \n"
199 " .set noreorder \n"
200 " .set noat \n"
201 " .set mips32r2 \n"
202 " .word 0x41610001 # dvpe $1 \n"
203 " move %0, $1 \n"
204 " ehb \n"
205 " .set pop \n"
206 : "=r" (res));
207
208 instruction_hazard();
209
210 return res;
211}
212
213static inline void __raw_evpe(void)
214{
215 __asm__ __volatile__(
216 " .set push \n"
217 " .set noreorder \n"
218 " .set noat \n"
219 " .set mips32r2 \n"
220 " .word 0x41600021 # evpe \n"
221 " ehb \n"
222 " .set pop \n");
223}
224
225/* Enable virtual processor execution if previous suggested it should be.
226 EVPE_ENABLE to force */
227
228#define EVPE_ENABLE MVPCONTROL_EVP
229
230static inline void evpe(int previous)
231{
232 if ((previous & MVPCONTROL_EVP))
233 __raw_evpe();
234}
235
236static inline unsigned int dmt(void)
237{
238 int res;
239
240 __asm__ __volatile__(
241 " .set push \n"
242 " .set mips32r2 \n"
243 " .set noat \n"
244 " .word 0x41610BC1 # dmt $1 \n"
245 " ehb \n"
246 " move %0, $1 \n"
247 " .set pop \n"
248 : "=r" (res));
249
250 instruction_hazard();
251
252 return res;
253}
254
255static inline void __raw_emt(void)
256{
257 __asm__ __volatile__(
258 " .set push \n"
259 " .set noreorder \n"
260 " .set mips32r2 \n"
261 " .word 0x41600be1 # emt \n"
262 " ehb \n"
263 " .set pop");
264}
265
266/* enable multi-threaded execution if previous suggested it should be.
267 EMT_ENABLE to force */
268
269#define EMT_ENABLE VPECONTROL_TE
270
271static inline void emt(int previous)
272{
273 if ((previous & EMT_ENABLE))
274 __raw_emt();
275}
276
277static inline void ehb(void)
278{
279 __asm__ __volatile__(
280 " .set push \n"
281 " .set mips32r2 \n"
282 " ehb \n"
283 " .set pop \n");
284}
285
286#define mftc0(rt,sel) \
287({ \
288 unsigned long __res; \
289 \
290 __asm__ __volatile__( \
291 " .set push \n" \
292 " .set mips32r2 \n" \
293 " .set noat \n" \
294 " # mftc0 $1, $" #rt ", " #sel " \n" \
295 " .word 0x41000800 | (" #rt " << 16) | " #sel " \n" \
296 " move %0, $1 \n" \
297 " .set pop \n" \
298 : "=r" (__res)); \
299 \
300 __res; \
301})
302
303#define mftgpr(rt) \
304({ \
305 unsigned long __res; \
306 \
307 __asm__ __volatile__( \
308 " .set push \n" \
309 " .set noat \n" \
310 " .set mips32r2 \n" \
311 " # mftgpr $1," #rt " \n" \
312 " .word 0x41000820 | (" #rt " << 16) \n" \
313 " move %0, $1 \n" \
314 " .set pop \n" \
315 : "=r" (__res)); \
316 \
317 __res; \
318})
319
320#define mftr(rt, u, sel) \
321({ \
322 unsigned long __res; \
323 \
324 __asm__ __volatile__( \
325 " mftr %0, " #rt ", " #u ", " #sel " \n" \
326 : "=r" (__res)); \
327 \
328 __res; \
329})
330
331#define mttgpr(rd,v) \
332do { \
333 __asm__ __volatile__( \
334 " .set push \n" \
335 " .set mips32r2 \n" \
336 " .set noat \n" \
337 " move $1, %0 \n" \
338 " # mttgpr $1, " #rd " \n" \
339 " .word 0x41810020 | (" #rd " << 11) \n" \
340 " .set pop \n" \
341 : : "r" (v)); \
342} while (0)
343
344#define mttc0(rd, sel, v) \
345({ \
346 __asm__ __volatile__( \
347 " .set push \n" \
348 " .set mips32r2 \n" \
349 " .set noat \n" \
350 " move $1, %0 \n" \
351 " # mttc0 %0," #rd ", " #sel " \n" \
352 " .word 0x41810000 | (" #rd " << 11) | " #sel " \n" \
353 " .set pop \n" \
354 : \
355 : "r" (v)); \
356})
357
358
359#define mttr(rd, u, sel, v) \
360({ \
361 __asm__ __volatile__( \
362 "mttr %0," #rd ", " #u ", " #sel \
363 : : "r" (v)); \
364})
365
366
367#define settc(tc) \
368do { \
369 write_c0_vpecontrol((read_c0_vpecontrol()&~VPECONTROL_TARGTC) | (tc)); \
370 ehb(); \
371} while (0)
372
373
374/* you *must* set the target tc (settc) before trying to use these */
375#define read_vpe_c0_vpecontrol() mftc0(1, 1)
376#define write_vpe_c0_vpecontrol(val) mttc0(1, 1, val)
377#define read_vpe_c0_vpeconf0() mftc0(1, 2)
378#define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val)
379#define read_vpe_c0_vpeconf1() mftc0(1, 3)
380#define write_vpe_c0_vpeconf1(val) mttc0(1, 3, val)
381#define read_vpe_c0_count() mftc0(9, 0)
382#define write_vpe_c0_count(val) mttc0(9, 0, val)
383#define read_vpe_c0_status() mftc0(12, 0)
384#define write_vpe_c0_status(val) mttc0(12, 0, val)
385#define read_vpe_c0_cause() mftc0(13, 0)
386#define write_vpe_c0_cause(val) mttc0(13, 0, val)
387#define read_vpe_c0_config() mftc0(16, 0)
388#define write_vpe_c0_config(val) mttc0(16, 0, val)
389#define read_vpe_c0_config1() mftc0(16, 1)
390#define write_vpe_c0_config1(val) mttc0(16, 1, val)
391#define read_vpe_c0_config7() mftc0(16, 7)
392#define write_vpe_c0_config7(val) mttc0(16, 7, val)
393#define read_vpe_c0_ebase() mftc0(15, 1)
394#define write_vpe_c0_ebase(val) mttc0(15, 1, val)
395#define write_vpe_c0_compare(val) mttc0(11, 0, val)
396#define read_vpe_c0_badvaddr() mftc0(8, 0)
397#define read_vpe_c0_epc() mftc0(14, 0)
398#define write_vpe_c0_epc(val) mttc0(14, 0, val)
399
400
401/* TC */
402#define read_tc_c0_tcstatus() mftc0(2, 1)
403#define write_tc_c0_tcstatus(val) mttc0(2, 1, val)
404#define read_tc_c0_tcbind() mftc0(2, 2)
405#define write_tc_c0_tcbind(val) mttc0(2, 2, val)
406#define read_tc_c0_tcrestart() mftc0(2, 3)
407#define write_tc_c0_tcrestart(val) mttc0(2, 3, val)
408#define read_tc_c0_tchalt() mftc0(2, 4)
409#define write_tc_c0_tchalt(val) mttc0(2, 4, val)
410#define read_tc_c0_tccontext() mftc0(2, 5)
411#define write_tc_c0_tccontext(val) mttc0(2, 5, val)
412
413/* GPR */
414#define read_tc_gpr_sp() mftgpr(29)
415#define write_tc_gpr_sp(val) mttgpr(29, val)
416#define read_tc_gpr_gp() mftgpr(28)
417#define write_tc_gpr_gp(val) mttgpr(28, val)
418
419__BUILD_SET_C0(mvpcontrol)
420
421#endif /* Not __ASSEMBLY__ */
422
423#endif
diff --git a/arch/mips/include/asm/mipsprom.h b/arch/mips/include/asm/mipsprom.h
new file mode 100644
index 000000000..2eda19f8f
--- /dev/null
+++ b/arch/mips/include/asm/mipsprom.h
@@ -0,0 +1,77 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MIPSPROM_H
3#define __ASM_MIPSPROM_H
4
5#define PROM_RESET 0
6#define PROM_EXEC 1
7#define PROM_RESTART 2
8#define PROM_REINIT 3
9#define PROM_REBOOT 4
10#define PROM_AUTOBOOT 5
11#define PROM_OPEN 6
12#define PROM_READ 7
13#define PROM_WRITE 8
14#define PROM_IOCTL 9
15#define PROM_CLOSE 10
16#define PROM_GETCHAR 11
17#define PROM_PUTCHAR 12
18#define PROM_SHOWCHAR 13 /* XXX */
19#define PROM_GETS 14 /* XXX */
20#define PROM_PUTS 15 /* XXX */
21#define PROM_PRINTF 16 /* XXX */
22
23/* What are these for? */
24#define PROM_INITPROTO 17 /* XXX */
25#define PROM_PROTOENABLE 18 /* XXX */
26#define PROM_PROTODISABLE 19 /* XXX */
27#define PROM_GETPKT 20 /* XXX */
28#define PROM_PUTPKT 21 /* XXX */
29
30/* More PROM shit. Probably has to do with VME RMW cycles??? */
31#define PROM_ORW_RMW 22 /* XXX */
32#define PROM_ORH_RMW 23 /* XXX */
33#define PROM_ORB_RMW 24 /* XXX */
34#define PROM_ANDW_RMW 25 /* XXX */
35#define PROM_ANDH_RMW 26 /* XXX */
36#define PROM_ANDB_RMW 27 /* XXX */
37
38/* Cache handling stuff */
39#define PROM_FLUSHCACHE 28 /* XXX */
40#define PROM_CLEARCACHE 29 /* XXX */
41
42/* Libc alike stuff */
43#define PROM_SETJMP 30 /* XXX */
44#define PROM_LONGJMP 31 /* XXX */
45#define PROM_BEVUTLB 32 /* XXX */
46#define PROM_GETENV 33 /* XXX */
47#define PROM_SETENV 34 /* XXX */
48#define PROM_ATOB 35 /* XXX */
49#define PROM_STRCMP 36 /* XXX */
50#define PROM_STRLEN 37 /* XXX */
51#define PROM_STRCPY 38 /* XXX */
52#define PROM_STRCAT 39 /* XXX */
53
54/* Misc stuff */
55#define PROM_PARSER 40 /* XXX */
56#define PROM_RANGE 41 /* XXX */
57#define PROM_ARGVIZE 42 /* XXX */
58#define PROM_HELP 43 /* XXX */
59
60/* Entry points for some PROM commands */
61#define PROM_DUMPCMD 44 /* XXX */
62#define PROM_SETENVCMD 45 /* XXX */
63#define PROM_UNSETENVCMD 46 /* XXX */
64#define PROM_PRINTENVCMD 47 /* XXX */
65#define PROM_BEVEXCEPT 48 /* XXX */
66#define PROM_ENABLECMD 49 /* XXX */
67#define PROM_DISABLECMD 50 /* XXX */
68
69#define PROM_CLEARNOFAULT 51 /* XXX */
70#define PROM_NOTIMPLEMENT 52 /* XXX */
71
72#define PROM_NV_GET 53 /* XXX */
73#define PROM_NV_SET 54 /* XXX */
74
75extern char *prom_getenv(char *);
76
77#endif /* __ASM_MIPSPROM_H */
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
new file mode 100644
index 000000000..7a7467d3f
--- /dev/null
+++ b/arch/mips/include/asm/mipsregs.h
@@ -0,0 +1,2927 @@
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, 07 MIPS Technologies, Inc.
11 * Copyright (C) 2003, 2004 Maciej W. Rozycki
12 */
13#ifndef _ASM_MIPSREGS_H
14#define _ASM_MIPSREGS_H
15
16#include <linux/linkage.h>
17#include <linux/types.h>
18#include <asm/hazards.h>
19#include <asm/isa-rev.h>
20#include <asm/war.h>
21
22/*
23 * The following macros are especially useful for __asm__
24 * inline assembler.
25 */
26#ifndef __STR
27#define __STR(x) #x
28#endif
29#ifndef STR
30#define STR(x) __STR(x)
31#endif
32
33/*
34 * Configure language
35 */
36#ifdef __ASSEMBLY__
37#define _ULCAST_
38#define _U64CAST_
39#else
40#define _ULCAST_ (unsigned long)
41#define _U64CAST_ (u64)
42#endif
43
44/*
45 * Coprocessor 0 register names
46 */
47#define CP0_INDEX $0
48#define CP0_RANDOM $1
49#define CP0_ENTRYLO0 $2
50#define CP0_ENTRYLO1 $3
51#define CP0_CONF $3
52#define CP0_GLOBALNUMBER $3, 1
53#define CP0_CONTEXT $4
54#define CP0_PAGEMASK $5
55#define CP0_PAGEGRAIN $5, 1
56#define CP0_SEGCTL0 $5, 2
57#define CP0_SEGCTL1 $5, 3
58#define CP0_SEGCTL2 $5, 4
59#define CP0_WIRED $6
60#define CP0_INFO $7
61#define CP0_HWRENA $7
62#define CP0_BADVADDR $8
63#define CP0_BADINSTR $8, 1
64#define CP0_COUNT $9
65#define CP0_ENTRYHI $10
66#define CP0_GUESTCTL1 $10, 4
67#define CP0_GUESTCTL2 $10, 5
68#define CP0_GUESTCTL3 $10, 6
69#define CP0_COMPARE $11
70#define CP0_GUESTCTL0EXT $11, 4
71#define CP0_STATUS $12
72#define CP0_GUESTCTL0 $12, 6
73#define CP0_GTOFFSET $12, 7
74#define CP0_CAUSE $13
75#define CP0_EPC $14
76#define CP0_PRID $15
77#define CP0_EBASE $15, 1
78#define CP0_CMGCRBASE $15, 3
79#define CP0_CONFIG $16
80#define CP0_CONFIG3 $16, 3
81#define CP0_CONFIG5 $16, 5
82#define CP0_CONFIG6 $16, 6
83#define CP0_LLADDR $17
84#define CP0_WATCHLO $18
85#define CP0_WATCHHI $19
86#define CP0_XCONTEXT $20
87#define CP0_FRAMEMASK $21
88#define CP0_DIAGNOSTIC $22
89#define CP0_DIAGNOSTIC1 $22, 1
90#define CP0_DEBUG $23
91#define CP0_DEPC $24
92#define CP0_PERFORMANCE $25
93#define CP0_ECC $26
94#define CP0_CACHEERR $27
95#define CP0_TAGLO $28
96#define CP0_TAGHI $29
97#define CP0_ERROREPC $30
98#define CP0_DESAVE $31
99
100/*
101 * R4640/R4650 cp0 register names. These registers are listed
102 * here only for completeness; without MMU these CPUs are not useable
103 * by Linux. A future ELKS port might take make Linux run on them
104 * though ...
105 */
106#define CP0_IBASE $0
107#define CP0_IBOUND $1
108#define CP0_DBASE $2
109#define CP0_DBOUND $3
110#define CP0_CALG $17
111#define CP0_IWATCH $18
112#define CP0_DWATCH $19
113
114/*
115 * Coprocessor 0 Set 1 register names
116 */
117#define CP0_S1_DERRADDR0 $26
118#define CP0_S1_DERRADDR1 $27
119#define CP0_S1_INTCONTROL $20
120
121/*
122 * Coprocessor 0 Set 2 register names
123 */
124#define CP0_S2_SRSCTL $12 /* MIPSR2 */
125
126/*
127 * Coprocessor 0 Set 3 register names
128 */
129#define CP0_S3_SRSMAP $12 /* MIPSR2 */
130
131/*
132 * TX39 Series
133 */
134#define CP0_TX39_CACHE $7
135
136
137/* Generic EntryLo bit definitions */
138#define ENTRYLO_G (_ULCAST_(1) << 0)
139#define ENTRYLO_V (_ULCAST_(1) << 1)
140#define ENTRYLO_D (_ULCAST_(1) << 2)
141#define ENTRYLO_C_SHIFT 3
142#define ENTRYLO_C (_ULCAST_(7) << ENTRYLO_C_SHIFT)
143
144/* R3000 EntryLo bit definitions */
145#define R3K_ENTRYLO_G (_ULCAST_(1) << 8)
146#define R3K_ENTRYLO_V (_ULCAST_(1) << 9)
147#define R3K_ENTRYLO_D (_ULCAST_(1) << 10)
148#define R3K_ENTRYLO_N (_ULCAST_(1) << 11)
149
150/* MIPS32/64 EntryLo bit definitions */
151#define MIPS_ENTRYLO_PFN_SHIFT 6
152#define MIPS_ENTRYLO_XI (_ULCAST_(1) << (BITS_PER_LONG - 2))
153#define MIPS_ENTRYLO_RI (_ULCAST_(1) << (BITS_PER_LONG - 1))
154
155/*
156 * MIPSr6+ GlobalNumber register definitions
157 */
158#define MIPS_GLOBALNUMBER_VP_SHF 0
159#define MIPS_GLOBALNUMBER_VP (_ULCAST_(0xff) << MIPS_GLOBALNUMBER_VP_SHF)
160#define MIPS_GLOBALNUMBER_CORE_SHF 8
161#define MIPS_GLOBALNUMBER_CORE (_ULCAST_(0xff) << MIPS_GLOBALNUMBER_CORE_SHF)
162#define MIPS_GLOBALNUMBER_CLUSTER_SHF 16
163#define MIPS_GLOBALNUMBER_CLUSTER (_ULCAST_(0xf) << MIPS_GLOBALNUMBER_CLUSTER_SHF)
164
165/*
166 * Values for PageMask register
167 */
168#ifdef CONFIG_CPU_VR41XX
169
170/* Why doesn't stupidity hurt ... */
171
172#define PM_1K 0x00000000
173#define PM_4K 0x00001800
174#define PM_16K 0x00007800
175#define PM_64K 0x0001f800
176#define PM_256K 0x0007f800
177
178#else
179
180#define PM_4K 0x00000000
181#define PM_8K 0x00002000
182#define PM_16K 0x00006000
183#define PM_32K 0x0000e000
184#define PM_64K 0x0001e000
185#define PM_128K 0x0003e000
186#define PM_256K 0x0007e000
187#define PM_512K 0x000fe000
188#define PM_1M 0x001fe000
189#define PM_2M 0x003fe000
190#define PM_4M 0x007fe000
191#define PM_8M 0x00ffe000
192#define PM_16M 0x01ffe000
193#define PM_32M 0x03ffe000
194#define PM_64M 0x07ffe000
195#define PM_256M 0x1fffe000
196#define PM_1G 0x7fffe000
197
198#endif
199
200/*
201 * Default page size for a given kernel configuration
202 */
203#ifdef CONFIG_PAGE_SIZE_4KB
204#define PM_DEFAULT_MASK PM_4K
205#elif defined(CONFIG_PAGE_SIZE_8KB)
206#define PM_DEFAULT_MASK PM_8K
207#elif defined(CONFIG_PAGE_SIZE_16KB)
208#define PM_DEFAULT_MASK PM_16K
209#elif defined(CONFIG_PAGE_SIZE_32KB)
210#define PM_DEFAULT_MASK PM_32K
211#elif defined(CONFIG_PAGE_SIZE_64KB)
212#define PM_DEFAULT_MASK PM_64K
213#else
214#error Bad page size configuration!
215#endif
216
217/*
218 * Default huge tlb size for a given kernel configuration
219 */
220#ifdef CONFIG_PAGE_SIZE_4KB
221#define PM_HUGE_MASK PM_1M
222#elif defined(CONFIG_PAGE_SIZE_8KB)
223#define PM_HUGE_MASK PM_4M
224#elif defined(CONFIG_PAGE_SIZE_16KB)
225#define PM_HUGE_MASK PM_16M
226#elif defined(CONFIG_PAGE_SIZE_32KB)
227#define PM_HUGE_MASK PM_64M
228#elif defined(CONFIG_PAGE_SIZE_64KB)
229#define PM_HUGE_MASK PM_256M
230#elif defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
231#error Bad page size configuration for hugetlbfs!
232#endif
233
234/*
235 * Wired register bits
236 */
237#define MIPSR6_WIRED_LIMIT_SHIFT 16
238#define MIPSR6_WIRED_LIMIT (_ULCAST_(0xffff) << MIPSR6_WIRED_LIMIT_SHIFT)
239#define MIPSR6_WIRED_WIRED_SHIFT 0
240#define MIPSR6_WIRED_WIRED (_ULCAST_(0xffff) << MIPSR6_WIRED_WIRED_SHIFT)
241
242/*
243 * Values used for computation of new tlb entries
244 */
245#define PL_4K 12
246#define PL_16K 14
247#define PL_64K 16
248#define PL_256K 18
249#define PL_1M 20
250#define PL_4M 22
251#define PL_16M 24
252#define PL_64M 26
253#define PL_256M 28
254
255/*
256 * PageGrain bits
257 */
258#define PG_RIE (_ULCAST_(1) << 31)
259#define PG_XIE (_ULCAST_(1) << 30)
260#define PG_ELPA (_ULCAST_(1) << 29)
261#define PG_ESP (_ULCAST_(1) << 28)
262#define PG_IEC (_ULCAST_(1) << 27)
263
264/* MIPS32/64 EntryHI bit definitions */
265#define MIPS_ENTRYHI_EHINV (_ULCAST_(1) << 10)
266#define MIPS_ENTRYHI_ASIDX (_ULCAST_(0x3) << 8)
267#define MIPS_ENTRYHI_ASID (_ULCAST_(0xff) << 0)
268
269/*
270 * R4x00 interrupt enable / cause bits
271 */
272#define IE_SW0 (_ULCAST_(1) << 8)
273#define IE_SW1 (_ULCAST_(1) << 9)
274#define IE_IRQ0 (_ULCAST_(1) << 10)
275#define IE_IRQ1 (_ULCAST_(1) << 11)
276#define IE_IRQ2 (_ULCAST_(1) << 12)
277#define IE_IRQ3 (_ULCAST_(1) << 13)
278#define IE_IRQ4 (_ULCAST_(1) << 14)
279#define IE_IRQ5 (_ULCAST_(1) << 15)
280
281/*
282 * R4x00 interrupt cause bits
283 */
284#define C_SW0 (_ULCAST_(1) << 8)
285#define C_SW1 (_ULCAST_(1) << 9)
286#define C_IRQ0 (_ULCAST_(1) << 10)
287#define C_IRQ1 (_ULCAST_(1) << 11)
288#define C_IRQ2 (_ULCAST_(1) << 12)
289#define C_IRQ3 (_ULCAST_(1) << 13)
290#define C_IRQ4 (_ULCAST_(1) << 14)
291#define C_IRQ5 (_ULCAST_(1) << 15)
292
293/*
294 * Bitfields in the R4xx0 cp0 status register
295 */
296#define ST0_IE 0x00000001
297#define ST0_EXL 0x00000002
298#define ST0_ERL 0x00000004
299#define ST0_KSU 0x00000018
300# define KSU_USER 0x00000010
301# define KSU_SUPERVISOR 0x00000008
302# define KSU_KERNEL 0x00000000
303#define ST0_UX 0x00000020
304#define ST0_SX 0x00000040
305#define ST0_KX 0x00000080
306#define ST0_DE 0x00010000
307#define ST0_CE 0x00020000
308
309/*
310 * Setting c0_status.co enables Hit_Writeback and Hit_Writeback_Invalidate
311 * cacheops in userspace. This bit exists only on RM7000 and RM9000
312 * processors.
313 */
314#define ST0_CO 0x08000000
315
316/*
317 * Bitfields in the R[23]000 cp0 status register.
318 */
319#define ST0_IEC 0x00000001
320#define ST0_KUC 0x00000002
321#define ST0_IEP 0x00000004
322#define ST0_KUP 0x00000008
323#define ST0_IEO 0x00000010
324#define ST0_KUO 0x00000020
325/* bits 6 & 7 are reserved on R[23]000 */
326#define ST0_ISC 0x00010000
327#define ST0_SWC 0x00020000
328#define ST0_CM 0x00080000
329
330/*
331 * Bits specific to the R4640/R4650
332 */
333#define ST0_UM (_ULCAST_(1) << 4)
334#define ST0_IL (_ULCAST_(1) << 23)
335#define ST0_DL (_ULCAST_(1) << 24)
336
337/*
338 * Enable the MIPS MDMX and DSP ASEs
339 */
340#define ST0_MX 0x01000000
341
342/*
343 * Status register bits available in all MIPS CPUs.
344 */
345#define ST0_IM 0x0000ff00
346#define STATUSB_IP0 8
347#define STATUSF_IP0 (_ULCAST_(1) << 8)
348#define STATUSB_IP1 9
349#define STATUSF_IP1 (_ULCAST_(1) << 9)
350#define STATUSB_IP2 10
351#define STATUSF_IP2 (_ULCAST_(1) << 10)
352#define STATUSB_IP3 11
353#define STATUSF_IP3 (_ULCAST_(1) << 11)
354#define STATUSB_IP4 12
355#define STATUSF_IP4 (_ULCAST_(1) << 12)
356#define STATUSB_IP5 13
357#define STATUSF_IP5 (_ULCAST_(1) << 13)
358#define STATUSB_IP6 14
359#define STATUSF_IP6 (_ULCAST_(1) << 14)
360#define STATUSB_IP7 15
361#define STATUSF_IP7 (_ULCAST_(1) << 15)
362#define STATUSB_IP8 0
363#define STATUSF_IP8 (_ULCAST_(1) << 0)
364#define STATUSB_IP9 1
365#define STATUSF_IP9 (_ULCAST_(1) << 1)
366#define STATUSB_IP10 2
367#define STATUSF_IP10 (_ULCAST_(1) << 2)
368#define STATUSB_IP11 3
369#define STATUSF_IP11 (_ULCAST_(1) << 3)
370#define STATUSB_IP12 4
371#define STATUSF_IP12 (_ULCAST_(1) << 4)
372#define STATUSB_IP13 5
373#define STATUSF_IP13 (_ULCAST_(1) << 5)
374#define STATUSB_IP14 6
375#define STATUSF_IP14 (_ULCAST_(1) << 6)
376#define STATUSB_IP15 7
377#define STATUSF_IP15 (_ULCAST_(1) << 7)
378#define ST0_CH 0x00040000
379#define ST0_NMI 0x00080000
380#define ST0_SR 0x00100000
381#define ST0_TS 0x00200000
382#define ST0_BEV 0x00400000
383#define ST0_RE 0x02000000
384#define ST0_FR 0x04000000
385#define ST0_CU 0xf0000000
386#define ST0_CU0 0x10000000
387#define ST0_CU1 0x20000000
388#define ST0_CU2 0x40000000
389#define ST0_CU3 0x80000000
390#define ST0_XX 0x80000000 /* MIPS IV naming */
391
392/* in-kernel enabled CUs */
393#ifdef CONFIG_CPU_LOONGSON64
394#define ST0_KERNEL_CUMASK (ST0_CU0 | ST0_CU2)
395#else
396#define ST0_KERNEL_CUMASK ST0_CU0
397#endif
398
399/*
400 * Bitfields and bit numbers in the coprocessor 0 IntCtl register. (MIPSR2)
401 */
402#define INTCTLB_IPFDC 23
403#define INTCTLF_IPFDC (_ULCAST_(7) << INTCTLB_IPFDC)
404#define INTCTLB_IPPCI 26
405#define INTCTLF_IPPCI (_ULCAST_(7) << INTCTLB_IPPCI)
406#define INTCTLB_IPTI 29
407#define INTCTLF_IPTI (_ULCAST_(7) << INTCTLB_IPTI)
408
409/*
410 * Bitfields and bit numbers in the coprocessor 0 cause register.
411 *
412 * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
413 */
414#define CAUSEB_EXCCODE 2
415#define CAUSEF_EXCCODE (_ULCAST_(31) << 2)
416#define CAUSEB_IP 8
417#define CAUSEF_IP (_ULCAST_(255) << 8)
418#define CAUSEB_IP0 8
419#define CAUSEF_IP0 (_ULCAST_(1) << 8)
420#define CAUSEB_IP1 9
421#define CAUSEF_IP1 (_ULCAST_(1) << 9)
422#define CAUSEB_IP2 10
423#define CAUSEF_IP2 (_ULCAST_(1) << 10)
424#define CAUSEB_IP3 11
425#define CAUSEF_IP3 (_ULCAST_(1) << 11)
426#define CAUSEB_IP4 12
427#define CAUSEF_IP4 (_ULCAST_(1) << 12)
428#define CAUSEB_IP5 13
429#define CAUSEF_IP5 (_ULCAST_(1) << 13)
430#define CAUSEB_IP6 14
431#define CAUSEF_IP6 (_ULCAST_(1) << 14)
432#define CAUSEB_IP7 15
433#define CAUSEF_IP7 (_ULCAST_(1) << 15)
434#define CAUSEB_FDCI 21
435#define CAUSEF_FDCI (_ULCAST_(1) << 21)
436#define CAUSEB_WP 22
437#define CAUSEF_WP (_ULCAST_(1) << 22)
438#define CAUSEB_IV 23
439#define CAUSEF_IV (_ULCAST_(1) << 23)
440#define CAUSEB_PCI 26
441#define CAUSEF_PCI (_ULCAST_(1) << 26)
442#define CAUSEB_DC 27
443#define CAUSEF_DC (_ULCAST_(1) << 27)
444#define CAUSEB_CE 28
445#define CAUSEF_CE (_ULCAST_(3) << 28)
446#define CAUSEB_TI 30
447#define CAUSEF_TI (_ULCAST_(1) << 30)
448#define CAUSEB_BD 31
449#define CAUSEF_BD (_ULCAST_(1) << 31)
450
451/*
452 * Cause.ExcCode trap codes.
453 */
454#define EXCCODE_INT 0 /* Interrupt pending */
455#define EXCCODE_MOD 1 /* TLB modified fault */
456#define EXCCODE_TLBL 2 /* TLB miss on load or ifetch */
457#define EXCCODE_TLBS 3 /* TLB miss on a store */
458#define EXCCODE_ADEL 4 /* Address error on a load or ifetch */
459#define EXCCODE_ADES 5 /* Address error on a store */
460#define EXCCODE_IBE 6 /* Bus error on an ifetch */
461#define EXCCODE_DBE 7 /* Bus error on a load or store */
462#define EXCCODE_SYS 8 /* System call */
463#define EXCCODE_BP 9 /* Breakpoint */
464#define EXCCODE_RI 10 /* Reserved instruction exception */
465#define EXCCODE_CPU 11 /* Coprocessor unusable */
466#define EXCCODE_OV 12 /* Arithmetic overflow */
467#define EXCCODE_TR 13 /* Trap instruction */
468#define EXCCODE_MSAFPE 14 /* MSA floating point exception */
469#define EXCCODE_FPE 15 /* Floating point exception */
470#define EXCCODE_TLBRI 19 /* TLB Read-Inhibit exception */
471#define EXCCODE_TLBXI 20 /* TLB Execution-Inhibit exception */
472#define EXCCODE_MSADIS 21 /* MSA disabled exception */
473#define EXCCODE_MDMX 22 /* MDMX unusable exception */
474#define EXCCODE_WATCH 23 /* Watch address reference */
475#define EXCCODE_MCHECK 24 /* Machine check */
476#define EXCCODE_THREAD 25 /* Thread exceptions (MT) */
477#define EXCCODE_DSPDIS 26 /* DSP disabled exception */
478#define EXCCODE_GE 27 /* Virtualized guest exception (VZ) */
479#define EXCCODE_CACHEERR 30 /* Parity/ECC occured on a core */
480
481/* Implementation specific trap codes used by MIPS cores */
482#define MIPS_EXCCODE_TLBPAR 16 /* TLB parity error exception */
483
484/* Implementation specific trap codes used by Loongson cores */
485#define LOONGSON_EXCCODE_GSEXC 16 /* Loongson-specific exception */
486
487/*
488 * Bits in the coprocessor 0 config register.
489 */
490/* Generic bits. */
491#define CONF_CM_CACHABLE_NO_WA 0
492#define CONF_CM_CACHABLE_WA 1
493#define CONF_CM_UNCACHED 2
494#define CONF_CM_CACHABLE_NONCOHERENT 3
495#define CONF_CM_CACHABLE_CE 4
496#define CONF_CM_CACHABLE_COW 5
497#define CONF_CM_CACHABLE_CUW 6
498#define CONF_CM_CACHABLE_ACCELERATED 7
499#define CONF_CM_CMASK 7
500#define CONF_BE (_ULCAST_(1) << 15)
501
502/* Bits common to various processors. */
503#define CONF_CU (_ULCAST_(1) << 3)
504#define CONF_DB (_ULCAST_(1) << 4)
505#define CONF_IB (_ULCAST_(1) << 5)
506#define CONF_DC (_ULCAST_(7) << 6)
507#define CONF_IC (_ULCAST_(7) << 9)
508#define CONF_EB (_ULCAST_(1) << 13)
509#define CONF_EM (_ULCAST_(1) << 14)
510#define CONF_SM (_ULCAST_(1) << 16)
511#define CONF_SC (_ULCAST_(1) << 17)
512#define CONF_EW (_ULCAST_(3) << 18)
513#define CONF_EP (_ULCAST_(15)<< 24)
514#define CONF_EC (_ULCAST_(7) << 28)
515#define CONF_CM (_ULCAST_(1) << 31)
516
517/* Bits specific to the R4xx0. */
518#define R4K_CONF_SW (_ULCAST_(1) << 20)
519#define R4K_CONF_SS (_ULCAST_(1) << 21)
520#define R4K_CONF_SB (_ULCAST_(3) << 22)
521
522/* Bits specific to the R5000. */
523#define R5K_CONF_SE (_ULCAST_(1) << 12)
524#define R5K_CONF_SS (_ULCAST_(3) << 20)
525
526/* Bits specific to the RM7000. */
527#define RM7K_CONF_SE (_ULCAST_(1) << 3)
528#define RM7K_CONF_TE (_ULCAST_(1) << 12)
529#define RM7K_CONF_CLK (_ULCAST_(1) << 16)
530#define RM7K_CONF_TC (_ULCAST_(1) << 17)
531#define RM7K_CONF_SI (_ULCAST_(3) << 20)
532#define RM7K_CONF_SC (_ULCAST_(1) << 31)
533
534/* Bits specific to the R10000. */
535#define R10K_CONF_DN (_ULCAST_(3) << 3)
536#define R10K_CONF_CT (_ULCAST_(1) << 5)
537#define R10K_CONF_PE (_ULCAST_(1) << 6)
538#define R10K_CONF_PM (_ULCAST_(3) << 7)
539#define R10K_CONF_EC (_ULCAST_(15)<< 9)
540#define R10K_CONF_SB (_ULCAST_(1) << 13)
541#define R10K_CONF_SK (_ULCAST_(1) << 14)
542#define R10K_CONF_SS (_ULCAST_(7) << 16)
543#define R10K_CONF_SC (_ULCAST_(7) << 19)
544#define R10K_CONF_DC (_ULCAST_(7) << 26)
545#define R10K_CONF_IC (_ULCAST_(7) << 29)
546
547/* Bits specific to the VR41xx. */
548#define VR41_CONF_CS (_ULCAST_(1) << 12)
549#define VR41_CONF_P4K (_ULCAST_(1) << 13)
550#define VR41_CONF_BP (_ULCAST_(1) << 16)
551#define VR41_CONF_M16 (_ULCAST_(1) << 20)
552#define VR41_CONF_AD (_ULCAST_(1) << 23)
553
554/* Bits specific to the R30xx. */
555#define R30XX_CONF_FDM (_ULCAST_(1) << 19)
556#define R30XX_CONF_REV (_ULCAST_(1) << 22)
557#define R30XX_CONF_AC (_ULCAST_(1) << 23)
558#define R30XX_CONF_RF (_ULCAST_(1) << 24)
559#define R30XX_CONF_HALT (_ULCAST_(1) << 25)
560#define R30XX_CONF_FPINT (_ULCAST_(7) << 26)
561#define R30XX_CONF_DBR (_ULCAST_(1) << 29)
562#define R30XX_CONF_SB (_ULCAST_(1) << 30)
563#define R30XX_CONF_LOCK (_ULCAST_(1) << 31)
564
565/* Bits specific to the TX49. */
566#define TX49_CONF_DC (_ULCAST_(1) << 16)
567#define TX49_CONF_IC (_ULCAST_(1) << 17) /* conflict with CONF_SC */
568#define TX49_CONF_HALT (_ULCAST_(1) << 18)
569#define TX49_CONF_CWFON (_ULCAST_(1) << 27)
570
571/* Bits specific to the MIPS32/64 PRA. */
572#define MIPS_CONF_VI (_ULCAST_(1) << 3)
573#define MIPS_CONF_MT (_ULCAST_(7) << 7)
574#define MIPS_CONF_MT_TLB (_ULCAST_(1) << 7)
575#define MIPS_CONF_MT_FTLB (_ULCAST_(4) << 7)
576#define MIPS_CONF_AR (_ULCAST_(7) << 10)
577#define MIPS_CONF_AT (_ULCAST_(3) << 13)
578#define MIPS_CONF_BE (_ULCAST_(1) << 15)
579#define MIPS_CONF_BM (_ULCAST_(1) << 16)
580#define MIPS_CONF_MM (_ULCAST_(3) << 17)
581#define MIPS_CONF_MM_SYSAD (_ULCAST_(1) << 17)
582#define MIPS_CONF_MM_FULL (_ULCAST_(2) << 17)
583#define MIPS_CONF_SB (_ULCAST_(1) << 21)
584#define MIPS_CONF_UDI (_ULCAST_(1) << 22)
585#define MIPS_CONF_DSP (_ULCAST_(1) << 23)
586#define MIPS_CONF_ISP (_ULCAST_(1) << 24)
587#define MIPS_CONF_KU (_ULCAST_(3) << 25)
588#define MIPS_CONF_K23 (_ULCAST_(3) << 28)
589#define MIPS_CONF_M (_ULCAST_(1) << 31)
590
591/*
592 * Bits in the MIPS32/64 PRA coprocessor 0 config registers 1 and above.
593 */
594#define MIPS_CONF1_FP (_ULCAST_(1) << 0)
595#define MIPS_CONF1_EP (_ULCAST_(1) << 1)
596#define MIPS_CONF1_CA (_ULCAST_(1) << 2)
597#define MIPS_CONF1_WR (_ULCAST_(1) << 3)
598#define MIPS_CONF1_PC (_ULCAST_(1) << 4)
599#define MIPS_CONF1_MD (_ULCAST_(1) << 5)
600#define MIPS_CONF1_C2 (_ULCAST_(1) << 6)
601#define MIPS_CONF1_DA_SHF 7
602#define MIPS_CONF1_DA_SZ 3
603#define MIPS_CONF1_DA (_ULCAST_(7) << 7)
604#define MIPS_CONF1_DL_SHF 10
605#define MIPS_CONF1_DL_SZ 3
606#define MIPS_CONF1_DL (_ULCAST_(7) << 10)
607#define MIPS_CONF1_DS_SHF 13
608#define MIPS_CONF1_DS_SZ 3
609#define MIPS_CONF1_DS (_ULCAST_(7) << 13)
610#define MIPS_CONF1_IA_SHF 16
611#define MIPS_CONF1_IA_SZ 3
612#define MIPS_CONF1_IA (_ULCAST_(7) << 16)
613#define MIPS_CONF1_IL_SHF 19
614#define MIPS_CONF1_IL_SZ 3
615#define MIPS_CONF1_IL (_ULCAST_(7) << 19)
616#define MIPS_CONF1_IS_SHF 22
617#define MIPS_CONF1_IS_SZ 3
618#define MIPS_CONF1_IS (_ULCAST_(7) << 22)
619#define MIPS_CONF1_TLBS_SHIFT (25)
620#define MIPS_CONF1_TLBS_SIZE (6)
621#define MIPS_CONF1_TLBS (_ULCAST_(63) << MIPS_CONF1_TLBS_SHIFT)
622
623#define MIPS_CONF2_SA (_ULCAST_(15)<< 0)
624#define MIPS_CONF2_SL (_ULCAST_(15)<< 4)
625#define MIPS_CONF2_SS (_ULCAST_(15)<< 8)
626#define MIPS_CONF2_SU (_ULCAST_(15)<< 12)
627#define MIPS_CONF2_TA (_ULCAST_(15)<< 16)
628#define MIPS_CONF2_TL (_ULCAST_(15)<< 20)
629#define MIPS_CONF2_TS (_ULCAST_(15)<< 24)
630#define MIPS_CONF2_TU (_ULCAST_(7) << 28)
631
632#define MIPS_CONF3_TL (_ULCAST_(1) << 0)
633#define MIPS_CONF3_SM (_ULCAST_(1) << 1)
634#define MIPS_CONF3_MT (_ULCAST_(1) << 2)
635#define MIPS_CONF3_CDMM (_ULCAST_(1) << 3)
636#define MIPS_CONF3_SP (_ULCAST_(1) << 4)
637#define MIPS_CONF3_VINT (_ULCAST_(1) << 5)
638#define MIPS_CONF3_VEIC (_ULCAST_(1) << 6)
639#define MIPS_CONF3_LPA (_ULCAST_(1) << 7)
640#define MIPS_CONF3_ITL (_ULCAST_(1) << 8)
641#define MIPS_CONF3_CTXTC (_ULCAST_(1) << 9)
642#define MIPS_CONF3_DSP (_ULCAST_(1) << 10)
643#define MIPS_CONF3_DSP2P (_ULCAST_(1) << 11)
644#define MIPS_CONF3_RXI (_ULCAST_(1) << 12)
645#define MIPS_CONF3_ULRI (_ULCAST_(1) << 13)
646#define MIPS_CONF3_ISA (_ULCAST_(3) << 14)
647#define MIPS_CONF3_ISA_OE (_ULCAST_(1) << 16)
648#define MIPS_CONF3_MCU (_ULCAST_(1) << 17)
649#define MIPS_CONF3_MMAR (_ULCAST_(7) << 18)
650#define MIPS_CONF3_IPLW (_ULCAST_(3) << 21)
651#define MIPS_CONF3_VZ (_ULCAST_(1) << 23)
652#define MIPS_CONF3_PW (_ULCAST_(1) << 24)
653#define MIPS_CONF3_SC (_ULCAST_(1) << 25)
654#define MIPS_CONF3_BI (_ULCAST_(1) << 26)
655#define MIPS_CONF3_BP (_ULCAST_(1) << 27)
656#define MIPS_CONF3_MSA (_ULCAST_(1) << 28)
657#define MIPS_CONF3_CMGCR (_ULCAST_(1) << 29)
658#define MIPS_CONF3_BPG (_ULCAST_(1) << 30)
659
660#define MIPS_CONF4_MMUSIZEEXT_SHIFT (0)
661#define MIPS_CONF4_MMUSIZEEXT (_ULCAST_(255) << 0)
662#define MIPS_CONF4_FTLBSETS_SHIFT (0)
663#define MIPS_CONF4_FTLBSETS (_ULCAST_(15) << MIPS_CONF4_FTLBSETS_SHIFT)
664#define MIPS_CONF4_FTLBWAYS_SHIFT (4)
665#define MIPS_CONF4_FTLBWAYS (_ULCAST_(15) << MIPS_CONF4_FTLBWAYS_SHIFT)
666#define MIPS_CONF4_FTLBPAGESIZE_SHIFT (8)
667/* bits 10:8 in FTLB-only configurations */
668#define MIPS_CONF4_FTLBPAGESIZE (_ULCAST_(7) << MIPS_CONF4_FTLBPAGESIZE_SHIFT)
669/* bits 12:8 in VTLB-FTLB only configurations */
670#define MIPS_CONF4_VFTLBPAGESIZE (_ULCAST_(31) << MIPS_CONF4_FTLBPAGESIZE_SHIFT)
671#define MIPS_CONF4_MMUEXTDEF (_ULCAST_(3) << 14)
672#define MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT (_ULCAST_(1) << 14)
673#define MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT (_ULCAST_(2) << 14)
674#define MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT (_ULCAST_(3) << 14)
675#define MIPS_CONF4_KSCREXIST_SHIFT (16)
676#define MIPS_CONF4_KSCREXIST (_ULCAST_(255) << MIPS_CONF4_KSCREXIST_SHIFT)
677#define MIPS_CONF4_VTLBSIZEEXT_SHIFT (24)
678#define MIPS_CONF4_VTLBSIZEEXT (_ULCAST_(15) << MIPS_CONF4_VTLBSIZEEXT_SHIFT)
679#define MIPS_CONF4_AE (_ULCAST_(1) << 28)
680#define MIPS_CONF4_IE (_ULCAST_(3) << 29)
681#define MIPS_CONF4_TLBINV (_ULCAST_(2) << 29)
682
683#define MIPS_CONF5_NF (_ULCAST_(1) << 0)
684#define MIPS_CONF5_UFR (_ULCAST_(1) << 2)
685#define MIPS_CONF5_MRP (_ULCAST_(1) << 3)
686#define MIPS_CONF5_LLB (_ULCAST_(1) << 4)
687#define MIPS_CONF5_MVH (_ULCAST_(1) << 5)
688#define MIPS_CONF5_VP (_ULCAST_(1) << 7)
689#define MIPS_CONF5_SBRI (_ULCAST_(1) << 6)
690#define MIPS_CONF5_FRE (_ULCAST_(1) << 8)
691#define MIPS_CONF5_UFE (_ULCAST_(1) << 9)
692#define MIPS_CONF5_CA2 (_ULCAST_(1) << 14)
693#define MIPS_CONF5_MI (_ULCAST_(1) << 17)
694#define MIPS_CONF5_CRCP (_ULCAST_(1) << 18)
695#define MIPS_CONF5_MSAEN (_ULCAST_(1) << 27)
696#define MIPS_CONF5_EVA (_ULCAST_(1) << 28)
697#define MIPS_CONF5_CV (_ULCAST_(1) << 29)
698#define MIPS_CONF5_K (_ULCAST_(1) << 30)
699
700/* Config6 feature bits for proAptiv/P5600 */
701
702/* Jump register cache prediction disable */
703#define MTI_CONF6_JRCD (_ULCAST_(1) << 0)
704/* MIPSr6 extensions enable */
705#define MTI_CONF6_R6 (_ULCAST_(1) << 2)
706/* IFU Performance Control */
707#define MTI_CONF6_IFUPERFCTL (_ULCAST_(3) << 10)
708#define MTI_CONF6_SYND (_ULCAST_(1) << 13)
709/* Sleep state performance counter disable */
710#define MTI_CONF6_SPCD (_ULCAST_(1) << 14)
711/* proAptiv FTLB on/off bit */
712#define MTI_CONF6_FTLBEN (_ULCAST_(1) << 15)
713/* Disable load/store bonding */
714#define MTI_CONF6_DLSB (_ULCAST_(1) << 21)
715/* FTLB probability bits */
716#define MTI_CONF6_FTLBP_SHIFT (16)
717
718/* Config6 feature bits for Loongson-3 */
719
720/* Loongson-3 internal timer bit */
721#define LOONGSON_CONF6_INTIMER (_ULCAST_(1) << 6)
722/* Loongson-3 external timer bit */
723#define LOONGSON_CONF6_EXTIMER (_ULCAST_(1) << 7)
724/* Loongson-3 SFB on/off bit, STFill in manual */
725#define LOONGSON_CONF6_SFBEN (_ULCAST_(1) << 8)
726/* Loongson-3's LL on exclusive cacheline */
727#define LOONGSON_CONF6_LLEXC (_ULCAST_(1) << 16)
728/* Loongson-3's SC has a random delay */
729#define LOONGSON_CONF6_SCRAND (_ULCAST_(1) << 17)
730/* Loongson-3 FTLB on/off bit, VTLBOnly in manual */
731#define LOONGSON_CONF6_FTLBDIS (_ULCAST_(1) << 22)
732
733#define MIPS_CONF7_WII (_ULCAST_(1) << 31)
734
735#define MIPS_CONF7_RPS (_ULCAST_(1) << 2)
736
737#define MIPS_CONF7_IAR (_ULCAST_(1) << 10)
738#define MIPS_CONF7_AR (_ULCAST_(1) << 16)
739
740/* Ingenic HPTLB off bits */
741#define XBURST_PAGECTRL_HPTLB_DIS 0xa9000000
742
743/* Ingenic Config7 bits */
744#define MIPS_CONF7_BTB_LOOP_EN (_ULCAST_(1) << 4)
745
746/* Config7 Bits specific to MIPS Technologies. */
747
748/* Performance counters implemented Per TC */
749#define MTI_CONF7_PTC (_ULCAST_(1) << 19)
750
751/* WatchLo* register definitions */
752#define MIPS_WATCHLO_IRW (_ULCAST_(0x7) << 0)
753
754/* WatchHi* register definitions */
755#define MIPS_WATCHHI_M (_ULCAST_(1) << 31)
756#define MIPS_WATCHHI_G (_ULCAST_(1) << 30)
757#define MIPS_WATCHHI_WM (_ULCAST_(0x3) << 28)
758#define MIPS_WATCHHI_WM_R_RVA (_ULCAST_(0) << 28)
759#define MIPS_WATCHHI_WM_R_GPA (_ULCAST_(1) << 28)
760#define MIPS_WATCHHI_WM_G_GVA (_ULCAST_(2) << 28)
761#define MIPS_WATCHHI_EAS (_ULCAST_(0x3) << 24)
762#define MIPS_WATCHHI_ASID (_ULCAST_(0xff) << 16)
763#define MIPS_WATCHHI_MASK (_ULCAST_(0x1ff) << 3)
764#define MIPS_WATCHHI_I (_ULCAST_(1) << 2)
765#define MIPS_WATCHHI_R (_ULCAST_(1) << 1)
766#define MIPS_WATCHHI_W (_ULCAST_(1) << 0)
767#define MIPS_WATCHHI_IRW (_ULCAST_(0x7) << 0)
768
769/* PerfCnt control register definitions */
770#define MIPS_PERFCTRL_EXL (_ULCAST_(1) << 0)
771#define MIPS_PERFCTRL_K (_ULCAST_(1) << 1)
772#define MIPS_PERFCTRL_S (_ULCAST_(1) << 2)
773#define MIPS_PERFCTRL_U (_ULCAST_(1) << 3)
774#define MIPS_PERFCTRL_IE (_ULCAST_(1) << 4)
775#define MIPS_PERFCTRL_EVENT_S 5
776#define MIPS_PERFCTRL_EVENT (_ULCAST_(0x3ff) << MIPS_PERFCTRL_EVENT_S)
777#define MIPS_PERFCTRL_PCTD (_ULCAST_(1) << 15)
778#define MIPS_PERFCTRL_EC (_ULCAST_(0x3) << 23)
779#define MIPS_PERFCTRL_EC_R (_ULCAST_(0) << 23)
780#define MIPS_PERFCTRL_EC_RI (_ULCAST_(1) << 23)
781#define MIPS_PERFCTRL_EC_G (_ULCAST_(2) << 23)
782#define MIPS_PERFCTRL_EC_GRI (_ULCAST_(3) << 23)
783#define MIPS_PERFCTRL_W (_ULCAST_(1) << 30)
784#define MIPS_PERFCTRL_M (_ULCAST_(1) << 31)
785
786/* PerfCnt control register MT extensions used by MIPS cores */
787#define MIPS_PERFCTRL_VPEID_S 16
788#define MIPS_PERFCTRL_VPEID (_ULCAST_(0xf) << MIPS_PERFCTRL_VPEID_S)
789#define MIPS_PERFCTRL_TCID_S 22
790#define MIPS_PERFCTRL_TCID (_ULCAST_(0xff) << MIPS_PERFCTRL_TCID_S)
791#define MIPS_PERFCTRL_MT_EN (_ULCAST_(0x3) << 20)
792#define MIPS_PERFCTRL_MT_EN_ALL (_ULCAST_(0) << 20)
793#define MIPS_PERFCTRL_MT_EN_VPE (_ULCAST_(1) << 20)
794#define MIPS_PERFCTRL_MT_EN_TC (_ULCAST_(2) << 20)
795
796/* PerfCnt control register MT extensions used by BMIPS5000 */
797#define BRCM_PERFCTRL_TC (_ULCAST_(1) << 30)
798
799/* PerfCnt control register MT extensions used by Netlogic XLR */
800#define XLR_PERFCTRL_ALLTHREADS (_ULCAST_(1) << 13)
801
802/* MAAR bit definitions */
803#define MIPS_MAAR_VH (_U64CAST_(1) << 63)
804#define MIPS_MAAR_ADDR GENMASK_ULL(55, 12)
805#define MIPS_MAAR_ADDR_SHIFT 12
806#define MIPS_MAAR_S (_ULCAST_(1) << 1)
807#define MIPS_MAAR_VL (_ULCAST_(1) << 0)
808#ifdef CONFIG_XPA
809#define MIPS_MAAR_V (MIPS_MAAR_VH | MIPS_MAAR_VL)
810#else
811#define MIPS_MAAR_V MIPS_MAAR_VL
812#endif
813#define MIPS_MAARX_VH (_ULCAST_(1) << 31)
814#define MIPS_MAARX_ADDR 0xF
815#define MIPS_MAARX_ADDR_SHIFT 32
816
817/* MAARI bit definitions */
818#define MIPS_MAARI_INDEX (_ULCAST_(0x3f) << 0)
819
820/* EBase bit definitions */
821#define MIPS_EBASE_CPUNUM_SHIFT 0
822#define MIPS_EBASE_CPUNUM (_ULCAST_(0x3ff) << 0)
823#define MIPS_EBASE_WG_SHIFT 11
824#define MIPS_EBASE_WG (_ULCAST_(1) << 11)
825#define MIPS_EBASE_BASE_SHIFT 12
826#define MIPS_EBASE_BASE (~_ULCAST_((1 << MIPS_EBASE_BASE_SHIFT) - 1))
827
828/* CMGCRBase bit definitions */
829#define MIPS_CMGCRB_BASE 11
830#define MIPS_CMGCRF_BASE (~_ULCAST_((1 << MIPS_CMGCRB_BASE) - 1))
831
832/* LLAddr bit definitions */
833#define MIPS_LLADDR_LLB_SHIFT 0
834#define MIPS_LLADDR_LLB (_ULCAST_(1) << MIPS_LLADDR_LLB_SHIFT)
835
836/*
837 * Bits in the MIPS32 Memory Segmentation registers.
838 */
839#define MIPS_SEGCFG_PA_SHIFT 9
840#define MIPS_SEGCFG_PA (_ULCAST_(127) << MIPS_SEGCFG_PA_SHIFT)
841#define MIPS_SEGCFG_AM_SHIFT 4
842#define MIPS_SEGCFG_AM (_ULCAST_(7) << MIPS_SEGCFG_AM_SHIFT)
843#define MIPS_SEGCFG_EU_SHIFT 3
844#define MIPS_SEGCFG_EU (_ULCAST_(1) << MIPS_SEGCFG_EU_SHIFT)
845#define MIPS_SEGCFG_C_SHIFT 0
846#define MIPS_SEGCFG_C (_ULCAST_(7) << MIPS_SEGCFG_C_SHIFT)
847
848#define MIPS_SEGCFG_UUSK _ULCAST_(7)
849#define MIPS_SEGCFG_USK _ULCAST_(5)
850#define MIPS_SEGCFG_MUSUK _ULCAST_(4)
851#define MIPS_SEGCFG_MUSK _ULCAST_(3)
852#define MIPS_SEGCFG_MSK _ULCAST_(2)
853#define MIPS_SEGCFG_MK _ULCAST_(1)
854#define MIPS_SEGCFG_UK _ULCAST_(0)
855
856#define MIPS_PWFIELD_GDI_SHIFT 24
857#define MIPS_PWFIELD_GDI_MASK 0x3f000000
858#define MIPS_PWFIELD_UDI_SHIFT 18
859#define MIPS_PWFIELD_UDI_MASK 0x00fc0000
860#define MIPS_PWFIELD_MDI_SHIFT 12
861#define MIPS_PWFIELD_MDI_MASK 0x0003f000
862#define MIPS_PWFIELD_PTI_SHIFT 6
863#define MIPS_PWFIELD_PTI_MASK 0x00000fc0
864#define MIPS_PWFIELD_PTEI_SHIFT 0
865#define MIPS_PWFIELD_PTEI_MASK 0x0000003f
866
867#define MIPS_PWSIZE_PS_SHIFT 30
868#define MIPS_PWSIZE_PS_MASK 0x40000000
869#define MIPS_PWSIZE_GDW_SHIFT 24
870#define MIPS_PWSIZE_GDW_MASK 0x3f000000
871#define MIPS_PWSIZE_UDW_SHIFT 18
872#define MIPS_PWSIZE_UDW_MASK 0x00fc0000
873#define MIPS_PWSIZE_MDW_SHIFT 12
874#define MIPS_PWSIZE_MDW_MASK 0x0003f000
875#define MIPS_PWSIZE_PTW_SHIFT 6
876#define MIPS_PWSIZE_PTW_MASK 0x00000fc0
877#define MIPS_PWSIZE_PTEW_SHIFT 0
878#define MIPS_PWSIZE_PTEW_MASK 0x0000003f
879
880#define MIPS_PWCTL_PWEN_SHIFT 31
881#define MIPS_PWCTL_PWEN_MASK 0x80000000
882#define MIPS_PWCTL_XK_SHIFT 28
883#define MIPS_PWCTL_XK_MASK 0x10000000
884#define MIPS_PWCTL_XS_SHIFT 27
885#define MIPS_PWCTL_XS_MASK 0x08000000
886#define MIPS_PWCTL_XU_SHIFT 26
887#define MIPS_PWCTL_XU_MASK 0x04000000
888#define MIPS_PWCTL_DPH_SHIFT 7
889#define MIPS_PWCTL_DPH_MASK 0x00000080
890#define MIPS_PWCTL_HUGEPG_SHIFT 6
891#define MIPS_PWCTL_HUGEPG_MASK 0x00000060
892#define MIPS_PWCTL_PSN_SHIFT 0
893#define MIPS_PWCTL_PSN_MASK 0x0000003f
894
895/* GuestCtl0 fields */
896#define MIPS_GCTL0_GM_SHIFT 31
897#define MIPS_GCTL0_GM (_ULCAST_(1) << MIPS_GCTL0_GM_SHIFT)
898#define MIPS_GCTL0_RI_SHIFT 30
899#define MIPS_GCTL0_RI (_ULCAST_(1) << MIPS_GCTL0_RI_SHIFT)
900#define MIPS_GCTL0_MC_SHIFT 29
901#define MIPS_GCTL0_MC (_ULCAST_(1) << MIPS_GCTL0_MC_SHIFT)
902#define MIPS_GCTL0_CP0_SHIFT 28
903#define MIPS_GCTL0_CP0 (_ULCAST_(1) << MIPS_GCTL0_CP0_SHIFT)
904#define MIPS_GCTL0_AT_SHIFT 26
905#define MIPS_GCTL0_AT (_ULCAST_(0x3) << MIPS_GCTL0_AT_SHIFT)
906#define MIPS_GCTL0_GT_SHIFT 25
907#define MIPS_GCTL0_GT (_ULCAST_(1) << MIPS_GCTL0_GT_SHIFT)
908#define MIPS_GCTL0_CG_SHIFT 24
909#define MIPS_GCTL0_CG (_ULCAST_(1) << MIPS_GCTL0_CG_SHIFT)
910#define MIPS_GCTL0_CF_SHIFT 23
911#define MIPS_GCTL0_CF (_ULCAST_(1) << MIPS_GCTL0_CF_SHIFT)
912#define MIPS_GCTL0_G1_SHIFT 22
913#define MIPS_GCTL0_G1 (_ULCAST_(1) << MIPS_GCTL0_G1_SHIFT)
914#define MIPS_GCTL0_G0E_SHIFT 19
915#define MIPS_GCTL0_G0E (_ULCAST_(1) << MIPS_GCTL0_G0E_SHIFT)
916#define MIPS_GCTL0_PT_SHIFT 18
917#define MIPS_GCTL0_PT (_ULCAST_(1) << MIPS_GCTL0_PT_SHIFT)
918#define MIPS_GCTL0_RAD_SHIFT 9
919#define MIPS_GCTL0_RAD (_ULCAST_(1) << MIPS_GCTL0_RAD_SHIFT)
920#define MIPS_GCTL0_DRG_SHIFT 8
921#define MIPS_GCTL0_DRG (_ULCAST_(1) << MIPS_GCTL0_DRG_SHIFT)
922#define MIPS_GCTL0_G2_SHIFT 7
923#define MIPS_GCTL0_G2 (_ULCAST_(1) << MIPS_GCTL0_G2_SHIFT)
924#define MIPS_GCTL0_GEXC_SHIFT 2
925#define MIPS_GCTL0_GEXC (_ULCAST_(0x1f) << MIPS_GCTL0_GEXC_SHIFT)
926#define MIPS_GCTL0_SFC2_SHIFT 1
927#define MIPS_GCTL0_SFC2 (_ULCAST_(1) << MIPS_GCTL0_SFC2_SHIFT)
928#define MIPS_GCTL0_SFC1_SHIFT 0
929#define MIPS_GCTL0_SFC1 (_ULCAST_(1) << MIPS_GCTL0_SFC1_SHIFT)
930
931/* GuestCtl0.AT Guest address translation control */
932#define MIPS_GCTL0_AT_ROOT 1 /* Guest MMU under Root control */
933#define MIPS_GCTL0_AT_GUEST 3 /* Guest MMU under Guest control */
934
935/* GuestCtl0.GExcCode Hypervisor exception cause codes */
936#define MIPS_GCTL0_GEXC_GPSI 0 /* Guest Privileged Sensitive Instruction */
937#define MIPS_GCTL0_GEXC_GSFC 1 /* Guest Software Field Change */
938#define MIPS_GCTL0_GEXC_HC 2 /* Hypercall */
939#define MIPS_GCTL0_GEXC_GRR 3 /* Guest Reserved Instruction Redirect */
940#define MIPS_GCTL0_GEXC_GVA 8 /* Guest Virtual Address available */
941#define MIPS_GCTL0_GEXC_GHFC 9 /* Guest Hardware Field Change */
942#define MIPS_GCTL0_GEXC_GPA 10 /* Guest Physical Address available */
943
944/* GuestCtl0Ext fields */
945#define MIPS_GCTL0EXT_RPW_SHIFT 8
946#define MIPS_GCTL0EXT_RPW (_ULCAST_(0x3) << MIPS_GCTL0EXT_RPW_SHIFT)
947#define MIPS_GCTL0EXT_NCC_SHIFT 6
948#define MIPS_GCTL0EXT_NCC (_ULCAST_(0x3) << MIPS_GCTL0EXT_NCC_SHIFT)
949#define MIPS_GCTL0EXT_CGI_SHIFT 4
950#define MIPS_GCTL0EXT_CGI (_ULCAST_(1) << MIPS_GCTL0EXT_CGI_SHIFT)
951#define MIPS_GCTL0EXT_FCD_SHIFT 3
952#define MIPS_GCTL0EXT_FCD (_ULCAST_(1) << MIPS_GCTL0EXT_FCD_SHIFT)
953#define MIPS_GCTL0EXT_OG_SHIFT 2
954#define MIPS_GCTL0EXT_OG (_ULCAST_(1) << MIPS_GCTL0EXT_OG_SHIFT)
955#define MIPS_GCTL0EXT_BG_SHIFT 1
956#define MIPS_GCTL0EXT_BG (_ULCAST_(1) << MIPS_GCTL0EXT_BG_SHIFT)
957#define MIPS_GCTL0EXT_MG_SHIFT 0
958#define MIPS_GCTL0EXT_MG (_ULCAST_(1) << MIPS_GCTL0EXT_MG_SHIFT)
959
960/* GuestCtl0Ext.RPW Root page walk configuration */
961#define MIPS_GCTL0EXT_RPW_BOTH 0 /* Root PW for GPA->RPA and RVA->RPA */
962#define MIPS_GCTL0EXT_RPW_GPA 2 /* Root PW for GPA->RPA */
963#define MIPS_GCTL0EXT_RPW_RVA 3 /* Root PW for RVA->RPA */
964
965/* GuestCtl0Ext.NCC Nested cache coherency attributes */
966#define MIPS_GCTL0EXT_NCC_IND 0 /* Guest CCA independent of Root CCA */
967#define MIPS_GCTL0EXT_NCC_MOD 1 /* Guest CCA modified by Root CCA */
968
969/* GuestCtl1 fields */
970#define MIPS_GCTL1_ID_SHIFT 0
971#define MIPS_GCTL1_ID_WIDTH 8
972#define MIPS_GCTL1_ID (_ULCAST_(0xff) << MIPS_GCTL1_ID_SHIFT)
973#define MIPS_GCTL1_RID_SHIFT 16
974#define MIPS_GCTL1_RID_WIDTH 8
975#define MIPS_GCTL1_RID (_ULCAST_(0xff) << MIPS_GCTL1_RID_SHIFT)
976#define MIPS_GCTL1_EID_SHIFT 24
977#define MIPS_GCTL1_EID_WIDTH 8
978#define MIPS_GCTL1_EID (_ULCAST_(0xff) << MIPS_GCTL1_EID_SHIFT)
979
980/* GuestID reserved for root context */
981#define MIPS_GCTL1_ROOT_GUESTID 0
982
983/* CDMMBase register bit definitions */
984#define MIPS_CDMMBASE_SIZE_SHIFT 0
985#define MIPS_CDMMBASE_SIZE (_ULCAST_(511) << MIPS_CDMMBASE_SIZE_SHIFT)
986#define MIPS_CDMMBASE_CI (_ULCAST_(1) << 9)
987#define MIPS_CDMMBASE_EN (_ULCAST_(1) << 10)
988#define MIPS_CDMMBASE_ADDR_SHIFT 11
989#define MIPS_CDMMBASE_ADDR_START 15
990
991/* RDHWR register numbers */
992#define MIPS_HWR_CPUNUM 0 /* CPU number */
993#define MIPS_HWR_SYNCISTEP 1 /* SYNCI step size */
994#define MIPS_HWR_CC 2 /* Cycle counter */
995#define MIPS_HWR_CCRES 3 /* Cycle counter resolution */
996#define MIPS_HWR_ULR 29 /* UserLocal */
997#define MIPS_HWR_IMPL1 30 /* Implementation dependent */
998#define MIPS_HWR_IMPL2 31 /* Implementation dependent */
999
1000/* Bits in HWREna register */
1001#define MIPS_HWRENA_CPUNUM (_ULCAST_(1) << MIPS_HWR_CPUNUM)
1002#define MIPS_HWRENA_SYNCISTEP (_ULCAST_(1) << MIPS_HWR_SYNCISTEP)
1003#define MIPS_HWRENA_CC (_ULCAST_(1) << MIPS_HWR_CC)
1004#define MIPS_HWRENA_CCRES (_ULCAST_(1) << MIPS_HWR_CCRES)
1005#define MIPS_HWRENA_ULR (_ULCAST_(1) << MIPS_HWR_ULR)
1006#define MIPS_HWRENA_IMPL1 (_ULCAST_(1) << MIPS_HWR_IMPL1)
1007#define MIPS_HWRENA_IMPL2 (_ULCAST_(1) << MIPS_HWR_IMPL2)
1008
1009/*
1010 * Bitfields in the TX39 family CP0 Configuration Register 3
1011 */
1012#define TX39_CONF_ICS_SHIFT 19
1013#define TX39_CONF_ICS_MASK 0x00380000
1014#define TX39_CONF_ICS_1KB 0x00000000
1015#define TX39_CONF_ICS_2KB 0x00080000
1016#define TX39_CONF_ICS_4KB 0x00100000
1017#define TX39_CONF_ICS_8KB 0x00180000
1018#define TX39_CONF_ICS_16KB 0x00200000
1019
1020#define TX39_CONF_DCS_SHIFT 16
1021#define TX39_CONF_DCS_MASK 0x00070000
1022#define TX39_CONF_DCS_1KB 0x00000000
1023#define TX39_CONF_DCS_2KB 0x00010000
1024#define TX39_CONF_DCS_4KB 0x00020000
1025#define TX39_CONF_DCS_8KB 0x00030000
1026#define TX39_CONF_DCS_16KB 0x00040000
1027
1028#define TX39_CONF_CWFON 0x00004000
1029#define TX39_CONF_WBON 0x00002000
1030#define TX39_CONF_RF_SHIFT 10
1031#define TX39_CONF_RF_MASK 0x00000c00
1032#define TX39_CONF_DOZE 0x00000200
1033#define TX39_CONF_HALT 0x00000100
1034#define TX39_CONF_LOCK 0x00000080
1035#define TX39_CONF_ICE 0x00000020
1036#define TX39_CONF_DCE 0x00000010
1037#define TX39_CONF_IRSIZE_SHIFT 2
1038#define TX39_CONF_IRSIZE_MASK 0x0000000c
1039#define TX39_CONF_DRSIZE_SHIFT 0
1040#define TX39_CONF_DRSIZE_MASK 0x00000003
1041
1042/*
1043 * Interesting Bits in the R10K CP0 Branch Diagnostic Register
1044 */
1045/* Disable Branch Target Address Cache */
1046#define R10K_DIAG_D_BTAC (_ULCAST_(1) << 27)
1047/* Enable Branch Prediction Global History */
1048#define R10K_DIAG_E_GHIST (_ULCAST_(1) << 26)
1049/* Disable Branch Return Cache */
1050#define R10K_DIAG_D_BRC (_ULCAST_(1) << 22)
1051
1052/* Flush BTB */
1053#define LOONGSON_DIAG_BTB (_ULCAST_(1) << 1)
1054/* Flush ITLB */
1055#define LOONGSON_DIAG_ITLB (_ULCAST_(1) << 2)
1056/* Flush DTLB */
1057#define LOONGSON_DIAG_DTLB (_ULCAST_(1) << 3)
1058/* Allow some CACHE instructions (CACHE0, 1, 3, 21 and 23) in user mode */
1059#define LOONGSON_DIAG_UCAC (_ULCAST_(1) << 8)
1060/* Flush VTLB */
1061#define LOONGSON_DIAG_VTLB (_ULCAST_(1) << 12)
1062/* Flush FTLB */
1063#define LOONGSON_DIAG_FTLB (_ULCAST_(1) << 13)
1064
1065/*
1066 * Diag1 (GSCause in Loongson-speak) fields
1067 */
1068/* Loongson-specific exception code (GSExcCode) */
1069#define LOONGSON_DIAG1_EXCCODE_SHIFT 2
1070#define LOONGSON_DIAG1_EXCCODE GENMASK(6, 2)
1071
1072/* CvmCtl register field definitions */
1073#define CVMCTL_IPPCI_SHIFT 7
1074#define CVMCTL_IPPCI (_U64CAST_(0x7) << CVMCTL_IPPCI_SHIFT)
1075#define CVMCTL_IPTI_SHIFT 4
1076#define CVMCTL_IPTI (_U64CAST_(0x7) << CVMCTL_IPTI_SHIFT)
1077
1078/* CvmMemCtl2 register field definitions */
1079#define CVMMEMCTL2_INHIBITTS (_U64CAST_(1) << 17)
1080
1081/* CvmVMConfig register field definitions */
1082#define CVMVMCONF_DGHT (_U64CAST_(1) << 60)
1083#define CVMVMCONF_MMUSIZEM1_S 12
1084#define CVMVMCONF_MMUSIZEM1 (_U64CAST_(0xff) << CVMVMCONF_MMUSIZEM1_S)
1085#define CVMVMCONF_RMMUSIZEM1_S 0
1086#define CVMVMCONF_RMMUSIZEM1 (_U64CAST_(0xff) << CVMVMCONF_RMMUSIZEM1_S)
1087
1088/*
1089 * Coprocessor 1 (FPU) register names
1090 */
1091#define CP1_REVISION $0
1092#define CP1_UFR $1
1093#define CP1_UNFR $4
1094#define CP1_FCCR $25
1095#define CP1_FEXR $26
1096#define CP1_FENR $28
1097#define CP1_STATUS $31
1098
1099
1100/*
1101 * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
1102 */
1103#define MIPS_FPIR_S (_ULCAST_(1) << 16)
1104#define MIPS_FPIR_D (_ULCAST_(1) << 17)
1105#define MIPS_FPIR_PS (_ULCAST_(1) << 18)
1106#define MIPS_FPIR_3D (_ULCAST_(1) << 19)
1107#define MIPS_FPIR_W (_ULCAST_(1) << 20)
1108#define MIPS_FPIR_L (_ULCAST_(1) << 21)
1109#define MIPS_FPIR_F64 (_ULCAST_(1) << 22)
1110#define MIPS_FPIR_HAS2008 (_ULCAST_(1) << 23)
1111#define MIPS_FPIR_UFRP (_ULCAST_(1) << 28)
1112#define MIPS_FPIR_FREP (_ULCAST_(1) << 29)
1113
1114/*
1115 * Bits in the MIPS32/64 coprocessor 1 (FPU) condition codes register.
1116 */
1117#define MIPS_FCCR_CONDX_S 0
1118#define MIPS_FCCR_CONDX (_ULCAST_(255) << MIPS_FCCR_CONDX_S)
1119#define MIPS_FCCR_COND0_S 0
1120#define MIPS_FCCR_COND0 (_ULCAST_(1) << MIPS_FCCR_COND0_S)
1121#define MIPS_FCCR_COND1_S 1
1122#define MIPS_FCCR_COND1 (_ULCAST_(1) << MIPS_FCCR_COND1_S)
1123#define MIPS_FCCR_COND2_S 2
1124#define MIPS_FCCR_COND2 (_ULCAST_(1) << MIPS_FCCR_COND2_S)
1125#define MIPS_FCCR_COND3_S 3
1126#define MIPS_FCCR_COND3 (_ULCAST_(1) << MIPS_FCCR_COND3_S)
1127#define MIPS_FCCR_COND4_S 4
1128#define MIPS_FCCR_COND4 (_ULCAST_(1) << MIPS_FCCR_COND4_S)
1129#define MIPS_FCCR_COND5_S 5
1130#define MIPS_FCCR_COND5 (_ULCAST_(1) << MIPS_FCCR_COND5_S)
1131#define MIPS_FCCR_COND6_S 6
1132#define MIPS_FCCR_COND6 (_ULCAST_(1) << MIPS_FCCR_COND6_S)
1133#define MIPS_FCCR_COND7_S 7
1134#define MIPS_FCCR_COND7 (_ULCAST_(1) << MIPS_FCCR_COND7_S)
1135
1136/*
1137 * Bits in the MIPS32/64 coprocessor 1 (FPU) enables register.
1138 */
1139#define MIPS_FENR_FS_S 2
1140#define MIPS_FENR_FS (_ULCAST_(1) << MIPS_FENR_FS_S)
1141
1142/*
1143 * FPU Status Register Values
1144 */
1145#define FPU_CSR_COND_S 23 /* $fcc0 */
1146#define FPU_CSR_COND (_ULCAST_(1) << FPU_CSR_COND_S)
1147
1148#define FPU_CSR_FS_S 24 /* flush denormalised results to 0 */
1149#define FPU_CSR_FS (_ULCAST_(1) << FPU_CSR_FS_S)
1150
1151#define FPU_CSR_CONDX_S 25 /* $fcc[7:1] */
1152#define FPU_CSR_CONDX (_ULCAST_(127) << FPU_CSR_CONDX_S)
1153#define FPU_CSR_COND1_S 25 /* $fcc1 */
1154#define FPU_CSR_COND1 (_ULCAST_(1) << FPU_CSR_COND1_S)
1155#define FPU_CSR_COND2_S 26 /* $fcc2 */
1156#define FPU_CSR_COND2 (_ULCAST_(1) << FPU_CSR_COND2_S)
1157#define FPU_CSR_COND3_S 27 /* $fcc3 */
1158#define FPU_CSR_COND3 (_ULCAST_(1) << FPU_CSR_COND3_S)
1159#define FPU_CSR_COND4_S 28 /* $fcc4 */
1160#define FPU_CSR_COND4 (_ULCAST_(1) << FPU_CSR_COND4_S)
1161#define FPU_CSR_COND5_S 29 /* $fcc5 */
1162#define FPU_CSR_COND5 (_ULCAST_(1) << FPU_CSR_COND5_S)
1163#define FPU_CSR_COND6_S 30 /* $fcc6 */
1164#define FPU_CSR_COND6 (_ULCAST_(1) << FPU_CSR_COND6_S)
1165#define FPU_CSR_COND7_S 31 /* $fcc7 */
1166#define FPU_CSR_COND7 (_ULCAST_(1) << FPU_CSR_COND7_S)
1167
1168/*
1169 * Bits 22:20 of the FPU Status Register will be read as 0,
1170 * and should be written as zero.
1171 * MAC2008 was removed in Release 5 so we still treat it as
1172 * reserved.
1173 */
1174#define FPU_CSR_RSVD (_ULCAST_(7) << 20)
1175
1176#define FPU_CSR_MAC2008 (_ULCAST_(1) << 20)
1177#define FPU_CSR_ABS2008 (_ULCAST_(1) << 19)
1178#define FPU_CSR_NAN2008 (_ULCAST_(1) << 18)
1179
1180/*
1181 * X the exception cause indicator
1182 * E the exception enable
1183 * S the sticky/flag bit
1184*/
1185#define FPU_CSR_ALL_X 0x0003f000
1186#define FPU_CSR_UNI_X 0x00020000
1187#define FPU_CSR_INV_X 0x00010000
1188#define FPU_CSR_DIV_X 0x00008000
1189#define FPU_CSR_OVF_X 0x00004000
1190#define FPU_CSR_UDF_X 0x00002000
1191#define FPU_CSR_INE_X 0x00001000
1192
1193#define FPU_CSR_ALL_E 0x00000f80
1194#define FPU_CSR_INV_E 0x00000800
1195#define FPU_CSR_DIV_E 0x00000400
1196#define FPU_CSR_OVF_E 0x00000200
1197#define FPU_CSR_UDF_E 0x00000100
1198#define FPU_CSR_INE_E 0x00000080
1199
1200#define FPU_CSR_ALL_S 0x0000007c
1201#define FPU_CSR_INV_S 0x00000040
1202#define FPU_CSR_DIV_S 0x00000020
1203#define FPU_CSR_OVF_S 0x00000010
1204#define FPU_CSR_UDF_S 0x00000008
1205#define FPU_CSR_INE_S 0x00000004
1206
1207/* Bits 0 and 1 of FPU Status Register specify the rounding mode */
1208#define FPU_CSR_RM 0x00000003
1209#define FPU_CSR_RN 0x0 /* nearest */
1210#define FPU_CSR_RZ 0x1 /* towards zero */
1211#define FPU_CSR_RU 0x2 /* towards +Infinity */
1212#define FPU_CSR_RD 0x3 /* towards -Infinity */
1213
1214
1215#ifndef __ASSEMBLY__
1216
1217/*
1218 * Macros for handling the ISA mode bit for MIPS16 and microMIPS.
1219 */
1220#if defined(CONFIG_SYS_SUPPORTS_MIPS16) || \
1221 defined(CONFIG_SYS_SUPPORTS_MICROMIPS)
1222#define get_isa16_mode(x) ((x) & 0x1)
1223#define msk_isa16_mode(x) ((x) & ~0x1)
1224#define set_isa16_mode(x) do { (x) |= 0x1; } while(0)
1225#else
1226#define get_isa16_mode(x) 0
1227#define msk_isa16_mode(x) (x)
1228#define set_isa16_mode(x) do { } while(0)
1229#endif
1230
1231/*
1232 * microMIPS instructions can be 16-bit or 32-bit in length. This
1233 * returns a 1 if the instruction is 16-bit and a 0 if 32-bit.
1234 */
1235static inline int mm_insn_16bit(u16 insn)
1236{
1237 u16 opcode = (insn >> 10) & 0x7;
1238
1239 return (opcode >= 1 && opcode <= 3) ? 1 : 0;
1240}
1241
1242/*
1243 * Helper macros for generating raw instruction encodings in inline asm.
1244 */
1245#ifdef CONFIG_CPU_MICROMIPS
1246#define _ASM_INSN16_IF_MM(_enc) \
1247 ".insn\n\t" \
1248 ".hword (" #_enc ")\n\t"
1249#define _ASM_INSN32_IF_MM(_enc) \
1250 ".insn\n\t" \
1251 ".hword ((" #_enc ") >> 16)\n\t" \
1252 ".hword ((" #_enc ") & 0xffff)\n\t"
1253#else
1254#define _ASM_INSN_IF_MIPS(_enc) \
1255 ".insn\n\t" \
1256 ".word (" #_enc ")\n\t"
1257#endif
1258
1259#ifndef _ASM_INSN16_IF_MM
1260#define _ASM_INSN16_IF_MM(_enc)
1261#endif
1262#ifndef _ASM_INSN32_IF_MM
1263#define _ASM_INSN32_IF_MM(_enc)
1264#endif
1265#ifndef _ASM_INSN_IF_MIPS
1266#define _ASM_INSN_IF_MIPS(_enc)
1267#endif
1268
1269/*
1270 * parse_r var, r - Helper assembler macro for parsing register names.
1271 *
1272 * This converts the register name in $n form provided in \r to the
1273 * corresponding register number, which is assigned to the variable \var. It is
1274 * needed to allow explicit encoding of instructions in inline assembly where
1275 * registers are chosen by the compiler in $n form, allowing us to avoid using
1276 * fixed register numbers.
1277 *
1278 * It also allows newer instructions (not implemented by the assembler) to be
1279 * transparently implemented using assembler macros, instead of needing separate
1280 * cases depending on toolchain support.
1281 *
1282 * Simple usage example:
1283 * __asm__ __volatile__("parse_r __rt, %0\n\t"
1284 * ".insn\n\t"
1285 * "# di %0\n\t"
1286 * ".word (0x41606000 | (__rt << 16))"
1287 * : "=r" (status);
1288 */
1289
1290/* Match an individual register number and assign to \var */
1291#define _IFC_REG(n) \
1292 ".ifc \\r, $" #n "\n\t" \
1293 "\\var = " #n "\n\t" \
1294 ".endif\n\t"
1295
1296__asm__(".macro parse_r var r\n\t"
1297 "\\var = -1\n\t"
1298 _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3)
1299 _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7)
1300 _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11)
1301 _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15)
1302 _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19)
1303 _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23)
1304 _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27)
1305 _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31)
1306 ".iflt \\var\n\t"
1307 ".error \"Unable to parse register name \\r\"\n\t"
1308 ".endif\n\t"
1309 ".endm");
1310
1311#undef _IFC_REG
1312
1313/*
1314 * C macros for generating assembler macros for common instruction formats.
1315 *
1316 * The names of the operands can be chosen by the caller, and the encoding of
1317 * register operand \<Rn> is assigned to __<Rn> where it can be accessed from
1318 * the ENC encodings.
1319 */
1320
1321/* Instructions with no operands */
1322#define _ASM_MACRO_0(OP, ENC) \
1323 __asm__(".macro " #OP "\n\t" \
1324 ENC \
1325 ".endm")
1326
1327/* Instructions with 1 register operand & 1 immediate operand */
1328#define _ASM_MACRO_1R1I(OP, R1, I2, ENC) \
1329 __asm__(".macro " #OP " " #R1 ", " #I2 "\n\t" \
1330 "parse_r __" #R1 ", \\" #R1 "\n\t" \
1331 ENC \
1332 ".endm")
1333
1334/* Instructions with 2 register operands */
1335#define _ASM_MACRO_2R(OP, R1, R2, ENC) \
1336 __asm__(".macro " #OP " " #R1 ", " #R2 "\n\t" \
1337 "parse_r __" #R1 ", \\" #R1 "\n\t" \
1338 "parse_r __" #R2 ", \\" #R2 "\n\t" \
1339 ENC \
1340 ".endm")
1341
1342/* Instructions with 3 register operands */
1343#define _ASM_MACRO_3R(OP, R1, R2, R3, ENC) \
1344 __asm__(".macro " #OP " " #R1 ", " #R2 ", " #R3 "\n\t" \
1345 "parse_r __" #R1 ", \\" #R1 "\n\t" \
1346 "parse_r __" #R2 ", \\" #R2 "\n\t" \
1347 "parse_r __" #R3 ", \\" #R3 "\n\t" \
1348 ENC \
1349 ".endm")
1350
1351/* Instructions with 2 register operands and 1 optional select operand */
1352#define _ASM_MACRO_2R_1S(OP, R1, R2, SEL3, ENC) \
1353 __asm__(".macro " #OP " " #R1 ", " #R2 ", " #SEL3 " = 0\n\t" \
1354 "parse_r __" #R1 ", \\" #R1 "\n\t" \
1355 "parse_r __" #R2 ", \\" #R2 "\n\t" \
1356 ENC \
1357 ".endm")
1358
1359/*
1360 * TLB Invalidate Flush
1361 */
1362static inline void tlbinvf(void)
1363{
1364 __asm__ __volatile__(
1365 ".set push\n\t"
1366 ".set noreorder\n\t"
1367 "# tlbinvf\n\t"
1368 _ASM_INSN_IF_MIPS(0x42000004)
1369 _ASM_INSN32_IF_MM(0x0000537c)
1370 ".set pop");
1371}
1372
1373
1374/*
1375 * Functions to access the R10000 performance counters. These are basically
1376 * mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit
1377 * performance counter number encoded into bits 1 ... 5 of the instruction.
1378 * Only performance counters 0 to 1 actually exist, so for a non-R10000 aware
1379 * disassembler these will look like an access to sel 0 or 1.
1380 */
1381#define read_r10k_perf_cntr(counter) \
1382({ \
1383 unsigned int __res; \
1384 __asm__ __volatile__( \
1385 "mfpc\t%0, %1" \
1386 : "=r" (__res) \
1387 : "i" (counter)); \
1388 \
1389 __res; \
1390})
1391
1392#define write_r10k_perf_cntr(counter,val) \
1393do { \
1394 __asm__ __volatile__( \
1395 "mtpc\t%0, %1" \
1396 : \
1397 : "r" (val), "i" (counter)); \
1398} while (0)
1399
1400#define read_r10k_perf_event(counter) \
1401({ \
1402 unsigned int __res; \
1403 __asm__ __volatile__( \
1404 "mfps\t%0, %1" \
1405 : "=r" (__res) \
1406 : "i" (counter)); \
1407 \
1408 __res; \
1409})
1410
1411#define write_r10k_perf_cntl(counter,val) \
1412do { \
1413 __asm__ __volatile__( \
1414 "mtps\t%0, %1" \
1415 : \
1416 : "r" (val), "i" (counter)); \
1417} while (0)
1418
1419
1420/*
1421 * Macros to access the system control coprocessor
1422 */
1423
1424#define ___read_32bit_c0_register(source, sel, vol) \
1425({ unsigned int __res; \
1426 if (sel == 0) \
1427 __asm__ vol( \
1428 "mfc0\t%0, " #source "\n\t" \
1429 : "=r" (__res)); \
1430 else \
1431 __asm__ vol( \
1432 ".set\tpush\n\t" \
1433 ".set\tmips32\n\t" \
1434 "mfc0\t%0, " #source ", " #sel "\n\t" \
1435 ".set\tpop\n\t" \
1436 : "=r" (__res)); \
1437 __res; \
1438})
1439
1440#define ___read_64bit_c0_register(source, sel, vol) \
1441({ unsigned long long __res; \
1442 if (sizeof(unsigned long) == 4) \
1443 __res = __read_64bit_c0_split(source, sel, vol); \
1444 else if (sel == 0) \
1445 __asm__ vol( \
1446 ".set\tpush\n\t" \
1447 ".set\tmips3\n\t" \
1448 "dmfc0\t%0, " #source "\n\t" \
1449 ".set\tpop" \
1450 : "=r" (__res)); \
1451 else \
1452 __asm__ vol( \
1453 ".set\tpush\n\t" \
1454 ".set\tmips64\n\t" \
1455 "dmfc0\t%0, " #source ", " #sel "\n\t" \
1456 ".set\tpop" \
1457 : "=r" (__res)); \
1458 __res; \
1459})
1460
1461#define __read_32bit_c0_register(source, sel) \
1462 ___read_32bit_c0_register(source, sel, __volatile__)
1463
1464#define __read_const_32bit_c0_register(source, sel) \
1465 ___read_32bit_c0_register(source, sel,)
1466
1467#define __read_64bit_c0_register(source, sel) \
1468 ___read_64bit_c0_register(source, sel, __volatile__)
1469
1470#define __read_const_64bit_c0_register(source, sel) \
1471 ___read_64bit_c0_register(source, sel,)
1472
1473#define __write_32bit_c0_register(register, sel, value) \
1474do { \
1475 if (sel == 0) \
1476 __asm__ __volatile__( \
1477 "mtc0\t%z0, " #register "\n\t" \
1478 : : "Jr" ((unsigned int)(value))); \
1479 else \
1480 __asm__ __volatile__( \
1481 ".set\tpush\n\t" \
1482 ".set\tmips32\n\t" \
1483 "mtc0\t%z0, " #register ", " #sel "\n\t" \
1484 ".set\tpop" \
1485 : : "Jr" ((unsigned int)(value))); \
1486} while (0)
1487
1488#define __write_64bit_c0_register(register, sel, value) \
1489do { \
1490 if (sizeof(unsigned long) == 4) \
1491 __write_64bit_c0_split(register, sel, value); \
1492 else if (sel == 0) \
1493 __asm__ __volatile__( \
1494 ".set\tpush\n\t" \
1495 ".set\tmips3\n\t" \
1496 "dmtc0\t%z0, " #register "\n\t" \
1497 ".set\tpop" \
1498 : : "Jr" (value)); \
1499 else \
1500 __asm__ __volatile__( \
1501 ".set\tpush\n\t" \
1502 ".set\tmips64\n\t" \
1503 "dmtc0\t%z0, " #register ", " #sel "\n\t" \
1504 ".set\tpop" \
1505 : : "Jr" (value)); \
1506} while (0)
1507
1508#define __read_ulong_c0_register(reg, sel) \
1509 ((sizeof(unsigned long) == 4) ? \
1510 (unsigned long) __read_32bit_c0_register(reg, sel) : \
1511 (unsigned long) __read_64bit_c0_register(reg, sel))
1512
1513#define __read_const_ulong_c0_register(reg, sel) \
1514 ((sizeof(unsigned long) == 4) ? \
1515 (unsigned long) __read_const_32bit_c0_register(reg, sel) : \
1516 (unsigned long) __read_const_64bit_c0_register(reg, sel))
1517
1518#define __write_ulong_c0_register(reg, sel, val) \
1519do { \
1520 if (sizeof(unsigned long) == 4) \
1521 __write_32bit_c0_register(reg, sel, val); \
1522 else \
1523 __write_64bit_c0_register(reg, sel, val); \
1524} while (0)
1525
1526/*
1527 * On RM7000/RM9000 these are uses to access cop0 set 1 registers
1528 */
1529#define __read_32bit_c0_ctrl_register(source) \
1530({ unsigned int __res; \
1531 __asm__ __volatile__( \
1532 "cfc0\t%0, " #source "\n\t" \
1533 : "=r" (__res)); \
1534 __res; \
1535})
1536
1537#define __write_32bit_c0_ctrl_register(register, value) \
1538do { \
1539 __asm__ __volatile__( \
1540 "ctc0\t%z0, " #register "\n\t" \
1541 : : "Jr" ((unsigned int)(value))); \
1542} while (0)
1543
1544/*
1545 * These versions are only needed for systems with more than 38 bits of
1546 * physical address space running the 32-bit kernel. That's none atm :-)
1547 */
1548#define __read_64bit_c0_split(source, sel, vol) \
1549({ \
1550 unsigned long long __val; \
1551 unsigned long __flags; \
1552 \
1553 local_irq_save(__flags); \
1554 if (sel == 0) \
1555 __asm__ vol( \
1556 ".set\tpush\n\t" \
1557 ".set\tmips64\n\t" \
1558 "dmfc0\t%L0, " #source "\n\t" \
1559 "dsra\t%M0, %L0, 32\n\t" \
1560 "sll\t%L0, %L0, 0\n\t" \
1561 ".set\tpop" \
1562 : "=r" (__val)); \
1563 else \
1564 __asm__ vol( \
1565 ".set\tpush\n\t" \
1566 ".set\tmips64\n\t" \
1567 "dmfc0\t%L0, " #source ", " #sel "\n\t" \
1568 "dsra\t%M0, %L0, 32\n\t" \
1569 "sll\t%L0, %L0, 0\n\t" \
1570 ".set\tpop" \
1571 : "=r" (__val)); \
1572 local_irq_restore(__flags); \
1573 \
1574 __val; \
1575})
1576
1577#define __write_64bit_c0_split(source, sel, val) \
1578do { \
1579 unsigned long long __tmp = (val); \
1580 unsigned long __flags; \
1581 \
1582 local_irq_save(__flags); \
1583 if (MIPS_ISA_REV >= 2) \
1584 __asm__ __volatile__( \
1585 ".set\tpush\n\t" \
1586 ".set\t" MIPS_ISA_LEVEL "\n\t" \
1587 "dins\t%L0, %M0, 32, 32\n\t" \
1588 "dmtc0\t%L0, " #source ", " #sel "\n\t" \
1589 ".set\tpop" \
1590 : "+r" (__tmp)); \
1591 else if (sel == 0) \
1592 __asm__ __volatile__( \
1593 ".set\tpush\n\t" \
1594 ".set\tmips64\n\t" \
1595 "dsll\t%L0, %L0, 32\n\t" \
1596 "dsrl\t%L0, %L0, 32\n\t" \
1597 "dsll\t%M0, %M0, 32\n\t" \
1598 "or\t%L0, %L0, %M0\n\t" \
1599 "dmtc0\t%L0, " #source "\n\t" \
1600 ".set\tpop" \
1601 : "+r" (__tmp)); \
1602 else \
1603 __asm__ __volatile__( \
1604 ".set\tpush\n\t" \
1605 ".set\tmips64\n\t" \
1606 "dsll\t%L0, %L0, 32\n\t" \
1607 "dsrl\t%L0, %L0, 32\n\t" \
1608 "dsll\t%M0, %M0, 32\n\t" \
1609 "or\t%L0, %L0, %M0\n\t" \
1610 "dmtc0\t%L0, " #source ", " #sel "\n\t" \
1611 ".set\tpop" \
1612 : "+r" (__tmp)); \
1613 local_irq_restore(__flags); \
1614} while (0)
1615
1616#ifndef TOOLCHAIN_SUPPORTS_XPA
1617_ASM_MACRO_2R_1S(mfhc0, rt, rs, sel,
1618 _ASM_INSN_IF_MIPS(0x40400000 | __rt << 16 | __rs << 11 | \\sel)
1619 _ASM_INSN32_IF_MM(0x000000f4 | __rt << 21 | __rs << 16 | \\sel << 11));
1620_ASM_MACRO_2R_1S(mthc0, rt, rd, sel,
1621 _ASM_INSN_IF_MIPS(0x40c00000 | __rt << 16 | __rd << 11 | \\sel)
1622 _ASM_INSN32_IF_MM(0x000002f4 | __rt << 21 | __rd << 16 | \\sel << 11));
1623#define _ASM_SET_XPA ""
1624#else /* !TOOLCHAIN_SUPPORTS_XPA */
1625#define _ASM_SET_XPA ".set\txpa\n\t"
1626#endif
1627
1628#define __readx_32bit_c0_register(source, sel) \
1629({ \
1630 unsigned int __res; \
1631 \
1632 __asm__ __volatile__( \
1633 " .set push \n" \
1634 " .set mips32r2 \n" \
1635 _ASM_SET_XPA \
1636 " mfhc0 %0, " #source ", %1 \n" \
1637 " .set pop \n" \
1638 : "=r" (__res) \
1639 : "i" (sel)); \
1640 __res; \
1641})
1642
1643#define __writex_32bit_c0_register(register, sel, value) \
1644do { \
1645 __asm__ __volatile__( \
1646 " .set push \n" \
1647 " .set mips32r2 \n" \
1648 _ASM_SET_XPA \
1649 " mthc0 %z0, " #register ", %1 \n" \
1650 " .set pop \n" \
1651 : \
1652 : "Jr" (value), "i" (sel)); \
1653} while (0)
1654
1655#define read_c0_index() __read_32bit_c0_register($0, 0)
1656#define write_c0_index(val) __write_32bit_c0_register($0, 0, val)
1657
1658#define read_c0_random() __read_32bit_c0_register($1, 0)
1659#define write_c0_random(val) __write_32bit_c0_register($1, 0, val)
1660
1661#define read_c0_entrylo0() __read_ulong_c0_register($2, 0)
1662#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val)
1663
1664#define readx_c0_entrylo0() __readx_32bit_c0_register($2, 0)
1665#define writex_c0_entrylo0(val) __writex_32bit_c0_register($2, 0, val)
1666
1667#define read_c0_entrylo1() __read_ulong_c0_register($3, 0)
1668#define write_c0_entrylo1(val) __write_ulong_c0_register($3, 0, val)
1669
1670#define readx_c0_entrylo1() __readx_32bit_c0_register($3, 0)
1671#define writex_c0_entrylo1(val) __writex_32bit_c0_register($3, 0, val)
1672
1673#define read_c0_conf() __read_32bit_c0_register($3, 0)
1674#define write_c0_conf(val) __write_32bit_c0_register($3, 0, val)
1675
1676#define read_c0_globalnumber() __read_32bit_c0_register($3, 1)
1677
1678#define read_c0_context() __read_ulong_c0_register($4, 0)
1679#define write_c0_context(val) __write_ulong_c0_register($4, 0, val)
1680
1681#define read_c0_contextconfig() __read_32bit_c0_register($4, 1)
1682#define write_c0_contextconfig(val) __write_32bit_c0_register($4, 1, val)
1683
1684#define read_c0_userlocal() __read_ulong_c0_register($4, 2)
1685#define write_c0_userlocal(val) __write_ulong_c0_register($4, 2, val)
1686
1687#define read_c0_xcontextconfig() __read_ulong_c0_register($4, 3)
1688#define write_c0_xcontextconfig(val) __write_ulong_c0_register($4, 3, val)
1689
1690#define read_c0_memorymapid() __read_32bit_c0_register($4, 5)
1691#define write_c0_memorymapid(val) __write_32bit_c0_register($4, 5, val)
1692
1693#define read_c0_pagemask() __read_32bit_c0_register($5, 0)
1694#define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val)
1695
1696#define read_c0_pagegrain() __read_32bit_c0_register($5, 1)
1697#define write_c0_pagegrain(val) __write_32bit_c0_register($5, 1, val)
1698
1699#define read_c0_wired() __read_32bit_c0_register($6, 0)
1700#define write_c0_wired(val) __write_32bit_c0_register($6, 0, val)
1701
1702#define read_c0_info() __read_32bit_c0_register($7, 0)
1703
1704#define read_c0_cache() __read_32bit_c0_register($7, 0) /* TX39xx */
1705#define write_c0_cache(val) __write_32bit_c0_register($7, 0, val)
1706
1707#define read_c0_badvaddr() __read_ulong_c0_register($8, 0)
1708#define write_c0_badvaddr(val) __write_ulong_c0_register($8, 0, val)
1709
1710#define read_c0_badinstr() __read_32bit_c0_register($8, 1)
1711#define read_c0_badinstrp() __read_32bit_c0_register($8, 2)
1712
1713#define read_c0_count() __read_32bit_c0_register($9, 0)
1714#define write_c0_count(val) __write_32bit_c0_register($9, 0, val)
1715
1716#define read_c0_entryhi() __read_ulong_c0_register($10, 0)
1717#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val)
1718
1719#define read_c0_guestctl1() __read_32bit_c0_register($10, 4)
1720#define write_c0_guestctl1(val) __write_32bit_c0_register($10, 4, val)
1721
1722#define read_c0_guestctl2() __read_32bit_c0_register($10, 5)
1723#define write_c0_guestctl2(val) __write_32bit_c0_register($10, 5, val)
1724
1725#define read_c0_guestctl3() __read_32bit_c0_register($10, 6)
1726#define write_c0_guestctl3(val) __write_32bit_c0_register($10, 6, val)
1727
1728#define read_c0_compare() __read_32bit_c0_register($11, 0)
1729#define write_c0_compare(val) __write_32bit_c0_register($11, 0, val)
1730
1731#define read_c0_guestctl0ext() __read_32bit_c0_register($11, 4)
1732#define write_c0_guestctl0ext(val) __write_32bit_c0_register($11, 4, val)
1733
1734#define read_c0_status() __read_32bit_c0_register($12, 0)
1735
1736#define write_c0_status(val) __write_32bit_c0_register($12, 0, val)
1737
1738#define read_c0_guestctl0() __read_32bit_c0_register($12, 6)
1739#define write_c0_guestctl0(val) __write_32bit_c0_register($12, 6, val)
1740
1741#define read_c0_gtoffset() __read_32bit_c0_register($12, 7)
1742#define write_c0_gtoffset(val) __write_32bit_c0_register($12, 7, val)
1743
1744#define read_c0_cause() __read_32bit_c0_register($13, 0)
1745#define write_c0_cause(val) __write_32bit_c0_register($13, 0, val)
1746
1747#define read_c0_epc() __read_ulong_c0_register($14, 0)
1748#define write_c0_epc(val) __write_ulong_c0_register($14, 0, val)
1749
1750#define read_c0_prid() __read_const_32bit_c0_register($15, 0)
1751
1752#define read_c0_cmgcrbase() __read_ulong_c0_register($15, 3)
1753
1754#define read_c0_config() __read_32bit_c0_register($16, 0)
1755#define read_c0_config1() __read_32bit_c0_register($16, 1)
1756#define read_c0_config2() __read_32bit_c0_register($16, 2)
1757#define read_c0_config3() __read_32bit_c0_register($16, 3)
1758#define read_c0_config4() __read_32bit_c0_register($16, 4)
1759#define read_c0_config5() __read_32bit_c0_register($16, 5)
1760#define read_c0_config6() __read_32bit_c0_register($16, 6)
1761#define read_c0_config7() __read_32bit_c0_register($16, 7)
1762#define write_c0_config(val) __write_32bit_c0_register($16, 0, val)
1763#define write_c0_config1(val) __write_32bit_c0_register($16, 1, val)
1764#define write_c0_config2(val) __write_32bit_c0_register($16, 2, val)
1765#define write_c0_config3(val) __write_32bit_c0_register($16, 3, val)
1766#define write_c0_config4(val) __write_32bit_c0_register($16, 4, val)
1767#define write_c0_config5(val) __write_32bit_c0_register($16, 5, val)
1768#define write_c0_config6(val) __write_32bit_c0_register($16, 6, val)
1769#define write_c0_config7(val) __write_32bit_c0_register($16, 7, val)
1770
1771#define read_c0_lladdr() __read_ulong_c0_register($17, 0)
1772#define write_c0_lladdr(val) __write_ulong_c0_register($17, 0, val)
1773#define read_c0_maar() __read_ulong_c0_register($17, 1)
1774#define write_c0_maar(val) __write_ulong_c0_register($17, 1, val)
1775#define readx_c0_maar() __readx_32bit_c0_register($17, 1)
1776#define writex_c0_maar(val) __writex_32bit_c0_register($17, 1, val)
1777#define read_c0_maari() __read_32bit_c0_register($17, 2)
1778#define write_c0_maari(val) __write_32bit_c0_register($17, 2, val)
1779
1780/*
1781 * The WatchLo register. There may be up to 8 of them.
1782 */
1783#define read_c0_watchlo0() __read_ulong_c0_register($18, 0)
1784#define read_c0_watchlo1() __read_ulong_c0_register($18, 1)
1785#define read_c0_watchlo2() __read_ulong_c0_register($18, 2)
1786#define read_c0_watchlo3() __read_ulong_c0_register($18, 3)
1787#define read_c0_watchlo4() __read_ulong_c0_register($18, 4)
1788#define read_c0_watchlo5() __read_ulong_c0_register($18, 5)
1789#define read_c0_watchlo6() __read_ulong_c0_register($18, 6)
1790#define read_c0_watchlo7() __read_ulong_c0_register($18, 7)
1791#define write_c0_watchlo0(val) __write_ulong_c0_register($18, 0, val)
1792#define write_c0_watchlo1(val) __write_ulong_c0_register($18, 1, val)
1793#define write_c0_watchlo2(val) __write_ulong_c0_register($18, 2, val)
1794#define write_c0_watchlo3(val) __write_ulong_c0_register($18, 3, val)
1795#define write_c0_watchlo4(val) __write_ulong_c0_register($18, 4, val)
1796#define write_c0_watchlo5(val) __write_ulong_c0_register($18, 5, val)
1797#define write_c0_watchlo6(val) __write_ulong_c0_register($18, 6, val)
1798#define write_c0_watchlo7(val) __write_ulong_c0_register($18, 7, val)
1799
1800/*
1801 * The WatchHi register. There may be up to 8 of them.
1802 */
1803#define read_c0_watchhi0() __read_32bit_c0_register($19, 0)
1804#define read_c0_watchhi1() __read_32bit_c0_register($19, 1)
1805#define read_c0_watchhi2() __read_32bit_c0_register($19, 2)
1806#define read_c0_watchhi3() __read_32bit_c0_register($19, 3)
1807#define read_c0_watchhi4() __read_32bit_c0_register($19, 4)
1808#define read_c0_watchhi5() __read_32bit_c0_register($19, 5)
1809#define read_c0_watchhi6() __read_32bit_c0_register($19, 6)
1810#define read_c0_watchhi7() __read_32bit_c0_register($19, 7)
1811
1812#define write_c0_watchhi0(val) __write_32bit_c0_register($19, 0, val)
1813#define write_c0_watchhi1(val) __write_32bit_c0_register($19, 1, val)
1814#define write_c0_watchhi2(val) __write_32bit_c0_register($19, 2, val)
1815#define write_c0_watchhi3(val) __write_32bit_c0_register($19, 3, val)
1816#define write_c0_watchhi4(val) __write_32bit_c0_register($19, 4, val)
1817#define write_c0_watchhi5(val) __write_32bit_c0_register($19, 5, val)
1818#define write_c0_watchhi6(val) __write_32bit_c0_register($19, 6, val)
1819#define write_c0_watchhi7(val) __write_32bit_c0_register($19, 7, val)
1820
1821#define read_c0_xcontext() __read_ulong_c0_register($20, 0)
1822#define write_c0_xcontext(val) __write_ulong_c0_register($20, 0, val)
1823
1824#define read_c0_intcontrol() __read_32bit_c0_ctrl_register($20)
1825#define write_c0_intcontrol(val) __write_32bit_c0_ctrl_register($20, val)
1826
1827#define read_c0_framemask() __read_32bit_c0_register($21, 0)
1828#define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val)
1829
1830#define read_c0_diag() __read_32bit_c0_register($22, 0)
1831#define write_c0_diag(val) __write_32bit_c0_register($22, 0, val)
1832
1833/* R10K CP0 Branch Diagnostic register is 64bits wide */
1834#define read_c0_r10k_diag() __read_64bit_c0_register($22, 0)
1835#define write_c0_r10k_diag(val) __write_64bit_c0_register($22, 0, val)
1836
1837#define read_c0_diag1() __read_32bit_c0_register($22, 1)
1838#define write_c0_diag1(val) __write_32bit_c0_register($22, 1, val)
1839
1840#define read_c0_diag2() __read_32bit_c0_register($22, 2)
1841#define write_c0_diag2(val) __write_32bit_c0_register($22, 2, val)
1842
1843#define read_c0_diag3() __read_32bit_c0_register($22, 3)
1844#define write_c0_diag3(val) __write_32bit_c0_register($22, 3, val)
1845
1846#define read_c0_diag4() __read_32bit_c0_register($22, 4)
1847#define write_c0_diag4(val) __write_32bit_c0_register($22, 4, val)
1848
1849#define read_c0_diag5() __read_32bit_c0_register($22, 5)
1850#define write_c0_diag5(val) __write_32bit_c0_register($22, 5, val)
1851
1852#define read_c0_debug() __read_32bit_c0_register($23, 0)
1853#define write_c0_debug(val) __write_32bit_c0_register($23, 0, val)
1854
1855#define read_c0_depc() __read_ulong_c0_register($24, 0)
1856#define write_c0_depc(val) __write_ulong_c0_register($24, 0, val)
1857
1858/*
1859 * MIPS32 / MIPS64 performance counters
1860 */
1861#define read_c0_perfctrl0() __read_32bit_c0_register($25, 0)
1862#define write_c0_perfctrl0(val) __write_32bit_c0_register($25, 0, val)
1863#define read_c0_perfcntr0() __read_32bit_c0_register($25, 1)
1864#define write_c0_perfcntr0(val) __write_32bit_c0_register($25, 1, val)
1865#define read_c0_perfcntr0_64() __read_64bit_c0_register($25, 1)
1866#define write_c0_perfcntr0_64(val) __write_64bit_c0_register($25, 1, val)
1867#define read_c0_perfctrl1() __read_32bit_c0_register($25, 2)
1868#define write_c0_perfctrl1(val) __write_32bit_c0_register($25, 2, val)
1869#define read_c0_perfcntr1() __read_32bit_c0_register($25, 3)
1870#define write_c0_perfcntr1(val) __write_32bit_c0_register($25, 3, val)
1871#define read_c0_perfcntr1_64() __read_64bit_c0_register($25, 3)
1872#define write_c0_perfcntr1_64(val) __write_64bit_c0_register($25, 3, val)
1873#define read_c0_perfctrl2() __read_32bit_c0_register($25, 4)
1874#define write_c0_perfctrl2(val) __write_32bit_c0_register($25, 4, val)
1875#define read_c0_perfcntr2() __read_32bit_c0_register($25, 5)
1876#define write_c0_perfcntr2(val) __write_32bit_c0_register($25, 5, val)
1877#define read_c0_perfcntr2_64() __read_64bit_c0_register($25, 5)
1878#define write_c0_perfcntr2_64(val) __write_64bit_c0_register($25, 5, val)
1879#define read_c0_perfctrl3() __read_32bit_c0_register($25, 6)
1880#define write_c0_perfctrl3(val) __write_32bit_c0_register($25, 6, val)
1881#define read_c0_perfcntr3() __read_32bit_c0_register($25, 7)
1882#define write_c0_perfcntr3(val) __write_32bit_c0_register($25, 7, val)
1883#define read_c0_perfcntr3_64() __read_64bit_c0_register($25, 7)
1884#define write_c0_perfcntr3_64(val) __write_64bit_c0_register($25, 7, val)
1885
1886#define read_c0_ecc() __read_32bit_c0_register($26, 0)
1887#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val)
1888
1889#define read_c0_derraddr0() __read_ulong_c0_register($26, 1)
1890#define write_c0_derraddr0(val) __write_ulong_c0_register($26, 1, val)
1891
1892#define read_c0_cacheerr() __read_32bit_c0_register($27, 0)
1893
1894#define read_c0_derraddr1() __read_ulong_c0_register($27, 1)
1895#define write_c0_derraddr1(val) __write_ulong_c0_register($27, 1, val)
1896
1897#define read_c0_taglo() __read_32bit_c0_register($28, 0)
1898#define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val)
1899
1900#define read_c0_dtaglo() __read_32bit_c0_register($28, 2)
1901#define write_c0_dtaglo(val) __write_32bit_c0_register($28, 2, val)
1902
1903#define read_c0_ddatalo() __read_32bit_c0_register($28, 3)
1904#define write_c0_ddatalo(val) __write_32bit_c0_register($28, 3, val)
1905
1906#define read_c0_staglo() __read_32bit_c0_register($28, 4)
1907#define write_c0_staglo(val) __write_32bit_c0_register($28, 4, val)
1908
1909#define read_c0_taghi() __read_32bit_c0_register($29, 0)
1910#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val)
1911
1912#define read_c0_errorepc() __read_ulong_c0_register($30, 0)
1913#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val)
1914
1915/* MIPSR2 */
1916#define read_c0_hwrena() __read_32bit_c0_register($7, 0)
1917#define write_c0_hwrena(val) __write_32bit_c0_register($7, 0, val)
1918
1919#define read_c0_intctl() __read_32bit_c0_register($12, 1)
1920#define write_c0_intctl(val) __write_32bit_c0_register($12, 1, val)
1921
1922#define read_c0_srsctl() __read_32bit_c0_register($12, 2)
1923#define write_c0_srsctl(val) __write_32bit_c0_register($12, 2, val)
1924
1925#define read_c0_srsmap() __read_32bit_c0_register($12, 3)
1926#define write_c0_srsmap(val) __write_32bit_c0_register($12, 3, val)
1927
1928#define read_c0_ebase() __read_32bit_c0_register($15, 1)
1929#define write_c0_ebase(val) __write_32bit_c0_register($15, 1, val)
1930
1931#define read_c0_ebase_64() __read_64bit_c0_register($15, 1)
1932#define write_c0_ebase_64(val) __write_64bit_c0_register($15, 1, val)
1933
1934#define read_c0_cdmmbase() __read_ulong_c0_register($15, 2)
1935#define write_c0_cdmmbase(val) __write_ulong_c0_register($15, 2, val)
1936
1937/* MIPSR3 */
1938#define read_c0_segctl0() __read_32bit_c0_register($5, 2)
1939#define write_c0_segctl0(val) __write_32bit_c0_register($5, 2, val)
1940
1941#define read_c0_segctl1() __read_32bit_c0_register($5, 3)
1942#define write_c0_segctl1(val) __write_32bit_c0_register($5, 3, val)
1943
1944#define read_c0_segctl2() __read_32bit_c0_register($5, 4)
1945#define write_c0_segctl2(val) __write_32bit_c0_register($5, 4, val)
1946
1947/* Hardware Page Table Walker */
1948#define read_c0_pwbase() __read_ulong_c0_register($5, 5)
1949#define write_c0_pwbase(val) __write_ulong_c0_register($5, 5, val)
1950
1951#define read_c0_pwfield() __read_ulong_c0_register($5, 6)
1952#define write_c0_pwfield(val) __write_ulong_c0_register($5, 6, val)
1953
1954#define read_c0_pwsize() __read_ulong_c0_register($5, 7)
1955#define write_c0_pwsize(val) __write_ulong_c0_register($5, 7, val)
1956
1957#define read_c0_pwctl() __read_32bit_c0_register($6, 6)
1958#define write_c0_pwctl(val) __write_32bit_c0_register($6, 6, val)
1959
1960#define read_c0_pgd() __read_64bit_c0_register($9, 7)
1961#define write_c0_pgd(val) __write_64bit_c0_register($9, 7, val)
1962
1963#define read_c0_kpgd() __read_64bit_c0_register($31, 7)
1964#define write_c0_kpgd(val) __write_64bit_c0_register($31, 7, val)
1965
1966/* Cavium OCTEON (cnMIPS) */
1967#define read_c0_cvmcount() __read_ulong_c0_register($9, 6)
1968#define write_c0_cvmcount(val) __write_ulong_c0_register($9, 6, val)
1969
1970#define read_c0_cvmctl() __read_64bit_c0_register($9, 7)
1971#define write_c0_cvmctl(val) __write_64bit_c0_register($9, 7, val)
1972
1973#define read_c0_cvmmemctl() __read_64bit_c0_register($11, 7)
1974#define write_c0_cvmmemctl(val) __write_64bit_c0_register($11, 7, val)
1975
1976#define read_c0_cvmmemctl2() __read_64bit_c0_register($16, 6)
1977#define write_c0_cvmmemctl2(val) __write_64bit_c0_register($16, 6, val)
1978
1979#define read_c0_cvmvmconfig() __read_64bit_c0_register($16, 7)
1980#define write_c0_cvmvmconfig(val) __write_64bit_c0_register($16, 7, val)
1981
1982/*
1983 * The cacheerr registers are not standardized. On OCTEON, they are
1984 * 64 bits wide.
1985 */
1986#define read_octeon_c0_icacheerr() __read_64bit_c0_register($27, 0)
1987#define write_octeon_c0_icacheerr(val) __write_64bit_c0_register($27, 0, val)
1988
1989#define read_octeon_c0_dcacheerr() __read_64bit_c0_register($27, 1)
1990#define write_octeon_c0_dcacheerr(val) __write_64bit_c0_register($27, 1, val)
1991
1992/* BMIPS3300 */
1993#define read_c0_brcm_config_0() __read_32bit_c0_register($22, 0)
1994#define write_c0_brcm_config_0(val) __write_32bit_c0_register($22, 0, val)
1995
1996#define read_c0_brcm_bus_pll() __read_32bit_c0_register($22, 4)
1997#define write_c0_brcm_bus_pll(val) __write_32bit_c0_register($22, 4, val)
1998
1999#define read_c0_brcm_reset() __read_32bit_c0_register($22, 5)
2000#define write_c0_brcm_reset(val) __write_32bit_c0_register($22, 5, val)
2001
2002/* BMIPS43xx */
2003#define read_c0_brcm_cmt_intr() __read_32bit_c0_register($22, 1)
2004#define write_c0_brcm_cmt_intr(val) __write_32bit_c0_register($22, 1, val)
2005
2006#define read_c0_brcm_cmt_ctrl() __read_32bit_c0_register($22, 2)
2007#define write_c0_brcm_cmt_ctrl(val) __write_32bit_c0_register($22, 2, val)
2008
2009#define read_c0_brcm_cmt_local() __read_32bit_c0_register($22, 3)
2010#define write_c0_brcm_cmt_local(val) __write_32bit_c0_register($22, 3, val)
2011
2012#define read_c0_brcm_config_1() __read_32bit_c0_register($22, 5)
2013#define write_c0_brcm_config_1(val) __write_32bit_c0_register($22, 5, val)
2014
2015#define read_c0_brcm_cbr() __read_32bit_c0_register($22, 6)
2016#define write_c0_brcm_cbr(val) __write_32bit_c0_register($22, 6, val)
2017
2018/* BMIPS5000 */
2019#define read_c0_brcm_config() __read_32bit_c0_register($22, 0)
2020#define write_c0_brcm_config(val) __write_32bit_c0_register($22, 0, val)
2021
2022#define read_c0_brcm_mode() __read_32bit_c0_register($22, 1)
2023#define write_c0_brcm_mode(val) __write_32bit_c0_register($22, 1, val)
2024
2025#define read_c0_brcm_action() __read_32bit_c0_register($22, 2)
2026#define write_c0_brcm_action(val) __write_32bit_c0_register($22, 2, val)
2027
2028#define read_c0_brcm_edsp() __read_32bit_c0_register($22, 3)
2029#define write_c0_brcm_edsp(val) __write_32bit_c0_register($22, 3, val)
2030
2031#define read_c0_brcm_bootvec() __read_32bit_c0_register($22, 4)
2032#define write_c0_brcm_bootvec(val) __write_32bit_c0_register($22, 4, val)
2033
2034#define read_c0_brcm_sleepcount() __read_32bit_c0_register($22, 7)
2035#define write_c0_brcm_sleepcount(val) __write_32bit_c0_register($22, 7, val)
2036
2037/* Ingenic page ctrl register */
2038#define write_c0_page_ctrl(val) __write_32bit_c0_register($5, 4, val)
2039
2040/*
2041 * Macros to access the guest system control coprocessor
2042 */
2043
2044#ifndef TOOLCHAIN_SUPPORTS_VIRT
2045_ASM_MACRO_2R_1S(mfgc0, rt, rs, sel,
2046 _ASM_INSN_IF_MIPS(0x40600000 | __rt << 16 | __rs << 11 | \\sel)
2047 _ASM_INSN32_IF_MM(0x000004fc | __rt << 21 | __rs << 16 | \\sel << 11));
2048_ASM_MACRO_2R_1S(dmfgc0, rt, rs, sel,
2049 _ASM_INSN_IF_MIPS(0x40600100 | __rt << 16 | __rs << 11 | \\sel)
2050 _ASM_INSN32_IF_MM(0x580004fc | __rt << 21 | __rs << 16 | \\sel << 11));
2051_ASM_MACRO_2R_1S(mtgc0, rt, rd, sel,
2052 _ASM_INSN_IF_MIPS(0x40600200 | __rt << 16 | __rd << 11 | \\sel)
2053 _ASM_INSN32_IF_MM(0x000006fc | __rt << 21 | __rd << 16 | \\sel << 11));
2054_ASM_MACRO_2R_1S(dmtgc0, rt, rd, sel,
2055 _ASM_INSN_IF_MIPS(0x40600300 | __rt << 16 | __rd << 11 | \\sel)
2056 _ASM_INSN32_IF_MM(0x580006fc | __rt << 21 | __rd << 16 | \\sel << 11));
2057_ASM_MACRO_0(tlbgp, _ASM_INSN_IF_MIPS(0x42000010)
2058 _ASM_INSN32_IF_MM(0x0000017c));
2059_ASM_MACRO_0(tlbgr, _ASM_INSN_IF_MIPS(0x42000009)
2060 _ASM_INSN32_IF_MM(0x0000117c));
2061_ASM_MACRO_0(tlbgwi, _ASM_INSN_IF_MIPS(0x4200000a)
2062 _ASM_INSN32_IF_MM(0x0000217c));
2063_ASM_MACRO_0(tlbgwr, _ASM_INSN_IF_MIPS(0x4200000e)
2064 _ASM_INSN32_IF_MM(0x0000317c));
2065_ASM_MACRO_0(tlbginvf, _ASM_INSN_IF_MIPS(0x4200000c)
2066 _ASM_INSN32_IF_MM(0x0000517c));
2067#define _ASM_SET_VIRT ""
2068#else /* !TOOLCHAIN_SUPPORTS_VIRT */
2069#define _ASM_SET_VIRT ".set\tvirt\n\t"
2070#endif
2071
2072#define __read_32bit_gc0_register(source, sel) \
2073({ int __res; \
2074 __asm__ __volatile__( \
2075 ".set\tpush\n\t" \
2076 ".set\tmips32r5\n\t" \
2077 _ASM_SET_VIRT \
2078 "mfgc0\t%0, " #source ", %1\n\t" \
2079 ".set\tpop" \
2080 : "=r" (__res) \
2081 : "i" (sel)); \
2082 __res; \
2083})
2084
2085#define __read_64bit_gc0_register(source, sel) \
2086({ unsigned long long __res; \
2087 __asm__ __volatile__( \
2088 ".set\tpush\n\t" \
2089 ".set\tmips64r5\n\t" \
2090 _ASM_SET_VIRT \
2091 "dmfgc0\t%0, " #source ", %1\n\t" \
2092 ".set\tpop" \
2093 : "=r" (__res) \
2094 : "i" (sel)); \
2095 __res; \
2096})
2097
2098#define __write_32bit_gc0_register(register, sel, value) \
2099do { \
2100 __asm__ __volatile__( \
2101 ".set\tpush\n\t" \
2102 ".set\tmips32r5\n\t" \
2103 _ASM_SET_VIRT \
2104 "mtgc0\t%z0, " #register ", %1\n\t" \
2105 ".set\tpop" \
2106 : : "Jr" ((unsigned int)(value)), \
2107 "i" (sel)); \
2108} while (0)
2109
2110#define __write_64bit_gc0_register(register, sel, value) \
2111do { \
2112 __asm__ __volatile__( \
2113 ".set\tpush\n\t" \
2114 ".set\tmips64r5\n\t" \
2115 _ASM_SET_VIRT \
2116 "dmtgc0\t%z0, " #register ", %1\n\t" \
2117 ".set\tpop" \
2118 : : "Jr" (value), \
2119 "i" (sel)); \
2120} while (0)
2121
2122#define __read_ulong_gc0_register(reg, sel) \
2123 ((sizeof(unsigned long) == 4) ? \
2124 (unsigned long) __read_32bit_gc0_register(reg, sel) : \
2125 (unsigned long) __read_64bit_gc0_register(reg, sel))
2126
2127#define __write_ulong_gc0_register(reg, sel, val) \
2128do { \
2129 if (sizeof(unsigned long) == 4) \
2130 __write_32bit_gc0_register(reg, sel, val); \
2131 else \
2132 __write_64bit_gc0_register(reg, sel, val); \
2133} while (0)
2134
2135#define read_gc0_index() __read_32bit_gc0_register($0, 0)
2136#define write_gc0_index(val) __write_32bit_gc0_register($0, 0, val)
2137
2138#define read_gc0_entrylo0() __read_ulong_gc0_register($2, 0)
2139#define write_gc0_entrylo0(val) __write_ulong_gc0_register($2, 0, val)
2140
2141#define read_gc0_entrylo1() __read_ulong_gc0_register($3, 0)
2142#define write_gc0_entrylo1(val) __write_ulong_gc0_register($3, 0, val)
2143
2144#define read_gc0_context() __read_ulong_gc0_register($4, 0)
2145#define write_gc0_context(val) __write_ulong_gc0_register($4, 0, val)
2146
2147#define read_gc0_contextconfig() __read_32bit_gc0_register($4, 1)
2148#define write_gc0_contextconfig(val) __write_32bit_gc0_register($4, 1, val)
2149
2150#define read_gc0_userlocal() __read_ulong_gc0_register($4, 2)
2151#define write_gc0_userlocal(val) __write_ulong_gc0_register($4, 2, val)
2152
2153#define read_gc0_xcontextconfig() __read_ulong_gc0_register($4, 3)
2154#define write_gc0_xcontextconfig(val) __write_ulong_gc0_register($4, 3, val)
2155
2156#define read_gc0_pagemask() __read_32bit_gc0_register($5, 0)
2157#define write_gc0_pagemask(val) __write_32bit_gc0_register($5, 0, val)
2158
2159#define read_gc0_pagegrain() __read_32bit_gc0_register($5, 1)
2160#define write_gc0_pagegrain(val) __write_32bit_gc0_register($5, 1, val)
2161
2162#define read_gc0_segctl0() __read_ulong_gc0_register($5, 2)
2163#define write_gc0_segctl0(val) __write_ulong_gc0_register($5, 2, val)
2164
2165#define read_gc0_segctl1() __read_ulong_gc0_register($5, 3)
2166#define write_gc0_segctl1(val) __write_ulong_gc0_register($5, 3, val)
2167
2168#define read_gc0_segctl2() __read_ulong_gc0_register($5, 4)
2169#define write_gc0_segctl2(val) __write_ulong_gc0_register($5, 4, val)
2170
2171#define read_gc0_pwbase() __read_ulong_gc0_register($5, 5)
2172#define write_gc0_pwbase(val) __write_ulong_gc0_register($5, 5, val)
2173
2174#define read_gc0_pwfield() __read_ulong_gc0_register($5, 6)
2175#define write_gc0_pwfield(val) __write_ulong_gc0_register($5, 6, val)
2176
2177#define read_gc0_pwsize() __read_ulong_gc0_register($5, 7)
2178#define write_gc0_pwsize(val) __write_ulong_gc0_register($5, 7, val)
2179
2180#define read_gc0_wired() __read_32bit_gc0_register($6, 0)
2181#define write_gc0_wired(val) __write_32bit_gc0_register($6, 0, val)
2182
2183#define read_gc0_pwctl() __read_32bit_gc0_register($6, 6)
2184#define write_gc0_pwctl(val) __write_32bit_gc0_register($6, 6, val)
2185
2186#define read_gc0_hwrena() __read_32bit_gc0_register($7, 0)
2187#define write_gc0_hwrena(val) __write_32bit_gc0_register($7, 0, val)
2188
2189#define read_gc0_badvaddr() __read_ulong_gc0_register($8, 0)
2190#define write_gc0_badvaddr(val) __write_ulong_gc0_register($8, 0, val)
2191
2192#define read_gc0_badinstr() __read_32bit_gc0_register($8, 1)
2193#define write_gc0_badinstr(val) __write_32bit_gc0_register($8, 1, val)
2194
2195#define read_gc0_badinstrp() __read_32bit_gc0_register($8, 2)
2196#define write_gc0_badinstrp(val) __write_32bit_gc0_register($8, 2, val)
2197
2198#define read_gc0_count() __read_32bit_gc0_register($9, 0)
2199
2200#define read_gc0_entryhi() __read_ulong_gc0_register($10, 0)
2201#define write_gc0_entryhi(val) __write_ulong_gc0_register($10, 0, val)
2202
2203#define read_gc0_compare() __read_32bit_gc0_register($11, 0)
2204#define write_gc0_compare(val) __write_32bit_gc0_register($11, 0, val)
2205
2206#define read_gc0_status() __read_32bit_gc0_register($12, 0)
2207#define write_gc0_status(val) __write_32bit_gc0_register($12, 0, val)
2208
2209#define read_gc0_intctl() __read_32bit_gc0_register($12, 1)
2210#define write_gc0_intctl(val) __write_32bit_gc0_register($12, 1, val)
2211
2212#define read_gc0_cause() __read_32bit_gc0_register($13, 0)
2213#define write_gc0_cause(val) __write_32bit_gc0_register($13, 0, val)
2214
2215#define read_gc0_epc() __read_ulong_gc0_register($14, 0)
2216#define write_gc0_epc(val) __write_ulong_gc0_register($14, 0, val)
2217
2218#define read_gc0_prid() __read_32bit_gc0_register($15, 0)
2219
2220#define read_gc0_ebase() __read_32bit_gc0_register($15, 1)
2221#define write_gc0_ebase(val) __write_32bit_gc0_register($15, 1, val)
2222
2223#define read_gc0_ebase_64() __read_64bit_gc0_register($15, 1)
2224#define write_gc0_ebase_64(val) __write_64bit_gc0_register($15, 1, val)
2225
2226#define read_gc0_config() __read_32bit_gc0_register($16, 0)
2227#define read_gc0_config1() __read_32bit_gc0_register($16, 1)
2228#define read_gc0_config2() __read_32bit_gc0_register($16, 2)
2229#define read_gc0_config3() __read_32bit_gc0_register($16, 3)
2230#define read_gc0_config4() __read_32bit_gc0_register($16, 4)
2231#define read_gc0_config5() __read_32bit_gc0_register($16, 5)
2232#define read_gc0_config6() __read_32bit_gc0_register($16, 6)
2233#define read_gc0_config7() __read_32bit_gc0_register($16, 7)
2234#define write_gc0_config(val) __write_32bit_gc0_register($16, 0, val)
2235#define write_gc0_config1(val) __write_32bit_gc0_register($16, 1, val)
2236#define write_gc0_config2(val) __write_32bit_gc0_register($16, 2, val)
2237#define write_gc0_config3(val) __write_32bit_gc0_register($16, 3, val)
2238#define write_gc0_config4(val) __write_32bit_gc0_register($16, 4, val)
2239#define write_gc0_config5(val) __write_32bit_gc0_register($16, 5, val)
2240#define write_gc0_config6(val) __write_32bit_gc0_register($16, 6, val)
2241#define write_gc0_config7(val) __write_32bit_gc0_register($16, 7, val)
2242
2243#define read_gc0_lladdr() __read_ulong_gc0_register($17, 0)
2244#define write_gc0_lladdr(val) __write_ulong_gc0_register($17, 0, val)
2245
2246#define read_gc0_watchlo0() __read_ulong_gc0_register($18, 0)
2247#define read_gc0_watchlo1() __read_ulong_gc0_register($18, 1)
2248#define read_gc0_watchlo2() __read_ulong_gc0_register($18, 2)
2249#define read_gc0_watchlo3() __read_ulong_gc0_register($18, 3)
2250#define read_gc0_watchlo4() __read_ulong_gc0_register($18, 4)
2251#define read_gc0_watchlo5() __read_ulong_gc0_register($18, 5)
2252#define read_gc0_watchlo6() __read_ulong_gc0_register($18, 6)
2253#define read_gc0_watchlo7() __read_ulong_gc0_register($18, 7)
2254#define write_gc0_watchlo0(val) __write_ulong_gc0_register($18, 0, val)
2255#define write_gc0_watchlo1(val) __write_ulong_gc0_register($18, 1, val)
2256#define write_gc0_watchlo2(val) __write_ulong_gc0_register($18, 2, val)
2257#define write_gc0_watchlo3(val) __write_ulong_gc0_register($18, 3, val)
2258#define write_gc0_watchlo4(val) __write_ulong_gc0_register($18, 4, val)
2259#define write_gc0_watchlo5(val) __write_ulong_gc0_register($18, 5, val)
2260#define write_gc0_watchlo6(val) __write_ulong_gc0_register($18, 6, val)
2261#define write_gc0_watchlo7(val) __write_ulong_gc0_register($18, 7, val)
2262
2263#define read_gc0_watchhi0() __read_32bit_gc0_register($19, 0)
2264#define read_gc0_watchhi1() __read_32bit_gc0_register($19, 1)
2265#define read_gc0_watchhi2() __read_32bit_gc0_register($19, 2)
2266#define read_gc0_watchhi3() __read_32bit_gc0_register($19, 3)
2267#define read_gc0_watchhi4() __read_32bit_gc0_register($19, 4)
2268#define read_gc0_watchhi5() __read_32bit_gc0_register($19, 5)
2269#define read_gc0_watchhi6() __read_32bit_gc0_register($19, 6)
2270#define read_gc0_watchhi7() __read_32bit_gc0_register($19, 7)
2271#define write_gc0_watchhi0(val) __write_32bit_gc0_register($19, 0, val)
2272#define write_gc0_watchhi1(val) __write_32bit_gc0_register($19, 1, val)
2273#define write_gc0_watchhi2(val) __write_32bit_gc0_register($19, 2, val)
2274#define write_gc0_watchhi3(val) __write_32bit_gc0_register($19, 3, val)
2275#define write_gc0_watchhi4(val) __write_32bit_gc0_register($19, 4, val)
2276#define write_gc0_watchhi5(val) __write_32bit_gc0_register($19, 5, val)
2277#define write_gc0_watchhi6(val) __write_32bit_gc0_register($19, 6, val)
2278#define write_gc0_watchhi7(val) __write_32bit_gc0_register($19, 7, val)
2279
2280#define read_gc0_xcontext() __read_ulong_gc0_register($20, 0)
2281#define write_gc0_xcontext(val) __write_ulong_gc0_register($20, 0, val)
2282
2283#define read_gc0_perfctrl0() __read_32bit_gc0_register($25, 0)
2284#define write_gc0_perfctrl0(val) __write_32bit_gc0_register($25, 0, val)
2285#define read_gc0_perfcntr0() __read_32bit_gc0_register($25, 1)
2286#define write_gc0_perfcntr0(val) __write_32bit_gc0_register($25, 1, val)
2287#define read_gc0_perfcntr0_64() __read_64bit_gc0_register($25, 1)
2288#define write_gc0_perfcntr0_64(val) __write_64bit_gc0_register($25, 1, val)
2289#define read_gc0_perfctrl1() __read_32bit_gc0_register($25, 2)
2290#define write_gc0_perfctrl1(val) __write_32bit_gc0_register($25, 2, val)
2291#define read_gc0_perfcntr1() __read_32bit_gc0_register($25, 3)
2292#define write_gc0_perfcntr1(val) __write_32bit_gc0_register($25, 3, val)
2293#define read_gc0_perfcntr1_64() __read_64bit_gc0_register($25, 3)
2294#define write_gc0_perfcntr1_64(val) __write_64bit_gc0_register($25, 3, val)
2295#define read_gc0_perfctrl2() __read_32bit_gc0_register($25, 4)
2296#define write_gc0_perfctrl2(val) __write_32bit_gc0_register($25, 4, val)
2297#define read_gc0_perfcntr2() __read_32bit_gc0_register($25, 5)
2298#define write_gc0_perfcntr2(val) __write_32bit_gc0_register($25, 5, val)
2299#define read_gc0_perfcntr2_64() __read_64bit_gc0_register($25, 5)
2300#define write_gc0_perfcntr2_64(val) __write_64bit_gc0_register($25, 5, val)
2301#define read_gc0_perfctrl3() __read_32bit_gc0_register($25, 6)
2302#define write_gc0_perfctrl3(val) __write_32bit_gc0_register($25, 6, val)
2303#define read_gc0_perfcntr3() __read_32bit_gc0_register($25, 7)
2304#define write_gc0_perfcntr3(val) __write_32bit_gc0_register($25, 7, val)
2305#define read_gc0_perfcntr3_64() __read_64bit_gc0_register($25, 7)
2306#define write_gc0_perfcntr3_64(val) __write_64bit_gc0_register($25, 7, val)
2307
2308#define read_gc0_errorepc() __read_ulong_gc0_register($30, 0)
2309#define write_gc0_errorepc(val) __write_ulong_gc0_register($30, 0, val)
2310
2311#define read_gc0_kscratch1() __read_ulong_gc0_register($31, 2)
2312#define read_gc0_kscratch2() __read_ulong_gc0_register($31, 3)
2313#define read_gc0_kscratch3() __read_ulong_gc0_register($31, 4)
2314#define read_gc0_kscratch4() __read_ulong_gc0_register($31, 5)
2315#define read_gc0_kscratch5() __read_ulong_gc0_register($31, 6)
2316#define read_gc0_kscratch6() __read_ulong_gc0_register($31, 7)
2317#define write_gc0_kscratch1(val) __write_ulong_gc0_register($31, 2, val)
2318#define write_gc0_kscratch2(val) __write_ulong_gc0_register($31, 3, val)
2319#define write_gc0_kscratch3(val) __write_ulong_gc0_register($31, 4, val)
2320#define write_gc0_kscratch4(val) __write_ulong_gc0_register($31, 5, val)
2321#define write_gc0_kscratch5(val) __write_ulong_gc0_register($31, 6, val)
2322#define write_gc0_kscratch6(val) __write_ulong_gc0_register($31, 7, val)
2323
2324/* Cavium OCTEON (cnMIPS) */
2325#define read_gc0_cvmcount() __read_ulong_gc0_register($9, 6)
2326#define write_gc0_cvmcount(val) __write_ulong_gc0_register($9, 6, val)
2327
2328#define read_gc0_cvmctl() __read_64bit_gc0_register($9, 7)
2329#define write_gc0_cvmctl(val) __write_64bit_gc0_register($9, 7, val)
2330
2331#define read_gc0_cvmmemctl() __read_64bit_gc0_register($11, 7)
2332#define write_gc0_cvmmemctl(val) __write_64bit_gc0_register($11, 7, val)
2333
2334#define read_gc0_cvmmemctl2() __read_64bit_gc0_register($16, 6)
2335#define write_gc0_cvmmemctl2(val) __write_64bit_gc0_register($16, 6, val)
2336
2337/*
2338 * Macros to access the floating point coprocessor control registers
2339 */
2340#define _read_32bit_cp1_register(source, gas_hardfloat) \
2341({ \
2342 unsigned int __res; \
2343 \
2344 __asm__ __volatile__( \
2345 " .set push \n" \
2346 " .set reorder \n" \
2347 " # gas fails to assemble cfc1 for some archs, \n" \
2348 " # like Octeon. \n" \
2349 " .set mips1 \n" \
2350 " "STR(gas_hardfloat)" \n" \
2351 " cfc1 %0,"STR(source)" \n" \
2352 " .set pop \n" \
2353 : "=r" (__res)); \
2354 __res; \
2355})
2356
2357#define _write_32bit_cp1_register(dest, val, gas_hardfloat) \
2358do { \
2359 __asm__ __volatile__( \
2360 " .set push \n" \
2361 " .set reorder \n" \
2362 " "STR(gas_hardfloat)" \n" \
2363 " ctc1 %0,"STR(dest)" \n" \
2364 " .set pop \n" \
2365 : : "r" (val)); \
2366} while (0)
2367
2368#ifdef GAS_HAS_SET_HARDFLOAT
2369#define read_32bit_cp1_register(source) \
2370 _read_32bit_cp1_register(source, .set hardfloat)
2371#define write_32bit_cp1_register(dest, val) \
2372 _write_32bit_cp1_register(dest, val, .set hardfloat)
2373#else
2374#define read_32bit_cp1_register(source) \
2375 _read_32bit_cp1_register(source, )
2376#define write_32bit_cp1_register(dest, val) \
2377 _write_32bit_cp1_register(dest, val, )
2378#endif
2379
2380#ifdef TOOLCHAIN_SUPPORTS_DSP
2381#define rddsp(mask) \
2382({ \
2383 unsigned int __dspctl; \
2384 \
2385 __asm__ __volatile__( \
2386 " .set push \n" \
2387 " .set " MIPS_ISA_LEVEL " \n" \
2388 " .set dsp \n" \
2389 " rddsp %0, %x1 \n" \
2390 " .set pop \n" \
2391 : "=r" (__dspctl) \
2392 : "i" (mask)); \
2393 __dspctl; \
2394})
2395
2396#define wrdsp(val, mask) \
2397do { \
2398 __asm__ __volatile__( \
2399 " .set push \n" \
2400 " .set " MIPS_ISA_LEVEL " \n" \
2401 " .set dsp \n" \
2402 " wrdsp %0, %x1 \n" \
2403 " .set pop \n" \
2404 : \
2405 : "r" (val), "i" (mask)); \
2406} while (0)
2407
2408#define mflo0() \
2409({ \
2410 long mflo0; \
2411 __asm__( \
2412 " .set push \n" \
2413 " .set " MIPS_ISA_LEVEL " \n" \
2414 " .set dsp \n" \
2415 " mflo %0, $ac0 \n" \
2416 " .set pop \n" \
2417 : "=r" (mflo0)); \
2418 mflo0; \
2419})
2420
2421#define mflo1() \
2422({ \
2423 long mflo1; \
2424 __asm__( \
2425 " .set push \n" \
2426 " .set " MIPS_ISA_LEVEL " \n" \
2427 " .set dsp \n" \
2428 " mflo %0, $ac1 \n" \
2429 " .set pop \n" \
2430 : "=r" (mflo1)); \
2431 mflo1; \
2432})
2433
2434#define mflo2() \
2435({ \
2436 long mflo2; \
2437 __asm__( \
2438 " .set push \n" \
2439 " .set " MIPS_ISA_LEVEL " \n" \
2440 " .set dsp \n" \
2441 " mflo %0, $ac2 \n" \
2442 " .set pop \n" \
2443 : "=r" (mflo2)); \
2444 mflo2; \
2445})
2446
2447#define mflo3() \
2448({ \
2449 long mflo3; \
2450 __asm__( \
2451 " .set push \n" \
2452 " .set " MIPS_ISA_LEVEL " \n" \
2453 " .set dsp \n" \
2454 " mflo %0, $ac3 \n" \
2455 " .set pop \n" \
2456 : "=r" (mflo3)); \
2457 mflo3; \
2458})
2459
2460#define mfhi0() \
2461({ \
2462 long mfhi0; \
2463 __asm__( \
2464 " .set push \n" \
2465 " .set " MIPS_ISA_LEVEL " \n" \
2466 " .set dsp \n" \
2467 " mfhi %0, $ac0 \n" \
2468 " .set pop \n" \
2469 : "=r" (mfhi0)); \
2470 mfhi0; \
2471})
2472
2473#define mfhi1() \
2474({ \
2475 long mfhi1; \
2476 __asm__( \
2477 " .set push \n" \
2478 " .set " MIPS_ISA_LEVEL " \n" \
2479 " .set dsp \n" \
2480 " mfhi %0, $ac1 \n" \
2481 " .set pop \n" \
2482 : "=r" (mfhi1)); \
2483 mfhi1; \
2484})
2485
2486#define mfhi2() \
2487({ \
2488 long mfhi2; \
2489 __asm__( \
2490 " .set push \n" \
2491 " .set " MIPS_ISA_LEVEL " \n" \
2492 " .set dsp \n" \
2493 " mfhi %0, $ac2 \n" \
2494 " .set pop \n" \
2495 : "=r" (mfhi2)); \
2496 mfhi2; \
2497})
2498
2499#define mfhi3() \
2500({ \
2501 long mfhi3; \
2502 __asm__( \
2503 " .set push \n" \
2504 " .set " MIPS_ISA_LEVEL " \n" \
2505 " .set dsp \n" \
2506 " mfhi %0, $ac3 \n" \
2507 " .set pop \n" \
2508 : "=r" (mfhi3)); \
2509 mfhi3; \
2510})
2511
2512
2513#define mtlo0(x) \
2514({ \
2515 __asm__( \
2516 " .set push \n" \
2517 " .set " MIPS_ISA_LEVEL " \n" \
2518 " .set dsp \n" \
2519 " mtlo %0, $ac0 \n" \
2520 " .set pop \n" \
2521 : \
2522 : "r" (x)); \
2523})
2524
2525#define mtlo1(x) \
2526({ \
2527 __asm__( \
2528 " .set push \n" \
2529 " .set " MIPS_ISA_LEVEL " \n" \
2530 " .set dsp \n" \
2531 " mtlo %0, $ac1 \n" \
2532 " .set pop \n" \
2533 : \
2534 : "r" (x)); \
2535})
2536
2537#define mtlo2(x) \
2538({ \
2539 __asm__( \
2540 " .set push \n" \
2541 " .set " MIPS_ISA_LEVEL " \n" \
2542 " .set dsp \n" \
2543 " mtlo %0, $ac2 \n" \
2544 " .set pop \n" \
2545 : \
2546 : "r" (x)); \
2547})
2548
2549#define mtlo3(x) \
2550({ \
2551 __asm__( \
2552 " .set push \n" \
2553 " .set " MIPS_ISA_LEVEL " \n" \
2554 " .set dsp \n" \
2555 " mtlo %0, $ac3 \n" \
2556 " .set pop \n" \
2557 : \
2558 : "r" (x)); \
2559})
2560
2561#define mthi0(x) \
2562({ \
2563 __asm__( \
2564 " .set push \n" \
2565 " .set " MIPS_ISA_LEVEL " \n" \
2566 " .set dsp \n" \
2567 " mthi %0, $ac0 \n" \
2568 " .set pop \n" \
2569 : \
2570 : "r" (x)); \
2571})
2572
2573#define mthi1(x) \
2574({ \
2575 __asm__( \
2576 " .set push \n" \
2577 " .set " MIPS_ISA_LEVEL " \n" \
2578 " .set dsp \n" \
2579 " mthi %0, $ac1 \n" \
2580 " .set pop \n" \
2581 : \
2582 : "r" (x)); \
2583})
2584
2585#define mthi2(x) \
2586({ \
2587 __asm__( \
2588 " .set push \n" \
2589 " .set " MIPS_ISA_LEVEL " \n" \
2590 " .set dsp \n" \
2591 " mthi %0, $ac2 \n" \
2592 " .set pop \n" \
2593 : \
2594 : "r" (x)); \
2595})
2596
2597#define mthi3(x) \
2598({ \
2599 __asm__( \
2600 " .set push \n" \
2601 " .set " MIPS_ISA_LEVEL " \n" \
2602 " .set dsp \n" \
2603 " mthi %0, $ac3 \n" \
2604 " .set pop \n" \
2605 : \
2606 : "r" (x)); \
2607})
2608
2609#else
2610
2611#define rddsp(mask) \
2612({ \
2613 unsigned int __res; \
2614 \
2615 __asm__ __volatile__( \
2616 " .set push \n" \
2617 " .set noat \n" \
2618 " # rddsp $1, %x1 \n" \
2619 _ASM_INSN_IF_MIPS(0x7c000cb8 | (%x1 << 16)) \
2620 _ASM_INSN32_IF_MM(0x0020067c | (%x1 << 14)) \
2621 " move %0, $1 \n" \
2622 " .set pop \n" \
2623 : "=r" (__res) \
2624 : "i" (mask)); \
2625 __res; \
2626})
2627
2628#define wrdsp(val, mask) \
2629do { \
2630 __asm__ __volatile__( \
2631 " .set push \n" \
2632 " .set noat \n" \
2633 " move $1, %0 \n" \
2634 " # wrdsp $1, %x1 \n" \
2635 _ASM_INSN_IF_MIPS(0x7c2004f8 | (%x1 << 11)) \
2636 _ASM_INSN32_IF_MM(0x0020167c | (%x1 << 14)) \
2637 " .set pop \n" \
2638 : \
2639 : "r" (val), "i" (mask)); \
2640} while (0)
2641
2642#define _dsp_mfxxx(ins) \
2643({ \
2644 unsigned long __treg; \
2645 \
2646 __asm__ __volatile__( \
2647 " .set push \n" \
2648 " .set noat \n" \
2649 _ASM_INSN_IF_MIPS(0x00000810 | %X1) \
2650 _ASM_INSN32_IF_MM(0x0001007c | %x1) \
2651 " move %0, $1 \n" \
2652 " .set pop \n" \
2653 : "=r" (__treg) \
2654 : "i" (ins)); \
2655 __treg; \
2656})
2657
2658#define _dsp_mtxxx(val, ins) \
2659do { \
2660 __asm__ __volatile__( \
2661 " .set push \n" \
2662 " .set noat \n" \
2663 " move $1, %0 \n" \
2664 _ASM_INSN_IF_MIPS(0x00200011 | %X1) \
2665 _ASM_INSN32_IF_MM(0x0001207c | %x1) \
2666 " .set pop \n" \
2667 : \
2668 : "r" (val), "i" (ins)); \
2669} while (0)
2670
2671#ifdef CONFIG_CPU_MICROMIPS
2672
2673#define _dsp_mflo(reg) _dsp_mfxxx((reg << 14) | 0x1000)
2674#define _dsp_mfhi(reg) _dsp_mfxxx((reg << 14) | 0x0000)
2675
2676#define _dsp_mtlo(val, reg) _dsp_mtxxx(val, ((reg << 14) | 0x1000))
2677#define _dsp_mthi(val, reg) _dsp_mtxxx(val, ((reg << 14) | 0x0000))
2678
2679#else /* !CONFIG_CPU_MICROMIPS */
2680
2681#define _dsp_mflo(reg) _dsp_mfxxx((reg << 21) | 0x0002)
2682#define _dsp_mfhi(reg) _dsp_mfxxx((reg << 21) | 0x0000)
2683
2684#define _dsp_mtlo(val, reg) _dsp_mtxxx(val, ((reg << 11) | 0x0002))
2685#define _dsp_mthi(val, reg) _dsp_mtxxx(val, ((reg << 11) | 0x0000))
2686
2687#endif /* CONFIG_CPU_MICROMIPS */
2688
2689#define mflo0() _dsp_mflo(0)
2690#define mflo1() _dsp_mflo(1)
2691#define mflo2() _dsp_mflo(2)
2692#define mflo3() _dsp_mflo(3)
2693
2694#define mfhi0() _dsp_mfhi(0)
2695#define mfhi1() _dsp_mfhi(1)
2696#define mfhi2() _dsp_mfhi(2)
2697#define mfhi3() _dsp_mfhi(3)
2698
2699#define mtlo0(x) _dsp_mtlo(x, 0)
2700#define mtlo1(x) _dsp_mtlo(x, 1)
2701#define mtlo2(x) _dsp_mtlo(x, 2)
2702#define mtlo3(x) _dsp_mtlo(x, 3)
2703
2704#define mthi0(x) _dsp_mthi(x, 0)
2705#define mthi1(x) _dsp_mthi(x, 1)
2706#define mthi2(x) _dsp_mthi(x, 2)
2707#define mthi3(x) _dsp_mthi(x, 3)
2708
2709#endif
2710
2711/*
2712 * TLB operations.
2713 *
2714 * It is responsibility of the caller to take care of any TLB hazards.
2715 */
2716static inline void tlb_probe(void)
2717{
2718 __asm__ __volatile__(
2719 ".set noreorder\n\t"
2720 "tlbp\n\t"
2721 ".set reorder");
2722}
2723
2724static inline void tlb_read(void)
2725{
2726#ifdef CONFIG_WAR_MIPS34K_MISSED_ITLB
2727 int res = 0;
2728
2729 __asm__ __volatile__(
2730 " .set push \n"
2731 " .set noreorder \n"
2732 " .set noat \n"
2733 " .set mips32r2 \n"
2734 " .word 0x41610001 # dvpe $1 \n"
2735 " move %0, $1 \n"
2736 " ehb \n"
2737 " .set pop \n"
2738 : "=r" (res));
2739
2740 instruction_hazard();
2741#endif
2742
2743 __asm__ __volatile__(
2744 ".set noreorder\n\t"
2745 "tlbr\n\t"
2746 ".set reorder");
2747
2748#ifdef CONFIG_WAR_MIPS34K_MISSED_ITLB
2749 if ((res & _ULCAST_(1)))
2750 __asm__ __volatile__(
2751 " .set push \n"
2752 " .set noreorder \n"
2753 " .set noat \n"
2754 " .set mips32r2 \n"
2755 " .word 0x41600021 # evpe \n"
2756 " ehb \n"
2757 " .set pop \n");
2758#endif
2759}
2760
2761static inline void tlb_write_indexed(void)
2762{
2763 __asm__ __volatile__(
2764 ".set noreorder\n\t"
2765 "tlbwi\n\t"
2766 ".set reorder");
2767}
2768
2769static inline void tlb_write_random(void)
2770{
2771 __asm__ __volatile__(
2772 ".set noreorder\n\t"
2773 "tlbwr\n\t"
2774 ".set reorder");
2775}
2776
2777/*
2778 * Guest TLB operations.
2779 *
2780 * It is responsibility of the caller to take care of any TLB hazards.
2781 */
2782static inline void guest_tlb_probe(void)
2783{
2784 __asm__ __volatile__(
2785 ".set push\n\t"
2786 ".set noreorder\n\t"
2787 _ASM_SET_VIRT
2788 "tlbgp\n\t"
2789 ".set pop");
2790}
2791
2792static inline void guest_tlb_read(void)
2793{
2794 __asm__ __volatile__(
2795 ".set push\n\t"
2796 ".set noreorder\n\t"
2797 _ASM_SET_VIRT
2798 "tlbgr\n\t"
2799 ".set pop");
2800}
2801
2802static inline void guest_tlb_write_indexed(void)
2803{
2804 __asm__ __volatile__(
2805 ".set push\n\t"
2806 ".set noreorder\n\t"
2807 _ASM_SET_VIRT
2808 "tlbgwi\n\t"
2809 ".set pop");
2810}
2811
2812static inline void guest_tlb_write_random(void)
2813{
2814 __asm__ __volatile__(
2815 ".set push\n\t"
2816 ".set noreorder\n\t"
2817 _ASM_SET_VIRT
2818 "tlbgwr\n\t"
2819 ".set pop");
2820}
2821
2822/*
2823 * Guest TLB Invalidate Flush
2824 */
2825static inline void guest_tlbinvf(void)
2826{
2827 __asm__ __volatile__(
2828 ".set push\n\t"
2829 ".set noreorder\n\t"
2830 _ASM_SET_VIRT
2831 "tlbginvf\n\t"
2832 ".set pop");
2833}
2834
2835/*
2836 * Manipulate bits in a register.
2837 */
2838#define __BUILD_SET_COMMON(name) \
2839static inline unsigned int \
2840set_##name(unsigned int set) \
2841{ \
2842 unsigned int res, new; \
2843 \
2844 res = read_##name(); \
2845 new = res | set; \
2846 write_##name(new); \
2847 \
2848 return res; \
2849} \
2850 \
2851static inline unsigned int \
2852clear_##name(unsigned int clear) \
2853{ \
2854 unsigned int res, new; \
2855 \
2856 res = read_##name(); \
2857 new = res & ~clear; \
2858 write_##name(new); \
2859 \
2860 return res; \
2861} \
2862 \
2863static inline unsigned int \
2864change_##name(unsigned int change, unsigned int val) \
2865{ \
2866 unsigned int res, new; \
2867 \
2868 res = read_##name(); \
2869 new = res & ~change; \
2870 new |= (val & change); \
2871 write_##name(new); \
2872 \
2873 return res; \
2874}
2875
2876/*
2877 * Manipulate bits in a c0 register.
2878 */
2879#define __BUILD_SET_C0(name) __BUILD_SET_COMMON(c0_##name)
2880
2881__BUILD_SET_C0(status)
2882__BUILD_SET_C0(cause)
2883__BUILD_SET_C0(config)
2884__BUILD_SET_C0(config5)
2885__BUILD_SET_C0(config6)
2886__BUILD_SET_C0(config7)
2887__BUILD_SET_C0(diag)
2888__BUILD_SET_C0(intcontrol)
2889__BUILD_SET_C0(intctl)
2890__BUILD_SET_C0(srsmap)
2891__BUILD_SET_C0(pagegrain)
2892__BUILD_SET_C0(guestctl0)
2893__BUILD_SET_C0(guestctl0ext)
2894__BUILD_SET_C0(guestctl1)
2895__BUILD_SET_C0(guestctl2)
2896__BUILD_SET_C0(guestctl3)
2897__BUILD_SET_C0(brcm_config_0)
2898__BUILD_SET_C0(brcm_bus_pll)
2899__BUILD_SET_C0(brcm_reset)
2900__BUILD_SET_C0(brcm_cmt_intr)
2901__BUILD_SET_C0(brcm_cmt_ctrl)
2902__BUILD_SET_C0(brcm_config)
2903__BUILD_SET_C0(brcm_mode)
2904
2905/*
2906 * Manipulate bits in a guest c0 register.
2907 */
2908#define __BUILD_SET_GC0(name) __BUILD_SET_COMMON(gc0_##name)
2909
2910__BUILD_SET_GC0(wired)
2911__BUILD_SET_GC0(status)
2912__BUILD_SET_GC0(cause)
2913__BUILD_SET_GC0(ebase)
2914__BUILD_SET_GC0(config1)
2915
2916/*
2917 * Return low 10 bits of ebase.
2918 * Note that under KVM (MIPSVZ) this returns vcpu id.
2919 */
2920static inline unsigned int get_ebase_cpunum(void)
2921{
2922 return read_c0_ebase() & MIPS_EBASE_CPUNUM;
2923}
2924
2925#endif /* !__ASSEMBLY__ */
2926
2927#endif /* _ASM_MIPSREGS_H */
diff --git a/arch/mips/include/asm/mmiowb.h b/arch/mips/include/asm/mmiowb.h
new file mode 100644
index 000000000..a40824e3e
--- /dev/null
+++ b/arch/mips/include/asm/mmiowb.h
@@ -0,0 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_MMIOWB_H
3#define _ASM_MMIOWB_H
4
5#include <asm/io.h>
6
7#define mmiowb() iobarrier_w()
8
9#include <asm-generic/mmiowb.h>
10
11#endif /* _ASM_MMIOWB_H */
diff --git a/arch/mips/include/asm/mmu.h b/arch/mips/include/asm/mmu.h
new file mode 100644
index 000000000..5df0238f6
--- /dev/null
+++ b/arch/mips/include/asm/mmu.h
@@ -0,0 +1,25 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_MMU_H
3#define __ASM_MMU_H
4
5#include <linux/atomic.h>
6#include <linux/spinlock.h>
7#include <linux/wait.h>
8
9typedef struct {
10 union {
11 u64 asid[NR_CPUS];
12 atomic64_t mmid;
13 };
14
15 void *vdso;
16
17 /* lock to be held whilst modifying fp_bd_emupage_allocmap */
18 spinlock_t bd_emupage_lock;
19 /* bitmap tracking allocation of fp_bd_emupage */
20 unsigned long *bd_emupage_allocmap;
21 /* wait queue for threads requiring an emuframe */
22 wait_queue_head_t bd_emupage_queue;
23} mm_context_t;
24
25#endif /* __ASM_MMU_H */
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
new file mode 100644
index 000000000..cddead91a
--- /dev/null
+++ b/arch/mips/include/asm/mmu_context.h
@@ -0,0 +1,240 @@
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/errno.h>
15#include <linux/sched.h>
16#include <linux/mm_types.h>
17#include <linux/smp.h>
18#include <linux/slab.h>
19
20#include <asm/barrier.h>
21#include <asm/cacheflush.h>
22#include <asm/dsemul.h>
23#include <asm/ginvt.h>
24#include <asm/hazards.h>
25#include <asm/tlbflush.h>
26#include <asm-generic/mm_hooks.h>
27
28#define htw_set_pwbase(pgd) \
29do { \
30 if (cpu_has_htw) { \
31 write_c0_pwbase(pgd); \
32 back_to_back_c0_hazard(); \
33 } \
34} while (0)
35
36extern void tlbmiss_handler_setup_pgd(unsigned long);
37extern char tlbmiss_handler_setup_pgd_end[];
38
39/* Note: This is also implemented with uasm in arch/mips/kvm/entry.c */
40#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
41do { \
42 tlbmiss_handler_setup_pgd((unsigned long)(pgd)); \
43 htw_set_pwbase((unsigned long)pgd); \
44} while (0)
45
46#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
47
48#define TLBMISS_HANDLER_RESTORE() \
49 write_c0_xcontext((unsigned long) smp_processor_id() << \
50 SMP_CPUID_REGSHIFT)
51
52#define TLBMISS_HANDLER_SETUP() \
53 do { \
54 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir); \
55 TLBMISS_HANDLER_RESTORE(); \
56 } while (0)
57
58#else /* !CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/
59
60/*
61 * For the fast tlb miss handlers, we keep a per cpu array of pointers
62 * to the current pgd for each processor. Also, the proc. id is stuffed
63 * into the context register.
64 */
65extern unsigned long pgd_current[];
66
67#define TLBMISS_HANDLER_RESTORE() \
68 write_c0_context((unsigned long) smp_processor_id() << \
69 SMP_CPUID_REGSHIFT)
70
71#define TLBMISS_HANDLER_SETUP() \
72 TLBMISS_HANDLER_RESTORE(); \
73 back_to_back_c0_hazard(); \
74 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
75#endif /* CONFIG_MIPS_PGD_C0_CONTEXT*/
76
77/*
78 * The ginvt instruction will invalidate wired entries when its type field
79 * targets anything other than the entire TLB. That means that if we were to
80 * allow the kernel to create wired entries with the MMID of current->active_mm
81 * then those wired entries could be invalidated when we later use ginvt to
82 * invalidate TLB entries with that MMID.
83 *
84 * In order to prevent ginvt from trashing wired entries, we reserve one MMID
85 * for use by the kernel when creating wired entries. This MMID will never be
86 * assigned to a struct mm, and we'll never target it with a ginvt instruction.
87 */
88#define MMID_KERNEL_WIRED 0
89
90/*
91 * All unused by hardware upper bits will be considered
92 * as a software asid extension.
93 */
94static inline u64 asid_version_mask(unsigned int cpu)
95{
96 unsigned long asid_mask = cpu_asid_mask(&cpu_data[cpu]);
97
98 return ~(u64)(asid_mask | (asid_mask - 1));
99}
100
101static inline u64 asid_first_version(unsigned int cpu)
102{
103 return ~asid_version_mask(cpu) + 1;
104}
105
106static inline u64 cpu_context(unsigned int cpu, const struct mm_struct *mm)
107{
108 if (cpu_has_mmid)
109 return atomic64_read(&mm->context.mmid);
110
111 return mm->context.asid[cpu];
112}
113
114static inline void set_cpu_context(unsigned int cpu,
115 struct mm_struct *mm, u64 ctx)
116{
117 if (cpu_has_mmid)
118 atomic64_set(&mm->context.mmid, ctx);
119 else
120 mm->context.asid[cpu] = ctx;
121}
122
123#define asid_cache(cpu) (cpu_data[cpu].asid_cache)
124#define cpu_asid(cpu, mm) \
125 (cpu_context((cpu), (mm)) & cpu_asid_mask(&cpu_data[cpu]))
126
127static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
128{
129}
130
131extern void get_new_mmu_context(struct mm_struct *mm);
132extern void check_mmu_context(struct mm_struct *mm);
133extern void check_switch_mmu_context(struct mm_struct *mm);
134
135/*
136 * Initialize the context related info for a new mm_struct
137 * instance.
138 */
139static inline int
140init_new_context(struct task_struct *tsk, struct mm_struct *mm)
141{
142 int i;
143
144 if (cpu_has_mmid) {
145 set_cpu_context(0, mm, 0);
146 } else {
147 for_each_possible_cpu(i)
148 set_cpu_context(i, mm, 0);
149 }
150
151 mm->context.bd_emupage_allocmap = NULL;
152 spin_lock_init(&mm->context.bd_emupage_lock);
153 init_waitqueue_head(&mm->context.bd_emupage_queue);
154
155 return 0;
156}
157
158static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
159 struct task_struct *tsk)
160{
161 unsigned int cpu = smp_processor_id();
162 unsigned long flags;
163 local_irq_save(flags);
164
165 htw_stop();
166 check_switch_mmu_context(next);
167
168 /*
169 * Mark current->active_mm as not "active" anymore.
170 * We don't want to mislead possible IPI tlb flush routines.
171 */
172 cpumask_clear_cpu(cpu, mm_cpumask(prev));
173 cpumask_set_cpu(cpu, mm_cpumask(next));
174 htw_start();
175
176 local_irq_restore(flags);
177}
178
179/*
180 * Destroy context related info for an mm_struct that is about
181 * to be put to rest.
182 */
183static inline void destroy_context(struct mm_struct *mm)
184{
185 dsemul_mm_cleanup(mm);
186}
187
188#define activate_mm(prev, next) switch_mm(prev, next, current)
189#define deactivate_mm(tsk, mm) do { } while (0)
190
191static inline void
192drop_mmu_context(struct mm_struct *mm)
193{
194 unsigned long flags;
195 unsigned int cpu;
196 u32 old_mmid;
197 u64 ctx;
198
199 local_irq_save(flags);
200
201 cpu = smp_processor_id();
202 ctx = cpu_context(cpu, mm);
203
204 if (!ctx) {
205 /* no-op */
206 } else if (cpu_has_mmid) {
207 /*
208 * Globally invalidating TLB entries associated with the MMID
209 * is pretty cheap using the GINVT instruction, so we'll do
210 * that rather than incur the overhead of allocating a new
211 * MMID. The latter would be especially difficult since MMIDs
212 * are global & other CPUs may be actively using ctx.
213 */
214 htw_stop();
215 old_mmid = read_c0_memorymapid();
216 write_c0_memorymapid(ctx & cpu_asid_mask(&cpu_data[cpu]));
217 mtc0_tlbw_hazard();
218 ginvt_mmid();
219 sync_ginv();
220 write_c0_memorymapid(old_mmid);
221 instruction_hazard();
222 htw_start();
223 } else if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
224 /*
225 * mm is currently active, so we can't really drop it.
226 * Instead we bump the ASID.
227 */
228 htw_stop();
229 get_new_mmu_context(mm);
230 write_c0_entryhi(cpu_asid(cpu, mm));
231 htw_start();
232 } else {
233 /* will get a new context next time */
234 set_cpu_context(cpu, mm, 0);
235 }
236
237 local_irq_restore(flags);
238}
239
240#endif /* _ASM_MMU_CONTEXT_H */
diff --git a/arch/mips/include/asm/mmzone.h b/arch/mips/include/asm/mmzone.h
new file mode 100644
index 000000000..b826b8473
--- /dev/null
+++ b/arch/mips/include/asm/mmzone.h
@@ -0,0 +1,29 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99
4 * Rewritten for Linux 2.6 by Christoph Hellwig (hch@lst.de) Jan 2004
5 */
6#ifndef _ASM_MMZONE_H_
7#define _ASM_MMZONE_H_
8
9#include <asm/page.h>
10
11#ifdef CONFIG_NEED_MULTIPLE_NODES
12# include <mmzone.h>
13#endif
14
15#ifndef pa_to_nid
16#define pa_to_nid(addr) 0
17#endif
18
19#ifndef nid_to_addrbase
20#define nid_to_addrbase(nid) 0
21#endif
22
23#ifdef CONFIG_DISCONTIGMEM
24
25#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT)
26
27#endif /* CONFIG_DISCONTIGMEM */
28
29#endif /* _ASM_MMZONE_H_ */
diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h
new file mode 100644
index 000000000..724a08825
--- /dev/null
+++ b/arch/mips/include/asm/module.h
@@ -0,0 +1,86 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_MODULE_H
3#define _ASM_MODULE_H
4
5#include <linux/list.h>
6#include <linux/elf.h>
7#include <asm/extable.h>
8
9struct mod_arch_specific {
10 /* Data Bus Error exception tables */
11 struct list_head dbe_list;
12 const struct exception_table_entry *dbe_start;
13 const struct exception_table_entry *dbe_end;
14 struct mips_hi16 *r_mips_hi16_list;
15};
16
17typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
18
19typedef struct {
20 Elf64_Addr r_offset; /* Address of relocation. */
21 Elf64_Word r_sym; /* Symbol index. */
22 Elf64_Byte r_ssym; /* Special symbol. */
23 Elf64_Byte r_type3; /* Third relocation. */
24 Elf64_Byte r_type2; /* Second relocation. */
25 Elf64_Byte r_type; /* First relocation. */
26} Elf64_Mips_Rel;
27
28typedef struct {
29 Elf64_Addr r_offset; /* Address of relocation. */
30 Elf64_Word r_sym; /* Symbol index. */
31 Elf64_Byte r_ssym; /* Special symbol. */
32 Elf64_Byte r_type3; /* Third relocation. */
33 Elf64_Byte r_type2; /* Second relocation. */
34 Elf64_Byte r_type; /* First relocation. */
35 Elf64_Sxword r_addend; /* Addend. */
36} Elf64_Mips_Rela;
37
38#ifdef CONFIG_32BIT
39#define Elf_Shdr Elf32_Shdr
40#define Elf_Sym Elf32_Sym
41#define Elf_Ehdr Elf32_Ehdr
42#define Elf_Addr Elf32_Addr
43#define Elf_Rel Elf32_Rel
44#define Elf_Rela Elf32_Rela
45#define ELF_R_TYPE(X) ELF32_R_TYPE(X)
46#define ELF_R_SYM(X) ELF32_R_SYM(X)
47
48#define Elf_Mips_Rel Elf32_Rel
49#define Elf_Mips_Rela Elf32_Rela
50
51#define ELF_MIPS_R_SYM(rel) ELF32_R_SYM((rel).r_info)
52#define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE((rel).r_info)
53
54#endif
55
56#ifdef CONFIG_64BIT
57#define Elf_Shdr Elf64_Shdr
58#define Elf_Sym Elf64_Sym
59#define Elf_Ehdr Elf64_Ehdr
60#define Elf_Addr Elf64_Addr
61#define Elf_Rel Elf64_Rel
62#define Elf_Rela Elf64_Rela
63#define ELF_R_TYPE(X) ELF64_R_TYPE(X)
64#define ELF_R_SYM(X) ELF64_R_SYM(X)
65
66#define Elf_Mips_Rel Elf64_Mips_Rel
67#define Elf_Mips_Rela Elf64_Mips_Rela
68
69#define ELF_MIPS_R_SYM(rel) ((rel).r_sym)
70#define ELF_MIPS_R_TYPE(rel) ((rel).r_type)
71
72#endif
73
74#ifdef CONFIG_MODULES
75/* Given an address, look for it in the exception tables. */
76const struct exception_table_entry*search_module_dbetables(unsigned long addr);
77#else
78/* Given an address, look for it in the exception tables. */
79static inline const struct exception_table_entry *
80search_module_dbetables(unsigned long addr)
81{
82 return NULL;
83}
84#endif
85
86#endif /* _ASM_MODULE_H */
diff --git a/arch/mips/include/asm/msa.h b/arch/mips/include/asm/msa.h
new file mode 100644
index 000000000..e0a3dd523
--- /dev/null
+++ b/arch/mips/include/asm/msa.h
@@ -0,0 +1,278 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2013 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6#ifndef _ASM_MSA_H
7#define _ASM_MSA_H
8
9#include <asm/mipsregs.h>
10
11#ifndef __ASSEMBLY__
12
13#include <asm/inst.h>
14
15extern void _save_msa(struct task_struct *);
16extern void _restore_msa(struct task_struct *);
17extern void _init_msa_upper(void);
18
19extern void read_msa_wr_b(unsigned idx, union fpureg *to);
20extern void read_msa_wr_h(unsigned idx, union fpureg *to);
21extern void read_msa_wr_w(unsigned idx, union fpureg *to);
22extern void read_msa_wr_d(unsigned idx, union fpureg *to);
23
24/**
25 * read_msa_wr() - Read a single MSA vector register
26 * @idx: The index of the vector register to read
27 * @to: The FPU register union to store the registers value in
28 * @fmt: The format of the data in the vector register
29 *
30 * Read the value of MSA vector register idx into the FPU register
31 * union to, using the format fmt.
32 */
33static inline void read_msa_wr(unsigned idx, union fpureg *to,
34 enum msa_2b_fmt fmt)
35{
36 switch (fmt) {
37 case msa_fmt_b:
38 read_msa_wr_b(idx, to);
39 break;
40
41 case msa_fmt_h:
42 read_msa_wr_h(idx, to);
43 break;
44
45 case msa_fmt_w:
46 read_msa_wr_w(idx, to);
47 break;
48
49 case msa_fmt_d:
50 read_msa_wr_d(idx, to);
51 break;
52
53 default:
54 BUG();
55 }
56}
57
58extern void write_msa_wr_b(unsigned idx, union fpureg *from);
59extern void write_msa_wr_h(unsigned idx, union fpureg *from);
60extern void write_msa_wr_w(unsigned idx, union fpureg *from);
61extern void write_msa_wr_d(unsigned idx, union fpureg *from);
62
63/**
64 * write_msa_wr() - Write a single MSA vector register
65 * @idx: The index of the vector register to write
66 * @from: The FPU register union to take the registers value from
67 * @fmt: The format of the data in the vector register
68 *
69 * Write the value from the FPU register union from into MSA vector
70 * register idx, using the format fmt.
71 */
72static inline void write_msa_wr(unsigned idx, union fpureg *from,
73 enum msa_2b_fmt fmt)
74{
75 switch (fmt) {
76 case msa_fmt_b:
77 write_msa_wr_b(idx, from);
78 break;
79
80 case msa_fmt_h:
81 write_msa_wr_h(idx, from);
82 break;
83
84 case msa_fmt_w:
85 write_msa_wr_w(idx, from);
86 break;
87
88 case msa_fmt_d:
89 write_msa_wr_d(idx, from);
90 break;
91
92 default:
93 BUG();
94 }
95}
96
97static inline void enable_msa(void)
98{
99 if (cpu_has_msa) {
100 set_c0_config5(MIPS_CONF5_MSAEN);
101 enable_fpu_hazard();
102 }
103}
104
105static inline void disable_msa(void)
106{
107 if (cpu_has_msa) {
108 clear_c0_config5(MIPS_CONF5_MSAEN);
109 disable_fpu_hazard();
110 }
111}
112
113static inline int is_msa_enabled(void)
114{
115 if (!cpu_has_msa)
116 return 0;
117
118 return read_c0_config5() & MIPS_CONF5_MSAEN;
119}
120
121static inline int thread_msa_context_live(void)
122{
123 /*
124 * Check cpu_has_msa only if it's a constant. This will allow the
125 * compiler to optimise out code for CPUs without MSA without adding
126 * an extra redundant check for CPUs with MSA.
127 */
128 if (__builtin_constant_p(cpu_has_msa) && !cpu_has_msa)
129 return 0;
130
131 return test_thread_flag(TIF_MSA_CTX_LIVE);
132}
133
134static inline void save_msa(struct task_struct *t)
135{
136 if (cpu_has_msa)
137 _save_msa(t);
138}
139
140static inline void restore_msa(struct task_struct *t)
141{
142 if (cpu_has_msa)
143 _restore_msa(t);
144}
145
146static inline void init_msa_upper(void)
147{
148 /*
149 * Check cpu_has_msa only if it's a constant. This will allow the
150 * compiler to optimise out code for CPUs without MSA without adding
151 * an extra redundant check for CPUs with MSA.
152 */
153 if (__builtin_constant_p(cpu_has_msa) && !cpu_has_msa)
154 return;
155
156 _init_msa_upper();
157}
158
159#ifndef TOOLCHAIN_SUPPORTS_MSA
160/*
161 * Define assembler macros using .word for the c[ft]cmsa instructions in order
162 * to allow compilation with toolchains that do not support MSA. Once all
163 * toolchains in use support MSA these can be removed.
164 */
165_ASM_MACRO_2R(cfcmsa, rd, cs,
166 _ASM_INSN_IF_MIPS(0x787e0019 | __cs << 11 | __rd << 6)
167 _ASM_INSN32_IF_MM(0x587e0016 | __cs << 11 | __rd << 6));
168_ASM_MACRO_2R(ctcmsa, cd, rs,
169 _ASM_INSN_IF_MIPS(0x783e0019 | __rs << 11 | __cd << 6)
170 _ASM_INSN32_IF_MM(0x583e0016 | __rs << 11 | __cd << 6));
171#define _ASM_SET_MSA ""
172#else /* TOOLCHAIN_SUPPORTS_MSA */
173#define _ASM_SET_MSA ".set\tfp=64\n\t" \
174 ".set\tmsa\n\t"
175#endif
176
177#define __BUILD_MSA_CTL_REG(name, cs) \
178static inline unsigned int read_msa_##name(void) \
179{ \
180 unsigned int reg; \
181 __asm__ __volatile__( \
182 " .set push\n" \
183 _ASM_SET_MSA \
184 " cfcmsa %0, $" #cs "\n" \
185 " .set pop\n" \
186 : "=r"(reg)); \
187 return reg; \
188} \
189 \
190static inline void write_msa_##name(unsigned int val) \
191{ \
192 __asm__ __volatile__( \
193 " .set push\n" \
194 _ASM_SET_MSA \
195 " ctcmsa $" #cs ", %0\n" \
196 " .set pop\n" \
197 : : "r"(val)); \
198}
199
200__BUILD_MSA_CTL_REG(ir, 0)
201__BUILD_MSA_CTL_REG(csr, 1)
202__BUILD_MSA_CTL_REG(access, 2)
203__BUILD_MSA_CTL_REG(save, 3)
204__BUILD_MSA_CTL_REG(modify, 4)
205__BUILD_MSA_CTL_REG(request, 5)
206__BUILD_MSA_CTL_REG(map, 6)
207__BUILD_MSA_CTL_REG(unmap, 7)
208
209#endif /* !__ASSEMBLY__ */
210
211#define MSA_IR 0
212#define MSA_CSR 1
213#define MSA_ACCESS 2
214#define MSA_SAVE 3
215#define MSA_MODIFY 4
216#define MSA_REQUEST 5
217#define MSA_MAP 6
218#define MSA_UNMAP 7
219
220/* MSA Implementation Register (MSAIR) */
221#define MSA_IR_REVB 0
222#define MSA_IR_REVF (_ULCAST_(0xff) << MSA_IR_REVB)
223#define MSA_IR_PROCB 8
224#define MSA_IR_PROCF (_ULCAST_(0xff) << MSA_IR_PROCB)
225#define MSA_IR_WRPB 16
226#define MSA_IR_WRPF (_ULCAST_(0x1) << MSA_IR_WRPB)
227
228/* MSA Control & Status Register (MSACSR) */
229#define MSA_CSR_RMB 0
230#define MSA_CSR_RMF (_ULCAST_(0x3) << MSA_CSR_RMB)
231#define MSA_CSR_RM_NEAREST 0
232#define MSA_CSR_RM_TO_ZERO 1
233#define MSA_CSR_RM_TO_POS 2
234#define MSA_CSR_RM_TO_NEG 3
235#define MSA_CSR_FLAGSB 2
236#define MSA_CSR_FLAGSF (_ULCAST_(0x1f) << MSA_CSR_FLAGSB)
237#define MSA_CSR_FLAGS_IB 2
238#define MSA_CSR_FLAGS_IF (_ULCAST_(0x1) << MSA_CSR_FLAGS_IB)
239#define MSA_CSR_FLAGS_UB 3
240#define MSA_CSR_FLAGS_UF (_ULCAST_(0x1) << MSA_CSR_FLAGS_UB)
241#define MSA_CSR_FLAGS_OB 4
242#define MSA_CSR_FLAGS_OF (_ULCAST_(0x1) << MSA_CSR_FLAGS_OB)
243#define MSA_CSR_FLAGS_ZB 5
244#define MSA_CSR_FLAGS_ZF (_ULCAST_(0x1) << MSA_CSR_FLAGS_ZB)
245#define MSA_CSR_FLAGS_VB 6
246#define MSA_CSR_FLAGS_VF (_ULCAST_(0x1) << MSA_CSR_FLAGS_VB)
247#define MSA_CSR_ENABLESB 7
248#define MSA_CSR_ENABLESF (_ULCAST_(0x1f) << MSA_CSR_ENABLESB)
249#define MSA_CSR_ENABLES_IB 7
250#define MSA_CSR_ENABLES_IF (_ULCAST_(0x1) << MSA_CSR_ENABLES_IB)
251#define MSA_CSR_ENABLES_UB 8
252#define MSA_CSR_ENABLES_UF (_ULCAST_(0x1) << MSA_CSR_ENABLES_UB)
253#define MSA_CSR_ENABLES_OB 9
254#define MSA_CSR_ENABLES_OF (_ULCAST_(0x1) << MSA_CSR_ENABLES_OB)
255#define MSA_CSR_ENABLES_ZB 10
256#define MSA_CSR_ENABLES_ZF (_ULCAST_(0x1) << MSA_CSR_ENABLES_ZB)
257#define MSA_CSR_ENABLES_VB 11
258#define MSA_CSR_ENABLES_VF (_ULCAST_(0x1) << MSA_CSR_ENABLES_VB)
259#define MSA_CSR_CAUSEB 12
260#define MSA_CSR_CAUSEF (_ULCAST_(0x3f) << MSA_CSR_CAUSEB)
261#define MSA_CSR_CAUSE_IB 12
262#define MSA_CSR_CAUSE_IF (_ULCAST_(0x1) << MSA_CSR_CAUSE_IB)
263#define MSA_CSR_CAUSE_UB 13
264#define MSA_CSR_CAUSE_UF (_ULCAST_(0x1) << MSA_CSR_CAUSE_UB)
265#define MSA_CSR_CAUSE_OB 14
266#define MSA_CSR_CAUSE_OF (_ULCAST_(0x1) << MSA_CSR_CAUSE_OB)
267#define MSA_CSR_CAUSE_ZB 15
268#define MSA_CSR_CAUSE_ZF (_ULCAST_(0x1) << MSA_CSR_CAUSE_ZB)
269#define MSA_CSR_CAUSE_VB 16
270#define MSA_CSR_CAUSE_VF (_ULCAST_(0x1) << MSA_CSR_CAUSE_VB)
271#define MSA_CSR_CAUSE_EB 17
272#define MSA_CSR_CAUSE_EF (_ULCAST_(0x1) << MSA_CSR_CAUSE_EB)
273#define MSA_CSR_NXB 18
274#define MSA_CSR_NXF (_ULCAST_(0x1) << MSA_CSR_NXB)
275#define MSA_CSR_FSB 24
276#define MSA_CSR_FSF (_ULCAST_(0x1) << MSA_CSR_FSB)
277
278#endif /* _ASM_MSA_H */
diff --git a/arch/mips/include/asm/msc01_ic.h b/arch/mips/include/asm/msc01_ic.h
new file mode 100644
index 000000000..ff7f074d0
--- /dev/null
+++ b/arch/mips/include/asm/msc01_ic.h
@@ -0,0 +1,147 @@
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 */
98
99/*****************************************************************************
100 * Absolute register addresses
101 *****************************************************************************/
102
103#define MSC01_IC_RST (MSC01_IC_REG_BASE + MSC01_IC_RST_OFS)
104#define MSC01_IC_ENAL (MSC01_IC_REG_BASE + MSC01_IC_ENAL_OFS)
105#define MSC01_IC_ENAH (MSC01_IC_REG_BASE + MSC01_IC_ENAH_OFS)
106#define MSC01_IC_DISL (MSC01_IC_REG_BASE + MSC01_IC_DISL_OFS)
107#define MSC01_IC_DISH (MSC01_IC_REG_BASE + MSC01_IC_DISH_OFS)
108#define MSC01_IC_ISBL (MSC01_IC_REG_BASE + MSC01_IC_ISBL_OFS)
109#define MSC01_IC_ISBH (MSC01_IC_REG_BASE + MSC01_IC_ISBH_OFS)
110#define MSC01_IC_ISAL (MSC01_IC_REG_BASE + MSC01_IC_ISAL_OFS)
111#define MSC01_IC_ISAH (MSC01_IC_REG_BASE + MSC01_IC_ISAH_OFS)
112#define MSC01_IC_LVL (MSC01_IC_REG_BASE + MSC01_IC_LVL_OFS)
113#define MSC01_IC_RAMW (MSC01_IC_REG_BASE + MSC01_IC_RAMW_OFS)
114#define MSC01_IC_OSB (MSC01_IC_REG_BASE + MSC01_IC_OSB_OFS)
115#define MSC01_IC_OSA (MSC01_IC_REG_BASE + MSC01_IC_OSA_OFS)
116#define MSC01_IC_GENA (MSC01_IC_REG_BASE + MSC01_IC_GENA_OFS)
117#define MSC01_IC_BASE (MSC01_IC_REG_BASE + MSC01_IC_BASE_OFS)
118#define MSC01_IC_VEC (MSC01_IC_REG_BASE + MSC01_IC_VEC_OFS)
119#define MSC01_IC_EOI (MSC01_IC_REG_BASE + MSC01_IC_EOI_OFS)
120#define MSC01_IC_CFG (MSC01_IC_REG_BASE + MSC01_IC_CFG_OFS)
121#define MSC01_IC_TRLD (MSC01_IC_REG_BASE + MSC01_IC_TRLD_OFS)
122#define MSC01_IC_TVAL (MSC01_IC_REG_BASE + MSC01_IC_TVAL_OFS)
123#define MSC01_IC_TCFG (MSC01_IC_REG_BASE + MSC01_IC_TCFG_OFS)
124#define MSC01_IC_SUP (MSC01_IC_REG_BASE + MSC01_IC_SUP_OFS)
125#define MSC01_IC_ENA (MSC01_IC_REG_BASE + MSC01_IC_ENA_OFS)
126#define MSC01_IC_DIS (MSC01_IC_REG_BASE + MSC01_IC_DIS_OFS)
127#define MSC01_IC_ISB (MSC01_IC_REG_BASE + MSC01_IC_ISB_OFS)
128#define MSC01_IC_ISA (MSC01_IC_REG_BASE + MSC01_IC_ISA_OFS)
129
130/*
131 * Soc-it interrupts are configurable.
132 * Every board describes its IRQ mapping with this table.
133 */
134typedef struct msc_irqmap {
135 int im_irq;
136 int im_type;
137 int im_lvl;
138} msc_irqmap_t;
139
140/* im_type */
141#define MSC01_IRQ_LEVEL 0
142#define MSC01_IRQ_EDGE 1
143
144extern void __init init_msc_irqs(unsigned long icubase, unsigned int base, msc_irqmap_t *imp, int nirq);
145extern void ll_msc_irq(void);
146
147#endif /* __ASM_MIPS_BOARDS_MSC01_IC_H */
diff --git a/arch/mips/include/asm/netlogic/common.h b/arch/mips/include/asm/netlogic/common.h
new file mode 100644
index 000000000..57616649b
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/common.h
@@ -0,0 +1,132 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _NETLOGIC_COMMON_H_
36#define _NETLOGIC_COMMON_H_
37
38/*
39 * Common SMP definitions
40 */
41#define RESET_VEC_PHYS 0x1fc00000
42#define RESET_VEC_SIZE 8192 /* 8KB reset code and data */
43#define RESET_DATA_PHYS (RESET_VEC_PHYS + (1<<10))
44
45/* Offsets of parameters in the RESET_DATA_PHYS area */
46#define BOOT_THREAD_MODE 0
47#define BOOT_NMI_LOCK 4
48#define BOOT_NMI_HANDLER 8
49
50/* CPU ready flags for each CPU */
51#define BOOT_CPU_READY 2048
52
53#ifndef __ASSEMBLY__
54#include <linux/cpumask.h>
55#include <linux/spinlock.h>
56#include <asm/irq.h>
57#include <asm/mach-netlogic/multi-node.h>
58
59struct irq_desc;
60void nlm_smp_function_ipi_handler(struct irq_desc *desc);
61void nlm_smp_resched_ipi_handler(struct irq_desc *desc);
62void nlm_smp_irq_init(int hwcpuid);
63void nlm_boot_secondary_cpus(void);
64int nlm_wakeup_secondary_cpus(void);
65void nlm_rmiboot_preboot(void);
66void nlm_percpu_init(int hwcpuid);
67
68static inline void *
69nlm_get_boot_data(int offset)
70{
71 return (void *)(CKSEG1ADDR(RESET_DATA_PHYS) + offset);
72}
73
74static inline void
75nlm_set_nmi_handler(void *handler)
76{
77 void *nmih = nlm_get_boot_data(BOOT_NMI_HANDLER);
78
79 *(int64_t *)nmih = (long)handler;
80}
81
82/*
83 * Misc.
84 */
85void nlm_init_boot_cpu(void);
86unsigned int nlm_get_cpu_frequency(void);
87extern const struct plat_smp_ops nlm_smp_ops;
88extern char nlm_reset_entry[], nlm_reset_entry_end[];
89
90extern unsigned int nlm_threads_per_core;
91extern cpumask_t nlm_cpumask;
92
93struct irq_data;
94uint64_t nlm_pci_irqmask(int node);
95void nlm_setup_pic_irq(int node, int picirq, int irq, int irt);
96void nlm_set_pic_extra_ack(int node, int irq, void (*xack)(struct irq_data *));
97
98#ifdef CONFIG_PCI_MSI
99void nlm_dispatch_msi(int node, int lirq);
100void nlm_dispatch_msix(int node, int msixirq);
101#endif
102
103/*
104 * The NR_IRQs is divided between nodes, each of them has a separate irq space
105 */
106static inline int nlm_irq_to_xirq(int node, int irq)
107{
108 return node * NR_IRQS / NLM_NR_NODES + irq;
109}
110
111#ifdef CONFIG_CPU_XLR
112#define nlm_cores_per_node() 8
113#else
114static inline int nlm_cores_per_node(void)
115{
116 return ((read_c0_prid() & PRID_IMP_MASK)
117 == PRID_IMP_NETLOGIC_XLP9XX) ? 32 : 8;
118}
119#endif
120static inline int nlm_threads_per_node(void)
121{
122 return nlm_cores_per_node() * NLM_THREADS_PER_CORE;
123}
124
125static inline int nlm_hwtid_to_node(int hwtid)
126{
127 return hwtid / nlm_threads_per_node();
128}
129
130extern int nlm_cpu_ready[];
131#endif /* __ASSEMBLY__ */
132#endif /* _NETLOGIC_COMMON_H_ */
diff --git a/arch/mips/include/asm/netlogic/haldefs.h b/arch/mips/include/asm/netlogic/haldefs.h
new file mode 100644
index 000000000..79c7cccdc
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/haldefs.h
@@ -0,0 +1,171 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef __NLM_HAL_HALDEFS_H__
36#define __NLM_HAL_HALDEFS_H__
37
38#include <linux/irqflags.h> /* for local_irq_disable */
39
40/*
41 * This file contains platform specific memory mapped IO implementation
42 * and will provide a way to read 32/64 bit memory mapped registers in
43 * all ABIs
44 */
45static inline uint32_t
46nlm_read_reg(uint64_t base, uint32_t reg)
47{
48 volatile uint32_t *addr = (volatile uint32_t *)(long)base + reg;
49
50 return *addr;
51}
52
53static inline void
54nlm_write_reg(uint64_t base, uint32_t reg, uint32_t val)
55{
56 volatile uint32_t *addr = (volatile uint32_t *)(long)base + reg;
57
58 *addr = val;
59}
60
61/*
62 * For o32 compilation, we have to disable interrupts to access 64 bit
63 * registers
64 *
65 * We need to disable interrupts because we save just the lower 32 bits of
66 * registers in interrupt handling. So if we get hit by an interrupt while
67 * using the upper 32 bits of a register, we lose.
68 */
69
70static inline uint64_t
71nlm_read_reg64(uint64_t base, uint32_t reg)
72{
73 uint64_t addr = base + (reg >> 1) * sizeof(uint64_t);
74 volatile uint64_t *ptr = (volatile uint64_t *)(long)addr;
75 uint64_t val;
76
77 if (sizeof(unsigned long) == 4) {
78 unsigned long flags;
79
80 local_irq_save(flags);
81 __asm__ __volatile__(
82 ".set push" "\n\t"
83 ".set mips64" "\n\t"
84 "ld %L0, %1" "\n\t"
85 "dsra32 %M0, %L0, 0" "\n\t"
86 "sll %L0, %L0, 0" "\n\t"
87 ".set pop" "\n"
88 : "=r" (val)
89 : "m" (*ptr));
90 local_irq_restore(flags);
91 } else
92 val = *ptr;
93
94 return val;
95}
96
97static inline void
98nlm_write_reg64(uint64_t base, uint32_t reg, uint64_t val)
99{
100 uint64_t addr = base + (reg >> 1) * sizeof(uint64_t);
101 volatile uint64_t *ptr = (volatile uint64_t *)(long)addr;
102
103 if (sizeof(unsigned long) == 4) {
104 unsigned long flags;
105 uint64_t tmp;
106
107 local_irq_save(flags);
108 __asm__ __volatile__(
109 ".set push" "\n\t"
110 ".set mips64" "\n\t"
111 "dsll32 %L0, %L0, 0" "\n\t"
112 "dsrl32 %L0, %L0, 0" "\n\t"
113 "dsll32 %M0, %M0, 0" "\n\t"
114 "or %L0, %L0, %M0" "\n\t"
115 "sd %L0, %2" "\n\t"
116 ".set pop" "\n"
117 : "=r" (tmp)
118 : "0" (val), "m" (*ptr));
119 local_irq_restore(flags);
120 } else
121 *ptr = val;
122}
123
124/*
125 * Routines to store 32/64 bit values to 64 bit addresses,
126 * used when going thru XKPHYS to access registers
127 */
128static inline uint32_t
129nlm_read_reg_xkphys(uint64_t base, uint32_t reg)
130{
131 return nlm_read_reg(base, reg);
132}
133
134static inline void
135nlm_write_reg_xkphys(uint64_t base, uint32_t reg, uint32_t val)
136{
137 nlm_write_reg(base, reg, val);
138}
139
140static inline uint64_t
141nlm_read_reg64_xkphys(uint64_t base, uint32_t reg)
142{
143 return nlm_read_reg64(base, reg);
144}
145
146static inline void
147nlm_write_reg64_xkphys(uint64_t base, uint32_t reg, uint64_t val)
148{
149 nlm_write_reg64(base, reg, val);
150}
151
152/* Location where IO base is mapped */
153extern uint64_t nlm_io_base;
154
155#if defined(CONFIG_CPU_XLP)
156static inline uint64_t
157nlm_pcicfg_base(uint32_t devoffset)
158{
159 return nlm_io_base + devoffset;
160}
161
162#elif defined(CONFIG_CPU_XLR)
163
164static inline uint64_t
165nlm_mmio_base(uint32_t devoffset)
166{
167 return nlm_io_base + devoffset;
168}
169#endif
170
171#endif
diff --git a/arch/mips/include/asm/netlogic/interrupt.h b/arch/mips/include/asm/netlogic/interrupt.h
new file mode 100644
index 000000000..ed5993d9b
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/interrupt.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _ASM_NLM_INTERRUPT_H
36#define _ASM_NLM_INTERRUPT_H
37
38/* Defines for the IRQ numbers */
39
40#define IRQ_IPI_SMP_FUNCTION 3
41#define IRQ_IPI_SMP_RESCHEDULE 4
42#define IRQ_FMN 5
43#define IRQ_TIMER 7
44
45#endif
diff --git a/arch/mips/include/asm/netlogic/mips-extns.h b/arch/mips/include/asm/netlogic/mips-extns.h
new file mode 100644
index 000000000..788baf399
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/mips-extns.h
@@ -0,0 +1,301 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _ASM_NLM_MIPS_EXTS_H
36#define _ASM_NLM_MIPS_EXTS_H
37
38/*
39 * XLR and XLP interrupt request and interrupt mask registers
40 */
41/*
42 * NOTE: Do not save/restore flags around write_c0_eimr().
43 * On non-R2 platforms the flags has part of EIMR that is shadowed in STATUS
44 * register. Restoring flags will overwrite the lower 8 bits of EIMR.
45 *
46 * Call with interrupts disabled.
47 */
48#define write_c0_eimr(val) \
49do { \
50 if (sizeof(unsigned long) == 4) { \
51 __asm__ __volatile__( \
52 ".set\tmips64\n\t" \
53 "dsll\t%L0, %L0, 32\n\t" \
54 "dsrl\t%L0, %L0, 32\n\t" \
55 "dsll\t%M0, %M0, 32\n\t" \
56 "or\t%L0, %L0, %M0\n\t" \
57 "dmtc0\t%L0, $9, 7\n\t" \
58 ".set\tmips0" \
59 : : "r" (val)); \
60 } else \
61 __write_64bit_c0_register($9, 7, (val)); \
62} while (0)
63
64/*
65 * Handling the 64 bit EIMR and EIRR registers in 32-bit mode with
66 * standard functions will be very inefficient. This provides
67 * optimized functions for the normal operations on the registers.
68 *
69 * Call with interrupts disabled.
70 */
71static inline void ack_c0_eirr(int irq)
72{
73 __asm__ __volatile__(
74 ".set push\n\t"
75 ".set mips64\n\t"
76 ".set noat\n\t"
77 "li $1, 1\n\t"
78 "dsllv $1, $1, %0\n\t"
79 "dmtc0 $1, $9, 6\n\t"
80 ".set pop"
81 : : "r" (irq));
82}
83
84static inline void set_c0_eimr(int irq)
85{
86 __asm__ __volatile__(
87 ".set push\n\t"
88 ".set mips64\n\t"
89 ".set noat\n\t"
90 "li $1, 1\n\t"
91 "dsllv %0, $1, %0\n\t"
92 "dmfc0 $1, $9, 7\n\t"
93 "or $1, %0\n\t"
94 "dmtc0 $1, $9, 7\n\t"
95 ".set pop"
96 : "+r" (irq));
97}
98
99static inline void clear_c0_eimr(int irq)
100{
101 __asm__ __volatile__(
102 ".set push\n\t"
103 ".set mips64\n\t"
104 ".set noat\n\t"
105 "li $1, 1\n\t"
106 "dsllv %0, $1, %0\n\t"
107 "dmfc0 $1, $9, 7\n\t"
108 "or $1, %0\n\t"
109 "xor $1, %0\n\t"
110 "dmtc0 $1, $9, 7\n\t"
111 ".set pop"
112 : "+r" (irq));
113}
114
115/*
116 * Read c0 eimr and c0 eirr, do AND of the two values, the result is
117 * the interrupts which are raised and are not masked.
118 */
119static inline uint64_t read_c0_eirr_and_eimr(void)
120{
121 uint64_t val;
122
123#ifdef CONFIG_64BIT
124 val = __read_64bit_c0_register($9, 6) & __read_64bit_c0_register($9, 7);
125#else
126 __asm__ __volatile__(
127 ".set push\n\t"
128 ".set mips64\n\t"
129 ".set noat\n\t"
130 "dmfc0 %M0, $9, 6\n\t"
131 "dmfc0 %L0, $9, 7\n\t"
132 "and %M0, %L0\n\t"
133 "dsll %L0, %M0, 32\n\t"
134 "dsra %M0, %M0, 32\n\t"
135 "dsra %L0, %L0, 32\n\t"
136 ".set pop"
137 : "=r" (val));
138#endif
139 return val;
140}
141
142static inline int hard_smp_processor_id(void)
143{
144 return __read_32bit_c0_register($15, 1) & 0x3ff;
145}
146
147static inline int nlm_nodeid(void)
148{
149 uint32_t prid = read_c0_prid() & PRID_IMP_MASK;
150
151 if ((prid == PRID_IMP_NETLOGIC_XLP9XX) ||
152 (prid == PRID_IMP_NETLOGIC_XLP5XX))
153 return (__read_32bit_c0_register($15, 1) >> 7) & 0x7;
154 else
155 return (__read_32bit_c0_register($15, 1) >> 5) & 0x3;
156}
157
158static inline unsigned int nlm_core_id(void)
159{
160 uint32_t prid = read_c0_prid() & PRID_IMP_MASK;
161
162 if ((prid == PRID_IMP_NETLOGIC_XLP9XX) ||
163 (prid == PRID_IMP_NETLOGIC_XLP5XX))
164 return (read_c0_ebase() & 0x7c) >> 2;
165 else
166 return (read_c0_ebase() & 0x1c) >> 2;
167}
168
169static inline unsigned int nlm_thread_id(void)
170{
171 return read_c0_ebase() & 0x3;
172}
173
174#define __read_64bit_c2_split(source, sel) \
175({ \
176 unsigned long long __val; \
177 unsigned long __flags; \
178 \
179 local_irq_save(__flags); \
180 if (sel == 0) \
181 __asm__ __volatile__( \
182 ".set\tmips64\n\t" \
183 "dmfc2\t%M0, " #source "\n\t" \
184 "dsll\t%L0, %M0, 32\n\t" \
185 "dsra\t%M0, %M0, 32\n\t" \
186 "dsra\t%L0, %L0, 32\n\t" \
187 ".set\tmips0\n\t" \
188 : "=r" (__val)); \
189 else \
190 __asm__ __volatile__( \
191 ".set\tmips64\n\t" \
192 "dmfc2\t%M0, " #source ", " #sel "\n\t" \
193 "dsll\t%L0, %M0, 32\n\t" \
194 "dsra\t%M0, %M0, 32\n\t" \
195 "dsra\t%L0, %L0, 32\n\t" \
196 ".set\tmips0\n\t" \
197 : "=r" (__val)); \
198 local_irq_restore(__flags); \
199 \
200 __val; \
201})
202
203#define __write_64bit_c2_split(source, sel, val) \
204do { \
205 unsigned long __flags; \
206 \
207 local_irq_save(__flags); \
208 if (sel == 0) \
209 __asm__ __volatile__( \
210 ".set\tmips64\n\t" \
211 "dsll\t%L0, %L0, 32\n\t" \
212 "dsrl\t%L0, %L0, 32\n\t" \
213 "dsll\t%M0, %M0, 32\n\t" \
214 "or\t%L0, %L0, %M0\n\t" \
215 "dmtc2\t%L0, " #source "\n\t" \
216 ".set\tmips0\n\t" \
217 : : "r" (val)); \
218 else \
219 __asm__ __volatile__( \
220 ".set\tmips64\n\t" \
221 "dsll\t%L0, %L0, 32\n\t" \
222 "dsrl\t%L0, %L0, 32\n\t" \
223 "dsll\t%M0, %M0, 32\n\t" \
224 "or\t%L0, %L0, %M0\n\t" \
225 "dmtc2\t%L0, " #source ", " #sel "\n\t" \
226 ".set\tmips0\n\t" \
227 : : "r" (val)); \
228 local_irq_restore(__flags); \
229} while (0)
230
231#define __read_32bit_c2_register(source, sel) \
232({ uint32_t __res; \
233 if (sel == 0) \
234 __asm__ __volatile__( \
235 ".set\tmips32\n\t" \
236 "mfc2\t%0, " #source "\n\t" \
237 ".set\tmips0\n\t" \
238 : "=r" (__res)); \
239 else \
240 __asm__ __volatile__( \
241 ".set\tmips32\n\t" \
242 "mfc2\t%0, " #source ", " #sel "\n\t" \
243 ".set\tmips0\n\t" \
244 : "=r" (__res)); \
245 __res; \
246})
247
248#define __read_64bit_c2_register(source, sel) \
249({ unsigned long long __res; \
250 if (sizeof(unsigned long) == 4) \
251 __res = __read_64bit_c2_split(source, sel); \
252 else if (sel == 0) \
253 __asm__ __volatile__( \
254 ".set\tmips64\n\t" \
255 "dmfc2\t%0, " #source "\n\t" \
256 ".set\tmips0\n\t" \
257 : "=r" (__res)); \
258 else \
259 __asm__ __volatile__( \
260 ".set\tmips64\n\t" \
261 "dmfc2\t%0, " #source ", " #sel "\n\t" \
262 ".set\tmips0\n\t" \
263 : "=r" (__res)); \
264 __res; \
265})
266
267#define __write_64bit_c2_register(register, sel, value) \
268do { \
269 if (sizeof(unsigned long) == 4) \
270 __write_64bit_c2_split(register, sel, value); \
271 else if (sel == 0) \
272 __asm__ __volatile__( \
273 ".set\tmips64\n\t" \
274 "dmtc2\t%z0, " #register "\n\t" \
275 ".set\tmips0\n\t" \
276 : : "Jr" (value)); \
277 else \
278 __asm__ __volatile__( \
279 ".set\tmips64\n\t" \
280 "dmtc2\t%z0, " #register ", " #sel "\n\t" \
281 ".set\tmips0\n\t" \
282 : : "Jr" (value)); \
283} while (0)
284
285#define __write_32bit_c2_register(reg, sel, value) \
286({ \
287 if (sel == 0) \
288 __asm__ __volatile__( \
289 ".set\tmips32\n\t" \
290 "mtc2\t%z0, " #reg "\n\t" \
291 ".set\tmips0\n\t" \
292 : : "Jr" (value)); \
293 else \
294 __asm__ __volatile__( \
295 ".set\tmips32\n\t" \
296 "mtc2\t%z0, " #reg ", " #sel "\n\t" \
297 ".set\tmips0\n\t" \
298 : : "Jr" (value)); \
299})
300
301#endif /*_ASM_NLM_MIPS_EXTS_H */
diff --git a/arch/mips/include/asm/netlogic/psb-bootinfo.h b/arch/mips/include/asm/netlogic/psb-bootinfo.h
new file mode 100644
index 000000000..c716e9397
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/psb-bootinfo.h
@@ -0,0 +1,95 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _ASM_NETLOGIC_BOOTINFO_H
36#define _ASM_NETLOGIC_BOOTINFO_H
37
38struct psb_info {
39 uint64_t boot_level;
40 uint64_t io_base;
41 uint64_t output_device;
42 uint64_t uart_print;
43 uint64_t led_output;
44 uint64_t init;
45 uint64_t exit;
46 uint64_t warm_reset;
47 uint64_t wakeup;
48 uint64_t online_cpu_map;
49 uint64_t master_reentry_sp;
50 uint64_t master_reentry_gp;
51 uint64_t master_reentry_fn;
52 uint64_t slave_reentry_fn;
53 uint64_t magic_dword;
54 uint64_t uart_putchar;
55 uint64_t size;
56 uint64_t uart_getchar;
57 uint64_t nmi_handler;
58 uint64_t psb_version;
59 uint64_t mac_addr;
60 uint64_t cpu_frequency;
61 uint64_t board_version;
62 uint64_t malloc;
63 uint64_t free;
64 uint64_t global_shmem_addr;
65 uint64_t global_shmem_size;
66 uint64_t psb_os_cpu_map;
67 uint64_t userapp_cpu_map;
68 uint64_t wakeup_os;
69 uint64_t psb_mem_map;
70 uint64_t board_major_version;
71 uint64_t board_minor_version;
72 uint64_t board_manf_revision;
73 uint64_t board_serial_number;
74 uint64_t psb_physaddr_map;
75 uint64_t xlr_loaderip_config;
76 uint64_t bldr_envp;
77 uint64_t avail_mem_map;
78};
79
80/* This is what netlboot passes and linux boot_mem_map is subtly different */
81#define NLM_BOOT_MEM_MAP_MAX 32
82struct nlm_boot_mem_map {
83 int nr_map;
84 struct nlm_boot_mem_map_entry {
85 uint64_t addr; /* start of memory segment */
86 uint64_t size; /* size of memory segment */
87 uint32_t type; /* type of memory segment */
88 } map[NLM_BOOT_MEM_MAP_MAX];
89};
90#define NLM_BOOT_MEM_RAM 1
91
92/* Pointer to saved boot loader info */
93extern struct psb_info nlm_prom_info;
94
95#endif
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/bridge.h b/arch/mips/include/asm/netlogic/xlp-hal/bridge.h
new file mode 100644
index 000000000..3067f9834
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlp-hal/bridge.h
@@ -0,0 +1,186 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef __NLM_HAL_BRIDGE_H__
36#define __NLM_HAL_BRIDGE_H__
37
38/**
39* @file_name mio.h
40* @author Netlogic Microsystems
41* @brief Basic definitions of XLP memory and io subsystem
42*/
43
44/*
45 * BRIDGE specific registers
46 *
47 * These registers start after the PCIe header, which has 0x40
48 * standard entries
49 */
50#define BRIDGE_MODE 0x00
51#define BRIDGE_PCI_CFG_BASE 0x01
52#define BRIDGE_PCI_CFG_LIMIT 0x02
53#define BRIDGE_PCIE_CFG_BASE 0x03
54#define BRIDGE_PCIE_CFG_LIMIT 0x04
55#define BRIDGE_BUSNUM_BAR0 0x05
56#define BRIDGE_BUSNUM_BAR1 0x06
57#define BRIDGE_BUSNUM_BAR2 0x07
58#define BRIDGE_BUSNUM_BAR3 0x08
59#define BRIDGE_BUSNUM_BAR4 0x09
60#define BRIDGE_BUSNUM_BAR5 0x0a
61#define BRIDGE_BUSNUM_BAR6 0x0b
62#define BRIDGE_FLASH_BAR0 0x0c
63#define BRIDGE_FLASH_BAR1 0x0d
64#define BRIDGE_FLASH_BAR2 0x0e
65#define BRIDGE_FLASH_BAR3 0x0f
66#define BRIDGE_FLASH_LIMIT0 0x10
67#define BRIDGE_FLASH_LIMIT1 0x11
68#define BRIDGE_FLASH_LIMIT2 0x12
69#define BRIDGE_FLASH_LIMIT3 0x13
70
71#define BRIDGE_DRAM_BAR(i) (0x14 + (i))
72#define BRIDGE_DRAM_LIMIT(i) (0x1c + (i))
73#define BRIDGE_DRAM_NODE_TRANSLN(i) (0x24 + (i))
74#define BRIDGE_DRAM_CHNL_TRANSLN(i) (0x2c + (i))
75
76#define BRIDGE_PCIEMEM_BASE0 0x34
77#define BRIDGE_PCIEMEM_BASE1 0x35
78#define BRIDGE_PCIEMEM_BASE2 0x36
79#define BRIDGE_PCIEMEM_BASE3 0x37
80#define BRIDGE_PCIEMEM_LIMIT0 0x38
81#define BRIDGE_PCIEMEM_LIMIT1 0x39
82#define BRIDGE_PCIEMEM_LIMIT2 0x3a
83#define BRIDGE_PCIEMEM_LIMIT3 0x3b
84#define BRIDGE_PCIEIO_BASE0 0x3c
85#define BRIDGE_PCIEIO_BASE1 0x3d
86#define BRIDGE_PCIEIO_BASE2 0x3e
87#define BRIDGE_PCIEIO_BASE3 0x3f
88#define BRIDGE_PCIEIO_LIMIT0 0x40
89#define BRIDGE_PCIEIO_LIMIT1 0x41
90#define BRIDGE_PCIEIO_LIMIT2 0x42
91#define BRIDGE_PCIEIO_LIMIT3 0x43
92#define BRIDGE_PCIEMEM_BASE4 0x44
93#define BRIDGE_PCIEMEM_BASE5 0x45
94#define BRIDGE_PCIEMEM_BASE6 0x46
95#define BRIDGE_PCIEMEM_LIMIT4 0x47
96#define BRIDGE_PCIEMEM_LIMIT5 0x48
97#define BRIDGE_PCIEMEM_LIMIT6 0x49
98#define BRIDGE_PCIEIO_BASE4 0x4a
99#define BRIDGE_PCIEIO_BASE5 0x4b
100#define BRIDGE_PCIEIO_BASE6 0x4c
101#define BRIDGE_PCIEIO_LIMIT4 0x4d
102#define BRIDGE_PCIEIO_LIMIT5 0x4e
103#define BRIDGE_PCIEIO_LIMIT6 0x4f
104#define BRIDGE_NBU_EVENT_CNT_CTL 0x50
105#define BRIDGE_EVNTCTR1_LOW 0x51
106#define BRIDGE_EVNTCTR1_HI 0x52
107#define BRIDGE_EVNT_CNT_CTL2 0x53
108#define BRIDGE_EVNTCTR2_LOW 0x54
109#define BRIDGE_EVNTCTR2_HI 0x55
110#define BRIDGE_TRACEBUF_MATCH0 0x56
111#define BRIDGE_TRACEBUF_MATCH1 0x57
112#define BRIDGE_TRACEBUF_MATCH_LOW 0x58
113#define BRIDGE_TRACEBUF_MATCH_HI 0x59
114#define BRIDGE_TRACEBUF_CTRL 0x5a
115#define BRIDGE_TRACEBUF_INIT 0x5b
116#define BRIDGE_TRACEBUF_ACCESS 0x5c
117#define BRIDGE_TRACEBUF_READ_DATA0 0x5d
118#define BRIDGE_TRACEBUF_READ_DATA1 0x5d
119#define BRIDGE_TRACEBUF_READ_DATA2 0x5f
120#define BRIDGE_TRACEBUF_READ_DATA3 0x60
121#define BRIDGE_TRACEBUF_STATUS 0x61
122#define BRIDGE_ADDRESS_ERROR0 0x62
123#define BRIDGE_ADDRESS_ERROR1 0x63
124#define BRIDGE_ADDRESS_ERROR2 0x64
125#define BRIDGE_TAG_ECC_ADDR_ERROR0 0x65
126#define BRIDGE_TAG_ECC_ADDR_ERROR1 0x66
127#define BRIDGE_TAG_ECC_ADDR_ERROR2 0x67
128#define BRIDGE_LINE_FLUSH0 0x68
129#define BRIDGE_LINE_FLUSH1 0x69
130#define BRIDGE_NODE_ID 0x6a
131#define BRIDGE_ERROR_INTERRUPT_EN 0x6b
132#define BRIDGE_PCIE0_WEIGHT 0x2c0
133#define BRIDGE_PCIE1_WEIGHT 0x2c1
134#define BRIDGE_PCIE2_WEIGHT 0x2c2
135#define BRIDGE_PCIE3_WEIGHT 0x2c3
136#define BRIDGE_USB_WEIGHT 0x2c4
137#define BRIDGE_NET_WEIGHT 0x2c5
138#define BRIDGE_POE_WEIGHT 0x2c6
139#define BRIDGE_CMS_WEIGHT 0x2c7
140#define BRIDGE_DMAENG_WEIGHT 0x2c8
141#define BRIDGE_SEC_WEIGHT 0x2c9
142#define BRIDGE_COMP_WEIGHT 0x2ca
143#define BRIDGE_GIO_WEIGHT 0x2cb
144#define BRIDGE_FLASH_WEIGHT 0x2cc
145
146/* FIXME verify */
147#define BRIDGE_9XX_FLASH_BAR(i) (0x11 + (i))
148#define BRIDGE_9XX_FLASH_BAR_LIMIT(i) (0x15 + (i))
149
150#define BRIDGE_9XX_DRAM_BAR(i) (0x19 + (i))
151#define BRIDGE_9XX_DRAM_LIMIT(i) (0x29 + (i))
152#define BRIDGE_9XX_DRAM_NODE_TRANSLN(i) (0x39 + (i))
153#define BRIDGE_9XX_DRAM_CHNL_TRANSLN(i) (0x49 + (i))
154
155#define BRIDGE_9XX_ADDRESS_ERROR0 0x9d
156#define BRIDGE_9XX_ADDRESS_ERROR1 0x9e
157#define BRIDGE_9XX_ADDRESS_ERROR2 0x9f
158
159#define BRIDGE_9XX_PCIEMEM_BASE0 0x59
160#define BRIDGE_9XX_PCIEMEM_BASE1 0x5a
161#define BRIDGE_9XX_PCIEMEM_BASE2 0x5b
162#define BRIDGE_9XX_PCIEMEM_BASE3 0x5c
163#define BRIDGE_9XX_PCIEMEM_LIMIT0 0x5d
164#define BRIDGE_9XX_PCIEMEM_LIMIT1 0x5e
165#define BRIDGE_9XX_PCIEMEM_LIMIT2 0x5f
166#define BRIDGE_9XX_PCIEMEM_LIMIT3 0x60
167#define BRIDGE_9XX_PCIEIO_BASE0 0x61
168#define BRIDGE_9XX_PCIEIO_BASE1 0x62
169#define BRIDGE_9XX_PCIEIO_BASE2 0x63
170#define BRIDGE_9XX_PCIEIO_BASE3 0x64
171#define BRIDGE_9XX_PCIEIO_LIMIT0 0x65
172#define BRIDGE_9XX_PCIEIO_LIMIT1 0x66
173#define BRIDGE_9XX_PCIEIO_LIMIT2 0x67
174#define BRIDGE_9XX_PCIEIO_LIMIT3 0x68
175
176#ifndef __ASSEMBLY__
177
178#define nlm_read_bridge_reg(b, r) nlm_read_reg(b, r)
179#define nlm_write_bridge_reg(b, r, v) nlm_write_reg(b, r, v)
180#define nlm_get_bridge_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
181 XLP9XX_IO_BRIDGE_OFFSET(node) : XLP_IO_BRIDGE_OFFSET(node))
182#define nlm_get_bridge_regbase(node) \
183 (nlm_get_bridge_pcibase(node) + XLP_IO_PCI_HDRSZ)
184
185#endif /* __ASSEMBLY__ */
186#endif /* __NLM_HAL_BRIDGE_H__ */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h b/arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h
new file mode 100644
index 000000000..a06b59292
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlp-hal/cpucontrol.h
@@ -0,0 +1,89 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef __NLM_HAL_CPUCONTROL_H__
36#define __NLM_HAL_CPUCONTROL_H__
37
38#define CPU_BLOCKID_IFU 0
39#define CPU_BLOCKID_ICU 1
40#define CPU_BLOCKID_IEU 2
41#define CPU_BLOCKID_LSU 3
42#define CPU_BLOCKID_MMU 4
43#define CPU_BLOCKID_PRF 5
44#define CPU_BLOCKID_SCH 7
45#define CPU_BLOCKID_SCU 8
46#define CPU_BLOCKID_FPU 9
47#define CPU_BLOCKID_MAP 10
48
49#define IFU_BRUB_RESERVE 0x007
50
51#define ICU_DEFEATURE 0x100
52
53#define LSU_DEFEATURE 0x304
54#define LSU_DEBUG_ADDR 0x305
55#define LSU_DEBUG_DATA0 0x306
56#define LSU_CERRLOG_REGID 0x309
57#define SCHED_DEFEATURE 0x700
58
59/* Offsets of interest from the 'MAP' Block */
60#define MAP_THREADMODE 0x00
61#define MAP_EXT_EBASE_ENABLE 0x04
62#define MAP_CCDI_CONFIG 0x08
63#define MAP_THRD0_CCDI_STATUS 0x0c
64#define MAP_THRD1_CCDI_STATUS 0x10
65#define MAP_THRD2_CCDI_STATUS 0x14
66#define MAP_THRD3_CCDI_STATUS 0x18
67#define MAP_THRD0_DEBUG_MODE 0x1c
68#define MAP_THRD1_DEBUG_MODE 0x20
69#define MAP_THRD2_DEBUG_MODE 0x24
70#define MAP_THRD3_DEBUG_MODE 0x28
71#define MAP_MISC_STATE 0x60
72#define MAP_DEBUG_READ_CTL 0x64
73#define MAP_DEBUG_READ_REG0 0x68
74#define MAP_DEBUG_READ_REG1 0x6c
75
76#define MMU_SETUP 0x400
77#define MMU_LFSRSEED 0x401
78#define MMU_HPW_NUM_PAGE_LVL 0x410
79#define MMU_PGWKR_PGDBASE 0x411
80#define MMU_PGWKR_PGDSHFT 0x412
81#define MMU_PGWKR_PGDMASK 0x413
82#define MMU_PGWKR_PUDSHFT 0x414
83#define MMU_PGWKR_PUDMASK 0x415
84#define MMU_PGWKR_PMDSHFT 0x416
85#define MMU_PGWKR_PMDMASK 0x417
86#define MMU_PGWKR_PTESHFT 0x418
87#define MMU_PGWKR_PTEMASK 0x419
88
89#endif /* __NLM_CPUCONTROL_H__ */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
new file mode 100644
index 000000000..805bfd21f
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
@@ -0,0 +1,214 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef __NLM_HAL_IOMAP_H__
36#define __NLM_HAL_IOMAP_H__
37
38#define XLP_DEFAULT_IO_BASE 0x18000000
39#define XLP_DEFAULT_PCI_ECFG_BASE XLP_DEFAULT_IO_BASE
40#define XLP_DEFAULT_PCI_CFG_BASE 0x1c000000
41
42#define NMI_BASE 0xbfc00000
43#define XLP_IO_CLK 133333333
44
45#define XLP_PCIE_CFG_SIZE 0x1000 /* 4K */
46#define XLP_PCIE_DEV_BLK_SIZE (8 * XLP_PCIE_CFG_SIZE)
47#define XLP_PCIE_BUS_BLK_SIZE (256 * XLP_PCIE_DEV_BLK_SIZE)
48#define XLP_IO_SIZE (64 << 20) /* ECFG space size */
49#define XLP_IO_PCI_HDRSZ 0x100
50#define XLP_IO_DEV(node, dev) ((dev) + (node) * 8)
51#define XLP_IO_PCI_OFFSET(b, d, f) (((b) << 20) | ((d) << 15) | ((f) << 12))
52
53#define XLP_HDR_OFFSET(node, bus, dev, fn) \
54 XLP_IO_PCI_OFFSET(bus, XLP_IO_DEV(node, dev), fn)
55
56#define XLP_IO_BRIDGE_OFFSET(node) XLP_HDR_OFFSET(node, 0, 0, 0)
57/* coherent inter chip */
58#define XLP_IO_CIC0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 0, 1)
59#define XLP_IO_CIC1_OFFSET(node) XLP_HDR_OFFSET(node, 0, 0, 2)
60#define XLP_IO_CIC2_OFFSET(node) XLP_HDR_OFFSET(node, 0, 0, 3)
61#define XLP_IO_PIC_OFFSET(node) XLP_HDR_OFFSET(node, 0, 0, 4)
62
63#define XLP_IO_PCIE_OFFSET(node, i) XLP_HDR_OFFSET(node, 0, 1, i)
64#define XLP_IO_PCIE0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 1, 0)
65#define XLP_IO_PCIE1_OFFSET(node) XLP_HDR_OFFSET(node, 0, 1, 1)
66#define XLP_IO_PCIE2_OFFSET(node) XLP_HDR_OFFSET(node, 0, 1, 2)
67#define XLP_IO_PCIE3_OFFSET(node) XLP_HDR_OFFSET(node, 0, 1, 3)
68
69#define XLP_IO_USB_OFFSET(node, i) XLP_HDR_OFFSET(node, 0, 2, i)
70#define XLP_IO_USB_EHCI0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 0)
71#define XLP_IO_USB_OHCI0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 1)
72#define XLP_IO_USB_OHCI1_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 2)
73#define XLP_IO_USB_EHCI1_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 3)
74#define XLP_IO_USB_OHCI2_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 4)
75#define XLP_IO_USB_OHCI3_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 5)
76
77#define XLP_IO_SATA_OFFSET(node) XLP_HDR_OFFSET(node, 0, 3, 2)
78
79/* XLP2xx has an updated USB block */
80#define XLP2XX_IO_USB_OFFSET(node, i) XLP_HDR_OFFSET(node, 0, 4, i)
81#define XLP2XX_IO_USB_XHCI0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 4, 1)
82#define XLP2XX_IO_USB_XHCI1_OFFSET(node) XLP_HDR_OFFSET(node, 0, 4, 2)
83#define XLP2XX_IO_USB_XHCI2_OFFSET(node) XLP_HDR_OFFSET(node, 0, 4, 3)
84
85#define XLP_IO_NAE_OFFSET(node) XLP_HDR_OFFSET(node, 0, 3, 0)
86#define XLP_IO_POE_OFFSET(node) XLP_HDR_OFFSET(node, 0, 3, 1)
87
88#define XLP_IO_CMS_OFFSET(node) XLP_HDR_OFFSET(node, 0, 4, 0)
89
90#define XLP_IO_DMA_OFFSET(node) XLP_HDR_OFFSET(node, 0, 5, 1)
91#define XLP_IO_SEC_OFFSET(node) XLP_HDR_OFFSET(node, 0, 5, 2)
92#define XLP_IO_CMP_OFFSET(node) XLP_HDR_OFFSET(node, 0, 5, 3)
93
94#define XLP_IO_UART_OFFSET(node, i) XLP_HDR_OFFSET(node, 0, 6, i)
95#define XLP_IO_UART0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 0)
96#define XLP_IO_UART1_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 1)
97#define XLP_IO_I2C_OFFSET(node, i) XLP_HDR_OFFSET(node, 0, 6, 2 + i)
98#define XLP_IO_I2C0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 2)
99#define XLP_IO_I2C1_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 3)
100#define XLP_IO_GPIO_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 4)
101/* on 2XX, all I2C busses are on the same block */
102#define XLP2XX_IO_I2C_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 7)
103
104/* system management */
105#define XLP_IO_SYS_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 5)
106#define XLP_IO_JTAG_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 6)
107
108/* Flash */
109#define XLP_IO_NOR_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 0)
110#define XLP_IO_NAND_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 1)
111#define XLP_IO_SPI_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 2)
112#define XLP_IO_MMC_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 3)
113
114/* Things have changed drastically in XLP 9XX */
115#define XLP9XX_HDR_OFFSET(n, d, f) \
116 XLP_IO_PCI_OFFSET(xlp9xx_get_socbus(n), d, f)
117
118#define XLP9XX_IO_BRIDGE_OFFSET(node) XLP_IO_PCI_OFFSET(0, 0, node)
119#define XLP9XX_IO_PIC_OFFSET(node) XLP9XX_HDR_OFFSET(node, 2, 0)
120#define XLP9XX_IO_UART_OFFSET(node) XLP9XX_HDR_OFFSET(node, 2, 2)
121#define XLP9XX_IO_SYS_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 0)
122#define XLP9XX_IO_FUSE_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 1)
123#define XLP9XX_IO_CLOCK_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 2)
124#define XLP9XX_IO_POWER_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 3)
125#define XLP9XX_IO_JTAG_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 4)
126
127#define XLP9XX_IO_PCIE_OFFSET(node, i) XLP9XX_HDR_OFFSET(node, 1, i)
128#define XLP9XX_IO_PCIE0_OFFSET(node) XLP9XX_HDR_OFFSET(node, 1, 0)
129#define XLP9XX_IO_PCIE2_OFFSET(node) XLP9XX_HDR_OFFSET(node, 1, 2)
130#define XLP9XX_IO_PCIE3_OFFSET(node) XLP9XX_HDR_OFFSET(node, 1, 3)
131
132/* XLP9xx USB block */
133#define XLP9XX_IO_USB_OFFSET(node, i) XLP9XX_HDR_OFFSET(node, 4, i)
134#define XLP9XX_IO_USB_XHCI0_OFFSET(node) XLP9XX_HDR_OFFSET(node, 4, 1)
135#define XLP9XX_IO_USB_XHCI1_OFFSET(node) XLP9XX_HDR_OFFSET(node, 4, 2)
136
137/* XLP9XX on-chip SATA controller */
138#define XLP9XX_IO_SATA_OFFSET(node) XLP9XX_HDR_OFFSET(node, 3, 2)
139
140/* Flash */
141#define XLP9XX_IO_NOR_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 0)
142#define XLP9XX_IO_NAND_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 1)
143#define XLP9XX_IO_SPI_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 2)
144#define XLP9XX_IO_MMC_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 3)
145
146/* PCI config header register id's */
147#define XLP_PCI_CFGREG0 0x00
148#define XLP_PCI_CFGREG1 0x01
149#define XLP_PCI_CFGREG2 0x02
150#define XLP_PCI_CFGREG3 0x03
151#define XLP_PCI_CFGREG4 0x04
152#define XLP_PCI_CFGREG5 0x05
153#define XLP_PCI_DEVINFO_REG0 0x30
154#define XLP_PCI_DEVINFO_REG1 0x31
155#define XLP_PCI_DEVINFO_REG2 0x32
156#define XLP_PCI_DEVINFO_REG3 0x33
157#define XLP_PCI_DEVINFO_REG4 0x34
158#define XLP_PCI_DEVINFO_REG5 0x35
159#define XLP_PCI_DEVINFO_REG6 0x36
160#define XLP_PCI_DEVINFO_REG7 0x37
161#define XLP_PCI_DEVSCRATCH_REG0 0x38
162#define XLP_PCI_DEVSCRATCH_REG1 0x39
163#define XLP_PCI_DEVSCRATCH_REG2 0x3a
164#define XLP_PCI_DEVSCRATCH_REG3 0x3b
165#define XLP_PCI_MSGSTN_REG 0x3c
166#define XLP_PCI_IRTINFO_REG 0x3d
167#define XLP_PCI_UCODEINFO_REG 0x3e
168#define XLP_PCI_SBB_WT_REG 0x3f
169
170/* PCI IDs for SoC device */
171#define PCI_VENDOR_NETLOGIC 0x184e
172
173#define PCI_DEVICE_ID_NLM_ROOT 0x1001
174#define PCI_DEVICE_ID_NLM_ICI 0x1002
175#define PCI_DEVICE_ID_NLM_PIC 0x1003
176#define PCI_DEVICE_ID_NLM_PCIE 0x1004
177#define PCI_DEVICE_ID_NLM_EHCI 0x1007
178#define PCI_DEVICE_ID_NLM_OHCI 0x1008
179#define PCI_DEVICE_ID_NLM_NAE 0x1009
180#define PCI_DEVICE_ID_NLM_POE 0x100A
181#define PCI_DEVICE_ID_NLM_FMN 0x100B
182#define PCI_DEVICE_ID_NLM_RAID 0x100D
183#define PCI_DEVICE_ID_NLM_SAE 0x100D
184#define PCI_DEVICE_ID_NLM_RSA 0x100E
185#define PCI_DEVICE_ID_NLM_CMP 0x100F
186#define PCI_DEVICE_ID_NLM_UART 0x1010
187#define PCI_DEVICE_ID_NLM_I2C 0x1011
188#define PCI_DEVICE_ID_NLM_NOR 0x1015
189#define PCI_DEVICE_ID_NLM_NAND 0x1016
190#define PCI_DEVICE_ID_NLM_MMC 0x1018
191#define PCI_DEVICE_ID_NLM_SATA 0x101A
192#define PCI_DEVICE_ID_NLM_XHCI 0x101D
193
194#define PCI_DEVICE_ID_XLP9XX_MMC 0x9018
195#define PCI_DEVICE_ID_XLP9XX_SATA 0x901A
196#define PCI_DEVICE_ID_XLP9XX_XHCI 0x901D
197
198#ifndef __ASSEMBLY__
199
200#define nlm_read_pci_reg(b, r) nlm_read_reg(b, r)
201#define nlm_write_pci_reg(b, r, v) nlm_write_reg(b, r, v)
202
203static inline int xlp9xx_get_socbus(int node)
204{
205 uint64_t socbridge;
206
207 if (node == 0)
208 return 1;
209 socbridge = nlm_pcicfg_base(XLP9XX_IO_BRIDGE_OFFSET(node));
210 return (nlm_read_pci_reg(socbridge, 0x6) >> 8) & 0xff;
211}
212#endif /* !__ASSEMBLY */
213
214#endif /* __NLM_HAL_IOMAP_H__ */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h
new file mode 100644
index 000000000..91540f41e
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h
@@ -0,0 +1,113 @@
1/*
2 * Copyright (c) 2003-2012 Broadcom Corporation
3 * All Rights Reserved
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the Broadcom
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef __NLM_HAL_PCIBUS_H__
36#define __NLM_HAL_PCIBUS_H__
37
38/* PCIE Memory and IO regions */
39#define PCIE_MEM_BASE 0xd0000000ULL
40#define PCIE_MEM_LIMIT 0xdfffffffULL
41#define PCIE_IO_BASE 0x14000000ULL
42#define PCIE_IO_LIMIT 0x15ffffffULL
43
44#define PCIE_BRIDGE_CMD 0x1
45#define PCIE_BRIDGE_MSI_CAP 0x14
46#define PCIE_BRIDGE_MSI_ADDRL 0x15
47#define PCIE_BRIDGE_MSI_ADDRH 0x16
48#define PCIE_BRIDGE_MSI_DATA 0x17
49
50/* XLP Global PCIE configuration space registers */
51#define PCIE_BYTE_SWAP_MEM_BASE 0x247
52#define PCIE_BYTE_SWAP_MEM_LIM 0x248
53#define PCIE_BYTE_SWAP_IO_BASE 0x249
54#define PCIE_BYTE_SWAP_IO_LIM 0x24A
55
56#define PCIE_BRIDGE_MSIX_ADDR_BASE 0x24F
57#define PCIE_BRIDGE_MSIX_ADDR_LIMIT 0x250
58#define PCIE_MSI_STATUS 0x25A
59#define PCIE_MSI_EN 0x25B
60#define PCIE_MSIX_STATUS 0x25D
61#define PCIE_INT_STATUS0 0x25F
62#define PCIE_INT_STATUS1 0x260
63#define PCIE_INT_EN0 0x261
64#define PCIE_INT_EN1 0x262
65
66/* XLP9XX has basic changes */
67#define PCIE_9XX_BYTE_SWAP_MEM_BASE 0x25c
68#define PCIE_9XX_BYTE_SWAP_MEM_LIM 0x25d
69#define PCIE_9XX_BYTE_SWAP_IO_BASE 0x25e
70#define PCIE_9XX_BYTE_SWAP_IO_LIM 0x25f
71
72#define PCIE_9XX_BRIDGE_MSIX_ADDR_BASE 0x264
73#define PCIE_9XX_BRIDGE_MSIX_ADDR_LIMIT 0x265
74#define PCIE_9XX_MSI_STATUS 0x283
75#define PCIE_9XX_MSI_EN 0x284
76/* 128 MSIX vectors available in 9xx */
77#define PCIE_9XX_MSIX_STATUS0 0x286
78#define PCIE_9XX_MSIX_STATUSX(n) (n + 0x286)
79#define PCIE_9XX_MSIX_VEC 0x296
80#define PCIE_9XX_MSIX_VECX(n) (n + 0x296)
81#define PCIE_9XX_INT_STATUS0 0x397
82#define PCIE_9XX_INT_STATUS1 0x398
83#define PCIE_9XX_INT_EN0 0x399
84#define PCIE_9XX_INT_EN1 0x39a
85
86/* other */
87#define PCIE_NLINKS 4
88
89/* MSI addresses */
90#define MSI_ADDR_BASE 0xfffee00000ULL
91#define MSI_ADDR_SZ 0x10000
92#define MSI_LINK_ADDR(n, l) (MSI_ADDR_BASE + \
93 (PCIE_NLINKS * (n) + (l)) * MSI_ADDR_SZ)
94#define MSIX_ADDR_BASE 0xfffef00000ULL
95#define MSIX_LINK_ADDR(n, l) (MSIX_ADDR_BASE + \
96 (PCIE_NLINKS * (n) + (l)) * MSI_ADDR_SZ)
97#ifndef __ASSEMBLY__
98
99#define nlm_read_pcie_reg(b, r) nlm_read_reg(b, r)
100#define nlm_write_pcie_reg(b, r, v) nlm_write_reg(b, r, v)
101#define nlm_get_pcie_base(node, inst) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
102 XLP9XX_IO_PCIE_OFFSET(node, inst) : XLP_IO_PCIE_OFFSET(node, inst))
103
104#ifdef CONFIG_PCI_MSI
105void xlp_init_node_msi_irqs(int node, int link);
106#else
107static inline void xlp_init_node_msi_irqs(int node, int link) {}
108#endif
109
110struct pci_dev *xlp_get_pcie_link(const struct pci_dev *dev);
111
112#endif
113#endif /* __NLM_HAL_PCIBUS_H__ */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pic.h b/arch/mips/include/asm/netlogic/xlp-hal/pic.h
new file mode 100644
index 000000000..41cefe94f
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlp-hal/pic.h
@@ -0,0 +1,366 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _NLM_HAL_PIC_H
36#define _NLM_HAL_PIC_H
37
38/* PIC Specific registers */
39#define PIC_CTRL 0x00
40
41/* PIC control register defines */
42#define PIC_CTRL_ITV 32 /* interrupt timeout value */
43#define PIC_CTRL_ICI 19 /* ICI interrupt timeout enable */
44#define PIC_CTRL_ITE 18 /* interrupt timeout enable */
45#define PIC_CTRL_STE 10 /* system timer interrupt enable */
46#define PIC_CTRL_WWR1 8 /* watchdog 1 wraparound count for reset */
47#define PIC_CTRL_WWR0 6 /* watchdog 0 wraparound count for reset */
48#define PIC_CTRL_WWN1 4 /* watchdog 1 wraparound count for NMI */
49#define PIC_CTRL_WWN0 2 /* watchdog 0 wraparound count for NMI */
50#define PIC_CTRL_WTE 0 /* watchdog timer enable */
51
52/* PIC Status register defines */
53#define PIC_ICI_STATUS 33 /* ICI interrupt timeout status */
54#define PIC_ITE_STATUS 32 /* interrupt timeout status */
55#define PIC_STS_STATUS 4 /* System timer interrupt status */
56#define PIC_WNS_STATUS 2 /* NMI status for watchdog timers */
57#define PIC_WIS_STATUS 0 /* Interrupt status for watchdog timers */
58
59/* PIC IPI control register offsets */
60#define PIC_IPICTRL_NMI 32
61#define PIC_IPICTRL_RIV 20 /* received interrupt vector */
62#define PIC_IPICTRL_IDB 16 /* interrupt destination base */
63#define PIC_IPICTRL_DTE 0 /* interrupt destination thread enables */
64
65/* PIC IRT register offsets */
66#define PIC_IRT_ENABLE 31
67#define PIC_IRT_NMI 29
68#define PIC_IRT_SCH 28 /* Scheduling scheme */
69#define PIC_IRT_RVEC 20 /* Interrupt receive vectors */
70#define PIC_IRT_DT 19 /* Destination type */
71#define PIC_IRT_DB 16 /* Destination base */
72#define PIC_IRT_DTE 0 /* Destination thread enables */
73
74#define PIC_BYTESWAP 0x02
75#define PIC_STATUS 0x04
76#define PIC_INTR_TIMEOUT 0x06
77#define PIC_ICI0_INTR_TIMEOUT 0x08
78#define PIC_ICI1_INTR_TIMEOUT 0x0a
79#define PIC_ICI2_INTR_TIMEOUT 0x0c
80#define PIC_IPI_CTL 0x0e
81#define PIC_INT_ACK 0x10
82#define PIC_INT_PENDING0 0x12
83#define PIC_INT_PENDING1 0x14
84#define PIC_INT_PENDING2 0x16
85
86#define PIC_WDOG0_MAXVAL 0x18
87#define PIC_WDOG0_COUNT 0x1a
88#define PIC_WDOG0_ENABLE0 0x1c
89#define PIC_WDOG0_ENABLE1 0x1e
90#define PIC_WDOG0_BEATCMD 0x20
91#define PIC_WDOG0_BEAT0 0x22
92#define PIC_WDOG0_BEAT1 0x24
93
94#define PIC_WDOG1_MAXVAL 0x26
95#define PIC_WDOG1_COUNT 0x28
96#define PIC_WDOG1_ENABLE0 0x2a
97#define PIC_WDOG1_ENABLE1 0x2c
98#define PIC_WDOG1_BEATCMD 0x2e
99#define PIC_WDOG1_BEAT0 0x30
100#define PIC_WDOG1_BEAT1 0x32
101
102#define PIC_WDOG_MAXVAL(i) (PIC_WDOG0_MAXVAL + ((i) ? 7 : 0))
103#define PIC_WDOG_COUNT(i) (PIC_WDOG0_COUNT + ((i) ? 7 : 0))
104#define PIC_WDOG_ENABLE0(i) (PIC_WDOG0_ENABLE0 + ((i) ? 7 : 0))
105#define PIC_WDOG_ENABLE1(i) (PIC_WDOG0_ENABLE1 + ((i) ? 7 : 0))
106#define PIC_WDOG_BEATCMD(i) (PIC_WDOG0_BEATCMD + ((i) ? 7 : 0))
107#define PIC_WDOG_BEAT0(i) (PIC_WDOG0_BEAT0 + ((i) ? 7 : 0))
108#define PIC_WDOG_BEAT1(i) (PIC_WDOG0_BEAT1 + ((i) ? 7 : 0))
109
110#define PIC_TIMER0_MAXVAL 0x34
111#define PIC_TIMER1_MAXVAL 0x36
112#define PIC_TIMER2_MAXVAL 0x38
113#define PIC_TIMER3_MAXVAL 0x3a
114#define PIC_TIMER4_MAXVAL 0x3c
115#define PIC_TIMER5_MAXVAL 0x3e
116#define PIC_TIMER6_MAXVAL 0x40
117#define PIC_TIMER7_MAXVAL 0x42
118#define PIC_TIMER_MAXVAL(i) (PIC_TIMER0_MAXVAL + ((i) * 2))
119
120#define PIC_TIMER0_COUNT 0x44
121#define PIC_TIMER1_COUNT 0x46
122#define PIC_TIMER2_COUNT 0x48
123#define PIC_TIMER3_COUNT 0x4a
124#define PIC_TIMER4_COUNT 0x4c
125#define PIC_TIMER5_COUNT 0x4e
126#define PIC_TIMER6_COUNT 0x50
127#define PIC_TIMER7_COUNT 0x52
128#define PIC_TIMER_COUNT(i) (PIC_TIMER0_COUNT + ((i) * 2))
129
130#define PIC_ITE0_N0_N1 0x54
131#define PIC_ITE1_N0_N1 0x58
132#define PIC_ITE2_N0_N1 0x5c
133#define PIC_ITE3_N0_N1 0x60
134#define PIC_ITE4_N0_N1 0x64
135#define PIC_ITE5_N0_N1 0x68
136#define PIC_ITE6_N0_N1 0x6c
137#define PIC_ITE7_N0_N1 0x70
138#define PIC_ITE_N0_N1(i) (PIC_ITE0_N0_N1 + ((i) * 4))
139
140#define PIC_ITE0_N2_N3 0x56
141#define PIC_ITE1_N2_N3 0x5a
142#define PIC_ITE2_N2_N3 0x5e
143#define PIC_ITE3_N2_N3 0x62
144#define PIC_ITE4_N2_N3 0x66
145#define PIC_ITE5_N2_N3 0x6a
146#define PIC_ITE6_N2_N3 0x6e
147#define PIC_ITE7_N2_N3 0x72
148#define PIC_ITE_N2_N3(i) (PIC_ITE0_N2_N3 + ((i) * 4))
149
150#define PIC_IRT0 0x74
151#define PIC_IRT(i) (PIC_IRT0 + ((i) * 2))
152
153#define PIC_9XX_PENDING_0 0x6
154#define PIC_9XX_PENDING_1 0x8
155#define PIC_9XX_PENDING_2 0xa
156#define PIC_9XX_PENDING_3 0xc
157
158#define PIC_9XX_IRT0 0x1c0
159#define PIC_9XX_IRT(i) (PIC_9XX_IRT0 + ((i) * 2))
160
161/*
162 * IRT Map
163 */
164#define PIC_NUM_IRTS 160
165#define PIC_9XX_NUM_IRTS 256
166
167#define PIC_IRT_WD_0_INDEX 0
168#define PIC_IRT_WD_1_INDEX 1
169#define PIC_IRT_WD_NMI_0_INDEX 2
170#define PIC_IRT_WD_NMI_1_INDEX 3
171#define PIC_IRT_TIMER_0_INDEX 4
172#define PIC_IRT_TIMER_1_INDEX 5
173#define PIC_IRT_TIMER_2_INDEX 6
174#define PIC_IRT_TIMER_3_INDEX 7
175#define PIC_IRT_TIMER_4_INDEX 8
176#define PIC_IRT_TIMER_5_INDEX 9
177#define PIC_IRT_TIMER_6_INDEX 10
178#define PIC_IRT_TIMER_7_INDEX 11
179#define PIC_IRT_CLOCK_INDEX PIC_IRT_TIMER_7_INDEX
180#define PIC_IRT_TIMER_INDEX(num) ((num) + PIC_IRT_TIMER_0_INDEX)
181
182
183/* 11 and 12 */
184#define PIC_NUM_MSG_Q_IRTS 32
185#define PIC_IRT_MSG_Q0_INDEX 12
186#define PIC_IRT_MSG_Q_INDEX(qid) ((qid) + PIC_IRT_MSG_Q0_INDEX)
187/* 12 to 43 */
188#define PIC_IRT_MSG_0_INDEX 44
189#define PIC_IRT_MSG_1_INDEX 45
190/* 44 and 45 */
191#define PIC_NUM_PCIE_MSIX_IRTS 32
192#define PIC_IRT_PCIE_MSIX_0_INDEX 46
193#define PIC_IRT_PCIE_MSIX_INDEX(num) ((num) + PIC_IRT_PCIE_MSIX_0_INDEX)
194/* 46 to 77 */
195#define PIC_NUM_PCIE_LINK_IRTS 4
196#define PIC_IRT_PCIE_LINK_0_INDEX 78
197#define PIC_IRT_PCIE_LINK_1_INDEX 79
198#define PIC_IRT_PCIE_LINK_2_INDEX 80
199#define PIC_IRT_PCIE_LINK_3_INDEX 81
200#define PIC_IRT_PCIE_LINK_INDEX(num) ((num) + PIC_IRT_PCIE_LINK_0_INDEX)
201
202#define PIC_9XX_IRT_PCIE_LINK_0_INDEX 191
203#define PIC_9XX_IRT_PCIE_LINK_INDEX(num) \
204 ((num) + PIC_9XX_IRT_PCIE_LINK_0_INDEX)
205
206#define PIC_CLOCK_TIMER 7
207
208#if !defined(LOCORE) && !defined(__ASSEMBLY__)
209
210/*
211 * Misc
212 */
213#define PIC_IRT_VALID 1
214#define PIC_LOCAL_SCHEDULING 1
215#define PIC_GLOBAL_SCHEDULING 0
216
217#define nlm_read_pic_reg(b, r) nlm_read_reg64(b, r)
218#define nlm_write_pic_reg(b, r, v) nlm_write_reg64(b, r, v)
219#define nlm_get_pic_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
220 XLP9XX_IO_PIC_OFFSET(node) : XLP_IO_PIC_OFFSET(node))
221#define nlm_get_pic_regbase(node) (nlm_get_pic_pcibase(node) + XLP_IO_PCI_HDRSZ)
222
223/* We use PIC on node 0 as a timer */
224#define pic_timer_freq() nlm_get_pic_frequency(0)
225
226/* IRT and h/w interrupt routines */
227static inline void
228nlm_9xx_pic_write_irt(uint64_t base, int irt_num, int en, int nmi,
229 int sch, int vec, int dt, int db, int cpu)
230{
231 uint64_t val;
232
233 val = (((uint64_t)en & 0x1) << 22) | ((nmi & 0x1) << 23) |
234 ((0 /*mc*/) << 20) | ((vec & 0x3f) << 24) |
235 ((dt & 0x1) << 21) | (0 /*ptr*/ << 16) |
236 (cpu & 0x3ff);
237
238 nlm_write_pic_reg(base, PIC_9XX_IRT(irt_num), val);
239}
240
241static inline void
242nlm_pic_write_irt(uint64_t base, int irt_num, int en, int nmi,
243 int sch, int vec, int dt, int db, int dte)
244{
245 uint64_t val;
246
247 val = (((uint64_t)en & 0x1) << 31) | ((nmi & 0x1) << 29) |
248 ((sch & 0x1) << 28) | ((vec & 0x3f) << 20) |
249 ((dt & 0x1) << 19) | ((db & 0x7) << 16) |
250 (dte & 0xffff);
251
252 nlm_write_pic_reg(base, PIC_IRT(irt_num), val);
253}
254
255static inline void
256nlm_pic_write_irt_direct(uint64_t base, int irt_num, int en, int nmi,
257 int sch, int vec, int cpu)
258{
259 if (cpu_is_xlp9xx())
260 nlm_9xx_pic_write_irt(base, irt_num, en, nmi, sch, vec,
261 1, 0, cpu);
262 else
263 nlm_pic_write_irt(base, irt_num, en, nmi, sch, vec, 1,
264 (cpu >> 4), /* thread group */
265 1 << (cpu & 0xf)); /* thread mask */
266}
267
268static inline uint64_t
269nlm_pic_read_timer(uint64_t base, int timer)
270{
271 return nlm_read_pic_reg(base, PIC_TIMER_COUNT(timer));
272}
273
274static inline uint32_t
275nlm_pic_read_timer32(uint64_t base, int timer)
276{
277 return (uint32_t)nlm_read_pic_reg(base, PIC_TIMER_COUNT(timer));
278}
279
280static inline void
281nlm_pic_write_timer(uint64_t base, int timer, uint64_t value)
282{
283 nlm_write_pic_reg(base, PIC_TIMER_COUNT(timer), value);
284}
285
286static inline void
287nlm_pic_set_timer(uint64_t base, int timer, uint64_t value, int irq, int cpu)
288{
289 uint64_t pic_ctrl = nlm_read_pic_reg(base, PIC_CTRL);
290 int en;
291
292 en = (irq > 0);
293 nlm_write_pic_reg(base, PIC_TIMER_MAXVAL(timer), value);
294 nlm_pic_write_irt_direct(base, PIC_IRT_TIMER_INDEX(timer),
295 en, 0, 0, irq, cpu);
296
297 /* enable the timer */
298 pic_ctrl |= (1 << (PIC_CTRL_STE + timer));
299 nlm_write_pic_reg(base, PIC_CTRL, pic_ctrl);
300}
301
302static inline void
303nlm_pic_enable_irt(uint64_t base, int irt)
304{
305 uint64_t reg;
306
307 if (cpu_is_xlp9xx()) {
308 reg = nlm_read_pic_reg(base, PIC_9XX_IRT(irt));
309 nlm_write_pic_reg(base, PIC_9XX_IRT(irt), reg | (1 << 22));
310 } else {
311 reg = nlm_read_pic_reg(base, PIC_IRT(irt));
312 nlm_write_pic_reg(base, PIC_IRT(irt), reg | (1u << 31));
313 }
314}
315
316static inline void
317nlm_pic_disable_irt(uint64_t base, int irt)
318{
319 uint64_t reg;
320
321 if (cpu_is_xlp9xx()) {
322 reg = nlm_read_pic_reg(base, PIC_9XX_IRT(irt));
323 reg &= ~((uint64_t)1 << 22);
324 nlm_write_pic_reg(base, PIC_9XX_IRT(irt), reg);
325 } else {
326 reg = nlm_read_pic_reg(base, PIC_IRT(irt));
327 reg &= ~((uint64_t)1 << 31);
328 nlm_write_pic_reg(base, PIC_IRT(irt), reg);
329 }
330}
331
332static inline void
333nlm_pic_send_ipi(uint64_t base, int hwt, int irq, int nmi)
334{
335 uint64_t ipi;
336
337 if (cpu_is_xlp9xx())
338 ipi = (nmi << 23) | (irq << 24) |
339 (0/*mcm*/ << 20) | (0/*ptr*/ << 16) | hwt;
340 else
341 ipi = ((uint64_t)nmi << 31) | (irq << 20) |
342 ((hwt >> 4) << 16) | (1 << (hwt & 0xf));
343
344 nlm_write_pic_reg(base, PIC_IPI_CTL, ipi);
345}
346
347static inline void
348nlm_pic_ack(uint64_t base, int irt_num)
349{
350 nlm_write_pic_reg(base, PIC_INT_ACK, irt_num);
351
352 /* Ack the Status register for Watchdog & System timers */
353 if (irt_num < 12)
354 nlm_write_pic_reg(base, PIC_STATUS, (1 << irt_num));
355}
356
357static inline void
358nlm_pic_init_irt(uint64_t base, int irt, int irq, int hwt, int en)
359{
360 nlm_pic_write_irt_direct(base, irt, en, 0, 0, irq, hwt);
361}
362
363int nlm_irq_to_irt(int irq);
364
365#endif /* __ASSEMBLY__ */
366#endif /* _NLM_HAL_PIC_H */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/sys.h b/arch/mips/include/asm/netlogic/xlp-hal/sys.h
new file mode 100644
index 000000000..6bcf3952e
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlp-hal/sys.h
@@ -0,0 +1,213 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef __NLM_HAL_SYS_H__
36#define __NLM_HAL_SYS_H__
37
38/**
39* @file_name sys.h
40* @author Netlogic Microsystems
41* @brief HAL for System configuration registers
42*/
43#define SYS_CHIP_RESET 0x00
44#define SYS_POWER_ON_RESET_CFG 0x01
45#define SYS_EFUSE_DEVICE_CFG_STATUS0 0x02
46#define SYS_EFUSE_DEVICE_CFG_STATUS1 0x03
47#define SYS_EFUSE_DEVICE_CFG_STATUS2 0x04
48#define SYS_EFUSE_DEVICE_CFG3 0x05
49#define SYS_EFUSE_DEVICE_CFG4 0x06
50#define SYS_EFUSE_DEVICE_CFG5 0x07
51#define SYS_EFUSE_DEVICE_CFG6 0x08
52#define SYS_EFUSE_DEVICE_CFG7 0x09
53#define SYS_PLL_CTRL 0x0a
54#define SYS_CPU_RESET 0x0b
55#define SYS_CPU_NONCOHERENT_MODE 0x0d
56#define SYS_CORE_DFS_DIS_CTRL 0x0e
57#define SYS_CORE_DFS_RST_CTRL 0x0f
58#define SYS_CORE_DFS_BYP_CTRL 0x10
59#define SYS_CORE_DFS_PHA_CTRL 0x11
60#define SYS_CORE_DFS_DIV_INC_CTRL 0x12
61#define SYS_CORE_DFS_DIV_DEC_CTRL 0x13
62#define SYS_CORE_DFS_DIV_VALUE 0x14
63#define SYS_RESET 0x15
64#define SYS_DFS_DIS_CTRL 0x16
65#define SYS_DFS_RST_CTRL 0x17
66#define SYS_DFS_BYP_CTRL 0x18
67#define SYS_DFS_DIV_INC_CTRL 0x19
68#define SYS_DFS_DIV_DEC_CTRL 0x1a
69#define SYS_DFS_DIV_VALUE0 0x1b
70#define SYS_DFS_DIV_VALUE1 0x1c
71#define SYS_SENSE_AMP_DLY 0x1d
72#define SYS_SOC_SENSE_AMP_DLY 0x1e
73#define SYS_CTRL0 0x1f
74#define SYS_CTRL1 0x20
75#define SYS_TIMEOUT_BS1 0x21
76#define SYS_BYTE_SWAP 0x22
77#define SYS_VRM_VID 0x23
78#define SYS_PWR_RAM_CMD 0x24
79#define SYS_PWR_RAM_ADDR 0x25
80#define SYS_PWR_RAM_DATA0 0x26
81#define SYS_PWR_RAM_DATA1 0x27
82#define SYS_PWR_RAM_DATA2 0x28
83#define SYS_PWR_UCODE 0x29
84#define SYS_CPU0_PWR_STATUS 0x2a
85#define SYS_CPU1_PWR_STATUS 0x2b
86#define SYS_CPU2_PWR_STATUS 0x2c
87#define SYS_CPU3_PWR_STATUS 0x2d
88#define SYS_CPU4_PWR_STATUS 0x2e
89#define SYS_CPU5_PWR_STATUS 0x2f
90#define SYS_CPU6_PWR_STATUS 0x30
91#define SYS_CPU7_PWR_STATUS 0x31
92#define SYS_STATUS 0x32
93#define SYS_INT_POL 0x33
94#define SYS_INT_TYPE 0x34
95#define SYS_INT_STATUS 0x35
96#define SYS_INT_MASK0 0x36
97#define SYS_INT_MASK1 0x37
98#define SYS_UCO_S_ECC 0x38
99#define SYS_UCO_M_ECC 0x39
100#define SYS_UCO_ADDR 0x3a
101#define SYS_UCO_INSTR 0x3b
102#define SYS_MEM_BIST0 0x3c
103#define SYS_MEM_BIST1 0x3d
104#define SYS_MEM_BIST2 0x3e
105#define SYS_MEM_BIST3 0x3f
106#define SYS_MEM_BIST4 0x40
107#define SYS_MEM_BIST5 0x41
108#define SYS_MEM_BIST6 0x42
109#define SYS_MEM_BIST7 0x43
110#define SYS_MEM_BIST8 0x44
111#define SYS_MEM_BIST9 0x45
112#define SYS_MEM_BIST10 0x46
113#define SYS_MEM_BIST11 0x47
114#define SYS_MEM_BIST12 0x48
115#define SYS_SCRTCH0 0x49
116#define SYS_SCRTCH1 0x4a
117#define SYS_SCRTCH2 0x4b
118#define SYS_SCRTCH3 0x4c
119
120/* PLL registers XLP2XX */
121#define SYS_CPU_PLL_CTRL0(core) (0x1c0 + (core * 4))
122#define SYS_CPU_PLL_CTRL1(core) (0x1c1 + (core * 4))
123#define SYS_CPU_PLL_CTRL2(core) (0x1c2 + (core * 4))
124#define SYS_CPU_PLL_CTRL3(core) (0x1c3 + (core * 4))
125#define SYS_PLL_CTRL0 0x240
126#define SYS_PLL_CTRL1 0x241
127#define SYS_PLL_CTRL2 0x242
128#define SYS_PLL_CTRL3 0x243
129#define SYS_DMC_PLL_CTRL0 0x244
130#define SYS_DMC_PLL_CTRL1 0x245
131#define SYS_DMC_PLL_CTRL2 0x246
132#define SYS_DMC_PLL_CTRL3 0x247
133
134#define SYS_PLL_CTRL0_DEVX(x) (0x248 + (x) * 4)
135#define SYS_PLL_CTRL1_DEVX(x) (0x249 + (x) * 4)
136#define SYS_PLL_CTRL2_DEVX(x) (0x24a + (x) * 4)
137#define SYS_PLL_CTRL3_DEVX(x) (0x24b + (x) * 4)
138
139#define SYS_CPU_PLL_CHG_CTRL 0x288
140#define SYS_PLL_CHG_CTRL 0x289
141#define SYS_CLK_DEV_DIS 0x28a
142#define SYS_CLK_DEV_SEL 0x28b
143#define SYS_CLK_DEV_DIV 0x28c
144#define SYS_CLK_DEV_CHG 0x28d
145#define SYS_CLK_DEV_SEL_REG 0x28e
146#define SYS_CLK_DEV_DIV_REG 0x28f
147#define SYS_CPU_PLL_LOCK 0x29f
148#define SYS_SYS_PLL_LOCK 0x2a0
149#define SYS_PLL_MEM_CMD 0x2a1
150#define SYS_CPU_PLL_MEM_REQ 0x2a2
151#define SYS_SYS_PLL_MEM_REQ 0x2a3
152#define SYS_PLL_MEM_STAT 0x2a4
153
154/* PLL registers XLP9XX */
155#define SYS_9XX_CPU_PLL_CTRL0(core) (0xc0 + (core * 4))
156#define SYS_9XX_CPU_PLL_CTRL1(core) (0xc1 + (core * 4))
157#define SYS_9XX_CPU_PLL_CTRL2(core) (0xc2 + (core * 4))
158#define SYS_9XX_CPU_PLL_CTRL3(core) (0xc3 + (core * 4))
159#define SYS_9XX_DMC_PLL_CTRL0 0x140
160#define SYS_9XX_DMC_PLL_CTRL1 0x141
161#define SYS_9XX_DMC_PLL_CTRL2 0x142
162#define SYS_9XX_DMC_PLL_CTRL3 0x143
163#define SYS_9XX_PLL_CTRL0 0x144
164#define SYS_9XX_PLL_CTRL1 0x145
165#define SYS_9XX_PLL_CTRL2 0x146
166#define SYS_9XX_PLL_CTRL3 0x147
167
168#define SYS_9XX_PLL_CTRL0_DEVX(x) (0x148 + (x) * 4)
169#define SYS_9XX_PLL_CTRL1_DEVX(x) (0x149 + (x) * 4)
170#define SYS_9XX_PLL_CTRL2_DEVX(x) (0x14a + (x) * 4)
171#define SYS_9XX_PLL_CTRL3_DEVX(x) (0x14b + (x) * 4)
172
173#define SYS_9XX_CPU_PLL_CHG_CTRL 0x188
174#define SYS_9XX_PLL_CHG_CTRL 0x189
175#define SYS_9XX_CLK_DEV_DIS 0x18a
176#define SYS_9XX_CLK_DEV_SEL 0x18b
177#define SYS_9XX_CLK_DEV_DIV 0x18d
178#define SYS_9XX_CLK_DEV_CHG 0x18f
179
180#define SYS_9XX_CLK_DEV_SEL_REG 0x1a4
181#define SYS_9XX_CLK_DEV_DIV_REG 0x1a6
182
183/* Registers changed on 9XX */
184#define SYS_9XX_POWER_ON_RESET_CFG 0x00
185#define SYS_9XX_CHIP_RESET 0x01
186#define SYS_9XX_CPU_RESET 0x02
187#define SYS_9XX_CPU_NONCOHERENT_MODE 0x03
188
189/* XLP 9XX fuse block registers */
190#define FUSE_9XX_DEVCFG6 0xc6
191
192#ifndef __ASSEMBLY__
193
194#define nlm_read_sys_reg(b, r) nlm_read_reg(b, r)
195#define nlm_write_sys_reg(b, r, v) nlm_write_reg(b, r, v)
196#define nlm_get_sys_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
197 XLP9XX_IO_SYS_OFFSET(node) : XLP_IO_SYS_OFFSET(node))
198#define nlm_get_sys_regbase(node) (nlm_get_sys_pcibase(node) + XLP_IO_PCI_HDRSZ)
199
200/* XLP9XX fuse block */
201#define nlm_get_fuse_pcibase(node) \
202 nlm_pcicfg_base(XLP9XX_IO_FUSE_OFFSET(node))
203#define nlm_get_fuse_regbase(node) \
204 (nlm_get_fuse_pcibase(node) + XLP_IO_PCI_HDRSZ)
205
206#define nlm_get_clock_pcibase(node) \
207 nlm_pcicfg_base(XLP9XX_IO_CLOCK_OFFSET(node))
208#define nlm_get_clock_regbase(node) \
209 (nlm_get_clock_pcibase(node) + XLP_IO_PCI_HDRSZ)
210
211unsigned int nlm_get_pic_frequency(int node);
212#endif
213#endif
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/uart.h b/arch/mips/include/asm/netlogic/xlp-hal/uart.h
new file mode 100644
index 000000000..a6c54424d
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlp-hal/uart.h
@@ -0,0 +1,192 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef __XLP_HAL_UART_H__
36#define __XLP_HAL_UART_H__
37
38/* UART Specific registers */
39#define UART_RX_DATA 0x00
40#define UART_TX_DATA 0x00
41
42#define UART_INT_EN 0x01
43#define UART_INT_ID 0x02
44#define UART_FIFO_CTL 0x02
45#define UART_LINE_CTL 0x03
46#define UART_MODEM_CTL 0x04
47#define UART_LINE_STS 0x05
48#define UART_MODEM_STS 0x06
49
50#define UART_DIVISOR0 0x00
51#define UART_DIVISOR1 0x01
52
53#define BASE_BAUD (XLP_IO_CLK/16)
54#define BAUD_DIVISOR(baud) (BASE_BAUD / baud)
55
56/* LCR mask values */
57#define LCR_5BITS 0x00
58#define LCR_6BITS 0x01
59#define LCR_7BITS 0x02
60#define LCR_8BITS 0x03
61#define LCR_STOPB 0x04
62#define LCR_PENAB 0x08
63#define LCR_PODD 0x00
64#define LCR_PEVEN 0x10
65#define LCR_PONE 0x20
66#define LCR_PZERO 0x30
67#define LCR_SBREAK 0x40
68#define LCR_EFR_ENABLE 0xbf
69#define LCR_DLAB 0x80
70
71/* MCR mask values */
72#define MCR_DTR 0x01
73#define MCR_RTS 0x02
74#define MCR_DRS 0x04
75#define MCR_IE 0x08
76#define MCR_LOOPBACK 0x10
77
78/* FCR mask values */
79#define FCR_RCV_RST 0x02
80#define FCR_XMT_RST 0x04
81#define FCR_RX_LOW 0x00
82#define FCR_RX_MEDL 0x40
83#define FCR_RX_MEDH 0x80
84#define FCR_RX_HIGH 0xc0
85
86/* IER mask values */
87#define IER_ERXRDY 0x1
88#define IER_ETXRDY 0x2
89#define IER_ERLS 0x4
90#define IER_EMSC 0x8
91
92#if !defined(LOCORE) && !defined(__ASSEMBLY__)
93
94#define nlm_read_uart_reg(b, r) nlm_read_reg(b, r)
95#define nlm_write_uart_reg(b, r, v) nlm_write_reg(b, r, v)
96#define nlm_get_uart_pcibase(node, inst) \
97 nlm_pcicfg_base(cpu_is_xlp9xx() ? XLP9XX_IO_UART_OFFSET(node) : \
98 XLP_IO_UART_OFFSET(node, inst))
99#define nlm_get_uart_regbase(node, inst) \
100 (nlm_get_uart_pcibase(node, inst) + XLP_IO_PCI_HDRSZ)
101
102static inline void
103nlm_uart_set_baudrate(uint64_t base, int baud)
104{
105 uint32_t lcr;
106
107 lcr = nlm_read_uart_reg(base, UART_LINE_CTL);
108
109 /* enable divisor register, and write baud values */
110 nlm_write_uart_reg(base, UART_LINE_CTL, lcr | (1 << 7));
111 nlm_write_uart_reg(base, UART_DIVISOR0,
112 (BAUD_DIVISOR(baud) & 0xff));
113 nlm_write_uart_reg(base, UART_DIVISOR1,
114 ((BAUD_DIVISOR(baud) >> 8) & 0xff));
115
116 /* restore default lcr */
117 nlm_write_uart_reg(base, UART_LINE_CTL, lcr);
118}
119
120static inline void
121nlm_uart_outbyte(uint64_t base, char c)
122{
123 uint32_t lsr;
124
125 for (;;) {
126 lsr = nlm_read_uart_reg(base, UART_LINE_STS);
127 if (lsr & 0x20)
128 break;
129 }
130
131 nlm_write_uart_reg(base, UART_TX_DATA, (int)c);
132}
133
134static inline char
135nlm_uart_inbyte(uint64_t base)
136{
137 int data, lsr;
138
139 for (;;) {
140 lsr = nlm_read_uart_reg(base, UART_LINE_STS);
141 if (lsr & 0x80) { /* parity/frame/break-error - push a zero */
142 data = 0;
143 break;
144 }
145 if (lsr & 0x01) { /* Rx data */
146 data = nlm_read_uart_reg(base, UART_RX_DATA);
147 break;
148 }
149 }
150
151 return (char)data;
152}
153
154static inline int
155nlm_uart_init(uint64_t base, int baud, int databits, int stopbits,
156 int parity, int int_en, int loopback)
157{
158 uint32_t lcr;
159
160 lcr = 0;
161 if (databits >= 8)
162 lcr |= LCR_8BITS;
163 else if (databits == 7)
164 lcr |= LCR_7BITS;
165 else if (databits == 6)
166 lcr |= LCR_6BITS;
167 else
168 lcr |= LCR_5BITS;
169
170 if (stopbits > 1)
171 lcr |= LCR_STOPB;
172
173 lcr |= parity << 3;
174
175 /* setup default lcr */
176 nlm_write_uart_reg(base, UART_LINE_CTL, lcr);
177
178 /* Reset the FIFOs */
179 nlm_write_uart_reg(base, UART_LINE_CTL, FCR_RCV_RST | FCR_XMT_RST);
180
181 nlm_uart_set_baudrate(base, baud);
182
183 if (loopback)
184 nlm_write_uart_reg(base, UART_MODEM_CTL, 0x1f);
185
186 if (int_en)
187 nlm_write_uart_reg(base, UART_INT_EN, IER_ERXRDY | IER_ETXRDY);
188
189 return 0;
190}
191#endif /* !LOCORE && !__ASSEMBLY__ */
192#endif /* __XLP_HAL_UART_H__ */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
new file mode 100644
index 000000000..feb6ed807
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
@@ -0,0 +1,119 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _NLM_HAL_XLP_H
36#define _NLM_HAL_XLP_H
37
38#define PIC_UART_0_IRQ 17
39#define PIC_UART_1_IRQ 18
40
41#define PIC_PCIE_LINK_LEGACY_IRQ_BASE 19
42#define PIC_PCIE_LINK_LEGACY_IRQ(i) (19 + (i))
43
44#define PIC_EHCI_0_IRQ 23
45#define PIC_EHCI_1_IRQ 24
46#define PIC_OHCI_0_IRQ 25
47#define PIC_OHCI_1_IRQ 26
48#define PIC_OHCI_2_IRQ 27
49#define PIC_OHCI_3_IRQ 28
50#define PIC_2XX_XHCI_0_IRQ 23
51#define PIC_2XX_XHCI_1_IRQ 24
52#define PIC_2XX_XHCI_2_IRQ 25
53#define PIC_9XX_XHCI_0_IRQ 23
54#define PIC_9XX_XHCI_1_IRQ 24
55#define PIC_9XX_XHCI_2_IRQ 25
56
57#define PIC_MMC_IRQ 29
58#define PIC_I2C_0_IRQ 30
59#define PIC_I2C_1_IRQ 31
60#define PIC_I2C_2_IRQ 32
61#define PIC_I2C_3_IRQ 33
62#define PIC_SPI_IRQ 34
63#define PIC_NAND_IRQ 37
64#define PIC_SATA_IRQ 38
65#define PIC_GPIO_IRQ 39
66
67#define PIC_PCIE_LINK_MSI_IRQ_BASE 44 /* 44 - 47 MSI IRQ */
68#define PIC_PCIE_LINK_MSI_IRQ(i) (44 + (i))
69
70/* MSI-X with second link-level dispatch */
71#define PIC_PCIE_MSIX_IRQ_BASE 48 /* 48 - 51 MSI-X IRQ */
72#define PIC_PCIE_MSIX_IRQ(i) (48 + (i))
73
74/* XLP9xx and XLP8xx has 128 and 32 MSIX vectors respectively */
75#define NLM_MSIX_VEC_BASE 96 /* 96 - 223 - MSIX mapped */
76#define NLM_MSI_VEC_BASE 224 /* 224 -351 - MSI mapped */
77
78#define NLM_PIC_INDIRECT_VEC_BASE 512
79#define NLM_GPIO_VEC_BASE 768
80
81#define PIC_IRQ_BASE 8
82#define PIC_IRT_FIRST_IRQ PIC_IRQ_BASE
83#define PIC_IRT_LAST_IRQ 63
84
85#ifndef __ASSEMBLY__
86
87/* SMP support functions */
88void xlp_boot_core0_siblings(void);
89void xlp_wakeup_secondary_cpus(void);
90
91void xlp_mmu_init(void);
92void nlm_hal_init(void);
93int nlm_get_dram_map(int node, uint64_t *dram_map, int nentries);
94
95struct pci_dev;
96int xlp_socdev_to_node(const struct pci_dev *dev);
97
98/* Device tree related */
99void xlp_early_init_devtree(void);
100void *xlp_dt_init(void *fdtp);
101
102static inline int cpu_is_xlpii(void)
103{
104 int chip = read_c0_prid() & PRID_IMP_MASK;
105
106 return chip == PRID_IMP_NETLOGIC_XLP2XX ||
107 chip == PRID_IMP_NETLOGIC_XLP9XX ||
108 chip == PRID_IMP_NETLOGIC_XLP5XX;
109}
110
111static inline int cpu_is_xlp9xx(void)
112{
113 int chip = read_c0_prid() & PRID_IMP_MASK;
114
115 return chip == PRID_IMP_NETLOGIC_XLP9XX ||
116 chip == PRID_IMP_NETLOGIC_XLP5XX;
117}
118#endif /* !__ASSEMBLY__ */
119#endif /* _ASM_NLM_XLP_H */
diff --git a/arch/mips/include/asm/netlogic/xlr/bridge.h b/arch/mips/include/asm/netlogic/xlr/bridge.h
new file mode 100644
index 000000000..2d02428c4
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlr/bridge.h
@@ -0,0 +1,104 @@
1/*
2 * Copyright (c) 2003-2012 Broadcom Corporation
3 * All Rights Reserved
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the Broadcom
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34#ifndef _ASM_NLM_BRIDGE_H_
35#define _ASM_NLM_BRIDGE_H_
36
37#define BRIDGE_DRAM_0_BAR 0
38#define BRIDGE_DRAM_1_BAR 1
39#define BRIDGE_DRAM_2_BAR 2
40#define BRIDGE_DRAM_3_BAR 3
41#define BRIDGE_DRAM_4_BAR 4
42#define BRIDGE_DRAM_5_BAR 5
43#define BRIDGE_DRAM_6_BAR 6
44#define BRIDGE_DRAM_7_BAR 7
45#define BRIDGE_DRAM_CHN_0_MTR_0_BAR 8
46#define BRIDGE_DRAM_CHN_0_MTR_1_BAR 9
47#define BRIDGE_DRAM_CHN_0_MTR_2_BAR 10
48#define BRIDGE_DRAM_CHN_0_MTR_3_BAR 11
49#define BRIDGE_DRAM_CHN_0_MTR_4_BAR 12
50#define BRIDGE_DRAM_CHN_0_MTR_5_BAR 13
51#define BRIDGE_DRAM_CHN_0_MTR_6_BAR 14
52#define BRIDGE_DRAM_CHN_0_MTR_7_BAR 15
53#define BRIDGE_DRAM_CHN_1_MTR_0_BAR 16
54#define BRIDGE_DRAM_CHN_1_MTR_1_BAR 17
55#define BRIDGE_DRAM_CHN_1_MTR_2_BAR 18
56#define BRIDGE_DRAM_CHN_1_MTR_3_BAR 19
57#define BRIDGE_DRAM_CHN_1_MTR_4_BAR 20
58#define BRIDGE_DRAM_CHN_1_MTR_5_BAR 21
59#define BRIDGE_DRAM_CHN_1_MTR_6_BAR 22
60#define BRIDGE_DRAM_CHN_1_MTR_7_BAR 23
61#define BRIDGE_CFG_BAR 24
62#define BRIDGE_PHNX_IO_BAR 25
63#define BRIDGE_FLASH_BAR 26
64#define BRIDGE_SRAM_BAR 27
65#define BRIDGE_HTMEM_BAR 28
66#define BRIDGE_HTINT_BAR 29
67#define BRIDGE_HTPIC_BAR 30
68#define BRIDGE_HTSM_BAR 31
69#define BRIDGE_HTIO_BAR 32
70#define BRIDGE_HTCFG_BAR 33
71#define BRIDGE_PCIXCFG_BAR 34
72#define BRIDGE_PCIXMEM_BAR 35
73#define BRIDGE_PCIXIO_BAR 36
74#define BRIDGE_DEVICE_MASK 37
75#define BRIDGE_AERR_INTR_LOG1 38
76#define BRIDGE_AERR_INTR_LOG2 39
77#define BRIDGE_AERR_INTR_LOG3 40
78#define BRIDGE_AERR_DEV_STAT 41
79#define BRIDGE_AERR1_LOG1 42
80#define BRIDGE_AERR1_LOG2 43
81#define BRIDGE_AERR1_LOG3 44
82#define BRIDGE_AERR1_DEV_STAT 45
83#define BRIDGE_AERR_INTR_EN 46
84#define BRIDGE_AERR_UPG 47
85#define BRIDGE_AERR_CLEAR 48
86#define BRIDGE_AERR1_CLEAR 49
87#define BRIDGE_SBE_COUNTS 50
88#define BRIDGE_DBE_COUNTS 51
89#define BRIDGE_BITERR_INT_EN 52
90
91#define BRIDGE_SYS2IO_CREDITS 53
92#define BRIDGE_EVNT_CNT_CTRL1 54
93#define BRIDGE_EVNT_COUNTER1 55
94#define BRIDGE_EVNT_CNT_CTRL2 56
95#define BRIDGE_EVNT_COUNTER2 57
96#define BRIDGE_RESERVED1 58
97
98#define BRIDGE_DEFEATURE 59
99#define BRIDGE_SCRATCH0 60
100#define BRIDGE_SCRATCH1 61
101#define BRIDGE_SCRATCH2 62
102#define BRIDGE_SCRATCH3 63
103
104#endif
diff --git a/arch/mips/include/asm/netlogic/xlr/flash.h b/arch/mips/include/asm/netlogic/xlr/flash.h
new file mode 100644
index 000000000..f8aca5472
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlr/flash.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright (c) 2003-2012 Broadcom Corporation
3 * All Rights Reserved
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the Broadcom
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34#ifndef _ASM_NLM_FLASH_H_
35#define _ASM_NLM_FLASH_H_
36
37#define FLASH_CSBASE_ADDR(cs) (cs)
38#define FLASH_CSADDR_MASK(cs) (0x10 + (cs))
39#define FLASH_CSDEV_PARM(cs) (0x20 + (cs))
40#define FLASH_CSTIME_PARMA(cs) (0x30 + (cs))
41#define FLASH_CSTIME_PARMB(cs) (0x40 + (cs))
42
43#define FLASH_INT_MASK 0x50
44#define FLASH_INT_STATUS 0x60
45#define FLASH_ERROR_STATUS 0x70
46#define FLASH_ERROR_ADDR 0x80
47
48#define FLASH_NAND_CLE(cs) (0x90 + (cs))
49#define FLASH_NAND_ALE(cs) (0xa0 + (cs))
50
51#define FLASH_NAND_CSDEV_PARAM 0x000041e6
52#define FLASH_NAND_CSTIME_PARAMA 0x4f400e22
53#define FLASH_NAND_CSTIME_PARAMB 0x000083cf
54
55#endif
diff --git a/arch/mips/include/asm/netlogic/xlr/fmn.h b/arch/mips/include/asm/netlogic/xlr/fmn.h
new file mode 100644
index 000000000..d79c68fa7
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlr/fmn.h
@@ -0,0 +1,365 @@
1/*
2 * Copyright (c) 2003-2012 Broadcom Corporation
3 * All Rights Reserved
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the Broadcom
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _NLM_FMN_H_
36#define _NLM_FMN_H_
37
38#include <asm/netlogic/mips-extns.h> /* for COP2 access */
39
40/* Station IDs */
41#define FMN_STNID_CPU0 0x00
42#define FMN_STNID_CPU1 0x08
43#define FMN_STNID_CPU2 0x10
44#define FMN_STNID_CPU3 0x18
45#define FMN_STNID_CPU4 0x20
46#define FMN_STNID_CPU5 0x28
47#define FMN_STNID_CPU6 0x30
48#define FMN_STNID_CPU7 0x38
49
50#define FMN_STNID_XGS0_TX 64
51#define FMN_STNID_XMAC0_00_TX 64
52#define FMN_STNID_XMAC0_01_TX 65
53#define FMN_STNID_XMAC0_02_TX 66
54#define FMN_STNID_XMAC0_03_TX 67
55#define FMN_STNID_XMAC0_04_TX 68
56#define FMN_STNID_XMAC0_05_TX 69
57#define FMN_STNID_XMAC0_06_TX 70
58#define FMN_STNID_XMAC0_07_TX 71
59#define FMN_STNID_XMAC0_08_TX 72
60#define FMN_STNID_XMAC0_09_TX 73
61#define FMN_STNID_XMAC0_10_TX 74
62#define FMN_STNID_XMAC0_11_TX 75
63#define FMN_STNID_XMAC0_12_TX 76
64#define FMN_STNID_XMAC0_13_TX 77
65#define FMN_STNID_XMAC0_14_TX 78
66#define FMN_STNID_XMAC0_15_TX 79
67
68#define FMN_STNID_XGS1_TX 80
69#define FMN_STNID_XMAC1_00_TX 80
70#define FMN_STNID_XMAC1_01_TX 81
71#define FMN_STNID_XMAC1_02_TX 82
72#define FMN_STNID_XMAC1_03_TX 83
73#define FMN_STNID_XMAC1_04_TX 84
74#define FMN_STNID_XMAC1_05_TX 85
75#define FMN_STNID_XMAC1_06_TX 86
76#define FMN_STNID_XMAC1_07_TX 87
77#define FMN_STNID_XMAC1_08_TX 88
78#define FMN_STNID_XMAC1_09_TX 89
79#define FMN_STNID_XMAC1_10_TX 90
80#define FMN_STNID_XMAC1_11_TX 91
81#define FMN_STNID_XMAC1_12_TX 92
82#define FMN_STNID_XMAC1_13_TX 93
83#define FMN_STNID_XMAC1_14_TX 94
84#define FMN_STNID_XMAC1_15_TX 95
85
86#define FMN_STNID_GMAC 96
87#define FMN_STNID_GMACJFR_0 96
88#define FMN_STNID_GMACRFR_0 97
89#define FMN_STNID_GMACTX0 98
90#define FMN_STNID_GMACTX1 99
91#define FMN_STNID_GMACTX2 100
92#define FMN_STNID_GMACTX3 101
93#define FMN_STNID_GMACJFR_1 102
94#define FMN_STNID_GMACRFR_1 103
95
96#define FMN_STNID_DMA 104
97#define FMN_STNID_DMA_0 104
98#define FMN_STNID_DMA_1 105
99#define FMN_STNID_DMA_2 106
100#define FMN_STNID_DMA_3 107
101
102#define FMN_STNID_XGS0FR 112
103#define FMN_STNID_XMAC0JFR 112
104#define FMN_STNID_XMAC0RFR 113
105
106#define FMN_STNID_XGS1FR 114
107#define FMN_STNID_XMAC1JFR 114
108#define FMN_STNID_XMAC1RFR 115
109#define FMN_STNID_SEC 120
110#define FMN_STNID_SEC0 120
111#define FMN_STNID_SEC1 121
112#define FMN_STNID_SEC2 122
113#define FMN_STNID_SEC3 123
114#define FMN_STNID_PK0 124
115#define FMN_STNID_SEC_RSA 124
116#define FMN_STNID_SEC_RSVD0 125
117#define FMN_STNID_SEC_RSVD1 126
118#define FMN_STNID_SEC_RSVD2 127
119
120#define FMN_STNID_GMAC1 80
121#define FMN_STNID_GMAC1_FR_0 81
122#define FMN_STNID_GMAC1_TX0 82
123#define FMN_STNID_GMAC1_TX1 83
124#define FMN_STNID_GMAC1_TX2 84
125#define FMN_STNID_GMAC1_TX3 85
126#define FMN_STNID_GMAC1_FR_1 87
127#define FMN_STNID_GMAC0 96
128#define FMN_STNID_GMAC0_FR_0 97
129#define FMN_STNID_GMAC0_TX0 98
130#define FMN_STNID_GMAC0_TX1 99
131#define FMN_STNID_GMAC0_TX2 100
132#define FMN_STNID_GMAC0_TX3 101
133#define FMN_STNID_GMAC0_FR_1 103
134#define FMN_STNID_CMP_0 108
135#define FMN_STNID_CMP_1 109
136#define FMN_STNID_CMP_2 110
137#define FMN_STNID_CMP_3 111
138#define FMN_STNID_PCIE_0 116
139#define FMN_STNID_PCIE_1 117
140#define FMN_STNID_PCIE_2 118
141#define FMN_STNID_PCIE_3 119
142#define FMN_STNID_XLS_PK0 121
143
144#define nlm_read_c2_cc0(s) __read_32bit_c2_register($16, s)
145#define nlm_read_c2_cc1(s) __read_32bit_c2_register($17, s)
146#define nlm_read_c2_cc2(s) __read_32bit_c2_register($18, s)
147#define nlm_read_c2_cc3(s) __read_32bit_c2_register($19, s)
148#define nlm_read_c2_cc4(s) __read_32bit_c2_register($20, s)
149#define nlm_read_c2_cc5(s) __read_32bit_c2_register($21, s)
150#define nlm_read_c2_cc6(s) __read_32bit_c2_register($22, s)
151#define nlm_read_c2_cc7(s) __read_32bit_c2_register($23, s)
152#define nlm_read_c2_cc8(s) __read_32bit_c2_register($24, s)
153#define nlm_read_c2_cc9(s) __read_32bit_c2_register($25, s)
154#define nlm_read_c2_cc10(s) __read_32bit_c2_register($26, s)
155#define nlm_read_c2_cc11(s) __read_32bit_c2_register($27, s)
156#define nlm_read_c2_cc12(s) __read_32bit_c2_register($28, s)
157#define nlm_read_c2_cc13(s) __read_32bit_c2_register($29, s)
158#define nlm_read_c2_cc14(s) __read_32bit_c2_register($30, s)
159#define nlm_read_c2_cc15(s) __read_32bit_c2_register($31, s)
160
161#define nlm_write_c2_cc0(s, v) __write_32bit_c2_register($16, s, v)
162#define nlm_write_c2_cc1(s, v) __write_32bit_c2_register($17, s, v)
163#define nlm_write_c2_cc2(s, v) __write_32bit_c2_register($18, s, v)
164#define nlm_write_c2_cc3(s, v) __write_32bit_c2_register($19, s, v)
165#define nlm_write_c2_cc4(s, v) __write_32bit_c2_register($20, s, v)
166#define nlm_write_c2_cc5(s, v) __write_32bit_c2_register($21, s, v)
167#define nlm_write_c2_cc6(s, v) __write_32bit_c2_register($22, s, v)
168#define nlm_write_c2_cc7(s, v) __write_32bit_c2_register($23, s, v)
169#define nlm_write_c2_cc8(s, v) __write_32bit_c2_register($24, s, v)
170#define nlm_write_c2_cc9(s, v) __write_32bit_c2_register($25, s, v)
171#define nlm_write_c2_cc10(s, v) __write_32bit_c2_register($26, s, v)
172#define nlm_write_c2_cc11(s, v) __write_32bit_c2_register($27, s, v)
173#define nlm_write_c2_cc12(s, v) __write_32bit_c2_register($28, s, v)
174#define nlm_write_c2_cc13(s, v) __write_32bit_c2_register($29, s, v)
175#define nlm_write_c2_cc14(s, v) __write_32bit_c2_register($30, s, v)
176#define nlm_write_c2_cc15(s, v) __write_32bit_c2_register($31, s, v)
177
178#define nlm_read_c2_status0() __read_32bit_c2_register($2, 0)
179#define nlm_write_c2_status0(v) __write_32bit_c2_register($2, 0, v)
180#define nlm_read_c2_status1() __read_32bit_c2_register($2, 1)
181#define nlm_write_c2_status1(v) __write_32bit_c2_register($2, 1, v)
182#define nlm_read_c2_status(sel) __read_32bit_c2_register($2, 0)
183#define nlm_read_c2_config() __read_32bit_c2_register($3, 0)
184#define nlm_write_c2_config(v) __write_32bit_c2_register($3, 0, v)
185#define nlm_read_c2_bucksize(b) __read_32bit_c2_register($4, b)
186#define nlm_write_c2_bucksize(b, v) __write_32bit_c2_register($4, b, v)
187
188#define nlm_read_c2_rx_msg0() __read_64bit_c2_register($1, 0)
189#define nlm_read_c2_rx_msg1() __read_64bit_c2_register($1, 1)
190#define nlm_read_c2_rx_msg2() __read_64bit_c2_register($1, 2)
191#define nlm_read_c2_rx_msg3() __read_64bit_c2_register($1, 3)
192
193#define nlm_write_c2_tx_msg0(v) __write_64bit_c2_register($0, 0, v)
194#define nlm_write_c2_tx_msg1(v) __write_64bit_c2_register($0, 1, v)
195#define nlm_write_c2_tx_msg2(v) __write_64bit_c2_register($0, 2, v)
196#define nlm_write_c2_tx_msg3(v) __write_64bit_c2_register($0, 3, v)
197
198#define FMN_STN_RX_QSIZE 256
199#define FMN_NSTATIONS 128
200#define FMN_CORE_NBUCKETS 8
201
202static inline void nlm_msgsnd(unsigned int stid)
203{
204 __asm__ volatile (
205 ".set push\n"
206 ".set noreorder\n"
207 ".set noat\n"
208 "move $1, %0\n"
209 "c2 0x10001\n" /* msgsnd $1 */
210 ".set pop\n"
211 : : "r" (stid) : "$1"
212 );
213}
214
215static inline void nlm_msgld(unsigned int pri)
216{
217 __asm__ volatile (
218 ".set push\n"
219 ".set noreorder\n"
220 ".set noat\n"
221 "move $1, %0\n"
222 "c2 0x10002\n" /* msgld $1 */
223 ".set pop\n"
224 : : "r" (pri) : "$1"
225 );
226}
227
228static inline void nlm_msgwait(unsigned int mask)
229{
230 __asm__ volatile (
231 ".set push\n"
232 ".set noreorder\n"
233 ".set noat\n"
234 "move $8, %0\n"
235 "c2 0x10003\n" /* msgwait $1 */
236 ".set pop\n"
237 : : "r" (mask) : "$1"
238 );
239}
240
241/*
242 * Disable interrupts and enable COP2 access
243 */
244static inline uint32_t nlm_cop2_enable_irqsave(void)
245{
246 uint32_t sr = read_c0_status();
247
248 write_c0_status((sr & ~ST0_IE) | ST0_CU2);
249 return sr;
250}
251
252static inline void nlm_cop2_disable_irqrestore(uint32_t sr)
253{
254 write_c0_status(sr);
255}
256
257static inline void nlm_fmn_setup_intr(int irq, unsigned int tmask)
258{
259 uint32_t config;
260
261 config = (1 << 24) /* interrupt water mark - 1 msg */
262 | (irq << 16) /* irq */
263 | (tmask << 8) /* thread mask */
264 | 0x2; /* enable watermark intr, disable empty intr */
265 nlm_write_c2_config(config);
266}
267
268struct nlm_fmn_msg {
269 uint64_t msg0;
270 uint64_t msg1;
271 uint64_t msg2;
272 uint64_t msg3;
273};
274
275static inline int nlm_fmn_send(unsigned int size, unsigned int code,
276 unsigned int stid, struct nlm_fmn_msg *msg)
277{
278 unsigned int dest;
279 uint32_t status;
280 int i;
281
282 /*
283 * Make sure that all the writes pending at the cpu are flushed.
284 * Any writes pending on CPU will not be see by devices. L1/L2
285 * caches are coherent with IO, so no cache flush needed.
286 */
287 __asm __volatile("sync");
288
289 /* Load TX message buffers */
290 nlm_write_c2_tx_msg0(msg->msg0);
291 nlm_write_c2_tx_msg1(msg->msg1);
292 nlm_write_c2_tx_msg2(msg->msg2);
293 nlm_write_c2_tx_msg3(msg->msg3);
294 dest = ((size - 1) << 16) | (code << 8) | stid;
295
296 /*
297 * Retry a few times on credit fail, this should be a
298 * transient condition, unless there is a configuration
299 * failure, or the receiver is stuck.
300 */
301 for (i = 0; i < 8; i++) {
302 nlm_msgsnd(dest);
303 status = nlm_read_c2_status0();
304 if ((status & 0x4) == 0)
305 return 0;
306 }
307
308 /* If there is a credit failure, return error */
309 return status & 0x06;
310}
311
312static inline int nlm_fmn_receive(int bucket, int *size, int *code, int *stid,
313 struct nlm_fmn_msg *msg)
314{
315 uint32_t status, tmp;
316
317 nlm_msgld(bucket);
318
319 /* wait for load pending to clear */
320 do {
321 status = nlm_read_c2_status0();
322 } while ((status & 0x08) != 0);
323
324 /* receive error bits */
325 tmp = status & 0x30;
326 if (tmp != 0)
327 return tmp;
328
329 *size = ((status & 0xc0) >> 6) + 1;
330 *code = (status & 0xff00) >> 8;
331 *stid = (status & 0x7f0000) >> 16;
332 msg->msg0 = nlm_read_c2_rx_msg0();
333 msg->msg1 = nlm_read_c2_rx_msg1();
334 msg->msg2 = nlm_read_c2_rx_msg2();
335 msg->msg3 = nlm_read_c2_rx_msg3();
336
337 return 0;
338}
339
340struct xlr_fmn_info {
341 int num_buckets;
342 int start_stn_id;
343 int end_stn_id;
344 int credit_config[128];
345};
346
347struct xlr_board_fmn_config {
348 int bucket_size[128]; /* size of buckets for all stations */
349 struct xlr_fmn_info cpu[8];
350 struct xlr_fmn_info gmac[2];
351 struct xlr_fmn_info dma;
352 struct xlr_fmn_info cmp;
353 struct xlr_fmn_info sae;
354 struct xlr_fmn_info xgmac[2];
355};
356
357extern int nlm_register_fmn_handler(int start, int end,
358 void (*fn)(int, int, int, int, struct nlm_fmn_msg *, void *),
359 void *arg);
360extern void xlr_percpu_fmn_init(void);
361extern void nlm_setup_fmn_irq(void);
362extern void xlr_board_info_setup(void);
363
364extern struct xlr_board_fmn_config xlr_board_fmn_config;
365#endif
diff --git a/arch/mips/include/asm/netlogic/xlr/gpio.h b/arch/mips/include/asm/netlogic/xlr/gpio.h
new file mode 100644
index 000000000..8492e835b
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlr/gpio.h
@@ -0,0 +1,74 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _ASM_NLM_GPIO_H
36#define _ASM_NLM_GPIO_H
37
38#define GPIO_INT_EN_REG 0
39#define GPIO_INPUT_INVERSION_REG 1
40#define GPIO_IO_DIR_REG 2
41#define GPIO_IO_DATA_WR_REG 3
42#define GPIO_IO_DATA_RD_REG 4
43
44#define GPIO_SWRESET_REG 8
45#define GPIO_DRAM1_CNTRL_REG 9
46#define GPIO_DRAM1_RATIO_REG 10
47#define GPIO_DRAM1_RESET_REG 11
48#define GPIO_DRAM1_STATUS_REG 12
49#define GPIO_DRAM2_CNTRL_REG 13
50#define GPIO_DRAM2_RATIO_REG 14
51#define GPIO_DRAM2_RESET_REG 15
52#define GPIO_DRAM2_STATUS_REG 16
53
54#define GPIO_PWRON_RESET_CFG_REG 21
55#define GPIO_BIST_ALL_GO_STATUS_REG 24
56#define GPIO_BIST_CPU_GO_STATUS_REG 25
57#define GPIO_BIST_DEV_GO_STATUS_REG 26
58
59#define GPIO_FUSE_BANK_REG 35
60#define GPIO_CPU_RESET_REG 40
61#define GPIO_RNG_REG 43
62
63#define PWRON_RESET_PCMCIA_BOOT 17
64
65#define GPIO_LED_BITMAP 0x1700000
66#define GPIO_LED_0_SHIFT 20
67#define GPIO_LED_1_SHIFT 24
68
69#define GPIO_LED_OUTPUT_CODE_RESET 0x01
70#define GPIO_LED_OUTPUT_CODE_HARD_RESET 0x02
71#define GPIO_LED_OUTPUT_CODE_SOFT_RESET 0x03
72#define GPIO_LED_OUTPUT_CODE_MAIN 0x04
73
74#endif
diff --git a/arch/mips/include/asm/netlogic/xlr/iomap.h b/arch/mips/include/asm/netlogic/xlr/iomap.h
new file mode 100644
index 000000000..ff4533d6e
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlr/iomap.h
@@ -0,0 +1,109 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _ASM_NLM_IOMAP_H
36#define _ASM_NLM_IOMAP_H
37
38#define DEFAULT_NETLOGIC_IO_BASE CKSEG1ADDR(0x1ef00000)
39#define NETLOGIC_IO_DDR2_CHN0_OFFSET 0x01000
40#define NETLOGIC_IO_DDR2_CHN1_OFFSET 0x02000
41#define NETLOGIC_IO_DDR2_CHN2_OFFSET 0x03000
42#define NETLOGIC_IO_DDR2_CHN3_OFFSET 0x04000
43#define NETLOGIC_IO_PIC_OFFSET 0x08000
44#define NETLOGIC_IO_UART_0_OFFSET 0x14000
45#define NETLOGIC_IO_UART_1_OFFSET 0x15100
46
47#define NETLOGIC_IO_SIZE 0x1000
48
49#define NETLOGIC_IO_BRIDGE_OFFSET 0x00000
50
51#define NETLOGIC_IO_RLD2_CHN0_OFFSET 0x05000
52#define NETLOGIC_IO_RLD2_CHN1_OFFSET 0x06000
53
54#define NETLOGIC_IO_SRAM_OFFSET 0x07000
55
56#define NETLOGIC_IO_PCIX_OFFSET 0x09000
57#define NETLOGIC_IO_HT_OFFSET 0x0A000
58
59#define NETLOGIC_IO_SECURITY_OFFSET 0x0B000
60
61#define NETLOGIC_IO_GMAC_0_OFFSET 0x0C000
62#define NETLOGIC_IO_GMAC_1_OFFSET 0x0D000
63#define NETLOGIC_IO_GMAC_2_OFFSET 0x0E000
64#define NETLOGIC_IO_GMAC_3_OFFSET 0x0F000
65
66/* XLS devices */
67#define NETLOGIC_IO_GMAC_4_OFFSET 0x20000
68#define NETLOGIC_IO_GMAC_5_OFFSET 0x21000
69#define NETLOGIC_IO_GMAC_6_OFFSET 0x22000
70#define NETLOGIC_IO_GMAC_7_OFFSET 0x23000
71
72#define NETLOGIC_IO_PCIE_0_OFFSET 0x1E000
73#define NETLOGIC_IO_PCIE_1_OFFSET 0x1F000
74#define NETLOGIC_IO_SRIO_0_OFFSET 0x1E000
75#define NETLOGIC_IO_SRIO_1_OFFSET 0x1F000
76
77#define NETLOGIC_IO_USB_0_OFFSET 0x24000
78#define NETLOGIC_IO_USB_1_OFFSET 0x25000
79
80#define NETLOGIC_IO_COMP_OFFSET 0x1D000
81/* end XLS devices */
82
83/* XLR devices */
84#define NETLOGIC_IO_SPI4_0_OFFSET 0x10000
85#define NETLOGIC_IO_XGMAC_0_OFFSET 0x11000
86#define NETLOGIC_IO_SPI4_1_OFFSET 0x12000
87#define NETLOGIC_IO_XGMAC_1_OFFSET 0x13000
88/* end XLR devices */
89
90#define NETLOGIC_IO_I2C_0_OFFSET 0x16000
91#define NETLOGIC_IO_I2C_1_OFFSET 0x17000
92
93#define NETLOGIC_IO_GPIO_OFFSET 0x18000
94#define NETLOGIC_IO_FLASH_OFFSET 0x19000
95#define NETLOGIC_IO_TB_OFFSET 0x1C000
96
97#define NETLOGIC_CPLD_OFFSET KSEG1ADDR(0x1d840000)
98
99/*
100 * Base Address (Virtual) of the PCI Config address space
101 * For now, choose 256M phys in kseg1 = 0xA0000000 + (1<<28)
102 * Config space spans 256 (num of buses) * 256 (num functions) * 256 bytes
103 * ie 1<<24 = 16M
104 */
105#define DEFAULT_PCI_CONFIG_BASE 0x18000000
106#define DEFAULT_HT_TYPE0_CFG_BASE 0x16000000
107#define DEFAULT_HT_TYPE1_CFG_BASE 0x17000000
108
109#endif
diff --git a/arch/mips/include/asm/netlogic/xlr/msidef.h b/arch/mips/include/asm/netlogic/xlr/msidef.h
new file mode 100644
index 000000000..c95d18edf
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlr/msidef.h
@@ -0,0 +1,84 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef ASM_RMI_MSIDEF_H
36#define ASM_RMI_MSIDEF_H
37
38/*
39 * Constants for Intel APIC based MSI messages.
40 * Adapted for the RMI XLR using identical defines
41 */
42
43/*
44 * Shifts for MSI data
45 */
46
47#define MSI_DATA_VECTOR_SHIFT 0
48#define MSI_DATA_VECTOR_MASK 0x000000ff
49#define MSI_DATA_VECTOR(v) (((v) << MSI_DATA_VECTOR_SHIFT) & \
50 MSI_DATA_VECTOR_MASK)
51
52#define MSI_DATA_DELIVERY_MODE_SHIFT 8
53#define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_MODE_SHIFT)
54#define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_MODE_SHIFT)
55
56#define MSI_DATA_LEVEL_SHIFT 14
57#define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT)
58#define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT)
59
60#define MSI_DATA_TRIGGER_SHIFT 15
61#define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT)
62#define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT)
63
64/*
65 * Shift/mask fields for msi address
66 */
67
68#define MSI_ADDR_BASE_HI 0
69#define MSI_ADDR_BASE_LO 0xfee00000
70
71#define MSI_ADDR_DEST_MODE_SHIFT 2
72#define MSI_ADDR_DEST_MODE_PHYSICAL (0 << MSI_ADDR_DEST_MODE_SHIFT)
73#define MSI_ADDR_DEST_MODE_LOGICAL (1 << MSI_ADDR_DEST_MODE_SHIFT)
74
75#define MSI_ADDR_REDIRECTION_SHIFT 3
76#define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT)
77#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT)
78
79#define MSI_ADDR_DEST_ID_SHIFT 12
80#define MSI_ADDR_DEST_ID_MASK 0x00ffff0
81#define MSI_ADDR_DEST_ID(dest) (((dest) << MSI_ADDR_DEST_ID_SHIFT) & \
82 MSI_ADDR_DEST_ID_MASK)
83
84#endif /* ASM_RMI_MSIDEF_H */
diff --git a/arch/mips/include/asm/netlogic/xlr/pic.h b/arch/mips/include/asm/netlogic/xlr/pic.h
new file mode 100644
index 000000000..3c80a7523
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlr/pic.h
@@ -0,0 +1,306 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _ASM_NLM_XLR_PIC_H
36#define _ASM_NLM_XLR_PIC_H
37
38#define PIC_CLK_HZ 66666666
39#define pic_timer_freq() PIC_CLK_HZ
40
41/* PIC hardware interrupt numbers */
42#define PIC_IRT_WD_INDEX 0
43#define PIC_IRT_TIMER_0_INDEX 1
44#define PIC_IRT_TIMER_INDEX(i) ((i) + PIC_IRT_TIMER_0_INDEX)
45#define PIC_IRT_TIMER_1_INDEX 2
46#define PIC_IRT_TIMER_2_INDEX 3
47#define PIC_IRT_TIMER_3_INDEX 4
48#define PIC_IRT_TIMER_4_INDEX 5
49#define PIC_IRT_TIMER_5_INDEX 6
50#define PIC_IRT_TIMER_6_INDEX 7
51#define PIC_IRT_TIMER_7_INDEX 8
52#define PIC_IRT_CLOCK_INDEX PIC_IRT_TIMER_7_INDEX
53#define PIC_IRT_UART_0_INDEX 9
54#define PIC_IRT_UART_1_INDEX 10
55#define PIC_IRT_I2C_0_INDEX 11
56#define PIC_IRT_I2C_1_INDEX 12
57#define PIC_IRT_PCMCIA_INDEX 13
58#define PIC_IRT_GPIO_INDEX 14
59#define PIC_IRT_HYPER_INDEX 15
60#define PIC_IRT_PCIX_INDEX 16
61/* XLS */
62#define PIC_IRT_CDE_INDEX 15
63#define PIC_IRT_BRIDGE_TB_XLS_INDEX 16
64/* XLS */
65#define PIC_IRT_GMAC0_INDEX 17
66#define PIC_IRT_GMAC1_INDEX 18
67#define PIC_IRT_GMAC2_INDEX 19
68#define PIC_IRT_GMAC3_INDEX 20
69#define PIC_IRT_XGS0_INDEX 21
70#define PIC_IRT_XGS1_INDEX 22
71#define PIC_IRT_HYPER_FATAL_INDEX 23
72#define PIC_IRT_PCIX_FATAL_INDEX 24
73#define PIC_IRT_BRIDGE_AERR_INDEX 25
74#define PIC_IRT_BRIDGE_BERR_INDEX 26
75#define PIC_IRT_BRIDGE_TB_XLR_INDEX 27
76#define PIC_IRT_BRIDGE_AERR_NMI_INDEX 28
77/* XLS */
78#define PIC_IRT_GMAC4_INDEX 21
79#define PIC_IRT_GMAC5_INDEX 22
80#define PIC_IRT_GMAC6_INDEX 23
81#define PIC_IRT_GMAC7_INDEX 24
82#define PIC_IRT_BRIDGE_ERR_INDEX 25
83#define PIC_IRT_PCIE_LINK0_INDEX 26
84#define PIC_IRT_PCIE_LINK1_INDEX 27
85#define PIC_IRT_PCIE_LINK2_INDEX 23
86#define PIC_IRT_PCIE_LINK3_INDEX 24
87#define PIC_IRT_PCIE_XLSB0_LINK2_INDEX 28
88#define PIC_IRT_PCIE_XLSB0_LINK3_INDEX 29
89#define PIC_IRT_SRIO_LINK0_INDEX 26
90#define PIC_IRT_SRIO_LINK1_INDEX 27
91#define PIC_IRT_SRIO_LINK2_INDEX 28
92#define PIC_IRT_SRIO_LINK3_INDEX 29
93#define PIC_IRT_PCIE_INT_INDEX 28
94#define PIC_IRT_PCIE_FATAL_INDEX 29
95#define PIC_IRT_GPIO_B_INDEX 30
96#define PIC_IRT_USB_INDEX 31
97/* XLS */
98#define PIC_NUM_IRTS 32
99
100
101#define PIC_CLOCK_TIMER 7
102
103/* PIC Registers */
104#define PIC_CTRL 0x00
105#define PIC_CTRL_STE 8 /* timer enable start bit */
106#define PIC_IPI 0x04
107#define PIC_INT_ACK 0x06
108
109#define WD_MAX_VAL_0 0x08
110#define WD_MAX_VAL_1 0x09
111#define WD_MASK_0 0x0a
112#define WD_MASK_1 0x0b
113#define WD_HEARBEAT_0 0x0c
114#define WD_HEARBEAT_1 0x0d
115
116#define PIC_IRT_0_BASE 0x40
117#define PIC_IRT_1_BASE 0x80
118#define PIC_TIMER_MAXVAL_0_BASE 0x100
119#define PIC_TIMER_MAXVAL_1_BASE 0x110
120#define PIC_TIMER_COUNT_0_BASE 0x120
121#define PIC_TIMER_COUNT_1_BASE 0x130
122
123#define PIC_IRT_0(picintr) (PIC_IRT_0_BASE + (picintr))
124#define PIC_IRT_1(picintr) (PIC_IRT_1_BASE + (picintr))
125
126#define PIC_TIMER_MAXVAL_0(i) (PIC_TIMER_MAXVAL_0_BASE + (i))
127#define PIC_TIMER_MAXVAL_1(i) (PIC_TIMER_MAXVAL_1_BASE + (i))
128#define PIC_TIMER_COUNT_0(i) (PIC_TIMER_COUNT_0_BASE + (i))
129#define PIC_TIMER_COUNT_1(i) (PIC_TIMER_COUNT_0_BASE + (i))
130
131/*
132 * Mapping between hardware interrupt numbers and IRQs on CPU
133 * we use a simple scheme to map PIC interrupts 0-31 to IRQs
134 * 8-39. This leaves the IRQ 0-7 for cpu interrupts like
135 * count/compare and FMN
136 */
137#define PIC_IRQ_BASE 8
138#define PIC_INTR_TO_IRQ(i) (PIC_IRQ_BASE + (i))
139#define PIC_IRQ_TO_INTR(i) ((i) - PIC_IRQ_BASE)
140
141#define PIC_IRT_FIRST_IRQ PIC_IRQ_BASE
142#define PIC_WD_IRQ PIC_INTR_TO_IRQ(PIC_IRT_WD_INDEX)
143#define PIC_TIMER_0_IRQ PIC_INTR_TO_IRQ(PIC_IRT_TIMER_0_INDEX)
144#define PIC_TIMER_1_IRQ PIC_INTR_TO_IRQ(PIC_IRT_TIMER_1_INDEX)
145#define PIC_TIMER_2_IRQ PIC_INTR_TO_IRQ(PIC_IRT_TIMER_2_INDEX)
146#define PIC_TIMER_3_IRQ PIC_INTR_TO_IRQ(PIC_IRT_TIMER_3_INDEX)
147#define PIC_TIMER_4_IRQ PIC_INTR_TO_IRQ(PIC_IRT_TIMER_4_INDEX)
148#define PIC_TIMER_5_IRQ PIC_INTR_TO_IRQ(PIC_IRT_TIMER_5_INDEX)
149#define PIC_TIMER_6_IRQ PIC_INTR_TO_IRQ(PIC_IRT_TIMER_6_INDEX)
150#define PIC_TIMER_7_IRQ PIC_INTR_TO_IRQ(PIC_IRT_TIMER_7_INDEX)
151#define PIC_CLOCK_IRQ (PIC_TIMER_7_IRQ)
152#define PIC_UART_0_IRQ PIC_INTR_TO_IRQ(PIC_IRT_UART_0_INDEX)
153#define PIC_UART_1_IRQ PIC_INTR_TO_IRQ(PIC_IRT_UART_1_INDEX)
154#define PIC_I2C_0_IRQ PIC_INTR_TO_IRQ(PIC_IRT_I2C_0_INDEX)
155#define PIC_I2C_1_IRQ PIC_INTR_TO_IRQ(PIC_IRT_I2C_1_INDEX)
156#define PIC_PCMCIA_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCMCIA_INDEX)
157#define PIC_GPIO_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GPIO_INDEX)
158#define PIC_HYPER_IRQ PIC_INTR_TO_IRQ(PIC_IRT_HYPER_INDEX)
159#define PIC_PCIX_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIX_INDEX)
160/* XLS */
161#define PIC_CDE_IRQ PIC_INTR_TO_IRQ(PIC_IRT_CDE_INDEX)
162#define PIC_BRIDGE_TB_XLS_IRQ PIC_INTR_TO_IRQ(PIC_IRT_BRIDGE_TB_XLS_INDEX)
163/* end XLS */
164#define PIC_GMAC_0_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GMAC0_INDEX)
165#define PIC_GMAC_1_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GMAC1_INDEX)
166#define PIC_GMAC_2_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GMAC2_INDEX)
167#define PIC_GMAC_3_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GMAC3_INDEX)
168#define PIC_XGS_0_IRQ PIC_INTR_TO_IRQ(PIC_IRT_XGS0_INDEX)
169#define PIC_XGS_1_IRQ PIC_INTR_TO_IRQ(PIC_IRT_XGS1_INDEX)
170#define PIC_HYPER_FATAL_IRQ PIC_INTR_TO_IRQ(PIC_IRT_HYPER_FATAL_INDEX)
171#define PIC_PCIX_FATAL_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIX_FATAL_INDEX)
172#define PIC_BRIDGE_AERR_IRQ PIC_INTR_TO_IRQ(PIC_IRT_BRIDGE_AERR_INDEX)
173#define PIC_BRIDGE_BERR_IRQ PIC_INTR_TO_IRQ(PIC_IRT_BRIDGE_BERR_INDEX)
174#define PIC_BRIDGE_TB_XLR_IRQ PIC_INTR_TO_IRQ(PIC_IRT_BRIDGE_TB_XLR_INDEX)
175#define PIC_BRIDGE_AERR_NMI_IRQ PIC_INTR_TO_IRQ(PIC_IRT_BRIDGE_AERR_NMI_INDEX)
176/* XLS defines */
177#define PIC_GMAC_4_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GMAC4_INDEX)
178#define PIC_GMAC_5_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GMAC5_INDEX)
179#define PIC_GMAC_6_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GMAC6_INDEX)
180#define PIC_GMAC_7_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GMAC7_INDEX)
181#define PIC_BRIDGE_ERR_IRQ PIC_INTR_TO_IRQ(PIC_IRT_BRIDGE_ERR_INDEX)
182#define PIC_PCIE_LINK0_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIE_LINK0_INDEX)
183#define PIC_PCIE_LINK1_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIE_LINK1_INDEX)
184#define PIC_PCIE_LINK2_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIE_LINK2_INDEX)
185#define PIC_PCIE_LINK3_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIE_LINK3_INDEX)
186#define PIC_PCIE_XLSB0_LINK2_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIE_XLSB0_LINK2_INDEX)
187#define PIC_PCIE_XLSB0_LINK3_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIE_XLSB0_LINK3_INDEX)
188#define PIC_SRIO_LINK0_IRQ PIC_INTR_TO_IRQ(PIC_IRT_SRIO_LINK0_INDEX)
189#define PIC_SRIO_LINK1_IRQ PIC_INTR_TO_IRQ(PIC_IRT_SRIO_LINK1_INDEX)
190#define PIC_SRIO_LINK2_IRQ PIC_INTR_TO_IRQ(PIC_IRT_SRIO_LINK2_INDEX)
191#define PIC_SRIO_LINK3_IRQ PIC_INTR_TO_IRQ(PIC_IRT_SRIO_LINK3_INDEX)
192#define PIC_PCIE_INT_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIE_INT__INDEX)
193#define PIC_PCIE_FATAL_IRQ PIC_INTR_TO_IRQ(PIC_IRT_PCIE_FATAL_INDEX)
194#define PIC_GPIO_B_IRQ PIC_INTR_TO_IRQ(PIC_IRT_GPIO_B_INDEX)
195#define PIC_USB_IRQ PIC_INTR_TO_IRQ(PIC_IRT_USB_INDEX)
196#define PIC_IRT_LAST_IRQ PIC_USB_IRQ
197/* end XLS */
198
199#ifndef __ASSEMBLY__
200
201#define PIC_IRQ_IS_EDGE_TRIGGERED(irq) (((irq) >= PIC_TIMER_0_IRQ) && \
202 ((irq) <= PIC_TIMER_7_IRQ))
203#define PIC_IRQ_IS_IRT(irq) (((irq) >= PIC_IRT_FIRST_IRQ) && \
204 ((irq) <= PIC_IRT_LAST_IRQ))
205
206static inline int
207nlm_irq_to_irt(int irq)
208{
209 if (PIC_IRQ_IS_IRT(irq) == 0)
210 return -1;
211
212 return PIC_IRQ_TO_INTR(irq);
213}
214
215static inline int
216nlm_irt_to_irq(int irt)
217{
218
219 return PIC_INTR_TO_IRQ(irt);
220}
221
222static inline void
223nlm_pic_enable_irt(uint64_t base, int irt)
224{
225 uint32_t reg;
226
227 reg = nlm_read_reg(base, PIC_IRT_1(irt));
228 nlm_write_reg(base, PIC_IRT_1(irt), reg | (1u << 31));
229}
230
231static inline void
232nlm_pic_disable_irt(uint64_t base, int irt)
233{
234 uint32_t reg;
235
236 reg = nlm_read_reg(base, PIC_IRT_1(irt));
237 nlm_write_reg(base, PIC_IRT_1(irt), reg & ~(1u << 31));
238}
239
240static inline void
241nlm_pic_send_ipi(uint64_t base, int hwt, int irq, int nmi)
242{
243 unsigned int tid, pid;
244
245 tid = hwt & 0x3;
246 pid = (hwt >> 2) & 0x07;
247 nlm_write_reg(base, PIC_IPI,
248 (pid << 20) | (tid << 16) | (nmi << 8) | irq);
249}
250
251static inline void
252nlm_pic_ack(uint64_t base, int irt)
253{
254 nlm_write_reg(base, PIC_INT_ACK, 1u << irt);
255}
256
257static inline void
258nlm_pic_init_irt(uint64_t base, int irt, int irq, int hwt, int en)
259{
260 nlm_write_reg(base, PIC_IRT_0(irt), (1u << hwt));
261 /* local scheduling, invalid, level by default */
262 nlm_write_reg(base, PIC_IRT_1(irt),
263 (en << 30) | (1 << 6) | irq);
264}
265
266static inline uint64_t
267nlm_pic_read_timer(uint64_t base, int timer)
268{
269 uint32_t up1, up2, low;
270
271 up1 = nlm_read_reg(base, PIC_TIMER_COUNT_1(timer));
272 low = nlm_read_reg(base, PIC_TIMER_COUNT_0(timer));
273 up2 = nlm_read_reg(base, PIC_TIMER_COUNT_1(timer));
274
275 if (up1 != up2) /* wrapped, get the new low */
276 low = nlm_read_reg(base, PIC_TIMER_COUNT_0(timer));
277 return ((uint64_t)up2 << 32) | low;
278
279}
280
281static inline uint32_t
282nlm_pic_read_timer32(uint64_t base, int timer)
283{
284 return nlm_read_reg(base, PIC_TIMER_COUNT_0(timer));
285}
286
287static inline void
288nlm_pic_set_timer(uint64_t base, int timer, uint64_t value, int irq, int cpu)
289{
290 uint32_t up, low;
291 uint64_t pic_ctrl = nlm_read_reg(base, PIC_CTRL);
292 int en;
293
294 en = (irq > 0);
295 up = value >> 32;
296 low = value & 0xFFFFFFFF;
297 nlm_write_reg(base, PIC_TIMER_MAXVAL_0(timer), low);
298 nlm_write_reg(base, PIC_TIMER_MAXVAL_1(timer), up);
299 nlm_pic_init_irt(base, PIC_IRT_TIMER_INDEX(timer), irq, cpu, 0);
300
301 /* enable the timer */
302 pic_ctrl |= (1 << (PIC_CTRL_STE + timer));
303 nlm_write_reg(base, PIC_CTRL, pic_ctrl);
304}
305#endif
306#endif /* _ASM_NLM_XLR_PIC_H */
diff --git a/arch/mips/include/asm/netlogic/xlr/xlr.h b/arch/mips/include/asm/netlogic/xlr/xlr.h
new file mode 100644
index 000000000..ceb991ca8
--- /dev/null
+++ b/arch/mips/include/asm/netlogic/xlr/xlr.h
@@ -0,0 +1,59 @@
1/*
2 * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights
3 * reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the NetLogic
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY NETLOGIC ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _ASM_NLM_XLR_H
36#define _ASM_NLM_XLR_H
37
38/* SMP helpers */
39void xlr_wakeup_secondary_cpus(void);
40
41/* XLS B silicon "Rook" */
42static inline unsigned int nlm_chip_is_xls_b(void)
43{
44 uint32_t prid = read_c0_prid();
45
46 return ((prid & 0xf000) == 0x4000);
47}
48
49/* XLR chip types */
50/* The XLS product line has chip versions 0x[48c]? */
51static inline unsigned int nlm_chip_is_xls(void)
52{
53 uint32_t prid = read_c0_prid();
54
55 return ((prid & 0xf000) == 0x8000 || (prid & 0xf000) == 0x4000 ||
56 (prid & 0xf000) == 0xc000);
57}
58
59#endif /* _ASM_NLM_XLR_H */
diff --git a/arch/mips/include/asm/octeon/cvmx-address.h b/arch/mips/include/asm/octeon/cvmx-address.h
new file mode 100644
index 000000000..e4444f8c4
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-address.h
@@ -0,0 +1,341 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2009 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 * Typedefs and defines for working with Octeon physical addresses.
30 *
31 */
32#ifndef __CVMX_ADDRESS_H__
33#define __CVMX_ADDRESS_H__
34
35#if 0
36typedef enum {
37 CVMX_MIPS_SPACE_XKSEG = 3LL,
38 CVMX_MIPS_SPACE_XKPHYS = 2LL,
39 CVMX_MIPS_SPACE_XSSEG = 1LL,
40 CVMX_MIPS_SPACE_XUSEG = 0LL
41} cvmx_mips_space_t;
42#endif
43
44typedef enum {
45 CVMX_MIPS_XKSEG_SPACE_KSEG0 = 0LL,
46 CVMX_MIPS_XKSEG_SPACE_KSEG1 = 1LL,
47 CVMX_MIPS_XKSEG_SPACE_SSEG = 2LL,
48 CVMX_MIPS_XKSEG_SPACE_KSEG3 = 3LL
49} cvmx_mips_xkseg_space_t;
50
51/* decodes <14:13> of a kseg3 window address */
52typedef enum {
53 CVMX_ADD_WIN_SCR = 0L,
54 /* see cvmx_add_win_dma_dec_t for further decode */
55 CVMX_ADD_WIN_DMA = 1L,
56 CVMX_ADD_WIN_UNUSED = 2L,
57 CVMX_ADD_WIN_UNUSED2 = 3L
58} cvmx_add_win_dec_t;
59
60/* decode within DMA space */
61typedef enum {
62 /*
63 * Add store data to the write buffer entry, allocating it if
64 * necessary.
65 */
66 CVMX_ADD_WIN_DMA_ADD = 0L,
67 /* send out the write buffer entry to DRAM */
68 CVMX_ADD_WIN_DMA_SENDMEM = 1L,
69 /* store data must be normal DRAM memory space address in this case */
70 /* send out the write buffer entry as an IOBDMA command */
71 CVMX_ADD_WIN_DMA_SENDDMA = 2L,
72 /* see CVMX_ADD_WIN_DMA_SEND_DEC for data contents */
73 /* send out the write buffer entry as an IO write */
74 CVMX_ADD_WIN_DMA_SENDIO = 3L,
75 /* store data must be normal IO space address in this case */
76 /* send out a single-tick command on the NCB bus */
77 CVMX_ADD_WIN_DMA_SENDSINGLE = 4L,
78 /* no write buffer data needed/used */
79} cvmx_add_win_dma_dec_t;
80
81/*
82 * Physical Address Decode
83 *
84 * Octeon-I HW never interprets this X (<39:36> reserved
85 * for future expansion), software should set to 0.
86 *
87 * - 0x0 XXX0 0000 0000 to DRAM Cached
88 * - 0x0 XXX0 0FFF FFFF
89 *
90 * - 0x0 XXX0 1000 0000 to Boot Bus Uncached (Converted to 0x1 00X0 1000 0000
91 * - 0x0 XXX0 1FFF FFFF + EJTAG to 0x1 00X0 1FFF FFFF)
92 *
93 * - 0x0 XXX0 2000 0000 to DRAM Cached
94 * - 0x0 XXXF FFFF FFFF
95 *
96 * - 0x1 00X0 0000 0000 to Boot Bus Uncached
97 * - 0x1 00XF FFFF FFFF
98 *
99 * - 0x1 01X0 0000 0000 to Other NCB Uncached
100 * - 0x1 FFXF FFFF FFFF devices
101 *
102 * Decode of all Octeon addresses
103 */
104typedef union {
105
106 uint64_t u64;
107#ifdef __BIG_ENDIAN_BITFIELD
108 /* mapped or unmapped virtual address */
109 struct {
110 uint64_t R:2;
111 uint64_t offset:62;
112 } sva;
113
114 /* mapped USEG virtual addresses (typically) */
115 struct {
116 uint64_t zeroes:33;
117 uint64_t offset:31;
118 } suseg;
119
120 /* mapped or unmapped virtual address */
121 struct {
122 uint64_t ones:33;
123 uint64_t sp:2;
124 uint64_t offset:29;
125 } sxkseg;
126
127 /*
128 * physical address accessed through xkphys unmapped virtual
129 * address.
130 */
131 struct {
132 uint64_t R:2; /* CVMX_MIPS_SPACE_XKPHYS in this case */
133 uint64_t cca:3; /* ignored by octeon */
134 uint64_t mbz:10;
135 uint64_t pa:49; /* physical address */
136 } sxkphys;
137
138 /* physical address */
139 struct {
140 uint64_t mbz:15;
141 /* if set, the address is uncached and resides on MCB bus */
142 uint64_t is_io:1;
143 /*
144 * the hardware ignores this field when is_io==0, else
145 * device ID.
146 */
147 uint64_t did:8;
148 /* the hardware ignores <39:36> in Octeon I */
149 uint64_t unaddr:4;
150 uint64_t offset:36;
151 } sphys;
152
153 /* physical mem address */
154 struct {
155 /* techically, <47:40> are dont-cares */
156 uint64_t zeroes:24;
157 /* the hardware ignores <39:36> in Octeon I */
158 uint64_t unaddr:4;
159 uint64_t offset:36;
160 } smem;
161
162 /* physical IO address */
163 struct {
164 uint64_t mem_region:2;
165 uint64_t mbz:13;
166 /* 1 in this case */
167 uint64_t is_io:1;
168 /*
169 * The hardware ignores this field when is_io==0, else
170 * device ID.
171 */
172 uint64_t did:8;
173 /* the hardware ignores <39:36> in Octeon I */
174 uint64_t unaddr:4;
175 uint64_t offset:36;
176 } sio;
177
178 /*
179 * Scratchpad virtual address - accessed through a window at
180 * the end of kseg3
181 */
182 struct {
183 uint64_t ones:49;
184 /* CVMX_ADD_WIN_SCR (0) in this case */
185 cvmx_add_win_dec_t csrdec:2;
186 uint64_t addr:13;
187 } sscr;
188
189 /* there should only be stores to IOBDMA space, no loads */
190 /*
191 * IOBDMA virtual address - accessed through a window at the
192 * end of kseg3
193 */
194 struct {
195 uint64_t ones:49;
196 uint64_t csrdec:2; /* CVMX_ADD_WIN_DMA (1) in this case */
197 uint64_t unused2:3;
198 uint64_t type:3;
199 uint64_t addr:7;
200 } sdma;
201
202 struct {
203 uint64_t didspace:24;
204 uint64_t unused:40;
205 } sfilldidspace;
206#else
207 struct {
208 uint64_t offset:62;
209 uint64_t R:2;
210 } sva;
211
212 struct {
213 uint64_t offset:31;
214 uint64_t zeroes:33;
215 } suseg;
216
217 struct {
218 uint64_t offset:29;
219 uint64_t sp:2;
220 uint64_t ones:33;
221 } sxkseg;
222
223 struct {
224 uint64_t pa:49;
225 uint64_t mbz:10;
226 uint64_t cca:3;
227 uint64_t R:2;
228 } sxkphys;
229
230 struct {
231 uint64_t offset:36;
232 uint64_t unaddr:4;
233 uint64_t did:8;
234 uint64_t is_io:1;
235 uint64_t mbz:15;
236 } sphys;
237
238 struct {
239 uint64_t offset:36;
240 uint64_t unaddr:4;
241 uint64_t zeroes:24;
242 } smem;
243
244 struct {
245 uint64_t offset:36;
246 uint64_t unaddr:4;
247 uint64_t did:8;
248 uint64_t is_io:1;
249 uint64_t mbz:13;
250 uint64_t mem_region:2;
251 } sio;
252
253 struct {
254 uint64_t addr:13;
255 cvmx_add_win_dec_t csrdec:2;
256 uint64_t ones:49;
257 } sscr;
258
259 struct {
260 uint64_t addr:7;
261 uint64_t type:3;
262 uint64_t unused2:3;
263 uint64_t csrdec:2;
264 uint64_t ones:49;
265 } sdma;
266
267 struct {
268 uint64_t unused:40;
269 uint64_t didspace:24;
270 } sfilldidspace;
271#endif
272
273} cvmx_addr_t;
274
275/* These macros for used by 32 bit applications */
276
277#define CVMX_MIPS32_SPACE_KSEG0 1l
278#define CVMX_ADD_SEG32(segment, add) \
279 (((int32_t)segment << 31) | (int32_t)(add))
280
281/*
282 * Currently all IOs are performed using XKPHYS addressing. Linux uses
283 * the CvmMemCtl register to enable XKPHYS addressing to IO space from
284 * user mode. Future OSes may need to change the upper bits of IO
285 * addresses. The following define controls the upper two bits for all
286 * IO addresses generated by the simple executive library.
287 */
288#define CVMX_IO_SEG CVMX_MIPS_SPACE_XKPHYS
289
290/* These macros simplify the process of creating common IO addresses */
291#define CVMX_ADD_SEG(segment, add) ((((uint64_t)segment) << 62) | (add))
292#ifndef CVMX_ADD_IO_SEG
293#define CVMX_ADD_IO_SEG(add) CVMX_ADD_SEG(CVMX_IO_SEG, (add))
294#endif
295#define CVMX_ADDR_DIDSPACE(did) (((CVMX_IO_SEG) << 22) | ((1ULL) << 8) | (did))
296#define CVMX_ADDR_DID(did) (CVMX_ADDR_DIDSPACE(did) << 40)
297#define CVMX_FULL_DID(did, subdid) (((did) << 3) | (subdid))
298
299 /* from include/ncb_rsl_id.v */
300#define CVMX_OCT_DID_MIS 0ULL /* misc stuff */
301#define CVMX_OCT_DID_GMX0 1ULL
302#define CVMX_OCT_DID_GMX1 2ULL
303#define CVMX_OCT_DID_PCI 3ULL
304#define CVMX_OCT_DID_KEY 4ULL
305#define CVMX_OCT_DID_FPA 5ULL
306#define CVMX_OCT_DID_DFA 6ULL
307#define CVMX_OCT_DID_ZIP 7ULL
308#define CVMX_OCT_DID_RNG 8ULL
309#define CVMX_OCT_DID_IPD 9ULL
310#define CVMX_OCT_DID_PKT 10ULL
311#define CVMX_OCT_DID_TIM 11ULL
312#define CVMX_OCT_DID_TAG 12ULL
313 /* the rest are not on the IO bus */
314#define CVMX_OCT_DID_L2C 16ULL
315#define CVMX_OCT_DID_LMC 17ULL
316#define CVMX_OCT_DID_SPX0 18ULL
317#define CVMX_OCT_DID_SPX1 19ULL
318#define CVMX_OCT_DID_PIP 20ULL
319#define CVMX_OCT_DID_ASX0 22ULL
320#define CVMX_OCT_DID_ASX1 23ULL
321#define CVMX_OCT_DID_IOB 30ULL
322
323#define CVMX_OCT_DID_PKT_SEND CVMX_FULL_DID(CVMX_OCT_DID_PKT, 2ULL)
324#define CVMX_OCT_DID_TAG_SWTAG CVMX_FULL_DID(CVMX_OCT_DID_TAG, 0ULL)
325#define CVMX_OCT_DID_TAG_TAG1 CVMX_FULL_DID(CVMX_OCT_DID_TAG, 1ULL)
326#define CVMX_OCT_DID_TAG_TAG2 CVMX_FULL_DID(CVMX_OCT_DID_TAG, 2ULL)
327#define CVMX_OCT_DID_TAG_TAG3 CVMX_FULL_DID(CVMX_OCT_DID_TAG, 3ULL)
328#define CVMX_OCT_DID_TAG_NULL_RD CVMX_FULL_DID(CVMX_OCT_DID_TAG, 4ULL)
329#define CVMX_OCT_DID_TAG_CSR CVMX_FULL_DID(CVMX_OCT_DID_TAG, 7ULL)
330#define CVMX_OCT_DID_FAU_FAI CVMX_FULL_DID(CVMX_OCT_DID_IOB, 0ULL)
331#define CVMX_OCT_DID_TIM_CSR CVMX_FULL_DID(CVMX_OCT_DID_TIM, 0ULL)
332#define CVMX_OCT_DID_KEY_RW CVMX_FULL_DID(CVMX_OCT_DID_KEY, 0ULL)
333#define CVMX_OCT_DID_PCI_6 CVMX_FULL_DID(CVMX_OCT_DID_PCI, 6ULL)
334#define CVMX_OCT_DID_MIS_BOO CVMX_FULL_DID(CVMX_OCT_DID_MIS, 0ULL)
335#define CVMX_OCT_DID_PCI_RML CVMX_FULL_DID(CVMX_OCT_DID_PCI, 0ULL)
336#define CVMX_OCT_DID_IPD_CSR CVMX_FULL_DID(CVMX_OCT_DID_IPD, 7ULL)
337#define CVMX_OCT_DID_DFA_CSR CVMX_FULL_DID(CVMX_OCT_DID_DFA, 7ULL)
338#define CVMX_OCT_DID_MIS_CSR CVMX_FULL_DID(CVMX_OCT_DID_MIS, 7ULL)
339#define CVMX_OCT_DID_ZIP_CSR CVMX_FULL_DID(CVMX_OCT_DID_ZIP, 0ULL)
340
341#endif /* __CVMX_ADDRESS_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-agl-defs.h b/arch/mips/include/asm/octeon/cvmx-agl-defs.h
new file mode 100644
index 000000000..3635ab384
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-agl-defs.h
@@ -0,0 +1,1759 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_AGL_DEFS_H__
29#define __CVMX_AGL_DEFS_H__
30
31#define CVMX_AGL_GMX_BAD_REG (CVMX_ADD_IO_SEG(0x00011800E0000518ull))
32#define CVMX_AGL_GMX_BIST (CVMX_ADD_IO_SEG(0x00011800E0000400ull))
33#define CVMX_AGL_GMX_DRV_CTL (CVMX_ADD_IO_SEG(0x00011800E00007F0ull))
34#define CVMX_AGL_GMX_INF_MODE (CVMX_ADD_IO_SEG(0x00011800E00007F8ull))
35#define CVMX_AGL_GMX_PRTX_CFG(offset) (CVMX_ADD_IO_SEG(0x00011800E0000010ull) + ((offset) & 1) * 2048)
36#define CVMX_AGL_GMX_RXX_ADR_CAM0(offset) (CVMX_ADD_IO_SEG(0x00011800E0000180ull) + ((offset) & 1) * 2048)
37#define CVMX_AGL_GMX_RXX_ADR_CAM1(offset) (CVMX_ADD_IO_SEG(0x00011800E0000188ull) + ((offset) & 1) * 2048)
38#define CVMX_AGL_GMX_RXX_ADR_CAM2(offset) (CVMX_ADD_IO_SEG(0x00011800E0000190ull) + ((offset) & 1) * 2048)
39#define CVMX_AGL_GMX_RXX_ADR_CAM3(offset) (CVMX_ADD_IO_SEG(0x00011800E0000198ull) + ((offset) & 1) * 2048)
40#define CVMX_AGL_GMX_RXX_ADR_CAM4(offset) (CVMX_ADD_IO_SEG(0x00011800E00001A0ull) + ((offset) & 1) * 2048)
41#define CVMX_AGL_GMX_RXX_ADR_CAM5(offset) (CVMX_ADD_IO_SEG(0x00011800E00001A8ull) + ((offset) & 1) * 2048)
42#define CVMX_AGL_GMX_RXX_ADR_CAM_EN(offset) (CVMX_ADD_IO_SEG(0x00011800E0000108ull) + ((offset) & 1) * 2048)
43#define CVMX_AGL_GMX_RXX_ADR_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000100ull) + ((offset) & 1) * 2048)
44#define CVMX_AGL_GMX_RXX_DECISION(offset) (CVMX_ADD_IO_SEG(0x00011800E0000040ull) + ((offset) & 1) * 2048)
45#define CVMX_AGL_GMX_RXX_FRM_CHK(offset) (CVMX_ADD_IO_SEG(0x00011800E0000020ull) + ((offset) & 1) * 2048)
46#define CVMX_AGL_GMX_RXX_FRM_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000018ull) + ((offset) & 1) * 2048)
47#define CVMX_AGL_GMX_RXX_FRM_MAX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000030ull) + ((offset) & 1) * 2048)
48#define CVMX_AGL_GMX_RXX_FRM_MIN(offset) (CVMX_ADD_IO_SEG(0x00011800E0000028ull) + ((offset) & 1) * 2048)
49#define CVMX_AGL_GMX_RXX_IFG(offset) (CVMX_ADD_IO_SEG(0x00011800E0000058ull) + ((offset) & 1) * 2048)
50#define CVMX_AGL_GMX_RXX_INT_EN(offset) (CVMX_ADD_IO_SEG(0x00011800E0000008ull) + ((offset) & 1) * 2048)
51#define CVMX_AGL_GMX_RXX_INT_REG(offset) (CVMX_ADD_IO_SEG(0x00011800E0000000ull) + ((offset) & 1) * 2048)
52#define CVMX_AGL_GMX_RXX_JABBER(offset) (CVMX_ADD_IO_SEG(0x00011800E0000038ull) + ((offset) & 1) * 2048)
53#define CVMX_AGL_GMX_RXX_PAUSE_DROP_TIME(offset) (CVMX_ADD_IO_SEG(0x00011800E0000068ull) + ((offset) & 1) * 2048)
54#define CVMX_AGL_GMX_RXX_RX_INBND(offset) (CVMX_ADD_IO_SEG(0x00011800E0000060ull) + ((offset) & 1) * 2048)
55#define CVMX_AGL_GMX_RXX_STATS_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000050ull) + ((offset) & 1) * 2048)
56#define CVMX_AGL_GMX_RXX_STATS_OCTS(offset) (CVMX_ADD_IO_SEG(0x00011800E0000088ull) + ((offset) & 1) * 2048)
57#define CVMX_AGL_GMX_RXX_STATS_OCTS_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000098ull) + ((offset) & 1) * 2048)
58#define CVMX_AGL_GMX_RXX_STATS_OCTS_DMAC(offset) (CVMX_ADD_IO_SEG(0x00011800E00000A8ull) + ((offset) & 1) * 2048)
59#define CVMX_AGL_GMX_RXX_STATS_OCTS_DRP(offset) (CVMX_ADD_IO_SEG(0x00011800E00000B8ull) + ((offset) & 1) * 2048)
60#define CVMX_AGL_GMX_RXX_STATS_PKTS(offset) (CVMX_ADD_IO_SEG(0x00011800E0000080ull) + ((offset) & 1) * 2048)
61#define CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(offset) (CVMX_ADD_IO_SEG(0x00011800E00000C0ull) + ((offset) & 1) * 2048)
62#define CVMX_AGL_GMX_RXX_STATS_PKTS_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000090ull) + ((offset) & 1) * 2048)
63#define CVMX_AGL_GMX_RXX_STATS_PKTS_DMAC(offset) (CVMX_ADD_IO_SEG(0x00011800E00000A0ull) + ((offset) & 1) * 2048)
64#define CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(offset) (CVMX_ADD_IO_SEG(0x00011800E00000B0ull) + ((offset) & 1) * 2048)
65#define CVMX_AGL_GMX_RXX_UDD_SKP(offset) (CVMX_ADD_IO_SEG(0x00011800E0000048ull) + ((offset) & 1) * 2048)
66#define CVMX_AGL_GMX_RX_BP_DROPX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000420ull) + ((offset) & 1) * 8)
67#define CVMX_AGL_GMX_RX_BP_OFFX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000460ull) + ((offset) & 1) * 8)
68#define CVMX_AGL_GMX_RX_BP_ONX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000440ull) + ((offset) & 1) * 8)
69#define CVMX_AGL_GMX_RX_PRT_INFO (CVMX_ADD_IO_SEG(0x00011800E00004E8ull))
70#define CVMX_AGL_GMX_RX_TX_STATUS (CVMX_ADD_IO_SEG(0x00011800E00007E8ull))
71#define CVMX_AGL_GMX_SMACX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000230ull) + ((offset) & 1) * 2048)
72#define CVMX_AGL_GMX_STAT_BP (CVMX_ADD_IO_SEG(0x00011800E0000520ull))
73#define CVMX_AGL_GMX_TXX_APPEND(offset) (CVMX_ADD_IO_SEG(0x00011800E0000218ull) + ((offset) & 1) * 2048)
74#define CVMX_AGL_GMX_TXX_CLK(offset) (CVMX_ADD_IO_SEG(0x00011800E0000208ull) + ((offset) & 1) * 2048)
75#define CVMX_AGL_GMX_TXX_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000270ull) + ((offset) & 1) * 2048)
76#define CVMX_AGL_GMX_TXX_MIN_PKT(offset) (CVMX_ADD_IO_SEG(0x00011800E0000240ull) + ((offset) & 1) * 2048)
77#define CVMX_AGL_GMX_TXX_PAUSE_PKT_INTERVAL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000248ull) + ((offset) & 1) * 2048)
78#define CVMX_AGL_GMX_TXX_PAUSE_PKT_TIME(offset) (CVMX_ADD_IO_SEG(0x00011800E0000238ull) + ((offset) & 1) * 2048)
79#define CVMX_AGL_GMX_TXX_PAUSE_TOGO(offset) (CVMX_ADD_IO_SEG(0x00011800E0000258ull) + ((offset) & 1) * 2048)
80#define CVMX_AGL_GMX_TXX_PAUSE_ZERO(offset) (CVMX_ADD_IO_SEG(0x00011800E0000260ull) + ((offset) & 1) * 2048)
81#define CVMX_AGL_GMX_TXX_SOFT_PAUSE(offset) (CVMX_ADD_IO_SEG(0x00011800E0000250ull) + ((offset) & 1) * 2048)
82#define CVMX_AGL_GMX_TXX_STAT0(offset) (CVMX_ADD_IO_SEG(0x00011800E0000280ull) + ((offset) & 1) * 2048)
83#define CVMX_AGL_GMX_TXX_STAT1(offset) (CVMX_ADD_IO_SEG(0x00011800E0000288ull) + ((offset) & 1) * 2048)
84#define CVMX_AGL_GMX_TXX_STAT2(offset) (CVMX_ADD_IO_SEG(0x00011800E0000290ull) + ((offset) & 1) * 2048)
85#define CVMX_AGL_GMX_TXX_STAT3(offset) (CVMX_ADD_IO_SEG(0x00011800E0000298ull) + ((offset) & 1) * 2048)
86#define CVMX_AGL_GMX_TXX_STAT4(offset) (CVMX_ADD_IO_SEG(0x00011800E00002A0ull) + ((offset) & 1) * 2048)
87#define CVMX_AGL_GMX_TXX_STAT5(offset) (CVMX_ADD_IO_SEG(0x00011800E00002A8ull) + ((offset) & 1) * 2048)
88#define CVMX_AGL_GMX_TXX_STAT6(offset) (CVMX_ADD_IO_SEG(0x00011800E00002B0ull) + ((offset) & 1) * 2048)
89#define CVMX_AGL_GMX_TXX_STAT7(offset) (CVMX_ADD_IO_SEG(0x00011800E00002B8ull) + ((offset) & 1) * 2048)
90#define CVMX_AGL_GMX_TXX_STAT8(offset) (CVMX_ADD_IO_SEG(0x00011800E00002C0ull) + ((offset) & 1) * 2048)
91#define CVMX_AGL_GMX_TXX_STAT9(offset) (CVMX_ADD_IO_SEG(0x00011800E00002C8ull) + ((offset) & 1) * 2048)
92#define CVMX_AGL_GMX_TXX_STATS_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000268ull) + ((offset) & 1) * 2048)
93#define CVMX_AGL_GMX_TXX_THRESH(offset) (CVMX_ADD_IO_SEG(0x00011800E0000210ull) + ((offset) & 1) * 2048)
94#define CVMX_AGL_GMX_TX_BP (CVMX_ADD_IO_SEG(0x00011800E00004D0ull))
95#define CVMX_AGL_GMX_TX_COL_ATTEMPT (CVMX_ADD_IO_SEG(0x00011800E0000498ull))
96#define CVMX_AGL_GMX_TX_IFG (CVMX_ADD_IO_SEG(0x00011800E0000488ull))
97#define CVMX_AGL_GMX_TX_INT_EN (CVMX_ADD_IO_SEG(0x00011800E0000508ull))
98#define CVMX_AGL_GMX_TX_INT_REG (CVMX_ADD_IO_SEG(0x00011800E0000500ull))
99#define CVMX_AGL_GMX_TX_JAM (CVMX_ADD_IO_SEG(0x00011800E0000490ull))
100#define CVMX_AGL_GMX_TX_LFSR (CVMX_ADD_IO_SEG(0x00011800E00004F8ull))
101#define CVMX_AGL_GMX_TX_OVR_BP (CVMX_ADD_IO_SEG(0x00011800E00004C8ull))
102#define CVMX_AGL_GMX_TX_PAUSE_PKT_DMAC (CVMX_ADD_IO_SEG(0x00011800E00004A0ull))
103#define CVMX_AGL_GMX_TX_PAUSE_PKT_TYPE (CVMX_ADD_IO_SEG(0x00011800E00004A8ull))
104#define CVMX_AGL_PRTX_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0002000ull) + ((offset) & 1) * 8)
105
106union cvmx_agl_gmx_bad_reg {
107 uint64_t u64;
108 struct cvmx_agl_gmx_bad_reg_s {
109#ifdef __BIG_ENDIAN_BITFIELD
110 uint64_t reserved_38_63:26;
111 uint64_t txpsh1:1;
112 uint64_t txpop1:1;
113 uint64_t ovrflw1:1;
114 uint64_t txpsh:1;
115 uint64_t txpop:1;
116 uint64_t ovrflw:1;
117 uint64_t reserved_27_31:5;
118 uint64_t statovr:1;
119 uint64_t reserved_24_25:2;
120 uint64_t loststat:2;
121 uint64_t reserved_4_21:18;
122 uint64_t out_ovr:2;
123 uint64_t reserved_0_1:2;
124#else
125 uint64_t reserved_0_1:2;
126 uint64_t out_ovr:2;
127 uint64_t reserved_4_21:18;
128 uint64_t loststat:2;
129 uint64_t reserved_24_25:2;
130 uint64_t statovr:1;
131 uint64_t reserved_27_31:5;
132 uint64_t ovrflw:1;
133 uint64_t txpop:1;
134 uint64_t txpsh:1;
135 uint64_t ovrflw1:1;
136 uint64_t txpop1:1;
137 uint64_t txpsh1:1;
138 uint64_t reserved_38_63:26;
139#endif
140 } s;
141 struct cvmx_agl_gmx_bad_reg_cn52xx {
142#ifdef __BIG_ENDIAN_BITFIELD
143 uint64_t reserved_38_63:26;
144 uint64_t txpsh1:1;
145 uint64_t txpop1:1;
146 uint64_t ovrflw1:1;
147 uint64_t txpsh:1;
148 uint64_t txpop:1;
149 uint64_t ovrflw:1;
150 uint64_t reserved_27_31:5;
151 uint64_t statovr:1;
152 uint64_t reserved_23_25:3;
153 uint64_t loststat:1;
154 uint64_t reserved_4_21:18;
155 uint64_t out_ovr:2;
156 uint64_t reserved_0_1:2;
157#else
158 uint64_t reserved_0_1:2;
159 uint64_t out_ovr:2;
160 uint64_t reserved_4_21:18;
161 uint64_t loststat:1;
162 uint64_t reserved_23_25:3;
163 uint64_t statovr:1;
164 uint64_t reserved_27_31:5;
165 uint64_t ovrflw:1;
166 uint64_t txpop:1;
167 uint64_t txpsh:1;
168 uint64_t ovrflw1:1;
169 uint64_t txpop1:1;
170 uint64_t txpsh1:1;
171 uint64_t reserved_38_63:26;
172#endif
173 } cn52xx;
174 struct cvmx_agl_gmx_bad_reg_cn56xx {
175#ifdef __BIG_ENDIAN_BITFIELD
176 uint64_t reserved_35_63:29;
177 uint64_t txpsh:1;
178 uint64_t txpop:1;
179 uint64_t ovrflw:1;
180 uint64_t reserved_27_31:5;
181 uint64_t statovr:1;
182 uint64_t reserved_23_25:3;
183 uint64_t loststat:1;
184 uint64_t reserved_3_21:19;
185 uint64_t out_ovr:1;
186 uint64_t reserved_0_1:2;
187#else
188 uint64_t reserved_0_1:2;
189 uint64_t out_ovr:1;
190 uint64_t reserved_3_21:19;
191 uint64_t loststat:1;
192 uint64_t reserved_23_25:3;
193 uint64_t statovr:1;
194 uint64_t reserved_27_31:5;
195 uint64_t ovrflw:1;
196 uint64_t txpop:1;
197 uint64_t txpsh:1;
198 uint64_t reserved_35_63:29;
199#endif
200 } cn56xx;
201};
202
203union cvmx_agl_gmx_bist {
204 uint64_t u64;
205 struct cvmx_agl_gmx_bist_s {
206#ifdef __BIG_ENDIAN_BITFIELD
207 uint64_t reserved_25_63:39;
208 uint64_t status:25;
209#else
210 uint64_t status:25;
211 uint64_t reserved_25_63:39;
212#endif
213 } s;
214 struct cvmx_agl_gmx_bist_cn52xx {
215#ifdef __BIG_ENDIAN_BITFIELD
216 uint64_t reserved_10_63:54;
217 uint64_t status:10;
218#else
219 uint64_t status:10;
220 uint64_t reserved_10_63:54;
221#endif
222 } cn52xx;
223};
224
225union cvmx_agl_gmx_drv_ctl {
226 uint64_t u64;
227 struct cvmx_agl_gmx_drv_ctl_s {
228#ifdef __BIG_ENDIAN_BITFIELD
229 uint64_t reserved_49_63:15;
230 uint64_t byp_en1:1;
231 uint64_t reserved_45_47:3;
232 uint64_t pctl1:5;
233 uint64_t reserved_37_39:3;
234 uint64_t nctl1:5;
235 uint64_t reserved_17_31:15;
236 uint64_t byp_en:1;
237 uint64_t reserved_13_15:3;
238 uint64_t pctl:5;
239 uint64_t reserved_5_7:3;
240 uint64_t nctl:5;
241#else
242 uint64_t nctl:5;
243 uint64_t reserved_5_7:3;
244 uint64_t pctl:5;
245 uint64_t reserved_13_15:3;
246 uint64_t byp_en:1;
247 uint64_t reserved_17_31:15;
248 uint64_t nctl1:5;
249 uint64_t reserved_37_39:3;
250 uint64_t pctl1:5;
251 uint64_t reserved_45_47:3;
252 uint64_t byp_en1:1;
253 uint64_t reserved_49_63:15;
254#endif
255 } s;
256 struct cvmx_agl_gmx_drv_ctl_cn56xx {
257#ifdef __BIG_ENDIAN_BITFIELD
258 uint64_t reserved_17_63:47;
259 uint64_t byp_en:1;
260 uint64_t reserved_13_15:3;
261 uint64_t pctl:5;
262 uint64_t reserved_5_7:3;
263 uint64_t nctl:5;
264#else
265 uint64_t nctl:5;
266 uint64_t reserved_5_7:3;
267 uint64_t pctl:5;
268 uint64_t reserved_13_15:3;
269 uint64_t byp_en:1;
270 uint64_t reserved_17_63:47;
271#endif
272 } cn56xx;
273};
274
275union cvmx_agl_gmx_inf_mode {
276 uint64_t u64;
277 struct cvmx_agl_gmx_inf_mode_s {
278#ifdef __BIG_ENDIAN_BITFIELD
279 uint64_t reserved_2_63:62;
280 uint64_t en:1;
281 uint64_t reserved_0_0:1;
282#else
283 uint64_t reserved_0_0:1;
284 uint64_t en:1;
285 uint64_t reserved_2_63:62;
286#endif
287 } s;
288};
289
290union cvmx_agl_gmx_prtx_cfg {
291 uint64_t u64;
292 struct cvmx_agl_gmx_prtx_cfg_s {
293#ifdef __BIG_ENDIAN_BITFIELD
294 uint64_t reserved_14_63:50;
295 uint64_t tx_idle:1;
296 uint64_t rx_idle:1;
297 uint64_t reserved_9_11:3;
298 uint64_t speed_msb:1;
299 uint64_t reserved_7_7:1;
300 uint64_t burst:1;
301 uint64_t tx_en:1;
302 uint64_t rx_en:1;
303 uint64_t slottime:1;
304 uint64_t duplex:1;
305 uint64_t speed:1;
306 uint64_t en:1;
307#else
308 uint64_t en:1;
309 uint64_t speed:1;
310 uint64_t duplex:1;
311 uint64_t slottime:1;
312 uint64_t rx_en:1;
313 uint64_t tx_en:1;
314 uint64_t burst:1;
315 uint64_t reserved_7_7:1;
316 uint64_t speed_msb:1;
317 uint64_t reserved_9_11:3;
318 uint64_t rx_idle:1;
319 uint64_t tx_idle:1;
320 uint64_t reserved_14_63:50;
321#endif
322 } s;
323 struct cvmx_agl_gmx_prtx_cfg_cn52xx {
324#ifdef __BIG_ENDIAN_BITFIELD
325 uint64_t reserved_6_63:58;
326 uint64_t tx_en:1;
327 uint64_t rx_en:1;
328 uint64_t slottime:1;
329 uint64_t duplex:1;
330 uint64_t speed:1;
331 uint64_t en:1;
332#else
333 uint64_t en:1;
334 uint64_t speed:1;
335 uint64_t duplex:1;
336 uint64_t slottime:1;
337 uint64_t rx_en:1;
338 uint64_t tx_en:1;
339 uint64_t reserved_6_63:58;
340#endif
341 } cn52xx;
342};
343
344union cvmx_agl_gmx_rxx_adr_cam0 {
345 uint64_t u64;
346 struct cvmx_agl_gmx_rxx_adr_cam0_s {
347#ifdef __BIG_ENDIAN_BITFIELD
348 uint64_t adr:64;
349#else
350 uint64_t adr:64;
351#endif
352 } s;
353};
354
355union cvmx_agl_gmx_rxx_adr_cam1 {
356 uint64_t u64;
357 struct cvmx_agl_gmx_rxx_adr_cam1_s {
358#ifdef __BIG_ENDIAN_BITFIELD
359 uint64_t adr:64;
360#else
361 uint64_t adr:64;
362#endif
363 } s;
364};
365
366union cvmx_agl_gmx_rxx_adr_cam2 {
367 uint64_t u64;
368 struct cvmx_agl_gmx_rxx_adr_cam2_s {
369#ifdef __BIG_ENDIAN_BITFIELD
370 uint64_t adr:64;
371#else
372 uint64_t adr:64;
373#endif
374 } s;
375};
376
377union cvmx_agl_gmx_rxx_adr_cam3 {
378 uint64_t u64;
379 struct cvmx_agl_gmx_rxx_adr_cam3_s {
380#ifdef __BIG_ENDIAN_BITFIELD
381 uint64_t adr:64;
382#else
383 uint64_t adr:64;
384#endif
385 } s;
386};
387
388union cvmx_agl_gmx_rxx_adr_cam4 {
389 uint64_t u64;
390 struct cvmx_agl_gmx_rxx_adr_cam4_s {
391#ifdef __BIG_ENDIAN_BITFIELD
392 uint64_t adr:64;
393#else
394 uint64_t adr:64;
395#endif
396 } s;
397};
398
399union cvmx_agl_gmx_rxx_adr_cam5 {
400 uint64_t u64;
401 struct cvmx_agl_gmx_rxx_adr_cam5_s {
402#ifdef __BIG_ENDIAN_BITFIELD
403 uint64_t adr:64;
404#else
405 uint64_t adr:64;
406#endif
407 } s;
408};
409
410union cvmx_agl_gmx_rxx_adr_cam_en {
411 uint64_t u64;
412 struct cvmx_agl_gmx_rxx_adr_cam_en_s {
413#ifdef __BIG_ENDIAN_BITFIELD
414 uint64_t reserved_8_63:56;
415 uint64_t en:8;
416#else
417 uint64_t en:8;
418 uint64_t reserved_8_63:56;
419#endif
420 } s;
421};
422
423union cvmx_agl_gmx_rxx_adr_ctl {
424 uint64_t u64;
425 struct cvmx_agl_gmx_rxx_adr_ctl_s {
426#ifdef __BIG_ENDIAN_BITFIELD
427 uint64_t reserved_4_63:60;
428 uint64_t cam_mode:1;
429 uint64_t mcst:2;
430 uint64_t bcst:1;
431#else
432 uint64_t bcst:1;
433 uint64_t mcst:2;
434 uint64_t cam_mode:1;
435 uint64_t reserved_4_63:60;
436#endif
437 } s;
438};
439
440union cvmx_agl_gmx_rxx_decision {
441 uint64_t u64;
442 struct cvmx_agl_gmx_rxx_decision_s {
443#ifdef __BIG_ENDIAN_BITFIELD
444 uint64_t reserved_5_63:59;
445 uint64_t cnt:5;
446#else
447 uint64_t cnt:5;
448 uint64_t reserved_5_63:59;
449#endif
450 } s;
451};
452
453union cvmx_agl_gmx_rxx_frm_chk {
454 uint64_t u64;
455 struct cvmx_agl_gmx_rxx_frm_chk_s {
456#ifdef __BIG_ENDIAN_BITFIELD
457 uint64_t reserved_10_63:54;
458 uint64_t niberr:1;
459 uint64_t skperr:1;
460 uint64_t rcverr:1;
461 uint64_t lenerr:1;
462 uint64_t alnerr:1;
463 uint64_t fcserr:1;
464 uint64_t jabber:1;
465 uint64_t maxerr:1;
466 uint64_t carext:1;
467 uint64_t minerr:1;
468#else
469 uint64_t minerr:1;
470 uint64_t carext:1;
471 uint64_t maxerr:1;
472 uint64_t jabber:1;
473 uint64_t fcserr:1;
474 uint64_t alnerr:1;
475 uint64_t lenerr:1;
476 uint64_t rcverr:1;
477 uint64_t skperr:1;
478 uint64_t niberr:1;
479 uint64_t reserved_10_63:54;
480#endif
481 } s;
482 struct cvmx_agl_gmx_rxx_frm_chk_cn52xx {
483#ifdef __BIG_ENDIAN_BITFIELD
484 uint64_t reserved_9_63:55;
485 uint64_t skperr:1;
486 uint64_t rcverr:1;
487 uint64_t lenerr:1;
488 uint64_t alnerr:1;
489 uint64_t fcserr:1;
490 uint64_t jabber:1;
491 uint64_t maxerr:1;
492 uint64_t reserved_1_1:1;
493 uint64_t minerr:1;
494#else
495 uint64_t minerr:1;
496 uint64_t reserved_1_1:1;
497 uint64_t maxerr:1;
498 uint64_t jabber:1;
499 uint64_t fcserr:1;
500 uint64_t alnerr:1;
501 uint64_t lenerr:1;
502 uint64_t rcverr:1;
503 uint64_t skperr:1;
504 uint64_t reserved_9_63:55;
505#endif
506 } cn52xx;
507};
508
509union cvmx_agl_gmx_rxx_frm_ctl {
510 uint64_t u64;
511 struct cvmx_agl_gmx_rxx_frm_ctl_s {
512#ifdef __BIG_ENDIAN_BITFIELD
513 uint64_t reserved_13_63:51;
514 uint64_t ptp_mode:1;
515 uint64_t reserved_11_11:1;
516 uint64_t null_dis:1;
517 uint64_t pre_align:1;
518 uint64_t pad_len:1;
519 uint64_t vlan_len:1;
520 uint64_t pre_free:1;
521 uint64_t ctl_smac:1;
522 uint64_t ctl_mcst:1;
523 uint64_t ctl_bck:1;
524 uint64_t ctl_drp:1;
525 uint64_t pre_strp:1;
526 uint64_t pre_chk:1;
527#else
528 uint64_t pre_chk:1;
529 uint64_t pre_strp:1;
530 uint64_t ctl_drp:1;
531 uint64_t ctl_bck:1;
532 uint64_t ctl_mcst:1;
533 uint64_t ctl_smac:1;
534 uint64_t pre_free:1;
535 uint64_t vlan_len:1;
536 uint64_t pad_len:1;
537 uint64_t pre_align:1;
538 uint64_t null_dis:1;
539 uint64_t reserved_11_11:1;
540 uint64_t ptp_mode:1;
541 uint64_t reserved_13_63:51;
542#endif
543 } s;
544 struct cvmx_agl_gmx_rxx_frm_ctl_cn52xx {
545#ifdef __BIG_ENDIAN_BITFIELD
546 uint64_t reserved_10_63:54;
547 uint64_t pre_align:1;
548 uint64_t pad_len:1;
549 uint64_t vlan_len:1;
550 uint64_t pre_free:1;
551 uint64_t ctl_smac:1;
552 uint64_t ctl_mcst:1;
553 uint64_t ctl_bck:1;
554 uint64_t ctl_drp:1;
555 uint64_t pre_strp:1;
556 uint64_t pre_chk:1;
557#else
558 uint64_t pre_chk:1;
559 uint64_t pre_strp:1;
560 uint64_t ctl_drp:1;
561 uint64_t ctl_bck:1;
562 uint64_t ctl_mcst:1;
563 uint64_t ctl_smac:1;
564 uint64_t pre_free:1;
565 uint64_t vlan_len:1;
566 uint64_t pad_len:1;
567 uint64_t pre_align:1;
568 uint64_t reserved_10_63:54;
569#endif
570 } cn52xx;
571};
572
573union cvmx_agl_gmx_rxx_frm_max {
574 uint64_t u64;
575 struct cvmx_agl_gmx_rxx_frm_max_s {
576#ifdef __BIG_ENDIAN_BITFIELD
577 uint64_t reserved_16_63:48;
578 uint64_t len:16;
579#else
580 uint64_t len:16;
581 uint64_t reserved_16_63:48;
582#endif
583 } s;
584};
585
586union cvmx_agl_gmx_rxx_frm_min {
587 uint64_t u64;
588 struct cvmx_agl_gmx_rxx_frm_min_s {
589#ifdef __BIG_ENDIAN_BITFIELD
590 uint64_t reserved_16_63:48;
591 uint64_t len:16;
592#else
593 uint64_t len:16;
594 uint64_t reserved_16_63:48;
595#endif
596 } s;
597};
598
599union cvmx_agl_gmx_rxx_ifg {
600 uint64_t u64;
601 struct cvmx_agl_gmx_rxx_ifg_s {
602#ifdef __BIG_ENDIAN_BITFIELD
603 uint64_t reserved_4_63:60;
604 uint64_t ifg:4;
605#else
606 uint64_t ifg:4;
607 uint64_t reserved_4_63:60;
608#endif
609 } s;
610};
611
612union cvmx_agl_gmx_rxx_int_en {
613 uint64_t u64;
614 struct cvmx_agl_gmx_rxx_int_en_s {
615#ifdef __BIG_ENDIAN_BITFIELD
616 uint64_t reserved_20_63:44;
617 uint64_t pause_drp:1;
618 uint64_t phy_dupx:1;
619 uint64_t phy_spd:1;
620 uint64_t phy_link:1;
621 uint64_t ifgerr:1;
622 uint64_t coldet:1;
623 uint64_t falerr:1;
624 uint64_t rsverr:1;
625 uint64_t pcterr:1;
626 uint64_t ovrerr:1;
627 uint64_t niberr:1;
628 uint64_t skperr:1;
629 uint64_t rcverr:1;
630 uint64_t lenerr:1;
631 uint64_t alnerr:1;
632 uint64_t fcserr:1;
633 uint64_t jabber:1;
634 uint64_t maxerr:1;
635 uint64_t carext:1;
636 uint64_t minerr:1;
637#else
638 uint64_t minerr:1;
639 uint64_t carext:1;
640 uint64_t maxerr:1;
641 uint64_t jabber:1;
642 uint64_t fcserr:1;
643 uint64_t alnerr:1;
644 uint64_t lenerr:1;
645 uint64_t rcverr:1;
646 uint64_t skperr:1;
647 uint64_t niberr:1;
648 uint64_t ovrerr:1;
649 uint64_t pcterr:1;
650 uint64_t rsverr:1;
651 uint64_t falerr:1;
652 uint64_t coldet:1;
653 uint64_t ifgerr:1;
654 uint64_t phy_link:1;
655 uint64_t phy_spd:1;
656 uint64_t phy_dupx:1;
657 uint64_t pause_drp:1;
658 uint64_t reserved_20_63:44;
659#endif
660 } s;
661 struct cvmx_agl_gmx_rxx_int_en_cn52xx {
662#ifdef __BIG_ENDIAN_BITFIELD
663 uint64_t reserved_20_63:44;
664 uint64_t pause_drp:1;
665 uint64_t reserved_16_18:3;
666 uint64_t ifgerr:1;
667 uint64_t coldet:1;
668 uint64_t falerr:1;
669 uint64_t rsverr:1;
670 uint64_t pcterr:1;
671 uint64_t ovrerr:1;
672 uint64_t reserved_9_9:1;
673 uint64_t skperr:1;
674 uint64_t rcverr:1;
675 uint64_t lenerr:1;
676 uint64_t alnerr:1;
677 uint64_t fcserr:1;
678 uint64_t jabber:1;
679 uint64_t maxerr:1;
680 uint64_t reserved_1_1:1;
681 uint64_t minerr:1;
682#else
683 uint64_t minerr:1;
684 uint64_t reserved_1_1:1;
685 uint64_t maxerr:1;
686 uint64_t jabber:1;
687 uint64_t fcserr:1;
688 uint64_t alnerr:1;
689 uint64_t lenerr:1;
690 uint64_t rcverr:1;
691 uint64_t skperr:1;
692 uint64_t reserved_9_9:1;
693 uint64_t ovrerr:1;
694 uint64_t pcterr:1;
695 uint64_t rsverr:1;
696 uint64_t falerr:1;
697 uint64_t coldet:1;
698 uint64_t ifgerr:1;
699 uint64_t reserved_16_18:3;
700 uint64_t pause_drp:1;
701 uint64_t reserved_20_63:44;
702#endif
703 } cn52xx;
704};
705
706union cvmx_agl_gmx_rxx_int_reg {
707 uint64_t u64;
708 struct cvmx_agl_gmx_rxx_int_reg_s {
709#ifdef __BIG_ENDIAN_BITFIELD
710 uint64_t reserved_20_63:44;
711 uint64_t pause_drp:1;
712 uint64_t phy_dupx:1;
713 uint64_t phy_spd:1;
714 uint64_t phy_link:1;
715 uint64_t ifgerr:1;
716 uint64_t coldet:1;
717 uint64_t falerr:1;
718 uint64_t rsverr:1;
719 uint64_t pcterr:1;
720 uint64_t ovrerr:1;
721 uint64_t niberr:1;
722 uint64_t skperr:1;
723 uint64_t rcverr:1;
724 uint64_t lenerr:1;
725 uint64_t alnerr:1;
726 uint64_t fcserr:1;
727 uint64_t jabber:1;
728 uint64_t maxerr:1;
729 uint64_t carext:1;
730 uint64_t minerr:1;
731#else
732 uint64_t minerr:1;
733 uint64_t carext:1;
734 uint64_t maxerr:1;
735 uint64_t jabber:1;
736 uint64_t fcserr:1;
737 uint64_t alnerr:1;
738 uint64_t lenerr:1;
739 uint64_t rcverr:1;
740 uint64_t skperr:1;
741 uint64_t niberr:1;
742 uint64_t ovrerr:1;
743 uint64_t pcterr:1;
744 uint64_t rsverr:1;
745 uint64_t falerr:1;
746 uint64_t coldet:1;
747 uint64_t ifgerr:1;
748 uint64_t phy_link:1;
749 uint64_t phy_spd:1;
750 uint64_t phy_dupx:1;
751 uint64_t pause_drp:1;
752 uint64_t reserved_20_63:44;
753#endif
754 } s;
755 struct cvmx_agl_gmx_rxx_int_reg_cn52xx {
756#ifdef __BIG_ENDIAN_BITFIELD
757 uint64_t reserved_20_63:44;
758 uint64_t pause_drp:1;
759 uint64_t reserved_16_18:3;
760 uint64_t ifgerr:1;
761 uint64_t coldet:1;
762 uint64_t falerr:1;
763 uint64_t rsverr:1;
764 uint64_t pcterr:1;
765 uint64_t ovrerr:1;
766 uint64_t reserved_9_9:1;
767 uint64_t skperr:1;
768 uint64_t rcverr:1;
769 uint64_t lenerr:1;
770 uint64_t alnerr:1;
771 uint64_t fcserr:1;
772 uint64_t jabber:1;
773 uint64_t maxerr:1;
774 uint64_t reserved_1_1:1;
775 uint64_t minerr:1;
776#else
777 uint64_t minerr:1;
778 uint64_t reserved_1_1:1;
779 uint64_t maxerr:1;
780 uint64_t jabber:1;
781 uint64_t fcserr:1;
782 uint64_t alnerr:1;
783 uint64_t lenerr:1;
784 uint64_t rcverr:1;
785 uint64_t skperr:1;
786 uint64_t reserved_9_9:1;
787 uint64_t ovrerr:1;
788 uint64_t pcterr:1;
789 uint64_t rsverr:1;
790 uint64_t falerr:1;
791 uint64_t coldet:1;
792 uint64_t ifgerr:1;
793 uint64_t reserved_16_18:3;
794 uint64_t pause_drp:1;
795 uint64_t reserved_20_63:44;
796#endif
797 } cn52xx;
798};
799
800union cvmx_agl_gmx_rxx_jabber {
801 uint64_t u64;
802 struct cvmx_agl_gmx_rxx_jabber_s {
803#ifdef __BIG_ENDIAN_BITFIELD
804 uint64_t reserved_16_63:48;
805 uint64_t cnt:16;
806#else
807 uint64_t cnt:16;
808 uint64_t reserved_16_63:48;
809#endif
810 } s;
811};
812
813union cvmx_agl_gmx_rxx_pause_drop_time {
814 uint64_t u64;
815 struct cvmx_agl_gmx_rxx_pause_drop_time_s {
816#ifdef __BIG_ENDIAN_BITFIELD
817 uint64_t reserved_16_63:48;
818 uint64_t status:16;
819#else
820 uint64_t status:16;
821 uint64_t reserved_16_63:48;
822#endif
823 } s;
824};
825
826union cvmx_agl_gmx_rxx_rx_inbnd {
827 uint64_t u64;
828 struct cvmx_agl_gmx_rxx_rx_inbnd_s {
829#ifdef __BIG_ENDIAN_BITFIELD
830 uint64_t reserved_4_63:60;
831 uint64_t duplex:1;
832 uint64_t speed:2;
833 uint64_t status:1;
834#else
835 uint64_t status:1;
836 uint64_t speed:2;
837 uint64_t duplex:1;
838 uint64_t reserved_4_63:60;
839#endif
840 } s;
841};
842
843union cvmx_agl_gmx_rxx_stats_ctl {
844 uint64_t u64;
845 struct cvmx_agl_gmx_rxx_stats_ctl_s {
846#ifdef __BIG_ENDIAN_BITFIELD
847 uint64_t reserved_1_63:63;
848 uint64_t rd_clr:1;
849#else
850 uint64_t rd_clr:1;
851 uint64_t reserved_1_63:63;
852#endif
853 } s;
854};
855
856union cvmx_agl_gmx_rxx_stats_octs {
857 uint64_t u64;
858 struct cvmx_agl_gmx_rxx_stats_octs_s {
859#ifdef __BIG_ENDIAN_BITFIELD
860 uint64_t reserved_48_63:16;
861 uint64_t cnt:48;
862#else
863 uint64_t cnt:48;
864 uint64_t reserved_48_63:16;
865#endif
866 } s;
867};
868
869union cvmx_agl_gmx_rxx_stats_octs_ctl {
870 uint64_t u64;
871 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s {
872#ifdef __BIG_ENDIAN_BITFIELD
873 uint64_t reserved_48_63:16;
874 uint64_t cnt:48;
875#else
876 uint64_t cnt:48;
877 uint64_t reserved_48_63:16;
878#endif
879 } s;
880};
881
882union cvmx_agl_gmx_rxx_stats_octs_dmac {
883 uint64_t u64;
884 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s {
885#ifdef __BIG_ENDIAN_BITFIELD
886 uint64_t reserved_48_63:16;
887 uint64_t cnt:48;
888#else
889 uint64_t cnt:48;
890 uint64_t reserved_48_63:16;
891#endif
892 } s;
893};
894
895union cvmx_agl_gmx_rxx_stats_octs_drp {
896 uint64_t u64;
897 struct cvmx_agl_gmx_rxx_stats_octs_drp_s {
898#ifdef __BIG_ENDIAN_BITFIELD
899 uint64_t reserved_48_63:16;
900 uint64_t cnt:48;
901#else
902 uint64_t cnt:48;
903 uint64_t reserved_48_63:16;
904#endif
905 } s;
906};
907
908union cvmx_agl_gmx_rxx_stats_pkts {
909 uint64_t u64;
910 struct cvmx_agl_gmx_rxx_stats_pkts_s {
911#ifdef __BIG_ENDIAN_BITFIELD
912 uint64_t reserved_32_63:32;
913 uint64_t cnt:32;
914#else
915 uint64_t cnt:32;
916 uint64_t reserved_32_63:32;
917#endif
918 } s;
919};
920
921union cvmx_agl_gmx_rxx_stats_pkts_bad {
922 uint64_t u64;
923 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s {
924#ifdef __BIG_ENDIAN_BITFIELD
925 uint64_t reserved_32_63:32;
926 uint64_t cnt:32;
927#else
928 uint64_t cnt:32;
929 uint64_t reserved_32_63:32;
930#endif
931 } s;
932};
933
934union cvmx_agl_gmx_rxx_stats_pkts_ctl {
935 uint64_t u64;
936 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s {
937#ifdef __BIG_ENDIAN_BITFIELD
938 uint64_t reserved_32_63:32;
939 uint64_t cnt:32;
940#else
941 uint64_t cnt:32;
942 uint64_t reserved_32_63:32;
943#endif
944 } s;
945};
946
947union cvmx_agl_gmx_rxx_stats_pkts_dmac {
948 uint64_t u64;
949 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s {
950#ifdef __BIG_ENDIAN_BITFIELD
951 uint64_t reserved_32_63:32;
952 uint64_t cnt:32;
953#else
954 uint64_t cnt:32;
955 uint64_t reserved_32_63:32;
956#endif
957 } s;
958};
959
960union cvmx_agl_gmx_rxx_stats_pkts_drp {
961 uint64_t u64;
962 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s {
963#ifdef __BIG_ENDIAN_BITFIELD
964 uint64_t reserved_32_63:32;
965 uint64_t cnt:32;
966#else
967 uint64_t cnt:32;
968 uint64_t reserved_32_63:32;
969#endif
970 } s;
971};
972
973union cvmx_agl_gmx_rxx_udd_skp {
974 uint64_t u64;
975 struct cvmx_agl_gmx_rxx_udd_skp_s {
976#ifdef __BIG_ENDIAN_BITFIELD
977 uint64_t reserved_9_63:55;
978 uint64_t fcssel:1;
979 uint64_t reserved_7_7:1;
980 uint64_t len:7;
981#else
982 uint64_t len:7;
983 uint64_t reserved_7_7:1;
984 uint64_t fcssel:1;
985 uint64_t reserved_9_63:55;
986#endif
987 } s;
988};
989
990union cvmx_agl_gmx_rx_bp_dropx {
991 uint64_t u64;
992 struct cvmx_agl_gmx_rx_bp_dropx_s {
993#ifdef __BIG_ENDIAN_BITFIELD
994 uint64_t reserved_6_63:58;
995 uint64_t mark:6;
996#else
997 uint64_t mark:6;
998 uint64_t reserved_6_63:58;
999#endif
1000 } s;
1001};
1002
1003union cvmx_agl_gmx_rx_bp_offx {
1004 uint64_t u64;
1005 struct cvmx_agl_gmx_rx_bp_offx_s {
1006#ifdef __BIG_ENDIAN_BITFIELD
1007 uint64_t reserved_6_63:58;
1008 uint64_t mark:6;
1009#else
1010 uint64_t mark:6;
1011 uint64_t reserved_6_63:58;
1012#endif
1013 } s;
1014};
1015
1016union cvmx_agl_gmx_rx_bp_onx {
1017 uint64_t u64;
1018 struct cvmx_agl_gmx_rx_bp_onx_s {
1019#ifdef __BIG_ENDIAN_BITFIELD
1020 uint64_t reserved_9_63:55;
1021 uint64_t mark:9;
1022#else
1023 uint64_t mark:9;
1024 uint64_t reserved_9_63:55;
1025#endif
1026 } s;
1027};
1028
1029union cvmx_agl_gmx_rx_prt_info {
1030 uint64_t u64;
1031 struct cvmx_agl_gmx_rx_prt_info_s {
1032#ifdef __BIG_ENDIAN_BITFIELD
1033 uint64_t reserved_18_63:46;
1034 uint64_t drop:2;
1035 uint64_t reserved_2_15:14;
1036 uint64_t commit:2;
1037#else
1038 uint64_t commit:2;
1039 uint64_t reserved_2_15:14;
1040 uint64_t drop:2;
1041 uint64_t reserved_18_63:46;
1042#endif
1043 } s;
1044 struct cvmx_agl_gmx_rx_prt_info_cn56xx {
1045#ifdef __BIG_ENDIAN_BITFIELD
1046 uint64_t reserved_17_63:47;
1047 uint64_t drop:1;
1048 uint64_t reserved_1_15:15;
1049 uint64_t commit:1;
1050#else
1051 uint64_t commit:1;
1052 uint64_t reserved_1_15:15;
1053 uint64_t drop:1;
1054 uint64_t reserved_17_63:47;
1055#endif
1056 } cn56xx;
1057};
1058
1059union cvmx_agl_gmx_rx_tx_status {
1060 uint64_t u64;
1061 struct cvmx_agl_gmx_rx_tx_status_s {
1062#ifdef __BIG_ENDIAN_BITFIELD
1063 uint64_t reserved_6_63:58;
1064 uint64_t tx:2;
1065 uint64_t reserved_2_3:2;
1066 uint64_t rx:2;
1067#else
1068 uint64_t rx:2;
1069 uint64_t reserved_2_3:2;
1070 uint64_t tx:2;
1071 uint64_t reserved_6_63:58;
1072#endif
1073 } s;
1074 struct cvmx_agl_gmx_rx_tx_status_cn56xx {
1075#ifdef __BIG_ENDIAN_BITFIELD
1076 uint64_t reserved_5_63:59;
1077 uint64_t tx:1;
1078 uint64_t reserved_1_3:3;
1079 uint64_t rx:1;
1080#else
1081 uint64_t rx:1;
1082 uint64_t reserved_1_3:3;
1083 uint64_t tx:1;
1084 uint64_t reserved_5_63:59;
1085#endif
1086 } cn56xx;
1087};
1088
1089union cvmx_agl_gmx_smacx {
1090 uint64_t u64;
1091 struct cvmx_agl_gmx_smacx_s {
1092#ifdef __BIG_ENDIAN_BITFIELD
1093 uint64_t reserved_48_63:16;
1094 uint64_t smac:48;
1095#else
1096 uint64_t smac:48;
1097 uint64_t reserved_48_63:16;
1098#endif
1099 } s;
1100};
1101
1102union cvmx_agl_gmx_stat_bp {
1103 uint64_t u64;
1104 struct cvmx_agl_gmx_stat_bp_s {
1105#ifdef __BIG_ENDIAN_BITFIELD
1106 uint64_t reserved_17_63:47;
1107 uint64_t bp:1;
1108 uint64_t cnt:16;
1109#else
1110 uint64_t cnt:16;
1111 uint64_t bp:1;
1112 uint64_t reserved_17_63:47;
1113#endif
1114 } s;
1115};
1116
1117union cvmx_agl_gmx_txx_append {
1118 uint64_t u64;
1119 struct cvmx_agl_gmx_txx_append_s {
1120#ifdef __BIG_ENDIAN_BITFIELD
1121 uint64_t reserved_4_63:60;
1122 uint64_t force_fcs:1;
1123 uint64_t fcs:1;
1124 uint64_t pad:1;
1125 uint64_t preamble:1;
1126#else
1127 uint64_t preamble:1;
1128 uint64_t pad:1;
1129 uint64_t fcs:1;
1130 uint64_t force_fcs:1;
1131 uint64_t reserved_4_63:60;
1132#endif
1133 } s;
1134};
1135
1136union cvmx_agl_gmx_txx_clk {
1137 uint64_t u64;
1138 struct cvmx_agl_gmx_txx_clk_s {
1139#ifdef __BIG_ENDIAN_BITFIELD
1140 uint64_t reserved_6_63:58;
1141 uint64_t clk_cnt:6;
1142#else
1143 uint64_t clk_cnt:6;
1144 uint64_t reserved_6_63:58;
1145#endif
1146 } s;
1147};
1148
1149union cvmx_agl_gmx_txx_ctl {
1150 uint64_t u64;
1151 struct cvmx_agl_gmx_txx_ctl_s {
1152#ifdef __BIG_ENDIAN_BITFIELD
1153 uint64_t reserved_2_63:62;
1154 uint64_t xsdef_en:1;
1155 uint64_t xscol_en:1;
1156#else
1157 uint64_t xscol_en:1;
1158 uint64_t xsdef_en:1;
1159 uint64_t reserved_2_63:62;
1160#endif
1161 } s;
1162};
1163
1164union cvmx_agl_gmx_txx_min_pkt {
1165 uint64_t u64;
1166 struct cvmx_agl_gmx_txx_min_pkt_s {
1167#ifdef __BIG_ENDIAN_BITFIELD
1168 uint64_t reserved_8_63:56;
1169 uint64_t min_size:8;
1170#else
1171 uint64_t min_size:8;
1172 uint64_t reserved_8_63:56;
1173#endif
1174 } s;
1175};
1176
1177union cvmx_agl_gmx_txx_pause_pkt_interval {
1178 uint64_t u64;
1179 struct cvmx_agl_gmx_txx_pause_pkt_interval_s {
1180#ifdef __BIG_ENDIAN_BITFIELD
1181 uint64_t reserved_16_63:48;
1182 uint64_t interval:16;
1183#else
1184 uint64_t interval:16;
1185 uint64_t reserved_16_63:48;
1186#endif
1187 } s;
1188};
1189
1190union cvmx_agl_gmx_txx_pause_pkt_time {
1191 uint64_t u64;
1192 struct cvmx_agl_gmx_txx_pause_pkt_time_s {
1193#ifdef __BIG_ENDIAN_BITFIELD
1194 uint64_t reserved_16_63:48;
1195 uint64_t time:16;
1196#else
1197 uint64_t time:16;
1198 uint64_t reserved_16_63:48;
1199#endif
1200 } s;
1201};
1202
1203union cvmx_agl_gmx_txx_pause_togo {
1204 uint64_t u64;
1205 struct cvmx_agl_gmx_txx_pause_togo_s {
1206#ifdef __BIG_ENDIAN_BITFIELD
1207 uint64_t reserved_16_63:48;
1208 uint64_t time:16;
1209#else
1210 uint64_t time:16;
1211 uint64_t reserved_16_63:48;
1212#endif
1213 } s;
1214};
1215
1216union cvmx_agl_gmx_txx_pause_zero {
1217 uint64_t u64;
1218 struct cvmx_agl_gmx_txx_pause_zero_s {
1219#ifdef __BIG_ENDIAN_BITFIELD
1220 uint64_t reserved_1_63:63;
1221 uint64_t send:1;
1222#else
1223 uint64_t send:1;
1224 uint64_t reserved_1_63:63;
1225#endif
1226 } s;
1227};
1228
1229union cvmx_agl_gmx_txx_soft_pause {
1230 uint64_t u64;
1231 struct cvmx_agl_gmx_txx_soft_pause_s {
1232#ifdef __BIG_ENDIAN_BITFIELD
1233 uint64_t reserved_16_63:48;
1234 uint64_t time:16;
1235#else
1236 uint64_t time:16;
1237 uint64_t reserved_16_63:48;
1238#endif
1239 } s;
1240};
1241
1242union cvmx_agl_gmx_txx_stat0 {
1243 uint64_t u64;
1244 struct cvmx_agl_gmx_txx_stat0_s {
1245#ifdef __BIG_ENDIAN_BITFIELD
1246 uint64_t xsdef:32;
1247 uint64_t xscol:32;
1248#else
1249 uint64_t xscol:32;
1250 uint64_t xsdef:32;
1251#endif
1252 } s;
1253};
1254
1255union cvmx_agl_gmx_txx_stat1 {
1256 uint64_t u64;
1257 struct cvmx_agl_gmx_txx_stat1_s {
1258#ifdef __BIG_ENDIAN_BITFIELD
1259 uint64_t scol:32;
1260 uint64_t mcol:32;
1261#else
1262 uint64_t mcol:32;
1263 uint64_t scol:32;
1264#endif
1265 } s;
1266};
1267
1268union cvmx_agl_gmx_txx_stat2 {
1269 uint64_t u64;
1270 struct cvmx_agl_gmx_txx_stat2_s {
1271#ifdef __BIG_ENDIAN_BITFIELD
1272 uint64_t reserved_48_63:16;
1273 uint64_t octs:48;
1274#else
1275 uint64_t octs:48;
1276 uint64_t reserved_48_63:16;
1277#endif
1278 } s;
1279};
1280
1281union cvmx_agl_gmx_txx_stat3 {
1282 uint64_t u64;
1283 struct cvmx_agl_gmx_txx_stat3_s {
1284#ifdef __BIG_ENDIAN_BITFIELD
1285 uint64_t reserved_32_63:32;
1286 uint64_t pkts:32;
1287#else
1288 uint64_t pkts:32;
1289 uint64_t reserved_32_63:32;
1290#endif
1291 } s;
1292};
1293
1294union cvmx_agl_gmx_txx_stat4 {
1295 uint64_t u64;
1296 struct cvmx_agl_gmx_txx_stat4_s {
1297#ifdef __BIG_ENDIAN_BITFIELD
1298 uint64_t hist1:32;
1299 uint64_t hist0:32;
1300#else
1301 uint64_t hist0:32;
1302 uint64_t hist1:32;
1303#endif
1304 } s;
1305};
1306
1307union cvmx_agl_gmx_txx_stat5 {
1308 uint64_t u64;
1309 struct cvmx_agl_gmx_txx_stat5_s {
1310#ifdef __BIG_ENDIAN_BITFIELD
1311 uint64_t hist3:32;
1312 uint64_t hist2:32;
1313#else
1314 uint64_t hist2:32;
1315 uint64_t hist3:32;
1316#endif
1317 } s;
1318};
1319
1320union cvmx_agl_gmx_txx_stat6 {
1321 uint64_t u64;
1322 struct cvmx_agl_gmx_txx_stat6_s {
1323#ifdef __BIG_ENDIAN_BITFIELD
1324 uint64_t hist5:32;
1325 uint64_t hist4:32;
1326#else
1327 uint64_t hist4:32;
1328 uint64_t hist5:32;
1329#endif
1330 } s;
1331};
1332
1333union cvmx_agl_gmx_txx_stat7 {
1334 uint64_t u64;
1335 struct cvmx_agl_gmx_txx_stat7_s {
1336#ifdef __BIG_ENDIAN_BITFIELD
1337 uint64_t hist7:32;
1338 uint64_t hist6:32;
1339#else
1340 uint64_t hist6:32;
1341 uint64_t hist7:32;
1342#endif
1343 } s;
1344};
1345
1346union cvmx_agl_gmx_txx_stat8 {
1347 uint64_t u64;
1348 struct cvmx_agl_gmx_txx_stat8_s {
1349#ifdef __BIG_ENDIAN_BITFIELD
1350 uint64_t mcst:32;
1351 uint64_t bcst:32;
1352#else
1353 uint64_t bcst:32;
1354 uint64_t mcst:32;
1355#endif
1356 } s;
1357};
1358
1359union cvmx_agl_gmx_txx_stat9 {
1360 uint64_t u64;
1361 struct cvmx_agl_gmx_txx_stat9_s {
1362#ifdef __BIG_ENDIAN_BITFIELD
1363 uint64_t undflw:32;
1364 uint64_t ctl:32;
1365#else
1366 uint64_t ctl:32;
1367 uint64_t undflw:32;
1368#endif
1369 } s;
1370};
1371
1372union cvmx_agl_gmx_txx_stats_ctl {
1373 uint64_t u64;
1374 struct cvmx_agl_gmx_txx_stats_ctl_s {
1375#ifdef __BIG_ENDIAN_BITFIELD
1376 uint64_t reserved_1_63:63;
1377 uint64_t rd_clr:1;
1378#else
1379 uint64_t rd_clr:1;
1380 uint64_t reserved_1_63:63;
1381#endif
1382 } s;
1383};
1384
1385union cvmx_agl_gmx_txx_thresh {
1386 uint64_t u64;
1387 struct cvmx_agl_gmx_txx_thresh_s {
1388#ifdef __BIG_ENDIAN_BITFIELD
1389 uint64_t reserved_6_63:58;
1390 uint64_t cnt:6;
1391#else
1392 uint64_t cnt:6;
1393 uint64_t reserved_6_63:58;
1394#endif
1395 } s;
1396};
1397
1398union cvmx_agl_gmx_tx_bp {
1399 uint64_t u64;
1400 struct cvmx_agl_gmx_tx_bp_s {
1401#ifdef __BIG_ENDIAN_BITFIELD
1402 uint64_t reserved_2_63:62;
1403 uint64_t bp:2;
1404#else
1405 uint64_t bp:2;
1406 uint64_t reserved_2_63:62;
1407#endif
1408 } s;
1409 struct cvmx_agl_gmx_tx_bp_cn56xx {
1410#ifdef __BIG_ENDIAN_BITFIELD
1411 uint64_t reserved_1_63:63;
1412 uint64_t bp:1;
1413#else
1414 uint64_t bp:1;
1415 uint64_t reserved_1_63:63;
1416#endif
1417 } cn56xx;
1418};
1419
1420union cvmx_agl_gmx_tx_col_attempt {
1421 uint64_t u64;
1422 struct cvmx_agl_gmx_tx_col_attempt_s {
1423#ifdef __BIG_ENDIAN_BITFIELD
1424 uint64_t reserved_5_63:59;
1425 uint64_t limit:5;
1426#else
1427 uint64_t limit:5;
1428 uint64_t reserved_5_63:59;
1429#endif
1430 } s;
1431};
1432
1433union cvmx_agl_gmx_tx_ifg {
1434 uint64_t u64;
1435 struct cvmx_agl_gmx_tx_ifg_s {
1436#ifdef __BIG_ENDIAN_BITFIELD
1437 uint64_t reserved_8_63:56;
1438 uint64_t ifg2:4;
1439 uint64_t ifg1:4;
1440#else
1441 uint64_t ifg1:4;
1442 uint64_t ifg2:4;
1443 uint64_t reserved_8_63:56;
1444#endif
1445 } s;
1446};
1447
1448union cvmx_agl_gmx_tx_int_en {
1449 uint64_t u64;
1450 struct cvmx_agl_gmx_tx_int_en_s {
1451#ifdef __BIG_ENDIAN_BITFIELD
1452 uint64_t reserved_22_63:42;
1453 uint64_t ptp_lost:2;
1454 uint64_t reserved_18_19:2;
1455 uint64_t late_col:2;
1456 uint64_t reserved_14_15:2;
1457 uint64_t xsdef:2;
1458 uint64_t reserved_10_11:2;
1459 uint64_t xscol:2;
1460 uint64_t reserved_4_7:4;
1461 uint64_t undflw:2;
1462 uint64_t reserved_1_1:1;
1463 uint64_t pko_nxa:1;
1464#else
1465 uint64_t pko_nxa:1;
1466 uint64_t reserved_1_1:1;
1467 uint64_t undflw:2;
1468 uint64_t reserved_4_7:4;
1469 uint64_t xscol:2;
1470 uint64_t reserved_10_11:2;
1471 uint64_t xsdef:2;
1472 uint64_t reserved_14_15:2;
1473 uint64_t late_col:2;
1474 uint64_t reserved_18_19:2;
1475 uint64_t ptp_lost:2;
1476 uint64_t reserved_22_63:42;
1477#endif
1478 } s;
1479 struct cvmx_agl_gmx_tx_int_en_cn52xx {
1480#ifdef __BIG_ENDIAN_BITFIELD
1481 uint64_t reserved_18_63:46;
1482 uint64_t late_col:2;
1483 uint64_t reserved_14_15:2;
1484 uint64_t xsdef:2;
1485 uint64_t reserved_10_11:2;
1486 uint64_t xscol:2;
1487 uint64_t reserved_4_7:4;
1488 uint64_t undflw:2;
1489 uint64_t reserved_1_1:1;
1490 uint64_t pko_nxa:1;
1491#else
1492 uint64_t pko_nxa:1;
1493 uint64_t reserved_1_1:1;
1494 uint64_t undflw:2;
1495 uint64_t reserved_4_7:4;
1496 uint64_t xscol:2;
1497 uint64_t reserved_10_11:2;
1498 uint64_t xsdef:2;
1499 uint64_t reserved_14_15:2;
1500 uint64_t late_col:2;
1501 uint64_t reserved_18_63:46;
1502#endif
1503 } cn52xx;
1504 struct cvmx_agl_gmx_tx_int_en_cn56xx {
1505#ifdef __BIG_ENDIAN_BITFIELD
1506 uint64_t reserved_17_63:47;
1507 uint64_t late_col:1;
1508 uint64_t reserved_13_15:3;
1509 uint64_t xsdef:1;
1510 uint64_t reserved_9_11:3;
1511 uint64_t xscol:1;
1512 uint64_t reserved_3_7:5;
1513 uint64_t undflw:1;
1514 uint64_t reserved_1_1:1;
1515 uint64_t pko_nxa:1;
1516#else
1517 uint64_t pko_nxa:1;
1518 uint64_t reserved_1_1:1;
1519 uint64_t undflw:1;
1520 uint64_t reserved_3_7:5;
1521 uint64_t xscol:1;
1522 uint64_t reserved_9_11:3;
1523 uint64_t xsdef:1;
1524 uint64_t reserved_13_15:3;
1525 uint64_t late_col:1;
1526 uint64_t reserved_17_63:47;
1527#endif
1528 } cn56xx;
1529};
1530
1531union cvmx_agl_gmx_tx_int_reg {
1532 uint64_t u64;
1533 struct cvmx_agl_gmx_tx_int_reg_s {
1534#ifdef __BIG_ENDIAN_BITFIELD
1535 uint64_t reserved_22_63:42;
1536 uint64_t ptp_lost:2;
1537 uint64_t reserved_18_19:2;
1538 uint64_t late_col:2;
1539 uint64_t reserved_14_15:2;
1540 uint64_t xsdef:2;
1541 uint64_t reserved_10_11:2;
1542 uint64_t xscol:2;
1543 uint64_t reserved_4_7:4;
1544 uint64_t undflw:2;
1545 uint64_t reserved_1_1:1;
1546 uint64_t pko_nxa:1;
1547#else
1548 uint64_t pko_nxa:1;
1549 uint64_t reserved_1_1:1;
1550 uint64_t undflw:2;
1551 uint64_t reserved_4_7:4;
1552 uint64_t xscol:2;
1553 uint64_t reserved_10_11:2;
1554 uint64_t xsdef:2;
1555 uint64_t reserved_14_15:2;
1556 uint64_t late_col:2;
1557 uint64_t reserved_18_19:2;
1558 uint64_t ptp_lost:2;
1559 uint64_t reserved_22_63:42;
1560#endif
1561 } s;
1562 struct cvmx_agl_gmx_tx_int_reg_cn52xx {
1563#ifdef __BIG_ENDIAN_BITFIELD
1564 uint64_t reserved_18_63:46;
1565 uint64_t late_col:2;
1566 uint64_t reserved_14_15:2;
1567 uint64_t xsdef:2;
1568 uint64_t reserved_10_11:2;
1569 uint64_t xscol:2;
1570 uint64_t reserved_4_7:4;
1571 uint64_t undflw:2;
1572 uint64_t reserved_1_1:1;
1573 uint64_t pko_nxa:1;
1574#else
1575 uint64_t pko_nxa:1;
1576 uint64_t reserved_1_1:1;
1577 uint64_t undflw:2;
1578 uint64_t reserved_4_7:4;
1579 uint64_t xscol:2;
1580 uint64_t reserved_10_11:2;
1581 uint64_t xsdef:2;
1582 uint64_t reserved_14_15:2;
1583 uint64_t late_col:2;
1584 uint64_t reserved_18_63:46;
1585#endif
1586 } cn52xx;
1587 struct cvmx_agl_gmx_tx_int_reg_cn56xx {
1588#ifdef __BIG_ENDIAN_BITFIELD
1589 uint64_t reserved_17_63:47;
1590 uint64_t late_col:1;
1591 uint64_t reserved_13_15:3;
1592 uint64_t xsdef:1;
1593 uint64_t reserved_9_11:3;
1594 uint64_t xscol:1;
1595 uint64_t reserved_3_7:5;
1596 uint64_t undflw:1;
1597 uint64_t reserved_1_1:1;
1598 uint64_t pko_nxa:1;
1599#else
1600 uint64_t pko_nxa:1;
1601 uint64_t reserved_1_1:1;
1602 uint64_t undflw:1;
1603 uint64_t reserved_3_7:5;
1604 uint64_t xscol:1;
1605 uint64_t reserved_9_11:3;
1606 uint64_t xsdef:1;
1607 uint64_t reserved_13_15:3;
1608 uint64_t late_col:1;
1609 uint64_t reserved_17_63:47;
1610#endif
1611 } cn56xx;
1612};
1613
1614union cvmx_agl_gmx_tx_jam {
1615 uint64_t u64;
1616 struct cvmx_agl_gmx_tx_jam_s {
1617#ifdef __BIG_ENDIAN_BITFIELD
1618 uint64_t reserved_8_63:56;
1619 uint64_t jam:8;
1620#else
1621 uint64_t jam:8;
1622 uint64_t reserved_8_63:56;
1623#endif
1624 } s;
1625};
1626
1627union cvmx_agl_gmx_tx_lfsr {
1628 uint64_t u64;
1629 struct cvmx_agl_gmx_tx_lfsr_s {
1630#ifdef __BIG_ENDIAN_BITFIELD
1631 uint64_t reserved_16_63:48;
1632 uint64_t lfsr:16;
1633#else
1634 uint64_t lfsr:16;
1635 uint64_t reserved_16_63:48;
1636#endif
1637 } s;
1638};
1639
1640union cvmx_agl_gmx_tx_ovr_bp {
1641 uint64_t u64;
1642 struct cvmx_agl_gmx_tx_ovr_bp_s {
1643#ifdef __BIG_ENDIAN_BITFIELD
1644 uint64_t reserved_10_63:54;
1645 uint64_t en:2;
1646 uint64_t reserved_6_7:2;
1647 uint64_t bp:2;
1648 uint64_t reserved_2_3:2;
1649 uint64_t ign_full:2;
1650#else
1651 uint64_t ign_full:2;
1652 uint64_t reserved_2_3:2;
1653 uint64_t bp:2;
1654 uint64_t reserved_6_7:2;
1655 uint64_t en:2;
1656 uint64_t reserved_10_63:54;
1657#endif
1658 } s;
1659 struct cvmx_agl_gmx_tx_ovr_bp_cn56xx {
1660#ifdef __BIG_ENDIAN_BITFIELD
1661 uint64_t reserved_9_63:55;
1662 uint64_t en:1;
1663 uint64_t reserved_5_7:3;
1664 uint64_t bp:1;
1665 uint64_t reserved_1_3:3;
1666 uint64_t ign_full:1;
1667#else
1668 uint64_t ign_full:1;
1669 uint64_t reserved_1_3:3;
1670 uint64_t bp:1;
1671 uint64_t reserved_5_7:3;
1672 uint64_t en:1;
1673 uint64_t reserved_9_63:55;
1674#endif
1675 } cn56xx;
1676};
1677
1678union cvmx_agl_gmx_tx_pause_pkt_dmac {
1679 uint64_t u64;
1680 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s {
1681#ifdef __BIG_ENDIAN_BITFIELD
1682 uint64_t reserved_48_63:16;
1683 uint64_t dmac:48;
1684#else
1685 uint64_t dmac:48;
1686 uint64_t reserved_48_63:16;
1687#endif
1688 } s;
1689};
1690
1691union cvmx_agl_gmx_tx_pause_pkt_type {
1692 uint64_t u64;
1693 struct cvmx_agl_gmx_tx_pause_pkt_type_s {
1694#ifdef __BIG_ENDIAN_BITFIELD
1695 uint64_t reserved_16_63:48;
1696 uint64_t type:16;
1697#else
1698 uint64_t type:16;
1699 uint64_t reserved_16_63:48;
1700#endif
1701 } s;
1702};
1703
1704union cvmx_agl_prtx_ctl {
1705 uint64_t u64;
1706 struct cvmx_agl_prtx_ctl_s {
1707#ifdef __BIG_ENDIAN_BITFIELD
1708 uint64_t drv_byp:1;
1709 uint64_t reserved_62_62:1;
1710 uint64_t cmp_pctl:6;
1711 uint64_t reserved_54_55:2;
1712 uint64_t cmp_nctl:6;
1713 uint64_t reserved_46_47:2;
1714 uint64_t drv_pctl:6;
1715 uint64_t reserved_38_39:2;
1716 uint64_t drv_nctl:6;
1717 uint64_t reserved_29_31:3;
1718 uint64_t clk_set:5;
1719 uint64_t clkrx_byp:1;
1720 uint64_t reserved_21_22:2;
1721 uint64_t clkrx_set:5;
1722 uint64_t clktx_byp:1;
1723 uint64_t reserved_13_14:2;
1724 uint64_t clktx_set:5;
1725 uint64_t reserved_5_7:3;
1726 uint64_t dllrst:1;
1727 uint64_t comp:1;
1728 uint64_t enable:1;
1729 uint64_t clkrst:1;
1730 uint64_t mode:1;
1731#else
1732 uint64_t mode:1;
1733 uint64_t clkrst:1;
1734 uint64_t enable:1;
1735 uint64_t comp:1;
1736 uint64_t dllrst:1;
1737 uint64_t reserved_5_7:3;
1738 uint64_t clktx_set:5;
1739 uint64_t reserved_13_14:2;
1740 uint64_t clktx_byp:1;
1741 uint64_t clkrx_set:5;
1742 uint64_t reserved_21_22:2;
1743 uint64_t clkrx_byp:1;
1744 uint64_t clk_set:5;
1745 uint64_t reserved_29_31:3;
1746 uint64_t drv_nctl:6;
1747 uint64_t reserved_38_39:2;
1748 uint64_t drv_pctl:6;
1749 uint64_t reserved_46_47:2;
1750 uint64_t cmp_nctl:6;
1751 uint64_t reserved_54_55:2;
1752 uint64_t cmp_pctl:6;
1753 uint64_t reserved_62_62:1;
1754 uint64_t drv_byp:1;
1755#endif
1756 } s;
1757};
1758
1759#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-asm.h b/arch/mips/include/asm/octeon/cvmx-asm.h
new file mode 100644
index 000000000..31eacc24b
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-asm.h
@@ -0,0 +1,139 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 *
30 * This is file defines ASM primitives for the executive.
31 */
32#ifndef __CVMX_ASM_H__
33#define __CVMX_ASM_H__
34
35#include <asm/octeon/octeon-model.h>
36
37/* other useful stuff */
38#define CVMX_SYNC asm volatile ("sync" : : : "memory")
39/* String version of SYNCW macro for using in inline asm constructs */
40#define CVMX_SYNCW_STR "syncw\nsyncw\n"
41#ifdef __OCTEON__
42
43/* Deprecated, will be removed in future release */
44#define CVMX_SYNCIO asm volatile ("nop")
45
46#define CVMX_SYNCIOBDMA asm volatile ("synciobdma" : : : "memory")
47
48/* Deprecated, will be removed in future release */
49#define CVMX_SYNCIOALL asm volatile ("nop")
50
51/*
52 * We actually use two syncw instructions in a row when we need a write
53 * memory barrier. This is because the CN3XXX series of Octeons have
54 * errata Core-401. This can cause a single syncw to not enforce
55 * ordering under very rare conditions. Even if it is rare, better safe
56 * than sorry.
57 */
58#define CVMX_SYNCW asm volatile ("syncw\n\tsyncw" : : : "memory")
59
60/*
61 * Define new sync instructions to be normal SYNC instructions for
62 * operating systems that use threads.
63 */
64#define CVMX_SYNCWS CVMX_SYNCW
65#define CVMX_SYNCS CVMX_SYNC
66#define CVMX_SYNCWS_STR CVMX_SYNCW_STR
67#else
68/*
69 * Not using a Cavium compiler, always use the slower sync so the
70 * assembler stays happy.
71 */
72/* Deprecated, will be removed in future release */
73#define CVMX_SYNCIO asm volatile ("nop")
74
75#define CVMX_SYNCIOBDMA asm volatile ("sync" : : : "memory")
76
77/* Deprecated, will be removed in future release */
78#define CVMX_SYNCIOALL asm volatile ("nop")
79
80#define CVMX_SYNCW asm volatile ("sync" : : : "memory")
81#define CVMX_SYNCWS CVMX_SYNCW
82#define CVMX_SYNCS CVMX_SYNC
83#define CVMX_SYNCWS_STR CVMX_SYNCW_STR
84#endif
85
86/*
87 * CVMX_PREPARE_FOR_STORE makes each byte of the block unpredictable
88 * (actually old value or zero) until that byte is stored to (by this or
89 * another processor. Note that the value of each byte is not only
90 * unpredictable, but may also change again - up until the point when one
91 * of the cores stores to the byte.
92 */
93#define CVMX_PREPARE_FOR_STORE(address, offset) \
94 asm volatile ("pref 30, " CVMX_TMP_STR(offset) "(%[rbase])" : : \
95 [rbase] "d" (address))
96/*
97 * This is a command headed to the L2 controller to tell it to clear
98 * its dirty bit for a block. Basically, SW is telling HW that the
99 * current version of the block will not be used.
100 */
101#define CVMX_DONT_WRITE_BACK(address, offset) \
102 asm volatile ("pref 29, " CVMX_TMP_STR(offset) "(%[rbase])" : : \
103 [rbase] "d" (address))
104
105/* flush stores, invalidate entire icache */
106#define CVMX_ICACHE_INVALIDATE \
107 { CVMX_SYNC; asm volatile ("synci 0($0)" : : ); }
108
109/* flush stores, invalidate entire icache */
110#define CVMX_ICACHE_INVALIDATE2 \
111 { CVMX_SYNC; asm volatile ("cache 0, 0($0)" : : ); }
112
113/* complete prefetches, invalidate entire dcache */
114#define CVMX_DCACHE_INVALIDATE \
115 { CVMX_SYNC; asm volatile ("cache 9, 0($0)" : : ); }
116
117#define CVMX_CACHE(op, address, offset) \
118 asm volatile ("cache " CVMX_TMP_STR(op) ", " CVMX_TMP_STR(offset) "(%[rbase])" \
119 : : [rbase] "d" (address) )
120/* fetch and lock the state. */
121#define CVMX_CACHE_LCKL2(address, offset) CVMX_CACHE(31, address, offset)
122/* unlock the state. */
123#define CVMX_CACHE_WBIL2(address, offset) CVMX_CACHE(23, address, offset)
124/* invalidate the cache block and clear the USED bits for the block */
125#define CVMX_CACHE_WBIL2I(address, offset) CVMX_CACHE(3, address, offset)
126/* load virtual tag and data for the L2 cache block into L2C_TAD0_TAG register */
127#define CVMX_CACHE_LTGL2I(address, offset) CVMX_CACHE(7, address, offset)
128
129#define CVMX_POP(result, input) \
130 asm ("pop %[rd],%[rs]" : [rd] "=d" (result) : [rs] "d" (input))
131#define CVMX_DPOP(result, input) \
132 asm ("dpop %[rd],%[rs]" : [rd] "=d" (result) : [rs] "d" (input))
133
134/* some new cop0-like stuff */
135#define CVMX_RDHWR(result, regstr) \
136 asm volatile ("rdhwr %[rt],$" CVMX_TMP_STR(regstr) : [rt] "=d" (result))
137#define CVMX_RDHWRNV(result, regstr) \
138 asm ("rdhwr %[rt],$" CVMX_TMP_STR(regstr) : [rt] "=d" (result))
139#endif /* __CVMX_ASM_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-asxx-defs.h b/arch/mips/include/asm/octeon/cvmx-asxx-defs.h
new file mode 100644
index 000000000..70f4a5729
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-asxx-defs.h
@@ -0,0 +1,566 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (C) 2003-2018 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_ASXX_DEFS_H__
29#define __CVMX_ASXX_DEFS_H__
30
31#define CVMX_ASXX_GMII_RX_CLK_SET(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000180ull))
32#define CVMX_ASXX_GMII_RX_DAT_SET(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000188ull))
33#define CVMX_ASXX_INT_EN(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000018ull) + ((block_id) & 1) * 0x8000000ull)
34#define CVMX_ASXX_INT_REG(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000010ull) + ((block_id) & 1) * 0x8000000ull)
35#define CVMX_ASXX_MII_RX_DAT_SET(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000190ull))
36#define CVMX_ASXX_PRT_LOOP(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000040ull) + ((block_id) & 1) * 0x8000000ull)
37#define CVMX_ASXX_RLD_BYPASS(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000248ull) + ((block_id) & 1) * 0x8000000ull)
38#define CVMX_ASXX_RLD_BYPASS_SETTING(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000250ull) + ((block_id) & 1) * 0x8000000ull)
39#define CVMX_ASXX_RLD_COMP(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000220ull) + ((block_id) & 1) * 0x8000000ull)
40#define CVMX_ASXX_RLD_DATA_DRV(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000218ull) + ((block_id) & 1) * 0x8000000ull)
41#define CVMX_ASXX_RLD_FCRAM_MODE(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000210ull) + ((block_id) & 1) * 0x8000000ull)
42#define CVMX_ASXX_RLD_NCTL_STRONG(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000230ull) + ((block_id) & 1) * 0x8000000ull)
43#define CVMX_ASXX_RLD_NCTL_WEAK(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000240ull) + ((block_id) & 1) * 0x8000000ull)
44#define CVMX_ASXX_RLD_PCTL_STRONG(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000228ull) + ((block_id) & 1) * 0x8000000ull)
45#define CVMX_ASXX_RLD_PCTL_WEAK(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000238ull) + ((block_id) & 1) * 0x8000000ull)
46#define CVMX_ASXX_RLD_SETTING(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000258ull) + ((block_id) & 1) * 0x8000000ull)
47#define CVMX_ASXX_RX_CLK_SETX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800B0000020ull) + (((offset) & 3) + ((block_id) & 1) * 0x1000000ull) * 8)
48#define CVMX_ASXX_RX_PRT_EN(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000000ull) + ((block_id) & 1) * 0x8000000ull)
49#define CVMX_ASXX_RX_WOL(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000100ull) + ((block_id) & 1) * 0x8000000ull)
50#define CVMX_ASXX_RX_WOL_MSK(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000108ull) + ((block_id) & 1) * 0x8000000ull)
51#define CVMX_ASXX_RX_WOL_POWOK(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000118ull) + ((block_id) & 1) * 0x8000000ull)
52#define CVMX_ASXX_RX_WOL_SIG(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000110ull) + ((block_id) & 1) * 0x8000000ull)
53#define CVMX_ASXX_TX_CLK_SETX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800B0000048ull) + (((offset) & 3) + ((block_id) & 1) * 0x1000000ull) * 8)
54#define CVMX_ASXX_TX_COMP_BYP(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000068ull) + ((block_id) & 1) * 0x8000000ull)
55#define CVMX_ASXX_TX_HI_WATERX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800B0000080ull) + (((offset) & 3) + ((block_id) & 1) * 0x1000000ull) * 8)
56#define CVMX_ASXX_TX_PRT_EN(block_id) (CVMX_ADD_IO_SEG(0x00011800B0000008ull) + ((block_id) & 1) * 0x8000000ull)
57
58void __cvmx_interrupt_asxx_enable(int block);
59
60union cvmx_asxx_gmii_rx_clk_set {
61 uint64_t u64;
62 struct cvmx_asxx_gmii_rx_clk_set_s {
63#ifdef __BIG_ENDIAN_BITFIELD
64 uint64_t reserved_5_63:59;
65 uint64_t setting:5;
66#else
67 uint64_t setting:5;
68 uint64_t reserved_5_63:59;
69#endif
70 } s;
71};
72
73union cvmx_asxx_gmii_rx_dat_set {
74 uint64_t u64;
75 struct cvmx_asxx_gmii_rx_dat_set_s {
76#ifdef __BIG_ENDIAN_BITFIELD
77 uint64_t reserved_5_63:59;
78 uint64_t setting:5;
79#else
80 uint64_t setting:5;
81 uint64_t reserved_5_63:59;
82#endif
83 } s;
84};
85
86union cvmx_asxx_int_en {
87 uint64_t u64;
88 struct cvmx_asxx_int_en_s {
89#ifdef __BIG_ENDIAN_BITFIELD
90 uint64_t reserved_12_63:52;
91 uint64_t txpsh:4;
92 uint64_t txpop:4;
93 uint64_t ovrflw:4;
94#else
95 uint64_t ovrflw:4;
96 uint64_t txpop:4;
97 uint64_t txpsh:4;
98 uint64_t reserved_12_63:52;
99#endif
100 } s;
101 struct cvmx_asxx_int_en_cn30xx {
102#ifdef __BIG_ENDIAN_BITFIELD
103 uint64_t reserved_11_63:53;
104 uint64_t txpsh:3;
105 uint64_t reserved_7_7:1;
106 uint64_t txpop:3;
107 uint64_t reserved_3_3:1;
108 uint64_t ovrflw:3;
109#else
110 uint64_t ovrflw:3;
111 uint64_t reserved_3_3:1;
112 uint64_t txpop:3;
113 uint64_t reserved_7_7:1;
114 uint64_t txpsh:3;
115 uint64_t reserved_11_63:53;
116#endif
117 } cn30xx;
118};
119
120union cvmx_asxx_int_reg {
121 uint64_t u64;
122 struct cvmx_asxx_int_reg_s {
123#ifdef __BIG_ENDIAN_BITFIELD
124 uint64_t reserved_12_63:52;
125 uint64_t txpsh:4;
126 uint64_t txpop:4;
127 uint64_t ovrflw:4;
128#else
129 uint64_t ovrflw:4;
130 uint64_t txpop:4;
131 uint64_t txpsh:4;
132 uint64_t reserved_12_63:52;
133#endif
134 } s;
135 struct cvmx_asxx_int_reg_cn30xx {
136#ifdef __BIG_ENDIAN_BITFIELD
137 uint64_t reserved_11_63:53;
138 uint64_t txpsh:3;
139 uint64_t reserved_7_7:1;
140 uint64_t txpop:3;
141 uint64_t reserved_3_3:1;
142 uint64_t ovrflw:3;
143#else
144 uint64_t ovrflw:3;
145 uint64_t reserved_3_3:1;
146 uint64_t txpop:3;
147 uint64_t reserved_7_7:1;
148 uint64_t txpsh:3;
149 uint64_t reserved_11_63:53;
150#endif
151 } cn30xx;
152};
153
154union cvmx_asxx_mii_rx_dat_set {
155 uint64_t u64;
156 struct cvmx_asxx_mii_rx_dat_set_s {
157#ifdef __BIG_ENDIAN_BITFIELD
158 uint64_t reserved_5_63:59;
159 uint64_t setting:5;
160#else
161 uint64_t setting:5;
162 uint64_t reserved_5_63:59;
163#endif
164 } s;
165};
166
167union cvmx_asxx_prt_loop {
168 uint64_t u64;
169 struct cvmx_asxx_prt_loop_s {
170#ifdef __BIG_ENDIAN_BITFIELD
171 uint64_t reserved_8_63:56;
172 uint64_t ext_loop:4;
173 uint64_t int_loop:4;
174#else
175 uint64_t int_loop:4;
176 uint64_t ext_loop:4;
177 uint64_t reserved_8_63:56;
178#endif
179 } s;
180 struct cvmx_asxx_prt_loop_cn30xx {
181#ifdef __BIG_ENDIAN_BITFIELD
182 uint64_t reserved_7_63:57;
183 uint64_t ext_loop:3;
184 uint64_t reserved_3_3:1;
185 uint64_t int_loop:3;
186#else
187 uint64_t int_loop:3;
188 uint64_t reserved_3_3:1;
189 uint64_t ext_loop:3;
190 uint64_t reserved_7_63:57;
191#endif
192 } cn30xx;
193};
194
195union cvmx_asxx_rld_bypass {
196 uint64_t u64;
197 struct cvmx_asxx_rld_bypass_s {
198#ifdef __BIG_ENDIAN_BITFIELD
199 uint64_t reserved_1_63:63;
200 uint64_t bypass:1;
201#else
202 uint64_t bypass:1;
203 uint64_t reserved_1_63:63;
204#endif
205 } s;
206};
207
208union cvmx_asxx_rld_bypass_setting {
209 uint64_t u64;
210 struct cvmx_asxx_rld_bypass_setting_s {
211#ifdef __BIG_ENDIAN_BITFIELD
212 uint64_t reserved_5_63:59;
213 uint64_t setting:5;
214#else
215 uint64_t setting:5;
216 uint64_t reserved_5_63:59;
217#endif
218 } s;
219};
220
221union cvmx_asxx_rld_comp {
222 uint64_t u64;
223 struct cvmx_asxx_rld_comp_s {
224#ifdef __BIG_ENDIAN_BITFIELD
225 uint64_t reserved_9_63:55;
226 uint64_t pctl:5;
227 uint64_t nctl:4;
228#else
229 uint64_t nctl:4;
230 uint64_t pctl:5;
231 uint64_t reserved_9_63:55;
232#endif
233 } s;
234 struct cvmx_asxx_rld_comp_cn38xx {
235#ifdef __BIG_ENDIAN_BITFIELD
236 uint64_t reserved_8_63:56;
237 uint64_t pctl:4;
238 uint64_t nctl:4;
239#else
240 uint64_t nctl:4;
241 uint64_t pctl:4;
242 uint64_t reserved_8_63:56;
243#endif
244 } cn38xx;
245};
246
247union cvmx_asxx_rld_data_drv {
248 uint64_t u64;
249 struct cvmx_asxx_rld_data_drv_s {
250#ifdef __BIG_ENDIAN_BITFIELD
251 uint64_t reserved_8_63:56;
252 uint64_t pctl:4;
253 uint64_t nctl:4;
254#else
255 uint64_t nctl:4;
256 uint64_t pctl:4;
257 uint64_t reserved_8_63:56;
258#endif
259 } s;
260};
261
262union cvmx_asxx_rld_fcram_mode {
263 uint64_t u64;
264 struct cvmx_asxx_rld_fcram_mode_s {
265#ifdef __BIG_ENDIAN_BITFIELD
266 uint64_t reserved_1_63:63;
267 uint64_t mode:1;
268#else
269 uint64_t mode:1;
270 uint64_t reserved_1_63:63;
271#endif
272 } s;
273};
274
275union cvmx_asxx_rld_nctl_strong {
276 uint64_t u64;
277 struct cvmx_asxx_rld_nctl_strong_s {
278#ifdef __BIG_ENDIAN_BITFIELD
279 uint64_t reserved_5_63:59;
280 uint64_t nctl:5;
281#else
282 uint64_t nctl:5;
283 uint64_t reserved_5_63:59;
284#endif
285 } s;
286};
287
288union cvmx_asxx_rld_nctl_weak {
289 uint64_t u64;
290 struct cvmx_asxx_rld_nctl_weak_s {
291#ifdef __BIG_ENDIAN_BITFIELD
292 uint64_t reserved_5_63:59;
293 uint64_t nctl:5;
294#else
295 uint64_t nctl:5;
296 uint64_t reserved_5_63:59;
297#endif
298 } s;
299};
300
301union cvmx_asxx_rld_pctl_strong {
302 uint64_t u64;
303 struct cvmx_asxx_rld_pctl_strong_s {
304#ifdef __BIG_ENDIAN_BITFIELD
305 uint64_t reserved_5_63:59;
306 uint64_t pctl:5;
307#else
308 uint64_t pctl:5;
309 uint64_t reserved_5_63:59;
310#endif
311 } s;
312};
313
314union cvmx_asxx_rld_pctl_weak {
315 uint64_t u64;
316 struct cvmx_asxx_rld_pctl_weak_s {
317#ifdef __BIG_ENDIAN_BITFIELD
318 uint64_t reserved_5_63:59;
319 uint64_t pctl:5;
320#else
321 uint64_t pctl:5;
322 uint64_t reserved_5_63:59;
323#endif
324 } s;
325};
326
327union cvmx_asxx_rld_setting {
328 uint64_t u64;
329 struct cvmx_asxx_rld_setting_s {
330#ifdef __BIG_ENDIAN_BITFIELD
331 uint64_t reserved_13_63:51;
332 uint64_t dfaset:5;
333 uint64_t dfalag:1;
334 uint64_t dfalead:1;
335 uint64_t dfalock:1;
336 uint64_t setting:5;
337#else
338 uint64_t setting:5;
339 uint64_t dfalock:1;
340 uint64_t dfalead:1;
341 uint64_t dfalag:1;
342 uint64_t dfaset:5;
343 uint64_t reserved_13_63:51;
344#endif
345 } s;
346 struct cvmx_asxx_rld_setting_cn38xx {
347#ifdef __BIG_ENDIAN_BITFIELD
348 uint64_t reserved_5_63:59;
349 uint64_t setting:5;
350#else
351 uint64_t setting:5;
352 uint64_t reserved_5_63:59;
353#endif
354 } cn38xx;
355};
356
357union cvmx_asxx_rx_clk_setx {
358 uint64_t u64;
359 struct cvmx_asxx_rx_clk_setx_s {
360#ifdef __BIG_ENDIAN_BITFIELD
361 uint64_t reserved_5_63:59;
362 uint64_t setting:5;
363#else
364 uint64_t setting:5;
365 uint64_t reserved_5_63:59;
366#endif
367 } s;
368};
369
370union cvmx_asxx_rx_prt_en {
371 uint64_t u64;
372 struct cvmx_asxx_rx_prt_en_s {
373#ifdef __BIG_ENDIAN_BITFIELD
374 uint64_t reserved_4_63:60;
375 uint64_t prt_en:4;
376#else
377 uint64_t prt_en:4;
378 uint64_t reserved_4_63:60;
379#endif
380 } s;
381 struct cvmx_asxx_rx_prt_en_cn30xx {
382#ifdef __BIG_ENDIAN_BITFIELD
383 uint64_t reserved_3_63:61;
384 uint64_t prt_en:3;
385#else
386 uint64_t prt_en:3;
387 uint64_t reserved_3_63:61;
388#endif
389 } cn30xx;
390};
391
392union cvmx_asxx_rx_wol {
393 uint64_t u64;
394 struct cvmx_asxx_rx_wol_s {
395#ifdef __BIG_ENDIAN_BITFIELD
396 uint64_t reserved_2_63:62;
397 uint64_t status:1;
398 uint64_t enable:1;
399#else
400 uint64_t enable:1;
401 uint64_t status:1;
402 uint64_t reserved_2_63:62;
403#endif
404 } s;
405};
406
407union cvmx_asxx_rx_wol_msk {
408 uint64_t u64;
409 struct cvmx_asxx_rx_wol_msk_s {
410#ifdef __BIG_ENDIAN_BITFIELD
411 uint64_t msk:64;
412#else
413 uint64_t msk:64;
414#endif
415 } s;
416};
417
418union cvmx_asxx_rx_wol_powok {
419 uint64_t u64;
420 struct cvmx_asxx_rx_wol_powok_s {
421#ifdef __BIG_ENDIAN_BITFIELD
422 uint64_t reserved_1_63:63;
423 uint64_t powerok:1;
424#else
425 uint64_t powerok:1;
426 uint64_t reserved_1_63:63;
427#endif
428 } s;
429};
430
431union cvmx_asxx_rx_wol_sig {
432 uint64_t u64;
433 struct cvmx_asxx_rx_wol_sig_s {
434#ifdef __BIG_ENDIAN_BITFIELD
435 uint64_t reserved_32_63:32;
436 uint64_t sig:32;
437#else
438 uint64_t sig:32;
439 uint64_t reserved_32_63:32;
440#endif
441 } s;
442};
443
444union cvmx_asxx_tx_clk_setx {
445 uint64_t u64;
446 struct cvmx_asxx_tx_clk_setx_s {
447#ifdef __BIG_ENDIAN_BITFIELD
448 uint64_t reserved_5_63:59;
449 uint64_t setting:5;
450#else
451 uint64_t setting:5;
452 uint64_t reserved_5_63:59;
453#endif
454 } s;
455};
456
457union cvmx_asxx_tx_comp_byp {
458 uint64_t u64;
459 struct cvmx_asxx_tx_comp_byp_s {
460#ifdef __BIG_ENDIAN_BITFIELD
461 uint64_t reserved_0_63:64;
462#else
463 uint64_t reserved_0_63:64;
464#endif
465 } s;
466 struct cvmx_asxx_tx_comp_byp_cn30xx {
467#ifdef __BIG_ENDIAN_BITFIELD
468 uint64_t reserved_9_63:55;
469 uint64_t bypass:1;
470 uint64_t pctl:4;
471 uint64_t nctl:4;
472#else
473 uint64_t nctl:4;
474 uint64_t pctl:4;
475 uint64_t bypass:1;
476 uint64_t reserved_9_63:55;
477#endif
478 } cn30xx;
479 struct cvmx_asxx_tx_comp_byp_cn38xx {
480#ifdef __BIG_ENDIAN_BITFIELD
481 uint64_t reserved_8_63:56;
482 uint64_t pctl:4;
483 uint64_t nctl:4;
484#else
485 uint64_t nctl:4;
486 uint64_t pctl:4;
487 uint64_t reserved_8_63:56;
488#endif
489 } cn38xx;
490 struct cvmx_asxx_tx_comp_byp_cn50xx {
491#ifdef __BIG_ENDIAN_BITFIELD
492 uint64_t reserved_17_63:47;
493 uint64_t bypass:1;
494 uint64_t reserved_13_15:3;
495 uint64_t pctl:5;
496 uint64_t reserved_5_7:3;
497 uint64_t nctl:5;
498#else
499 uint64_t nctl:5;
500 uint64_t reserved_5_7:3;
501 uint64_t pctl:5;
502 uint64_t reserved_13_15:3;
503 uint64_t bypass:1;
504 uint64_t reserved_17_63:47;
505#endif
506 } cn50xx;
507 struct cvmx_asxx_tx_comp_byp_cn58xx {
508#ifdef __BIG_ENDIAN_BITFIELD
509 uint64_t reserved_13_63:51;
510 uint64_t pctl:5;
511 uint64_t reserved_5_7:3;
512 uint64_t nctl:5;
513#else
514 uint64_t nctl:5;
515 uint64_t reserved_5_7:3;
516 uint64_t pctl:5;
517 uint64_t reserved_13_63:51;
518#endif
519 } cn58xx;
520};
521
522union cvmx_asxx_tx_hi_waterx {
523 uint64_t u64;
524 struct cvmx_asxx_tx_hi_waterx_s {
525#ifdef __BIG_ENDIAN_BITFIELD
526 uint64_t reserved_4_63:60;
527 uint64_t mark:4;
528#else
529 uint64_t mark:4;
530 uint64_t reserved_4_63:60;
531#endif
532 } s;
533 struct cvmx_asxx_tx_hi_waterx_cn30xx {
534#ifdef __BIG_ENDIAN_BITFIELD
535 uint64_t reserved_3_63:61;
536 uint64_t mark:3;
537#else
538 uint64_t mark:3;
539 uint64_t reserved_3_63:61;
540#endif
541 } cn30xx;
542};
543
544union cvmx_asxx_tx_prt_en {
545 uint64_t u64;
546 struct cvmx_asxx_tx_prt_en_s {
547#ifdef __BIG_ENDIAN_BITFIELD
548 uint64_t reserved_4_63:60;
549 uint64_t prt_en:4;
550#else
551 uint64_t prt_en:4;
552 uint64_t reserved_4_63:60;
553#endif
554 } s;
555 struct cvmx_asxx_tx_prt_en_cn30xx {
556#ifdef __BIG_ENDIAN_BITFIELD
557 uint64_t reserved_3_63:61;
558 uint64_t prt_en:3;
559#else
560 uint64_t prt_en:3;
561 uint64_t reserved_3_63:61;
562#endif
563 } cn30xx;
564};
565
566#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-boot-vector.h b/arch/mips/include/asm/octeon/cvmx-boot-vector.h
new file mode 100644
index 000000000..8db08241d
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-boot-vector.h
@@ -0,0 +1,53 @@
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-2017 Cavium, Inc.
7 */
8
9#ifndef __CVMX_BOOT_VECTOR_H__
10#define __CVMX_BOOT_VECTOR_H__
11
12#include <asm/octeon/octeon.h>
13
14/*
15 * The boot vector table is made up of an array of 1024 elements of
16 * struct cvmx_boot_vector_element. There is one entry for each
17 * possible MIPS CPUNum, indexed by the CPUNum.
18 *
19 * Once cvmx_boot_vector_get() returns a non-NULL value (indicating
20 * success), NMI to a core will cause execution to transfer to the
21 * target_ptr location for that core's entry in the vector table.
22 *
23 * The struct cvmx_boot_vector_element fields app0, app1, and app2 can
24 * be used by the application that has set the target_ptr in any
25 * application specific manner, they are not touched by the vectoring
26 * code.
27 *
28 * The boot vector code clobbers the CP0_DESAVE register, and on
29 * OCTEON II and later CPUs also clobbers CP0_KScratch2. All GP
30 * registers are preserved, except on pre-OCTEON II CPUs, where k1 is
31 * clobbered.
32 *
33 */
34
35
36/*
37 * Applications install the boot bus code in cvmx-boot-vector.c, which
38 * uses this magic:
39 */
40#define OCTEON_BOOT_MOVEABLE_MAGIC1 0xdb00110ad358eacdull
41
42struct cvmx_boot_vector_element {
43 /* kseg0 or xkphys address of target code. */
44 uint64_t target_ptr;
45 /* Three application specific arguments. */
46 uint64_t app0;
47 uint64_t app1;
48 uint64_t app2;
49};
50
51struct cvmx_boot_vector_element *cvmx_boot_vector_get(void);
52
53#endif /* __CVMX_BOOT_VECTOR_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
new file mode 100644
index 000000000..e77e8b7c0
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
@@ -0,0 +1,424 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 * Header file containing the ABI with the bootloader.
30 */
31
32#ifndef __CVMX_BOOTINFO_H__
33#define __CVMX_BOOTINFO_H__
34
35#include "cvmx-coremask.h"
36
37/*
38 * Current major and minor versions of the CVMX bootinfo block that is
39 * passed from the bootloader to the application. This is versioned
40 * so that applications can properly handle multiple bootloader
41 * versions.
42 */
43#define CVMX_BOOTINFO_MAJ_VER 1
44#define CVMX_BOOTINFO_MIN_VER 4
45
46#if (CVMX_BOOTINFO_MAJ_VER == 1)
47#define CVMX_BOOTINFO_OCTEON_SERIAL_LEN 20
48/*
49 * This structure is populated by the bootloader. For binary
50 * compatibility the only changes that should be made are
51 * adding members to the end of the structure, and the minor
52 * version should be incremented at that time.
53 * If an incompatible change is made, the major version
54 * must be incremented, and the minor version should be reset
55 * to 0.
56 */
57struct cvmx_bootinfo {
58#ifdef __BIG_ENDIAN_BITFIELD
59 uint32_t major_version;
60 uint32_t minor_version;
61
62 uint64_t stack_top;
63 uint64_t heap_base;
64 uint64_t heap_end;
65 uint64_t desc_vaddr;
66
67 uint32_t exception_base_addr;
68 uint32_t stack_size;
69 uint32_t flags;
70 uint32_t core_mask;
71 /* DRAM size in megabytes */
72 uint32_t dram_size;
73 /* physical address of free memory descriptor block*/
74 uint32_t phy_mem_desc_addr;
75 /* used to pass flags from app to debugger */
76 uint32_t debugger_flags_base_addr;
77
78 /* CPU clock speed, in hz */
79 uint32_t eclock_hz;
80
81 /* DRAM clock speed, in hz */
82 uint32_t dclock_hz;
83
84 uint32_t reserved0;
85 uint16_t board_type;
86 uint8_t board_rev_major;
87 uint8_t board_rev_minor;
88 uint16_t reserved1;
89 uint8_t reserved2;
90 uint8_t reserved3;
91 char board_serial_number[CVMX_BOOTINFO_OCTEON_SERIAL_LEN];
92 uint8_t mac_addr_base[6];
93 uint8_t mac_addr_count;
94#if (CVMX_BOOTINFO_MIN_VER >= 1)
95 /*
96 * Several boards support compact flash on the Octeon boot
97 * bus. The CF memory spaces may be mapped to different
98 * addresses on different boards. These are the physical
99 * addresses, so care must be taken to use the correct
100 * XKPHYS/KSEG0 addressing depending on the application's
101 * ABI. These values will be 0 if CF is not present.
102 */
103 uint64_t compact_flash_common_base_addr;
104 uint64_t compact_flash_attribute_base_addr;
105 /*
106 * Base address of the LED display (as on EBT3000 board)
107 * This will be 0 if LED display not present.
108 */
109 uint64_t led_display_base_addr;
110#endif
111#if (CVMX_BOOTINFO_MIN_VER >= 2)
112 /* DFA reference clock in hz (if applicable)*/
113 uint32_t dfa_ref_clock_hz;
114
115 /*
116 * flags indicating various configuration options. These
117 * flags supercede the 'flags' variable and should be used
118 * instead if available.
119 */
120 uint32_t config_flags;
121#endif
122#if (CVMX_BOOTINFO_MIN_VER >= 3)
123 /*
124 * Address of the OF Flattened Device Tree structure
125 * describing the board.
126 */
127 uint64_t fdt_addr;
128#endif
129#if (CVMX_BOOTINFO_MIN_VER >= 4)
130 /*
131 * Coremask used for processors with more than 32 cores
132 * or with OCI. This replaces core_mask.
133 */
134 struct cvmx_coremask ext_core_mask;
135#endif
136#else /* __BIG_ENDIAN */
137 /*
138 * Little-Endian: When the CPU mode is switched to
139 * little-endian, the view of the structure has some of the
140 * fields swapped.
141 */
142 uint32_t minor_version;
143 uint32_t major_version;
144
145 uint64_t stack_top;
146 uint64_t heap_base;
147 uint64_t heap_end;
148 uint64_t desc_vaddr;
149
150 uint32_t stack_size;
151 uint32_t exception_base_addr;
152
153 uint32_t core_mask;
154 uint32_t flags;
155
156 uint32_t phy_mem_desc_addr;
157 uint32_t dram_size;
158
159 uint32_t eclock_hz;
160 uint32_t debugger_flags_base_addr;
161
162 uint32_t reserved0;
163 uint32_t dclock_hz;
164
165 uint8_t reserved3;
166 uint8_t reserved2;
167 uint16_t reserved1;
168 uint8_t board_rev_minor;
169 uint8_t board_rev_major;
170 uint16_t board_type;
171
172 char board_serial_number[CVMX_BOOTINFO_OCTEON_SERIAL_LEN];
173 uint8_t mac_addr_base[6];
174 uint8_t mac_addr_count;
175 uint8_t pad[5];
176
177#if (CVMX_BOOTINFO_MIN_VER >= 1)
178 uint64_t compact_flash_common_base_addr;
179 uint64_t compact_flash_attribute_base_addr;
180 uint64_t led_display_base_addr;
181#endif
182#if (CVMX_BOOTINFO_MIN_VER >= 2)
183 uint32_t config_flags;
184 uint32_t dfa_ref_clock_hz;
185#endif
186#if (CVMX_BOOTINFO_MIN_VER >= 3)
187 uint64_t fdt_addr;
188#endif
189#if (CVMX_BOOTINFO_MIN_VER >= 4)
190 struct cvmx_coremask ext_core_mask;
191#endif
192#endif
193};
194
195#define CVMX_BOOTINFO_CFG_FLAG_PCI_HOST (1ull << 0)
196#define CVMX_BOOTINFO_CFG_FLAG_PCI_TARGET (1ull << 1)
197#define CVMX_BOOTINFO_CFG_FLAG_DEBUG (1ull << 2)
198#define CVMX_BOOTINFO_CFG_FLAG_NO_MAGIC (1ull << 3)
199/* This flag is set if the TLB mappings are not contained in the
200 * 0x10000000 - 0x20000000 boot bus region. */
201#define CVMX_BOOTINFO_CFG_FLAG_OVERSIZE_TLB_MAPPING (1ull << 4)
202#define CVMX_BOOTINFO_CFG_FLAG_BREAK (1ull << 5)
203
204#endif /* (CVMX_BOOTINFO_MAJ_VER == 1) */
205
206/* Type defines for board and chip types */
207enum cvmx_board_types_enum {
208 CVMX_BOARD_TYPE_NULL = 0,
209 CVMX_BOARD_TYPE_SIM = 1,
210 CVMX_BOARD_TYPE_EBT3000 = 2,
211 CVMX_BOARD_TYPE_KODAMA = 3,
212 CVMX_BOARD_TYPE_NIAGARA = 4,
213 CVMX_BOARD_TYPE_NAC38 = 5, /* formerly NAO38 */
214 CVMX_BOARD_TYPE_THUNDER = 6,
215 CVMX_BOARD_TYPE_TRANTOR = 7,
216 CVMX_BOARD_TYPE_EBH3000 = 8,
217 CVMX_BOARD_TYPE_EBH3100 = 9,
218 CVMX_BOARD_TYPE_HIKARI = 10,
219 CVMX_BOARD_TYPE_CN3010_EVB_HS5 = 11,
220 CVMX_BOARD_TYPE_CN3005_EVB_HS5 = 12,
221 CVMX_BOARD_TYPE_KBP = 13,
222 /* Deprecated, CVMX_BOARD_TYPE_CN3010_EVB_HS5 supports the CN3020 */
223 CVMX_BOARD_TYPE_CN3020_EVB_HS5 = 14,
224 CVMX_BOARD_TYPE_EBT5800 = 15,
225 CVMX_BOARD_TYPE_NICPRO2 = 16,
226 CVMX_BOARD_TYPE_EBH5600 = 17,
227 CVMX_BOARD_TYPE_EBH5601 = 18,
228 CVMX_BOARD_TYPE_EBH5200 = 19,
229 CVMX_BOARD_TYPE_BBGW_REF = 20,
230 CVMX_BOARD_TYPE_NIC_XLE_4G = 21,
231 CVMX_BOARD_TYPE_EBT5600 = 22,
232 CVMX_BOARD_TYPE_EBH5201 = 23,
233 CVMX_BOARD_TYPE_EBT5200 = 24,
234 CVMX_BOARD_TYPE_CB5600 = 25,
235 CVMX_BOARD_TYPE_CB5601 = 26,
236 CVMX_BOARD_TYPE_CB5200 = 27,
237 /* Special 'generic' board type, supports many boards */
238 CVMX_BOARD_TYPE_GENERIC = 28,
239 CVMX_BOARD_TYPE_EBH5610 = 29,
240 CVMX_BOARD_TYPE_LANAI2_A = 30,
241 CVMX_BOARD_TYPE_LANAI2_U = 31,
242 CVMX_BOARD_TYPE_EBB5600 = 32,
243 CVMX_BOARD_TYPE_EBB6300 = 33,
244 CVMX_BOARD_TYPE_NIC_XLE_10G = 34,
245 CVMX_BOARD_TYPE_LANAI2_G = 35,
246 CVMX_BOARD_TYPE_EBT5810 = 36,
247 CVMX_BOARD_TYPE_NIC10E = 37,
248 CVMX_BOARD_TYPE_EP6300C = 38,
249 CVMX_BOARD_TYPE_EBB6800 = 39,
250 CVMX_BOARD_TYPE_NIC4E = 40,
251 CVMX_BOARD_TYPE_NIC2E = 41,
252 CVMX_BOARD_TYPE_EBB6600 = 42,
253 CVMX_BOARD_TYPE_REDWING = 43,
254 CVMX_BOARD_TYPE_NIC68_4 = 44,
255 CVMX_BOARD_TYPE_NIC10E_66 = 45,
256 CVMX_BOARD_TYPE_MAX,
257
258 /*
259 * The range from CVMX_BOARD_TYPE_MAX to
260 * CVMX_BOARD_TYPE_CUST_DEFINED_MIN is reserved for future
261 * SDK use.
262 */
263
264 /*
265 * Set aside a range for customer boards. These numbers are managed
266 * by Cavium.
267 */
268 CVMX_BOARD_TYPE_CUST_DEFINED_MIN = 10000,
269 CVMX_BOARD_TYPE_CUST_WSX16 = 10001,
270 CVMX_BOARD_TYPE_CUST_NS0216 = 10002,
271 CVMX_BOARD_TYPE_CUST_NB5 = 10003,
272 CVMX_BOARD_TYPE_CUST_WMR500 = 10004,
273 CVMX_BOARD_TYPE_CUST_ITB101 = 10005,
274 CVMX_BOARD_TYPE_CUST_NTE102 = 10006,
275 CVMX_BOARD_TYPE_CUST_AGS103 = 10007,
276 CVMX_BOARD_TYPE_CUST_GST104 = 10008,
277 CVMX_BOARD_TYPE_CUST_GCT105 = 10009,
278 CVMX_BOARD_TYPE_CUST_AGS106 = 10010,
279 CVMX_BOARD_TYPE_CUST_SGM107 = 10011,
280 CVMX_BOARD_TYPE_CUST_GCT108 = 10012,
281 CVMX_BOARD_TYPE_CUST_AGS109 = 10013,
282 CVMX_BOARD_TYPE_CUST_GCT110 = 10014,
283 CVMX_BOARD_TYPE_CUST_L2_AIR_SENDER = 10015,
284 CVMX_BOARD_TYPE_CUST_L2_AIR_RECEIVER = 10016,
285 CVMX_BOARD_TYPE_CUST_L2_ACCTON2_TX = 10017,
286 CVMX_BOARD_TYPE_CUST_L2_ACCTON2_RX = 10018,
287 CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_TX = 10019,
288 CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_RX = 10020,
289 CVMX_BOARD_TYPE_CUST_L2_ZINWELL = 10021,
290 CVMX_BOARD_TYPE_CUST_DEFINED_MAX = 20000,
291
292 /*
293 * Set aside a range for customer private use. The SDK won't
294 * use any numbers in this range.
295 */
296 CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001,
297 CVMX_BOARD_TYPE_UBNT_E100 = 20002,
298 CVMX_BOARD_TYPE_UBNT_E200 = 20003,
299 CVMX_BOARD_TYPE_UBNT_E220 = 20005,
300 CVMX_BOARD_TYPE_CUST_DSR1000N = 20006,
301 CVMX_BOARD_TYPE_KONTRON_S1901 = 21901,
302 CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
303
304 /* The remaining range is reserved for future use. */
305};
306
307enum cvmx_chip_types_enum {
308 CVMX_CHIP_TYPE_NULL = 0,
309 CVMX_CHIP_SIM_TYPE_DEPRECATED = 1,
310 CVMX_CHIP_TYPE_OCTEON_SAMPLE = 2,
311 CVMX_CHIP_TYPE_MAX,
312};
313
314/* Compatibility alias for NAC38 name change, planned to be removed
315 * from SDK 1.7 */
316#define CVMX_BOARD_TYPE_NAO38 CVMX_BOARD_TYPE_NAC38
317
318/* Functions to return string based on type */
319#define ENUM_BRD_TYPE_CASE(x) \
320 case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */
321static inline const char *cvmx_board_type_to_string(enum
322 cvmx_board_types_enum type)
323{
324 switch (type) {
325 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NULL)
326 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_SIM)
327 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT3000)
328 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KODAMA)
329 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIAGARA)
330 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NAC38)
331 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_THUNDER)
332 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_TRANTOR)
333 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3000)
334 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3100)
335 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_HIKARI)
336 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3010_EVB_HS5)
337 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3005_EVB_HS5)
338 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KBP)
339 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3020_EVB_HS5)
340 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5800)
341 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NICPRO2)
342 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5600)
343 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5601)
344 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5200)
345 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_BBGW_REF)
346 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC_XLE_4G)
347 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5600)
348 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5201)
349 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5200)
350 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5600)
351 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5601)
352 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5200)
353 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_GENERIC)
354 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5610)
355 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_LANAI2_A)
356 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_LANAI2_U)
357 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB5600)
358 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB6300)
359 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC_XLE_10G)
360 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_LANAI2_G)
361 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5810)
362 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC10E)
363 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EP6300C)
364 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB6800)
365 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC4E)
366 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC2E)
367 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB6600)
368 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_REDWING)
369 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC68_4)
370 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC10E_66)
371 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MAX)
372
373 /* Customer boards listed here */
374 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MIN)
375 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WSX16)
376 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NS0216)
377 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NB5)
378 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WMR500)
379 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_ITB101)
380 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NTE102)
381 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS103)
382 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GST104)
383 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT105)
384 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS106)
385 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_SGM107)
386 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT108)
387 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS109)
388 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT110)
389 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_AIR_SENDER)
390 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_AIR_RECEIVER)
391 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ACCTON2_TX)
392 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ACCTON2_RX)
393 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_TX)
394 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_RX)
395 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ZINWELL)
396 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MAX)
397
398 /* Customer private range */
399 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN)
400 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E100)
401 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E200)
402 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E220)
403 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DSR1000N)
404 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KONTRON_S1901)
405 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
406 }
407 return NULL;
408}
409
410#define ENUM_CHIP_TYPE_CASE(x) \
411 case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */
412static inline const char *cvmx_chip_type_to_string(enum
413 cvmx_chip_types_enum type)
414{
415 switch (type) {
416 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_NULL)
417 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_SIM_TYPE_DEPRECATED)
418 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_OCTEON_SAMPLE)
419 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_MAX)
420 }
421 return "Unsupported Chip";
422}
423
424#endif /* __CVMX_BOOTINFO_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-bootmem.h b/arch/mips/include/asm/octeon/cvmx-bootmem.h
new file mode 100644
index 000000000..689a82cac
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-bootmem.h
@@ -0,0 +1,341 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 * Simple allocate only memory allocator. Used to allocate memory at
30 * application start time.
31 */
32
33#ifndef __CVMX_BOOTMEM_H__
34#define __CVMX_BOOTMEM_H__
35/* Must be multiple of 8, changing breaks ABI */
36#define CVMX_BOOTMEM_NAME_LEN 128
37
38/* Can change without breaking ABI */
39#define CVMX_BOOTMEM_NUM_NAMED_BLOCKS 64
40
41/* minimum alignment of bootmem alloced blocks */
42#define CVMX_BOOTMEM_ALIGNMENT_SIZE (16ull)
43
44/* Flags for cvmx_bootmem_phy_mem* functions */
45/* Allocate from end of block instead of beginning */
46#define CVMX_BOOTMEM_FLAG_END_ALLOC (1 << 0)
47
48/* Don't do any locking. */
49#define CVMX_BOOTMEM_FLAG_NO_LOCKING (1 << 1)
50
51/* First bytes of each free physical block of memory contain this structure,
52 * which is used to maintain the free memory list. Since the bootloader is
53 * only 32 bits, there is a union providing 64 and 32 bit versions. The
54 * application init code converts addresses to 64 bit addresses before the
55 * application starts.
56 */
57struct cvmx_bootmem_block_header {
58 /*
59 * Note: these are referenced from assembly routines in the
60 * bootloader, so this structure should not be changed
61 * without changing those routines as well.
62 */
63 uint64_t next_block_addr;
64 uint64_t size;
65
66};
67
68/*
69 * Structure for named memory blocks. Number of descriptors available
70 * can be changed without affecting compatibility, but name length
71 * changes require a bump in the bootmem descriptor version Note: This
72 * structure must be naturally 64 bit aligned, as a single memory
73 * image will be used by both 32 and 64 bit programs.
74 */
75struct cvmx_bootmem_named_block_desc {
76 /* Base address of named block */
77 uint64_t base_addr;
78 /*
79 * Size actually allocated for named block (may differ from
80 * requested).
81 */
82 uint64_t size;
83 /* name of named block */
84 char name[CVMX_BOOTMEM_NAME_LEN];
85};
86
87/* Current descriptor versions */
88/* CVMX bootmem descriptor major version */
89#define CVMX_BOOTMEM_DESC_MAJ_VER 3
90
91/* CVMX bootmem descriptor minor version */
92#define CVMX_BOOTMEM_DESC_MIN_VER 0
93
94/* First three members of cvmx_bootmem_desc_t are left in original
95 * positions for backwards compatibility.
96 */
97struct cvmx_bootmem_desc {
98#if defined(__BIG_ENDIAN_BITFIELD) || defined(CVMX_BUILD_FOR_LINUX_HOST)
99 /* spinlock to control access to list */
100 uint32_t lock;
101 /* flags for indicating various conditions */
102 uint32_t flags;
103 uint64_t head_addr;
104
105 /* Incremented when incompatible changes made */
106 uint32_t major_version;
107
108 /*
109 * Incremented changed when compatible changes made, reset to
110 * zero when major incremented.
111 */
112 uint32_t minor_version;
113
114 uint64_t app_data_addr;
115 uint64_t app_data_size;
116
117 /* number of elements in named blocks array */
118 uint32_t named_block_num_blocks;
119
120 /* length of name array in bootmem blocks */
121 uint32_t named_block_name_len;
122 /* address of named memory block descriptors */
123 uint64_t named_block_array_addr;
124#else /* __LITTLE_ENDIAN */
125 uint32_t flags;
126 uint32_t lock;
127 uint64_t head_addr;
128
129 uint32_t minor_version;
130 uint32_t major_version;
131 uint64_t app_data_addr;
132 uint64_t app_data_size;
133
134 uint32_t named_block_name_len;
135 uint32_t named_block_num_blocks;
136 uint64_t named_block_array_addr;
137#endif
138};
139
140/**
141 * Initialize the boot alloc memory structures. This is
142 * normally called inside of cvmx_user_app_init()
143 *
144 * @mem_desc_ptr: Address of the free memory list
145 */
146extern int cvmx_bootmem_init(void *mem_desc_ptr);
147
148/**
149 * Allocate a block of memory from the free list that was
150 * passed to the application by the bootloader at a specific
151 * address. This is an allocate-only algorithm, so
152 * freeing memory is not possible. Allocation will fail if
153 * memory cannot be allocated at the specified address.
154 *
155 * @size: Size in bytes of block to allocate
156 * @address: Physical address to allocate memory at. If this memory is not
157 * available, the allocation fails.
158 * @alignment: Alignment required - must be power of 2
159 * Returns pointer to block of memory, NULL on error
160 */
161extern void *cvmx_bootmem_alloc_address(uint64_t size, uint64_t address,
162 uint64_t alignment);
163
164/**
165 * Frees a previously allocated named bootmem block.
166 *
167 * @name: name of block to free
168 *
169 * Returns 0 on failure,
170 * !0 on success
171 */
172
173
174/**
175 * Allocate a block of memory from the free list that was passed
176 * to the application by the bootloader, and assign it a name in the
177 * global named block table. (part of the cvmx_bootmem_descriptor_t structure)
178 * Named blocks can later be freed.
179 *
180 * @size: Size in bytes of block to allocate
181 * @alignment: Alignment required - must be power of 2
182 * @name: name of block - must be less than CVMX_BOOTMEM_NAME_LEN bytes
183 *
184 * Returns a pointer to block of memory, NULL on error
185 */
186extern void *cvmx_bootmem_alloc_named(uint64_t size, uint64_t alignment,
187 char *name);
188
189/**
190 * Allocate a block of memory from a specific range of the free list
191 * that was passed to the application by the bootloader, and assign it
192 * a name in the global named block table. (part of the
193 * cvmx_bootmem_descriptor_t structure) Named blocks can later be
194 * freed. If request cannot be satisfied within the address range
195 * specified, NULL is returned
196 *
197 * @size: Size in bytes of block to allocate
198 * @min_addr: minimum address of range
199 * @max_addr: maximum address of range
200 * @align: Alignment of memory to be allocated. (must be a power of 2)
201 * @name: name of block - must be less than CVMX_BOOTMEM_NAME_LEN bytes
202 *
203 * Returns a pointer to block of memory, NULL on error
204 */
205extern void *cvmx_bootmem_alloc_named_range(uint64_t size, uint64_t min_addr,
206 uint64_t max_addr, uint64_t align,
207 char *name);
208
209/**
210 * Allocate if needed a block of memory from a specific range of the
211 * free list that was passed to the application by the bootloader, and
212 * assign it a name in the global named block table. (part of the
213 * cvmx_bootmem_descriptor_t structure) Named blocks can later be
214 * freed. If the requested name block is already allocated, return
215 * the pointer to block of memory. If request cannot be satisfied
216 * within the address range specified, NULL is returned
217 *
218 * @param size Size in bytes of block to allocate
219 * @param min_addr minimum address of range
220 * @param max_addr maximum address of range
221 * @param align Alignment of memory to be allocated. (must be a power of 2)
222 * @param name name of block - must be less than CVMX_BOOTMEM_NAME_LEN bytes
223 * @param init Initialization function
224 *
225 * The initialization function is optional, if omitted the named block
226 * is initialized to all zeros when it is created, i.e. once.
227 *
228 * @return pointer to block of memory, NULL on error
229 */
230void *cvmx_bootmem_alloc_named_range_once(uint64_t size,
231 uint64_t min_addr,
232 uint64_t max_addr,
233 uint64_t align,
234 char *name,
235 void (*init) (void *));
236
237extern int cvmx_bootmem_free_named(char *name);
238
239/**
240 * Finds a named bootmem block by name.
241 *
242 * @name: name of block to free
243 *
244 * Returns pointer to named block descriptor on success
245 * 0 on failure
246 */
247struct cvmx_bootmem_named_block_desc *cvmx_bootmem_find_named_block(char *name);
248
249/**
250 * Allocates a block of physical memory from the free list, at
251 * (optional) requested address and alignment.
252 *
253 * @req_size: size of region to allocate. All requests are rounded up
254 * to be a multiple CVMX_BOOTMEM_ALIGNMENT_SIZE bytes size
255 *
256 * @address_min: Minimum address that block can occupy.
257 *
258 * @address_max: Specifies the maximum address_min (inclusive) that
259 * the allocation can use.
260 *
261 * @alignment: Requested alignment of the block. If this alignment
262 * cannot be met, the allocation fails. This must be a
263 * power of 2. (Note: Alignment of
264 * CVMX_BOOTMEM_ALIGNMENT_SIZE bytes is required, and
265 * internally enforced. Requested alignments of less than
266 * CVMX_BOOTMEM_ALIGNMENT_SIZE are set to
267 * CVMX_BOOTMEM_ALIGNMENT_SIZE.)
268 *
269 * @flags: Flags to control options for the allocation.
270 *
271 * Returns physical address of block allocated, or -1 on failure
272 */
273int64_t cvmx_bootmem_phy_alloc(uint64_t req_size, uint64_t address_min,
274 uint64_t address_max, uint64_t alignment,
275 uint32_t flags);
276
277/**
278 * Allocates a named block of physical memory from the free list, at
279 * (optional) requested address and alignment.
280 *
281 * @param size size of region to allocate. All requests are rounded
282 * up to be a multiple CVMX_BOOTMEM_ALIGNMENT_SIZE
283 * bytes size
284 * @param min_addr Minimum address that block can occupy.
285 * @param max_addr Specifies the maximum address_min (inclusive) that
286 * the allocation can use.
287 * @param alignment Requested alignment of the block. If this
288 * alignment cannot be met, the allocation fails.
289 * This must be a power of 2. (Note: Alignment of
290 * CVMX_BOOTMEM_ALIGNMENT_SIZE bytes is required, and
291 * internally enforced. Requested alignments of less
292 * than CVMX_BOOTMEM_ALIGNMENT_SIZE are set to
293 * CVMX_BOOTMEM_ALIGNMENT_SIZE.)
294 * @param name name to assign to named block
295 * @param flags Flags to control options for the allocation.
296 *
297 * @return physical address of block allocated, or -1 on failure
298 */
299int64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr,
300 uint64_t max_addr,
301 uint64_t alignment,
302 char *name, uint32_t flags);
303
304/**
305 * Frees a block to the bootmem allocator list. This must
306 * be used with care, as the size provided must match the size
307 * of the block that was allocated, or the list will become
308 * corrupted.
309 *
310 * IMPORTANT: This is only intended to be used as part of named block
311 * frees and initial population of the free memory list.
312 * *
313 *
314 * @phy_addr: physical address of block
315 * @size: size of block in bytes.
316 * @flags: flags for passing options
317 *
318 * Returns 1 on success,
319 * 0 on failure
320 */
321int __cvmx_bootmem_phy_free(uint64_t phy_addr, uint64_t size, uint32_t flags);
322
323/**
324 * Locks the bootmem allocator. This is useful in certain situations
325 * where multiple allocations must be made without being interrupted.
326 * This should be used with the CVMX_BOOTMEM_FLAG_NO_LOCKING flag.
327 *
328 */
329void cvmx_bootmem_lock(void);
330
331/**
332 * Unlocks the bootmem allocator. This is useful in certain situations
333 * where multiple allocations must be made without being interrupted.
334 * This should be used with the CVMX_BOOTMEM_FLAG_NO_LOCKING flag.
335 *
336 */
337void cvmx_bootmem_unlock(void);
338
339extern struct cvmx_bootmem_desc *cvmx_bootmem_get_desc(void);
340
341#endif /* __CVMX_BOOTMEM_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-ciu-defs.h b/arch/mips/include/asm/octeon/cvmx-ciu-defs.h
new file mode 100644
index 000000000..1d18be8cd
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-ciu-defs.h
@@ -0,0 +1,176 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Octeon CIU definitions
3 *
4 * Copyright (C) 2003-2018 Cavium, Inc.
5 */
6
7#ifndef __CVMX_CIU_DEFS_H__
8#define __CVMX_CIU_DEFS_H__
9
10#include <asm/bitfield.h>
11
12#define CVMX_CIU_ADDR(addr, coreid, coremask, offset) \
13 (CVMX_ADD_IO_SEG(0x0001070000000000ull + addr##ull) + \
14 (((coreid) & (coremask)) * offset))
15
16#define CVMX_CIU_EN2_PPX_IP4(c) CVMX_CIU_ADDR(0xA400, c, 0x0F, 8)
17#define CVMX_CIU_EN2_PPX_IP4_W1C(c) CVMX_CIU_ADDR(0xCC00, c, 0x0F, 8)
18#define CVMX_CIU_EN2_PPX_IP4_W1S(c) CVMX_CIU_ADDR(0xAC00, c, 0x0F, 8)
19#define CVMX_CIU_FUSE CVMX_CIU_ADDR(0x0728, 0, 0x00, 0)
20#define CVMX_CIU_INT_SUM1 CVMX_CIU_ADDR(0x0108, 0, 0x00, 0)
21#define CVMX_CIU_INTX_EN0(c) CVMX_CIU_ADDR(0x0200, c, 0x3F, 16)
22#define CVMX_CIU_INTX_EN0_W1C(c) CVMX_CIU_ADDR(0x2200, c, 0x3F, 16)
23#define CVMX_CIU_INTX_EN0_W1S(c) CVMX_CIU_ADDR(0x6200, c, 0x3F, 16)
24#define CVMX_CIU_INTX_EN1(c) CVMX_CIU_ADDR(0x0208, c, 0x3F, 16)
25#define CVMX_CIU_INTX_EN1_W1C(c) CVMX_CIU_ADDR(0x2208, c, 0x3F, 16)
26#define CVMX_CIU_INTX_EN1_W1S(c) CVMX_CIU_ADDR(0x6208, c, 0x3F, 16)
27#define CVMX_CIU_INTX_SUM0(c) CVMX_CIU_ADDR(0x0000, c, 0x3F, 8)
28#define CVMX_CIU_NMI CVMX_CIU_ADDR(0x0718, 0, 0x00, 0)
29#define CVMX_CIU_PCI_INTA CVMX_CIU_ADDR(0x0750, 0, 0x00, 0)
30#define CVMX_CIU_PP_BIST_STAT CVMX_CIU_ADDR(0x07E0, 0, 0x00, 0)
31#define CVMX_CIU_PP_DBG CVMX_CIU_ADDR(0x0708, 0, 0x00, 0)
32#define CVMX_CIU_PP_RST CVMX_CIU_ADDR(0x0700, 0, 0x00, 0)
33#define CVMX_CIU_QLM0 CVMX_CIU_ADDR(0x0780, 0, 0x00, 0)
34#define CVMX_CIU_QLM1 CVMX_CIU_ADDR(0x0788, 0, 0x00, 0)
35#define CVMX_CIU_QLM_JTGC CVMX_CIU_ADDR(0x0768, 0, 0x00, 0)
36#define CVMX_CIU_QLM_JTGD CVMX_CIU_ADDR(0x0770, 0, 0x00, 0)
37#define CVMX_CIU_SOFT_BIST CVMX_CIU_ADDR(0x0738, 0, 0x00, 0)
38#define CVMX_CIU_SOFT_PRST1 CVMX_CIU_ADDR(0x0758, 0, 0x00, 0)
39#define CVMX_CIU_SOFT_PRST CVMX_CIU_ADDR(0x0748, 0, 0x00, 0)
40#define CVMX_CIU_SOFT_RST CVMX_CIU_ADDR(0x0740, 0, 0x00, 0)
41#define CVMX_CIU_SUM2_PPX_IP4(c) CVMX_CIU_ADDR(0x8C00, c, 0x0F, 8)
42#define CVMX_CIU_TIM_MULTI_CAST CVMX_CIU_ADDR(0xC200, 0, 0x00, 0)
43#define CVMX_CIU_TIMX(c) CVMX_CIU_ADDR(0x0480, c, 0x0F, 8)
44
45static inline uint64_t CVMX_CIU_MBOX_CLRX(unsigned int coreid)
46{
47 if (cvmx_get_octeon_family() == (OCTEON_CN68XX & OCTEON_FAMILY_MASK))
48 return CVMX_CIU_ADDR(0x100100600, coreid, 0x0F, 8);
49 else
50 return CVMX_CIU_ADDR(0x000000680, coreid, 0x0F, 8);
51}
52
53static inline uint64_t CVMX_CIU_MBOX_SETX(unsigned int coreid)
54{
55 if (cvmx_get_octeon_family() == (OCTEON_CN68XX & OCTEON_FAMILY_MASK))
56 return CVMX_CIU_ADDR(0x100100400, coreid, 0x0F, 8);
57 else
58 return CVMX_CIU_ADDR(0x000000600, coreid, 0x0F, 8);
59}
60
61static inline uint64_t CVMX_CIU_PP_POKEX(unsigned int coreid)
62{
63 switch (cvmx_get_octeon_family()) {
64 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
65 return CVMX_CIU_ADDR(0x100100200, coreid, 0x0F, 8);
66 case OCTEON_CNF75XX & OCTEON_FAMILY_MASK:
67 case OCTEON_CN73XX & OCTEON_FAMILY_MASK:
68 case OCTEON_CN78XX & OCTEON_FAMILY_MASK:
69 return CVMX_CIU_ADDR(0x000030000, coreid, 0x0F, 8) -
70 0x60000000000ull;
71 default:
72 return CVMX_CIU_ADDR(0x000000580, coreid, 0x0F, 8);
73 }
74}
75
76static inline uint64_t CVMX_CIU_WDOGX(unsigned int coreid)
77{
78 switch (cvmx_get_octeon_family()) {
79 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
80 return CVMX_CIU_ADDR(0x100100000, coreid, 0x0F, 8);
81 case OCTEON_CNF75XX & OCTEON_FAMILY_MASK:
82 case OCTEON_CN73XX & OCTEON_FAMILY_MASK:
83 case OCTEON_CN78XX & OCTEON_FAMILY_MASK:
84 return CVMX_CIU_ADDR(0x000020000, coreid, 0x0F, 8) -
85 0x60000000000ull;
86 default:
87 return CVMX_CIU_ADDR(0x000000500, coreid, 0x0F, 8);
88 }
89}
90
91
92union cvmx_ciu_qlm {
93 uint64_t u64;
94 struct cvmx_ciu_qlm_s {
95 __BITFIELD_FIELD(uint64_t g2bypass:1,
96 __BITFIELD_FIELD(uint64_t reserved_53_62:10,
97 __BITFIELD_FIELD(uint64_t g2deemph:5,
98 __BITFIELD_FIELD(uint64_t reserved_45_47:3,
99 __BITFIELD_FIELD(uint64_t g2margin:5,
100 __BITFIELD_FIELD(uint64_t reserved_32_39:8,
101 __BITFIELD_FIELD(uint64_t txbypass:1,
102 __BITFIELD_FIELD(uint64_t reserved_21_30:10,
103 __BITFIELD_FIELD(uint64_t txdeemph:5,
104 __BITFIELD_FIELD(uint64_t reserved_13_15:3,
105 __BITFIELD_FIELD(uint64_t txmargin:5,
106 __BITFIELD_FIELD(uint64_t reserved_4_7:4,
107 __BITFIELD_FIELD(uint64_t lane_en:4,
108 ;)))))))))))))
109 } s;
110};
111
112union cvmx_ciu_qlm_jtgc {
113 uint64_t u64;
114 struct cvmx_ciu_qlm_jtgc_s {
115 __BITFIELD_FIELD(uint64_t reserved_17_63:47,
116 __BITFIELD_FIELD(uint64_t bypass_ext:1,
117 __BITFIELD_FIELD(uint64_t reserved_11_15:5,
118 __BITFIELD_FIELD(uint64_t clk_div:3,
119 __BITFIELD_FIELD(uint64_t reserved_7_7:1,
120 __BITFIELD_FIELD(uint64_t mux_sel:3,
121 __BITFIELD_FIELD(uint64_t bypass:4,
122 ;)))))))
123 } s;
124};
125
126union cvmx_ciu_qlm_jtgd {
127 uint64_t u64;
128 struct cvmx_ciu_qlm_jtgd_s {
129 __BITFIELD_FIELD(uint64_t capture:1,
130 __BITFIELD_FIELD(uint64_t shift:1,
131 __BITFIELD_FIELD(uint64_t update:1,
132 __BITFIELD_FIELD(uint64_t reserved_45_60:16,
133 __BITFIELD_FIELD(uint64_t select:5,
134 __BITFIELD_FIELD(uint64_t reserved_37_39:3,
135 __BITFIELD_FIELD(uint64_t shft_cnt:5,
136 __BITFIELD_FIELD(uint64_t shft_reg:32,
137 ;))))))))
138 } s;
139};
140
141union cvmx_ciu_soft_prst {
142 uint64_t u64;
143 struct cvmx_ciu_soft_prst_s {
144 __BITFIELD_FIELD(uint64_t reserved_3_63:61,
145 __BITFIELD_FIELD(uint64_t host64:1,
146 __BITFIELD_FIELD(uint64_t npi:1,
147 __BITFIELD_FIELD(uint64_t soft_prst:1,
148 ;))))
149 } s;
150};
151
152union cvmx_ciu_timx {
153 uint64_t u64;
154 struct cvmx_ciu_timx_s {
155 __BITFIELD_FIELD(uint64_t reserved_37_63:27,
156 __BITFIELD_FIELD(uint64_t one_shot:1,
157 __BITFIELD_FIELD(uint64_t len:36,
158 ;)))
159 } s;
160};
161
162union cvmx_ciu_wdogx {
163 uint64_t u64;
164 struct cvmx_ciu_wdogx_s {
165 __BITFIELD_FIELD(uint64_t reserved_46_63:18,
166 __BITFIELD_FIELD(uint64_t gstopen:1,
167 __BITFIELD_FIELD(uint64_t dstop:1,
168 __BITFIELD_FIELD(uint64_t cnt:24,
169 __BITFIELD_FIELD(uint64_t len:16,
170 __BITFIELD_FIELD(uint64_t state:2,
171 __BITFIELD_FIELD(uint64_t mode:2,
172 ;)))))))
173 } s;
174};
175
176#endif /* __CVMX_CIU_DEFS_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-ciu2-defs.h b/arch/mips/include/asm/octeon/cvmx-ciu2-defs.h
new file mode 100644
index 000000000..5babd88d4
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-ciu2-defs.h
@@ -0,0 +1,48 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_CIU2_DEFS_H__
29#define __CVMX_CIU2_DEFS_H__
30
31#define CVMX_CIU2_ACK_PPX_IP2(block_id) (CVMX_ADD_IO_SEG(0x00010701000C0000ull) + ((block_id) & 31) * 0x200000ull)
32#define CVMX_CIU2_ACK_PPX_IP3(block_id) (CVMX_ADD_IO_SEG(0x00010701000C0200ull) + ((block_id) & 31) * 0x200000ull)
33#define CVMX_CIU2_EN_PPX_IP2_RML(block_id) (CVMX_ADD_IO_SEG(0x0001070100092000ull) + ((block_id) & 31) * 0x200000ull)
34#define CVMX_CIU2_EN_PPX_IP2_WDOG(block_id) (CVMX_ADD_IO_SEG(0x0001070100091000ull) + ((block_id) & 31) * 0x200000ull)
35#define CVMX_CIU2_EN_PPX_IP2_WRKQ(block_id) (CVMX_ADD_IO_SEG(0x0001070100090000ull) + ((block_id) & 31) * 0x200000ull)
36#define CVMX_CIU2_EN_PPX_IP2_WRKQ_W1C(block_id) (CVMX_ADD_IO_SEG(0x00010701000B0000ull) + ((block_id) & 31) * 0x200000ull)
37#define CVMX_CIU2_EN_PPX_IP2_WRKQ_W1S(block_id) (CVMX_ADD_IO_SEG(0x00010701000A0000ull) + ((block_id) & 31) * 0x200000ull)
38#define CVMX_CIU2_EN_PPX_IP3_MBOX_W1C(block_id) (CVMX_ADD_IO_SEG(0x00010701000B8200ull) + ((block_id) & 31) * 0x200000ull)
39#define CVMX_CIU2_EN_PPX_IP3_MBOX_W1S(block_id) (CVMX_ADD_IO_SEG(0x00010701000A8200ull) + ((block_id) & 31) * 0x200000ull)
40#define CVMX_CIU2_INTR_CIU_READY (CVMX_ADD_IO_SEG(0x0001070100102008ull))
41#define CVMX_CIU2_RAW_PPX_IP2_WRKQ(block_id) (CVMX_ADD_IO_SEG(0x0001070100040000ull) + ((block_id) & 31) * 0x200000ull)
42#define CVMX_CIU2_SRC_PPX_IP2_RML(block_id) (CVMX_ADD_IO_SEG(0x0001070100082000ull) + ((block_id) & 31) * 0x200000ull)
43#define CVMX_CIU2_SRC_PPX_IP2_WDOG(block_id) (CVMX_ADD_IO_SEG(0x0001070100081000ull) + ((block_id) & 31) * 0x200000ull)
44#define CVMX_CIU2_SRC_PPX_IP2_WRKQ(block_id) (CVMX_ADD_IO_SEG(0x0001070100080000ull) + ((block_id) & 31) * 0x200000ull)
45#define CVMX_CIU2_SUM_PPX_IP2(offset) (CVMX_ADD_IO_SEG(0x0001070100000000ull) + ((offset) & 31) * 8)
46#define CVMX_CIU2_SUM_PPX_IP3(offset) (CVMX_ADD_IO_SEG(0x0001070100000200ull) + ((offset) & 31) * 8)
47
48#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-ciu3-defs.h b/arch/mips/include/asm/octeon/cvmx-ciu3-defs.h
new file mode 100644
index 000000000..547f778f5
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-ciu3-defs.h
@@ -0,0 +1,353 @@
1/*
2 * Copyright (c) 2003-2016 Cavium Inc.
3 *
4 * This file is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, Version 2, as
6 * published by the Free Software Foundation.
7 *
8 * This file is distributed in the hope that it will be useful, but
9 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
11 * NONINFRINGEMENT. See the GNU General Public License for more
12 * details.
13 *
14 */
15
16#ifndef __CVMX_CIU3_DEFS_H__
17#define __CVMX_CIU3_DEFS_H__
18
19#define CVMX_CIU3_FUSE CVMX_ADD_IO_SEG(0x00010100000001A0ull)
20#define CVMX_CIU3_BIST CVMX_ADD_IO_SEG(0x00010100000001C0ull)
21#define CVMX_CIU3_CONST CVMX_ADD_IO_SEG(0x0001010000000220ull)
22#define CVMX_CIU3_CTL CVMX_ADD_IO_SEG(0x00010100000000E0ull)
23#define CVMX_CIU3_DESTX_IO_INT(offset) (CVMX_ADD_IO_SEG(0x0001010000210000ull) + ((offset) & 7) * 8)
24#define CVMX_CIU3_DESTX_PP_INT(offset) (CVMX_ADD_IO_SEG(0x0001010000200000ull) + ((offset) & 255) * 8)
25#define CVMX_CIU3_GSTOP CVMX_ADD_IO_SEG(0x0001010000000140ull)
26#define CVMX_CIU3_IDTX_CTL(offset) (CVMX_ADD_IO_SEG(0x0001010000110000ull) + ((offset) & 255) * 8)
27#define CVMX_CIU3_IDTX_IO(offset) (CVMX_ADD_IO_SEG(0x0001010000130000ull) + ((offset) & 255) * 8)
28#define CVMX_CIU3_IDTX_PPX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001010000120000ull) + ((block_id) & 255) * 0x20ull)
29#define CVMX_CIU3_INTR_RAM_ECC_CTL CVMX_ADD_IO_SEG(0x0001010000000260ull)
30#define CVMX_CIU3_INTR_RAM_ECC_ST CVMX_ADD_IO_SEG(0x0001010000000280ull)
31#define CVMX_CIU3_INTR_READY CVMX_ADD_IO_SEG(0x00010100000002A0ull)
32#define CVMX_CIU3_INTR_SLOWDOWN CVMX_ADD_IO_SEG(0x0001010000000240ull)
33#define CVMX_CIU3_ISCX_CTL(offset) (CVMX_ADD_IO_SEG(0x0001010080000000ull) + ((offset) & 1048575) * 8)
34#define CVMX_CIU3_ISCX_W1C(offset) (CVMX_ADD_IO_SEG(0x0001010090000000ull) + ((offset) & 1048575) * 8)
35#define CVMX_CIU3_ISCX_W1S(offset) (CVMX_ADD_IO_SEG(0x00010100A0000000ull) + ((offset) & 1048575) * 8)
36#define CVMX_CIU3_NMI CVMX_ADD_IO_SEG(0x0001010000000160ull)
37#define CVMX_CIU3_SISCX(offset) (CVMX_ADD_IO_SEG(0x0001010000220000ull) + ((offset) & 255) * 8)
38#define CVMX_CIU3_TIMX(offset) (CVMX_ADD_IO_SEG(0x0001010000010000ull) + ((offset) & 15) * 8)
39
40union cvmx_ciu3_bist {
41 uint64_t u64;
42 struct cvmx_ciu3_bist_s {
43#ifdef __BIG_ENDIAN_BITFIELD
44 uint64_t reserved_9_63 : 55;
45 uint64_t bist : 9;
46#else
47 uint64_t bist : 9;
48 uint64_t reserved_9_63 : 55;
49#endif
50 } s;
51};
52
53union cvmx_ciu3_const {
54 uint64_t u64;
55 struct cvmx_ciu3_const_s {
56#ifdef __BIG_ENDIAN_BITFIELD
57 uint64_t dests_io : 16;
58 uint64_t pintsn : 16;
59 uint64_t dests_pp : 16;
60 uint64_t idt : 16;
61#else
62 uint64_t idt : 16;
63 uint64_t dests_pp : 16;
64 uint64_t pintsn : 16;
65 uint64_t dests_io : 16;
66#endif
67 } s;
68};
69
70union cvmx_ciu3_ctl {
71 uint64_t u64;
72 struct cvmx_ciu3_ctl_s {
73#ifdef __BIG_ENDIAN_BITFIELD
74 uint64_t reserved_5_63 : 59;
75 uint64_t mcd_sel : 2;
76 uint64_t iscmem_le : 1;
77 uint64_t seq_dis : 1;
78 uint64_t cclk_dis : 1;
79#else
80 uint64_t cclk_dis : 1;
81 uint64_t seq_dis : 1;
82 uint64_t iscmem_le : 1;
83 uint64_t mcd_sel : 2;
84 uint64_t reserved_5_63 : 59;
85#endif
86 } s;
87};
88
89union cvmx_ciu3_destx_io_int {
90 uint64_t u64;
91 struct cvmx_ciu3_destx_io_int_s {
92#ifdef __BIG_ENDIAN_BITFIELD
93 uint64_t reserved_52_63 : 12;
94 uint64_t intsn : 20;
95 uint64_t reserved_10_31 : 22;
96 uint64_t intidt : 8;
97 uint64_t newint : 1;
98 uint64_t intr : 1;
99#else
100 uint64_t intr : 1;
101 uint64_t newint : 1;
102 uint64_t intidt : 8;
103 uint64_t reserved_10_31 : 22;
104 uint64_t intsn : 20;
105 uint64_t reserved_52_63 : 12;
106#endif
107 } s;
108};
109
110union cvmx_ciu3_destx_pp_int {
111 uint64_t u64;
112 struct cvmx_ciu3_destx_pp_int_s {
113#ifdef __BIG_ENDIAN_BITFIELD
114 uint64_t reserved_52_63 : 12;
115 uint64_t intsn : 20;
116 uint64_t reserved_10_31 : 22;
117 uint64_t intidt : 8;
118 uint64_t newint : 1;
119 uint64_t intr : 1;
120#else
121 uint64_t intr : 1;
122 uint64_t newint : 1;
123 uint64_t intidt : 8;
124 uint64_t reserved_10_31 : 22;
125 uint64_t intsn : 20;
126 uint64_t reserved_52_63 : 12;
127#endif
128 } s;
129};
130
131union cvmx_ciu3_gstop {
132 uint64_t u64;
133 struct cvmx_ciu3_gstop_s {
134#ifdef __BIG_ENDIAN_BITFIELD
135 uint64_t reserved_1_63 : 63;
136 uint64_t gstop : 1;
137#else
138 uint64_t gstop : 1;
139 uint64_t reserved_1_63 : 63;
140#endif
141 } s;
142};
143
144union cvmx_ciu3_idtx_ctl {
145 uint64_t u64;
146 struct cvmx_ciu3_idtx_ctl_s {
147#ifdef __BIG_ENDIAN_BITFIELD
148 uint64_t reserved_52_63 : 12;
149 uint64_t intsn : 20;
150 uint64_t reserved_4_31 : 28;
151 uint64_t intr : 1;
152 uint64_t newint : 1;
153 uint64_t ip_num : 2;
154#else
155 uint64_t ip_num : 2;
156 uint64_t newint : 1;
157 uint64_t intr : 1;
158 uint64_t reserved_4_31 : 28;
159 uint64_t intsn : 20;
160 uint64_t reserved_52_63 : 12;
161#endif
162 } s;
163};
164
165union cvmx_ciu3_idtx_io {
166 uint64_t u64;
167 struct cvmx_ciu3_idtx_io_s {
168#ifdef __BIG_ENDIAN_BITFIELD
169 uint64_t reserved_5_63 : 59;
170 uint64_t io : 5;
171#else
172 uint64_t io : 5;
173 uint64_t reserved_5_63 : 59;
174#endif
175 } s;
176};
177
178union cvmx_ciu3_idtx_ppx {
179 uint64_t u64;
180 struct cvmx_ciu3_idtx_ppx_s {
181#ifdef __BIG_ENDIAN_BITFIELD
182 uint64_t reserved_48_63 : 16;
183 uint64_t pp : 48;
184#else
185 uint64_t pp : 48;
186 uint64_t reserved_48_63 : 16;
187#endif
188 } s;
189};
190
191union cvmx_ciu3_intr_ram_ecc_ctl {
192 uint64_t u64;
193 struct cvmx_ciu3_intr_ram_ecc_ctl_s {
194#ifdef __BIG_ENDIAN_BITFIELD
195 uint64_t reserved_3_63 : 61;
196 uint64_t flip_synd : 2;
197 uint64_t ecc_ena : 1;
198#else
199 uint64_t ecc_ena : 1;
200 uint64_t flip_synd : 2;
201 uint64_t reserved_3_63 : 61;
202#endif
203 } s;
204};
205
206union cvmx_ciu3_intr_ram_ecc_st {
207 uint64_t u64;
208 struct cvmx_ciu3_intr_ram_ecc_st_s {
209#ifdef __BIG_ENDIAN_BITFIELD
210 uint64_t reserved_52_63 : 12;
211 uint64_t addr : 20;
212 uint64_t reserved_6_31 : 26;
213 uint64_t sisc_dbe : 1;
214 uint64_t sisc_sbe : 1;
215 uint64_t idt_dbe : 1;
216 uint64_t idt_sbe : 1;
217 uint64_t isc_dbe : 1;
218 uint64_t isc_sbe : 1;
219#else
220 uint64_t isc_sbe : 1;
221 uint64_t isc_dbe : 1;
222 uint64_t idt_sbe : 1;
223 uint64_t idt_dbe : 1;
224 uint64_t sisc_sbe : 1;
225 uint64_t sisc_dbe : 1;
226 uint64_t reserved_6_31 : 26;
227 uint64_t addr : 20;
228 uint64_t reserved_52_63 : 12;
229#endif
230 } s;
231};
232
233union cvmx_ciu3_intr_ready {
234 uint64_t u64;
235 struct cvmx_ciu3_intr_ready_s {
236#ifdef __BIG_ENDIAN_BITFIELD
237 uint64_t reserved_46_63 : 18;
238 uint64_t index : 14;
239 uint64_t reserved_1_31 : 31;
240 uint64_t ready : 1;
241#else
242 uint64_t ready : 1;
243 uint64_t reserved_1_31 : 31;
244 uint64_t index : 14;
245 uint64_t reserved_46_63 : 18;
246#endif
247 } s;
248};
249
250union cvmx_ciu3_intr_slowdown {
251 uint64_t u64;
252 struct cvmx_ciu3_intr_slowdown_s {
253#ifdef __BIG_ENDIAN_BITFIELD
254 uint64_t reserved_3_63 : 61;
255 uint64_t ctl : 3;
256#else
257 uint64_t ctl : 3;
258 uint64_t reserved_3_63 : 61;
259#endif
260 } s;
261};
262
263union cvmx_ciu3_iscx_ctl {
264 uint64_t u64;
265 struct cvmx_ciu3_iscx_ctl_s {
266#ifdef __BIG_ENDIAN_BITFIELD
267 uint64_t reserved_24_63 : 40;
268 uint64_t idt : 8;
269 uint64_t imp : 1;
270 uint64_t reserved_2_14 : 13;
271 uint64_t en : 1;
272 uint64_t raw : 1;
273#else
274 uint64_t raw : 1;
275 uint64_t en : 1;
276 uint64_t reserved_2_14 : 13;
277 uint64_t imp : 1;
278 uint64_t idt : 8;
279 uint64_t reserved_24_63 : 40;
280#endif
281 } s;
282};
283
284union cvmx_ciu3_iscx_w1c {
285 uint64_t u64;
286 struct cvmx_ciu3_iscx_w1c_s {
287#ifdef __BIG_ENDIAN_BITFIELD
288 uint64_t reserved_2_63 : 62;
289 uint64_t en : 1;
290 uint64_t raw : 1;
291#else
292 uint64_t raw : 1;
293 uint64_t en : 1;
294 uint64_t reserved_2_63 : 62;
295#endif
296 } s;
297};
298
299union cvmx_ciu3_iscx_w1s {
300 uint64_t u64;
301 struct cvmx_ciu3_iscx_w1s_s {
302#ifdef __BIG_ENDIAN_BITFIELD
303 uint64_t reserved_2_63 : 62;
304 uint64_t en : 1;
305 uint64_t raw : 1;
306#else
307 uint64_t raw : 1;
308 uint64_t en : 1;
309 uint64_t reserved_2_63 : 62;
310#endif
311 } s;
312};
313
314union cvmx_ciu3_nmi {
315 uint64_t u64;
316 struct cvmx_ciu3_nmi_s {
317#ifdef __BIG_ENDIAN_BITFIELD
318 uint64_t reserved_48_63 : 16;
319 uint64_t nmi : 48;
320#else
321 uint64_t nmi : 48;
322 uint64_t reserved_48_63 : 16;
323#endif
324 } s;
325};
326
327union cvmx_ciu3_siscx {
328 uint64_t u64;
329 struct cvmx_ciu3_siscx_s {
330#ifdef __BIG_ENDIAN_BITFIELD
331 uint64_t en : 64;
332#else
333 uint64_t en : 64;
334#endif
335 } s;
336};
337
338union cvmx_ciu3_timx {
339 uint64_t u64;
340 struct cvmx_ciu3_timx_s {
341#ifdef __BIG_ENDIAN_BITFIELD
342 uint64_t reserved_37_63 : 27;
343 uint64_t one_shot : 1;
344 uint64_t len : 36;
345#else
346 uint64_t len : 36;
347 uint64_t one_shot : 1;
348 uint64_t reserved_37_63 : 27;
349#endif
350 } s;
351};
352
353#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-cmd-queue.h b/arch/mips/include/asm/octeon/cvmx-cmd-queue.h
new file mode 100644
index 000000000..a07a36f7d
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-cmd-queue.h
@@ -0,0 +1,619 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 *
30 * Support functions for managing command queues used for
31 * various hardware blocks.
32 *
33 * The common command queue infrastructure abstracts out the
34 * software necessary for adding to Octeon's chained queue
35 * structures. These structures are used for commands to the
36 * PKO, ZIP, DFA, RAID, and DMA engine blocks. Although each
37 * hardware unit takes commands and CSRs of different types,
38 * they all use basic linked command buffers to store the
39 * pending request. In general, users of the CVMX API don't
40 * call cvmx-cmd-queue functions directly. Instead the hardware
41 * unit specific wrapper should be used. The wrappers perform
42 * unit specific validation and CSR writes to submit the
43 * commands.
44 *
45 * Even though most software will never directly interact with
46 * cvmx-cmd-queue, knowledge of its internal working can help
47 * in diagnosing performance problems and help with debugging.
48 *
49 * Command queue pointers are stored in a global named block
50 * called "cvmx_cmd_queues". Except for the PKO queues, each
51 * hardware queue is stored in its own cache line to reduce SMP
52 * contention on spin locks. The PKO queues are stored such that
53 * every 16th queue is next to each other in memory. This scheme
54 * allows for queues being in separate cache lines when there
55 * are low number of queues per port. With 16 queues per port,
56 * the first queue for each port is in the same cache area. The
57 * second queues for each port are in another area, etc. This
58 * allows software to implement very efficient lockless PKO with
59 * 16 queues per port using a minimum of cache lines per core.
60 * All queues for a given core will be isolated in the same
61 * cache area.
62 *
63 * In addition to the memory pointer layout, cvmx-cmd-queue
64 * provides an optimized fair ll/sc locking mechanism for the
65 * queues. The lock uses a "ticket / now serving" model to
66 * maintain fair order on contended locks. In addition, it uses
67 * predicted locking time to limit cache contention. When a core
68 * know it must wait in line for a lock, it spins on the
69 * internal cycle counter to completely eliminate any causes of
70 * bus traffic.
71 *
72 */
73
74#ifndef __CVMX_CMD_QUEUE_H__
75#define __CVMX_CMD_QUEUE_H__
76
77#include <linux/prefetch.h>
78
79#include <asm/compiler.h>
80
81#include <asm/octeon/cvmx-fpa.h>
82/**
83 * By default we disable the max depth support. Most programs
84 * don't use it and it slows down the command queue processing
85 * significantly.
86 */
87#ifndef CVMX_CMD_QUEUE_ENABLE_MAX_DEPTH
88#define CVMX_CMD_QUEUE_ENABLE_MAX_DEPTH 0
89#endif
90
91/**
92 * Enumeration representing all hardware blocks that use command
93 * queues. Each hardware block has up to 65536 sub identifiers for
94 * multiple command queues. Not all chips support all hardware
95 * units.
96 */
97typedef enum {
98 CVMX_CMD_QUEUE_PKO_BASE = 0x00000,
99
100#define CVMX_CMD_QUEUE_PKO(queue) \
101 ((cvmx_cmd_queue_id_t)(CVMX_CMD_QUEUE_PKO_BASE + (0xffff&(queue))))
102
103 CVMX_CMD_QUEUE_ZIP = 0x10000,
104 CVMX_CMD_QUEUE_DFA = 0x20000,
105 CVMX_CMD_QUEUE_RAID = 0x30000,
106 CVMX_CMD_QUEUE_DMA_BASE = 0x40000,
107
108#define CVMX_CMD_QUEUE_DMA(queue) \
109 ((cvmx_cmd_queue_id_t)(CVMX_CMD_QUEUE_DMA_BASE + (0xffff&(queue))))
110
111 CVMX_CMD_QUEUE_END = 0x50000,
112} cvmx_cmd_queue_id_t;
113
114/**
115 * Command write operations can fail if the command queue needs
116 * a new buffer and the associated FPA pool is empty. It can also
117 * fail if the number of queued command words reaches the maximum
118 * set at initialization.
119 */
120typedef enum {
121 CVMX_CMD_QUEUE_SUCCESS = 0,
122 CVMX_CMD_QUEUE_NO_MEMORY = -1,
123 CVMX_CMD_QUEUE_FULL = -2,
124 CVMX_CMD_QUEUE_INVALID_PARAM = -3,
125 CVMX_CMD_QUEUE_ALREADY_SETUP = -4,
126} cvmx_cmd_queue_result_t;
127
128typedef struct {
129 /* You have lock when this is your ticket */
130 uint8_t now_serving;
131 uint64_t unused1:24;
132 /* Maximum outstanding command words */
133 uint32_t max_depth;
134 /* FPA pool buffers come from */
135 uint64_t fpa_pool:3;
136 /* Top of command buffer pointer shifted 7 */
137 uint64_t base_ptr_div128:29;
138 uint64_t unused2:6;
139 /* FPA buffer size in 64bit words minus 1 */
140 uint64_t pool_size_m1:13;
141 /* Number of commands already used in buffer */
142 uint64_t index:13;
143} __cvmx_cmd_queue_state_t;
144
145/**
146 * This structure contains the global state of all command queues.
147 * It is stored in a bootmem named block and shared by all
148 * applications running on Octeon. Tickets are stored in a differnet
149 * cache line that queue information to reduce the contention on the
150 * ll/sc used to get a ticket. If this is not the case, the update
151 * of queue state causes the ll/sc to fail quite often.
152 */
153typedef struct {
154 uint64_t ticket[(CVMX_CMD_QUEUE_END >> 16) * 256];
155 __cvmx_cmd_queue_state_t state[(CVMX_CMD_QUEUE_END >> 16) * 256];
156} __cvmx_cmd_queue_all_state_t;
157
158/**
159 * Initialize a command queue for use. The initial FPA buffer is
160 * allocated and the hardware unit is configured to point to the
161 * new command queue.
162 *
163 * @queue_id: Hardware command queue to initialize.
164 * @max_depth: Maximum outstanding commands that can be queued.
165 * @fpa_pool: FPA pool the command queues should come from.
166 * @pool_size: Size of each buffer in the FPA pool (bytes)
167 *
168 * Returns CVMX_CMD_QUEUE_SUCCESS or a failure code
169 */
170cvmx_cmd_queue_result_t cvmx_cmd_queue_initialize(cvmx_cmd_queue_id_t queue_id,
171 int max_depth, int fpa_pool,
172 int pool_size);
173
174/**
175 * Shutdown a queue a free it's command buffers to the FPA. The
176 * hardware connected to the queue must be stopped before this
177 * function is called.
178 *
179 * @queue_id: Queue to shutdown
180 *
181 * Returns CVMX_CMD_QUEUE_SUCCESS or a failure code
182 */
183cvmx_cmd_queue_result_t cvmx_cmd_queue_shutdown(cvmx_cmd_queue_id_t queue_id);
184
185/**
186 * Return the number of command words pending in the queue. This
187 * function may be relatively slow for some hardware units.
188 *
189 * @queue_id: Hardware command queue to query
190 *
191 * Returns Number of outstanding commands
192 */
193int cvmx_cmd_queue_length(cvmx_cmd_queue_id_t queue_id);
194
195/**
196 * Return the command buffer to be written to. The purpose of this
197 * function is to allow CVMX routine access t othe low level buffer
198 * for initial hardware setup. User applications should not call this
199 * function directly.
200 *
201 * @queue_id: Command queue to query
202 *
203 * Returns Command buffer or NULL on failure
204 */
205void *cvmx_cmd_queue_buffer(cvmx_cmd_queue_id_t queue_id);
206
207/**
208 * Get the index into the state arrays for the supplied queue id.
209 *
210 * @queue_id: Queue ID to get an index for
211 *
212 * Returns Index into the state arrays
213 */
214static inline int __cvmx_cmd_queue_get_index(cvmx_cmd_queue_id_t queue_id)
215{
216 /*
217 * Warning: This code currently only works with devices that
218 * have 256 queues or less. Devices with more than 16 queues
219 * are laid out in memory to allow cores quick access to
220 * every 16th queue. This reduces cache thrashing when you are
221 * running 16 queues per port to support lockless operation.
222 */
223 int unit = queue_id >> 16;
224 int q = (queue_id >> 4) & 0xf;
225 int core = queue_id & 0xf;
226 return unit * 256 + core * 16 + q;
227}
228
229/**
230 * Lock the supplied queue so nobody else is updating it at the same
231 * time as us.
232 *
233 * @queue_id: Queue ID to lock
234 * @qptr: Pointer to the queue's global state
235 */
236static inline void __cvmx_cmd_queue_lock(cvmx_cmd_queue_id_t queue_id,
237 __cvmx_cmd_queue_state_t *qptr)
238{
239 extern __cvmx_cmd_queue_all_state_t
240 *__cvmx_cmd_queue_state_ptr;
241 int tmp;
242 int my_ticket;
243 prefetch(qptr);
244 asm volatile (
245 ".set push\n"
246 ".set noreorder\n"
247 "1:\n"
248 /* Atomic add one to ticket_ptr */
249 "ll %[my_ticket], %[ticket_ptr]\n"
250 /* and store the original value */
251 "li %[ticket], 1\n"
252 /* in my_ticket */
253 "baddu %[ticket], %[my_ticket]\n"
254 "sc %[ticket], %[ticket_ptr]\n"
255 "beqz %[ticket], 1b\n"
256 " nop\n"
257 /* Load the current now_serving ticket */
258 "lbu %[ticket], %[now_serving]\n"
259 "2:\n"
260 /* Jump out if now_serving == my_ticket */
261 "beq %[ticket], %[my_ticket], 4f\n"
262 /* Find out how many tickets are in front of me */
263 " subu %[ticket], %[my_ticket], %[ticket]\n"
264 /* Use tickets in front of me minus one to delay */
265 "subu %[ticket], 1\n"
266 /* Delay will be ((tickets in front)-1)*32 loops */
267 "cins %[ticket], %[ticket], 5, 7\n"
268 "3:\n"
269 /* Loop here until our ticket might be up */
270 "bnez %[ticket], 3b\n"
271 " subu %[ticket], 1\n"
272 /* Jump back up to check out ticket again */
273 "b 2b\n"
274 /* Load the current now_serving ticket */
275 " lbu %[ticket], %[now_serving]\n"
276 "4:\n"
277 ".set pop\n" :
278 [ticket_ptr] "=" GCC_OFF_SMALL_ASM()(__cvmx_cmd_queue_state_ptr->ticket[__cvmx_cmd_queue_get_index(queue_id)]),
279 [now_serving] "=m"(qptr->now_serving), [ticket] "=r"(tmp),
280 [my_ticket] "=r"(my_ticket)
281 );
282}
283
284/**
285 * Unlock the queue, flushing all writes.
286 *
287 * @qptr: Queue to unlock
288 */
289static inline void __cvmx_cmd_queue_unlock(__cvmx_cmd_queue_state_t *qptr)
290{
291 qptr->now_serving++;
292 CVMX_SYNCWS;
293}
294
295/**
296 * Get the queue state structure for the given queue id
297 *
298 * @queue_id: Queue id to get
299 *
300 * Returns Queue structure or NULL on failure
301 */
302static inline __cvmx_cmd_queue_state_t
303 *__cvmx_cmd_queue_get_state(cvmx_cmd_queue_id_t queue_id)
304{
305 extern __cvmx_cmd_queue_all_state_t
306 *__cvmx_cmd_queue_state_ptr;
307 return &__cvmx_cmd_queue_state_ptr->
308 state[__cvmx_cmd_queue_get_index(queue_id)];
309}
310
311/**
312 * Write an arbitrary number of command words to a command queue.
313 * This is a generic function; the fixed number of command word
314 * functions yield higher performance.
315 *
316 * @queue_id: Hardware command queue to write to
317 * @use_locking:
318 * Use internal locking to ensure exclusive access for queue
319 * updates. If you don't use this locking you must ensure
320 * exclusivity some other way. Locking is strongly recommended.
321 * @cmd_count: Number of command words to write
322 * @cmds: Array of commands to write
323 *
324 * Returns CVMX_CMD_QUEUE_SUCCESS or a failure code
325 */
326static inline cvmx_cmd_queue_result_t cvmx_cmd_queue_write(cvmx_cmd_queue_id_t
327 queue_id,
328 int use_locking,
329 int cmd_count,
330 uint64_t *cmds)
331{
332 __cvmx_cmd_queue_state_t *qptr = __cvmx_cmd_queue_get_state(queue_id);
333
334 /* Make sure nobody else is updating the same queue */
335 if (likely(use_locking))
336 __cvmx_cmd_queue_lock(queue_id, qptr);
337
338 /*
339 * If a max queue length was specified then make sure we don't
340 * exceed it. If any part of the command would be below the
341 * limit we allow it.
342 */
343 if (CVMX_CMD_QUEUE_ENABLE_MAX_DEPTH && unlikely(qptr->max_depth)) {
344 if (unlikely
345 (cvmx_cmd_queue_length(queue_id) > (int)qptr->max_depth)) {
346 if (likely(use_locking))
347 __cvmx_cmd_queue_unlock(qptr);
348 return CVMX_CMD_QUEUE_FULL;
349 }
350 }
351
352 /*
353 * Normally there is plenty of room in the current buffer for
354 * the command.
355 */
356 if (likely(qptr->index + cmd_count < qptr->pool_size_m1)) {
357 uint64_t *ptr =
358 (uint64_t *) cvmx_phys_to_ptr((uint64_t) qptr->
359 base_ptr_div128 << 7);
360 ptr += qptr->index;
361 qptr->index += cmd_count;
362 while (cmd_count--)
363 *ptr++ = *cmds++;
364 } else {
365 uint64_t *ptr;
366 int count;
367 /*
368 * We need a new command buffer. Fail if there isn't
369 * one available.
370 */
371 uint64_t *new_buffer =
372 (uint64_t *) cvmx_fpa_alloc(qptr->fpa_pool);
373 if (unlikely(new_buffer == NULL)) {
374 if (likely(use_locking))
375 __cvmx_cmd_queue_unlock(qptr);
376 return CVMX_CMD_QUEUE_NO_MEMORY;
377 }
378 ptr =
379 (uint64_t *) cvmx_phys_to_ptr((uint64_t) qptr->
380 base_ptr_div128 << 7);
381 /*
382 * Figure out how many command words will fit in this
383 * buffer. One location will be needed for the next
384 * buffer pointer.
385 */
386 count = qptr->pool_size_m1 - qptr->index;
387 ptr += qptr->index;
388 cmd_count -= count;
389 while (count--)
390 *ptr++ = *cmds++;
391 *ptr = cvmx_ptr_to_phys(new_buffer);
392 /*
393 * The current buffer is full and has a link to the
394 * next buffer. Time to write the rest of the commands
395 * into the new buffer.
396 */
397 qptr->base_ptr_div128 = *ptr >> 7;
398 qptr->index = cmd_count;
399 ptr = new_buffer;
400 while (cmd_count--)
401 *ptr++ = *cmds++;
402 }
403
404 /* All updates are complete. Release the lock and return */
405 if (likely(use_locking))
406 __cvmx_cmd_queue_unlock(qptr);
407 return CVMX_CMD_QUEUE_SUCCESS;
408}
409
410/**
411 * Simple function to write two command words to a command
412 * queue.
413 *
414 * @queue_id: Hardware command queue to write to
415 * @use_locking:
416 * Use internal locking to ensure exclusive access for queue
417 * updates. If you don't use this locking you must ensure
418 * exclusivity some other way. Locking is strongly recommended.
419 * @cmd1: Command
420 * @cmd2: Command
421 *
422 * Returns CVMX_CMD_QUEUE_SUCCESS or a failure code
423 */
424static inline cvmx_cmd_queue_result_t cvmx_cmd_queue_write2(cvmx_cmd_queue_id_t
425 queue_id,
426 int use_locking,
427 uint64_t cmd1,
428 uint64_t cmd2)
429{
430 __cvmx_cmd_queue_state_t *qptr = __cvmx_cmd_queue_get_state(queue_id);
431
432 /* Make sure nobody else is updating the same queue */
433 if (likely(use_locking))
434 __cvmx_cmd_queue_lock(queue_id, qptr);
435
436 /*
437 * If a max queue length was specified then make sure we don't
438 * exceed it. If any part of the command would be below the
439 * limit we allow it.
440 */
441 if (CVMX_CMD_QUEUE_ENABLE_MAX_DEPTH && unlikely(qptr->max_depth)) {
442 if (unlikely
443 (cvmx_cmd_queue_length(queue_id) > (int)qptr->max_depth)) {
444 if (likely(use_locking))
445 __cvmx_cmd_queue_unlock(qptr);
446 return CVMX_CMD_QUEUE_FULL;
447 }
448 }
449
450 /*
451 * Normally there is plenty of room in the current buffer for
452 * the command.
453 */
454 if (likely(qptr->index + 2 < qptr->pool_size_m1)) {
455 uint64_t *ptr =
456 (uint64_t *) cvmx_phys_to_ptr((uint64_t) qptr->
457 base_ptr_div128 << 7);
458 ptr += qptr->index;
459 qptr->index += 2;
460 ptr[0] = cmd1;
461 ptr[1] = cmd2;
462 } else {
463 uint64_t *ptr;
464 /*
465 * Figure out how many command words will fit in this
466 * buffer. One location will be needed for the next
467 * buffer pointer.
468 */
469 int count = qptr->pool_size_m1 - qptr->index;
470 /*
471 * We need a new command buffer. Fail if there isn't
472 * one available.
473 */
474 uint64_t *new_buffer =
475 (uint64_t *) cvmx_fpa_alloc(qptr->fpa_pool);
476 if (unlikely(new_buffer == NULL)) {
477 if (likely(use_locking))
478 __cvmx_cmd_queue_unlock(qptr);
479 return CVMX_CMD_QUEUE_NO_MEMORY;
480 }
481 count--;
482 ptr =
483 (uint64_t *) cvmx_phys_to_ptr((uint64_t) qptr->
484 base_ptr_div128 << 7);
485 ptr += qptr->index;
486 *ptr++ = cmd1;
487 if (likely(count))
488 *ptr++ = cmd2;
489 *ptr = cvmx_ptr_to_phys(new_buffer);
490 /*
491 * The current buffer is full and has a link to the
492 * next buffer. Time to write the rest of the commands
493 * into the new buffer.
494 */
495 qptr->base_ptr_div128 = *ptr >> 7;
496 qptr->index = 0;
497 if (unlikely(count == 0)) {
498 qptr->index = 1;
499 new_buffer[0] = cmd2;
500 }
501 }
502
503 /* All updates are complete. Release the lock and return */
504 if (likely(use_locking))
505 __cvmx_cmd_queue_unlock(qptr);
506 return CVMX_CMD_QUEUE_SUCCESS;
507}
508
509/**
510 * Simple function to write three command words to a command
511 * queue.
512 *
513 * @queue_id: Hardware command queue to write to
514 * @use_locking:
515 * Use internal locking to ensure exclusive access for queue
516 * updates. If you don't use this locking you must ensure
517 * exclusivity some other way. Locking is strongly recommended.
518 * @cmd1: Command
519 * @cmd2: Command
520 * @cmd3: Command
521 *
522 * Returns CVMX_CMD_QUEUE_SUCCESS or a failure code
523 */
524static inline cvmx_cmd_queue_result_t cvmx_cmd_queue_write3(cvmx_cmd_queue_id_t
525 queue_id,
526 int use_locking,
527 uint64_t cmd1,
528 uint64_t cmd2,
529 uint64_t cmd3)
530{
531 __cvmx_cmd_queue_state_t *qptr = __cvmx_cmd_queue_get_state(queue_id);
532
533 /* Make sure nobody else is updating the same queue */
534 if (likely(use_locking))
535 __cvmx_cmd_queue_lock(queue_id, qptr);
536
537 /*
538 * If a max queue length was specified then make sure we don't
539 * exceed it. If any part of the command would be below the
540 * limit we allow it.
541 */
542 if (CVMX_CMD_QUEUE_ENABLE_MAX_DEPTH && unlikely(qptr->max_depth)) {
543 if (unlikely
544 (cvmx_cmd_queue_length(queue_id) > (int)qptr->max_depth)) {
545 if (likely(use_locking))
546 __cvmx_cmd_queue_unlock(qptr);
547 return CVMX_CMD_QUEUE_FULL;
548 }
549 }
550
551 /*
552 * Normally there is plenty of room in the current buffer for
553 * the command.
554 */
555 if (likely(qptr->index + 3 < qptr->pool_size_m1)) {
556 uint64_t *ptr =
557 (uint64_t *) cvmx_phys_to_ptr((uint64_t) qptr->
558 base_ptr_div128 << 7);
559 ptr += qptr->index;
560 qptr->index += 3;
561 ptr[0] = cmd1;
562 ptr[1] = cmd2;
563 ptr[2] = cmd3;
564 } else {
565 uint64_t *ptr;
566 /*
567 * Figure out how many command words will fit in this
568 * buffer. One location will be needed for the next
569 * buffer pointer
570 */
571 int count = qptr->pool_size_m1 - qptr->index;
572 /*
573 * We need a new command buffer. Fail if there isn't
574 * one available
575 */
576 uint64_t *new_buffer =
577 (uint64_t *) cvmx_fpa_alloc(qptr->fpa_pool);
578 if (unlikely(new_buffer == NULL)) {
579 if (likely(use_locking))
580 __cvmx_cmd_queue_unlock(qptr);
581 return CVMX_CMD_QUEUE_NO_MEMORY;
582 }
583 count--;
584 ptr =
585 (uint64_t *) cvmx_phys_to_ptr((uint64_t) qptr->
586 base_ptr_div128 << 7);
587 ptr += qptr->index;
588 *ptr++ = cmd1;
589 if (count) {
590 *ptr++ = cmd2;
591 if (count > 1)
592 *ptr++ = cmd3;
593 }
594 *ptr = cvmx_ptr_to_phys(new_buffer);
595 /*
596 * The current buffer is full and has a link to the
597 * next buffer. Time to write the rest of the commands
598 * into the new buffer.
599 */
600 qptr->base_ptr_div128 = *ptr >> 7;
601 qptr->index = 0;
602 ptr = new_buffer;
603 if (count == 0) {
604 *ptr++ = cmd2;
605 qptr->index++;
606 }
607 if (count < 2) {
608 *ptr++ = cmd3;
609 qptr->index++;
610 }
611 }
612
613 /* All updates are complete. Release the lock and return */
614 if (likely(use_locking))
615 __cvmx_cmd_queue_unlock(qptr);
616 return CVMX_CMD_QUEUE_SUCCESS;
617}
618
619#endif /* __CVMX_CMD_QUEUE_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-config.h b/arch/mips/include/asm/octeon/cvmx-config.h
new file mode 100644
index 000000000..a8c358c02
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-config.h
@@ -0,0 +1,169 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __CVMX_CONFIG_H__
3#define __CVMX_CONFIG_H__
4
5/************************* Config Specific Defines ************************/
6#define CVMX_LLM_NUM_PORTS 1
7#define CVMX_NULL_POINTER_PROTECT 1
8#define CVMX_ENABLE_DEBUG_PRINTS 1
9/* PKO queues per port for interface 0 (ports 0-15) */
10#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 1
11/* PKO queues per port for interface 1 (ports 16-31) */
12#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 1
13/* Limit on the number of PKO ports enabled for interface 0 */
14#define CVMX_PKO_MAX_PORTS_INTERFACE0 CVMX_HELPER_PKO_MAX_PORTS_INTERFACE0
15/* Limit on the number of PKO ports enabled for interface 1 */
16#define CVMX_PKO_MAX_PORTS_INTERFACE1 CVMX_HELPER_PKO_MAX_PORTS_INTERFACE1
17/* PKO queues per port for PCI (ports 32-35) */
18#define CVMX_PKO_QUEUES_PER_PORT_PCI 1
19/* PKO queues per port for Loop devices (ports 36-39) */
20#define CVMX_PKO_QUEUES_PER_PORT_LOOP 1
21
22/************************* FPA allocation *********************************/
23/* Pool sizes in bytes, must be multiple of a cache line */
24#define CVMX_FPA_POOL_0_SIZE (16 * CVMX_CACHE_LINE_SIZE)
25#define CVMX_FPA_POOL_1_SIZE (1 * CVMX_CACHE_LINE_SIZE)
26#define CVMX_FPA_POOL_2_SIZE (8 * CVMX_CACHE_LINE_SIZE)
27#define CVMX_FPA_POOL_3_SIZE (0 * CVMX_CACHE_LINE_SIZE)
28#define CVMX_FPA_POOL_4_SIZE (0 * CVMX_CACHE_LINE_SIZE)
29#define CVMX_FPA_POOL_5_SIZE (0 * CVMX_CACHE_LINE_SIZE)
30#define CVMX_FPA_POOL_6_SIZE (0 * CVMX_CACHE_LINE_SIZE)
31#define CVMX_FPA_POOL_7_SIZE (0 * CVMX_CACHE_LINE_SIZE)
32
33/* Pools in use */
34/* Packet buffers */
35#define CVMX_FPA_PACKET_POOL (0)
36#define CVMX_FPA_PACKET_POOL_SIZE CVMX_FPA_POOL_0_SIZE
37/* Work queue entries */
38#define CVMX_FPA_WQE_POOL (1)
39#define CVMX_FPA_WQE_POOL_SIZE CVMX_FPA_POOL_1_SIZE
40/* PKO queue command buffers */
41#define CVMX_FPA_OUTPUT_BUFFER_POOL (2)
42#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE CVMX_FPA_POOL_2_SIZE
43
44/************************* FAU allocation ********************************/
45/* The fetch and add registers are allocated here. They are arranged
46 * in order of descending size so that all alignment constraints are
47 * automatically met. The enums are linked so that the following enum
48 * continues allocating where the previous one left off, so the
49 * numbering within each enum always starts with zero. The macros
50 * take care of the address increment size, so the values entered
51 * always increase by 1. FAU registers are accessed with byte
52 * addresses.
53 */
54
55#define CVMX_FAU_REG_64_ADDR(x) ((x << 3) + CVMX_FAU_REG_64_START)
56typedef enum {
57 CVMX_FAU_REG_64_START = 0,
58 CVMX_FAU_REG_64_END = CVMX_FAU_REG_64_ADDR(0),
59} cvmx_fau_reg_64_t;
60
61#define CVMX_FAU_REG_32_ADDR(x) ((x << 2) + CVMX_FAU_REG_32_START)
62typedef enum {
63 CVMX_FAU_REG_32_START = CVMX_FAU_REG_64_END,
64 CVMX_FAU_REG_32_END = CVMX_FAU_REG_32_ADDR(0),
65} cvmx_fau_reg_32_t;
66
67#define CVMX_FAU_REG_16_ADDR(x) ((x << 1) + CVMX_FAU_REG_16_START)
68typedef enum {
69 CVMX_FAU_REG_16_START = CVMX_FAU_REG_32_END,
70 CVMX_FAU_REG_16_END = CVMX_FAU_REG_16_ADDR(0),
71} cvmx_fau_reg_16_t;
72
73#define CVMX_FAU_REG_8_ADDR(x) ((x) + CVMX_FAU_REG_8_START)
74typedef enum {
75 CVMX_FAU_REG_8_START = CVMX_FAU_REG_16_END,
76 CVMX_FAU_REG_8_END = CVMX_FAU_REG_8_ADDR(0),
77} cvmx_fau_reg_8_t;
78
79/*
80 * The name CVMX_FAU_REG_AVAIL_BASE is provided to indicate the first
81 * available FAU address that is not allocated in cvmx-config.h. This
82 * is 64 bit aligned.
83 */
84#define CVMX_FAU_REG_AVAIL_BASE ((CVMX_FAU_REG_8_END + 0x7) & (~0x7ULL))
85#define CVMX_FAU_REG_END (2048)
86
87/********************** scratch memory allocation *************************/
88/* Scratchpad memory allocation. Note that these are byte memory
89 * addresses. Some uses of scratchpad (IOBDMA for example) require
90 * the use of 8-byte aligned addresses, so proper alignment needs to
91 * be taken into account.
92 */
93/* Generic scratch iobdma area */
94#define CVMX_SCR_SCRATCH (0)
95/* First location available after cvmx-config.h allocated region. */
96#define CVMX_SCR_REG_AVAIL_BASE (8)
97
98/*
99 * CVMX_HELPER_FIRST_MBUFF_SKIP is the number of bytes to reserve
100 * before the beginning of the packet. If necessary, override the
101 * default here. See the IPD section of the hardware manual for MBUFF
102 * SKIP details.
103 */
104#define CVMX_HELPER_FIRST_MBUFF_SKIP 184
105
106/*
107 * CVMX_HELPER_NOT_FIRST_MBUFF_SKIP is the number of bytes to reserve
108 * in each chained packet element. If necessary, override the default
109 * here.
110 */
111#define CVMX_HELPER_NOT_FIRST_MBUFF_SKIP 0
112
113/*
114 * CVMX_HELPER_ENABLE_BACK_PRESSURE controls whether back pressure is
115 * enabled for all input ports. This controls if IPD sends
116 * backpressure to all ports if Octeon's FPA pools don't have enough
117 * packet or work queue entries. Even when this is off, it is still
118 * possible to get backpressure from individual hardware ports. When
119 * configuring backpressure, also check
120 * CVMX_HELPER_DISABLE_*_BACKPRESSURE below. If necessary, override
121 * the default here.
122 */
123#define CVMX_HELPER_ENABLE_BACK_PRESSURE 1
124
125/*
126 * CVMX_HELPER_ENABLE_IPD controls if the IPD is enabled in the helper
127 * function. Once it is enabled the hardware starts accepting
128 * packets. You might want to skip the IPD enable if configuration
129 * changes are need from the default helper setup. If necessary,
130 * override the default here.
131 */
132#define CVMX_HELPER_ENABLE_IPD 0
133
134/*
135 * CVMX_HELPER_INPUT_TAG_TYPE selects the type of tag that the IPD assigns
136 * to incoming packets.
137 */
138#define CVMX_HELPER_INPUT_TAG_TYPE CVMX_POW_TAG_TYPE_ORDERED
139
140#define CVMX_ENABLE_PARAMETER_CHECKING 0
141
142/*
143 * The following select which fields are used by the PIP to generate
144 * the tag on INPUT
145 * 0: don't include
146 * 1: include
147 */
148#define CVMX_HELPER_INPUT_TAG_IPV6_SRC_IP 0
149#define CVMX_HELPER_INPUT_TAG_IPV6_DST_IP 0
150#define CVMX_HELPER_INPUT_TAG_IPV6_SRC_PORT 0
151#define CVMX_HELPER_INPUT_TAG_IPV6_DST_PORT 0
152#define CVMX_HELPER_INPUT_TAG_IPV6_NEXT_HEADER 0
153#define CVMX_HELPER_INPUT_TAG_IPV4_SRC_IP 0
154#define CVMX_HELPER_INPUT_TAG_IPV4_DST_IP 0
155#define CVMX_HELPER_INPUT_TAG_IPV4_SRC_PORT 0
156#define CVMX_HELPER_INPUT_TAG_IPV4_DST_PORT 0
157#define CVMX_HELPER_INPUT_TAG_IPV4_PROTOCOL 0
158#define CVMX_HELPER_INPUT_TAG_INPUT_PORT 1
159
160/* Select skip mode for input ports */
161#define CVMX_HELPER_INPUT_PORT_SKIP_MODE CVMX_PIP_PORT_CFG_MODE_SKIPL2
162
163/*
164 * Force backpressure to be disabled. This overrides all other
165 * backpressure configuration.
166 */
167#define CVMX_HELPER_DISABLE_RGMII_BACKPRESSURE 0
168
169#endif /* __CVMX_CONFIG_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-coremask.h b/arch/mips/include/asm/octeon/cvmx-coremask.h
new file mode 100644
index 000000000..097dc096d
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-coremask.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 * Copyright (c) 2016 Cavium Inc. (support@cavium.com).
7 *
8 */
9
10/*
11 * Module to support operations on bitmap of cores. Coremask can be used to
12 * select a specific core, a group of cores, or all available cores, for
13 * initialization and differentiation of roles within a single shared binary
14 * executable image.
15 *
16 * The core numbers used in this file are the same value as what is found in
17 * the COP0_EBASE register and the rdhwr 0 instruction.
18 *
19 * For the CN78XX and other multi-node environments the core numbers are not
20 * contiguous. The core numbers for the CN78XX are as follows:
21 *
22 * Node 0: Cores 0 - 47
23 * Node 1: Cores 128 - 175
24 * Node 2: Cores 256 - 303
25 * Node 3: Cores 384 - 431
26 *
27 */
28
29#ifndef __CVMX_COREMASK_H__
30#define __CVMX_COREMASK_H__
31
32#define CVMX_MIPS_MAX_CORES 1024
33/* bits per holder */
34#define CVMX_COREMASK_ELTSZ 64
35
36/* cvmx_coremask_t's size in u64 */
37#define CVMX_COREMASK_BMPSZ (CVMX_MIPS_MAX_CORES / CVMX_COREMASK_ELTSZ)
38
39
40/* cvmx_coremask_t */
41struct cvmx_coremask {
42 u64 coremask_bitmap[CVMX_COREMASK_BMPSZ];
43};
44
45/*
46 * Is ``core'' set in the coremask?
47 */
48static inline bool cvmx_coremask_is_core_set(const struct cvmx_coremask *pcm,
49 int core)
50{
51 int n, i;
52
53 n = core % CVMX_COREMASK_ELTSZ;
54 i = core / CVMX_COREMASK_ELTSZ;
55
56 return (pcm->coremask_bitmap[i] & ((u64)1 << n)) != 0;
57}
58
59/*
60 * Make a copy of a coremask
61 */
62static inline void cvmx_coremask_copy(struct cvmx_coremask *dest,
63 const struct cvmx_coremask *src)
64{
65 memcpy(dest, src, sizeof(*dest));
66}
67
68/*
69 * Set the lower 64-bit of the coremask.
70 */
71static inline void cvmx_coremask_set64(struct cvmx_coremask *pcm,
72 uint64_t coremask_64)
73{
74 pcm->coremask_bitmap[0] = coremask_64;
75}
76
77/*
78 * Clear ``core'' from the coremask.
79 */
80static inline void cvmx_coremask_clear_core(struct cvmx_coremask *pcm, int core)
81{
82 int n, i;
83
84 n = core % CVMX_COREMASK_ELTSZ;
85 i = core / CVMX_COREMASK_ELTSZ;
86 pcm->coremask_bitmap[i] &= ~(1ull << n);
87}
88
89#endif /* __CVMX_COREMASK_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-dbg-defs.h b/arch/mips/include/asm/octeon/cvmx-dbg-defs.h
new file mode 100644
index 000000000..828d07d87
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-dbg-defs.h
@@ -0,0 +1,101 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_DBG_DEFS_H__
29#define __CVMX_DBG_DEFS_H__
30
31#define CVMX_DBG_DATA (CVMX_ADD_IO_SEG(0x00011F00000001E8ull))
32
33union cvmx_dbg_data {
34 uint64_t u64;
35 struct cvmx_dbg_data_s {
36#ifdef __BIG_ENDIAN_BITFIELD
37 uint64_t reserved_23_63:41;
38 uint64_t c_mul:5;
39 uint64_t dsel_ext:1;
40 uint64_t data:17;
41#else
42 uint64_t data:17;
43 uint64_t dsel_ext:1;
44 uint64_t c_mul:5;
45 uint64_t reserved_23_63:41;
46#endif
47 } s;
48 struct cvmx_dbg_data_cn30xx {
49#ifdef __BIG_ENDIAN_BITFIELD
50 uint64_t reserved_31_63:33;
51 uint64_t pll_mul:3;
52 uint64_t reserved_23_27:5;
53 uint64_t c_mul:5;
54 uint64_t dsel_ext:1;
55 uint64_t data:17;
56#else
57 uint64_t data:17;
58 uint64_t dsel_ext:1;
59 uint64_t c_mul:5;
60 uint64_t reserved_23_27:5;
61 uint64_t pll_mul:3;
62 uint64_t reserved_31_63:33;
63#endif
64 } cn30xx;
65 struct cvmx_dbg_data_cn38xx {
66#ifdef __BIG_ENDIAN_BITFIELD
67 uint64_t reserved_29_63:35;
68 uint64_t d_mul:4;
69 uint64_t dclk_mul2:1;
70 uint64_t cclk_div2:1;
71 uint64_t c_mul:5;
72 uint64_t dsel_ext:1;
73 uint64_t data:17;
74#else
75 uint64_t data:17;
76 uint64_t dsel_ext:1;
77 uint64_t c_mul:5;
78 uint64_t cclk_div2:1;
79 uint64_t dclk_mul2:1;
80 uint64_t d_mul:4;
81 uint64_t reserved_29_63:35;
82#endif
83 } cn38xx;
84 struct cvmx_dbg_data_cn58xx {
85#ifdef __BIG_ENDIAN_BITFIELD
86 uint64_t reserved_29_63:35;
87 uint64_t rem:6;
88 uint64_t c_mul:5;
89 uint64_t dsel_ext:1;
90 uint64_t data:17;
91#else
92 uint64_t data:17;
93 uint64_t dsel_ext:1;
94 uint64_t c_mul:5;
95 uint64_t rem:6;
96 uint64_t reserved_29_63:35;
97#endif
98 } cn58xx;
99};
100
101#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-dpi-defs.h b/arch/mips/include/asm/octeon/cvmx-dpi-defs.h
new file mode 100644
index 000000000..e8613e1f6
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-dpi-defs.h
@@ -0,0 +1,874 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_DPI_DEFS_H__
29#define __CVMX_DPI_DEFS_H__
30
31#define CVMX_DPI_BIST_STATUS (CVMX_ADD_IO_SEG(0x0001DF0000000000ull))
32#define CVMX_DPI_CTL (CVMX_ADD_IO_SEG(0x0001DF0000000040ull))
33#define CVMX_DPI_DMAX_COUNTS(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000300ull) + ((offset) & 7) * 8)
34#define CVMX_DPI_DMAX_DBELL(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000200ull) + ((offset) & 7) * 8)
35#define CVMX_DPI_DMAX_ERR_RSP_STATUS(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000A80ull) + ((offset) & 7) * 8)
36#define CVMX_DPI_DMAX_IBUFF_SADDR(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000280ull) + ((offset) & 7) * 8)
37#define CVMX_DPI_DMAX_IFLIGHT(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000A00ull) + ((offset) & 7) * 8)
38#define CVMX_DPI_DMAX_NADDR(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000380ull) + ((offset) & 7) * 8)
39#define CVMX_DPI_DMAX_REQBNK0(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000400ull) + ((offset) & 7) * 8)
40#define CVMX_DPI_DMAX_REQBNK1(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000480ull) + ((offset) & 7) * 8)
41#define CVMX_DPI_DMA_CONTROL (CVMX_ADD_IO_SEG(0x0001DF0000000048ull))
42#define CVMX_DPI_DMA_ENGX_EN(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000080ull) + ((offset) & 7) * 8)
43#define CVMX_DPI_DMA_PPX_CNT(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000B00ull) + ((offset) & 31) * 8)
44#define CVMX_DPI_ENGX_BUF(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000880ull) + ((offset) & 7) * 8)
45#define CVMX_DPI_INFO_REG (CVMX_ADD_IO_SEG(0x0001DF0000000980ull))
46#define CVMX_DPI_INT_EN (CVMX_ADD_IO_SEG(0x0001DF0000000010ull))
47#define CVMX_DPI_INT_REG (CVMX_ADD_IO_SEG(0x0001DF0000000008ull))
48#define CVMX_DPI_NCBX_CFG(block_id) (CVMX_ADD_IO_SEG(0x0001DF0000000800ull))
49#define CVMX_DPI_PINT_INFO (CVMX_ADD_IO_SEG(0x0001DF0000000830ull))
50#define CVMX_DPI_PKT_ERR_RSP (CVMX_ADD_IO_SEG(0x0001DF0000000078ull))
51#define CVMX_DPI_REQ_ERR_RSP (CVMX_ADD_IO_SEG(0x0001DF0000000058ull))
52#define CVMX_DPI_REQ_ERR_RSP_EN (CVMX_ADD_IO_SEG(0x0001DF0000000068ull))
53#define CVMX_DPI_REQ_ERR_RST (CVMX_ADD_IO_SEG(0x0001DF0000000060ull))
54#define CVMX_DPI_REQ_ERR_RST_EN (CVMX_ADD_IO_SEG(0x0001DF0000000070ull))
55#define CVMX_DPI_REQ_ERR_SKIP_COMP (CVMX_ADD_IO_SEG(0x0001DF0000000838ull))
56#define CVMX_DPI_REQ_GBL_EN (CVMX_ADD_IO_SEG(0x0001DF0000000050ull))
57#define CVMX_DPI_SLI_PRTX_CFG(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000900ull) + ((offset) & 3) * 8)
58static inline uint64_t CVMX_DPI_SLI_PRTX_ERR(unsigned long offset)
59{
60 switch (cvmx_get_octeon_family()) {
61 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
62 return CVMX_ADD_IO_SEG(0x0001DF0000000920ull) + (offset) * 8;
63 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
64 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
65 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
66
67 if (OCTEON_IS_MODEL(OCTEON_CN68XX_PASS1))
68 return CVMX_ADD_IO_SEG(0x0001DF0000000928ull) + (offset) * 8;
69
70 if (OCTEON_IS_MODEL(OCTEON_CN68XX_PASS2))
71 return CVMX_ADD_IO_SEG(0x0001DF0000000920ull) + (offset) * 8;
72 return CVMX_ADD_IO_SEG(0x0001DF0000000920ull) + (offset) * 8;
73 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
74 return CVMX_ADD_IO_SEG(0x0001DF0000000928ull) + (offset) * 8;
75 }
76 return CVMX_ADD_IO_SEG(0x0001DF0000000920ull) + (offset) * 8;
77}
78
79#define CVMX_DPI_SLI_PRTX_ERR_INFO(offset) (CVMX_ADD_IO_SEG(0x0001DF0000000940ull) + ((offset) & 3) * 8)
80
81union cvmx_dpi_bist_status {
82 uint64_t u64;
83 struct cvmx_dpi_bist_status_s {
84#ifdef __BIG_ENDIAN_BITFIELD
85 uint64_t reserved_47_63:17;
86 uint64_t bist:47;
87#else
88 uint64_t bist:47;
89 uint64_t reserved_47_63:17;
90#endif
91 } s;
92 struct cvmx_dpi_bist_status_cn63xx {
93#ifdef __BIG_ENDIAN_BITFIELD
94 uint64_t reserved_45_63:19;
95 uint64_t bist:45;
96#else
97 uint64_t bist:45;
98 uint64_t reserved_45_63:19;
99#endif
100 } cn63xx;
101 struct cvmx_dpi_bist_status_cn63xxp1 {
102#ifdef __BIG_ENDIAN_BITFIELD
103 uint64_t reserved_37_63:27;
104 uint64_t bist:37;
105#else
106 uint64_t bist:37;
107 uint64_t reserved_37_63:27;
108#endif
109 } cn63xxp1;
110};
111
112union cvmx_dpi_ctl {
113 uint64_t u64;
114 struct cvmx_dpi_ctl_s {
115#ifdef __BIG_ENDIAN_BITFIELD
116 uint64_t reserved_2_63:62;
117 uint64_t clk:1;
118 uint64_t en:1;
119#else
120 uint64_t en:1;
121 uint64_t clk:1;
122 uint64_t reserved_2_63:62;
123#endif
124 } s;
125 struct cvmx_dpi_ctl_cn61xx {
126#ifdef __BIG_ENDIAN_BITFIELD
127 uint64_t reserved_1_63:63;
128 uint64_t en:1;
129#else
130 uint64_t en:1;
131 uint64_t reserved_1_63:63;
132#endif
133 } cn61xx;
134};
135
136union cvmx_dpi_dmax_counts {
137 uint64_t u64;
138 struct cvmx_dpi_dmax_counts_s {
139#ifdef __BIG_ENDIAN_BITFIELD
140 uint64_t reserved_39_63:25;
141 uint64_t fcnt:7;
142 uint64_t dbell:32;
143#else
144 uint64_t dbell:32;
145 uint64_t fcnt:7;
146 uint64_t reserved_39_63:25;
147#endif
148 } s;
149};
150
151union cvmx_dpi_dmax_dbell {
152 uint64_t u64;
153 struct cvmx_dpi_dmax_dbell_s {
154#ifdef __BIG_ENDIAN_BITFIELD
155 uint64_t reserved_16_63:48;
156 uint64_t dbell:16;
157#else
158 uint64_t dbell:16;
159 uint64_t reserved_16_63:48;
160#endif
161 } s;
162};
163
164union cvmx_dpi_dmax_err_rsp_status {
165 uint64_t u64;
166 struct cvmx_dpi_dmax_err_rsp_status_s {
167#ifdef __BIG_ENDIAN_BITFIELD
168 uint64_t reserved_6_63:58;
169 uint64_t status:6;
170#else
171 uint64_t status:6;
172 uint64_t reserved_6_63:58;
173#endif
174 } s;
175};
176
177union cvmx_dpi_dmax_ibuff_saddr {
178 uint64_t u64;
179 struct cvmx_dpi_dmax_ibuff_saddr_s {
180#ifdef __BIG_ENDIAN_BITFIELD
181 uint64_t reserved_62_63:2;
182 uint64_t csize:14;
183 uint64_t reserved_41_47:7;
184 uint64_t idle:1;
185 uint64_t saddr:33;
186 uint64_t reserved_0_6:7;
187#else
188 uint64_t reserved_0_6:7;
189 uint64_t saddr:33;
190 uint64_t idle:1;
191 uint64_t reserved_41_47:7;
192 uint64_t csize:14;
193 uint64_t reserved_62_63:2;
194#endif
195 } s;
196 struct cvmx_dpi_dmax_ibuff_saddr_cn61xx {
197#ifdef __BIG_ENDIAN_BITFIELD
198 uint64_t reserved_62_63:2;
199 uint64_t csize:14;
200 uint64_t reserved_41_47:7;
201 uint64_t idle:1;
202 uint64_t reserved_36_39:4;
203 uint64_t saddr:29;
204 uint64_t reserved_0_6:7;
205#else
206 uint64_t reserved_0_6:7;
207 uint64_t saddr:29;
208 uint64_t reserved_36_39:4;
209 uint64_t idle:1;
210 uint64_t reserved_41_47:7;
211 uint64_t csize:14;
212 uint64_t reserved_62_63:2;
213#endif
214 } cn61xx;
215};
216
217union cvmx_dpi_dmax_iflight {
218 uint64_t u64;
219 struct cvmx_dpi_dmax_iflight_s {
220#ifdef __BIG_ENDIAN_BITFIELD
221 uint64_t reserved_3_63:61;
222 uint64_t cnt:3;
223#else
224 uint64_t cnt:3;
225 uint64_t reserved_3_63:61;
226#endif
227 } s;
228};
229
230union cvmx_dpi_dmax_naddr {
231 uint64_t u64;
232 struct cvmx_dpi_dmax_naddr_s {
233#ifdef __BIG_ENDIAN_BITFIELD
234 uint64_t reserved_40_63:24;
235 uint64_t addr:40;
236#else
237 uint64_t addr:40;
238 uint64_t reserved_40_63:24;
239#endif
240 } s;
241 struct cvmx_dpi_dmax_naddr_cn61xx {
242#ifdef __BIG_ENDIAN_BITFIELD
243 uint64_t reserved_36_63:28;
244 uint64_t addr:36;
245#else
246 uint64_t addr:36;
247 uint64_t reserved_36_63:28;
248#endif
249 } cn61xx;
250};
251
252union cvmx_dpi_dmax_reqbnk0 {
253 uint64_t u64;
254 struct cvmx_dpi_dmax_reqbnk0_s {
255#ifdef __BIG_ENDIAN_BITFIELD
256 uint64_t state:64;
257#else
258 uint64_t state:64;
259#endif
260 } s;
261};
262
263union cvmx_dpi_dmax_reqbnk1 {
264 uint64_t u64;
265 struct cvmx_dpi_dmax_reqbnk1_s {
266#ifdef __BIG_ENDIAN_BITFIELD
267 uint64_t state:64;
268#else
269 uint64_t state:64;
270#endif
271 } s;
272};
273
274union cvmx_dpi_dma_control {
275 uint64_t u64;
276 struct cvmx_dpi_dma_control_s {
277#ifdef __BIG_ENDIAN_BITFIELD
278 uint64_t reserved_62_63:2;
279 uint64_t dici_mode:1;
280 uint64_t pkt_en1:1;
281 uint64_t ffp_dis:1;
282 uint64_t commit_mode:1;
283 uint64_t pkt_hp:1;
284 uint64_t pkt_en:1;
285 uint64_t reserved_54_55:2;
286 uint64_t dma_enb:6;
287 uint64_t reserved_34_47:14;
288 uint64_t b0_lend:1;
289 uint64_t dwb_denb:1;
290 uint64_t dwb_ichk:9;
291 uint64_t fpa_que:3;
292 uint64_t o_add1:1;
293 uint64_t o_ro:1;
294 uint64_t o_ns:1;
295 uint64_t o_es:2;
296 uint64_t o_mode:1;
297 uint64_t reserved_0_13:14;
298#else
299 uint64_t reserved_0_13:14;
300 uint64_t o_mode:1;
301 uint64_t o_es:2;
302 uint64_t o_ns:1;
303 uint64_t o_ro:1;
304 uint64_t o_add1:1;
305 uint64_t fpa_que:3;
306 uint64_t dwb_ichk:9;
307 uint64_t dwb_denb:1;
308 uint64_t b0_lend:1;
309 uint64_t reserved_34_47:14;
310 uint64_t dma_enb:6;
311 uint64_t reserved_54_55:2;
312 uint64_t pkt_en:1;
313 uint64_t pkt_hp:1;
314 uint64_t commit_mode:1;
315 uint64_t ffp_dis:1;
316 uint64_t pkt_en1:1;
317 uint64_t dici_mode:1;
318 uint64_t reserved_62_63:2;
319#endif
320 } s;
321 struct cvmx_dpi_dma_control_cn63xx {
322#ifdef __BIG_ENDIAN_BITFIELD
323 uint64_t reserved_61_63:3;
324 uint64_t pkt_en1:1;
325 uint64_t ffp_dis:1;
326 uint64_t commit_mode:1;
327 uint64_t pkt_hp:1;
328 uint64_t pkt_en:1;
329 uint64_t reserved_54_55:2;
330 uint64_t dma_enb:6;
331 uint64_t reserved_34_47:14;
332 uint64_t b0_lend:1;
333 uint64_t dwb_denb:1;
334 uint64_t dwb_ichk:9;
335 uint64_t fpa_que:3;
336 uint64_t o_add1:1;
337 uint64_t o_ro:1;
338 uint64_t o_ns:1;
339 uint64_t o_es:2;
340 uint64_t o_mode:1;
341 uint64_t reserved_0_13:14;
342#else
343 uint64_t reserved_0_13:14;
344 uint64_t o_mode:1;
345 uint64_t o_es:2;
346 uint64_t o_ns:1;
347 uint64_t o_ro:1;
348 uint64_t o_add1:1;
349 uint64_t fpa_que:3;
350 uint64_t dwb_ichk:9;
351 uint64_t dwb_denb:1;
352 uint64_t b0_lend:1;
353 uint64_t reserved_34_47:14;
354 uint64_t dma_enb:6;
355 uint64_t reserved_54_55:2;
356 uint64_t pkt_en:1;
357 uint64_t pkt_hp:1;
358 uint64_t commit_mode:1;
359 uint64_t ffp_dis:1;
360 uint64_t pkt_en1:1;
361 uint64_t reserved_61_63:3;
362#endif
363 } cn63xx;
364 struct cvmx_dpi_dma_control_cn63xxp1 {
365#ifdef __BIG_ENDIAN_BITFIELD
366 uint64_t reserved_59_63:5;
367 uint64_t commit_mode:1;
368 uint64_t pkt_hp:1;
369 uint64_t pkt_en:1;
370 uint64_t reserved_54_55:2;
371 uint64_t dma_enb:6;
372 uint64_t reserved_34_47:14;
373 uint64_t b0_lend:1;
374 uint64_t dwb_denb:1;
375 uint64_t dwb_ichk:9;
376 uint64_t fpa_que:3;
377 uint64_t o_add1:1;
378 uint64_t o_ro:1;
379 uint64_t o_ns:1;
380 uint64_t o_es:2;
381 uint64_t o_mode:1;
382 uint64_t reserved_0_13:14;
383#else
384 uint64_t reserved_0_13:14;
385 uint64_t o_mode:1;
386 uint64_t o_es:2;
387 uint64_t o_ns:1;
388 uint64_t o_ro:1;
389 uint64_t o_add1:1;
390 uint64_t fpa_que:3;
391 uint64_t dwb_ichk:9;
392 uint64_t dwb_denb:1;
393 uint64_t b0_lend:1;
394 uint64_t reserved_34_47:14;
395 uint64_t dma_enb:6;
396 uint64_t reserved_54_55:2;
397 uint64_t pkt_en:1;
398 uint64_t pkt_hp:1;
399 uint64_t commit_mode:1;
400 uint64_t reserved_59_63:5;
401#endif
402 } cn63xxp1;
403};
404
405union cvmx_dpi_dma_engx_en {
406 uint64_t u64;
407 struct cvmx_dpi_dma_engx_en_s {
408#ifdef __BIG_ENDIAN_BITFIELD
409 uint64_t reserved_8_63:56;
410 uint64_t qen:8;
411#else
412 uint64_t qen:8;
413 uint64_t reserved_8_63:56;
414#endif
415 } s;
416};
417
418union cvmx_dpi_dma_ppx_cnt {
419 uint64_t u64;
420 struct cvmx_dpi_dma_ppx_cnt_s {
421#ifdef __BIG_ENDIAN_BITFIELD
422 uint64_t reserved_16_63:48;
423 uint64_t cnt:16;
424#else
425 uint64_t cnt:16;
426 uint64_t reserved_16_63:48;
427#endif
428 } s;
429};
430
431union cvmx_dpi_engx_buf {
432 uint64_t u64;
433 struct cvmx_dpi_engx_buf_s {
434#ifdef __BIG_ENDIAN_BITFIELD
435 uint64_t reserved_37_63:27;
436 uint64_t compblks:5;
437 uint64_t reserved_9_31:23;
438 uint64_t base:5;
439 uint64_t blks:4;
440#else
441 uint64_t blks:4;
442 uint64_t base:5;
443 uint64_t reserved_9_31:23;
444 uint64_t compblks:5;
445 uint64_t reserved_37_63:27;
446#endif
447 } s;
448 struct cvmx_dpi_engx_buf_cn63xx {
449#ifdef __BIG_ENDIAN_BITFIELD
450 uint64_t reserved_8_63:56;
451 uint64_t base:4;
452 uint64_t blks:4;
453#else
454 uint64_t blks:4;
455 uint64_t base:4;
456 uint64_t reserved_8_63:56;
457#endif
458 } cn63xx;
459};
460
461union cvmx_dpi_info_reg {
462 uint64_t u64;
463 struct cvmx_dpi_info_reg_s {
464#ifdef __BIG_ENDIAN_BITFIELD
465 uint64_t reserved_8_63:56;
466 uint64_t ffp:4;
467 uint64_t reserved_2_3:2;
468 uint64_t ncb:1;
469 uint64_t rsl:1;
470#else
471 uint64_t rsl:1;
472 uint64_t ncb:1;
473 uint64_t reserved_2_3:2;
474 uint64_t ffp:4;
475 uint64_t reserved_8_63:56;
476#endif
477 } s;
478 struct cvmx_dpi_info_reg_cn63xxp1 {
479#ifdef __BIG_ENDIAN_BITFIELD
480 uint64_t reserved_2_63:62;
481 uint64_t ncb:1;
482 uint64_t rsl:1;
483#else
484 uint64_t rsl:1;
485 uint64_t ncb:1;
486 uint64_t reserved_2_63:62;
487#endif
488 } cn63xxp1;
489};
490
491union cvmx_dpi_int_en {
492 uint64_t u64;
493 struct cvmx_dpi_int_en_s {
494#ifdef __BIG_ENDIAN_BITFIELD
495 uint64_t reserved_28_63:36;
496 uint64_t sprt3_rst:1;
497 uint64_t sprt2_rst:1;
498 uint64_t sprt1_rst:1;
499 uint64_t sprt0_rst:1;
500 uint64_t reserved_23_23:1;
501 uint64_t req_badfil:1;
502 uint64_t req_inull:1;
503 uint64_t req_anull:1;
504 uint64_t req_undflw:1;
505 uint64_t req_ovrflw:1;
506 uint64_t req_badlen:1;
507 uint64_t req_badadr:1;
508 uint64_t dmadbo:8;
509 uint64_t reserved_2_7:6;
510 uint64_t nfovr:1;
511 uint64_t nderr:1;
512#else
513 uint64_t nderr:1;
514 uint64_t nfovr:1;
515 uint64_t reserved_2_7:6;
516 uint64_t dmadbo:8;
517 uint64_t req_badadr:1;
518 uint64_t req_badlen:1;
519 uint64_t req_ovrflw:1;
520 uint64_t req_undflw:1;
521 uint64_t req_anull:1;
522 uint64_t req_inull:1;
523 uint64_t req_badfil:1;
524 uint64_t reserved_23_23:1;
525 uint64_t sprt0_rst:1;
526 uint64_t sprt1_rst:1;
527 uint64_t sprt2_rst:1;
528 uint64_t sprt3_rst:1;
529 uint64_t reserved_28_63:36;
530#endif
531 } s;
532 struct cvmx_dpi_int_en_cn63xx {
533#ifdef __BIG_ENDIAN_BITFIELD
534 uint64_t reserved_26_63:38;
535 uint64_t sprt1_rst:1;
536 uint64_t sprt0_rst:1;
537 uint64_t reserved_23_23:1;
538 uint64_t req_badfil:1;
539 uint64_t req_inull:1;
540 uint64_t req_anull:1;
541 uint64_t req_undflw:1;
542 uint64_t req_ovrflw:1;
543 uint64_t req_badlen:1;
544 uint64_t req_badadr:1;
545 uint64_t dmadbo:8;
546 uint64_t reserved_2_7:6;
547 uint64_t nfovr:1;
548 uint64_t nderr:1;
549#else
550 uint64_t nderr:1;
551 uint64_t nfovr:1;
552 uint64_t reserved_2_7:6;
553 uint64_t dmadbo:8;
554 uint64_t req_badadr:1;
555 uint64_t req_badlen:1;
556 uint64_t req_ovrflw:1;
557 uint64_t req_undflw:1;
558 uint64_t req_anull:1;
559 uint64_t req_inull:1;
560 uint64_t req_badfil:1;
561 uint64_t reserved_23_23:1;
562 uint64_t sprt0_rst:1;
563 uint64_t sprt1_rst:1;
564 uint64_t reserved_26_63:38;
565#endif
566 } cn63xx;
567};
568
569union cvmx_dpi_int_reg {
570 uint64_t u64;
571 struct cvmx_dpi_int_reg_s {
572#ifdef __BIG_ENDIAN_BITFIELD
573 uint64_t reserved_28_63:36;
574 uint64_t sprt3_rst:1;
575 uint64_t sprt2_rst:1;
576 uint64_t sprt1_rst:1;
577 uint64_t sprt0_rst:1;
578 uint64_t reserved_23_23:1;
579 uint64_t req_badfil:1;
580 uint64_t req_inull:1;
581 uint64_t req_anull:1;
582 uint64_t req_undflw:1;
583 uint64_t req_ovrflw:1;
584 uint64_t req_badlen:1;
585 uint64_t req_badadr:1;
586 uint64_t dmadbo:8;
587 uint64_t reserved_2_7:6;
588 uint64_t nfovr:1;
589 uint64_t nderr:1;
590#else
591 uint64_t nderr:1;
592 uint64_t nfovr:1;
593 uint64_t reserved_2_7:6;
594 uint64_t dmadbo:8;
595 uint64_t req_badadr:1;
596 uint64_t req_badlen:1;
597 uint64_t req_ovrflw:1;
598 uint64_t req_undflw:1;
599 uint64_t req_anull:1;
600 uint64_t req_inull:1;
601 uint64_t req_badfil:1;
602 uint64_t reserved_23_23:1;
603 uint64_t sprt0_rst:1;
604 uint64_t sprt1_rst:1;
605 uint64_t sprt2_rst:1;
606 uint64_t sprt3_rst:1;
607 uint64_t reserved_28_63:36;
608#endif
609 } s;
610 struct cvmx_dpi_int_reg_cn63xx {
611#ifdef __BIG_ENDIAN_BITFIELD
612 uint64_t reserved_26_63:38;
613 uint64_t sprt1_rst:1;
614 uint64_t sprt0_rst:1;
615 uint64_t reserved_23_23:1;
616 uint64_t req_badfil:1;
617 uint64_t req_inull:1;
618 uint64_t req_anull:1;
619 uint64_t req_undflw:1;
620 uint64_t req_ovrflw:1;
621 uint64_t req_badlen:1;
622 uint64_t req_badadr:1;
623 uint64_t dmadbo:8;
624 uint64_t reserved_2_7:6;
625 uint64_t nfovr:1;
626 uint64_t nderr:1;
627#else
628 uint64_t nderr:1;
629 uint64_t nfovr:1;
630 uint64_t reserved_2_7:6;
631 uint64_t dmadbo:8;
632 uint64_t req_badadr:1;
633 uint64_t req_badlen:1;
634 uint64_t req_ovrflw:1;
635 uint64_t req_undflw:1;
636 uint64_t req_anull:1;
637 uint64_t req_inull:1;
638 uint64_t req_badfil:1;
639 uint64_t reserved_23_23:1;
640 uint64_t sprt0_rst:1;
641 uint64_t sprt1_rst:1;
642 uint64_t reserved_26_63:38;
643#endif
644 } cn63xx;
645};
646
647union cvmx_dpi_ncbx_cfg {
648 uint64_t u64;
649 struct cvmx_dpi_ncbx_cfg_s {
650#ifdef __BIG_ENDIAN_BITFIELD
651 uint64_t reserved_6_63:58;
652 uint64_t molr:6;
653#else
654 uint64_t molr:6;
655 uint64_t reserved_6_63:58;
656#endif
657 } s;
658};
659
660union cvmx_dpi_pint_info {
661 uint64_t u64;
662 struct cvmx_dpi_pint_info_s {
663#ifdef __BIG_ENDIAN_BITFIELD
664 uint64_t reserved_14_63:50;
665 uint64_t iinfo:6;
666 uint64_t reserved_6_7:2;
667 uint64_t sinfo:6;
668#else
669 uint64_t sinfo:6;
670 uint64_t reserved_6_7:2;
671 uint64_t iinfo:6;
672 uint64_t reserved_14_63:50;
673#endif
674 } s;
675};
676
677union cvmx_dpi_pkt_err_rsp {
678 uint64_t u64;
679 struct cvmx_dpi_pkt_err_rsp_s {
680#ifdef __BIG_ENDIAN_BITFIELD
681 uint64_t reserved_1_63:63;
682 uint64_t pkterr:1;
683#else
684 uint64_t pkterr:1;
685 uint64_t reserved_1_63:63;
686#endif
687 } s;
688};
689
690union cvmx_dpi_req_err_rsp {
691 uint64_t u64;
692 struct cvmx_dpi_req_err_rsp_s {
693#ifdef __BIG_ENDIAN_BITFIELD
694 uint64_t reserved_8_63:56;
695 uint64_t qerr:8;
696#else
697 uint64_t qerr:8;
698 uint64_t reserved_8_63:56;
699#endif
700 } s;
701};
702
703union cvmx_dpi_req_err_rsp_en {
704 uint64_t u64;
705 struct cvmx_dpi_req_err_rsp_en_s {
706#ifdef __BIG_ENDIAN_BITFIELD
707 uint64_t reserved_8_63:56;
708 uint64_t en:8;
709#else
710 uint64_t en:8;
711 uint64_t reserved_8_63:56;
712#endif
713 } s;
714};
715
716union cvmx_dpi_req_err_rst {
717 uint64_t u64;
718 struct cvmx_dpi_req_err_rst_s {
719#ifdef __BIG_ENDIAN_BITFIELD
720 uint64_t reserved_8_63:56;
721 uint64_t qerr:8;
722#else
723 uint64_t qerr:8;
724 uint64_t reserved_8_63:56;
725#endif
726 } s;
727};
728
729union cvmx_dpi_req_err_rst_en {
730 uint64_t u64;
731 struct cvmx_dpi_req_err_rst_en_s {
732#ifdef __BIG_ENDIAN_BITFIELD
733 uint64_t reserved_8_63:56;
734 uint64_t en:8;
735#else
736 uint64_t en:8;
737 uint64_t reserved_8_63:56;
738#endif
739 } s;
740};
741
742union cvmx_dpi_req_err_skip_comp {
743 uint64_t u64;
744 struct cvmx_dpi_req_err_skip_comp_s {
745#ifdef __BIG_ENDIAN_BITFIELD
746 uint64_t reserved_24_63:40;
747 uint64_t en_rst:8;
748 uint64_t reserved_8_15:8;
749 uint64_t en_rsp:8;
750#else
751 uint64_t en_rsp:8;
752 uint64_t reserved_8_15:8;
753 uint64_t en_rst:8;
754 uint64_t reserved_24_63:40;
755#endif
756 } s;
757};
758
759union cvmx_dpi_req_gbl_en {
760 uint64_t u64;
761 struct cvmx_dpi_req_gbl_en_s {
762#ifdef __BIG_ENDIAN_BITFIELD
763 uint64_t reserved_8_63:56;
764 uint64_t qen:8;
765#else
766 uint64_t qen:8;
767 uint64_t reserved_8_63:56;
768#endif
769 } s;
770};
771
772union cvmx_dpi_sli_prtx_cfg {
773 uint64_t u64;
774 struct cvmx_dpi_sli_prtx_cfg_s {
775#ifdef __BIG_ENDIAN_BITFIELD
776 uint64_t reserved_25_63:39;
777 uint64_t halt:1;
778 uint64_t qlm_cfg:4;
779 uint64_t reserved_17_19:3;
780 uint64_t rd_mode:1;
781 uint64_t reserved_14_15:2;
782 uint64_t molr:6;
783 uint64_t mps_lim:1;
784 uint64_t reserved_5_6:2;
785 uint64_t mps:1;
786 uint64_t mrrs_lim:1;
787 uint64_t reserved_2_2:1;
788 uint64_t mrrs:2;
789#else
790 uint64_t mrrs:2;
791 uint64_t reserved_2_2:1;
792 uint64_t mrrs_lim:1;
793 uint64_t mps:1;
794 uint64_t reserved_5_6:2;
795 uint64_t mps_lim:1;
796 uint64_t molr:6;
797 uint64_t reserved_14_15:2;
798 uint64_t rd_mode:1;
799 uint64_t reserved_17_19:3;
800 uint64_t qlm_cfg:4;
801 uint64_t halt:1;
802 uint64_t reserved_25_63:39;
803#endif
804 } s;
805 struct cvmx_dpi_sli_prtx_cfg_cn63xx {
806#ifdef __BIG_ENDIAN_BITFIELD
807 uint64_t reserved_25_63:39;
808 uint64_t halt:1;
809 uint64_t reserved_21_23:3;
810 uint64_t qlm_cfg:1;
811 uint64_t reserved_17_19:3;
812 uint64_t rd_mode:1;
813 uint64_t reserved_14_15:2;
814 uint64_t molr:6;
815 uint64_t mps_lim:1;
816 uint64_t reserved_5_6:2;
817 uint64_t mps:1;
818 uint64_t mrrs_lim:1;
819 uint64_t reserved_2_2:1;
820 uint64_t mrrs:2;
821#else
822 uint64_t mrrs:2;
823 uint64_t reserved_2_2:1;
824 uint64_t mrrs_lim:1;
825 uint64_t mps:1;
826 uint64_t reserved_5_6:2;
827 uint64_t mps_lim:1;
828 uint64_t molr:6;
829 uint64_t reserved_14_15:2;
830 uint64_t rd_mode:1;
831 uint64_t reserved_17_19:3;
832 uint64_t qlm_cfg:1;
833 uint64_t reserved_21_23:3;
834 uint64_t halt:1;
835 uint64_t reserved_25_63:39;
836#endif
837 } cn63xx;
838};
839
840union cvmx_dpi_sli_prtx_err {
841 uint64_t u64;
842 struct cvmx_dpi_sli_prtx_err_s {
843#ifdef __BIG_ENDIAN_BITFIELD
844 uint64_t addr:61;
845 uint64_t reserved_0_2:3;
846#else
847 uint64_t reserved_0_2:3;
848 uint64_t addr:61;
849#endif
850 } s;
851};
852
853union cvmx_dpi_sli_prtx_err_info {
854 uint64_t u64;
855 struct cvmx_dpi_sli_prtx_err_info_s {
856#ifdef __BIG_ENDIAN_BITFIELD
857 uint64_t reserved_9_63:55;
858 uint64_t lock:1;
859 uint64_t reserved_5_7:3;
860 uint64_t type:1;
861 uint64_t reserved_3_3:1;
862 uint64_t reqq:3;
863#else
864 uint64_t reqq:3;
865 uint64_t reserved_3_3:1;
866 uint64_t type:1;
867 uint64_t reserved_5_7:3;
868 uint64_t lock:1;
869 uint64_t reserved_9_63:55;
870#endif
871 } s;
872};
873
874#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-fau.h b/arch/mips/include/asm/octeon/cvmx-fau.h
new file mode 100644
index 000000000..dafeae300
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-fau.h
@@ -0,0 +1,619 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 * Interface to the hardware Fetch and Add Unit.
30 */
31
32#ifndef __CVMX_FAU_H__
33#define __CVMX_FAU_H__
34
35/*
36 * Octeon Fetch and Add Unit (FAU)
37 */
38
39#define CVMX_FAU_LOAD_IO_ADDRESS cvmx_build_io_address(0x1e, 0)
40#define CVMX_FAU_BITS_SCRADDR 63, 56
41#define CVMX_FAU_BITS_LEN 55, 48
42#define CVMX_FAU_BITS_INEVAL 35, 14
43#define CVMX_FAU_BITS_TAGWAIT 13, 13
44#define CVMX_FAU_BITS_NOADD 13, 13
45#define CVMX_FAU_BITS_SIZE 12, 11
46#define CVMX_FAU_BITS_REGISTER 10, 0
47
48typedef enum {
49 CVMX_FAU_OP_SIZE_8 = 0,
50 CVMX_FAU_OP_SIZE_16 = 1,
51 CVMX_FAU_OP_SIZE_32 = 2,
52 CVMX_FAU_OP_SIZE_64 = 3
53} cvmx_fau_op_size_t;
54
55/**
56 * Tagwait return definition. If a timeout occurs, the error
57 * bit will be set. Otherwise the value of the register before
58 * the update will be returned.
59 */
60typedef struct {
61 uint64_t error:1;
62 int64_t value:63;
63} cvmx_fau_tagwait64_t;
64
65/**
66 * Tagwait return definition. If a timeout occurs, the error
67 * bit will be set. Otherwise the value of the register before
68 * the update will be returned.
69 */
70typedef struct {
71 uint64_t error:1;
72 int32_t value:31;
73} cvmx_fau_tagwait32_t;
74
75/**
76 * Tagwait return definition. If a timeout occurs, the error
77 * bit will be set. Otherwise the value of the register before
78 * the update will be returned.
79 */
80typedef struct {
81 uint64_t error:1;
82 int16_t value:15;
83} cvmx_fau_tagwait16_t;
84
85/**
86 * Tagwait return definition. If a timeout occurs, the error
87 * bit will be set. Otherwise the value of the register before
88 * the update will be returned.
89 */
90typedef struct {
91 uint64_t error:1;
92 int8_t value:7;
93} cvmx_fau_tagwait8_t;
94
95/**
96 * Asynchronous tagwait return definition. If a timeout occurs,
97 * the error bit will be set. Otherwise the value of the
98 * register before the update will be returned.
99 */
100typedef union {
101 uint64_t u64;
102 struct {
103 uint64_t invalid:1;
104 uint64_t data:63; /* unpredictable if invalid is set */
105 } s;
106} cvmx_fau_async_tagwait_result_t;
107
108#ifdef __BIG_ENDIAN_BITFIELD
109#define SWIZZLE_8 0
110#define SWIZZLE_16 0
111#define SWIZZLE_32 0
112#else
113#define SWIZZLE_8 0x7
114#define SWIZZLE_16 0x6
115#define SWIZZLE_32 0x4
116#endif
117
118/**
119 * Builds a store I/O address for writing to the FAU
120 *
121 * @noadd: 0 = Store value is atomically added to the current value
122 * 1 = Store value is atomically written over the current value
123 * @reg: FAU atomic register to access. 0 <= reg < 2048.
124 * - Step by 2 for 16 bit access.
125 * - Step by 4 for 32 bit access.
126 * - Step by 8 for 64 bit access.
127 * Returns Address to store for atomic update
128 */
129static inline uint64_t __cvmx_fau_store_address(uint64_t noadd, uint64_t reg)
130{
131 return CVMX_ADD_IO_SEG(CVMX_FAU_LOAD_IO_ADDRESS) |
132 cvmx_build_bits(CVMX_FAU_BITS_NOADD, noadd) |
133 cvmx_build_bits(CVMX_FAU_BITS_REGISTER, reg);
134}
135
136/**
137 * Builds a I/O address for accessing the FAU
138 *
139 * @tagwait: Should the atomic add wait for the current tag switch
140 * operation to complete.
141 * - 0 = Don't wait
142 * - 1 = Wait for tag switch to complete
143 * @reg: FAU atomic register to access. 0 <= reg < 2048.
144 * - Step by 2 for 16 bit access.
145 * - Step by 4 for 32 bit access.
146 * - Step by 8 for 64 bit access.
147 * @value: Signed value to add.
148 * Note: When performing 32 and 64 bit access, only the low
149 * 22 bits are available.
150 * Returns Address to read from for atomic update
151 */
152static inline uint64_t __cvmx_fau_atomic_address(uint64_t tagwait, uint64_t reg,
153 int64_t value)
154{
155 return CVMX_ADD_IO_SEG(CVMX_FAU_LOAD_IO_ADDRESS) |
156 cvmx_build_bits(CVMX_FAU_BITS_INEVAL, value) |
157 cvmx_build_bits(CVMX_FAU_BITS_TAGWAIT, tagwait) |
158 cvmx_build_bits(CVMX_FAU_BITS_REGISTER, reg);
159}
160
161/**
162 * Perform an atomic 64 bit add
163 *
164 * @reg: FAU atomic register to access. 0 <= reg < 2048.
165 * - Step by 8 for 64 bit access.
166 * @value: Signed value to add.
167 * Note: Only the low 22 bits are available.
168 * Returns Value of the register before the update
169 */
170static inline int64_t cvmx_fau_fetch_and_add64(cvmx_fau_reg_64_t reg,
171 int64_t value)
172{
173 return cvmx_read64_int64(__cvmx_fau_atomic_address(0, reg, value));
174}
175
176/**
177 * Perform an atomic 32 bit add
178 *
179 * @reg: FAU atomic register to access. 0 <= reg < 2048.
180 * - Step by 4 for 32 bit access.
181 * @value: Signed value to add.
182 * Note: Only the low 22 bits are available.
183 * Returns Value of the register before the update
184 */
185static inline int32_t cvmx_fau_fetch_and_add32(cvmx_fau_reg_32_t reg,
186 int32_t value)
187{
188 reg ^= SWIZZLE_32;
189 return cvmx_read64_int32(__cvmx_fau_atomic_address(0, reg, value));
190}
191
192/**
193 * Perform an atomic 16 bit add
194 *
195 * @reg: FAU atomic register to access. 0 <= reg < 2048.
196 * - Step by 2 for 16 bit access.
197 * @value: Signed value to add.
198 * Returns Value of the register before the update
199 */
200static inline int16_t cvmx_fau_fetch_and_add16(cvmx_fau_reg_16_t reg,
201 int16_t value)
202{
203 reg ^= SWIZZLE_16;
204 return cvmx_read64_int16(__cvmx_fau_atomic_address(0, reg, value));
205}
206
207/**
208 * Perform an atomic 8 bit add
209 *
210 * @reg: FAU atomic register to access. 0 <= reg < 2048.
211 * @value: Signed value to add.
212 * Returns Value of the register before the update
213 */
214static inline int8_t cvmx_fau_fetch_and_add8(cvmx_fau_reg_8_t reg, int8_t value)
215{
216 reg ^= SWIZZLE_8;
217 return cvmx_read64_int8(__cvmx_fau_atomic_address(0, reg, value));
218}
219
220/**
221 * Perform an atomic 64 bit add after the current tag switch
222 * completes
223 *
224 * @reg: FAU atomic register to access. 0 <= reg < 2048.
225 * - Step by 8 for 64 bit access.
226 * @value: Signed value to add.
227 * Note: Only the low 22 bits are available.
228 * Returns If a timeout occurs, the error bit will be set. Otherwise
229 * the value of the register before the update will be
230 * returned
231 */
232static inline cvmx_fau_tagwait64_t
233cvmx_fau_tagwait_fetch_and_add64(cvmx_fau_reg_64_t reg, int64_t value)
234{
235 union {
236 uint64_t i64;
237 cvmx_fau_tagwait64_t t;
238 } result;
239 result.i64 =
240 cvmx_read64_int64(__cvmx_fau_atomic_address(1, reg, value));
241 return result.t;
242}
243
244/**
245 * Perform an atomic 32 bit add after the current tag switch
246 * completes
247 *
248 * @reg: FAU atomic register to access. 0 <= reg < 2048.
249 * - Step by 4 for 32 bit access.
250 * @value: Signed value to add.
251 * Note: Only the low 22 bits are available.
252 * Returns If a timeout occurs, the error bit will be set. Otherwise
253 * the value of the register before the update will be
254 * returned
255 */
256static inline cvmx_fau_tagwait32_t
257cvmx_fau_tagwait_fetch_and_add32(cvmx_fau_reg_32_t reg, int32_t value)
258{
259 union {
260 uint64_t i32;
261 cvmx_fau_tagwait32_t t;
262 } result;
263 reg ^= SWIZZLE_32;
264 result.i32 =
265 cvmx_read64_int32(__cvmx_fau_atomic_address(1, reg, value));
266 return result.t;
267}
268
269/**
270 * Perform an atomic 16 bit add after the current tag switch
271 * completes
272 *
273 * @reg: FAU atomic register to access. 0 <= reg < 2048.
274 * - Step by 2 for 16 bit access.
275 * @value: Signed value to add.
276 * Returns If a timeout occurs, the error bit will be set. Otherwise
277 * the value of the register before the update will be
278 * returned
279 */
280static inline cvmx_fau_tagwait16_t
281cvmx_fau_tagwait_fetch_and_add16(cvmx_fau_reg_16_t reg, int16_t value)
282{
283 union {
284 uint64_t i16;
285 cvmx_fau_tagwait16_t t;
286 } result;
287 reg ^= SWIZZLE_16;
288 result.i16 =
289 cvmx_read64_int16(__cvmx_fau_atomic_address(1, reg, value));
290 return result.t;
291}
292
293/**
294 * Perform an atomic 8 bit add after the current tag switch
295 * completes
296 *
297 * @reg: FAU atomic register to access. 0 <= reg < 2048.
298 * @value: Signed value to add.
299 * Returns If a timeout occurs, the error bit will be set. Otherwise
300 * the value of the register before the update will be
301 * returned
302 */
303static inline cvmx_fau_tagwait8_t
304cvmx_fau_tagwait_fetch_and_add8(cvmx_fau_reg_8_t reg, int8_t value)
305{
306 union {
307 uint64_t i8;
308 cvmx_fau_tagwait8_t t;
309 } result;
310 reg ^= SWIZZLE_8;
311 result.i8 = cvmx_read64_int8(__cvmx_fau_atomic_address(1, reg, value));
312 return result.t;
313}
314
315/**
316 * Builds I/O data for async operations
317 *
318 * @scraddr: Scratch pad byte address to write to. Must be 8 byte aligned
319 * @value: Signed value to add.
320 * Note: When performing 32 and 64 bit access, only the low
321 * 22 bits are available.
322 * @tagwait: Should the atomic add wait for the current tag switch
323 * operation to complete.
324 * - 0 = Don't wait
325 * - 1 = Wait for tag switch to complete
326 * @size: The size of the operation:
327 * - CVMX_FAU_OP_SIZE_8 (0) = 8 bits
328 * - CVMX_FAU_OP_SIZE_16 (1) = 16 bits
329 * - CVMX_FAU_OP_SIZE_32 (2) = 32 bits
330 * - CVMX_FAU_OP_SIZE_64 (3) = 64 bits
331 * @reg: FAU atomic register to access. 0 <= reg < 2048.
332 * - Step by 2 for 16 bit access.
333 * - Step by 4 for 32 bit access.
334 * - Step by 8 for 64 bit access.
335 * Returns Data to write using cvmx_send_single
336 */
337static inline uint64_t __cvmx_fau_iobdma_data(uint64_t scraddr, int64_t value,
338 uint64_t tagwait,
339 cvmx_fau_op_size_t size,
340 uint64_t reg)
341{
342 return CVMX_FAU_LOAD_IO_ADDRESS |
343 cvmx_build_bits(CVMX_FAU_BITS_SCRADDR, scraddr >> 3) |
344 cvmx_build_bits(CVMX_FAU_BITS_LEN, 1) |
345 cvmx_build_bits(CVMX_FAU_BITS_INEVAL, value) |
346 cvmx_build_bits(CVMX_FAU_BITS_TAGWAIT, tagwait) |
347 cvmx_build_bits(CVMX_FAU_BITS_SIZE, size) |
348 cvmx_build_bits(CVMX_FAU_BITS_REGISTER, reg);
349}
350
351/**
352 * Perform an async atomic 64 bit add. The old value is
353 * placed in the scratch memory at byte address scraddr.
354 *
355 * @scraddr: Scratch memory byte address to put response in.
356 * Must be 8 byte aligned.
357 * @reg: FAU atomic register to access. 0 <= reg < 2048.
358 * - Step by 8 for 64 bit access.
359 * @value: Signed value to add.
360 * Note: Only the low 22 bits are available.
361 * Returns Placed in the scratch pad register
362 */
363static inline void cvmx_fau_async_fetch_and_add64(uint64_t scraddr,
364 cvmx_fau_reg_64_t reg,
365 int64_t value)
366{
367 cvmx_send_single(__cvmx_fau_iobdma_data
368 (scraddr, value, 0, CVMX_FAU_OP_SIZE_64, reg));
369}
370
371/**
372 * Perform an async atomic 32 bit add. The old value is
373 * placed in the scratch memory at byte address scraddr.
374 *
375 * @scraddr: Scratch memory byte address to put response in.
376 * Must be 8 byte aligned.
377 * @reg: FAU atomic register to access. 0 <= reg < 2048.
378 * - Step by 4 for 32 bit access.
379 * @value: Signed value to add.
380 * Note: Only the low 22 bits are available.
381 * Returns Placed in the scratch pad register
382 */
383static inline void cvmx_fau_async_fetch_and_add32(uint64_t scraddr,
384 cvmx_fau_reg_32_t reg,
385 int32_t value)
386{
387 cvmx_send_single(__cvmx_fau_iobdma_data
388 (scraddr, value, 0, CVMX_FAU_OP_SIZE_32, reg));
389}
390
391/**
392 * Perform an async atomic 16 bit add. The old value is
393 * placed in the scratch memory at byte address scraddr.
394 *
395 * @scraddr: Scratch memory byte address to put response in.
396 * Must be 8 byte aligned.
397 * @reg: FAU atomic register to access. 0 <= reg < 2048.
398 * - Step by 2 for 16 bit access.
399 * @value: Signed value to add.
400 * Returns Placed in the scratch pad register
401 */
402static inline void cvmx_fau_async_fetch_and_add16(uint64_t scraddr,
403 cvmx_fau_reg_16_t reg,
404 int16_t value)
405{
406 cvmx_send_single(__cvmx_fau_iobdma_data
407 (scraddr, value, 0, CVMX_FAU_OP_SIZE_16, reg));
408}
409
410/**
411 * Perform an async atomic 8 bit add. The old value is
412 * placed in the scratch memory at byte address scraddr.
413 *
414 * @scraddr: Scratch memory byte address to put response in.
415 * Must be 8 byte aligned.
416 * @reg: FAU atomic register to access. 0 <= reg < 2048.
417 * @value: Signed value to add.
418 * Returns Placed in the scratch pad register
419 */
420static inline void cvmx_fau_async_fetch_and_add8(uint64_t scraddr,
421 cvmx_fau_reg_8_t reg,
422 int8_t value)
423{
424 cvmx_send_single(__cvmx_fau_iobdma_data
425 (scraddr, value, 0, CVMX_FAU_OP_SIZE_8, reg));
426}
427
428/**
429 * Perform an async atomic 64 bit add after the current tag
430 * switch completes.
431 *
432 * @scraddr: Scratch memory byte address to put response in. Must be
433 * 8 byte aligned. If a timeout occurs, the error bit (63)
434 * will be set. Otherwise the value of the register before
435 * the update will be returned
436 *
437 * @reg: FAU atomic register to access. 0 <= reg < 2048.
438 * - Step by 8 for 64 bit access.
439 * @value: Signed value to add.
440 * Note: Only the low 22 bits are available.
441 * Returns Placed in the scratch pad register
442 */
443static inline void cvmx_fau_async_tagwait_fetch_and_add64(uint64_t scraddr,
444 cvmx_fau_reg_64_t reg,
445 int64_t value)
446{
447 cvmx_send_single(__cvmx_fau_iobdma_data
448 (scraddr, value, 1, CVMX_FAU_OP_SIZE_64, reg));
449}
450
451/**
452 * Perform an async atomic 32 bit add after the current tag
453 * switch completes.
454 *
455 * @scraddr: Scratch memory byte address to put response in. Must be
456 * 8 byte aligned. If a timeout occurs, the error bit (63)
457 * will be set. Otherwise the value of the register before
458 * the update will be returned
459 *
460 * @reg: FAU atomic register to access. 0 <= reg < 2048.
461 * - Step by 4 for 32 bit access.
462 * @value: Signed value to add.
463 * Note: Only the low 22 bits are available.
464 * Returns Placed in the scratch pad register
465 */
466static inline void cvmx_fau_async_tagwait_fetch_and_add32(uint64_t scraddr,
467 cvmx_fau_reg_32_t reg,
468 int32_t value)
469{
470 cvmx_send_single(__cvmx_fau_iobdma_data
471 (scraddr, value, 1, CVMX_FAU_OP_SIZE_32, reg));
472}
473
474/**
475 * Perform an async atomic 16 bit add after the current tag
476 * switch completes.
477 *
478 * @scraddr: Scratch memory byte address to put response in. Must be
479 * 8 byte aligned. If a timeout occurs, the error bit (63)
480 * will be set. Otherwise the value of the register before
481 * the update will be returned
482 *
483 * @reg: FAU atomic register to access. 0 <= reg < 2048.
484 * - Step by 2 for 16 bit access.
485 * @value: Signed value to add.
486 *
487 * Returns Placed in the scratch pad register
488 */
489static inline void cvmx_fau_async_tagwait_fetch_and_add16(uint64_t scraddr,
490 cvmx_fau_reg_16_t reg,
491 int16_t value)
492{
493 cvmx_send_single(__cvmx_fau_iobdma_data
494 (scraddr, value, 1, CVMX_FAU_OP_SIZE_16, reg));
495}
496
497/**
498 * Perform an async atomic 8 bit add after the current tag
499 * switch completes.
500 *
501 * @scraddr: Scratch memory byte address to put response in. Must be
502 * 8 byte aligned. If a timeout occurs, the error bit (63)
503 * will be set. Otherwise the value of the register before
504 * the update will be returned
505 *
506 * @reg: FAU atomic register to access. 0 <= reg < 2048.
507 * @value: Signed value to add.
508 *
509 * Returns Placed in the scratch pad register
510 */
511static inline void cvmx_fau_async_tagwait_fetch_and_add8(uint64_t scraddr,
512 cvmx_fau_reg_8_t reg,
513 int8_t value)
514{
515 cvmx_send_single(__cvmx_fau_iobdma_data
516 (scraddr, value, 1, CVMX_FAU_OP_SIZE_8, reg));
517}
518
519/**
520 * Perform an atomic 64 bit add
521 *
522 * @reg: FAU atomic register to access. 0 <= reg < 2048.
523 * - Step by 8 for 64 bit access.
524 * @value: Signed value to add.
525 */
526static inline void cvmx_fau_atomic_add64(cvmx_fau_reg_64_t reg, int64_t value)
527{
528 cvmx_write64_int64(__cvmx_fau_store_address(0, reg), value);
529}
530
531/**
532 * Perform an atomic 32 bit add
533 *
534 * @reg: FAU atomic register to access. 0 <= reg < 2048.
535 * - Step by 4 for 32 bit access.
536 * @value: Signed value to add.
537 */
538static inline void cvmx_fau_atomic_add32(cvmx_fau_reg_32_t reg, int32_t value)
539{
540 reg ^= SWIZZLE_32;
541 cvmx_write64_int32(__cvmx_fau_store_address(0, reg), value);
542}
543
544/**
545 * Perform an atomic 16 bit add
546 *
547 * @reg: FAU atomic register to access. 0 <= reg < 2048.
548 * - Step by 2 for 16 bit access.
549 * @value: Signed value to add.
550 */
551static inline void cvmx_fau_atomic_add16(cvmx_fau_reg_16_t reg, int16_t value)
552{
553 reg ^= SWIZZLE_16;
554 cvmx_write64_int16(__cvmx_fau_store_address(0, reg), value);
555}
556
557/**
558 * Perform an atomic 8 bit add
559 *
560 * @reg: FAU atomic register to access. 0 <= reg < 2048.
561 * @value: Signed value to add.
562 */
563static inline void cvmx_fau_atomic_add8(cvmx_fau_reg_8_t reg, int8_t value)
564{
565 reg ^= SWIZZLE_8;
566 cvmx_write64_int8(__cvmx_fau_store_address(0, reg), value);
567}
568
569/**
570 * Perform an atomic 64 bit write
571 *
572 * @reg: FAU atomic register to access. 0 <= reg < 2048.
573 * - Step by 8 for 64 bit access.
574 * @value: Signed value to write.
575 */
576static inline void cvmx_fau_atomic_write64(cvmx_fau_reg_64_t reg, int64_t value)
577{
578 cvmx_write64_int64(__cvmx_fau_store_address(1, reg), value);
579}
580
581/**
582 * Perform an atomic 32 bit write
583 *
584 * @reg: FAU atomic register to access. 0 <= reg < 2048.
585 * - Step by 4 for 32 bit access.
586 * @value: Signed value to write.
587 */
588static inline void cvmx_fau_atomic_write32(cvmx_fau_reg_32_t reg, int32_t value)
589{
590 reg ^= SWIZZLE_32;
591 cvmx_write64_int32(__cvmx_fau_store_address(1, reg), value);
592}
593
594/**
595 * Perform an atomic 16 bit write
596 *
597 * @reg: FAU atomic register to access. 0 <= reg < 2048.
598 * - Step by 2 for 16 bit access.
599 * @value: Signed value to write.
600 */
601static inline void cvmx_fau_atomic_write16(cvmx_fau_reg_16_t reg, int16_t value)
602{
603 reg ^= SWIZZLE_16;
604 cvmx_write64_int16(__cvmx_fau_store_address(1, reg), value);
605}
606
607/**
608 * Perform an atomic 8 bit write
609 *
610 * @reg: FAU atomic register to access. 0 <= reg < 2048.
611 * @value: Signed value to write.
612 */
613static inline void cvmx_fau_atomic_write8(cvmx_fau_reg_8_t reg, int8_t value)
614{
615 reg ^= SWIZZLE_8;
616 cvmx_write64_int8(__cvmx_fau_store_address(1, reg), value);
617}
618
619#endif /* __CVMX_FAU_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-fpa-defs.h b/arch/mips/include/asm/octeon/cvmx-fpa-defs.h
new file mode 100644
index 000000000..322943f7c
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-fpa-defs.h
@@ -0,0 +1,1252 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_FPA_DEFS_H__
29#define __CVMX_FPA_DEFS_H__
30
31#define CVMX_FPA_ADDR_RANGE_ERROR (CVMX_ADD_IO_SEG(0x0001180028000458ull))
32#define CVMX_FPA_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011800280000E8ull))
33#define CVMX_FPA_CTL_STATUS (CVMX_ADD_IO_SEG(0x0001180028000050ull))
34#define CVMX_FPA_FPF0_MARKS (CVMX_ADD_IO_SEG(0x0001180028000000ull))
35#define CVMX_FPA_FPF0_SIZE (CVMX_ADD_IO_SEG(0x0001180028000058ull))
36#define CVMX_FPA_FPF1_MARKS CVMX_FPA_FPFX_MARKS(1)
37#define CVMX_FPA_FPF2_MARKS CVMX_FPA_FPFX_MARKS(2)
38#define CVMX_FPA_FPF3_MARKS CVMX_FPA_FPFX_MARKS(3)
39#define CVMX_FPA_FPF4_MARKS CVMX_FPA_FPFX_MARKS(4)
40#define CVMX_FPA_FPF5_MARKS CVMX_FPA_FPFX_MARKS(5)
41#define CVMX_FPA_FPF6_MARKS CVMX_FPA_FPFX_MARKS(6)
42#define CVMX_FPA_FPF7_MARKS CVMX_FPA_FPFX_MARKS(7)
43#define CVMX_FPA_FPF8_MARKS (CVMX_ADD_IO_SEG(0x0001180028000240ull))
44#define CVMX_FPA_FPF8_SIZE (CVMX_ADD_IO_SEG(0x0001180028000248ull))
45#define CVMX_FPA_FPFX_MARKS(offset) (CVMX_ADD_IO_SEG(0x0001180028000008ull) + ((offset) & 7) * 8 - 8*1)
46#define CVMX_FPA_FPFX_SIZE(offset) (CVMX_ADD_IO_SEG(0x0001180028000060ull) + ((offset) & 7) * 8 - 8*1)
47#define CVMX_FPA_INT_ENB (CVMX_ADD_IO_SEG(0x0001180028000048ull))
48#define CVMX_FPA_INT_SUM (CVMX_ADD_IO_SEG(0x0001180028000040ull))
49#define CVMX_FPA_PACKET_THRESHOLD (CVMX_ADD_IO_SEG(0x0001180028000460ull))
50#define CVMX_FPA_POOLX_END_ADDR(offset) (CVMX_ADD_IO_SEG(0x0001180028000358ull) + ((offset) & 15) * 8)
51#define CVMX_FPA_POOLX_START_ADDR(offset) (CVMX_ADD_IO_SEG(0x0001180028000258ull) + ((offset) & 15) * 8)
52#define CVMX_FPA_POOLX_THRESHOLD(offset) (CVMX_ADD_IO_SEG(0x0001180028000140ull) + ((offset) & 15) * 8)
53#define CVMX_FPA_QUE0_PAGE_INDEX CVMX_FPA_QUEX_PAGE_INDEX(0)
54#define CVMX_FPA_QUE1_PAGE_INDEX CVMX_FPA_QUEX_PAGE_INDEX(1)
55#define CVMX_FPA_QUE2_PAGE_INDEX CVMX_FPA_QUEX_PAGE_INDEX(2)
56#define CVMX_FPA_QUE3_PAGE_INDEX CVMX_FPA_QUEX_PAGE_INDEX(3)
57#define CVMX_FPA_QUE4_PAGE_INDEX CVMX_FPA_QUEX_PAGE_INDEX(4)
58#define CVMX_FPA_QUE5_PAGE_INDEX CVMX_FPA_QUEX_PAGE_INDEX(5)
59#define CVMX_FPA_QUE6_PAGE_INDEX CVMX_FPA_QUEX_PAGE_INDEX(6)
60#define CVMX_FPA_QUE7_PAGE_INDEX CVMX_FPA_QUEX_PAGE_INDEX(7)
61#define CVMX_FPA_QUE8_PAGE_INDEX (CVMX_ADD_IO_SEG(0x0001180028000250ull))
62#define CVMX_FPA_QUEX_AVAILABLE(offset) (CVMX_ADD_IO_SEG(0x0001180028000098ull) + ((offset) & 15) * 8)
63#define CVMX_FPA_QUEX_PAGE_INDEX(offset) (CVMX_ADD_IO_SEG(0x00011800280000F0ull) + ((offset) & 7) * 8)
64#define CVMX_FPA_QUE_ACT (CVMX_ADD_IO_SEG(0x0001180028000138ull))
65#define CVMX_FPA_QUE_EXP (CVMX_ADD_IO_SEG(0x0001180028000130ull))
66#define CVMX_FPA_WART_CTL (CVMX_ADD_IO_SEG(0x00011800280000D8ull))
67#define CVMX_FPA_WART_STATUS (CVMX_ADD_IO_SEG(0x00011800280000E0ull))
68#define CVMX_FPA_WQE_THRESHOLD (CVMX_ADD_IO_SEG(0x0001180028000468ull))
69#define CVMX_FPA_CLK_COUNT (CVMX_ADD_IO_SEG(0x00012800000000F0ull))
70
71union cvmx_fpa_addr_range_error {
72 uint64_t u64;
73 struct cvmx_fpa_addr_range_error_s {
74#ifdef __BIG_ENDIAN_BITFIELD
75 uint64_t reserved_38_63:26;
76 uint64_t pool:5;
77 uint64_t addr:33;
78#else
79 uint64_t addr:33;
80 uint64_t pool:5;
81 uint64_t reserved_38_63:26;
82#endif
83 } s;
84};
85
86union cvmx_fpa_bist_status {
87 uint64_t u64;
88 struct cvmx_fpa_bist_status_s {
89#ifdef __BIG_ENDIAN_BITFIELD
90 uint64_t reserved_5_63:59;
91 uint64_t frd:1;
92 uint64_t fpf0:1;
93 uint64_t fpf1:1;
94 uint64_t ffr:1;
95 uint64_t fdr:1;
96#else
97 uint64_t fdr:1;
98 uint64_t ffr:1;
99 uint64_t fpf1:1;
100 uint64_t fpf0:1;
101 uint64_t frd:1;
102 uint64_t reserved_5_63:59;
103#endif
104 } s;
105};
106
107union cvmx_fpa_ctl_status {
108 uint64_t u64;
109 struct cvmx_fpa_ctl_status_s {
110#ifdef __BIG_ENDIAN_BITFIELD
111 uint64_t reserved_21_63:43;
112 uint64_t free_en:1;
113 uint64_t ret_off:1;
114 uint64_t req_off:1;
115 uint64_t reset:1;
116 uint64_t use_ldt:1;
117 uint64_t use_stt:1;
118 uint64_t enb:1;
119 uint64_t mem1_err:7;
120 uint64_t mem0_err:7;
121#else
122 uint64_t mem0_err:7;
123 uint64_t mem1_err:7;
124 uint64_t enb:1;
125 uint64_t use_stt:1;
126 uint64_t use_ldt:1;
127 uint64_t reset:1;
128 uint64_t req_off:1;
129 uint64_t ret_off:1;
130 uint64_t free_en:1;
131 uint64_t reserved_21_63:43;
132#endif
133 } s;
134 struct cvmx_fpa_ctl_status_cn30xx {
135#ifdef __BIG_ENDIAN_BITFIELD
136 uint64_t reserved_18_63:46;
137 uint64_t reset:1;
138 uint64_t use_ldt:1;
139 uint64_t use_stt:1;
140 uint64_t enb:1;
141 uint64_t mem1_err:7;
142 uint64_t mem0_err:7;
143#else
144 uint64_t mem0_err:7;
145 uint64_t mem1_err:7;
146 uint64_t enb:1;
147 uint64_t use_stt:1;
148 uint64_t use_ldt:1;
149 uint64_t reset:1;
150 uint64_t reserved_18_63:46;
151#endif
152 } cn30xx;
153};
154
155union cvmx_fpa_fpfx_marks {
156 uint64_t u64;
157 struct cvmx_fpa_fpfx_marks_s {
158#ifdef __BIG_ENDIAN_BITFIELD
159 uint64_t reserved_22_63:42;
160 uint64_t fpf_wr:11;
161 uint64_t fpf_rd:11;
162#else
163 uint64_t fpf_rd:11;
164 uint64_t fpf_wr:11;
165 uint64_t reserved_22_63:42;
166#endif
167 } s;
168};
169
170union cvmx_fpa_fpfx_size {
171 uint64_t u64;
172 struct cvmx_fpa_fpfx_size_s {
173#ifdef __BIG_ENDIAN_BITFIELD
174 uint64_t reserved_11_63:53;
175 uint64_t fpf_siz:11;
176#else
177 uint64_t fpf_siz:11;
178 uint64_t reserved_11_63:53;
179#endif
180 } s;
181};
182
183union cvmx_fpa_fpf0_marks {
184 uint64_t u64;
185 struct cvmx_fpa_fpf0_marks_s {
186#ifdef __BIG_ENDIAN_BITFIELD
187 uint64_t reserved_24_63:40;
188 uint64_t fpf_wr:12;
189 uint64_t fpf_rd:12;
190#else
191 uint64_t fpf_rd:12;
192 uint64_t fpf_wr:12;
193 uint64_t reserved_24_63:40;
194#endif
195 } s;
196};
197
198union cvmx_fpa_fpf0_size {
199 uint64_t u64;
200 struct cvmx_fpa_fpf0_size_s {
201#ifdef __BIG_ENDIAN_BITFIELD
202 uint64_t reserved_12_63:52;
203 uint64_t fpf_siz:12;
204#else
205 uint64_t fpf_siz:12;
206 uint64_t reserved_12_63:52;
207#endif
208 } s;
209};
210
211union cvmx_fpa_fpf8_marks {
212 uint64_t u64;
213 struct cvmx_fpa_fpf8_marks_s {
214#ifdef __BIG_ENDIAN_BITFIELD
215 uint64_t reserved_22_63:42;
216 uint64_t fpf_wr:11;
217 uint64_t fpf_rd:11;
218#else
219 uint64_t fpf_rd:11;
220 uint64_t fpf_wr:11;
221 uint64_t reserved_22_63:42;
222#endif
223 } s;
224};
225
226union cvmx_fpa_fpf8_size {
227 uint64_t u64;
228 struct cvmx_fpa_fpf8_size_s {
229#ifdef __BIG_ENDIAN_BITFIELD
230 uint64_t reserved_12_63:52;
231 uint64_t fpf_siz:12;
232#else
233 uint64_t fpf_siz:12;
234 uint64_t reserved_12_63:52;
235#endif
236 } s;
237};
238
239union cvmx_fpa_int_enb {
240 uint64_t u64;
241 struct cvmx_fpa_int_enb_s {
242#ifdef __BIG_ENDIAN_BITFIELD
243 uint64_t reserved_50_63:14;
244 uint64_t paddr_e:1;
245 uint64_t reserved_44_48:5;
246 uint64_t free7:1;
247 uint64_t free6:1;
248 uint64_t free5:1;
249 uint64_t free4:1;
250 uint64_t free3:1;
251 uint64_t free2:1;
252 uint64_t free1:1;
253 uint64_t free0:1;
254 uint64_t pool7th:1;
255 uint64_t pool6th:1;
256 uint64_t pool5th:1;
257 uint64_t pool4th:1;
258 uint64_t pool3th:1;
259 uint64_t pool2th:1;
260 uint64_t pool1th:1;
261 uint64_t pool0th:1;
262 uint64_t q7_perr:1;
263 uint64_t q7_coff:1;
264 uint64_t q7_und:1;
265 uint64_t q6_perr:1;
266 uint64_t q6_coff:1;
267 uint64_t q6_und:1;
268 uint64_t q5_perr:1;
269 uint64_t q5_coff:1;
270 uint64_t q5_und:1;
271 uint64_t q4_perr:1;
272 uint64_t q4_coff:1;
273 uint64_t q4_und:1;
274 uint64_t q3_perr:1;
275 uint64_t q3_coff:1;
276 uint64_t q3_und:1;
277 uint64_t q2_perr:1;
278 uint64_t q2_coff:1;
279 uint64_t q2_und:1;
280 uint64_t q1_perr:1;
281 uint64_t q1_coff:1;
282 uint64_t q1_und:1;
283 uint64_t q0_perr:1;
284 uint64_t q0_coff:1;
285 uint64_t q0_und:1;
286 uint64_t fed1_dbe:1;
287 uint64_t fed1_sbe:1;
288 uint64_t fed0_dbe:1;
289 uint64_t fed0_sbe:1;
290#else
291 uint64_t fed0_sbe:1;
292 uint64_t fed0_dbe:1;
293 uint64_t fed1_sbe:1;
294 uint64_t fed1_dbe:1;
295 uint64_t q0_und:1;
296 uint64_t q0_coff:1;
297 uint64_t q0_perr:1;
298 uint64_t q1_und:1;
299 uint64_t q1_coff:1;
300 uint64_t q1_perr:1;
301 uint64_t q2_und:1;
302 uint64_t q2_coff:1;
303 uint64_t q2_perr:1;
304 uint64_t q3_und:1;
305 uint64_t q3_coff:1;
306 uint64_t q3_perr:1;
307 uint64_t q4_und:1;
308 uint64_t q4_coff:1;
309 uint64_t q4_perr:1;
310 uint64_t q5_und:1;
311 uint64_t q5_coff:1;
312 uint64_t q5_perr:1;
313 uint64_t q6_und:1;
314 uint64_t q6_coff:1;
315 uint64_t q6_perr:1;
316 uint64_t q7_und:1;
317 uint64_t q7_coff:1;
318 uint64_t q7_perr:1;
319 uint64_t pool0th:1;
320 uint64_t pool1th:1;
321 uint64_t pool2th:1;
322 uint64_t pool3th:1;
323 uint64_t pool4th:1;
324 uint64_t pool5th:1;
325 uint64_t pool6th:1;
326 uint64_t pool7th:1;
327 uint64_t free0:1;
328 uint64_t free1:1;
329 uint64_t free2:1;
330 uint64_t free3:1;
331 uint64_t free4:1;
332 uint64_t free5:1;
333 uint64_t free6:1;
334 uint64_t free7:1;
335 uint64_t reserved_44_48:5;
336 uint64_t paddr_e:1;
337 uint64_t reserved_50_63:14;
338#endif
339 } s;
340 struct cvmx_fpa_int_enb_cn30xx {
341#ifdef __BIG_ENDIAN_BITFIELD
342 uint64_t reserved_28_63:36;
343 uint64_t q7_perr:1;
344 uint64_t q7_coff:1;
345 uint64_t q7_und:1;
346 uint64_t q6_perr:1;
347 uint64_t q6_coff:1;
348 uint64_t q6_und:1;
349 uint64_t q5_perr:1;
350 uint64_t q5_coff:1;
351 uint64_t q5_und:1;
352 uint64_t q4_perr:1;
353 uint64_t q4_coff:1;
354 uint64_t q4_und:1;
355 uint64_t q3_perr:1;
356 uint64_t q3_coff:1;
357 uint64_t q3_und:1;
358 uint64_t q2_perr:1;
359 uint64_t q2_coff:1;
360 uint64_t q2_und:1;
361 uint64_t q1_perr:1;
362 uint64_t q1_coff:1;
363 uint64_t q1_und:1;
364 uint64_t q0_perr:1;
365 uint64_t q0_coff:1;
366 uint64_t q0_und:1;
367 uint64_t fed1_dbe:1;
368 uint64_t fed1_sbe:1;
369 uint64_t fed0_dbe:1;
370 uint64_t fed0_sbe:1;
371#else
372 uint64_t fed0_sbe:1;
373 uint64_t fed0_dbe:1;
374 uint64_t fed1_sbe:1;
375 uint64_t fed1_dbe:1;
376 uint64_t q0_und:1;
377 uint64_t q0_coff:1;
378 uint64_t q0_perr:1;
379 uint64_t q1_und:1;
380 uint64_t q1_coff:1;
381 uint64_t q1_perr:1;
382 uint64_t q2_und:1;
383 uint64_t q2_coff:1;
384 uint64_t q2_perr:1;
385 uint64_t q3_und:1;
386 uint64_t q3_coff:1;
387 uint64_t q3_perr:1;
388 uint64_t q4_und:1;
389 uint64_t q4_coff:1;
390 uint64_t q4_perr:1;
391 uint64_t q5_und:1;
392 uint64_t q5_coff:1;
393 uint64_t q5_perr:1;
394 uint64_t q6_und:1;
395 uint64_t q6_coff:1;
396 uint64_t q6_perr:1;
397 uint64_t q7_und:1;
398 uint64_t q7_coff:1;
399 uint64_t q7_perr:1;
400 uint64_t reserved_28_63:36;
401#endif
402 } cn30xx;
403 struct cvmx_fpa_int_enb_cn61xx {
404#ifdef __BIG_ENDIAN_BITFIELD
405 uint64_t reserved_50_63:14;
406 uint64_t paddr_e:1;
407 uint64_t res_44:5;
408 uint64_t free7:1;
409 uint64_t free6:1;
410 uint64_t free5:1;
411 uint64_t free4:1;
412 uint64_t free3:1;
413 uint64_t free2:1;
414 uint64_t free1:1;
415 uint64_t free0:1;
416 uint64_t pool7th:1;
417 uint64_t pool6th:1;
418 uint64_t pool5th:1;
419 uint64_t pool4th:1;
420 uint64_t pool3th:1;
421 uint64_t pool2th:1;
422 uint64_t pool1th:1;
423 uint64_t pool0th:1;
424 uint64_t q7_perr:1;
425 uint64_t q7_coff:1;
426 uint64_t q7_und:1;
427 uint64_t q6_perr:1;
428 uint64_t q6_coff:1;
429 uint64_t q6_und:1;
430 uint64_t q5_perr:1;
431 uint64_t q5_coff:1;
432 uint64_t q5_und:1;
433 uint64_t q4_perr:1;
434 uint64_t q4_coff:1;
435 uint64_t q4_und:1;
436 uint64_t q3_perr:1;
437 uint64_t q3_coff:1;
438 uint64_t q3_und:1;
439 uint64_t q2_perr:1;
440 uint64_t q2_coff:1;
441 uint64_t q2_und:1;
442 uint64_t q1_perr:1;
443 uint64_t q1_coff:1;
444 uint64_t q1_und:1;
445 uint64_t q0_perr:1;
446 uint64_t q0_coff:1;
447 uint64_t q0_und:1;
448 uint64_t fed1_dbe:1;
449 uint64_t fed1_sbe:1;
450 uint64_t fed0_dbe:1;
451 uint64_t fed0_sbe:1;
452#else
453 uint64_t fed0_sbe:1;
454 uint64_t fed0_dbe:1;
455 uint64_t fed1_sbe:1;
456 uint64_t fed1_dbe:1;
457 uint64_t q0_und:1;
458 uint64_t q0_coff:1;
459 uint64_t q0_perr:1;
460 uint64_t q1_und:1;
461 uint64_t q1_coff:1;
462 uint64_t q1_perr:1;
463 uint64_t q2_und:1;
464 uint64_t q2_coff:1;
465 uint64_t q2_perr:1;
466 uint64_t q3_und:1;
467 uint64_t q3_coff:1;
468 uint64_t q3_perr:1;
469 uint64_t q4_und:1;
470 uint64_t q4_coff:1;
471 uint64_t q4_perr:1;
472 uint64_t q5_und:1;
473 uint64_t q5_coff:1;
474 uint64_t q5_perr:1;
475 uint64_t q6_und:1;
476 uint64_t q6_coff:1;
477 uint64_t q6_perr:1;
478 uint64_t q7_und:1;
479 uint64_t q7_coff:1;
480 uint64_t q7_perr:1;
481 uint64_t pool0th:1;
482 uint64_t pool1th:1;
483 uint64_t pool2th:1;
484 uint64_t pool3th:1;
485 uint64_t pool4th:1;
486 uint64_t pool5th:1;
487 uint64_t pool6th:1;
488 uint64_t pool7th:1;
489 uint64_t free0:1;
490 uint64_t free1:1;
491 uint64_t free2:1;
492 uint64_t free3:1;
493 uint64_t free4:1;
494 uint64_t free5:1;
495 uint64_t free6:1;
496 uint64_t free7:1;
497 uint64_t res_44:5;
498 uint64_t paddr_e:1;
499 uint64_t reserved_50_63:14;
500#endif
501 } cn61xx;
502 struct cvmx_fpa_int_enb_cn63xx {
503#ifdef __BIG_ENDIAN_BITFIELD
504 uint64_t reserved_44_63:20;
505 uint64_t free7:1;
506 uint64_t free6:1;
507 uint64_t free5:1;
508 uint64_t free4:1;
509 uint64_t free3:1;
510 uint64_t free2:1;
511 uint64_t free1:1;
512 uint64_t free0:1;
513 uint64_t pool7th:1;
514 uint64_t pool6th:1;
515 uint64_t pool5th:1;
516 uint64_t pool4th:1;
517 uint64_t pool3th:1;
518 uint64_t pool2th:1;
519 uint64_t pool1th:1;
520 uint64_t pool0th:1;
521 uint64_t q7_perr:1;
522 uint64_t q7_coff:1;
523 uint64_t q7_und:1;
524 uint64_t q6_perr:1;
525 uint64_t q6_coff:1;
526 uint64_t q6_und:1;
527 uint64_t q5_perr:1;
528 uint64_t q5_coff:1;
529 uint64_t q5_und:1;
530 uint64_t q4_perr:1;
531 uint64_t q4_coff:1;
532 uint64_t q4_und:1;
533 uint64_t q3_perr:1;
534 uint64_t q3_coff:1;
535 uint64_t q3_und:1;
536 uint64_t q2_perr:1;
537 uint64_t q2_coff:1;
538 uint64_t q2_und:1;
539 uint64_t q1_perr:1;
540 uint64_t q1_coff:1;
541 uint64_t q1_und:1;
542 uint64_t q0_perr:1;
543 uint64_t q0_coff:1;
544 uint64_t q0_und:1;
545 uint64_t fed1_dbe:1;
546 uint64_t fed1_sbe:1;
547 uint64_t fed0_dbe:1;
548 uint64_t fed0_sbe:1;
549#else
550 uint64_t fed0_sbe:1;
551 uint64_t fed0_dbe:1;
552 uint64_t fed1_sbe:1;
553 uint64_t fed1_dbe:1;
554 uint64_t q0_und:1;
555 uint64_t q0_coff:1;
556 uint64_t q0_perr:1;
557 uint64_t q1_und:1;
558 uint64_t q1_coff:1;
559 uint64_t q1_perr:1;
560 uint64_t q2_und:1;
561 uint64_t q2_coff:1;
562 uint64_t q2_perr:1;
563 uint64_t q3_und:1;
564 uint64_t q3_coff:1;
565 uint64_t q3_perr:1;
566 uint64_t q4_und:1;
567 uint64_t q4_coff:1;
568 uint64_t q4_perr:1;
569 uint64_t q5_und:1;
570 uint64_t q5_coff:1;
571 uint64_t q5_perr:1;
572 uint64_t q6_und:1;
573 uint64_t q6_coff:1;
574 uint64_t q6_perr:1;
575 uint64_t q7_und:1;
576 uint64_t q7_coff:1;
577 uint64_t q7_perr:1;
578 uint64_t pool0th:1;
579 uint64_t pool1th:1;
580 uint64_t pool2th:1;
581 uint64_t pool3th:1;
582 uint64_t pool4th:1;
583 uint64_t pool5th:1;
584 uint64_t pool6th:1;
585 uint64_t pool7th:1;
586 uint64_t free0:1;
587 uint64_t free1:1;
588 uint64_t free2:1;
589 uint64_t free3:1;
590 uint64_t free4:1;
591 uint64_t free5:1;
592 uint64_t free6:1;
593 uint64_t free7:1;
594 uint64_t reserved_44_63:20;
595#endif
596 } cn63xx;
597 struct cvmx_fpa_int_enb_cn68xx {
598#ifdef __BIG_ENDIAN_BITFIELD
599 uint64_t reserved_50_63:14;
600 uint64_t paddr_e:1;
601 uint64_t pool8th:1;
602 uint64_t q8_perr:1;
603 uint64_t q8_coff:1;
604 uint64_t q8_und:1;
605 uint64_t free8:1;
606 uint64_t free7:1;
607 uint64_t free6:1;
608 uint64_t free5:1;
609 uint64_t free4:1;
610 uint64_t free3:1;
611 uint64_t free2:1;
612 uint64_t free1:1;
613 uint64_t free0:1;
614 uint64_t pool7th:1;
615 uint64_t pool6th:1;
616 uint64_t pool5th:1;
617 uint64_t pool4th:1;
618 uint64_t pool3th:1;
619 uint64_t pool2th:1;
620 uint64_t pool1th:1;
621 uint64_t pool0th:1;
622 uint64_t q7_perr:1;
623 uint64_t q7_coff:1;
624 uint64_t q7_und:1;
625 uint64_t q6_perr:1;
626 uint64_t q6_coff:1;
627 uint64_t q6_und:1;
628 uint64_t q5_perr:1;
629 uint64_t q5_coff:1;
630 uint64_t q5_und:1;
631 uint64_t q4_perr:1;
632 uint64_t q4_coff:1;
633 uint64_t q4_und:1;
634 uint64_t q3_perr:1;
635 uint64_t q3_coff:1;
636 uint64_t q3_und:1;
637 uint64_t q2_perr:1;
638 uint64_t q2_coff:1;
639 uint64_t q2_und:1;
640 uint64_t q1_perr:1;
641 uint64_t q1_coff:1;
642 uint64_t q1_und:1;
643 uint64_t q0_perr:1;
644 uint64_t q0_coff:1;
645 uint64_t q0_und:1;
646 uint64_t fed1_dbe:1;
647 uint64_t fed1_sbe:1;
648 uint64_t fed0_dbe:1;
649 uint64_t fed0_sbe:1;
650#else
651 uint64_t fed0_sbe:1;
652 uint64_t fed0_dbe:1;
653 uint64_t fed1_sbe:1;
654 uint64_t fed1_dbe:1;
655 uint64_t q0_und:1;
656 uint64_t q0_coff:1;
657 uint64_t q0_perr:1;
658 uint64_t q1_und:1;
659 uint64_t q1_coff:1;
660 uint64_t q1_perr:1;
661 uint64_t q2_und:1;
662 uint64_t q2_coff:1;
663 uint64_t q2_perr:1;
664 uint64_t q3_und:1;
665 uint64_t q3_coff:1;
666 uint64_t q3_perr:1;
667 uint64_t q4_und:1;
668 uint64_t q4_coff:1;
669 uint64_t q4_perr:1;
670 uint64_t q5_und:1;
671 uint64_t q5_coff:1;
672 uint64_t q5_perr:1;
673 uint64_t q6_und:1;
674 uint64_t q6_coff:1;
675 uint64_t q6_perr:1;
676 uint64_t q7_und:1;
677 uint64_t q7_coff:1;
678 uint64_t q7_perr:1;
679 uint64_t pool0th:1;
680 uint64_t pool1th:1;
681 uint64_t pool2th:1;
682 uint64_t pool3th:1;
683 uint64_t pool4th:1;
684 uint64_t pool5th:1;
685 uint64_t pool6th:1;
686 uint64_t pool7th:1;
687 uint64_t free0:1;
688 uint64_t free1:1;
689 uint64_t free2:1;
690 uint64_t free3:1;
691 uint64_t free4:1;
692 uint64_t free5:1;
693 uint64_t free6:1;
694 uint64_t free7:1;
695 uint64_t free8:1;
696 uint64_t q8_und:1;
697 uint64_t q8_coff:1;
698 uint64_t q8_perr:1;
699 uint64_t pool8th:1;
700 uint64_t paddr_e:1;
701 uint64_t reserved_50_63:14;
702#endif
703 } cn68xx;
704};
705
706union cvmx_fpa_int_sum {
707 uint64_t u64;
708 struct cvmx_fpa_int_sum_s {
709#ifdef __BIG_ENDIAN_BITFIELD
710 uint64_t reserved_50_63:14;
711 uint64_t paddr_e:1;
712 uint64_t pool8th:1;
713 uint64_t q8_perr:1;
714 uint64_t q8_coff:1;
715 uint64_t q8_und:1;
716 uint64_t free8:1;
717 uint64_t free7:1;
718 uint64_t free6:1;
719 uint64_t free5:1;
720 uint64_t free4:1;
721 uint64_t free3:1;
722 uint64_t free2:1;
723 uint64_t free1:1;
724 uint64_t free0:1;
725 uint64_t pool7th:1;
726 uint64_t pool6th:1;
727 uint64_t pool5th:1;
728 uint64_t pool4th:1;
729 uint64_t pool3th:1;
730 uint64_t pool2th:1;
731 uint64_t pool1th:1;
732 uint64_t pool0th:1;
733 uint64_t q7_perr:1;
734 uint64_t q7_coff:1;
735 uint64_t q7_und:1;
736 uint64_t q6_perr:1;
737 uint64_t q6_coff:1;
738 uint64_t q6_und:1;
739 uint64_t q5_perr:1;
740 uint64_t q5_coff:1;
741 uint64_t q5_und:1;
742 uint64_t q4_perr:1;
743 uint64_t q4_coff:1;
744 uint64_t q4_und:1;
745 uint64_t q3_perr:1;
746 uint64_t q3_coff:1;
747 uint64_t q3_und:1;
748 uint64_t q2_perr:1;
749 uint64_t q2_coff:1;
750 uint64_t q2_und:1;
751 uint64_t q1_perr:1;
752 uint64_t q1_coff:1;
753 uint64_t q1_und:1;
754 uint64_t q0_perr:1;
755 uint64_t q0_coff:1;
756 uint64_t q0_und:1;
757 uint64_t fed1_dbe:1;
758 uint64_t fed1_sbe:1;
759 uint64_t fed0_dbe:1;
760 uint64_t fed0_sbe:1;
761#else
762 uint64_t fed0_sbe:1;
763 uint64_t fed0_dbe:1;
764 uint64_t fed1_sbe:1;
765 uint64_t fed1_dbe:1;
766 uint64_t q0_und:1;
767 uint64_t q0_coff:1;
768 uint64_t q0_perr:1;
769 uint64_t q1_und:1;
770 uint64_t q1_coff:1;
771 uint64_t q1_perr:1;
772 uint64_t q2_und:1;
773 uint64_t q2_coff:1;
774 uint64_t q2_perr:1;
775 uint64_t q3_und:1;
776 uint64_t q3_coff:1;
777 uint64_t q3_perr:1;
778 uint64_t q4_und:1;
779 uint64_t q4_coff:1;
780 uint64_t q4_perr:1;
781 uint64_t q5_und:1;
782 uint64_t q5_coff:1;
783 uint64_t q5_perr:1;
784 uint64_t q6_und:1;
785 uint64_t q6_coff:1;
786 uint64_t q6_perr:1;
787 uint64_t q7_und:1;
788 uint64_t q7_coff:1;
789 uint64_t q7_perr:1;
790 uint64_t pool0th:1;
791 uint64_t pool1th:1;
792 uint64_t pool2th:1;
793 uint64_t pool3th:1;
794 uint64_t pool4th:1;
795 uint64_t pool5th:1;
796 uint64_t pool6th:1;
797 uint64_t pool7th:1;
798 uint64_t free0:1;
799 uint64_t free1:1;
800 uint64_t free2:1;
801 uint64_t free3:1;
802 uint64_t free4:1;
803 uint64_t free5:1;
804 uint64_t free6:1;
805 uint64_t free7:1;
806 uint64_t free8:1;
807 uint64_t q8_und:1;
808 uint64_t q8_coff:1;
809 uint64_t q8_perr:1;
810 uint64_t pool8th:1;
811 uint64_t paddr_e:1;
812 uint64_t reserved_50_63:14;
813#endif
814 } s;
815 struct cvmx_fpa_int_sum_cn30xx {
816#ifdef __BIG_ENDIAN_BITFIELD
817 uint64_t reserved_28_63:36;
818 uint64_t q7_perr:1;
819 uint64_t q7_coff:1;
820 uint64_t q7_und:1;
821 uint64_t q6_perr:1;
822 uint64_t q6_coff:1;
823 uint64_t q6_und:1;
824 uint64_t q5_perr:1;
825 uint64_t q5_coff:1;
826 uint64_t q5_und:1;
827 uint64_t q4_perr:1;
828 uint64_t q4_coff:1;
829 uint64_t q4_und:1;
830 uint64_t q3_perr:1;
831 uint64_t q3_coff:1;
832 uint64_t q3_und:1;
833 uint64_t q2_perr:1;
834 uint64_t q2_coff:1;
835 uint64_t q2_und:1;
836 uint64_t q1_perr:1;
837 uint64_t q1_coff:1;
838 uint64_t q1_und:1;
839 uint64_t q0_perr:1;
840 uint64_t q0_coff:1;
841 uint64_t q0_und:1;
842 uint64_t fed1_dbe:1;
843 uint64_t fed1_sbe:1;
844 uint64_t fed0_dbe:1;
845 uint64_t fed0_sbe:1;
846#else
847 uint64_t fed0_sbe:1;
848 uint64_t fed0_dbe:1;
849 uint64_t fed1_sbe:1;
850 uint64_t fed1_dbe:1;
851 uint64_t q0_und:1;
852 uint64_t q0_coff:1;
853 uint64_t q0_perr:1;
854 uint64_t q1_und:1;
855 uint64_t q1_coff:1;
856 uint64_t q1_perr:1;
857 uint64_t q2_und:1;
858 uint64_t q2_coff:1;
859 uint64_t q2_perr:1;
860 uint64_t q3_und:1;
861 uint64_t q3_coff:1;
862 uint64_t q3_perr:1;
863 uint64_t q4_und:1;
864 uint64_t q4_coff:1;
865 uint64_t q4_perr:1;
866 uint64_t q5_und:1;
867 uint64_t q5_coff:1;
868 uint64_t q5_perr:1;
869 uint64_t q6_und:1;
870 uint64_t q6_coff:1;
871 uint64_t q6_perr:1;
872 uint64_t q7_und:1;
873 uint64_t q7_coff:1;
874 uint64_t q7_perr:1;
875 uint64_t reserved_28_63:36;
876#endif
877 } cn30xx;
878 struct cvmx_fpa_int_sum_cn61xx {
879#ifdef __BIG_ENDIAN_BITFIELD
880 uint64_t reserved_50_63:14;
881 uint64_t paddr_e:1;
882 uint64_t reserved_44_48:5;
883 uint64_t free7:1;
884 uint64_t free6:1;
885 uint64_t free5:1;
886 uint64_t free4:1;
887 uint64_t free3:1;
888 uint64_t free2:1;
889 uint64_t free1:1;
890 uint64_t free0:1;
891 uint64_t pool7th:1;
892 uint64_t pool6th:1;
893 uint64_t pool5th:1;
894 uint64_t pool4th:1;
895 uint64_t pool3th:1;
896 uint64_t pool2th:1;
897 uint64_t pool1th:1;
898 uint64_t pool0th:1;
899 uint64_t q7_perr:1;
900 uint64_t q7_coff:1;
901 uint64_t q7_und:1;
902 uint64_t q6_perr:1;
903 uint64_t q6_coff:1;
904 uint64_t q6_und:1;
905 uint64_t q5_perr:1;
906 uint64_t q5_coff:1;
907 uint64_t q5_und:1;
908 uint64_t q4_perr:1;
909 uint64_t q4_coff:1;
910 uint64_t q4_und:1;
911 uint64_t q3_perr:1;
912 uint64_t q3_coff:1;
913 uint64_t q3_und:1;
914 uint64_t q2_perr:1;
915 uint64_t q2_coff:1;
916 uint64_t q2_und:1;
917 uint64_t q1_perr:1;
918 uint64_t q1_coff:1;
919 uint64_t q1_und:1;
920 uint64_t q0_perr:1;
921 uint64_t q0_coff:1;
922 uint64_t q0_und:1;
923 uint64_t fed1_dbe:1;
924 uint64_t fed1_sbe:1;
925 uint64_t fed0_dbe:1;
926 uint64_t fed0_sbe:1;
927#else
928 uint64_t fed0_sbe:1;
929 uint64_t fed0_dbe:1;
930 uint64_t fed1_sbe:1;
931 uint64_t fed1_dbe:1;
932 uint64_t q0_und:1;
933 uint64_t q0_coff:1;
934 uint64_t q0_perr:1;
935 uint64_t q1_und:1;
936 uint64_t q1_coff:1;
937 uint64_t q1_perr:1;
938 uint64_t q2_und:1;
939 uint64_t q2_coff:1;
940 uint64_t q2_perr:1;
941 uint64_t q3_und:1;
942 uint64_t q3_coff:1;
943 uint64_t q3_perr:1;
944 uint64_t q4_und:1;
945 uint64_t q4_coff:1;
946 uint64_t q4_perr:1;
947 uint64_t q5_und:1;
948 uint64_t q5_coff:1;
949 uint64_t q5_perr:1;
950 uint64_t q6_und:1;
951 uint64_t q6_coff:1;
952 uint64_t q6_perr:1;
953 uint64_t q7_und:1;
954 uint64_t q7_coff:1;
955 uint64_t q7_perr:1;
956 uint64_t pool0th:1;
957 uint64_t pool1th:1;
958 uint64_t pool2th:1;
959 uint64_t pool3th:1;
960 uint64_t pool4th:1;
961 uint64_t pool5th:1;
962 uint64_t pool6th:1;
963 uint64_t pool7th:1;
964 uint64_t free0:1;
965 uint64_t free1:1;
966 uint64_t free2:1;
967 uint64_t free3:1;
968 uint64_t free4:1;
969 uint64_t free5:1;
970 uint64_t free6:1;
971 uint64_t free7:1;
972 uint64_t reserved_44_48:5;
973 uint64_t paddr_e:1;
974 uint64_t reserved_50_63:14;
975#endif
976 } cn61xx;
977 struct cvmx_fpa_int_sum_cn63xx {
978#ifdef __BIG_ENDIAN_BITFIELD
979 uint64_t reserved_44_63:20;
980 uint64_t free7:1;
981 uint64_t free6:1;
982 uint64_t free5:1;
983 uint64_t free4:1;
984 uint64_t free3:1;
985 uint64_t free2:1;
986 uint64_t free1:1;
987 uint64_t free0:1;
988 uint64_t pool7th:1;
989 uint64_t pool6th:1;
990 uint64_t pool5th:1;
991 uint64_t pool4th:1;
992 uint64_t pool3th:1;
993 uint64_t pool2th:1;
994 uint64_t pool1th:1;
995 uint64_t pool0th:1;
996 uint64_t q7_perr:1;
997 uint64_t q7_coff:1;
998 uint64_t q7_und:1;
999 uint64_t q6_perr:1;
1000 uint64_t q6_coff:1;
1001 uint64_t q6_und:1;
1002 uint64_t q5_perr:1;
1003 uint64_t q5_coff:1;
1004 uint64_t q5_und:1;
1005 uint64_t q4_perr:1;
1006 uint64_t q4_coff:1;
1007 uint64_t q4_und:1;
1008 uint64_t q3_perr:1;
1009 uint64_t q3_coff:1;
1010 uint64_t q3_und:1;
1011 uint64_t q2_perr:1;
1012 uint64_t q2_coff:1;
1013 uint64_t q2_und:1;
1014 uint64_t q1_perr:1;
1015 uint64_t q1_coff:1;
1016 uint64_t q1_und:1;
1017 uint64_t q0_perr:1;
1018 uint64_t q0_coff:1;
1019 uint64_t q0_und:1;
1020 uint64_t fed1_dbe:1;
1021 uint64_t fed1_sbe:1;
1022 uint64_t fed0_dbe:1;
1023 uint64_t fed0_sbe:1;
1024#else
1025 uint64_t fed0_sbe:1;
1026 uint64_t fed0_dbe:1;
1027 uint64_t fed1_sbe:1;
1028 uint64_t fed1_dbe:1;
1029 uint64_t q0_und:1;
1030 uint64_t q0_coff:1;
1031 uint64_t q0_perr:1;
1032 uint64_t q1_und:1;
1033 uint64_t q1_coff:1;
1034 uint64_t q1_perr:1;
1035 uint64_t q2_und:1;
1036 uint64_t q2_coff:1;
1037 uint64_t q2_perr:1;
1038 uint64_t q3_und:1;
1039 uint64_t q3_coff:1;
1040 uint64_t q3_perr:1;
1041 uint64_t q4_und:1;
1042 uint64_t q4_coff:1;
1043 uint64_t q4_perr:1;
1044 uint64_t q5_und:1;
1045 uint64_t q5_coff:1;
1046 uint64_t q5_perr:1;
1047 uint64_t q6_und:1;
1048 uint64_t q6_coff:1;
1049 uint64_t q6_perr:1;
1050 uint64_t q7_und:1;
1051 uint64_t q7_coff:1;
1052 uint64_t q7_perr:1;
1053 uint64_t pool0th:1;
1054 uint64_t pool1th:1;
1055 uint64_t pool2th:1;
1056 uint64_t pool3th:1;
1057 uint64_t pool4th:1;
1058 uint64_t pool5th:1;
1059 uint64_t pool6th:1;
1060 uint64_t pool7th:1;
1061 uint64_t free0:1;
1062 uint64_t free1:1;
1063 uint64_t free2:1;
1064 uint64_t free3:1;
1065 uint64_t free4:1;
1066 uint64_t free5:1;
1067 uint64_t free6:1;
1068 uint64_t free7:1;
1069 uint64_t reserved_44_63:20;
1070#endif
1071 } cn63xx;
1072};
1073
1074union cvmx_fpa_packet_threshold {
1075 uint64_t u64;
1076 struct cvmx_fpa_packet_threshold_s {
1077#ifdef __BIG_ENDIAN_BITFIELD
1078 uint64_t reserved_32_63:32;
1079 uint64_t thresh:32;
1080#else
1081 uint64_t thresh:32;
1082 uint64_t reserved_32_63:32;
1083#endif
1084 } s;
1085};
1086
1087union cvmx_fpa_poolx_end_addr {
1088 uint64_t u64;
1089 struct cvmx_fpa_poolx_end_addr_s {
1090#ifdef __BIG_ENDIAN_BITFIELD
1091 uint64_t reserved_33_63:31;
1092 uint64_t addr:33;
1093#else
1094 uint64_t addr:33;
1095 uint64_t reserved_33_63:31;
1096#endif
1097 } s;
1098};
1099
1100union cvmx_fpa_poolx_start_addr {
1101 uint64_t u64;
1102 struct cvmx_fpa_poolx_start_addr_s {
1103#ifdef __BIG_ENDIAN_BITFIELD
1104 uint64_t reserved_33_63:31;
1105 uint64_t addr:33;
1106#else
1107 uint64_t addr:33;
1108 uint64_t reserved_33_63:31;
1109#endif
1110 } s;
1111};
1112
1113union cvmx_fpa_poolx_threshold {
1114 uint64_t u64;
1115 struct cvmx_fpa_poolx_threshold_s {
1116#ifdef __BIG_ENDIAN_BITFIELD
1117 uint64_t reserved_32_63:32;
1118 uint64_t thresh:32;
1119#else
1120 uint64_t thresh:32;
1121 uint64_t reserved_32_63:32;
1122#endif
1123 } s;
1124 struct cvmx_fpa_poolx_threshold_cn61xx {
1125#ifdef __BIG_ENDIAN_BITFIELD
1126 uint64_t reserved_29_63:35;
1127 uint64_t thresh:29;
1128#else
1129 uint64_t thresh:29;
1130 uint64_t reserved_29_63:35;
1131#endif
1132 } cn61xx;
1133};
1134
1135union cvmx_fpa_quex_available {
1136 uint64_t u64;
1137 struct cvmx_fpa_quex_available_s {
1138#ifdef __BIG_ENDIAN_BITFIELD
1139 uint64_t reserved_32_63:32;
1140 uint64_t que_siz:32;
1141#else
1142 uint64_t que_siz:32;
1143 uint64_t reserved_32_63:32;
1144#endif
1145 } s;
1146 struct cvmx_fpa_quex_available_cn30xx {
1147#ifdef __BIG_ENDIAN_BITFIELD
1148 uint64_t reserved_29_63:35;
1149 uint64_t que_siz:29;
1150#else
1151 uint64_t que_siz:29;
1152 uint64_t reserved_29_63:35;
1153#endif
1154 } cn30xx;
1155};
1156
1157union cvmx_fpa_quex_page_index {
1158 uint64_t u64;
1159 struct cvmx_fpa_quex_page_index_s {
1160#ifdef __BIG_ENDIAN_BITFIELD
1161 uint64_t reserved_25_63:39;
1162 uint64_t pg_num:25;
1163#else
1164 uint64_t pg_num:25;
1165 uint64_t reserved_25_63:39;
1166#endif
1167 } s;
1168};
1169
1170union cvmx_fpa_que8_page_index {
1171 uint64_t u64;
1172 struct cvmx_fpa_que8_page_index_s {
1173#ifdef __BIG_ENDIAN_BITFIELD
1174 uint64_t reserved_25_63:39;
1175 uint64_t pg_num:25;
1176#else
1177 uint64_t pg_num:25;
1178 uint64_t reserved_25_63:39;
1179#endif
1180 } s;
1181};
1182
1183union cvmx_fpa_que_act {
1184 uint64_t u64;
1185 struct cvmx_fpa_que_act_s {
1186#ifdef __BIG_ENDIAN_BITFIELD
1187 uint64_t reserved_29_63:35;
1188 uint64_t act_que:3;
1189 uint64_t act_indx:26;
1190#else
1191 uint64_t act_indx:26;
1192 uint64_t act_que:3;
1193 uint64_t reserved_29_63:35;
1194#endif
1195 } s;
1196};
1197
1198union cvmx_fpa_que_exp {
1199 uint64_t u64;
1200 struct cvmx_fpa_que_exp_s {
1201#ifdef __BIG_ENDIAN_BITFIELD
1202 uint64_t reserved_29_63:35;
1203 uint64_t exp_que:3;
1204 uint64_t exp_indx:26;
1205#else
1206 uint64_t exp_indx:26;
1207 uint64_t exp_que:3;
1208 uint64_t reserved_29_63:35;
1209#endif
1210 } s;
1211};
1212
1213union cvmx_fpa_wart_ctl {
1214 uint64_t u64;
1215 struct cvmx_fpa_wart_ctl_s {
1216#ifdef __BIG_ENDIAN_BITFIELD
1217 uint64_t reserved_16_63:48;
1218 uint64_t ctl:16;
1219#else
1220 uint64_t ctl:16;
1221 uint64_t reserved_16_63:48;
1222#endif
1223 } s;
1224};
1225
1226union cvmx_fpa_wart_status {
1227 uint64_t u64;
1228 struct cvmx_fpa_wart_status_s {
1229#ifdef __BIG_ENDIAN_BITFIELD
1230 uint64_t reserved_32_63:32;
1231 uint64_t status:32;
1232#else
1233 uint64_t status:32;
1234 uint64_t reserved_32_63:32;
1235#endif
1236 } s;
1237};
1238
1239union cvmx_fpa_wqe_threshold {
1240 uint64_t u64;
1241 struct cvmx_fpa_wqe_threshold_s {
1242#ifdef __BIG_ENDIAN_BITFIELD
1243 uint64_t reserved_32_63:32;
1244 uint64_t thresh:32;
1245#else
1246 uint64_t thresh:32;
1247 uint64_t reserved_32_63:32;
1248#endif
1249 } s;
1250};
1251
1252#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-fpa.h b/arch/mips/include/asm/octeon/cvmx-fpa.h
new file mode 100644
index 000000000..29ae63606
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-fpa.h
@@ -0,0 +1,308 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 * @file
30 *
31 * Interface to the hardware Free Pool Allocator.
32 *
33 *
34 */
35
36#ifndef __CVMX_FPA_H__
37#define __CVMX_FPA_H__
38
39#include <linux/delay.h>
40
41#include <asm/octeon/cvmx-address.h>
42#include <asm/octeon/cvmx-fpa-defs.h>
43
44#define CVMX_FPA_NUM_POOLS 8
45#define CVMX_FPA_MIN_BLOCK_SIZE 128
46#define CVMX_FPA_ALIGNMENT 128
47
48/**
49 * Structure describing the data format used for stores to the FPA.
50 */
51typedef union {
52 uint64_t u64;
53 struct {
54#ifdef __BIG_ENDIAN_BITFIELD
55 /*
56 * the (64-bit word) location in scratchpad to write
57 * to (if len != 0)
58 */
59 uint64_t scraddr:8;
60 /* the number of words in the response (0 => no response) */
61 uint64_t len:8;
62 /* the ID of the device on the non-coherent bus */
63 uint64_t did:8;
64 /*
65 * the address that will appear in the first tick on
66 * the NCB bus.
67 */
68 uint64_t addr:40;
69#else
70 uint64_t addr:40;
71 uint64_t did:8;
72 uint64_t len:8;
73 uint64_t scraddr:8;
74#endif
75 } s;
76} cvmx_fpa_iobdma_data_t;
77
78/**
79 * Structure describing the current state of a FPA pool.
80 */
81typedef struct {
82 /* Name it was created under */
83 const char *name;
84 /* Size of each block */
85 uint64_t size;
86 /* The base memory address of whole block */
87 void *base;
88 /* The number of elements in the pool at creation */
89 uint64_t starting_element_count;
90} cvmx_fpa_pool_info_t;
91
92/**
93 * Current state of all the pools. Use access functions
94 * instead of using it directly.
95 */
96extern cvmx_fpa_pool_info_t cvmx_fpa_pool_info[CVMX_FPA_NUM_POOLS];
97
98/* CSR typedefs have been moved to cvmx-csr-*.h */
99
100/**
101 * Return the name of the pool
102 *
103 * @pool: Pool to get the name of
104 * Returns The name
105 */
106static inline const char *cvmx_fpa_get_name(uint64_t pool)
107{
108 return cvmx_fpa_pool_info[pool].name;
109}
110
111/**
112 * Return the base of the pool
113 *
114 * @pool: Pool to get the base of
115 * Returns The base
116 */
117static inline void *cvmx_fpa_get_base(uint64_t pool)
118{
119 return cvmx_fpa_pool_info[pool].base;
120}
121
122/**
123 * Check if a pointer belongs to an FPA pool. Return non-zero
124 * if the supplied pointer is inside the memory controlled by
125 * an FPA pool.
126 *
127 * @pool: Pool to check
128 * @ptr: Pointer to check
129 * Returns Non-zero if pointer is in the pool. Zero if not
130 */
131static inline int cvmx_fpa_is_member(uint64_t pool, void *ptr)
132{
133 return ((ptr >= cvmx_fpa_pool_info[pool].base) &&
134 ((char *)ptr <
135 ((char *)(cvmx_fpa_pool_info[pool].base)) +
136 cvmx_fpa_pool_info[pool].size *
137 cvmx_fpa_pool_info[pool].starting_element_count));
138}
139
140/**
141 * Enable the FPA for use. Must be performed after any CSR
142 * configuration but before any other FPA functions.
143 */
144static inline void cvmx_fpa_enable(void)
145{
146 union cvmx_fpa_ctl_status status;
147
148 status.u64 = cvmx_read_csr(CVMX_FPA_CTL_STATUS);
149 if (status.s.enb) {
150 cvmx_dprintf
151 ("Warning: Enabling FPA when FPA already enabled.\n");
152 }
153
154 /*
155 * Do runtime check as we allow pass1 compiled code to run on
156 * pass2 chips.
157 */
158 if (cvmx_octeon_is_pass1()) {
159 union cvmx_fpa_fpfx_marks marks;
160 int i;
161 for (i = 1; i < 8; i++) {
162 marks.u64 =
163 cvmx_read_csr(CVMX_FPA_FPF1_MARKS + (i - 1) * 8ull);
164 marks.s.fpf_wr = 0xe0;
165 cvmx_write_csr(CVMX_FPA_FPF1_MARKS + (i - 1) * 8ull,
166 marks.u64);
167 }
168
169 /* Enforce a 10 cycle delay between config and enable */
170 __delay(10);
171 }
172
173 /* FIXME: CVMX_FPA_CTL_STATUS read is unmodelled */
174 status.u64 = 0;
175 status.s.enb = 1;
176 cvmx_write_csr(CVMX_FPA_CTL_STATUS, status.u64);
177}
178
179/**
180 * Get a new block from the FPA
181 *
182 * @pool: Pool to get the block from
183 * Returns Pointer to the block or NULL on failure
184 */
185static inline void *cvmx_fpa_alloc(uint64_t pool)
186{
187 uint64_t address =
188 cvmx_read_csr(CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_FPA, pool)));
189 if (address)
190 return cvmx_phys_to_ptr(address);
191 else
192 return NULL;
193}
194
195/**
196 * Asynchronously get a new block from the FPA
197 *
198 * @scr_addr: Local scratch address to put response in. This is a byte address,
199 * but must be 8 byte aligned.
200 * @pool: Pool to get the block from
201 */
202static inline void cvmx_fpa_async_alloc(uint64_t scr_addr, uint64_t pool)
203{
204 cvmx_fpa_iobdma_data_t data;
205
206 /*
207 * Hardware only uses 64 bit aligned locations, so convert
208 * from byte address to 64-bit index
209 */
210 data.s.scraddr = scr_addr >> 3;
211 data.s.len = 1;
212 data.s.did = CVMX_FULL_DID(CVMX_OCT_DID_FPA, pool);
213 data.s.addr = 0;
214 cvmx_send_single(data.u64);
215}
216
217/**
218 * Free a block allocated with a FPA pool. Does NOT provide memory
219 * ordering in cases where the memory block was modified by the core.
220 *
221 * @ptr: Block to free
222 * @pool: Pool to put it in
223 * @num_cache_lines:
224 * Cache lines to invalidate
225 */
226static inline void cvmx_fpa_free_nosync(void *ptr, uint64_t pool,
227 uint64_t num_cache_lines)
228{
229 cvmx_addr_t newptr;
230 newptr.u64 = cvmx_ptr_to_phys(ptr);
231 newptr.sfilldidspace.didspace =
232 CVMX_ADDR_DIDSPACE(CVMX_FULL_DID(CVMX_OCT_DID_FPA, pool));
233 /* Prevent GCC from reordering around free */
234 barrier();
235 /* value written is number of cache lines not written back */
236 cvmx_write_io(newptr.u64, num_cache_lines);
237}
238
239/**
240 * Free a block allocated with a FPA pool. Provides required memory
241 * ordering in cases where memory block was modified by core.
242 *
243 * @ptr: Block to free
244 * @pool: Pool to put it in
245 * @num_cache_lines:
246 * Cache lines to invalidate
247 */
248static inline void cvmx_fpa_free(void *ptr, uint64_t pool,
249 uint64_t num_cache_lines)
250{
251 cvmx_addr_t newptr;
252 newptr.u64 = cvmx_ptr_to_phys(ptr);
253 newptr.sfilldidspace.didspace =
254 CVMX_ADDR_DIDSPACE(CVMX_FULL_DID(CVMX_OCT_DID_FPA, pool));
255 /*
256 * Make sure that any previous writes to memory go out before
257 * we free this buffer. This also serves as a barrier to
258 * prevent GCC from reordering operations to after the
259 * free.
260 */
261 CVMX_SYNCWS;
262 /* value written is number of cache lines not written back */
263 cvmx_write_io(newptr.u64, num_cache_lines);
264}
265
266/**
267 * Setup a FPA pool to control a new block of memory.
268 * This can only be called once per pool. Make sure proper
269 * locking enforces this.
270 *
271 * @pool: Pool to initialize
272 * 0 <= pool < 8
273 * @name: Constant character string to name this pool.
274 * String is not copied.
275 * @buffer: Pointer to the block of memory to use. This must be
276 * accessible by all processors and external hardware.
277 * @block_size: Size for each block controlled by the FPA
278 * @num_blocks: Number of blocks
279 *
280 * Returns 0 on Success,
281 * -1 on failure
282 */
283extern int cvmx_fpa_setup_pool(uint64_t pool, const char *name, void *buffer,
284 uint64_t block_size, uint64_t num_blocks);
285
286/**
287 * Shutdown a Memory pool and validate that it had all of
288 * the buffers originally placed in it. This should only be
289 * called by one processor after all hardware has finished
290 * using the pool.
291 *
292 * @pool: Pool to shutdown
293 * Returns Zero on success
294 * - Positive is count of missing buffers
295 * - Negative is too many buffers or corrupted pointers
296 */
297extern uint64_t cvmx_fpa_shutdown_pool(uint64_t pool);
298
299/**
300 * Get the size of blocks controlled by the pool
301 * This is resolved to a constant at compile time.
302 *
303 * @pool: Pool to access
304 * Returns Size of the block in bytes
305 */
306uint64_t cvmx_fpa_get_block_size(uint64_t pool);
307
308#endif /* __CVM_FPA_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-gmxx-defs.h b/arch/mips/include/asm/octeon/cvmx-gmxx-defs.h
new file mode 100644
index 000000000..bdba676f1
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-gmxx-defs.h
@@ -0,0 +1,2259 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (C) 2003-2018 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_GMXX_DEFS_H__
29#define __CVMX_GMXX_DEFS_H__
30
31static inline uint64_t CVMX_GMXX_HG2_CONTROL(unsigned long block_id)
32{
33 switch (cvmx_get_octeon_family()) {
34 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
35 return CVMX_ADD_IO_SEG(0x0001180008000550ull) + (block_id) * 0x1000000ull;
36 }
37 return CVMX_ADD_IO_SEG(0x0001180008000550ull) + (block_id) * 0x8000000ull;
38}
39
40static inline uint64_t CVMX_GMXX_INF_MODE(unsigned long block_id)
41{
42 switch (cvmx_get_octeon_family()) {
43 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
44 return CVMX_ADD_IO_SEG(0x00011800080007F8ull) + (block_id) * 0x1000000ull;
45 }
46 return CVMX_ADD_IO_SEG(0x00011800080007F8ull) + (block_id) * 0x8000000ull;
47}
48
49static inline uint64_t CVMX_GMXX_PRTX_CFG(unsigned long offset, unsigned long block_id)
50{
51 switch (cvmx_get_octeon_family()) {
52 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
53 return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x0ull) * 2048;
54 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
55 return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
56 }
57 return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
58}
59
60static inline uint64_t CVMX_GMXX_RXX_ADR_CAM0(unsigned long offset, unsigned long block_id)
61{
62 switch (cvmx_get_octeon_family()) {
63 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
64 return CVMX_ADD_IO_SEG(0x0001180008000180ull) + ((offset) + (block_id) * 0x0ull) * 2048;
65 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
66 return CVMX_ADD_IO_SEG(0x0001180008000180ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
67 }
68 return CVMX_ADD_IO_SEG(0x0001180008000180ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
69}
70
71static inline uint64_t CVMX_GMXX_RXX_ADR_CAM1(unsigned long offset, unsigned long block_id)
72{
73 switch (cvmx_get_octeon_family()) {
74 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
75 return CVMX_ADD_IO_SEG(0x0001180008000188ull) + ((offset) + (block_id) * 0x0ull) * 2048;
76 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
77 return CVMX_ADD_IO_SEG(0x0001180008000188ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
78 }
79 return CVMX_ADD_IO_SEG(0x0001180008000188ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
80}
81
82static inline uint64_t CVMX_GMXX_RXX_ADR_CAM2(unsigned long offset, unsigned long block_id)
83{
84 switch (cvmx_get_octeon_family()) {
85 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
86 return CVMX_ADD_IO_SEG(0x0001180008000190ull) + ((offset) + (block_id) * 0x0ull) * 2048;
87 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
88 return CVMX_ADD_IO_SEG(0x0001180008000190ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
89 }
90 return CVMX_ADD_IO_SEG(0x0001180008000190ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
91}
92
93static inline uint64_t CVMX_GMXX_RXX_ADR_CAM3(unsigned long offset, unsigned long block_id)
94{
95 switch (cvmx_get_octeon_family()) {
96 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
97 return CVMX_ADD_IO_SEG(0x0001180008000198ull) + ((offset) + (block_id) * 0x0ull) * 2048;
98 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
99 return CVMX_ADD_IO_SEG(0x0001180008000198ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
100 }
101 return CVMX_ADD_IO_SEG(0x0001180008000198ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
102}
103
104static inline uint64_t CVMX_GMXX_RXX_ADR_CAM4(unsigned long offset, unsigned long block_id)
105{
106 switch (cvmx_get_octeon_family()) {
107 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
108 return CVMX_ADD_IO_SEG(0x00011800080001A0ull) + ((offset) + (block_id) * 0x0ull) * 2048;
109 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
110 return CVMX_ADD_IO_SEG(0x00011800080001A0ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
111 }
112 return CVMX_ADD_IO_SEG(0x00011800080001A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
113}
114
115static inline uint64_t CVMX_GMXX_RXX_ADR_CAM5(unsigned long offset, unsigned long block_id)
116{
117 switch (cvmx_get_octeon_family()) {
118 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
119 return CVMX_ADD_IO_SEG(0x00011800080001A8ull) + ((offset) + (block_id) * 0x0ull) * 2048;
120 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
121 return CVMX_ADD_IO_SEG(0x00011800080001A8ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
122 }
123 return CVMX_ADD_IO_SEG(0x00011800080001A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
124}
125
126static inline uint64_t CVMX_GMXX_RXX_ADR_CAM_EN(unsigned long offset, unsigned long block_id)
127{
128 switch (cvmx_get_octeon_family()) {
129 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
130 return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x0ull) * 2048;
131 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
132 return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
133 }
134 return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
135}
136
137static inline uint64_t CVMX_GMXX_RXX_ADR_CTL(unsigned long offset, unsigned long block_id)
138{
139 switch (cvmx_get_octeon_family()) {
140 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
141 return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x0ull) * 2048;
142 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
143 return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
144 }
145 return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
146}
147
148static inline uint64_t CVMX_GMXX_RXX_FRM_CTL(unsigned long offset, unsigned long block_id)
149{
150 switch (cvmx_get_octeon_family()) {
151 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
152 return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x0ull) * 2048;
153 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
154 return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
155 }
156 return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
157}
158
159#define CVMX_GMXX_RXX_FRM_MAX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000030ull) + (((offset) & 3) + ((block_id) & 1) * 0x10000ull) * 2048)
160#define CVMX_GMXX_RXX_FRM_MIN(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000028ull) + (((offset) & 3) + ((block_id) & 1) * 0x10000ull) * 2048)
161
162static inline uint64_t CVMX_GMXX_RXX_INT_EN(unsigned long offset, unsigned long block_id)
163{
164 switch (cvmx_get_octeon_family()) {
165 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
166 return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x0ull) * 2048;
167 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
168 return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
169 }
170 return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
171}
172
173static inline uint64_t CVMX_GMXX_RXX_INT_REG(unsigned long offset, unsigned long block_id)
174{
175 switch (cvmx_get_octeon_family()) {
176 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
177 return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x0ull) * 2048;
178 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
179 return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
180 }
181 return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
182}
183
184static inline uint64_t CVMX_GMXX_RXX_JABBER(unsigned long offset, unsigned long block_id)
185{
186 switch (cvmx_get_octeon_family()) {
187 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
188 return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x0ull) * 2048;
189 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
190 return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
191 }
192 return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
193}
194
195#define CVMX_GMXX_RXX_RX_INBND(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000060ull) + (((offset) & 3) + ((block_id) & 1) * 0x10000ull) * 2048)
196
197static inline uint64_t CVMX_GMXX_RX_PRTS(unsigned long block_id)
198{
199 switch (cvmx_get_octeon_family()) {
200 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
201 return CVMX_ADD_IO_SEG(0x0001180008000410ull) + (block_id) * 0x1000000ull;
202 }
203 return CVMX_ADD_IO_SEG(0x0001180008000410ull) + (block_id) * 0x8000000ull;
204}
205
206static inline uint64_t CVMX_GMXX_RX_XAUI_CTL(unsigned long block_id)
207{
208 switch (cvmx_get_octeon_family()) {
209 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
210 return CVMX_ADD_IO_SEG(0x0001180008000530ull) + (block_id) * 0x1000000ull;
211 }
212 return CVMX_ADD_IO_SEG(0x0001180008000530ull) + (block_id) * 0x8000000ull;
213}
214
215static inline uint64_t CVMX_GMXX_SMACX(unsigned long offset, unsigned long block_id)
216{
217 switch (cvmx_get_octeon_family()) {
218 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
219 return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x0ull) * 2048;
220 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
221 return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
222 }
223 return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
224}
225
226static inline uint64_t CVMX_GMXX_TXX_BURST(unsigned long offset, unsigned long block_id)
227{
228 switch (cvmx_get_octeon_family()) {
229 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
230 return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x0ull) * 2048;
231 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
232 return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
233 }
234 return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
235}
236
237#define CVMX_GMXX_TXX_CLK(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000208ull) + (((offset) & 3) + ((block_id) & 1) * 0x10000ull) * 2048)
238static inline uint64_t CVMX_GMXX_TXX_CTL(unsigned long offset, unsigned long block_id)
239{
240 switch (cvmx_get_octeon_family()) {
241 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
242 return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x0ull) * 2048;
243 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
244 return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
245 }
246 return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
247}
248
249static inline uint64_t CVMX_GMXX_TXX_PAUSE_PKT_INTERVAL(unsigned long offset, unsigned long block_id)
250{
251 switch (cvmx_get_octeon_family()) {
252 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
253 return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x0ull) * 2048;
254 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
255 return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
256 }
257 return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
258}
259
260static inline uint64_t CVMX_GMXX_TXX_PAUSE_PKT_TIME(unsigned long offset, unsigned long block_id)
261{
262 switch (cvmx_get_octeon_family()) {
263 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
264 return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x0ull) * 2048;
265 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
266 return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
267 }
268 return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
269}
270
271static inline uint64_t CVMX_GMXX_TXX_SLOT(unsigned long offset, unsigned long block_id)
272{
273 switch (cvmx_get_octeon_family()) {
274 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
275 return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x0ull) * 2048;
276 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
277 return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
278 }
279 return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
280}
281
282static inline uint64_t CVMX_GMXX_TXX_THRESH(unsigned long offset, unsigned long block_id)
283{
284 switch (cvmx_get_octeon_family()) {
285 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
286 return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x0ull) * 2048;
287 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
288 return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
289 }
290 return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
291}
292
293static inline uint64_t CVMX_GMXX_TX_INT_EN(unsigned long block_id)
294{
295 switch (cvmx_get_octeon_family()) {
296 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
297 return CVMX_ADD_IO_SEG(0x0001180008000508ull) + (block_id) * 0x1000000ull;
298 }
299 return CVMX_ADD_IO_SEG(0x0001180008000508ull) + (block_id) * 0x8000000ull;
300}
301
302static inline uint64_t CVMX_GMXX_TX_INT_REG(unsigned long block_id)
303{
304 switch (cvmx_get_octeon_family()) {
305 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
306 return CVMX_ADD_IO_SEG(0x0001180008000500ull) + (block_id) * 0x1000000ull;
307 }
308 return CVMX_ADD_IO_SEG(0x0001180008000500ull) + (block_id) * 0x8000000ull;
309}
310
311static inline uint64_t CVMX_GMXX_TX_OVR_BP(unsigned long block_id)
312{
313 switch (cvmx_get_octeon_family()) {
314 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
315 return CVMX_ADD_IO_SEG(0x00011800080004C8ull) + (block_id) * 0x1000000ull;
316 }
317 return CVMX_ADD_IO_SEG(0x00011800080004C8ull) + (block_id) * 0x8000000ull;
318}
319
320static inline uint64_t CVMX_GMXX_TX_PRTS(unsigned long block_id)
321{
322 switch (cvmx_get_octeon_family()) {
323 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
324 return CVMX_ADD_IO_SEG(0x0001180008000480ull) + (block_id) * 0x1000000ull;
325 }
326 return CVMX_ADD_IO_SEG(0x0001180008000480ull) + (block_id) * 0x8000000ull;
327}
328
329#define CVMX_GMXX_TX_SPI_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800080004C0ull) + ((block_id) & 1) * 0x8000000ull)
330#define CVMX_GMXX_TX_SPI_MAX(block_id) (CVMX_ADD_IO_SEG(0x00011800080004B0ull) + ((block_id) & 1) * 0x8000000ull)
331#define CVMX_GMXX_TX_SPI_THRESH(block_id) (CVMX_ADD_IO_SEG(0x00011800080004B8ull) + ((block_id) & 1) * 0x8000000ull)
332static inline uint64_t CVMX_GMXX_TX_XAUI_CTL(unsigned long block_id)
333{
334 switch (cvmx_get_octeon_family()) {
335 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
336 return CVMX_ADD_IO_SEG(0x0001180008000528ull) + (block_id) * 0x1000000ull;
337 }
338 return CVMX_ADD_IO_SEG(0x0001180008000528ull) + (block_id) * 0x8000000ull;
339}
340
341void __cvmx_interrupt_gmxx_enable(int interface);
342
343union cvmx_gmxx_hg2_control {
344 uint64_t u64;
345 struct cvmx_gmxx_hg2_control_s {
346#ifdef __BIG_ENDIAN_BITFIELD
347 uint64_t reserved_19_63:45;
348 uint64_t hg2tx_en:1;
349 uint64_t hg2rx_en:1;
350 uint64_t phys_en:1;
351 uint64_t logl_en:16;
352#else
353 uint64_t logl_en:16;
354 uint64_t phys_en:1;
355 uint64_t hg2rx_en:1;
356 uint64_t hg2tx_en:1;
357 uint64_t reserved_19_63:45;
358#endif
359 } s;
360};
361
362union cvmx_gmxx_inf_mode {
363 uint64_t u64;
364 struct cvmx_gmxx_inf_mode_s {
365#ifdef __BIG_ENDIAN_BITFIELD
366 uint64_t reserved_20_63:44;
367 uint64_t rate:4;
368 uint64_t reserved_12_15:4;
369 uint64_t speed:4;
370 uint64_t reserved_7_7:1;
371 uint64_t mode:3;
372 uint64_t reserved_3_3:1;
373 uint64_t p0mii:1;
374 uint64_t en:1;
375 uint64_t type:1;
376#else
377 uint64_t type:1;
378 uint64_t en:1;
379 uint64_t p0mii:1;
380 uint64_t reserved_3_3:1;
381 uint64_t mode:3;
382 uint64_t reserved_7_7:1;
383 uint64_t speed:4;
384 uint64_t reserved_12_15:4;
385 uint64_t rate:4;
386 uint64_t reserved_20_63:44;
387#endif
388 } s;
389 struct cvmx_gmxx_inf_mode_cn30xx {
390#ifdef __BIG_ENDIAN_BITFIELD
391 uint64_t reserved_3_63:61;
392 uint64_t p0mii:1;
393 uint64_t en:1;
394 uint64_t type:1;
395#else
396 uint64_t type:1;
397 uint64_t en:1;
398 uint64_t p0mii:1;
399 uint64_t reserved_3_63:61;
400#endif
401 } cn30xx;
402 struct cvmx_gmxx_inf_mode_cn31xx {
403#ifdef __BIG_ENDIAN_BITFIELD
404 uint64_t reserved_2_63:62;
405 uint64_t en:1;
406 uint64_t type:1;
407#else
408 uint64_t type:1;
409 uint64_t en:1;
410 uint64_t reserved_2_63:62;
411#endif
412 } cn31xx;
413 struct cvmx_gmxx_inf_mode_cn52xx {
414#ifdef __BIG_ENDIAN_BITFIELD
415 uint64_t reserved_10_63:54;
416 uint64_t speed:2;
417 uint64_t reserved_6_7:2;
418 uint64_t mode:2;
419 uint64_t reserved_2_3:2;
420 uint64_t en:1;
421 uint64_t type:1;
422#else
423 uint64_t type:1;
424 uint64_t en:1;
425 uint64_t reserved_2_3:2;
426 uint64_t mode:2;
427 uint64_t reserved_6_7:2;
428 uint64_t speed:2;
429 uint64_t reserved_10_63:54;
430#endif
431 } cn52xx;
432 struct cvmx_gmxx_inf_mode_cn61xx {
433#ifdef __BIG_ENDIAN_BITFIELD
434 uint64_t reserved_12_63:52;
435 uint64_t speed:4;
436 uint64_t reserved_5_7:3;
437 uint64_t mode:1;
438 uint64_t reserved_2_3:2;
439 uint64_t en:1;
440 uint64_t type:1;
441#else
442 uint64_t type:1;
443 uint64_t en:1;
444 uint64_t reserved_2_3:2;
445 uint64_t mode:1;
446 uint64_t reserved_5_7:3;
447 uint64_t speed:4;
448 uint64_t reserved_12_63:52;
449#endif
450 } cn61xx;
451 struct cvmx_gmxx_inf_mode_cn66xx {
452#ifdef __BIG_ENDIAN_BITFIELD
453 uint64_t reserved_20_63:44;
454 uint64_t rate:4;
455 uint64_t reserved_12_15:4;
456 uint64_t speed:4;
457 uint64_t reserved_5_7:3;
458 uint64_t mode:1;
459 uint64_t reserved_2_3:2;
460 uint64_t en:1;
461 uint64_t type:1;
462#else
463 uint64_t type:1;
464 uint64_t en:1;
465 uint64_t reserved_2_3:2;
466 uint64_t mode:1;
467 uint64_t reserved_5_7:3;
468 uint64_t speed:4;
469 uint64_t reserved_12_15:4;
470 uint64_t rate:4;
471 uint64_t reserved_20_63:44;
472#endif
473 } cn66xx;
474 struct cvmx_gmxx_inf_mode_cn68xx {
475#ifdef __BIG_ENDIAN_BITFIELD
476 uint64_t reserved_12_63:52;
477 uint64_t speed:4;
478 uint64_t reserved_7_7:1;
479 uint64_t mode:3;
480 uint64_t reserved_2_3:2;
481 uint64_t en:1;
482 uint64_t type:1;
483#else
484 uint64_t type:1;
485 uint64_t en:1;
486 uint64_t reserved_2_3:2;
487 uint64_t mode:3;
488 uint64_t reserved_7_7:1;
489 uint64_t speed:4;
490 uint64_t reserved_12_63:52;
491#endif
492 } cn68xx;
493};
494
495union cvmx_gmxx_prtx_cfg {
496 uint64_t u64;
497 struct cvmx_gmxx_prtx_cfg_s {
498#ifdef __BIG_ENDIAN_BITFIELD
499 uint64_t reserved_22_63:42;
500 uint64_t pknd:6;
501 uint64_t reserved_14_15:2;
502 uint64_t tx_idle:1;
503 uint64_t rx_idle:1;
504 uint64_t reserved_9_11:3;
505 uint64_t speed_msb:1;
506 uint64_t reserved_4_7:4;
507 uint64_t slottime:1;
508 uint64_t duplex:1;
509 uint64_t speed:1;
510 uint64_t en:1;
511#else
512 uint64_t en:1;
513 uint64_t speed:1;
514 uint64_t duplex:1;
515 uint64_t slottime:1;
516 uint64_t reserved_4_7:4;
517 uint64_t speed_msb:1;
518 uint64_t reserved_9_11:3;
519 uint64_t rx_idle:1;
520 uint64_t tx_idle:1;
521 uint64_t reserved_14_15:2;
522 uint64_t pknd:6;
523 uint64_t reserved_22_63:42;
524#endif
525 } s;
526 struct cvmx_gmxx_prtx_cfg_cn30xx {
527#ifdef __BIG_ENDIAN_BITFIELD
528 uint64_t reserved_4_63:60;
529 uint64_t slottime:1;
530 uint64_t duplex:1;
531 uint64_t speed:1;
532 uint64_t en:1;
533#else
534 uint64_t en:1;
535 uint64_t speed:1;
536 uint64_t duplex:1;
537 uint64_t slottime:1;
538 uint64_t reserved_4_63:60;
539#endif
540 } cn30xx;
541 struct cvmx_gmxx_prtx_cfg_cn52xx {
542#ifdef __BIG_ENDIAN_BITFIELD
543 uint64_t reserved_14_63:50;
544 uint64_t tx_idle:1;
545 uint64_t rx_idle:1;
546 uint64_t reserved_9_11:3;
547 uint64_t speed_msb:1;
548 uint64_t reserved_4_7:4;
549 uint64_t slottime:1;
550 uint64_t duplex:1;
551 uint64_t speed:1;
552 uint64_t en:1;
553#else
554 uint64_t en:1;
555 uint64_t speed:1;
556 uint64_t duplex:1;
557 uint64_t slottime:1;
558 uint64_t reserved_4_7:4;
559 uint64_t speed_msb:1;
560 uint64_t reserved_9_11:3;
561 uint64_t rx_idle:1;
562 uint64_t tx_idle:1;
563 uint64_t reserved_14_63:50;
564#endif
565 } cn52xx;
566};
567
568union cvmx_gmxx_rxx_adr_ctl {
569 uint64_t u64;
570 struct cvmx_gmxx_rxx_adr_ctl_s {
571#ifdef __BIG_ENDIAN_BITFIELD
572 uint64_t reserved_4_63:60;
573 uint64_t cam_mode:1;
574 uint64_t mcst:2;
575 uint64_t bcst:1;
576#else
577 uint64_t bcst:1;
578 uint64_t mcst:2;
579 uint64_t cam_mode:1;
580 uint64_t reserved_4_63:60;
581#endif
582 } s;
583};
584
585union cvmx_gmxx_rxx_frm_ctl {
586 uint64_t u64;
587 struct cvmx_gmxx_rxx_frm_ctl_s {
588#ifdef __BIG_ENDIAN_BITFIELD
589 uint64_t reserved_13_63:51;
590 uint64_t ptp_mode:1;
591 uint64_t reserved_11_11:1;
592 uint64_t null_dis:1;
593 uint64_t pre_align:1;
594 uint64_t pad_len:1;
595 uint64_t vlan_len:1;
596 uint64_t pre_free:1;
597 uint64_t ctl_smac:1;
598 uint64_t ctl_mcst:1;
599 uint64_t ctl_bck:1;
600 uint64_t ctl_drp:1;
601 uint64_t pre_strp:1;
602 uint64_t pre_chk:1;
603#else
604 uint64_t pre_chk:1;
605 uint64_t pre_strp:1;
606 uint64_t ctl_drp:1;
607 uint64_t ctl_bck:1;
608 uint64_t ctl_mcst:1;
609 uint64_t ctl_smac:1;
610 uint64_t pre_free:1;
611 uint64_t vlan_len:1;
612 uint64_t pad_len:1;
613 uint64_t pre_align:1;
614 uint64_t null_dis:1;
615 uint64_t reserved_11_11:1;
616 uint64_t ptp_mode:1;
617 uint64_t reserved_13_63:51;
618#endif
619 } s;
620 struct cvmx_gmxx_rxx_frm_ctl_cn30xx {
621#ifdef __BIG_ENDIAN_BITFIELD
622 uint64_t reserved_9_63:55;
623 uint64_t pad_len:1;
624 uint64_t vlan_len:1;
625 uint64_t pre_free:1;
626 uint64_t ctl_smac:1;
627 uint64_t ctl_mcst:1;
628 uint64_t ctl_bck:1;
629 uint64_t ctl_drp:1;
630 uint64_t pre_strp:1;
631 uint64_t pre_chk:1;
632#else
633 uint64_t pre_chk:1;
634 uint64_t pre_strp:1;
635 uint64_t ctl_drp:1;
636 uint64_t ctl_bck:1;
637 uint64_t ctl_mcst:1;
638 uint64_t ctl_smac:1;
639 uint64_t pre_free:1;
640 uint64_t vlan_len:1;
641 uint64_t pad_len:1;
642 uint64_t reserved_9_63:55;
643#endif
644 } cn30xx;
645 struct cvmx_gmxx_rxx_frm_ctl_cn31xx {
646#ifdef __BIG_ENDIAN_BITFIELD
647 uint64_t reserved_8_63:56;
648 uint64_t vlan_len:1;
649 uint64_t pre_free:1;
650 uint64_t ctl_smac:1;
651 uint64_t ctl_mcst:1;
652 uint64_t ctl_bck:1;
653 uint64_t ctl_drp:1;
654 uint64_t pre_strp:1;
655 uint64_t pre_chk:1;
656#else
657 uint64_t pre_chk:1;
658 uint64_t pre_strp:1;
659 uint64_t ctl_drp:1;
660 uint64_t ctl_bck:1;
661 uint64_t ctl_mcst:1;
662 uint64_t ctl_smac:1;
663 uint64_t pre_free:1;
664 uint64_t vlan_len:1;
665 uint64_t reserved_8_63:56;
666#endif
667 } cn31xx;
668 struct cvmx_gmxx_rxx_frm_ctl_cn50xx {
669#ifdef __BIG_ENDIAN_BITFIELD
670 uint64_t reserved_11_63:53;
671 uint64_t null_dis:1;
672 uint64_t pre_align:1;
673 uint64_t reserved_7_8:2;
674 uint64_t pre_free:1;
675 uint64_t ctl_smac:1;
676 uint64_t ctl_mcst:1;
677 uint64_t ctl_bck:1;
678 uint64_t ctl_drp:1;
679 uint64_t pre_strp:1;
680 uint64_t pre_chk:1;
681#else
682 uint64_t pre_chk:1;
683 uint64_t pre_strp:1;
684 uint64_t ctl_drp:1;
685 uint64_t ctl_bck:1;
686 uint64_t ctl_mcst:1;
687 uint64_t ctl_smac:1;
688 uint64_t pre_free:1;
689 uint64_t reserved_7_8:2;
690 uint64_t pre_align:1;
691 uint64_t null_dis:1;
692 uint64_t reserved_11_63:53;
693#endif
694 } cn50xx;
695 struct cvmx_gmxx_rxx_frm_ctl_cn56xxp1 {
696#ifdef __BIG_ENDIAN_BITFIELD
697 uint64_t reserved_10_63:54;
698 uint64_t pre_align:1;
699 uint64_t reserved_7_8:2;
700 uint64_t pre_free:1;
701 uint64_t ctl_smac:1;
702 uint64_t ctl_mcst:1;
703 uint64_t ctl_bck:1;
704 uint64_t ctl_drp:1;
705 uint64_t pre_strp:1;
706 uint64_t pre_chk:1;
707#else
708 uint64_t pre_chk:1;
709 uint64_t pre_strp:1;
710 uint64_t ctl_drp:1;
711 uint64_t ctl_bck:1;
712 uint64_t ctl_mcst:1;
713 uint64_t ctl_smac:1;
714 uint64_t pre_free:1;
715 uint64_t reserved_7_8:2;
716 uint64_t pre_align:1;
717 uint64_t reserved_10_63:54;
718#endif
719 } cn56xxp1;
720 struct cvmx_gmxx_rxx_frm_ctl_cn58xx {
721#ifdef __BIG_ENDIAN_BITFIELD
722 uint64_t reserved_11_63:53;
723 uint64_t null_dis:1;
724 uint64_t pre_align:1;
725 uint64_t pad_len:1;
726 uint64_t vlan_len:1;
727 uint64_t pre_free:1;
728 uint64_t ctl_smac:1;
729 uint64_t ctl_mcst:1;
730 uint64_t ctl_bck:1;
731 uint64_t ctl_drp:1;
732 uint64_t pre_strp:1;
733 uint64_t pre_chk:1;
734#else
735 uint64_t pre_chk:1;
736 uint64_t pre_strp:1;
737 uint64_t ctl_drp:1;
738 uint64_t ctl_bck:1;
739 uint64_t ctl_mcst:1;
740 uint64_t ctl_smac:1;
741 uint64_t pre_free:1;
742 uint64_t vlan_len:1;
743 uint64_t pad_len:1;
744 uint64_t pre_align:1;
745 uint64_t null_dis:1;
746 uint64_t reserved_11_63:53;
747#endif
748 } cn58xx;
749 struct cvmx_gmxx_rxx_frm_ctl_cn61xx {
750#ifdef __BIG_ENDIAN_BITFIELD
751 uint64_t reserved_13_63:51;
752 uint64_t ptp_mode:1;
753 uint64_t reserved_11_11:1;
754 uint64_t null_dis:1;
755 uint64_t pre_align:1;
756 uint64_t reserved_7_8:2;
757 uint64_t pre_free:1;
758 uint64_t ctl_smac:1;
759 uint64_t ctl_mcst:1;
760 uint64_t ctl_bck:1;
761 uint64_t ctl_drp:1;
762 uint64_t pre_strp:1;
763 uint64_t pre_chk:1;
764#else
765 uint64_t pre_chk:1;
766 uint64_t pre_strp:1;
767 uint64_t ctl_drp:1;
768 uint64_t ctl_bck:1;
769 uint64_t ctl_mcst:1;
770 uint64_t ctl_smac:1;
771 uint64_t pre_free:1;
772 uint64_t reserved_7_8:2;
773 uint64_t pre_align:1;
774 uint64_t null_dis:1;
775 uint64_t reserved_11_11:1;
776 uint64_t ptp_mode:1;
777 uint64_t reserved_13_63:51;
778#endif
779 } cn61xx;
780};
781
782union cvmx_gmxx_rxx_frm_max {
783 uint64_t u64;
784 struct cvmx_gmxx_rxx_frm_max_s {
785#ifdef __BIG_ENDIAN_BITFIELD
786 uint64_t reserved_16_63:48;
787 uint64_t len:16;
788#else
789 uint64_t len:16;
790 uint64_t reserved_16_63:48;
791#endif
792 } s;
793};
794
795union cvmx_gmxx_rxx_frm_min {
796 uint64_t u64;
797 struct cvmx_gmxx_rxx_frm_min_s {
798#ifdef __BIG_ENDIAN_BITFIELD
799 uint64_t reserved_16_63:48;
800 uint64_t len:16;
801#else
802 uint64_t len:16;
803 uint64_t reserved_16_63:48;
804#endif
805 } s;
806};
807
808union cvmx_gmxx_rxx_int_en {
809 uint64_t u64;
810 struct cvmx_gmxx_rxx_int_en_s {
811#ifdef __BIG_ENDIAN_BITFIELD
812 uint64_t reserved_29_63:35;
813 uint64_t hg2cc:1;
814 uint64_t hg2fld:1;
815 uint64_t undat:1;
816 uint64_t uneop:1;
817 uint64_t unsop:1;
818 uint64_t bad_term:1;
819 uint64_t bad_seq:1;
820 uint64_t rem_fault:1;
821 uint64_t loc_fault:1;
822 uint64_t pause_drp:1;
823 uint64_t phy_dupx:1;
824 uint64_t phy_spd:1;
825 uint64_t phy_link:1;
826 uint64_t ifgerr:1;
827 uint64_t coldet:1;
828 uint64_t falerr:1;
829 uint64_t rsverr:1;
830 uint64_t pcterr:1;
831 uint64_t ovrerr:1;
832 uint64_t niberr:1;
833 uint64_t skperr:1;
834 uint64_t rcverr:1;
835 uint64_t lenerr:1;
836 uint64_t alnerr:1;
837 uint64_t fcserr:1;
838 uint64_t jabber:1;
839 uint64_t maxerr:1;
840 uint64_t carext:1;
841 uint64_t minerr:1;
842#else
843 uint64_t minerr:1;
844 uint64_t carext:1;
845 uint64_t maxerr:1;
846 uint64_t jabber:1;
847 uint64_t fcserr:1;
848 uint64_t alnerr:1;
849 uint64_t lenerr:1;
850 uint64_t rcverr:1;
851 uint64_t skperr:1;
852 uint64_t niberr:1;
853 uint64_t ovrerr:1;
854 uint64_t pcterr:1;
855 uint64_t rsverr:1;
856 uint64_t falerr:1;
857 uint64_t coldet:1;
858 uint64_t ifgerr:1;
859 uint64_t phy_link:1;
860 uint64_t phy_spd:1;
861 uint64_t phy_dupx:1;
862 uint64_t pause_drp:1;
863 uint64_t loc_fault:1;
864 uint64_t rem_fault:1;
865 uint64_t bad_seq:1;
866 uint64_t bad_term:1;
867 uint64_t unsop:1;
868 uint64_t uneop:1;
869 uint64_t undat:1;
870 uint64_t hg2fld:1;
871 uint64_t hg2cc:1;
872 uint64_t reserved_29_63:35;
873#endif
874 } s;
875 struct cvmx_gmxx_rxx_int_en_cn30xx {
876#ifdef __BIG_ENDIAN_BITFIELD
877 uint64_t reserved_19_63:45;
878 uint64_t phy_dupx:1;
879 uint64_t phy_spd:1;
880 uint64_t phy_link:1;
881 uint64_t ifgerr:1;
882 uint64_t coldet:1;
883 uint64_t falerr:1;
884 uint64_t rsverr:1;
885 uint64_t pcterr:1;
886 uint64_t ovrerr:1;
887 uint64_t niberr:1;
888 uint64_t skperr:1;
889 uint64_t rcverr:1;
890 uint64_t lenerr:1;
891 uint64_t alnerr:1;
892 uint64_t fcserr:1;
893 uint64_t jabber:1;
894 uint64_t maxerr:1;
895 uint64_t carext:1;
896 uint64_t minerr:1;
897#else
898 uint64_t minerr:1;
899 uint64_t carext:1;
900 uint64_t maxerr:1;
901 uint64_t jabber:1;
902 uint64_t fcserr:1;
903 uint64_t alnerr:1;
904 uint64_t lenerr:1;
905 uint64_t rcverr:1;
906 uint64_t skperr:1;
907 uint64_t niberr:1;
908 uint64_t ovrerr:1;
909 uint64_t pcterr:1;
910 uint64_t rsverr:1;
911 uint64_t falerr:1;
912 uint64_t coldet:1;
913 uint64_t ifgerr:1;
914 uint64_t phy_link:1;
915 uint64_t phy_spd:1;
916 uint64_t phy_dupx:1;
917 uint64_t reserved_19_63:45;
918#endif
919 } cn30xx;
920 struct cvmx_gmxx_rxx_int_en_cn50xx {
921#ifdef __BIG_ENDIAN_BITFIELD
922 uint64_t reserved_20_63:44;
923 uint64_t pause_drp:1;
924 uint64_t phy_dupx:1;
925 uint64_t phy_spd:1;
926 uint64_t phy_link:1;
927 uint64_t ifgerr:1;
928 uint64_t coldet:1;
929 uint64_t falerr:1;
930 uint64_t rsverr:1;
931 uint64_t pcterr:1;
932 uint64_t ovrerr:1;
933 uint64_t niberr:1;
934 uint64_t skperr:1;
935 uint64_t rcverr:1;
936 uint64_t reserved_6_6:1;
937 uint64_t alnerr:1;
938 uint64_t fcserr:1;
939 uint64_t jabber:1;
940 uint64_t reserved_2_2:1;
941 uint64_t carext:1;
942 uint64_t reserved_0_0:1;
943#else
944 uint64_t reserved_0_0:1;
945 uint64_t carext:1;
946 uint64_t reserved_2_2:1;
947 uint64_t jabber:1;
948 uint64_t fcserr:1;
949 uint64_t alnerr:1;
950 uint64_t reserved_6_6:1;
951 uint64_t rcverr:1;
952 uint64_t skperr:1;
953 uint64_t niberr:1;
954 uint64_t ovrerr:1;
955 uint64_t pcterr:1;
956 uint64_t rsverr:1;
957 uint64_t falerr:1;
958 uint64_t coldet:1;
959 uint64_t ifgerr:1;
960 uint64_t phy_link:1;
961 uint64_t phy_spd:1;
962 uint64_t phy_dupx:1;
963 uint64_t pause_drp:1;
964 uint64_t reserved_20_63:44;
965#endif
966 } cn50xx;
967 struct cvmx_gmxx_rxx_int_en_cn52xx {
968#ifdef __BIG_ENDIAN_BITFIELD
969 uint64_t reserved_29_63:35;
970 uint64_t hg2cc:1;
971 uint64_t hg2fld:1;
972 uint64_t undat:1;
973 uint64_t uneop:1;
974 uint64_t unsop:1;
975 uint64_t bad_term:1;
976 uint64_t bad_seq:1;
977 uint64_t rem_fault:1;
978 uint64_t loc_fault:1;
979 uint64_t pause_drp:1;
980 uint64_t reserved_16_18:3;
981 uint64_t ifgerr:1;
982 uint64_t coldet:1;
983 uint64_t falerr:1;
984 uint64_t rsverr:1;
985 uint64_t pcterr:1;
986 uint64_t ovrerr:1;
987 uint64_t reserved_9_9:1;
988 uint64_t skperr:1;
989 uint64_t rcverr:1;
990 uint64_t reserved_5_6:2;
991 uint64_t fcserr:1;
992 uint64_t jabber:1;
993 uint64_t reserved_2_2:1;
994 uint64_t carext:1;
995 uint64_t reserved_0_0:1;
996#else
997 uint64_t reserved_0_0:1;
998 uint64_t carext:1;
999 uint64_t reserved_2_2:1;
1000 uint64_t jabber:1;
1001 uint64_t fcserr:1;
1002 uint64_t reserved_5_6:2;
1003 uint64_t rcverr:1;
1004 uint64_t skperr:1;
1005 uint64_t reserved_9_9:1;
1006 uint64_t ovrerr:1;
1007 uint64_t pcterr:1;
1008 uint64_t rsverr:1;
1009 uint64_t falerr:1;
1010 uint64_t coldet:1;
1011 uint64_t ifgerr:1;
1012 uint64_t reserved_16_18:3;
1013 uint64_t pause_drp:1;
1014 uint64_t loc_fault:1;
1015 uint64_t rem_fault:1;
1016 uint64_t bad_seq:1;
1017 uint64_t bad_term:1;
1018 uint64_t unsop:1;
1019 uint64_t uneop:1;
1020 uint64_t undat:1;
1021 uint64_t hg2fld:1;
1022 uint64_t hg2cc:1;
1023 uint64_t reserved_29_63:35;
1024#endif
1025 } cn52xx;
1026 struct cvmx_gmxx_rxx_int_en_cn56xxp1 {
1027#ifdef __BIG_ENDIAN_BITFIELD
1028 uint64_t reserved_27_63:37;
1029 uint64_t undat:1;
1030 uint64_t uneop:1;
1031 uint64_t unsop:1;
1032 uint64_t bad_term:1;
1033 uint64_t bad_seq:1;
1034 uint64_t rem_fault:1;
1035 uint64_t loc_fault:1;
1036 uint64_t pause_drp:1;
1037 uint64_t reserved_16_18:3;
1038 uint64_t ifgerr:1;
1039 uint64_t coldet:1;
1040 uint64_t falerr:1;
1041 uint64_t rsverr:1;
1042 uint64_t pcterr:1;
1043 uint64_t ovrerr:1;
1044 uint64_t reserved_9_9:1;
1045 uint64_t skperr:1;
1046 uint64_t rcverr:1;
1047 uint64_t reserved_5_6:2;
1048 uint64_t fcserr:1;
1049 uint64_t jabber:1;
1050 uint64_t reserved_2_2:1;
1051 uint64_t carext:1;
1052 uint64_t reserved_0_0:1;
1053#else
1054 uint64_t reserved_0_0:1;
1055 uint64_t carext:1;
1056 uint64_t reserved_2_2:1;
1057 uint64_t jabber:1;
1058 uint64_t fcserr:1;
1059 uint64_t reserved_5_6:2;
1060 uint64_t rcverr:1;
1061 uint64_t skperr:1;
1062 uint64_t reserved_9_9:1;
1063 uint64_t ovrerr:1;
1064 uint64_t pcterr:1;
1065 uint64_t rsverr:1;
1066 uint64_t falerr:1;
1067 uint64_t coldet:1;
1068 uint64_t ifgerr:1;
1069 uint64_t reserved_16_18:3;
1070 uint64_t pause_drp:1;
1071 uint64_t loc_fault:1;
1072 uint64_t rem_fault:1;
1073 uint64_t bad_seq:1;
1074 uint64_t bad_term:1;
1075 uint64_t unsop:1;
1076 uint64_t uneop:1;
1077 uint64_t undat:1;
1078 uint64_t reserved_27_63:37;
1079#endif
1080 } cn56xxp1;
1081 struct cvmx_gmxx_rxx_int_en_cn58xx {
1082#ifdef __BIG_ENDIAN_BITFIELD
1083 uint64_t reserved_20_63:44;
1084 uint64_t pause_drp:1;
1085 uint64_t phy_dupx:1;
1086 uint64_t phy_spd:1;
1087 uint64_t phy_link:1;
1088 uint64_t ifgerr:1;
1089 uint64_t coldet:1;
1090 uint64_t falerr:1;
1091 uint64_t rsverr:1;
1092 uint64_t pcterr:1;
1093 uint64_t ovrerr:1;
1094 uint64_t niberr:1;
1095 uint64_t skperr:1;
1096 uint64_t rcverr:1;
1097 uint64_t lenerr:1;
1098 uint64_t alnerr:1;
1099 uint64_t fcserr:1;
1100 uint64_t jabber:1;
1101 uint64_t maxerr:1;
1102 uint64_t carext:1;
1103 uint64_t minerr:1;
1104#else
1105 uint64_t minerr:1;
1106 uint64_t carext:1;
1107 uint64_t maxerr:1;
1108 uint64_t jabber:1;
1109 uint64_t fcserr:1;
1110 uint64_t alnerr:1;
1111 uint64_t lenerr:1;
1112 uint64_t rcverr:1;
1113 uint64_t skperr:1;
1114 uint64_t niberr:1;
1115 uint64_t ovrerr:1;
1116 uint64_t pcterr:1;
1117 uint64_t rsverr:1;
1118 uint64_t falerr:1;
1119 uint64_t coldet:1;
1120 uint64_t ifgerr:1;
1121 uint64_t phy_link:1;
1122 uint64_t phy_spd:1;
1123 uint64_t phy_dupx:1;
1124 uint64_t pause_drp:1;
1125 uint64_t reserved_20_63:44;
1126#endif
1127 } cn58xx;
1128 struct cvmx_gmxx_rxx_int_en_cn61xx {
1129#ifdef __BIG_ENDIAN_BITFIELD
1130 uint64_t reserved_29_63:35;
1131 uint64_t hg2cc:1;
1132 uint64_t hg2fld:1;
1133 uint64_t undat:1;
1134 uint64_t uneop:1;
1135 uint64_t unsop:1;
1136 uint64_t bad_term:1;
1137 uint64_t bad_seq:1;
1138 uint64_t rem_fault:1;
1139 uint64_t loc_fault:1;
1140 uint64_t pause_drp:1;
1141 uint64_t reserved_16_18:3;
1142 uint64_t ifgerr:1;
1143 uint64_t coldet:1;
1144 uint64_t falerr:1;
1145 uint64_t rsverr:1;
1146 uint64_t pcterr:1;
1147 uint64_t ovrerr:1;
1148 uint64_t reserved_9_9:1;
1149 uint64_t skperr:1;
1150 uint64_t rcverr:1;
1151 uint64_t reserved_5_6:2;
1152 uint64_t fcserr:1;
1153 uint64_t jabber:1;
1154 uint64_t reserved_2_2:1;
1155 uint64_t carext:1;
1156 uint64_t minerr:1;
1157#else
1158 uint64_t minerr:1;
1159 uint64_t carext:1;
1160 uint64_t reserved_2_2:1;
1161 uint64_t jabber:1;
1162 uint64_t fcserr:1;
1163 uint64_t reserved_5_6:2;
1164 uint64_t rcverr:1;
1165 uint64_t skperr:1;
1166 uint64_t reserved_9_9:1;
1167 uint64_t ovrerr:1;
1168 uint64_t pcterr:1;
1169 uint64_t rsverr:1;
1170 uint64_t falerr:1;
1171 uint64_t coldet:1;
1172 uint64_t ifgerr:1;
1173 uint64_t reserved_16_18:3;
1174 uint64_t pause_drp:1;
1175 uint64_t loc_fault:1;
1176 uint64_t rem_fault:1;
1177 uint64_t bad_seq:1;
1178 uint64_t bad_term:1;
1179 uint64_t unsop:1;
1180 uint64_t uneop:1;
1181 uint64_t undat:1;
1182 uint64_t hg2fld:1;
1183 uint64_t hg2cc:1;
1184 uint64_t reserved_29_63:35;
1185#endif
1186 } cn61xx;
1187};
1188
1189union cvmx_gmxx_rxx_int_reg {
1190 uint64_t u64;
1191 struct cvmx_gmxx_rxx_int_reg_s {
1192#ifdef __BIG_ENDIAN_BITFIELD
1193 uint64_t reserved_29_63:35;
1194 uint64_t hg2cc:1;
1195 uint64_t hg2fld:1;
1196 uint64_t undat:1;
1197 uint64_t uneop:1;
1198 uint64_t unsop:1;
1199 uint64_t bad_term:1;
1200 uint64_t bad_seq:1;
1201 uint64_t rem_fault:1;
1202 uint64_t loc_fault:1;
1203 uint64_t pause_drp:1;
1204 uint64_t phy_dupx:1;
1205 uint64_t phy_spd:1;
1206 uint64_t phy_link:1;
1207 uint64_t ifgerr:1;
1208 uint64_t coldet:1;
1209 uint64_t falerr:1;
1210 uint64_t rsverr:1;
1211 uint64_t pcterr:1;
1212 uint64_t ovrerr:1;
1213 uint64_t niberr:1;
1214 uint64_t skperr:1;
1215 uint64_t rcverr:1;
1216 uint64_t lenerr:1;
1217 uint64_t alnerr:1;
1218 uint64_t fcserr:1;
1219 uint64_t jabber:1;
1220 uint64_t maxerr:1;
1221 uint64_t carext:1;
1222 uint64_t minerr:1;
1223#else
1224 uint64_t minerr:1;
1225 uint64_t carext:1;
1226 uint64_t maxerr:1;
1227 uint64_t jabber:1;
1228 uint64_t fcserr:1;
1229 uint64_t alnerr:1;
1230 uint64_t lenerr:1;
1231 uint64_t rcverr:1;
1232 uint64_t skperr:1;
1233 uint64_t niberr:1;
1234 uint64_t ovrerr:1;
1235 uint64_t pcterr:1;
1236 uint64_t rsverr:1;
1237 uint64_t falerr:1;
1238 uint64_t coldet:1;
1239 uint64_t ifgerr:1;
1240 uint64_t phy_link:1;
1241 uint64_t phy_spd:1;
1242 uint64_t phy_dupx:1;
1243 uint64_t pause_drp:1;
1244 uint64_t loc_fault:1;
1245 uint64_t rem_fault:1;
1246 uint64_t bad_seq:1;
1247 uint64_t bad_term:1;
1248 uint64_t unsop:1;
1249 uint64_t uneop:1;
1250 uint64_t undat:1;
1251 uint64_t hg2fld:1;
1252 uint64_t hg2cc:1;
1253 uint64_t reserved_29_63:35;
1254#endif
1255 } s;
1256 struct cvmx_gmxx_rxx_int_reg_cn30xx {
1257#ifdef __BIG_ENDIAN_BITFIELD
1258 uint64_t reserved_19_63:45;
1259 uint64_t phy_dupx:1;
1260 uint64_t phy_spd:1;
1261 uint64_t phy_link:1;
1262 uint64_t ifgerr:1;
1263 uint64_t coldet:1;
1264 uint64_t falerr:1;
1265 uint64_t rsverr:1;
1266 uint64_t pcterr:1;
1267 uint64_t ovrerr:1;
1268 uint64_t niberr:1;
1269 uint64_t skperr:1;
1270 uint64_t rcverr:1;
1271 uint64_t lenerr:1;
1272 uint64_t alnerr:1;
1273 uint64_t fcserr:1;
1274 uint64_t jabber:1;
1275 uint64_t maxerr:1;
1276 uint64_t carext:1;
1277 uint64_t minerr:1;
1278#else
1279 uint64_t minerr:1;
1280 uint64_t carext:1;
1281 uint64_t maxerr:1;
1282 uint64_t jabber:1;
1283 uint64_t fcserr:1;
1284 uint64_t alnerr:1;
1285 uint64_t lenerr:1;
1286 uint64_t rcverr:1;
1287 uint64_t skperr:1;
1288 uint64_t niberr:1;
1289 uint64_t ovrerr:1;
1290 uint64_t pcterr:1;
1291 uint64_t rsverr:1;
1292 uint64_t falerr:1;
1293 uint64_t coldet:1;
1294 uint64_t ifgerr:1;
1295 uint64_t phy_link:1;
1296 uint64_t phy_spd:1;
1297 uint64_t phy_dupx:1;
1298 uint64_t reserved_19_63:45;
1299#endif
1300 } cn30xx;
1301 struct cvmx_gmxx_rxx_int_reg_cn50xx {
1302#ifdef __BIG_ENDIAN_BITFIELD
1303 uint64_t reserved_20_63:44;
1304 uint64_t pause_drp:1;
1305 uint64_t phy_dupx:1;
1306 uint64_t phy_spd:1;
1307 uint64_t phy_link:1;
1308 uint64_t ifgerr:1;
1309 uint64_t coldet:1;
1310 uint64_t falerr:1;
1311 uint64_t rsverr:1;
1312 uint64_t pcterr:1;
1313 uint64_t ovrerr:1;
1314 uint64_t niberr:1;
1315 uint64_t skperr:1;
1316 uint64_t rcverr:1;
1317 uint64_t reserved_6_6:1;
1318 uint64_t alnerr:1;
1319 uint64_t fcserr:1;
1320 uint64_t jabber:1;
1321 uint64_t reserved_2_2:1;
1322 uint64_t carext:1;
1323 uint64_t reserved_0_0:1;
1324#else
1325 uint64_t reserved_0_0:1;
1326 uint64_t carext:1;
1327 uint64_t reserved_2_2:1;
1328 uint64_t jabber:1;
1329 uint64_t fcserr:1;
1330 uint64_t alnerr:1;
1331 uint64_t reserved_6_6:1;
1332 uint64_t rcverr:1;
1333 uint64_t skperr:1;
1334 uint64_t niberr:1;
1335 uint64_t ovrerr:1;
1336 uint64_t pcterr:1;
1337 uint64_t rsverr:1;
1338 uint64_t falerr:1;
1339 uint64_t coldet:1;
1340 uint64_t ifgerr:1;
1341 uint64_t phy_link:1;
1342 uint64_t phy_spd:1;
1343 uint64_t phy_dupx:1;
1344 uint64_t pause_drp:1;
1345 uint64_t reserved_20_63:44;
1346#endif
1347 } cn50xx;
1348 struct cvmx_gmxx_rxx_int_reg_cn52xx {
1349#ifdef __BIG_ENDIAN_BITFIELD
1350 uint64_t reserved_29_63:35;
1351 uint64_t hg2cc:1;
1352 uint64_t hg2fld:1;
1353 uint64_t undat:1;
1354 uint64_t uneop:1;
1355 uint64_t unsop:1;
1356 uint64_t bad_term:1;
1357 uint64_t bad_seq:1;
1358 uint64_t rem_fault:1;
1359 uint64_t loc_fault:1;
1360 uint64_t pause_drp:1;
1361 uint64_t reserved_16_18:3;
1362 uint64_t ifgerr:1;
1363 uint64_t coldet:1;
1364 uint64_t falerr:1;
1365 uint64_t rsverr:1;
1366 uint64_t pcterr:1;
1367 uint64_t ovrerr:1;
1368 uint64_t reserved_9_9:1;
1369 uint64_t skperr:1;
1370 uint64_t rcverr:1;
1371 uint64_t reserved_5_6:2;
1372 uint64_t fcserr:1;
1373 uint64_t jabber:1;
1374 uint64_t reserved_2_2:1;
1375 uint64_t carext:1;
1376 uint64_t reserved_0_0:1;
1377#else
1378 uint64_t reserved_0_0:1;
1379 uint64_t carext:1;
1380 uint64_t reserved_2_2:1;
1381 uint64_t jabber:1;
1382 uint64_t fcserr:1;
1383 uint64_t reserved_5_6:2;
1384 uint64_t rcverr:1;
1385 uint64_t skperr:1;
1386 uint64_t reserved_9_9:1;
1387 uint64_t ovrerr:1;
1388 uint64_t pcterr:1;
1389 uint64_t rsverr:1;
1390 uint64_t falerr:1;
1391 uint64_t coldet:1;
1392 uint64_t ifgerr:1;
1393 uint64_t reserved_16_18:3;
1394 uint64_t pause_drp:1;
1395 uint64_t loc_fault:1;
1396 uint64_t rem_fault:1;
1397 uint64_t bad_seq:1;
1398 uint64_t bad_term:1;
1399 uint64_t unsop:1;
1400 uint64_t uneop:1;
1401 uint64_t undat:1;
1402 uint64_t hg2fld:1;
1403 uint64_t hg2cc:1;
1404 uint64_t reserved_29_63:35;
1405#endif
1406 } cn52xx;
1407 struct cvmx_gmxx_rxx_int_reg_cn56xxp1 {
1408#ifdef __BIG_ENDIAN_BITFIELD
1409 uint64_t reserved_27_63:37;
1410 uint64_t undat:1;
1411 uint64_t uneop:1;
1412 uint64_t unsop:1;
1413 uint64_t bad_term:1;
1414 uint64_t bad_seq:1;
1415 uint64_t rem_fault:1;
1416 uint64_t loc_fault:1;
1417 uint64_t pause_drp:1;
1418 uint64_t reserved_16_18:3;
1419 uint64_t ifgerr:1;
1420 uint64_t coldet:1;
1421 uint64_t falerr:1;
1422 uint64_t rsverr:1;
1423 uint64_t pcterr:1;
1424 uint64_t ovrerr:1;
1425 uint64_t reserved_9_9:1;
1426 uint64_t skperr:1;
1427 uint64_t rcverr:1;
1428 uint64_t reserved_5_6:2;
1429 uint64_t fcserr:1;
1430 uint64_t jabber:1;
1431 uint64_t reserved_2_2:1;
1432 uint64_t carext:1;
1433 uint64_t reserved_0_0:1;
1434#else
1435 uint64_t reserved_0_0:1;
1436 uint64_t carext:1;
1437 uint64_t reserved_2_2:1;
1438 uint64_t jabber:1;
1439 uint64_t fcserr:1;
1440 uint64_t reserved_5_6:2;
1441 uint64_t rcverr:1;
1442 uint64_t skperr:1;
1443 uint64_t reserved_9_9:1;
1444 uint64_t ovrerr:1;
1445 uint64_t pcterr:1;
1446 uint64_t rsverr:1;
1447 uint64_t falerr:1;
1448 uint64_t coldet:1;
1449 uint64_t ifgerr:1;
1450 uint64_t reserved_16_18:3;
1451 uint64_t pause_drp:1;
1452 uint64_t loc_fault:1;
1453 uint64_t rem_fault:1;
1454 uint64_t bad_seq:1;
1455 uint64_t bad_term:1;
1456 uint64_t unsop:1;
1457 uint64_t uneop:1;
1458 uint64_t undat:1;
1459 uint64_t reserved_27_63:37;
1460#endif
1461 } cn56xxp1;
1462 struct cvmx_gmxx_rxx_int_reg_cn58xx {
1463#ifdef __BIG_ENDIAN_BITFIELD
1464 uint64_t reserved_20_63:44;
1465 uint64_t pause_drp:1;
1466 uint64_t phy_dupx:1;
1467 uint64_t phy_spd:1;
1468 uint64_t phy_link:1;
1469 uint64_t ifgerr:1;
1470 uint64_t coldet:1;
1471 uint64_t falerr:1;
1472 uint64_t rsverr:1;
1473 uint64_t pcterr:1;
1474 uint64_t ovrerr:1;
1475 uint64_t niberr:1;
1476 uint64_t skperr:1;
1477 uint64_t rcverr:1;
1478 uint64_t lenerr:1;
1479 uint64_t alnerr:1;
1480 uint64_t fcserr:1;
1481 uint64_t jabber:1;
1482 uint64_t maxerr:1;
1483 uint64_t carext:1;
1484 uint64_t minerr:1;
1485#else
1486 uint64_t minerr:1;
1487 uint64_t carext:1;
1488 uint64_t maxerr:1;
1489 uint64_t jabber:1;
1490 uint64_t fcserr:1;
1491 uint64_t alnerr:1;
1492 uint64_t lenerr:1;
1493 uint64_t rcverr:1;
1494 uint64_t skperr:1;
1495 uint64_t niberr:1;
1496 uint64_t ovrerr:1;
1497 uint64_t pcterr:1;
1498 uint64_t rsverr:1;
1499 uint64_t falerr:1;
1500 uint64_t coldet:1;
1501 uint64_t ifgerr:1;
1502 uint64_t phy_link:1;
1503 uint64_t phy_spd:1;
1504 uint64_t phy_dupx:1;
1505 uint64_t pause_drp:1;
1506 uint64_t reserved_20_63:44;
1507#endif
1508 } cn58xx;
1509 struct cvmx_gmxx_rxx_int_reg_cn61xx {
1510#ifdef __BIG_ENDIAN_BITFIELD
1511 uint64_t reserved_29_63:35;
1512 uint64_t hg2cc:1;
1513 uint64_t hg2fld:1;
1514 uint64_t undat:1;
1515 uint64_t uneop:1;
1516 uint64_t unsop:1;
1517 uint64_t bad_term:1;
1518 uint64_t bad_seq:1;
1519 uint64_t rem_fault:1;
1520 uint64_t loc_fault:1;
1521 uint64_t pause_drp:1;
1522 uint64_t reserved_16_18:3;
1523 uint64_t ifgerr:1;
1524 uint64_t coldet:1;
1525 uint64_t falerr:1;
1526 uint64_t rsverr:1;
1527 uint64_t pcterr:1;
1528 uint64_t ovrerr:1;
1529 uint64_t reserved_9_9:1;
1530 uint64_t skperr:1;
1531 uint64_t rcverr:1;
1532 uint64_t reserved_5_6:2;
1533 uint64_t fcserr:1;
1534 uint64_t jabber:1;
1535 uint64_t reserved_2_2:1;
1536 uint64_t carext:1;
1537 uint64_t minerr:1;
1538#else
1539 uint64_t minerr:1;
1540 uint64_t carext:1;
1541 uint64_t reserved_2_2:1;
1542 uint64_t jabber:1;
1543 uint64_t fcserr:1;
1544 uint64_t reserved_5_6:2;
1545 uint64_t rcverr:1;
1546 uint64_t skperr:1;
1547 uint64_t reserved_9_9:1;
1548 uint64_t ovrerr:1;
1549 uint64_t pcterr:1;
1550 uint64_t rsverr:1;
1551 uint64_t falerr:1;
1552 uint64_t coldet:1;
1553 uint64_t ifgerr:1;
1554 uint64_t reserved_16_18:3;
1555 uint64_t pause_drp:1;
1556 uint64_t loc_fault:1;
1557 uint64_t rem_fault:1;
1558 uint64_t bad_seq:1;
1559 uint64_t bad_term:1;
1560 uint64_t unsop:1;
1561 uint64_t uneop:1;
1562 uint64_t undat:1;
1563 uint64_t hg2fld:1;
1564 uint64_t hg2cc:1;
1565 uint64_t reserved_29_63:35;
1566#endif
1567 } cn61xx;
1568};
1569
1570union cvmx_gmxx_rxx_jabber {
1571 uint64_t u64;
1572 struct cvmx_gmxx_rxx_jabber_s {
1573#ifdef __BIG_ENDIAN_BITFIELD
1574 uint64_t reserved_16_63:48;
1575 uint64_t cnt:16;
1576#else
1577 uint64_t cnt:16;
1578 uint64_t reserved_16_63:48;
1579#endif
1580 } s;
1581};
1582
1583union cvmx_gmxx_rxx_rx_inbnd {
1584 uint64_t u64;
1585 struct cvmx_gmxx_rxx_rx_inbnd_s {
1586#ifdef __BIG_ENDIAN_BITFIELD
1587 uint64_t reserved_4_63:60;
1588 uint64_t duplex:1;
1589 uint64_t speed:2;
1590 uint64_t status:1;
1591#else
1592 uint64_t status:1;
1593 uint64_t speed:2;
1594 uint64_t duplex:1;
1595 uint64_t reserved_4_63:60;
1596#endif
1597 } s;
1598};
1599
1600union cvmx_gmxx_rx_prts {
1601 uint64_t u64;
1602 struct cvmx_gmxx_rx_prts_s {
1603#ifdef __BIG_ENDIAN_BITFIELD
1604 uint64_t reserved_3_63:61;
1605 uint64_t prts:3;
1606#else
1607 uint64_t prts:3;
1608 uint64_t reserved_3_63:61;
1609#endif
1610 } s;
1611};
1612
1613union cvmx_gmxx_rx_xaui_ctl {
1614 uint64_t u64;
1615 struct cvmx_gmxx_rx_xaui_ctl_s {
1616#ifdef __BIG_ENDIAN_BITFIELD
1617 uint64_t reserved_2_63:62;
1618 uint64_t status:2;
1619#else
1620 uint64_t status:2;
1621 uint64_t reserved_2_63:62;
1622#endif
1623 } s;
1624};
1625
1626union cvmx_gmxx_txx_thresh {
1627 uint64_t u64;
1628 struct cvmx_gmxx_txx_thresh_s {
1629#ifdef __BIG_ENDIAN_BITFIELD
1630 uint64_t reserved_10_63:54;
1631 uint64_t cnt:10;
1632#else
1633 uint64_t cnt:10;
1634 uint64_t reserved_10_63:54;
1635#endif
1636 } s;
1637 struct cvmx_gmxx_txx_thresh_cn30xx {
1638#ifdef __BIG_ENDIAN_BITFIELD
1639 uint64_t reserved_7_63:57;
1640 uint64_t cnt:7;
1641#else
1642 uint64_t cnt:7;
1643 uint64_t reserved_7_63:57;
1644#endif
1645 } cn30xx;
1646 struct cvmx_gmxx_txx_thresh_cn38xx {
1647#ifdef __BIG_ENDIAN_BITFIELD
1648 uint64_t reserved_9_63:55;
1649 uint64_t cnt:9;
1650#else
1651 uint64_t cnt:9;
1652 uint64_t reserved_9_63:55;
1653#endif
1654 } cn38xx;
1655};
1656
1657union cvmx_gmxx_tx_int_en {
1658 uint64_t u64;
1659 struct cvmx_gmxx_tx_int_en_s {
1660#ifdef __BIG_ENDIAN_BITFIELD
1661 uint64_t reserved_25_63:39;
1662 uint64_t xchange:1;
1663 uint64_t ptp_lost:4;
1664 uint64_t late_col:4;
1665 uint64_t xsdef:4;
1666 uint64_t xscol:4;
1667 uint64_t reserved_6_7:2;
1668 uint64_t undflw:4;
1669 uint64_t reserved_1_1:1;
1670 uint64_t pko_nxa:1;
1671#else
1672 uint64_t pko_nxa:1;
1673 uint64_t reserved_1_1:1;
1674 uint64_t undflw:4;
1675 uint64_t reserved_6_7:2;
1676 uint64_t xscol:4;
1677 uint64_t xsdef:4;
1678 uint64_t late_col:4;
1679 uint64_t ptp_lost:4;
1680 uint64_t xchange:1;
1681 uint64_t reserved_25_63:39;
1682#endif
1683 } s;
1684 struct cvmx_gmxx_tx_int_en_cn30xx {
1685#ifdef __BIG_ENDIAN_BITFIELD
1686 uint64_t reserved_19_63:45;
1687 uint64_t late_col:3;
1688 uint64_t reserved_15_15:1;
1689 uint64_t xsdef:3;
1690 uint64_t reserved_11_11:1;
1691 uint64_t xscol:3;
1692 uint64_t reserved_5_7:3;
1693 uint64_t undflw:3;
1694 uint64_t reserved_1_1:1;
1695 uint64_t pko_nxa:1;
1696#else
1697 uint64_t pko_nxa:1;
1698 uint64_t reserved_1_1:1;
1699 uint64_t undflw:3;
1700 uint64_t reserved_5_7:3;
1701 uint64_t xscol:3;
1702 uint64_t reserved_11_11:1;
1703 uint64_t xsdef:3;
1704 uint64_t reserved_15_15:1;
1705 uint64_t late_col:3;
1706 uint64_t reserved_19_63:45;
1707#endif
1708 } cn30xx;
1709 struct cvmx_gmxx_tx_int_en_cn31xx {
1710#ifdef __BIG_ENDIAN_BITFIELD
1711 uint64_t reserved_15_63:49;
1712 uint64_t xsdef:3;
1713 uint64_t reserved_11_11:1;
1714 uint64_t xscol:3;
1715 uint64_t reserved_5_7:3;
1716 uint64_t undflw:3;
1717 uint64_t reserved_1_1:1;
1718 uint64_t pko_nxa:1;
1719#else
1720 uint64_t pko_nxa:1;
1721 uint64_t reserved_1_1:1;
1722 uint64_t undflw:3;
1723 uint64_t reserved_5_7:3;
1724 uint64_t xscol:3;
1725 uint64_t reserved_11_11:1;
1726 uint64_t xsdef:3;
1727 uint64_t reserved_15_63:49;
1728#endif
1729 } cn31xx;
1730 struct cvmx_gmxx_tx_int_en_cn38xx {
1731#ifdef __BIG_ENDIAN_BITFIELD
1732 uint64_t reserved_20_63:44;
1733 uint64_t late_col:4;
1734 uint64_t xsdef:4;
1735 uint64_t xscol:4;
1736 uint64_t reserved_6_7:2;
1737 uint64_t undflw:4;
1738 uint64_t ncb_nxa:1;
1739 uint64_t pko_nxa:1;
1740#else
1741 uint64_t pko_nxa:1;
1742 uint64_t ncb_nxa:1;
1743 uint64_t undflw:4;
1744 uint64_t reserved_6_7:2;
1745 uint64_t xscol:4;
1746 uint64_t xsdef:4;
1747 uint64_t late_col:4;
1748 uint64_t reserved_20_63:44;
1749#endif
1750 } cn38xx;
1751 struct cvmx_gmxx_tx_int_en_cn38xxp2 {
1752#ifdef __BIG_ENDIAN_BITFIELD
1753 uint64_t reserved_16_63:48;
1754 uint64_t xsdef:4;
1755 uint64_t xscol:4;
1756 uint64_t reserved_6_7:2;
1757 uint64_t undflw:4;
1758 uint64_t ncb_nxa:1;
1759 uint64_t pko_nxa:1;
1760#else
1761 uint64_t pko_nxa:1;
1762 uint64_t ncb_nxa:1;
1763 uint64_t undflw:4;
1764 uint64_t reserved_6_7:2;
1765 uint64_t xscol:4;
1766 uint64_t xsdef:4;
1767 uint64_t reserved_16_63:48;
1768#endif
1769 } cn38xxp2;
1770 struct cvmx_gmxx_tx_int_en_cn52xx {
1771#ifdef __BIG_ENDIAN_BITFIELD
1772 uint64_t reserved_20_63:44;
1773 uint64_t late_col:4;
1774 uint64_t xsdef:4;
1775 uint64_t xscol:4;
1776 uint64_t reserved_6_7:2;
1777 uint64_t undflw:4;
1778 uint64_t reserved_1_1:1;
1779 uint64_t pko_nxa:1;
1780#else
1781 uint64_t pko_nxa:1;
1782 uint64_t reserved_1_1:1;
1783 uint64_t undflw:4;
1784 uint64_t reserved_6_7:2;
1785 uint64_t xscol:4;
1786 uint64_t xsdef:4;
1787 uint64_t late_col:4;
1788 uint64_t reserved_20_63:44;
1789#endif
1790 } cn52xx;
1791 struct cvmx_gmxx_tx_int_en_cn63xx {
1792#ifdef __BIG_ENDIAN_BITFIELD
1793 uint64_t reserved_24_63:40;
1794 uint64_t ptp_lost:4;
1795 uint64_t late_col:4;
1796 uint64_t xsdef:4;
1797 uint64_t xscol:4;
1798 uint64_t reserved_6_7:2;
1799 uint64_t undflw:4;
1800 uint64_t reserved_1_1:1;
1801 uint64_t pko_nxa:1;
1802#else
1803 uint64_t pko_nxa:1;
1804 uint64_t reserved_1_1:1;
1805 uint64_t undflw:4;
1806 uint64_t reserved_6_7:2;
1807 uint64_t xscol:4;
1808 uint64_t xsdef:4;
1809 uint64_t late_col:4;
1810 uint64_t ptp_lost:4;
1811 uint64_t reserved_24_63:40;
1812#endif
1813 } cn63xx;
1814 struct cvmx_gmxx_tx_int_en_cn68xx {
1815#ifdef __BIG_ENDIAN_BITFIELD
1816 uint64_t reserved_25_63:39;
1817 uint64_t xchange:1;
1818 uint64_t ptp_lost:4;
1819 uint64_t late_col:4;
1820 uint64_t xsdef:4;
1821 uint64_t xscol:4;
1822 uint64_t reserved_6_7:2;
1823 uint64_t undflw:4;
1824 uint64_t pko_nxp:1;
1825 uint64_t pko_nxa:1;
1826#else
1827 uint64_t pko_nxa:1;
1828 uint64_t pko_nxp:1;
1829 uint64_t undflw:4;
1830 uint64_t reserved_6_7:2;
1831 uint64_t xscol:4;
1832 uint64_t xsdef:4;
1833 uint64_t late_col:4;
1834 uint64_t ptp_lost:4;
1835 uint64_t xchange:1;
1836 uint64_t reserved_25_63:39;
1837#endif
1838 } cn68xx;
1839 struct cvmx_gmxx_tx_int_en_cnf71xx {
1840#ifdef __BIG_ENDIAN_BITFIELD
1841 uint64_t reserved_25_63:39;
1842 uint64_t xchange:1;
1843 uint64_t reserved_22_23:2;
1844 uint64_t ptp_lost:2;
1845 uint64_t reserved_18_19:2;
1846 uint64_t late_col:2;
1847 uint64_t reserved_14_15:2;
1848 uint64_t xsdef:2;
1849 uint64_t reserved_10_11:2;
1850 uint64_t xscol:2;
1851 uint64_t reserved_4_7:4;
1852 uint64_t undflw:2;
1853 uint64_t reserved_1_1:1;
1854 uint64_t pko_nxa:1;
1855#else
1856 uint64_t pko_nxa:1;
1857 uint64_t reserved_1_1:1;
1858 uint64_t undflw:2;
1859 uint64_t reserved_4_7:4;
1860 uint64_t xscol:2;
1861 uint64_t reserved_10_11:2;
1862 uint64_t xsdef:2;
1863 uint64_t reserved_14_15:2;
1864 uint64_t late_col:2;
1865 uint64_t reserved_18_19:2;
1866 uint64_t ptp_lost:2;
1867 uint64_t reserved_22_23:2;
1868 uint64_t xchange:1;
1869 uint64_t reserved_25_63:39;
1870#endif
1871 } cnf71xx;
1872};
1873
1874union cvmx_gmxx_tx_int_reg {
1875 uint64_t u64;
1876 struct cvmx_gmxx_tx_int_reg_s {
1877#ifdef __BIG_ENDIAN_BITFIELD
1878 uint64_t reserved_25_63:39;
1879 uint64_t xchange:1;
1880 uint64_t ptp_lost:4;
1881 uint64_t late_col:4;
1882 uint64_t xsdef:4;
1883 uint64_t xscol:4;
1884 uint64_t reserved_6_7:2;
1885 uint64_t undflw:4;
1886 uint64_t reserved_1_1:1;
1887 uint64_t pko_nxa:1;
1888#else
1889 uint64_t pko_nxa:1;
1890 uint64_t reserved_1_1:1;
1891 uint64_t undflw:4;
1892 uint64_t reserved_6_7:2;
1893 uint64_t xscol:4;
1894 uint64_t xsdef:4;
1895 uint64_t late_col:4;
1896 uint64_t ptp_lost:4;
1897 uint64_t xchange:1;
1898 uint64_t reserved_25_63:39;
1899#endif
1900 } s;
1901 struct cvmx_gmxx_tx_int_reg_cn30xx {
1902#ifdef __BIG_ENDIAN_BITFIELD
1903 uint64_t reserved_19_63:45;
1904 uint64_t late_col:3;
1905 uint64_t reserved_15_15:1;
1906 uint64_t xsdef:3;
1907 uint64_t reserved_11_11:1;
1908 uint64_t xscol:3;
1909 uint64_t reserved_5_7:3;
1910 uint64_t undflw:3;
1911 uint64_t reserved_1_1:1;
1912 uint64_t pko_nxa:1;
1913#else
1914 uint64_t pko_nxa:1;
1915 uint64_t reserved_1_1:1;
1916 uint64_t undflw:3;
1917 uint64_t reserved_5_7:3;
1918 uint64_t xscol:3;
1919 uint64_t reserved_11_11:1;
1920 uint64_t xsdef:3;
1921 uint64_t reserved_15_15:1;
1922 uint64_t late_col:3;
1923 uint64_t reserved_19_63:45;
1924#endif
1925 } cn30xx;
1926 struct cvmx_gmxx_tx_int_reg_cn31xx {
1927#ifdef __BIG_ENDIAN_BITFIELD
1928 uint64_t reserved_15_63:49;
1929 uint64_t xsdef:3;
1930 uint64_t reserved_11_11:1;
1931 uint64_t xscol:3;
1932 uint64_t reserved_5_7:3;
1933 uint64_t undflw:3;
1934 uint64_t reserved_1_1:1;
1935 uint64_t pko_nxa:1;
1936#else
1937 uint64_t pko_nxa:1;
1938 uint64_t reserved_1_1:1;
1939 uint64_t undflw:3;
1940 uint64_t reserved_5_7:3;
1941 uint64_t xscol:3;
1942 uint64_t reserved_11_11:1;
1943 uint64_t xsdef:3;
1944 uint64_t reserved_15_63:49;
1945#endif
1946 } cn31xx;
1947 struct cvmx_gmxx_tx_int_reg_cn38xx {
1948#ifdef __BIG_ENDIAN_BITFIELD
1949 uint64_t reserved_20_63:44;
1950 uint64_t late_col:4;
1951 uint64_t xsdef:4;
1952 uint64_t xscol:4;
1953 uint64_t reserved_6_7:2;
1954 uint64_t undflw:4;
1955 uint64_t ncb_nxa:1;
1956 uint64_t pko_nxa:1;
1957#else
1958 uint64_t pko_nxa:1;
1959 uint64_t ncb_nxa:1;
1960 uint64_t undflw:4;
1961 uint64_t reserved_6_7:2;
1962 uint64_t xscol:4;
1963 uint64_t xsdef:4;
1964 uint64_t late_col:4;
1965 uint64_t reserved_20_63:44;
1966#endif
1967 } cn38xx;
1968 struct cvmx_gmxx_tx_int_reg_cn38xxp2 {
1969#ifdef __BIG_ENDIAN_BITFIELD
1970 uint64_t reserved_16_63:48;
1971 uint64_t xsdef:4;
1972 uint64_t xscol:4;
1973 uint64_t reserved_6_7:2;
1974 uint64_t undflw:4;
1975 uint64_t ncb_nxa:1;
1976 uint64_t pko_nxa:1;
1977#else
1978 uint64_t pko_nxa:1;
1979 uint64_t ncb_nxa:1;
1980 uint64_t undflw:4;
1981 uint64_t reserved_6_7:2;
1982 uint64_t xscol:4;
1983 uint64_t xsdef:4;
1984 uint64_t reserved_16_63:48;
1985#endif
1986 } cn38xxp2;
1987 struct cvmx_gmxx_tx_int_reg_cn52xx {
1988#ifdef __BIG_ENDIAN_BITFIELD
1989 uint64_t reserved_20_63:44;
1990 uint64_t late_col:4;
1991 uint64_t xsdef:4;
1992 uint64_t xscol:4;
1993 uint64_t reserved_6_7:2;
1994 uint64_t undflw:4;
1995 uint64_t reserved_1_1:1;
1996 uint64_t pko_nxa:1;
1997#else
1998 uint64_t pko_nxa:1;
1999 uint64_t reserved_1_1:1;
2000 uint64_t undflw:4;
2001 uint64_t reserved_6_7:2;
2002 uint64_t xscol:4;
2003 uint64_t xsdef:4;
2004 uint64_t late_col:4;
2005 uint64_t reserved_20_63:44;
2006#endif
2007 } cn52xx;
2008 struct cvmx_gmxx_tx_int_reg_cn63xx {
2009#ifdef __BIG_ENDIAN_BITFIELD
2010 uint64_t reserved_24_63:40;
2011 uint64_t ptp_lost:4;
2012 uint64_t late_col:4;
2013 uint64_t xsdef:4;
2014 uint64_t xscol:4;
2015 uint64_t reserved_6_7:2;
2016 uint64_t undflw:4;
2017 uint64_t reserved_1_1:1;
2018 uint64_t pko_nxa:1;
2019#else
2020 uint64_t pko_nxa:1;
2021 uint64_t reserved_1_1:1;
2022 uint64_t undflw:4;
2023 uint64_t reserved_6_7:2;
2024 uint64_t xscol:4;
2025 uint64_t xsdef:4;
2026 uint64_t late_col:4;
2027 uint64_t ptp_lost:4;
2028 uint64_t reserved_24_63:40;
2029#endif
2030 } cn63xx;
2031 struct cvmx_gmxx_tx_int_reg_cn68xx {
2032#ifdef __BIG_ENDIAN_BITFIELD
2033 uint64_t reserved_25_63:39;
2034 uint64_t xchange:1;
2035 uint64_t ptp_lost:4;
2036 uint64_t late_col:4;
2037 uint64_t xsdef:4;
2038 uint64_t xscol:4;
2039 uint64_t reserved_6_7:2;
2040 uint64_t undflw:4;
2041 uint64_t pko_nxp:1;
2042 uint64_t pko_nxa:1;
2043#else
2044 uint64_t pko_nxa:1;
2045 uint64_t pko_nxp:1;
2046 uint64_t undflw:4;
2047 uint64_t reserved_6_7:2;
2048 uint64_t xscol:4;
2049 uint64_t xsdef:4;
2050 uint64_t late_col:4;
2051 uint64_t ptp_lost:4;
2052 uint64_t xchange:1;
2053 uint64_t reserved_25_63:39;
2054#endif
2055 } cn68xx;
2056 struct cvmx_gmxx_tx_int_reg_cnf71xx {
2057#ifdef __BIG_ENDIAN_BITFIELD
2058 uint64_t reserved_25_63:39;
2059 uint64_t xchange:1;
2060 uint64_t reserved_22_23:2;
2061 uint64_t ptp_lost:2;
2062 uint64_t reserved_18_19:2;
2063 uint64_t late_col:2;
2064 uint64_t reserved_14_15:2;
2065 uint64_t xsdef:2;
2066 uint64_t reserved_10_11:2;
2067 uint64_t xscol:2;
2068 uint64_t reserved_4_7:4;
2069 uint64_t undflw:2;
2070 uint64_t reserved_1_1:1;
2071 uint64_t pko_nxa:1;
2072#else
2073 uint64_t pko_nxa:1;
2074 uint64_t reserved_1_1:1;
2075 uint64_t undflw:2;
2076 uint64_t reserved_4_7:4;
2077 uint64_t xscol:2;
2078 uint64_t reserved_10_11:2;
2079 uint64_t xsdef:2;
2080 uint64_t reserved_14_15:2;
2081 uint64_t late_col:2;
2082 uint64_t reserved_18_19:2;
2083 uint64_t ptp_lost:2;
2084 uint64_t reserved_22_23:2;
2085 uint64_t xchange:1;
2086 uint64_t reserved_25_63:39;
2087#endif
2088 } cnf71xx;
2089};
2090
2091union cvmx_gmxx_tx_ovr_bp {
2092 uint64_t u64;
2093 struct cvmx_gmxx_tx_ovr_bp_s {
2094#ifdef __BIG_ENDIAN_BITFIELD
2095 uint64_t reserved_48_63:16;
2096 uint64_t tx_prt_bp:16;
2097 uint64_t reserved_12_31:20;
2098 uint64_t en:4;
2099 uint64_t bp:4;
2100 uint64_t ign_full:4;
2101#else
2102 uint64_t ign_full:4;
2103 uint64_t bp:4;
2104 uint64_t en:4;
2105 uint64_t reserved_12_31:20;
2106 uint64_t tx_prt_bp:16;
2107 uint64_t reserved_48_63:16;
2108#endif
2109 } s;
2110 struct cvmx_gmxx_tx_ovr_bp_cn30xx {
2111#ifdef __BIG_ENDIAN_BITFIELD
2112 uint64_t reserved_11_63:53;
2113 uint64_t en:3;
2114 uint64_t reserved_7_7:1;
2115 uint64_t bp:3;
2116 uint64_t reserved_3_3:1;
2117 uint64_t ign_full:3;
2118#else
2119 uint64_t ign_full:3;
2120 uint64_t reserved_3_3:1;
2121 uint64_t bp:3;
2122 uint64_t reserved_7_7:1;
2123 uint64_t en:3;
2124 uint64_t reserved_11_63:53;
2125#endif
2126 } cn30xx;
2127 struct cvmx_gmxx_tx_ovr_bp_cn38xx {
2128#ifdef __BIG_ENDIAN_BITFIELD
2129 uint64_t reserved_12_63:52;
2130 uint64_t en:4;
2131 uint64_t bp:4;
2132 uint64_t ign_full:4;
2133#else
2134 uint64_t ign_full:4;
2135 uint64_t bp:4;
2136 uint64_t en:4;
2137 uint64_t reserved_12_63:52;
2138#endif
2139 } cn38xx;
2140 struct cvmx_gmxx_tx_ovr_bp_cnf71xx {
2141#ifdef __BIG_ENDIAN_BITFIELD
2142 uint64_t reserved_48_63:16;
2143 uint64_t tx_prt_bp:16;
2144 uint64_t reserved_10_31:22;
2145 uint64_t en:2;
2146 uint64_t reserved_6_7:2;
2147 uint64_t bp:2;
2148 uint64_t reserved_2_3:2;
2149 uint64_t ign_full:2;
2150#else
2151 uint64_t ign_full:2;
2152 uint64_t reserved_2_3:2;
2153 uint64_t bp:2;
2154 uint64_t reserved_6_7:2;
2155 uint64_t en:2;
2156 uint64_t reserved_10_31:22;
2157 uint64_t tx_prt_bp:16;
2158 uint64_t reserved_48_63:16;
2159#endif
2160 } cnf71xx;
2161};
2162
2163union cvmx_gmxx_tx_prts {
2164 uint64_t u64;
2165 struct cvmx_gmxx_tx_prts_s {
2166#ifdef __BIG_ENDIAN_BITFIELD
2167 uint64_t reserved_5_63:59;
2168 uint64_t prts:5;
2169#else
2170 uint64_t prts:5;
2171 uint64_t reserved_5_63:59;
2172#endif
2173 } s;
2174};
2175
2176union cvmx_gmxx_tx_spi_ctl {
2177 uint64_t u64;
2178 struct cvmx_gmxx_tx_spi_ctl_s {
2179#ifdef __BIG_ENDIAN_BITFIELD
2180 uint64_t reserved_2_63:62;
2181 uint64_t tpa_clr:1;
2182 uint64_t cont_pkt:1;
2183#else
2184 uint64_t cont_pkt:1;
2185 uint64_t tpa_clr:1;
2186 uint64_t reserved_2_63:62;
2187#endif
2188 } s;
2189};
2190
2191union cvmx_gmxx_tx_spi_max {
2192 uint64_t u64;
2193 struct cvmx_gmxx_tx_spi_max_s {
2194#ifdef __BIG_ENDIAN_BITFIELD
2195 uint64_t reserved_23_63:41;
2196 uint64_t slice:7;
2197 uint64_t max2:8;
2198 uint64_t max1:8;
2199#else
2200 uint64_t max1:8;
2201 uint64_t max2:8;
2202 uint64_t slice:7;
2203 uint64_t reserved_23_63:41;
2204#endif
2205 } s;
2206 struct cvmx_gmxx_tx_spi_max_cn38xx {
2207#ifdef __BIG_ENDIAN_BITFIELD
2208 uint64_t reserved_16_63:48;
2209 uint64_t max2:8;
2210 uint64_t max1:8;
2211#else
2212 uint64_t max1:8;
2213 uint64_t max2:8;
2214 uint64_t reserved_16_63:48;
2215#endif
2216 } cn38xx;
2217};
2218
2219union cvmx_gmxx_tx_spi_thresh {
2220 uint64_t u64;
2221 struct cvmx_gmxx_tx_spi_thresh_s {
2222#ifdef __BIG_ENDIAN_BITFIELD
2223 uint64_t reserved_6_63:58;
2224 uint64_t thresh:6;
2225#else
2226 uint64_t thresh:6;
2227 uint64_t reserved_6_63:58;
2228#endif
2229 } s;
2230};
2231
2232union cvmx_gmxx_tx_xaui_ctl {
2233 uint64_t u64;
2234 struct cvmx_gmxx_tx_xaui_ctl_s {
2235#ifdef __BIG_ENDIAN_BITFIELD
2236 uint64_t reserved_11_63:53;
2237 uint64_t hg_pause_hgi:2;
2238 uint64_t hg_en:1;
2239 uint64_t reserved_7_7:1;
2240 uint64_t ls_byp:1;
2241 uint64_t ls:2;
2242 uint64_t reserved_2_3:2;
2243 uint64_t uni_en:1;
2244 uint64_t dic_en:1;
2245#else
2246 uint64_t dic_en:1;
2247 uint64_t uni_en:1;
2248 uint64_t reserved_2_3:2;
2249 uint64_t ls:2;
2250 uint64_t ls_byp:1;
2251 uint64_t reserved_7_7:1;
2252 uint64_t hg_en:1;
2253 uint64_t hg_pause_hgi:2;
2254 uint64_t reserved_11_63:53;
2255#endif
2256 } s;
2257};
2258
2259#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-gpio-defs.h b/arch/mips/include/asm/octeon/cvmx-gpio-defs.h
new file mode 100644
index 000000000..5420fa667
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-gpio-defs.h
@@ -0,0 +1,399 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_GPIO_DEFS_H__
29#define __CVMX_GPIO_DEFS_H__
30
31#define CVMX_GPIO_BIT_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001070000000800ull) + ((offset) & 15) * 8)
32#define CVMX_GPIO_BOOT_ENA (CVMX_ADD_IO_SEG(0x00010700000008A8ull))
33#define CVMX_GPIO_CLK_GENX(offset) (CVMX_ADD_IO_SEG(0x00010700000008C0ull) + ((offset) & 3) * 8)
34#define CVMX_GPIO_CLK_QLMX(offset) (CVMX_ADD_IO_SEG(0x00010700000008E0ull) + ((offset) & 1) * 8)
35#define CVMX_GPIO_DBG_ENA (CVMX_ADD_IO_SEG(0x00010700000008A0ull))
36#define CVMX_GPIO_INT_CLR (CVMX_ADD_IO_SEG(0x0001070000000898ull))
37#define CVMX_GPIO_MULTI_CAST (CVMX_ADD_IO_SEG(0x00010700000008B0ull))
38#define CVMX_GPIO_PIN_ENA (CVMX_ADD_IO_SEG(0x00010700000008B8ull))
39#define CVMX_GPIO_RX_DAT (CVMX_ADD_IO_SEG(0x0001070000000880ull))
40#define CVMX_GPIO_TIM_CTL (CVMX_ADD_IO_SEG(0x00010700000008A0ull))
41#define CVMX_GPIO_TX_CLR (CVMX_ADD_IO_SEG(0x0001070000000890ull))
42#define CVMX_GPIO_TX_SET (CVMX_ADD_IO_SEG(0x0001070000000888ull))
43#define CVMX_GPIO_XBIT_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001070000000900ull) + ((offset) & 31) * 8 - 8*16)
44
45union cvmx_gpio_bit_cfgx {
46 uint64_t u64;
47 struct cvmx_gpio_bit_cfgx_s {
48#ifdef __BIG_ENDIAN_BITFIELD
49 uint64_t reserved_21_63:42;
50 uint64_t output_sel:5;
51 uint64_t synce_sel:2;
52 uint64_t clk_gen:1;
53 uint64_t clk_sel:2;
54 uint64_t fil_sel:4;
55 uint64_t fil_cnt:4;
56 uint64_t int_type:1;
57 uint64_t int_en:1;
58 uint64_t rx_xor:1;
59 uint64_t tx_oe:1;
60#else
61 uint64_t tx_oe:1;
62 uint64_t rx_xor:1;
63 uint64_t int_en:1;
64 uint64_t int_type:1;
65 uint64_t fil_cnt:4;
66 uint64_t fil_sel:4;
67 uint64_t clk_sel:2;
68 uint64_t clk_gen:1;
69 uint64_t synce_sel:2;
70 uint64_t output_sel:5;
71 uint64_t reserved_21_63:42;
72#endif
73 } s;
74 struct cvmx_gpio_bit_cfgx_cn30xx {
75#ifdef __BIG_ENDIAN_BITFIELD
76 uint64_t reserved_12_63:52;
77 uint64_t fil_sel:4;
78 uint64_t fil_cnt:4;
79 uint64_t int_type:1;
80 uint64_t int_en:1;
81 uint64_t rx_xor:1;
82 uint64_t tx_oe:1;
83#else
84 uint64_t tx_oe:1;
85 uint64_t rx_xor:1;
86 uint64_t int_en:1;
87 uint64_t int_type:1;
88 uint64_t fil_cnt:4;
89 uint64_t fil_sel:4;
90 uint64_t reserved_12_63:52;
91#endif
92 } cn30xx;
93 struct cvmx_gpio_bit_cfgx_cn52xx {
94#ifdef __BIG_ENDIAN_BITFIELD
95 uint64_t reserved_15_63:49;
96 uint64_t clk_gen:1;
97 uint64_t clk_sel:2;
98 uint64_t fil_sel:4;
99 uint64_t fil_cnt:4;
100 uint64_t int_type:1;
101 uint64_t int_en:1;
102 uint64_t rx_xor:1;
103 uint64_t tx_oe:1;
104#else
105 uint64_t tx_oe:1;
106 uint64_t rx_xor:1;
107 uint64_t int_en:1;
108 uint64_t int_type:1;
109 uint64_t fil_cnt:4;
110 uint64_t fil_sel:4;
111 uint64_t clk_sel:2;
112 uint64_t clk_gen:1;
113 uint64_t reserved_15_63:49;
114#endif
115 } cn52xx;
116};
117
118union cvmx_gpio_boot_ena {
119 uint64_t u64;
120 struct cvmx_gpio_boot_ena_s {
121#ifdef __BIG_ENDIAN_BITFIELD
122 uint64_t reserved_12_63:52;
123 uint64_t boot_ena:4;
124 uint64_t reserved_0_7:8;
125#else
126 uint64_t reserved_0_7:8;
127 uint64_t boot_ena:4;
128 uint64_t reserved_12_63:52;
129#endif
130 } s;
131};
132
133union cvmx_gpio_clk_genx {
134 uint64_t u64;
135 struct cvmx_gpio_clk_genx_s {
136#ifdef __BIG_ENDIAN_BITFIELD
137 uint64_t reserved_32_63:32;
138 uint64_t n:32;
139#else
140 uint64_t n:32;
141 uint64_t reserved_32_63:32;
142#endif
143 } s;
144};
145
146union cvmx_gpio_clk_qlmx {
147 uint64_t u64;
148 struct cvmx_gpio_clk_qlmx_s {
149#ifdef __BIG_ENDIAN_BITFIELD
150 uint64_t reserved_11_63:53;
151 uint64_t qlm_sel:3;
152 uint64_t reserved_3_7:5;
153 uint64_t div:1;
154 uint64_t lane_sel:2;
155#else
156 uint64_t lane_sel:2;
157 uint64_t div:1;
158 uint64_t reserved_3_7:5;
159 uint64_t qlm_sel:3;
160 uint64_t reserved_11_63:53;
161#endif
162 } s;
163 struct cvmx_gpio_clk_qlmx_cn61xx {
164#ifdef __BIG_ENDIAN_BITFIELD
165 uint64_t reserved_10_63:54;
166 uint64_t qlm_sel:2;
167 uint64_t reserved_3_7:5;
168 uint64_t div:1;
169 uint64_t lane_sel:2;
170#else
171 uint64_t lane_sel:2;
172 uint64_t div:1;
173 uint64_t reserved_3_7:5;
174 uint64_t qlm_sel:2;
175 uint64_t reserved_10_63:54;
176#endif
177 } cn61xx;
178 struct cvmx_gpio_clk_qlmx_cn63xx {
179#ifdef __BIG_ENDIAN_BITFIELD
180 uint64_t reserved_3_63:61;
181 uint64_t div:1;
182 uint64_t lane_sel:2;
183#else
184 uint64_t lane_sel:2;
185 uint64_t div:1;
186 uint64_t reserved_3_63:61;
187#endif
188 } cn63xx;
189};
190
191union cvmx_gpio_dbg_ena {
192 uint64_t u64;
193 struct cvmx_gpio_dbg_ena_s {
194#ifdef __BIG_ENDIAN_BITFIELD
195 uint64_t reserved_21_63:43;
196 uint64_t dbg_ena:21;
197#else
198 uint64_t dbg_ena:21;
199 uint64_t reserved_21_63:43;
200#endif
201 } s;
202};
203
204union cvmx_gpio_int_clr {
205 uint64_t u64;
206 struct cvmx_gpio_int_clr_s {
207#ifdef __BIG_ENDIAN_BITFIELD
208 uint64_t reserved_16_63:48;
209 uint64_t type:16;
210#else
211 uint64_t type:16;
212 uint64_t reserved_16_63:48;
213#endif
214 } s;
215};
216
217union cvmx_gpio_multi_cast {
218 uint64_t u64;
219 struct cvmx_gpio_multi_cast_s {
220#ifdef __BIG_ENDIAN_BITFIELD
221 uint64_t reserved_1_63:63;
222 uint64_t en:1;
223#else
224 uint64_t en:1;
225 uint64_t reserved_1_63:63;
226#endif
227 } s;
228};
229
230union cvmx_gpio_pin_ena {
231 uint64_t u64;
232 struct cvmx_gpio_pin_ena_s {
233#ifdef __BIG_ENDIAN_BITFIELD
234 uint64_t reserved_20_63:44;
235 uint64_t ena19:1;
236 uint64_t ena18:1;
237 uint64_t reserved_0_17:18;
238#else
239 uint64_t reserved_0_17:18;
240 uint64_t ena18:1;
241 uint64_t ena19:1;
242 uint64_t reserved_20_63:44;
243#endif
244 } s;
245};
246
247union cvmx_gpio_rx_dat {
248 uint64_t u64;
249 struct cvmx_gpio_rx_dat_s {
250#ifdef __BIG_ENDIAN_BITFIELD
251 uint64_t reserved_24_63:40;
252 uint64_t dat:24;
253#else
254 uint64_t dat:24;
255 uint64_t reserved_24_63:40;
256#endif
257 } s;
258 struct cvmx_gpio_rx_dat_cn38xx {
259#ifdef __BIG_ENDIAN_BITFIELD
260 uint64_t reserved_16_63:48;
261 uint64_t dat:16;
262#else
263 uint64_t dat:16;
264 uint64_t reserved_16_63:48;
265#endif
266 } cn38xx;
267 struct cvmx_gpio_rx_dat_cn61xx {
268#ifdef __BIG_ENDIAN_BITFIELD
269 uint64_t reserved_20_63:44;
270 uint64_t dat:20;
271#else
272 uint64_t dat:20;
273 uint64_t reserved_20_63:44;
274#endif
275 } cn61xx;
276};
277
278union cvmx_gpio_tim_ctl {
279 uint64_t u64;
280 struct cvmx_gpio_tim_ctl_s {
281#ifdef __BIG_ENDIAN_BITFIELD
282 uint64_t reserved_4_63:60;
283 uint64_t sel:4;
284#else
285 uint64_t sel:4;
286 uint64_t reserved_4_63:60;
287#endif
288 } s;
289};
290
291union cvmx_gpio_tx_clr {
292 uint64_t u64;
293 struct cvmx_gpio_tx_clr_s {
294#ifdef __BIG_ENDIAN_BITFIELD
295 uint64_t reserved_24_63:40;
296 uint64_t clr:24;
297#else
298 uint64_t clr:24;
299 uint64_t reserved_24_63:40;
300#endif
301 } s;
302 struct cvmx_gpio_tx_clr_cn38xx {
303#ifdef __BIG_ENDIAN_BITFIELD
304 uint64_t reserved_16_63:48;
305 uint64_t clr:16;
306#else
307 uint64_t clr:16;
308 uint64_t reserved_16_63:48;
309#endif
310 } cn38xx;
311 struct cvmx_gpio_tx_clr_cn61xx {
312#ifdef __BIG_ENDIAN_BITFIELD
313 uint64_t reserved_20_63:44;
314 uint64_t clr:20;
315#else
316 uint64_t clr:20;
317 uint64_t reserved_20_63:44;
318#endif
319 } cn61xx;
320};
321
322union cvmx_gpio_tx_set {
323 uint64_t u64;
324 struct cvmx_gpio_tx_set_s {
325#ifdef __BIG_ENDIAN_BITFIELD
326 uint64_t reserved_24_63:40;
327 uint64_t set:24;
328#else
329 uint64_t set:24;
330 uint64_t reserved_24_63:40;
331#endif
332 } s;
333 struct cvmx_gpio_tx_set_cn38xx {
334#ifdef __BIG_ENDIAN_BITFIELD
335 uint64_t reserved_16_63:48;
336 uint64_t set:16;
337#else
338 uint64_t set:16;
339 uint64_t reserved_16_63:48;
340#endif
341 } cn38xx;
342 struct cvmx_gpio_tx_set_cn61xx {
343#ifdef __BIG_ENDIAN_BITFIELD
344 uint64_t reserved_20_63:44;
345 uint64_t set:20;
346#else
347 uint64_t set:20;
348 uint64_t reserved_20_63:44;
349#endif
350 } cn61xx;
351};
352
353union cvmx_gpio_xbit_cfgx {
354 uint64_t u64;
355 struct cvmx_gpio_xbit_cfgx_s {
356#ifdef __BIG_ENDIAN_BITFIELD
357 uint64_t reserved_17_63:47;
358 uint64_t synce_sel:2;
359 uint64_t clk_gen:1;
360 uint64_t clk_sel:2;
361 uint64_t fil_sel:4;
362 uint64_t fil_cnt:4;
363 uint64_t int_type:1;
364 uint64_t int_en:1;
365 uint64_t rx_xor:1;
366 uint64_t tx_oe:1;
367#else
368 uint64_t tx_oe:1;
369 uint64_t rx_xor:1;
370 uint64_t int_en:1;
371 uint64_t int_type:1;
372 uint64_t fil_cnt:4;
373 uint64_t fil_sel:4;
374 uint64_t clk_sel:2;
375 uint64_t clk_gen:1;
376 uint64_t synce_sel:2;
377 uint64_t reserved_17_63:47;
378#endif
379 } s;
380 struct cvmx_gpio_xbit_cfgx_cn30xx {
381#ifdef __BIG_ENDIAN_BITFIELD
382 uint64_t reserved_12_63:52;
383 uint64_t fil_sel:4;
384 uint64_t fil_cnt:4;
385 uint64_t reserved_2_3:2;
386 uint64_t rx_xor:1;
387 uint64_t tx_oe:1;
388#else
389 uint64_t tx_oe:1;
390 uint64_t rx_xor:1;
391 uint64_t reserved_2_3:2;
392 uint64_t fil_cnt:4;
393 uint64_t fil_sel:4;
394 uint64_t reserved_12_63:52;
395#endif
396 } cn30xx;
397};
398
399#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-board.h b/arch/mips/include/asm/octeon/cvmx-helper-board.h
new file mode 100644
index 000000000..ce52aafe7
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-board.h
@@ -0,0 +1,124 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 *
30 * Helper functions to abstract board specific data about
31 * network ports from the rest of the cvmx-helper files.
32 *
33 */
34#ifndef __CVMX_HELPER_BOARD_H__
35#define __CVMX_HELPER_BOARD_H__
36
37#include <asm/octeon/cvmx-helper.h>
38
39enum cvmx_helper_board_usb_clock_types {
40 USB_CLOCK_TYPE_REF_12,
41 USB_CLOCK_TYPE_REF_24,
42 USB_CLOCK_TYPE_REF_48,
43 USB_CLOCK_TYPE_CRYSTAL_12,
44};
45
46typedef enum {
47 set_phy_link_flags_autoneg = 0x1,
48 set_phy_link_flags_flow_control_dont_touch = 0x0 << 1,
49 set_phy_link_flags_flow_control_enable = 0x1 << 1,
50 set_phy_link_flags_flow_control_disable = 0x2 << 1,
51 set_phy_link_flags_flow_control_mask = 0x3 << 1, /* Mask for 2 bit wide flow control field */
52} cvmx_helper_board_set_phy_link_flags_types_t;
53
54/*
55 * Fake IPD port, the RGMII/MII interface may use different PHY, use
56 * this macro to return appropriate MIX address to read the PHY.
57 */
58#define CVMX_HELPER_BOARD_MGMT_IPD_PORT -10
59
60/**
61 * Return the MII PHY address associated with the given IPD
62 * port. A result of -1 means there isn't a MII capable PHY
63 * connected to this port. On chips supporting multiple MII
64 * busses the bus number is encoded in bits <15:8>.
65 *
66 * This function must be modifed for every new Octeon board.
67 * Internally it uses switch statements based on the cvmx_sysinfo
68 * data to determine board types and revisions. It relys on the
69 * fact that every Octeon board receives a unique board type
70 * enumeration from the bootloader.
71 *
72 * @ipd_port: Octeon IPD port to get the MII address for.
73 *
74 * Returns MII PHY address and bus number or -1.
75 */
76extern int cvmx_helper_board_get_mii_address(int ipd_port);
77
78/**
79 * This function is the board specific method of determining an
80 * ethernet ports link speed. Most Octeon boards have Marvell PHYs
81 * and are handled by the fall through case. This function must be
82 * updated for boards that don't have the normal Marvell PHYs.
83 *
84 * This function must be modifed for every new Octeon board.
85 * Internally it uses switch statements based on the cvmx_sysinfo
86 * data to determine board types and revisions. It relys on the
87 * fact that every Octeon board receives a unique board type
88 * enumeration from the bootloader.
89 *
90 * @ipd_port: IPD input port associated with the port we want to get link
91 * status for.
92 *
93 * Returns The ports link status. If the link isn't fully resolved, this must
94 * return zero.
95 */
96extern union cvmx_helper_link_info __cvmx_helper_board_link_get(int ipd_port);
97
98/**
99 * This function is called by cvmx_helper_interface_probe() after it
100 * determines the number of ports Octeon can support on a specific
101 * interface. This function is the per board location to override
102 * this value. It is called with the number of ports Octeon might
103 * support and should return the number of actual ports on the
104 * board.
105 *
106 * This function must be modifed for every new Octeon board.
107 * Internally it uses switch statements based on the cvmx_sysinfo
108 * data to determine board types and revisions. It relys on the
109 * fact that every Octeon board receives a unique board type
110 * enumeration from the bootloader.
111 *
112 * @interface: Interface to probe
113 * @supported_ports:
114 * Number of ports Octeon supports.
115 *
116 * Returns Number of ports the actual board supports. Many times this will
117 * simple be "support_ports".
118 */
119extern int __cvmx_helper_board_interface_probe(int interface,
120 int supported_ports);
121
122enum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(void);
123
124#endif /* __CVMX_HELPER_BOARD_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-errata.h b/arch/mips/include/asm/octeon/cvmx-helper-errata.h
new file mode 100644
index 000000000..5fc99189f
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-errata.h
@@ -0,0 +1,33 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_HELPER_ERRATA_H__
29#define __CVMX_HELPER_ERRATA_H__
30
31extern void __cvmx_helper_errata_qlm_disable_2nd_order_cdr(int qlm);
32
33#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-jtag.h b/arch/mips/include/asm/octeon/cvmx-helper-jtag.h
new file mode 100644
index 000000000..29f016ddb
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-jtag.h
@@ -0,0 +1,43 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 * @file
30 *
31 * Helper utilities for qlm_jtag.
32 *
33 */
34
35#ifndef __CVMX_HELPER_JTAG_H__
36#define __CVMX_HELPER_JTAG_H__
37
38extern void cvmx_helper_qlm_jtag_init(void);
39extern uint32_t cvmx_helper_qlm_jtag_shift(int qlm, int bits, uint32_t data);
40extern void cvmx_helper_qlm_jtag_shift_zeros(int qlm, int bits);
41extern void cvmx_helper_qlm_jtag_update(int qlm);
42
43#endif /* __CVMX_HELPER_JTAG_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-loop.h b/arch/mips/include/asm/octeon/cvmx-helper-loop.h
new file mode 100644
index 000000000..077f0e9d3
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-loop.h
@@ -0,0 +1,60 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as published by
11 * the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful,
14 * but AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
16 * See the GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this file; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 * or visit http://www.gnu.org/licenses/.
22 *
23 * This file may also be available under a different license from Cavium.
24 * Contact Cavium Networks for more information
25 ***********************license end**************************************/
26
27/**
28 * @file
29 *
30 * Functions for LOOP initialization, configuration,
31 * and monitoring.
32 *
33 */
34#ifndef __CVMX_HELPER_LOOP_H__
35#define __CVMX_HELPER_LOOP_H__
36
37/**
38 * Probe a LOOP interface and determine the number of ports
39 * connected to it. The LOOP interface should still be down after
40 * this call.
41 *
42 * @interface: Interface to probe
43 *
44 * Returns Number of ports on the interface. Zero to disable.
45 */
46extern int __cvmx_helper_loop_probe(int interface);
47static inline int __cvmx_helper_loop_enumerate(int interface) {return 4; }
48
49/**
50 * Bringup and enable a LOOP interface. After this call packet
51 * I/O should be fully functional. This is called with IPD
52 * enabled but PKO disabled.
53 *
54 * @interface: Interface to bring up
55 *
56 * Returns Zero on success, negative on failure
57 */
58extern int __cvmx_helper_loop_enable(int interface);
59
60#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-npi.h b/arch/mips/include/asm/octeon/cvmx-helper-npi.h
new file mode 100644
index 000000000..8df4c7faf
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-npi.h
@@ -0,0 +1,61 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 * @file
30 *
31 * Functions for NPI initialization, configuration,
32 * and monitoring.
33 *
34 */
35#ifndef __CVMX_HELPER_NPI_H__
36#define __CVMX_HELPER_NPI_H__
37
38/**
39 * Probe a NPI interface and determine the number of ports
40 * connected to it. The NPI interface should still be down after
41 * this call.
42 *
43 * @interface: Interface to probe
44 *
45 * Returns Number of ports on the interface. Zero to disable.
46 */
47extern int __cvmx_helper_npi_probe(int interface);
48#define __cvmx_helper_npi_enumerate __cvmx_helper_npi_probe
49
50/**
51 * Bringup and enable a NPI interface. After this call packet
52 * I/O should be fully functional. This is called with IPD
53 * enabled but PKO disabled.
54 *
55 * @interface: Interface to bring up
56 *
57 * Returns Zero on success, negative on failure
58 */
59extern int __cvmx_helper_npi_enable(int interface);
60
61#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-rgmii.h b/arch/mips/include/asm/octeon/cvmx-helper-rgmii.h
new file mode 100644
index 000000000..3e79a7f89
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-rgmii.h
@@ -0,0 +1,93 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 * @file
30 *
31 * Functions for RGMII/GMII/MII initialization, configuration,
32 * and monitoring.
33 *
34 */
35#ifndef __CVMX_HELPER_RGMII_H__
36#define __CVMX_HELPER_RGMII_H__
37
38/**
39 * Probe RGMII ports and determine the number present
40 *
41 * @interface: Interface to probe
42 *
43 * Returns Number of RGMII/GMII/MII ports (0-4).
44 */
45extern int __cvmx_helper_rgmii_probe(int interface);
46#define __cvmx_helper_rgmii_enumerate __cvmx_helper_rgmii_probe
47
48/**
49 * Put an RGMII interface in loopback mode. Internal packets sent
50 * out will be received back again on the same port. Externally
51 * received packets will echo back out.
52 *
53 * @port: IPD port number to loop.
54 */
55extern void cvmx_helper_rgmii_internal_loopback(int port);
56
57/**
58 * Configure all of the ASX, GMX, and PKO registers required
59 * to get RGMII to function on the supplied interface.
60 *
61 * @interface: PKO Interface to configure (0 or 1)
62 *
63 * Returns Zero on success
64 */
65extern int __cvmx_helper_rgmii_enable(int interface);
66
67/**
68 * Return the link state of an IPD/PKO port as returned by
69 * auto negotiation. The result of this function may not match
70 * Octeon's link config if auto negotiation has changed since
71 * the last call to cvmx_helper_link_set().
72 *
73 * @ipd_port: IPD/PKO port to query
74 *
75 * Returns Link state
76 */
77extern union cvmx_helper_link_info __cvmx_helper_rgmii_link_get(int ipd_port);
78
79/**
80 * Configure an IPD/PKO port for the specified link state. This
81 * function does not influence auto negotiation at the PHY level.
82 * The passed link state must always match the link state returned
83 * by cvmx_helper_link_get().
84 *
85 * @ipd_port: IPD/PKO port to configure
86 * @link_info: The new link state
87 *
88 * Returns Zero on success, negative on failure
89 */
90extern int __cvmx_helper_rgmii_link_set(int ipd_port,
91 union cvmx_helper_link_info link_info);
92
93#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-sgmii.h b/arch/mips/include/asm/octeon/cvmx-helper-sgmii.h
new file mode 100644
index 000000000..8aac90f18
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-sgmii.h
@@ -0,0 +1,87 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 * @file
30 *
31 * Functions for SGMII initialization, configuration,
32 * and monitoring.
33 *
34 */
35#ifndef __CVMX_HELPER_SGMII_H__
36#define __CVMX_HELPER_SGMII_H__
37
38/**
39 * Probe a SGMII interface and determine the number of ports
40 * connected to it. The SGMII interface should still be down after
41 * this call.
42 *
43 * @interface: Interface to probe
44 *
45 * Returns Number of ports on the interface. Zero to disable.
46 */
47extern int __cvmx_helper_sgmii_probe(int interface);
48extern int __cvmx_helper_sgmii_enumerate(int interface);
49
50/**
51 * Bringup and enable a SGMII interface. After this call packet
52 * I/O should be fully functional. This is called with IPD
53 * enabled but PKO disabled.
54 *
55 * @interface: Interface to bring up
56 *
57 * Returns Zero on success, negative on failure
58 */
59extern int __cvmx_helper_sgmii_enable(int interface);
60
61/**
62 * Return the link state of an IPD/PKO port as returned by
63 * auto negotiation. The result of this function may not match
64 * Octeon's link config if auto negotiation has changed since
65 * the last call to cvmx_helper_link_set().
66 *
67 * @ipd_port: IPD/PKO port to query
68 *
69 * Returns Link state
70 */
71extern union cvmx_helper_link_info __cvmx_helper_sgmii_link_get(int ipd_port);
72
73/**
74 * Configure an IPD/PKO port for the specified link state. This
75 * function does not influence auto negotiation at the PHY level.
76 * The passed link state must always match the link state returned
77 * by cvmx_helper_link_get().
78 *
79 * @ipd_port: IPD/PKO port to configure
80 * @link_info: The new link state
81 *
82 * Returns Zero on success, negative on failure
83 */
84extern int __cvmx_helper_sgmii_link_set(int ipd_port,
85 union cvmx_helper_link_info link_info);
86
87#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-spi.h b/arch/mips/include/asm/octeon/cvmx-helper-spi.h
new file mode 100644
index 000000000..bc8cab936
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-spi.h
@@ -0,0 +1,84 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 * Functions for SPI initialization, configuration,
30 * and monitoring.
31 */
32#ifndef __CVMX_HELPER_SPI_H__
33#define __CVMX_HELPER_SPI_H__
34
35/**
36 * Probe a SPI interface and determine the number of ports
37 * connected to it. The SPI interface should still be down after
38 * this call.
39 *
40 * @interface: Interface to probe
41 *
42 * Returns Number of ports on the interface. Zero to disable.
43 */
44extern int __cvmx_helper_spi_probe(int interface);
45extern int __cvmx_helper_spi_enumerate(int interface);
46
47/**
48 * Bringup and enable a SPI interface. After this call packet I/O
49 * should be fully functional. This is called with IPD enabled but
50 * PKO disabled.
51 *
52 * @interface: Interface to bring up
53 *
54 * Returns Zero on success, negative on failure
55 */
56extern int __cvmx_helper_spi_enable(int interface);
57
58/**
59 * Return the link state of an IPD/PKO port as returned by
60 * auto negotiation. The result of this function may not match
61 * Octeon's link config if auto negotiation has changed since
62 * the last call to cvmx_helper_link_set().
63 *
64 * @ipd_port: IPD/PKO port to query
65 *
66 * Returns Link state
67 */
68extern union cvmx_helper_link_info __cvmx_helper_spi_link_get(int ipd_port);
69
70/**
71 * Configure an IPD/PKO port for the specified link state. This
72 * function does not influence auto negotiation at the PHY level.
73 * The passed link state must always match the link state returned
74 * by cvmx_helper_link_get().
75 *
76 * @ipd_port: IPD/PKO port to configure
77 * @link_info: The new link state
78 *
79 * Returns Zero on success, negative on failure
80 */
81extern int __cvmx_helper_spi_link_set(int ipd_port,
82 union cvmx_helper_link_info link_info);
83
84#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-util.h b/arch/mips/include/asm/octeon/cvmx-helper-util.h
new file mode 100644
index 000000000..97b27a07c
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-util.h
@@ -0,0 +1,192 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 *
30 * Small helper utilities.
31 *
32 */
33
34#ifndef __CVMX_HELPER_UTIL_H__
35#define __CVMX_HELPER_UTIL_H__
36
37/**
38 * Convert a interface mode into a human readable string
39 *
40 * @mode: Mode to convert
41 *
42 * Returns String
43 */
44extern const char
45 *cvmx_helper_interface_mode_to_string(cvmx_helper_interface_mode_t mode);
46
47/**
48 * Setup Random Early Drop to automatically begin dropping packets.
49 *
50 * @pass_thresh:
51 * Packets will begin slowly dropping when there are less than
52 * this many packet buffers free in FPA 0.
53 * @drop_thresh:
54 * All incoming packets will be dropped when there are less
55 * than this many free packet buffers in FPA 0.
56 * Returns Zero on success. Negative on failure
57 */
58extern int cvmx_helper_setup_red(int pass_thresh, int drop_thresh);
59
60/**
61 * Get the version of the CVMX libraries.
62 *
63 * Returns Version string. Note this buffer is allocated statically
64 * and will be shared by all callers.
65 */
66extern const char *cvmx_helper_get_version(void);
67
68/**
69 * Setup the common GMX settings that determine the number of
70 * ports. These setting apply to almost all configurations of all
71 * chips.
72 *
73 * @interface: Interface to configure
74 * @num_ports: Number of ports on the interface
75 *
76 * Returns Zero on success, negative on failure
77 */
78extern int __cvmx_helper_setup_gmx(int interface, int num_ports);
79
80/**
81 * Returns the IPD/PKO port number for a port on the given
82 * interface.
83 *
84 * @interface: Interface to use
85 * @port: Port on the interface
86 *
87 * Returns IPD/PKO port number
88 */
89extern int cvmx_helper_get_ipd_port(int interface, int port);
90
91/**
92 * Returns the IPD/PKO port number for the first port on the given
93 * interface.
94 *
95 * @interface: Interface to use
96 *
97 * Returns IPD/PKO port number
98 */
99static inline int cvmx_helper_get_first_ipd_port(int interface)
100{
101 return cvmx_helper_get_ipd_port(interface, 0);
102}
103
104/**
105 * Returns the IPD/PKO port number for the last port on the given
106 * interface.
107 *
108 * @interface: Interface to use
109 *
110 * Returns IPD/PKO port number
111 */
112static inline int cvmx_helper_get_last_ipd_port(int interface)
113{
114 extern int cvmx_helper_ports_on_interface(int interface);
115
116 return cvmx_helper_get_first_ipd_port(interface) +
117 cvmx_helper_ports_on_interface(interface) - 1;
118}
119
120/**
121 * Free the packet buffers contained in a work queue entry.
122 * The work queue entry is not freed.
123 *
124 * @work: Work queue entry with packet to free
125 */
126static inline void cvmx_helper_free_packet_data(struct cvmx_wqe *work)
127{
128 uint64_t number_buffers;
129 union cvmx_buf_ptr buffer_ptr;
130 union cvmx_buf_ptr next_buffer_ptr;
131 uint64_t start_of_buffer;
132
133 number_buffers = work->word2.s.bufs;
134 if (number_buffers == 0)
135 return;
136 buffer_ptr = work->packet_ptr;
137
138 /*
139 * Since the number of buffers is not zero, we know this is
140 * not a dynamic short packet. We need to check if it is a
141 * packet received with IPD_CTL_STATUS[NO_WPTR]. If this is
142 * true, we need to free all buffers except for the first
143 * one. The caller doesn't expect their WQE pointer to be
144 * freed
145 */
146 start_of_buffer = ((buffer_ptr.s.addr >> 7) - buffer_ptr.s.back) << 7;
147 if (cvmx_ptr_to_phys(work) == start_of_buffer) {
148 next_buffer_ptr =
149 *(union cvmx_buf_ptr *) cvmx_phys_to_ptr(buffer_ptr.s.addr - 8);
150 buffer_ptr = next_buffer_ptr;
151 number_buffers--;
152 }
153
154 while (number_buffers--) {
155 /*
156 * Remember the back pointer is in cache lines, not
157 * 64bit words
158 */
159 start_of_buffer =
160 ((buffer_ptr.s.addr >> 7) - buffer_ptr.s.back) << 7;
161 /*
162 * Read pointer to next buffer before we free the
163 * current buffer.
164 */
165 next_buffer_ptr =
166 *(union cvmx_buf_ptr *) cvmx_phys_to_ptr(buffer_ptr.s.addr - 8);
167 cvmx_fpa_free(cvmx_phys_to_ptr(start_of_buffer),
168 buffer_ptr.s.pool, 0);
169 buffer_ptr = next_buffer_ptr;
170 }
171}
172
173/**
174 * Returns the interface number for an IPD/PKO port number.
175 *
176 * @ipd_port: IPD/PKO port number
177 *
178 * Returns Interface number
179 */
180extern int cvmx_helper_get_interface_num(int ipd_port);
181
182/**
183 * Returns the interface index number for an IPD/PKO port
184 * number.
185 *
186 * @ipd_port: IPD/PKO port number
187 *
188 * Returns Interface index number
189 */
190extern int cvmx_helper_get_interface_index_num(int ipd_port);
191
192#endif /* __CVMX_HELPER_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-xaui.h b/arch/mips/include/asm/octeon/cvmx-helper-xaui.h
new file mode 100644
index 000000000..c18da2eba
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper-xaui.h
@@ -0,0 +1,87 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 * @file
30 *
31 * Functions for XAUI initialization, configuration,
32 * and monitoring.
33 *
34 */
35#ifndef __CVMX_HELPER_XAUI_H__
36#define __CVMX_HELPER_XAUI_H__
37
38/**
39 * Probe a XAUI interface and determine the number of ports
40 * connected to it. The XAUI interface should still be down
41 * after this call.
42 *
43 * @interface: Interface to probe
44 *
45 * Returns Number of ports on the interface. Zero to disable.
46 */
47extern int __cvmx_helper_xaui_probe(int interface);
48extern int __cvmx_helper_xaui_enumerate(int interface);
49
50/**
51 * Bringup and enable a XAUI interface. After this call packet
52 * I/O should be fully functional. This is called with IPD
53 * enabled but PKO disabled.
54 *
55 * @interface: Interface to bring up
56 *
57 * Returns Zero on success, negative on failure
58 */
59extern int __cvmx_helper_xaui_enable(int interface);
60
61/**
62 * Return the link state of an IPD/PKO port as returned by
63 * auto negotiation. The result of this function may not match
64 * Octeon's link config if auto negotiation has changed since
65 * the last call to cvmx_helper_link_set().
66 *
67 * @ipd_port: IPD/PKO port to query
68 *
69 * Returns Link state
70 */
71extern union cvmx_helper_link_info __cvmx_helper_xaui_link_get(int ipd_port);
72
73/**
74 * Configure an IPD/PKO port for the specified link state. This
75 * function does not influence auto negotiation at the PHY level.
76 * The passed link state must always match the link state returned
77 * by cvmx_helper_link_get().
78 *
79 * @ipd_port: IPD/PKO port to configure
80 * @link_info: The new link state
81 *
82 * Returns Zero on success, negative on failure
83 */
84extern int __cvmx_helper_xaui_link_set(int ipd_port,
85 union cvmx_helper_link_info link_info);
86
87#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-helper.h b/arch/mips/include/asm/octeon/cvmx-helper.h
new file mode 100644
index 000000000..c6c99e28e
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-helper.h
@@ -0,0 +1,178 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 *
30 * Helper functions for common, but complicated tasks.
31 *
32 */
33
34#ifndef __CVMX_HELPER_H__
35#define __CVMX_HELPER_H__
36
37#include <asm/octeon/cvmx-config.h>
38#include <asm/octeon/cvmx-fpa.h>
39#include <asm/octeon/cvmx-wqe.h>
40
41typedef enum {
42 CVMX_HELPER_INTERFACE_MODE_DISABLED,
43 CVMX_HELPER_INTERFACE_MODE_RGMII,
44 CVMX_HELPER_INTERFACE_MODE_GMII,
45 CVMX_HELPER_INTERFACE_MODE_SPI,
46 CVMX_HELPER_INTERFACE_MODE_PCIE,
47 CVMX_HELPER_INTERFACE_MODE_XAUI,
48 CVMX_HELPER_INTERFACE_MODE_SGMII,
49 CVMX_HELPER_INTERFACE_MODE_PICMG,
50 CVMX_HELPER_INTERFACE_MODE_NPI,
51 CVMX_HELPER_INTERFACE_MODE_LOOP,
52} cvmx_helper_interface_mode_t;
53
54union cvmx_helper_link_info {
55 uint64_t u64;
56 struct {
57 uint64_t reserved_20_63:44;
58 uint64_t link_up:1; /**< Is the physical link up? */
59 uint64_t full_duplex:1; /**< 1 if the link is full duplex */
60 uint64_t speed:18; /**< Speed of the link in Mbps */
61 } s;
62};
63
64#include <asm/octeon/cvmx-helper-errata.h>
65#include <asm/octeon/cvmx-helper-loop.h>
66#include <asm/octeon/cvmx-helper-npi.h>
67#include <asm/octeon/cvmx-helper-rgmii.h>
68#include <asm/octeon/cvmx-helper-sgmii.h>
69#include <asm/octeon/cvmx-helper-spi.h>
70#include <asm/octeon/cvmx-helper-util.h>
71#include <asm/octeon/cvmx-helper-xaui.h>
72
73/**
74 * This function enables the IPD and also enables the packet interfaces.
75 * The packet interfaces (RGMII and SPI) must be enabled after the
76 * IPD. This should be called by the user program after any additional
77 * IPD configuration changes are made if CVMX_HELPER_ENABLE_IPD
78 * is not set in the executive-config.h file.
79 *
80 * Returns 0 on success
81 * -1 on failure
82 */
83extern int cvmx_helper_ipd_and_packet_input_enable(void);
84
85/**
86 * Initialize the PIP, IPD, and PKO hardware to support
87 * simple priority based queues for the ethernet ports. Each
88 * port is configured with a number of priority queues based
89 * on CVMX_PKO_QUEUES_PER_PORT_* where each queue is lower
90 * priority than the previous.
91 *
92 * Returns Zero on success, non-zero on failure
93 */
94extern int cvmx_helper_initialize_packet_io_global(void);
95
96/**
97 * Does core local initialization for packet io
98 *
99 * Returns Zero on success, non-zero on failure
100 */
101extern int cvmx_helper_initialize_packet_io_local(void);
102
103/**
104 * Returns the number of ports on the given interface.
105 * The interface must be initialized before the port count
106 * can be returned.
107 *
108 * @interface: Which interface to return port count for.
109 *
110 * Returns Port count for interface
111 * -1 for uninitialized interface
112 */
113extern int cvmx_helper_ports_on_interface(int interface);
114
115/**
116 * Return the number of interfaces the chip has. Each interface
117 * may have multiple ports. Most chips support two interfaces,
118 * but the CNX0XX and CNX1XX are exceptions. These only support
119 * one interface.
120 *
121 * Returns Number of interfaces on chip
122 */
123extern int cvmx_helper_get_number_of_interfaces(void);
124
125/**
126 * Get the operating mode of an interface. Depending on the Octeon
127 * chip and configuration, this function returns an enumeration
128 * of the type of packet I/O supported by an interface.
129 *
130 * @interface: Interface to probe
131 *
132 * Returns Mode of the interface. Unknown or unsupported interfaces return
133 * DISABLED.
134 */
135extern cvmx_helper_interface_mode_t cvmx_helper_interface_get_mode(int
136 interface);
137
138/**
139 * Return the link state of an IPD/PKO port as returned by
140 * auto negotiation. The result of this function may not match
141 * Octeon's link config if auto negotiation has changed since
142 * the last call to cvmx_helper_link_set().
143 *
144 * @ipd_port: IPD/PKO port to query
145 *
146 * Returns Link state
147 */
148extern union cvmx_helper_link_info cvmx_helper_link_get(int ipd_port);
149
150/**
151 * Configure an IPD/PKO port for the specified link state. This
152 * function does not influence auto negotiation at the PHY level.
153 * The passed link state must always match the link state returned
154 * by cvmx_helper_link_get().
155 *
156 * @ipd_port: IPD/PKO port to configure
157 * @link_info: The new link state
158 *
159 * Returns Zero on success, negative on failure
160 */
161extern int cvmx_helper_link_set(int ipd_port,
162 union cvmx_helper_link_info link_info);
163
164/**
165 * This function probes an interface to determine the actual
166 * number of hardware ports connected to it. It doesn't setup the
167 * ports or enable them. The main goal here is to set the global
168 * interface_port_count[interface] correctly. Hardware setup of the
169 * ports will be performed later.
170 *
171 * @interface: Interface to probe
172 *
173 * Returns Zero on success, negative on failure
174 */
175extern int cvmx_helper_interface_probe(int interface);
176extern int cvmx_helper_interface_enumerate(int interface);
177
178#endif /* __CVMX_HELPER_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-iob-defs.h b/arch/mips/include/asm/octeon/cvmx-iob-defs.h
new file mode 100644
index 000000000..989b67bba
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-iob-defs.h
@@ -0,0 +1,903 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_IOB_DEFS_H__
29#define __CVMX_IOB_DEFS_H__
30
31#define CVMX_IOB_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011800F00007F8ull))
32#define CVMX_IOB_CTL_STATUS (CVMX_ADD_IO_SEG(0x00011800F0000050ull))
33#define CVMX_IOB_DWB_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000028ull))
34#define CVMX_IOB_FAU_TIMEOUT (CVMX_ADD_IO_SEG(0x00011800F0000000ull))
35#define CVMX_IOB_I2C_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000010ull))
36#define CVMX_IOB_INB_CONTROL_MATCH (CVMX_ADD_IO_SEG(0x00011800F0000078ull))
37#define CVMX_IOB_INB_CONTROL_MATCH_ENB (CVMX_ADD_IO_SEG(0x00011800F0000088ull))
38#define CVMX_IOB_INB_DATA_MATCH (CVMX_ADD_IO_SEG(0x00011800F0000070ull))
39#define CVMX_IOB_INB_DATA_MATCH_ENB (CVMX_ADD_IO_SEG(0x00011800F0000080ull))
40#define CVMX_IOB_INT_ENB (CVMX_ADD_IO_SEG(0x00011800F0000060ull))
41#define CVMX_IOB_INT_SUM (CVMX_ADD_IO_SEG(0x00011800F0000058ull))
42#define CVMX_IOB_N2C_L2C_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000020ull))
43#define CVMX_IOB_N2C_RSP_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000008ull))
44#define CVMX_IOB_OUTB_COM_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000040ull))
45#define CVMX_IOB_OUTB_CONTROL_MATCH (CVMX_ADD_IO_SEG(0x00011800F0000098ull))
46#define CVMX_IOB_OUTB_CONTROL_MATCH_ENB (CVMX_ADD_IO_SEG(0x00011800F00000A8ull))
47#define CVMX_IOB_OUTB_DATA_MATCH (CVMX_ADD_IO_SEG(0x00011800F0000090ull))
48#define CVMX_IOB_OUTB_DATA_MATCH_ENB (CVMX_ADD_IO_SEG(0x00011800F00000A0ull))
49#define CVMX_IOB_OUTB_FPA_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000048ull))
50#define CVMX_IOB_OUTB_REQ_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000038ull))
51#define CVMX_IOB_P2C_REQ_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000018ull))
52#define CVMX_IOB_PKT_ERR (CVMX_ADD_IO_SEG(0x00011800F0000068ull))
53#define CVMX_IOB_TO_CMB_CREDITS (CVMX_ADD_IO_SEG(0x00011800F00000B0ull))
54#define CVMX_IOB_TO_NCB_DID_00_CREDITS (CVMX_ADD_IO_SEG(0x00011800F0000800ull))
55#define CVMX_IOB_TO_NCB_DID_111_CREDITS (CVMX_ADD_IO_SEG(0x00011800F0000B78ull))
56#define CVMX_IOB_TO_NCB_DID_223_CREDITS (CVMX_ADD_IO_SEG(0x00011800F0000EF8ull))
57#define CVMX_IOB_TO_NCB_DID_24_CREDITS (CVMX_ADD_IO_SEG(0x00011800F00008C0ull))
58#define CVMX_IOB_TO_NCB_DID_32_CREDITS (CVMX_ADD_IO_SEG(0x00011800F0000900ull))
59#define CVMX_IOB_TO_NCB_DID_40_CREDITS (CVMX_ADD_IO_SEG(0x00011800F0000940ull))
60#define CVMX_IOB_TO_NCB_DID_55_CREDITS (CVMX_ADD_IO_SEG(0x00011800F00009B8ull))
61#define CVMX_IOB_TO_NCB_DID_64_CREDITS (CVMX_ADD_IO_SEG(0x00011800F0000A00ull))
62#define CVMX_IOB_TO_NCB_DID_79_CREDITS (CVMX_ADD_IO_SEG(0x00011800F0000A78ull))
63#define CVMX_IOB_TO_NCB_DID_96_CREDITS (CVMX_ADD_IO_SEG(0x00011800F0000B00ull))
64#define CVMX_IOB_TO_NCB_DID_98_CREDITS (CVMX_ADD_IO_SEG(0x00011800F0000B10ull))
65
66union cvmx_iob_bist_status {
67 uint64_t u64;
68 struct cvmx_iob_bist_status_s {
69#ifdef __BIG_ENDIAN_BITFIELD
70 uint64_t reserved_2_63:62;
71 uint64_t ibd:1;
72 uint64_t icd:1;
73#else
74 uint64_t icd:1;
75 uint64_t ibd:1;
76 uint64_t reserved_2_63:62;
77#endif
78 } s;
79 struct cvmx_iob_bist_status_cn30xx {
80#ifdef __BIG_ENDIAN_BITFIELD
81 uint64_t reserved_18_63:46;
82 uint64_t icnrcb:1;
83 uint64_t icr0:1;
84 uint64_t icr1:1;
85 uint64_t icnr1:1;
86 uint64_t icnr0:1;
87 uint64_t ibdr0:1;
88 uint64_t ibdr1:1;
89 uint64_t ibr0:1;
90 uint64_t ibr1:1;
91 uint64_t icnrt:1;
92 uint64_t ibrq0:1;
93 uint64_t ibrq1:1;
94 uint64_t icrn0:1;
95 uint64_t icrn1:1;
96 uint64_t icrp0:1;
97 uint64_t icrp1:1;
98 uint64_t ibd:1;
99 uint64_t icd:1;
100#else
101 uint64_t icd:1;
102 uint64_t ibd:1;
103 uint64_t icrp1:1;
104 uint64_t icrp0:1;
105 uint64_t icrn1:1;
106 uint64_t icrn0:1;
107 uint64_t ibrq1:1;
108 uint64_t ibrq0:1;
109 uint64_t icnrt:1;
110 uint64_t ibr1:1;
111 uint64_t ibr0:1;
112 uint64_t ibdr1:1;
113 uint64_t ibdr0:1;
114 uint64_t icnr0:1;
115 uint64_t icnr1:1;
116 uint64_t icr1:1;
117 uint64_t icr0:1;
118 uint64_t icnrcb:1;
119 uint64_t reserved_18_63:46;
120#endif
121 } cn30xx;
122 struct cvmx_iob_bist_status_cn61xx {
123#ifdef __BIG_ENDIAN_BITFIELD
124 uint64_t reserved_23_63:41;
125 uint64_t xmdfif:1;
126 uint64_t xmcfif:1;
127 uint64_t iorfif:1;
128 uint64_t rsdfif:1;
129 uint64_t iocfif:1;
130 uint64_t icnrcb:1;
131 uint64_t icr0:1;
132 uint64_t icr1:1;
133 uint64_t icnr1:1;
134 uint64_t icnr0:1;
135 uint64_t ibdr0:1;
136 uint64_t ibdr1:1;
137 uint64_t ibr0:1;
138 uint64_t ibr1:1;
139 uint64_t icnrt:1;
140 uint64_t ibrq0:1;
141 uint64_t ibrq1:1;
142 uint64_t icrn0:1;
143 uint64_t icrn1:1;
144 uint64_t icrp0:1;
145 uint64_t icrp1:1;
146 uint64_t ibd:1;
147 uint64_t icd:1;
148#else
149 uint64_t icd:1;
150 uint64_t ibd:1;
151 uint64_t icrp1:1;
152 uint64_t icrp0:1;
153 uint64_t icrn1:1;
154 uint64_t icrn0:1;
155 uint64_t ibrq1:1;
156 uint64_t ibrq0:1;
157 uint64_t icnrt:1;
158 uint64_t ibr1:1;
159 uint64_t ibr0:1;
160 uint64_t ibdr1:1;
161 uint64_t ibdr0:1;
162 uint64_t icnr0:1;
163 uint64_t icnr1:1;
164 uint64_t icr1:1;
165 uint64_t icr0:1;
166 uint64_t icnrcb:1;
167 uint64_t iocfif:1;
168 uint64_t rsdfif:1;
169 uint64_t iorfif:1;
170 uint64_t xmcfif:1;
171 uint64_t xmdfif:1;
172 uint64_t reserved_23_63:41;
173#endif
174 } cn61xx;
175 struct cvmx_iob_bist_status_cn68xx {
176#ifdef __BIG_ENDIAN_BITFIELD
177 uint64_t reserved_18_63:46;
178 uint64_t xmdfif:1;
179 uint64_t xmcfif:1;
180 uint64_t iorfif:1;
181 uint64_t rsdfif:1;
182 uint64_t iocfif:1;
183 uint64_t icnrcb:1;
184 uint64_t icr0:1;
185 uint64_t icr1:1;
186 uint64_t icnr0:1;
187 uint64_t ibr0:1;
188 uint64_t ibr1:1;
189 uint64_t icnrt:1;
190 uint64_t ibrq0:1;
191 uint64_t ibrq1:1;
192 uint64_t icrn0:1;
193 uint64_t icrn1:1;
194 uint64_t ibd:1;
195 uint64_t icd:1;
196#else
197 uint64_t icd:1;
198 uint64_t ibd:1;
199 uint64_t icrn1:1;
200 uint64_t icrn0:1;
201 uint64_t ibrq1:1;
202 uint64_t ibrq0:1;
203 uint64_t icnrt:1;
204 uint64_t ibr1:1;
205 uint64_t ibr0:1;
206 uint64_t icnr0:1;
207 uint64_t icr1:1;
208 uint64_t icr0:1;
209 uint64_t icnrcb:1;
210 uint64_t iocfif:1;
211 uint64_t rsdfif:1;
212 uint64_t iorfif:1;
213 uint64_t xmcfif:1;
214 uint64_t xmdfif:1;
215 uint64_t reserved_18_63:46;
216#endif
217 } cn68xx;
218};
219
220union cvmx_iob_ctl_status {
221 uint64_t u64;
222 struct cvmx_iob_ctl_status_s {
223#ifdef __BIG_ENDIAN_BITFIELD
224 uint64_t reserved_11_63:53;
225 uint64_t fif_dly:1;
226 uint64_t xmc_per:4;
227 uint64_t reserved_5_5:1;
228 uint64_t outb_mat:1;
229 uint64_t inb_mat:1;
230 uint64_t pko_enb:1;
231 uint64_t dwb_enb:1;
232 uint64_t fau_end:1;
233#else
234 uint64_t fau_end:1;
235 uint64_t dwb_enb:1;
236 uint64_t pko_enb:1;
237 uint64_t inb_mat:1;
238 uint64_t outb_mat:1;
239 uint64_t reserved_5_5:1;
240 uint64_t xmc_per:4;
241 uint64_t fif_dly:1;
242 uint64_t reserved_11_63:53;
243#endif
244 } s;
245 struct cvmx_iob_ctl_status_cn30xx {
246#ifdef __BIG_ENDIAN_BITFIELD
247 uint64_t reserved_5_63:59;
248 uint64_t outb_mat:1;
249 uint64_t inb_mat:1;
250 uint64_t pko_enb:1;
251 uint64_t dwb_enb:1;
252 uint64_t fau_end:1;
253#else
254 uint64_t fau_end:1;
255 uint64_t dwb_enb:1;
256 uint64_t pko_enb:1;
257 uint64_t inb_mat:1;
258 uint64_t outb_mat:1;
259 uint64_t reserved_5_63:59;
260#endif
261 } cn30xx;
262 struct cvmx_iob_ctl_status_cn52xx {
263#ifdef __BIG_ENDIAN_BITFIELD
264 uint64_t reserved_6_63:58;
265 uint64_t rr_mode:1;
266 uint64_t outb_mat:1;
267 uint64_t inb_mat:1;
268 uint64_t pko_enb:1;
269 uint64_t dwb_enb:1;
270 uint64_t fau_end:1;
271#else
272 uint64_t fau_end:1;
273 uint64_t dwb_enb:1;
274 uint64_t pko_enb:1;
275 uint64_t inb_mat:1;
276 uint64_t outb_mat:1;
277 uint64_t rr_mode:1;
278 uint64_t reserved_6_63:58;
279#endif
280 } cn52xx;
281 struct cvmx_iob_ctl_status_cn61xx {
282#ifdef __BIG_ENDIAN_BITFIELD
283 uint64_t reserved_11_63:53;
284 uint64_t fif_dly:1;
285 uint64_t xmc_per:4;
286 uint64_t rr_mode:1;
287 uint64_t outb_mat:1;
288 uint64_t inb_mat:1;
289 uint64_t pko_enb:1;
290 uint64_t dwb_enb:1;
291 uint64_t fau_end:1;
292#else
293 uint64_t fau_end:1;
294 uint64_t dwb_enb:1;
295 uint64_t pko_enb:1;
296 uint64_t inb_mat:1;
297 uint64_t outb_mat:1;
298 uint64_t rr_mode:1;
299 uint64_t xmc_per:4;
300 uint64_t fif_dly:1;
301 uint64_t reserved_11_63:53;
302#endif
303 } cn61xx;
304 struct cvmx_iob_ctl_status_cn63xx {
305#ifdef __BIG_ENDIAN_BITFIELD
306 uint64_t reserved_10_63:54;
307 uint64_t xmc_per:4;
308 uint64_t rr_mode:1;
309 uint64_t outb_mat:1;
310 uint64_t inb_mat:1;
311 uint64_t pko_enb:1;
312 uint64_t dwb_enb:1;
313 uint64_t fau_end:1;
314#else
315 uint64_t fau_end:1;
316 uint64_t dwb_enb:1;
317 uint64_t pko_enb:1;
318 uint64_t inb_mat:1;
319 uint64_t outb_mat:1;
320 uint64_t rr_mode:1;
321 uint64_t xmc_per:4;
322 uint64_t reserved_10_63:54;
323#endif
324 } cn63xx;
325 struct cvmx_iob_ctl_status_cn68xx {
326#ifdef __BIG_ENDIAN_BITFIELD
327 uint64_t reserved_11_63:53;
328 uint64_t fif_dly:1;
329 uint64_t xmc_per:4;
330 uint64_t rsvr5:1;
331 uint64_t outb_mat:1;
332 uint64_t inb_mat:1;
333 uint64_t pko_enb:1;
334 uint64_t dwb_enb:1;
335 uint64_t fau_end:1;
336#else
337 uint64_t fau_end:1;
338 uint64_t dwb_enb:1;
339 uint64_t pko_enb:1;
340 uint64_t inb_mat:1;
341 uint64_t outb_mat:1;
342 uint64_t rsvr5:1;
343 uint64_t xmc_per:4;
344 uint64_t fif_dly:1;
345 uint64_t reserved_11_63:53;
346#endif
347 } cn68xx;
348};
349
350union cvmx_iob_dwb_pri_cnt {
351 uint64_t u64;
352 struct cvmx_iob_dwb_pri_cnt_s {
353#ifdef __BIG_ENDIAN_BITFIELD
354 uint64_t reserved_16_63:48;
355 uint64_t cnt_enb:1;
356 uint64_t cnt_val:15;
357#else
358 uint64_t cnt_val:15;
359 uint64_t cnt_enb:1;
360 uint64_t reserved_16_63:48;
361#endif
362 } s;
363};
364
365union cvmx_iob_fau_timeout {
366 uint64_t u64;
367 struct cvmx_iob_fau_timeout_s {
368#ifdef __BIG_ENDIAN_BITFIELD
369 uint64_t reserved_13_63:51;
370 uint64_t tout_enb:1;
371 uint64_t tout_val:12;
372#else
373 uint64_t tout_val:12;
374 uint64_t tout_enb:1;
375 uint64_t reserved_13_63:51;
376#endif
377 } s;
378};
379
380union cvmx_iob_i2c_pri_cnt {
381 uint64_t u64;
382 struct cvmx_iob_i2c_pri_cnt_s {
383#ifdef __BIG_ENDIAN_BITFIELD
384 uint64_t reserved_16_63:48;
385 uint64_t cnt_enb:1;
386 uint64_t cnt_val:15;
387#else
388 uint64_t cnt_val:15;
389 uint64_t cnt_enb:1;
390 uint64_t reserved_16_63:48;
391#endif
392 } s;
393};
394
395union cvmx_iob_inb_control_match {
396 uint64_t u64;
397 struct cvmx_iob_inb_control_match_s {
398#ifdef __BIG_ENDIAN_BITFIELD
399 uint64_t reserved_29_63:35;
400 uint64_t mask:8;
401 uint64_t opc:4;
402 uint64_t dst:9;
403 uint64_t src:8;
404#else
405 uint64_t src:8;
406 uint64_t dst:9;
407 uint64_t opc:4;
408 uint64_t mask:8;
409 uint64_t reserved_29_63:35;
410#endif
411 } s;
412};
413
414union cvmx_iob_inb_control_match_enb {
415 uint64_t u64;
416 struct cvmx_iob_inb_control_match_enb_s {
417#ifdef __BIG_ENDIAN_BITFIELD
418 uint64_t reserved_29_63:35;
419 uint64_t mask:8;
420 uint64_t opc:4;
421 uint64_t dst:9;
422 uint64_t src:8;
423#else
424 uint64_t src:8;
425 uint64_t dst:9;
426 uint64_t opc:4;
427 uint64_t mask:8;
428 uint64_t reserved_29_63:35;
429#endif
430 } s;
431};
432
433union cvmx_iob_inb_data_match {
434 uint64_t u64;
435 struct cvmx_iob_inb_data_match_s {
436#ifdef __BIG_ENDIAN_BITFIELD
437 uint64_t data:64;
438#else
439 uint64_t data:64;
440#endif
441 } s;
442};
443
444union cvmx_iob_inb_data_match_enb {
445 uint64_t u64;
446 struct cvmx_iob_inb_data_match_enb_s {
447#ifdef __BIG_ENDIAN_BITFIELD
448 uint64_t data:64;
449#else
450 uint64_t data:64;
451#endif
452 } s;
453};
454
455union cvmx_iob_int_enb {
456 uint64_t u64;
457 struct cvmx_iob_int_enb_s {
458#ifdef __BIG_ENDIAN_BITFIELD
459 uint64_t reserved_6_63:58;
460 uint64_t p_dat:1;
461 uint64_t np_dat:1;
462 uint64_t p_eop:1;
463 uint64_t p_sop:1;
464 uint64_t np_eop:1;
465 uint64_t np_sop:1;
466#else
467 uint64_t np_sop:1;
468 uint64_t np_eop:1;
469 uint64_t p_sop:1;
470 uint64_t p_eop:1;
471 uint64_t np_dat:1;
472 uint64_t p_dat:1;
473 uint64_t reserved_6_63:58;
474#endif
475 } s;
476 struct cvmx_iob_int_enb_cn30xx {
477#ifdef __BIG_ENDIAN_BITFIELD
478 uint64_t reserved_4_63:60;
479 uint64_t p_eop:1;
480 uint64_t p_sop:1;
481 uint64_t np_eop:1;
482 uint64_t np_sop:1;
483#else
484 uint64_t np_sop:1;
485 uint64_t np_eop:1;
486 uint64_t p_sop:1;
487 uint64_t p_eop:1;
488 uint64_t reserved_4_63:60;
489#endif
490 } cn30xx;
491 struct cvmx_iob_int_enb_cn68xx {
492#ifdef __BIG_ENDIAN_BITFIELD
493 uint64_t reserved_0_63:64;
494#else
495 uint64_t reserved_0_63:64;
496#endif
497 } cn68xx;
498};
499
500union cvmx_iob_int_sum {
501 uint64_t u64;
502 struct cvmx_iob_int_sum_s {
503#ifdef __BIG_ENDIAN_BITFIELD
504 uint64_t reserved_6_63:58;
505 uint64_t p_dat:1;
506 uint64_t np_dat:1;
507 uint64_t p_eop:1;
508 uint64_t p_sop:1;
509 uint64_t np_eop:1;
510 uint64_t np_sop:1;
511#else
512 uint64_t np_sop:1;
513 uint64_t np_eop:1;
514 uint64_t p_sop:1;
515 uint64_t p_eop:1;
516 uint64_t np_dat:1;
517 uint64_t p_dat:1;
518 uint64_t reserved_6_63:58;
519#endif
520 } s;
521 struct cvmx_iob_int_sum_cn30xx {
522#ifdef __BIG_ENDIAN_BITFIELD
523 uint64_t reserved_4_63:60;
524 uint64_t p_eop:1;
525 uint64_t p_sop:1;
526 uint64_t np_eop:1;
527 uint64_t np_sop:1;
528#else
529 uint64_t np_sop:1;
530 uint64_t np_eop:1;
531 uint64_t p_sop:1;
532 uint64_t p_eop:1;
533 uint64_t reserved_4_63:60;
534#endif
535 } cn30xx;
536 struct cvmx_iob_int_sum_cn68xx {
537#ifdef __BIG_ENDIAN_BITFIELD
538 uint64_t reserved_0_63:64;
539#else
540 uint64_t reserved_0_63:64;
541#endif
542 } cn68xx;
543};
544
545union cvmx_iob_n2c_l2c_pri_cnt {
546 uint64_t u64;
547 struct cvmx_iob_n2c_l2c_pri_cnt_s {
548#ifdef __BIG_ENDIAN_BITFIELD
549 uint64_t reserved_16_63:48;
550 uint64_t cnt_enb:1;
551 uint64_t cnt_val:15;
552#else
553 uint64_t cnt_val:15;
554 uint64_t cnt_enb:1;
555 uint64_t reserved_16_63:48;
556#endif
557 } s;
558};
559
560union cvmx_iob_n2c_rsp_pri_cnt {
561 uint64_t u64;
562 struct cvmx_iob_n2c_rsp_pri_cnt_s {
563#ifdef __BIG_ENDIAN_BITFIELD
564 uint64_t reserved_16_63:48;
565 uint64_t cnt_enb:1;
566 uint64_t cnt_val:15;
567#else
568 uint64_t cnt_val:15;
569 uint64_t cnt_enb:1;
570 uint64_t reserved_16_63:48;
571#endif
572 } s;
573};
574
575union cvmx_iob_outb_com_pri_cnt {
576 uint64_t u64;
577 struct cvmx_iob_outb_com_pri_cnt_s {
578#ifdef __BIG_ENDIAN_BITFIELD
579 uint64_t reserved_16_63:48;
580 uint64_t cnt_enb:1;
581 uint64_t cnt_val:15;
582#else
583 uint64_t cnt_val:15;
584 uint64_t cnt_enb:1;
585 uint64_t reserved_16_63:48;
586#endif
587 } s;
588};
589
590union cvmx_iob_outb_control_match {
591 uint64_t u64;
592 struct cvmx_iob_outb_control_match_s {
593#ifdef __BIG_ENDIAN_BITFIELD
594 uint64_t reserved_26_63:38;
595 uint64_t mask:8;
596 uint64_t eot:1;
597 uint64_t dst:8;
598 uint64_t src:9;
599#else
600 uint64_t src:9;
601 uint64_t dst:8;
602 uint64_t eot:1;
603 uint64_t mask:8;
604 uint64_t reserved_26_63:38;
605#endif
606 } s;
607};
608
609union cvmx_iob_outb_control_match_enb {
610 uint64_t u64;
611 struct cvmx_iob_outb_control_match_enb_s {
612#ifdef __BIG_ENDIAN_BITFIELD
613 uint64_t reserved_26_63:38;
614 uint64_t mask:8;
615 uint64_t eot:1;
616 uint64_t dst:8;
617 uint64_t src:9;
618#else
619 uint64_t src:9;
620 uint64_t dst:8;
621 uint64_t eot:1;
622 uint64_t mask:8;
623 uint64_t reserved_26_63:38;
624#endif
625 } s;
626};
627
628union cvmx_iob_outb_data_match {
629 uint64_t u64;
630 struct cvmx_iob_outb_data_match_s {
631#ifdef __BIG_ENDIAN_BITFIELD
632 uint64_t data:64;
633#else
634 uint64_t data:64;
635#endif
636 } s;
637};
638
639union cvmx_iob_outb_data_match_enb {
640 uint64_t u64;
641 struct cvmx_iob_outb_data_match_enb_s {
642#ifdef __BIG_ENDIAN_BITFIELD
643 uint64_t data:64;
644#else
645 uint64_t data:64;
646#endif
647 } s;
648};
649
650union cvmx_iob_outb_fpa_pri_cnt {
651 uint64_t u64;
652 struct cvmx_iob_outb_fpa_pri_cnt_s {
653#ifdef __BIG_ENDIAN_BITFIELD
654 uint64_t reserved_16_63:48;
655 uint64_t cnt_enb:1;
656 uint64_t cnt_val:15;
657#else
658 uint64_t cnt_val:15;
659 uint64_t cnt_enb:1;
660 uint64_t reserved_16_63:48;
661#endif
662 } s;
663};
664
665union cvmx_iob_outb_req_pri_cnt {
666 uint64_t u64;
667 struct cvmx_iob_outb_req_pri_cnt_s {
668#ifdef __BIG_ENDIAN_BITFIELD
669 uint64_t reserved_16_63:48;
670 uint64_t cnt_enb:1;
671 uint64_t cnt_val:15;
672#else
673 uint64_t cnt_val:15;
674 uint64_t cnt_enb:1;
675 uint64_t reserved_16_63:48;
676#endif
677 } s;
678};
679
680union cvmx_iob_p2c_req_pri_cnt {
681 uint64_t u64;
682 struct cvmx_iob_p2c_req_pri_cnt_s {
683#ifdef __BIG_ENDIAN_BITFIELD
684 uint64_t reserved_16_63:48;
685 uint64_t cnt_enb:1;
686 uint64_t cnt_val:15;
687#else
688 uint64_t cnt_val:15;
689 uint64_t cnt_enb:1;
690 uint64_t reserved_16_63:48;
691#endif
692 } s;
693};
694
695union cvmx_iob_pkt_err {
696 uint64_t u64;
697 struct cvmx_iob_pkt_err_s {
698#ifdef __BIG_ENDIAN_BITFIELD
699 uint64_t reserved_12_63:52;
700 uint64_t vport:6;
701 uint64_t port:6;
702#else
703 uint64_t port:6;
704 uint64_t vport:6;
705 uint64_t reserved_12_63:52;
706#endif
707 } s;
708 struct cvmx_iob_pkt_err_cn30xx {
709#ifdef __BIG_ENDIAN_BITFIELD
710 uint64_t reserved_6_63:58;
711 uint64_t port:6;
712#else
713 uint64_t port:6;
714 uint64_t reserved_6_63:58;
715#endif
716 } cn30xx;
717};
718
719union cvmx_iob_to_cmb_credits {
720 uint64_t u64;
721 struct cvmx_iob_to_cmb_credits_s {
722#ifdef __BIG_ENDIAN_BITFIELD
723 uint64_t reserved_6_63:58;
724 uint64_t ncb_rd:3;
725 uint64_t ncb_wr:3;
726#else
727 uint64_t ncb_wr:3;
728 uint64_t ncb_rd:3;
729 uint64_t reserved_6_63:58;
730#endif
731 } s;
732 struct cvmx_iob_to_cmb_credits_cn52xx {
733#ifdef __BIG_ENDIAN_BITFIELD
734 uint64_t reserved_9_63:55;
735 uint64_t pko_rd:3;
736 uint64_t ncb_rd:3;
737 uint64_t ncb_wr:3;
738#else
739 uint64_t ncb_wr:3;
740 uint64_t ncb_rd:3;
741 uint64_t pko_rd:3;
742 uint64_t reserved_9_63:55;
743#endif
744 } cn52xx;
745 struct cvmx_iob_to_cmb_credits_cn68xx {
746#ifdef __BIG_ENDIAN_BITFIELD
747 uint64_t reserved_9_63:55;
748 uint64_t dwb:3;
749 uint64_t ncb_rd:3;
750 uint64_t ncb_wr:3;
751#else
752 uint64_t ncb_wr:3;
753 uint64_t ncb_rd:3;
754 uint64_t dwb:3;
755 uint64_t reserved_9_63:55;
756#endif
757 } cn68xx;
758};
759
760union cvmx_iob_to_ncb_did_00_credits {
761 uint64_t u64;
762 struct cvmx_iob_to_ncb_did_00_credits_s {
763#ifdef __BIG_ENDIAN_BITFIELD
764 uint64_t reserved_7_63:57;
765 uint64_t crd:7;
766#else
767 uint64_t crd:7;
768 uint64_t reserved_7_63:57;
769#endif
770 } s;
771};
772
773union cvmx_iob_to_ncb_did_111_credits {
774 uint64_t u64;
775 struct cvmx_iob_to_ncb_did_111_credits_s {
776#ifdef __BIG_ENDIAN_BITFIELD
777 uint64_t reserved_7_63:57;
778 uint64_t crd:7;
779#else
780 uint64_t crd:7;
781 uint64_t reserved_7_63:57;
782#endif
783 } s;
784};
785
786union cvmx_iob_to_ncb_did_223_credits {
787 uint64_t u64;
788 struct cvmx_iob_to_ncb_did_223_credits_s {
789#ifdef __BIG_ENDIAN_BITFIELD
790 uint64_t reserved_7_63:57;
791 uint64_t crd:7;
792#else
793 uint64_t crd:7;
794 uint64_t reserved_7_63:57;
795#endif
796 } s;
797};
798
799union cvmx_iob_to_ncb_did_24_credits {
800 uint64_t u64;
801 struct cvmx_iob_to_ncb_did_24_credits_s {
802#ifdef __BIG_ENDIAN_BITFIELD
803 uint64_t reserved_7_63:57;
804 uint64_t crd:7;
805#else
806 uint64_t crd:7;
807 uint64_t reserved_7_63:57;
808#endif
809 } s;
810};
811
812union cvmx_iob_to_ncb_did_32_credits {
813 uint64_t u64;
814 struct cvmx_iob_to_ncb_did_32_credits_s {
815#ifdef __BIG_ENDIAN_BITFIELD
816 uint64_t reserved_7_63:57;
817 uint64_t crd:7;
818#else
819 uint64_t crd:7;
820 uint64_t reserved_7_63:57;
821#endif
822 } s;
823};
824
825union cvmx_iob_to_ncb_did_40_credits {
826 uint64_t u64;
827 struct cvmx_iob_to_ncb_did_40_credits_s {
828#ifdef __BIG_ENDIAN_BITFIELD
829 uint64_t reserved_7_63:57;
830 uint64_t crd:7;
831#else
832 uint64_t crd:7;
833 uint64_t reserved_7_63:57;
834#endif
835 } s;
836};
837
838union cvmx_iob_to_ncb_did_55_credits {
839 uint64_t u64;
840 struct cvmx_iob_to_ncb_did_55_credits_s {
841#ifdef __BIG_ENDIAN_BITFIELD
842 uint64_t reserved_7_63:57;
843 uint64_t crd:7;
844#else
845 uint64_t crd:7;
846 uint64_t reserved_7_63:57;
847#endif
848 } s;
849};
850
851union cvmx_iob_to_ncb_did_64_credits {
852 uint64_t u64;
853 struct cvmx_iob_to_ncb_did_64_credits_s {
854#ifdef __BIG_ENDIAN_BITFIELD
855 uint64_t reserved_7_63:57;
856 uint64_t crd:7;
857#else
858 uint64_t crd:7;
859 uint64_t reserved_7_63:57;
860#endif
861 } s;
862};
863
864union cvmx_iob_to_ncb_did_79_credits {
865 uint64_t u64;
866 struct cvmx_iob_to_ncb_did_79_credits_s {
867#ifdef __BIG_ENDIAN_BITFIELD
868 uint64_t reserved_7_63:57;
869 uint64_t crd:7;
870#else
871 uint64_t crd:7;
872 uint64_t reserved_7_63:57;
873#endif
874 } s;
875};
876
877union cvmx_iob_to_ncb_did_96_credits {
878 uint64_t u64;
879 struct cvmx_iob_to_ncb_did_96_credits_s {
880#ifdef __BIG_ENDIAN_BITFIELD
881 uint64_t reserved_7_63:57;
882 uint64_t crd:7;
883#else
884 uint64_t crd:7;
885 uint64_t reserved_7_63:57;
886#endif
887 } s;
888};
889
890union cvmx_iob_to_ncb_did_98_credits {
891 uint64_t u64;
892 struct cvmx_iob_to_ncb_did_98_credits_s {
893#ifdef __BIG_ENDIAN_BITFIELD
894 uint64_t reserved_7_63:57;
895 uint64_t crd:7;
896#else
897 uint64_t crd:7;
898 uint64_t reserved_7_63:57;
899#endif
900 } s;
901};
902
903#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-ipd-defs.h b/arch/mips/include/asm/octeon/cvmx-ipd-defs.h
new file mode 100644
index 000000000..c0a4ac7b4
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-ipd-defs.h
@@ -0,0 +1,1472 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_IPD_DEFS_H__
29#define __CVMX_IPD_DEFS_H__
30
31#define CVMX_IPD_1ST_MBUFF_SKIP (CVMX_ADD_IO_SEG(0x00014F0000000000ull))
32#define CVMX_IPD_1st_NEXT_PTR_BACK (CVMX_ADD_IO_SEG(0x00014F0000000150ull))
33#define CVMX_IPD_2nd_NEXT_PTR_BACK (CVMX_ADD_IO_SEG(0x00014F0000000158ull))
34#define CVMX_IPD_BIST_STATUS (CVMX_ADD_IO_SEG(0x00014F00000007F8ull))
35#define CVMX_IPD_BPIDX_MBUF_TH(offset) (CVMX_ADD_IO_SEG(0x00014F0000002000ull) + ((offset) & 63) * 8)
36#define CVMX_IPD_BPID_BP_COUNTERX(offset) (CVMX_ADD_IO_SEG(0x00014F0000003000ull) + ((offset) & 63) * 8)
37#define CVMX_IPD_BP_PRT_RED_END (CVMX_ADD_IO_SEG(0x00014F0000000328ull))
38#define CVMX_IPD_CLK_COUNT (CVMX_ADD_IO_SEG(0x00014F0000000338ull))
39#define CVMX_IPD_CREDITS (CVMX_ADD_IO_SEG(0x00014F0000004410ull))
40#define CVMX_IPD_CTL_STATUS (CVMX_ADD_IO_SEG(0x00014F0000000018ull))
41#define CVMX_IPD_ECC_CTL (CVMX_ADD_IO_SEG(0x00014F0000004408ull))
42#define CVMX_IPD_FREE_PTR_FIFO_CTL (CVMX_ADD_IO_SEG(0x00014F0000000780ull))
43#define CVMX_IPD_FREE_PTR_VALUE (CVMX_ADD_IO_SEG(0x00014F0000000788ull))
44#define CVMX_IPD_HOLD_PTR_FIFO_CTL (CVMX_ADD_IO_SEG(0x00014F0000000790ull))
45#define CVMX_IPD_INT_ENB (CVMX_ADD_IO_SEG(0x00014F0000000160ull))
46#define CVMX_IPD_INT_SUM (CVMX_ADD_IO_SEG(0x00014F0000000168ull))
47#define CVMX_IPD_NEXT_PKT_PTR (CVMX_ADD_IO_SEG(0x00014F00000007A0ull))
48#define CVMX_IPD_NEXT_WQE_PTR (CVMX_ADD_IO_SEG(0x00014F00000007A8ull))
49#define CVMX_IPD_NOT_1ST_MBUFF_SKIP (CVMX_ADD_IO_SEG(0x00014F0000000008ull))
50#define CVMX_IPD_ON_BP_DROP_PKTX(block_id) (CVMX_ADD_IO_SEG(0x00014F0000004100ull))
51#define CVMX_IPD_PACKET_MBUFF_SIZE (CVMX_ADD_IO_SEG(0x00014F0000000010ull))
52#define CVMX_IPD_PKT_ERR (CVMX_ADD_IO_SEG(0x00014F00000003F0ull))
53#define CVMX_IPD_PKT_PTR_VALID (CVMX_ADD_IO_SEG(0x00014F0000000358ull))
54#define CVMX_IPD_PORTX_BP_PAGE_CNT(offset) (CVMX_ADD_IO_SEG(0x00014F0000000028ull) + ((offset) & 63) * 8)
55#define CVMX_IPD_PORTX_BP_PAGE_CNT2(offset) (CVMX_ADD_IO_SEG(0x00014F0000000368ull) + ((offset) & 63) * 8 - 8*36)
56#define CVMX_IPD_PORTX_BP_PAGE_CNT3(offset) (CVMX_ADD_IO_SEG(0x00014F00000003D0ull) + ((offset) & 63) * 8 - 8*40)
57#define CVMX_IPD_PORT_BP_COUNTERS2_PAIRX(offset) (CVMX_ADD_IO_SEG(0x00014F0000000388ull) + ((offset) & 63) * 8 - 8*36)
58#define CVMX_IPD_PORT_BP_COUNTERS3_PAIRX(offset) (CVMX_ADD_IO_SEG(0x00014F00000003B0ull) + ((offset) & 63) * 8 - 8*40)
59#define CVMX_IPD_PORT_BP_COUNTERS4_PAIRX(offset) (CVMX_ADD_IO_SEG(0x00014F0000000410ull) + ((offset) & 63) * 8 - 8*44)
60#define CVMX_IPD_PORT_BP_COUNTERS_PAIRX(offset) (CVMX_ADD_IO_SEG(0x00014F00000001B8ull) + ((offset) & 63) * 8)
61#define CVMX_IPD_PORT_PTR_FIFO_CTL (CVMX_ADD_IO_SEG(0x00014F0000000798ull))
62#define CVMX_IPD_PORT_QOS_INTX(offset) (CVMX_ADD_IO_SEG(0x00014F0000000808ull) + ((offset) & 7) * 8)
63#define CVMX_IPD_PORT_QOS_INT_ENBX(offset) (CVMX_ADD_IO_SEG(0x00014F0000000848ull) + ((offset) & 7) * 8)
64#define CVMX_IPD_PORT_QOS_X_CNT(offset) (CVMX_ADD_IO_SEG(0x00014F0000000888ull) + ((offset) & 511) * 8)
65#define CVMX_IPD_PORT_SOPX(block_id) (CVMX_ADD_IO_SEG(0x00014F0000004400ull))
66#define CVMX_IPD_PRC_HOLD_PTR_FIFO_CTL (CVMX_ADD_IO_SEG(0x00014F0000000348ull))
67#define CVMX_IPD_PRC_PORT_PTR_FIFO_CTL (CVMX_ADD_IO_SEG(0x00014F0000000350ull))
68#define CVMX_IPD_PTR_COUNT (CVMX_ADD_IO_SEG(0x00014F0000000320ull))
69#define CVMX_IPD_PWP_PTR_FIFO_CTL (CVMX_ADD_IO_SEG(0x00014F0000000340ull))
70#define CVMX_IPD_QOS0_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(0)
71#define CVMX_IPD_QOS1_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(1)
72#define CVMX_IPD_QOS2_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(2)
73#define CVMX_IPD_QOS3_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(3)
74#define CVMX_IPD_QOS4_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(4)
75#define CVMX_IPD_QOS5_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(5)
76#define CVMX_IPD_QOS6_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(6)
77#define CVMX_IPD_QOS7_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(7)
78#define CVMX_IPD_QOSX_RED_MARKS(offset) (CVMX_ADD_IO_SEG(0x00014F0000000178ull) + ((offset) & 7) * 8)
79#define CVMX_IPD_QUE0_FREE_PAGE_CNT (CVMX_ADD_IO_SEG(0x00014F0000000330ull))
80#define CVMX_IPD_RED_BPID_ENABLEX(block_id) (CVMX_ADD_IO_SEG(0x00014F0000004200ull))
81#define CVMX_IPD_RED_DELAY (CVMX_ADD_IO_SEG(0x00014F0000004300ull))
82#define CVMX_IPD_RED_PORT_ENABLE (CVMX_ADD_IO_SEG(0x00014F00000002D8ull))
83#define CVMX_IPD_RED_PORT_ENABLE2 (CVMX_ADD_IO_SEG(0x00014F00000003A8ull))
84#define CVMX_IPD_RED_QUE0_PARAM CVMX_IPD_RED_QUEX_PARAM(0)
85#define CVMX_IPD_RED_QUE1_PARAM CVMX_IPD_RED_QUEX_PARAM(1)
86#define CVMX_IPD_RED_QUE2_PARAM CVMX_IPD_RED_QUEX_PARAM(2)
87#define CVMX_IPD_RED_QUE3_PARAM CVMX_IPD_RED_QUEX_PARAM(3)
88#define CVMX_IPD_RED_QUE4_PARAM CVMX_IPD_RED_QUEX_PARAM(4)
89#define CVMX_IPD_RED_QUE5_PARAM CVMX_IPD_RED_QUEX_PARAM(5)
90#define CVMX_IPD_RED_QUE6_PARAM CVMX_IPD_RED_QUEX_PARAM(6)
91#define CVMX_IPD_RED_QUE7_PARAM CVMX_IPD_RED_QUEX_PARAM(7)
92#define CVMX_IPD_RED_QUEX_PARAM(offset) (CVMX_ADD_IO_SEG(0x00014F00000002E0ull) + ((offset) & 7) * 8)
93#define CVMX_IPD_REQ_WGT (CVMX_ADD_IO_SEG(0x00014F0000004418ull))
94#define CVMX_IPD_SUB_PORT_BP_PAGE_CNT (CVMX_ADD_IO_SEG(0x00014F0000000148ull))
95#define CVMX_IPD_SUB_PORT_FCS (CVMX_ADD_IO_SEG(0x00014F0000000170ull))
96#define CVMX_IPD_SUB_PORT_QOS_CNT (CVMX_ADD_IO_SEG(0x00014F0000000800ull))
97#define CVMX_IPD_WQE_FPA_QUEUE (CVMX_ADD_IO_SEG(0x00014F0000000020ull))
98#define CVMX_IPD_WQE_PTR_VALID (CVMX_ADD_IO_SEG(0x00014F0000000360ull))
99
100union cvmx_ipd_1st_mbuff_skip {
101 uint64_t u64;
102 struct cvmx_ipd_1st_mbuff_skip_s {
103#ifdef __BIG_ENDIAN_BITFIELD
104 uint64_t reserved_6_63:58;
105 uint64_t skip_sz:6;
106#else
107 uint64_t skip_sz:6;
108 uint64_t reserved_6_63:58;
109#endif
110 } s;
111};
112
113union cvmx_ipd_1st_next_ptr_back {
114 uint64_t u64;
115 struct cvmx_ipd_1st_next_ptr_back_s {
116#ifdef __BIG_ENDIAN_BITFIELD
117 uint64_t reserved_4_63:60;
118 uint64_t back:4;
119#else
120 uint64_t back:4;
121 uint64_t reserved_4_63:60;
122#endif
123 } s;
124};
125
126union cvmx_ipd_2nd_next_ptr_back {
127 uint64_t u64;
128 struct cvmx_ipd_2nd_next_ptr_back_s {
129#ifdef __BIG_ENDIAN_BITFIELD
130 uint64_t reserved_4_63:60;
131 uint64_t back:4;
132#else
133 uint64_t back:4;
134 uint64_t reserved_4_63:60;
135#endif
136 } s;
137};
138
139union cvmx_ipd_bist_status {
140 uint64_t u64;
141 struct cvmx_ipd_bist_status_s {
142#ifdef __BIG_ENDIAN_BITFIELD
143 uint64_t reserved_23_63:41;
144 uint64_t iiwo1:1;
145 uint64_t iiwo0:1;
146 uint64_t iio1:1;
147 uint64_t iio0:1;
148 uint64_t pbm4:1;
149 uint64_t csr_mem:1;
150 uint64_t csr_ncmd:1;
151 uint64_t pwq_wqed:1;
152 uint64_t pwq_wp1:1;
153 uint64_t pwq_pow:1;
154 uint64_t ipq_pbe1:1;
155 uint64_t ipq_pbe0:1;
156 uint64_t pbm3:1;
157 uint64_t pbm2:1;
158 uint64_t pbm1:1;
159 uint64_t pbm0:1;
160 uint64_t pbm_word:1;
161 uint64_t pwq1:1;
162 uint64_t pwq0:1;
163 uint64_t prc_off:1;
164 uint64_t ipd_old:1;
165 uint64_t ipd_new:1;
166 uint64_t pwp:1;
167#else
168 uint64_t pwp:1;
169 uint64_t ipd_new:1;
170 uint64_t ipd_old:1;
171 uint64_t prc_off:1;
172 uint64_t pwq0:1;
173 uint64_t pwq1:1;
174 uint64_t pbm_word:1;
175 uint64_t pbm0:1;
176 uint64_t pbm1:1;
177 uint64_t pbm2:1;
178 uint64_t pbm3:1;
179 uint64_t ipq_pbe0:1;
180 uint64_t ipq_pbe1:1;
181 uint64_t pwq_pow:1;
182 uint64_t pwq_wp1:1;
183 uint64_t pwq_wqed:1;
184 uint64_t csr_ncmd:1;
185 uint64_t csr_mem:1;
186 uint64_t pbm4:1;
187 uint64_t iio0:1;
188 uint64_t iio1:1;
189 uint64_t iiwo0:1;
190 uint64_t iiwo1:1;
191 uint64_t reserved_23_63:41;
192#endif
193 } s;
194 struct cvmx_ipd_bist_status_cn30xx {
195#ifdef __BIG_ENDIAN_BITFIELD
196 uint64_t reserved_16_63:48;
197 uint64_t pwq_wqed:1;
198 uint64_t pwq_wp1:1;
199 uint64_t pwq_pow:1;
200 uint64_t ipq_pbe1:1;
201 uint64_t ipq_pbe0:1;
202 uint64_t pbm3:1;
203 uint64_t pbm2:1;
204 uint64_t pbm1:1;
205 uint64_t pbm0:1;
206 uint64_t pbm_word:1;
207 uint64_t pwq1:1;
208 uint64_t pwq0:1;
209 uint64_t prc_off:1;
210 uint64_t ipd_old:1;
211 uint64_t ipd_new:1;
212 uint64_t pwp:1;
213#else
214 uint64_t pwp:1;
215 uint64_t ipd_new:1;
216 uint64_t ipd_old:1;
217 uint64_t prc_off:1;
218 uint64_t pwq0:1;
219 uint64_t pwq1:1;
220 uint64_t pbm_word:1;
221 uint64_t pbm0:1;
222 uint64_t pbm1:1;
223 uint64_t pbm2:1;
224 uint64_t pbm3:1;
225 uint64_t ipq_pbe0:1;
226 uint64_t ipq_pbe1:1;
227 uint64_t pwq_pow:1;
228 uint64_t pwq_wp1:1;
229 uint64_t pwq_wqed:1;
230 uint64_t reserved_16_63:48;
231#endif
232 } cn30xx;
233 struct cvmx_ipd_bist_status_cn52xx {
234#ifdef __BIG_ENDIAN_BITFIELD
235 uint64_t reserved_18_63:46;
236 uint64_t csr_mem:1;
237 uint64_t csr_ncmd:1;
238 uint64_t pwq_wqed:1;
239 uint64_t pwq_wp1:1;
240 uint64_t pwq_pow:1;
241 uint64_t ipq_pbe1:1;
242 uint64_t ipq_pbe0:1;
243 uint64_t pbm3:1;
244 uint64_t pbm2:1;
245 uint64_t pbm1:1;
246 uint64_t pbm0:1;
247 uint64_t pbm_word:1;
248 uint64_t pwq1:1;
249 uint64_t pwq0:1;
250 uint64_t prc_off:1;
251 uint64_t ipd_old:1;
252 uint64_t ipd_new:1;
253 uint64_t pwp:1;
254#else
255 uint64_t pwp:1;
256 uint64_t ipd_new:1;
257 uint64_t ipd_old:1;
258 uint64_t prc_off:1;
259 uint64_t pwq0:1;
260 uint64_t pwq1:1;
261 uint64_t pbm_word:1;
262 uint64_t pbm0:1;
263 uint64_t pbm1:1;
264 uint64_t pbm2:1;
265 uint64_t pbm3:1;
266 uint64_t ipq_pbe0:1;
267 uint64_t ipq_pbe1:1;
268 uint64_t pwq_pow:1;
269 uint64_t pwq_wp1:1;
270 uint64_t pwq_wqed:1;
271 uint64_t csr_ncmd:1;
272 uint64_t csr_mem:1;
273 uint64_t reserved_18_63:46;
274#endif
275 } cn52xx;
276};
277
278union cvmx_ipd_bp_prt_red_end {
279 uint64_t u64;
280 struct cvmx_ipd_bp_prt_red_end_s {
281#ifdef __BIG_ENDIAN_BITFIELD
282 uint64_t reserved_48_63:16;
283 uint64_t prt_enb:48;
284#else
285 uint64_t prt_enb:48;
286 uint64_t reserved_48_63:16;
287#endif
288 } s;
289 struct cvmx_ipd_bp_prt_red_end_cn30xx {
290#ifdef __BIG_ENDIAN_BITFIELD
291 uint64_t reserved_36_63:28;
292 uint64_t prt_enb:36;
293#else
294 uint64_t prt_enb:36;
295 uint64_t reserved_36_63:28;
296#endif
297 } cn30xx;
298 struct cvmx_ipd_bp_prt_red_end_cn52xx {
299#ifdef __BIG_ENDIAN_BITFIELD
300 uint64_t reserved_40_63:24;
301 uint64_t prt_enb:40;
302#else
303 uint64_t prt_enb:40;
304 uint64_t reserved_40_63:24;
305#endif
306 } cn52xx;
307 struct cvmx_ipd_bp_prt_red_end_cn63xx {
308#ifdef __BIG_ENDIAN_BITFIELD
309 uint64_t reserved_44_63:20;
310 uint64_t prt_enb:44;
311#else
312 uint64_t prt_enb:44;
313 uint64_t reserved_44_63:20;
314#endif
315 } cn63xx;
316};
317
318union cvmx_ipd_bpidx_mbuf_th {
319 uint64_t u64;
320 struct cvmx_ipd_bpidx_mbuf_th_s {
321#ifdef __BIG_ENDIAN_BITFIELD
322 uint64_t reserved_18_63:46;
323 uint64_t bp_enb:1;
324 uint64_t page_cnt:17;
325#else
326 uint64_t page_cnt:17;
327 uint64_t bp_enb:1;
328 uint64_t reserved_18_63:46;
329#endif
330 } s;
331};
332
333union cvmx_ipd_bpid_bp_counterx {
334 uint64_t u64;
335 struct cvmx_ipd_bpid_bp_counterx_s {
336#ifdef __BIG_ENDIAN_BITFIELD
337 uint64_t reserved_25_63:39;
338 uint64_t cnt_val:25;
339#else
340 uint64_t cnt_val:25;
341 uint64_t reserved_25_63:39;
342#endif
343 } s;
344};
345
346union cvmx_ipd_clk_count {
347 uint64_t u64;
348 struct cvmx_ipd_clk_count_s {
349#ifdef __BIG_ENDIAN_BITFIELD
350 uint64_t clk_cnt:64;
351#else
352 uint64_t clk_cnt:64;
353#endif
354 } s;
355};
356
357union cvmx_ipd_credits {
358 uint64_t u64;
359 struct cvmx_ipd_credits_s {
360#ifdef __BIG_ENDIAN_BITFIELD
361 uint64_t reserved_16_63:48;
362 uint64_t iob_wrc:8;
363 uint64_t iob_wr:8;
364#else
365 uint64_t iob_wr:8;
366 uint64_t iob_wrc:8;
367 uint64_t reserved_16_63:48;
368#endif
369 } s;
370};
371
372union cvmx_ipd_ctl_status {
373 uint64_t u64;
374 struct cvmx_ipd_ctl_status_s {
375#ifdef __BIG_ENDIAN_BITFIELD
376 uint64_t reserved_18_63:46;
377 uint64_t use_sop:1;
378 uint64_t rst_done:1;
379 uint64_t clken:1;
380 uint64_t no_wptr:1;
381 uint64_t pq_apkt:1;
382 uint64_t pq_nabuf:1;
383 uint64_t ipd_full:1;
384 uint64_t pkt_off:1;
385 uint64_t len_m8:1;
386 uint64_t reset:1;
387 uint64_t addpkt:1;
388 uint64_t naddbuf:1;
389 uint64_t pkt_lend:1;
390 uint64_t wqe_lend:1;
391 uint64_t pbp_en:1;
392 uint64_t opc_mode:2;
393 uint64_t ipd_en:1;
394#else
395 uint64_t ipd_en:1;
396 uint64_t opc_mode:2;
397 uint64_t pbp_en:1;
398 uint64_t wqe_lend:1;
399 uint64_t pkt_lend:1;
400 uint64_t naddbuf:1;
401 uint64_t addpkt:1;
402 uint64_t reset:1;
403 uint64_t len_m8:1;
404 uint64_t pkt_off:1;
405 uint64_t ipd_full:1;
406 uint64_t pq_nabuf:1;
407 uint64_t pq_apkt:1;
408 uint64_t no_wptr:1;
409 uint64_t clken:1;
410 uint64_t rst_done:1;
411 uint64_t use_sop:1;
412 uint64_t reserved_18_63:46;
413#endif
414 } s;
415 struct cvmx_ipd_ctl_status_cn30xx {
416#ifdef __BIG_ENDIAN_BITFIELD
417 uint64_t reserved_10_63:54;
418 uint64_t len_m8:1;
419 uint64_t reset:1;
420 uint64_t addpkt:1;
421 uint64_t naddbuf:1;
422 uint64_t pkt_lend:1;
423 uint64_t wqe_lend:1;
424 uint64_t pbp_en:1;
425 uint64_t opc_mode:2;
426 uint64_t ipd_en:1;
427#else
428 uint64_t ipd_en:1;
429 uint64_t opc_mode:2;
430 uint64_t pbp_en:1;
431 uint64_t wqe_lend:1;
432 uint64_t pkt_lend:1;
433 uint64_t naddbuf:1;
434 uint64_t addpkt:1;
435 uint64_t reset:1;
436 uint64_t len_m8:1;
437 uint64_t reserved_10_63:54;
438#endif
439 } cn30xx;
440 struct cvmx_ipd_ctl_status_cn38xxp2 {
441#ifdef __BIG_ENDIAN_BITFIELD
442 uint64_t reserved_9_63:55;
443 uint64_t reset:1;
444 uint64_t addpkt:1;
445 uint64_t naddbuf:1;
446 uint64_t pkt_lend:1;
447 uint64_t wqe_lend:1;
448 uint64_t pbp_en:1;
449 uint64_t opc_mode:2;
450 uint64_t ipd_en:1;
451#else
452 uint64_t ipd_en:1;
453 uint64_t opc_mode:2;
454 uint64_t pbp_en:1;
455 uint64_t wqe_lend:1;
456 uint64_t pkt_lend:1;
457 uint64_t naddbuf:1;
458 uint64_t addpkt:1;
459 uint64_t reset:1;
460 uint64_t reserved_9_63:55;
461#endif
462 } cn38xxp2;
463 struct cvmx_ipd_ctl_status_cn50xx {
464#ifdef __BIG_ENDIAN_BITFIELD
465 uint64_t reserved_15_63:49;
466 uint64_t no_wptr:1;
467 uint64_t pq_apkt:1;
468 uint64_t pq_nabuf:1;
469 uint64_t ipd_full:1;
470 uint64_t pkt_off:1;
471 uint64_t len_m8:1;
472 uint64_t reset:1;
473 uint64_t addpkt:1;
474 uint64_t naddbuf:1;
475 uint64_t pkt_lend:1;
476 uint64_t wqe_lend:1;
477 uint64_t pbp_en:1;
478 uint64_t opc_mode:2;
479 uint64_t ipd_en:1;
480#else
481 uint64_t ipd_en:1;
482 uint64_t opc_mode:2;
483 uint64_t pbp_en:1;
484 uint64_t wqe_lend:1;
485 uint64_t pkt_lend:1;
486 uint64_t naddbuf:1;
487 uint64_t addpkt:1;
488 uint64_t reset:1;
489 uint64_t len_m8:1;
490 uint64_t pkt_off:1;
491 uint64_t ipd_full:1;
492 uint64_t pq_nabuf:1;
493 uint64_t pq_apkt:1;
494 uint64_t no_wptr:1;
495 uint64_t reserved_15_63:49;
496#endif
497 } cn50xx;
498 struct cvmx_ipd_ctl_status_cn58xx {
499#ifdef __BIG_ENDIAN_BITFIELD
500 uint64_t reserved_12_63:52;
501 uint64_t ipd_full:1;
502 uint64_t pkt_off:1;
503 uint64_t len_m8:1;
504 uint64_t reset:1;
505 uint64_t addpkt:1;
506 uint64_t naddbuf:1;
507 uint64_t pkt_lend:1;
508 uint64_t wqe_lend:1;
509 uint64_t pbp_en:1;
510 uint64_t opc_mode:2;
511 uint64_t ipd_en:1;
512#else
513 uint64_t ipd_en:1;
514 uint64_t opc_mode:2;
515 uint64_t pbp_en:1;
516 uint64_t wqe_lend:1;
517 uint64_t pkt_lend:1;
518 uint64_t naddbuf:1;
519 uint64_t addpkt:1;
520 uint64_t reset:1;
521 uint64_t len_m8:1;
522 uint64_t pkt_off:1;
523 uint64_t ipd_full:1;
524 uint64_t reserved_12_63:52;
525#endif
526 } cn58xx;
527 struct cvmx_ipd_ctl_status_cn63xxp1 {
528#ifdef __BIG_ENDIAN_BITFIELD
529 uint64_t reserved_16_63:48;
530 uint64_t clken:1;
531 uint64_t no_wptr:1;
532 uint64_t pq_apkt:1;
533 uint64_t pq_nabuf:1;
534 uint64_t ipd_full:1;
535 uint64_t pkt_off:1;
536 uint64_t len_m8:1;
537 uint64_t reset:1;
538 uint64_t addpkt:1;
539 uint64_t naddbuf:1;
540 uint64_t pkt_lend:1;
541 uint64_t wqe_lend:1;
542 uint64_t pbp_en:1;
543 uint64_t opc_mode:2;
544 uint64_t ipd_en:1;
545#else
546 uint64_t ipd_en:1;
547 uint64_t opc_mode:2;
548 uint64_t pbp_en:1;
549 uint64_t wqe_lend:1;
550 uint64_t pkt_lend:1;
551 uint64_t naddbuf:1;
552 uint64_t addpkt:1;
553 uint64_t reset:1;
554 uint64_t len_m8:1;
555 uint64_t pkt_off:1;
556 uint64_t ipd_full:1;
557 uint64_t pq_nabuf:1;
558 uint64_t pq_apkt:1;
559 uint64_t no_wptr:1;
560 uint64_t clken:1;
561 uint64_t reserved_16_63:48;
562#endif
563 } cn63xxp1;
564};
565
566union cvmx_ipd_ecc_ctl {
567 uint64_t u64;
568 struct cvmx_ipd_ecc_ctl_s {
569#ifdef __BIG_ENDIAN_BITFIELD
570 uint64_t reserved_8_63:56;
571 uint64_t pm3_syn:2;
572 uint64_t pm2_syn:2;
573 uint64_t pm1_syn:2;
574 uint64_t pm0_syn:2;
575#else
576 uint64_t pm0_syn:2;
577 uint64_t pm1_syn:2;
578 uint64_t pm2_syn:2;
579 uint64_t pm3_syn:2;
580 uint64_t reserved_8_63:56;
581#endif
582 } s;
583};
584
585union cvmx_ipd_free_ptr_fifo_ctl {
586 uint64_t u64;
587 struct cvmx_ipd_free_ptr_fifo_ctl_s {
588#ifdef __BIG_ENDIAN_BITFIELD
589 uint64_t reserved_32_63:32;
590 uint64_t max_cnts:7;
591 uint64_t wraddr:8;
592 uint64_t praddr:8;
593 uint64_t cena:1;
594 uint64_t raddr:8;
595#else
596 uint64_t raddr:8;
597 uint64_t cena:1;
598 uint64_t praddr:8;
599 uint64_t wraddr:8;
600 uint64_t max_cnts:7;
601 uint64_t reserved_32_63:32;
602#endif
603 } s;
604};
605
606union cvmx_ipd_free_ptr_value {
607 uint64_t u64;
608 struct cvmx_ipd_free_ptr_value_s {
609#ifdef __BIG_ENDIAN_BITFIELD
610 uint64_t reserved_33_63:31;
611 uint64_t ptr:33;
612#else
613 uint64_t ptr:33;
614 uint64_t reserved_33_63:31;
615#endif
616 } s;
617};
618
619union cvmx_ipd_hold_ptr_fifo_ctl {
620 uint64_t u64;
621 struct cvmx_ipd_hold_ptr_fifo_ctl_s {
622#ifdef __BIG_ENDIAN_BITFIELD
623 uint64_t reserved_43_63:21;
624 uint64_t ptr:33;
625 uint64_t max_pkt:3;
626 uint64_t praddr:3;
627 uint64_t cena:1;
628 uint64_t raddr:3;
629#else
630 uint64_t raddr:3;
631 uint64_t cena:1;
632 uint64_t praddr:3;
633 uint64_t max_pkt:3;
634 uint64_t ptr:33;
635 uint64_t reserved_43_63:21;
636#endif
637 } s;
638};
639
640union cvmx_ipd_int_enb {
641 uint64_t u64;
642 struct cvmx_ipd_int_enb_s {
643#ifdef __BIG_ENDIAN_BITFIELD
644 uint64_t reserved_23_63:41;
645 uint64_t pw3_dbe:1;
646 uint64_t pw3_sbe:1;
647 uint64_t pw2_dbe:1;
648 uint64_t pw2_sbe:1;
649 uint64_t pw1_dbe:1;
650 uint64_t pw1_sbe:1;
651 uint64_t pw0_dbe:1;
652 uint64_t pw0_sbe:1;
653 uint64_t dat:1;
654 uint64_t eop:1;
655 uint64_t sop:1;
656 uint64_t pq_sub:1;
657 uint64_t pq_add:1;
658 uint64_t bc_ovr:1;
659 uint64_t d_coll:1;
660 uint64_t c_coll:1;
661 uint64_t cc_ovr:1;
662 uint64_t dc_ovr:1;
663 uint64_t bp_sub:1;
664 uint64_t prc_par3:1;
665 uint64_t prc_par2:1;
666 uint64_t prc_par1:1;
667 uint64_t prc_par0:1;
668#else
669 uint64_t prc_par0:1;
670 uint64_t prc_par1:1;
671 uint64_t prc_par2:1;
672 uint64_t prc_par3:1;
673 uint64_t bp_sub:1;
674 uint64_t dc_ovr:1;
675 uint64_t cc_ovr:1;
676 uint64_t c_coll:1;
677 uint64_t d_coll:1;
678 uint64_t bc_ovr:1;
679 uint64_t pq_add:1;
680 uint64_t pq_sub:1;
681 uint64_t sop:1;
682 uint64_t eop:1;
683 uint64_t dat:1;
684 uint64_t pw0_sbe:1;
685 uint64_t pw0_dbe:1;
686 uint64_t pw1_sbe:1;
687 uint64_t pw1_dbe:1;
688 uint64_t pw2_sbe:1;
689 uint64_t pw2_dbe:1;
690 uint64_t pw3_sbe:1;
691 uint64_t pw3_dbe:1;
692 uint64_t reserved_23_63:41;
693#endif
694 } s;
695 struct cvmx_ipd_int_enb_cn30xx {
696#ifdef __BIG_ENDIAN_BITFIELD
697 uint64_t reserved_5_63:59;
698 uint64_t bp_sub:1;
699 uint64_t prc_par3:1;
700 uint64_t prc_par2:1;
701 uint64_t prc_par1:1;
702 uint64_t prc_par0:1;
703#else
704 uint64_t prc_par0:1;
705 uint64_t prc_par1:1;
706 uint64_t prc_par2:1;
707 uint64_t prc_par3:1;
708 uint64_t bp_sub:1;
709 uint64_t reserved_5_63:59;
710#endif
711 } cn30xx;
712 struct cvmx_ipd_int_enb_cn38xx {
713#ifdef __BIG_ENDIAN_BITFIELD
714 uint64_t reserved_10_63:54;
715 uint64_t bc_ovr:1;
716 uint64_t d_coll:1;
717 uint64_t c_coll:1;
718 uint64_t cc_ovr:1;
719 uint64_t dc_ovr:1;
720 uint64_t bp_sub:1;
721 uint64_t prc_par3:1;
722 uint64_t prc_par2:1;
723 uint64_t prc_par1:1;
724 uint64_t prc_par0:1;
725#else
726 uint64_t prc_par0:1;
727 uint64_t prc_par1:1;
728 uint64_t prc_par2:1;
729 uint64_t prc_par3:1;
730 uint64_t bp_sub:1;
731 uint64_t dc_ovr:1;
732 uint64_t cc_ovr:1;
733 uint64_t c_coll:1;
734 uint64_t d_coll:1;
735 uint64_t bc_ovr:1;
736 uint64_t reserved_10_63:54;
737#endif
738 } cn38xx;
739 struct cvmx_ipd_int_enb_cn52xx {
740#ifdef __BIG_ENDIAN_BITFIELD
741 uint64_t reserved_12_63:52;
742 uint64_t pq_sub:1;
743 uint64_t pq_add:1;
744 uint64_t bc_ovr:1;
745 uint64_t d_coll:1;
746 uint64_t c_coll:1;
747 uint64_t cc_ovr:1;
748 uint64_t dc_ovr:1;
749 uint64_t bp_sub:1;
750 uint64_t prc_par3:1;
751 uint64_t prc_par2:1;
752 uint64_t prc_par1:1;
753 uint64_t prc_par0:1;
754#else
755 uint64_t prc_par0:1;
756 uint64_t prc_par1:1;
757 uint64_t prc_par2:1;
758 uint64_t prc_par3:1;
759 uint64_t bp_sub:1;
760 uint64_t dc_ovr:1;
761 uint64_t cc_ovr:1;
762 uint64_t c_coll:1;
763 uint64_t d_coll:1;
764 uint64_t bc_ovr:1;
765 uint64_t pq_add:1;
766 uint64_t pq_sub:1;
767 uint64_t reserved_12_63:52;
768#endif
769 } cn52xx;
770};
771
772union cvmx_ipd_int_sum {
773 uint64_t u64;
774 struct cvmx_ipd_int_sum_s {
775#ifdef __BIG_ENDIAN_BITFIELD
776 uint64_t reserved_23_63:41;
777 uint64_t pw3_dbe:1;
778 uint64_t pw3_sbe:1;
779 uint64_t pw2_dbe:1;
780 uint64_t pw2_sbe:1;
781 uint64_t pw1_dbe:1;
782 uint64_t pw1_sbe:1;
783 uint64_t pw0_dbe:1;
784 uint64_t pw0_sbe:1;
785 uint64_t dat:1;
786 uint64_t eop:1;
787 uint64_t sop:1;
788 uint64_t pq_sub:1;
789 uint64_t pq_add:1;
790 uint64_t bc_ovr:1;
791 uint64_t d_coll:1;
792 uint64_t c_coll:1;
793 uint64_t cc_ovr:1;
794 uint64_t dc_ovr:1;
795 uint64_t bp_sub:1;
796 uint64_t prc_par3:1;
797 uint64_t prc_par2:1;
798 uint64_t prc_par1:1;
799 uint64_t prc_par0:1;
800#else
801 uint64_t prc_par0:1;
802 uint64_t prc_par1:1;
803 uint64_t prc_par2:1;
804 uint64_t prc_par3:1;
805 uint64_t bp_sub:1;
806 uint64_t dc_ovr:1;
807 uint64_t cc_ovr:1;
808 uint64_t c_coll:1;
809 uint64_t d_coll:1;
810 uint64_t bc_ovr:1;
811 uint64_t pq_add:1;
812 uint64_t pq_sub:1;
813 uint64_t sop:1;
814 uint64_t eop:1;
815 uint64_t dat:1;
816 uint64_t pw0_sbe:1;
817 uint64_t pw0_dbe:1;
818 uint64_t pw1_sbe:1;
819 uint64_t pw1_dbe:1;
820 uint64_t pw2_sbe:1;
821 uint64_t pw2_dbe:1;
822 uint64_t pw3_sbe:1;
823 uint64_t pw3_dbe:1;
824 uint64_t reserved_23_63:41;
825#endif
826 } s;
827 struct cvmx_ipd_int_sum_cn30xx {
828#ifdef __BIG_ENDIAN_BITFIELD
829 uint64_t reserved_5_63:59;
830 uint64_t bp_sub:1;
831 uint64_t prc_par3:1;
832 uint64_t prc_par2:1;
833 uint64_t prc_par1:1;
834 uint64_t prc_par0:1;
835#else
836 uint64_t prc_par0:1;
837 uint64_t prc_par1:1;
838 uint64_t prc_par2:1;
839 uint64_t prc_par3:1;
840 uint64_t bp_sub:1;
841 uint64_t reserved_5_63:59;
842#endif
843 } cn30xx;
844 struct cvmx_ipd_int_sum_cn38xx {
845#ifdef __BIG_ENDIAN_BITFIELD
846 uint64_t reserved_10_63:54;
847 uint64_t bc_ovr:1;
848 uint64_t d_coll:1;
849 uint64_t c_coll:1;
850 uint64_t cc_ovr:1;
851 uint64_t dc_ovr:1;
852 uint64_t bp_sub:1;
853 uint64_t prc_par3:1;
854 uint64_t prc_par2:1;
855 uint64_t prc_par1:1;
856 uint64_t prc_par0:1;
857#else
858 uint64_t prc_par0:1;
859 uint64_t prc_par1:1;
860 uint64_t prc_par2:1;
861 uint64_t prc_par3:1;
862 uint64_t bp_sub:1;
863 uint64_t dc_ovr:1;
864 uint64_t cc_ovr:1;
865 uint64_t c_coll:1;
866 uint64_t d_coll:1;
867 uint64_t bc_ovr:1;
868 uint64_t reserved_10_63:54;
869#endif
870 } cn38xx;
871 struct cvmx_ipd_int_sum_cn52xx {
872#ifdef __BIG_ENDIAN_BITFIELD
873 uint64_t reserved_12_63:52;
874 uint64_t pq_sub:1;
875 uint64_t pq_add:1;
876 uint64_t bc_ovr:1;
877 uint64_t d_coll:1;
878 uint64_t c_coll:1;
879 uint64_t cc_ovr:1;
880 uint64_t dc_ovr:1;
881 uint64_t bp_sub:1;
882 uint64_t prc_par3:1;
883 uint64_t prc_par2:1;
884 uint64_t prc_par1:1;
885 uint64_t prc_par0:1;
886#else
887 uint64_t prc_par0:1;
888 uint64_t prc_par1:1;
889 uint64_t prc_par2:1;
890 uint64_t prc_par3:1;
891 uint64_t bp_sub:1;
892 uint64_t dc_ovr:1;
893 uint64_t cc_ovr:1;
894 uint64_t c_coll:1;
895 uint64_t d_coll:1;
896 uint64_t bc_ovr:1;
897 uint64_t pq_add:1;
898 uint64_t pq_sub:1;
899 uint64_t reserved_12_63:52;
900#endif
901 } cn52xx;
902};
903
904union cvmx_ipd_next_pkt_ptr {
905 uint64_t u64;
906 struct cvmx_ipd_next_pkt_ptr_s {
907#ifdef __BIG_ENDIAN_BITFIELD
908 uint64_t reserved_33_63:31;
909 uint64_t ptr:33;
910#else
911 uint64_t ptr:33;
912 uint64_t reserved_33_63:31;
913#endif
914 } s;
915};
916
917union cvmx_ipd_next_wqe_ptr {
918 uint64_t u64;
919 struct cvmx_ipd_next_wqe_ptr_s {
920#ifdef __BIG_ENDIAN_BITFIELD
921 uint64_t reserved_33_63:31;
922 uint64_t ptr:33;
923#else
924 uint64_t ptr:33;
925 uint64_t reserved_33_63:31;
926#endif
927 } s;
928};
929
930union cvmx_ipd_not_1st_mbuff_skip {
931 uint64_t u64;
932 struct cvmx_ipd_not_1st_mbuff_skip_s {
933#ifdef __BIG_ENDIAN_BITFIELD
934 uint64_t reserved_6_63:58;
935 uint64_t skip_sz:6;
936#else
937 uint64_t skip_sz:6;
938 uint64_t reserved_6_63:58;
939#endif
940 } s;
941};
942
943union cvmx_ipd_on_bp_drop_pktx {
944 uint64_t u64;
945 struct cvmx_ipd_on_bp_drop_pktx_s {
946#ifdef __BIG_ENDIAN_BITFIELD
947 uint64_t prt_enb:64;
948#else
949 uint64_t prt_enb:64;
950#endif
951 } s;
952};
953
954union cvmx_ipd_packet_mbuff_size {
955 uint64_t u64;
956 struct cvmx_ipd_packet_mbuff_size_s {
957#ifdef __BIG_ENDIAN_BITFIELD
958 uint64_t reserved_12_63:52;
959 uint64_t mb_size:12;
960#else
961 uint64_t mb_size:12;
962 uint64_t reserved_12_63:52;
963#endif
964 } s;
965};
966
967union cvmx_ipd_pkt_err {
968 uint64_t u64;
969 struct cvmx_ipd_pkt_err_s {
970#ifdef __BIG_ENDIAN_BITFIELD
971 uint64_t reserved_6_63:58;
972 uint64_t reasm:6;
973#else
974 uint64_t reasm:6;
975 uint64_t reserved_6_63:58;
976#endif
977 } s;
978};
979
980union cvmx_ipd_pkt_ptr_valid {
981 uint64_t u64;
982 struct cvmx_ipd_pkt_ptr_valid_s {
983#ifdef __BIG_ENDIAN_BITFIELD
984 uint64_t reserved_29_63:35;
985 uint64_t ptr:29;
986#else
987 uint64_t ptr:29;
988 uint64_t reserved_29_63:35;
989#endif
990 } s;
991};
992
993union cvmx_ipd_portx_bp_page_cnt {
994 uint64_t u64;
995 struct cvmx_ipd_portx_bp_page_cnt_s {
996#ifdef __BIG_ENDIAN_BITFIELD
997 uint64_t reserved_18_63:46;
998 uint64_t bp_enb:1;
999 uint64_t page_cnt:17;
1000#else
1001 uint64_t page_cnt:17;
1002 uint64_t bp_enb:1;
1003 uint64_t reserved_18_63:46;
1004#endif
1005 } s;
1006};
1007
1008union cvmx_ipd_portx_bp_page_cnt2 {
1009 uint64_t u64;
1010 struct cvmx_ipd_portx_bp_page_cnt2_s {
1011#ifdef __BIG_ENDIAN_BITFIELD
1012 uint64_t reserved_18_63:46;
1013 uint64_t bp_enb:1;
1014 uint64_t page_cnt:17;
1015#else
1016 uint64_t page_cnt:17;
1017 uint64_t bp_enb:1;
1018 uint64_t reserved_18_63:46;
1019#endif
1020 } s;
1021};
1022
1023union cvmx_ipd_portx_bp_page_cnt3 {
1024 uint64_t u64;
1025 struct cvmx_ipd_portx_bp_page_cnt3_s {
1026#ifdef __BIG_ENDIAN_BITFIELD
1027 uint64_t reserved_18_63:46;
1028 uint64_t bp_enb:1;
1029 uint64_t page_cnt:17;
1030#else
1031 uint64_t page_cnt:17;
1032 uint64_t bp_enb:1;
1033 uint64_t reserved_18_63:46;
1034#endif
1035 } s;
1036};
1037
1038union cvmx_ipd_port_bp_counters2_pairx {
1039 uint64_t u64;
1040 struct cvmx_ipd_port_bp_counters2_pairx_s {
1041#ifdef __BIG_ENDIAN_BITFIELD
1042 uint64_t reserved_25_63:39;
1043 uint64_t cnt_val:25;
1044#else
1045 uint64_t cnt_val:25;
1046 uint64_t reserved_25_63:39;
1047#endif
1048 } s;
1049};
1050
1051union cvmx_ipd_port_bp_counters3_pairx {
1052 uint64_t u64;
1053 struct cvmx_ipd_port_bp_counters3_pairx_s {
1054#ifdef __BIG_ENDIAN_BITFIELD
1055 uint64_t reserved_25_63:39;
1056 uint64_t cnt_val:25;
1057#else
1058 uint64_t cnt_val:25;
1059 uint64_t reserved_25_63:39;
1060#endif
1061 } s;
1062};
1063
1064union cvmx_ipd_port_bp_counters4_pairx {
1065 uint64_t u64;
1066 struct cvmx_ipd_port_bp_counters4_pairx_s {
1067#ifdef __BIG_ENDIAN_BITFIELD
1068 uint64_t reserved_25_63:39;
1069 uint64_t cnt_val:25;
1070#else
1071 uint64_t cnt_val:25;
1072 uint64_t reserved_25_63:39;
1073#endif
1074 } s;
1075};
1076
1077union cvmx_ipd_port_bp_counters_pairx {
1078 uint64_t u64;
1079 struct cvmx_ipd_port_bp_counters_pairx_s {
1080#ifdef __BIG_ENDIAN_BITFIELD
1081 uint64_t reserved_25_63:39;
1082 uint64_t cnt_val:25;
1083#else
1084 uint64_t cnt_val:25;
1085 uint64_t reserved_25_63:39;
1086#endif
1087 } s;
1088};
1089
1090union cvmx_ipd_port_ptr_fifo_ctl {
1091 uint64_t u64;
1092 struct cvmx_ipd_port_ptr_fifo_ctl_s {
1093#ifdef __BIG_ENDIAN_BITFIELD
1094 uint64_t reserved_48_63:16;
1095 uint64_t ptr:33;
1096 uint64_t max_pkt:7;
1097 uint64_t cena:1;
1098 uint64_t raddr:7;
1099#else
1100 uint64_t raddr:7;
1101 uint64_t cena:1;
1102 uint64_t max_pkt:7;
1103 uint64_t ptr:33;
1104 uint64_t reserved_48_63:16;
1105#endif
1106 } s;
1107};
1108
1109union cvmx_ipd_port_qos_x_cnt {
1110 uint64_t u64;
1111 struct cvmx_ipd_port_qos_x_cnt_s {
1112#ifdef __BIG_ENDIAN_BITFIELD
1113 uint64_t wmark:32;
1114 uint64_t cnt:32;
1115#else
1116 uint64_t cnt:32;
1117 uint64_t wmark:32;
1118#endif
1119 } s;
1120};
1121
1122union cvmx_ipd_port_qos_intx {
1123 uint64_t u64;
1124 struct cvmx_ipd_port_qos_intx_s {
1125#ifdef __BIG_ENDIAN_BITFIELD
1126 uint64_t intr:64;
1127#else
1128 uint64_t intr:64;
1129#endif
1130 } s;
1131};
1132
1133union cvmx_ipd_port_qos_int_enbx {
1134 uint64_t u64;
1135 struct cvmx_ipd_port_qos_int_enbx_s {
1136#ifdef __BIG_ENDIAN_BITFIELD
1137 uint64_t enb:64;
1138#else
1139 uint64_t enb:64;
1140#endif
1141 } s;
1142};
1143
1144union cvmx_ipd_port_sopx {
1145 uint64_t u64;
1146 struct cvmx_ipd_port_sopx_s {
1147#ifdef __BIG_ENDIAN_BITFIELD
1148 uint64_t sop:64;
1149#else
1150 uint64_t sop:64;
1151#endif
1152 } s;
1153};
1154
1155union cvmx_ipd_prc_hold_ptr_fifo_ctl {
1156 uint64_t u64;
1157 struct cvmx_ipd_prc_hold_ptr_fifo_ctl_s {
1158#ifdef __BIG_ENDIAN_BITFIELD
1159 uint64_t reserved_39_63:25;
1160 uint64_t max_pkt:3;
1161 uint64_t praddr:3;
1162 uint64_t ptr:29;
1163 uint64_t cena:1;
1164 uint64_t raddr:3;
1165#else
1166 uint64_t raddr:3;
1167 uint64_t cena:1;
1168 uint64_t ptr:29;
1169 uint64_t praddr:3;
1170 uint64_t max_pkt:3;
1171 uint64_t reserved_39_63:25;
1172#endif
1173 } s;
1174};
1175
1176union cvmx_ipd_prc_port_ptr_fifo_ctl {
1177 uint64_t u64;
1178 struct cvmx_ipd_prc_port_ptr_fifo_ctl_s {
1179#ifdef __BIG_ENDIAN_BITFIELD
1180 uint64_t reserved_44_63:20;
1181 uint64_t max_pkt:7;
1182 uint64_t ptr:29;
1183 uint64_t cena:1;
1184 uint64_t raddr:7;
1185#else
1186 uint64_t raddr:7;
1187 uint64_t cena:1;
1188 uint64_t ptr:29;
1189 uint64_t max_pkt:7;
1190 uint64_t reserved_44_63:20;
1191#endif
1192 } s;
1193};
1194
1195union cvmx_ipd_ptr_count {
1196 uint64_t u64;
1197 struct cvmx_ipd_ptr_count_s {
1198#ifdef __BIG_ENDIAN_BITFIELD
1199 uint64_t reserved_19_63:45;
1200 uint64_t pktv_cnt:1;
1201 uint64_t wqev_cnt:1;
1202 uint64_t pfif_cnt:3;
1203 uint64_t pkt_pcnt:7;
1204 uint64_t wqe_pcnt:7;
1205#else
1206 uint64_t wqe_pcnt:7;
1207 uint64_t pkt_pcnt:7;
1208 uint64_t pfif_cnt:3;
1209 uint64_t wqev_cnt:1;
1210 uint64_t pktv_cnt:1;
1211 uint64_t reserved_19_63:45;
1212#endif
1213 } s;
1214};
1215
1216union cvmx_ipd_pwp_ptr_fifo_ctl {
1217 uint64_t u64;
1218 struct cvmx_ipd_pwp_ptr_fifo_ctl_s {
1219#ifdef __BIG_ENDIAN_BITFIELD
1220 uint64_t reserved_61_63:3;
1221 uint64_t max_cnts:7;
1222 uint64_t wraddr:8;
1223 uint64_t praddr:8;
1224 uint64_t ptr:29;
1225 uint64_t cena:1;
1226 uint64_t raddr:8;
1227#else
1228 uint64_t raddr:8;
1229 uint64_t cena:1;
1230 uint64_t ptr:29;
1231 uint64_t praddr:8;
1232 uint64_t wraddr:8;
1233 uint64_t max_cnts:7;
1234 uint64_t reserved_61_63:3;
1235#endif
1236 } s;
1237};
1238
1239union cvmx_ipd_qosx_red_marks {
1240 uint64_t u64;
1241 struct cvmx_ipd_qosx_red_marks_s {
1242#ifdef __BIG_ENDIAN_BITFIELD
1243 uint64_t drop:32;
1244 uint64_t pass:32;
1245#else
1246 uint64_t pass:32;
1247 uint64_t drop:32;
1248#endif
1249 } s;
1250};
1251
1252union cvmx_ipd_que0_free_page_cnt {
1253 uint64_t u64;
1254 struct cvmx_ipd_que0_free_page_cnt_s {
1255#ifdef __BIG_ENDIAN_BITFIELD
1256 uint64_t reserved_32_63:32;
1257 uint64_t q0_pcnt:32;
1258#else
1259 uint64_t q0_pcnt:32;
1260 uint64_t reserved_32_63:32;
1261#endif
1262 } s;
1263};
1264
1265union cvmx_ipd_red_bpid_enablex {
1266 uint64_t u64;
1267 struct cvmx_ipd_red_bpid_enablex_s {
1268#ifdef __BIG_ENDIAN_BITFIELD
1269 uint64_t prt_enb:64;
1270#else
1271 uint64_t prt_enb:64;
1272#endif
1273 } s;
1274};
1275
1276union cvmx_ipd_red_delay {
1277 uint64_t u64;
1278 struct cvmx_ipd_red_delay_s {
1279#ifdef __BIG_ENDIAN_BITFIELD
1280 uint64_t reserved_28_63:36;
1281 uint64_t prb_dly:14;
1282 uint64_t avg_dly:14;
1283#else
1284 uint64_t avg_dly:14;
1285 uint64_t prb_dly:14;
1286 uint64_t reserved_28_63:36;
1287#endif
1288 } s;
1289};
1290
1291union cvmx_ipd_red_port_enable {
1292 uint64_t u64;
1293 struct cvmx_ipd_red_port_enable_s {
1294#ifdef __BIG_ENDIAN_BITFIELD
1295 uint64_t prb_dly:14;
1296 uint64_t avg_dly:14;
1297 uint64_t prt_enb:36;
1298#else
1299 uint64_t prt_enb:36;
1300 uint64_t avg_dly:14;
1301 uint64_t prb_dly:14;
1302#endif
1303 } s;
1304};
1305
1306union cvmx_ipd_red_port_enable2 {
1307 uint64_t u64;
1308 struct cvmx_ipd_red_port_enable2_s {
1309#ifdef __BIG_ENDIAN_BITFIELD
1310 uint64_t reserved_12_63:52;
1311 uint64_t prt_enb:12;
1312#else
1313 uint64_t prt_enb:12;
1314 uint64_t reserved_12_63:52;
1315#endif
1316 } s;
1317 struct cvmx_ipd_red_port_enable2_cn52xx {
1318#ifdef __BIG_ENDIAN_BITFIELD
1319 uint64_t reserved_4_63:60;
1320 uint64_t prt_enb:4;
1321#else
1322 uint64_t prt_enb:4;
1323 uint64_t reserved_4_63:60;
1324#endif
1325 } cn52xx;
1326 struct cvmx_ipd_red_port_enable2_cn63xx {
1327#ifdef __BIG_ENDIAN_BITFIELD
1328 uint64_t reserved_8_63:56;
1329 uint64_t prt_enb:8;
1330#else
1331 uint64_t prt_enb:8;
1332 uint64_t reserved_8_63:56;
1333#endif
1334 } cn63xx;
1335};
1336
1337union cvmx_ipd_red_quex_param {
1338 uint64_t u64;
1339 struct cvmx_ipd_red_quex_param_s {
1340#ifdef __BIG_ENDIAN_BITFIELD
1341 uint64_t reserved_49_63:15;
1342 uint64_t use_pcnt:1;
1343 uint64_t new_con:8;
1344 uint64_t avg_con:8;
1345 uint64_t prb_con:32;
1346#else
1347 uint64_t prb_con:32;
1348 uint64_t avg_con:8;
1349 uint64_t new_con:8;
1350 uint64_t use_pcnt:1;
1351 uint64_t reserved_49_63:15;
1352#endif
1353 } s;
1354};
1355
1356union cvmx_ipd_req_wgt {
1357 uint64_t u64;
1358 struct cvmx_ipd_req_wgt_s {
1359#ifdef __BIG_ENDIAN_BITFIELD
1360 uint64_t wgt7:8;
1361 uint64_t wgt6:8;
1362 uint64_t wgt5:8;
1363 uint64_t wgt4:8;
1364 uint64_t wgt3:8;
1365 uint64_t wgt2:8;
1366 uint64_t wgt1:8;
1367 uint64_t wgt0:8;
1368#else
1369 uint64_t wgt0:8;
1370 uint64_t wgt1:8;
1371 uint64_t wgt2:8;
1372 uint64_t wgt3:8;
1373 uint64_t wgt4:8;
1374 uint64_t wgt5:8;
1375 uint64_t wgt6:8;
1376 uint64_t wgt7:8;
1377#endif
1378 } s;
1379};
1380
1381union cvmx_ipd_sub_port_bp_page_cnt {
1382 uint64_t u64;
1383 struct cvmx_ipd_sub_port_bp_page_cnt_s {
1384#ifdef __BIG_ENDIAN_BITFIELD
1385 uint64_t reserved_31_63:33;
1386 uint64_t port:6;
1387 uint64_t page_cnt:25;
1388#else
1389 uint64_t page_cnt:25;
1390 uint64_t port:6;
1391 uint64_t reserved_31_63:33;
1392#endif
1393 } s;
1394};
1395
1396union cvmx_ipd_sub_port_fcs {
1397 uint64_t u64;
1398 struct cvmx_ipd_sub_port_fcs_s {
1399#ifdef __BIG_ENDIAN_BITFIELD
1400 uint64_t reserved_40_63:24;
1401 uint64_t port_bit2:4;
1402 uint64_t reserved_32_35:4;
1403 uint64_t port_bit:32;
1404#else
1405 uint64_t port_bit:32;
1406 uint64_t reserved_32_35:4;
1407 uint64_t port_bit2:4;
1408 uint64_t reserved_40_63:24;
1409#endif
1410 } s;
1411 struct cvmx_ipd_sub_port_fcs_cn30xx {
1412#ifdef __BIG_ENDIAN_BITFIELD
1413 uint64_t reserved_3_63:61;
1414 uint64_t port_bit:3;
1415#else
1416 uint64_t port_bit:3;
1417 uint64_t reserved_3_63:61;
1418#endif
1419 } cn30xx;
1420 struct cvmx_ipd_sub_port_fcs_cn38xx {
1421#ifdef __BIG_ENDIAN_BITFIELD
1422 uint64_t reserved_32_63:32;
1423 uint64_t port_bit:32;
1424#else
1425 uint64_t port_bit:32;
1426 uint64_t reserved_32_63:32;
1427#endif
1428 } cn38xx;
1429};
1430
1431union cvmx_ipd_sub_port_qos_cnt {
1432 uint64_t u64;
1433 struct cvmx_ipd_sub_port_qos_cnt_s {
1434#ifdef __BIG_ENDIAN_BITFIELD
1435 uint64_t reserved_41_63:23;
1436 uint64_t port_qos:9;
1437 uint64_t cnt:32;
1438#else
1439 uint64_t cnt:32;
1440 uint64_t port_qos:9;
1441 uint64_t reserved_41_63:23;
1442#endif
1443 } s;
1444};
1445
1446union cvmx_ipd_wqe_fpa_queue {
1447 uint64_t u64;
1448 struct cvmx_ipd_wqe_fpa_queue_s {
1449#ifdef __BIG_ENDIAN_BITFIELD
1450 uint64_t reserved_3_63:61;
1451 uint64_t wqe_pool:3;
1452#else
1453 uint64_t wqe_pool:3;
1454 uint64_t reserved_3_63:61;
1455#endif
1456 } s;
1457};
1458
1459union cvmx_ipd_wqe_ptr_valid {
1460 uint64_t u64;
1461 struct cvmx_ipd_wqe_ptr_valid_s {
1462#ifdef __BIG_ENDIAN_BITFIELD
1463 uint64_t reserved_29_63:35;
1464 uint64_t ptr:29;
1465#else
1466 uint64_t ptr:29;
1467 uint64_t reserved_29_63:35;
1468#endif
1469 } s;
1470};
1471
1472#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-ipd.h b/arch/mips/include/asm/octeon/cvmx-ipd.h
new file mode 100644
index 000000000..adab7b54c
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-ipd.h
@@ -0,0 +1,339 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 *
30 * Interface to the hardware Input Packet Data unit.
31 */
32
33#ifndef __CVMX_IPD_H__
34#define __CVMX_IPD_H__
35
36#include <asm/octeon/octeon-feature.h>
37
38#include <asm/octeon/cvmx-ipd-defs.h>
39#include <asm/octeon/cvmx-pip-defs.h>
40
41enum cvmx_ipd_mode {
42 CVMX_IPD_OPC_MODE_STT = 0LL, /* All blocks DRAM, not cached in L2 */
43 CVMX_IPD_OPC_MODE_STF = 1LL, /* All blocks into L2 */
44 CVMX_IPD_OPC_MODE_STF1_STT = 2LL, /* 1st block L2, rest DRAM */
45 CVMX_IPD_OPC_MODE_STF2_STT = 3LL /* 1st, 2nd blocks L2, rest DRAM */
46};
47
48#ifndef CVMX_ENABLE_LEN_M8_FIX
49#define CVMX_ENABLE_LEN_M8_FIX 0
50#endif
51
52/* CSR typedefs have been moved to cvmx-csr-*.h */
53typedef union cvmx_ipd_1st_mbuff_skip cvmx_ipd_mbuff_first_skip_t;
54typedef union cvmx_ipd_1st_next_ptr_back cvmx_ipd_first_next_ptr_back_t;
55
56typedef cvmx_ipd_mbuff_first_skip_t cvmx_ipd_mbuff_not_first_skip_t;
57typedef cvmx_ipd_first_next_ptr_back_t cvmx_ipd_second_next_ptr_back_t;
58
59/**
60 * Configure IPD
61 *
62 * @mbuff_size: Packets buffer size in 8 byte words
63 * @first_mbuff_skip:
64 * Number of 8 byte words to skip in the first buffer
65 * @not_first_mbuff_skip:
66 * Number of 8 byte words to skip in each following buffer
67 * @first_back: Must be same as first_mbuff_skip / 128
68 * @second_back:
69 * Must be same as not_first_mbuff_skip / 128
70 * @wqe_fpa_pool:
71 * FPA pool to get work entries from
72 * @cache_mode:
73 * @back_pres_enable_flag:
74 * Enable or disable port back pressure
75 */
76static inline void cvmx_ipd_config(uint64_t mbuff_size,
77 uint64_t first_mbuff_skip,
78 uint64_t not_first_mbuff_skip,
79 uint64_t first_back,
80 uint64_t second_back,
81 uint64_t wqe_fpa_pool,
82 enum cvmx_ipd_mode cache_mode,
83 uint64_t back_pres_enable_flag)
84{
85 cvmx_ipd_mbuff_first_skip_t first_skip;
86 cvmx_ipd_mbuff_not_first_skip_t not_first_skip;
87 union cvmx_ipd_packet_mbuff_size size;
88 cvmx_ipd_first_next_ptr_back_t first_back_struct;
89 cvmx_ipd_second_next_ptr_back_t second_back_struct;
90 union cvmx_ipd_wqe_fpa_queue wqe_pool;
91 union cvmx_ipd_ctl_status ipd_ctl_reg;
92
93 first_skip.u64 = 0;
94 first_skip.s.skip_sz = first_mbuff_skip;
95 cvmx_write_csr(CVMX_IPD_1ST_MBUFF_SKIP, first_skip.u64);
96
97 not_first_skip.u64 = 0;
98 not_first_skip.s.skip_sz = not_first_mbuff_skip;
99 cvmx_write_csr(CVMX_IPD_NOT_1ST_MBUFF_SKIP, not_first_skip.u64);
100
101 size.u64 = 0;
102 size.s.mb_size = mbuff_size;
103 cvmx_write_csr(CVMX_IPD_PACKET_MBUFF_SIZE, size.u64);
104
105 first_back_struct.u64 = 0;
106 first_back_struct.s.back = first_back;
107 cvmx_write_csr(CVMX_IPD_1st_NEXT_PTR_BACK, first_back_struct.u64);
108
109 second_back_struct.u64 = 0;
110 second_back_struct.s.back = second_back;
111 cvmx_write_csr(CVMX_IPD_2nd_NEXT_PTR_BACK, second_back_struct.u64);
112
113 wqe_pool.u64 = 0;
114 wqe_pool.s.wqe_pool = wqe_fpa_pool;
115 cvmx_write_csr(CVMX_IPD_WQE_FPA_QUEUE, wqe_pool.u64);
116
117 ipd_ctl_reg.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
118 ipd_ctl_reg.s.opc_mode = cache_mode;
119 ipd_ctl_reg.s.pbp_en = back_pres_enable_flag;
120 cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_ctl_reg.u64);
121
122 /* Note: the example RED code that used to be here has been moved to
123 cvmx_helper_setup_red */
124}
125
126/**
127 * Enable IPD
128 */
129static inline void cvmx_ipd_enable(void)
130{
131 union cvmx_ipd_ctl_status ipd_reg;
132 ipd_reg.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
133 if (ipd_reg.s.ipd_en) {
134 cvmx_dprintf
135 ("Warning: Enabling IPD when IPD already enabled.\n");
136 }
137 ipd_reg.s.ipd_en = 1;
138#if CVMX_ENABLE_LEN_M8_FIX
139 if (!OCTEON_IS_MODEL(OCTEON_CN38XX_PASS2))
140 ipd_reg.s.len_m8 = TRUE;
141#endif
142 cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_reg.u64);
143}
144
145/**
146 * Disable IPD
147 */
148static inline void cvmx_ipd_disable(void)
149{
150 union cvmx_ipd_ctl_status ipd_reg;
151 ipd_reg.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
152 ipd_reg.s.ipd_en = 0;
153 cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_reg.u64);
154}
155
156/**
157 * Supportive function for cvmx_fpa_shutdown_pool.
158 */
159static inline void cvmx_ipd_free_ptr(void)
160{
161 /* Only CN38XXp{1,2} cannot read pointer out of the IPD */
162 if (!OCTEON_IS_MODEL(OCTEON_CN38XX_PASS1)
163 && !OCTEON_IS_MODEL(OCTEON_CN38XX_PASS2)) {
164 int no_wptr = 0;
165 union cvmx_ipd_ptr_count ipd_ptr_count;
166 ipd_ptr_count.u64 = cvmx_read_csr(CVMX_IPD_PTR_COUNT);
167
168 /* Handle Work Queue Entry in cn56xx and cn52xx */
169 if (octeon_has_feature(OCTEON_FEATURE_NO_WPTR)) {
170 union cvmx_ipd_ctl_status ipd_ctl_status;
171 ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
172 if (ipd_ctl_status.s.no_wptr)
173 no_wptr = 1;
174 }
175
176 /* Free the prefetched WQE */
177 if (ipd_ptr_count.s.wqev_cnt) {
178 union cvmx_ipd_wqe_ptr_valid ipd_wqe_ptr_valid;
179 ipd_wqe_ptr_valid.u64 =
180 cvmx_read_csr(CVMX_IPD_WQE_PTR_VALID);
181 if (no_wptr)
182 cvmx_fpa_free(cvmx_phys_to_ptr
183 ((uint64_t) ipd_wqe_ptr_valid.s.
184 ptr << 7), CVMX_FPA_PACKET_POOL,
185 0);
186 else
187 cvmx_fpa_free(cvmx_phys_to_ptr
188 ((uint64_t) ipd_wqe_ptr_valid.s.
189 ptr << 7), CVMX_FPA_WQE_POOL, 0);
190 }
191
192 /* Free all WQE in the fifo */
193 if (ipd_ptr_count.s.wqe_pcnt) {
194 int i;
195 union cvmx_ipd_pwp_ptr_fifo_ctl ipd_pwp_ptr_fifo_ctl;
196 ipd_pwp_ptr_fifo_ctl.u64 =
197 cvmx_read_csr(CVMX_IPD_PWP_PTR_FIFO_CTL);
198 for (i = 0; i < ipd_ptr_count.s.wqe_pcnt; i++) {
199 ipd_pwp_ptr_fifo_ctl.s.cena = 0;
200 ipd_pwp_ptr_fifo_ctl.s.raddr =
201 ipd_pwp_ptr_fifo_ctl.s.max_cnts +
202 (ipd_pwp_ptr_fifo_ctl.s.wraddr +
203 i) % ipd_pwp_ptr_fifo_ctl.s.max_cnts;
204 cvmx_write_csr(CVMX_IPD_PWP_PTR_FIFO_CTL,
205 ipd_pwp_ptr_fifo_ctl.u64);
206 ipd_pwp_ptr_fifo_ctl.u64 =
207 cvmx_read_csr(CVMX_IPD_PWP_PTR_FIFO_CTL);
208 if (no_wptr)
209 cvmx_fpa_free(cvmx_phys_to_ptr
210 ((uint64_t)
211 ipd_pwp_ptr_fifo_ctl.s.
212 ptr << 7),
213 CVMX_FPA_PACKET_POOL, 0);
214 else
215 cvmx_fpa_free(cvmx_phys_to_ptr
216 ((uint64_t)
217 ipd_pwp_ptr_fifo_ctl.s.
218 ptr << 7),
219 CVMX_FPA_WQE_POOL, 0);
220 }
221 ipd_pwp_ptr_fifo_ctl.s.cena = 1;
222 cvmx_write_csr(CVMX_IPD_PWP_PTR_FIFO_CTL,
223 ipd_pwp_ptr_fifo_ctl.u64);
224 }
225
226 /* Free the prefetched packet */
227 if (ipd_ptr_count.s.pktv_cnt) {
228 union cvmx_ipd_pkt_ptr_valid ipd_pkt_ptr_valid;
229 ipd_pkt_ptr_valid.u64 =
230 cvmx_read_csr(CVMX_IPD_PKT_PTR_VALID);
231 cvmx_fpa_free(cvmx_phys_to_ptr
232 (ipd_pkt_ptr_valid.s.ptr << 7),
233 CVMX_FPA_PACKET_POOL, 0);
234 }
235
236 /* Free the per port prefetched packets */
237 if (1) {
238 int i;
239 union cvmx_ipd_prc_port_ptr_fifo_ctl
240 ipd_prc_port_ptr_fifo_ctl;
241 ipd_prc_port_ptr_fifo_ctl.u64 =
242 cvmx_read_csr(CVMX_IPD_PRC_PORT_PTR_FIFO_CTL);
243
244 for (i = 0; i < ipd_prc_port_ptr_fifo_ctl.s.max_pkt;
245 i++) {
246 ipd_prc_port_ptr_fifo_ctl.s.cena = 0;
247 ipd_prc_port_ptr_fifo_ctl.s.raddr =
248 i % ipd_prc_port_ptr_fifo_ctl.s.max_pkt;
249 cvmx_write_csr(CVMX_IPD_PRC_PORT_PTR_FIFO_CTL,
250 ipd_prc_port_ptr_fifo_ctl.u64);
251 ipd_prc_port_ptr_fifo_ctl.u64 =
252 cvmx_read_csr
253 (CVMX_IPD_PRC_PORT_PTR_FIFO_CTL);
254 cvmx_fpa_free(cvmx_phys_to_ptr
255 ((uint64_t)
256 ipd_prc_port_ptr_fifo_ctl.s.
257 ptr << 7), CVMX_FPA_PACKET_POOL,
258 0);
259 }
260 ipd_prc_port_ptr_fifo_ctl.s.cena = 1;
261 cvmx_write_csr(CVMX_IPD_PRC_PORT_PTR_FIFO_CTL,
262 ipd_prc_port_ptr_fifo_ctl.u64);
263 }
264
265 /* Free all packets in the holding fifo */
266 if (ipd_ptr_count.s.pfif_cnt) {
267 int i;
268 union cvmx_ipd_prc_hold_ptr_fifo_ctl
269 ipd_prc_hold_ptr_fifo_ctl;
270
271 ipd_prc_hold_ptr_fifo_ctl.u64 =
272 cvmx_read_csr(CVMX_IPD_PRC_HOLD_PTR_FIFO_CTL);
273
274 for (i = 0; i < ipd_ptr_count.s.pfif_cnt; i++) {
275 ipd_prc_hold_ptr_fifo_ctl.s.cena = 0;
276 ipd_prc_hold_ptr_fifo_ctl.s.raddr =
277 (ipd_prc_hold_ptr_fifo_ctl.s.praddr +
278 i) % ipd_prc_hold_ptr_fifo_ctl.s.max_pkt;
279 cvmx_write_csr(CVMX_IPD_PRC_HOLD_PTR_FIFO_CTL,
280 ipd_prc_hold_ptr_fifo_ctl.u64);
281 ipd_prc_hold_ptr_fifo_ctl.u64 =
282 cvmx_read_csr
283 (CVMX_IPD_PRC_HOLD_PTR_FIFO_CTL);
284 cvmx_fpa_free(cvmx_phys_to_ptr
285 ((uint64_t)
286 ipd_prc_hold_ptr_fifo_ctl.s.
287 ptr << 7), CVMX_FPA_PACKET_POOL,
288 0);
289 }
290 ipd_prc_hold_ptr_fifo_ctl.s.cena = 1;
291 cvmx_write_csr(CVMX_IPD_PRC_HOLD_PTR_FIFO_CTL,
292 ipd_prc_hold_ptr_fifo_ctl.u64);
293 }
294
295 /* Free all packets in the fifo */
296 if (ipd_ptr_count.s.pkt_pcnt) {
297 int i;
298 union cvmx_ipd_pwp_ptr_fifo_ctl ipd_pwp_ptr_fifo_ctl;
299 ipd_pwp_ptr_fifo_ctl.u64 =
300 cvmx_read_csr(CVMX_IPD_PWP_PTR_FIFO_CTL);
301
302 for (i = 0; i < ipd_ptr_count.s.pkt_pcnt; i++) {
303 ipd_pwp_ptr_fifo_ctl.s.cena = 0;
304 ipd_pwp_ptr_fifo_ctl.s.raddr =
305 (ipd_pwp_ptr_fifo_ctl.s.praddr +
306 i) % ipd_pwp_ptr_fifo_ctl.s.max_cnts;
307 cvmx_write_csr(CVMX_IPD_PWP_PTR_FIFO_CTL,
308 ipd_pwp_ptr_fifo_ctl.u64);
309 ipd_pwp_ptr_fifo_ctl.u64 =
310 cvmx_read_csr(CVMX_IPD_PWP_PTR_FIFO_CTL);
311 cvmx_fpa_free(cvmx_phys_to_ptr
312 ((uint64_t) ipd_pwp_ptr_fifo_ctl.
313 s.ptr << 7),
314 CVMX_FPA_PACKET_POOL, 0);
315 }
316 ipd_pwp_ptr_fifo_ctl.s.cena = 1;
317 cvmx_write_csr(CVMX_IPD_PWP_PTR_FIFO_CTL,
318 ipd_pwp_ptr_fifo_ctl.u64);
319 }
320
321 /* Reset the IPD to get all buffers out of it */
322 {
323 union cvmx_ipd_ctl_status ipd_ctl_status;
324 ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
325 ipd_ctl_status.s.reset = 1;
326 cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_ctl_status.u64);
327 }
328
329 /* Reset the PIP */
330 {
331 union cvmx_pip_sft_rst pip_sft_rst;
332 pip_sft_rst.u64 = cvmx_read_csr(CVMX_PIP_SFT_RST);
333 pip_sft_rst.s.rst = 1;
334 cvmx_write_csr(CVMX_PIP_SFT_RST, pip_sft_rst.u64);
335 }
336 }
337}
338
339#endif /* __CVMX_IPD_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-l2c-defs.h b/arch/mips/include/asm/octeon/cvmx-l2c-defs.h
new file mode 100644
index 000000000..3ea84acf1
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-l2c-defs.h
@@ -0,0 +1,239 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2017 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_L2C_DEFS_H__
29#define __CVMX_L2C_DEFS_H__
30
31#include <uapi/asm/bitfield.h>
32
33#define CVMX_L2C_DBG (CVMX_ADD_IO_SEG(0x0001180080000030ull))
34#define CVMX_L2C_CFG (CVMX_ADD_IO_SEG(0x0001180080000000ull))
35#define CVMX_L2C_CTL (CVMX_ADD_IO_SEG(0x0001180080800000ull))
36#define CVMX_L2C_ERR_TDTX(block_id) \
37 (CVMX_ADD_IO_SEG(0x0001180080A007E0ull) + ((block_id) & 3) * 0x40000ull)
38#define CVMX_L2C_ERR_TTGX(block_id) \
39 (CVMX_ADD_IO_SEG(0x0001180080A007E8ull) + ((block_id) & 3) * 0x40000ull)
40#define CVMX_L2C_LCKBASE (CVMX_ADD_IO_SEG(0x0001180080000058ull))
41#define CVMX_L2C_LCKOFF (CVMX_ADD_IO_SEG(0x0001180080000060ull))
42#define CVMX_L2C_PFCTL (CVMX_ADD_IO_SEG(0x0001180080000090ull))
43#define CVMX_L2C_PFCX(offset) (CVMX_ADD_IO_SEG(0x0001180080000098ull) + \
44 ((offset) & 3) * 8)
45#define CVMX_L2C_PFC0 CVMX_L2C_PFCX(0)
46#define CVMX_L2C_PFC1 CVMX_L2C_PFCX(1)
47#define CVMX_L2C_PFC2 CVMX_L2C_PFCX(2)
48#define CVMX_L2C_PFC3 CVMX_L2C_PFCX(3)
49#define CVMX_L2C_SPAR0 (CVMX_ADD_IO_SEG(0x0001180080000068ull))
50#define CVMX_L2C_SPAR1 (CVMX_ADD_IO_SEG(0x0001180080000070ull))
51#define CVMX_L2C_SPAR2 (CVMX_ADD_IO_SEG(0x0001180080000078ull))
52#define CVMX_L2C_SPAR3 (CVMX_ADD_IO_SEG(0x0001180080000080ull))
53#define CVMX_L2C_SPAR4 (CVMX_ADD_IO_SEG(0x0001180080000088ull))
54#define CVMX_L2C_TADX_PFCX(offset, block_id) \
55 (CVMX_ADD_IO_SEG(0x0001180080A00400ull) + (((offset) & 3) + \
56 ((block_id) & 7) * 0x8000ull) * 8)
57#define CVMX_L2C_TADX_PFC0(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00400ull) + \
58 ((block_id) & 3) * 0x40000ull)
59#define CVMX_L2C_TADX_PFC1(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00408ull) + \
60 ((block_id) & 3) * 0x40000ull)
61#define CVMX_L2C_TADX_PFC2(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00410ull) + \
62 ((block_id) & 3) * 0x40000ull)
63#define CVMX_L2C_TADX_PFC3(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00418ull) + \
64 ((block_id) & 3) * 0x40000ull)
65#define CVMX_L2C_TADX_PRF(offset) (CVMX_ADD_IO_SEG(0x0001180080A00008ull) + \
66 ((offset) & 7) * 0x40000ull)
67#define CVMX_L2C_TADX_TAG(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00010ull) + \
68 ((block_id) & 3) * 0x40000ull)
69#define CVMX_L2C_WPAR_IOBX(offset) (CVMX_ADD_IO_SEG(0x0001180080840200ull) + \
70 ((offset) & 1) * 8)
71#define CVMX_L2C_WPAR_PPX(offset) (CVMX_ADD_IO_SEG(0x0001180080840000ull) + \
72 ((offset) & 31) * 8)
73
74
75union cvmx_l2c_err_tdtx {
76 uint64_t u64;
77 struct cvmx_l2c_err_tdtx_s {
78 __BITFIELD_FIELD(uint64_t dbe:1,
79 __BITFIELD_FIELD(uint64_t sbe:1,
80 __BITFIELD_FIELD(uint64_t vdbe:1,
81 __BITFIELD_FIELD(uint64_t vsbe:1,
82 __BITFIELD_FIELD(uint64_t syn:10,
83 __BITFIELD_FIELD(uint64_t reserved_22_49:28,
84 __BITFIELD_FIELD(uint64_t wayidx:18,
85 __BITFIELD_FIELD(uint64_t reserved_2_3:2,
86 __BITFIELD_FIELD(uint64_t type:2,
87 ;)))))))))
88 } s;
89};
90
91union cvmx_l2c_err_ttgx {
92 uint64_t u64;
93 struct cvmx_l2c_err_ttgx_s {
94 __BITFIELD_FIELD(uint64_t dbe:1,
95 __BITFIELD_FIELD(uint64_t sbe:1,
96 __BITFIELD_FIELD(uint64_t noway:1,
97 __BITFIELD_FIELD(uint64_t reserved_56_60:5,
98 __BITFIELD_FIELD(uint64_t syn:6,
99 __BITFIELD_FIELD(uint64_t reserved_22_49:28,
100 __BITFIELD_FIELD(uint64_t wayidx:15,
101 __BITFIELD_FIELD(uint64_t reserved_2_6:5,
102 __BITFIELD_FIELD(uint64_t type:2,
103 ;)))))))))
104 } s;
105};
106
107union cvmx_l2c_cfg {
108 uint64_t u64;
109 struct cvmx_l2c_cfg_s {
110 __BITFIELD_FIELD(uint64_t reserved_20_63:44,
111 __BITFIELD_FIELD(uint64_t bstrun:1,
112 __BITFIELD_FIELD(uint64_t lbist:1,
113 __BITFIELD_FIELD(uint64_t xor_bank:1,
114 __BITFIELD_FIELD(uint64_t dpres1:1,
115 __BITFIELD_FIELD(uint64_t dpres0:1,
116 __BITFIELD_FIELD(uint64_t dfill_dis:1,
117 __BITFIELD_FIELD(uint64_t fpexp:4,
118 __BITFIELD_FIELD(uint64_t fpempty:1,
119 __BITFIELD_FIELD(uint64_t fpen:1,
120 __BITFIELD_FIELD(uint64_t idxalias:1,
121 __BITFIELD_FIELD(uint64_t mwf_crd:4,
122 __BITFIELD_FIELD(uint64_t rsp_arb_mode:1,
123 __BITFIELD_FIELD(uint64_t rfb_arb_mode:1,
124 __BITFIELD_FIELD(uint64_t lrf_arb_mode:1,
125 ;)))))))))))))))
126 } s;
127};
128
129union cvmx_l2c_ctl {
130 uint64_t u64;
131 struct cvmx_l2c_ctl_s {
132 __BITFIELD_FIELD(uint64_t reserved_30_63:34,
133 __BITFIELD_FIELD(uint64_t sepcmt:1,
134 __BITFIELD_FIELD(uint64_t rdf_fast:1,
135 __BITFIELD_FIELD(uint64_t disstgl2i:1,
136 __BITFIELD_FIELD(uint64_t l2dfsbe:1,
137 __BITFIELD_FIELD(uint64_t l2dfdbe:1,
138 __BITFIELD_FIELD(uint64_t discclk:1,
139 __BITFIELD_FIELD(uint64_t maxvab:4,
140 __BITFIELD_FIELD(uint64_t maxlfb:4,
141 __BITFIELD_FIELD(uint64_t rsp_arb_mode:1,
142 __BITFIELD_FIELD(uint64_t xmc_arb_mode:1,
143 __BITFIELD_FIELD(uint64_t ef_ena:1,
144 __BITFIELD_FIELD(uint64_t ef_cnt:7,
145 __BITFIELD_FIELD(uint64_t vab_thresh:4,
146 __BITFIELD_FIELD(uint64_t disecc:1,
147 __BITFIELD_FIELD(uint64_t disidxalias:1,
148 ;))))))))))))))))
149 } s;
150};
151
152union cvmx_l2c_dbg {
153 uint64_t u64;
154 struct cvmx_l2c_dbg_s {
155 __BITFIELD_FIELD(uint64_t reserved_15_63:49,
156 __BITFIELD_FIELD(uint64_t lfb_enum:4,
157 __BITFIELD_FIELD(uint64_t lfb_dmp:1,
158 __BITFIELD_FIELD(uint64_t ppnum:4,
159 __BITFIELD_FIELD(uint64_t set:3,
160 __BITFIELD_FIELD(uint64_t finv:1,
161 __BITFIELD_FIELD(uint64_t l2d:1,
162 __BITFIELD_FIELD(uint64_t l2t:1,
163 ;))))))))
164 } s;
165};
166
167union cvmx_l2c_pfctl {
168 uint64_t u64;
169 struct cvmx_l2c_pfctl_s {
170 __BITFIELD_FIELD(uint64_t reserved_36_63:28,
171 __BITFIELD_FIELD(uint64_t cnt3rdclr:1,
172 __BITFIELD_FIELD(uint64_t cnt2rdclr:1,
173 __BITFIELD_FIELD(uint64_t cnt1rdclr:1,
174 __BITFIELD_FIELD(uint64_t cnt0rdclr:1,
175 __BITFIELD_FIELD(uint64_t cnt3ena:1,
176 __BITFIELD_FIELD(uint64_t cnt3clr:1,
177 __BITFIELD_FIELD(uint64_t cnt3sel:6,
178 __BITFIELD_FIELD(uint64_t cnt2ena:1,
179 __BITFIELD_FIELD(uint64_t cnt2clr:1,
180 __BITFIELD_FIELD(uint64_t cnt2sel:6,
181 __BITFIELD_FIELD(uint64_t cnt1ena:1,
182 __BITFIELD_FIELD(uint64_t cnt1clr:1,
183 __BITFIELD_FIELD(uint64_t cnt1sel:6,
184 __BITFIELD_FIELD(uint64_t cnt0ena:1,
185 __BITFIELD_FIELD(uint64_t cnt0clr:1,
186 __BITFIELD_FIELD(uint64_t cnt0sel:6,
187 ;)))))))))))))))))
188 } s;
189};
190
191union cvmx_l2c_tadx_prf {
192 uint64_t u64;
193 struct cvmx_l2c_tadx_prf_s {
194 __BITFIELD_FIELD(uint64_t reserved_32_63:32,
195 __BITFIELD_FIELD(uint64_t cnt3sel:8,
196 __BITFIELD_FIELD(uint64_t cnt2sel:8,
197 __BITFIELD_FIELD(uint64_t cnt1sel:8,
198 __BITFIELD_FIELD(uint64_t cnt0sel:8,
199 ;)))))
200 } s;
201};
202
203union cvmx_l2c_tadx_tag {
204 uint64_t u64;
205 struct cvmx_l2c_tadx_tag_s {
206 __BITFIELD_FIELD(uint64_t reserved_46_63:18,
207 __BITFIELD_FIELD(uint64_t ecc:6,
208 __BITFIELD_FIELD(uint64_t reserved_36_39:4,
209 __BITFIELD_FIELD(uint64_t tag:19,
210 __BITFIELD_FIELD(uint64_t reserved_4_16:13,
211 __BITFIELD_FIELD(uint64_t use:1,
212 __BITFIELD_FIELD(uint64_t valid:1,
213 __BITFIELD_FIELD(uint64_t dirty:1,
214 __BITFIELD_FIELD(uint64_t lock:1,
215 ;)))))))))
216 } s;
217};
218
219union cvmx_l2c_lckbase {
220 uint64_t u64;
221 struct cvmx_l2c_lckbase_s {
222 __BITFIELD_FIELD(uint64_t reserved_31_63:33,
223 __BITFIELD_FIELD(uint64_t lck_base:27,
224 __BITFIELD_FIELD(uint64_t reserved_1_3:3,
225 __BITFIELD_FIELD(uint64_t lck_ena:1,
226 ;))))
227 } s;
228};
229
230union cvmx_l2c_lckoff {
231 uint64_t u64;
232 struct cvmx_l2c_lckoff_s {
233 __BITFIELD_FIELD(uint64_t reserved_10_63:54,
234 __BITFIELD_FIELD(uint64_t lck_offset:10,
235 ;))
236 } s;
237};
238
239#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-l2c.h b/arch/mips/include/asm/octeon/cvmx-l2c.h
new file mode 100644
index 000000000..4459a3200
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-l2c.h
@@ -0,0 +1,364 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2017 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 * Interface to the Level 2 Cache (L2C) control, measurement, and debugging
30 * facilities.
31 */
32
33#ifndef __CVMX_L2C_H__
34#define __CVMX_L2C_H__
35
36#include <uapi/asm/bitfield.h>
37
38#define CVMX_L2_ASSOC cvmx_l2c_get_num_assoc() /* Deprecated macro */
39#define CVMX_L2_SET_BITS cvmx_l2c_get_set_bits() /* Deprecated macro */
40#define CVMX_L2_SETS cvmx_l2c_get_num_sets() /* Deprecated macro */
41
42/* Based on 128 byte cache line size */
43#define CVMX_L2C_IDX_ADDR_SHIFT 7
44#define CVMX_L2C_IDX_MASK (cvmx_l2c_get_num_sets() - 1)
45
46/* Defines for index aliasing computations */
47#define CVMX_L2C_TAG_ADDR_ALIAS_SHIFT (CVMX_L2C_IDX_ADDR_SHIFT + \
48 cvmx_l2c_get_set_bits())
49#define CVMX_L2C_ALIAS_MASK (CVMX_L2C_IDX_MASK << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT)
50#define CVMX_L2C_MEMBANK_SELECT_SIZE 4096
51
52/* Number of L2C Tag-and-data sections (TADs) that are connected to LMC. */
53#define CVMX_L2C_TADS 1
54
55union cvmx_l2c_tag {
56 uint64_t u64;
57 struct {
58 __BITFIELD_FIELD(uint64_t reserved:28,
59 __BITFIELD_FIELD(uint64_t V:1,
60 __BITFIELD_FIELD(uint64_t D:1,
61 __BITFIELD_FIELD(uint64_t L:1,
62 __BITFIELD_FIELD(uint64_t U:1,
63 __BITFIELD_FIELD(uint64_t addr:32,
64 ;))))))
65 } s;
66};
67
68/* L2C Performance Counter events. */
69enum cvmx_l2c_event {
70 CVMX_L2C_EVENT_CYCLES = 0,
71 CVMX_L2C_EVENT_INSTRUCTION_MISS = 1,
72 CVMX_L2C_EVENT_INSTRUCTION_HIT = 2,
73 CVMX_L2C_EVENT_DATA_MISS = 3,
74 CVMX_L2C_EVENT_DATA_HIT = 4,
75 CVMX_L2C_EVENT_MISS = 5,
76 CVMX_L2C_EVENT_HIT = 6,
77 CVMX_L2C_EVENT_VICTIM_HIT = 7,
78 CVMX_L2C_EVENT_INDEX_CONFLICT = 8,
79 CVMX_L2C_EVENT_TAG_PROBE = 9,
80 CVMX_L2C_EVENT_TAG_UPDATE = 10,
81 CVMX_L2C_EVENT_TAG_COMPLETE = 11,
82 CVMX_L2C_EVENT_TAG_DIRTY = 12,
83 CVMX_L2C_EVENT_DATA_STORE_NOP = 13,
84 CVMX_L2C_EVENT_DATA_STORE_READ = 14,
85 CVMX_L2C_EVENT_DATA_STORE_WRITE = 15,
86 CVMX_L2C_EVENT_FILL_DATA_VALID = 16,
87 CVMX_L2C_EVENT_WRITE_REQUEST = 17,
88 CVMX_L2C_EVENT_READ_REQUEST = 18,
89 CVMX_L2C_EVENT_WRITE_DATA_VALID = 19,
90 CVMX_L2C_EVENT_XMC_NOP = 20,
91 CVMX_L2C_EVENT_XMC_LDT = 21,
92 CVMX_L2C_EVENT_XMC_LDI = 22,
93 CVMX_L2C_EVENT_XMC_LDD = 23,
94 CVMX_L2C_EVENT_XMC_STF = 24,
95 CVMX_L2C_EVENT_XMC_STT = 25,
96 CVMX_L2C_EVENT_XMC_STP = 26,
97 CVMX_L2C_EVENT_XMC_STC = 27,
98 CVMX_L2C_EVENT_XMC_DWB = 28,
99 CVMX_L2C_EVENT_XMC_PL2 = 29,
100 CVMX_L2C_EVENT_XMC_PSL1 = 30,
101 CVMX_L2C_EVENT_XMC_IOBLD = 31,
102 CVMX_L2C_EVENT_XMC_IOBST = 32,
103 CVMX_L2C_EVENT_XMC_IOBDMA = 33,
104 CVMX_L2C_EVENT_XMC_IOBRSP = 34,
105 CVMX_L2C_EVENT_XMC_BUS_VALID = 35,
106 CVMX_L2C_EVENT_XMC_MEM_DATA = 36,
107 CVMX_L2C_EVENT_XMC_REFL_DATA = 37,
108 CVMX_L2C_EVENT_XMC_IOBRSP_DATA = 38,
109 CVMX_L2C_EVENT_RSC_NOP = 39,
110 CVMX_L2C_EVENT_RSC_STDN = 40,
111 CVMX_L2C_EVENT_RSC_FILL = 41,
112 CVMX_L2C_EVENT_RSC_REFL = 42,
113 CVMX_L2C_EVENT_RSC_STIN = 43,
114 CVMX_L2C_EVENT_RSC_SCIN = 44,
115 CVMX_L2C_EVENT_RSC_SCFL = 45,
116 CVMX_L2C_EVENT_RSC_SCDN = 46,
117 CVMX_L2C_EVENT_RSC_DATA_VALID = 47,
118 CVMX_L2C_EVENT_RSC_VALID_FILL = 48,
119 CVMX_L2C_EVENT_RSC_VALID_STRSP = 49,
120 CVMX_L2C_EVENT_RSC_VALID_REFL = 50,
121 CVMX_L2C_EVENT_LRF_REQ = 51,
122 CVMX_L2C_EVENT_DT_RD_ALLOC = 52,
123 CVMX_L2C_EVENT_DT_WR_INVAL = 53,
124 CVMX_L2C_EVENT_MAX
125};
126
127/* L2C Performance Counter events for Octeon2. */
128enum cvmx_l2c_tad_event {
129 CVMX_L2C_TAD_EVENT_NONE = 0,
130 CVMX_L2C_TAD_EVENT_TAG_HIT = 1,
131 CVMX_L2C_TAD_EVENT_TAG_MISS = 2,
132 CVMX_L2C_TAD_EVENT_TAG_NOALLOC = 3,
133 CVMX_L2C_TAD_EVENT_TAG_VICTIM = 4,
134 CVMX_L2C_TAD_EVENT_SC_FAIL = 5,
135 CVMX_L2C_TAD_EVENT_SC_PASS = 6,
136 CVMX_L2C_TAD_EVENT_LFB_VALID = 7,
137 CVMX_L2C_TAD_EVENT_LFB_WAIT_LFB = 8,
138 CVMX_L2C_TAD_EVENT_LFB_WAIT_VAB = 9,
139 CVMX_L2C_TAD_EVENT_QUAD0_INDEX = 128,
140 CVMX_L2C_TAD_EVENT_QUAD0_READ = 129,
141 CVMX_L2C_TAD_EVENT_QUAD0_BANK = 130,
142 CVMX_L2C_TAD_EVENT_QUAD0_WDAT = 131,
143 CVMX_L2C_TAD_EVENT_QUAD1_INDEX = 144,
144 CVMX_L2C_TAD_EVENT_QUAD1_READ = 145,
145 CVMX_L2C_TAD_EVENT_QUAD1_BANK = 146,
146 CVMX_L2C_TAD_EVENT_QUAD1_WDAT = 147,
147 CVMX_L2C_TAD_EVENT_QUAD2_INDEX = 160,
148 CVMX_L2C_TAD_EVENT_QUAD2_READ = 161,
149 CVMX_L2C_TAD_EVENT_QUAD2_BANK = 162,
150 CVMX_L2C_TAD_EVENT_QUAD2_WDAT = 163,
151 CVMX_L2C_TAD_EVENT_QUAD3_INDEX = 176,
152 CVMX_L2C_TAD_EVENT_QUAD3_READ = 177,
153 CVMX_L2C_TAD_EVENT_QUAD3_BANK = 178,
154 CVMX_L2C_TAD_EVENT_QUAD3_WDAT = 179,
155 CVMX_L2C_TAD_EVENT_MAX
156};
157
158/**
159 * Configure one of the four L2 Cache performance counters to capture event
160 * occurrences.
161 *
162 * @counter: The counter to configure. Range 0..3.
163 * @event: The type of L2 Cache event occurrence to count.
164 * @clear_on_read: When asserted, any read of the performance counter
165 * clears the counter.
166 *
167 * @note The routine does not clear the counter.
168 */
169void cvmx_l2c_config_perf(uint32_t counter, enum cvmx_l2c_event event,
170 uint32_t clear_on_read);
171
172/**
173 * Read the given L2 Cache performance counter. The counter must be configured
174 * before reading, but this routine does not enforce this requirement.
175 *
176 * @counter: The counter to configure. Range 0..3.
177 *
178 * Returns The current counter value.
179 */
180uint64_t cvmx_l2c_read_perf(uint32_t counter);
181
182/**
183 * Return the L2 Cache way partitioning for a given core.
184 *
185 * @core: The core processor of interest.
186 *
187 * Returns The mask specifying the partitioning. 0 bits in mask indicates
188 * the cache 'ways' that a core can evict from.
189 * -1 on error
190 */
191int cvmx_l2c_get_core_way_partition(uint32_t core);
192
193/**
194 * Partitions the L2 cache for a core
195 *
196 * @core: The core that the partitioning applies to.
197 * @mask: The partitioning of the ways expressed as a binary
198 * mask. A 0 bit allows the core to evict cache lines from
199 * a way, while a 1 bit blocks the core from evicting any
200 * lines from that way. There must be at least one allowed
201 * way (0 bit) in the mask.
202 *
203
204 * @note If any ways are blocked for all cores and the HW blocks, then
205 * those ways will never have any cache lines evicted from them.
206 * All cores and the hardware blocks are free to read from all
207 * ways regardless of the partitioning.
208 */
209int cvmx_l2c_set_core_way_partition(uint32_t core, uint32_t mask);
210
211/**
212 * Return the L2 Cache way partitioning for the hw blocks.
213 *
214 * Returns The mask specifying the reserved way. 0 bits in mask indicates
215 * the cache 'ways' that a core can evict from.
216 * -1 on error
217 */
218int cvmx_l2c_get_hw_way_partition(void);
219
220/**
221 * Partitions the L2 cache for the hardware blocks.
222 *
223 * @mask: The partitioning of the ways expressed as a binary
224 * mask. A 0 bit allows the core to evict cache lines from
225 * a way, while a 1 bit blocks the core from evicting any
226 * lines from that way. There must be at least one allowed
227 * way (0 bit) in the mask.
228 *
229
230 * @note If any ways are blocked for all cores and the HW blocks, then
231 * those ways will never have any cache lines evicted from them.
232 * All cores and the hardware blocks are free to read from all
233 * ways regardless of the partitioning.
234 */
235int cvmx_l2c_set_hw_way_partition(uint32_t mask);
236
237
238/**
239 * Locks a line in the L2 cache at the specified physical address
240 *
241 * @addr: physical address of line to lock
242 *
243 * Returns 0 on success,
244 * 1 if line not locked.
245 */
246int cvmx_l2c_lock_line(uint64_t addr);
247
248/**
249 * Locks a specified memory region in the L2 cache.
250 *
251 * Note that if not all lines can be locked, that means that all
252 * but one of the ways (associations) available to the locking
253 * core are locked. Having only 1 association available for
254 * normal caching may have a significant adverse affect on performance.
255 * Care should be taken to ensure that enough of the L2 cache is left
256 * unlocked to allow for normal caching of DRAM.
257 *
258 * @start: Physical address of the start of the region to lock
259 * @len: Length (in bytes) of region to lock
260 *
261 * Returns Number of requested lines that where not locked.
262 * 0 on success (all locked)
263 */
264int cvmx_l2c_lock_mem_region(uint64_t start, uint64_t len);
265
266/**
267 * Unlock and flush a cache line from the L2 cache.
268 * IMPORTANT: Must only be run by one core at a time due to use
269 * of L2C debug features.
270 * Note that this function will flush a matching but unlocked cache line.
271 * (If address is not in L2, no lines are flushed.)
272 *
273 * @address: Physical address to unlock
274 *
275 * Returns 0: line not unlocked
276 * 1: line unlocked
277 */
278int cvmx_l2c_unlock_line(uint64_t address);
279
280/**
281 * Unlocks a region of memory that is locked in the L2 cache
282 *
283 * @start: start physical address
284 * @len: length (in bytes) to unlock
285 *
286 * Returns Number of locked lines that the call unlocked
287 */
288int cvmx_l2c_unlock_mem_region(uint64_t start, uint64_t len);
289
290/**
291 * Read the L2 controller tag for a given location in L2
292 *
293 * @association:
294 * Which association to read line from
295 * @index: Which way to read from.
296 *
297 * Returns l2c tag structure for line requested.
298 */
299union cvmx_l2c_tag cvmx_l2c_get_tag(uint32_t association, uint32_t index);
300
301/* Wrapper providing a deprecated old function name */
302static inline union cvmx_l2c_tag cvmx_get_l2c_tag(uint32_t association,
303 uint32_t index)
304 __attribute__((deprecated));
305static inline union cvmx_l2c_tag cvmx_get_l2c_tag(uint32_t association,
306 uint32_t index)
307{
308 return cvmx_l2c_get_tag(association, index);
309}
310
311
312/**
313 * Returns the cache index for a given physical address
314 *
315 * @addr: physical address
316 *
317 * Returns L2 cache index
318 */
319uint32_t cvmx_l2c_address_to_index(uint64_t addr);
320
321/**
322 * Flushes (and unlocks) the entire L2 cache.
323 * IMPORTANT: Must only be run by one core at a time due to use
324 * of L2C debug features.
325 */
326void cvmx_l2c_flush(void);
327
328/**
329 *
330 * Returns the size of the L2 cache in bytes,
331 * -1 on error (unrecognized model)
332 */
333int cvmx_l2c_get_cache_size_bytes(void);
334
335/**
336 * Return the number of sets in the L2 Cache
337 *
338 * Returns
339 */
340int cvmx_l2c_get_num_sets(void);
341
342/**
343 * Return log base 2 of the number of sets in the L2 cache
344 * Returns
345 */
346int cvmx_l2c_get_set_bits(void);
347/**
348 * Return the number of associations in the L2 Cache
349 *
350 * Returns
351 */
352int cvmx_l2c_get_num_assoc(void);
353
354/**
355 * Flush a line from the L2 cache
356 * This should only be called from one core at a time, as this routine
357 * sets the core to the 'debug' core in order to flush the line.
358 *
359 * @assoc: Association (or way) to flush
360 * @index: Index to flush
361 */
362void cvmx_l2c_flush_line(uint32_t assoc, uint32_t index);
363
364#endif /* __CVMX_L2C_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-l2d-defs.h b/arch/mips/include/asm/octeon/cvmx-l2d-defs.h
new file mode 100644
index 000000000..a951ad5d6
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-l2d-defs.h
@@ -0,0 +1,60 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2017 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_L2D_DEFS_H__
29#define __CVMX_L2D_DEFS_H__
30
31#define CVMX_L2D_ERR (CVMX_ADD_IO_SEG(0x0001180080000010ull))
32#define CVMX_L2D_FUS3 (CVMX_ADD_IO_SEG(0x00011800800007B8ull))
33
34
35union cvmx_l2d_err {
36 uint64_t u64;
37 struct cvmx_l2d_err_s {
38 __BITFIELD_FIELD(uint64_t reserved_6_63:58,
39 __BITFIELD_FIELD(uint64_t bmhclsel:1,
40 __BITFIELD_FIELD(uint64_t ded_err:1,
41 __BITFIELD_FIELD(uint64_t sec_err:1,
42 __BITFIELD_FIELD(uint64_t ded_intena:1,
43 __BITFIELD_FIELD(uint64_t sec_intena:1,
44 __BITFIELD_FIELD(uint64_t ecc_ena:1,
45 ;)))))))
46 } s;
47};
48
49union cvmx_l2d_fus3 {
50 uint64_t u64;
51 struct cvmx_l2d_fus3_s {
52 __BITFIELD_FIELD(uint64_t reserved_40_63:24,
53 __BITFIELD_FIELD(uint64_t ema_ctl:3,
54 __BITFIELD_FIELD(uint64_t reserved_34_36:3,
55 __BITFIELD_FIELD(uint64_t q3fus:34,
56 ;))))
57 } s;
58};
59
60#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-l2t-defs.h b/arch/mips/include/asm/octeon/cvmx-l2t-defs.h
new file mode 100644
index 000000000..06ea13251
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-l2t-defs.h
@@ -0,0 +1,143 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2017 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_L2T_DEFS_H__
29#define __CVMX_L2T_DEFS_H__
30
31#include <uapi/asm/bitfield.h>
32
33#define CVMX_L2T_ERR (CVMX_ADD_IO_SEG(0x0001180080000008ull))
34
35
36union cvmx_l2t_err {
37 uint64_t u64;
38 struct cvmx_l2t_err_s {
39 __BITFIELD_FIELD(uint64_t reserved_29_63:35,
40 __BITFIELD_FIELD(uint64_t fadru:1,
41 __BITFIELD_FIELD(uint64_t lck_intena2:1,
42 __BITFIELD_FIELD(uint64_t lckerr2:1,
43 __BITFIELD_FIELD(uint64_t lck_intena:1,
44 __BITFIELD_FIELD(uint64_t lckerr:1,
45 __BITFIELD_FIELD(uint64_t fset:3,
46 __BITFIELD_FIELD(uint64_t fadr:10,
47 __BITFIELD_FIELD(uint64_t fsyn:6,
48 __BITFIELD_FIELD(uint64_t ded_err:1,
49 __BITFIELD_FIELD(uint64_t sec_err:1,
50 __BITFIELD_FIELD(uint64_t ded_intena:1,
51 __BITFIELD_FIELD(uint64_t sec_intena:1,
52 __BITFIELD_FIELD(uint64_t ecc_ena:1,
53 ;))))))))))))))
54 } s;
55 struct cvmx_l2t_err_cn30xx {
56 __BITFIELD_FIELD(uint64_t reserved_28_63:36,
57 __BITFIELD_FIELD(uint64_t lck_intena2:1,
58 __BITFIELD_FIELD(uint64_t lckerr2:1,
59 __BITFIELD_FIELD(uint64_t lck_intena:1,
60 __BITFIELD_FIELD(uint64_t lckerr:1,
61 __BITFIELD_FIELD(uint64_t reserved_23_23:1,
62 __BITFIELD_FIELD(uint64_t fset:2,
63 __BITFIELD_FIELD(uint64_t reserved_19_20:2,
64 __BITFIELD_FIELD(uint64_t fadr:8,
65 __BITFIELD_FIELD(uint64_t fsyn:6,
66 __BITFIELD_FIELD(uint64_t ded_err:1,
67 __BITFIELD_FIELD(uint64_t sec_err:1,
68 __BITFIELD_FIELD(uint64_t ded_intena:1,
69 __BITFIELD_FIELD(uint64_t sec_intena:1,
70 __BITFIELD_FIELD(uint64_t ecc_ena:1,
71 ;)))))))))))))))
72 } cn30xx;
73 struct cvmx_l2t_err_cn31xx {
74 __BITFIELD_FIELD(uint64_t reserved_28_63:36,
75 __BITFIELD_FIELD(uint64_t lck_intena2:1,
76 __BITFIELD_FIELD(uint64_t lckerr2:1,
77 __BITFIELD_FIELD(uint64_t lck_intena:1,
78 __BITFIELD_FIELD(uint64_t lckerr:1,
79 __BITFIELD_FIELD(uint64_t reserved_23_23:1,
80 __BITFIELD_FIELD(uint64_t fset:2,
81 __BITFIELD_FIELD(uint64_t reserved_20_20:1,
82 __BITFIELD_FIELD(uint64_t fadr:9,
83 __BITFIELD_FIELD(uint64_t fsyn:6,
84 __BITFIELD_FIELD(uint64_t ded_err:1,
85 __BITFIELD_FIELD(uint64_t sec_err:1,
86 __BITFIELD_FIELD(uint64_t ded_intena:1,
87 __BITFIELD_FIELD(uint64_t sec_intena:1,
88 __BITFIELD_FIELD(uint64_t ecc_ena:1,
89 ;)))))))))))))))
90 } cn31xx;
91 struct cvmx_l2t_err_cn38xx {
92 __BITFIELD_FIELD(uint64_t reserved_28_63:36,
93 __BITFIELD_FIELD(uint64_t lck_intena2:1,
94 __BITFIELD_FIELD(uint64_t lckerr2:1,
95 __BITFIELD_FIELD(uint64_t lck_intena:1,
96 __BITFIELD_FIELD(uint64_t lckerr:1,
97 __BITFIELD_FIELD(uint64_t fset:3,
98 __BITFIELD_FIELD(uint64_t fadr:10,
99 __BITFIELD_FIELD(uint64_t fsyn:6,
100 __BITFIELD_FIELD(uint64_t ded_err:1,
101 __BITFIELD_FIELD(uint64_t sec_err:1,
102 __BITFIELD_FIELD(uint64_t ded_intena:1,
103 __BITFIELD_FIELD(uint64_t sec_intena:1,
104 __BITFIELD_FIELD(uint64_t ecc_ena:1,
105 ;)))))))))))))
106 } cn38xx;
107 struct cvmx_l2t_err_cn50xx {
108 __BITFIELD_FIELD(uint64_t reserved_28_63:36,
109 __BITFIELD_FIELD(uint64_t lck_intena2:1,
110 __BITFIELD_FIELD(uint64_t lckerr2:1,
111 __BITFIELD_FIELD(uint64_t lck_intena:1,
112 __BITFIELD_FIELD(uint64_t lckerr:1,
113 __BITFIELD_FIELD(uint64_t fset:3,
114 __BITFIELD_FIELD(uint64_t reserved_18_20:3,
115 __BITFIELD_FIELD(uint64_t fadr:7,
116 __BITFIELD_FIELD(uint64_t fsyn:6,
117 __BITFIELD_FIELD(uint64_t ded_err:1,
118 __BITFIELD_FIELD(uint64_t sec_err:1,
119 __BITFIELD_FIELD(uint64_t ded_intena:1,
120 __BITFIELD_FIELD(uint64_t sec_intena:1,
121 __BITFIELD_FIELD(uint64_t ecc_ena:1,
122 ;))))))))))))))
123 } cn50xx;
124 struct cvmx_l2t_err_cn52xx {
125 __BITFIELD_FIELD(uint64_t reserved_28_63:36,
126 __BITFIELD_FIELD(uint64_t lck_intena2:1,
127 __BITFIELD_FIELD(uint64_t lckerr2:1,
128 __BITFIELD_FIELD(uint64_t lck_intena:1,
129 __BITFIELD_FIELD(uint64_t lckerr:1,
130 __BITFIELD_FIELD(uint64_t fset:3,
131 __BITFIELD_FIELD(uint64_t reserved_20_20:1,
132 __BITFIELD_FIELD(uint64_t fadr:9,
133 __BITFIELD_FIELD(uint64_t fsyn:6,
134 __BITFIELD_FIELD(uint64_t ded_err:1,
135 __BITFIELD_FIELD(uint64_t sec_err:1,
136 __BITFIELD_FIELD(uint64_t ded_intena:1,
137 __BITFIELD_FIELD(uint64_t sec_intena:1,
138 __BITFIELD_FIELD(uint64_t ecc_ena:1,
139 ;))))))))))))))
140 } cn52xx;
141};
142
143#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-led-defs.h b/arch/mips/include/asm/octeon/cvmx-led-defs.h
new file mode 100644
index 000000000..023790752
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-led-defs.h
@@ -0,0 +1,214 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_LED_DEFS_H__
29#define __CVMX_LED_DEFS_H__
30
31#define CVMX_LED_BLINK (CVMX_ADD_IO_SEG(0x0001180000001A48ull))
32#define CVMX_LED_CLK_PHASE (CVMX_ADD_IO_SEG(0x0001180000001A08ull))
33#define CVMX_LED_CYLON (CVMX_ADD_IO_SEG(0x0001180000001AF8ull))
34#define CVMX_LED_DBG (CVMX_ADD_IO_SEG(0x0001180000001A18ull))
35#define CVMX_LED_EN (CVMX_ADD_IO_SEG(0x0001180000001A00ull))
36#define CVMX_LED_POLARITY (CVMX_ADD_IO_SEG(0x0001180000001A50ull))
37#define CVMX_LED_PRT (CVMX_ADD_IO_SEG(0x0001180000001A10ull))
38#define CVMX_LED_PRT_FMT (CVMX_ADD_IO_SEG(0x0001180000001A30ull))
39#define CVMX_LED_PRT_STATUSX(offset) (CVMX_ADD_IO_SEG(0x0001180000001A80ull) + ((offset) & 7) * 8)
40#define CVMX_LED_UDD_CNTX(offset) (CVMX_ADD_IO_SEG(0x0001180000001A20ull) + ((offset) & 1) * 8)
41#define CVMX_LED_UDD_DATX(offset) (CVMX_ADD_IO_SEG(0x0001180000001A38ull) + ((offset) & 1) * 8)
42#define CVMX_LED_UDD_DAT_CLRX(offset) (CVMX_ADD_IO_SEG(0x0001180000001AC8ull) + ((offset) & 1) * 16)
43#define CVMX_LED_UDD_DAT_SETX(offset) (CVMX_ADD_IO_SEG(0x0001180000001AC0ull) + ((offset) & 1) * 16)
44
45union cvmx_led_blink {
46 uint64_t u64;
47 struct cvmx_led_blink_s {
48#ifdef __BIG_ENDIAN_BITFIELD
49 uint64_t reserved_8_63:56;
50 uint64_t rate:8;
51#else
52 uint64_t rate:8;
53 uint64_t reserved_8_63:56;
54#endif
55 } s;
56};
57
58union cvmx_led_clk_phase {
59 uint64_t u64;
60 struct cvmx_led_clk_phase_s {
61#ifdef __BIG_ENDIAN_BITFIELD
62 uint64_t reserved_7_63:57;
63 uint64_t phase:7;
64#else
65 uint64_t phase:7;
66 uint64_t reserved_7_63:57;
67#endif
68 } s;
69};
70
71union cvmx_led_cylon {
72 uint64_t u64;
73 struct cvmx_led_cylon_s {
74#ifdef __BIG_ENDIAN_BITFIELD
75 uint64_t reserved_16_63:48;
76 uint64_t rate:16;
77#else
78 uint64_t rate:16;
79 uint64_t reserved_16_63:48;
80#endif
81 } s;
82};
83
84union cvmx_led_dbg {
85 uint64_t u64;
86 struct cvmx_led_dbg_s {
87#ifdef __BIG_ENDIAN_BITFIELD
88 uint64_t reserved_1_63:63;
89 uint64_t dbg_en:1;
90#else
91 uint64_t dbg_en:1;
92 uint64_t reserved_1_63:63;
93#endif
94 } s;
95};
96
97union cvmx_led_en {
98 uint64_t u64;
99 struct cvmx_led_en_s {
100#ifdef __BIG_ENDIAN_BITFIELD
101 uint64_t reserved_1_63:63;
102 uint64_t en:1;
103#else
104 uint64_t en:1;
105 uint64_t reserved_1_63:63;
106#endif
107 } s;
108};
109
110union cvmx_led_polarity {
111 uint64_t u64;
112 struct cvmx_led_polarity_s {
113#ifdef __BIG_ENDIAN_BITFIELD
114 uint64_t reserved_1_63:63;
115 uint64_t polarity:1;
116#else
117 uint64_t polarity:1;
118 uint64_t reserved_1_63:63;
119#endif
120 } s;
121};
122
123union cvmx_led_prt {
124 uint64_t u64;
125 struct cvmx_led_prt_s {
126#ifdef __BIG_ENDIAN_BITFIELD
127 uint64_t reserved_8_63:56;
128 uint64_t prt_en:8;
129#else
130 uint64_t prt_en:8;
131 uint64_t reserved_8_63:56;
132#endif
133 } s;
134};
135
136union cvmx_led_prt_fmt {
137 uint64_t u64;
138 struct cvmx_led_prt_fmt_s {
139#ifdef __BIG_ENDIAN_BITFIELD
140 uint64_t reserved_4_63:60;
141 uint64_t format:4;
142#else
143 uint64_t format:4;
144 uint64_t reserved_4_63:60;
145#endif
146 } s;
147};
148
149union cvmx_led_prt_statusx {
150 uint64_t u64;
151 struct cvmx_led_prt_statusx_s {
152#ifdef __BIG_ENDIAN_BITFIELD
153 uint64_t reserved_6_63:58;
154 uint64_t status:6;
155#else
156 uint64_t status:6;
157 uint64_t reserved_6_63:58;
158#endif
159 } s;
160};
161
162union cvmx_led_udd_cntx {
163 uint64_t u64;
164 struct cvmx_led_udd_cntx_s {
165#ifdef __BIG_ENDIAN_BITFIELD
166 uint64_t reserved_6_63:58;
167 uint64_t cnt:6;
168#else
169 uint64_t cnt:6;
170 uint64_t reserved_6_63:58;
171#endif
172 } s;
173};
174
175union cvmx_led_udd_datx {
176 uint64_t u64;
177 struct cvmx_led_udd_datx_s {
178#ifdef __BIG_ENDIAN_BITFIELD
179 uint64_t reserved_32_63:32;
180 uint64_t dat:32;
181#else
182 uint64_t dat:32;
183 uint64_t reserved_32_63:32;
184#endif
185 } s;
186};
187
188union cvmx_led_udd_dat_clrx {
189 uint64_t u64;
190 struct cvmx_led_udd_dat_clrx_s {
191#ifdef __BIG_ENDIAN_BITFIELD
192 uint64_t reserved_32_63:32;
193 uint64_t clr:32;
194#else
195 uint64_t clr:32;
196 uint64_t reserved_32_63:32;
197#endif
198 } s;
199};
200
201union cvmx_led_udd_dat_setx {
202 uint64_t u64;
203 struct cvmx_led_udd_dat_setx_s {
204#ifdef __BIG_ENDIAN_BITFIELD
205 uint64_t reserved_32_63:32;
206 uint64_t set:32;
207#else
208 uint64_t set:32;
209 uint64_t reserved_32_63:32;
210#endif
211 } s;
212};
213
214#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-lmcx-defs.h b/arch/mips/include/asm/octeon/cvmx-lmcx-defs.h
new file mode 100644
index 000000000..4167a4c7a
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-lmcx-defs.h
@@ -0,0 +1,2943 @@
1/***********************license start***************
2 * Author: Cavium Inc.
3 *
4 * Contact: support@cavium.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Inc. for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_LMCX_DEFS_H__
29#define __CVMX_LMCX_DEFS_H__
30
31#define CVMX_LMCX_BIST_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000F0ull) + ((block_id) & 1) * 0x60000000ull)
32#define CVMX_LMCX_BIST_RESULT(block_id) (CVMX_ADD_IO_SEG(0x00011800880000F8ull) + ((block_id) & 1) * 0x60000000ull)
33#define CVMX_LMCX_CHAR_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000220ull) + ((block_id) & 3) * 0x1000000ull)
34#define CVMX_LMCX_CHAR_MASK0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000228ull) + ((block_id) & 3) * 0x1000000ull)
35#define CVMX_LMCX_CHAR_MASK1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000230ull) + ((block_id) & 3) * 0x1000000ull)
36#define CVMX_LMCX_CHAR_MASK2(block_id) (CVMX_ADD_IO_SEG(0x0001180088000238ull) + ((block_id) & 3) * 0x1000000ull)
37#define CVMX_LMCX_CHAR_MASK3(block_id) (CVMX_ADD_IO_SEG(0x0001180088000240ull) + ((block_id) & 3) * 0x1000000ull)
38#define CVMX_LMCX_CHAR_MASK4(block_id) (CVMX_ADD_IO_SEG(0x0001180088000318ull) + ((block_id) & 3) * 0x1000000ull)
39#define CVMX_LMCX_COMP_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000028ull) + ((block_id) & 1) * 0x60000000ull)
40#define CVMX_LMCX_COMP_CTL2(block_id) (CVMX_ADD_IO_SEG(0x00011800880001B8ull) + ((block_id) & 3) * 0x1000000ull)
41#define CVMX_LMCX_CONFIG(block_id) (CVMX_ADD_IO_SEG(0x0001180088000188ull) + ((block_id) & 3) * 0x1000000ull)
42#define CVMX_LMCX_CONTROL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000190ull) + ((block_id) & 3) * 0x1000000ull)
43#define CVMX_LMCX_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000010ull) + ((block_id) & 1) * 0x60000000ull)
44#define CVMX_LMCX_CTL1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000090ull) + ((block_id) & 1) * 0x60000000ull)
45#define CVMX_LMCX_DCLK_CNT(block_id) (CVMX_ADD_IO_SEG(0x00011800880001E0ull) + ((block_id) & 3) * 0x1000000ull)
46#define CVMX_LMCX_DCLK_CNT_HI(block_id) (CVMX_ADD_IO_SEG(0x0001180088000070ull) + ((block_id) & 1) * 0x60000000ull)
47#define CVMX_LMCX_DCLK_CNT_LO(block_id) (CVMX_ADD_IO_SEG(0x0001180088000068ull) + ((block_id) & 1) * 0x60000000ull)
48#define CVMX_LMCX_DCLK_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000B8ull) + ((block_id) & 1) * 0x60000000ull)
49#define CVMX_LMCX_DDR2_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000018ull) + ((block_id) & 1) * 0x60000000ull)
50#define CVMX_LMCX_DDR_PLL_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000258ull) + ((block_id) & 3) * 0x1000000ull)
51#define CVMX_LMCX_DELAY_CFG(block_id) (CVMX_ADD_IO_SEG(0x0001180088000088ull) + ((block_id) & 1) * 0x60000000ull)
52#define CVMX_LMCX_DIMMX_PARAMS(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180088000270ull) + (((offset) & 1) + ((block_id) & 3) * 0x200000ull) * 8)
53#define CVMX_LMCX_DIMM_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000310ull) + ((block_id) & 3) * 0x1000000ull)
54#define CVMX_LMCX_DLL_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000C0ull) + ((block_id) & 1) * 0x60000000ull)
55#define CVMX_LMCX_DLL_CTL2(block_id) (CVMX_ADD_IO_SEG(0x00011800880001C8ull) + ((block_id) & 3) * 0x1000000ull)
56#define CVMX_LMCX_DLL_CTL3(block_id) (CVMX_ADD_IO_SEG(0x0001180088000218ull) + ((block_id) & 3) * 0x1000000ull)
57static inline uint64_t CVMX_LMCX_DUAL_MEMCFG(unsigned long block_id)
58{
59 switch (cvmx_get_octeon_family()) {
60 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
61 case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
62 case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
63 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
64 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
65 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
66 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
67 return CVMX_ADD_IO_SEG(0x0001180088000098ull) + (block_id) * 0x60000000ull;
68 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
69 return CVMX_ADD_IO_SEG(0x0001180088000098ull) + (block_id) * 0x60000000ull;
70 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
71 return CVMX_ADD_IO_SEG(0x0001180088000098ull) + (block_id) * 0x1000000ull;
72 }
73 return CVMX_ADD_IO_SEG(0x0001180088000098ull) + (block_id) * 0x60000000ull;
74}
75
76static inline uint64_t CVMX_LMCX_ECC_SYND(unsigned long block_id)
77{
78 switch (cvmx_get_octeon_family()) {
79 case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
80 case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
81 case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
82 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
83 case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
84 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
85 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
86 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
87 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
88 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
89 return CVMX_ADD_IO_SEG(0x0001180088000038ull) + (block_id) * 0x60000000ull;
90 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
91 return CVMX_ADD_IO_SEG(0x0001180088000038ull) + (block_id) * 0x60000000ull;
92 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
93 return CVMX_ADD_IO_SEG(0x0001180088000038ull) + (block_id) * 0x1000000ull;
94 }
95 return CVMX_ADD_IO_SEG(0x0001180088000038ull) + (block_id) * 0x60000000ull;
96}
97
98static inline uint64_t CVMX_LMCX_FADR(unsigned long block_id)
99{
100 switch (cvmx_get_octeon_family()) {
101 case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
102 case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
103 case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
104 case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
105 case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
106 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
107 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
108 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
109 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
110 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
111 return CVMX_ADD_IO_SEG(0x0001180088000020ull) + (block_id) * 0x60000000ull;
112 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
113 return CVMX_ADD_IO_SEG(0x0001180088000020ull) + (block_id) * 0x60000000ull;
114 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
115 return CVMX_ADD_IO_SEG(0x0001180088000020ull) + (block_id) * 0x1000000ull;
116 }
117 return CVMX_ADD_IO_SEG(0x0001180088000020ull) + (block_id) * 0x60000000ull;
118}
119
120#define CVMX_LMCX_IFB_CNT(block_id) (CVMX_ADD_IO_SEG(0x00011800880001D0ull) + ((block_id) & 3) * 0x1000000ull)
121#define CVMX_LMCX_IFB_CNT_HI(block_id) (CVMX_ADD_IO_SEG(0x0001180088000050ull) + ((block_id) & 1) * 0x60000000ull)
122#define CVMX_LMCX_IFB_CNT_LO(block_id) (CVMX_ADD_IO_SEG(0x0001180088000048ull) + ((block_id) & 1) * 0x60000000ull)
123#define CVMX_LMCX_INT(block_id) (CVMX_ADD_IO_SEG(0x00011800880001F0ull) + ((block_id) & 3) * 0x1000000ull)
124#define CVMX_LMCX_INT_EN(block_id) (CVMX_ADD_IO_SEG(0x00011800880001E8ull) + ((block_id) & 3) * 0x1000000ull)
125#define CVMX_LMCX_MEM_CFG0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000000ull) + ((block_id) & 1) * 0x60000000ull)
126#define CVMX_LMCX_MEM_CFG1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000008ull) + ((block_id) & 1) * 0x60000000ull)
127#define CVMX_LMCX_MODEREG_PARAMS0(block_id) (CVMX_ADD_IO_SEG(0x00011800880001A8ull) + ((block_id) & 3) * 0x1000000ull)
128#define CVMX_LMCX_MODEREG_PARAMS1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000260ull) + ((block_id) & 3) * 0x1000000ull)
129static inline uint64_t CVMX_LMCX_NXM(unsigned long block_id)
130{
131 switch (cvmx_get_octeon_family()) {
132 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
133 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
134 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
135 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
136 case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
137 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
138 return CVMX_ADD_IO_SEG(0x00011800880000C8ull) + (block_id) * 0x60000000ull;
139 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
140 return CVMX_ADD_IO_SEG(0x00011800880000C8ull) + (block_id) * 0x60000000ull;
141 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
142 return CVMX_ADD_IO_SEG(0x00011800880000C8ull) + (block_id) * 0x1000000ull;
143 }
144 return CVMX_ADD_IO_SEG(0x00011800880000C8ull) + (block_id) * 0x60000000ull;
145}
146
147#define CVMX_LMCX_OPS_CNT(block_id) (CVMX_ADD_IO_SEG(0x00011800880001D8ull) + ((block_id) & 3) * 0x1000000ull)
148#define CVMX_LMCX_OPS_CNT_HI(block_id) (CVMX_ADD_IO_SEG(0x0001180088000060ull) + ((block_id) & 1) * 0x60000000ull)
149#define CVMX_LMCX_OPS_CNT_LO(block_id) (CVMX_ADD_IO_SEG(0x0001180088000058ull) + ((block_id) & 1) * 0x60000000ull)
150#define CVMX_LMCX_PHY_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000210ull) + ((block_id) & 3) * 0x1000000ull)
151#define CVMX_LMCX_PLL_BWCTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000040ull))
152#define CVMX_LMCX_PLL_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000A8ull) + ((block_id) & 1) * 0x60000000ull)
153#define CVMX_LMCX_PLL_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800880000B0ull) + ((block_id) & 1) * 0x60000000ull)
154#define CVMX_LMCX_READ_LEVEL_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000140ull) + ((block_id) & 1) * 0x60000000ull)
155#define CVMX_LMCX_READ_LEVEL_DBG(block_id) (CVMX_ADD_IO_SEG(0x0001180088000148ull) + ((block_id) & 1) * 0x60000000ull)
156#define CVMX_LMCX_READ_LEVEL_RANKX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180088000100ull) + (((offset) & 3) + ((block_id) & 1) * 0xC000000ull) * 8)
157#define CVMX_LMCX_RESET_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000180ull) + ((block_id) & 3) * 0x1000000ull)
158#define CVMX_LMCX_RLEVEL_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880002A0ull) + ((block_id) & 3) * 0x1000000ull)
159#define CVMX_LMCX_RLEVEL_DBG(block_id) (CVMX_ADD_IO_SEG(0x00011800880002A8ull) + ((block_id) & 3) * 0x1000000ull)
160#define CVMX_LMCX_RLEVEL_RANKX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180088000280ull) + (((offset) & 3) + ((block_id) & 3) * 0x200000ull) * 8)
161#define CVMX_LMCX_RODT_COMP_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800880000A0ull) + ((block_id) & 1) * 0x60000000ull)
162#define CVMX_LMCX_RODT_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000078ull) + ((block_id) & 1) * 0x60000000ull)
163#define CVMX_LMCX_RODT_MASK(block_id) (CVMX_ADD_IO_SEG(0x0001180088000268ull) + ((block_id) & 3) * 0x1000000ull)
164#define CVMX_LMCX_SCRAMBLED_FADR(block_id) (CVMX_ADD_IO_SEG(0x0001180088000330ull))
165#define CVMX_LMCX_SCRAMBLE_CFG0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000320ull))
166#define CVMX_LMCX_SCRAMBLE_CFG1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000328ull))
167#define CVMX_LMCX_SLOT_CTL0(block_id) (CVMX_ADD_IO_SEG(0x00011800880001F8ull) + ((block_id) & 3) * 0x1000000ull)
168#define CVMX_LMCX_SLOT_CTL1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000200ull) + ((block_id) & 3) * 0x1000000ull)
169#define CVMX_LMCX_SLOT_CTL2(block_id) (CVMX_ADD_IO_SEG(0x0001180088000208ull) + ((block_id) & 3) * 0x1000000ull)
170#define CVMX_LMCX_TIMING_PARAMS0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000198ull) + ((block_id) & 3) * 0x1000000ull)
171#define CVMX_LMCX_TIMING_PARAMS1(block_id) (CVMX_ADD_IO_SEG(0x00011800880001A0ull) + ((block_id) & 3) * 0x1000000ull)
172#define CVMX_LMCX_TRO_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000248ull) + ((block_id) & 3) * 0x1000000ull)
173#define CVMX_LMCX_TRO_STAT(block_id) (CVMX_ADD_IO_SEG(0x0001180088000250ull) + ((block_id) & 3) * 0x1000000ull)
174#define CVMX_LMCX_WLEVEL_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180088000300ull) + ((block_id) & 3) * 0x1000000ull)
175#define CVMX_LMCX_WLEVEL_DBG(block_id) (CVMX_ADD_IO_SEG(0x0001180088000308ull) + ((block_id) & 3) * 0x1000000ull)
176#define CVMX_LMCX_WLEVEL_RANKX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800880002B0ull) + (((offset) & 3) + ((block_id) & 3) * 0x200000ull) * 8)
177#define CVMX_LMCX_WODT_CTL0(block_id) (CVMX_ADD_IO_SEG(0x0001180088000030ull) + ((block_id) & 1) * 0x60000000ull)
178#define CVMX_LMCX_WODT_CTL1(block_id) (CVMX_ADD_IO_SEG(0x0001180088000080ull) + ((block_id) & 1) * 0x60000000ull)
179#define CVMX_LMCX_WODT_MASK(block_id) (CVMX_ADD_IO_SEG(0x00011800880001B0ull) + ((block_id) & 3) * 0x1000000ull)
180
181union cvmx_lmcx_bist_ctl {
182 uint64_t u64;
183 struct cvmx_lmcx_bist_ctl_s {
184#ifdef __BIG_ENDIAN_BITFIELD
185 uint64_t reserved_1_63:63;
186 uint64_t start:1;
187#else
188 uint64_t start:1;
189 uint64_t reserved_1_63:63;
190#endif
191 } s;
192};
193
194union cvmx_lmcx_bist_result {
195 uint64_t u64;
196 struct cvmx_lmcx_bist_result_s {
197#ifdef __BIG_ENDIAN_BITFIELD
198 uint64_t reserved_11_63:53;
199 uint64_t csrd2e:1;
200 uint64_t csre2d:1;
201 uint64_t mwf:1;
202 uint64_t mwd:3;
203 uint64_t mwc:1;
204 uint64_t mrf:1;
205 uint64_t mrd:3;
206#else
207 uint64_t mrd:3;
208 uint64_t mrf:1;
209 uint64_t mwc:1;
210 uint64_t mwd:3;
211 uint64_t mwf:1;
212 uint64_t csre2d:1;
213 uint64_t csrd2e:1;
214 uint64_t reserved_11_63:53;
215#endif
216 } s;
217 struct cvmx_lmcx_bist_result_cn50xx {
218#ifdef __BIG_ENDIAN_BITFIELD
219 uint64_t reserved_9_63:55;
220 uint64_t mwf:1;
221 uint64_t mwd:3;
222 uint64_t mwc:1;
223 uint64_t mrf:1;
224 uint64_t mrd:3;
225#else
226 uint64_t mrd:3;
227 uint64_t mrf:1;
228 uint64_t mwc:1;
229 uint64_t mwd:3;
230 uint64_t mwf:1;
231 uint64_t reserved_9_63:55;
232#endif
233 } cn50xx;
234};
235
236union cvmx_lmcx_char_ctl {
237 uint64_t u64;
238 struct cvmx_lmcx_char_ctl_s {
239#ifdef __BIG_ENDIAN_BITFIELD
240 uint64_t reserved_44_63:20;
241 uint64_t dr:1;
242 uint64_t skew_on:1;
243 uint64_t en:1;
244 uint64_t sel:1;
245 uint64_t prog:8;
246 uint64_t prbs:32;
247#else
248 uint64_t prbs:32;
249 uint64_t prog:8;
250 uint64_t sel:1;
251 uint64_t en:1;
252 uint64_t skew_on:1;
253 uint64_t dr:1;
254 uint64_t reserved_44_63:20;
255#endif
256 } s;
257 struct cvmx_lmcx_char_ctl_cn63xx {
258#ifdef __BIG_ENDIAN_BITFIELD
259 uint64_t reserved_42_63:22;
260 uint64_t en:1;
261 uint64_t sel:1;
262 uint64_t prog:8;
263 uint64_t prbs:32;
264#else
265 uint64_t prbs:32;
266 uint64_t prog:8;
267 uint64_t sel:1;
268 uint64_t en:1;
269 uint64_t reserved_42_63:22;
270#endif
271 } cn63xx;
272};
273
274union cvmx_lmcx_char_mask0 {
275 uint64_t u64;
276 struct cvmx_lmcx_char_mask0_s {
277#ifdef __BIG_ENDIAN_BITFIELD
278 uint64_t mask:64;
279#else
280 uint64_t mask:64;
281#endif
282 } s;
283};
284
285union cvmx_lmcx_char_mask1 {
286 uint64_t u64;
287 struct cvmx_lmcx_char_mask1_s {
288#ifdef __BIG_ENDIAN_BITFIELD
289 uint64_t reserved_8_63:56;
290 uint64_t mask:8;
291#else
292 uint64_t mask:8;
293 uint64_t reserved_8_63:56;
294#endif
295 } s;
296};
297
298union cvmx_lmcx_char_mask2 {
299 uint64_t u64;
300 struct cvmx_lmcx_char_mask2_s {
301#ifdef __BIG_ENDIAN_BITFIELD
302 uint64_t mask:64;
303#else
304 uint64_t mask:64;
305#endif
306 } s;
307};
308
309union cvmx_lmcx_char_mask3 {
310 uint64_t u64;
311 struct cvmx_lmcx_char_mask3_s {
312#ifdef __BIG_ENDIAN_BITFIELD
313 uint64_t reserved_8_63:56;
314 uint64_t mask:8;
315#else
316 uint64_t mask:8;
317 uint64_t reserved_8_63:56;
318#endif
319 } s;
320};
321
322union cvmx_lmcx_char_mask4 {
323 uint64_t u64;
324 struct cvmx_lmcx_char_mask4_s {
325#ifdef __BIG_ENDIAN_BITFIELD
326 uint64_t reserved_33_63:31;
327 uint64_t reset_n_mask:1;
328 uint64_t a_mask:16;
329 uint64_t ba_mask:3;
330 uint64_t we_n_mask:1;
331 uint64_t cas_n_mask:1;
332 uint64_t ras_n_mask:1;
333 uint64_t odt1_mask:2;
334 uint64_t odt0_mask:2;
335 uint64_t cs1_n_mask:2;
336 uint64_t cs0_n_mask:2;
337 uint64_t cke_mask:2;
338#else
339 uint64_t cke_mask:2;
340 uint64_t cs0_n_mask:2;
341 uint64_t cs1_n_mask:2;
342 uint64_t odt0_mask:2;
343 uint64_t odt1_mask:2;
344 uint64_t ras_n_mask:1;
345 uint64_t cas_n_mask:1;
346 uint64_t we_n_mask:1;
347 uint64_t ba_mask:3;
348 uint64_t a_mask:16;
349 uint64_t reset_n_mask:1;
350 uint64_t reserved_33_63:31;
351#endif
352 } s;
353};
354
355union cvmx_lmcx_comp_ctl {
356 uint64_t u64;
357 struct cvmx_lmcx_comp_ctl_s {
358#ifdef __BIG_ENDIAN_BITFIELD
359 uint64_t reserved_32_63:32;
360 uint64_t nctl_csr:4;
361 uint64_t nctl_clk:4;
362 uint64_t nctl_cmd:4;
363 uint64_t nctl_dat:4;
364 uint64_t pctl_csr:4;
365 uint64_t pctl_clk:4;
366 uint64_t reserved_0_7:8;
367#else
368 uint64_t reserved_0_7:8;
369 uint64_t pctl_clk:4;
370 uint64_t pctl_csr:4;
371 uint64_t nctl_dat:4;
372 uint64_t nctl_cmd:4;
373 uint64_t nctl_clk:4;
374 uint64_t nctl_csr:4;
375 uint64_t reserved_32_63:32;
376#endif
377 } s;
378 struct cvmx_lmcx_comp_ctl_cn30xx {
379#ifdef __BIG_ENDIAN_BITFIELD
380 uint64_t reserved_32_63:32;
381 uint64_t nctl_csr:4;
382 uint64_t nctl_clk:4;
383 uint64_t nctl_cmd:4;
384 uint64_t nctl_dat:4;
385 uint64_t pctl_csr:4;
386 uint64_t pctl_clk:4;
387 uint64_t pctl_cmd:4;
388 uint64_t pctl_dat:4;
389#else
390 uint64_t pctl_dat:4;
391 uint64_t pctl_cmd:4;
392 uint64_t pctl_clk:4;
393 uint64_t pctl_csr:4;
394 uint64_t nctl_dat:4;
395 uint64_t nctl_cmd:4;
396 uint64_t nctl_clk:4;
397 uint64_t nctl_csr:4;
398 uint64_t reserved_32_63:32;
399#endif
400 } cn30xx;
401 struct cvmx_lmcx_comp_ctl_cn50xx {
402#ifdef __BIG_ENDIAN_BITFIELD
403 uint64_t reserved_32_63:32;
404 uint64_t nctl_csr:4;
405 uint64_t reserved_20_27:8;
406 uint64_t nctl_dat:4;
407 uint64_t pctl_csr:4;
408 uint64_t reserved_5_11:7;
409 uint64_t pctl_dat:5;
410#else
411 uint64_t pctl_dat:5;
412 uint64_t reserved_5_11:7;
413 uint64_t pctl_csr:4;
414 uint64_t nctl_dat:4;
415 uint64_t reserved_20_27:8;
416 uint64_t nctl_csr:4;
417 uint64_t reserved_32_63:32;
418#endif
419 } cn50xx;
420 struct cvmx_lmcx_comp_ctl_cn58xxp1 {
421#ifdef __BIG_ENDIAN_BITFIELD
422 uint64_t reserved_32_63:32;
423 uint64_t nctl_csr:4;
424 uint64_t reserved_20_27:8;
425 uint64_t nctl_dat:4;
426 uint64_t pctl_csr:4;
427 uint64_t reserved_4_11:8;
428 uint64_t pctl_dat:4;
429#else
430 uint64_t pctl_dat:4;
431 uint64_t reserved_4_11:8;
432 uint64_t pctl_csr:4;
433 uint64_t nctl_dat:4;
434 uint64_t reserved_20_27:8;
435 uint64_t nctl_csr:4;
436 uint64_t reserved_32_63:32;
437#endif
438 } cn58xxp1;
439};
440
441union cvmx_lmcx_comp_ctl2 {
442 uint64_t u64;
443 struct cvmx_lmcx_comp_ctl2_s {
444#ifdef __BIG_ENDIAN_BITFIELD
445 uint64_t reserved_34_63:30;
446 uint64_t ddr__ptune:4;
447 uint64_t ddr__ntune:4;
448 uint64_t m180:1;
449 uint64_t byp:1;
450 uint64_t ptune:4;
451 uint64_t ntune:4;
452 uint64_t rodt_ctl:4;
453 uint64_t cmd_ctl:4;
454 uint64_t ck_ctl:4;
455 uint64_t dqx_ctl:4;
456#else
457 uint64_t dqx_ctl:4;
458 uint64_t ck_ctl:4;
459 uint64_t cmd_ctl:4;
460 uint64_t rodt_ctl:4;
461 uint64_t ntune:4;
462 uint64_t ptune:4;
463 uint64_t byp:1;
464 uint64_t m180:1;
465 uint64_t ddr__ntune:4;
466 uint64_t ddr__ptune:4;
467 uint64_t reserved_34_63:30;
468#endif
469 } s;
470};
471
472union cvmx_lmcx_config {
473 uint64_t u64;
474 struct cvmx_lmcx_config_s {
475#ifdef __BIG_ENDIAN_BITFIELD
476 uint64_t reserved_61_63:3;
477 uint64_t mode32b:1;
478 uint64_t scrz:1;
479 uint64_t early_unload_d1_r1:1;
480 uint64_t early_unload_d1_r0:1;
481 uint64_t early_unload_d0_r1:1;
482 uint64_t early_unload_d0_r0:1;
483 uint64_t init_status:4;
484 uint64_t mirrmask:4;
485 uint64_t rankmask:4;
486 uint64_t rank_ena:1;
487 uint64_t sref_with_dll:1;
488 uint64_t early_dqx:1;
489 uint64_t sequence:3;
490 uint64_t ref_zqcs_int:19;
491 uint64_t reset:1;
492 uint64_t ecc_adr:1;
493 uint64_t forcewrite:4;
494 uint64_t idlepower:3;
495 uint64_t pbank_lsb:4;
496 uint64_t row_lsb:3;
497 uint64_t ecc_ena:1;
498 uint64_t init_start:1;
499#else
500 uint64_t init_start:1;
501 uint64_t ecc_ena:1;
502 uint64_t row_lsb:3;
503 uint64_t pbank_lsb:4;
504 uint64_t idlepower:3;
505 uint64_t forcewrite:4;
506 uint64_t ecc_adr:1;
507 uint64_t reset:1;
508 uint64_t ref_zqcs_int:19;
509 uint64_t sequence:3;
510 uint64_t early_dqx:1;
511 uint64_t sref_with_dll:1;
512 uint64_t rank_ena:1;
513 uint64_t rankmask:4;
514 uint64_t mirrmask:4;
515 uint64_t init_status:4;
516 uint64_t early_unload_d0_r0:1;
517 uint64_t early_unload_d0_r1:1;
518 uint64_t early_unload_d1_r0:1;
519 uint64_t early_unload_d1_r1:1;
520 uint64_t scrz:1;
521 uint64_t mode32b:1;
522 uint64_t reserved_61_63:3;
523#endif
524 } s;
525 struct cvmx_lmcx_config_cn63xx {
526#ifdef __BIG_ENDIAN_BITFIELD
527 uint64_t reserved_59_63:5;
528 uint64_t early_unload_d1_r1:1;
529 uint64_t early_unload_d1_r0:1;
530 uint64_t early_unload_d0_r1:1;
531 uint64_t early_unload_d0_r0:1;
532 uint64_t init_status:4;
533 uint64_t mirrmask:4;
534 uint64_t rankmask:4;
535 uint64_t rank_ena:1;
536 uint64_t sref_with_dll:1;
537 uint64_t early_dqx:1;
538 uint64_t sequence:3;
539 uint64_t ref_zqcs_int:19;
540 uint64_t reset:1;
541 uint64_t ecc_adr:1;
542 uint64_t forcewrite:4;
543 uint64_t idlepower:3;
544 uint64_t pbank_lsb:4;
545 uint64_t row_lsb:3;
546 uint64_t ecc_ena:1;
547 uint64_t init_start:1;
548#else
549 uint64_t init_start:1;
550 uint64_t ecc_ena:1;
551 uint64_t row_lsb:3;
552 uint64_t pbank_lsb:4;
553 uint64_t idlepower:3;
554 uint64_t forcewrite:4;
555 uint64_t ecc_adr:1;
556 uint64_t reset:1;
557 uint64_t ref_zqcs_int:19;
558 uint64_t sequence:3;
559 uint64_t early_dqx:1;
560 uint64_t sref_with_dll:1;
561 uint64_t rank_ena:1;
562 uint64_t rankmask:4;
563 uint64_t mirrmask:4;
564 uint64_t init_status:4;
565 uint64_t early_unload_d0_r0:1;
566 uint64_t early_unload_d0_r1:1;
567 uint64_t early_unload_d1_r0:1;
568 uint64_t early_unload_d1_r1:1;
569 uint64_t reserved_59_63:5;
570#endif
571 } cn63xx;
572 struct cvmx_lmcx_config_cn63xxp1 {
573#ifdef __BIG_ENDIAN_BITFIELD
574 uint64_t reserved_55_63:9;
575 uint64_t init_status:4;
576 uint64_t mirrmask:4;
577 uint64_t rankmask:4;
578 uint64_t rank_ena:1;
579 uint64_t sref_with_dll:1;
580 uint64_t early_dqx:1;
581 uint64_t sequence:3;
582 uint64_t ref_zqcs_int:19;
583 uint64_t reset:1;
584 uint64_t ecc_adr:1;
585 uint64_t forcewrite:4;
586 uint64_t idlepower:3;
587 uint64_t pbank_lsb:4;
588 uint64_t row_lsb:3;
589 uint64_t ecc_ena:1;
590 uint64_t init_start:1;
591#else
592 uint64_t init_start:1;
593 uint64_t ecc_ena:1;
594 uint64_t row_lsb:3;
595 uint64_t pbank_lsb:4;
596 uint64_t idlepower:3;
597 uint64_t forcewrite:4;
598 uint64_t ecc_adr:1;
599 uint64_t reset:1;
600 uint64_t ref_zqcs_int:19;
601 uint64_t sequence:3;
602 uint64_t early_dqx:1;
603 uint64_t sref_with_dll:1;
604 uint64_t rank_ena:1;
605 uint64_t rankmask:4;
606 uint64_t mirrmask:4;
607 uint64_t init_status:4;
608 uint64_t reserved_55_63:9;
609#endif
610 } cn63xxp1;
611 struct cvmx_lmcx_config_cn66xx {
612#ifdef __BIG_ENDIAN_BITFIELD
613 uint64_t reserved_60_63:4;
614 uint64_t scrz:1;
615 uint64_t early_unload_d1_r1:1;
616 uint64_t early_unload_d1_r0:1;
617 uint64_t early_unload_d0_r1:1;
618 uint64_t early_unload_d0_r0:1;
619 uint64_t init_status:4;
620 uint64_t mirrmask:4;
621 uint64_t rankmask:4;
622 uint64_t rank_ena:1;
623 uint64_t sref_with_dll:1;
624 uint64_t early_dqx:1;
625 uint64_t sequence:3;
626 uint64_t ref_zqcs_int:19;
627 uint64_t reset:1;
628 uint64_t ecc_adr:1;
629 uint64_t forcewrite:4;
630 uint64_t idlepower:3;
631 uint64_t pbank_lsb:4;
632 uint64_t row_lsb:3;
633 uint64_t ecc_ena:1;
634 uint64_t init_start:1;
635#else
636 uint64_t init_start:1;
637 uint64_t ecc_ena:1;
638 uint64_t row_lsb:3;
639 uint64_t pbank_lsb:4;
640 uint64_t idlepower:3;
641 uint64_t forcewrite:4;
642 uint64_t ecc_adr:1;
643 uint64_t reset:1;
644 uint64_t ref_zqcs_int:19;
645 uint64_t sequence:3;
646 uint64_t early_dqx:1;
647 uint64_t sref_with_dll:1;
648 uint64_t rank_ena:1;
649 uint64_t rankmask:4;
650 uint64_t mirrmask:4;
651 uint64_t init_status:4;
652 uint64_t early_unload_d0_r0:1;
653 uint64_t early_unload_d0_r1:1;
654 uint64_t early_unload_d1_r0:1;
655 uint64_t early_unload_d1_r1:1;
656 uint64_t scrz:1;
657 uint64_t reserved_60_63:4;
658#endif
659 } cn66xx;
660};
661
662union cvmx_lmcx_control {
663 uint64_t u64;
664 struct cvmx_lmcx_control_s {
665#ifdef __BIG_ENDIAN_BITFIELD
666 uint64_t scramble_ena:1;
667 uint64_t thrcnt:12;
668 uint64_t persub:8;
669 uint64_t thrmax:4;
670 uint64_t crm_cnt:5;
671 uint64_t crm_thr:5;
672 uint64_t crm_max:5;
673 uint64_t rodt_bprch:1;
674 uint64_t wodt_bprch:1;
675 uint64_t bprch:2;
676 uint64_t ext_zqcs_dis:1;
677 uint64_t int_zqcs_dis:1;
678 uint64_t auto_dclkdis:1;
679 uint64_t xor_bank:1;
680 uint64_t max_write_batch:4;
681 uint64_t nxm_write_en:1;
682 uint64_t elev_prio_dis:1;
683 uint64_t inorder_wr:1;
684 uint64_t inorder_rd:1;
685 uint64_t throttle_wr:1;
686 uint64_t throttle_rd:1;
687 uint64_t fprch2:2;
688 uint64_t pocas:1;
689 uint64_t ddr2t:1;
690 uint64_t bwcnt:1;
691 uint64_t rdimm_ena:1;
692#else
693 uint64_t rdimm_ena:1;
694 uint64_t bwcnt:1;
695 uint64_t ddr2t:1;
696 uint64_t pocas:1;
697 uint64_t fprch2:2;
698 uint64_t throttle_rd:1;
699 uint64_t throttle_wr:1;
700 uint64_t inorder_rd:1;
701 uint64_t inorder_wr:1;
702 uint64_t elev_prio_dis:1;
703 uint64_t nxm_write_en:1;
704 uint64_t max_write_batch:4;
705 uint64_t xor_bank:1;
706 uint64_t auto_dclkdis:1;
707 uint64_t int_zqcs_dis:1;
708 uint64_t ext_zqcs_dis:1;
709 uint64_t bprch:2;
710 uint64_t wodt_bprch:1;
711 uint64_t rodt_bprch:1;
712 uint64_t crm_max:5;
713 uint64_t crm_thr:5;
714 uint64_t crm_cnt:5;
715 uint64_t thrmax:4;
716 uint64_t persub:8;
717 uint64_t thrcnt:12;
718 uint64_t scramble_ena:1;
719#endif
720 } s;
721 struct cvmx_lmcx_control_cn63xx {
722#ifdef __BIG_ENDIAN_BITFIELD
723 uint64_t reserved_24_63:40;
724 uint64_t rodt_bprch:1;
725 uint64_t wodt_bprch:1;
726 uint64_t bprch:2;
727 uint64_t ext_zqcs_dis:1;
728 uint64_t int_zqcs_dis:1;
729 uint64_t auto_dclkdis:1;
730 uint64_t xor_bank:1;
731 uint64_t max_write_batch:4;
732 uint64_t nxm_write_en:1;
733 uint64_t elev_prio_dis:1;
734 uint64_t inorder_wr:1;
735 uint64_t inorder_rd:1;
736 uint64_t throttle_wr:1;
737 uint64_t throttle_rd:1;
738 uint64_t fprch2:2;
739 uint64_t pocas:1;
740 uint64_t ddr2t:1;
741 uint64_t bwcnt:1;
742 uint64_t rdimm_ena:1;
743#else
744 uint64_t rdimm_ena:1;
745 uint64_t bwcnt:1;
746 uint64_t ddr2t:1;
747 uint64_t pocas:1;
748 uint64_t fprch2:2;
749 uint64_t throttle_rd:1;
750 uint64_t throttle_wr:1;
751 uint64_t inorder_rd:1;
752 uint64_t inorder_wr:1;
753 uint64_t elev_prio_dis:1;
754 uint64_t nxm_write_en:1;
755 uint64_t max_write_batch:4;
756 uint64_t xor_bank:1;
757 uint64_t auto_dclkdis:1;
758 uint64_t int_zqcs_dis:1;
759 uint64_t ext_zqcs_dis:1;
760 uint64_t bprch:2;
761 uint64_t wodt_bprch:1;
762 uint64_t rodt_bprch:1;
763 uint64_t reserved_24_63:40;
764#endif
765 } cn63xx;
766 struct cvmx_lmcx_control_cn66xx {
767#ifdef __BIG_ENDIAN_BITFIELD
768 uint64_t scramble_ena:1;
769 uint64_t reserved_24_62:39;
770 uint64_t rodt_bprch:1;
771 uint64_t wodt_bprch:1;
772 uint64_t bprch:2;
773 uint64_t ext_zqcs_dis:1;
774 uint64_t int_zqcs_dis:1;
775 uint64_t auto_dclkdis:1;
776 uint64_t xor_bank:1;
777 uint64_t max_write_batch:4;
778 uint64_t nxm_write_en:1;
779 uint64_t elev_prio_dis:1;
780 uint64_t inorder_wr:1;
781 uint64_t inorder_rd:1;
782 uint64_t throttle_wr:1;
783 uint64_t throttle_rd:1;
784 uint64_t fprch2:2;
785 uint64_t pocas:1;
786 uint64_t ddr2t:1;
787 uint64_t bwcnt:1;
788 uint64_t rdimm_ena:1;
789#else
790 uint64_t rdimm_ena:1;
791 uint64_t bwcnt:1;
792 uint64_t ddr2t:1;
793 uint64_t pocas:1;
794 uint64_t fprch2:2;
795 uint64_t throttle_rd:1;
796 uint64_t throttle_wr:1;
797 uint64_t inorder_rd:1;
798 uint64_t inorder_wr:1;
799 uint64_t elev_prio_dis:1;
800 uint64_t nxm_write_en:1;
801 uint64_t max_write_batch:4;
802 uint64_t xor_bank:1;
803 uint64_t auto_dclkdis:1;
804 uint64_t int_zqcs_dis:1;
805 uint64_t ext_zqcs_dis:1;
806 uint64_t bprch:2;
807 uint64_t wodt_bprch:1;
808 uint64_t rodt_bprch:1;
809 uint64_t reserved_24_62:39;
810 uint64_t scramble_ena:1;
811#endif
812 } cn66xx;
813 struct cvmx_lmcx_control_cn68xx {
814#ifdef __BIG_ENDIAN_BITFIELD
815 uint64_t reserved_63_63:1;
816 uint64_t thrcnt:12;
817 uint64_t persub:8;
818 uint64_t thrmax:4;
819 uint64_t crm_cnt:5;
820 uint64_t crm_thr:5;
821 uint64_t crm_max:5;
822 uint64_t rodt_bprch:1;
823 uint64_t wodt_bprch:1;
824 uint64_t bprch:2;
825 uint64_t ext_zqcs_dis:1;
826 uint64_t int_zqcs_dis:1;
827 uint64_t auto_dclkdis:1;
828 uint64_t xor_bank:1;
829 uint64_t max_write_batch:4;
830 uint64_t nxm_write_en:1;
831 uint64_t elev_prio_dis:1;
832 uint64_t inorder_wr:1;
833 uint64_t inorder_rd:1;
834 uint64_t throttle_wr:1;
835 uint64_t throttle_rd:1;
836 uint64_t fprch2:2;
837 uint64_t pocas:1;
838 uint64_t ddr2t:1;
839 uint64_t bwcnt:1;
840 uint64_t rdimm_ena:1;
841#else
842 uint64_t rdimm_ena:1;
843 uint64_t bwcnt:1;
844 uint64_t ddr2t:1;
845 uint64_t pocas:1;
846 uint64_t fprch2:2;
847 uint64_t throttle_rd:1;
848 uint64_t throttle_wr:1;
849 uint64_t inorder_rd:1;
850 uint64_t inorder_wr:1;
851 uint64_t elev_prio_dis:1;
852 uint64_t nxm_write_en:1;
853 uint64_t max_write_batch:4;
854 uint64_t xor_bank:1;
855 uint64_t auto_dclkdis:1;
856 uint64_t int_zqcs_dis:1;
857 uint64_t ext_zqcs_dis:1;
858 uint64_t bprch:2;
859 uint64_t wodt_bprch:1;
860 uint64_t rodt_bprch:1;
861 uint64_t crm_max:5;
862 uint64_t crm_thr:5;
863 uint64_t crm_cnt:5;
864 uint64_t thrmax:4;
865 uint64_t persub:8;
866 uint64_t thrcnt:12;
867 uint64_t reserved_63_63:1;
868#endif
869 } cn68xx;
870};
871
872union cvmx_lmcx_ctl {
873 uint64_t u64;
874 struct cvmx_lmcx_ctl_s {
875#ifdef __BIG_ENDIAN_BITFIELD
876 uint64_t reserved_32_63:32;
877 uint64_t ddr__nctl:4;
878 uint64_t ddr__pctl:4;
879 uint64_t slow_scf:1;
880 uint64_t xor_bank:1;
881 uint64_t max_write_batch:4;
882 uint64_t pll_div2:1;
883 uint64_t pll_bypass:1;
884 uint64_t rdimm_ena:1;
885 uint64_t r2r_slot:1;
886 uint64_t inorder_mwf:1;
887 uint64_t inorder_mrf:1;
888 uint64_t reserved_10_11:2;
889 uint64_t fprch2:1;
890 uint64_t bprch:1;
891 uint64_t sil_lat:2;
892 uint64_t tskw:2;
893 uint64_t qs_dic:2;
894 uint64_t dic:2;
895#else
896 uint64_t dic:2;
897 uint64_t qs_dic:2;
898 uint64_t tskw:2;
899 uint64_t sil_lat:2;
900 uint64_t bprch:1;
901 uint64_t fprch2:1;
902 uint64_t reserved_10_11:2;
903 uint64_t inorder_mrf:1;
904 uint64_t inorder_mwf:1;
905 uint64_t r2r_slot:1;
906 uint64_t rdimm_ena:1;
907 uint64_t pll_bypass:1;
908 uint64_t pll_div2:1;
909 uint64_t max_write_batch:4;
910 uint64_t xor_bank:1;
911 uint64_t slow_scf:1;
912 uint64_t ddr__pctl:4;
913 uint64_t ddr__nctl:4;
914 uint64_t reserved_32_63:32;
915#endif
916 } s;
917 struct cvmx_lmcx_ctl_cn30xx {
918#ifdef __BIG_ENDIAN_BITFIELD
919 uint64_t reserved_32_63:32;
920 uint64_t ddr__nctl:4;
921 uint64_t ddr__pctl:4;
922 uint64_t slow_scf:1;
923 uint64_t xor_bank:1;
924 uint64_t max_write_batch:4;
925 uint64_t pll_div2:1;
926 uint64_t pll_bypass:1;
927 uint64_t rdimm_ena:1;
928 uint64_t r2r_slot:1;
929 uint64_t inorder_mwf:1;
930 uint64_t inorder_mrf:1;
931 uint64_t dreset:1;
932 uint64_t mode32b:1;
933 uint64_t fprch2:1;
934 uint64_t bprch:1;
935 uint64_t sil_lat:2;
936 uint64_t tskw:2;
937 uint64_t qs_dic:2;
938 uint64_t dic:2;
939#else
940 uint64_t dic:2;
941 uint64_t qs_dic:2;
942 uint64_t tskw:2;
943 uint64_t sil_lat:2;
944 uint64_t bprch:1;
945 uint64_t fprch2:1;
946 uint64_t mode32b:1;
947 uint64_t dreset:1;
948 uint64_t inorder_mrf:1;
949 uint64_t inorder_mwf:1;
950 uint64_t r2r_slot:1;
951 uint64_t rdimm_ena:1;
952 uint64_t pll_bypass:1;
953 uint64_t pll_div2:1;
954 uint64_t max_write_batch:4;
955 uint64_t xor_bank:1;
956 uint64_t slow_scf:1;
957 uint64_t ddr__pctl:4;
958 uint64_t ddr__nctl:4;
959 uint64_t reserved_32_63:32;
960#endif
961 } cn30xx;
962 struct cvmx_lmcx_ctl_cn38xx {
963#ifdef __BIG_ENDIAN_BITFIELD
964 uint64_t reserved_32_63:32;
965 uint64_t ddr__nctl:4;
966 uint64_t ddr__pctl:4;
967 uint64_t slow_scf:1;
968 uint64_t xor_bank:1;
969 uint64_t max_write_batch:4;
970 uint64_t reserved_16_17:2;
971 uint64_t rdimm_ena:1;
972 uint64_t r2r_slot:1;
973 uint64_t inorder_mwf:1;
974 uint64_t inorder_mrf:1;
975 uint64_t set_zero:1;
976 uint64_t mode128b:1;
977 uint64_t fprch2:1;
978 uint64_t bprch:1;
979 uint64_t sil_lat:2;
980 uint64_t tskw:2;
981 uint64_t qs_dic:2;
982 uint64_t dic:2;
983#else
984 uint64_t dic:2;
985 uint64_t qs_dic:2;
986 uint64_t tskw:2;
987 uint64_t sil_lat:2;
988 uint64_t bprch:1;
989 uint64_t fprch2:1;
990 uint64_t mode128b:1;
991 uint64_t set_zero:1;
992 uint64_t inorder_mrf:1;
993 uint64_t inorder_mwf:1;
994 uint64_t r2r_slot:1;
995 uint64_t rdimm_ena:1;
996 uint64_t reserved_16_17:2;
997 uint64_t max_write_batch:4;
998 uint64_t xor_bank:1;
999 uint64_t slow_scf:1;
1000 uint64_t ddr__pctl:4;
1001 uint64_t ddr__nctl:4;
1002 uint64_t reserved_32_63:32;
1003#endif
1004 } cn38xx;
1005 struct cvmx_lmcx_ctl_cn50xx {
1006#ifdef __BIG_ENDIAN_BITFIELD
1007 uint64_t reserved_32_63:32;
1008 uint64_t ddr__nctl:4;
1009 uint64_t ddr__pctl:4;
1010 uint64_t slow_scf:1;
1011 uint64_t xor_bank:1;
1012 uint64_t max_write_batch:4;
1013 uint64_t reserved_17_17:1;
1014 uint64_t pll_bypass:1;
1015 uint64_t rdimm_ena:1;
1016 uint64_t r2r_slot:1;
1017 uint64_t inorder_mwf:1;
1018 uint64_t inorder_mrf:1;
1019 uint64_t dreset:1;
1020 uint64_t mode32b:1;
1021 uint64_t fprch2:1;
1022 uint64_t bprch:1;
1023 uint64_t sil_lat:2;
1024 uint64_t tskw:2;
1025 uint64_t qs_dic:2;
1026 uint64_t dic:2;
1027#else
1028 uint64_t dic:2;
1029 uint64_t qs_dic:2;
1030 uint64_t tskw:2;
1031 uint64_t sil_lat:2;
1032 uint64_t bprch:1;
1033 uint64_t fprch2:1;
1034 uint64_t mode32b:1;
1035 uint64_t dreset:1;
1036 uint64_t inorder_mrf:1;
1037 uint64_t inorder_mwf:1;
1038 uint64_t r2r_slot:1;
1039 uint64_t rdimm_ena:1;
1040 uint64_t pll_bypass:1;
1041 uint64_t reserved_17_17:1;
1042 uint64_t max_write_batch:4;
1043 uint64_t xor_bank:1;
1044 uint64_t slow_scf:1;
1045 uint64_t ddr__pctl:4;
1046 uint64_t ddr__nctl:4;
1047 uint64_t reserved_32_63:32;
1048#endif
1049 } cn50xx;
1050 struct cvmx_lmcx_ctl_cn52xx {
1051#ifdef __BIG_ENDIAN_BITFIELD
1052 uint64_t reserved_32_63:32;
1053 uint64_t ddr__nctl:4;
1054 uint64_t ddr__pctl:4;
1055 uint64_t slow_scf:1;
1056 uint64_t xor_bank:1;
1057 uint64_t max_write_batch:4;
1058 uint64_t reserved_16_17:2;
1059 uint64_t rdimm_ena:1;
1060 uint64_t r2r_slot:1;
1061 uint64_t inorder_mwf:1;
1062 uint64_t inorder_mrf:1;
1063 uint64_t dreset:1;
1064 uint64_t mode32b:1;
1065 uint64_t fprch2:1;
1066 uint64_t bprch:1;
1067 uint64_t sil_lat:2;
1068 uint64_t tskw:2;
1069 uint64_t qs_dic:2;
1070 uint64_t dic:2;
1071#else
1072 uint64_t dic:2;
1073 uint64_t qs_dic:2;
1074 uint64_t tskw:2;
1075 uint64_t sil_lat:2;
1076 uint64_t bprch:1;
1077 uint64_t fprch2:1;
1078 uint64_t mode32b:1;
1079 uint64_t dreset:1;
1080 uint64_t inorder_mrf:1;
1081 uint64_t inorder_mwf:1;
1082 uint64_t r2r_slot:1;
1083 uint64_t rdimm_ena:1;
1084 uint64_t reserved_16_17:2;
1085 uint64_t max_write_batch:4;
1086 uint64_t xor_bank:1;
1087 uint64_t slow_scf:1;
1088 uint64_t ddr__pctl:4;
1089 uint64_t ddr__nctl:4;
1090 uint64_t reserved_32_63:32;
1091#endif
1092 } cn52xx;
1093 struct cvmx_lmcx_ctl_cn58xx {
1094#ifdef __BIG_ENDIAN_BITFIELD
1095 uint64_t reserved_32_63:32;
1096 uint64_t ddr__nctl:4;
1097 uint64_t ddr__pctl:4;
1098 uint64_t slow_scf:1;
1099 uint64_t xor_bank:1;
1100 uint64_t max_write_batch:4;
1101 uint64_t reserved_16_17:2;
1102 uint64_t rdimm_ena:1;
1103 uint64_t r2r_slot:1;
1104 uint64_t inorder_mwf:1;
1105 uint64_t inorder_mrf:1;
1106 uint64_t dreset:1;
1107 uint64_t mode128b:1;
1108 uint64_t fprch2:1;
1109 uint64_t bprch:1;
1110 uint64_t sil_lat:2;
1111 uint64_t tskw:2;
1112 uint64_t qs_dic:2;
1113 uint64_t dic:2;
1114#else
1115 uint64_t dic:2;
1116 uint64_t qs_dic:2;
1117 uint64_t tskw:2;
1118 uint64_t sil_lat:2;
1119 uint64_t bprch:1;
1120 uint64_t fprch2:1;
1121 uint64_t mode128b:1;
1122 uint64_t dreset:1;
1123 uint64_t inorder_mrf:1;
1124 uint64_t inorder_mwf:1;
1125 uint64_t r2r_slot:1;
1126 uint64_t rdimm_ena:1;
1127 uint64_t reserved_16_17:2;
1128 uint64_t max_write_batch:4;
1129 uint64_t xor_bank:1;
1130 uint64_t slow_scf:1;
1131 uint64_t ddr__pctl:4;
1132 uint64_t ddr__nctl:4;
1133 uint64_t reserved_32_63:32;
1134#endif
1135 } cn58xx;
1136};
1137
1138union cvmx_lmcx_ctl1 {
1139 uint64_t u64;
1140 struct cvmx_lmcx_ctl1_s {
1141#ifdef __BIG_ENDIAN_BITFIELD
1142 uint64_t reserved_21_63:43;
1143 uint64_t ecc_adr:1;
1144 uint64_t forcewrite:4;
1145 uint64_t idlepower:3;
1146 uint64_t sequence:3;
1147 uint64_t sil_mode:1;
1148 uint64_t dcc_enable:1;
1149 uint64_t reserved_2_7:6;
1150 uint64_t data_layout:2;
1151#else
1152 uint64_t data_layout:2;
1153 uint64_t reserved_2_7:6;
1154 uint64_t dcc_enable:1;
1155 uint64_t sil_mode:1;
1156 uint64_t sequence:3;
1157 uint64_t idlepower:3;
1158 uint64_t forcewrite:4;
1159 uint64_t ecc_adr:1;
1160 uint64_t reserved_21_63:43;
1161#endif
1162 } s;
1163 struct cvmx_lmcx_ctl1_cn30xx {
1164#ifdef __BIG_ENDIAN_BITFIELD
1165 uint64_t reserved_2_63:62;
1166 uint64_t data_layout:2;
1167#else
1168 uint64_t data_layout:2;
1169 uint64_t reserved_2_63:62;
1170#endif
1171 } cn30xx;
1172 struct cvmx_lmcx_ctl1_cn50xx {
1173#ifdef __BIG_ENDIAN_BITFIELD
1174 uint64_t reserved_10_63:54;
1175 uint64_t sil_mode:1;
1176 uint64_t dcc_enable:1;
1177 uint64_t reserved_2_7:6;
1178 uint64_t data_layout:2;
1179#else
1180 uint64_t data_layout:2;
1181 uint64_t reserved_2_7:6;
1182 uint64_t dcc_enable:1;
1183 uint64_t sil_mode:1;
1184 uint64_t reserved_10_63:54;
1185#endif
1186 } cn50xx;
1187 struct cvmx_lmcx_ctl1_cn52xx {
1188#ifdef __BIG_ENDIAN_BITFIELD
1189 uint64_t reserved_21_63:43;
1190 uint64_t ecc_adr:1;
1191 uint64_t forcewrite:4;
1192 uint64_t idlepower:3;
1193 uint64_t sequence:3;
1194 uint64_t sil_mode:1;
1195 uint64_t dcc_enable:1;
1196 uint64_t reserved_0_7:8;
1197#else
1198 uint64_t reserved_0_7:8;
1199 uint64_t dcc_enable:1;
1200 uint64_t sil_mode:1;
1201 uint64_t sequence:3;
1202 uint64_t idlepower:3;
1203 uint64_t forcewrite:4;
1204 uint64_t ecc_adr:1;
1205 uint64_t reserved_21_63:43;
1206#endif
1207 } cn52xx;
1208 struct cvmx_lmcx_ctl1_cn58xx {
1209#ifdef __BIG_ENDIAN_BITFIELD
1210 uint64_t reserved_10_63:54;
1211 uint64_t sil_mode:1;
1212 uint64_t dcc_enable:1;
1213 uint64_t reserved_0_7:8;
1214#else
1215 uint64_t reserved_0_7:8;
1216 uint64_t dcc_enable:1;
1217 uint64_t sil_mode:1;
1218 uint64_t reserved_10_63:54;
1219#endif
1220 } cn58xx;
1221};
1222
1223union cvmx_lmcx_dclk_cnt {
1224 uint64_t u64;
1225 struct cvmx_lmcx_dclk_cnt_s {
1226#ifdef __BIG_ENDIAN_BITFIELD
1227 uint64_t dclkcnt:64;
1228#else
1229 uint64_t dclkcnt:64;
1230#endif
1231 } s;
1232};
1233
1234union cvmx_lmcx_dclk_cnt_hi {
1235 uint64_t u64;
1236 struct cvmx_lmcx_dclk_cnt_hi_s {
1237#ifdef __BIG_ENDIAN_BITFIELD
1238 uint64_t reserved_32_63:32;
1239 uint64_t dclkcnt_hi:32;
1240#else
1241 uint64_t dclkcnt_hi:32;
1242 uint64_t reserved_32_63:32;
1243#endif
1244 } s;
1245};
1246
1247union cvmx_lmcx_dclk_cnt_lo {
1248 uint64_t u64;
1249 struct cvmx_lmcx_dclk_cnt_lo_s {
1250#ifdef __BIG_ENDIAN_BITFIELD
1251 uint64_t reserved_32_63:32;
1252 uint64_t dclkcnt_lo:32;
1253#else
1254 uint64_t dclkcnt_lo:32;
1255 uint64_t reserved_32_63:32;
1256#endif
1257 } s;
1258};
1259
1260union cvmx_lmcx_dclk_ctl {
1261 uint64_t u64;
1262 struct cvmx_lmcx_dclk_ctl_s {
1263#ifdef __BIG_ENDIAN_BITFIELD
1264 uint64_t reserved_8_63:56;
1265 uint64_t off90_ena:1;
1266 uint64_t dclk90_byp:1;
1267 uint64_t dclk90_ld:1;
1268 uint64_t dclk90_vlu:5;
1269#else
1270 uint64_t dclk90_vlu:5;
1271 uint64_t dclk90_ld:1;
1272 uint64_t dclk90_byp:1;
1273 uint64_t off90_ena:1;
1274 uint64_t reserved_8_63:56;
1275#endif
1276 } s;
1277};
1278
1279union cvmx_lmcx_ddr2_ctl {
1280 uint64_t u64;
1281 struct cvmx_lmcx_ddr2_ctl_s {
1282#ifdef __BIG_ENDIAN_BITFIELD
1283 uint64_t reserved_32_63:32;
1284 uint64_t bank8:1;
1285 uint64_t burst8:1;
1286 uint64_t addlat:3;
1287 uint64_t pocas:1;
1288 uint64_t bwcnt:1;
1289 uint64_t twr:3;
1290 uint64_t silo_hc:1;
1291 uint64_t ddr_eof:4;
1292 uint64_t tfaw:5;
1293 uint64_t crip_mode:1;
1294 uint64_t ddr2t:1;
1295 uint64_t odt_ena:1;
1296 uint64_t qdll_ena:1;
1297 uint64_t dll90_vlu:5;
1298 uint64_t dll90_byp:1;
1299 uint64_t rdqs:1;
1300 uint64_t ddr2:1;
1301#else
1302 uint64_t ddr2:1;
1303 uint64_t rdqs:1;
1304 uint64_t dll90_byp:1;
1305 uint64_t dll90_vlu:5;
1306 uint64_t qdll_ena:1;
1307 uint64_t odt_ena:1;
1308 uint64_t ddr2t:1;
1309 uint64_t crip_mode:1;
1310 uint64_t tfaw:5;
1311 uint64_t ddr_eof:4;
1312 uint64_t silo_hc:1;
1313 uint64_t twr:3;
1314 uint64_t bwcnt:1;
1315 uint64_t pocas:1;
1316 uint64_t addlat:3;
1317 uint64_t burst8:1;
1318 uint64_t bank8:1;
1319 uint64_t reserved_32_63:32;
1320#endif
1321 } s;
1322 struct cvmx_lmcx_ddr2_ctl_cn30xx {
1323#ifdef __BIG_ENDIAN_BITFIELD
1324 uint64_t reserved_32_63:32;
1325 uint64_t bank8:1;
1326 uint64_t burst8:1;
1327 uint64_t addlat:3;
1328 uint64_t pocas:1;
1329 uint64_t bwcnt:1;
1330 uint64_t twr:3;
1331 uint64_t silo_hc:1;
1332 uint64_t ddr_eof:4;
1333 uint64_t tfaw:5;
1334 uint64_t crip_mode:1;
1335 uint64_t ddr2t:1;
1336 uint64_t odt_ena:1;
1337 uint64_t qdll_ena:1;
1338 uint64_t dll90_vlu:5;
1339 uint64_t dll90_byp:1;
1340 uint64_t reserved_1_1:1;
1341 uint64_t ddr2:1;
1342#else
1343 uint64_t ddr2:1;
1344 uint64_t reserved_1_1:1;
1345 uint64_t dll90_byp:1;
1346 uint64_t dll90_vlu:5;
1347 uint64_t qdll_ena:1;
1348 uint64_t odt_ena:1;
1349 uint64_t ddr2t:1;
1350 uint64_t crip_mode:1;
1351 uint64_t tfaw:5;
1352 uint64_t ddr_eof:4;
1353 uint64_t silo_hc:1;
1354 uint64_t twr:3;
1355 uint64_t bwcnt:1;
1356 uint64_t pocas:1;
1357 uint64_t addlat:3;
1358 uint64_t burst8:1;
1359 uint64_t bank8:1;
1360 uint64_t reserved_32_63:32;
1361#endif
1362 } cn30xx;
1363};
1364
1365union cvmx_lmcx_ddr_pll_ctl {
1366 uint64_t u64;
1367 struct cvmx_lmcx_ddr_pll_ctl_s {
1368#ifdef __BIG_ENDIAN_BITFIELD
1369 uint64_t reserved_27_63:37;
1370 uint64_t jtg_test_mode:1;
1371 uint64_t dfm_div_reset:1;
1372 uint64_t dfm_ps_en:3;
1373 uint64_t ddr_div_reset:1;
1374 uint64_t ddr_ps_en:3;
1375 uint64_t diffamp:4;
1376 uint64_t cps:3;
1377 uint64_t cpb:3;
1378 uint64_t reset_n:1;
1379 uint64_t clkf:7;
1380#else
1381 uint64_t clkf:7;
1382 uint64_t reset_n:1;
1383 uint64_t cpb:3;
1384 uint64_t cps:3;
1385 uint64_t diffamp:4;
1386 uint64_t ddr_ps_en:3;
1387 uint64_t ddr_div_reset:1;
1388 uint64_t dfm_ps_en:3;
1389 uint64_t dfm_div_reset:1;
1390 uint64_t jtg_test_mode:1;
1391 uint64_t reserved_27_63:37;
1392#endif
1393 } s;
1394};
1395
1396union cvmx_lmcx_delay_cfg {
1397 uint64_t u64;
1398 struct cvmx_lmcx_delay_cfg_s {
1399#ifdef __BIG_ENDIAN_BITFIELD
1400 uint64_t reserved_15_63:49;
1401 uint64_t dq:5;
1402 uint64_t cmd:5;
1403 uint64_t clk:5;
1404#else
1405 uint64_t clk:5;
1406 uint64_t cmd:5;
1407 uint64_t dq:5;
1408 uint64_t reserved_15_63:49;
1409#endif
1410 } s;
1411 struct cvmx_lmcx_delay_cfg_cn38xx {
1412#ifdef __BIG_ENDIAN_BITFIELD
1413 uint64_t reserved_14_63:50;
1414 uint64_t dq:4;
1415 uint64_t reserved_9_9:1;
1416 uint64_t cmd:4;
1417 uint64_t reserved_4_4:1;
1418 uint64_t clk:4;
1419#else
1420 uint64_t clk:4;
1421 uint64_t reserved_4_4:1;
1422 uint64_t cmd:4;
1423 uint64_t reserved_9_9:1;
1424 uint64_t dq:4;
1425 uint64_t reserved_14_63:50;
1426#endif
1427 } cn38xx;
1428};
1429
1430union cvmx_lmcx_dimmx_params {
1431 uint64_t u64;
1432 struct cvmx_lmcx_dimmx_params_s {
1433#ifdef __BIG_ENDIAN_BITFIELD
1434 uint64_t rc15:4;
1435 uint64_t rc14:4;
1436 uint64_t rc13:4;
1437 uint64_t rc12:4;
1438 uint64_t rc11:4;
1439 uint64_t rc10:4;
1440 uint64_t rc9:4;
1441 uint64_t rc8:4;
1442 uint64_t rc7:4;
1443 uint64_t rc6:4;
1444 uint64_t rc5:4;
1445 uint64_t rc4:4;
1446 uint64_t rc3:4;
1447 uint64_t rc2:4;
1448 uint64_t rc1:4;
1449 uint64_t rc0:4;
1450#else
1451 uint64_t rc0:4;
1452 uint64_t rc1:4;
1453 uint64_t rc2:4;
1454 uint64_t rc3:4;
1455 uint64_t rc4:4;
1456 uint64_t rc5:4;
1457 uint64_t rc6:4;
1458 uint64_t rc7:4;
1459 uint64_t rc8:4;
1460 uint64_t rc9:4;
1461 uint64_t rc10:4;
1462 uint64_t rc11:4;
1463 uint64_t rc12:4;
1464 uint64_t rc13:4;
1465 uint64_t rc14:4;
1466 uint64_t rc15:4;
1467#endif
1468 } s;
1469};
1470
1471union cvmx_lmcx_dimm_ctl {
1472 uint64_t u64;
1473 struct cvmx_lmcx_dimm_ctl_s {
1474#ifdef __BIG_ENDIAN_BITFIELD
1475 uint64_t reserved_46_63:18;
1476 uint64_t parity:1;
1477 uint64_t tcws:13;
1478 uint64_t dimm1_wmask:16;
1479 uint64_t dimm0_wmask:16;
1480#else
1481 uint64_t dimm0_wmask:16;
1482 uint64_t dimm1_wmask:16;
1483 uint64_t tcws:13;
1484 uint64_t parity:1;
1485 uint64_t reserved_46_63:18;
1486#endif
1487 } s;
1488};
1489
1490union cvmx_lmcx_dll_ctl {
1491 uint64_t u64;
1492 struct cvmx_lmcx_dll_ctl_s {
1493#ifdef __BIG_ENDIAN_BITFIELD
1494 uint64_t reserved_8_63:56;
1495 uint64_t dreset:1;
1496 uint64_t dll90_byp:1;
1497 uint64_t dll90_ena:1;
1498 uint64_t dll90_vlu:5;
1499#else
1500 uint64_t dll90_vlu:5;
1501 uint64_t dll90_ena:1;
1502 uint64_t dll90_byp:1;
1503 uint64_t dreset:1;
1504 uint64_t reserved_8_63:56;
1505#endif
1506 } s;
1507};
1508
1509union cvmx_lmcx_dll_ctl2 {
1510 uint64_t u64;
1511 struct cvmx_lmcx_dll_ctl2_s {
1512#ifdef __BIG_ENDIAN_BITFIELD
1513 uint64_t reserved_16_63:48;
1514 uint64_t intf_en:1;
1515 uint64_t dll_bringup:1;
1516 uint64_t dreset:1;
1517 uint64_t quad_dll_ena:1;
1518 uint64_t byp_sel:4;
1519 uint64_t byp_setting:8;
1520#else
1521 uint64_t byp_setting:8;
1522 uint64_t byp_sel:4;
1523 uint64_t quad_dll_ena:1;
1524 uint64_t dreset:1;
1525 uint64_t dll_bringup:1;
1526 uint64_t intf_en:1;
1527 uint64_t reserved_16_63:48;
1528#endif
1529 } s;
1530 struct cvmx_lmcx_dll_ctl2_cn63xx {
1531#ifdef __BIG_ENDIAN_BITFIELD
1532 uint64_t reserved_15_63:49;
1533 uint64_t dll_bringup:1;
1534 uint64_t dreset:1;
1535 uint64_t quad_dll_ena:1;
1536 uint64_t byp_sel:4;
1537 uint64_t byp_setting:8;
1538#else
1539 uint64_t byp_setting:8;
1540 uint64_t byp_sel:4;
1541 uint64_t quad_dll_ena:1;
1542 uint64_t dreset:1;
1543 uint64_t dll_bringup:1;
1544 uint64_t reserved_15_63:49;
1545#endif
1546 } cn63xx;
1547};
1548
1549union cvmx_lmcx_dll_ctl3 {
1550 uint64_t u64;
1551 struct cvmx_lmcx_dll_ctl3_s {
1552#ifdef __BIG_ENDIAN_BITFIELD
1553 uint64_t reserved_41_63:23;
1554 uint64_t dclk90_fwd:1;
1555 uint64_t ddr_90_dly_byp:1;
1556 uint64_t dclk90_recal_dis:1;
1557 uint64_t dclk90_byp_sel:1;
1558 uint64_t dclk90_byp_setting:8;
1559 uint64_t dll_fast:1;
1560 uint64_t dll90_setting:8;
1561 uint64_t fine_tune_mode:1;
1562 uint64_t dll_mode:1;
1563 uint64_t dll90_byte_sel:4;
1564 uint64_t offset_ena:1;
1565 uint64_t load_offset:1;
1566 uint64_t mode_sel:2;
1567 uint64_t byte_sel:4;
1568 uint64_t offset:6;
1569#else
1570 uint64_t offset:6;
1571 uint64_t byte_sel:4;
1572 uint64_t mode_sel:2;
1573 uint64_t load_offset:1;
1574 uint64_t offset_ena:1;
1575 uint64_t dll90_byte_sel:4;
1576 uint64_t dll_mode:1;
1577 uint64_t fine_tune_mode:1;
1578 uint64_t dll90_setting:8;
1579 uint64_t dll_fast:1;
1580 uint64_t dclk90_byp_setting:8;
1581 uint64_t dclk90_byp_sel:1;
1582 uint64_t dclk90_recal_dis:1;
1583 uint64_t ddr_90_dly_byp:1;
1584 uint64_t dclk90_fwd:1;
1585 uint64_t reserved_41_63:23;
1586#endif
1587 } s;
1588 struct cvmx_lmcx_dll_ctl3_cn63xx {
1589#ifdef __BIG_ENDIAN_BITFIELD
1590 uint64_t reserved_29_63:35;
1591 uint64_t dll_fast:1;
1592 uint64_t dll90_setting:8;
1593 uint64_t fine_tune_mode:1;
1594 uint64_t dll_mode:1;
1595 uint64_t dll90_byte_sel:4;
1596 uint64_t offset_ena:1;
1597 uint64_t load_offset:1;
1598 uint64_t mode_sel:2;
1599 uint64_t byte_sel:4;
1600 uint64_t offset:6;
1601#else
1602 uint64_t offset:6;
1603 uint64_t byte_sel:4;
1604 uint64_t mode_sel:2;
1605 uint64_t load_offset:1;
1606 uint64_t offset_ena:1;
1607 uint64_t dll90_byte_sel:4;
1608 uint64_t dll_mode:1;
1609 uint64_t fine_tune_mode:1;
1610 uint64_t dll90_setting:8;
1611 uint64_t dll_fast:1;
1612 uint64_t reserved_29_63:35;
1613#endif
1614 } cn63xx;
1615};
1616
1617union cvmx_lmcx_dual_memcfg {
1618 uint64_t u64;
1619 struct cvmx_lmcx_dual_memcfg_s {
1620#ifdef __BIG_ENDIAN_BITFIELD
1621 uint64_t reserved_20_63:44;
1622 uint64_t bank8:1;
1623 uint64_t row_lsb:3;
1624 uint64_t reserved_8_15:8;
1625 uint64_t cs_mask:8;
1626#else
1627 uint64_t cs_mask:8;
1628 uint64_t reserved_8_15:8;
1629 uint64_t row_lsb:3;
1630 uint64_t bank8:1;
1631 uint64_t reserved_20_63:44;
1632#endif
1633 } s;
1634 struct cvmx_lmcx_dual_memcfg_cn61xx {
1635#ifdef __BIG_ENDIAN_BITFIELD
1636 uint64_t reserved_19_63:45;
1637 uint64_t row_lsb:3;
1638 uint64_t reserved_8_15:8;
1639 uint64_t cs_mask:8;
1640#else
1641 uint64_t cs_mask:8;
1642 uint64_t reserved_8_15:8;
1643 uint64_t row_lsb:3;
1644 uint64_t reserved_19_63:45;
1645#endif
1646 } cn61xx;
1647};
1648
1649union cvmx_lmcx_ecc_synd {
1650 uint64_t u64;
1651 struct cvmx_lmcx_ecc_synd_s {
1652#ifdef __BIG_ENDIAN_BITFIELD
1653 uint64_t reserved_32_63:32;
1654 uint64_t mrdsyn3:8;
1655 uint64_t mrdsyn2:8;
1656 uint64_t mrdsyn1:8;
1657 uint64_t mrdsyn0:8;
1658#else
1659 uint64_t mrdsyn0:8;
1660 uint64_t mrdsyn1:8;
1661 uint64_t mrdsyn2:8;
1662 uint64_t mrdsyn3:8;
1663 uint64_t reserved_32_63:32;
1664#endif
1665 } s;
1666};
1667
1668union cvmx_lmcx_fadr {
1669 uint64_t u64;
1670 struct cvmx_lmcx_fadr_s {
1671#ifdef __BIG_ENDIAN_BITFIELD
1672 uint64_t reserved_0_63:64;
1673#else
1674 uint64_t reserved_0_63:64;
1675#endif
1676 } s;
1677 struct cvmx_lmcx_fadr_cn30xx {
1678#ifdef __BIG_ENDIAN_BITFIELD
1679 uint64_t reserved_32_63:32;
1680 uint64_t fdimm:2;
1681 uint64_t fbunk:1;
1682 uint64_t fbank:3;
1683 uint64_t frow:14;
1684 uint64_t fcol:12;
1685#else
1686 uint64_t fcol:12;
1687 uint64_t frow:14;
1688 uint64_t fbank:3;
1689 uint64_t fbunk:1;
1690 uint64_t fdimm:2;
1691 uint64_t reserved_32_63:32;
1692#endif
1693 } cn30xx;
1694 struct cvmx_lmcx_fadr_cn61xx {
1695#ifdef __BIG_ENDIAN_BITFIELD
1696 uint64_t reserved_36_63:28;
1697 uint64_t fdimm:2;
1698 uint64_t fbunk:1;
1699 uint64_t fbank:3;
1700 uint64_t frow:16;
1701 uint64_t fcol:14;
1702#else
1703 uint64_t fcol:14;
1704 uint64_t frow:16;
1705 uint64_t fbank:3;
1706 uint64_t fbunk:1;
1707 uint64_t fdimm:2;
1708 uint64_t reserved_36_63:28;
1709#endif
1710 } cn61xx;
1711};
1712
1713union cvmx_lmcx_ifb_cnt {
1714 uint64_t u64;
1715 struct cvmx_lmcx_ifb_cnt_s {
1716#ifdef __BIG_ENDIAN_BITFIELD
1717 uint64_t ifbcnt:64;
1718#else
1719 uint64_t ifbcnt:64;
1720#endif
1721 } s;
1722};
1723
1724union cvmx_lmcx_ifb_cnt_hi {
1725 uint64_t u64;
1726 struct cvmx_lmcx_ifb_cnt_hi_s {
1727#ifdef __BIG_ENDIAN_BITFIELD
1728 uint64_t reserved_32_63:32;
1729 uint64_t ifbcnt_hi:32;
1730#else
1731 uint64_t ifbcnt_hi:32;
1732 uint64_t reserved_32_63:32;
1733#endif
1734 } s;
1735};
1736
1737union cvmx_lmcx_ifb_cnt_lo {
1738 uint64_t u64;
1739 struct cvmx_lmcx_ifb_cnt_lo_s {
1740#ifdef __BIG_ENDIAN_BITFIELD
1741 uint64_t reserved_32_63:32;
1742 uint64_t ifbcnt_lo:32;
1743#else
1744 uint64_t ifbcnt_lo:32;
1745 uint64_t reserved_32_63:32;
1746#endif
1747 } s;
1748};
1749
1750union cvmx_lmcx_int {
1751 uint64_t u64;
1752 struct cvmx_lmcx_int_s {
1753#ifdef __BIG_ENDIAN_BITFIELD
1754 uint64_t reserved_9_63:55;
1755 uint64_t ded_err:4;
1756 uint64_t sec_err:4;
1757 uint64_t nxm_wr_err:1;
1758#else
1759 uint64_t nxm_wr_err:1;
1760 uint64_t sec_err:4;
1761 uint64_t ded_err:4;
1762 uint64_t reserved_9_63:55;
1763#endif
1764 } s;
1765};
1766
1767union cvmx_lmcx_int_en {
1768 uint64_t u64;
1769 struct cvmx_lmcx_int_en_s {
1770#ifdef __BIG_ENDIAN_BITFIELD
1771 uint64_t reserved_3_63:61;
1772 uint64_t intr_ded_ena:1;
1773 uint64_t intr_sec_ena:1;
1774 uint64_t intr_nxm_wr_ena:1;
1775#else
1776 uint64_t intr_nxm_wr_ena:1;
1777 uint64_t intr_sec_ena:1;
1778 uint64_t intr_ded_ena:1;
1779 uint64_t reserved_3_63:61;
1780#endif
1781 } s;
1782};
1783
1784union cvmx_lmcx_mem_cfg0 {
1785 uint64_t u64;
1786 struct cvmx_lmcx_mem_cfg0_s {
1787#ifdef __BIG_ENDIAN_BITFIELD
1788 uint64_t reserved_32_63:32;
1789 uint64_t reset:1;
1790 uint64_t silo_qc:1;
1791 uint64_t bunk_ena:1;
1792 uint64_t ded_err:4;
1793 uint64_t sec_err:4;
1794 uint64_t intr_ded_ena:1;
1795 uint64_t intr_sec_ena:1;
1796 uint64_t tcl:4;
1797 uint64_t ref_int:6;
1798 uint64_t pbank_lsb:4;
1799 uint64_t row_lsb:3;
1800 uint64_t ecc_ena:1;
1801 uint64_t init_start:1;
1802#else
1803 uint64_t init_start:1;
1804 uint64_t ecc_ena:1;
1805 uint64_t row_lsb:3;
1806 uint64_t pbank_lsb:4;
1807 uint64_t ref_int:6;
1808 uint64_t tcl:4;
1809 uint64_t intr_sec_ena:1;
1810 uint64_t intr_ded_ena:1;
1811 uint64_t sec_err:4;
1812 uint64_t ded_err:4;
1813 uint64_t bunk_ena:1;
1814 uint64_t silo_qc:1;
1815 uint64_t reset:1;
1816 uint64_t reserved_32_63:32;
1817#endif
1818 } s;
1819};
1820
1821union cvmx_lmcx_mem_cfg1 {
1822 uint64_t u64;
1823 struct cvmx_lmcx_mem_cfg1_s {
1824#ifdef __BIG_ENDIAN_BITFIELD
1825 uint64_t reserved_32_63:32;
1826 uint64_t comp_bypass:1;
1827 uint64_t trrd:3;
1828 uint64_t caslat:3;
1829 uint64_t tmrd:3;
1830 uint64_t trfc:5;
1831 uint64_t trp:4;
1832 uint64_t twtr:4;
1833 uint64_t trcd:4;
1834 uint64_t tras:5;
1835#else
1836 uint64_t tras:5;
1837 uint64_t trcd:4;
1838 uint64_t twtr:4;
1839 uint64_t trp:4;
1840 uint64_t trfc:5;
1841 uint64_t tmrd:3;
1842 uint64_t caslat:3;
1843 uint64_t trrd:3;
1844 uint64_t comp_bypass:1;
1845 uint64_t reserved_32_63:32;
1846#endif
1847 } s;
1848 struct cvmx_lmcx_mem_cfg1_cn38xx {
1849#ifdef __BIG_ENDIAN_BITFIELD
1850 uint64_t reserved_31_63:33;
1851 uint64_t trrd:3;
1852 uint64_t caslat:3;
1853 uint64_t tmrd:3;
1854 uint64_t trfc:5;
1855 uint64_t trp:4;
1856 uint64_t twtr:4;
1857 uint64_t trcd:4;
1858 uint64_t tras:5;
1859#else
1860 uint64_t tras:5;
1861 uint64_t trcd:4;
1862 uint64_t twtr:4;
1863 uint64_t trp:4;
1864 uint64_t trfc:5;
1865 uint64_t tmrd:3;
1866 uint64_t caslat:3;
1867 uint64_t trrd:3;
1868 uint64_t reserved_31_63:33;
1869#endif
1870 } cn38xx;
1871};
1872
1873union cvmx_lmcx_modereg_params0 {
1874 uint64_t u64;
1875 struct cvmx_lmcx_modereg_params0_s {
1876#ifdef __BIG_ENDIAN_BITFIELD
1877 uint64_t reserved_25_63:39;
1878 uint64_t ppd:1;
1879 uint64_t wrp:3;
1880 uint64_t dllr:1;
1881 uint64_t tm:1;
1882 uint64_t rbt:1;
1883 uint64_t cl:4;
1884 uint64_t bl:2;
1885 uint64_t qoff:1;
1886 uint64_t tdqs:1;
1887 uint64_t wlev:1;
1888 uint64_t al:2;
1889 uint64_t dll:1;
1890 uint64_t mpr:1;
1891 uint64_t mprloc:2;
1892 uint64_t cwl:3;
1893#else
1894 uint64_t cwl:3;
1895 uint64_t mprloc:2;
1896 uint64_t mpr:1;
1897 uint64_t dll:1;
1898 uint64_t al:2;
1899 uint64_t wlev:1;
1900 uint64_t tdqs:1;
1901 uint64_t qoff:1;
1902 uint64_t bl:2;
1903 uint64_t cl:4;
1904 uint64_t rbt:1;
1905 uint64_t tm:1;
1906 uint64_t dllr:1;
1907 uint64_t wrp:3;
1908 uint64_t ppd:1;
1909 uint64_t reserved_25_63:39;
1910#endif
1911 } s;
1912};
1913
1914union cvmx_lmcx_modereg_params1 {
1915 uint64_t u64;
1916 struct cvmx_lmcx_modereg_params1_s {
1917#ifdef __BIG_ENDIAN_BITFIELD
1918 uint64_t reserved_48_63:16;
1919 uint64_t rtt_nom_11:3;
1920 uint64_t dic_11:2;
1921 uint64_t rtt_wr_11:2;
1922 uint64_t srt_11:1;
1923 uint64_t asr_11:1;
1924 uint64_t pasr_11:3;
1925 uint64_t rtt_nom_10:3;
1926 uint64_t dic_10:2;
1927 uint64_t rtt_wr_10:2;
1928 uint64_t srt_10:1;
1929 uint64_t asr_10:1;
1930 uint64_t pasr_10:3;
1931 uint64_t rtt_nom_01:3;
1932 uint64_t dic_01:2;
1933 uint64_t rtt_wr_01:2;
1934 uint64_t srt_01:1;
1935 uint64_t asr_01:1;
1936 uint64_t pasr_01:3;
1937 uint64_t rtt_nom_00:3;
1938 uint64_t dic_00:2;
1939 uint64_t rtt_wr_00:2;
1940 uint64_t srt_00:1;
1941 uint64_t asr_00:1;
1942 uint64_t pasr_00:3;
1943#else
1944 uint64_t pasr_00:3;
1945 uint64_t asr_00:1;
1946 uint64_t srt_00:1;
1947 uint64_t rtt_wr_00:2;
1948 uint64_t dic_00:2;
1949 uint64_t rtt_nom_00:3;
1950 uint64_t pasr_01:3;
1951 uint64_t asr_01:1;
1952 uint64_t srt_01:1;
1953 uint64_t rtt_wr_01:2;
1954 uint64_t dic_01:2;
1955 uint64_t rtt_nom_01:3;
1956 uint64_t pasr_10:3;
1957 uint64_t asr_10:1;
1958 uint64_t srt_10:1;
1959 uint64_t rtt_wr_10:2;
1960 uint64_t dic_10:2;
1961 uint64_t rtt_nom_10:3;
1962 uint64_t pasr_11:3;
1963 uint64_t asr_11:1;
1964 uint64_t srt_11:1;
1965 uint64_t rtt_wr_11:2;
1966 uint64_t dic_11:2;
1967 uint64_t rtt_nom_11:3;
1968 uint64_t reserved_48_63:16;
1969#endif
1970 } s;
1971};
1972
1973union cvmx_lmcx_nxm {
1974 uint64_t u64;
1975 struct cvmx_lmcx_nxm_s {
1976#ifdef __BIG_ENDIAN_BITFIELD
1977 uint64_t reserved_40_63:24;
1978 uint64_t mem_msb_d3_r1:4;
1979 uint64_t mem_msb_d3_r0:4;
1980 uint64_t mem_msb_d2_r1:4;
1981 uint64_t mem_msb_d2_r0:4;
1982 uint64_t mem_msb_d1_r1:4;
1983 uint64_t mem_msb_d1_r0:4;
1984 uint64_t mem_msb_d0_r1:4;
1985 uint64_t mem_msb_d0_r0:4;
1986 uint64_t cs_mask:8;
1987#else
1988 uint64_t cs_mask:8;
1989 uint64_t mem_msb_d0_r0:4;
1990 uint64_t mem_msb_d0_r1:4;
1991 uint64_t mem_msb_d1_r0:4;
1992 uint64_t mem_msb_d1_r1:4;
1993 uint64_t mem_msb_d2_r0:4;
1994 uint64_t mem_msb_d2_r1:4;
1995 uint64_t mem_msb_d3_r0:4;
1996 uint64_t mem_msb_d3_r1:4;
1997 uint64_t reserved_40_63:24;
1998#endif
1999 } s;
2000 struct cvmx_lmcx_nxm_cn52xx {
2001#ifdef __BIG_ENDIAN_BITFIELD
2002 uint64_t reserved_8_63:56;
2003 uint64_t cs_mask:8;
2004#else
2005 uint64_t cs_mask:8;
2006 uint64_t reserved_8_63:56;
2007#endif
2008 } cn52xx;
2009};
2010
2011union cvmx_lmcx_ops_cnt {
2012 uint64_t u64;
2013 struct cvmx_lmcx_ops_cnt_s {
2014#ifdef __BIG_ENDIAN_BITFIELD
2015 uint64_t opscnt:64;
2016#else
2017 uint64_t opscnt:64;
2018#endif
2019 } s;
2020};
2021
2022union cvmx_lmcx_ops_cnt_hi {
2023 uint64_t u64;
2024 struct cvmx_lmcx_ops_cnt_hi_s {
2025#ifdef __BIG_ENDIAN_BITFIELD
2026 uint64_t reserved_32_63:32;
2027 uint64_t opscnt_hi:32;
2028#else
2029 uint64_t opscnt_hi:32;
2030 uint64_t reserved_32_63:32;
2031#endif
2032 } s;
2033};
2034
2035union cvmx_lmcx_ops_cnt_lo {
2036 uint64_t u64;
2037 struct cvmx_lmcx_ops_cnt_lo_s {
2038#ifdef __BIG_ENDIAN_BITFIELD
2039 uint64_t reserved_32_63:32;
2040 uint64_t opscnt_lo:32;
2041#else
2042 uint64_t opscnt_lo:32;
2043 uint64_t reserved_32_63:32;
2044#endif
2045 } s;
2046};
2047
2048union cvmx_lmcx_phy_ctl {
2049 uint64_t u64;
2050 struct cvmx_lmcx_phy_ctl_s {
2051#ifdef __BIG_ENDIAN_BITFIELD
2052 uint64_t reserved_15_63:49;
2053 uint64_t rx_always_on:1;
2054 uint64_t lv_mode:1;
2055 uint64_t ck_tune1:1;
2056 uint64_t ck_dlyout1:4;
2057 uint64_t ck_tune0:1;
2058 uint64_t ck_dlyout0:4;
2059 uint64_t loopback:1;
2060 uint64_t loopback_pos:1;
2061 uint64_t ts_stagger:1;
2062#else
2063 uint64_t ts_stagger:1;
2064 uint64_t loopback_pos:1;
2065 uint64_t loopback:1;
2066 uint64_t ck_dlyout0:4;
2067 uint64_t ck_tune0:1;
2068 uint64_t ck_dlyout1:4;
2069 uint64_t ck_tune1:1;
2070 uint64_t lv_mode:1;
2071 uint64_t rx_always_on:1;
2072 uint64_t reserved_15_63:49;
2073#endif
2074 } s;
2075 struct cvmx_lmcx_phy_ctl_cn63xxp1 {
2076#ifdef __BIG_ENDIAN_BITFIELD
2077 uint64_t reserved_14_63:50;
2078 uint64_t lv_mode:1;
2079 uint64_t ck_tune1:1;
2080 uint64_t ck_dlyout1:4;
2081 uint64_t ck_tune0:1;
2082 uint64_t ck_dlyout0:4;
2083 uint64_t loopback:1;
2084 uint64_t loopback_pos:1;
2085 uint64_t ts_stagger:1;
2086#else
2087 uint64_t ts_stagger:1;
2088 uint64_t loopback_pos:1;
2089 uint64_t loopback:1;
2090 uint64_t ck_dlyout0:4;
2091 uint64_t ck_tune0:1;
2092 uint64_t ck_dlyout1:4;
2093 uint64_t ck_tune1:1;
2094 uint64_t lv_mode:1;
2095 uint64_t reserved_14_63:50;
2096#endif
2097 } cn63xxp1;
2098};
2099
2100union cvmx_lmcx_pll_bwctl {
2101 uint64_t u64;
2102 struct cvmx_lmcx_pll_bwctl_s {
2103#ifdef __BIG_ENDIAN_BITFIELD
2104 uint64_t reserved_5_63:59;
2105 uint64_t bwupd:1;
2106 uint64_t bwctl:4;
2107#else
2108 uint64_t bwctl:4;
2109 uint64_t bwupd:1;
2110 uint64_t reserved_5_63:59;
2111#endif
2112 } s;
2113};
2114
2115union cvmx_lmcx_pll_ctl {
2116 uint64_t u64;
2117 struct cvmx_lmcx_pll_ctl_s {
2118#ifdef __BIG_ENDIAN_BITFIELD
2119 uint64_t reserved_30_63:34;
2120 uint64_t bypass:1;
2121 uint64_t fasten_n:1;
2122 uint64_t div_reset:1;
2123 uint64_t reset_n:1;
2124 uint64_t clkf:12;
2125 uint64_t clkr:6;
2126 uint64_t reserved_6_7:2;
2127 uint64_t en16:1;
2128 uint64_t en12:1;
2129 uint64_t en8:1;
2130 uint64_t en6:1;
2131 uint64_t en4:1;
2132 uint64_t en2:1;
2133#else
2134 uint64_t en2:1;
2135 uint64_t en4:1;
2136 uint64_t en6:1;
2137 uint64_t en8:1;
2138 uint64_t en12:1;
2139 uint64_t en16:1;
2140 uint64_t reserved_6_7:2;
2141 uint64_t clkr:6;
2142 uint64_t clkf:12;
2143 uint64_t reset_n:1;
2144 uint64_t div_reset:1;
2145 uint64_t fasten_n:1;
2146 uint64_t bypass:1;
2147 uint64_t reserved_30_63:34;
2148#endif
2149 } s;
2150 struct cvmx_lmcx_pll_ctl_cn50xx {
2151#ifdef __BIG_ENDIAN_BITFIELD
2152 uint64_t reserved_29_63:35;
2153 uint64_t fasten_n:1;
2154 uint64_t div_reset:1;
2155 uint64_t reset_n:1;
2156 uint64_t clkf:12;
2157 uint64_t clkr:6;
2158 uint64_t reserved_6_7:2;
2159 uint64_t en16:1;
2160 uint64_t en12:1;
2161 uint64_t en8:1;
2162 uint64_t en6:1;
2163 uint64_t en4:1;
2164 uint64_t en2:1;
2165#else
2166 uint64_t en2:1;
2167 uint64_t en4:1;
2168 uint64_t en6:1;
2169 uint64_t en8:1;
2170 uint64_t en12:1;
2171 uint64_t en16:1;
2172 uint64_t reserved_6_7:2;
2173 uint64_t clkr:6;
2174 uint64_t clkf:12;
2175 uint64_t reset_n:1;
2176 uint64_t div_reset:1;
2177 uint64_t fasten_n:1;
2178 uint64_t reserved_29_63:35;
2179#endif
2180 } cn50xx;
2181 struct cvmx_lmcx_pll_ctl_cn56xxp1 {
2182#ifdef __BIG_ENDIAN_BITFIELD
2183 uint64_t reserved_28_63:36;
2184 uint64_t div_reset:1;
2185 uint64_t reset_n:1;
2186 uint64_t clkf:12;
2187 uint64_t clkr:6;
2188 uint64_t reserved_6_7:2;
2189 uint64_t en16:1;
2190 uint64_t en12:1;
2191 uint64_t en8:1;
2192 uint64_t en6:1;
2193 uint64_t en4:1;
2194 uint64_t en2:1;
2195#else
2196 uint64_t en2:1;
2197 uint64_t en4:1;
2198 uint64_t en6:1;
2199 uint64_t en8:1;
2200 uint64_t en12:1;
2201 uint64_t en16:1;
2202 uint64_t reserved_6_7:2;
2203 uint64_t clkr:6;
2204 uint64_t clkf:12;
2205 uint64_t reset_n:1;
2206 uint64_t div_reset:1;
2207 uint64_t reserved_28_63:36;
2208#endif
2209 } cn56xxp1;
2210};
2211
2212union cvmx_lmcx_pll_status {
2213 uint64_t u64;
2214 struct cvmx_lmcx_pll_status_s {
2215#ifdef __BIG_ENDIAN_BITFIELD
2216 uint64_t reserved_32_63:32;
2217 uint64_t ddr__nctl:5;
2218 uint64_t ddr__pctl:5;
2219 uint64_t reserved_2_21:20;
2220 uint64_t rfslip:1;
2221 uint64_t fbslip:1;
2222#else
2223 uint64_t fbslip:1;
2224 uint64_t rfslip:1;
2225 uint64_t reserved_2_21:20;
2226 uint64_t ddr__pctl:5;
2227 uint64_t ddr__nctl:5;
2228 uint64_t reserved_32_63:32;
2229#endif
2230 } s;
2231 struct cvmx_lmcx_pll_status_cn58xxp1 {
2232#ifdef __BIG_ENDIAN_BITFIELD
2233 uint64_t reserved_2_63:62;
2234 uint64_t rfslip:1;
2235 uint64_t fbslip:1;
2236#else
2237 uint64_t fbslip:1;
2238 uint64_t rfslip:1;
2239 uint64_t reserved_2_63:62;
2240#endif
2241 } cn58xxp1;
2242};
2243
2244union cvmx_lmcx_read_level_ctl {
2245 uint64_t u64;
2246 struct cvmx_lmcx_read_level_ctl_s {
2247#ifdef __BIG_ENDIAN_BITFIELD
2248 uint64_t reserved_44_63:20;
2249 uint64_t rankmask:4;
2250 uint64_t pattern:8;
2251 uint64_t row:16;
2252 uint64_t col:12;
2253 uint64_t reserved_3_3:1;
2254 uint64_t bnk:3;
2255#else
2256 uint64_t bnk:3;
2257 uint64_t reserved_3_3:1;
2258 uint64_t col:12;
2259 uint64_t row:16;
2260 uint64_t pattern:8;
2261 uint64_t rankmask:4;
2262 uint64_t reserved_44_63:20;
2263#endif
2264 } s;
2265};
2266
2267union cvmx_lmcx_read_level_dbg {
2268 uint64_t u64;
2269 struct cvmx_lmcx_read_level_dbg_s {
2270#ifdef __BIG_ENDIAN_BITFIELD
2271 uint64_t reserved_32_63:32;
2272 uint64_t bitmask:16;
2273 uint64_t reserved_4_15:12;
2274 uint64_t byte:4;
2275#else
2276 uint64_t byte:4;
2277 uint64_t reserved_4_15:12;
2278 uint64_t bitmask:16;
2279 uint64_t reserved_32_63:32;
2280#endif
2281 } s;
2282};
2283
2284union cvmx_lmcx_read_level_rankx {
2285 uint64_t u64;
2286 struct cvmx_lmcx_read_level_rankx_s {
2287#ifdef __BIG_ENDIAN_BITFIELD
2288 uint64_t reserved_38_63:26;
2289 uint64_t status:2;
2290 uint64_t byte8:4;
2291 uint64_t byte7:4;
2292 uint64_t byte6:4;
2293 uint64_t byte5:4;
2294 uint64_t byte4:4;
2295 uint64_t byte3:4;
2296 uint64_t byte2:4;
2297 uint64_t byte1:4;
2298 uint64_t byte0:4;
2299#else
2300 uint64_t byte0:4;
2301 uint64_t byte1:4;
2302 uint64_t byte2:4;
2303 uint64_t byte3:4;
2304 uint64_t byte4:4;
2305 uint64_t byte5:4;
2306 uint64_t byte6:4;
2307 uint64_t byte7:4;
2308 uint64_t byte8:4;
2309 uint64_t status:2;
2310 uint64_t reserved_38_63:26;
2311#endif
2312 } s;
2313};
2314
2315union cvmx_lmcx_reset_ctl {
2316 uint64_t u64;
2317 struct cvmx_lmcx_reset_ctl_s {
2318#ifdef __BIG_ENDIAN_BITFIELD
2319 uint64_t reserved_4_63:60;
2320 uint64_t ddr3psv:1;
2321 uint64_t ddr3psoft:1;
2322 uint64_t ddr3pwarm:1;
2323 uint64_t ddr3rst:1;
2324#else
2325 uint64_t ddr3rst:1;
2326 uint64_t ddr3pwarm:1;
2327 uint64_t ddr3psoft:1;
2328 uint64_t ddr3psv:1;
2329 uint64_t reserved_4_63:60;
2330#endif
2331 } s;
2332};
2333
2334union cvmx_lmcx_rlevel_ctl {
2335 uint64_t u64;
2336 struct cvmx_lmcx_rlevel_ctl_s {
2337#ifdef __BIG_ENDIAN_BITFIELD
2338 uint64_t reserved_22_63:42;
2339 uint64_t delay_unload_3:1;
2340 uint64_t delay_unload_2:1;
2341 uint64_t delay_unload_1:1;
2342 uint64_t delay_unload_0:1;
2343 uint64_t bitmask:8;
2344 uint64_t or_dis:1;
2345 uint64_t offset_en:1;
2346 uint64_t offset:4;
2347 uint64_t byte:4;
2348#else
2349 uint64_t byte:4;
2350 uint64_t offset:4;
2351 uint64_t offset_en:1;
2352 uint64_t or_dis:1;
2353 uint64_t bitmask:8;
2354 uint64_t delay_unload_0:1;
2355 uint64_t delay_unload_1:1;
2356 uint64_t delay_unload_2:1;
2357 uint64_t delay_unload_3:1;
2358 uint64_t reserved_22_63:42;
2359#endif
2360 } s;
2361 struct cvmx_lmcx_rlevel_ctl_cn63xxp1 {
2362#ifdef __BIG_ENDIAN_BITFIELD
2363 uint64_t reserved_9_63:55;
2364 uint64_t offset_en:1;
2365 uint64_t offset:4;
2366 uint64_t byte:4;
2367#else
2368 uint64_t byte:4;
2369 uint64_t offset:4;
2370 uint64_t offset_en:1;
2371 uint64_t reserved_9_63:55;
2372#endif
2373 } cn63xxp1;
2374};
2375
2376union cvmx_lmcx_rlevel_dbg {
2377 uint64_t u64;
2378 struct cvmx_lmcx_rlevel_dbg_s {
2379#ifdef __BIG_ENDIAN_BITFIELD
2380 uint64_t bitmask:64;
2381#else
2382 uint64_t bitmask:64;
2383#endif
2384 } s;
2385};
2386
2387union cvmx_lmcx_rlevel_rankx {
2388 uint64_t u64;
2389 struct cvmx_lmcx_rlevel_rankx_s {
2390#ifdef __BIG_ENDIAN_BITFIELD
2391 uint64_t reserved_56_63:8;
2392 uint64_t status:2;
2393 uint64_t byte8:6;
2394 uint64_t byte7:6;
2395 uint64_t byte6:6;
2396 uint64_t byte5:6;
2397 uint64_t byte4:6;
2398 uint64_t byte3:6;
2399 uint64_t byte2:6;
2400 uint64_t byte1:6;
2401 uint64_t byte0:6;
2402#else
2403 uint64_t byte0:6;
2404 uint64_t byte1:6;
2405 uint64_t byte2:6;
2406 uint64_t byte3:6;
2407 uint64_t byte4:6;
2408 uint64_t byte5:6;
2409 uint64_t byte6:6;
2410 uint64_t byte7:6;
2411 uint64_t byte8:6;
2412 uint64_t status:2;
2413 uint64_t reserved_56_63:8;
2414#endif
2415 } s;
2416};
2417
2418union cvmx_lmcx_rodt_comp_ctl {
2419 uint64_t u64;
2420 struct cvmx_lmcx_rodt_comp_ctl_s {
2421#ifdef __BIG_ENDIAN_BITFIELD
2422 uint64_t reserved_17_63:47;
2423 uint64_t enable:1;
2424 uint64_t reserved_12_15:4;
2425 uint64_t nctl:4;
2426 uint64_t reserved_5_7:3;
2427 uint64_t pctl:5;
2428#else
2429 uint64_t pctl:5;
2430 uint64_t reserved_5_7:3;
2431 uint64_t nctl:4;
2432 uint64_t reserved_12_15:4;
2433 uint64_t enable:1;
2434 uint64_t reserved_17_63:47;
2435#endif
2436 } s;
2437};
2438
2439union cvmx_lmcx_rodt_ctl {
2440 uint64_t u64;
2441 struct cvmx_lmcx_rodt_ctl_s {
2442#ifdef __BIG_ENDIAN_BITFIELD
2443 uint64_t reserved_32_63:32;
2444 uint64_t rodt_hi3:4;
2445 uint64_t rodt_hi2:4;
2446 uint64_t rodt_hi1:4;
2447 uint64_t rodt_hi0:4;
2448 uint64_t rodt_lo3:4;
2449 uint64_t rodt_lo2:4;
2450 uint64_t rodt_lo1:4;
2451 uint64_t rodt_lo0:4;
2452#else
2453 uint64_t rodt_lo0:4;
2454 uint64_t rodt_lo1:4;
2455 uint64_t rodt_lo2:4;
2456 uint64_t rodt_lo3:4;
2457 uint64_t rodt_hi0:4;
2458 uint64_t rodt_hi1:4;
2459 uint64_t rodt_hi2:4;
2460 uint64_t rodt_hi3:4;
2461 uint64_t reserved_32_63:32;
2462#endif
2463 } s;
2464};
2465
2466union cvmx_lmcx_rodt_mask {
2467 uint64_t u64;
2468 struct cvmx_lmcx_rodt_mask_s {
2469#ifdef __BIG_ENDIAN_BITFIELD
2470 uint64_t rodt_d3_r1:8;
2471 uint64_t rodt_d3_r0:8;
2472 uint64_t rodt_d2_r1:8;
2473 uint64_t rodt_d2_r0:8;
2474 uint64_t rodt_d1_r1:8;
2475 uint64_t rodt_d1_r0:8;
2476 uint64_t rodt_d0_r1:8;
2477 uint64_t rodt_d0_r0:8;
2478#else
2479 uint64_t rodt_d0_r0:8;
2480 uint64_t rodt_d0_r1:8;
2481 uint64_t rodt_d1_r0:8;
2482 uint64_t rodt_d1_r1:8;
2483 uint64_t rodt_d2_r0:8;
2484 uint64_t rodt_d2_r1:8;
2485 uint64_t rodt_d3_r0:8;
2486 uint64_t rodt_d3_r1:8;
2487#endif
2488 } s;
2489};
2490
2491union cvmx_lmcx_scramble_cfg0 {
2492 uint64_t u64;
2493 struct cvmx_lmcx_scramble_cfg0_s {
2494#ifdef __BIG_ENDIAN_BITFIELD
2495 uint64_t key:64;
2496#else
2497 uint64_t key:64;
2498#endif
2499 } s;
2500};
2501
2502union cvmx_lmcx_scramble_cfg1 {
2503 uint64_t u64;
2504 struct cvmx_lmcx_scramble_cfg1_s {
2505#ifdef __BIG_ENDIAN_BITFIELD
2506 uint64_t key:64;
2507#else
2508 uint64_t key:64;
2509#endif
2510 } s;
2511};
2512
2513union cvmx_lmcx_scrambled_fadr {
2514 uint64_t u64;
2515 struct cvmx_lmcx_scrambled_fadr_s {
2516#ifdef __BIG_ENDIAN_BITFIELD
2517 uint64_t reserved_36_63:28;
2518 uint64_t fdimm:2;
2519 uint64_t fbunk:1;
2520 uint64_t fbank:3;
2521 uint64_t frow:16;
2522 uint64_t fcol:14;
2523#else
2524 uint64_t fcol:14;
2525 uint64_t frow:16;
2526 uint64_t fbank:3;
2527 uint64_t fbunk:1;
2528 uint64_t fdimm:2;
2529 uint64_t reserved_36_63:28;
2530#endif
2531 } s;
2532};
2533
2534union cvmx_lmcx_slot_ctl0 {
2535 uint64_t u64;
2536 struct cvmx_lmcx_slot_ctl0_s {
2537#ifdef __BIG_ENDIAN_BITFIELD
2538 uint64_t reserved_24_63:40;
2539 uint64_t w2w_init:6;
2540 uint64_t w2r_init:6;
2541 uint64_t r2w_init:6;
2542 uint64_t r2r_init:6;
2543#else
2544 uint64_t r2r_init:6;
2545 uint64_t r2w_init:6;
2546 uint64_t w2r_init:6;
2547 uint64_t w2w_init:6;
2548 uint64_t reserved_24_63:40;
2549#endif
2550 } s;
2551};
2552
2553union cvmx_lmcx_slot_ctl1 {
2554 uint64_t u64;
2555 struct cvmx_lmcx_slot_ctl1_s {
2556#ifdef __BIG_ENDIAN_BITFIELD
2557 uint64_t reserved_24_63:40;
2558 uint64_t w2w_xrank_init:6;
2559 uint64_t w2r_xrank_init:6;
2560 uint64_t r2w_xrank_init:6;
2561 uint64_t r2r_xrank_init:6;
2562#else
2563 uint64_t r2r_xrank_init:6;
2564 uint64_t r2w_xrank_init:6;
2565 uint64_t w2r_xrank_init:6;
2566 uint64_t w2w_xrank_init:6;
2567 uint64_t reserved_24_63:40;
2568#endif
2569 } s;
2570};
2571
2572union cvmx_lmcx_slot_ctl2 {
2573 uint64_t u64;
2574 struct cvmx_lmcx_slot_ctl2_s {
2575#ifdef __BIG_ENDIAN_BITFIELD
2576 uint64_t reserved_24_63:40;
2577 uint64_t w2w_xdimm_init:6;
2578 uint64_t w2r_xdimm_init:6;
2579 uint64_t r2w_xdimm_init:6;
2580 uint64_t r2r_xdimm_init:6;
2581#else
2582 uint64_t r2r_xdimm_init:6;
2583 uint64_t r2w_xdimm_init:6;
2584 uint64_t w2r_xdimm_init:6;
2585 uint64_t w2w_xdimm_init:6;
2586 uint64_t reserved_24_63:40;
2587#endif
2588 } s;
2589};
2590
2591union cvmx_lmcx_timing_params0 {
2592 uint64_t u64;
2593 struct cvmx_lmcx_timing_params0_s {
2594#ifdef __BIG_ENDIAN_BITFIELD
2595 uint64_t reserved_47_63:17;
2596 uint64_t trp_ext:1;
2597 uint64_t tcksre:4;
2598 uint64_t trp:4;
2599 uint64_t tzqinit:4;
2600 uint64_t tdllk:4;
2601 uint64_t tmod:4;
2602 uint64_t tmrd:4;
2603 uint64_t txpr:4;
2604 uint64_t tcke:4;
2605 uint64_t tzqcs:4;
2606 uint64_t tckeon:10;
2607#else
2608 uint64_t tckeon:10;
2609 uint64_t tzqcs:4;
2610 uint64_t tcke:4;
2611 uint64_t txpr:4;
2612 uint64_t tmrd:4;
2613 uint64_t tmod:4;
2614 uint64_t tdllk:4;
2615 uint64_t tzqinit:4;
2616 uint64_t trp:4;
2617 uint64_t tcksre:4;
2618 uint64_t trp_ext:1;
2619 uint64_t reserved_47_63:17;
2620#endif
2621 } s;
2622 struct cvmx_lmcx_timing_params0_cn61xx {
2623#ifdef __BIG_ENDIAN_BITFIELD
2624 uint64_t reserved_47_63:17;
2625 uint64_t trp_ext:1;
2626 uint64_t tcksre:4;
2627 uint64_t trp:4;
2628 uint64_t tzqinit:4;
2629 uint64_t tdllk:4;
2630 uint64_t tmod:4;
2631 uint64_t tmrd:4;
2632 uint64_t txpr:4;
2633 uint64_t tcke:4;
2634 uint64_t tzqcs:4;
2635 uint64_t reserved_0_9:10;
2636#else
2637 uint64_t reserved_0_9:10;
2638 uint64_t tzqcs:4;
2639 uint64_t tcke:4;
2640 uint64_t txpr:4;
2641 uint64_t tmrd:4;
2642 uint64_t tmod:4;
2643 uint64_t tdllk:4;
2644 uint64_t tzqinit:4;
2645 uint64_t trp:4;
2646 uint64_t tcksre:4;
2647 uint64_t trp_ext:1;
2648 uint64_t reserved_47_63:17;
2649#endif
2650 } cn61xx;
2651 struct cvmx_lmcx_timing_params0_cn63xxp1 {
2652#ifdef __BIG_ENDIAN_BITFIELD
2653 uint64_t reserved_46_63:18;
2654 uint64_t tcksre:4;
2655 uint64_t trp:4;
2656 uint64_t tzqinit:4;
2657 uint64_t tdllk:4;
2658 uint64_t tmod:4;
2659 uint64_t tmrd:4;
2660 uint64_t txpr:4;
2661 uint64_t tcke:4;
2662 uint64_t tzqcs:4;
2663 uint64_t tckeon:10;
2664#else
2665 uint64_t tckeon:10;
2666 uint64_t tzqcs:4;
2667 uint64_t tcke:4;
2668 uint64_t txpr:4;
2669 uint64_t tmrd:4;
2670 uint64_t tmod:4;
2671 uint64_t tdllk:4;
2672 uint64_t tzqinit:4;
2673 uint64_t trp:4;
2674 uint64_t tcksre:4;
2675 uint64_t reserved_46_63:18;
2676#endif
2677 } cn63xxp1;
2678};
2679
2680union cvmx_lmcx_timing_params1 {
2681 uint64_t u64;
2682 struct cvmx_lmcx_timing_params1_s {
2683#ifdef __BIG_ENDIAN_BITFIELD
2684 uint64_t reserved_47_63:17;
2685 uint64_t tras_ext:1;
2686 uint64_t txpdll:5;
2687 uint64_t tfaw:5;
2688 uint64_t twldqsen:4;
2689 uint64_t twlmrd:4;
2690 uint64_t txp:3;
2691 uint64_t trrd:3;
2692 uint64_t trfc:5;
2693 uint64_t twtr:4;
2694 uint64_t trcd:4;
2695 uint64_t tras:5;
2696 uint64_t tmprr:4;
2697#else
2698 uint64_t tmprr:4;
2699 uint64_t tras:5;
2700 uint64_t trcd:4;
2701 uint64_t twtr:4;
2702 uint64_t trfc:5;
2703 uint64_t trrd:3;
2704 uint64_t txp:3;
2705 uint64_t twlmrd:4;
2706 uint64_t twldqsen:4;
2707 uint64_t tfaw:5;
2708 uint64_t txpdll:5;
2709 uint64_t tras_ext:1;
2710 uint64_t reserved_47_63:17;
2711#endif
2712 } s;
2713 struct cvmx_lmcx_timing_params1_cn63xxp1 {
2714#ifdef __BIG_ENDIAN_BITFIELD
2715 uint64_t reserved_46_63:18;
2716 uint64_t txpdll:5;
2717 uint64_t tfaw:5;
2718 uint64_t twldqsen:4;
2719 uint64_t twlmrd:4;
2720 uint64_t txp:3;
2721 uint64_t trrd:3;
2722 uint64_t trfc:5;
2723 uint64_t twtr:4;
2724 uint64_t trcd:4;
2725 uint64_t tras:5;
2726 uint64_t tmprr:4;
2727#else
2728 uint64_t tmprr:4;
2729 uint64_t tras:5;
2730 uint64_t trcd:4;
2731 uint64_t twtr:4;
2732 uint64_t trfc:5;
2733 uint64_t trrd:3;
2734 uint64_t txp:3;
2735 uint64_t twlmrd:4;
2736 uint64_t twldqsen:4;
2737 uint64_t tfaw:5;
2738 uint64_t txpdll:5;
2739 uint64_t reserved_46_63:18;
2740#endif
2741 } cn63xxp1;
2742};
2743
2744union cvmx_lmcx_tro_ctl {
2745 uint64_t u64;
2746 struct cvmx_lmcx_tro_ctl_s {
2747#ifdef __BIG_ENDIAN_BITFIELD
2748 uint64_t reserved_33_63:31;
2749 uint64_t rclk_cnt:32;
2750 uint64_t treset:1;
2751#else
2752 uint64_t treset:1;
2753 uint64_t rclk_cnt:32;
2754 uint64_t reserved_33_63:31;
2755#endif
2756 } s;
2757};
2758
2759union cvmx_lmcx_tro_stat {
2760 uint64_t u64;
2761 struct cvmx_lmcx_tro_stat_s {
2762#ifdef __BIG_ENDIAN_BITFIELD
2763 uint64_t reserved_32_63:32;
2764 uint64_t ring_cnt:32;
2765#else
2766 uint64_t ring_cnt:32;
2767 uint64_t reserved_32_63:32;
2768#endif
2769 } s;
2770};
2771
2772union cvmx_lmcx_wlevel_ctl {
2773 uint64_t u64;
2774 struct cvmx_lmcx_wlevel_ctl_s {
2775#ifdef __BIG_ENDIAN_BITFIELD
2776 uint64_t reserved_22_63:42;
2777 uint64_t rtt_nom:3;
2778 uint64_t bitmask:8;
2779 uint64_t or_dis:1;
2780 uint64_t sset:1;
2781 uint64_t lanemask:9;
2782#else
2783 uint64_t lanemask:9;
2784 uint64_t sset:1;
2785 uint64_t or_dis:1;
2786 uint64_t bitmask:8;
2787 uint64_t rtt_nom:3;
2788 uint64_t reserved_22_63:42;
2789#endif
2790 } s;
2791 struct cvmx_lmcx_wlevel_ctl_cn63xxp1 {
2792#ifdef __BIG_ENDIAN_BITFIELD
2793 uint64_t reserved_10_63:54;
2794 uint64_t sset:1;
2795 uint64_t lanemask:9;
2796#else
2797 uint64_t lanemask:9;
2798 uint64_t sset:1;
2799 uint64_t reserved_10_63:54;
2800#endif
2801 } cn63xxp1;
2802};
2803
2804union cvmx_lmcx_wlevel_dbg {
2805 uint64_t u64;
2806 struct cvmx_lmcx_wlevel_dbg_s {
2807#ifdef __BIG_ENDIAN_BITFIELD
2808 uint64_t reserved_12_63:52;
2809 uint64_t bitmask:8;
2810 uint64_t byte:4;
2811#else
2812 uint64_t byte:4;
2813 uint64_t bitmask:8;
2814 uint64_t reserved_12_63:52;
2815#endif
2816 } s;
2817};
2818
2819union cvmx_lmcx_wlevel_rankx {
2820 uint64_t u64;
2821 struct cvmx_lmcx_wlevel_rankx_s {
2822#ifdef __BIG_ENDIAN_BITFIELD
2823 uint64_t reserved_47_63:17;
2824 uint64_t status:2;
2825 uint64_t byte8:5;
2826 uint64_t byte7:5;
2827 uint64_t byte6:5;
2828 uint64_t byte5:5;
2829 uint64_t byte4:5;
2830 uint64_t byte3:5;
2831 uint64_t byte2:5;
2832 uint64_t byte1:5;
2833 uint64_t byte0:5;
2834#else
2835 uint64_t byte0:5;
2836 uint64_t byte1:5;
2837 uint64_t byte2:5;
2838 uint64_t byte3:5;
2839 uint64_t byte4:5;
2840 uint64_t byte5:5;
2841 uint64_t byte6:5;
2842 uint64_t byte7:5;
2843 uint64_t byte8:5;
2844 uint64_t status:2;
2845 uint64_t reserved_47_63:17;
2846#endif
2847 } s;
2848};
2849
2850union cvmx_lmcx_wodt_ctl0 {
2851 uint64_t u64;
2852 struct cvmx_lmcx_wodt_ctl0_s {
2853#ifdef __BIG_ENDIAN_BITFIELD
2854 uint64_t reserved_0_63:64;
2855#else
2856 uint64_t reserved_0_63:64;
2857#endif
2858 } s;
2859 struct cvmx_lmcx_wodt_ctl0_cn30xx {
2860#ifdef __BIG_ENDIAN_BITFIELD
2861 uint64_t reserved_32_63:32;
2862 uint64_t wodt_d1_r1:8;
2863 uint64_t wodt_d1_r0:8;
2864 uint64_t wodt_d0_r1:8;
2865 uint64_t wodt_d0_r0:8;
2866#else
2867 uint64_t wodt_d0_r0:8;
2868 uint64_t wodt_d0_r1:8;
2869 uint64_t wodt_d1_r0:8;
2870 uint64_t wodt_d1_r1:8;
2871 uint64_t reserved_32_63:32;
2872#endif
2873 } cn30xx;
2874 struct cvmx_lmcx_wodt_ctl0_cn38xx {
2875#ifdef __BIG_ENDIAN_BITFIELD
2876 uint64_t reserved_32_63:32;
2877 uint64_t wodt_hi3:4;
2878 uint64_t wodt_hi2:4;
2879 uint64_t wodt_hi1:4;
2880 uint64_t wodt_hi0:4;
2881 uint64_t wodt_lo3:4;
2882 uint64_t wodt_lo2:4;
2883 uint64_t wodt_lo1:4;
2884 uint64_t wodt_lo0:4;
2885#else
2886 uint64_t wodt_lo0:4;
2887 uint64_t wodt_lo1:4;
2888 uint64_t wodt_lo2:4;
2889 uint64_t wodt_lo3:4;
2890 uint64_t wodt_hi0:4;
2891 uint64_t wodt_hi1:4;
2892 uint64_t wodt_hi2:4;
2893 uint64_t wodt_hi3:4;
2894 uint64_t reserved_32_63:32;
2895#endif
2896 } cn38xx;
2897};
2898
2899union cvmx_lmcx_wodt_ctl1 {
2900 uint64_t u64;
2901 struct cvmx_lmcx_wodt_ctl1_s {
2902#ifdef __BIG_ENDIAN_BITFIELD
2903 uint64_t reserved_32_63:32;
2904 uint64_t wodt_d3_r1:8;
2905 uint64_t wodt_d3_r0:8;
2906 uint64_t wodt_d2_r1:8;
2907 uint64_t wodt_d2_r0:8;
2908#else
2909 uint64_t wodt_d2_r0:8;
2910 uint64_t wodt_d2_r1:8;
2911 uint64_t wodt_d3_r0:8;
2912 uint64_t wodt_d3_r1:8;
2913 uint64_t reserved_32_63:32;
2914#endif
2915 } s;
2916};
2917
2918union cvmx_lmcx_wodt_mask {
2919 uint64_t u64;
2920 struct cvmx_lmcx_wodt_mask_s {
2921#ifdef __BIG_ENDIAN_BITFIELD
2922 uint64_t wodt_d3_r1:8;
2923 uint64_t wodt_d3_r0:8;
2924 uint64_t wodt_d2_r1:8;
2925 uint64_t wodt_d2_r0:8;
2926 uint64_t wodt_d1_r1:8;
2927 uint64_t wodt_d1_r0:8;
2928 uint64_t wodt_d0_r1:8;
2929 uint64_t wodt_d0_r0:8;
2930#else
2931 uint64_t wodt_d0_r0:8;
2932 uint64_t wodt_d0_r1:8;
2933 uint64_t wodt_d1_r0:8;
2934 uint64_t wodt_d1_r1:8;
2935 uint64_t wodt_d2_r0:8;
2936 uint64_t wodt_d2_r1:8;
2937 uint64_t wodt_d3_r0:8;
2938 uint64_t wodt_d3_r1:8;
2939#endif
2940 } s;
2941};
2942
2943#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-mio-defs.h b/arch/mips/include/asm/octeon/cvmx-mio-defs.h
new file mode 100644
index 000000000..4ad95d040
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-mio-defs.h
@@ -0,0 +1,4396 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_MIO_DEFS_H__
29#define __CVMX_MIO_DEFS_H__
30
31#define CVMX_MIO_BOOT_BIST_STAT (CVMX_ADD_IO_SEG(0x00011800000000F8ull))
32#define CVMX_MIO_BOOT_COMP (CVMX_ADD_IO_SEG(0x00011800000000B8ull))
33#define CVMX_MIO_BOOT_DMA_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001180000000100ull) + ((offset) & 3) * 8)
34#define CVMX_MIO_BOOT_DMA_INTX(offset) (CVMX_ADD_IO_SEG(0x0001180000000138ull) + ((offset) & 3) * 8)
35#define CVMX_MIO_BOOT_DMA_INT_ENX(offset) (CVMX_ADD_IO_SEG(0x0001180000000150ull) + ((offset) & 3) * 8)
36#define CVMX_MIO_BOOT_DMA_TIMX(offset) (CVMX_ADD_IO_SEG(0x0001180000000120ull) + ((offset) & 3) * 8)
37#define CVMX_MIO_BOOT_ERR (CVMX_ADD_IO_SEG(0x00011800000000A0ull))
38#define CVMX_MIO_BOOT_INT (CVMX_ADD_IO_SEG(0x00011800000000A8ull))
39#define CVMX_MIO_BOOT_LOC_ADR (CVMX_ADD_IO_SEG(0x0001180000000090ull))
40#define CVMX_MIO_BOOT_LOC_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001180000000080ull) + ((offset) & 1) * 8)
41#define CVMX_MIO_BOOT_LOC_DAT (CVMX_ADD_IO_SEG(0x0001180000000098ull))
42#define CVMX_MIO_BOOT_PIN_DEFS (CVMX_ADD_IO_SEG(0x00011800000000C0ull))
43#define CVMX_MIO_BOOT_REG_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001180000000000ull) + ((offset) & 7) * 8)
44#define CVMX_MIO_BOOT_REG_TIMX(offset) (CVMX_ADD_IO_SEG(0x0001180000000040ull) + ((offset) & 7) * 8)
45#define CVMX_MIO_BOOT_THR (CVMX_ADD_IO_SEG(0x00011800000000B0ull))
46#define CVMX_MIO_EMM_BUF_DAT (CVMX_ADD_IO_SEG(0x00011800000020E8ull))
47#define CVMX_MIO_EMM_BUF_IDX (CVMX_ADD_IO_SEG(0x00011800000020E0ull))
48#define CVMX_MIO_EMM_CFG (CVMX_ADD_IO_SEG(0x0001180000002000ull))
49#define CVMX_MIO_EMM_CMD (CVMX_ADD_IO_SEG(0x0001180000002058ull))
50#define CVMX_MIO_EMM_DMA (CVMX_ADD_IO_SEG(0x0001180000002050ull))
51#define CVMX_MIO_EMM_INT (CVMX_ADD_IO_SEG(0x0001180000002078ull))
52#define CVMX_MIO_EMM_INT_EN (CVMX_ADD_IO_SEG(0x0001180000002080ull))
53#define CVMX_MIO_EMM_MODEX(offset) (CVMX_ADD_IO_SEG(0x0001180000002008ull) + ((offset) & 3) * 8)
54#define CVMX_MIO_EMM_RCA (CVMX_ADD_IO_SEG(0x00011800000020A0ull))
55#define CVMX_MIO_EMM_RSP_HI (CVMX_ADD_IO_SEG(0x0001180000002070ull))
56#define CVMX_MIO_EMM_RSP_LO (CVMX_ADD_IO_SEG(0x0001180000002068ull))
57#define CVMX_MIO_EMM_RSP_STS (CVMX_ADD_IO_SEG(0x0001180000002060ull))
58#define CVMX_MIO_EMM_SAMPLE (CVMX_ADD_IO_SEG(0x0001180000002090ull))
59#define CVMX_MIO_EMM_STS_MASK (CVMX_ADD_IO_SEG(0x0001180000002098ull))
60#define CVMX_MIO_EMM_SWITCH (CVMX_ADD_IO_SEG(0x0001180000002048ull))
61#define CVMX_MIO_EMM_WDOG (CVMX_ADD_IO_SEG(0x0001180000002088ull))
62#define CVMX_MIO_FUS_BNK_DATX(offset) (CVMX_ADD_IO_SEG(0x0001180000001520ull) + ((offset) & 3) * 8)
63#define CVMX_MIO_FUS_DAT0 (CVMX_ADD_IO_SEG(0x0001180000001400ull))
64#define CVMX_MIO_FUS_DAT1 (CVMX_ADD_IO_SEG(0x0001180000001408ull))
65#define CVMX_MIO_FUS_DAT2 (CVMX_ADD_IO_SEG(0x0001180000001410ull))
66#define CVMX_MIO_FUS_DAT3 (CVMX_ADD_IO_SEG(0x0001180000001418ull))
67#define CVMX_MIO_FUS_EMA (CVMX_ADD_IO_SEG(0x0001180000001550ull))
68#define CVMX_MIO_FUS_PDF (CVMX_ADD_IO_SEG(0x0001180000001420ull))
69#define CVMX_MIO_FUS_PLL (CVMX_ADD_IO_SEG(0x0001180000001580ull))
70#define CVMX_MIO_FUS_PROG (CVMX_ADD_IO_SEG(0x0001180000001510ull))
71#define CVMX_MIO_FUS_PROG_TIMES (CVMX_ADD_IO_SEG(0x0001180000001518ull))
72#define CVMX_MIO_FUS_RCMD (CVMX_ADD_IO_SEG(0x0001180000001500ull))
73#define CVMX_MIO_FUS_READ_TIMES (CVMX_ADD_IO_SEG(0x0001180000001570ull))
74#define CVMX_MIO_FUS_REPAIR_RES0 (CVMX_ADD_IO_SEG(0x0001180000001558ull))
75#define CVMX_MIO_FUS_REPAIR_RES1 (CVMX_ADD_IO_SEG(0x0001180000001560ull))
76#define CVMX_MIO_FUS_REPAIR_RES2 (CVMX_ADD_IO_SEG(0x0001180000001568ull))
77#define CVMX_MIO_FUS_SPR_REPAIR_RES (CVMX_ADD_IO_SEG(0x0001180000001548ull))
78#define CVMX_MIO_FUS_SPR_REPAIR_SUM (CVMX_ADD_IO_SEG(0x0001180000001540ull))
79#define CVMX_MIO_FUS_TGG (CVMX_ADD_IO_SEG(0x0001180000001428ull))
80#define CVMX_MIO_FUS_UNLOCK (CVMX_ADD_IO_SEG(0x0001180000001578ull))
81#define CVMX_MIO_FUS_WADR (CVMX_ADD_IO_SEG(0x0001180000001508ull))
82#define CVMX_MIO_GPIO_COMP (CVMX_ADD_IO_SEG(0x00011800000000C8ull))
83#define CVMX_MIO_NDF_DMA_CFG (CVMX_ADD_IO_SEG(0x0001180000000168ull))
84#define CVMX_MIO_NDF_DMA_INT (CVMX_ADD_IO_SEG(0x0001180000000170ull))
85#define CVMX_MIO_NDF_DMA_INT_EN (CVMX_ADD_IO_SEG(0x0001180000000178ull))
86#define CVMX_MIO_PLL_CTL (CVMX_ADD_IO_SEG(0x0001180000001448ull))
87#define CVMX_MIO_PLL_SETTING (CVMX_ADD_IO_SEG(0x0001180000001440ull))
88#define CVMX_MIO_PTP_CKOUT_HI_INCR (CVMX_ADD_IO_SEG(0x0001070000000F40ull))
89#define CVMX_MIO_PTP_CKOUT_LO_INCR (CVMX_ADD_IO_SEG(0x0001070000000F48ull))
90#define CVMX_MIO_PTP_CKOUT_THRESH_HI (CVMX_ADD_IO_SEG(0x0001070000000F38ull))
91#define CVMX_MIO_PTP_CKOUT_THRESH_LO (CVMX_ADD_IO_SEG(0x0001070000000F30ull))
92#define CVMX_MIO_PTP_CLOCK_CFG (CVMX_ADD_IO_SEG(0x0001070000000F00ull))
93#define CVMX_MIO_PTP_CLOCK_COMP (CVMX_ADD_IO_SEG(0x0001070000000F18ull))
94#define CVMX_MIO_PTP_CLOCK_HI (CVMX_ADD_IO_SEG(0x0001070000000F10ull))
95#define CVMX_MIO_PTP_CLOCK_LO (CVMX_ADD_IO_SEG(0x0001070000000F08ull))
96#define CVMX_MIO_PTP_EVT_CNT (CVMX_ADD_IO_SEG(0x0001070000000F28ull))
97#define CVMX_MIO_PTP_PHY_1PPS_IN (CVMX_ADD_IO_SEG(0x0001070000000F70ull))
98#define CVMX_MIO_PTP_PPS_HI_INCR (CVMX_ADD_IO_SEG(0x0001070000000F60ull))
99#define CVMX_MIO_PTP_PPS_LO_INCR (CVMX_ADD_IO_SEG(0x0001070000000F68ull))
100#define CVMX_MIO_PTP_PPS_THRESH_HI (CVMX_ADD_IO_SEG(0x0001070000000F58ull))
101#define CVMX_MIO_PTP_PPS_THRESH_LO (CVMX_ADD_IO_SEG(0x0001070000000F50ull))
102#define CVMX_MIO_PTP_TIMESTAMP (CVMX_ADD_IO_SEG(0x0001070000000F20ull))
103#define CVMX_MIO_QLMX_CFG(offset) (CVMX_ADD_IO_SEG(0x0001180000001590ull) + ((offset) & 7) * 8)
104#define CVMX_MIO_RST_BOOT (CVMX_ADD_IO_SEG(0x0001180000001600ull))
105#define CVMX_MIO_RST_CFG (CVMX_ADD_IO_SEG(0x0001180000001610ull))
106#define CVMX_MIO_RST_CKILL (CVMX_ADD_IO_SEG(0x0001180000001638ull))
107#define CVMX_MIO_RST_CNTLX(offset) (CVMX_ADD_IO_SEG(0x0001180000001648ull) + ((offset) & 3) * 8)
108#define CVMX_MIO_RST_CTLX(offset) (CVMX_ADD_IO_SEG(0x0001180000001618ull) + ((offset) & 1) * 8)
109#define CVMX_MIO_RST_DELAY (CVMX_ADD_IO_SEG(0x0001180000001608ull))
110#define CVMX_MIO_RST_INT (CVMX_ADD_IO_SEG(0x0001180000001628ull))
111#define CVMX_MIO_RST_INT_EN (CVMX_ADD_IO_SEG(0x0001180000001630ull))
112#define CVMX_MIO_TWSX_INT(offset) (CVMX_ADD_IO_SEG(0x0001180000001010ull) + ((offset) & 1) * 512)
113#define CVMX_MIO_TWSX_SW_TWSI(offset) (CVMX_ADD_IO_SEG(0x0001180000001000ull) + ((offset) & 1) * 512)
114#define CVMX_MIO_TWSX_SW_TWSI_EXT(offset) (CVMX_ADD_IO_SEG(0x0001180000001018ull) + ((offset) & 1) * 512)
115#define CVMX_MIO_TWSX_TWSI_SW(offset) (CVMX_ADD_IO_SEG(0x0001180000001008ull) + ((offset) & 1) * 512)
116#define CVMX_MIO_UART2_DLH (CVMX_ADD_IO_SEG(0x0001180000000488ull))
117#define CVMX_MIO_UART2_DLL (CVMX_ADD_IO_SEG(0x0001180000000480ull))
118#define CVMX_MIO_UART2_FAR (CVMX_ADD_IO_SEG(0x0001180000000520ull))
119#define CVMX_MIO_UART2_FCR (CVMX_ADD_IO_SEG(0x0001180000000450ull))
120#define CVMX_MIO_UART2_HTX (CVMX_ADD_IO_SEG(0x0001180000000708ull))
121#define CVMX_MIO_UART2_IER (CVMX_ADD_IO_SEG(0x0001180000000408ull))
122#define CVMX_MIO_UART2_IIR (CVMX_ADD_IO_SEG(0x0001180000000410ull))
123#define CVMX_MIO_UART2_LCR (CVMX_ADD_IO_SEG(0x0001180000000418ull))
124#define CVMX_MIO_UART2_LSR (CVMX_ADD_IO_SEG(0x0001180000000428ull))
125#define CVMX_MIO_UART2_MCR (CVMX_ADD_IO_SEG(0x0001180000000420ull))
126#define CVMX_MIO_UART2_MSR (CVMX_ADD_IO_SEG(0x0001180000000430ull))
127#define CVMX_MIO_UART2_RBR (CVMX_ADD_IO_SEG(0x0001180000000400ull))
128#define CVMX_MIO_UART2_RFL (CVMX_ADD_IO_SEG(0x0001180000000608ull))
129#define CVMX_MIO_UART2_RFW (CVMX_ADD_IO_SEG(0x0001180000000530ull))
130#define CVMX_MIO_UART2_SBCR (CVMX_ADD_IO_SEG(0x0001180000000620ull))
131#define CVMX_MIO_UART2_SCR (CVMX_ADD_IO_SEG(0x0001180000000438ull))
132#define CVMX_MIO_UART2_SFE (CVMX_ADD_IO_SEG(0x0001180000000630ull))
133#define CVMX_MIO_UART2_SRR (CVMX_ADD_IO_SEG(0x0001180000000610ull))
134#define CVMX_MIO_UART2_SRT (CVMX_ADD_IO_SEG(0x0001180000000638ull))
135#define CVMX_MIO_UART2_SRTS (CVMX_ADD_IO_SEG(0x0001180000000618ull))
136#define CVMX_MIO_UART2_STT (CVMX_ADD_IO_SEG(0x0001180000000700ull))
137#define CVMX_MIO_UART2_TFL (CVMX_ADD_IO_SEG(0x0001180000000600ull))
138#define CVMX_MIO_UART2_TFR (CVMX_ADD_IO_SEG(0x0001180000000528ull))
139#define CVMX_MIO_UART2_THR (CVMX_ADD_IO_SEG(0x0001180000000440ull))
140#define CVMX_MIO_UART2_USR (CVMX_ADD_IO_SEG(0x0001180000000538ull))
141#define CVMX_MIO_UARTX_DLH(offset) (CVMX_ADD_IO_SEG(0x0001180000000888ull) + ((offset) & 1) * 1024)
142#define CVMX_MIO_UARTX_DLL(offset) (CVMX_ADD_IO_SEG(0x0001180000000880ull) + ((offset) & 1) * 1024)
143#define CVMX_MIO_UARTX_FAR(offset) (CVMX_ADD_IO_SEG(0x0001180000000920ull) + ((offset) & 1) * 1024)
144#define CVMX_MIO_UARTX_FCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000850ull) + ((offset) & 1) * 1024)
145#define CVMX_MIO_UARTX_HTX(offset) (CVMX_ADD_IO_SEG(0x0001180000000B08ull) + ((offset) & 1) * 1024)
146#define CVMX_MIO_UARTX_IER(offset) (CVMX_ADD_IO_SEG(0x0001180000000808ull) + ((offset) & 1) * 1024)
147#define CVMX_MIO_UARTX_IIR(offset) (CVMX_ADD_IO_SEG(0x0001180000000810ull) + ((offset) & 1) * 1024)
148#define CVMX_MIO_UARTX_LCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000818ull) + ((offset) & 1) * 1024)
149#define CVMX_MIO_UARTX_LSR(offset) (CVMX_ADD_IO_SEG(0x0001180000000828ull) + ((offset) & 1) * 1024)
150#define CVMX_MIO_UARTX_MCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000820ull) + ((offset) & 1) * 1024)
151#define CVMX_MIO_UARTX_MSR(offset) (CVMX_ADD_IO_SEG(0x0001180000000830ull) + ((offset) & 1) * 1024)
152#define CVMX_MIO_UARTX_RBR(offset) (CVMX_ADD_IO_SEG(0x0001180000000800ull) + ((offset) & 1) * 1024)
153#define CVMX_MIO_UARTX_RFL(offset) (CVMX_ADD_IO_SEG(0x0001180000000A08ull) + ((offset) & 1) * 1024)
154#define CVMX_MIO_UARTX_RFW(offset) (CVMX_ADD_IO_SEG(0x0001180000000930ull) + ((offset) & 1) * 1024)
155#define CVMX_MIO_UARTX_SBCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000A20ull) + ((offset) & 1) * 1024)
156#define CVMX_MIO_UARTX_SCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000838ull) + ((offset) & 1) * 1024)
157#define CVMX_MIO_UARTX_SFE(offset) (CVMX_ADD_IO_SEG(0x0001180000000A30ull) + ((offset) & 1) * 1024)
158#define CVMX_MIO_UARTX_SRR(offset) (CVMX_ADD_IO_SEG(0x0001180000000A10ull) + ((offset) & 1) * 1024)
159#define CVMX_MIO_UARTX_SRT(offset) (CVMX_ADD_IO_SEG(0x0001180000000A38ull) + ((offset) & 1) * 1024)
160#define CVMX_MIO_UARTX_SRTS(offset) (CVMX_ADD_IO_SEG(0x0001180000000A18ull) + ((offset) & 1) * 1024)
161#define CVMX_MIO_UARTX_STT(offset) (CVMX_ADD_IO_SEG(0x0001180000000B00ull) + ((offset) & 1) * 1024)
162#define CVMX_MIO_UARTX_TFL(offset) (CVMX_ADD_IO_SEG(0x0001180000000A00ull) + ((offset) & 1) * 1024)
163#define CVMX_MIO_UARTX_TFR(offset) (CVMX_ADD_IO_SEG(0x0001180000000928ull) + ((offset) & 1) * 1024)
164#define CVMX_MIO_UARTX_THR(offset) (CVMX_ADD_IO_SEG(0x0001180000000840ull) + ((offset) & 1) * 1024)
165#define CVMX_MIO_UARTX_USR(offset) (CVMX_ADD_IO_SEG(0x0001180000000938ull) + ((offset) & 1) * 1024)
166
167union cvmx_mio_boot_bist_stat {
168 uint64_t u64;
169 struct cvmx_mio_boot_bist_stat_s {
170#ifdef __BIG_ENDIAN_BITFIELD
171 uint64_t reserved_0_63:64;
172#else
173 uint64_t reserved_0_63:64;
174#endif
175 } s;
176 struct cvmx_mio_boot_bist_stat_cn30xx {
177#ifdef __BIG_ENDIAN_BITFIELD
178 uint64_t reserved_4_63:60;
179 uint64_t ncbo_1:1;
180 uint64_t ncbo_0:1;
181 uint64_t loc:1;
182 uint64_t ncbi:1;
183#else
184 uint64_t ncbi:1;
185 uint64_t loc:1;
186 uint64_t ncbo_0:1;
187 uint64_t ncbo_1:1;
188 uint64_t reserved_4_63:60;
189#endif
190 } cn30xx;
191 struct cvmx_mio_boot_bist_stat_cn38xx {
192#ifdef __BIG_ENDIAN_BITFIELD
193 uint64_t reserved_3_63:61;
194 uint64_t ncbo_0:1;
195 uint64_t loc:1;
196 uint64_t ncbi:1;
197#else
198 uint64_t ncbi:1;
199 uint64_t loc:1;
200 uint64_t ncbo_0:1;
201 uint64_t reserved_3_63:61;
202#endif
203 } cn38xx;
204 struct cvmx_mio_boot_bist_stat_cn50xx {
205#ifdef __BIG_ENDIAN_BITFIELD
206 uint64_t reserved_6_63:58;
207 uint64_t pcm_1:1;
208 uint64_t pcm_0:1;
209 uint64_t ncbo_1:1;
210 uint64_t ncbo_0:1;
211 uint64_t loc:1;
212 uint64_t ncbi:1;
213#else
214 uint64_t ncbi:1;
215 uint64_t loc:1;
216 uint64_t ncbo_0:1;
217 uint64_t ncbo_1:1;
218 uint64_t pcm_0:1;
219 uint64_t pcm_1:1;
220 uint64_t reserved_6_63:58;
221#endif
222 } cn50xx;
223 struct cvmx_mio_boot_bist_stat_cn52xx {
224#ifdef __BIG_ENDIAN_BITFIELD
225 uint64_t reserved_6_63:58;
226 uint64_t ndf:2;
227 uint64_t ncbo_0:1;
228 uint64_t dma:1;
229 uint64_t loc:1;
230 uint64_t ncbi:1;
231#else
232 uint64_t ncbi:1;
233 uint64_t loc:1;
234 uint64_t dma:1;
235 uint64_t ncbo_0:1;
236 uint64_t ndf:2;
237 uint64_t reserved_6_63:58;
238#endif
239 } cn52xx;
240 struct cvmx_mio_boot_bist_stat_cn52xxp1 {
241#ifdef __BIG_ENDIAN_BITFIELD
242 uint64_t reserved_4_63:60;
243 uint64_t ncbo_0:1;
244 uint64_t dma:1;
245 uint64_t loc:1;
246 uint64_t ncbi:1;
247#else
248 uint64_t ncbi:1;
249 uint64_t loc:1;
250 uint64_t dma:1;
251 uint64_t ncbo_0:1;
252 uint64_t reserved_4_63:60;
253#endif
254 } cn52xxp1;
255 struct cvmx_mio_boot_bist_stat_cn61xx {
256#ifdef __BIG_ENDIAN_BITFIELD
257 uint64_t reserved_12_63:52;
258 uint64_t stat:12;
259#else
260 uint64_t stat:12;
261 uint64_t reserved_12_63:52;
262#endif
263 } cn61xx;
264 struct cvmx_mio_boot_bist_stat_cn63xx {
265#ifdef __BIG_ENDIAN_BITFIELD
266 uint64_t reserved_9_63:55;
267 uint64_t stat:9;
268#else
269 uint64_t stat:9;
270 uint64_t reserved_9_63:55;
271#endif
272 } cn63xx;
273 struct cvmx_mio_boot_bist_stat_cn66xx {
274#ifdef __BIG_ENDIAN_BITFIELD
275 uint64_t reserved_10_63:54;
276 uint64_t stat:10;
277#else
278 uint64_t stat:10;
279 uint64_t reserved_10_63:54;
280#endif
281 } cn66xx;
282};
283
284union cvmx_mio_boot_comp {
285 uint64_t u64;
286 struct cvmx_mio_boot_comp_s {
287#ifdef __BIG_ENDIAN_BITFIELD
288 uint64_t reserved_0_63:64;
289#else
290 uint64_t reserved_0_63:64;
291#endif
292 } s;
293 struct cvmx_mio_boot_comp_cn50xx {
294#ifdef __BIG_ENDIAN_BITFIELD
295 uint64_t reserved_10_63:54;
296 uint64_t pctl:5;
297 uint64_t nctl:5;
298#else
299 uint64_t nctl:5;
300 uint64_t pctl:5;
301 uint64_t reserved_10_63:54;
302#endif
303 } cn50xx;
304 struct cvmx_mio_boot_comp_cn61xx {
305#ifdef __BIG_ENDIAN_BITFIELD
306 uint64_t reserved_12_63:52;
307 uint64_t pctl:6;
308 uint64_t nctl:6;
309#else
310 uint64_t nctl:6;
311 uint64_t pctl:6;
312 uint64_t reserved_12_63:52;
313#endif
314 } cn61xx;
315};
316
317union cvmx_mio_boot_dma_cfgx {
318 uint64_t u64;
319 struct cvmx_mio_boot_dma_cfgx_s {
320#ifdef __BIG_ENDIAN_BITFIELD
321 uint64_t en:1;
322 uint64_t rw:1;
323 uint64_t clr:1;
324 uint64_t reserved_60_60:1;
325 uint64_t swap32:1;
326 uint64_t swap16:1;
327 uint64_t swap8:1;
328 uint64_t endian:1;
329 uint64_t size:20;
330 uint64_t adr:36;
331#else
332 uint64_t adr:36;
333 uint64_t size:20;
334 uint64_t endian:1;
335 uint64_t swap8:1;
336 uint64_t swap16:1;
337 uint64_t swap32:1;
338 uint64_t reserved_60_60:1;
339 uint64_t clr:1;
340 uint64_t rw:1;
341 uint64_t en:1;
342#endif
343 } s;
344};
345
346union cvmx_mio_boot_dma_intx {
347 uint64_t u64;
348 struct cvmx_mio_boot_dma_intx_s {
349#ifdef __BIG_ENDIAN_BITFIELD
350 uint64_t reserved_2_63:62;
351 uint64_t dmarq:1;
352 uint64_t done:1;
353#else
354 uint64_t done:1;
355 uint64_t dmarq:1;
356 uint64_t reserved_2_63:62;
357#endif
358 } s;
359};
360
361union cvmx_mio_boot_dma_int_enx {
362 uint64_t u64;
363 struct cvmx_mio_boot_dma_int_enx_s {
364#ifdef __BIG_ENDIAN_BITFIELD
365 uint64_t reserved_2_63:62;
366 uint64_t dmarq:1;
367 uint64_t done:1;
368#else
369 uint64_t done:1;
370 uint64_t dmarq:1;
371 uint64_t reserved_2_63:62;
372#endif
373 } s;
374};
375
376union cvmx_mio_boot_dma_timx {
377 uint64_t u64;
378 struct cvmx_mio_boot_dma_timx_s {
379#ifdef __BIG_ENDIAN_BITFIELD
380 uint64_t dmack_pi:1;
381 uint64_t dmarq_pi:1;
382 uint64_t tim_mult:2;
383 uint64_t rd_dly:3;
384 uint64_t ddr:1;
385 uint64_t width:1;
386 uint64_t reserved_48_54:7;
387 uint64_t pause:6;
388 uint64_t dmack_h:6;
389 uint64_t we_n:6;
390 uint64_t we_a:6;
391 uint64_t oe_n:6;
392 uint64_t oe_a:6;
393 uint64_t dmack_s:6;
394 uint64_t dmarq:6;
395#else
396 uint64_t dmarq:6;
397 uint64_t dmack_s:6;
398 uint64_t oe_a:6;
399 uint64_t oe_n:6;
400 uint64_t we_a:6;
401 uint64_t we_n:6;
402 uint64_t dmack_h:6;
403 uint64_t pause:6;
404 uint64_t reserved_48_54:7;
405 uint64_t width:1;
406 uint64_t ddr:1;
407 uint64_t rd_dly:3;
408 uint64_t tim_mult:2;
409 uint64_t dmarq_pi:1;
410 uint64_t dmack_pi:1;
411#endif
412 } s;
413};
414
415union cvmx_mio_boot_err {
416 uint64_t u64;
417 struct cvmx_mio_boot_err_s {
418#ifdef __BIG_ENDIAN_BITFIELD
419 uint64_t reserved_2_63:62;
420 uint64_t wait_err:1;
421 uint64_t adr_err:1;
422#else
423 uint64_t adr_err:1;
424 uint64_t wait_err:1;
425 uint64_t reserved_2_63:62;
426#endif
427 } s;
428};
429
430union cvmx_mio_boot_int {
431 uint64_t u64;
432 struct cvmx_mio_boot_int_s {
433#ifdef __BIG_ENDIAN_BITFIELD
434 uint64_t reserved_2_63:62;
435 uint64_t wait_int:1;
436 uint64_t adr_int:1;
437#else
438 uint64_t adr_int:1;
439 uint64_t wait_int:1;
440 uint64_t reserved_2_63:62;
441#endif
442 } s;
443};
444
445union cvmx_mio_boot_loc_adr {
446 uint64_t u64;
447 struct cvmx_mio_boot_loc_adr_s {
448#ifdef __BIG_ENDIAN_BITFIELD
449 uint64_t reserved_8_63:56;
450 uint64_t adr:5;
451 uint64_t reserved_0_2:3;
452#else
453 uint64_t reserved_0_2:3;
454 uint64_t adr:5;
455 uint64_t reserved_8_63:56;
456#endif
457 } s;
458};
459
460union cvmx_mio_boot_loc_cfgx {
461 uint64_t u64;
462 struct cvmx_mio_boot_loc_cfgx_s {
463#ifdef __BIG_ENDIAN_BITFIELD
464 uint64_t reserved_32_63:32;
465 uint64_t en:1;
466 uint64_t reserved_28_30:3;
467 uint64_t base:25;
468 uint64_t reserved_0_2:3;
469#else
470 uint64_t reserved_0_2:3;
471 uint64_t base:25;
472 uint64_t reserved_28_30:3;
473 uint64_t en:1;
474 uint64_t reserved_32_63:32;
475#endif
476 } s;
477};
478
479union cvmx_mio_boot_loc_dat {
480 uint64_t u64;
481 struct cvmx_mio_boot_loc_dat_s {
482#ifdef __BIG_ENDIAN_BITFIELD
483 uint64_t data:64;
484#else
485 uint64_t data:64;
486#endif
487 } s;
488};
489
490union cvmx_mio_boot_pin_defs {
491 uint64_t u64;
492 struct cvmx_mio_boot_pin_defs_s {
493#ifdef __BIG_ENDIAN_BITFIELD
494 uint64_t reserved_32_63:32;
495 uint64_t user1:16;
496 uint64_t ale:1;
497 uint64_t width:1;
498 uint64_t dmack_p2:1;
499 uint64_t dmack_p1:1;
500 uint64_t dmack_p0:1;
501 uint64_t term:2;
502 uint64_t nand:1;
503 uint64_t user0:8;
504#else
505 uint64_t user0:8;
506 uint64_t nand:1;
507 uint64_t term:2;
508 uint64_t dmack_p0:1;
509 uint64_t dmack_p1:1;
510 uint64_t dmack_p2:1;
511 uint64_t width:1;
512 uint64_t ale:1;
513 uint64_t user1:16;
514 uint64_t reserved_32_63:32;
515#endif
516 } s;
517 struct cvmx_mio_boot_pin_defs_cn52xx {
518#ifdef __BIG_ENDIAN_BITFIELD
519 uint64_t reserved_16_63:48;
520 uint64_t ale:1;
521 uint64_t width:1;
522 uint64_t reserved_13_13:1;
523 uint64_t dmack_p1:1;
524 uint64_t dmack_p0:1;
525 uint64_t term:2;
526 uint64_t nand:1;
527 uint64_t reserved_0_7:8;
528#else
529 uint64_t reserved_0_7:8;
530 uint64_t nand:1;
531 uint64_t term:2;
532 uint64_t dmack_p0:1;
533 uint64_t dmack_p1:1;
534 uint64_t reserved_13_13:1;
535 uint64_t width:1;
536 uint64_t ale:1;
537 uint64_t reserved_16_63:48;
538#endif
539 } cn52xx;
540 struct cvmx_mio_boot_pin_defs_cn56xx {
541#ifdef __BIG_ENDIAN_BITFIELD
542 uint64_t reserved_16_63:48;
543 uint64_t ale:1;
544 uint64_t width:1;
545 uint64_t dmack_p2:1;
546 uint64_t dmack_p1:1;
547 uint64_t dmack_p0:1;
548 uint64_t term:2;
549 uint64_t reserved_0_8:9;
550#else
551 uint64_t reserved_0_8:9;
552 uint64_t term:2;
553 uint64_t dmack_p0:1;
554 uint64_t dmack_p1:1;
555 uint64_t dmack_p2:1;
556 uint64_t width:1;
557 uint64_t ale:1;
558 uint64_t reserved_16_63:48;
559#endif
560 } cn56xx;
561 struct cvmx_mio_boot_pin_defs_cn61xx {
562#ifdef __BIG_ENDIAN_BITFIELD
563 uint64_t reserved_32_63:32;
564 uint64_t user1:16;
565 uint64_t ale:1;
566 uint64_t width:1;
567 uint64_t reserved_13_13:1;
568 uint64_t dmack_p1:1;
569 uint64_t dmack_p0:1;
570 uint64_t term:2;
571 uint64_t nand:1;
572 uint64_t user0:8;
573#else
574 uint64_t user0:8;
575 uint64_t nand:1;
576 uint64_t term:2;
577 uint64_t dmack_p0:1;
578 uint64_t dmack_p1:1;
579 uint64_t reserved_13_13:1;
580 uint64_t width:1;
581 uint64_t ale:1;
582 uint64_t user1:16;
583 uint64_t reserved_32_63:32;
584#endif
585 } cn61xx;
586};
587
588union cvmx_mio_boot_reg_cfgx {
589 uint64_t u64;
590 struct cvmx_mio_boot_reg_cfgx_s {
591#ifdef __BIG_ENDIAN_BITFIELD
592 uint64_t reserved_44_63:20;
593 uint64_t dmack:2;
594 uint64_t tim_mult:2;
595 uint64_t rd_dly:3;
596 uint64_t sam:1;
597 uint64_t we_ext:2;
598 uint64_t oe_ext:2;
599 uint64_t en:1;
600 uint64_t orbit:1;
601 uint64_t ale:1;
602 uint64_t width:1;
603 uint64_t size:12;
604 uint64_t base:16;
605#else
606 uint64_t base:16;
607 uint64_t size:12;
608 uint64_t width:1;
609 uint64_t ale:1;
610 uint64_t orbit:1;
611 uint64_t en:1;
612 uint64_t oe_ext:2;
613 uint64_t we_ext:2;
614 uint64_t sam:1;
615 uint64_t rd_dly:3;
616 uint64_t tim_mult:2;
617 uint64_t dmack:2;
618 uint64_t reserved_44_63:20;
619#endif
620 } s;
621 struct cvmx_mio_boot_reg_cfgx_cn30xx {
622#ifdef __BIG_ENDIAN_BITFIELD
623 uint64_t reserved_37_63:27;
624 uint64_t sam:1;
625 uint64_t we_ext:2;
626 uint64_t oe_ext:2;
627 uint64_t en:1;
628 uint64_t orbit:1;
629 uint64_t ale:1;
630 uint64_t width:1;
631 uint64_t size:12;
632 uint64_t base:16;
633#else
634 uint64_t base:16;
635 uint64_t size:12;
636 uint64_t width:1;
637 uint64_t ale:1;
638 uint64_t orbit:1;
639 uint64_t en:1;
640 uint64_t oe_ext:2;
641 uint64_t we_ext:2;
642 uint64_t sam:1;
643 uint64_t reserved_37_63:27;
644#endif
645 } cn30xx;
646 struct cvmx_mio_boot_reg_cfgx_cn38xx {
647#ifdef __BIG_ENDIAN_BITFIELD
648 uint64_t reserved_32_63:32;
649 uint64_t en:1;
650 uint64_t orbit:1;
651 uint64_t reserved_28_29:2;
652 uint64_t size:12;
653 uint64_t base:16;
654#else
655 uint64_t base:16;
656 uint64_t size:12;
657 uint64_t reserved_28_29:2;
658 uint64_t orbit:1;
659 uint64_t en:1;
660 uint64_t reserved_32_63:32;
661#endif
662 } cn38xx;
663 struct cvmx_mio_boot_reg_cfgx_cn50xx {
664#ifdef __BIG_ENDIAN_BITFIELD
665 uint64_t reserved_42_63:22;
666 uint64_t tim_mult:2;
667 uint64_t rd_dly:3;
668 uint64_t sam:1;
669 uint64_t we_ext:2;
670 uint64_t oe_ext:2;
671 uint64_t en:1;
672 uint64_t orbit:1;
673 uint64_t ale:1;
674 uint64_t width:1;
675 uint64_t size:12;
676 uint64_t base:16;
677#else
678 uint64_t base:16;
679 uint64_t size:12;
680 uint64_t width:1;
681 uint64_t ale:1;
682 uint64_t orbit:1;
683 uint64_t en:1;
684 uint64_t oe_ext:2;
685 uint64_t we_ext:2;
686 uint64_t sam:1;
687 uint64_t rd_dly:3;
688 uint64_t tim_mult:2;
689 uint64_t reserved_42_63:22;
690#endif
691 } cn50xx;
692};
693
694union cvmx_mio_boot_reg_timx {
695 uint64_t u64;
696 struct cvmx_mio_boot_reg_timx_s {
697#ifdef __BIG_ENDIAN_BITFIELD
698 uint64_t pagem:1;
699 uint64_t waitm:1;
700 uint64_t pages:2;
701 uint64_t ale:6;
702 uint64_t page:6;
703 uint64_t wait:6;
704 uint64_t pause:6;
705 uint64_t wr_hld:6;
706 uint64_t rd_hld:6;
707 uint64_t we:6;
708 uint64_t oe:6;
709 uint64_t ce:6;
710 uint64_t adr:6;
711#else
712 uint64_t adr:6;
713 uint64_t ce:6;
714 uint64_t oe:6;
715 uint64_t we:6;
716 uint64_t rd_hld:6;
717 uint64_t wr_hld:6;
718 uint64_t pause:6;
719 uint64_t wait:6;
720 uint64_t page:6;
721 uint64_t ale:6;
722 uint64_t pages:2;
723 uint64_t waitm:1;
724 uint64_t pagem:1;
725#endif
726 } s;
727 struct cvmx_mio_boot_reg_timx_cn38xx {
728#ifdef __BIG_ENDIAN_BITFIELD
729 uint64_t pagem:1;
730 uint64_t waitm:1;
731 uint64_t pages:2;
732 uint64_t reserved_54_59:6;
733 uint64_t page:6;
734 uint64_t wait:6;
735 uint64_t pause:6;
736 uint64_t wr_hld:6;
737 uint64_t rd_hld:6;
738 uint64_t we:6;
739 uint64_t oe:6;
740 uint64_t ce:6;
741 uint64_t adr:6;
742#else
743 uint64_t adr:6;
744 uint64_t ce:6;
745 uint64_t oe:6;
746 uint64_t we:6;
747 uint64_t rd_hld:6;
748 uint64_t wr_hld:6;
749 uint64_t pause:6;
750 uint64_t wait:6;
751 uint64_t page:6;
752 uint64_t reserved_54_59:6;
753 uint64_t pages:2;
754 uint64_t waitm:1;
755 uint64_t pagem:1;
756#endif
757 } cn38xx;
758};
759
760union cvmx_mio_boot_thr {
761 uint64_t u64;
762 struct cvmx_mio_boot_thr_s {
763#ifdef __BIG_ENDIAN_BITFIELD
764 uint64_t reserved_22_63:42;
765 uint64_t dma_thr:6;
766 uint64_t reserved_14_15:2;
767 uint64_t fif_cnt:6;
768 uint64_t reserved_6_7:2;
769 uint64_t fif_thr:6;
770#else
771 uint64_t fif_thr:6;
772 uint64_t reserved_6_7:2;
773 uint64_t fif_cnt:6;
774 uint64_t reserved_14_15:2;
775 uint64_t dma_thr:6;
776 uint64_t reserved_22_63:42;
777#endif
778 } s;
779 struct cvmx_mio_boot_thr_cn30xx {
780#ifdef __BIG_ENDIAN_BITFIELD
781 uint64_t reserved_14_63:50;
782 uint64_t fif_cnt:6;
783 uint64_t reserved_6_7:2;
784 uint64_t fif_thr:6;
785#else
786 uint64_t fif_thr:6;
787 uint64_t reserved_6_7:2;
788 uint64_t fif_cnt:6;
789 uint64_t reserved_14_63:50;
790#endif
791 } cn30xx;
792};
793
794union cvmx_mio_emm_buf_dat {
795 uint64_t u64;
796 struct cvmx_mio_emm_buf_dat_s {
797#ifdef __BIG_ENDIAN_BITFIELD
798 uint64_t dat:64;
799#else
800 uint64_t dat:64;
801#endif
802 } s;
803};
804
805union cvmx_mio_emm_buf_idx {
806 uint64_t u64;
807 struct cvmx_mio_emm_buf_idx_s {
808#ifdef __BIG_ENDIAN_BITFIELD
809 uint64_t reserved_17_63:47;
810 uint64_t inc:1;
811 uint64_t reserved_7_15:9;
812 uint64_t buf_num:1;
813 uint64_t offset:6;
814#else
815 uint64_t offset:6;
816 uint64_t buf_num:1;
817 uint64_t reserved_7_15:9;
818 uint64_t inc:1;
819 uint64_t reserved_17_63:47;
820#endif
821 } s;
822};
823
824union cvmx_mio_emm_cfg {
825 uint64_t u64;
826 struct cvmx_mio_emm_cfg_s {
827#ifdef __BIG_ENDIAN_BITFIELD
828 uint64_t reserved_17_63:47;
829 uint64_t boot_fail:1;
830 uint64_t reserved_4_15:12;
831 uint64_t bus_ena:4;
832#else
833 uint64_t bus_ena:4;
834 uint64_t reserved_4_15:12;
835 uint64_t boot_fail:1;
836 uint64_t reserved_17_63:47;
837#endif
838 } s;
839};
840
841union cvmx_mio_emm_cmd {
842 uint64_t u64;
843 struct cvmx_mio_emm_cmd_s {
844#ifdef __BIG_ENDIAN_BITFIELD
845 uint64_t reserved_62_63:2;
846 uint64_t bus_id:2;
847 uint64_t cmd_val:1;
848 uint64_t reserved_56_58:3;
849 uint64_t dbuf:1;
850 uint64_t offset:6;
851 uint64_t reserved_43_48:6;
852 uint64_t ctype_xor:2;
853 uint64_t rtype_xor:3;
854 uint64_t cmd_idx:6;
855 uint64_t arg:32;
856#else
857 uint64_t arg:32;
858 uint64_t cmd_idx:6;
859 uint64_t rtype_xor:3;
860 uint64_t ctype_xor:2;
861 uint64_t reserved_43_48:6;
862 uint64_t offset:6;
863 uint64_t dbuf:1;
864 uint64_t reserved_56_58:3;
865 uint64_t cmd_val:1;
866 uint64_t bus_id:2;
867 uint64_t reserved_62_63:2;
868#endif
869 } s;
870};
871
872union cvmx_mio_emm_dma {
873 uint64_t u64;
874 struct cvmx_mio_emm_dma_s {
875#ifdef __BIG_ENDIAN_BITFIELD
876 uint64_t reserved_62_63:2;
877 uint64_t bus_id:2;
878 uint64_t dma_val:1;
879 uint64_t sector:1;
880 uint64_t dat_null:1;
881 uint64_t thres:6;
882 uint64_t rel_wr:1;
883 uint64_t rw:1;
884 uint64_t multi:1;
885 uint64_t block_cnt:16;
886 uint64_t card_addr:32;
887#else
888 uint64_t card_addr:32;
889 uint64_t block_cnt:16;
890 uint64_t multi:1;
891 uint64_t rw:1;
892 uint64_t rel_wr:1;
893 uint64_t thres:6;
894 uint64_t dat_null:1;
895 uint64_t sector:1;
896 uint64_t dma_val:1;
897 uint64_t bus_id:2;
898 uint64_t reserved_62_63:2;
899#endif
900 } s;
901};
902
903union cvmx_mio_emm_int {
904 uint64_t u64;
905 struct cvmx_mio_emm_int_s {
906#ifdef __BIG_ENDIAN_BITFIELD
907 uint64_t reserved_7_63:57;
908 uint64_t switch_err:1;
909 uint64_t switch_done:1;
910 uint64_t dma_err:1;
911 uint64_t cmd_err:1;
912 uint64_t dma_done:1;
913 uint64_t cmd_done:1;
914 uint64_t buf_done:1;
915#else
916 uint64_t buf_done:1;
917 uint64_t cmd_done:1;
918 uint64_t dma_done:1;
919 uint64_t cmd_err:1;
920 uint64_t dma_err:1;
921 uint64_t switch_done:1;
922 uint64_t switch_err:1;
923 uint64_t reserved_7_63:57;
924#endif
925 } s;
926};
927
928union cvmx_mio_emm_int_en {
929 uint64_t u64;
930 struct cvmx_mio_emm_int_en_s {
931#ifdef __BIG_ENDIAN_BITFIELD
932 uint64_t reserved_7_63:57;
933 uint64_t switch_err:1;
934 uint64_t switch_done:1;
935 uint64_t dma_err:1;
936 uint64_t cmd_err:1;
937 uint64_t dma_done:1;
938 uint64_t cmd_done:1;
939 uint64_t buf_done:1;
940#else
941 uint64_t buf_done:1;
942 uint64_t cmd_done:1;
943 uint64_t dma_done:1;
944 uint64_t cmd_err:1;
945 uint64_t dma_err:1;
946 uint64_t switch_done:1;
947 uint64_t switch_err:1;
948 uint64_t reserved_7_63:57;
949#endif
950 } s;
951};
952
953union cvmx_mio_emm_modex {
954 uint64_t u64;
955 struct cvmx_mio_emm_modex_s {
956#ifdef __BIG_ENDIAN_BITFIELD
957 uint64_t reserved_49_63:15;
958 uint64_t hs_timing:1;
959 uint64_t reserved_43_47:5;
960 uint64_t bus_width:3;
961 uint64_t reserved_36_39:4;
962 uint64_t power_class:4;
963 uint64_t clk_hi:16;
964 uint64_t clk_lo:16;
965#else
966 uint64_t clk_lo:16;
967 uint64_t clk_hi:16;
968 uint64_t power_class:4;
969 uint64_t reserved_36_39:4;
970 uint64_t bus_width:3;
971 uint64_t reserved_43_47:5;
972 uint64_t hs_timing:1;
973 uint64_t reserved_49_63:15;
974#endif
975 } s;
976};
977
978union cvmx_mio_emm_rca {
979 uint64_t u64;
980 struct cvmx_mio_emm_rca_s {
981#ifdef __BIG_ENDIAN_BITFIELD
982 uint64_t reserved_16_63:48;
983 uint64_t card_rca:16;
984#else
985 uint64_t card_rca:16;
986 uint64_t reserved_16_63:48;
987#endif
988 } s;
989};
990
991union cvmx_mio_emm_rsp_hi {
992 uint64_t u64;
993 struct cvmx_mio_emm_rsp_hi_s {
994#ifdef __BIG_ENDIAN_BITFIELD
995 uint64_t dat:64;
996#else
997 uint64_t dat:64;
998#endif
999 } s;
1000};
1001
1002union cvmx_mio_emm_rsp_lo {
1003 uint64_t u64;
1004 struct cvmx_mio_emm_rsp_lo_s {
1005#ifdef __BIG_ENDIAN_BITFIELD
1006 uint64_t dat:64;
1007#else
1008 uint64_t dat:64;
1009#endif
1010 } s;
1011};
1012
1013union cvmx_mio_emm_rsp_sts {
1014 uint64_t u64;
1015 struct cvmx_mio_emm_rsp_sts_s {
1016#ifdef __BIG_ENDIAN_BITFIELD
1017 uint64_t reserved_62_63:2;
1018 uint64_t bus_id:2;
1019 uint64_t cmd_val:1;
1020 uint64_t switch_val:1;
1021 uint64_t dma_val:1;
1022 uint64_t dma_pend:1;
1023 uint64_t reserved_29_55:27;
1024 uint64_t dbuf_err:1;
1025 uint64_t reserved_24_27:4;
1026 uint64_t dbuf:1;
1027 uint64_t blk_timeout:1;
1028 uint64_t blk_crc_err:1;
1029 uint64_t rsp_busybit:1;
1030 uint64_t stp_timeout:1;
1031 uint64_t stp_crc_err:1;
1032 uint64_t stp_bad_sts:1;
1033 uint64_t stp_val:1;
1034 uint64_t rsp_timeout:1;
1035 uint64_t rsp_crc_err:1;
1036 uint64_t rsp_bad_sts:1;
1037 uint64_t rsp_val:1;
1038 uint64_t rsp_type:3;
1039 uint64_t cmd_type:2;
1040 uint64_t cmd_idx:6;
1041 uint64_t cmd_done:1;
1042#else
1043 uint64_t cmd_done:1;
1044 uint64_t cmd_idx:6;
1045 uint64_t cmd_type:2;
1046 uint64_t rsp_type:3;
1047 uint64_t rsp_val:1;
1048 uint64_t rsp_bad_sts:1;
1049 uint64_t rsp_crc_err:1;
1050 uint64_t rsp_timeout:1;
1051 uint64_t stp_val:1;
1052 uint64_t stp_bad_sts:1;
1053 uint64_t stp_crc_err:1;
1054 uint64_t stp_timeout:1;
1055 uint64_t rsp_busybit:1;
1056 uint64_t blk_crc_err:1;
1057 uint64_t blk_timeout:1;
1058 uint64_t dbuf:1;
1059 uint64_t reserved_24_27:4;
1060 uint64_t dbuf_err:1;
1061 uint64_t reserved_29_55:27;
1062 uint64_t dma_pend:1;
1063 uint64_t dma_val:1;
1064 uint64_t switch_val:1;
1065 uint64_t cmd_val:1;
1066 uint64_t bus_id:2;
1067 uint64_t reserved_62_63:2;
1068#endif
1069 } s;
1070};
1071
1072union cvmx_mio_emm_sample {
1073 uint64_t u64;
1074 struct cvmx_mio_emm_sample_s {
1075#ifdef __BIG_ENDIAN_BITFIELD
1076 uint64_t reserved_26_63:38;
1077 uint64_t cmd_cnt:10;
1078 uint64_t reserved_10_15:6;
1079 uint64_t dat_cnt:10;
1080#else
1081 uint64_t dat_cnt:10;
1082 uint64_t reserved_10_15:6;
1083 uint64_t cmd_cnt:10;
1084 uint64_t reserved_26_63:38;
1085#endif
1086 } s;
1087};
1088
1089union cvmx_mio_emm_sts_mask {
1090 uint64_t u64;
1091 struct cvmx_mio_emm_sts_mask_s {
1092#ifdef __BIG_ENDIAN_BITFIELD
1093 uint64_t reserved_32_63:32;
1094 uint64_t sts_msk:32;
1095#else
1096 uint64_t sts_msk:32;
1097 uint64_t reserved_32_63:32;
1098#endif
1099 } s;
1100};
1101
1102union cvmx_mio_emm_switch {
1103 uint64_t u64;
1104 struct cvmx_mio_emm_switch_s {
1105#ifdef __BIG_ENDIAN_BITFIELD
1106 uint64_t reserved_62_63:2;
1107 uint64_t bus_id:2;
1108 uint64_t switch_exe:1;
1109 uint64_t switch_err0:1;
1110 uint64_t switch_err1:1;
1111 uint64_t switch_err2:1;
1112 uint64_t reserved_49_55:7;
1113 uint64_t hs_timing:1;
1114 uint64_t reserved_43_47:5;
1115 uint64_t bus_width:3;
1116 uint64_t reserved_36_39:4;
1117 uint64_t power_class:4;
1118 uint64_t clk_hi:16;
1119 uint64_t clk_lo:16;
1120#else
1121 uint64_t clk_lo:16;
1122 uint64_t clk_hi:16;
1123 uint64_t power_class:4;
1124 uint64_t reserved_36_39:4;
1125 uint64_t bus_width:3;
1126 uint64_t reserved_43_47:5;
1127 uint64_t hs_timing:1;
1128 uint64_t reserved_49_55:7;
1129 uint64_t switch_err2:1;
1130 uint64_t switch_err1:1;
1131 uint64_t switch_err0:1;
1132 uint64_t switch_exe:1;
1133 uint64_t bus_id:2;
1134 uint64_t reserved_62_63:2;
1135#endif
1136 } s;
1137};
1138
1139union cvmx_mio_emm_wdog {
1140 uint64_t u64;
1141 struct cvmx_mio_emm_wdog_s {
1142#ifdef __BIG_ENDIAN_BITFIELD
1143 uint64_t reserved_26_63:38;
1144 uint64_t clk_cnt:26;
1145#else
1146 uint64_t clk_cnt:26;
1147 uint64_t reserved_26_63:38;
1148#endif
1149 } s;
1150};
1151
1152union cvmx_mio_fus_bnk_datx {
1153 uint64_t u64;
1154 struct cvmx_mio_fus_bnk_datx_s {
1155#ifdef __BIG_ENDIAN_BITFIELD
1156 uint64_t dat:64;
1157#else
1158 uint64_t dat:64;
1159#endif
1160 } s;
1161};
1162
1163union cvmx_mio_fus_dat0 {
1164 uint64_t u64;
1165 struct cvmx_mio_fus_dat0_s {
1166#ifdef __BIG_ENDIAN_BITFIELD
1167 uint64_t reserved_32_63:32;
1168 uint64_t man_info:32;
1169#else
1170 uint64_t man_info:32;
1171 uint64_t reserved_32_63:32;
1172#endif
1173 } s;
1174};
1175
1176union cvmx_mio_fus_dat1 {
1177 uint64_t u64;
1178 struct cvmx_mio_fus_dat1_s {
1179#ifdef __BIG_ENDIAN_BITFIELD
1180 uint64_t reserved_32_63:32;
1181 uint64_t man_info:32;
1182#else
1183 uint64_t man_info:32;
1184 uint64_t reserved_32_63:32;
1185#endif
1186 } s;
1187};
1188
1189union cvmx_mio_fus_dat2 {
1190 uint64_t u64;
1191 struct cvmx_mio_fus_dat2_s {
1192#ifdef __BIG_ENDIAN_BITFIELD
1193 uint64_t reserved_59_63:5;
1194 uint64_t run_platform:3;
1195 uint64_t gbl_pwr_throttle:8;
1196 uint64_t fus118:1;
1197 uint64_t rom_info:10;
1198 uint64_t power_limit:2;
1199 uint64_t dorm_crypto:1;
1200 uint64_t fus318:1;
1201 uint64_t raid_en:1;
1202 uint64_t reserved_30_31:2;
1203 uint64_t nokasu:1;
1204 uint64_t nodfa_cp2:1;
1205 uint64_t nomul:1;
1206 uint64_t nocrypto:1;
1207 uint64_t rst_sht:1;
1208 uint64_t bist_dis:1;
1209 uint64_t chip_id:8;
1210 uint64_t reserved_0_15:16;
1211#else
1212 uint64_t reserved_0_15:16;
1213 uint64_t chip_id:8;
1214 uint64_t bist_dis:1;
1215 uint64_t rst_sht:1;
1216 uint64_t nocrypto:1;
1217 uint64_t nomul:1;
1218 uint64_t nodfa_cp2:1;
1219 uint64_t nokasu:1;
1220 uint64_t reserved_30_31:2;
1221 uint64_t raid_en:1;
1222 uint64_t fus318:1;
1223 uint64_t dorm_crypto:1;
1224 uint64_t power_limit:2;
1225 uint64_t rom_info:10;
1226 uint64_t fus118:1;
1227 uint64_t gbl_pwr_throttle:8;
1228 uint64_t run_platform:3;
1229 uint64_t reserved_59_63:5;
1230#endif
1231 } s;
1232 struct cvmx_mio_fus_dat2_cn30xx {
1233#ifdef __BIG_ENDIAN_BITFIELD
1234 uint64_t reserved_29_63:35;
1235 uint64_t nodfa_cp2:1;
1236 uint64_t nomul:1;
1237 uint64_t nocrypto:1;
1238 uint64_t rst_sht:1;
1239 uint64_t bist_dis:1;
1240 uint64_t chip_id:8;
1241 uint64_t pll_off:4;
1242 uint64_t reserved_1_11:11;
1243 uint64_t pp_dis:1;
1244#else
1245 uint64_t pp_dis:1;
1246 uint64_t reserved_1_11:11;
1247 uint64_t pll_off:4;
1248 uint64_t chip_id:8;
1249 uint64_t bist_dis:1;
1250 uint64_t rst_sht:1;
1251 uint64_t nocrypto:1;
1252 uint64_t nomul:1;
1253 uint64_t nodfa_cp2:1;
1254 uint64_t reserved_29_63:35;
1255#endif
1256 } cn30xx;
1257 struct cvmx_mio_fus_dat2_cn31xx {
1258#ifdef __BIG_ENDIAN_BITFIELD
1259 uint64_t reserved_29_63:35;
1260 uint64_t nodfa_cp2:1;
1261 uint64_t nomul:1;
1262 uint64_t nocrypto:1;
1263 uint64_t rst_sht:1;
1264 uint64_t bist_dis:1;
1265 uint64_t chip_id:8;
1266 uint64_t pll_off:4;
1267 uint64_t reserved_2_11:10;
1268 uint64_t pp_dis:2;
1269#else
1270 uint64_t pp_dis:2;
1271 uint64_t reserved_2_11:10;
1272 uint64_t pll_off:4;
1273 uint64_t chip_id:8;
1274 uint64_t bist_dis:1;
1275 uint64_t rst_sht:1;
1276 uint64_t nocrypto:1;
1277 uint64_t nomul:1;
1278 uint64_t nodfa_cp2:1;
1279 uint64_t reserved_29_63:35;
1280#endif
1281 } cn31xx;
1282 struct cvmx_mio_fus_dat2_cn38xx {
1283#ifdef __BIG_ENDIAN_BITFIELD
1284 uint64_t reserved_29_63:35;
1285 uint64_t nodfa_cp2:1;
1286 uint64_t nomul:1;
1287 uint64_t nocrypto:1;
1288 uint64_t rst_sht:1;
1289 uint64_t bist_dis:1;
1290 uint64_t chip_id:8;
1291 uint64_t pp_dis:16;
1292#else
1293 uint64_t pp_dis:16;
1294 uint64_t chip_id:8;
1295 uint64_t bist_dis:1;
1296 uint64_t rst_sht:1;
1297 uint64_t nocrypto:1;
1298 uint64_t nomul:1;
1299 uint64_t nodfa_cp2:1;
1300 uint64_t reserved_29_63:35;
1301#endif
1302 } cn38xx;
1303 struct cvmx_mio_fus_dat2_cn50xx {
1304#ifdef __BIG_ENDIAN_BITFIELD
1305 uint64_t reserved_34_63:30;
1306 uint64_t fus318:1;
1307 uint64_t raid_en:1;
1308 uint64_t reserved_30_31:2;
1309 uint64_t nokasu:1;
1310 uint64_t nodfa_cp2:1;
1311 uint64_t nomul:1;
1312 uint64_t nocrypto:1;
1313 uint64_t rst_sht:1;
1314 uint64_t bist_dis:1;
1315 uint64_t chip_id:8;
1316 uint64_t reserved_2_15:14;
1317 uint64_t pp_dis:2;
1318#else
1319 uint64_t pp_dis:2;
1320 uint64_t reserved_2_15:14;
1321 uint64_t chip_id:8;
1322 uint64_t bist_dis:1;
1323 uint64_t rst_sht:1;
1324 uint64_t nocrypto:1;
1325 uint64_t nomul:1;
1326 uint64_t nodfa_cp2:1;
1327 uint64_t nokasu:1;
1328 uint64_t reserved_30_31:2;
1329 uint64_t raid_en:1;
1330 uint64_t fus318:1;
1331 uint64_t reserved_34_63:30;
1332#endif
1333 } cn50xx;
1334 struct cvmx_mio_fus_dat2_cn52xx {
1335#ifdef __BIG_ENDIAN_BITFIELD
1336 uint64_t reserved_34_63:30;
1337 uint64_t fus318:1;
1338 uint64_t raid_en:1;
1339 uint64_t reserved_30_31:2;
1340 uint64_t nokasu:1;
1341 uint64_t nodfa_cp2:1;
1342 uint64_t nomul:1;
1343 uint64_t nocrypto:1;
1344 uint64_t rst_sht:1;
1345 uint64_t bist_dis:1;
1346 uint64_t chip_id:8;
1347 uint64_t reserved_4_15:12;
1348 uint64_t pp_dis:4;
1349#else
1350 uint64_t pp_dis:4;
1351 uint64_t reserved_4_15:12;
1352 uint64_t chip_id:8;
1353 uint64_t bist_dis:1;
1354 uint64_t rst_sht:1;
1355 uint64_t nocrypto:1;
1356 uint64_t nomul:1;
1357 uint64_t nodfa_cp2:1;
1358 uint64_t nokasu:1;
1359 uint64_t reserved_30_31:2;
1360 uint64_t raid_en:1;
1361 uint64_t fus318:1;
1362 uint64_t reserved_34_63:30;
1363#endif
1364 } cn52xx;
1365 struct cvmx_mio_fus_dat2_cn56xx {
1366#ifdef __BIG_ENDIAN_BITFIELD
1367 uint64_t reserved_34_63:30;
1368 uint64_t fus318:1;
1369 uint64_t raid_en:1;
1370 uint64_t reserved_30_31:2;
1371 uint64_t nokasu:1;
1372 uint64_t nodfa_cp2:1;
1373 uint64_t nomul:1;
1374 uint64_t nocrypto:1;
1375 uint64_t rst_sht:1;
1376 uint64_t bist_dis:1;
1377 uint64_t chip_id:8;
1378 uint64_t reserved_12_15:4;
1379 uint64_t pp_dis:12;
1380#else
1381 uint64_t pp_dis:12;
1382 uint64_t reserved_12_15:4;
1383 uint64_t chip_id:8;
1384 uint64_t bist_dis:1;
1385 uint64_t rst_sht:1;
1386 uint64_t nocrypto:1;
1387 uint64_t nomul:1;
1388 uint64_t nodfa_cp2:1;
1389 uint64_t nokasu:1;
1390 uint64_t reserved_30_31:2;
1391 uint64_t raid_en:1;
1392 uint64_t fus318:1;
1393 uint64_t reserved_34_63:30;
1394#endif
1395 } cn56xx;
1396 struct cvmx_mio_fus_dat2_cn58xx {
1397#ifdef __BIG_ENDIAN_BITFIELD
1398 uint64_t reserved_30_63:34;
1399 uint64_t nokasu:1;
1400 uint64_t nodfa_cp2:1;
1401 uint64_t nomul:1;
1402 uint64_t nocrypto:1;
1403 uint64_t rst_sht:1;
1404 uint64_t bist_dis:1;
1405 uint64_t chip_id:8;
1406 uint64_t pp_dis:16;
1407#else
1408 uint64_t pp_dis:16;
1409 uint64_t chip_id:8;
1410 uint64_t bist_dis:1;
1411 uint64_t rst_sht:1;
1412 uint64_t nocrypto:1;
1413 uint64_t nomul:1;
1414 uint64_t nodfa_cp2:1;
1415 uint64_t nokasu:1;
1416 uint64_t reserved_30_63:34;
1417#endif
1418 } cn58xx;
1419 struct cvmx_mio_fus_dat2_cn61xx {
1420#ifdef __BIG_ENDIAN_BITFIELD
1421 uint64_t reserved_48_63:16;
1422 uint64_t fus118:1;
1423 uint64_t rom_info:10;
1424 uint64_t power_limit:2;
1425 uint64_t dorm_crypto:1;
1426 uint64_t fus318:1;
1427 uint64_t raid_en:1;
1428 uint64_t reserved_29_31:3;
1429 uint64_t nodfa_cp2:1;
1430 uint64_t nomul:1;
1431 uint64_t nocrypto:1;
1432 uint64_t reserved_24_25:2;
1433 uint64_t chip_id:8;
1434 uint64_t reserved_4_15:12;
1435 uint64_t pp_dis:4;
1436#else
1437 uint64_t pp_dis:4;
1438 uint64_t reserved_4_15:12;
1439 uint64_t chip_id:8;
1440 uint64_t reserved_24_25:2;
1441 uint64_t nocrypto:1;
1442 uint64_t nomul:1;
1443 uint64_t nodfa_cp2:1;
1444 uint64_t reserved_29_31:3;
1445 uint64_t raid_en:1;
1446 uint64_t fus318:1;
1447 uint64_t dorm_crypto:1;
1448 uint64_t power_limit:2;
1449 uint64_t rom_info:10;
1450 uint64_t fus118:1;
1451 uint64_t reserved_48_63:16;
1452#endif
1453 } cn61xx;
1454 struct cvmx_mio_fus_dat2_cn63xx {
1455#ifdef __BIG_ENDIAN_BITFIELD
1456 uint64_t reserved_35_63:29;
1457 uint64_t dorm_crypto:1;
1458 uint64_t fus318:1;
1459 uint64_t raid_en:1;
1460 uint64_t reserved_29_31:3;
1461 uint64_t nodfa_cp2:1;
1462 uint64_t nomul:1;
1463 uint64_t nocrypto:1;
1464 uint64_t reserved_24_25:2;
1465 uint64_t chip_id:8;
1466 uint64_t reserved_6_15:10;
1467 uint64_t pp_dis:6;
1468#else
1469 uint64_t pp_dis:6;
1470 uint64_t reserved_6_15:10;
1471 uint64_t chip_id:8;
1472 uint64_t reserved_24_25:2;
1473 uint64_t nocrypto:1;
1474 uint64_t nomul:1;
1475 uint64_t nodfa_cp2:1;
1476 uint64_t reserved_29_31:3;
1477 uint64_t raid_en:1;
1478 uint64_t fus318:1;
1479 uint64_t dorm_crypto:1;
1480 uint64_t reserved_35_63:29;
1481#endif
1482 } cn63xx;
1483 struct cvmx_mio_fus_dat2_cn66xx {
1484#ifdef __BIG_ENDIAN_BITFIELD
1485 uint64_t reserved_48_63:16;
1486 uint64_t fus118:1;
1487 uint64_t rom_info:10;
1488 uint64_t power_limit:2;
1489 uint64_t dorm_crypto:1;
1490 uint64_t fus318:1;
1491 uint64_t raid_en:1;
1492 uint64_t reserved_29_31:3;
1493 uint64_t nodfa_cp2:1;
1494 uint64_t nomul:1;
1495 uint64_t nocrypto:1;
1496 uint64_t reserved_24_25:2;
1497 uint64_t chip_id:8;
1498 uint64_t reserved_10_15:6;
1499 uint64_t pp_dis:10;
1500#else
1501 uint64_t pp_dis:10;
1502 uint64_t reserved_10_15:6;
1503 uint64_t chip_id:8;
1504 uint64_t reserved_24_25:2;
1505 uint64_t nocrypto:1;
1506 uint64_t nomul:1;
1507 uint64_t nodfa_cp2:1;
1508 uint64_t reserved_29_31:3;
1509 uint64_t raid_en:1;
1510 uint64_t fus318:1;
1511 uint64_t dorm_crypto:1;
1512 uint64_t power_limit:2;
1513 uint64_t rom_info:10;
1514 uint64_t fus118:1;
1515 uint64_t reserved_48_63:16;
1516#endif
1517 } cn66xx;
1518 struct cvmx_mio_fus_dat2_cn68xx {
1519#ifdef __BIG_ENDIAN_BITFIELD
1520 uint64_t reserved_37_63:27;
1521 uint64_t power_limit:2;
1522 uint64_t dorm_crypto:1;
1523 uint64_t fus318:1;
1524 uint64_t raid_en:1;
1525 uint64_t reserved_29_31:3;
1526 uint64_t nodfa_cp2:1;
1527 uint64_t nomul:1;
1528 uint64_t nocrypto:1;
1529 uint64_t reserved_24_25:2;
1530 uint64_t chip_id:8;
1531 uint64_t reserved_0_15:16;
1532#else
1533 uint64_t reserved_0_15:16;
1534 uint64_t chip_id:8;
1535 uint64_t reserved_24_25:2;
1536 uint64_t nocrypto:1;
1537 uint64_t nomul:1;
1538 uint64_t nodfa_cp2:1;
1539 uint64_t reserved_29_31:3;
1540 uint64_t raid_en:1;
1541 uint64_t fus318:1;
1542 uint64_t dorm_crypto:1;
1543 uint64_t power_limit:2;
1544 uint64_t reserved_37_63:27;
1545#endif
1546 } cn68xx;
1547 struct cvmx_mio_fus_dat2_cn70xx {
1548#ifdef __BIG_ENDIAN_BITFIELD
1549 uint64_t reserved_48_63:16;
1550 uint64_t fus118:1;
1551 uint64_t rom_info:10;
1552 uint64_t power_limit:2;
1553 uint64_t dorm_crypto:1;
1554 uint64_t fus318:1;
1555 uint64_t raid_en:1;
1556 uint64_t reserved_31_29:3;
1557 uint64_t nodfa_cp2:1;
1558 uint64_t nomul:1;
1559 uint64_t nocrypto:1;
1560 uint64_t reserved_25_24:2;
1561 uint64_t chip_id:8;
1562 uint64_t reserved_15_0:16;
1563#else
1564 uint64_t reserved_15_0:16;
1565 uint64_t chip_id:8;
1566 uint64_t reserved_25_24:2;
1567 uint64_t nocrypto:1;
1568 uint64_t nomul:1;
1569 uint64_t nodfa_cp2:1;
1570 uint64_t reserved_31_29:3;
1571 uint64_t raid_en:1;
1572 uint64_t fus318:1;
1573 uint64_t dorm_crypto:1;
1574 uint64_t power_limit:2;
1575 uint64_t rom_info:10;
1576 uint64_t fus118:1;
1577 uint64_t reserved_48_63:16;
1578#endif
1579 } cn70xx;
1580 struct cvmx_mio_fus_dat2_cn73xx {
1581#ifdef __BIG_ENDIAN_BITFIELD
1582 uint64_t reserved_59_63:5;
1583 uint64_t run_platform:3;
1584 uint64_t gbl_pwr_throttle:8;
1585 uint64_t fus118:1;
1586 uint64_t rom_info:10;
1587 uint64_t power_limit:2;
1588 uint64_t dorm_crypto:1;
1589 uint64_t fus318:1;
1590 uint64_t raid_en:1;
1591 uint64_t reserved_31_29:3;
1592 uint64_t nodfa_cp2:1;
1593 uint64_t nomul:1;
1594 uint64_t nocrypto:1;
1595 uint64_t reserved_25_24:2;
1596 uint64_t chip_id:8;
1597 uint64_t reserved_15_0:16;
1598#else
1599 uint64_t reserved_15_0:16;
1600 uint64_t chip_id:8;
1601 uint64_t reserved_25_24:2;
1602 uint64_t nocrypto:1;
1603 uint64_t nomul:1;
1604 uint64_t nodfa_cp2:1;
1605 uint64_t reserved_31_29:3;
1606 uint64_t raid_en:1;
1607 uint64_t fus318:1;
1608 uint64_t dorm_crypto:1;
1609 uint64_t power_limit:2;
1610 uint64_t rom_info:10;
1611 uint64_t fus118:1;
1612 uint64_t gbl_pwr_throttle:8;
1613 uint64_t run_platform:3;
1614 uint64_t reserved_59_63:5;
1615#endif
1616 } cn73xx;
1617 struct cvmx_mio_fus_dat2_cn78xx {
1618#ifdef __BIG_ENDIAN_BITFIELD
1619 uint64_t reserved_59_63:5;
1620 uint64_t run_platform:3;
1621 uint64_t reserved_48_55:8;
1622 uint64_t fus118:1;
1623 uint64_t rom_info:10;
1624 uint64_t power_limit:2;
1625 uint64_t dorm_crypto:1;
1626 uint64_t fus318:1;
1627 uint64_t raid_en:1;
1628 uint64_t reserved_31_29:3;
1629 uint64_t nodfa_cp2:1;
1630 uint64_t nomul:1;
1631 uint64_t nocrypto:1;
1632 uint64_t reserved_25_24:2;
1633 uint64_t chip_id:8;
1634 uint64_t reserved_0_15:16;
1635#else
1636 uint64_t reserved_0_15:16;
1637 uint64_t chip_id:8;
1638 uint64_t reserved_25_24:2;
1639 uint64_t nocrypto:1;
1640 uint64_t nomul:1;
1641 uint64_t nodfa_cp2:1;
1642 uint64_t reserved_31_29:3;
1643 uint64_t raid_en:1;
1644 uint64_t fus318:1;
1645 uint64_t dorm_crypto:1;
1646 uint64_t power_limit:2;
1647 uint64_t rom_info:10;
1648 uint64_t fus118:1;
1649 uint64_t reserved_48_55:8;
1650 uint64_t run_platform:3;
1651 uint64_t reserved_59_63:5;
1652#endif
1653 } cn78xx;
1654 struct cvmx_mio_fus_dat2_cn78xxp2 {
1655#ifdef __BIG_ENDIAN_BITFIELD
1656 uint64_t reserved_59_63:5;
1657 uint64_t run_platform:3;
1658 uint64_t gbl_pwr_throttle:8;
1659 uint64_t fus118:1;
1660 uint64_t rom_info:10;
1661 uint64_t power_limit:2;
1662 uint64_t dorm_crypto:1;
1663 uint64_t fus318:1;
1664 uint64_t raid_en:1;
1665 uint64_t reserved_31_29:3;
1666 uint64_t nodfa_cp2:1;
1667 uint64_t nomul:1;
1668 uint64_t nocrypto:1;
1669 uint64_t reserved_25_24:2;
1670 uint64_t chip_id:8;
1671 uint64_t reserved_0_15:16;
1672#else
1673 uint64_t reserved_0_15:16;
1674 uint64_t chip_id:8;
1675 uint64_t reserved_25_24:2;
1676 uint64_t nocrypto:1;
1677 uint64_t nomul:1;
1678 uint64_t nodfa_cp2:1;
1679 uint64_t reserved_31_29:3;
1680 uint64_t raid_en:1;
1681 uint64_t fus318:1;
1682 uint64_t dorm_crypto:1;
1683 uint64_t power_limit:2;
1684 uint64_t rom_info:10;
1685 uint64_t fus118:1;
1686 uint64_t gbl_pwr_throttle:8;
1687 uint64_t run_platform:3;
1688 uint64_t reserved_59_63:5;
1689#endif
1690 } cn78xxp2;
1691};
1692
1693union cvmx_mio_fus_dat3 {
1694 uint64_t u64;
1695 struct cvmx_mio_fus_dat3_s {
1696#ifdef __BIG_ENDIAN_BITFIELD
1697 uint64_t ema0:6;
1698 uint64_t pll_ctl:10;
1699 uint64_t dfa_info_dte:3;
1700 uint64_t dfa_info_clm:4;
1701 uint64_t pll_alt_matrix:1;
1702 uint64_t reserved_38_39:2;
1703 uint64_t efus_lck_rsv:1;
1704 uint64_t efus_lck_man:1;
1705 uint64_t pll_half_dis:1;
1706 uint64_t l2c_crip:3;
1707 uint64_t reserved_28_31:4;
1708 uint64_t efus_lck:1;
1709 uint64_t efus_ign:1;
1710 uint64_t nozip:1;
1711 uint64_t nodfa_dte:1;
1712 uint64_t reserved_0_23:24;
1713#else
1714 uint64_t reserved_0_23:24;
1715 uint64_t nodfa_dte:1;
1716 uint64_t nozip:1;
1717 uint64_t efus_ign:1;
1718 uint64_t efus_lck:1;
1719 uint64_t reserved_28_31:4;
1720 uint64_t l2c_crip:3;
1721 uint64_t pll_half_dis:1;
1722 uint64_t efus_lck_man:1;
1723 uint64_t efus_lck_rsv:1;
1724 uint64_t reserved_38_39:2;
1725 uint64_t pll_alt_matrix:1;
1726 uint64_t dfa_info_clm:4;
1727 uint64_t dfa_info_dte:3;
1728 uint64_t pll_ctl:10;
1729 uint64_t ema0:6;
1730#endif
1731 } s;
1732 struct cvmx_mio_fus_dat3_cn30xx {
1733#ifdef __BIG_ENDIAN_BITFIELD
1734 uint64_t reserved_32_63:32;
1735 uint64_t pll_div4:1;
1736 uint64_t reserved_29_30:2;
1737 uint64_t bar2_en:1;
1738 uint64_t efus_lck:1;
1739 uint64_t efus_ign:1;
1740 uint64_t nozip:1;
1741 uint64_t nodfa_dte:1;
1742 uint64_t icache:24;
1743#else
1744 uint64_t icache:24;
1745 uint64_t nodfa_dte:1;
1746 uint64_t nozip:1;
1747 uint64_t efus_ign:1;
1748 uint64_t efus_lck:1;
1749 uint64_t bar2_en:1;
1750 uint64_t reserved_29_30:2;
1751 uint64_t pll_div4:1;
1752 uint64_t reserved_32_63:32;
1753#endif
1754 } cn30xx;
1755 struct cvmx_mio_fus_dat3_cn31xx {
1756#ifdef __BIG_ENDIAN_BITFIELD
1757 uint64_t reserved_32_63:32;
1758 uint64_t pll_div4:1;
1759 uint64_t zip_crip:2;
1760 uint64_t bar2_en:1;
1761 uint64_t efus_lck:1;
1762 uint64_t efus_ign:1;
1763 uint64_t nozip:1;
1764 uint64_t nodfa_dte:1;
1765 uint64_t icache:24;
1766#else
1767 uint64_t icache:24;
1768 uint64_t nodfa_dte:1;
1769 uint64_t nozip:1;
1770 uint64_t efus_ign:1;
1771 uint64_t efus_lck:1;
1772 uint64_t bar2_en:1;
1773 uint64_t zip_crip:2;
1774 uint64_t pll_div4:1;
1775 uint64_t reserved_32_63:32;
1776#endif
1777 } cn31xx;
1778 struct cvmx_mio_fus_dat3_cn38xx {
1779#ifdef __BIG_ENDIAN_BITFIELD
1780 uint64_t reserved_31_63:33;
1781 uint64_t zip_crip:2;
1782 uint64_t bar2_en:1;
1783 uint64_t efus_lck:1;
1784 uint64_t efus_ign:1;
1785 uint64_t nozip:1;
1786 uint64_t nodfa_dte:1;
1787 uint64_t icache:24;
1788#else
1789 uint64_t icache:24;
1790 uint64_t nodfa_dte:1;
1791 uint64_t nozip:1;
1792 uint64_t efus_ign:1;
1793 uint64_t efus_lck:1;
1794 uint64_t bar2_en:1;
1795 uint64_t zip_crip:2;
1796 uint64_t reserved_31_63:33;
1797#endif
1798 } cn38xx;
1799 struct cvmx_mio_fus_dat3_cn38xxp2 {
1800#ifdef __BIG_ENDIAN_BITFIELD
1801 uint64_t reserved_29_63:35;
1802 uint64_t bar2_en:1;
1803 uint64_t efus_lck:1;
1804 uint64_t efus_ign:1;
1805 uint64_t nozip:1;
1806 uint64_t nodfa_dte:1;
1807 uint64_t icache:24;
1808#else
1809 uint64_t icache:24;
1810 uint64_t nodfa_dte:1;
1811 uint64_t nozip:1;
1812 uint64_t efus_ign:1;
1813 uint64_t efus_lck:1;
1814 uint64_t bar2_en:1;
1815 uint64_t reserved_29_63:35;
1816#endif
1817 } cn38xxp2;
1818 struct cvmx_mio_fus_dat3_cn61xx {
1819#ifdef __BIG_ENDIAN_BITFIELD
1820 uint64_t reserved_58_63:6;
1821 uint64_t pll_ctl:10;
1822 uint64_t dfa_info_dte:3;
1823 uint64_t dfa_info_clm:4;
1824 uint64_t reserved_40_40:1;
1825 uint64_t ema:2;
1826 uint64_t efus_lck_rsv:1;
1827 uint64_t efus_lck_man:1;
1828 uint64_t pll_half_dis:1;
1829 uint64_t l2c_crip:3;
1830 uint64_t reserved_31_31:1;
1831 uint64_t zip_info:2;
1832 uint64_t bar2_en:1;
1833 uint64_t efus_lck:1;
1834 uint64_t efus_ign:1;
1835 uint64_t nozip:1;
1836 uint64_t nodfa_dte:1;
1837 uint64_t reserved_0_23:24;
1838#else
1839 uint64_t reserved_0_23:24;
1840 uint64_t nodfa_dte:1;
1841 uint64_t nozip:1;
1842 uint64_t efus_ign:1;
1843 uint64_t efus_lck:1;
1844 uint64_t bar2_en:1;
1845 uint64_t zip_info:2;
1846 uint64_t reserved_31_31:1;
1847 uint64_t l2c_crip:3;
1848 uint64_t pll_half_dis:1;
1849 uint64_t efus_lck_man:1;
1850 uint64_t efus_lck_rsv:1;
1851 uint64_t ema:2;
1852 uint64_t reserved_40_40:1;
1853 uint64_t dfa_info_clm:4;
1854 uint64_t dfa_info_dte:3;
1855 uint64_t pll_ctl:10;
1856 uint64_t reserved_58_63:6;
1857#endif
1858 } cn61xx;
1859 struct cvmx_mio_fus_dat3_cn70xx {
1860#ifdef __BIG_ENDIAN_BITFIELD
1861 uint64_t ema0:6;
1862 uint64_t pll_ctl:10;
1863 uint64_t dfa_info_dte:3;
1864 uint64_t dfa_info_clm:4;
1865 uint64_t pll_alt_matrix:1;
1866 uint64_t pll_bwadj_denom:2;
1867 uint64_t efus_lck_rsv:1;
1868 uint64_t efus_lck_man:1;
1869 uint64_t pll_half_dis:1;
1870 uint64_t l2c_crip:3;
1871 uint64_t use_int_refclk:1;
1872 uint64_t zip_info:2;
1873 uint64_t bar2_sz_conf:1;
1874 uint64_t efus_lck:1;
1875 uint64_t efus_ign:1;
1876 uint64_t nozip:1;
1877 uint64_t nodfa_dte:1;
1878 uint64_t ema1:6;
1879 uint64_t reserved_0_17:18;
1880#else
1881 uint64_t reserved_0_17:18;
1882 uint64_t ema1:6;
1883 uint64_t nodfa_dte:1;
1884 uint64_t nozip:1;
1885 uint64_t efus_ign:1;
1886 uint64_t efus_lck:1;
1887 uint64_t bar2_sz_conf:1;
1888 uint64_t zip_info:2;
1889 uint64_t use_int_refclk:1;
1890 uint64_t l2c_crip:3;
1891 uint64_t pll_half_dis:1;
1892 uint64_t efus_lck_man:1;
1893 uint64_t efus_lck_rsv:1;
1894 uint64_t pll_bwadj_denom:2;
1895 uint64_t pll_alt_matrix:1;
1896 uint64_t dfa_info_clm:4;
1897 uint64_t dfa_info_dte:3;
1898 uint64_t pll_ctl:10;
1899 uint64_t ema0:6;
1900#endif
1901 } cn70xx;
1902 struct cvmx_mio_fus_dat3_cn70xxp1 {
1903#ifdef __BIG_ENDIAN_BITFIELD
1904 uint64_t ema0:6;
1905 uint64_t pll_ctl:10;
1906 uint64_t dfa_info_dte:3;
1907 uint64_t dfa_info_clm:4;
1908 uint64_t reserved_38_40:3;
1909 uint64_t efus_lck_rsv:1;
1910 uint64_t efus_lck_man:1;
1911 uint64_t pll_half_dis:1;
1912 uint64_t l2c_crip:3;
1913 uint64_t reserved_31_31:1;
1914 uint64_t zip_info:2;
1915 uint64_t bar2_sz_conf:1;
1916 uint64_t efus_lck:1;
1917 uint64_t efus_ign:1;
1918 uint64_t nozip:1;
1919 uint64_t nodfa_dte:1;
1920 uint64_t ema1:6;
1921 uint64_t reserved_0_17:18;
1922#else
1923 uint64_t reserved_0_17:18;
1924 uint64_t ema1:6;
1925 uint64_t nodfa_dte:1;
1926 uint64_t nozip:1;
1927 uint64_t efus_ign:1;
1928 uint64_t efus_lck:1;
1929 uint64_t bar2_sz_conf:1;
1930 uint64_t zip_info:2;
1931 uint64_t reserved_31_31:1;
1932 uint64_t l2c_crip:3;
1933 uint64_t pll_half_dis:1;
1934 uint64_t efus_lck_man:1;
1935 uint64_t efus_lck_rsv:1;
1936 uint64_t reserved_38_40:3;
1937 uint64_t dfa_info_clm:4;
1938 uint64_t dfa_info_dte:3;
1939 uint64_t pll_ctl:10;
1940 uint64_t ema0:6;
1941#endif
1942 } cn70xxp1;
1943 struct cvmx_mio_fus_dat3_cn73xx {
1944#ifdef __BIG_ENDIAN_BITFIELD
1945 uint64_t ema0:6;
1946 uint64_t pll_ctl:10;
1947 uint64_t dfa_info_dte:3;
1948 uint64_t dfa_info_clm:4;
1949 uint64_t pll_alt_matrix:1;
1950 uint64_t pll_bwadj_denom:2;
1951 uint64_t efus_lck_rsv:1;
1952 uint64_t efus_lck_man:1;
1953 uint64_t pll_half_dis:1;
1954 uint64_t l2c_crip:3;
1955 uint64_t use_int_refclk:1;
1956 uint64_t zip_info:2;
1957 uint64_t bar2_sz_conf:1;
1958 uint64_t efus_lck:1;
1959 uint64_t efus_ign:1;
1960 uint64_t nozip:1;
1961 uint64_t nodfa_dte:1;
1962 uint64_t ema1:6;
1963 uint64_t nohna_dte:1;
1964 uint64_t hna_info_dte:3;
1965 uint64_t hna_info_clm:4;
1966 uint64_t reserved_9_9:1;
1967 uint64_t core_pll_mul:5;
1968 uint64_t pnr_pll_mul:4;
1969#else
1970 uint64_t pnr_pll_mul:4;
1971 uint64_t core_pll_mul:5;
1972 uint64_t reserved_9_9:1;
1973 uint64_t hna_info_clm:4;
1974 uint64_t hna_info_dte:3;
1975 uint64_t nohna_dte:1;
1976 uint64_t ema1:6;
1977 uint64_t nodfa_dte:1;
1978 uint64_t nozip:1;
1979 uint64_t efus_ign:1;
1980 uint64_t efus_lck:1;
1981 uint64_t bar2_sz_conf:1;
1982 uint64_t zip_info:2;
1983 uint64_t use_int_refclk:1;
1984 uint64_t l2c_crip:3;
1985 uint64_t pll_half_dis:1;
1986 uint64_t efus_lck_man:1;
1987 uint64_t efus_lck_rsv:1;
1988 uint64_t pll_bwadj_denom:2;
1989 uint64_t pll_alt_matrix:1;
1990 uint64_t dfa_info_clm:4;
1991 uint64_t dfa_info_dte:3;
1992 uint64_t pll_ctl:10;
1993 uint64_t ema0:6;
1994#endif
1995 } cn73xx;
1996 struct cvmx_mio_fus_dat3_cn78xx {
1997#ifdef __BIG_ENDIAN_BITFIELD
1998 uint64_t ema0:6;
1999 uint64_t pll_ctl:10;
2000 uint64_t dfa_info_dte:3;
2001 uint64_t dfa_info_clm:4;
2002 uint64_t reserved_38_40:3;
2003 uint64_t efus_lck_rsv:1;
2004 uint64_t efus_lck_man:1;
2005 uint64_t pll_half_dis:1;
2006 uint64_t l2c_crip:3;
2007 uint64_t reserved_31_31:1;
2008 uint64_t zip_info:2;
2009 uint64_t bar2_sz_conf:1;
2010 uint64_t efus_lck:1;
2011 uint64_t efus_ign:1;
2012 uint64_t nozip:1;
2013 uint64_t nodfa_dte:1;
2014 uint64_t ema1:6;
2015 uint64_t nohna_dte:1;
2016 uint64_t hna_info_dte:3;
2017 uint64_t hna_info_clm:4;
2018 uint64_t reserved_0_9:10;
2019#else
2020 uint64_t reserved_0_9:10;
2021 uint64_t hna_info_clm:4;
2022 uint64_t hna_info_dte:3;
2023 uint64_t nohna_dte:1;
2024 uint64_t ema1:6;
2025 uint64_t nodfa_dte:1;
2026 uint64_t nozip:1;
2027 uint64_t efus_ign:1;
2028 uint64_t efus_lck:1;
2029 uint64_t bar2_sz_conf:1;
2030 uint64_t zip_info:2;
2031 uint64_t reserved_31_31:1;
2032 uint64_t l2c_crip:3;
2033 uint64_t pll_half_dis:1;
2034 uint64_t efus_lck_man:1;
2035 uint64_t efus_lck_rsv:1;
2036 uint64_t reserved_38_40:3;
2037 uint64_t dfa_info_clm:4;
2038 uint64_t dfa_info_dte:3;
2039 uint64_t pll_ctl:10;
2040 uint64_t ema0:6;
2041#endif
2042 } cn78xx;
2043 struct cvmx_mio_fus_dat3_cnf75xx {
2044#ifdef __BIG_ENDIAN_BITFIELD
2045 uint64_t ema0:6;
2046 uint64_t pll_ctl:10;
2047 uint64_t dfa_info_dte:3;
2048 uint64_t dfa_info_clm:4;
2049 uint64_t pll_alt_matrix:1;
2050 uint64_t pll_bwadj_denom:2;
2051 uint64_t efus_lck_rsv:1;
2052 uint64_t efus_lck_man:1;
2053 uint64_t pll_half_dis:1;
2054 uint64_t l2c_crip:3;
2055 uint64_t use_int_refclk:1;
2056 uint64_t zip_info:2;
2057 uint64_t bar2_sz_conf:1;
2058 uint64_t efus_lck:1;
2059 uint64_t efus_ign:1;
2060 uint64_t nozip:1;
2061 uint64_t nodfa_dte:1;
2062 uint64_t ema1:6;
2063 uint64_t reserved_9_17:9;
2064 uint64_t core_pll_mul:5;
2065 uint64_t pnr_pll_mul:4;
2066#else
2067 uint64_t pnr_pll_mul:4;
2068 uint64_t core_pll_mul:5;
2069 uint64_t reserved_9_17:9;
2070 uint64_t ema1:6;
2071 uint64_t nodfa_dte:1;
2072 uint64_t nozip:1;
2073 uint64_t efus_ign:1;
2074 uint64_t efus_lck:1;
2075 uint64_t bar2_sz_conf:1;
2076 uint64_t zip_info:2;
2077 uint64_t use_int_refclk:1;
2078 uint64_t l2c_crip:3;
2079 uint64_t pll_half_dis:1;
2080 uint64_t efus_lck_man:1;
2081 uint64_t efus_lck_rsv:1;
2082 uint64_t pll_bwadj_denom:2;
2083 uint64_t pll_alt_matrix:1;
2084 uint64_t dfa_info_clm:4;
2085 uint64_t dfa_info_dte:3;
2086 uint64_t pll_ctl:10;
2087 uint64_t ema0:6;
2088#endif
2089 } cnf75xx;
2090};
2091
2092union cvmx_mio_fus_ema {
2093 uint64_t u64;
2094 struct cvmx_mio_fus_ema_s {
2095#ifdef __BIG_ENDIAN_BITFIELD
2096 uint64_t reserved_7_63:57;
2097 uint64_t eff_ema:3;
2098 uint64_t reserved_3_3:1;
2099 uint64_t ema:3;
2100#else
2101 uint64_t ema:3;
2102 uint64_t reserved_3_3:1;
2103 uint64_t eff_ema:3;
2104 uint64_t reserved_7_63:57;
2105#endif
2106 } s;
2107 struct cvmx_mio_fus_ema_cn58xx {
2108#ifdef __BIG_ENDIAN_BITFIELD
2109 uint64_t reserved_2_63:62;
2110 uint64_t ema:2;
2111#else
2112 uint64_t ema:2;
2113 uint64_t reserved_2_63:62;
2114#endif
2115 } cn58xx;
2116};
2117
2118union cvmx_mio_fus_pdf {
2119 uint64_t u64;
2120 struct cvmx_mio_fus_pdf_s {
2121#ifdef __BIG_ENDIAN_BITFIELD
2122 uint64_t pdf:64;
2123#else
2124 uint64_t pdf:64;
2125#endif
2126 } s;
2127};
2128
2129union cvmx_mio_fus_pll {
2130 uint64_t u64;
2131 struct cvmx_mio_fus_pll_s {
2132#ifdef __BIG_ENDIAN_BITFIELD
2133 uint64_t reserved_48_63:16;
2134 uint64_t rclk_align_r:8;
2135 uint64_t rclk_align_l:8;
2136 uint64_t reserved_8_31:24;
2137 uint64_t c_cout_rst:1;
2138 uint64_t c_cout_sel:2;
2139 uint64_t pnr_cout_rst:1;
2140 uint64_t pnr_cout_sel:2;
2141 uint64_t rfslip:1;
2142 uint64_t fbslip:1;
2143#else
2144 uint64_t fbslip:1;
2145 uint64_t rfslip:1;
2146 uint64_t pnr_cout_sel:2;
2147 uint64_t pnr_cout_rst:1;
2148 uint64_t c_cout_sel:2;
2149 uint64_t c_cout_rst:1;
2150 uint64_t reserved_8_31:24;
2151 uint64_t rclk_align_l:8;
2152 uint64_t rclk_align_r:8;
2153 uint64_t reserved_48_63:16;
2154#endif
2155 } s;
2156 struct cvmx_mio_fus_pll_cn50xx {
2157#ifdef __BIG_ENDIAN_BITFIELD
2158 uint64_t reserved_2_63:62;
2159 uint64_t rfslip:1;
2160 uint64_t fbslip:1;
2161#else
2162 uint64_t fbslip:1;
2163 uint64_t rfslip:1;
2164 uint64_t reserved_2_63:62;
2165#endif
2166 } cn50xx;
2167 struct cvmx_mio_fus_pll_cn61xx {
2168#ifdef __BIG_ENDIAN_BITFIELD
2169 uint64_t reserved_8_63:56;
2170 uint64_t c_cout_rst:1;
2171 uint64_t c_cout_sel:2;
2172 uint64_t pnr_cout_rst:1;
2173 uint64_t pnr_cout_sel:2;
2174 uint64_t rfslip:1;
2175 uint64_t fbslip:1;
2176#else
2177 uint64_t fbslip:1;
2178 uint64_t rfslip:1;
2179 uint64_t pnr_cout_sel:2;
2180 uint64_t pnr_cout_rst:1;
2181 uint64_t c_cout_sel:2;
2182 uint64_t c_cout_rst:1;
2183 uint64_t reserved_8_63:56;
2184#endif
2185 } cn61xx;
2186};
2187
2188union cvmx_mio_fus_prog {
2189 uint64_t u64;
2190 struct cvmx_mio_fus_prog_s {
2191#ifdef __BIG_ENDIAN_BITFIELD
2192 uint64_t reserved_2_63:62;
2193 uint64_t soft:1;
2194 uint64_t prog:1;
2195#else
2196 uint64_t prog:1;
2197 uint64_t soft:1;
2198 uint64_t reserved_2_63:62;
2199#endif
2200 } s;
2201 struct cvmx_mio_fus_prog_cn30xx {
2202#ifdef __BIG_ENDIAN_BITFIELD
2203 uint64_t reserved_1_63:63;
2204 uint64_t prog:1;
2205#else
2206 uint64_t prog:1;
2207 uint64_t reserved_1_63:63;
2208#endif
2209 } cn30xx;
2210};
2211
2212union cvmx_mio_fus_prog_times {
2213 uint64_t u64;
2214 struct cvmx_mio_fus_prog_times_s {
2215#ifdef __BIG_ENDIAN_BITFIELD
2216 uint64_t reserved_35_63:29;
2217 uint64_t vgate_pin:1;
2218 uint64_t fsrc_pin:1;
2219 uint64_t prog_pin:1;
2220 uint64_t reserved_6_31:26;
2221 uint64_t setup:6;
2222#else
2223 uint64_t setup:6;
2224 uint64_t reserved_6_31:26;
2225 uint64_t prog_pin:1;
2226 uint64_t fsrc_pin:1;
2227 uint64_t vgate_pin:1;
2228 uint64_t reserved_35_63:29;
2229#endif
2230 } s;
2231 struct cvmx_mio_fus_prog_times_cn50xx {
2232#ifdef __BIG_ENDIAN_BITFIELD
2233 uint64_t reserved_33_63:31;
2234 uint64_t prog_pin:1;
2235 uint64_t out:8;
2236 uint64_t sclk_lo:4;
2237 uint64_t sclk_hi:12;
2238 uint64_t setup:8;
2239#else
2240 uint64_t setup:8;
2241 uint64_t sclk_hi:12;
2242 uint64_t sclk_lo:4;
2243 uint64_t out:8;
2244 uint64_t prog_pin:1;
2245 uint64_t reserved_33_63:31;
2246#endif
2247 } cn50xx;
2248 struct cvmx_mio_fus_prog_times_cn61xx {
2249#ifdef __BIG_ENDIAN_BITFIELD
2250 uint64_t reserved_35_63:29;
2251 uint64_t vgate_pin:1;
2252 uint64_t fsrc_pin:1;
2253 uint64_t prog_pin:1;
2254 uint64_t out:7;
2255 uint64_t sclk_lo:4;
2256 uint64_t sclk_hi:15;
2257 uint64_t setup:6;
2258#else
2259 uint64_t setup:6;
2260 uint64_t sclk_hi:15;
2261 uint64_t sclk_lo:4;
2262 uint64_t out:7;
2263 uint64_t prog_pin:1;
2264 uint64_t fsrc_pin:1;
2265 uint64_t vgate_pin:1;
2266 uint64_t reserved_35_63:29;
2267#endif
2268 } cn61xx;
2269};
2270
2271union cvmx_mio_fus_rcmd {
2272 uint64_t u64;
2273 struct cvmx_mio_fus_rcmd_s {
2274#ifdef __BIG_ENDIAN_BITFIELD
2275 uint64_t reserved_24_63:40;
2276 uint64_t dat:8;
2277 uint64_t reserved_13_15:3;
2278 uint64_t pend:1;
2279 uint64_t reserved_9_11:3;
2280 uint64_t efuse:1;
2281 uint64_t addr:8;
2282#else
2283 uint64_t addr:8;
2284 uint64_t efuse:1;
2285 uint64_t reserved_9_11:3;
2286 uint64_t pend:1;
2287 uint64_t reserved_13_15:3;
2288 uint64_t dat:8;
2289 uint64_t reserved_24_63:40;
2290#endif
2291 } s;
2292 struct cvmx_mio_fus_rcmd_cn30xx {
2293#ifdef __BIG_ENDIAN_BITFIELD
2294 uint64_t reserved_24_63:40;
2295 uint64_t dat:8;
2296 uint64_t reserved_13_15:3;
2297 uint64_t pend:1;
2298 uint64_t reserved_9_11:3;
2299 uint64_t efuse:1;
2300 uint64_t reserved_7_7:1;
2301 uint64_t addr:7;
2302#else
2303 uint64_t addr:7;
2304 uint64_t reserved_7_7:1;
2305 uint64_t efuse:1;
2306 uint64_t reserved_9_11:3;
2307 uint64_t pend:1;
2308 uint64_t reserved_13_15:3;
2309 uint64_t dat:8;
2310 uint64_t reserved_24_63:40;
2311#endif
2312 } cn30xx;
2313};
2314
2315union cvmx_mio_fus_read_times {
2316 uint64_t u64;
2317 struct cvmx_mio_fus_read_times_s {
2318#ifdef __BIG_ENDIAN_BITFIELD
2319 uint64_t reserved_26_63:38;
2320 uint64_t sch:4;
2321 uint64_t fsh:4;
2322 uint64_t prh:4;
2323 uint64_t sdh:4;
2324 uint64_t setup:10;
2325#else
2326 uint64_t setup:10;
2327 uint64_t sdh:4;
2328 uint64_t prh:4;
2329 uint64_t fsh:4;
2330 uint64_t sch:4;
2331 uint64_t reserved_26_63:38;
2332#endif
2333 } s;
2334};
2335
2336union cvmx_mio_fus_repair_res0 {
2337 uint64_t u64;
2338 struct cvmx_mio_fus_repair_res0_s {
2339#ifdef __BIG_ENDIAN_BITFIELD
2340 uint64_t reserved_55_63:9;
2341 uint64_t too_many:1;
2342 uint64_t repair2:18;
2343 uint64_t repair1:18;
2344 uint64_t repair0:18;
2345#else
2346 uint64_t repair0:18;
2347 uint64_t repair1:18;
2348 uint64_t repair2:18;
2349 uint64_t too_many:1;
2350 uint64_t reserved_55_63:9;
2351#endif
2352 } s;
2353};
2354
2355union cvmx_mio_fus_repair_res1 {
2356 uint64_t u64;
2357 struct cvmx_mio_fus_repair_res1_s {
2358#ifdef __BIG_ENDIAN_BITFIELD
2359 uint64_t reserved_54_63:10;
2360 uint64_t repair5:18;
2361 uint64_t repair4:18;
2362 uint64_t repair3:18;
2363#else
2364 uint64_t repair3:18;
2365 uint64_t repair4:18;
2366 uint64_t repair5:18;
2367 uint64_t reserved_54_63:10;
2368#endif
2369 } s;
2370};
2371
2372union cvmx_mio_fus_repair_res2 {
2373 uint64_t u64;
2374 struct cvmx_mio_fus_repair_res2_s {
2375#ifdef __BIG_ENDIAN_BITFIELD
2376 uint64_t reserved_18_63:46;
2377 uint64_t repair6:18;
2378#else
2379 uint64_t repair6:18;
2380 uint64_t reserved_18_63:46;
2381#endif
2382 } s;
2383};
2384
2385union cvmx_mio_fus_spr_repair_res {
2386 uint64_t u64;
2387 struct cvmx_mio_fus_spr_repair_res_s {
2388#ifdef __BIG_ENDIAN_BITFIELD
2389 uint64_t reserved_42_63:22;
2390 uint64_t repair2:14;
2391 uint64_t repair1:14;
2392 uint64_t repair0:14;
2393#else
2394 uint64_t repair0:14;
2395 uint64_t repair1:14;
2396 uint64_t repair2:14;
2397 uint64_t reserved_42_63:22;
2398#endif
2399 } s;
2400};
2401
2402union cvmx_mio_fus_spr_repair_sum {
2403 uint64_t u64;
2404 struct cvmx_mio_fus_spr_repair_sum_s {
2405#ifdef __BIG_ENDIAN_BITFIELD
2406 uint64_t reserved_1_63:63;
2407 uint64_t too_many:1;
2408#else
2409 uint64_t too_many:1;
2410 uint64_t reserved_1_63:63;
2411#endif
2412 } s;
2413};
2414
2415union cvmx_mio_fus_tgg {
2416 uint64_t u64;
2417 struct cvmx_mio_fus_tgg_s {
2418#ifdef __BIG_ENDIAN_BITFIELD
2419 uint64_t val:1;
2420 uint64_t dat:63;
2421#else
2422 uint64_t dat:63;
2423 uint64_t val:1;
2424#endif
2425 } s;
2426};
2427
2428union cvmx_mio_fus_unlock {
2429 uint64_t u64;
2430 struct cvmx_mio_fus_unlock_s {
2431#ifdef __BIG_ENDIAN_BITFIELD
2432 uint64_t reserved_24_63:40;
2433 uint64_t key:24;
2434#else
2435 uint64_t key:24;
2436 uint64_t reserved_24_63:40;
2437#endif
2438 } s;
2439};
2440
2441union cvmx_mio_fus_wadr {
2442 uint64_t u64;
2443 struct cvmx_mio_fus_wadr_s {
2444#ifdef __BIG_ENDIAN_BITFIELD
2445 uint64_t reserved_10_63:54;
2446 uint64_t addr:10;
2447#else
2448 uint64_t addr:10;
2449 uint64_t reserved_10_63:54;
2450#endif
2451 } s;
2452 struct cvmx_mio_fus_wadr_cn50xx {
2453#ifdef __BIG_ENDIAN_BITFIELD
2454 uint64_t reserved_2_63:62;
2455 uint64_t addr:2;
2456#else
2457 uint64_t addr:2;
2458 uint64_t reserved_2_63:62;
2459#endif
2460 } cn50xx;
2461 struct cvmx_mio_fus_wadr_cn52xx {
2462#ifdef __BIG_ENDIAN_BITFIELD
2463 uint64_t reserved_3_63:61;
2464 uint64_t addr:3;
2465#else
2466 uint64_t addr:3;
2467 uint64_t reserved_3_63:61;
2468#endif
2469 } cn52xx;
2470 struct cvmx_mio_fus_wadr_cn61xx {
2471#ifdef __BIG_ENDIAN_BITFIELD
2472 uint64_t reserved_4_63:60;
2473 uint64_t addr:4;
2474#else
2475 uint64_t addr:4;
2476 uint64_t reserved_4_63:60;
2477#endif
2478 } cn61xx;
2479};
2480
2481union cvmx_mio_gpio_comp {
2482 uint64_t u64;
2483 struct cvmx_mio_gpio_comp_s {
2484#ifdef __BIG_ENDIAN_BITFIELD
2485 uint64_t reserved_12_63:52;
2486 uint64_t pctl:6;
2487 uint64_t nctl:6;
2488#else
2489 uint64_t nctl:6;
2490 uint64_t pctl:6;
2491 uint64_t reserved_12_63:52;
2492#endif
2493 } s;
2494};
2495
2496union cvmx_mio_ndf_dma_cfg {
2497 uint64_t u64;
2498 struct cvmx_mio_ndf_dma_cfg_s {
2499#ifdef __BIG_ENDIAN_BITFIELD
2500 uint64_t en:1;
2501 uint64_t rw:1;
2502 uint64_t clr:1;
2503 uint64_t reserved_60_60:1;
2504 uint64_t swap32:1;
2505 uint64_t swap16:1;
2506 uint64_t swap8:1;
2507 uint64_t endian:1;
2508 uint64_t size:20;
2509 uint64_t adr:36;
2510#else
2511 uint64_t adr:36;
2512 uint64_t size:20;
2513 uint64_t endian:1;
2514 uint64_t swap8:1;
2515 uint64_t swap16:1;
2516 uint64_t swap32:1;
2517 uint64_t reserved_60_60:1;
2518 uint64_t clr:1;
2519 uint64_t rw:1;
2520 uint64_t en:1;
2521#endif
2522 } s;
2523};
2524
2525union cvmx_mio_ndf_dma_int {
2526 uint64_t u64;
2527 struct cvmx_mio_ndf_dma_int_s {
2528#ifdef __BIG_ENDIAN_BITFIELD
2529 uint64_t reserved_1_63:63;
2530 uint64_t done:1;
2531#else
2532 uint64_t done:1;
2533 uint64_t reserved_1_63:63;
2534#endif
2535 } s;
2536};
2537
2538union cvmx_mio_ndf_dma_int_en {
2539 uint64_t u64;
2540 struct cvmx_mio_ndf_dma_int_en_s {
2541#ifdef __BIG_ENDIAN_BITFIELD
2542 uint64_t reserved_1_63:63;
2543 uint64_t done:1;
2544#else
2545 uint64_t done:1;
2546 uint64_t reserved_1_63:63;
2547#endif
2548 } s;
2549};
2550
2551union cvmx_mio_pll_ctl {
2552 uint64_t u64;
2553 struct cvmx_mio_pll_ctl_s {
2554#ifdef __BIG_ENDIAN_BITFIELD
2555 uint64_t reserved_5_63:59;
2556 uint64_t bw_ctl:5;
2557#else
2558 uint64_t bw_ctl:5;
2559 uint64_t reserved_5_63:59;
2560#endif
2561 } s;
2562};
2563
2564union cvmx_mio_pll_setting {
2565 uint64_t u64;
2566 struct cvmx_mio_pll_setting_s {
2567#ifdef __BIG_ENDIAN_BITFIELD
2568 uint64_t reserved_17_63:47;
2569 uint64_t setting:17;
2570#else
2571 uint64_t setting:17;
2572 uint64_t reserved_17_63:47;
2573#endif
2574 } s;
2575};
2576
2577union cvmx_mio_ptp_ckout_hi_incr {
2578 uint64_t u64;
2579 struct cvmx_mio_ptp_ckout_hi_incr_s {
2580#ifdef __BIG_ENDIAN_BITFIELD
2581 uint64_t nanosec:32;
2582 uint64_t frnanosec:32;
2583#else
2584 uint64_t frnanosec:32;
2585 uint64_t nanosec:32;
2586#endif
2587 } s;
2588};
2589
2590union cvmx_mio_ptp_ckout_lo_incr {
2591 uint64_t u64;
2592 struct cvmx_mio_ptp_ckout_lo_incr_s {
2593#ifdef __BIG_ENDIAN_BITFIELD
2594 uint64_t nanosec:32;
2595 uint64_t frnanosec:32;
2596#else
2597 uint64_t frnanosec:32;
2598 uint64_t nanosec:32;
2599#endif
2600 } s;
2601};
2602
2603union cvmx_mio_ptp_ckout_thresh_hi {
2604 uint64_t u64;
2605 struct cvmx_mio_ptp_ckout_thresh_hi_s {
2606#ifdef __BIG_ENDIAN_BITFIELD
2607 uint64_t nanosec:64;
2608#else
2609 uint64_t nanosec:64;
2610#endif
2611 } s;
2612};
2613
2614union cvmx_mio_ptp_ckout_thresh_lo {
2615 uint64_t u64;
2616 struct cvmx_mio_ptp_ckout_thresh_lo_s {
2617#ifdef __BIG_ENDIAN_BITFIELD
2618 uint64_t reserved_32_63:32;
2619 uint64_t frnanosec:32;
2620#else
2621 uint64_t frnanosec:32;
2622 uint64_t reserved_32_63:32;
2623#endif
2624 } s;
2625};
2626
2627union cvmx_mio_ptp_clock_cfg {
2628 uint64_t u64;
2629 struct cvmx_mio_ptp_clock_cfg_s {
2630#ifdef __BIG_ENDIAN_BITFIELD
2631 uint64_t reserved_42_63:22;
2632 uint64_t pps:1;
2633 uint64_t ckout:1;
2634 uint64_t ext_clk_edge:2;
2635 uint64_t ckout_out4:1;
2636 uint64_t pps_out:5;
2637 uint64_t pps_inv:1;
2638 uint64_t pps_en:1;
2639 uint64_t ckout_out:4;
2640 uint64_t ckout_inv:1;
2641 uint64_t ckout_en:1;
2642 uint64_t evcnt_in:6;
2643 uint64_t evcnt_edge:1;
2644 uint64_t evcnt_en:1;
2645 uint64_t tstmp_in:6;
2646 uint64_t tstmp_edge:1;
2647 uint64_t tstmp_en:1;
2648 uint64_t ext_clk_in:6;
2649 uint64_t ext_clk_en:1;
2650 uint64_t ptp_en:1;
2651#else
2652 uint64_t ptp_en:1;
2653 uint64_t ext_clk_en:1;
2654 uint64_t ext_clk_in:6;
2655 uint64_t tstmp_en:1;
2656 uint64_t tstmp_edge:1;
2657 uint64_t tstmp_in:6;
2658 uint64_t evcnt_en:1;
2659 uint64_t evcnt_edge:1;
2660 uint64_t evcnt_in:6;
2661 uint64_t ckout_en:1;
2662 uint64_t ckout_inv:1;
2663 uint64_t ckout_out:4;
2664 uint64_t pps_en:1;
2665 uint64_t pps_inv:1;
2666 uint64_t pps_out:5;
2667 uint64_t ckout_out4:1;
2668 uint64_t ext_clk_edge:2;
2669 uint64_t ckout:1;
2670 uint64_t pps:1;
2671 uint64_t reserved_42_63:22;
2672#endif
2673 } s;
2674 struct cvmx_mio_ptp_clock_cfg_cn63xx {
2675#ifdef __BIG_ENDIAN_BITFIELD
2676 uint64_t reserved_24_63:40;
2677 uint64_t evcnt_in:6;
2678 uint64_t evcnt_edge:1;
2679 uint64_t evcnt_en:1;
2680 uint64_t tstmp_in:6;
2681 uint64_t tstmp_edge:1;
2682 uint64_t tstmp_en:1;
2683 uint64_t ext_clk_in:6;
2684 uint64_t ext_clk_en:1;
2685 uint64_t ptp_en:1;
2686#else
2687 uint64_t ptp_en:1;
2688 uint64_t ext_clk_en:1;
2689 uint64_t ext_clk_in:6;
2690 uint64_t tstmp_en:1;
2691 uint64_t tstmp_edge:1;
2692 uint64_t tstmp_in:6;
2693 uint64_t evcnt_en:1;
2694 uint64_t evcnt_edge:1;
2695 uint64_t evcnt_in:6;
2696 uint64_t reserved_24_63:40;
2697#endif
2698 } cn63xx;
2699 struct cvmx_mio_ptp_clock_cfg_cn66xx {
2700#ifdef __BIG_ENDIAN_BITFIELD
2701 uint64_t reserved_40_63:24;
2702 uint64_t ext_clk_edge:2;
2703 uint64_t ckout_out4:1;
2704 uint64_t pps_out:5;
2705 uint64_t pps_inv:1;
2706 uint64_t pps_en:1;
2707 uint64_t ckout_out:4;
2708 uint64_t ckout_inv:1;
2709 uint64_t ckout_en:1;
2710 uint64_t evcnt_in:6;
2711 uint64_t evcnt_edge:1;
2712 uint64_t evcnt_en:1;
2713 uint64_t tstmp_in:6;
2714 uint64_t tstmp_edge:1;
2715 uint64_t tstmp_en:1;
2716 uint64_t ext_clk_in:6;
2717 uint64_t ext_clk_en:1;
2718 uint64_t ptp_en:1;
2719#else
2720 uint64_t ptp_en:1;
2721 uint64_t ext_clk_en:1;
2722 uint64_t ext_clk_in:6;
2723 uint64_t tstmp_en:1;
2724 uint64_t tstmp_edge:1;
2725 uint64_t tstmp_in:6;
2726 uint64_t evcnt_en:1;
2727 uint64_t evcnt_edge:1;
2728 uint64_t evcnt_in:6;
2729 uint64_t ckout_en:1;
2730 uint64_t ckout_inv:1;
2731 uint64_t ckout_out:4;
2732 uint64_t pps_en:1;
2733 uint64_t pps_inv:1;
2734 uint64_t pps_out:5;
2735 uint64_t ckout_out4:1;
2736 uint64_t ext_clk_edge:2;
2737 uint64_t reserved_40_63:24;
2738#endif
2739 } cn66xx;
2740};
2741
2742union cvmx_mio_ptp_clock_comp {
2743 uint64_t u64;
2744 struct cvmx_mio_ptp_clock_comp_s {
2745#ifdef __BIG_ENDIAN_BITFIELD
2746 uint64_t nanosec:32;
2747 uint64_t frnanosec:32;
2748#else
2749 uint64_t frnanosec:32;
2750 uint64_t nanosec:32;
2751#endif
2752 } s;
2753};
2754
2755union cvmx_mio_ptp_clock_hi {
2756 uint64_t u64;
2757 struct cvmx_mio_ptp_clock_hi_s {
2758#ifdef __BIG_ENDIAN_BITFIELD
2759 uint64_t nanosec:64;
2760#else
2761 uint64_t nanosec:64;
2762#endif
2763 } s;
2764};
2765
2766union cvmx_mio_ptp_clock_lo {
2767 uint64_t u64;
2768 struct cvmx_mio_ptp_clock_lo_s {
2769#ifdef __BIG_ENDIAN_BITFIELD
2770 uint64_t reserved_32_63:32;
2771 uint64_t frnanosec:32;
2772#else
2773 uint64_t frnanosec:32;
2774 uint64_t reserved_32_63:32;
2775#endif
2776 } s;
2777};
2778
2779union cvmx_mio_ptp_evt_cnt {
2780 uint64_t u64;
2781 struct cvmx_mio_ptp_evt_cnt_s {
2782#ifdef __BIG_ENDIAN_BITFIELD
2783 uint64_t cntr:64;
2784#else
2785 uint64_t cntr:64;
2786#endif
2787 } s;
2788};
2789
2790union cvmx_mio_ptp_phy_1pps_in {
2791 uint64_t u64;
2792 struct cvmx_mio_ptp_phy_1pps_in_s {
2793#ifdef __BIG_ENDIAN_BITFIELD
2794 uint64_t reserved_5_63:59;
2795 uint64_t sel:5;
2796#else
2797 uint64_t sel:5;
2798 uint64_t reserved_5_63:59;
2799#endif
2800 } s;
2801};
2802
2803union cvmx_mio_ptp_pps_hi_incr {
2804 uint64_t u64;
2805 struct cvmx_mio_ptp_pps_hi_incr_s {
2806#ifdef __BIG_ENDIAN_BITFIELD
2807 uint64_t nanosec:32;
2808 uint64_t frnanosec:32;
2809#else
2810 uint64_t frnanosec:32;
2811 uint64_t nanosec:32;
2812#endif
2813 } s;
2814};
2815
2816union cvmx_mio_ptp_pps_lo_incr {
2817 uint64_t u64;
2818 struct cvmx_mio_ptp_pps_lo_incr_s {
2819#ifdef __BIG_ENDIAN_BITFIELD
2820 uint64_t nanosec:32;
2821 uint64_t frnanosec:32;
2822#else
2823 uint64_t frnanosec:32;
2824 uint64_t nanosec:32;
2825#endif
2826 } s;
2827};
2828
2829union cvmx_mio_ptp_pps_thresh_hi {
2830 uint64_t u64;
2831 struct cvmx_mio_ptp_pps_thresh_hi_s {
2832#ifdef __BIG_ENDIAN_BITFIELD
2833 uint64_t nanosec:64;
2834#else
2835 uint64_t nanosec:64;
2836#endif
2837 } s;
2838};
2839
2840union cvmx_mio_ptp_pps_thresh_lo {
2841 uint64_t u64;
2842 struct cvmx_mio_ptp_pps_thresh_lo_s {
2843#ifdef __BIG_ENDIAN_BITFIELD
2844 uint64_t reserved_32_63:32;
2845 uint64_t frnanosec:32;
2846#else
2847 uint64_t frnanosec:32;
2848 uint64_t reserved_32_63:32;
2849#endif
2850 } s;
2851};
2852
2853union cvmx_mio_ptp_timestamp {
2854 uint64_t u64;
2855 struct cvmx_mio_ptp_timestamp_s {
2856#ifdef __BIG_ENDIAN_BITFIELD
2857 uint64_t nanosec:64;
2858#else
2859 uint64_t nanosec:64;
2860#endif
2861 } s;
2862};
2863
2864union cvmx_mio_qlmx_cfg {
2865 uint64_t u64;
2866 struct cvmx_mio_qlmx_cfg_s {
2867#ifdef __BIG_ENDIAN_BITFIELD
2868 uint64_t reserved_15_63:49;
2869 uint64_t prtmode:1;
2870 uint64_t reserved_12_13:2;
2871 uint64_t qlm_spd:4;
2872 uint64_t reserved_4_7:4;
2873 uint64_t qlm_cfg:4;
2874#else
2875 uint64_t qlm_cfg:4;
2876 uint64_t reserved_4_7:4;
2877 uint64_t qlm_spd:4;
2878 uint64_t reserved_12_13:2;
2879 uint64_t prtmode:1;
2880 uint64_t reserved_15_63:49;
2881#endif
2882 } s;
2883 struct cvmx_mio_qlmx_cfg_cn61xx {
2884#ifdef __BIG_ENDIAN_BITFIELD
2885 uint64_t reserved_15_63:49;
2886 uint64_t prtmode:1;
2887 uint64_t reserved_12_13:2;
2888 uint64_t qlm_spd:4;
2889 uint64_t reserved_2_7:6;
2890 uint64_t qlm_cfg:2;
2891#else
2892 uint64_t qlm_cfg:2;
2893 uint64_t reserved_2_7:6;
2894 uint64_t qlm_spd:4;
2895 uint64_t reserved_12_13:2;
2896 uint64_t prtmode:1;
2897 uint64_t reserved_15_63:49;
2898#endif
2899 } cn61xx;
2900 struct cvmx_mio_qlmx_cfg_cn66xx {
2901#ifdef __BIG_ENDIAN_BITFIELD
2902 uint64_t reserved_12_63:52;
2903 uint64_t qlm_spd:4;
2904 uint64_t reserved_4_7:4;
2905 uint64_t qlm_cfg:4;
2906#else
2907 uint64_t qlm_cfg:4;
2908 uint64_t reserved_4_7:4;
2909 uint64_t qlm_spd:4;
2910 uint64_t reserved_12_63:52;
2911#endif
2912 } cn66xx;
2913 struct cvmx_mio_qlmx_cfg_cn68xx {
2914#ifdef __BIG_ENDIAN_BITFIELD
2915 uint64_t reserved_12_63:52;
2916 uint64_t qlm_spd:4;
2917 uint64_t reserved_3_7:5;
2918 uint64_t qlm_cfg:3;
2919#else
2920 uint64_t qlm_cfg:3;
2921 uint64_t reserved_3_7:5;
2922 uint64_t qlm_spd:4;
2923 uint64_t reserved_12_63:52;
2924#endif
2925 } cn68xx;
2926};
2927
2928union cvmx_mio_rst_boot {
2929 uint64_t u64;
2930 struct cvmx_mio_rst_boot_s {
2931#ifdef __BIG_ENDIAN_BITFIELD
2932 uint64_t chipkill:1;
2933 uint64_t jtcsrdis:1;
2934 uint64_t ejtagdis:1;
2935 uint64_t romen:1;
2936 uint64_t ckill_ppdis:1;
2937 uint64_t jt_tstmode:1;
2938 uint64_t reserved_50_57:8;
2939 uint64_t lboot_ext:2;
2940 uint64_t reserved_44_47:4;
2941 uint64_t qlm4_spd:4;
2942 uint64_t qlm3_spd:4;
2943 uint64_t c_mul:6;
2944 uint64_t pnr_mul:6;
2945 uint64_t qlm2_spd:4;
2946 uint64_t qlm1_spd:4;
2947 uint64_t qlm0_spd:4;
2948 uint64_t lboot:10;
2949 uint64_t rboot:1;
2950 uint64_t rboot_pin:1;
2951#else
2952 uint64_t rboot_pin:1;
2953 uint64_t rboot:1;
2954 uint64_t lboot:10;
2955 uint64_t qlm0_spd:4;
2956 uint64_t qlm1_spd:4;
2957 uint64_t qlm2_spd:4;
2958 uint64_t pnr_mul:6;
2959 uint64_t c_mul:6;
2960 uint64_t qlm3_spd:4;
2961 uint64_t qlm4_spd:4;
2962 uint64_t reserved_44_47:4;
2963 uint64_t lboot_ext:2;
2964 uint64_t reserved_50_57:8;
2965 uint64_t jt_tstmode:1;
2966 uint64_t ckill_ppdis:1;
2967 uint64_t romen:1;
2968 uint64_t ejtagdis:1;
2969 uint64_t jtcsrdis:1;
2970 uint64_t chipkill:1;
2971#endif
2972 } s;
2973 struct cvmx_mio_rst_boot_cn61xx {
2974#ifdef __BIG_ENDIAN_BITFIELD
2975 uint64_t chipkill:1;
2976 uint64_t jtcsrdis:1;
2977 uint64_t ejtagdis:1;
2978 uint64_t romen:1;
2979 uint64_t ckill_ppdis:1;
2980 uint64_t jt_tstmode:1;
2981 uint64_t reserved_50_57:8;
2982 uint64_t lboot_ext:2;
2983 uint64_t reserved_36_47:12;
2984 uint64_t c_mul:6;
2985 uint64_t pnr_mul:6;
2986 uint64_t qlm2_spd:4;
2987 uint64_t qlm1_spd:4;
2988 uint64_t qlm0_spd:4;
2989 uint64_t lboot:10;
2990 uint64_t rboot:1;
2991 uint64_t rboot_pin:1;
2992#else
2993 uint64_t rboot_pin:1;
2994 uint64_t rboot:1;
2995 uint64_t lboot:10;
2996 uint64_t qlm0_spd:4;
2997 uint64_t qlm1_spd:4;
2998 uint64_t qlm2_spd:4;
2999 uint64_t pnr_mul:6;
3000 uint64_t c_mul:6;
3001 uint64_t reserved_36_47:12;
3002 uint64_t lboot_ext:2;
3003 uint64_t reserved_50_57:8;
3004 uint64_t jt_tstmode:1;
3005 uint64_t ckill_ppdis:1;
3006 uint64_t romen:1;
3007 uint64_t ejtagdis:1;
3008 uint64_t jtcsrdis:1;
3009 uint64_t chipkill:1;
3010#endif
3011 } cn61xx;
3012 struct cvmx_mio_rst_boot_cn63xx {
3013#ifdef __BIG_ENDIAN_BITFIELD
3014 uint64_t reserved_36_63:28;
3015 uint64_t c_mul:6;
3016 uint64_t pnr_mul:6;
3017 uint64_t qlm2_spd:4;
3018 uint64_t qlm1_spd:4;
3019 uint64_t qlm0_spd:4;
3020 uint64_t lboot:10;
3021 uint64_t rboot:1;
3022 uint64_t rboot_pin:1;
3023#else
3024 uint64_t rboot_pin:1;
3025 uint64_t rboot:1;
3026 uint64_t lboot:10;
3027 uint64_t qlm0_spd:4;
3028 uint64_t qlm1_spd:4;
3029 uint64_t qlm2_spd:4;
3030 uint64_t pnr_mul:6;
3031 uint64_t c_mul:6;
3032 uint64_t reserved_36_63:28;
3033#endif
3034 } cn63xx;
3035 struct cvmx_mio_rst_boot_cn66xx {
3036#ifdef __BIG_ENDIAN_BITFIELD
3037 uint64_t chipkill:1;
3038 uint64_t jtcsrdis:1;
3039 uint64_t ejtagdis:1;
3040 uint64_t romen:1;
3041 uint64_t ckill_ppdis:1;
3042 uint64_t reserved_50_58:9;
3043 uint64_t lboot_ext:2;
3044 uint64_t reserved_36_47:12;
3045 uint64_t c_mul:6;
3046 uint64_t pnr_mul:6;
3047 uint64_t qlm2_spd:4;
3048 uint64_t qlm1_spd:4;
3049 uint64_t qlm0_spd:4;
3050 uint64_t lboot:10;
3051 uint64_t rboot:1;
3052 uint64_t rboot_pin:1;
3053#else
3054 uint64_t rboot_pin:1;
3055 uint64_t rboot:1;
3056 uint64_t lboot:10;
3057 uint64_t qlm0_spd:4;
3058 uint64_t qlm1_spd:4;
3059 uint64_t qlm2_spd:4;
3060 uint64_t pnr_mul:6;
3061 uint64_t c_mul:6;
3062 uint64_t reserved_36_47:12;
3063 uint64_t lboot_ext:2;
3064 uint64_t reserved_50_58:9;
3065 uint64_t ckill_ppdis:1;
3066 uint64_t romen:1;
3067 uint64_t ejtagdis:1;
3068 uint64_t jtcsrdis:1;
3069 uint64_t chipkill:1;
3070#endif
3071 } cn66xx;
3072 struct cvmx_mio_rst_boot_cn68xx {
3073#ifdef __BIG_ENDIAN_BITFIELD
3074 uint64_t reserved_59_63:5;
3075 uint64_t jt_tstmode:1;
3076 uint64_t reserved_44_57:14;
3077 uint64_t qlm4_spd:4;
3078 uint64_t qlm3_spd:4;
3079 uint64_t c_mul:6;
3080 uint64_t pnr_mul:6;
3081 uint64_t qlm2_spd:4;
3082 uint64_t qlm1_spd:4;
3083 uint64_t qlm0_spd:4;
3084 uint64_t lboot:10;
3085 uint64_t rboot:1;
3086 uint64_t rboot_pin:1;
3087#else
3088 uint64_t rboot_pin:1;
3089 uint64_t rboot:1;
3090 uint64_t lboot:10;
3091 uint64_t qlm0_spd:4;
3092 uint64_t qlm1_spd:4;
3093 uint64_t qlm2_spd:4;
3094 uint64_t pnr_mul:6;
3095 uint64_t c_mul:6;
3096 uint64_t qlm3_spd:4;
3097 uint64_t qlm4_spd:4;
3098 uint64_t reserved_44_57:14;
3099 uint64_t jt_tstmode:1;
3100 uint64_t reserved_59_63:5;
3101#endif
3102 } cn68xx;
3103 struct cvmx_mio_rst_boot_cn68xxp1 {
3104#ifdef __BIG_ENDIAN_BITFIELD
3105 uint64_t reserved_44_63:20;
3106 uint64_t qlm4_spd:4;
3107 uint64_t qlm3_spd:4;
3108 uint64_t c_mul:6;
3109 uint64_t pnr_mul:6;
3110 uint64_t qlm2_spd:4;
3111 uint64_t qlm1_spd:4;
3112 uint64_t qlm0_spd:4;
3113 uint64_t lboot:10;
3114 uint64_t rboot:1;
3115 uint64_t rboot_pin:1;
3116#else
3117 uint64_t rboot_pin:1;
3118 uint64_t rboot:1;
3119 uint64_t lboot:10;
3120 uint64_t qlm0_spd:4;
3121 uint64_t qlm1_spd:4;
3122 uint64_t qlm2_spd:4;
3123 uint64_t pnr_mul:6;
3124 uint64_t c_mul:6;
3125 uint64_t qlm3_spd:4;
3126 uint64_t qlm4_spd:4;
3127 uint64_t reserved_44_63:20;
3128#endif
3129 } cn68xxp1;
3130};
3131
3132union cvmx_mio_rst_cfg {
3133 uint64_t u64;
3134 struct cvmx_mio_rst_cfg_s {
3135#ifdef __BIG_ENDIAN_BITFIELD
3136 uint64_t reserved_3_63:61;
3137 uint64_t cntl_clr_bist:1;
3138 uint64_t warm_clr_bist:1;
3139 uint64_t soft_clr_bist:1;
3140#else
3141 uint64_t soft_clr_bist:1;
3142 uint64_t warm_clr_bist:1;
3143 uint64_t cntl_clr_bist:1;
3144 uint64_t reserved_3_63:61;
3145#endif
3146 } s;
3147 struct cvmx_mio_rst_cfg_cn61xx {
3148#ifdef __BIG_ENDIAN_BITFIELD
3149 uint64_t bist_delay:58;
3150 uint64_t reserved_3_5:3;
3151 uint64_t cntl_clr_bist:1;
3152 uint64_t warm_clr_bist:1;
3153 uint64_t soft_clr_bist:1;
3154#else
3155 uint64_t soft_clr_bist:1;
3156 uint64_t warm_clr_bist:1;
3157 uint64_t cntl_clr_bist:1;
3158 uint64_t reserved_3_5:3;
3159 uint64_t bist_delay:58;
3160#endif
3161 } cn61xx;
3162 struct cvmx_mio_rst_cfg_cn63xxp1 {
3163#ifdef __BIG_ENDIAN_BITFIELD
3164 uint64_t bist_delay:58;
3165 uint64_t reserved_2_5:4;
3166 uint64_t warm_clr_bist:1;
3167 uint64_t soft_clr_bist:1;
3168#else
3169 uint64_t soft_clr_bist:1;
3170 uint64_t warm_clr_bist:1;
3171 uint64_t reserved_2_5:4;
3172 uint64_t bist_delay:58;
3173#endif
3174 } cn63xxp1;
3175 struct cvmx_mio_rst_cfg_cn68xx {
3176#ifdef __BIG_ENDIAN_BITFIELD
3177 uint64_t bist_delay:56;
3178 uint64_t reserved_3_7:5;
3179 uint64_t cntl_clr_bist:1;
3180 uint64_t warm_clr_bist:1;
3181 uint64_t soft_clr_bist:1;
3182#else
3183 uint64_t soft_clr_bist:1;
3184 uint64_t warm_clr_bist:1;
3185 uint64_t cntl_clr_bist:1;
3186 uint64_t reserved_3_7:5;
3187 uint64_t bist_delay:56;
3188#endif
3189 } cn68xx;
3190};
3191
3192union cvmx_mio_rst_ckill {
3193 uint64_t u64;
3194 struct cvmx_mio_rst_ckill_s {
3195#ifdef __BIG_ENDIAN_BITFIELD
3196 uint64_t reserved_47_63:17;
3197 uint64_t timer:47;
3198#else
3199 uint64_t timer:47;
3200 uint64_t reserved_47_63:17;
3201#endif
3202 } s;
3203};
3204
3205union cvmx_mio_rst_cntlx {
3206 uint64_t u64;
3207 struct cvmx_mio_rst_cntlx_s {
3208#ifdef __BIG_ENDIAN_BITFIELD
3209 uint64_t reserved_13_63:51;
3210 uint64_t in_rev_ln:1;
3211 uint64_t rev_lanes:1;
3212 uint64_t gen1_only:1;
3213 uint64_t prst_link:1;
3214 uint64_t rst_done:1;
3215 uint64_t rst_link:1;
3216 uint64_t host_mode:1;
3217 uint64_t prtmode:2;
3218 uint64_t rst_drv:1;
3219 uint64_t rst_rcv:1;
3220 uint64_t rst_chip:1;
3221 uint64_t rst_val:1;
3222#else
3223 uint64_t rst_val:1;
3224 uint64_t rst_chip:1;
3225 uint64_t rst_rcv:1;
3226 uint64_t rst_drv:1;
3227 uint64_t prtmode:2;
3228 uint64_t host_mode:1;
3229 uint64_t rst_link:1;
3230 uint64_t rst_done:1;
3231 uint64_t prst_link:1;
3232 uint64_t gen1_only:1;
3233 uint64_t rev_lanes:1;
3234 uint64_t in_rev_ln:1;
3235 uint64_t reserved_13_63:51;
3236#endif
3237 } s;
3238 struct cvmx_mio_rst_cntlx_cn66xx {
3239#ifdef __BIG_ENDIAN_BITFIELD
3240 uint64_t reserved_10_63:54;
3241 uint64_t prst_link:1;
3242 uint64_t rst_done:1;
3243 uint64_t rst_link:1;
3244 uint64_t host_mode:1;
3245 uint64_t prtmode:2;
3246 uint64_t rst_drv:1;
3247 uint64_t rst_rcv:1;
3248 uint64_t rst_chip:1;
3249 uint64_t rst_val:1;
3250#else
3251 uint64_t rst_val:1;
3252 uint64_t rst_chip:1;
3253 uint64_t rst_rcv:1;
3254 uint64_t rst_drv:1;
3255 uint64_t prtmode:2;
3256 uint64_t host_mode:1;
3257 uint64_t rst_link:1;
3258 uint64_t rst_done:1;
3259 uint64_t prst_link:1;
3260 uint64_t reserved_10_63:54;
3261#endif
3262 } cn66xx;
3263};
3264
3265union cvmx_mio_rst_ctlx {
3266 uint64_t u64;
3267 struct cvmx_mio_rst_ctlx_s {
3268#ifdef __BIG_ENDIAN_BITFIELD
3269 uint64_t reserved_13_63:51;
3270 uint64_t in_rev_ln:1;
3271 uint64_t rev_lanes:1;
3272 uint64_t gen1_only:1;
3273 uint64_t prst_link:1;
3274 uint64_t rst_done:1;
3275 uint64_t rst_link:1;
3276 uint64_t host_mode:1;
3277 uint64_t prtmode:2;
3278 uint64_t rst_drv:1;
3279 uint64_t rst_rcv:1;
3280 uint64_t rst_chip:1;
3281 uint64_t rst_val:1;
3282#else
3283 uint64_t rst_val:1;
3284 uint64_t rst_chip:1;
3285 uint64_t rst_rcv:1;
3286 uint64_t rst_drv:1;
3287 uint64_t prtmode:2;
3288 uint64_t host_mode:1;
3289 uint64_t rst_link:1;
3290 uint64_t rst_done:1;
3291 uint64_t prst_link:1;
3292 uint64_t gen1_only:1;
3293 uint64_t rev_lanes:1;
3294 uint64_t in_rev_ln:1;
3295 uint64_t reserved_13_63:51;
3296#endif
3297 } s;
3298 struct cvmx_mio_rst_ctlx_cn63xx {
3299#ifdef __BIG_ENDIAN_BITFIELD
3300 uint64_t reserved_10_63:54;
3301 uint64_t prst_link:1;
3302 uint64_t rst_done:1;
3303 uint64_t rst_link:1;
3304 uint64_t host_mode:1;
3305 uint64_t prtmode:2;
3306 uint64_t rst_drv:1;
3307 uint64_t rst_rcv:1;
3308 uint64_t rst_chip:1;
3309 uint64_t rst_val:1;
3310#else
3311 uint64_t rst_val:1;
3312 uint64_t rst_chip:1;
3313 uint64_t rst_rcv:1;
3314 uint64_t rst_drv:1;
3315 uint64_t prtmode:2;
3316 uint64_t host_mode:1;
3317 uint64_t rst_link:1;
3318 uint64_t rst_done:1;
3319 uint64_t prst_link:1;
3320 uint64_t reserved_10_63:54;
3321#endif
3322 } cn63xx;
3323 struct cvmx_mio_rst_ctlx_cn63xxp1 {
3324#ifdef __BIG_ENDIAN_BITFIELD
3325 uint64_t reserved_9_63:55;
3326 uint64_t rst_done:1;
3327 uint64_t rst_link:1;
3328 uint64_t host_mode:1;
3329 uint64_t prtmode:2;
3330 uint64_t rst_drv:1;
3331 uint64_t rst_rcv:1;
3332 uint64_t rst_chip:1;
3333 uint64_t rst_val:1;
3334#else
3335 uint64_t rst_val:1;
3336 uint64_t rst_chip:1;
3337 uint64_t rst_rcv:1;
3338 uint64_t rst_drv:1;
3339 uint64_t prtmode:2;
3340 uint64_t host_mode:1;
3341 uint64_t rst_link:1;
3342 uint64_t rst_done:1;
3343 uint64_t reserved_9_63:55;
3344#endif
3345 } cn63xxp1;
3346};
3347
3348union cvmx_mio_rst_delay {
3349 uint64_t u64;
3350 struct cvmx_mio_rst_delay_s {
3351#ifdef __BIG_ENDIAN_BITFIELD
3352 uint64_t reserved_32_63:32;
3353 uint64_t warm_rst_dly:16;
3354 uint64_t soft_rst_dly:16;
3355#else
3356 uint64_t soft_rst_dly:16;
3357 uint64_t warm_rst_dly:16;
3358 uint64_t reserved_32_63:32;
3359#endif
3360 } s;
3361};
3362
3363union cvmx_mio_rst_int {
3364 uint64_t u64;
3365 struct cvmx_mio_rst_int_s {
3366#ifdef __BIG_ENDIAN_BITFIELD
3367 uint64_t reserved_10_63:54;
3368 uint64_t perst1:1;
3369 uint64_t perst0:1;
3370 uint64_t reserved_4_7:4;
3371 uint64_t rst_link3:1;
3372 uint64_t rst_link2:1;
3373 uint64_t rst_link1:1;
3374 uint64_t rst_link0:1;
3375#else
3376 uint64_t rst_link0:1;
3377 uint64_t rst_link1:1;
3378 uint64_t rst_link2:1;
3379 uint64_t rst_link3:1;
3380 uint64_t reserved_4_7:4;
3381 uint64_t perst0:1;
3382 uint64_t perst1:1;
3383 uint64_t reserved_10_63:54;
3384#endif
3385 } s;
3386 struct cvmx_mio_rst_int_cn61xx {
3387#ifdef __BIG_ENDIAN_BITFIELD
3388 uint64_t reserved_10_63:54;
3389 uint64_t perst1:1;
3390 uint64_t perst0:1;
3391 uint64_t reserved_2_7:6;
3392 uint64_t rst_link1:1;
3393 uint64_t rst_link0:1;
3394#else
3395 uint64_t rst_link0:1;
3396 uint64_t rst_link1:1;
3397 uint64_t reserved_2_7:6;
3398 uint64_t perst0:1;
3399 uint64_t perst1:1;
3400 uint64_t reserved_10_63:54;
3401#endif
3402 } cn61xx;
3403};
3404
3405union cvmx_mio_rst_int_en {
3406 uint64_t u64;
3407 struct cvmx_mio_rst_int_en_s {
3408#ifdef __BIG_ENDIAN_BITFIELD
3409 uint64_t reserved_10_63:54;
3410 uint64_t perst1:1;
3411 uint64_t perst0:1;
3412 uint64_t reserved_4_7:4;
3413 uint64_t rst_link3:1;
3414 uint64_t rst_link2:1;
3415 uint64_t rst_link1:1;
3416 uint64_t rst_link0:1;
3417#else
3418 uint64_t rst_link0:1;
3419 uint64_t rst_link1:1;
3420 uint64_t rst_link2:1;
3421 uint64_t rst_link3:1;
3422 uint64_t reserved_4_7:4;
3423 uint64_t perst0:1;
3424 uint64_t perst1:1;
3425 uint64_t reserved_10_63:54;
3426#endif
3427 } s;
3428 struct cvmx_mio_rst_int_en_cn61xx {
3429#ifdef __BIG_ENDIAN_BITFIELD
3430 uint64_t reserved_10_63:54;
3431 uint64_t perst1:1;
3432 uint64_t perst0:1;
3433 uint64_t reserved_2_7:6;
3434 uint64_t rst_link1:1;
3435 uint64_t rst_link0:1;
3436#else
3437 uint64_t rst_link0:1;
3438 uint64_t rst_link1:1;
3439 uint64_t reserved_2_7:6;
3440 uint64_t perst0:1;
3441 uint64_t perst1:1;
3442 uint64_t reserved_10_63:54;
3443#endif
3444 } cn61xx;
3445};
3446
3447union cvmx_mio_twsx_int {
3448 uint64_t u64;
3449 struct cvmx_mio_twsx_int_s {
3450#ifdef __BIG_ENDIAN_BITFIELD
3451 uint64_t reserved_12_63:52;
3452 uint64_t scl:1;
3453 uint64_t sda:1;
3454 uint64_t scl_ovr:1;
3455 uint64_t sda_ovr:1;
3456 uint64_t reserved_7_7:1;
3457 uint64_t core_en:1;
3458 uint64_t ts_en:1;
3459 uint64_t st_en:1;
3460 uint64_t reserved_3_3:1;
3461 uint64_t core_int:1;
3462 uint64_t ts_int:1;
3463 uint64_t st_int:1;
3464#else
3465 uint64_t st_int:1;
3466 uint64_t ts_int:1;
3467 uint64_t core_int:1;
3468 uint64_t reserved_3_3:1;
3469 uint64_t st_en:1;
3470 uint64_t ts_en:1;
3471 uint64_t core_en:1;
3472 uint64_t reserved_7_7:1;
3473 uint64_t sda_ovr:1;
3474 uint64_t scl_ovr:1;
3475 uint64_t sda:1;
3476 uint64_t scl:1;
3477 uint64_t reserved_12_63:52;
3478#endif
3479 } s;
3480 struct cvmx_mio_twsx_int_cn38xxp2 {
3481#ifdef __BIG_ENDIAN_BITFIELD
3482 uint64_t reserved_7_63:57;
3483 uint64_t core_en:1;
3484 uint64_t ts_en:1;
3485 uint64_t st_en:1;
3486 uint64_t reserved_3_3:1;
3487 uint64_t core_int:1;
3488 uint64_t ts_int:1;
3489 uint64_t st_int:1;
3490#else
3491 uint64_t st_int:1;
3492 uint64_t ts_int:1;
3493 uint64_t core_int:1;
3494 uint64_t reserved_3_3:1;
3495 uint64_t st_en:1;
3496 uint64_t ts_en:1;
3497 uint64_t core_en:1;
3498 uint64_t reserved_7_63:57;
3499#endif
3500 } cn38xxp2;
3501};
3502
3503union cvmx_mio_twsx_sw_twsi {
3504 uint64_t u64;
3505 struct cvmx_mio_twsx_sw_twsi_s {
3506#ifdef __BIG_ENDIAN_BITFIELD
3507 uint64_t v:1;
3508 uint64_t slonly:1;
3509 uint64_t eia:1;
3510 uint64_t op:4;
3511 uint64_t r:1;
3512 uint64_t sovr:1;
3513 uint64_t size:3;
3514 uint64_t scr:2;
3515 uint64_t a:10;
3516 uint64_t ia:5;
3517 uint64_t eop_ia:3;
3518 uint64_t d:32;
3519#else
3520 uint64_t d:32;
3521 uint64_t eop_ia:3;
3522 uint64_t ia:5;
3523 uint64_t a:10;
3524 uint64_t scr:2;
3525 uint64_t size:3;
3526 uint64_t sovr:1;
3527 uint64_t r:1;
3528 uint64_t op:4;
3529 uint64_t eia:1;
3530 uint64_t slonly:1;
3531 uint64_t v:1;
3532#endif
3533 } s;
3534};
3535
3536union cvmx_mio_twsx_sw_twsi_ext {
3537 uint64_t u64;
3538 struct cvmx_mio_twsx_sw_twsi_ext_s {
3539#ifdef __BIG_ENDIAN_BITFIELD
3540 uint64_t reserved_40_63:24;
3541 uint64_t ia:8;
3542 uint64_t d:32;
3543#else
3544 uint64_t d:32;
3545 uint64_t ia:8;
3546 uint64_t reserved_40_63:24;
3547#endif
3548 } s;
3549};
3550
3551union cvmx_mio_twsx_twsi_sw {
3552 uint64_t u64;
3553 struct cvmx_mio_twsx_twsi_sw_s {
3554#ifdef __BIG_ENDIAN_BITFIELD
3555 uint64_t v:2;
3556 uint64_t reserved_32_61:30;
3557 uint64_t d:32;
3558#else
3559 uint64_t d:32;
3560 uint64_t reserved_32_61:30;
3561 uint64_t v:2;
3562#endif
3563 } s;
3564};
3565
3566union cvmx_mio_uartx_dlh {
3567 uint64_t u64;
3568 struct cvmx_mio_uartx_dlh_s {
3569#ifdef __BIG_ENDIAN_BITFIELD
3570 uint64_t reserved_8_63:56;
3571 uint64_t dlh:8;
3572#else
3573 uint64_t dlh:8;
3574 uint64_t reserved_8_63:56;
3575#endif
3576 } s;
3577};
3578
3579union cvmx_mio_uartx_dll {
3580 uint64_t u64;
3581 struct cvmx_mio_uartx_dll_s {
3582#ifdef __BIG_ENDIAN_BITFIELD
3583 uint64_t reserved_8_63:56;
3584 uint64_t dll:8;
3585#else
3586 uint64_t dll:8;
3587 uint64_t reserved_8_63:56;
3588#endif
3589 } s;
3590};
3591
3592union cvmx_mio_uartx_far {
3593 uint64_t u64;
3594 struct cvmx_mio_uartx_far_s {
3595#ifdef __BIG_ENDIAN_BITFIELD
3596 uint64_t reserved_1_63:63;
3597 uint64_t far:1;
3598#else
3599 uint64_t far:1;
3600 uint64_t reserved_1_63:63;
3601#endif
3602 } s;
3603};
3604
3605union cvmx_mio_uartx_fcr {
3606 uint64_t u64;
3607 struct cvmx_mio_uartx_fcr_s {
3608#ifdef __BIG_ENDIAN_BITFIELD
3609 uint64_t reserved_8_63:56;
3610 uint64_t rxtrig:2;
3611 uint64_t txtrig:2;
3612 uint64_t reserved_3_3:1;
3613 uint64_t txfr:1;
3614 uint64_t rxfr:1;
3615 uint64_t en:1;
3616#else
3617 uint64_t en:1;
3618 uint64_t rxfr:1;
3619 uint64_t txfr:1;
3620 uint64_t reserved_3_3:1;
3621 uint64_t txtrig:2;
3622 uint64_t rxtrig:2;
3623 uint64_t reserved_8_63:56;
3624#endif
3625 } s;
3626};
3627
3628union cvmx_mio_uartx_htx {
3629 uint64_t u64;
3630 struct cvmx_mio_uartx_htx_s {
3631#ifdef __BIG_ENDIAN_BITFIELD
3632 uint64_t reserved_1_63:63;
3633 uint64_t htx:1;
3634#else
3635 uint64_t htx:1;
3636 uint64_t reserved_1_63:63;
3637#endif
3638 } s;
3639};
3640
3641union cvmx_mio_uartx_ier {
3642 uint64_t u64;
3643 struct cvmx_mio_uartx_ier_s {
3644#ifdef __BIG_ENDIAN_BITFIELD
3645 uint64_t reserved_8_63:56;
3646 uint64_t ptime:1;
3647 uint64_t reserved_4_6:3;
3648 uint64_t edssi:1;
3649 uint64_t elsi:1;
3650 uint64_t etbei:1;
3651 uint64_t erbfi:1;
3652#else
3653 uint64_t erbfi:1;
3654 uint64_t etbei:1;
3655 uint64_t elsi:1;
3656 uint64_t edssi:1;
3657 uint64_t reserved_4_6:3;
3658 uint64_t ptime:1;
3659 uint64_t reserved_8_63:56;
3660#endif
3661 } s;
3662};
3663
3664union cvmx_mio_uartx_iir {
3665 uint64_t u64;
3666 struct cvmx_mio_uartx_iir_s {
3667#ifdef __BIG_ENDIAN_BITFIELD
3668 uint64_t reserved_8_63:56;
3669 uint64_t fen:2;
3670 uint64_t reserved_4_5:2;
3671 uint64_t iid:4;
3672#else
3673 uint64_t iid:4;
3674 uint64_t reserved_4_5:2;
3675 uint64_t fen:2;
3676 uint64_t reserved_8_63:56;
3677#endif
3678 } s;
3679};
3680
3681union cvmx_mio_uartx_lcr {
3682 uint64_t u64;
3683 struct cvmx_mio_uartx_lcr_s {
3684#ifdef __BIG_ENDIAN_BITFIELD
3685 uint64_t reserved_8_63:56;
3686 uint64_t dlab:1;
3687 uint64_t brk:1;
3688 uint64_t reserved_5_5:1;
3689 uint64_t eps:1;
3690 uint64_t pen:1;
3691 uint64_t stop:1;
3692 uint64_t cls:2;
3693#else
3694 uint64_t cls:2;
3695 uint64_t stop:1;
3696 uint64_t pen:1;
3697 uint64_t eps:1;
3698 uint64_t reserved_5_5:1;
3699 uint64_t brk:1;
3700 uint64_t dlab:1;
3701 uint64_t reserved_8_63:56;
3702#endif
3703 } s;
3704};
3705
3706union cvmx_mio_uartx_lsr {
3707 uint64_t u64;
3708 struct cvmx_mio_uartx_lsr_s {
3709#ifdef __BIG_ENDIAN_BITFIELD
3710 uint64_t reserved_8_63:56;
3711 uint64_t ferr:1;
3712 uint64_t temt:1;
3713 uint64_t thre:1;
3714 uint64_t bi:1;
3715 uint64_t fe:1;
3716 uint64_t pe:1;
3717 uint64_t oe:1;
3718 uint64_t dr:1;
3719#else
3720 uint64_t dr:1;
3721 uint64_t oe:1;
3722 uint64_t pe:1;
3723 uint64_t fe:1;
3724 uint64_t bi:1;
3725 uint64_t thre:1;
3726 uint64_t temt:1;
3727 uint64_t ferr:1;
3728 uint64_t reserved_8_63:56;
3729#endif
3730 } s;
3731};
3732
3733union cvmx_mio_uartx_mcr {
3734 uint64_t u64;
3735 struct cvmx_mio_uartx_mcr_s {
3736#ifdef __BIG_ENDIAN_BITFIELD
3737 uint64_t reserved_6_63:58;
3738 uint64_t afce:1;
3739 uint64_t loop:1;
3740 uint64_t out2:1;
3741 uint64_t out1:1;
3742 uint64_t rts:1;
3743 uint64_t dtr:1;
3744#else
3745 uint64_t dtr:1;
3746 uint64_t rts:1;
3747 uint64_t out1:1;
3748 uint64_t out2:1;
3749 uint64_t loop:1;
3750 uint64_t afce:1;
3751 uint64_t reserved_6_63:58;
3752#endif
3753 } s;
3754};
3755
3756union cvmx_mio_uartx_msr {
3757 uint64_t u64;
3758 struct cvmx_mio_uartx_msr_s {
3759#ifdef __BIG_ENDIAN_BITFIELD
3760 uint64_t reserved_8_63:56;
3761 uint64_t dcd:1;
3762 uint64_t ri:1;
3763 uint64_t dsr:1;
3764 uint64_t cts:1;
3765 uint64_t ddcd:1;
3766 uint64_t teri:1;
3767 uint64_t ddsr:1;
3768 uint64_t dcts:1;
3769#else
3770 uint64_t dcts:1;
3771 uint64_t ddsr:1;
3772 uint64_t teri:1;
3773 uint64_t ddcd:1;
3774 uint64_t cts:1;
3775 uint64_t dsr:1;
3776 uint64_t ri:1;
3777 uint64_t dcd:1;
3778 uint64_t reserved_8_63:56;
3779#endif
3780 } s;
3781};
3782
3783union cvmx_mio_uartx_rbr {
3784 uint64_t u64;
3785 struct cvmx_mio_uartx_rbr_s {
3786#ifdef __BIG_ENDIAN_BITFIELD
3787 uint64_t reserved_8_63:56;
3788 uint64_t rbr:8;
3789#else
3790 uint64_t rbr:8;
3791 uint64_t reserved_8_63:56;
3792#endif
3793 } s;
3794};
3795
3796union cvmx_mio_uartx_rfl {
3797 uint64_t u64;
3798 struct cvmx_mio_uartx_rfl_s {
3799#ifdef __BIG_ENDIAN_BITFIELD
3800 uint64_t reserved_7_63:57;
3801 uint64_t rfl:7;
3802#else
3803 uint64_t rfl:7;
3804 uint64_t reserved_7_63:57;
3805#endif
3806 } s;
3807};
3808
3809union cvmx_mio_uartx_rfw {
3810 uint64_t u64;
3811 struct cvmx_mio_uartx_rfw_s {
3812#ifdef __BIG_ENDIAN_BITFIELD
3813 uint64_t reserved_10_63:54;
3814 uint64_t rffe:1;
3815 uint64_t rfpe:1;
3816 uint64_t rfwd:8;
3817#else
3818 uint64_t rfwd:8;
3819 uint64_t rfpe:1;
3820 uint64_t rffe:1;
3821 uint64_t reserved_10_63:54;
3822#endif
3823 } s;
3824};
3825
3826union cvmx_mio_uartx_sbcr {
3827 uint64_t u64;
3828 struct cvmx_mio_uartx_sbcr_s {
3829#ifdef __BIG_ENDIAN_BITFIELD
3830 uint64_t reserved_1_63:63;
3831 uint64_t sbcr:1;
3832#else
3833 uint64_t sbcr:1;
3834 uint64_t reserved_1_63:63;
3835#endif
3836 } s;
3837};
3838
3839union cvmx_mio_uartx_scr {
3840 uint64_t u64;
3841 struct cvmx_mio_uartx_scr_s {
3842#ifdef __BIG_ENDIAN_BITFIELD
3843 uint64_t reserved_8_63:56;
3844 uint64_t scr:8;
3845#else
3846 uint64_t scr:8;
3847 uint64_t reserved_8_63:56;
3848#endif
3849 } s;
3850};
3851
3852union cvmx_mio_uartx_sfe {
3853 uint64_t u64;
3854 struct cvmx_mio_uartx_sfe_s {
3855#ifdef __BIG_ENDIAN_BITFIELD
3856 uint64_t reserved_1_63:63;
3857 uint64_t sfe:1;
3858#else
3859 uint64_t sfe:1;
3860 uint64_t reserved_1_63:63;
3861#endif
3862 } s;
3863};
3864
3865union cvmx_mio_uartx_srr {
3866 uint64_t u64;
3867 struct cvmx_mio_uartx_srr_s {
3868#ifdef __BIG_ENDIAN_BITFIELD
3869 uint64_t reserved_3_63:61;
3870 uint64_t stfr:1;
3871 uint64_t srfr:1;
3872 uint64_t usr:1;
3873#else
3874 uint64_t usr:1;
3875 uint64_t srfr:1;
3876 uint64_t stfr:1;
3877 uint64_t reserved_3_63:61;
3878#endif
3879 } s;
3880};
3881
3882union cvmx_mio_uartx_srt {
3883 uint64_t u64;
3884 struct cvmx_mio_uartx_srt_s {
3885#ifdef __BIG_ENDIAN_BITFIELD
3886 uint64_t reserved_2_63:62;
3887 uint64_t srt:2;
3888#else
3889 uint64_t srt:2;
3890 uint64_t reserved_2_63:62;
3891#endif
3892 } s;
3893};
3894
3895union cvmx_mio_uartx_srts {
3896 uint64_t u64;
3897 struct cvmx_mio_uartx_srts_s {
3898#ifdef __BIG_ENDIAN_BITFIELD
3899 uint64_t reserved_1_63:63;
3900 uint64_t srts:1;
3901#else
3902 uint64_t srts:1;
3903 uint64_t reserved_1_63:63;
3904#endif
3905 } s;
3906};
3907
3908union cvmx_mio_uartx_stt {
3909 uint64_t u64;
3910 struct cvmx_mio_uartx_stt_s {
3911#ifdef __BIG_ENDIAN_BITFIELD
3912 uint64_t reserved_2_63:62;
3913 uint64_t stt:2;
3914#else
3915 uint64_t stt:2;
3916 uint64_t reserved_2_63:62;
3917#endif
3918 } s;
3919};
3920
3921union cvmx_mio_uartx_tfl {
3922 uint64_t u64;
3923 struct cvmx_mio_uartx_tfl_s {
3924#ifdef __BIG_ENDIAN_BITFIELD
3925 uint64_t reserved_7_63:57;
3926 uint64_t tfl:7;
3927#else
3928 uint64_t tfl:7;
3929 uint64_t reserved_7_63:57;
3930#endif
3931 } s;
3932};
3933
3934union cvmx_mio_uartx_tfr {
3935 uint64_t u64;
3936 struct cvmx_mio_uartx_tfr_s {
3937#ifdef __BIG_ENDIAN_BITFIELD
3938 uint64_t reserved_8_63:56;
3939 uint64_t tfr:8;
3940#else
3941 uint64_t tfr:8;
3942 uint64_t reserved_8_63:56;
3943#endif
3944 } s;
3945};
3946
3947union cvmx_mio_uartx_thr {
3948 uint64_t u64;
3949 struct cvmx_mio_uartx_thr_s {
3950#ifdef __BIG_ENDIAN_BITFIELD
3951 uint64_t reserved_8_63:56;
3952 uint64_t thr:8;
3953#else
3954 uint64_t thr:8;
3955 uint64_t reserved_8_63:56;
3956#endif
3957 } s;
3958};
3959
3960union cvmx_mio_uartx_usr {
3961 uint64_t u64;
3962 struct cvmx_mio_uartx_usr_s {
3963#ifdef __BIG_ENDIAN_BITFIELD
3964 uint64_t reserved_5_63:59;
3965 uint64_t rff:1;
3966 uint64_t rfne:1;
3967 uint64_t tfe:1;
3968 uint64_t tfnf:1;
3969 uint64_t busy:1;
3970#else
3971 uint64_t busy:1;
3972 uint64_t tfnf:1;
3973 uint64_t tfe:1;
3974 uint64_t rfne:1;
3975 uint64_t rff:1;
3976 uint64_t reserved_5_63:59;
3977#endif
3978 } s;
3979};
3980
3981union cvmx_mio_uart2_dlh {
3982 uint64_t u64;
3983 struct cvmx_mio_uart2_dlh_s {
3984#ifdef __BIG_ENDIAN_BITFIELD
3985 uint64_t reserved_8_63:56;
3986 uint64_t dlh:8;
3987#else
3988 uint64_t dlh:8;
3989 uint64_t reserved_8_63:56;
3990#endif
3991 } s;
3992};
3993
3994union cvmx_mio_uart2_dll {
3995 uint64_t u64;
3996 struct cvmx_mio_uart2_dll_s {
3997#ifdef __BIG_ENDIAN_BITFIELD
3998 uint64_t reserved_8_63:56;
3999 uint64_t dll:8;
4000#else
4001 uint64_t dll:8;
4002 uint64_t reserved_8_63:56;
4003#endif
4004 } s;
4005};
4006
4007union cvmx_mio_uart2_far {
4008 uint64_t u64;
4009 struct cvmx_mio_uart2_far_s {
4010#ifdef __BIG_ENDIAN_BITFIELD
4011 uint64_t reserved_1_63:63;
4012 uint64_t far:1;
4013#else
4014 uint64_t far:1;
4015 uint64_t reserved_1_63:63;
4016#endif
4017 } s;
4018};
4019
4020union cvmx_mio_uart2_fcr {
4021 uint64_t u64;
4022 struct cvmx_mio_uart2_fcr_s {
4023#ifdef __BIG_ENDIAN_BITFIELD
4024 uint64_t reserved_8_63:56;
4025 uint64_t rxtrig:2;
4026 uint64_t txtrig:2;
4027 uint64_t reserved_3_3:1;
4028 uint64_t txfr:1;
4029 uint64_t rxfr:1;
4030 uint64_t en:1;
4031#else
4032 uint64_t en:1;
4033 uint64_t rxfr:1;
4034 uint64_t txfr:1;
4035 uint64_t reserved_3_3:1;
4036 uint64_t txtrig:2;
4037 uint64_t rxtrig:2;
4038 uint64_t reserved_8_63:56;
4039#endif
4040 } s;
4041};
4042
4043union cvmx_mio_uart2_htx {
4044 uint64_t u64;
4045 struct cvmx_mio_uart2_htx_s {
4046#ifdef __BIG_ENDIAN_BITFIELD
4047 uint64_t reserved_1_63:63;
4048 uint64_t htx:1;
4049#else
4050 uint64_t htx:1;
4051 uint64_t reserved_1_63:63;
4052#endif
4053 } s;
4054};
4055
4056union cvmx_mio_uart2_ier {
4057 uint64_t u64;
4058 struct cvmx_mio_uart2_ier_s {
4059#ifdef __BIG_ENDIAN_BITFIELD
4060 uint64_t reserved_8_63:56;
4061 uint64_t ptime:1;
4062 uint64_t reserved_4_6:3;
4063 uint64_t edssi:1;
4064 uint64_t elsi:1;
4065 uint64_t etbei:1;
4066 uint64_t erbfi:1;
4067#else
4068 uint64_t erbfi:1;
4069 uint64_t etbei:1;
4070 uint64_t elsi:1;
4071 uint64_t edssi:1;
4072 uint64_t reserved_4_6:3;
4073 uint64_t ptime:1;
4074 uint64_t reserved_8_63:56;
4075#endif
4076 } s;
4077};
4078
4079union cvmx_mio_uart2_iir {
4080 uint64_t u64;
4081 struct cvmx_mio_uart2_iir_s {
4082#ifdef __BIG_ENDIAN_BITFIELD
4083 uint64_t reserved_8_63:56;
4084 uint64_t fen:2;
4085 uint64_t reserved_4_5:2;
4086 uint64_t iid:4;
4087#else
4088 uint64_t iid:4;
4089 uint64_t reserved_4_5:2;
4090 uint64_t fen:2;
4091 uint64_t reserved_8_63:56;
4092#endif
4093 } s;
4094};
4095
4096union cvmx_mio_uart2_lcr {
4097 uint64_t u64;
4098 struct cvmx_mio_uart2_lcr_s {
4099#ifdef __BIG_ENDIAN_BITFIELD
4100 uint64_t reserved_8_63:56;
4101 uint64_t dlab:1;
4102 uint64_t brk:1;
4103 uint64_t reserved_5_5:1;
4104 uint64_t eps:1;
4105 uint64_t pen:1;
4106 uint64_t stop:1;
4107 uint64_t cls:2;
4108#else
4109 uint64_t cls:2;
4110 uint64_t stop:1;
4111 uint64_t pen:1;
4112 uint64_t eps:1;
4113 uint64_t reserved_5_5:1;
4114 uint64_t brk:1;
4115 uint64_t dlab:1;
4116 uint64_t reserved_8_63:56;
4117#endif
4118 } s;
4119};
4120
4121union cvmx_mio_uart2_lsr {
4122 uint64_t u64;
4123 struct cvmx_mio_uart2_lsr_s {
4124#ifdef __BIG_ENDIAN_BITFIELD
4125 uint64_t reserved_8_63:56;
4126 uint64_t ferr:1;
4127 uint64_t temt:1;
4128 uint64_t thre:1;
4129 uint64_t bi:1;
4130 uint64_t fe:1;
4131 uint64_t pe:1;
4132 uint64_t oe:1;
4133 uint64_t dr:1;
4134#else
4135 uint64_t dr:1;
4136 uint64_t oe:1;
4137 uint64_t pe:1;
4138 uint64_t fe:1;
4139 uint64_t bi:1;
4140 uint64_t thre:1;
4141 uint64_t temt:1;
4142 uint64_t ferr:1;
4143 uint64_t reserved_8_63:56;
4144#endif
4145 } s;
4146};
4147
4148union cvmx_mio_uart2_mcr {
4149 uint64_t u64;
4150 struct cvmx_mio_uart2_mcr_s {
4151#ifdef __BIG_ENDIAN_BITFIELD
4152 uint64_t reserved_6_63:58;
4153 uint64_t afce:1;
4154 uint64_t loop:1;
4155 uint64_t out2:1;
4156 uint64_t out1:1;
4157 uint64_t rts:1;
4158 uint64_t dtr:1;
4159#else
4160 uint64_t dtr:1;
4161 uint64_t rts:1;
4162 uint64_t out1:1;
4163 uint64_t out2:1;
4164 uint64_t loop:1;
4165 uint64_t afce:1;
4166 uint64_t reserved_6_63:58;
4167#endif
4168 } s;
4169};
4170
4171union cvmx_mio_uart2_msr {
4172 uint64_t u64;
4173 struct cvmx_mio_uart2_msr_s {
4174#ifdef __BIG_ENDIAN_BITFIELD
4175 uint64_t reserved_8_63:56;
4176 uint64_t dcd:1;
4177 uint64_t ri:1;
4178 uint64_t dsr:1;
4179 uint64_t cts:1;
4180 uint64_t ddcd:1;
4181 uint64_t teri:1;
4182 uint64_t ddsr:1;
4183 uint64_t dcts:1;
4184#else
4185 uint64_t dcts:1;
4186 uint64_t ddsr:1;
4187 uint64_t teri:1;
4188 uint64_t ddcd:1;
4189 uint64_t cts:1;
4190 uint64_t dsr:1;
4191 uint64_t ri:1;
4192 uint64_t dcd:1;
4193 uint64_t reserved_8_63:56;
4194#endif
4195 } s;
4196};
4197
4198union cvmx_mio_uart2_rbr {
4199 uint64_t u64;
4200 struct cvmx_mio_uart2_rbr_s {
4201#ifdef __BIG_ENDIAN_BITFIELD
4202 uint64_t reserved_8_63:56;
4203 uint64_t rbr:8;
4204#else
4205 uint64_t rbr:8;
4206 uint64_t reserved_8_63:56;
4207#endif
4208 } s;
4209};
4210
4211union cvmx_mio_uart2_rfl {
4212 uint64_t u64;
4213 struct cvmx_mio_uart2_rfl_s {
4214#ifdef __BIG_ENDIAN_BITFIELD
4215 uint64_t reserved_7_63:57;
4216 uint64_t rfl:7;
4217#else
4218 uint64_t rfl:7;
4219 uint64_t reserved_7_63:57;
4220#endif
4221 } s;
4222};
4223
4224union cvmx_mio_uart2_rfw {
4225 uint64_t u64;
4226 struct cvmx_mio_uart2_rfw_s {
4227#ifdef __BIG_ENDIAN_BITFIELD
4228 uint64_t reserved_10_63:54;
4229 uint64_t rffe:1;
4230 uint64_t rfpe:1;
4231 uint64_t rfwd:8;
4232#else
4233 uint64_t rfwd:8;
4234 uint64_t rfpe:1;
4235 uint64_t rffe:1;
4236 uint64_t reserved_10_63:54;
4237#endif
4238 } s;
4239};
4240
4241union cvmx_mio_uart2_sbcr {
4242 uint64_t u64;
4243 struct cvmx_mio_uart2_sbcr_s {
4244#ifdef __BIG_ENDIAN_BITFIELD
4245 uint64_t reserved_1_63:63;
4246 uint64_t sbcr:1;
4247#else
4248 uint64_t sbcr:1;
4249 uint64_t reserved_1_63:63;
4250#endif
4251 } s;
4252};
4253
4254union cvmx_mio_uart2_scr {
4255 uint64_t u64;
4256 struct cvmx_mio_uart2_scr_s {
4257#ifdef __BIG_ENDIAN_BITFIELD
4258 uint64_t reserved_8_63:56;
4259 uint64_t scr:8;
4260#else
4261 uint64_t scr:8;
4262 uint64_t reserved_8_63:56;
4263#endif
4264 } s;
4265};
4266
4267union cvmx_mio_uart2_sfe {
4268 uint64_t u64;
4269 struct cvmx_mio_uart2_sfe_s {
4270#ifdef __BIG_ENDIAN_BITFIELD
4271 uint64_t reserved_1_63:63;
4272 uint64_t sfe:1;
4273#else
4274 uint64_t sfe:1;
4275 uint64_t reserved_1_63:63;
4276#endif
4277 } s;
4278};
4279
4280union cvmx_mio_uart2_srr {
4281 uint64_t u64;
4282 struct cvmx_mio_uart2_srr_s {
4283#ifdef __BIG_ENDIAN_BITFIELD
4284 uint64_t reserved_3_63:61;
4285 uint64_t stfr:1;
4286 uint64_t srfr:1;
4287 uint64_t usr:1;
4288#else
4289 uint64_t usr:1;
4290 uint64_t srfr:1;
4291 uint64_t stfr:1;
4292 uint64_t reserved_3_63:61;
4293#endif
4294 } s;
4295};
4296
4297union cvmx_mio_uart2_srt {
4298 uint64_t u64;
4299 struct cvmx_mio_uart2_srt_s {
4300#ifdef __BIG_ENDIAN_BITFIELD
4301 uint64_t reserved_2_63:62;
4302 uint64_t srt:2;
4303#else
4304 uint64_t srt:2;
4305 uint64_t reserved_2_63:62;
4306#endif
4307 } s;
4308};
4309
4310union cvmx_mio_uart2_srts {
4311 uint64_t u64;
4312 struct cvmx_mio_uart2_srts_s {
4313#ifdef __BIG_ENDIAN_BITFIELD
4314 uint64_t reserved_1_63:63;
4315 uint64_t srts:1;
4316#else
4317 uint64_t srts:1;
4318 uint64_t reserved_1_63:63;
4319#endif
4320 } s;
4321};
4322
4323union cvmx_mio_uart2_stt {
4324 uint64_t u64;
4325 struct cvmx_mio_uart2_stt_s {
4326#ifdef __BIG_ENDIAN_BITFIELD
4327 uint64_t reserved_2_63:62;
4328 uint64_t stt:2;
4329#else
4330 uint64_t stt:2;
4331 uint64_t reserved_2_63:62;
4332#endif
4333 } s;
4334};
4335
4336union cvmx_mio_uart2_tfl {
4337 uint64_t u64;
4338 struct cvmx_mio_uart2_tfl_s {
4339#ifdef __BIG_ENDIAN_BITFIELD
4340 uint64_t reserved_7_63:57;
4341 uint64_t tfl:7;
4342#else
4343 uint64_t tfl:7;
4344 uint64_t reserved_7_63:57;
4345#endif
4346 } s;
4347};
4348
4349union cvmx_mio_uart2_tfr {
4350 uint64_t u64;
4351 struct cvmx_mio_uart2_tfr_s {
4352#ifdef __BIG_ENDIAN_BITFIELD
4353 uint64_t reserved_8_63:56;
4354 uint64_t tfr:8;
4355#else
4356 uint64_t tfr:8;
4357 uint64_t reserved_8_63:56;
4358#endif
4359 } s;
4360};
4361
4362union cvmx_mio_uart2_thr {
4363 uint64_t u64;
4364 struct cvmx_mio_uart2_thr_s {
4365#ifdef __BIG_ENDIAN_BITFIELD
4366 uint64_t reserved_8_63:56;
4367 uint64_t thr:8;
4368#else
4369 uint64_t thr:8;
4370 uint64_t reserved_8_63:56;
4371#endif
4372 } s;
4373};
4374
4375union cvmx_mio_uart2_usr {
4376 uint64_t u64;
4377 struct cvmx_mio_uart2_usr_s {
4378#ifdef __BIG_ENDIAN_BITFIELD
4379 uint64_t reserved_5_63:59;
4380 uint64_t rff:1;
4381 uint64_t rfne:1;
4382 uint64_t tfe:1;
4383 uint64_t tfnf:1;
4384 uint64_t busy:1;
4385#else
4386 uint64_t busy:1;
4387 uint64_t tfnf:1;
4388 uint64_t tfe:1;
4389 uint64_t rfne:1;
4390 uint64_t rff:1;
4391 uint64_t reserved_5_63:59;
4392#endif
4393 } s;
4394};
4395
4396#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-mixx-defs.h b/arch/mips/include/asm/octeon/cvmx-mixx-defs.h
new file mode 100644
index 000000000..cd60d43e8
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-mixx-defs.h
@@ -0,0 +1,430 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_MIXX_DEFS_H__
29#define __CVMX_MIXX_DEFS_H__
30
31#define CVMX_MIXX_BIST(offset) (CVMX_ADD_IO_SEG(0x0001070000100078ull) + ((offset) & 1) * 2048)
32#define CVMX_MIXX_CTL(offset) (CVMX_ADD_IO_SEG(0x0001070000100020ull) + ((offset) & 1) * 2048)
33#define CVMX_MIXX_INTENA(offset) (CVMX_ADD_IO_SEG(0x0001070000100050ull) + ((offset) & 1) * 2048)
34#define CVMX_MIXX_IRCNT(offset) (CVMX_ADD_IO_SEG(0x0001070000100030ull) + ((offset) & 1) * 2048)
35#define CVMX_MIXX_IRHWM(offset) (CVMX_ADD_IO_SEG(0x0001070000100028ull) + ((offset) & 1) * 2048)
36#define CVMX_MIXX_IRING1(offset) (CVMX_ADD_IO_SEG(0x0001070000100010ull) + ((offset) & 1) * 2048)
37#define CVMX_MIXX_IRING2(offset) (CVMX_ADD_IO_SEG(0x0001070000100018ull) + ((offset) & 1) * 2048)
38#define CVMX_MIXX_ISR(offset) (CVMX_ADD_IO_SEG(0x0001070000100048ull) + ((offset) & 1) * 2048)
39#define CVMX_MIXX_ORCNT(offset) (CVMX_ADD_IO_SEG(0x0001070000100040ull) + ((offset) & 1) * 2048)
40#define CVMX_MIXX_ORHWM(offset) (CVMX_ADD_IO_SEG(0x0001070000100038ull) + ((offset) & 1) * 2048)
41#define CVMX_MIXX_ORING1(offset) (CVMX_ADD_IO_SEG(0x0001070000100000ull) + ((offset) & 1) * 2048)
42#define CVMX_MIXX_ORING2(offset) (CVMX_ADD_IO_SEG(0x0001070000100008ull) + ((offset) & 1) * 2048)
43#define CVMX_MIXX_REMCNT(offset) (CVMX_ADD_IO_SEG(0x0001070000100058ull) + ((offset) & 1) * 2048)
44#define CVMX_MIXX_TSCTL(offset) (CVMX_ADD_IO_SEG(0x0001070000100068ull) + ((offset) & 1) * 2048)
45#define CVMX_MIXX_TSTAMP(offset) (CVMX_ADD_IO_SEG(0x0001070000100060ull) + ((offset) & 1) * 2048)
46
47union cvmx_mixx_bist {
48 uint64_t u64;
49 struct cvmx_mixx_bist_s {
50#ifdef __BIG_ENDIAN_BITFIELD
51 uint64_t reserved_6_63:58;
52 uint64_t opfdat:1;
53 uint64_t mrgdat:1;
54 uint64_t mrqdat:1;
55 uint64_t ipfdat:1;
56 uint64_t irfdat:1;
57 uint64_t orfdat:1;
58#else
59 uint64_t orfdat:1;
60 uint64_t irfdat:1;
61 uint64_t ipfdat:1;
62 uint64_t mrqdat:1;
63 uint64_t mrgdat:1;
64 uint64_t opfdat:1;
65 uint64_t reserved_6_63:58;
66#endif
67 } s;
68 struct cvmx_mixx_bist_cn52xx {
69#ifdef __BIG_ENDIAN_BITFIELD
70 uint64_t reserved_4_63:60;
71 uint64_t mrqdat:1;
72 uint64_t ipfdat:1;
73 uint64_t irfdat:1;
74 uint64_t orfdat:1;
75#else
76 uint64_t orfdat:1;
77 uint64_t irfdat:1;
78 uint64_t ipfdat:1;
79 uint64_t mrqdat:1;
80 uint64_t reserved_4_63:60;
81#endif
82 } cn52xx;
83};
84
85union cvmx_mixx_ctl {
86 uint64_t u64;
87 struct cvmx_mixx_ctl_s {
88#ifdef __BIG_ENDIAN_BITFIELD
89 uint64_t reserved_12_63:52;
90 uint64_t ts_thresh:4;
91 uint64_t crc_strip:1;
92 uint64_t busy:1;
93 uint64_t en:1;
94 uint64_t reset:1;
95 uint64_t lendian:1;
96 uint64_t nbtarb:1;
97 uint64_t mrq_hwm:2;
98#else
99 uint64_t mrq_hwm:2;
100 uint64_t nbtarb:1;
101 uint64_t lendian:1;
102 uint64_t reset:1;
103 uint64_t en:1;
104 uint64_t busy:1;
105 uint64_t crc_strip:1;
106 uint64_t ts_thresh:4;
107 uint64_t reserved_12_63:52;
108#endif
109 } s;
110 struct cvmx_mixx_ctl_cn52xx {
111#ifdef __BIG_ENDIAN_BITFIELD
112 uint64_t reserved_8_63:56;
113 uint64_t crc_strip:1;
114 uint64_t busy:1;
115 uint64_t en:1;
116 uint64_t reset:1;
117 uint64_t lendian:1;
118 uint64_t nbtarb:1;
119 uint64_t mrq_hwm:2;
120#else
121 uint64_t mrq_hwm:2;
122 uint64_t nbtarb:1;
123 uint64_t lendian:1;
124 uint64_t reset:1;
125 uint64_t en:1;
126 uint64_t busy:1;
127 uint64_t crc_strip:1;
128 uint64_t reserved_8_63:56;
129#endif
130 } cn52xx;
131};
132
133union cvmx_mixx_intena {
134 uint64_t u64;
135 struct cvmx_mixx_intena_s {
136#ifdef __BIG_ENDIAN_BITFIELD
137 uint64_t reserved_8_63:56;
138 uint64_t tsena:1;
139 uint64_t orunena:1;
140 uint64_t irunena:1;
141 uint64_t data_drpena:1;
142 uint64_t ithena:1;
143 uint64_t othena:1;
144 uint64_t ivfena:1;
145 uint64_t ovfena:1;
146#else
147 uint64_t ovfena:1;
148 uint64_t ivfena:1;
149 uint64_t othena:1;
150 uint64_t ithena:1;
151 uint64_t data_drpena:1;
152 uint64_t irunena:1;
153 uint64_t orunena:1;
154 uint64_t tsena:1;
155 uint64_t reserved_8_63:56;
156#endif
157 } s;
158 struct cvmx_mixx_intena_cn52xx {
159#ifdef __BIG_ENDIAN_BITFIELD
160 uint64_t reserved_7_63:57;
161 uint64_t orunena:1;
162 uint64_t irunena:1;
163 uint64_t data_drpena:1;
164 uint64_t ithena:1;
165 uint64_t othena:1;
166 uint64_t ivfena:1;
167 uint64_t ovfena:1;
168#else
169 uint64_t ovfena:1;
170 uint64_t ivfena:1;
171 uint64_t othena:1;
172 uint64_t ithena:1;
173 uint64_t data_drpena:1;
174 uint64_t irunena:1;
175 uint64_t orunena:1;
176 uint64_t reserved_7_63:57;
177#endif
178 } cn52xx;
179};
180
181union cvmx_mixx_ircnt {
182 uint64_t u64;
183 struct cvmx_mixx_ircnt_s {
184#ifdef __BIG_ENDIAN_BITFIELD
185 uint64_t reserved_20_63:44;
186 uint64_t ircnt:20;
187#else
188 uint64_t ircnt:20;
189 uint64_t reserved_20_63:44;
190#endif
191 } s;
192};
193
194union cvmx_mixx_irhwm {
195 uint64_t u64;
196 struct cvmx_mixx_irhwm_s {
197#ifdef __BIG_ENDIAN_BITFIELD
198 uint64_t reserved_40_63:24;
199 uint64_t ibplwm:20;
200 uint64_t irhwm:20;
201#else
202 uint64_t irhwm:20;
203 uint64_t ibplwm:20;
204 uint64_t reserved_40_63:24;
205#endif
206 } s;
207};
208
209union cvmx_mixx_iring1 {
210 uint64_t u64;
211 struct cvmx_mixx_iring1_s {
212#ifdef __BIG_ENDIAN_BITFIELD
213 uint64_t reserved_60_63:4;
214 uint64_t isize:20;
215 uint64_t ibase:37;
216 uint64_t reserved_0_2:3;
217#else
218 uint64_t reserved_0_2:3;
219 uint64_t ibase:37;
220 uint64_t isize:20;
221 uint64_t reserved_60_63:4;
222#endif
223 } s;
224 struct cvmx_mixx_iring1_cn52xx {
225#ifdef __BIG_ENDIAN_BITFIELD
226 uint64_t reserved_60_63:4;
227 uint64_t isize:20;
228 uint64_t reserved_36_39:4;
229 uint64_t ibase:33;
230 uint64_t reserved_0_2:3;
231#else
232 uint64_t reserved_0_2:3;
233 uint64_t ibase:33;
234 uint64_t reserved_36_39:4;
235 uint64_t isize:20;
236 uint64_t reserved_60_63:4;
237#endif
238 } cn52xx;
239};
240
241union cvmx_mixx_iring2 {
242 uint64_t u64;
243 struct cvmx_mixx_iring2_s {
244#ifdef __BIG_ENDIAN_BITFIELD
245 uint64_t reserved_52_63:12;
246 uint64_t itlptr:20;
247 uint64_t reserved_20_31:12;
248 uint64_t idbell:20;
249#else
250 uint64_t idbell:20;
251 uint64_t reserved_20_31:12;
252 uint64_t itlptr:20;
253 uint64_t reserved_52_63:12;
254#endif
255 } s;
256};
257
258union cvmx_mixx_isr {
259 uint64_t u64;
260 struct cvmx_mixx_isr_s {
261#ifdef __BIG_ENDIAN_BITFIELD
262 uint64_t reserved_8_63:56;
263 uint64_t ts:1;
264 uint64_t orun:1;
265 uint64_t irun:1;
266 uint64_t data_drp:1;
267 uint64_t irthresh:1;
268 uint64_t orthresh:1;
269 uint64_t idblovf:1;
270 uint64_t odblovf:1;
271#else
272 uint64_t odblovf:1;
273 uint64_t idblovf:1;
274 uint64_t orthresh:1;
275 uint64_t irthresh:1;
276 uint64_t data_drp:1;
277 uint64_t irun:1;
278 uint64_t orun:1;
279 uint64_t ts:1;
280 uint64_t reserved_8_63:56;
281#endif
282 } s;
283 struct cvmx_mixx_isr_cn52xx {
284#ifdef __BIG_ENDIAN_BITFIELD
285 uint64_t reserved_7_63:57;
286 uint64_t orun:1;
287 uint64_t irun:1;
288 uint64_t data_drp:1;
289 uint64_t irthresh:1;
290 uint64_t orthresh:1;
291 uint64_t idblovf:1;
292 uint64_t odblovf:1;
293#else
294 uint64_t odblovf:1;
295 uint64_t idblovf:1;
296 uint64_t orthresh:1;
297 uint64_t irthresh:1;
298 uint64_t data_drp:1;
299 uint64_t irun:1;
300 uint64_t orun:1;
301 uint64_t reserved_7_63:57;
302#endif
303 } cn52xx;
304};
305
306union cvmx_mixx_orcnt {
307 uint64_t u64;
308 struct cvmx_mixx_orcnt_s {
309#ifdef __BIG_ENDIAN_BITFIELD
310 uint64_t reserved_20_63:44;
311 uint64_t orcnt:20;
312#else
313 uint64_t orcnt:20;
314 uint64_t reserved_20_63:44;
315#endif
316 } s;
317};
318
319union cvmx_mixx_orhwm {
320 uint64_t u64;
321 struct cvmx_mixx_orhwm_s {
322#ifdef __BIG_ENDIAN_BITFIELD
323 uint64_t reserved_20_63:44;
324 uint64_t orhwm:20;
325#else
326 uint64_t orhwm:20;
327 uint64_t reserved_20_63:44;
328#endif
329 } s;
330};
331
332union cvmx_mixx_oring1 {
333 uint64_t u64;
334 struct cvmx_mixx_oring1_s {
335#ifdef __BIG_ENDIAN_BITFIELD
336 uint64_t reserved_60_63:4;
337 uint64_t osize:20;
338 uint64_t obase:37;
339 uint64_t reserved_0_2:3;
340#else
341 uint64_t reserved_0_2:3;
342 uint64_t obase:37;
343 uint64_t osize:20;
344 uint64_t reserved_60_63:4;
345#endif
346 } s;
347 struct cvmx_mixx_oring1_cn52xx {
348#ifdef __BIG_ENDIAN_BITFIELD
349 uint64_t reserved_60_63:4;
350 uint64_t osize:20;
351 uint64_t reserved_36_39:4;
352 uint64_t obase:33;
353 uint64_t reserved_0_2:3;
354#else
355 uint64_t reserved_0_2:3;
356 uint64_t obase:33;
357 uint64_t reserved_36_39:4;
358 uint64_t osize:20;
359 uint64_t reserved_60_63:4;
360#endif
361 } cn52xx;
362};
363
364union cvmx_mixx_oring2 {
365 uint64_t u64;
366 struct cvmx_mixx_oring2_s {
367#ifdef __BIG_ENDIAN_BITFIELD
368 uint64_t reserved_52_63:12;
369 uint64_t otlptr:20;
370 uint64_t reserved_20_31:12;
371 uint64_t odbell:20;
372#else
373 uint64_t odbell:20;
374 uint64_t reserved_20_31:12;
375 uint64_t otlptr:20;
376 uint64_t reserved_52_63:12;
377#endif
378 } s;
379};
380
381union cvmx_mixx_remcnt {
382 uint64_t u64;
383 struct cvmx_mixx_remcnt_s {
384#ifdef __BIG_ENDIAN_BITFIELD
385 uint64_t reserved_52_63:12;
386 uint64_t iremcnt:20;
387 uint64_t reserved_20_31:12;
388 uint64_t oremcnt:20;
389#else
390 uint64_t oremcnt:20;
391 uint64_t reserved_20_31:12;
392 uint64_t iremcnt:20;
393 uint64_t reserved_52_63:12;
394#endif
395 } s;
396};
397
398union cvmx_mixx_tsctl {
399 uint64_t u64;
400 struct cvmx_mixx_tsctl_s {
401#ifdef __BIG_ENDIAN_BITFIELD
402 uint64_t reserved_21_63:43;
403 uint64_t tsavl:5;
404 uint64_t reserved_13_15:3;
405 uint64_t tstot:5;
406 uint64_t reserved_5_7:3;
407 uint64_t tscnt:5;
408#else
409 uint64_t tscnt:5;
410 uint64_t reserved_5_7:3;
411 uint64_t tstot:5;
412 uint64_t reserved_13_15:3;
413 uint64_t tsavl:5;
414 uint64_t reserved_21_63:43;
415#endif
416 } s;
417};
418
419union cvmx_mixx_tstamp {
420 uint64_t u64;
421 struct cvmx_mixx_tstamp_s {
422#ifdef __BIG_ENDIAN_BITFIELD
423 uint64_t tstamp:64;
424#else
425 uint64_t tstamp:64;
426#endif
427 } s;
428};
429
430#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-npei-defs.h b/arch/mips/include/asm/octeon/cvmx-npei-defs.h
new file mode 100644
index 000000000..6a51b1ef8
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-npei-defs.h
@@ -0,0 +1,3925 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_NPEI_DEFS_H__
29#define __CVMX_NPEI_DEFS_H__
30
31#define CVMX_NPEI_BAR1_INDEXX(offset) (0x0000000000000000ull + ((offset) & 31) * 16)
32#define CVMX_NPEI_BIST_STATUS (0x0000000000000580ull)
33#define CVMX_NPEI_BIST_STATUS2 (0x0000000000000680ull)
34#define CVMX_NPEI_CTL_PORT0 (0x0000000000000250ull)
35#define CVMX_NPEI_CTL_PORT1 (0x0000000000000260ull)
36#define CVMX_NPEI_CTL_STATUS (0x0000000000000570ull)
37#define CVMX_NPEI_CTL_STATUS2 (0x0000000000003C00ull)
38#define CVMX_NPEI_DATA_OUT_CNT (0x00000000000005F0ull)
39#define CVMX_NPEI_DBG_DATA (0x0000000000000510ull)
40#define CVMX_NPEI_DBG_SELECT (0x0000000000000500ull)
41#define CVMX_NPEI_DMA0_INT_LEVEL (0x00000000000005C0ull)
42#define CVMX_NPEI_DMA1_INT_LEVEL (0x00000000000005D0ull)
43#define CVMX_NPEI_DMAX_COUNTS(offset) (0x0000000000000450ull + ((offset) & 7) * 16)
44#define CVMX_NPEI_DMAX_DBELL(offset) (0x00000000000003B0ull + ((offset) & 7) * 16)
45#define CVMX_NPEI_DMAX_IBUFF_SADDR(offset) (0x0000000000000400ull + ((offset) & 7) * 16)
46#define CVMX_NPEI_DMAX_NADDR(offset) (0x00000000000004A0ull + ((offset) & 7) * 16)
47#define CVMX_NPEI_DMA_CNTS (0x00000000000005E0ull)
48#define CVMX_NPEI_DMA_CONTROL (0x00000000000003A0ull)
49#define CVMX_NPEI_DMA_PCIE_REQ_NUM (0x00000000000005B0ull)
50#define CVMX_NPEI_DMA_STATE1 (0x00000000000006C0ull)
51#define CVMX_NPEI_DMA_STATE1_P1 (0x0000000000000680ull)
52#define CVMX_NPEI_DMA_STATE2 (0x00000000000006D0ull)
53#define CVMX_NPEI_DMA_STATE2_P1 (0x0000000000000690ull)
54#define CVMX_NPEI_DMA_STATE3_P1 (0x00000000000006A0ull)
55#define CVMX_NPEI_DMA_STATE4_P1 (0x00000000000006B0ull)
56#define CVMX_NPEI_DMA_STATE5_P1 (0x00000000000006C0ull)
57#define CVMX_NPEI_INT_A_ENB (0x0000000000000560ull)
58#define CVMX_NPEI_INT_A_ENB2 (0x0000000000003CE0ull)
59#define CVMX_NPEI_INT_A_SUM (0x0000000000000550ull)
60#define CVMX_NPEI_INT_ENB (0x0000000000000540ull)
61#define CVMX_NPEI_INT_ENB2 (0x0000000000003CD0ull)
62#define CVMX_NPEI_INT_INFO (0x0000000000000590ull)
63#define CVMX_NPEI_INT_SUM (0x0000000000000530ull)
64#define CVMX_NPEI_INT_SUM2 (0x0000000000003CC0ull)
65#define CVMX_NPEI_LAST_WIN_RDATA0 (0x0000000000000600ull)
66#define CVMX_NPEI_LAST_WIN_RDATA1 (0x0000000000000610ull)
67#define CVMX_NPEI_MEM_ACCESS_CTL (0x00000000000004F0ull)
68#define CVMX_NPEI_MEM_ACCESS_SUBIDX(offset) (0x0000000000000280ull + ((offset) & 31) * 16 - 16*12)
69#define CVMX_NPEI_MSI_ENB0 (0x0000000000003C50ull)
70#define CVMX_NPEI_MSI_ENB1 (0x0000000000003C60ull)
71#define CVMX_NPEI_MSI_ENB2 (0x0000000000003C70ull)
72#define CVMX_NPEI_MSI_ENB3 (0x0000000000003C80ull)
73#define CVMX_NPEI_MSI_RCV0 (0x0000000000003C10ull)
74#define CVMX_NPEI_MSI_RCV1 (0x0000000000003C20ull)
75#define CVMX_NPEI_MSI_RCV2 (0x0000000000003C30ull)
76#define CVMX_NPEI_MSI_RCV3 (0x0000000000003C40ull)
77#define CVMX_NPEI_MSI_RD_MAP (0x0000000000003CA0ull)
78#define CVMX_NPEI_MSI_W1C_ENB0 (0x0000000000003CF0ull)
79#define CVMX_NPEI_MSI_W1C_ENB1 (0x0000000000003D00ull)
80#define CVMX_NPEI_MSI_W1C_ENB2 (0x0000000000003D10ull)
81#define CVMX_NPEI_MSI_W1C_ENB3 (0x0000000000003D20ull)
82#define CVMX_NPEI_MSI_W1S_ENB0 (0x0000000000003D30ull)
83#define CVMX_NPEI_MSI_W1S_ENB1 (0x0000000000003D40ull)
84#define CVMX_NPEI_MSI_W1S_ENB2 (0x0000000000003D50ull)
85#define CVMX_NPEI_MSI_W1S_ENB3 (0x0000000000003D60ull)
86#define CVMX_NPEI_MSI_WR_MAP (0x0000000000003C90ull)
87#define CVMX_NPEI_PCIE_CREDIT_CNT (0x0000000000003D70ull)
88#define CVMX_NPEI_PCIE_MSI_RCV (0x0000000000003CB0ull)
89#define CVMX_NPEI_PCIE_MSI_RCV_B1 (0x0000000000000650ull)
90#define CVMX_NPEI_PCIE_MSI_RCV_B2 (0x0000000000000660ull)
91#define CVMX_NPEI_PCIE_MSI_RCV_B3 (0x0000000000000670ull)
92#define CVMX_NPEI_PKTX_CNTS(offset) (0x0000000000002400ull + ((offset) & 31) * 16)
93#define CVMX_NPEI_PKTX_INSTR_BADDR(offset) (0x0000000000002800ull + ((offset) & 31) * 16)
94#define CVMX_NPEI_PKTX_INSTR_BAOFF_DBELL(offset) (0x0000000000002C00ull + ((offset) & 31) * 16)
95#define CVMX_NPEI_PKTX_INSTR_FIFO_RSIZE(offset) (0x0000000000003000ull + ((offset) & 31) * 16)
96#define CVMX_NPEI_PKTX_INSTR_HEADER(offset) (0x0000000000003400ull + ((offset) & 31) * 16)
97#define CVMX_NPEI_PKTX_IN_BP(offset) (0x0000000000003800ull + ((offset) & 31) * 16)
98#define CVMX_NPEI_PKTX_SLIST_BADDR(offset) (0x0000000000001400ull + ((offset) & 31) * 16)
99#define CVMX_NPEI_PKTX_SLIST_BAOFF_DBELL(offset) (0x0000000000001800ull + ((offset) & 31) * 16)
100#define CVMX_NPEI_PKTX_SLIST_FIFO_RSIZE(offset) (0x0000000000001C00ull + ((offset) & 31) * 16)
101#define CVMX_NPEI_PKT_CNT_INT (0x0000000000001110ull)
102#define CVMX_NPEI_PKT_CNT_INT_ENB (0x0000000000001130ull)
103#define CVMX_NPEI_PKT_DATA_OUT_ES (0x00000000000010B0ull)
104#define CVMX_NPEI_PKT_DATA_OUT_NS (0x00000000000010A0ull)
105#define CVMX_NPEI_PKT_DATA_OUT_ROR (0x0000000000001090ull)
106#define CVMX_NPEI_PKT_DPADDR (0x0000000000001080ull)
107#define CVMX_NPEI_PKT_INPUT_CONTROL (0x0000000000001150ull)
108#define CVMX_NPEI_PKT_INSTR_ENB (0x0000000000001000ull)
109#define CVMX_NPEI_PKT_INSTR_RD_SIZE (0x0000000000001190ull)
110#define CVMX_NPEI_PKT_INSTR_SIZE (0x0000000000001020ull)
111#define CVMX_NPEI_PKT_INT_LEVELS (0x0000000000001100ull)
112#define CVMX_NPEI_PKT_IN_BP (0x00000000000006B0ull)
113#define CVMX_NPEI_PKT_IN_DONEX_CNTS(offset) (0x0000000000002000ull + ((offset) & 31) * 16)
114#define CVMX_NPEI_PKT_IN_INSTR_COUNTS (0x00000000000006A0ull)
115#define CVMX_NPEI_PKT_IN_PCIE_PORT (0x00000000000011A0ull)
116#define CVMX_NPEI_PKT_IPTR (0x0000000000001070ull)
117#define CVMX_NPEI_PKT_OUTPUT_WMARK (0x0000000000001160ull)
118#define CVMX_NPEI_PKT_OUT_BMODE (0x00000000000010D0ull)
119#define CVMX_NPEI_PKT_OUT_ENB (0x0000000000001010ull)
120#define CVMX_NPEI_PKT_PCIE_PORT (0x00000000000010E0ull)
121#define CVMX_NPEI_PKT_PORT_IN_RST (0x0000000000000690ull)
122#define CVMX_NPEI_PKT_SLIST_ES (0x0000000000001050ull)
123#define CVMX_NPEI_PKT_SLIST_ID_SIZE (0x0000000000001180ull)
124#define CVMX_NPEI_PKT_SLIST_NS (0x0000000000001040ull)
125#define CVMX_NPEI_PKT_SLIST_ROR (0x0000000000001030ull)
126#define CVMX_NPEI_PKT_TIME_INT (0x0000000000001120ull)
127#define CVMX_NPEI_PKT_TIME_INT_ENB (0x0000000000001140ull)
128#define CVMX_NPEI_RSL_INT_BLOCKS (0x0000000000000520ull)
129#define CVMX_NPEI_SCRATCH_1 (0x0000000000000270ull)
130#define CVMX_NPEI_STATE1 (0x0000000000000620ull)
131#define CVMX_NPEI_STATE2 (0x0000000000000630ull)
132#define CVMX_NPEI_STATE3 (0x0000000000000640ull)
133#define CVMX_NPEI_WINDOW_CTL (0x0000000000000380ull)
134#define CVMX_NPEI_WIN_RD_ADDR (0x0000000000000210ull)
135#define CVMX_NPEI_WIN_RD_DATA (0x0000000000000240ull)
136#define CVMX_NPEI_WIN_WR_ADDR (0x0000000000000200ull)
137#define CVMX_NPEI_WIN_WR_DATA (0x0000000000000220ull)
138#define CVMX_NPEI_WIN_WR_MASK (0x0000000000000230ull)
139
140union cvmx_npei_bar1_indexx {
141 uint32_t u32;
142 struct cvmx_npei_bar1_indexx_s {
143#ifdef __BIG_ENDIAN_BITFIELD
144 uint32_t reserved_18_31:14;
145 uint32_t addr_idx:14;
146 uint32_t ca:1;
147 uint32_t end_swp:2;
148 uint32_t addr_v:1;
149#else
150 uint32_t addr_v:1;
151 uint32_t end_swp:2;
152 uint32_t ca:1;
153 uint32_t addr_idx:14;
154 uint32_t reserved_18_31:14;
155#endif
156 } s;
157};
158
159union cvmx_npei_bist_status {
160 uint64_t u64;
161 struct cvmx_npei_bist_status_s {
162#ifdef __BIG_ENDIAN_BITFIELD
163 uint64_t pkt_rdf:1;
164 uint64_t reserved_60_62:3;
165 uint64_t pcr_gim:1;
166 uint64_t pkt_pif:1;
167 uint64_t pcsr_int:1;
168 uint64_t pcsr_im:1;
169 uint64_t pcsr_cnt:1;
170 uint64_t pcsr_id:1;
171 uint64_t pcsr_sl:1;
172 uint64_t reserved_50_52:3;
173 uint64_t pkt_ind:1;
174 uint64_t pkt_slm:1;
175 uint64_t reserved_36_47:12;
176 uint64_t d0_pst:1;
177 uint64_t d1_pst:1;
178 uint64_t d2_pst:1;
179 uint64_t d3_pst:1;
180 uint64_t reserved_31_31:1;
181 uint64_t n2p0_c:1;
182 uint64_t n2p0_o:1;
183 uint64_t n2p1_c:1;
184 uint64_t n2p1_o:1;
185 uint64_t cpl_p0:1;
186 uint64_t cpl_p1:1;
187 uint64_t p2n1_po:1;
188 uint64_t p2n1_no:1;
189 uint64_t p2n1_co:1;
190 uint64_t p2n0_po:1;
191 uint64_t p2n0_no:1;
192 uint64_t p2n0_co:1;
193 uint64_t p2n0_c0:1;
194 uint64_t p2n0_c1:1;
195 uint64_t p2n0_n:1;
196 uint64_t p2n0_p0:1;
197 uint64_t p2n0_p1:1;
198 uint64_t p2n1_c0:1;
199 uint64_t p2n1_c1:1;
200 uint64_t p2n1_n:1;
201 uint64_t p2n1_p0:1;
202 uint64_t p2n1_p1:1;
203 uint64_t csm0:1;
204 uint64_t csm1:1;
205 uint64_t dif0:1;
206 uint64_t dif1:1;
207 uint64_t dif2:1;
208 uint64_t dif3:1;
209 uint64_t reserved_2_2:1;
210 uint64_t msi:1;
211 uint64_t ncb_cmd:1;
212#else
213 uint64_t ncb_cmd:1;
214 uint64_t msi:1;
215 uint64_t reserved_2_2:1;
216 uint64_t dif3:1;
217 uint64_t dif2:1;
218 uint64_t dif1:1;
219 uint64_t dif0:1;
220 uint64_t csm1:1;
221 uint64_t csm0:1;
222 uint64_t p2n1_p1:1;
223 uint64_t p2n1_p0:1;
224 uint64_t p2n1_n:1;
225 uint64_t p2n1_c1:1;
226 uint64_t p2n1_c0:1;
227 uint64_t p2n0_p1:1;
228 uint64_t p2n0_p0:1;
229 uint64_t p2n0_n:1;
230 uint64_t p2n0_c1:1;
231 uint64_t p2n0_c0:1;
232 uint64_t p2n0_co:1;
233 uint64_t p2n0_no:1;
234 uint64_t p2n0_po:1;
235 uint64_t p2n1_co:1;
236 uint64_t p2n1_no:1;
237 uint64_t p2n1_po:1;
238 uint64_t cpl_p1:1;
239 uint64_t cpl_p0:1;
240 uint64_t n2p1_o:1;
241 uint64_t n2p1_c:1;
242 uint64_t n2p0_o:1;
243 uint64_t n2p0_c:1;
244 uint64_t reserved_31_31:1;
245 uint64_t d3_pst:1;
246 uint64_t d2_pst:1;
247 uint64_t d1_pst:1;
248 uint64_t d0_pst:1;
249 uint64_t reserved_36_47:12;
250 uint64_t pkt_slm:1;
251 uint64_t pkt_ind:1;
252 uint64_t reserved_50_52:3;
253 uint64_t pcsr_sl:1;
254 uint64_t pcsr_id:1;
255 uint64_t pcsr_cnt:1;
256 uint64_t pcsr_im:1;
257 uint64_t pcsr_int:1;
258 uint64_t pkt_pif:1;
259 uint64_t pcr_gim:1;
260 uint64_t reserved_60_62:3;
261 uint64_t pkt_rdf:1;
262#endif
263 } s;
264 struct cvmx_npei_bist_status_cn52xx {
265#ifdef __BIG_ENDIAN_BITFIELD
266 uint64_t pkt_rdf:1;
267 uint64_t reserved_60_62:3;
268 uint64_t pcr_gim:1;
269 uint64_t pkt_pif:1;
270 uint64_t pcsr_int:1;
271 uint64_t pcsr_im:1;
272 uint64_t pcsr_cnt:1;
273 uint64_t pcsr_id:1;
274 uint64_t pcsr_sl:1;
275 uint64_t pkt_imem:1;
276 uint64_t pkt_pfm:1;
277 uint64_t pkt_pof:1;
278 uint64_t reserved_48_49:2;
279 uint64_t pkt_pop0:1;
280 uint64_t pkt_pop1:1;
281 uint64_t d0_mem:1;
282 uint64_t d1_mem:1;
283 uint64_t d2_mem:1;
284 uint64_t d3_mem:1;
285 uint64_t d4_mem:1;
286 uint64_t ds_mem:1;
287 uint64_t reserved_36_39:4;
288 uint64_t d0_pst:1;
289 uint64_t d1_pst:1;
290 uint64_t d2_pst:1;
291 uint64_t d3_pst:1;
292 uint64_t d4_pst:1;
293 uint64_t n2p0_c:1;
294 uint64_t n2p0_o:1;
295 uint64_t n2p1_c:1;
296 uint64_t n2p1_o:1;
297 uint64_t cpl_p0:1;
298 uint64_t cpl_p1:1;
299 uint64_t p2n1_po:1;
300 uint64_t p2n1_no:1;
301 uint64_t p2n1_co:1;
302 uint64_t p2n0_po:1;
303 uint64_t p2n0_no:1;
304 uint64_t p2n0_co:1;
305 uint64_t p2n0_c0:1;
306 uint64_t p2n0_c1:1;
307 uint64_t p2n0_n:1;
308 uint64_t p2n0_p0:1;
309 uint64_t p2n0_p1:1;
310 uint64_t p2n1_c0:1;
311 uint64_t p2n1_c1:1;
312 uint64_t p2n1_n:1;
313 uint64_t p2n1_p0:1;
314 uint64_t p2n1_p1:1;
315 uint64_t csm0:1;
316 uint64_t csm1:1;
317 uint64_t dif0:1;
318 uint64_t dif1:1;
319 uint64_t dif2:1;
320 uint64_t dif3:1;
321 uint64_t dif4:1;
322 uint64_t msi:1;
323 uint64_t ncb_cmd:1;
324#else
325 uint64_t ncb_cmd:1;
326 uint64_t msi:1;
327 uint64_t dif4:1;
328 uint64_t dif3:1;
329 uint64_t dif2:1;
330 uint64_t dif1:1;
331 uint64_t dif0:1;
332 uint64_t csm1:1;
333 uint64_t csm0:1;
334 uint64_t p2n1_p1:1;
335 uint64_t p2n1_p0:1;
336 uint64_t p2n1_n:1;
337 uint64_t p2n1_c1:1;
338 uint64_t p2n1_c0:1;
339 uint64_t p2n0_p1:1;
340 uint64_t p2n0_p0:1;
341 uint64_t p2n0_n:1;
342 uint64_t p2n0_c1:1;
343 uint64_t p2n0_c0:1;
344 uint64_t p2n0_co:1;
345 uint64_t p2n0_no:1;
346 uint64_t p2n0_po:1;
347 uint64_t p2n1_co:1;
348 uint64_t p2n1_no:1;
349 uint64_t p2n1_po:1;
350 uint64_t cpl_p1:1;
351 uint64_t cpl_p0:1;
352 uint64_t n2p1_o:1;
353 uint64_t n2p1_c:1;
354 uint64_t n2p0_o:1;
355 uint64_t n2p0_c:1;
356 uint64_t d4_pst:1;
357 uint64_t d3_pst:1;
358 uint64_t d2_pst:1;
359 uint64_t d1_pst:1;
360 uint64_t d0_pst:1;
361 uint64_t reserved_36_39:4;
362 uint64_t ds_mem:1;
363 uint64_t d4_mem:1;
364 uint64_t d3_mem:1;
365 uint64_t d2_mem:1;
366 uint64_t d1_mem:1;
367 uint64_t d0_mem:1;
368 uint64_t pkt_pop1:1;
369 uint64_t pkt_pop0:1;
370 uint64_t reserved_48_49:2;
371 uint64_t pkt_pof:1;
372 uint64_t pkt_pfm:1;
373 uint64_t pkt_imem:1;
374 uint64_t pcsr_sl:1;
375 uint64_t pcsr_id:1;
376 uint64_t pcsr_cnt:1;
377 uint64_t pcsr_im:1;
378 uint64_t pcsr_int:1;
379 uint64_t pkt_pif:1;
380 uint64_t pcr_gim:1;
381 uint64_t reserved_60_62:3;
382 uint64_t pkt_rdf:1;
383#endif
384 } cn52xx;
385 struct cvmx_npei_bist_status_cn52xxp1 {
386#ifdef __BIG_ENDIAN_BITFIELD
387 uint64_t reserved_46_63:18;
388 uint64_t d0_mem0:1;
389 uint64_t d1_mem1:1;
390 uint64_t d2_mem2:1;
391 uint64_t d3_mem3:1;
392 uint64_t dr0_mem:1;
393 uint64_t d0_mem:1;
394 uint64_t d1_mem:1;
395 uint64_t d2_mem:1;
396 uint64_t d3_mem:1;
397 uint64_t dr1_mem:1;
398 uint64_t d0_pst:1;
399 uint64_t d1_pst:1;
400 uint64_t d2_pst:1;
401 uint64_t d3_pst:1;
402 uint64_t dr2_mem:1;
403 uint64_t n2p0_c:1;
404 uint64_t n2p0_o:1;
405 uint64_t n2p1_c:1;
406 uint64_t n2p1_o:1;
407 uint64_t cpl_p0:1;
408 uint64_t cpl_p1:1;
409 uint64_t p2n1_po:1;
410 uint64_t p2n1_no:1;
411 uint64_t p2n1_co:1;
412 uint64_t p2n0_po:1;
413 uint64_t p2n0_no:1;
414 uint64_t p2n0_co:1;
415 uint64_t p2n0_c0:1;
416 uint64_t p2n0_c1:1;
417 uint64_t p2n0_n:1;
418 uint64_t p2n0_p0:1;
419 uint64_t p2n0_p1:1;
420 uint64_t p2n1_c0:1;
421 uint64_t p2n1_c1:1;
422 uint64_t p2n1_n:1;
423 uint64_t p2n1_p0:1;
424 uint64_t p2n1_p1:1;
425 uint64_t csm0:1;
426 uint64_t csm1:1;
427 uint64_t dif0:1;
428 uint64_t dif1:1;
429 uint64_t dif2:1;
430 uint64_t dif3:1;
431 uint64_t dr3_mem:1;
432 uint64_t msi:1;
433 uint64_t ncb_cmd:1;
434#else
435 uint64_t ncb_cmd:1;
436 uint64_t msi:1;
437 uint64_t dr3_mem:1;
438 uint64_t dif3:1;
439 uint64_t dif2:1;
440 uint64_t dif1:1;
441 uint64_t dif0:1;
442 uint64_t csm1:1;
443 uint64_t csm0:1;
444 uint64_t p2n1_p1:1;
445 uint64_t p2n1_p0:1;
446 uint64_t p2n1_n:1;
447 uint64_t p2n1_c1:1;
448 uint64_t p2n1_c0:1;
449 uint64_t p2n0_p1:1;
450 uint64_t p2n0_p0:1;
451 uint64_t p2n0_n:1;
452 uint64_t p2n0_c1:1;
453 uint64_t p2n0_c0:1;
454 uint64_t p2n0_co:1;
455 uint64_t p2n0_no:1;
456 uint64_t p2n0_po:1;
457 uint64_t p2n1_co:1;
458 uint64_t p2n1_no:1;
459 uint64_t p2n1_po:1;
460 uint64_t cpl_p1:1;
461 uint64_t cpl_p0:1;
462 uint64_t n2p1_o:1;
463 uint64_t n2p1_c:1;
464 uint64_t n2p0_o:1;
465 uint64_t n2p0_c:1;
466 uint64_t dr2_mem:1;
467 uint64_t d3_pst:1;
468 uint64_t d2_pst:1;
469 uint64_t d1_pst:1;
470 uint64_t d0_pst:1;
471 uint64_t dr1_mem:1;
472 uint64_t d3_mem:1;
473 uint64_t d2_mem:1;
474 uint64_t d1_mem:1;
475 uint64_t d0_mem:1;
476 uint64_t dr0_mem:1;
477 uint64_t d3_mem3:1;
478 uint64_t d2_mem2:1;
479 uint64_t d1_mem1:1;
480 uint64_t d0_mem0:1;
481 uint64_t reserved_46_63:18;
482#endif
483 } cn52xxp1;
484 struct cvmx_npei_bist_status_cn56xxp1 {
485#ifdef __BIG_ENDIAN_BITFIELD
486 uint64_t reserved_58_63:6;
487 uint64_t pcsr_int:1;
488 uint64_t pcsr_im:1;
489 uint64_t pcsr_cnt:1;
490 uint64_t pcsr_id:1;
491 uint64_t pcsr_sl:1;
492 uint64_t pkt_pout:1;
493 uint64_t pkt_imem:1;
494 uint64_t pkt_cntm:1;
495 uint64_t pkt_ind:1;
496 uint64_t pkt_slm:1;
497 uint64_t pkt_odf:1;
498 uint64_t pkt_oif:1;
499 uint64_t pkt_out:1;
500 uint64_t pkt_i0:1;
501 uint64_t pkt_i1:1;
502 uint64_t pkt_s0:1;
503 uint64_t pkt_s1:1;
504 uint64_t d0_mem:1;
505 uint64_t d1_mem:1;
506 uint64_t d2_mem:1;
507 uint64_t d3_mem:1;
508 uint64_t d4_mem:1;
509 uint64_t d0_pst:1;
510 uint64_t d1_pst:1;
511 uint64_t d2_pst:1;
512 uint64_t d3_pst:1;
513 uint64_t d4_pst:1;
514 uint64_t n2p0_c:1;
515 uint64_t n2p0_o:1;
516 uint64_t n2p1_c:1;
517 uint64_t n2p1_o:1;
518 uint64_t cpl_p0:1;
519 uint64_t cpl_p1:1;
520 uint64_t p2n1_po:1;
521 uint64_t p2n1_no:1;
522 uint64_t p2n1_co:1;
523 uint64_t p2n0_po:1;
524 uint64_t p2n0_no:1;
525 uint64_t p2n0_co:1;
526 uint64_t p2n0_c0:1;
527 uint64_t p2n0_c1:1;
528 uint64_t p2n0_n:1;
529 uint64_t p2n0_p0:1;
530 uint64_t p2n0_p1:1;
531 uint64_t p2n1_c0:1;
532 uint64_t p2n1_c1:1;
533 uint64_t p2n1_n:1;
534 uint64_t p2n1_p0:1;
535 uint64_t p2n1_p1:1;
536 uint64_t csm0:1;
537 uint64_t csm1:1;
538 uint64_t dif0:1;
539 uint64_t dif1:1;
540 uint64_t dif2:1;
541 uint64_t dif3:1;
542 uint64_t dif4:1;
543 uint64_t msi:1;
544 uint64_t ncb_cmd:1;
545#else
546 uint64_t ncb_cmd:1;
547 uint64_t msi:1;
548 uint64_t dif4:1;
549 uint64_t dif3:1;
550 uint64_t dif2:1;
551 uint64_t dif1:1;
552 uint64_t dif0:1;
553 uint64_t csm1:1;
554 uint64_t csm0:1;
555 uint64_t p2n1_p1:1;
556 uint64_t p2n1_p0:1;
557 uint64_t p2n1_n:1;
558 uint64_t p2n1_c1:1;
559 uint64_t p2n1_c0:1;
560 uint64_t p2n0_p1:1;
561 uint64_t p2n0_p0:1;
562 uint64_t p2n0_n:1;
563 uint64_t p2n0_c1:1;
564 uint64_t p2n0_c0:1;
565 uint64_t p2n0_co:1;
566 uint64_t p2n0_no:1;
567 uint64_t p2n0_po:1;
568 uint64_t p2n1_co:1;
569 uint64_t p2n1_no:1;
570 uint64_t p2n1_po:1;
571 uint64_t cpl_p1:1;
572 uint64_t cpl_p0:1;
573 uint64_t n2p1_o:1;
574 uint64_t n2p1_c:1;
575 uint64_t n2p0_o:1;
576 uint64_t n2p0_c:1;
577 uint64_t d4_pst:1;
578 uint64_t d3_pst:1;
579 uint64_t d2_pst:1;
580 uint64_t d1_pst:1;
581 uint64_t d0_pst:1;
582 uint64_t d4_mem:1;
583 uint64_t d3_mem:1;
584 uint64_t d2_mem:1;
585 uint64_t d1_mem:1;
586 uint64_t d0_mem:1;
587 uint64_t pkt_s1:1;
588 uint64_t pkt_s0:1;
589 uint64_t pkt_i1:1;
590 uint64_t pkt_i0:1;
591 uint64_t pkt_out:1;
592 uint64_t pkt_oif:1;
593 uint64_t pkt_odf:1;
594 uint64_t pkt_slm:1;
595 uint64_t pkt_ind:1;
596 uint64_t pkt_cntm:1;
597 uint64_t pkt_imem:1;
598 uint64_t pkt_pout:1;
599 uint64_t pcsr_sl:1;
600 uint64_t pcsr_id:1;
601 uint64_t pcsr_cnt:1;
602 uint64_t pcsr_im:1;
603 uint64_t pcsr_int:1;
604 uint64_t reserved_58_63:6;
605#endif
606 } cn56xxp1;
607};
608
609union cvmx_npei_bist_status2 {
610 uint64_t u64;
611 struct cvmx_npei_bist_status2_s {
612#ifdef __BIG_ENDIAN_BITFIELD
613 uint64_t reserved_14_63:50;
614 uint64_t prd_tag:1;
615 uint64_t prd_st0:1;
616 uint64_t prd_st1:1;
617 uint64_t prd_err:1;
618 uint64_t nrd_st:1;
619 uint64_t nwe_st:1;
620 uint64_t nwe_wr0:1;
621 uint64_t nwe_wr1:1;
622 uint64_t pkt_rd:1;
623 uint64_t psc_p0:1;
624 uint64_t psc_p1:1;
625 uint64_t pkt_gd:1;
626 uint64_t pkt_gl:1;
627 uint64_t pkt_blk:1;
628#else
629 uint64_t pkt_blk:1;
630 uint64_t pkt_gl:1;
631 uint64_t pkt_gd:1;
632 uint64_t psc_p1:1;
633 uint64_t psc_p0:1;
634 uint64_t pkt_rd:1;
635 uint64_t nwe_wr1:1;
636 uint64_t nwe_wr0:1;
637 uint64_t nwe_st:1;
638 uint64_t nrd_st:1;
639 uint64_t prd_err:1;
640 uint64_t prd_st1:1;
641 uint64_t prd_st0:1;
642 uint64_t prd_tag:1;
643 uint64_t reserved_14_63:50;
644#endif
645 } s;
646};
647
648union cvmx_npei_ctl_port0 {
649 uint64_t u64;
650 struct cvmx_npei_ctl_port0_s {
651#ifdef __BIG_ENDIAN_BITFIELD
652 uint64_t reserved_21_63:43;
653 uint64_t waitl_com:1;
654 uint64_t intd:1;
655 uint64_t intc:1;
656 uint64_t intb:1;
657 uint64_t inta:1;
658 uint64_t intd_map:2;
659 uint64_t intc_map:2;
660 uint64_t intb_map:2;
661 uint64_t inta_map:2;
662 uint64_t ctlp_ro:1;
663 uint64_t reserved_6_6:1;
664 uint64_t ptlp_ro:1;
665 uint64_t bar2_enb:1;
666 uint64_t bar2_esx:2;
667 uint64_t bar2_cax:1;
668 uint64_t wait_com:1;
669#else
670 uint64_t wait_com:1;
671 uint64_t bar2_cax:1;
672 uint64_t bar2_esx:2;
673 uint64_t bar2_enb:1;
674 uint64_t ptlp_ro:1;
675 uint64_t reserved_6_6:1;
676 uint64_t ctlp_ro:1;
677 uint64_t inta_map:2;
678 uint64_t intb_map:2;
679 uint64_t intc_map:2;
680 uint64_t intd_map:2;
681 uint64_t inta:1;
682 uint64_t intb:1;
683 uint64_t intc:1;
684 uint64_t intd:1;
685 uint64_t waitl_com:1;
686 uint64_t reserved_21_63:43;
687#endif
688 } s;
689};
690
691union cvmx_npei_ctl_port1 {
692 uint64_t u64;
693 struct cvmx_npei_ctl_port1_s {
694#ifdef __BIG_ENDIAN_BITFIELD
695 uint64_t reserved_21_63:43;
696 uint64_t waitl_com:1;
697 uint64_t intd:1;
698 uint64_t intc:1;
699 uint64_t intb:1;
700 uint64_t inta:1;
701 uint64_t intd_map:2;
702 uint64_t intc_map:2;
703 uint64_t intb_map:2;
704 uint64_t inta_map:2;
705 uint64_t ctlp_ro:1;
706 uint64_t reserved_6_6:1;
707 uint64_t ptlp_ro:1;
708 uint64_t bar2_enb:1;
709 uint64_t bar2_esx:2;
710 uint64_t bar2_cax:1;
711 uint64_t wait_com:1;
712#else
713 uint64_t wait_com:1;
714 uint64_t bar2_cax:1;
715 uint64_t bar2_esx:2;
716 uint64_t bar2_enb:1;
717 uint64_t ptlp_ro:1;
718 uint64_t reserved_6_6:1;
719 uint64_t ctlp_ro:1;
720 uint64_t inta_map:2;
721 uint64_t intb_map:2;
722 uint64_t intc_map:2;
723 uint64_t intd_map:2;
724 uint64_t inta:1;
725 uint64_t intb:1;
726 uint64_t intc:1;
727 uint64_t intd:1;
728 uint64_t waitl_com:1;
729 uint64_t reserved_21_63:43;
730#endif
731 } s;
732};
733
734union cvmx_npei_ctl_status {
735 uint64_t u64;
736 struct cvmx_npei_ctl_status_s {
737#ifdef __BIG_ENDIAN_BITFIELD
738 uint64_t reserved_44_63:20;
739 uint64_t p1_ntags:6;
740 uint64_t p0_ntags:6;
741 uint64_t cfg_rtry:16;
742 uint64_t ring_en:1;
743 uint64_t lnk_rst:1;
744 uint64_t arb:1;
745 uint64_t pkt_bp:4;
746 uint64_t host_mode:1;
747 uint64_t chip_rev:8;
748#else
749 uint64_t chip_rev:8;
750 uint64_t host_mode:1;
751 uint64_t pkt_bp:4;
752 uint64_t arb:1;
753 uint64_t lnk_rst:1;
754 uint64_t ring_en:1;
755 uint64_t cfg_rtry:16;
756 uint64_t p0_ntags:6;
757 uint64_t p1_ntags:6;
758 uint64_t reserved_44_63:20;
759#endif
760 } s;
761 struct cvmx_npei_ctl_status_cn52xxp1 {
762#ifdef __BIG_ENDIAN_BITFIELD
763 uint64_t reserved_44_63:20;
764 uint64_t p1_ntags:6;
765 uint64_t p0_ntags:6;
766 uint64_t cfg_rtry:16;
767 uint64_t reserved_15_15:1;
768 uint64_t lnk_rst:1;
769 uint64_t arb:1;
770 uint64_t reserved_9_12:4;
771 uint64_t host_mode:1;
772 uint64_t chip_rev:8;
773#else
774 uint64_t chip_rev:8;
775 uint64_t host_mode:1;
776 uint64_t reserved_9_12:4;
777 uint64_t arb:1;
778 uint64_t lnk_rst:1;
779 uint64_t reserved_15_15:1;
780 uint64_t cfg_rtry:16;
781 uint64_t p0_ntags:6;
782 uint64_t p1_ntags:6;
783 uint64_t reserved_44_63:20;
784#endif
785 } cn52xxp1;
786 struct cvmx_npei_ctl_status_cn56xxp1 {
787#ifdef __BIG_ENDIAN_BITFIELD
788 uint64_t reserved_15_63:49;
789 uint64_t lnk_rst:1;
790 uint64_t arb:1;
791 uint64_t pkt_bp:4;
792 uint64_t host_mode:1;
793 uint64_t chip_rev:8;
794#else
795 uint64_t chip_rev:8;
796 uint64_t host_mode:1;
797 uint64_t pkt_bp:4;
798 uint64_t arb:1;
799 uint64_t lnk_rst:1;
800 uint64_t reserved_15_63:49;
801#endif
802 } cn56xxp1;
803};
804
805union cvmx_npei_ctl_status2 {
806 uint64_t u64;
807 struct cvmx_npei_ctl_status2_s {
808#ifdef __BIG_ENDIAN_BITFIELD
809 uint64_t reserved_16_63:48;
810 uint64_t mps:1;
811 uint64_t mrrs:3;
812 uint64_t c1_w_flt:1;
813 uint64_t c0_w_flt:1;
814 uint64_t c1_b1_s:3;
815 uint64_t c0_b1_s:3;
816 uint64_t c1_wi_d:1;
817 uint64_t c1_b0_d:1;
818 uint64_t c0_wi_d:1;
819 uint64_t c0_b0_d:1;
820#else
821 uint64_t c0_b0_d:1;
822 uint64_t c0_wi_d:1;
823 uint64_t c1_b0_d:1;
824 uint64_t c1_wi_d:1;
825 uint64_t c0_b1_s:3;
826 uint64_t c1_b1_s:3;
827 uint64_t c0_w_flt:1;
828 uint64_t c1_w_flt:1;
829 uint64_t mrrs:3;
830 uint64_t mps:1;
831 uint64_t reserved_16_63:48;
832#endif
833 } s;
834};
835
836union cvmx_npei_data_out_cnt {
837 uint64_t u64;
838 struct cvmx_npei_data_out_cnt_s {
839#ifdef __BIG_ENDIAN_BITFIELD
840 uint64_t reserved_44_63:20;
841 uint64_t p1_ucnt:16;
842 uint64_t p1_fcnt:6;
843 uint64_t p0_ucnt:16;
844 uint64_t p0_fcnt:6;
845#else
846 uint64_t p0_fcnt:6;
847 uint64_t p0_ucnt:16;
848 uint64_t p1_fcnt:6;
849 uint64_t p1_ucnt:16;
850 uint64_t reserved_44_63:20;
851#endif
852 } s;
853};
854
855union cvmx_npei_dbg_data {
856 uint64_t u64;
857 struct cvmx_npei_dbg_data_s {
858#ifdef __BIG_ENDIAN_BITFIELD
859 uint64_t reserved_28_63:36;
860 uint64_t qlm0_rev_lanes:1;
861 uint64_t reserved_25_26:2;
862 uint64_t qlm1_spd:2;
863 uint64_t c_mul:5;
864 uint64_t dsel_ext:1;
865 uint64_t data:17;
866#else
867 uint64_t data:17;
868 uint64_t dsel_ext:1;
869 uint64_t c_mul:5;
870 uint64_t qlm1_spd:2;
871 uint64_t reserved_25_26:2;
872 uint64_t qlm0_rev_lanes:1;
873 uint64_t reserved_28_63:36;
874#endif
875 } s;
876 struct cvmx_npei_dbg_data_cn52xx {
877#ifdef __BIG_ENDIAN_BITFIELD
878 uint64_t reserved_29_63:35;
879 uint64_t qlm0_link_width:1;
880 uint64_t qlm0_rev_lanes:1;
881 uint64_t qlm1_mode:2;
882 uint64_t qlm1_spd:2;
883 uint64_t c_mul:5;
884 uint64_t dsel_ext:1;
885 uint64_t data:17;
886#else
887 uint64_t data:17;
888 uint64_t dsel_ext:1;
889 uint64_t c_mul:5;
890 uint64_t qlm1_spd:2;
891 uint64_t qlm1_mode:2;
892 uint64_t qlm0_rev_lanes:1;
893 uint64_t qlm0_link_width:1;
894 uint64_t reserved_29_63:35;
895#endif
896 } cn52xx;
897 struct cvmx_npei_dbg_data_cn56xx {
898#ifdef __BIG_ENDIAN_BITFIELD
899 uint64_t reserved_29_63:35;
900 uint64_t qlm2_rev_lanes:1;
901 uint64_t qlm0_rev_lanes:1;
902 uint64_t qlm3_spd:2;
903 uint64_t qlm1_spd:2;
904 uint64_t c_mul:5;
905 uint64_t dsel_ext:1;
906 uint64_t data:17;
907#else
908 uint64_t data:17;
909 uint64_t dsel_ext:1;
910 uint64_t c_mul:5;
911 uint64_t qlm1_spd:2;
912 uint64_t qlm3_spd:2;
913 uint64_t qlm0_rev_lanes:1;
914 uint64_t qlm2_rev_lanes:1;
915 uint64_t reserved_29_63:35;
916#endif
917 } cn56xx;
918};
919
920union cvmx_npei_dbg_select {
921 uint64_t u64;
922 struct cvmx_npei_dbg_select_s {
923#ifdef __BIG_ENDIAN_BITFIELD
924 uint64_t reserved_16_63:48;
925 uint64_t dbg_sel:16;
926#else
927 uint64_t dbg_sel:16;
928 uint64_t reserved_16_63:48;
929#endif
930 } s;
931};
932
933union cvmx_npei_dmax_counts {
934 uint64_t u64;
935 struct cvmx_npei_dmax_counts_s {
936#ifdef __BIG_ENDIAN_BITFIELD
937 uint64_t reserved_39_63:25;
938 uint64_t fcnt:7;
939 uint64_t dbell:32;
940#else
941 uint64_t dbell:32;
942 uint64_t fcnt:7;
943 uint64_t reserved_39_63:25;
944#endif
945 } s;
946};
947
948union cvmx_npei_dmax_dbell {
949 uint32_t u32;
950 struct cvmx_npei_dmax_dbell_s {
951#ifdef __BIG_ENDIAN_BITFIELD
952 uint32_t reserved_16_31:16;
953 uint32_t dbell:16;
954#else
955 uint32_t dbell:16;
956 uint32_t reserved_16_31:16;
957#endif
958 } s;
959};
960
961union cvmx_npei_dmax_ibuff_saddr {
962 uint64_t u64;
963 struct cvmx_npei_dmax_ibuff_saddr_s {
964#ifdef __BIG_ENDIAN_BITFIELD
965 uint64_t reserved_37_63:27;
966 uint64_t idle:1;
967 uint64_t saddr:29;
968 uint64_t reserved_0_6:7;
969#else
970 uint64_t reserved_0_6:7;
971 uint64_t saddr:29;
972 uint64_t idle:1;
973 uint64_t reserved_37_63:27;
974#endif
975 } s;
976 struct cvmx_npei_dmax_ibuff_saddr_cn52xxp1 {
977#ifdef __BIG_ENDIAN_BITFIELD
978 uint64_t reserved_36_63:28;
979 uint64_t saddr:29;
980 uint64_t reserved_0_6:7;
981#else
982 uint64_t reserved_0_6:7;
983 uint64_t saddr:29;
984 uint64_t reserved_36_63:28;
985#endif
986 } cn52xxp1;
987};
988
989union cvmx_npei_dmax_naddr {
990 uint64_t u64;
991 struct cvmx_npei_dmax_naddr_s {
992#ifdef __BIG_ENDIAN_BITFIELD
993 uint64_t reserved_36_63:28;
994 uint64_t addr:36;
995#else
996 uint64_t addr:36;
997 uint64_t reserved_36_63:28;
998#endif
999 } s;
1000};
1001
1002union cvmx_npei_dma0_int_level {
1003 uint64_t u64;
1004 struct cvmx_npei_dma0_int_level_s {
1005#ifdef __BIG_ENDIAN_BITFIELD
1006 uint64_t time:32;
1007 uint64_t cnt:32;
1008#else
1009 uint64_t cnt:32;
1010 uint64_t time:32;
1011#endif
1012 } s;
1013};
1014
1015union cvmx_npei_dma1_int_level {
1016 uint64_t u64;
1017 struct cvmx_npei_dma1_int_level_s {
1018#ifdef __BIG_ENDIAN_BITFIELD
1019 uint64_t time:32;
1020 uint64_t cnt:32;
1021#else
1022 uint64_t cnt:32;
1023 uint64_t time:32;
1024#endif
1025 } s;
1026};
1027
1028union cvmx_npei_dma_cnts {
1029 uint64_t u64;
1030 struct cvmx_npei_dma_cnts_s {
1031#ifdef __BIG_ENDIAN_BITFIELD
1032 uint64_t dma1:32;
1033 uint64_t dma0:32;
1034#else
1035 uint64_t dma0:32;
1036 uint64_t dma1:32;
1037#endif
1038 } s;
1039};
1040
1041union cvmx_npei_dma_control {
1042 uint64_t u64;
1043 struct cvmx_npei_dma_control_s {
1044#ifdef __BIG_ENDIAN_BITFIELD
1045 uint64_t reserved_40_63:24;
1046 uint64_t p_32b_m:1;
1047 uint64_t dma4_enb:1;
1048 uint64_t dma3_enb:1;
1049 uint64_t dma2_enb:1;
1050 uint64_t dma1_enb:1;
1051 uint64_t dma0_enb:1;
1052 uint64_t b0_lend:1;
1053 uint64_t dwb_denb:1;
1054 uint64_t dwb_ichk:9;
1055 uint64_t fpa_que:3;
1056 uint64_t o_add1:1;
1057 uint64_t o_ro:1;
1058 uint64_t o_ns:1;
1059 uint64_t o_es:2;
1060 uint64_t o_mode:1;
1061 uint64_t csize:14;
1062#else
1063 uint64_t csize:14;
1064 uint64_t o_mode:1;
1065 uint64_t o_es:2;
1066 uint64_t o_ns:1;
1067 uint64_t o_ro:1;
1068 uint64_t o_add1:1;
1069 uint64_t fpa_que:3;
1070 uint64_t dwb_ichk:9;
1071 uint64_t dwb_denb:1;
1072 uint64_t b0_lend:1;
1073 uint64_t dma0_enb:1;
1074 uint64_t dma1_enb:1;
1075 uint64_t dma2_enb:1;
1076 uint64_t dma3_enb:1;
1077 uint64_t dma4_enb:1;
1078 uint64_t p_32b_m:1;
1079 uint64_t reserved_40_63:24;
1080#endif
1081 } s;
1082 struct cvmx_npei_dma_control_cn52xxp1 {
1083#ifdef __BIG_ENDIAN_BITFIELD
1084 uint64_t reserved_38_63:26;
1085 uint64_t dma3_enb:1;
1086 uint64_t dma2_enb:1;
1087 uint64_t dma1_enb:1;
1088 uint64_t dma0_enb:1;
1089 uint64_t b0_lend:1;
1090 uint64_t dwb_denb:1;
1091 uint64_t dwb_ichk:9;
1092 uint64_t fpa_que:3;
1093 uint64_t o_add1:1;
1094 uint64_t o_ro:1;
1095 uint64_t o_ns:1;
1096 uint64_t o_es:2;
1097 uint64_t o_mode:1;
1098 uint64_t csize:14;
1099#else
1100 uint64_t csize:14;
1101 uint64_t o_mode:1;
1102 uint64_t o_es:2;
1103 uint64_t o_ns:1;
1104 uint64_t o_ro:1;
1105 uint64_t o_add1:1;
1106 uint64_t fpa_que:3;
1107 uint64_t dwb_ichk:9;
1108 uint64_t dwb_denb:1;
1109 uint64_t b0_lend:1;
1110 uint64_t dma0_enb:1;
1111 uint64_t dma1_enb:1;
1112 uint64_t dma2_enb:1;
1113 uint64_t dma3_enb:1;
1114 uint64_t reserved_38_63:26;
1115#endif
1116 } cn52xxp1;
1117 struct cvmx_npei_dma_control_cn56xxp1 {
1118#ifdef __BIG_ENDIAN_BITFIELD
1119 uint64_t reserved_39_63:25;
1120 uint64_t dma4_enb:1;
1121 uint64_t dma3_enb:1;
1122 uint64_t dma2_enb:1;
1123 uint64_t dma1_enb:1;
1124 uint64_t dma0_enb:1;
1125 uint64_t b0_lend:1;
1126 uint64_t dwb_denb:1;
1127 uint64_t dwb_ichk:9;
1128 uint64_t fpa_que:3;
1129 uint64_t o_add1:1;
1130 uint64_t o_ro:1;
1131 uint64_t o_ns:1;
1132 uint64_t o_es:2;
1133 uint64_t o_mode:1;
1134 uint64_t csize:14;
1135#else
1136 uint64_t csize:14;
1137 uint64_t o_mode:1;
1138 uint64_t o_es:2;
1139 uint64_t o_ns:1;
1140 uint64_t o_ro:1;
1141 uint64_t o_add1:1;
1142 uint64_t fpa_que:3;
1143 uint64_t dwb_ichk:9;
1144 uint64_t dwb_denb:1;
1145 uint64_t b0_lend:1;
1146 uint64_t dma0_enb:1;
1147 uint64_t dma1_enb:1;
1148 uint64_t dma2_enb:1;
1149 uint64_t dma3_enb:1;
1150 uint64_t dma4_enb:1;
1151 uint64_t reserved_39_63:25;
1152#endif
1153 } cn56xxp1;
1154};
1155
1156union cvmx_npei_dma_pcie_req_num {
1157 uint64_t u64;
1158 struct cvmx_npei_dma_pcie_req_num_s {
1159#ifdef __BIG_ENDIAN_BITFIELD
1160 uint64_t dma_arb:1;
1161 uint64_t reserved_53_62:10;
1162 uint64_t pkt_cnt:5;
1163 uint64_t reserved_45_47:3;
1164 uint64_t dma4_cnt:5;
1165 uint64_t reserved_37_39:3;
1166 uint64_t dma3_cnt:5;
1167 uint64_t reserved_29_31:3;
1168 uint64_t dma2_cnt:5;
1169 uint64_t reserved_21_23:3;
1170 uint64_t dma1_cnt:5;
1171 uint64_t reserved_13_15:3;
1172 uint64_t dma0_cnt:5;
1173 uint64_t reserved_5_7:3;
1174 uint64_t dma_cnt:5;
1175#else
1176 uint64_t dma_cnt:5;
1177 uint64_t reserved_5_7:3;
1178 uint64_t dma0_cnt:5;
1179 uint64_t reserved_13_15:3;
1180 uint64_t dma1_cnt:5;
1181 uint64_t reserved_21_23:3;
1182 uint64_t dma2_cnt:5;
1183 uint64_t reserved_29_31:3;
1184 uint64_t dma3_cnt:5;
1185 uint64_t reserved_37_39:3;
1186 uint64_t dma4_cnt:5;
1187 uint64_t reserved_45_47:3;
1188 uint64_t pkt_cnt:5;
1189 uint64_t reserved_53_62:10;
1190 uint64_t dma_arb:1;
1191#endif
1192 } s;
1193};
1194
1195union cvmx_npei_dma_state1 {
1196 uint64_t u64;
1197 struct cvmx_npei_dma_state1_s {
1198#ifdef __BIG_ENDIAN_BITFIELD
1199 uint64_t reserved_40_63:24;
1200 uint64_t d4_dwe:8;
1201 uint64_t d3_dwe:8;
1202 uint64_t d2_dwe:8;
1203 uint64_t d1_dwe:8;
1204 uint64_t d0_dwe:8;
1205#else
1206 uint64_t d0_dwe:8;
1207 uint64_t d1_dwe:8;
1208 uint64_t d2_dwe:8;
1209 uint64_t d3_dwe:8;
1210 uint64_t d4_dwe:8;
1211 uint64_t reserved_40_63:24;
1212#endif
1213 } s;
1214};
1215
1216union cvmx_npei_dma_state1_p1 {
1217 uint64_t u64;
1218 struct cvmx_npei_dma_state1_p1_s {
1219#ifdef __BIG_ENDIAN_BITFIELD
1220 uint64_t reserved_60_63:4;
1221 uint64_t d0_difst:7;
1222 uint64_t d1_difst:7;
1223 uint64_t d2_difst:7;
1224 uint64_t d3_difst:7;
1225 uint64_t d4_difst:7;
1226 uint64_t d0_reqst:5;
1227 uint64_t d1_reqst:5;
1228 uint64_t d2_reqst:5;
1229 uint64_t d3_reqst:5;
1230 uint64_t d4_reqst:5;
1231#else
1232 uint64_t d4_reqst:5;
1233 uint64_t d3_reqst:5;
1234 uint64_t d2_reqst:5;
1235 uint64_t d1_reqst:5;
1236 uint64_t d0_reqst:5;
1237 uint64_t d4_difst:7;
1238 uint64_t d3_difst:7;
1239 uint64_t d2_difst:7;
1240 uint64_t d1_difst:7;
1241 uint64_t d0_difst:7;
1242 uint64_t reserved_60_63:4;
1243#endif
1244 } s;
1245 struct cvmx_npei_dma_state1_p1_cn52xxp1 {
1246#ifdef __BIG_ENDIAN_BITFIELD
1247 uint64_t reserved_60_63:4;
1248 uint64_t d0_difst:7;
1249 uint64_t d1_difst:7;
1250 uint64_t d2_difst:7;
1251 uint64_t d3_difst:7;
1252 uint64_t reserved_25_31:7;
1253 uint64_t d0_reqst:5;
1254 uint64_t d1_reqst:5;
1255 uint64_t d2_reqst:5;
1256 uint64_t d3_reqst:5;
1257 uint64_t reserved_0_4:5;
1258#else
1259 uint64_t reserved_0_4:5;
1260 uint64_t d3_reqst:5;
1261 uint64_t d2_reqst:5;
1262 uint64_t d1_reqst:5;
1263 uint64_t d0_reqst:5;
1264 uint64_t reserved_25_31:7;
1265 uint64_t d3_difst:7;
1266 uint64_t d2_difst:7;
1267 uint64_t d1_difst:7;
1268 uint64_t d0_difst:7;
1269 uint64_t reserved_60_63:4;
1270#endif
1271 } cn52xxp1;
1272};
1273
1274union cvmx_npei_dma_state2 {
1275 uint64_t u64;
1276 struct cvmx_npei_dma_state2_s {
1277#ifdef __BIG_ENDIAN_BITFIELD
1278 uint64_t reserved_28_63:36;
1279 uint64_t ndwe:4;
1280 uint64_t reserved_21_23:3;
1281 uint64_t ndre:5;
1282 uint64_t reserved_10_15:6;
1283 uint64_t prd:10;
1284#else
1285 uint64_t prd:10;
1286 uint64_t reserved_10_15:6;
1287 uint64_t ndre:5;
1288 uint64_t reserved_21_23:3;
1289 uint64_t ndwe:4;
1290 uint64_t reserved_28_63:36;
1291#endif
1292 } s;
1293};
1294
1295union cvmx_npei_dma_state2_p1 {
1296 uint64_t u64;
1297 struct cvmx_npei_dma_state2_p1_s {
1298#ifdef __BIG_ENDIAN_BITFIELD
1299 uint64_t reserved_45_63:19;
1300 uint64_t d0_dffst:9;
1301 uint64_t d1_dffst:9;
1302 uint64_t d2_dffst:9;
1303 uint64_t d3_dffst:9;
1304 uint64_t d4_dffst:9;
1305#else
1306 uint64_t d4_dffst:9;
1307 uint64_t d3_dffst:9;
1308 uint64_t d2_dffst:9;
1309 uint64_t d1_dffst:9;
1310 uint64_t d0_dffst:9;
1311 uint64_t reserved_45_63:19;
1312#endif
1313 } s;
1314 struct cvmx_npei_dma_state2_p1_cn52xxp1 {
1315#ifdef __BIG_ENDIAN_BITFIELD
1316 uint64_t reserved_45_63:19;
1317 uint64_t d0_dffst:9;
1318 uint64_t d1_dffst:9;
1319 uint64_t d2_dffst:9;
1320 uint64_t d3_dffst:9;
1321 uint64_t reserved_0_8:9;
1322#else
1323 uint64_t reserved_0_8:9;
1324 uint64_t d3_dffst:9;
1325 uint64_t d2_dffst:9;
1326 uint64_t d1_dffst:9;
1327 uint64_t d0_dffst:9;
1328 uint64_t reserved_45_63:19;
1329#endif
1330 } cn52xxp1;
1331};
1332
1333union cvmx_npei_dma_state3_p1 {
1334 uint64_t u64;
1335 struct cvmx_npei_dma_state3_p1_s {
1336#ifdef __BIG_ENDIAN_BITFIELD
1337 uint64_t reserved_60_63:4;
1338 uint64_t d0_drest:15;
1339 uint64_t d1_drest:15;
1340 uint64_t d2_drest:15;
1341 uint64_t d3_drest:15;
1342#else
1343 uint64_t d3_drest:15;
1344 uint64_t d2_drest:15;
1345 uint64_t d1_drest:15;
1346 uint64_t d0_drest:15;
1347 uint64_t reserved_60_63:4;
1348#endif
1349 } s;
1350};
1351
1352union cvmx_npei_dma_state4_p1 {
1353 uint64_t u64;
1354 struct cvmx_npei_dma_state4_p1_s {
1355#ifdef __BIG_ENDIAN_BITFIELD
1356 uint64_t reserved_52_63:12;
1357 uint64_t d0_dwest:13;
1358 uint64_t d1_dwest:13;
1359 uint64_t d2_dwest:13;
1360 uint64_t d3_dwest:13;
1361#else
1362 uint64_t d3_dwest:13;
1363 uint64_t d2_dwest:13;
1364 uint64_t d1_dwest:13;
1365 uint64_t d0_dwest:13;
1366 uint64_t reserved_52_63:12;
1367#endif
1368 } s;
1369};
1370
1371union cvmx_npei_dma_state5_p1 {
1372 uint64_t u64;
1373 struct cvmx_npei_dma_state5_p1_s {
1374#ifdef __BIG_ENDIAN_BITFIELD
1375 uint64_t reserved_28_63:36;
1376 uint64_t d4_drest:15;
1377 uint64_t d4_dwest:13;
1378#else
1379 uint64_t d4_dwest:13;
1380 uint64_t d4_drest:15;
1381 uint64_t reserved_28_63:36;
1382#endif
1383 } s;
1384};
1385
1386union cvmx_npei_int_a_enb {
1387 uint64_t u64;
1388 struct cvmx_npei_int_a_enb_s {
1389#ifdef __BIG_ENDIAN_BITFIELD
1390 uint64_t reserved_10_63:54;
1391 uint64_t pout_err:1;
1392 uint64_t pin_bp:1;
1393 uint64_t p1_rdlk:1;
1394 uint64_t p0_rdlk:1;
1395 uint64_t pgl_err:1;
1396 uint64_t pdi_err:1;
1397 uint64_t pop_err:1;
1398 uint64_t pins_err:1;
1399 uint64_t dma1_cpl:1;
1400 uint64_t dma0_cpl:1;
1401#else
1402 uint64_t dma0_cpl:1;
1403 uint64_t dma1_cpl:1;
1404 uint64_t pins_err:1;
1405 uint64_t pop_err:1;
1406 uint64_t pdi_err:1;
1407 uint64_t pgl_err:1;
1408 uint64_t p0_rdlk:1;
1409 uint64_t p1_rdlk:1;
1410 uint64_t pin_bp:1;
1411 uint64_t pout_err:1;
1412 uint64_t reserved_10_63:54;
1413#endif
1414 } s;
1415 struct cvmx_npei_int_a_enb_cn52xxp1 {
1416#ifdef __BIG_ENDIAN_BITFIELD
1417 uint64_t reserved_2_63:62;
1418 uint64_t dma1_cpl:1;
1419 uint64_t dma0_cpl:1;
1420#else
1421 uint64_t dma0_cpl:1;
1422 uint64_t dma1_cpl:1;
1423 uint64_t reserved_2_63:62;
1424#endif
1425 } cn52xxp1;
1426};
1427
1428union cvmx_npei_int_a_enb2 {
1429 uint64_t u64;
1430 struct cvmx_npei_int_a_enb2_s {
1431#ifdef __BIG_ENDIAN_BITFIELD
1432 uint64_t reserved_10_63:54;
1433 uint64_t pout_err:1;
1434 uint64_t pin_bp:1;
1435 uint64_t p1_rdlk:1;
1436 uint64_t p0_rdlk:1;
1437 uint64_t pgl_err:1;
1438 uint64_t pdi_err:1;
1439 uint64_t pop_err:1;
1440 uint64_t pins_err:1;
1441 uint64_t dma1_cpl:1;
1442 uint64_t dma0_cpl:1;
1443#else
1444 uint64_t dma0_cpl:1;
1445 uint64_t dma1_cpl:1;
1446 uint64_t pins_err:1;
1447 uint64_t pop_err:1;
1448 uint64_t pdi_err:1;
1449 uint64_t pgl_err:1;
1450 uint64_t p0_rdlk:1;
1451 uint64_t p1_rdlk:1;
1452 uint64_t pin_bp:1;
1453 uint64_t pout_err:1;
1454 uint64_t reserved_10_63:54;
1455#endif
1456 } s;
1457 struct cvmx_npei_int_a_enb2_cn52xxp1 {
1458#ifdef __BIG_ENDIAN_BITFIELD
1459 uint64_t reserved_2_63:62;
1460 uint64_t dma1_cpl:1;
1461 uint64_t dma0_cpl:1;
1462#else
1463 uint64_t dma0_cpl:1;
1464 uint64_t dma1_cpl:1;
1465 uint64_t reserved_2_63:62;
1466#endif
1467 } cn52xxp1;
1468};
1469
1470union cvmx_npei_int_a_sum {
1471 uint64_t u64;
1472 struct cvmx_npei_int_a_sum_s {
1473#ifdef __BIG_ENDIAN_BITFIELD
1474 uint64_t reserved_10_63:54;
1475 uint64_t pout_err:1;
1476 uint64_t pin_bp:1;
1477 uint64_t p1_rdlk:1;
1478 uint64_t p0_rdlk:1;
1479 uint64_t pgl_err:1;
1480 uint64_t pdi_err:1;
1481 uint64_t pop_err:1;
1482 uint64_t pins_err:1;
1483 uint64_t dma1_cpl:1;
1484 uint64_t dma0_cpl:1;
1485#else
1486 uint64_t dma0_cpl:1;
1487 uint64_t dma1_cpl:1;
1488 uint64_t pins_err:1;
1489 uint64_t pop_err:1;
1490 uint64_t pdi_err:1;
1491 uint64_t pgl_err:1;
1492 uint64_t p0_rdlk:1;
1493 uint64_t p1_rdlk:1;
1494 uint64_t pin_bp:1;
1495 uint64_t pout_err:1;
1496 uint64_t reserved_10_63:54;
1497#endif
1498 } s;
1499 struct cvmx_npei_int_a_sum_cn52xxp1 {
1500#ifdef __BIG_ENDIAN_BITFIELD
1501 uint64_t reserved_2_63:62;
1502 uint64_t dma1_cpl:1;
1503 uint64_t dma0_cpl:1;
1504#else
1505 uint64_t dma0_cpl:1;
1506 uint64_t dma1_cpl:1;
1507 uint64_t reserved_2_63:62;
1508#endif
1509 } cn52xxp1;
1510};
1511
1512union cvmx_npei_int_enb {
1513 uint64_t u64;
1514 struct cvmx_npei_int_enb_s {
1515#ifdef __BIG_ENDIAN_BITFIELD
1516 uint64_t mio_inta:1;
1517 uint64_t reserved_62_62:1;
1518 uint64_t int_a:1;
1519 uint64_t c1_ldwn:1;
1520 uint64_t c0_ldwn:1;
1521 uint64_t c1_exc:1;
1522 uint64_t c0_exc:1;
1523 uint64_t c1_up_wf:1;
1524 uint64_t c0_up_wf:1;
1525 uint64_t c1_un_wf:1;
1526 uint64_t c0_un_wf:1;
1527 uint64_t c1_un_bx:1;
1528 uint64_t c1_un_wi:1;
1529 uint64_t c1_un_b2:1;
1530 uint64_t c1_un_b1:1;
1531 uint64_t c1_un_b0:1;
1532 uint64_t c1_up_bx:1;
1533 uint64_t c1_up_wi:1;
1534 uint64_t c1_up_b2:1;
1535 uint64_t c1_up_b1:1;
1536 uint64_t c1_up_b0:1;
1537 uint64_t c0_un_bx:1;
1538 uint64_t c0_un_wi:1;
1539 uint64_t c0_un_b2:1;
1540 uint64_t c0_un_b1:1;
1541 uint64_t c0_un_b0:1;
1542 uint64_t c0_up_bx:1;
1543 uint64_t c0_up_wi:1;
1544 uint64_t c0_up_b2:1;
1545 uint64_t c0_up_b1:1;
1546 uint64_t c0_up_b0:1;
1547 uint64_t c1_hpint:1;
1548 uint64_t c1_pmei:1;
1549 uint64_t c1_wake:1;
1550 uint64_t crs1_dr:1;
1551 uint64_t c1_se:1;
1552 uint64_t crs1_er:1;
1553 uint64_t c1_aeri:1;
1554 uint64_t c0_hpint:1;
1555 uint64_t c0_pmei:1;
1556 uint64_t c0_wake:1;
1557 uint64_t crs0_dr:1;
1558 uint64_t c0_se:1;
1559 uint64_t crs0_er:1;
1560 uint64_t c0_aeri:1;
1561 uint64_t ptime:1;
1562 uint64_t pcnt:1;
1563 uint64_t pidbof:1;
1564 uint64_t psldbof:1;
1565 uint64_t dtime1:1;
1566 uint64_t dtime0:1;
1567 uint64_t dcnt1:1;
1568 uint64_t dcnt0:1;
1569 uint64_t dma1fi:1;
1570 uint64_t dma0fi:1;
1571 uint64_t dma4dbo:1;
1572 uint64_t dma3dbo:1;
1573 uint64_t dma2dbo:1;
1574 uint64_t dma1dbo:1;
1575 uint64_t dma0dbo:1;
1576 uint64_t iob2big:1;
1577 uint64_t bar0_to:1;
1578 uint64_t rml_wto:1;
1579 uint64_t rml_rto:1;
1580#else
1581 uint64_t rml_rto:1;
1582 uint64_t rml_wto:1;
1583 uint64_t bar0_to:1;
1584 uint64_t iob2big:1;
1585 uint64_t dma0dbo:1;
1586 uint64_t dma1dbo:1;
1587 uint64_t dma2dbo:1;
1588 uint64_t dma3dbo:1;
1589 uint64_t dma4dbo:1;
1590 uint64_t dma0fi:1;
1591 uint64_t dma1fi:1;
1592 uint64_t dcnt0:1;
1593 uint64_t dcnt1:1;
1594 uint64_t dtime0:1;
1595 uint64_t dtime1:1;
1596 uint64_t psldbof:1;
1597 uint64_t pidbof:1;
1598 uint64_t pcnt:1;
1599 uint64_t ptime:1;
1600 uint64_t c0_aeri:1;
1601 uint64_t crs0_er:1;
1602 uint64_t c0_se:1;
1603 uint64_t crs0_dr:1;
1604 uint64_t c0_wake:1;
1605 uint64_t c0_pmei:1;
1606 uint64_t c0_hpint:1;
1607 uint64_t c1_aeri:1;
1608 uint64_t crs1_er:1;
1609 uint64_t c1_se:1;
1610 uint64_t crs1_dr:1;
1611 uint64_t c1_wake:1;
1612 uint64_t c1_pmei:1;
1613 uint64_t c1_hpint:1;
1614 uint64_t c0_up_b0:1;
1615 uint64_t c0_up_b1:1;
1616 uint64_t c0_up_b2:1;
1617 uint64_t c0_up_wi:1;
1618 uint64_t c0_up_bx:1;
1619 uint64_t c0_un_b0:1;
1620 uint64_t c0_un_b1:1;
1621 uint64_t c0_un_b2:1;
1622 uint64_t c0_un_wi:1;
1623 uint64_t c0_un_bx:1;
1624 uint64_t c1_up_b0:1;
1625 uint64_t c1_up_b1:1;
1626 uint64_t c1_up_b2:1;
1627 uint64_t c1_up_wi:1;
1628 uint64_t c1_up_bx:1;
1629 uint64_t c1_un_b0:1;
1630 uint64_t c1_un_b1:1;
1631 uint64_t c1_un_b2:1;
1632 uint64_t c1_un_wi:1;
1633 uint64_t c1_un_bx:1;
1634 uint64_t c0_un_wf:1;
1635 uint64_t c1_un_wf:1;
1636 uint64_t c0_up_wf:1;
1637 uint64_t c1_up_wf:1;
1638 uint64_t c0_exc:1;
1639 uint64_t c1_exc:1;
1640 uint64_t c0_ldwn:1;
1641 uint64_t c1_ldwn:1;
1642 uint64_t int_a:1;
1643 uint64_t reserved_62_62:1;
1644 uint64_t mio_inta:1;
1645#endif
1646 } s;
1647 struct cvmx_npei_int_enb_cn52xxp1 {
1648#ifdef __BIG_ENDIAN_BITFIELD
1649 uint64_t mio_inta:1;
1650 uint64_t reserved_62_62:1;
1651 uint64_t int_a:1;
1652 uint64_t c1_ldwn:1;
1653 uint64_t c0_ldwn:1;
1654 uint64_t c1_exc:1;
1655 uint64_t c0_exc:1;
1656 uint64_t c1_up_wf:1;
1657 uint64_t c0_up_wf:1;
1658 uint64_t c1_un_wf:1;
1659 uint64_t c0_un_wf:1;
1660 uint64_t c1_un_bx:1;
1661 uint64_t c1_un_wi:1;
1662 uint64_t c1_un_b2:1;
1663 uint64_t c1_un_b1:1;
1664 uint64_t c1_un_b0:1;
1665 uint64_t c1_up_bx:1;
1666 uint64_t c1_up_wi:1;
1667 uint64_t c1_up_b2:1;
1668 uint64_t c1_up_b1:1;
1669 uint64_t c1_up_b0:1;
1670 uint64_t c0_un_bx:1;
1671 uint64_t c0_un_wi:1;
1672 uint64_t c0_un_b2:1;
1673 uint64_t c0_un_b1:1;
1674 uint64_t c0_un_b0:1;
1675 uint64_t c0_up_bx:1;
1676 uint64_t c0_up_wi:1;
1677 uint64_t c0_up_b2:1;
1678 uint64_t c0_up_b1:1;
1679 uint64_t c0_up_b0:1;
1680 uint64_t c1_hpint:1;
1681 uint64_t c1_pmei:1;
1682 uint64_t c1_wake:1;
1683 uint64_t crs1_dr:1;
1684 uint64_t c1_se:1;
1685 uint64_t crs1_er:1;
1686 uint64_t c1_aeri:1;
1687 uint64_t c0_hpint:1;
1688 uint64_t c0_pmei:1;
1689 uint64_t c0_wake:1;
1690 uint64_t crs0_dr:1;
1691 uint64_t c0_se:1;
1692 uint64_t crs0_er:1;
1693 uint64_t c0_aeri:1;
1694 uint64_t ptime:1;
1695 uint64_t pcnt:1;
1696 uint64_t pidbof:1;
1697 uint64_t psldbof:1;
1698 uint64_t dtime1:1;
1699 uint64_t dtime0:1;
1700 uint64_t dcnt1:1;
1701 uint64_t dcnt0:1;
1702 uint64_t dma1fi:1;
1703 uint64_t dma0fi:1;
1704 uint64_t reserved_8_8:1;
1705 uint64_t dma3dbo:1;
1706 uint64_t dma2dbo:1;
1707 uint64_t dma1dbo:1;
1708 uint64_t dma0dbo:1;
1709 uint64_t iob2big:1;
1710 uint64_t bar0_to:1;
1711 uint64_t rml_wto:1;
1712 uint64_t rml_rto:1;
1713#else
1714 uint64_t rml_rto:1;
1715 uint64_t rml_wto:1;
1716 uint64_t bar0_to:1;
1717 uint64_t iob2big:1;
1718 uint64_t dma0dbo:1;
1719 uint64_t dma1dbo:1;
1720 uint64_t dma2dbo:1;
1721 uint64_t dma3dbo:1;
1722 uint64_t reserved_8_8:1;
1723 uint64_t dma0fi:1;
1724 uint64_t dma1fi:1;
1725 uint64_t dcnt0:1;
1726 uint64_t dcnt1:1;
1727 uint64_t dtime0:1;
1728 uint64_t dtime1:1;
1729 uint64_t psldbof:1;
1730 uint64_t pidbof:1;
1731 uint64_t pcnt:1;
1732 uint64_t ptime:1;
1733 uint64_t c0_aeri:1;
1734 uint64_t crs0_er:1;
1735 uint64_t c0_se:1;
1736 uint64_t crs0_dr:1;
1737 uint64_t c0_wake:1;
1738 uint64_t c0_pmei:1;
1739 uint64_t c0_hpint:1;
1740 uint64_t c1_aeri:1;
1741 uint64_t crs1_er:1;
1742 uint64_t c1_se:1;
1743 uint64_t crs1_dr:1;
1744 uint64_t c1_wake:1;
1745 uint64_t c1_pmei:1;
1746 uint64_t c1_hpint:1;
1747 uint64_t c0_up_b0:1;
1748 uint64_t c0_up_b1:1;
1749 uint64_t c0_up_b2:1;
1750 uint64_t c0_up_wi:1;
1751 uint64_t c0_up_bx:1;
1752 uint64_t c0_un_b0:1;
1753 uint64_t c0_un_b1:1;
1754 uint64_t c0_un_b2:1;
1755 uint64_t c0_un_wi:1;
1756 uint64_t c0_un_bx:1;
1757 uint64_t c1_up_b0:1;
1758 uint64_t c1_up_b1:1;
1759 uint64_t c1_up_b2:1;
1760 uint64_t c1_up_wi:1;
1761 uint64_t c1_up_bx:1;
1762 uint64_t c1_un_b0:1;
1763 uint64_t c1_un_b1:1;
1764 uint64_t c1_un_b2:1;
1765 uint64_t c1_un_wi:1;
1766 uint64_t c1_un_bx:1;
1767 uint64_t c0_un_wf:1;
1768 uint64_t c1_un_wf:1;
1769 uint64_t c0_up_wf:1;
1770 uint64_t c1_up_wf:1;
1771 uint64_t c0_exc:1;
1772 uint64_t c1_exc:1;
1773 uint64_t c0_ldwn:1;
1774 uint64_t c1_ldwn:1;
1775 uint64_t int_a:1;
1776 uint64_t reserved_62_62:1;
1777 uint64_t mio_inta:1;
1778#endif
1779 } cn52xxp1;
1780 struct cvmx_npei_int_enb_cn56xxp1 {
1781#ifdef __BIG_ENDIAN_BITFIELD
1782 uint64_t mio_inta:1;
1783 uint64_t reserved_61_62:2;
1784 uint64_t c1_ldwn:1;
1785 uint64_t c0_ldwn:1;
1786 uint64_t c1_exc:1;
1787 uint64_t c0_exc:1;
1788 uint64_t c1_up_wf:1;
1789 uint64_t c0_up_wf:1;
1790 uint64_t c1_un_wf:1;
1791 uint64_t c0_un_wf:1;
1792 uint64_t c1_un_bx:1;
1793 uint64_t c1_un_wi:1;
1794 uint64_t c1_un_b2:1;
1795 uint64_t c1_un_b1:1;
1796 uint64_t c1_un_b0:1;
1797 uint64_t c1_up_bx:1;
1798 uint64_t c1_up_wi:1;
1799 uint64_t c1_up_b2:1;
1800 uint64_t c1_up_b1:1;
1801 uint64_t c1_up_b0:1;
1802 uint64_t c0_un_bx:1;
1803 uint64_t c0_un_wi:1;
1804 uint64_t c0_un_b2:1;
1805 uint64_t c0_un_b1:1;
1806 uint64_t c0_un_b0:1;
1807 uint64_t c0_up_bx:1;
1808 uint64_t c0_up_wi:1;
1809 uint64_t c0_up_b2:1;
1810 uint64_t c0_up_b1:1;
1811 uint64_t c0_up_b0:1;
1812 uint64_t c1_hpint:1;
1813 uint64_t c1_pmei:1;
1814 uint64_t c1_wake:1;
1815 uint64_t reserved_29_29:1;
1816 uint64_t c1_se:1;
1817 uint64_t reserved_27_27:1;
1818 uint64_t c1_aeri:1;
1819 uint64_t c0_hpint:1;
1820 uint64_t c0_pmei:1;
1821 uint64_t c0_wake:1;
1822 uint64_t reserved_22_22:1;
1823 uint64_t c0_se:1;
1824 uint64_t reserved_20_20:1;
1825 uint64_t c0_aeri:1;
1826 uint64_t ptime:1;
1827 uint64_t pcnt:1;
1828 uint64_t pidbof:1;
1829 uint64_t psldbof:1;
1830 uint64_t dtime1:1;
1831 uint64_t dtime0:1;
1832 uint64_t dcnt1:1;
1833 uint64_t dcnt0:1;
1834 uint64_t dma1fi:1;
1835 uint64_t dma0fi:1;
1836 uint64_t dma4dbo:1;
1837 uint64_t dma3dbo:1;
1838 uint64_t dma2dbo:1;
1839 uint64_t dma1dbo:1;
1840 uint64_t dma0dbo:1;
1841 uint64_t iob2big:1;
1842 uint64_t bar0_to:1;
1843 uint64_t rml_wto:1;
1844 uint64_t rml_rto:1;
1845#else
1846 uint64_t rml_rto:1;
1847 uint64_t rml_wto:1;
1848 uint64_t bar0_to:1;
1849 uint64_t iob2big:1;
1850 uint64_t dma0dbo:1;
1851 uint64_t dma1dbo:1;
1852 uint64_t dma2dbo:1;
1853 uint64_t dma3dbo:1;
1854 uint64_t dma4dbo:1;
1855 uint64_t dma0fi:1;
1856 uint64_t dma1fi:1;
1857 uint64_t dcnt0:1;
1858 uint64_t dcnt1:1;
1859 uint64_t dtime0:1;
1860 uint64_t dtime1:1;
1861 uint64_t psldbof:1;
1862 uint64_t pidbof:1;
1863 uint64_t pcnt:1;
1864 uint64_t ptime:1;
1865 uint64_t c0_aeri:1;
1866 uint64_t reserved_20_20:1;
1867 uint64_t c0_se:1;
1868 uint64_t reserved_22_22:1;
1869 uint64_t c0_wake:1;
1870 uint64_t c0_pmei:1;
1871 uint64_t c0_hpint:1;
1872 uint64_t c1_aeri:1;
1873 uint64_t reserved_27_27:1;
1874 uint64_t c1_se:1;
1875 uint64_t reserved_29_29:1;
1876 uint64_t c1_wake:1;
1877 uint64_t c1_pmei:1;
1878 uint64_t c1_hpint:1;
1879 uint64_t c0_up_b0:1;
1880 uint64_t c0_up_b1:1;
1881 uint64_t c0_up_b2:1;
1882 uint64_t c0_up_wi:1;
1883 uint64_t c0_up_bx:1;
1884 uint64_t c0_un_b0:1;
1885 uint64_t c0_un_b1:1;
1886 uint64_t c0_un_b2:1;
1887 uint64_t c0_un_wi:1;
1888 uint64_t c0_un_bx:1;
1889 uint64_t c1_up_b0:1;
1890 uint64_t c1_up_b1:1;
1891 uint64_t c1_up_b2:1;
1892 uint64_t c1_up_wi:1;
1893 uint64_t c1_up_bx:1;
1894 uint64_t c1_un_b0:1;
1895 uint64_t c1_un_b1:1;
1896 uint64_t c1_un_b2:1;
1897 uint64_t c1_un_wi:1;
1898 uint64_t c1_un_bx:1;
1899 uint64_t c0_un_wf:1;
1900 uint64_t c1_un_wf:1;
1901 uint64_t c0_up_wf:1;
1902 uint64_t c1_up_wf:1;
1903 uint64_t c0_exc:1;
1904 uint64_t c1_exc:1;
1905 uint64_t c0_ldwn:1;
1906 uint64_t c1_ldwn:1;
1907 uint64_t reserved_61_62:2;
1908 uint64_t mio_inta:1;
1909#endif
1910 } cn56xxp1;
1911};
1912
1913union cvmx_npei_int_enb2 {
1914 uint64_t u64;
1915 struct cvmx_npei_int_enb2_s {
1916#ifdef __BIG_ENDIAN_BITFIELD
1917 uint64_t reserved_62_63:2;
1918 uint64_t int_a:1;
1919 uint64_t c1_ldwn:1;
1920 uint64_t c0_ldwn:1;
1921 uint64_t c1_exc:1;
1922 uint64_t c0_exc:1;
1923 uint64_t c1_up_wf:1;
1924 uint64_t c0_up_wf:1;
1925 uint64_t c1_un_wf:1;
1926 uint64_t c0_un_wf:1;
1927 uint64_t c1_un_bx:1;
1928 uint64_t c1_un_wi:1;
1929 uint64_t c1_un_b2:1;
1930 uint64_t c1_un_b1:1;
1931 uint64_t c1_un_b0:1;
1932 uint64_t c1_up_bx:1;
1933 uint64_t c1_up_wi:1;
1934 uint64_t c1_up_b2:1;
1935 uint64_t c1_up_b1:1;
1936 uint64_t c1_up_b0:1;
1937 uint64_t c0_un_bx:1;
1938 uint64_t c0_un_wi:1;
1939 uint64_t c0_un_b2:1;
1940 uint64_t c0_un_b1:1;
1941 uint64_t c0_un_b0:1;
1942 uint64_t c0_up_bx:1;
1943 uint64_t c0_up_wi:1;
1944 uint64_t c0_up_b2:1;
1945 uint64_t c0_up_b1:1;
1946 uint64_t c0_up_b0:1;
1947 uint64_t c1_hpint:1;
1948 uint64_t c1_pmei:1;
1949 uint64_t c1_wake:1;
1950 uint64_t crs1_dr:1;
1951 uint64_t c1_se:1;
1952 uint64_t crs1_er:1;
1953 uint64_t c1_aeri:1;
1954 uint64_t c0_hpint:1;
1955 uint64_t c0_pmei:1;
1956 uint64_t c0_wake:1;
1957 uint64_t crs0_dr:1;
1958 uint64_t c0_se:1;
1959 uint64_t crs0_er:1;
1960 uint64_t c0_aeri:1;
1961 uint64_t ptime:1;
1962 uint64_t pcnt:1;
1963 uint64_t pidbof:1;
1964 uint64_t psldbof:1;
1965 uint64_t dtime1:1;
1966 uint64_t dtime0:1;
1967 uint64_t dcnt1:1;
1968 uint64_t dcnt0:1;
1969 uint64_t dma1fi:1;
1970 uint64_t dma0fi:1;
1971 uint64_t dma4dbo:1;
1972 uint64_t dma3dbo:1;
1973 uint64_t dma2dbo:1;
1974 uint64_t dma1dbo:1;
1975 uint64_t dma0dbo:1;
1976 uint64_t iob2big:1;
1977 uint64_t bar0_to:1;
1978 uint64_t rml_wto:1;
1979 uint64_t rml_rto:1;
1980#else
1981 uint64_t rml_rto:1;
1982 uint64_t rml_wto:1;
1983 uint64_t bar0_to:1;
1984 uint64_t iob2big:1;
1985 uint64_t dma0dbo:1;
1986 uint64_t dma1dbo:1;
1987 uint64_t dma2dbo:1;
1988 uint64_t dma3dbo:1;
1989 uint64_t dma4dbo:1;
1990 uint64_t dma0fi:1;
1991 uint64_t dma1fi:1;
1992 uint64_t dcnt0:1;
1993 uint64_t dcnt1:1;
1994 uint64_t dtime0:1;
1995 uint64_t dtime1:1;
1996 uint64_t psldbof:1;
1997 uint64_t pidbof:1;
1998 uint64_t pcnt:1;
1999 uint64_t ptime:1;
2000 uint64_t c0_aeri:1;
2001 uint64_t crs0_er:1;
2002 uint64_t c0_se:1;
2003 uint64_t crs0_dr:1;
2004 uint64_t c0_wake:1;
2005 uint64_t c0_pmei:1;
2006 uint64_t c0_hpint:1;
2007 uint64_t c1_aeri:1;
2008 uint64_t crs1_er:1;
2009 uint64_t c1_se:1;
2010 uint64_t crs1_dr:1;
2011 uint64_t c1_wake:1;
2012 uint64_t c1_pmei:1;
2013 uint64_t c1_hpint:1;
2014 uint64_t c0_up_b0:1;
2015 uint64_t c0_up_b1:1;
2016 uint64_t c0_up_b2:1;
2017 uint64_t c0_up_wi:1;
2018 uint64_t c0_up_bx:1;
2019 uint64_t c0_un_b0:1;
2020 uint64_t c0_un_b1:1;
2021 uint64_t c0_un_b2:1;
2022 uint64_t c0_un_wi:1;
2023 uint64_t c0_un_bx:1;
2024 uint64_t c1_up_b0:1;
2025 uint64_t c1_up_b1:1;
2026 uint64_t c1_up_b2:1;
2027 uint64_t c1_up_wi:1;
2028 uint64_t c1_up_bx:1;
2029 uint64_t c1_un_b0:1;
2030 uint64_t c1_un_b1:1;
2031 uint64_t c1_un_b2:1;
2032 uint64_t c1_un_wi:1;
2033 uint64_t c1_un_bx:1;
2034 uint64_t c0_un_wf:1;
2035 uint64_t c1_un_wf:1;
2036 uint64_t c0_up_wf:1;
2037 uint64_t c1_up_wf:1;
2038 uint64_t c0_exc:1;
2039 uint64_t c1_exc:1;
2040 uint64_t c0_ldwn:1;
2041 uint64_t c1_ldwn:1;
2042 uint64_t int_a:1;
2043 uint64_t reserved_62_63:2;
2044#endif
2045 } s;
2046 struct cvmx_npei_int_enb2_cn52xxp1 {
2047#ifdef __BIG_ENDIAN_BITFIELD
2048 uint64_t reserved_62_63:2;
2049 uint64_t int_a:1;
2050 uint64_t c1_ldwn:1;
2051 uint64_t c0_ldwn:1;
2052 uint64_t c1_exc:1;
2053 uint64_t c0_exc:1;
2054 uint64_t c1_up_wf:1;
2055 uint64_t c0_up_wf:1;
2056 uint64_t c1_un_wf:1;
2057 uint64_t c0_un_wf:1;
2058 uint64_t c1_un_bx:1;
2059 uint64_t c1_un_wi:1;
2060 uint64_t c1_un_b2:1;
2061 uint64_t c1_un_b1:1;
2062 uint64_t c1_un_b0:1;
2063 uint64_t c1_up_bx:1;
2064 uint64_t c1_up_wi:1;
2065 uint64_t c1_up_b2:1;
2066 uint64_t c1_up_b1:1;
2067 uint64_t c1_up_b0:1;
2068 uint64_t c0_un_bx:1;
2069 uint64_t c0_un_wi:1;
2070 uint64_t c0_un_b2:1;
2071 uint64_t c0_un_b1:1;
2072 uint64_t c0_un_b0:1;
2073 uint64_t c0_up_bx:1;
2074 uint64_t c0_up_wi:1;
2075 uint64_t c0_up_b2:1;
2076 uint64_t c0_up_b1:1;
2077 uint64_t c0_up_b0:1;
2078 uint64_t c1_hpint:1;
2079 uint64_t c1_pmei:1;
2080 uint64_t c1_wake:1;
2081 uint64_t crs1_dr:1;
2082 uint64_t c1_se:1;
2083 uint64_t crs1_er:1;
2084 uint64_t c1_aeri:1;
2085 uint64_t c0_hpint:1;
2086 uint64_t c0_pmei:1;
2087 uint64_t c0_wake:1;
2088 uint64_t crs0_dr:1;
2089 uint64_t c0_se:1;
2090 uint64_t crs0_er:1;
2091 uint64_t c0_aeri:1;
2092 uint64_t ptime:1;
2093 uint64_t pcnt:1;
2094 uint64_t pidbof:1;
2095 uint64_t psldbof:1;
2096 uint64_t dtime1:1;
2097 uint64_t dtime0:1;
2098 uint64_t dcnt1:1;
2099 uint64_t dcnt0:1;
2100 uint64_t dma1fi:1;
2101 uint64_t dma0fi:1;
2102 uint64_t reserved_8_8:1;
2103 uint64_t dma3dbo:1;
2104 uint64_t dma2dbo:1;
2105 uint64_t dma1dbo:1;
2106 uint64_t dma0dbo:1;
2107 uint64_t iob2big:1;
2108 uint64_t bar0_to:1;
2109 uint64_t rml_wto:1;
2110 uint64_t rml_rto:1;
2111#else
2112 uint64_t rml_rto:1;
2113 uint64_t rml_wto:1;
2114 uint64_t bar0_to:1;
2115 uint64_t iob2big:1;
2116 uint64_t dma0dbo:1;
2117 uint64_t dma1dbo:1;
2118 uint64_t dma2dbo:1;
2119 uint64_t dma3dbo:1;
2120 uint64_t reserved_8_8:1;
2121 uint64_t dma0fi:1;
2122 uint64_t dma1fi:1;
2123 uint64_t dcnt0:1;
2124 uint64_t dcnt1:1;
2125 uint64_t dtime0:1;
2126 uint64_t dtime1:1;
2127 uint64_t psldbof:1;
2128 uint64_t pidbof:1;
2129 uint64_t pcnt:1;
2130 uint64_t ptime:1;
2131 uint64_t c0_aeri:1;
2132 uint64_t crs0_er:1;
2133 uint64_t c0_se:1;
2134 uint64_t crs0_dr:1;
2135 uint64_t c0_wake:1;
2136 uint64_t c0_pmei:1;
2137 uint64_t c0_hpint:1;
2138 uint64_t c1_aeri:1;
2139 uint64_t crs1_er:1;
2140 uint64_t c1_se:1;
2141 uint64_t crs1_dr:1;
2142 uint64_t c1_wake:1;
2143 uint64_t c1_pmei:1;
2144 uint64_t c1_hpint:1;
2145 uint64_t c0_up_b0:1;
2146 uint64_t c0_up_b1:1;
2147 uint64_t c0_up_b2:1;
2148 uint64_t c0_up_wi:1;
2149 uint64_t c0_up_bx:1;
2150 uint64_t c0_un_b0:1;
2151 uint64_t c0_un_b1:1;
2152 uint64_t c0_un_b2:1;
2153 uint64_t c0_un_wi:1;
2154 uint64_t c0_un_bx:1;
2155 uint64_t c1_up_b0:1;
2156 uint64_t c1_up_b1:1;
2157 uint64_t c1_up_b2:1;
2158 uint64_t c1_up_wi:1;
2159 uint64_t c1_up_bx:1;
2160 uint64_t c1_un_b0:1;
2161 uint64_t c1_un_b1:1;
2162 uint64_t c1_un_b2:1;
2163 uint64_t c1_un_wi:1;
2164 uint64_t c1_un_bx:1;
2165 uint64_t c0_un_wf:1;
2166 uint64_t c1_un_wf:1;
2167 uint64_t c0_up_wf:1;
2168 uint64_t c1_up_wf:1;
2169 uint64_t c0_exc:1;
2170 uint64_t c1_exc:1;
2171 uint64_t c0_ldwn:1;
2172 uint64_t c1_ldwn:1;
2173 uint64_t int_a:1;
2174 uint64_t reserved_62_63:2;
2175#endif
2176 } cn52xxp1;
2177 struct cvmx_npei_int_enb2_cn56xxp1 {
2178#ifdef __BIG_ENDIAN_BITFIELD
2179 uint64_t reserved_61_63:3;
2180 uint64_t c1_ldwn:1;
2181 uint64_t c0_ldwn:1;
2182 uint64_t c1_exc:1;
2183 uint64_t c0_exc:1;
2184 uint64_t c1_up_wf:1;
2185 uint64_t c0_up_wf:1;
2186 uint64_t c1_un_wf:1;
2187 uint64_t c0_un_wf:1;
2188 uint64_t c1_un_bx:1;
2189 uint64_t c1_un_wi:1;
2190 uint64_t c1_un_b2:1;
2191 uint64_t c1_un_b1:1;
2192 uint64_t c1_un_b0:1;
2193 uint64_t c1_up_bx:1;
2194 uint64_t c1_up_wi:1;
2195 uint64_t c1_up_b2:1;
2196 uint64_t c1_up_b1:1;
2197 uint64_t c1_up_b0:1;
2198 uint64_t c0_un_bx:1;
2199 uint64_t c0_un_wi:1;
2200 uint64_t c0_un_b2:1;
2201 uint64_t c0_un_b1:1;
2202 uint64_t c0_un_b0:1;
2203 uint64_t c0_up_bx:1;
2204 uint64_t c0_up_wi:1;
2205 uint64_t c0_up_b2:1;
2206 uint64_t c0_up_b1:1;
2207 uint64_t c0_up_b0:1;
2208 uint64_t c1_hpint:1;
2209 uint64_t c1_pmei:1;
2210 uint64_t c1_wake:1;
2211 uint64_t reserved_29_29:1;
2212 uint64_t c1_se:1;
2213 uint64_t reserved_27_27:1;
2214 uint64_t c1_aeri:1;
2215 uint64_t c0_hpint:1;
2216 uint64_t c0_pmei:1;
2217 uint64_t c0_wake:1;
2218 uint64_t reserved_22_22:1;
2219 uint64_t c0_se:1;
2220 uint64_t reserved_20_20:1;
2221 uint64_t c0_aeri:1;
2222 uint64_t ptime:1;
2223 uint64_t pcnt:1;
2224 uint64_t pidbof:1;
2225 uint64_t psldbof:1;
2226 uint64_t dtime1:1;
2227 uint64_t dtime0:1;
2228 uint64_t dcnt1:1;
2229 uint64_t dcnt0:1;
2230 uint64_t dma1fi:1;
2231 uint64_t dma0fi:1;
2232 uint64_t dma4dbo:1;
2233 uint64_t dma3dbo:1;
2234 uint64_t dma2dbo:1;
2235 uint64_t dma1dbo:1;
2236 uint64_t dma0dbo:1;
2237 uint64_t iob2big:1;
2238 uint64_t bar0_to:1;
2239 uint64_t rml_wto:1;
2240 uint64_t rml_rto:1;
2241#else
2242 uint64_t rml_rto:1;
2243 uint64_t rml_wto:1;
2244 uint64_t bar0_to:1;
2245 uint64_t iob2big:1;
2246 uint64_t dma0dbo:1;
2247 uint64_t dma1dbo:1;
2248 uint64_t dma2dbo:1;
2249 uint64_t dma3dbo:1;
2250 uint64_t dma4dbo:1;
2251 uint64_t dma0fi:1;
2252 uint64_t dma1fi:1;
2253 uint64_t dcnt0:1;
2254 uint64_t dcnt1:1;
2255 uint64_t dtime0:1;
2256 uint64_t dtime1:1;
2257 uint64_t psldbof:1;
2258 uint64_t pidbof:1;
2259 uint64_t pcnt:1;
2260 uint64_t ptime:1;
2261 uint64_t c0_aeri:1;
2262 uint64_t reserved_20_20:1;
2263 uint64_t c0_se:1;
2264 uint64_t reserved_22_22:1;
2265 uint64_t c0_wake:1;
2266 uint64_t c0_pmei:1;
2267 uint64_t c0_hpint:1;
2268 uint64_t c1_aeri:1;
2269 uint64_t reserved_27_27:1;
2270 uint64_t c1_se:1;
2271 uint64_t reserved_29_29:1;
2272 uint64_t c1_wake:1;
2273 uint64_t c1_pmei:1;
2274 uint64_t c1_hpint:1;
2275 uint64_t c0_up_b0:1;
2276 uint64_t c0_up_b1:1;
2277 uint64_t c0_up_b2:1;
2278 uint64_t c0_up_wi:1;
2279 uint64_t c0_up_bx:1;
2280 uint64_t c0_un_b0:1;
2281 uint64_t c0_un_b1:1;
2282 uint64_t c0_un_b2:1;
2283 uint64_t c0_un_wi:1;
2284 uint64_t c0_un_bx:1;
2285 uint64_t c1_up_b0:1;
2286 uint64_t c1_up_b1:1;
2287 uint64_t c1_up_b2:1;
2288 uint64_t c1_up_wi:1;
2289 uint64_t c1_up_bx:1;
2290 uint64_t c1_un_b0:1;
2291 uint64_t c1_un_b1:1;
2292 uint64_t c1_un_b2:1;
2293 uint64_t c1_un_wi:1;
2294 uint64_t c1_un_bx:1;
2295 uint64_t c0_un_wf:1;
2296 uint64_t c1_un_wf:1;
2297 uint64_t c0_up_wf:1;
2298 uint64_t c1_up_wf:1;
2299 uint64_t c0_exc:1;
2300 uint64_t c1_exc:1;
2301 uint64_t c0_ldwn:1;
2302 uint64_t c1_ldwn:1;
2303 uint64_t reserved_61_63:3;
2304#endif
2305 } cn56xxp1;
2306};
2307
2308union cvmx_npei_int_info {
2309 uint64_t u64;
2310 struct cvmx_npei_int_info_s {
2311#ifdef __BIG_ENDIAN_BITFIELD
2312 uint64_t reserved_12_63:52;
2313 uint64_t pidbof:6;
2314 uint64_t psldbof:6;
2315#else
2316 uint64_t psldbof:6;
2317 uint64_t pidbof:6;
2318 uint64_t reserved_12_63:52;
2319#endif
2320 } s;
2321};
2322
2323union cvmx_npei_int_sum {
2324 uint64_t u64;
2325 struct cvmx_npei_int_sum_s {
2326#ifdef __BIG_ENDIAN_BITFIELD
2327 uint64_t mio_inta:1;
2328 uint64_t reserved_62_62:1;
2329 uint64_t int_a:1;
2330 uint64_t c1_ldwn:1;
2331 uint64_t c0_ldwn:1;
2332 uint64_t c1_exc:1;
2333 uint64_t c0_exc:1;
2334 uint64_t c1_up_wf:1;
2335 uint64_t c0_up_wf:1;
2336 uint64_t c1_un_wf:1;
2337 uint64_t c0_un_wf:1;
2338 uint64_t c1_un_bx:1;
2339 uint64_t c1_un_wi:1;
2340 uint64_t c1_un_b2:1;
2341 uint64_t c1_un_b1:1;
2342 uint64_t c1_un_b0:1;
2343 uint64_t c1_up_bx:1;
2344 uint64_t c1_up_wi:1;
2345 uint64_t c1_up_b2:1;
2346 uint64_t c1_up_b1:1;
2347 uint64_t c1_up_b0:1;
2348 uint64_t c0_un_bx:1;
2349 uint64_t c0_un_wi:1;
2350 uint64_t c0_un_b2:1;
2351 uint64_t c0_un_b1:1;
2352 uint64_t c0_un_b0:1;
2353 uint64_t c0_up_bx:1;
2354 uint64_t c0_up_wi:1;
2355 uint64_t c0_up_b2:1;
2356 uint64_t c0_up_b1:1;
2357 uint64_t c0_up_b0:1;
2358 uint64_t c1_hpint:1;
2359 uint64_t c1_pmei:1;
2360 uint64_t c1_wake:1;
2361 uint64_t crs1_dr:1;
2362 uint64_t c1_se:1;
2363 uint64_t crs1_er:1;
2364 uint64_t c1_aeri:1;
2365 uint64_t c0_hpint:1;
2366 uint64_t c0_pmei:1;
2367 uint64_t c0_wake:1;
2368 uint64_t crs0_dr:1;
2369 uint64_t c0_se:1;
2370 uint64_t crs0_er:1;
2371 uint64_t c0_aeri:1;
2372 uint64_t ptime:1;
2373 uint64_t pcnt:1;
2374 uint64_t pidbof:1;
2375 uint64_t psldbof:1;
2376 uint64_t dtime1:1;
2377 uint64_t dtime0:1;
2378 uint64_t dcnt1:1;
2379 uint64_t dcnt0:1;
2380 uint64_t dma1fi:1;
2381 uint64_t dma0fi:1;
2382 uint64_t dma4dbo:1;
2383 uint64_t dma3dbo:1;
2384 uint64_t dma2dbo:1;
2385 uint64_t dma1dbo:1;
2386 uint64_t dma0dbo:1;
2387 uint64_t iob2big:1;
2388 uint64_t bar0_to:1;
2389 uint64_t rml_wto:1;
2390 uint64_t rml_rto:1;
2391#else
2392 uint64_t rml_rto:1;
2393 uint64_t rml_wto:1;
2394 uint64_t bar0_to:1;
2395 uint64_t iob2big:1;
2396 uint64_t dma0dbo:1;
2397 uint64_t dma1dbo:1;
2398 uint64_t dma2dbo:1;
2399 uint64_t dma3dbo:1;
2400 uint64_t dma4dbo:1;
2401 uint64_t dma0fi:1;
2402 uint64_t dma1fi:1;
2403 uint64_t dcnt0:1;
2404 uint64_t dcnt1:1;
2405 uint64_t dtime0:1;
2406 uint64_t dtime1:1;
2407 uint64_t psldbof:1;
2408 uint64_t pidbof:1;
2409 uint64_t pcnt:1;
2410 uint64_t ptime:1;
2411 uint64_t c0_aeri:1;
2412 uint64_t crs0_er:1;
2413 uint64_t c0_se:1;
2414 uint64_t crs0_dr:1;
2415 uint64_t c0_wake:1;
2416 uint64_t c0_pmei:1;
2417 uint64_t c0_hpint:1;
2418 uint64_t c1_aeri:1;
2419 uint64_t crs1_er:1;
2420 uint64_t c1_se:1;
2421 uint64_t crs1_dr:1;
2422 uint64_t c1_wake:1;
2423 uint64_t c1_pmei:1;
2424 uint64_t c1_hpint:1;
2425 uint64_t c0_up_b0:1;
2426 uint64_t c0_up_b1:1;
2427 uint64_t c0_up_b2:1;
2428 uint64_t c0_up_wi:1;
2429 uint64_t c0_up_bx:1;
2430 uint64_t c0_un_b0:1;
2431 uint64_t c0_un_b1:1;
2432 uint64_t c0_un_b2:1;
2433 uint64_t c0_un_wi:1;
2434 uint64_t c0_un_bx:1;
2435 uint64_t c1_up_b0:1;
2436 uint64_t c1_up_b1:1;
2437 uint64_t c1_up_b2:1;
2438 uint64_t c1_up_wi:1;
2439 uint64_t c1_up_bx:1;
2440 uint64_t c1_un_b0:1;
2441 uint64_t c1_un_b1:1;
2442 uint64_t c1_un_b2:1;
2443 uint64_t c1_un_wi:1;
2444 uint64_t c1_un_bx:1;
2445 uint64_t c0_un_wf:1;
2446 uint64_t c1_un_wf:1;
2447 uint64_t c0_up_wf:1;
2448 uint64_t c1_up_wf:1;
2449 uint64_t c0_exc:1;
2450 uint64_t c1_exc:1;
2451 uint64_t c0_ldwn:1;
2452 uint64_t c1_ldwn:1;
2453 uint64_t int_a:1;
2454 uint64_t reserved_62_62:1;
2455 uint64_t mio_inta:1;
2456#endif
2457 } s;
2458 struct cvmx_npei_int_sum_cn52xxp1 {
2459#ifdef __BIG_ENDIAN_BITFIELD
2460 uint64_t mio_inta:1;
2461 uint64_t reserved_62_62:1;
2462 uint64_t int_a:1;
2463 uint64_t c1_ldwn:1;
2464 uint64_t c0_ldwn:1;
2465 uint64_t c1_exc:1;
2466 uint64_t c0_exc:1;
2467 uint64_t c1_up_wf:1;
2468 uint64_t c0_up_wf:1;
2469 uint64_t c1_un_wf:1;
2470 uint64_t c0_un_wf:1;
2471 uint64_t c1_un_bx:1;
2472 uint64_t c1_un_wi:1;
2473 uint64_t c1_un_b2:1;
2474 uint64_t c1_un_b1:1;
2475 uint64_t c1_un_b0:1;
2476 uint64_t c1_up_bx:1;
2477 uint64_t c1_up_wi:1;
2478 uint64_t c1_up_b2:1;
2479 uint64_t c1_up_b1:1;
2480 uint64_t c1_up_b0:1;
2481 uint64_t c0_un_bx:1;
2482 uint64_t c0_un_wi:1;
2483 uint64_t c0_un_b2:1;
2484 uint64_t c0_un_b1:1;
2485 uint64_t c0_un_b0:1;
2486 uint64_t c0_up_bx:1;
2487 uint64_t c0_up_wi:1;
2488 uint64_t c0_up_b2:1;
2489 uint64_t c0_up_b1:1;
2490 uint64_t c0_up_b0:1;
2491 uint64_t c1_hpint:1;
2492 uint64_t c1_pmei:1;
2493 uint64_t c1_wake:1;
2494 uint64_t crs1_dr:1;
2495 uint64_t c1_se:1;
2496 uint64_t crs1_er:1;
2497 uint64_t c1_aeri:1;
2498 uint64_t c0_hpint:1;
2499 uint64_t c0_pmei:1;
2500 uint64_t c0_wake:1;
2501 uint64_t crs0_dr:1;
2502 uint64_t c0_se:1;
2503 uint64_t crs0_er:1;
2504 uint64_t c0_aeri:1;
2505 uint64_t reserved_15_18:4;
2506 uint64_t dtime1:1;
2507 uint64_t dtime0:1;
2508 uint64_t dcnt1:1;
2509 uint64_t dcnt0:1;
2510 uint64_t dma1fi:1;
2511 uint64_t dma0fi:1;
2512 uint64_t reserved_8_8:1;
2513 uint64_t dma3dbo:1;
2514 uint64_t dma2dbo:1;
2515 uint64_t dma1dbo:1;
2516 uint64_t dma0dbo:1;
2517 uint64_t iob2big:1;
2518 uint64_t bar0_to:1;
2519 uint64_t rml_wto:1;
2520 uint64_t rml_rto:1;
2521#else
2522 uint64_t rml_rto:1;
2523 uint64_t rml_wto:1;
2524 uint64_t bar0_to:1;
2525 uint64_t iob2big:1;
2526 uint64_t dma0dbo:1;
2527 uint64_t dma1dbo:1;
2528 uint64_t dma2dbo:1;
2529 uint64_t dma3dbo:1;
2530 uint64_t reserved_8_8:1;
2531 uint64_t dma0fi:1;
2532 uint64_t dma1fi:1;
2533 uint64_t dcnt0:1;
2534 uint64_t dcnt1:1;
2535 uint64_t dtime0:1;
2536 uint64_t dtime1:1;
2537 uint64_t reserved_15_18:4;
2538 uint64_t c0_aeri:1;
2539 uint64_t crs0_er:1;
2540 uint64_t c0_se:1;
2541 uint64_t crs0_dr:1;
2542 uint64_t c0_wake:1;
2543 uint64_t c0_pmei:1;
2544 uint64_t c0_hpint:1;
2545 uint64_t c1_aeri:1;
2546 uint64_t crs1_er:1;
2547 uint64_t c1_se:1;
2548 uint64_t crs1_dr:1;
2549 uint64_t c1_wake:1;
2550 uint64_t c1_pmei:1;
2551 uint64_t c1_hpint:1;
2552 uint64_t c0_up_b0:1;
2553 uint64_t c0_up_b1:1;
2554 uint64_t c0_up_b2:1;
2555 uint64_t c0_up_wi:1;
2556 uint64_t c0_up_bx:1;
2557 uint64_t c0_un_b0:1;
2558 uint64_t c0_un_b1:1;
2559 uint64_t c0_un_b2:1;
2560 uint64_t c0_un_wi:1;
2561 uint64_t c0_un_bx:1;
2562 uint64_t c1_up_b0:1;
2563 uint64_t c1_up_b1:1;
2564 uint64_t c1_up_b2:1;
2565 uint64_t c1_up_wi:1;
2566 uint64_t c1_up_bx:1;
2567 uint64_t c1_un_b0:1;
2568 uint64_t c1_un_b1:1;
2569 uint64_t c1_un_b2:1;
2570 uint64_t c1_un_wi:1;
2571 uint64_t c1_un_bx:1;
2572 uint64_t c0_un_wf:1;
2573 uint64_t c1_un_wf:1;
2574 uint64_t c0_up_wf:1;
2575 uint64_t c1_up_wf:1;
2576 uint64_t c0_exc:1;
2577 uint64_t c1_exc:1;
2578 uint64_t c0_ldwn:1;
2579 uint64_t c1_ldwn:1;
2580 uint64_t int_a:1;
2581 uint64_t reserved_62_62:1;
2582 uint64_t mio_inta:1;
2583#endif
2584 } cn52xxp1;
2585 struct cvmx_npei_int_sum_cn56xxp1 {
2586#ifdef __BIG_ENDIAN_BITFIELD
2587 uint64_t mio_inta:1;
2588 uint64_t reserved_61_62:2;
2589 uint64_t c1_ldwn:1;
2590 uint64_t c0_ldwn:1;
2591 uint64_t c1_exc:1;
2592 uint64_t c0_exc:1;
2593 uint64_t c1_up_wf:1;
2594 uint64_t c0_up_wf:1;
2595 uint64_t c1_un_wf:1;
2596 uint64_t c0_un_wf:1;
2597 uint64_t c1_un_bx:1;
2598 uint64_t c1_un_wi:1;
2599 uint64_t c1_un_b2:1;
2600 uint64_t c1_un_b1:1;
2601 uint64_t c1_un_b0:1;
2602 uint64_t c1_up_bx:1;
2603 uint64_t c1_up_wi:1;
2604 uint64_t c1_up_b2:1;
2605 uint64_t c1_up_b1:1;
2606 uint64_t c1_up_b0:1;
2607 uint64_t c0_un_bx:1;
2608 uint64_t c0_un_wi:1;
2609 uint64_t c0_un_b2:1;
2610 uint64_t c0_un_b1:1;
2611 uint64_t c0_un_b0:1;
2612 uint64_t c0_up_bx:1;
2613 uint64_t c0_up_wi:1;
2614 uint64_t c0_up_b2:1;
2615 uint64_t c0_up_b1:1;
2616 uint64_t c0_up_b0:1;
2617 uint64_t c1_hpint:1;
2618 uint64_t c1_pmei:1;
2619 uint64_t c1_wake:1;
2620 uint64_t reserved_29_29:1;
2621 uint64_t c1_se:1;
2622 uint64_t reserved_27_27:1;
2623 uint64_t c1_aeri:1;
2624 uint64_t c0_hpint:1;
2625 uint64_t c0_pmei:1;
2626 uint64_t c0_wake:1;
2627 uint64_t reserved_22_22:1;
2628 uint64_t c0_se:1;
2629 uint64_t reserved_20_20:1;
2630 uint64_t c0_aeri:1;
2631 uint64_t reserved_15_18:4;
2632 uint64_t dtime1:1;
2633 uint64_t dtime0:1;
2634 uint64_t dcnt1:1;
2635 uint64_t dcnt0:1;
2636 uint64_t dma1fi:1;
2637 uint64_t dma0fi:1;
2638 uint64_t dma4dbo:1;
2639 uint64_t dma3dbo:1;
2640 uint64_t dma2dbo:1;
2641 uint64_t dma1dbo:1;
2642 uint64_t dma0dbo:1;
2643 uint64_t iob2big:1;
2644 uint64_t bar0_to:1;
2645 uint64_t rml_wto:1;
2646 uint64_t rml_rto:1;
2647#else
2648 uint64_t rml_rto:1;
2649 uint64_t rml_wto:1;
2650 uint64_t bar0_to:1;
2651 uint64_t iob2big:1;
2652 uint64_t dma0dbo:1;
2653 uint64_t dma1dbo:1;
2654 uint64_t dma2dbo:1;
2655 uint64_t dma3dbo:1;
2656 uint64_t dma4dbo:1;
2657 uint64_t dma0fi:1;
2658 uint64_t dma1fi:1;
2659 uint64_t dcnt0:1;
2660 uint64_t dcnt1:1;
2661 uint64_t dtime0:1;
2662 uint64_t dtime1:1;
2663 uint64_t reserved_15_18:4;
2664 uint64_t c0_aeri:1;
2665 uint64_t reserved_20_20:1;
2666 uint64_t c0_se:1;
2667 uint64_t reserved_22_22:1;
2668 uint64_t c0_wake:1;
2669 uint64_t c0_pmei:1;
2670 uint64_t c0_hpint:1;
2671 uint64_t c1_aeri:1;
2672 uint64_t reserved_27_27:1;
2673 uint64_t c1_se:1;
2674 uint64_t reserved_29_29:1;
2675 uint64_t c1_wake:1;
2676 uint64_t c1_pmei:1;
2677 uint64_t c1_hpint:1;
2678 uint64_t c0_up_b0:1;
2679 uint64_t c0_up_b1:1;
2680 uint64_t c0_up_b2:1;
2681 uint64_t c0_up_wi:1;
2682 uint64_t c0_up_bx:1;
2683 uint64_t c0_un_b0:1;
2684 uint64_t c0_un_b1:1;
2685 uint64_t c0_un_b2:1;
2686 uint64_t c0_un_wi:1;
2687 uint64_t c0_un_bx:1;
2688 uint64_t c1_up_b0:1;
2689 uint64_t c1_up_b1:1;
2690 uint64_t c1_up_b2:1;
2691 uint64_t c1_up_wi:1;
2692 uint64_t c1_up_bx:1;
2693 uint64_t c1_un_b0:1;
2694 uint64_t c1_un_b1:1;
2695 uint64_t c1_un_b2:1;
2696 uint64_t c1_un_wi:1;
2697 uint64_t c1_un_bx:1;
2698 uint64_t c0_un_wf:1;
2699 uint64_t c1_un_wf:1;
2700 uint64_t c0_up_wf:1;
2701 uint64_t c1_up_wf:1;
2702 uint64_t c0_exc:1;
2703 uint64_t c1_exc:1;
2704 uint64_t c0_ldwn:1;
2705 uint64_t c1_ldwn:1;
2706 uint64_t reserved_61_62:2;
2707 uint64_t mio_inta:1;
2708#endif
2709 } cn56xxp1;
2710};
2711
2712union cvmx_npei_int_sum2 {
2713 uint64_t u64;
2714 struct cvmx_npei_int_sum2_s {
2715#ifdef __BIG_ENDIAN_BITFIELD
2716 uint64_t mio_inta:1;
2717 uint64_t reserved_62_62:1;
2718 uint64_t int_a:1;
2719 uint64_t c1_ldwn:1;
2720 uint64_t c0_ldwn:1;
2721 uint64_t c1_exc:1;
2722 uint64_t c0_exc:1;
2723 uint64_t c1_up_wf:1;
2724 uint64_t c0_up_wf:1;
2725 uint64_t c1_un_wf:1;
2726 uint64_t c0_un_wf:1;
2727 uint64_t c1_un_bx:1;
2728 uint64_t c1_un_wi:1;
2729 uint64_t c1_un_b2:1;
2730 uint64_t c1_un_b1:1;
2731 uint64_t c1_un_b0:1;
2732 uint64_t c1_up_bx:1;
2733 uint64_t c1_up_wi:1;
2734 uint64_t c1_up_b2:1;
2735 uint64_t c1_up_b1:1;
2736 uint64_t c1_up_b0:1;
2737 uint64_t c0_un_bx:1;
2738 uint64_t c0_un_wi:1;
2739 uint64_t c0_un_b2:1;
2740 uint64_t c0_un_b1:1;
2741 uint64_t c0_un_b0:1;
2742 uint64_t c0_up_bx:1;
2743 uint64_t c0_up_wi:1;
2744 uint64_t c0_up_b2:1;
2745 uint64_t c0_up_b1:1;
2746 uint64_t c0_up_b0:1;
2747 uint64_t c1_hpint:1;
2748 uint64_t c1_pmei:1;
2749 uint64_t c1_wake:1;
2750 uint64_t crs1_dr:1;
2751 uint64_t c1_se:1;
2752 uint64_t crs1_er:1;
2753 uint64_t c1_aeri:1;
2754 uint64_t c0_hpint:1;
2755 uint64_t c0_pmei:1;
2756 uint64_t c0_wake:1;
2757 uint64_t crs0_dr:1;
2758 uint64_t c0_se:1;
2759 uint64_t crs0_er:1;
2760 uint64_t c0_aeri:1;
2761 uint64_t reserved_15_18:4;
2762 uint64_t dtime1:1;
2763 uint64_t dtime0:1;
2764 uint64_t dcnt1:1;
2765 uint64_t dcnt0:1;
2766 uint64_t dma1fi:1;
2767 uint64_t dma0fi:1;
2768 uint64_t reserved_8_8:1;
2769 uint64_t dma3dbo:1;
2770 uint64_t dma2dbo:1;
2771 uint64_t dma1dbo:1;
2772 uint64_t dma0dbo:1;
2773 uint64_t iob2big:1;
2774 uint64_t bar0_to:1;
2775 uint64_t rml_wto:1;
2776 uint64_t rml_rto:1;
2777#else
2778 uint64_t rml_rto:1;
2779 uint64_t rml_wto:1;
2780 uint64_t bar0_to:1;
2781 uint64_t iob2big:1;
2782 uint64_t dma0dbo:1;
2783 uint64_t dma1dbo:1;
2784 uint64_t dma2dbo:1;
2785 uint64_t dma3dbo:1;
2786 uint64_t reserved_8_8:1;
2787 uint64_t dma0fi:1;
2788 uint64_t dma1fi:1;
2789 uint64_t dcnt0:1;
2790 uint64_t dcnt1:1;
2791 uint64_t dtime0:1;
2792 uint64_t dtime1:1;
2793 uint64_t reserved_15_18:4;
2794 uint64_t c0_aeri:1;
2795 uint64_t crs0_er:1;
2796 uint64_t c0_se:1;
2797 uint64_t crs0_dr:1;
2798 uint64_t c0_wake:1;
2799 uint64_t c0_pmei:1;
2800 uint64_t c0_hpint:1;
2801 uint64_t c1_aeri:1;
2802 uint64_t crs1_er:1;
2803 uint64_t c1_se:1;
2804 uint64_t crs1_dr:1;
2805 uint64_t c1_wake:1;
2806 uint64_t c1_pmei:1;
2807 uint64_t c1_hpint:1;
2808 uint64_t c0_up_b0:1;
2809 uint64_t c0_up_b1:1;
2810 uint64_t c0_up_b2:1;
2811 uint64_t c0_up_wi:1;
2812 uint64_t c0_up_bx:1;
2813 uint64_t c0_un_b0:1;
2814 uint64_t c0_un_b1:1;
2815 uint64_t c0_un_b2:1;
2816 uint64_t c0_un_wi:1;
2817 uint64_t c0_un_bx:1;
2818 uint64_t c1_up_b0:1;
2819 uint64_t c1_up_b1:1;
2820 uint64_t c1_up_b2:1;
2821 uint64_t c1_up_wi:1;
2822 uint64_t c1_up_bx:1;
2823 uint64_t c1_un_b0:1;
2824 uint64_t c1_un_b1:1;
2825 uint64_t c1_un_b2:1;
2826 uint64_t c1_un_wi:1;
2827 uint64_t c1_un_bx:1;
2828 uint64_t c0_un_wf:1;
2829 uint64_t c1_un_wf:1;
2830 uint64_t c0_up_wf:1;
2831 uint64_t c1_up_wf:1;
2832 uint64_t c0_exc:1;
2833 uint64_t c1_exc:1;
2834 uint64_t c0_ldwn:1;
2835 uint64_t c1_ldwn:1;
2836 uint64_t int_a:1;
2837 uint64_t reserved_62_62:1;
2838 uint64_t mio_inta:1;
2839#endif
2840 } s;
2841};
2842
2843union cvmx_npei_last_win_rdata0 {
2844 uint64_t u64;
2845 struct cvmx_npei_last_win_rdata0_s {
2846#ifdef __BIG_ENDIAN_BITFIELD
2847 uint64_t data:64;
2848#else
2849 uint64_t data:64;
2850#endif
2851 } s;
2852};
2853
2854union cvmx_npei_last_win_rdata1 {
2855 uint64_t u64;
2856 struct cvmx_npei_last_win_rdata1_s {
2857#ifdef __BIG_ENDIAN_BITFIELD
2858 uint64_t data:64;
2859#else
2860 uint64_t data:64;
2861#endif
2862 } s;
2863};
2864
2865union cvmx_npei_mem_access_ctl {
2866 uint64_t u64;
2867 struct cvmx_npei_mem_access_ctl_s {
2868#ifdef __BIG_ENDIAN_BITFIELD
2869 uint64_t reserved_14_63:50;
2870 uint64_t max_word:4;
2871 uint64_t timer:10;
2872#else
2873 uint64_t timer:10;
2874 uint64_t max_word:4;
2875 uint64_t reserved_14_63:50;
2876#endif
2877 } s;
2878};
2879
2880union cvmx_npei_mem_access_subidx {
2881 uint64_t u64;
2882 struct cvmx_npei_mem_access_subidx_s {
2883#ifdef __BIG_ENDIAN_BITFIELD
2884 uint64_t reserved_42_63:22;
2885 uint64_t zero:1;
2886 uint64_t port:2;
2887 uint64_t nmerge:1;
2888 uint64_t esr:2;
2889 uint64_t esw:2;
2890 uint64_t nsr:1;
2891 uint64_t nsw:1;
2892 uint64_t ror:1;
2893 uint64_t row:1;
2894 uint64_t ba:30;
2895#else
2896 uint64_t ba:30;
2897 uint64_t row:1;
2898 uint64_t ror:1;
2899 uint64_t nsw:1;
2900 uint64_t nsr:1;
2901 uint64_t esw:2;
2902 uint64_t esr:2;
2903 uint64_t nmerge:1;
2904 uint64_t port:2;
2905 uint64_t zero:1;
2906 uint64_t reserved_42_63:22;
2907#endif
2908 } s;
2909};
2910
2911union cvmx_npei_msi_enb0 {
2912 uint64_t u64;
2913 struct cvmx_npei_msi_enb0_s {
2914#ifdef __BIG_ENDIAN_BITFIELD
2915 uint64_t enb:64;
2916#else
2917 uint64_t enb:64;
2918#endif
2919 } s;
2920};
2921
2922union cvmx_npei_msi_enb1 {
2923 uint64_t u64;
2924 struct cvmx_npei_msi_enb1_s {
2925#ifdef __BIG_ENDIAN_BITFIELD
2926 uint64_t enb:64;
2927#else
2928 uint64_t enb:64;
2929#endif
2930 } s;
2931};
2932
2933union cvmx_npei_msi_enb2 {
2934 uint64_t u64;
2935 struct cvmx_npei_msi_enb2_s {
2936#ifdef __BIG_ENDIAN_BITFIELD
2937 uint64_t enb:64;
2938#else
2939 uint64_t enb:64;
2940#endif
2941 } s;
2942};
2943
2944union cvmx_npei_msi_enb3 {
2945 uint64_t u64;
2946 struct cvmx_npei_msi_enb3_s {
2947#ifdef __BIG_ENDIAN_BITFIELD
2948 uint64_t enb:64;
2949#else
2950 uint64_t enb:64;
2951#endif
2952 } s;
2953};
2954
2955union cvmx_npei_msi_rcv0 {
2956 uint64_t u64;
2957 struct cvmx_npei_msi_rcv0_s {
2958#ifdef __BIG_ENDIAN_BITFIELD
2959 uint64_t intr:64;
2960#else
2961 uint64_t intr:64;
2962#endif
2963 } s;
2964};
2965
2966union cvmx_npei_msi_rcv1 {
2967 uint64_t u64;
2968 struct cvmx_npei_msi_rcv1_s {
2969#ifdef __BIG_ENDIAN_BITFIELD
2970 uint64_t intr:64;
2971#else
2972 uint64_t intr:64;
2973#endif
2974 } s;
2975};
2976
2977union cvmx_npei_msi_rcv2 {
2978 uint64_t u64;
2979 struct cvmx_npei_msi_rcv2_s {
2980#ifdef __BIG_ENDIAN_BITFIELD
2981 uint64_t intr:64;
2982#else
2983 uint64_t intr:64;
2984#endif
2985 } s;
2986};
2987
2988union cvmx_npei_msi_rcv3 {
2989 uint64_t u64;
2990 struct cvmx_npei_msi_rcv3_s {
2991#ifdef __BIG_ENDIAN_BITFIELD
2992 uint64_t intr:64;
2993#else
2994 uint64_t intr:64;
2995#endif
2996 } s;
2997};
2998
2999union cvmx_npei_msi_rd_map {
3000 uint64_t u64;
3001 struct cvmx_npei_msi_rd_map_s {
3002#ifdef __BIG_ENDIAN_BITFIELD
3003 uint64_t reserved_16_63:48;
3004 uint64_t rd_int:8;
3005 uint64_t msi_int:8;
3006#else
3007 uint64_t msi_int:8;
3008 uint64_t rd_int:8;
3009 uint64_t reserved_16_63:48;
3010#endif
3011 } s;
3012};
3013
3014union cvmx_npei_msi_w1c_enb0 {
3015 uint64_t u64;
3016 struct cvmx_npei_msi_w1c_enb0_s {
3017#ifdef __BIG_ENDIAN_BITFIELD
3018 uint64_t clr:64;
3019#else
3020 uint64_t clr:64;
3021#endif
3022 } s;
3023};
3024
3025union cvmx_npei_msi_w1c_enb1 {
3026 uint64_t u64;
3027 struct cvmx_npei_msi_w1c_enb1_s {
3028#ifdef __BIG_ENDIAN_BITFIELD
3029 uint64_t clr:64;
3030#else
3031 uint64_t clr:64;
3032#endif
3033 } s;
3034};
3035
3036union cvmx_npei_msi_w1c_enb2 {
3037 uint64_t u64;
3038 struct cvmx_npei_msi_w1c_enb2_s {
3039#ifdef __BIG_ENDIAN_BITFIELD
3040 uint64_t clr:64;
3041#else
3042 uint64_t clr:64;
3043#endif
3044 } s;
3045};
3046
3047union cvmx_npei_msi_w1c_enb3 {
3048 uint64_t u64;
3049 struct cvmx_npei_msi_w1c_enb3_s {
3050#ifdef __BIG_ENDIAN_BITFIELD
3051 uint64_t clr:64;
3052#else
3053 uint64_t clr:64;
3054#endif
3055 } s;
3056};
3057
3058union cvmx_npei_msi_w1s_enb0 {
3059 uint64_t u64;
3060 struct cvmx_npei_msi_w1s_enb0_s {
3061#ifdef __BIG_ENDIAN_BITFIELD
3062 uint64_t set:64;
3063#else
3064 uint64_t set:64;
3065#endif
3066 } s;
3067};
3068
3069union cvmx_npei_msi_w1s_enb1 {
3070 uint64_t u64;
3071 struct cvmx_npei_msi_w1s_enb1_s {
3072#ifdef __BIG_ENDIAN_BITFIELD
3073 uint64_t set:64;
3074#else
3075 uint64_t set:64;
3076#endif
3077 } s;
3078};
3079
3080union cvmx_npei_msi_w1s_enb2 {
3081 uint64_t u64;
3082 struct cvmx_npei_msi_w1s_enb2_s {
3083#ifdef __BIG_ENDIAN_BITFIELD
3084 uint64_t set:64;
3085#else
3086 uint64_t set:64;
3087#endif
3088 } s;
3089};
3090
3091union cvmx_npei_msi_w1s_enb3 {
3092 uint64_t u64;
3093 struct cvmx_npei_msi_w1s_enb3_s {
3094#ifdef __BIG_ENDIAN_BITFIELD
3095 uint64_t set:64;
3096#else
3097 uint64_t set:64;
3098#endif
3099 } s;
3100};
3101
3102union cvmx_npei_msi_wr_map {
3103 uint64_t u64;
3104 struct cvmx_npei_msi_wr_map_s {
3105#ifdef __BIG_ENDIAN_BITFIELD
3106 uint64_t reserved_16_63:48;
3107 uint64_t ciu_int:8;
3108 uint64_t msi_int:8;
3109#else
3110 uint64_t msi_int:8;
3111 uint64_t ciu_int:8;
3112 uint64_t reserved_16_63:48;
3113#endif
3114 } s;
3115};
3116
3117union cvmx_npei_pcie_credit_cnt {
3118 uint64_t u64;
3119 struct cvmx_npei_pcie_credit_cnt_s {
3120#ifdef __BIG_ENDIAN_BITFIELD
3121 uint64_t reserved_48_63:16;
3122 uint64_t p1_ccnt:8;
3123 uint64_t p1_ncnt:8;
3124 uint64_t p1_pcnt:8;
3125 uint64_t p0_ccnt:8;
3126 uint64_t p0_ncnt:8;
3127 uint64_t p0_pcnt:8;
3128#else
3129 uint64_t p0_pcnt:8;
3130 uint64_t p0_ncnt:8;
3131 uint64_t p0_ccnt:8;
3132 uint64_t p1_pcnt:8;
3133 uint64_t p1_ncnt:8;
3134 uint64_t p1_ccnt:8;
3135 uint64_t reserved_48_63:16;
3136#endif
3137 } s;
3138};
3139
3140union cvmx_npei_pcie_msi_rcv {
3141 uint64_t u64;
3142 struct cvmx_npei_pcie_msi_rcv_s {
3143#ifdef __BIG_ENDIAN_BITFIELD
3144 uint64_t reserved_8_63:56;
3145 uint64_t intr:8;
3146#else
3147 uint64_t intr:8;
3148 uint64_t reserved_8_63:56;
3149#endif
3150 } s;
3151};
3152
3153union cvmx_npei_pcie_msi_rcv_b1 {
3154 uint64_t u64;
3155 struct cvmx_npei_pcie_msi_rcv_b1_s {
3156#ifdef __BIG_ENDIAN_BITFIELD
3157 uint64_t reserved_16_63:48;
3158 uint64_t intr:8;
3159 uint64_t reserved_0_7:8;
3160#else
3161 uint64_t reserved_0_7:8;
3162 uint64_t intr:8;
3163 uint64_t reserved_16_63:48;
3164#endif
3165 } s;
3166};
3167
3168union cvmx_npei_pcie_msi_rcv_b2 {
3169 uint64_t u64;
3170 struct cvmx_npei_pcie_msi_rcv_b2_s {
3171#ifdef __BIG_ENDIAN_BITFIELD
3172 uint64_t reserved_24_63:40;
3173 uint64_t intr:8;
3174 uint64_t reserved_0_15:16;
3175#else
3176 uint64_t reserved_0_15:16;
3177 uint64_t intr:8;
3178 uint64_t reserved_24_63:40;
3179#endif
3180 } s;
3181};
3182
3183union cvmx_npei_pcie_msi_rcv_b3 {
3184 uint64_t u64;
3185 struct cvmx_npei_pcie_msi_rcv_b3_s {
3186#ifdef __BIG_ENDIAN_BITFIELD
3187 uint64_t reserved_32_63:32;
3188 uint64_t intr:8;
3189 uint64_t reserved_0_23:24;
3190#else
3191 uint64_t reserved_0_23:24;
3192 uint64_t intr:8;
3193 uint64_t reserved_32_63:32;
3194#endif
3195 } s;
3196};
3197
3198union cvmx_npei_pktx_cnts {
3199 uint64_t u64;
3200 struct cvmx_npei_pktx_cnts_s {
3201#ifdef __BIG_ENDIAN_BITFIELD
3202 uint64_t reserved_54_63:10;
3203 uint64_t timer:22;
3204 uint64_t cnt:32;
3205#else
3206 uint64_t cnt:32;
3207 uint64_t timer:22;
3208 uint64_t reserved_54_63:10;
3209#endif
3210 } s;
3211};
3212
3213union cvmx_npei_pktx_in_bp {
3214 uint64_t u64;
3215 struct cvmx_npei_pktx_in_bp_s {
3216#ifdef __BIG_ENDIAN_BITFIELD
3217 uint64_t wmark:32;
3218 uint64_t cnt:32;
3219#else
3220 uint64_t cnt:32;
3221 uint64_t wmark:32;
3222#endif
3223 } s;
3224};
3225
3226union cvmx_npei_pktx_instr_baddr {
3227 uint64_t u64;
3228 struct cvmx_npei_pktx_instr_baddr_s {
3229#ifdef __BIG_ENDIAN_BITFIELD
3230 uint64_t addr:61;
3231 uint64_t reserved_0_2:3;
3232#else
3233 uint64_t reserved_0_2:3;
3234 uint64_t addr:61;
3235#endif
3236 } s;
3237};
3238
3239union cvmx_npei_pktx_instr_baoff_dbell {
3240 uint64_t u64;
3241 struct cvmx_npei_pktx_instr_baoff_dbell_s {
3242#ifdef __BIG_ENDIAN_BITFIELD
3243 uint64_t aoff:32;
3244 uint64_t dbell:32;
3245#else
3246 uint64_t dbell:32;
3247 uint64_t aoff:32;
3248#endif
3249 } s;
3250};
3251
3252union cvmx_npei_pktx_instr_fifo_rsize {
3253 uint64_t u64;
3254 struct cvmx_npei_pktx_instr_fifo_rsize_s {
3255#ifdef __BIG_ENDIAN_BITFIELD
3256 uint64_t max:9;
3257 uint64_t rrp:9;
3258 uint64_t wrp:9;
3259 uint64_t fcnt:5;
3260 uint64_t rsize:32;
3261#else
3262 uint64_t rsize:32;
3263 uint64_t fcnt:5;
3264 uint64_t wrp:9;
3265 uint64_t rrp:9;
3266 uint64_t max:9;
3267#endif
3268 } s;
3269};
3270
3271union cvmx_npei_pktx_instr_header {
3272 uint64_t u64;
3273 struct cvmx_npei_pktx_instr_header_s {
3274#ifdef __BIG_ENDIAN_BITFIELD
3275 uint64_t reserved_44_63:20;
3276 uint64_t pbp:1;
3277 uint64_t reserved_38_42:5;
3278 uint64_t rparmode:2;
3279 uint64_t reserved_35_35:1;
3280 uint64_t rskp_len:7;
3281 uint64_t reserved_22_27:6;
3282 uint64_t use_ihdr:1;
3283 uint64_t reserved_16_20:5;
3284 uint64_t par_mode:2;
3285 uint64_t reserved_13_13:1;
3286 uint64_t skp_len:7;
3287 uint64_t reserved_0_5:6;
3288#else
3289 uint64_t reserved_0_5:6;
3290 uint64_t skp_len:7;
3291 uint64_t reserved_13_13:1;
3292 uint64_t par_mode:2;
3293 uint64_t reserved_16_20:5;
3294 uint64_t use_ihdr:1;
3295 uint64_t reserved_22_27:6;
3296 uint64_t rskp_len:7;
3297 uint64_t reserved_35_35:1;
3298 uint64_t rparmode:2;
3299 uint64_t reserved_38_42:5;
3300 uint64_t pbp:1;
3301 uint64_t reserved_44_63:20;
3302#endif
3303 } s;
3304};
3305
3306union cvmx_npei_pktx_slist_baddr {
3307 uint64_t u64;
3308 struct cvmx_npei_pktx_slist_baddr_s {
3309#ifdef __BIG_ENDIAN_BITFIELD
3310 uint64_t addr:60;
3311 uint64_t reserved_0_3:4;
3312#else
3313 uint64_t reserved_0_3:4;
3314 uint64_t addr:60;
3315#endif
3316 } s;
3317};
3318
3319union cvmx_npei_pktx_slist_baoff_dbell {
3320 uint64_t u64;
3321 struct cvmx_npei_pktx_slist_baoff_dbell_s {
3322#ifdef __BIG_ENDIAN_BITFIELD
3323 uint64_t aoff:32;
3324 uint64_t dbell:32;
3325#else
3326 uint64_t dbell:32;
3327 uint64_t aoff:32;
3328#endif
3329 } s;
3330};
3331
3332union cvmx_npei_pktx_slist_fifo_rsize {
3333 uint64_t u64;
3334 struct cvmx_npei_pktx_slist_fifo_rsize_s {
3335#ifdef __BIG_ENDIAN_BITFIELD
3336 uint64_t reserved_32_63:32;
3337 uint64_t rsize:32;
3338#else
3339 uint64_t rsize:32;
3340 uint64_t reserved_32_63:32;
3341#endif
3342 } s;
3343};
3344
3345union cvmx_npei_pkt_cnt_int {
3346 uint64_t u64;
3347 struct cvmx_npei_pkt_cnt_int_s {
3348#ifdef __BIG_ENDIAN_BITFIELD
3349 uint64_t reserved_32_63:32;
3350 uint64_t port:32;
3351#else
3352 uint64_t port:32;
3353 uint64_t reserved_32_63:32;
3354#endif
3355 } s;
3356};
3357
3358union cvmx_npei_pkt_cnt_int_enb {
3359 uint64_t u64;
3360 struct cvmx_npei_pkt_cnt_int_enb_s {
3361#ifdef __BIG_ENDIAN_BITFIELD
3362 uint64_t reserved_32_63:32;
3363 uint64_t port:32;
3364#else
3365 uint64_t port:32;
3366 uint64_t reserved_32_63:32;
3367#endif
3368 } s;
3369};
3370
3371union cvmx_npei_pkt_data_out_es {
3372 uint64_t u64;
3373 struct cvmx_npei_pkt_data_out_es_s {
3374#ifdef __BIG_ENDIAN_BITFIELD
3375 uint64_t es:64;
3376#else
3377 uint64_t es:64;
3378#endif
3379 } s;
3380};
3381
3382union cvmx_npei_pkt_data_out_ns {
3383 uint64_t u64;
3384 struct cvmx_npei_pkt_data_out_ns_s {
3385#ifdef __BIG_ENDIAN_BITFIELD
3386 uint64_t reserved_32_63:32;
3387 uint64_t nsr:32;
3388#else
3389 uint64_t nsr:32;
3390 uint64_t reserved_32_63:32;
3391#endif
3392 } s;
3393};
3394
3395union cvmx_npei_pkt_data_out_ror {
3396 uint64_t u64;
3397 struct cvmx_npei_pkt_data_out_ror_s {
3398#ifdef __BIG_ENDIAN_BITFIELD
3399 uint64_t reserved_32_63:32;
3400 uint64_t ror:32;
3401#else
3402 uint64_t ror:32;
3403 uint64_t reserved_32_63:32;
3404#endif
3405 } s;
3406};
3407
3408union cvmx_npei_pkt_dpaddr {
3409 uint64_t u64;
3410 struct cvmx_npei_pkt_dpaddr_s {
3411#ifdef __BIG_ENDIAN_BITFIELD
3412 uint64_t reserved_32_63:32;
3413 uint64_t dptr:32;
3414#else
3415 uint64_t dptr:32;
3416 uint64_t reserved_32_63:32;
3417#endif
3418 } s;
3419};
3420
3421union cvmx_npei_pkt_in_bp {
3422 uint64_t u64;
3423 struct cvmx_npei_pkt_in_bp_s {
3424#ifdef __BIG_ENDIAN_BITFIELD
3425 uint64_t reserved_32_63:32;
3426 uint64_t bp:32;
3427#else
3428 uint64_t bp:32;
3429 uint64_t reserved_32_63:32;
3430#endif
3431 } s;
3432};
3433
3434union cvmx_npei_pkt_in_donex_cnts {
3435 uint64_t u64;
3436 struct cvmx_npei_pkt_in_donex_cnts_s {
3437#ifdef __BIG_ENDIAN_BITFIELD
3438 uint64_t reserved_32_63:32;
3439 uint64_t cnt:32;
3440#else
3441 uint64_t cnt:32;
3442 uint64_t reserved_32_63:32;
3443#endif
3444 } s;
3445};
3446
3447union cvmx_npei_pkt_in_instr_counts {
3448 uint64_t u64;
3449 struct cvmx_npei_pkt_in_instr_counts_s {
3450#ifdef __BIG_ENDIAN_BITFIELD
3451 uint64_t wr_cnt:32;
3452 uint64_t rd_cnt:32;
3453#else
3454 uint64_t rd_cnt:32;
3455 uint64_t wr_cnt:32;
3456#endif
3457 } s;
3458};
3459
3460union cvmx_npei_pkt_in_pcie_port {
3461 uint64_t u64;
3462 struct cvmx_npei_pkt_in_pcie_port_s {
3463#ifdef __BIG_ENDIAN_BITFIELD
3464 uint64_t pp:64;
3465#else
3466 uint64_t pp:64;
3467#endif
3468 } s;
3469};
3470
3471union cvmx_npei_pkt_input_control {
3472 uint64_t u64;
3473 struct cvmx_npei_pkt_input_control_s {
3474#ifdef __BIG_ENDIAN_BITFIELD
3475 uint64_t reserved_23_63:41;
3476 uint64_t pkt_rr:1;
3477 uint64_t pbp_dhi:13;
3478 uint64_t d_nsr:1;
3479 uint64_t d_esr:2;
3480 uint64_t d_ror:1;
3481 uint64_t use_csr:1;
3482 uint64_t nsr:1;
3483 uint64_t esr:2;
3484 uint64_t ror:1;
3485#else
3486 uint64_t ror:1;
3487 uint64_t esr:2;
3488 uint64_t nsr:1;
3489 uint64_t use_csr:1;
3490 uint64_t d_ror:1;
3491 uint64_t d_esr:2;
3492 uint64_t d_nsr:1;
3493 uint64_t pbp_dhi:13;
3494 uint64_t pkt_rr:1;
3495 uint64_t reserved_23_63:41;
3496#endif
3497 } s;
3498};
3499
3500union cvmx_npei_pkt_instr_enb {
3501 uint64_t u64;
3502 struct cvmx_npei_pkt_instr_enb_s {
3503#ifdef __BIG_ENDIAN_BITFIELD
3504 uint64_t reserved_32_63:32;
3505 uint64_t enb:32;
3506#else
3507 uint64_t enb:32;
3508 uint64_t reserved_32_63:32;
3509#endif
3510 } s;
3511};
3512
3513union cvmx_npei_pkt_instr_rd_size {
3514 uint64_t u64;
3515 struct cvmx_npei_pkt_instr_rd_size_s {
3516#ifdef __BIG_ENDIAN_BITFIELD
3517 uint64_t rdsize:64;
3518#else
3519 uint64_t rdsize:64;
3520#endif
3521 } s;
3522};
3523
3524union cvmx_npei_pkt_instr_size {
3525 uint64_t u64;
3526 struct cvmx_npei_pkt_instr_size_s {
3527#ifdef __BIG_ENDIAN_BITFIELD
3528 uint64_t reserved_32_63:32;
3529 uint64_t is_64b:32;
3530#else
3531 uint64_t is_64b:32;
3532 uint64_t reserved_32_63:32;
3533#endif
3534 } s;
3535};
3536
3537union cvmx_npei_pkt_int_levels {
3538 uint64_t u64;
3539 struct cvmx_npei_pkt_int_levels_s {
3540#ifdef __BIG_ENDIAN_BITFIELD
3541 uint64_t reserved_54_63:10;
3542 uint64_t time:22;
3543 uint64_t cnt:32;
3544#else
3545 uint64_t cnt:32;
3546 uint64_t time:22;
3547 uint64_t reserved_54_63:10;
3548#endif
3549 } s;
3550};
3551
3552union cvmx_npei_pkt_iptr {
3553 uint64_t u64;
3554 struct cvmx_npei_pkt_iptr_s {
3555#ifdef __BIG_ENDIAN_BITFIELD
3556 uint64_t reserved_32_63:32;
3557 uint64_t iptr:32;
3558#else
3559 uint64_t iptr:32;
3560 uint64_t reserved_32_63:32;
3561#endif
3562 } s;
3563};
3564
3565union cvmx_npei_pkt_out_bmode {
3566 uint64_t u64;
3567 struct cvmx_npei_pkt_out_bmode_s {
3568#ifdef __BIG_ENDIAN_BITFIELD
3569 uint64_t reserved_32_63:32;
3570 uint64_t bmode:32;
3571#else
3572 uint64_t bmode:32;
3573 uint64_t reserved_32_63:32;
3574#endif
3575 } s;
3576};
3577
3578union cvmx_npei_pkt_out_enb {
3579 uint64_t u64;
3580 struct cvmx_npei_pkt_out_enb_s {
3581#ifdef __BIG_ENDIAN_BITFIELD
3582 uint64_t reserved_32_63:32;
3583 uint64_t enb:32;
3584#else
3585 uint64_t enb:32;
3586 uint64_t reserved_32_63:32;
3587#endif
3588 } s;
3589};
3590
3591union cvmx_npei_pkt_output_wmark {
3592 uint64_t u64;
3593 struct cvmx_npei_pkt_output_wmark_s {
3594#ifdef __BIG_ENDIAN_BITFIELD
3595 uint64_t reserved_32_63:32;
3596 uint64_t wmark:32;
3597#else
3598 uint64_t wmark:32;
3599 uint64_t reserved_32_63:32;
3600#endif
3601 } s;
3602};
3603
3604union cvmx_npei_pkt_pcie_port {
3605 uint64_t u64;
3606 struct cvmx_npei_pkt_pcie_port_s {
3607#ifdef __BIG_ENDIAN_BITFIELD
3608 uint64_t pp:64;
3609#else
3610 uint64_t pp:64;
3611#endif
3612 } s;
3613};
3614
3615union cvmx_npei_pkt_port_in_rst {
3616 uint64_t u64;
3617 struct cvmx_npei_pkt_port_in_rst_s {
3618#ifdef __BIG_ENDIAN_BITFIELD
3619 uint64_t in_rst:32;
3620 uint64_t out_rst:32;
3621#else
3622 uint64_t out_rst:32;
3623 uint64_t in_rst:32;
3624#endif
3625 } s;
3626};
3627
3628union cvmx_npei_pkt_slist_es {
3629 uint64_t u64;
3630 struct cvmx_npei_pkt_slist_es_s {
3631#ifdef __BIG_ENDIAN_BITFIELD
3632 uint64_t es:64;
3633#else
3634 uint64_t es:64;
3635#endif
3636 } s;
3637};
3638
3639union cvmx_npei_pkt_slist_id_size {
3640 uint64_t u64;
3641 struct cvmx_npei_pkt_slist_id_size_s {
3642#ifdef __BIG_ENDIAN_BITFIELD
3643 uint64_t reserved_23_63:41;
3644 uint64_t isize:7;
3645 uint64_t bsize:16;
3646#else
3647 uint64_t bsize:16;
3648 uint64_t isize:7;
3649 uint64_t reserved_23_63:41;
3650#endif
3651 } s;
3652};
3653
3654union cvmx_npei_pkt_slist_ns {
3655 uint64_t u64;
3656 struct cvmx_npei_pkt_slist_ns_s {
3657#ifdef __BIG_ENDIAN_BITFIELD
3658 uint64_t reserved_32_63:32;
3659 uint64_t nsr:32;
3660#else
3661 uint64_t nsr:32;
3662 uint64_t reserved_32_63:32;
3663#endif
3664 } s;
3665};
3666
3667union cvmx_npei_pkt_slist_ror {
3668 uint64_t u64;
3669 struct cvmx_npei_pkt_slist_ror_s {
3670#ifdef __BIG_ENDIAN_BITFIELD
3671 uint64_t reserved_32_63:32;
3672 uint64_t ror:32;
3673#else
3674 uint64_t ror:32;
3675 uint64_t reserved_32_63:32;
3676#endif
3677 } s;
3678};
3679
3680union cvmx_npei_pkt_time_int {
3681 uint64_t u64;
3682 struct cvmx_npei_pkt_time_int_s {
3683#ifdef __BIG_ENDIAN_BITFIELD
3684 uint64_t reserved_32_63:32;
3685 uint64_t port:32;
3686#else
3687 uint64_t port:32;
3688 uint64_t reserved_32_63:32;
3689#endif
3690 } s;
3691};
3692
3693union cvmx_npei_pkt_time_int_enb {
3694 uint64_t u64;
3695 struct cvmx_npei_pkt_time_int_enb_s {
3696#ifdef __BIG_ENDIAN_BITFIELD
3697 uint64_t reserved_32_63:32;
3698 uint64_t port:32;
3699#else
3700 uint64_t port:32;
3701 uint64_t reserved_32_63:32;
3702#endif
3703 } s;
3704};
3705
3706union cvmx_npei_rsl_int_blocks {
3707 uint64_t u64;
3708 struct cvmx_npei_rsl_int_blocks_s {
3709#ifdef __BIG_ENDIAN_BITFIELD
3710 uint64_t reserved_31_63:33;
3711 uint64_t iob:1;
3712 uint64_t lmc1:1;
3713 uint64_t agl:1;
3714 uint64_t reserved_24_27:4;
3715 uint64_t asxpcs1:1;
3716 uint64_t asxpcs0:1;
3717 uint64_t reserved_21_21:1;
3718 uint64_t pip:1;
3719 uint64_t spx1:1;
3720 uint64_t spx0:1;
3721 uint64_t lmc0:1;
3722 uint64_t l2c:1;
3723 uint64_t usb1:1;
3724 uint64_t rad:1;
3725 uint64_t usb:1;
3726 uint64_t pow:1;
3727 uint64_t tim:1;
3728 uint64_t pko:1;
3729 uint64_t ipd:1;
3730 uint64_t reserved_8_8:1;
3731 uint64_t zip:1;
3732 uint64_t dfa:1;
3733 uint64_t fpa:1;
3734 uint64_t key:1;
3735 uint64_t npei:1;
3736 uint64_t gmx1:1;
3737 uint64_t gmx0:1;
3738 uint64_t mio:1;
3739#else
3740 uint64_t mio:1;
3741 uint64_t gmx0:1;
3742 uint64_t gmx1:1;
3743 uint64_t npei:1;
3744 uint64_t key:1;
3745 uint64_t fpa:1;
3746 uint64_t dfa:1;
3747 uint64_t zip:1;
3748 uint64_t reserved_8_8:1;
3749 uint64_t ipd:1;
3750 uint64_t pko:1;
3751 uint64_t tim:1;
3752 uint64_t pow:1;
3753 uint64_t usb:1;
3754 uint64_t rad:1;
3755 uint64_t usb1:1;
3756 uint64_t l2c:1;
3757 uint64_t lmc0:1;
3758 uint64_t spx0:1;
3759 uint64_t spx1:1;
3760 uint64_t pip:1;
3761 uint64_t reserved_21_21:1;
3762 uint64_t asxpcs0:1;
3763 uint64_t asxpcs1:1;
3764 uint64_t reserved_24_27:4;
3765 uint64_t agl:1;
3766 uint64_t lmc1:1;
3767 uint64_t iob:1;
3768 uint64_t reserved_31_63:33;
3769#endif
3770 } s;
3771};
3772
3773union cvmx_npei_scratch_1 {
3774 uint64_t u64;
3775 struct cvmx_npei_scratch_1_s {
3776#ifdef __BIG_ENDIAN_BITFIELD
3777 uint64_t data:64;
3778#else
3779 uint64_t data:64;
3780#endif
3781 } s;
3782};
3783
3784union cvmx_npei_state1 {
3785 uint64_t u64;
3786 struct cvmx_npei_state1_s {
3787#ifdef __BIG_ENDIAN_BITFIELD
3788 uint64_t cpl1:12;
3789 uint64_t cpl0:12;
3790 uint64_t arb:1;
3791 uint64_t csr:39;
3792#else
3793 uint64_t csr:39;
3794 uint64_t arb:1;
3795 uint64_t cpl0:12;
3796 uint64_t cpl1:12;
3797#endif
3798 } s;
3799};
3800
3801union cvmx_npei_state2 {
3802 uint64_t u64;
3803 struct cvmx_npei_state2_s {
3804#ifdef __BIG_ENDIAN_BITFIELD
3805 uint64_t reserved_48_63:16;
3806 uint64_t npei:1;
3807 uint64_t rac:1;
3808 uint64_t csm1:15;
3809 uint64_t csm0:15;
3810 uint64_t nnp0:8;
3811 uint64_t nnd:8;
3812#else
3813 uint64_t nnd:8;
3814 uint64_t nnp0:8;
3815 uint64_t csm0:15;
3816 uint64_t csm1:15;
3817 uint64_t rac:1;
3818 uint64_t npei:1;
3819 uint64_t reserved_48_63:16;
3820#endif
3821 } s;
3822};
3823
3824union cvmx_npei_state3 {
3825 uint64_t u64;
3826 struct cvmx_npei_state3_s {
3827#ifdef __BIG_ENDIAN_BITFIELD
3828 uint64_t reserved_56_63:8;
3829 uint64_t psm1:15;
3830 uint64_t psm0:15;
3831 uint64_t nsm1:13;
3832 uint64_t nsm0:13;
3833#else
3834 uint64_t nsm0:13;
3835 uint64_t nsm1:13;
3836 uint64_t psm0:15;
3837 uint64_t psm1:15;
3838 uint64_t reserved_56_63:8;
3839#endif
3840 } s;
3841};
3842
3843union cvmx_npei_win_rd_addr {
3844 uint64_t u64;
3845 struct cvmx_npei_win_rd_addr_s {
3846#ifdef __BIG_ENDIAN_BITFIELD
3847 uint64_t reserved_51_63:13;
3848 uint64_t ld_cmd:2;
3849 uint64_t iobit:1;
3850 uint64_t rd_addr:48;
3851#else
3852 uint64_t rd_addr:48;
3853 uint64_t iobit:1;
3854 uint64_t ld_cmd:2;
3855 uint64_t reserved_51_63:13;
3856#endif
3857 } s;
3858};
3859
3860union cvmx_npei_win_rd_data {
3861 uint64_t u64;
3862 struct cvmx_npei_win_rd_data_s {
3863#ifdef __BIG_ENDIAN_BITFIELD
3864 uint64_t rd_data:64;
3865#else
3866 uint64_t rd_data:64;
3867#endif
3868 } s;
3869};
3870
3871union cvmx_npei_win_wr_addr {
3872 uint64_t u64;
3873 struct cvmx_npei_win_wr_addr_s {
3874#ifdef __BIG_ENDIAN_BITFIELD
3875 uint64_t reserved_49_63:15;
3876 uint64_t iobit:1;
3877 uint64_t wr_addr:46;
3878 uint64_t reserved_0_1:2;
3879#else
3880 uint64_t reserved_0_1:2;
3881 uint64_t wr_addr:46;
3882 uint64_t iobit:1;
3883 uint64_t reserved_49_63:15;
3884#endif
3885 } s;
3886};
3887
3888union cvmx_npei_win_wr_data {
3889 uint64_t u64;
3890 struct cvmx_npei_win_wr_data_s {
3891#ifdef __BIG_ENDIAN_BITFIELD
3892 uint64_t wr_data:64;
3893#else
3894 uint64_t wr_data:64;
3895#endif
3896 } s;
3897};
3898
3899union cvmx_npei_win_wr_mask {
3900 uint64_t u64;
3901 struct cvmx_npei_win_wr_mask_s {
3902#ifdef __BIG_ENDIAN_BITFIELD
3903 uint64_t reserved_8_63:56;
3904 uint64_t wr_mask:8;
3905#else
3906 uint64_t wr_mask:8;
3907 uint64_t reserved_8_63:56;
3908#endif
3909 } s;
3910};
3911
3912union cvmx_npei_window_ctl {
3913 uint64_t u64;
3914 struct cvmx_npei_window_ctl_s {
3915#ifdef __BIG_ENDIAN_BITFIELD
3916 uint64_t reserved_32_63:32;
3917 uint64_t time:32;
3918#else
3919 uint64_t time:32;
3920 uint64_t reserved_32_63:32;
3921#endif
3922 } s;
3923};
3924
3925#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-npi-defs.h b/arch/mips/include/asm/octeon/cvmx-npi-defs.h
new file mode 100644
index 000000000..ba4967fda
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-npi-defs.h
@@ -0,0 +1,2514 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_NPI_DEFS_H__
29#define __CVMX_NPI_DEFS_H__
30
31#define CVMX_NPI_BASE_ADDR_INPUT0 CVMX_NPI_BASE_ADDR_INPUTX(0)
32#define CVMX_NPI_BASE_ADDR_INPUT1 CVMX_NPI_BASE_ADDR_INPUTX(1)
33#define CVMX_NPI_BASE_ADDR_INPUT2 CVMX_NPI_BASE_ADDR_INPUTX(2)
34#define CVMX_NPI_BASE_ADDR_INPUT3 CVMX_NPI_BASE_ADDR_INPUTX(3)
35#define CVMX_NPI_BASE_ADDR_INPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000000070ull) + ((offset) & 3) * 16)
36#define CVMX_NPI_BASE_ADDR_OUTPUT0 CVMX_NPI_BASE_ADDR_OUTPUTX(0)
37#define CVMX_NPI_BASE_ADDR_OUTPUT1 CVMX_NPI_BASE_ADDR_OUTPUTX(1)
38#define CVMX_NPI_BASE_ADDR_OUTPUT2 CVMX_NPI_BASE_ADDR_OUTPUTX(2)
39#define CVMX_NPI_BASE_ADDR_OUTPUT3 CVMX_NPI_BASE_ADDR_OUTPUTX(3)
40#define CVMX_NPI_BASE_ADDR_OUTPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F00000000B8ull) + ((offset) & 3) * 8)
41#define CVMX_NPI_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011F00000003F8ull))
42#define CVMX_NPI_BUFF_SIZE_OUTPUT0 CVMX_NPI_BUFF_SIZE_OUTPUTX(0)
43#define CVMX_NPI_BUFF_SIZE_OUTPUT1 CVMX_NPI_BUFF_SIZE_OUTPUTX(1)
44#define CVMX_NPI_BUFF_SIZE_OUTPUT2 CVMX_NPI_BUFF_SIZE_OUTPUTX(2)
45#define CVMX_NPI_BUFF_SIZE_OUTPUT3 CVMX_NPI_BUFF_SIZE_OUTPUTX(3)
46#define CVMX_NPI_BUFF_SIZE_OUTPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F00000000E0ull) + ((offset) & 3) * 8)
47#define CVMX_NPI_COMP_CTL (CVMX_ADD_IO_SEG(0x00011F0000000218ull))
48#define CVMX_NPI_CTL_STATUS (CVMX_ADD_IO_SEG(0x00011F0000000010ull))
49#define CVMX_NPI_DBG_SELECT (CVMX_ADD_IO_SEG(0x00011F0000000008ull))
50#define CVMX_NPI_DMA_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000000128ull))
51#define CVMX_NPI_DMA_HIGHP_COUNTS (CVMX_ADD_IO_SEG(0x00011F0000000148ull))
52#define CVMX_NPI_DMA_HIGHP_NADDR (CVMX_ADD_IO_SEG(0x00011F0000000158ull))
53#define CVMX_NPI_DMA_LOWP_COUNTS (CVMX_ADD_IO_SEG(0x00011F0000000140ull))
54#define CVMX_NPI_DMA_LOWP_NADDR (CVMX_ADD_IO_SEG(0x00011F0000000150ull))
55#define CVMX_NPI_HIGHP_DBELL (CVMX_ADD_IO_SEG(0x00011F0000000120ull))
56#define CVMX_NPI_HIGHP_IBUFF_SADDR (CVMX_ADD_IO_SEG(0x00011F0000000110ull))
57#define CVMX_NPI_INPUT_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000000138ull))
58#define CVMX_NPI_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000000020ull))
59#define CVMX_NPI_INT_SUM (CVMX_ADD_IO_SEG(0x00011F0000000018ull))
60#define CVMX_NPI_LOWP_DBELL (CVMX_ADD_IO_SEG(0x00011F0000000118ull))
61#define CVMX_NPI_LOWP_IBUFF_SADDR (CVMX_ADD_IO_SEG(0x00011F0000000108ull))
62#define CVMX_NPI_MEM_ACCESS_SUBID3 CVMX_NPI_MEM_ACCESS_SUBIDX(3)
63#define CVMX_NPI_MEM_ACCESS_SUBID4 CVMX_NPI_MEM_ACCESS_SUBIDX(4)
64#define CVMX_NPI_MEM_ACCESS_SUBID5 CVMX_NPI_MEM_ACCESS_SUBIDX(5)
65#define CVMX_NPI_MEM_ACCESS_SUBID6 CVMX_NPI_MEM_ACCESS_SUBIDX(6)
66#define CVMX_NPI_MEM_ACCESS_SUBIDX(offset) (CVMX_ADD_IO_SEG(0x00011F0000000028ull) + ((offset) & 7) * 8 - 8*3)
67#define CVMX_NPI_MSI_RCV (0x0000000000000190ull)
68#define CVMX_NPI_NPI_MSI_RCV (CVMX_ADD_IO_SEG(0x00011F0000001190ull))
69#define CVMX_NPI_NUM_DESC_OUTPUT0 CVMX_NPI_NUM_DESC_OUTPUTX(0)
70#define CVMX_NPI_NUM_DESC_OUTPUT1 CVMX_NPI_NUM_DESC_OUTPUTX(1)
71#define CVMX_NPI_NUM_DESC_OUTPUT2 CVMX_NPI_NUM_DESC_OUTPUTX(2)
72#define CVMX_NPI_NUM_DESC_OUTPUT3 CVMX_NPI_NUM_DESC_OUTPUTX(3)
73#define CVMX_NPI_NUM_DESC_OUTPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000000050ull) + ((offset) & 3) * 8)
74#define CVMX_NPI_OUTPUT_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000000100ull))
75#define CVMX_NPI_P0_DBPAIR_ADDR CVMX_NPI_PX_DBPAIR_ADDR(0)
76#define CVMX_NPI_P0_INSTR_ADDR CVMX_NPI_PX_INSTR_ADDR(0)
77#define CVMX_NPI_P0_INSTR_CNTS CVMX_NPI_PX_INSTR_CNTS(0)
78#define CVMX_NPI_P0_PAIR_CNTS CVMX_NPI_PX_PAIR_CNTS(0)
79#define CVMX_NPI_P1_DBPAIR_ADDR CVMX_NPI_PX_DBPAIR_ADDR(1)
80#define CVMX_NPI_P1_INSTR_ADDR CVMX_NPI_PX_INSTR_ADDR(1)
81#define CVMX_NPI_P1_INSTR_CNTS CVMX_NPI_PX_INSTR_CNTS(1)
82#define CVMX_NPI_P1_PAIR_CNTS CVMX_NPI_PX_PAIR_CNTS(1)
83#define CVMX_NPI_P2_DBPAIR_ADDR CVMX_NPI_PX_DBPAIR_ADDR(2)
84#define CVMX_NPI_P2_INSTR_ADDR CVMX_NPI_PX_INSTR_ADDR(2)
85#define CVMX_NPI_P2_INSTR_CNTS CVMX_NPI_PX_INSTR_CNTS(2)
86#define CVMX_NPI_P2_PAIR_CNTS CVMX_NPI_PX_PAIR_CNTS(2)
87#define CVMX_NPI_P3_DBPAIR_ADDR CVMX_NPI_PX_DBPAIR_ADDR(3)
88#define CVMX_NPI_P3_INSTR_ADDR CVMX_NPI_PX_INSTR_ADDR(3)
89#define CVMX_NPI_P3_INSTR_CNTS CVMX_NPI_PX_INSTR_CNTS(3)
90#define CVMX_NPI_P3_PAIR_CNTS CVMX_NPI_PX_PAIR_CNTS(3)
91#define CVMX_NPI_PCI_BAR1_INDEXX(offset) (CVMX_ADD_IO_SEG(0x00011F0000001100ull) + ((offset) & 31) * 4)
92#define CVMX_NPI_PCI_BIST_REG (CVMX_ADD_IO_SEG(0x00011F00000011C0ull))
93#define CVMX_NPI_PCI_BURST_SIZE (CVMX_ADD_IO_SEG(0x00011F00000000D8ull))
94#define CVMX_NPI_PCI_CFG00 (CVMX_ADD_IO_SEG(0x00011F0000001800ull))
95#define CVMX_NPI_PCI_CFG01 (CVMX_ADD_IO_SEG(0x00011F0000001804ull))
96#define CVMX_NPI_PCI_CFG02 (CVMX_ADD_IO_SEG(0x00011F0000001808ull))
97#define CVMX_NPI_PCI_CFG03 (CVMX_ADD_IO_SEG(0x00011F000000180Cull))
98#define CVMX_NPI_PCI_CFG04 (CVMX_ADD_IO_SEG(0x00011F0000001810ull))
99#define CVMX_NPI_PCI_CFG05 (CVMX_ADD_IO_SEG(0x00011F0000001814ull))
100#define CVMX_NPI_PCI_CFG06 (CVMX_ADD_IO_SEG(0x00011F0000001818ull))
101#define CVMX_NPI_PCI_CFG07 (CVMX_ADD_IO_SEG(0x00011F000000181Cull))
102#define CVMX_NPI_PCI_CFG08 (CVMX_ADD_IO_SEG(0x00011F0000001820ull))
103#define CVMX_NPI_PCI_CFG09 (CVMX_ADD_IO_SEG(0x00011F0000001824ull))
104#define CVMX_NPI_PCI_CFG10 (CVMX_ADD_IO_SEG(0x00011F0000001828ull))
105#define CVMX_NPI_PCI_CFG11 (CVMX_ADD_IO_SEG(0x00011F000000182Cull))
106#define CVMX_NPI_PCI_CFG12 (CVMX_ADD_IO_SEG(0x00011F0000001830ull))
107#define CVMX_NPI_PCI_CFG13 (CVMX_ADD_IO_SEG(0x00011F0000001834ull))
108#define CVMX_NPI_PCI_CFG15 (CVMX_ADD_IO_SEG(0x00011F000000183Cull))
109#define CVMX_NPI_PCI_CFG16 (CVMX_ADD_IO_SEG(0x00011F0000001840ull))
110#define CVMX_NPI_PCI_CFG17 (CVMX_ADD_IO_SEG(0x00011F0000001844ull))
111#define CVMX_NPI_PCI_CFG18 (CVMX_ADD_IO_SEG(0x00011F0000001848ull))
112#define CVMX_NPI_PCI_CFG19 (CVMX_ADD_IO_SEG(0x00011F000000184Cull))
113#define CVMX_NPI_PCI_CFG20 (CVMX_ADD_IO_SEG(0x00011F0000001850ull))
114#define CVMX_NPI_PCI_CFG21 (CVMX_ADD_IO_SEG(0x00011F0000001854ull))
115#define CVMX_NPI_PCI_CFG22 (CVMX_ADD_IO_SEG(0x00011F0000001858ull))
116#define CVMX_NPI_PCI_CFG56 (CVMX_ADD_IO_SEG(0x00011F00000018E0ull))
117#define CVMX_NPI_PCI_CFG57 (CVMX_ADD_IO_SEG(0x00011F00000018E4ull))
118#define CVMX_NPI_PCI_CFG58 (CVMX_ADD_IO_SEG(0x00011F00000018E8ull))
119#define CVMX_NPI_PCI_CFG59 (CVMX_ADD_IO_SEG(0x00011F00000018ECull))
120#define CVMX_NPI_PCI_CFG60 (CVMX_ADD_IO_SEG(0x00011F00000018F0ull))
121#define CVMX_NPI_PCI_CFG61 (CVMX_ADD_IO_SEG(0x00011F00000018F4ull))
122#define CVMX_NPI_PCI_CFG62 (CVMX_ADD_IO_SEG(0x00011F00000018F8ull))
123#define CVMX_NPI_PCI_CFG63 (CVMX_ADD_IO_SEG(0x00011F00000018FCull))
124#define CVMX_NPI_PCI_CNT_REG (CVMX_ADD_IO_SEG(0x00011F00000011B8ull))
125#define CVMX_NPI_PCI_CTL_STATUS_2 (CVMX_ADD_IO_SEG(0x00011F000000118Cull))
126#define CVMX_NPI_PCI_INT_ARB_CFG (CVMX_ADD_IO_SEG(0x00011F0000000130ull))
127#define CVMX_NPI_PCI_INT_ENB2 (CVMX_ADD_IO_SEG(0x00011F00000011A0ull))
128#define CVMX_NPI_PCI_INT_SUM2 (CVMX_ADD_IO_SEG(0x00011F0000001198ull))
129#define CVMX_NPI_PCI_READ_CMD (CVMX_ADD_IO_SEG(0x00011F0000000048ull))
130#define CVMX_NPI_PCI_READ_CMD_6 (CVMX_ADD_IO_SEG(0x00011F0000001180ull))
131#define CVMX_NPI_PCI_READ_CMD_C (CVMX_ADD_IO_SEG(0x00011F0000001184ull))
132#define CVMX_NPI_PCI_READ_CMD_E (CVMX_ADD_IO_SEG(0x00011F0000001188ull))
133#define CVMX_NPI_PCI_SCM_REG (CVMX_ADD_IO_SEG(0x00011F00000011A8ull))
134#define CVMX_NPI_PCI_TSR_REG (CVMX_ADD_IO_SEG(0x00011F00000011B0ull))
135#define CVMX_NPI_PORT32_INSTR_HDR (CVMX_ADD_IO_SEG(0x00011F00000001F8ull))
136#define CVMX_NPI_PORT33_INSTR_HDR (CVMX_ADD_IO_SEG(0x00011F0000000200ull))
137#define CVMX_NPI_PORT34_INSTR_HDR (CVMX_ADD_IO_SEG(0x00011F0000000208ull))
138#define CVMX_NPI_PORT35_INSTR_HDR (CVMX_ADD_IO_SEG(0x00011F0000000210ull))
139#define CVMX_NPI_PORT_BP_CONTROL (CVMX_ADD_IO_SEG(0x00011F00000001F0ull))
140#define CVMX_NPI_PX_DBPAIR_ADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000000180ull) + ((offset) & 3) * 8)
141#define CVMX_NPI_PX_INSTR_ADDR(offset) (CVMX_ADD_IO_SEG(0x00011F00000001C0ull) + ((offset) & 3) * 8)
142#define CVMX_NPI_PX_INSTR_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F00000001A0ull) + ((offset) & 3) * 8)
143#define CVMX_NPI_PX_PAIR_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F0000000160ull) + ((offset) & 3) * 8)
144#define CVMX_NPI_RSL_INT_BLOCKS (CVMX_ADD_IO_SEG(0x00011F0000000000ull))
145#define CVMX_NPI_SIZE_INPUT0 CVMX_NPI_SIZE_INPUTX(0)
146#define CVMX_NPI_SIZE_INPUT1 CVMX_NPI_SIZE_INPUTX(1)
147#define CVMX_NPI_SIZE_INPUT2 CVMX_NPI_SIZE_INPUTX(2)
148#define CVMX_NPI_SIZE_INPUT3 CVMX_NPI_SIZE_INPUTX(3)
149#define CVMX_NPI_SIZE_INPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000000078ull) + ((offset) & 3) * 16)
150#define CVMX_NPI_WIN_READ_TO (CVMX_ADD_IO_SEG(0x00011F00000001E0ull))
151
152union cvmx_npi_base_addr_inputx {
153 uint64_t u64;
154 struct cvmx_npi_base_addr_inputx_s {
155#ifdef __BIG_ENDIAN_BITFIELD
156 uint64_t baddr:61;
157 uint64_t reserved_0_2:3;
158#else
159 uint64_t reserved_0_2:3;
160 uint64_t baddr:61;
161#endif
162 } s;
163};
164
165union cvmx_npi_base_addr_outputx {
166 uint64_t u64;
167 struct cvmx_npi_base_addr_outputx_s {
168#ifdef __BIG_ENDIAN_BITFIELD
169 uint64_t baddr:61;
170 uint64_t reserved_0_2:3;
171#else
172 uint64_t reserved_0_2:3;
173 uint64_t baddr:61;
174#endif
175 } s;
176};
177
178union cvmx_npi_bist_status {
179 uint64_t u64;
180 struct cvmx_npi_bist_status_s {
181#ifdef __BIG_ENDIAN_BITFIELD
182 uint64_t reserved_20_63:44;
183 uint64_t csr_bs:1;
184 uint64_t dif_bs:1;
185 uint64_t rdp_bs:1;
186 uint64_t pcnc_bs:1;
187 uint64_t pcn_bs:1;
188 uint64_t rdn_bs:1;
189 uint64_t pcac_bs:1;
190 uint64_t pcad_bs:1;
191 uint64_t rdnl_bs:1;
192 uint64_t pgf_bs:1;
193 uint64_t pig_bs:1;
194 uint64_t pof0_bs:1;
195 uint64_t pof1_bs:1;
196 uint64_t pof2_bs:1;
197 uint64_t pof3_bs:1;
198 uint64_t pos_bs:1;
199 uint64_t nus_bs:1;
200 uint64_t dob_bs:1;
201 uint64_t pdf_bs:1;
202 uint64_t dpi_bs:1;
203#else
204 uint64_t dpi_bs:1;
205 uint64_t pdf_bs:1;
206 uint64_t dob_bs:1;
207 uint64_t nus_bs:1;
208 uint64_t pos_bs:1;
209 uint64_t pof3_bs:1;
210 uint64_t pof2_bs:1;
211 uint64_t pof1_bs:1;
212 uint64_t pof0_bs:1;
213 uint64_t pig_bs:1;
214 uint64_t pgf_bs:1;
215 uint64_t rdnl_bs:1;
216 uint64_t pcad_bs:1;
217 uint64_t pcac_bs:1;
218 uint64_t rdn_bs:1;
219 uint64_t pcn_bs:1;
220 uint64_t pcnc_bs:1;
221 uint64_t rdp_bs:1;
222 uint64_t dif_bs:1;
223 uint64_t csr_bs:1;
224 uint64_t reserved_20_63:44;
225#endif
226 } s;
227 struct cvmx_npi_bist_status_cn30xx {
228#ifdef __BIG_ENDIAN_BITFIELD
229 uint64_t reserved_20_63:44;
230 uint64_t csr_bs:1;
231 uint64_t dif_bs:1;
232 uint64_t rdp_bs:1;
233 uint64_t pcnc_bs:1;
234 uint64_t pcn_bs:1;
235 uint64_t rdn_bs:1;
236 uint64_t pcac_bs:1;
237 uint64_t pcad_bs:1;
238 uint64_t rdnl_bs:1;
239 uint64_t pgf_bs:1;
240 uint64_t pig_bs:1;
241 uint64_t pof0_bs:1;
242 uint64_t reserved_5_7:3;
243 uint64_t pos_bs:1;
244 uint64_t nus_bs:1;
245 uint64_t dob_bs:1;
246 uint64_t pdf_bs:1;
247 uint64_t dpi_bs:1;
248#else
249 uint64_t dpi_bs:1;
250 uint64_t pdf_bs:1;
251 uint64_t dob_bs:1;
252 uint64_t nus_bs:1;
253 uint64_t pos_bs:1;
254 uint64_t reserved_5_7:3;
255 uint64_t pof0_bs:1;
256 uint64_t pig_bs:1;
257 uint64_t pgf_bs:1;
258 uint64_t rdnl_bs:1;
259 uint64_t pcad_bs:1;
260 uint64_t pcac_bs:1;
261 uint64_t rdn_bs:1;
262 uint64_t pcn_bs:1;
263 uint64_t pcnc_bs:1;
264 uint64_t rdp_bs:1;
265 uint64_t dif_bs:1;
266 uint64_t csr_bs:1;
267 uint64_t reserved_20_63:44;
268#endif
269 } cn30xx;
270 struct cvmx_npi_bist_status_cn50xx {
271#ifdef __BIG_ENDIAN_BITFIELD
272 uint64_t reserved_20_63:44;
273 uint64_t csr_bs:1;
274 uint64_t dif_bs:1;
275 uint64_t rdp_bs:1;
276 uint64_t pcnc_bs:1;
277 uint64_t pcn_bs:1;
278 uint64_t rdn_bs:1;
279 uint64_t pcac_bs:1;
280 uint64_t pcad_bs:1;
281 uint64_t rdnl_bs:1;
282 uint64_t pgf_bs:1;
283 uint64_t pig_bs:1;
284 uint64_t pof0_bs:1;
285 uint64_t pof1_bs:1;
286 uint64_t reserved_5_6:2;
287 uint64_t pos_bs:1;
288 uint64_t nus_bs:1;
289 uint64_t dob_bs:1;
290 uint64_t pdf_bs:1;
291 uint64_t dpi_bs:1;
292#else
293 uint64_t dpi_bs:1;
294 uint64_t pdf_bs:1;
295 uint64_t dob_bs:1;
296 uint64_t nus_bs:1;
297 uint64_t pos_bs:1;
298 uint64_t reserved_5_6:2;
299 uint64_t pof1_bs:1;
300 uint64_t pof0_bs:1;
301 uint64_t pig_bs:1;
302 uint64_t pgf_bs:1;
303 uint64_t rdnl_bs:1;
304 uint64_t pcad_bs:1;
305 uint64_t pcac_bs:1;
306 uint64_t rdn_bs:1;
307 uint64_t pcn_bs:1;
308 uint64_t pcnc_bs:1;
309 uint64_t rdp_bs:1;
310 uint64_t dif_bs:1;
311 uint64_t csr_bs:1;
312 uint64_t reserved_20_63:44;
313#endif
314 } cn50xx;
315};
316
317union cvmx_npi_buff_size_outputx {
318 uint64_t u64;
319 struct cvmx_npi_buff_size_outputx_s {
320#ifdef __BIG_ENDIAN_BITFIELD
321 uint64_t reserved_23_63:41;
322 uint64_t isize:7;
323 uint64_t bsize:16;
324#else
325 uint64_t bsize:16;
326 uint64_t isize:7;
327 uint64_t reserved_23_63:41;
328#endif
329 } s;
330};
331
332union cvmx_npi_comp_ctl {
333 uint64_t u64;
334 struct cvmx_npi_comp_ctl_s {
335#ifdef __BIG_ENDIAN_BITFIELD
336 uint64_t reserved_10_63:54;
337 uint64_t pctl:5;
338 uint64_t nctl:5;
339#else
340 uint64_t nctl:5;
341 uint64_t pctl:5;
342 uint64_t reserved_10_63:54;
343#endif
344 } s;
345};
346
347union cvmx_npi_ctl_status {
348 uint64_t u64;
349 struct cvmx_npi_ctl_status_s {
350#ifdef __BIG_ENDIAN_BITFIELD
351 uint64_t reserved_63_63:1;
352 uint64_t chip_rev:8;
353 uint64_t dis_pniw:1;
354 uint64_t out3_enb:1;
355 uint64_t out2_enb:1;
356 uint64_t out1_enb:1;
357 uint64_t out0_enb:1;
358 uint64_t ins3_enb:1;
359 uint64_t ins2_enb:1;
360 uint64_t ins1_enb:1;
361 uint64_t ins0_enb:1;
362 uint64_t ins3_64b:1;
363 uint64_t ins2_64b:1;
364 uint64_t ins1_64b:1;
365 uint64_t ins0_64b:1;
366 uint64_t pci_wdis:1;
367 uint64_t wait_com:1;
368 uint64_t reserved_37_39:3;
369 uint64_t max_word:5;
370 uint64_t reserved_10_31:22;
371 uint64_t timer:10;
372#else
373 uint64_t timer:10;
374 uint64_t reserved_10_31:22;
375 uint64_t max_word:5;
376 uint64_t reserved_37_39:3;
377 uint64_t wait_com:1;
378 uint64_t pci_wdis:1;
379 uint64_t ins0_64b:1;
380 uint64_t ins1_64b:1;
381 uint64_t ins2_64b:1;
382 uint64_t ins3_64b:1;
383 uint64_t ins0_enb:1;
384 uint64_t ins1_enb:1;
385 uint64_t ins2_enb:1;
386 uint64_t ins3_enb:1;
387 uint64_t out0_enb:1;
388 uint64_t out1_enb:1;
389 uint64_t out2_enb:1;
390 uint64_t out3_enb:1;
391 uint64_t dis_pniw:1;
392 uint64_t chip_rev:8;
393 uint64_t reserved_63_63:1;
394#endif
395 } s;
396 struct cvmx_npi_ctl_status_cn30xx {
397#ifdef __BIG_ENDIAN_BITFIELD
398 uint64_t reserved_63_63:1;
399 uint64_t chip_rev:8;
400 uint64_t dis_pniw:1;
401 uint64_t reserved_51_53:3;
402 uint64_t out0_enb:1;
403 uint64_t reserved_47_49:3;
404 uint64_t ins0_enb:1;
405 uint64_t reserved_43_45:3;
406 uint64_t ins0_64b:1;
407 uint64_t pci_wdis:1;
408 uint64_t wait_com:1;
409 uint64_t reserved_37_39:3;
410 uint64_t max_word:5;
411 uint64_t reserved_10_31:22;
412 uint64_t timer:10;
413#else
414 uint64_t timer:10;
415 uint64_t reserved_10_31:22;
416 uint64_t max_word:5;
417 uint64_t reserved_37_39:3;
418 uint64_t wait_com:1;
419 uint64_t pci_wdis:1;
420 uint64_t ins0_64b:1;
421 uint64_t reserved_43_45:3;
422 uint64_t ins0_enb:1;
423 uint64_t reserved_47_49:3;
424 uint64_t out0_enb:1;
425 uint64_t reserved_51_53:3;
426 uint64_t dis_pniw:1;
427 uint64_t chip_rev:8;
428 uint64_t reserved_63_63:1;
429#endif
430 } cn30xx;
431 struct cvmx_npi_ctl_status_cn31xx {
432#ifdef __BIG_ENDIAN_BITFIELD
433 uint64_t reserved_63_63:1;
434 uint64_t chip_rev:8;
435 uint64_t dis_pniw:1;
436 uint64_t reserved_52_53:2;
437 uint64_t out1_enb:1;
438 uint64_t out0_enb:1;
439 uint64_t reserved_48_49:2;
440 uint64_t ins1_enb:1;
441 uint64_t ins0_enb:1;
442 uint64_t reserved_44_45:2;
443 uint64_t ins1_64b:1;
444 uint64_t ins0_64b:1;
445 uint64_t pci_wdis:1;
446 uint64_t wait_com:1;
447 uint64_t reserved_37_39:3;
448 uint64_t max_word:5;
449 uint64_t reserved_10_31:22;
450 uint64_t timer:10;
451#else
452 uint64_t timer:10;
453 uint64_t reserved_10_31:22;
454 uint64_t max_word:5;
455 uint64_t reserved_37_39:3;
456 uint64_t wait_com:1;
457 uint64_t pci_wdis:1;
458 uint64_t ins0_64b:1;
459 uint64_t ins1_64b:1;
460 uint64_t reserved_44_45:2;
461 uint64_t ins0_enb:1;
462 uint64_t ins1_enb:1;
463 uint64_t reserved_48_49:2;
464 uint64_t out0_enb:1;
465 uint64_t out1_enb:1;
466 uint64_t reserved_52_53:2;
467 uint64_t dis_pniw:1;
468 uint64_t chip_rev:8;
469 uint64_t reserved_63_63:1;
470#endif
471 } cn31xx;
472};
473
474union cvmx_npi_dbg_select {
475 uint64_t u64;
476 struct cvmx_npi_dbg_select_s {
477#ifdef __BIG_ENDIAN_BITFIELD
478 uint64_t reserved_16_63:48;
479 uint64_t dbg_sel:16;
480#else
481 uint64_t dbg_sel:16;
482 uint64_t reserved_16_63:48;
483#endif
484 } s;
485};
486
487union cvmx_npi_dma_control {
488 uint64_t u64;
489 struct cvmx_npi_dma_control_s {
490#ifdef __BIG_ENDIAN_BITFIELD
491 uint64_t reserved_36_63:28;
492 uint64_t b0_lend:1;
493 uint64_t dwb_denb:1;
494 uint64_t dwb_ichk:9;
495 uint64_t fpa_que:3;
496 uint64_t o_add1:1;
497 uint64_t o_ro:1;
498 uint64_t o_ns:1;
499 uint64_t o_es:2;
500 uint64_t o_mode:1;
501 uint64_t hp_enb:1;
502 uint64_t lp_enb:1;
503 uint64_t csize:14;
504#else
505 uint64_t csize:14;
506 uint64_t lp_enb:1;
507 uint64_t hp_enb:1;
508 uint64_t o_mode:1;
509 uint64_t o_es:2;
510 uint64_t o_ns:1;
511 uint64_t o_ro:1;
512 uint64_t o_add1:1;
513 uint64_t fpa_que:3;
514 uint64_t dwb_ichk:9;
515 uint64_t dwb_denb:1;
516 uint64_t b0_lend:1;
517 uint64_t reserved_36_63:28;
518#endif
519 } s;
520};
521
522union cvmx_npi_dma_highp_counts {
523 uint64_t u64;
524 struct cvmx_npi_dma_highp_counts_s {
525#ifdef __BIG_ENDIAN_BITFIELD
526 uint64_t reserved_39_63:25;
527 uint64_t fcnt:7;
528 uint64_t dbell:32;
529#else
530 uint64_t dbell:32;
531 uint64_t fcnt:7;
532 uint64_t reserved_39_63:25;
533#endif
534 } s;
535};
536
537union cvmx_npi_dma_highp_naddr {
538 uint64_t u64;
539 struct cvmx_npi_dma_highp_naddr_s {
540#ifdef __BIG_ENDIAN_BITFIELD
541 uint64_t reserved_40_63:24;
542 uint64_t state:4;
543 uint64_t addr:36;
544#else
545 uint64_t addr:36;
546 uint64_t state:4;
547 uint64_t reserved_40_63:24;
548#endif
549 } s;
550};
551
552union cvmx_npi_dma_lowp_counts {
553 uint64_t u64;
554 struct cvmx_npi_dma_lowp_counts_s {
555#ifdef __BIG_ENDIAN_BITFIELD
556 uint64_t reserved_39_63:25;
557 uint64_t fcnt:7;
558 uint64_t dbell:32;
559#else
560 uint64_t dbell:32;
561 uint64_t fcnt:7;
562 uint64_t reserved_39_63:25;
563#endif
564 } s;
565};
566
567union cvmx_npi_dma_lowp_naddr {
568 uint64_t u64;
569 struct cvmx_npi_dma_lowp_naddr_s {
570#ifdef __BIG_ENDIAN_BITFIELD
571 uint64_t reserved_40_63:24;
572 uint64_t state:4;
573 uint64_t addr:36;
574#else
575 uint64_t addr:36;
576 uint64_t state:4;
577 uint64_t reserved_40_63:24;
578#endif
579 } s;
580};
581
582union cvmx_npi_highp_dbell {
583 uint64_t u64;
584 struct cvmx_npi_highp_dbell_s {
585#ifdef __BIG_ENDIAN_BITFIELD
586 uint64_t reserved_16_63:48;
587 uint64_t dbell:16;
588#else
589 uint64_t dbell:16;
590 uint64_t reserved_16_63:48;
591#endif
592 } s;
593};
594
595union cvmx_npi_highp_ibuff_saddr {
596 uint64_t u64;
597 struct cvmx_npi_highp_ibuff_saddr_s {
598#ifdef __BIG_ENDIAN_BITFIELD
599 uint64_t reserved_36_63:28;
600 uint64_t saddr:36;
601#else
602 uint64_t saddr:36;
603 uint64_t reserved_36_63:28;
604#endif
605 } s;
606};
607
608union cvmx_npi_input_control {
609 uint64_t u64;
610 struct cvmx_npi_input_control_s {
611#ifdef __BIG_ENDIAN_BITFIELD
612 uint64_t reserved_23_63:41;
613 uint64_t pkt_rr:1;
614 uint64_t pbp_dhi:13;
615 uint64_t d_nsr:1;
616 uint64_t d_esr:2;
617 uint64_t d_ror:1;
618 uint64_t use_csr:1;
619 uint64_t nsr:1;
620 uint64_t esr:2;
621 uint64_t ror:1;
622#else
623 uint64_t ror:1;
624 uint64_t esr:2;
625 uint64_t nsr:1;
626 uint64_t use_csr:1;
627 uint64_t d_ror:1;
628 uint64_t d_esr:2;
629 uint64_t d_nsr:1;
630 uint64_t pbp_dhi:13;
631 uint64_t pkt_rr:1;
632 uint64_t reserved_23_63:41;
633#endif
634 } s;
635 struct cvmx_npi_input_control_cn30xx {
636#ifdef __BIG_ENDIAN_BITFIELD
637 uint64_t reserved_22_63:42;
638 uint64_t pbp_dhi:13;
639 uint64_t d_nsr:1;
640 uint64_t d_esr:2;
641 uint64_t d_ror:1;
642 uint64_t use_csr:1;
643 uint64_t nsr:1;
644 uint64_t esr:2;
645 uint64_t ror:1;
646#else
647 uint64_t ror:1;
648 uint64_t esr:2;
649 uint64_t nsr:1;
650 uint64_t use_csr:1;
651 uint64_t d_ror:1;
652 uint64_t d_esr:2;
653 uint64_t d_nsr:1;
654 uint64_t pbp_dhi:13;
655 uint64_t reserved_22_63:42;
656#endif
657 } cn30xx;
658};
659
660union cvmx_npi_int_enb {
661 uint64_t u64;
662 struct cvmx_npi_int_enb_s {
663#ifdef __BIG_ENDIAN_BITFIELD
664 uint64_t reserved_62_63:2;
665 uint64_t q1_a_f:1;
666 uint64_t q1_s_e:1;
667 uint64_t pdf_p_f:1;
668 uint64_t pdf_p_e:1;
669 uint64_t pcf_p_f:1;
670 uint64_t pcf_p_e:1;
671 uint64_t rdx_s_e:1;
672 uint64_t rwx_s_e:1;
673 uint64_t pnc_a_f:1;
674 uint64_t pnc_s_e:1;
675 uint64_t com_a_f:1;
676 uint64_t com_s_e:1;
677 uint64_t q3_a_f:1;
678 uint64_t q3_s_e:1;
679 uint64_t q2_a_f:1;
680 uint64_t q2_s_e:1;
681 uint64_t pcr_a_f:1;
682 uint64_t pcr_s_e:1;
683 uint64_t fcr_a_f:1;
684 uint64_t fcr_s_e:1;
685 uint64_t iobdma:1;
686 uint64_t p_dperr:1;
687 uint64_t win_rto:1;
688 uint64_t i3_pperr:1;
689 uint64_t i2_pperr:1;
690 uint64_t i1_pperr:1;
691 uint64_t i0_pperr:1;
692 uint64_t p3_ptout:1;
693 uint64_t p2_ptout:1;
694 uint64_t p1_ptout:1;
695 uint64_t p0_ptout:1;
696 uint64_t p3_pperr:1;
697 uint64_t p2_pperr:1;
698 uint64_t p1_pperr:1;
699 uint64_t p0_pperr:1;
700 uint64_t g3_rtout:1;
701 uint64_t g2_rtout:1;
702 uint64_t g1_rtout:1;
703 uint64_t g0_rtout:1;
704 uint64_t p3_perr:1;
705 uint64_t p2_perr:1;
706 uint64_t p1_perr:1;
707 uint64_t p0_perr:1;
708 uint64_t p3_rtout:1;
709 uint64_t p2_rtout:1;
710 uint64_t p1_rtout:1;
711 uint64_t p0_rtout:1;
712 uint64_t i3_overf:1;
713 uint64_t i2_overf:1;
714 uint64_t i1_overf:1;
715 uint64_t i0_overf:1;
716 uint64_t i3_rtout:1;
717 uint64_t i2_rtout:1;
718 uint64_t i1_rtout:1;
719 uint64_t i0_rtout:1;
720 uint64_t po3_2sml:1;
721 uint64_t po2_2sml:1;
722 uint64_t po1_2sml:1;
723 uint64_t po0_2sml:1;
724 uint64_t pci_rsl:1;
725 uint64_t rml_wto:1;
726 uint64_t rml_rto:1;
727#else
728 uint64_t rml_rto:1;
729 uint64_t rml_wto:1;
730 uint64_t pci_rsl:1;
731 uint64_t po0_2sml:1;
732 uint64_t po1_2sml:1;
733 uint64_t po2_2sml:1;
734 uint64_t po3_2sml:1;
735 uint64_t i0_rtout:1;
736 uint64_t i1_rtout:1;
737 uint64_t i2_rtout:1;
738 uint64_t i3_rtout:1;
739 uint64_t i0_overf:1;
740 uint64_t i1_overf:1;
741 uint64_t i2_overf:1;
742 uint64_t i3_overf:1;
743 uint64_t p0_rtout:1;
744 uint64_t p1_rtout:1;
745 uint64_t p2_rtout:1;
746 uint64_t p3_rtout:1;
747 uint64_t p0_perr:1;
748 uint64_t p1_perr:1;
749 uint64_t p2_perr:1;
750 uint64_t p3_perr:1;
751 uint64_t g0_rtout:1;
752 uint64_t g1_rtout:1;
753 uint64_t g2_rtout:1;
754 uint64_t g3_rtout:1;
755 uint64_t p0_pperr:1;
756 uint64_t p1_pperr:1;
757 uint64_t p2_pperr:1;
758 uint64_t p3_pperr:1;
759 uint64_t p0_ptout:1;
760 uint64_t p1_ptout:1;
761 uint64_t p2_ptout:1;
762 uint64_t p3_ptout:1;
763 uint64_t i0_pperr:1;
764 uint64_t i1_pperr:1;
765 uint64_t i2_pperr:1;
766 uint64_t i3_pperr:1;
767 uint64_t win_rto:1;
768 uint64_t p_dperr:1;
769 uint64_t iobdma:1;
770 uint64_t fcr_s_e:1;
771 uint64_t fcr_a_f:1;
772 uint64_t pcr_s_e:1;
773 uint64_t pcr_a_f:1;
774 uint64_t q2_s_e:1;
775 uint64_t q2_a_f:1;
776 uint64_t q3_s_e:1;
777 uint64_t q3_a_f:1;
778 uint64_t com_s_e:1;
779 uint64_t com_a_f:1;
780 uint64_t pnc_s_e:1;
781 uint64_t pnc_a_f:1;
782 uint64_t rwx_s_e:1;
783 uint64_t rdx_s_e:1;
784 uint64_t pcf_p_e:1;
785 uint64_t pcf_p_f:1;
786 uint64_t pdf_p_e:1;
787 uint64_t pdf_p_f:1;
788 uint64_t q1_s_e:1;
789 uint64_t q1_a_f:1;
790 uint64_t reserved_62_63:2;
791#endif
792 } s;
793 struct cvmx_npi_int_enb_cn30xx {
794#ifdef __BIG_ENDIAN_BITFIELD
795 uint64_t reserved_62_63:2;
796 uint64_t q1_a_f:1;
797 uint64_t q1_s_e:1;
798 uint64_t pdf_p_f:1;
799 uint64_t pdf_p_e:1;
800 uint64_t pcf_p_f:1;
801 uint64_t pcf_p_e:1;
802 uint64_t rdx_s_e:1;
803 uint64_t rwx_s_e:1;
804 uint64_t pnc_a_f:1;
805 uint64_t pnc_s_e:1;
806 uint64_t com_a_f:1;
807 uint64_t com_s_e:1;
808 uint64_t q3_a_f:1;
809 uint64_t q3_s_e:1;
810 uint64_t q2_a_f:1;
811 uint64_t q2_s_e:1;
812 uint64_t pcr_a_f:1;
813 uint64_t pcr_s_e:1;
814 uint64_t fcr_a_f:1;
815 uint64_t fcr_s_e:1;
816 uint64_t iobdma:1;
817 uint64_t p_dperr:1;
818 uint64_t win_rto:1;
819 uint64_t reserved_36_38:3;
820 uint64_t i0_pperr:1;
821 uint64_t reserved_32_34:3;
822 uint64_t p0_ptout:1;
823 uint64_t reserved_28_30:3;
824 uint64_t p0_pperr:1;
825 uint64_t reserved_24_26:3;
826 uint64_t g0_rtout:1;
827 uint64_t reserved_20_22:3;
828 uint64_t p0_perr:1;
829 uint64_t reserved_16_18:3;
830 uint64_t p0_rtout:1;
831 uint64_t reserved_12_14:3;
832 uint64_t i0_overf:1;
833 uint64_t reserved_8_10:3;
834 uint64_t i0_rtout:1;
835 uint64_t reserved_4_6:3;
836 uint64_t po0_2sml:1;
837 uint64_t pci_rsl:1;
838 uint64_t rml_wto:1;
839 uint64_t rml_rto:1;
840#else
841 uint64_t rml_rto:1;
842 uint64_t rml_wto:1;
843 uint64_t pci_rsl:1;
844 uint64_t po0_2sml:1;
845 uint64_t reserved_4_6:3;
846 uint64_t i0_rtout:1;
847 uint64_t reserved_8_10:3;
848 uint64_t i0_overf:1;
849 uint64_t reserved_12_14:3;
850 uint64_t p0_rtout:1;
851 uint64_t reserved_16_18:3;
852 uint64_t p0_perr:1;
853 uint64_t reserved_20_22:3;
854 uint64_t g0_rtout:1;
855 uint64_t reserved_24_26:3;
856 uint64_t p0_pperr:1;
857 uint64_t reserved_28_30:3;
858 uint64_t p0_ptout:1;
859 uint64_t reserved_32_34:3;
860 uint64_t i0_pperr:1;
861 uint64_t reserved_36_38:3;
862 uint64_t win_rto:1;
863 uint64_t p_dperr:1;
864 uint64_t iobdma:1;
865 uint64_t fcr_s_e:1;
866 uint64_t fcr_a_f:1;
867 uint64_t pcr_s_e:1;
868 uint64_t pcr_a_f:1;
869 uint64_t q2_s_e:1;
870 uint64_t q2_a_f:1;
871 uint64_t q3_s_e:1;
872 uint64_t q3_a_f:1;
873 uint64_t com_s_e:1;
874 uint64_t com_a_f:1;
875 uint64_t pnc_s_e:1;
876 uint64_t pnc_a_f:1;
877 uint64_t rwx_s_e:1;
878 uint64_t rdx_s_e:1;
879 uint64_t pcf_p_e:1;
880 uint64_t pcf_p_f:1;
881 uint64_t pdf_p_e:1;
882 uint64_t pdf_p_f:1;
883 uint64_t q1_s_e:1;
884 uint64_t q1_a_f:1;
885 uint64_t reserved_62_63:2;
886#endif
887 } cn30xx;
888 struct cvmx_npi_int_enb_cn31xx {
889#ifdef __BIG_ENDIAN_BITFIELD
890 uint64_t reserved_62_63:2;
891 uint64_t q1_a_f:1;
892 uint64_t q1_s_e:1;
893 uint64_t pdf_p_f:1;
894 uint64_t pdf_p_e:1;
895 uint64_t pcf_p_f:1;
896 uint64_t pcf_p_e:1;
897 uint64_t rdx_s_e:1;
898 uint64_t rwx_s_e:1;
899 uint64_t pnc_a_f:1;
900 uint64_t pnc_s_e:1;
901 uint64_t com_a_f:1;
902 uint64_t com_s_e:1;
903 uint64_t q3_a_f:1;
904 uint64_t q3_s_e:1;
905 uint64_t q2_a_f:1;
906 uint64_t q2_s_e:1;
907 uint64_t pcr_a_f:1;
908 uint64_t pcr_s_e:1;
909 uint64_t fcr_a_f:1;
910 uint64_t fcr_s_e:1;
911 uint64_t iobdma:1;
912 uint64_t p_dperr:1;
913 uint64_t win_rto:1;
914 uint64_t reserved_37_38:2;
915 uint64_t i1_pperr:1;
916 uint64_t i0_pperr:1;
917 uint64_t reserved_33_34:2;
918 uint64_t p1_ptout:1;
919 uint64_t p0_ptout:1;
920 uint64_t reserved_29_30:2;
921 uint64_t p1_pperr:1;
922 uint64_t p0_pperr:1;
923 uint64_t reserved_25_26:2;
924 uint64_t g1_rtout:1;
925 uint64_t g0_rtout:1;
926 uint64_t reserved_21_22:2;
927 uint64_t p1_perr:1;
928 uint64_t p0_perr:1;
929 uint64_t reserved_17_18:2;
930 uint64_t p1_rtout:1;
931 uint64_t p0_rtout:1;
932 uint64_t reserved_13_14:2;
933 uint64_t i1_overf:1;
934 uint64_t i0_overf:1;
935 uint64_t reserved_9_10:2;
936 uint64_t i1_rtout:1;
937 uint64_t i0_rtout:1;
938 uint64_t reserved_5_6:2;
939 uint64_t po1_2sml:1;
940 uint64_t po0_2sml:1;
941 uint64_t pci_rsl:1;
942 uint64_t rml_wto:1;
943 uint64_t rml_rto:1;
944#else
945 uint64_t rml_rto:1;
946 uint64_t rml_wto:1;
947 uint64_t pci_rsl:1;
948 uint64_t po0_2sml:1;
949 uint64_t po1_2sml:1;
950 uint64_t reserved_5_6:2;
951 uint64_t i0_rtout:1;
952 uint64_t i1_rtout:1;
953 uint64_t reserved_9_10:2;
954 uint64_t i0_overf:1;
955 uint64_t i1_overf:1;
956 uint64_t reserved_13_14:2;
957 uint64_t p0_rtout:1;
958 uint64_t p1_rtout:1;
959 uint64_t reserved_17_18:2;
960 uint64_t p0_perr:1;
961 uint64_t p1_perr:1;
962 uint64_t reserved_21_22:2;
963 uint64_t g0_rtout:1;
964 uint64_t g1_rtout:1;
965 uint64_t reserved_25_26:2;
966 uint64_t p0_pperr:1;
967 uint64_t p1_pperr:1;
968 uint64_t reserved_29_30:2;
969 uint64_t p0_ptout:1;
970 uint64_t p1_ptout:1;
971 uint64_t reserved_33_34:2;
972 uint64_t i0_pperr:1;
973 uint64_t i1_pperr:1;
974 uint64_t reserved_37_38:2;
975 uint64_t win_rto:1;
976 uint64_t p_dperr:1;
977 uint64_t iobdma:1;
978 uint64_t fcr_s_e:1;
979 uint64_t fcr_a_f:1;
980 uint64_t pcr_s_e:1;
981 uint64_t pcr_a_f:1;
982 uint64_t q2_s_e:1;
983 uint64_t q2_a_f:1;
984 uint64_t q3_s_e:1;
985 uint64_t q3_a_f:1;
986 uint64_t com_s_e:1;
987 uint64_t com_a_f:1;
988 uint64_t pnc_s_e:1;
989 uint64_t pnc_a_f:1;
990 uint64_t rwx_s_e:1;
991 uint64_t rdx_s_e:1;
992 uint64_t pcf_p_e:1;
993 uint64_t pcf_p_f:1;
994 uint64_t pdf_p_e:1;
995 uint64_t pdf_p_f:1;
996 uint64_t q1_s_e:1;
997 uint64_t q1_a_f:1;
998 uint64_t reserved_62_63:2;
999#endif
1000 } cn31xx;
1001 struct cvmx_npi_int_enb_cn38xxp2 {
1002#ifdef __BIG_ENDIAN_BITFIELD
1003 uint64_t reserved_42_63:22;
1004 uint64_t iobdma:1;
1005 uint64_t p_dperr:1;
1006 uint64_t win_rto:1;
1007 uint64_t i3_pperr:1;
1008 uint64_t i2_pperr:1;
1009 uint64_t i1_pperr:1;
1010 uint64_t i0_pperr:1;
1011 uint64_t p3_ptout:1;
1012 uint64_t p2_ptout:1;
1013 uint64_t p1_ptout:1;
1014 uint64_t p0_ptout:1;
1015 uint64_t p3_pperr:1;
1016 uint64_t p2_pperr:1;
1017 uint64_t p1_pperr:1;
1018 uint64_t p0_pperr:1;
1019 uint64_t g3_rtout:1;
1020 uint64_t g2_rtout:1;
1021 uint64_t g1_rtout:1;
1022 uint64_t g0_rtout:1;
1023 uint64_t p3_perr:1;
1024 uint64_t p2_perr:1;
1025 uint64_t p1_perr:1;
1026 uint64_t p0_perr:1;
1027 uint64_t p3_rtout:1;
1028 uint64_t p2_rtout:1;
1029 uint64_t p1_rtout:1;
1030 uint64_t p0_rtout:1;
1031 uint64_t i3_overf:1;
1032 uint64_t i2_overf:1;
1033 uint64_t i1_overf:1;
1034 uint64_t i0_overf:1;
1035 uint64_t i3_rtout:1;
1036 uint64_t i2_rtout:1;
1037 uint64_t i1_rtout:1;
1038 uint64_t i0_rtout:1;
1039 uint64_t po3_2sml:1;
1040 uint64_t po2_2sml:1;
1041 uint64_t po1_2sml:1;
1042 uint64_t po0_2sml:1;
1043 uint64_t pci_rsl:1;
1044 uint64_t rml_wto:1;
1045 uint64_t rml_rto:1;
1046#else
1047 uint64_t rml_rto:1;
1048 uint64_t rml_wto:1;
1049 uint64_t pci_rsl:1;
1050 uint64_t po0_2sml:1;
1051 uint64_t po1_2sml:1;
1052 uint64_t po2_2sml:1;
1053 uint64_t po3_2sml:1;
1054 uint64_t i0_rtout:1;
1055 uint64_t i1_rtout:1;
1056 uint64_t i2_rtout:1;
1057 uint64_t i3_rtout:1;
1058 uint64_t i0_overf:1;
1059 uint64_t i1_overf:1;
1060 uint64_t i2_overf:1;
1061 uint64_t i3_overf:1;
1062 uint64_t p0_rtout:1;
1063 uint64_t p1_rtout:1;
1064 uint64_t p2_rtout:1;
1065 uint64_t p3_rtout:1;
1066 uint64_t p0_perr:1;
1067 uint64_t p1_perr:1;
1068 uint64_t p2_perr:1;
1069 uint64_t p3_perr:1;
1070 uint64_t g0_rtout:1;
1071 uint64_t g1_rtout:1;
1072 uint64_t g2_rtout:1;
1073 uint64_t g3_rtout:1;
1074 uint64_t p0_pperr:1;
1075 uint64_t p1_pperr:1;
1076 uint64_t p2_pperr:1;
1077 uint64_t p3_pperr:1;
1078 uint64_t p0_ptout:1;
1079 uint64_t p1_ptout:1;
1080 uint64_t p2_ptout:1;
1081 uint64_t p3_ptout:1;
1082 uint64_t i0_pperr:1;
1083 uint64_t i1_pperr:1;
1084 uint64_t i2_pperr:1;
1085 uint64_t i3_pperr:1;
1086 uint64_t win_rto:1;
1087 uint64_t p_dperr:1;
1088 uint64_t iobdma:1;
1089 uint64_t reserved_42_63:22;
1090#endif
1091 } cn38xxp2;
1092};
1093
1094union cvmx_npi_int_sum {
1095 uint64_t u64;
1096 struct cvmx_npi_int_sum_s {
1097#ifdef __BIG_ENDIAN_BITFIELD
1098 uint64_t reserved_62_63:2;
1099 uint64_t q1_a_f:1;
1100 uint64_t q1_s_e:1;
1101 uint64_t pdf_p_f:1;
1102 uint64_t pdf_p_e:1;
1103 uint64_t pcf_p_f:1;
1104 uint64_t pcf_p_e:1;
1105 uint64_t rdx_s_e:1;
1106 uint64_t rwx_s_e:1;
1107 uint64_t pnc_a_f:1;
1108 uint64_t pnc_s_e:1;
1109 uint64_t com_a_f:1;
1110 uint64_t com_s_e:1;
1111 uint64_t q3_a_f:1;
1112 uint64_t q3_s_e:1;
1113 uint64_t q2_a_f:1;
1114 uint64_t q2_s_e:1;
1115 uint64_t pcr_a_f:1;
1116 uint64_t pcr_s_e:1;
1117 uint64_t fcr_a_f:1;
1118 uint64_t fcr_s_e:1;
1119 uint64_t iobdma:1;
1120 uint64_t p_dperr:1;
1121 uint64_t win_rto:1;
1122 uint64_t i3_pperr:1;
1123 uint64_t i2_pperr:1;
1124 uint64_t i1_pperr:1;
1125 uint64_t i0_pperr:1;
1126 uint64_t p3_ptout:1;
1127 uint64_t p2_ptout:1;
1128 uint64_t p1_ptout:1;
1129 uint64_t p0_ptout:1;
1130 uint64_t p3_pperr:1;
1131 uint64_t p2_pperr:1;
1132 uint64_t p1_pperr:1;
1133 uint64_t p0_pperr:1;
1134 uint64_t g3_rtout:1;
1135 uint64_t g2_rtout:1;
1136 uint64_t g1_rtout:1;
1137 uint64_t g0_rtout:1;
1138 uint64_t p3_perr:1;
1139 uint64_t p2_perr:1;
1140 uint64_t p1_perr:1;
1141 uint64_t p0_perr:1;
1142 uint64_t p3_rtout:1;
1143 uint64_t p2_rtout:1;
1144 uint64_t p1_rtout:1;
1145 uint64_t p0_rtout:1;
1146 uint64_t i3_overf:1;
1147 uint64_t i2_overf:1;
1148 uint64_t i1_overf:1;
1149 uint64_t i0_overf:1;
1150 uint64_t i3_rtout:1;
1151 uint64_t i2_rtout:1;
1152 uint64_t i1_rtout:1;
1153 uint64_t i0_rtout:1;
1154 uint64_t po3_2sml:1;
1155 uint64_t po2_2sml:1;
1156 uint64_t po1_2sml:1;
1157 uint64_t po0_2sml:1;
1158 uint64_t pci_rsl:1;
1159 uint64_t rml_wto:1;
1160 uint64_t rml_rto:1;
1161#else
1162 uint64_t rml_rto:1;
1163 uint64_t rml_wto:1;
1164 uint64_t pci_rsl:1;
1165 uint64_t po0_2sml:1;
1166 uint64_t po1_2sml:1;
1167 uint64_t po2_2sml:1;
1168 uint64_t po3_2sml:1;
1169 uint64_t i0_rtout:1;
1170 uint64_t i1_rtout:1;
1171 uint64_t i2_rtout:1;
1172 uint64_t i3_rtout:1;
1173 uint64_t i0_overf:1;
1174 uint64_t i1_overf:1;
1175 uint64_t i2_overf:1;
1176 uint64_t i3_overf:1;
1177 uint64_t p0_rtout:1;
1178 uint64_t p1_rtout:1;
1179 uint64_t p2_rtout:1;
1180 uint64_t p3_rtout:1;
1181 uint64_t p0_perr:1;
1182 uint64_t p1_perr:1;
1183 uint64_t p2_perr:1;
1184 uint64_t p3_perr:1;
1185 uint64_t g0_rtout:1;
1186 uint64_t g1_rtout:1;
1187 uint64_t g2_rtout:1;
1188 uint64_t g3_rtout:1;
1189 uint64_t p0_pperr:1;
1190 uint64_t p1_pperr:1;
1191 uint64_t p2_pperr:1;
1192 uint64_t p3_pperr:1;
1193 uint64_t p0_ptout:1;
1194 uint64_t p1_ptout:1;
1195 uint64_t p2_ptout:1;
1196 uint64_t p3_ptout:1;
1197 uint64_t i0_pperr:1;
1198 uint64_t i1_pperr:1;
1199 uint64_t i2_pperr:1;
1200 uint64_t i3_pperr:1;
1201 uint64_t win_rto:1;
1202 uint64_t p_dperr:1;
1203 uint64_t iobdma:1;
1204 uint64_t fcr_s_e:1;
1205 uint64_t fcr_a_f:1;
1206 uint64_t pcr_s_e:1;
1207 uint64_t pcr_a_f:1;
1208 uint64_t q2_s_e:1;
1209 uint64_t q2_a_f:1;
1210 uint64_t q3_s_e:1;
1211 uint64_t q3_a_f:1;
1212 uint64_t com_s_e:1;
1213 uint64_t com_a_f:1;
1214 uint64_t pnc_s_e:1;
1215 uint64_t pnc_a_f:1;
1216 uint64_t rwx_s_e:1;
1217 uint64_t rdx_s_e:1;
1218 uint64_t pcf_p_e:1;
1219 uint64_t pcf_p_f:1;
1220 uint64_t pdf_p_e:1;
1221 uint64_t pdf_p_f:1;
1222 uint64_t q1_s_e:1;
1223 uint64_t q1_a_f:1;
1224 uint64_t reserved_62_63:2;
1225#endif
1226 } s;
1227 struct cvmx_npi_int_sum_cn30xx {
1228#ifdef __BIG_ENDIAN_BITFIELD
1229 uint64_t reserved_62_63:2;
1230 uint64_t q1_a_f:1;
1231 uint64_t q1_s_e:1;
1232 uint64_t pdf_p_f:1;
1233 uint64_t pdf_p_e:1;
1234 uint64_t pcf_p_f:1;
1235 uint64_t pcf_p_e:1;
1236 uint64_t rdx_s_e:1;
1237 uint64_t rwx_s_e:1;
1238 uint64_t pnc_a_f:1;
1239 uint64_t pnc_s_e:1;
1240 uint64_t com_a_f:1;
1241 uint64_t com_s_e:1;
1242 uint64_t q3_a_f:1;
1243 uint64_t q3_s_e:1;
1244 uint64_t q2_a_f:1;
1245 uint64_t q2_s_e:1;
1246 uint64_t pcr_a_f:1;
1247 uint64_t pcr_s_e:1;
1248 uint64_t fcr_a_f:1;
1249 uint64_t fcr_s_e:1;
1250 uint64_t iobdma:1;
1251 uint64_t p_dperr:1;
1252 uint64_t win_rto:1;
1253 uint64_t reserved_36_38:3;
1254 uint64_t i0_pperr:1;
1255 uint64_t reserved_32_34:3;
1256 uint64_t p0_ptout:1;
1257 uint64_t reserved_28_30:3;
1258 uint64_t p0_pperr:1;
1259 uint64_t reserved_24_26:3;
1260 uint64_t g0_rtout:1;
1261 uint64_t reserved_20_22:3;
1262 uint64_t p0_perr:1;
1263 uint64_t reserved_16_18:3;
1264 uint64_t p0_rtout:1;
1265 uint64_t reserved_12_14:3;
1266 uint64_t i0_overf:1;
1267 uint64_t reserved_8_10:3;
1268 uint64_t i0_rtout:1;
1269 uint64_t reserved_4_6:3;
1270 uint64_t po0_2sml:1;
1271 uint64_t pci_rsl:1;
1272 uint64_t rml_wto:1;
1273 uint64_t rml_rto:1;
1274#else
1275 uint64_t rml_rto:1;
1276 uint64_t rml_wto:1;
1277 uint64_t pci_rsl:1;
1278 uint64_t po0_2sml:1;
1279 uint64_t reserved_4_6:3;
1280 uint64_t i0_rtout:1;
1281 uint64_t reserved_8_10:3;
1282 uint64_t i0_overf:1;
1283 uint64_t reserved_12_14:3;
1284 uint64_t p0_rtout:1;
1285 uint64_t reserved_16_18:3;
1286 uint64_t p0_perr:1;
1287 uint64_t reserved_20_22:3;
1288 uint64_t g0_rtout:1;
1289 uint64_t reserved_24_26:3;
1290 uint64_t p0_pperr:1;
1291 uint64_t reserved_28_30:3;
1292 uint64_t p0_ptout:1;
1293 uint64_t reserved_32_34:3;
1294 uint64_t i0_pperr:1;
1295 uint64_t reserved_36_38:3;
1296 uint64_t win_rto:1;
1297 uint64_t p_dperr:1;
1298 uint64_t iobdma:1;
1299 uint64_t fcr_s_e:1;
1300 uint64_t fcr_a_f:1;
1301 uint64_t pcr_s_e:1;
1302 uint64_t pcr_a_f:1;
1303 uint64_t q2_s_e:1;
1304 uint64_t q2_a_f:1;
1305 uint64_t q3_s_e:1;
1306 uint64_t q3_a_f:1;
1307 uint64_t com_s_e:1;
1308 uint64_t com_a_f:1;
1309 uint64_t pnc_s_e:1;
1310 uint64_t pnc_a_f:1;
1311 uint64_t rwx_s_e:1;
1312 uint64_t rdx_s_e:1;
1313 uint64_t pcf_p_e:1;
1314 uint64_t pcf_p_f:1;
1315 uint64_t pdf_p_e:1;
1316 uint64_t pdf_p_f:1;
1317 uint64_t q1_s_e:1;
1318 uint64_t q1_a_f:1;
1319 uint64_t reserved_62_63:2;
1320#endif
1321 } cn30xx;
1322 struct cvmx_npi_int_sum_cn31xx {
1323#ifdef __BIG_ENDIAN_BITFIELD
1324 uint64_t reserved_62_63:2;
1325 uint64_t q1_a_f:1;
1326 uint64_t q1_s_e:1;
1327 uint64_t pdf_p_f:1;
1328 uint64_t pdf_p_e:1;
1329 uint64_t pcf_p_f:1;
1330 uint64_t pcf_p_e:1;
1331 uint64_t rdx_s_e:1;
1332 uint64_t rwx_s_e:1;
1333 uint64_t pnc_a_f:1;
1334 uint64_t pnc_s_e:1;
1335 uint64_t com_a_f:1;
1336 uint64_t com_s_e:1;
1337 uint64_t q3_a_f:1;
1338 uint64_t q3_s_e:1;
1339 uint64_t q2_a_f:1;
1340 uint64_t q2_s_e:1;
1341 uint64_t pcr_a_f:1;
1342 uint64_t pcr_s_e:1;
1343 uint64_t fcr_a_f:1;
1344 uint64_t fcr_s_e:1;
1345 uint64_t iobdma:1;
1346 uint64_t p_dperr:1;
1347 uint64_t win_rto:1;
1348 uint64_t reserved_37_38:2;
1349 uint64_t i1_pperr:1;
1350 uint64_t i0_pperr:1;
1351 uint64_t reserved_33_34:2;
1352 uint64_t p1_ptout:1;
1353 uint64_t p0_ptout:1;
1354 uint64_t reserved_29_30:2;
1355 uint64_t p1_pperr:1;
1356 uint64_t p0_pperr:1;
1357 uint64_t reserved_25_26:2;
1358 uint64_t g1_rtout:1;
1359 uint64_t g0_rtout:1;
1360 uint64_t reserved_21_22:2;
1361 uint64_t p1_perr:1;
1362 uint64_t p0_perr:1;
1363 uint64_t reserved_17_18:2;
1364 uint64_t p1_rtout:1;
1365 uint64_t p0_rtout:1;
1366 uint64_t reserved_13_14:2;
1367 uint64_t i1_overf:1;
1368 uint64_t i0_overf:1;
1369 uint64_t reserved_9_10:2;
1370 uint64_t i1_rtout:1;
1371 uint64_t i0_rtout:1;
1372 uint64_t reserved_5_6:2;
1373 uint64_t po1_2sml:1;
1374 uint64_t po0_2sml:1;
1375 uint64_t pci_rsl:1;
1376 uint64_t rml_wto:1;
1377 uint64_t rml_rto:1;
1378#else
1379 uint64_t rml_rto:1;
1380 uint64_t rml_wto:1;
1381 uint64_t pci_rsl:1;
1382 uint64_t po0_2sml:1;
1383 uint64_t po1_2sml:1;
1384 uint64_t reserved_5_6:2;
1385 uint64_t i0_rtout:1;
1386 uint64_t i1_rtout:1;
1387 uint64_t reserved_9_10:2;
1388 uint64_t i0_overf:1;
1389 uint64_t i1_overf:1;
1390 uint64_t reserved_13_14:2;
1391 uint64_t p0_rtout:1;
1392 uint64_t p1_rtout:1;
1393 uint64_t reserved_17_18:2;
1394 uint64_t p0_perr:1;
1395 uint64_t p1_perr:1;
1396 uint64_t reserved_21_22:2;
1397 uint64_t g0_rtout:1;
1398 uint64_t g1_rtout:1;
1399 uint64_t reserved_25_26:2;
1400 uint64_t p0_pperr:1;
1401 uint64_t p1_pperr:1;
1402 uint64_t reserved_29_30:2;
1403 uint64_t p0_ptout:1;
1404 uint64_t p1_ptout:1;
1405 uint64_t reserved_33_34:2;
1406 uint64_t i0_pperr:1;
1407 uint64_t i1_pperr:1;
1408 uint64_t reserved_37_38:2;
1409 uint64_t win_rto:1;
1410 uint64_t p_dperr:1;
1411 uint64_t iobdma:1;
1412 uint64_t fcr_s_e:1;
1413 uint64_t fcr_a_f:1;
1414 uint64_t pcr_s_e:1;
1415 uint64_t pcr_a_f:1;
1416 uint64_t q2_s_e:1;
1417 uint64_t q2_a_f:1;
1418 uint64_t q3_s_e:1;
1419 uint64_t q3_a_f:1;
1420 uint64_t com_s_e:1;
1421 uint64_t com_a_f:1;
1422 uint64_t pnc_s_e:1;
1423 uint64_t pnc_a_f:1;
1424 uint64_t rwx_s_e:1;
1425 uint64_t rdx_s_e:1;
1426 uint64_t pcf_p_e:1;
1427 uint64_t pcf_p_f:1;
1428 uint64_t pdf_p_e:1;
1429 uint64_t pdf_p_f:1;
1430 uint64_t q1_s_e:1;
1431 uint64_t q1_a_f:1;
1432 uint64_t reserved_62_63:2;
1433#endif
1434 } cn31xx;
1435 struct cvmx_npi_int_sum_cn38xxp2 {
1436#ifdef __BIG_ENDIAN_BITFIELD
1437 uint64_t reserved_42_63:22;
1438 uint64_t iobdma:1;
1439 uint64_t p_dperr:1;
1440 uint64_t win_rto:1;
1441 uint64_t i3_pperr:1;
1442 uint64_t i2_pperr:1;
1443 uint64_t i1_pperr:1;
1444 uint64_t i0_pperr:1;
1445 uint64_t p3_ptout:1;
1446 uint64_t p2_ptout:1;
1447 uint64_t p1_ptout:1;
1448 uint64_t p0_ptout:1;
1449 uint64_t p3_pperr:1;
1450 uint64_t p2_pperr:1;
1451 uint64_t p1_pperr:1;
1452 uint64_t p0_pperr:1;
1453 uint64_t g3_rtout:1;
1454 uint64_t g2_rtout:1;
1455 uint64_t g1_rtout:1;
1456 uint64_t g0_rtout:1;
1457 uint64_t p3_perr:1;
1458 uint64_t p2_perr:1;
1459 uint64_t p1_perr:1;
1460 uint64_t p0_perr:1;
1461 uint64_t p3_rtout:1;
1462 uint64_t p2_rtout:1;
1463 uint64_t p1_rtout:1;
1464 uint64_t p0_rtout:1;
1465 uint64_t i3_overf:1;
1466 uint64_t i2_overf:1;
1467 uint64_t i1_overf:1;
1468 uint64_t i0_overf:1;
1469 uint64_t i3_rtout:1;
1470 uint64_t i2_rtout:1;
1471 uint64_t i1_rtout:1;
1472 uint64_t i0_rtout:1;
1473 uint64_t po3_2sml:1;
1474 uint64_t po2_2sml:1;
1475 uint64_t po1_2sml:1;
1476 uint64_t po0_2sml:1;
1477 uint64_t pci_rsl:1;
1478 uint64_t rml_wto:1;
1479 uint64_t rml_rto:1;
1480#else
1481 uint64_t rml_rto:1;
1482 uint64_t rml_wto:1;
1483 uint64_t pci_rsl:1;
1484 uint64_t po0_2sml:1;
1485 uint64_t po1_2sml:1;
1486 uint64_t po2_2sml:1;
1487 uint64_t po3_2sml:1;
1488 uint64_t i0_rtout:1;
1489 uint64_t i1_rtout:1;
1490 uint64_t i2_rtout:1;
1491 uint64_t i3_rtout:1;
1492 uint64_t i0_overf:1;
1493 uint64_t i1_overf:1;
1494 uint64_t i2_overf:1;
1495 uint64_t i3_overf:1;
1496 uint64_t p0_rtout:1;
1497 uint64_t p1_rtout:1;
1498 uint64_t p2_rtout:1;
1499 uint64_t p3_rtout:1;
1500 uint64_t p0_perr:1;
1501 uint64_t p1_perr:1;
1502 uint64_t p2_perr:1;
1503 uint64_t p3_perr:1;
1504 uint64_t g0_rtout:1;
1505 uint64_t g1_rtout:1;
1506 uint64_t g2_rtout:1;
1507 uint64_t g3_rtout:1;
1508 uint64_t p0_pperr:1;
1509 uint64_t p1_pperr:1;
1510 uint64_t p2_pperr:1;
1511 uint64_t p3_pperr:1;
1512 uint64_t p0_ptout:1;
1513 uint64_t p1_ptout:1;
1514 uint64_t p2_ptout:1;
1515 uint64_t p3_ptout:1;
1516 uint64_t i0_pperr:1;
1517 uint64_t i1_pperr:1;
1518 uint64_t i2_pperr:1;
1519 uint64_t i3_pperr:1;
1520 uint64_t win_rto:1;
1521 uint64_t p_dperr:1;
1522 uint64_t iobdma:1;
1523 uint64_t reserved_42_63:22;
1524#endif
1525 } cn38xxp2;
1526};
1527
1528union cvmx_npi_lowp_dbell {
1529 uint64_t u64;
1530 struct cvmx_npi_lowp_dbell_s {
1531#ifdef __BIG_ENDIAN_BITFIELD
1532 uint64_t reserved_16_63:48;
1533 uint64_t dbell:16;
1534#else
1535 uint64_t dbell:16;
1536 uint64_t reserved_16_63:48;
1537#endif
1538 } s;
1539};
1540
1541union cvmx_npi_lowp_ibuff_saddr {
1542 uint64_t u64;
1543 struct cvmx_npi_lowp_ibuff_saddr_s {
1544#ifdef __BIG_ENDIAN_BITFIELD
1545 uint64_t reserved_36_63:28;
1546 uint64_t saddr:36;
1547#else
1548 uint64_t saddr:36;
1549 uint64_t reserved_36_63:28;
1550#endif
1551 } s;
1552};
1553
1554union cvmx_npi_mem_access_subidx {
1555 uint64_t u64;
1556 struct cvmx_npi_mem_access_subidx_s {
1557#ifdef __BIG_ENDIAN_BITFIELD
1558 uint64_t reserved_38_63:26;
1559 uint64_t shortl:1;
1560 uint64_t nmerge:1;
1561 uint64_t esr:2;
1562 uint64_t esw:2;
1563 uint64_t nsr:1;
1564 uint64_t nsw:1;
1565 uint64_t ror:1;
1566 uint64_t row:1;
1567 uint64_t ba:28;
1568#else
1569 uint64_t ba:28;
1570 uint64_t row:1;
1571 uint64_t ror:1;
1572 uint64_t nsw:1;
1573 uint64_t nsr:1;
1574 uint64_t esw:2;
1575 uint64_t esr:2;
1576 uint64_t nmerge:1;
1577 uint64_t shortl:1;
1578 uint64_t reserved_38_63:26;
1579#endif
1580 } s;
1581 struct cvmx_npi_mem_access_subidx_cn31xx {
1582#ifdef __BIG_ENDIAN_BITFIELD
1583 uint64_t reserved_36_63:28;
1584 uint64_t esr:2;
1585 uint64_t esw:2;
1586 uint64_t nsr:1;
1587 uint64_t nsw:1;
1588 uint64_t ror:1;
1589 uint64_t row:1;
1590 uint64_t ba:28;
1591#else
1592 uint64_t ba:28;
1593 uint64_t row:1;
1594 uint64_t ror:1;
1595 uint64_t nsw:1;
1596 uint64_t nsr:1;
1597 uint64_t esw:2;
1598 uint64_t esr:2;
1599 uint64_t reserved_36_63:28;
1600#endif
1601 } cn31xx;
1602};
1603
1604union cvmx_npi_msi_rcv {
1605 uint64_t u64;
1606 struct cvmx_npi_msi_rcv_s {
1607#ifdef __BIG_ENDIAN_BITFIELD
1608 uint64_t int_vec:64;
1609#else
1610 uint64_t int_vec:64;
1611#endif
1612 } s;
1613};
1614
1615union cvmx_npi_num_desc_outputx {
1616 uint64_t u64;
1617 struct cvmx_npi_num_desc_outputx_s {
1618#ifdef __BIG_ENDIAN_BITFIELD
1619 uint64_t reserved_32_63:32;
1620 uint64_t size:32;
1621#else
1622 uint64_t size:32;
1623 uint64_t reserved_32_63:32;
1624#endif
1625 } s;
1626};
1627
1628union cvmx_npi_output_control {
1629 uint64_t u64;
1630 struct cvmx_npi_output_control_s {
1631#ifdef __BIG_ENDIAN_BITFIELD
1632 uint64_t reserved_49_63:15;
1633 uint64_t pkt_rr:1;
1634 uint64_t p3_bmode:1;
1635 uint64_t p2_bmode:1;
1636 uint64_t p1_bmode:1;
1637 uint64_t p0_bmode:1;
1638 uint64_t o3_es:2;
1639 uint64_t o3_ns:1;
1640 uint64_t o3_ro:1;
1641 uint64_t o2_es:2;
1642 uint64_t o2_ns:1;
1643 uint64_t o2_ro:1;
1644 uint64_t o1_es:2;
1645 uint64_t o1_ns:1;
1646 uint64_t o1_ro:1;
1647 uint64_t o0_es:2;
1648 uint64_t o0_ns:1;
1649 uint64_t o0_ro:1;
1650 uint64_t o3_csrm:1;
1651 uint64_t o2_csrm:1;
1652 uint64_t o1_csrm:1;
1653 uint64_t o0_csrm:1;
1654 uint64_t reserved_20_23:4;
1655 uint64_t iptr_o3:1;
1656 uint64_t iptr_o2:1;
1657 uint64_t iptr_o1:1;
1658 uint64_t iptr_o0:1;
1659 uint64_t esr_sl3:2;
1660 uint64_t nsr_sl3:1;
1661 uint64_t ror_sl3:1;
1662 uint64_t esr_sl2:2;
1663 uint64_t nsr_sl2:1;
1664 uint64_t ror_sl2:1;
1665 uint64_t esr_sl1:2;
1666 uint64_t nsr_sl1:1;
1667 uint64_t ror_sl1:1;
1668 uint64_t esr_sl0:2;
1669 uint64_t nsr_sl0:1;
1670 uint64_t ror_sl0:1;
1671#else
1672 uint64_t ror_sl0:1;
1673 uint64_t nsr_sl0:1;
1674 uint64_t esr_sl0:2;
1675 uint64_t ror_sl1:1;
1676 uint64_t nsr_sl1:1;
1677 uint64_t esr_sl1:2;
1678 uint64_t ror_sl2:1;
1679 uint64_t nsr_sl2:1;
1680 uint64_t esr_sl2:2;
1681 uint64_t ror_sl3:1;
1682 uint64_t nsr_sl3:1;
1683 uint64_t esr_sl3:2;
1684 uint64_t iptr_o0:1;
1685 uint64_t iptr_o1:1;
1686 uint64_t iptr_o2:1;
1687 uint64_t iptr_o3:1;
1688 uint64_t reserved_20_23:4;
1689 uint64_t o0_csrm:1;
1690 uint64_t o1_csrm:1;
1691 uint64_t o2_csrm:1;
1692 uint64_t o3_csrm:1;
1693 uint64_t o0_ro:1;
1694 uint64_t o0_ns:1;
1695 uint64_t o0_es:2;
1696 uint64_t o1_ro:1;
1697 uint64_t o1_ns:1;
1698 uint64_t o1_es:2;
1699 uint64_t o2_ro:1;
1700 uint64_t o2_ns:1;
1701 uint64_t o2_es:2;
1702 uint64_t o3_ro:1;
1703 uint64_t o3_ns:1;
1704 uint64_t o3_es:2;
1705 uint64_t p0_bmode:1;
1706 uint64_t p1_bmode:1;
1707 uint64_t p2_bmode:1;
1708 uint64_t p3_bmode:1;
1709 uint64_t pkt_rr:1;
1710 uint64_t reserved_49_63:15;
1711#endif
1712 } s;
1713 struct cvmx_npi_output_control_cn30xx {
1714#ifdef __BIG_ENDIAN_BITFIELD
1715 uint64_t reserved_45_63:19;
1716 uint64_t p0_bmode:1;
1717 uint64_t reserved_32_43:12;
1718 uint64_t o0_es:2;
1719 uint64_t o0_ns:1;
1720 uint64_t o0_ro:1;
1721 uint64_t reserved_25_27:3;
1722 uint64_t o0_csrm:1;
1723 uint64_t reserved_17_23:7;
1724 uint64_t iptr_o0:1;
1725 uint64_t reserved_4_15:12;
1726 uint64_t esr_sl0:2;
1727 uint64_t nsr_sl0:1;
1728 uint64_t ror_sl0:1;
1729#else
1730 uint64_t ror_sl0:1;
1731 uint64_t nsr_sl0:1;
1732 uint64_t esr_sl0:2;
1733 uint64_t reserved_4_15:12;
1734 uint64_t iptr_o0:1;
1735 uint64_t reserved_17_23:7;
1736 uint64_t o0_csrm:1;
1737 uint64_t reserved_25_27:3;
1738 uint64_t o0_ro:1;
1739 uint64_t o0_ns:1;
1740 uint64_t o0_es:2;
1741 uint64_t reserved_32_43:12;
1742 uint64_t p0_bmode:1;
1743 uint64_t reserved_45_63:19;
1744#endif
1745 } cn30xx;
1746 struct cvmx_npi_output_control_cn31xx {
1747#ifdef __BIG_ENDIAN_BITFIELD
1748 uint64_t reserved_46_63:18;
1749 uint64_t p1_bmode:1;
1750 uint64_t p0_bmode:1;
1751 uint64_t reserved_36_43:8;
1752 uint64_t o1_es:2;
1753 uint64_t o1_ns:1;
1754 uint64_t o1_ro:1;
1755 uint64_t o0_es:2;
1756 uint64_t o0_ns:1;
1757 uint64_t o0_ro:1;
1758 uint64_t reserved_26_27:2;
1759 uint64_t o1_csrm:1;
1760 uint64_t o0_csrm:1;
1761 uint64_t reserved_18_23:6;
1762 uint64_t iptr_o1:1;
1763 uint64_t iptr_o0:1;
1764 uint64_t reserved_8_15:8;
1765 uint64_t esr_sl1:2;
1766 uint64_t nsr_sl1:1;
1767 uint64_t ror_sl1:1;
1768 uint64_t esr_sl0:2;
1769 uint64_t nsr_sl0:1;
1770 uint64_t ror_sl0:1;
1771#else
1772 uint64_t ror_sl0:1;
1773 uint64_t nsr_sl0:1;
1774 uint64_t esr_sl0:2;
1775 uint64_t ror_sl1:1;
1776 uint64_t nsr_sl1:1;
1777 uint64_t esr_sl1:2;
1778 uint64_t reserved_8_15:8;
1779 uint64_t iptr_o0:1;
1780 uint64_t iptr_o1:1;
1781 uint64_t reserved_18_23:6;
1782 uint64_t o0_csrm:1;
1783 uint64_t o1_csrm:1;
1784 uint64_t reserved_26_27:2;
1785 uint64_t o0_ro:1;
1786 uint64_t o0_ns:1;
1787 uint64_t o0_es:2;
1788 uint64_t o1_ro:1;
1789 uint64_t o1_ns:1;
1790 uint64_t o1_es:2;
1791 uint64_t reserved_36_43:8;
1792 uint64_t p0_bmode:1;
1793 uint64_t p1_bmode:1;
1794 uint64_t reserved_46_63:18;
1795#endif
1796 } cn31xx;
1797 struct cvmx_npi_output_control_cn38xxp2 {
1798#ifdef __BIG_ENDIAN_BITFIELD
1799 uint64_t reserved_48_63:16;
1800 uint64_t p3_bmode:1;
1801 uint64_t p2_bmode:1;
1802 uint64_t p1_bmode:1;
1803 uint64_t p0_bmode:1;
1804 uint64_t o3_es:2;
1805 uint64_t o3_ns:1;
1806 uint64_t o3_ro:1;
1807 uint64_t o2_es:2;
1808 uint64_t o2_ns:1;
1809 uint64_t o2_ro:1;
1810 uint64_t o1_es:2;
1811 uint64_t o1_ns:1;
1812 uint64_t o1_ro:1;
1813 uint64_t o0_es:2;
1814 uint64_t o0_ns:1;
1815 uint64_t o0_ro:1;
1816 uint64_t o3_csrm:1;
1817 uint64_t o2_csrm:1;
1818 uint64_t o1_csrm:1;
1819 uint64_t o0_csrm:1;
1820 uint64_t reserved_20_23:4;
1821 uint64_t iptr_o3:1;
1822 uint64_t iptr_o2:1;
1823 uint64_t iptr_o1:1;
1824 uint64_t iptr_o0:1;
1825 uint64_t esr_sl3:2;
1826 uint64_t nsr_sl3:1;
1827 uint64_t ror_sl3:1;
1828 uint64_t esr_sl2:2;
1829 uint64_t nsr_sl2:1;
1830 uint64_t ror_sl2:1;
1831 uint64_t esr_sl1:2;
1832 uint64_t nsr_sl1:1;
1833 uint64_t ror_sl1:1;
1834 uint64_t esr_sl0:2;
1835 uint64_t nsr_sl0:1;
1836 uint64_t ror_sl0:1;
1837#else
1838 uint64_t ror_sl0:1;
1839 uint64_t nsr_sl0:1;
1840 uint64_t esr_sl0:2;
1841 uint64_t ror_sl1:1;
1842 uint64_t nsr_sl1:1;
1843 uint64_t esr_sl1:2;
1844 uint64_t ror_sl2:1;
1845 uint64_t nsr_sl2:1;
1846 uint64_t esr_sl2:2;
1847 uint64_t ror_sl3:1;
1848 uint64_t nsr_sl3:1;
1849 uint64_t esr_sl3:2;
1850 uint64_t iptr_o0:1;
1851 uint64_t iptr_o1:1;
1852 uint64_t iptr_o2:1;
1853 uint64_t iptr_o3:1;
1854 uint64_t reserved_20_23:4;
1855 uint64_t o0_csrm:1;
1856 uint64_t o1_csrm:1;
1857 uint64_t o2_csrm:1;
1858 uint64_t o3_csrm:1;
1859 uint64_t o0_ro:1;
1860 uint64_t o0_ns:1;
1861 uint64_t o0_es:2;
1862 uint64_t o1_ro:1;
1863 uint64_t o1_ns:1;
1864 uint64_t o1_es:2;
1865 uint64_t o2_ro:1;
1866 uint64_t o2_ns:1;
1867 uint64_t o2_es:2;
1868 uint64_t o3_ro:1;
1869 uint64_t o3_ns:1;
1870 uint64_t o3_es:2;
1871 uint64_t p0_bmode:1;
1872 uint64_t p1_bmode:1;
1873 uint64_t p2_bmode:1;
1874 uint64_t p3_bmode:1;
1875 uint64_t reserved_48_63:16;
1876#endif
1877 } cn38xxp2;
1878 struct cvmx_npi_output_control_cn50xx {
1879#ifdef __BIG_ENDIAN_BITFIELD
1880 uint64_t reserved_49_63:15;
1881 uint64_t pkt_rr:1;
1882 uint64_t reserved_46_47:2;
1883 uint64_t p1_bmode:1;
1884 uint64_t p0_bmode:1;
1885 uint64_t reserved_36_43:8;
1886 uint64_t o1_es:2;
1887 uint64_t o1_ns:1;
1888 uint64_t o1_ro:1;
1889 uint64_t o0_es:2;
1890 uint64_t o0_ns:1;
1891 uint64_t o0_ro:1;
1892 uint64_t reserved_26_27:2;
1893 uint64_t o1_csrm:1;
1894 uint64_t o0_csrm:1;
1895 uint64_t reserved_18_23:6;
1896 uint64_t iptr_o1:1;
1897 uint64_t iptr_o0:1;
1898 uint64_t reserved_8_15:8;
1899 uint64_t esr_sl1:2;
1900 uint64_t nsr_sl1:1;
1901 uint64_t ror_sl1:1;
1902 uint64_t esr_sl0:2;
1903 uint64_t nsr_sl0:1;
1904 uint64_t ror_sl0:1;
1905#else
1906 uint64_t ror_sl0:1;
1907 uint64_t nsr_sl0:1;
1908 uint64_t esr_sl0:2;
1909 uint64_t ror_sl1:1;
1910 uint64_t nsr_sl1:1;
1911 uint64_t esr_sl1:2;
1912 uint64_t reserved_8_15:8;
1913 uint64_t iptr_o0:1;
1914 uint64_t iptr_o1:1;
1915 uint64_t reserved_18_23:6;
1916 uint64_t o0_csrm:1;
1917 uint64_t o1_csrm:1;
1918 uint64_t reserved_26_27:2;
1919 uint64_t o0_ro:1;
1920 uint64_t o0_ns:1;
1921 uint64_t o0_es:2;
1922 uint64_t o1_ro:1;
1923 uint64_t o1_ns:1;
1924 uint64_t o1_es:2;
1925 uint64_t reserved_36_43:8;
1926 uint64_t p0_bmode:1;
1927 uint64_t p1_bmode:1;
1928 uint64_t reserved_46_47:2;
1929 uint64_t pkt_rr:1;
1930 uint64_t reserved_49_63:15;
1931#endif
1932 } cn50xx;
1933};
1934
1935union cvmx_npi_px_dbpair_addr {
1936 uint64_t u64;
1937 struct cvmx_npi_px_dbpair_addr_s {
1938#ifdef __BIG_ENDIAN_BITFIELD
1939 uint64_t reserved_63_63:1;
1940 uint64_t state:2;
1941 uint64_t naddr:61;
1942#else
1943 uint64_t naddr:61;
1944 uint64_t state:2;
1945 uint64_t reserved_63_63:1;
1946#endif
1947 } s;
1948};
1949
1950union cvmx_npi_px_instr_addr {
1951 uint64_t u64;
1952 struct cvmx_npi_px_instr_addr_s {
1953#ifdef __BIG_ENDIAN_BITFIELD
1954 uint64_t state:3;
1955 uint64_t naddr:61;
1956#else
1957 uint64_t naddr:61;
1958 uint64_t state:3;
1959#endif
1960 } s;
1961};
1962
1963union cvmx_npi_px_instr_cnts {
1964 uint64_t u64;
1965 struct cvmx_npi_px_instr_cnts_s {
1966#ifdef __BIG_ENDIAN_BITFIELD
1967 uint64_t reserved_38_63:26;
1968 uint64_t fcnt:6;
1969 uint64_t avail:32;
1970#else
1971 uint64_t avail:32;
1972 uint64_t fcnt:6;
1973 uint64_t reserved_38_63:26;
1974#endif
1975 } s;
1976};
1977
1978union cvmx_npi_px_pair_cnts {
1979 uint64_t u64;
1980 struct cvmx_npi_px_pair_cnts_s {
1981#ifdef __BIG_ENDIAN_BITFIELD
1982 uint64_t reserved_37_63:27;
1983 uint64_t fcnt:5;
1984 uint64_t avail:32;
1985#else
1986 uint64_t avail:32;
1987 uint64_t fcnt:5;
1988 uint64_t reserved_37_63:27;
1989#endif
1990 } s;
1991};
1992
1993union cvmx_npi_pci_burst_size {
1994 uint64_t u64;
1995 struct cvmx_npi_pci_burst_size_s {
1996#ifdef __BIG_ENDIAN_BITFIELD
1997 uint64_t reserved_14_63:50;
1998 uint64_t wr_brst:7;
1999 uint64_t rd_brst:7;
2000#else
2001 uint64_t rd_brst:7;
2002 uint64_t wr_brst:7;
2003 uint64_t reserved_14_63:50;
2004#endif
2005 } s;
2006};
2007
2008union cvmx_npi_pci_int_arb_cfg {
2009 uint64_t u64;
2010 struct cvmx_npi_pci_int_arb_cfg_s {
2011#ifdef __BIG_ENDIAN_BITFIELD
2012 uint64_t reserved_13_63:51;
2013 uint64_t hostmode:1;
2014 uint64_t pci_ovr:4;
2015 uint64_t reserved_5_7:3;
2016 uint64_t en:1;
2017 uint64_t park_mod:1;
2018 uint64_t park_dev:3;
2019#else
2020 uint64_t park_dev:3;
2021 uint64_t park_mod:1;
2022 uint64_t en:1;
2023 uint64_t reserved_5_7:3;
2024 uint64_t pci_ovr:4;
2025 uint64_t hostmode:1;
2026 uint64_t reserved_13_63:51;
2027#endif
2028 } s;
2029 struct cvmx_npi_pci_int_arb_cfg_cn30xx {
2030#ifdef __BIG_ENDIAN_BITFIELD
2031 uint64_t reserved_5_63:59;
2032 uint64_t en:1;
2033 uint64_t park_mod:1;
2034 uint64_t park_dev:3;
2035#else
2036 uint64_t park_dev:3;
2037 uint64_t park_mod:1;
2038 uint64_t en:1;
2039 uint64_t reserved_5_63:59;
2040#endif
2041 } cn30xx;
2042};
2043
2044union cvmx_npi_pci_read_cmd {
2045 uint64_t u64;
2046 struct cvmx_npi_pci_read_cmd_s {
2047#ifdef __BIG_ENDIAN_BITFIELD
2048 uint64_t reserved_11_63:53;
2049 uint64_t cmd_size:11;
2050#else
2051 uint64_t cmd_size:11;
2052 uint64_t reserved_11_63:53;
2053#endif
2054 } s;
2055};
2056
2057union cvmx_npi_port32_instr_hdr {
2058 uint64_t u64;
2059 struct cvmx_npi_port32_instr_hdr_s {
2060#ifdef __BIG_ENDIAN_BITFIELD
2061 uint64_t reserved_44_63:20;
2062 uint64_t pbp:1;
2063 uint64_t rsv_f:5;
2064 uint64_t rparmode:2;
2065 uint64_t rsv_e:1;
2066 uint64_t rskp_len:7;
2067 uint64_t rsv_d:6;
2068 uint64_t use_ihdr:1;
2069 uint64_t rsv_c:5;
2070 uint64_t par_mode:2;
2071 uint64_t rsv_b:1;
2072 uint64_t skp_len:7;
2073 uint64_t rsv_a:6;
2074#else
2075 uint64_t rsv_a:6;
2076 uint64_t skp_len:7;
2077 uint64_t rsv_b:1;
2078 uint64_t par_mode:2;
2079 uint64_t rsv_c:5;
2080 uint64_t use_ihdr:1;
2081 uint64_t rsv_d:6;
2082 uint64_t rskp_len:7;
2083 uint64_t rsv_e:1;
2084 uint64_t rparmode:2;
2085 uint64_t rsv_f:5;
2086 uint64_t pbp:1;
2087 uint64_t reserved_44_63:20;
2088#endif
2089 } s;
2090};
2091
2092union cvmx_npi_port33_instr_hdr {
2093 uint64_t u64;
2094 struct cvmx_npi_port33_instr_hdr_s {
2095#ifdef __BIG_ENDIAN_BITFIELD
2096 uint64_t reserved_44_63:20;
2097 uint64_t pbp:1;
2098 uint64_t rsv_f:5;
2099 uint64_t rparmode:2;
2100 uint64_t rsv_e:1;
2101 uint64_t rskp_len:7;
2102 uint64_t rsv_d:6;
2103 uint64_t use_ihdr:1;
2104 uint64_t rsv_c:5;
2105 uint64_t par_mode:2;
2106 uint64_t rsv_b:1;
2107 uint64_t skp_len:7;
2108 uint64_t rsv_a:6;
2109#else
2110 uint64_t rsv_a:6;
2111 uint64_t skp_len:7;
2112 uint64_t rsv_b:1;
2113 uint64_t par_mode:2;
2114 uint64_t rsv_c:5;
2115 uint64_t use_ihdr:1;
2116 uint64_t rsv_d:6;
2117 uint64_t rskp_len:7;
2118 uint64_t rsv_e:1;
2119 uint64_t rparmode:2;
2120 uint64_t rsv_f:5;
2121 uint64_t pbp:1;
2122 uint64_t reserved_44_63:20;
2123#endif
2124 } s;
2125};
2126
2127union cvmx_npi_port34_instr_hdr {
2128 uint64_t u64;
2129 struct cvmx_npi_port34_instr_hdr_s {
2130#ifdef __BIG_ENDIAN_BITFIELD
2131 uint64_t reserved_44_63:20;
2132 uint64_t pbp:1;
2133 uint64_t rsv_f:5;
2134 uint64_t rparmode:2;
2135 uint64_t rsv_e:1;
2136 uint64_t rskp_len:7;
2137 uint64_t rsv_d:6;
2138 uint64_t use_ihdr:1;
2139 uint64_t rsv_c:5;
2140 uint64_t par_mode:2;
2141 uint64_t rsv_b:1;
2142 uint64_t skp_len:7;
2143 uint64_t rsv_a:6;
2144#else
2145 uint64_t rsv_a:6;
2146 uint64_t skp_len:7;
2147 uint64_t rsv_b:1;
2148 uint64_t par_mode:2;
2149 uint64_t rsv_c:5;
2150 uint64_t use_ihdr:1;
2151 uint64_t rsv_d:6;
2152 uint64_t rskp_len:7;
2153 uint64_t rsv_e:1;
2154 uint64_t rparmode:2;
2155 uint64_t rsv_f:5;
2156 uint64_t pbp:1;
2157 uint64_t reserved_44_63:20;
2158#endif
2159 } s;
2160};
2161
2162union cvmx_npi_port35_instr_hdr {
2163 uint64_t u64;
2164 struct cvmx_npi_port35_instr_hdr_s {
2165#ifdef __BIG_ENDIAN_BITFIELD
2166 uint64_t reserved_44_63:20;
2167 uint64_t pbp:1;
2168 uint64_t rsv_f:5;
2169 uint64_t rparmode:2;
2170 uint64_t rsv_e:1;
2171 uint64_t rskp_len:7;
2172 uint64_t rsv_d:6;
2173 uint64_t use_ihdr:1;
2174 uint64_t rsv_c:5;
2175 uint64_t par_mode:2;
2176 uint64_t rsv_b:1;
2177 uint64_t skp_len:7;
2178 uint64_t rsv_a:6;
2179#else
2180 uint64_t rsv_a:6;
2181 uint64_t skp_len:7;
2182 uint64_t rsv_b:1;
2183 uint64_t par_mode:2;
2184 uint64_t rsv_c:5;
2185 uint64_t use_ihdr:1;
2186 uint64_t rsv_d:6;
2187 uint64_t rskp_len:7;
2188 uint64_t rsv_e:1;
2189 uint64_t rparmode:2;
2190 uint64_t rsv_f:5;
2191 uint64_t pbp:1;
2192 uint64_t reserved_44_63:20;
2193#endif
2194 } s;
2195};
2196
2197union cvmx_npi_port_bp_control {
2198 uint64_t u64;
2199 struct cvmx_npi_port_bp_control_s {
2200#ifdef __BIG_ENDIAN_BITFIELD
2201 uint64_t reserved_8_63:56;
2202 uint64_t bp_on:4;
2203 uint64_t enb:4;
2204#else
2205 uint64_t enb:4;
2206 uint64_t bp_on:4;
2207 uint64_t reserved_8_63:56;
2208#endif
2209 } s;
2210};
2211
2212union cvmx_npi_rsl_int_blocks {
2213 uint64_t u64;
2214 struct cvmx_npi_rsl_int_blocks_s {
2215#ifdef __BIG_ENDIAN_BITFIELD
2216 uint64_t reserved_32_63:32;
2217 uint64_t rint_31:1;
2218 uint64_t iob:1;
2219 uint64_t reserved_28_29:2;
2220 uint64_t rint_27:1;
2221 uint64_t rint_26:1;
2222 uint64_t rint_25:1;
2223 uint64_t rint_24:1;
2224 uint64_t asx1:1;
2225 uint64_t asx0:1;
2226 uint64_t rint_21:1;
2227 uint64_t pip:1;
2228 uint64_t spx1:1;
2229 uint64_t spx0:1;
2230 uint64_t lmc:1;
2231 uint64_t l2c:1;
2232 uint64_t rint_15:1;
2233 uint64_t reserved_13_14:2;
2234 uint64_t pow:1;
2235 uint64_t tim:1;
2236 uint64_t pko:1;
2237 uint64_t ipd:1;
2238 uint64_t rint_8:1;
2239 uint64_t zip:1;
2240 uint64_t dfa:1;
2241 uint64_t fpa:1;
2242 uint64_t key:1;
2243 uint64_t npi:1;
2244 uint64_t gmx1:1;
2245 uint64_t gmx0:1;
2246 uint64_t mio:1;
2247#else
2248 uint64_t mio:1;
2249 uint64_t gmx0:1;
2250 uint64_t gmx1:1;
2251 uint64_t npi:1;
2252 uint64_t key:1;
2253 uint64_t fpa:1;
2254 uint64_t dfa:1;
2255 uint64_t zip:1;
2256 uint64_t rint_8:1;
2257 uint64_t ipd:1;
2258 uint64_t pko:1;
2259 uint64_t tim:1;
2260 uint64_t pow:1;
2261 uint64_t reserved_13_14:2;
2262 uint64_t rint_15:1;
2263 uint64_t l2c:1;
2264 uint64_t lmc:1;
2265 uint64_t spx0:1;
2266 uint64_t spx1:1;
2267 uint64_t pip:1;
2268 uint64_t rint_21:1;
2269 uint64_t asx0:1;
2270 uint64_t asx1:1;
2271 uint64_t rint_24:1;
2272 uint64_t rint_25:1;
2273 uint64_t rint_26:1;
2274 uint64_t rint_27:1;
2275 uint64_t reserved_28_29:2;
2276 uint64_t iob:1;
2277 uint64_t rint_31:1;
2278 uint64_t reserved_32_63:32;
2279#endif
2280 } s;
2281 struct cvmx_npi_rsl_int_blocks_cn30xx {
2282#ifdef __BIG_ENDIAN_BITFIELD
2283 uint64_t reserved_32_63:32;
2284 uint64_t rint_31:1;
2285 uint64_t iob:1;
2286 uint64_t rint_29:1;
2287 uint64_t rint_28:1;
2288 uint64_t rint_27:1;
2289 uint64_t rint_26:1;
2290 uint64_t rint_25:1;
2291 uint64_t rint_24:1;
2292 uint64_t asx1:1;
2293 uint64_t asx0:1;
2294 uint64_t rint_21:1;
2295 uint64_t pip:1;
2296 uint64_t spx1:1;
2297 uint64_t spx0:1;
2298 uint64_t lmc:1;
2299 uint64_t l2c:1;
2300 uint64_t rint_15:1;
2301 uint64_t rint_14:1;
2302 uint64_t usb:1;
2303 uint64_t pow:1;
2304 uint64_t tim:1;
2305 uint64_t pko:1;
2306 uint64_t ipd:1;
2307 uint64_t rint_8:1;
2308 uint64_t zip:1;
2309 uint64_t dfa:1;
2310 uint64_t fpa:1;
2311 uint64_t key:1;
2312 uint64_t npi:1;
2313 uint64_t gmx1:1;
2314 uint64_t gmx0:1;
2315 uint64_t mio:1;
2316#else
2317 uint64_t mio:1;
2318 uint64_t gmx0:1;
2319 uint64_t gmx1:1;
2320 uint64_t npi:1;
2321 uint64_t key:1;
2322 uint64_t fpa:1;
2323 uint64_t dfa:1;
2324 uint64_t zip:1;
2325 uint64_t rint_8:1;
2326 uint64_t ipd:1;
2327 uint64_t pko:1;
2328 uint64_t tim:1;
2329 uint64_t pow:1;
2330 uint64_t usb:1;
2331 uint64_t rint_14:1;
2332 uint64_t rint_15:1;
2333 uint64_t l2c:1;
2334 uint64_t lmc:1;
2335 uint64_t spx0:1;
2336 uint64_t spx1:1;
2337 uint64_t pip:1;
2338 uint64_t rint_21:1;
2339 uint64_t asx0:1;
2340 uint64_t asx1:1;
2341 uint64_t rint_24:1;
2342 uint64_t rint_25:1;
2343 uint64_t rint_26:1;
2344 uint64_t rint_27:1;
2345 uint64_t rint_28:1;
2346 uint64_t rint_29:1;
2347 uint64_t iob:1;
2348 uint64_t rint_31:1;
2349 uint64_t reserved_32_63:32;
2350#endif
2351 } cn30xx;
2352 struct cvmx_npi_rsl_int_blocks_cn38xx {
2353#ifdef __BIG_ENDIAN_BITFIELD
2354 uint64_t reserved_32_63:32;
2355 uint64_t rint_31:1;
2356 uint64_t iob:1;
2357 uint64_t rint_29:1;
2358 uint64_t rint_28:1;
2359 uint64_t rint_27:1;
2360 uint64_t rint_26:1;
2361 uint64_t rint_25:1;
2362 uint64_t rint_24:1;
2363 uint64_t asx1:1;
2364 uint64_t asx0:1;
2365 uint64_t rint_21:1;
2366 uint64_t pip:1;
2367 uint64_t spx1:1;
2368 uint64_t spx0:1;
2369 uint64_t lmc:1;
2370 uint64_t l2c:1;
2371 uint64_t rint_15:1;
2372 uint64_t rint_14:1;
2373 uint64_t rint_13:1;
2374 uint64_t pow:1;
2375 uint64_t tim:1;
2376 uint64_t pko:1;
2377 uint64_t ipd:1;
2378 uint64_t rint_8:1;
2379 uint64_t zip:1;
2380 uint64_t dfa:1;
2381 uint64_t fpa:1;
2382 uint64_t key:1;
2383 uint64_t npi:1;
2384 uint64_t gmx1:1;
2385 uint64_t gmx0:1;
2386 uint64_t mio:1;
2387#else
2388 uint64_t mio:1;
2389 uint64_t gmx0:1;
2390 uint64_t gmx1:1;
2391 uint64_t npi:1;
2392 uint64_t key:1;
2393 uint64_t fpa:1;
2394 uint64_t dfa:1;
2395 uint64_t zip:1;
2396 uint64_t rint_8:1;
2397 uint64_t ipd:1;
2398 uint64_t pko:1;
2399 uint64_t tim:1;
2400 uint64_t pow:1;
2401 uint64_t rint_13:1;
2402 uint64_t rint_14:1;
2403 uint64_t rint_15:1;
2404 uint64_t l2c:1;
2405 uint64_t lmc:1;
2406 uint64_t spx0:1;
2407 uint64_t spx1:1;
2408 uint64_t pip:1;
2409 uint64_t rint_21:1;
2410 uint64_t asx0:1;
2411 uint64_t asx1:1;
2412 uint64_t rint_24:1;
2413 uint64_t rint_25:1;
2414 uint64_t rint_26:1;
2415 uint64_t rint_27:1;
2416 uint64_t rint_28:1;
2417 uint64_t rint_29:1;
2418 uint64_t iob:1;
2419 uint64_t rint_31:1;
2420 uint64_t reserved_32_63:32;
2421#endif
2422 } cn38xx;
2423 struct cvmx_npi_rsl_int_blocks_cn50xx {
2424#ifdef __BIG_ENDIAN_BITFIELD
2425 uint64_t reserved_31_63:33;
2426 uint64_t iob:1;
2427 uint64_t lmc1:1;
2428 uint64_t agl:1;
2429 uint64_t reserved_24_27:4;
2430 uint64_t asx1:1;
2431 uint64_t asx0:1;
2432 uint64_t reserved_21_21:1;
2433 uint64_t pip:1;
2434 uint64_t spx1:1;
2435 uint64_t spx0:1;
2436 uint64_t lmc:1;
2437 uint64_t l2c:1;
2438 uint64_t reserved_15_15:1;
2439 uint64_t rad:1;
2440 uint64_t usb:1;
2441 uint64_t pow:1;
2442 uint64_t tim:1;
2443 uint64_t pko:1;
2444 uint64_t ipd:1;
2445 uint64_t reserved_8_8:1;
2446 uint64_t zip:1;
2447 uint64_t dfa:1;
2448 uint64_t fpa:1;
2449 uint64_t key:1;
2450 uint64_t npi:1;
2451 uint64_t gmx1:1;
2452 uint64_t gmx0:1;
2453 uint64_t mio:1;
2454#else
2455 uint64_t mio:1;
2456 uint64_t gmx0:1;
2457 uint64_t gmx1:1;
2458 uint64_t npi:1;
2459 uint64_t key:1;
2460 uint64_t fpa:1;
2461 uint64_t dfa:1;
2462 uint64_t zip:1;
2463 uint64_t reserved_8_8:1;
2464 uint64_t ipd:1;
2465 uint64_t pko:1;
2466 uint64_t tim:1;
2467 uint64_t pow:1;
2468 uint64_t usb:1;
2469 uint64_t rad:1;
2470 uint64_t reserved_15_15:1;
2471 uint64_t l2c:1;
2472 uint64_t lmc:1;
2473 uint64_t spx0:1;
2474 uint64_t spx1:1;
2475 uint64_t pip:1;
2476 uint64_t reserved_21_21:1;
2477 uint64_t asx0:1;
2478 uint64_t asx1:1;
2479 uint64_t reserved_24_27:4;
2480 uint64_t agl:1;
2481 uint64_t lmc1:1;
2482 uint64_t iob:1;
2483 uint64_t reserved_31_63:33;
2484#endif
2485 } cn50xx;
2486};
2487
2488union cvmx_npi_size_inputx {
2489 uint64_t u64;
2490 struct cvmx_npi_size_inputx_s {
2491#ifdef __BIG_ENDIAN_BITFIELD
2492 uint64_t reserved_32_63:32;
2493 uint64_t size:32;
2494#else
2495 uint64_t size:32;
2496 uint64_t reserved_32_63:32;
2497#endif
2498 } s;
2499};
2500
2501union cvmx_npi_win_read_to {
2502 uint64_t u64;
2503 struct cvmx_npi_win_read_to_s {
2504#ifdef __BIG_ENDIAN_BITFIELD
2505 uint64_t reserved_32_63:32;
2506 uint64_t time:32;
2507#else
2508 uint64_t time:32;
2509 uint64_t reserved_32_63:32;
2510#endif
2511 } s;
2512};
2513
2514#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-packet.h b/arch/mips/include/asm/octeon/cvmx-packet.h
new file mode 100644
index 000000000..895e93d68
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-packet.h
@@ -0,0 +1,69 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 * Packet buffer defines.
30 */
31
32#ifndef __CVMX_PACKET_H__
33#define __CVMX_PACKET_H__
34
35/**
36 * This structure defines a buffer pointer on Octeon
37 */
38union cvmx_buf_ptr {
39 void *ptr;
40 uint64_t u64;
41 struct {
42#ifdef __BIG_ENDIAN_BITFIELD
43 /* if set, invert the "free" pick of the overall
44 * packet. HW always sets this bit to 0 on inbound
45 * packet */
46 uint64_t i:1;
47
48 /* Indicates the amount to back up to get to the
49 * buffer start in cache lines. In most cases this is
50 * less than one complete cache line, so the value is
51 * zero */
52 uint64_t back:4;
53 /* The pool that the buffer came from / goes to */
54 uint64_t pool:3;
55 /* The size of the segment pointed to by addr (in bytes) */
56 uint64_t size:16;
57 /* Pointer to the first byte of the data, NOT buffer */
58 uint64_t addr:40;
59#else
60 uint64_t addr:40;
61 uint64_t size:16;
62 uint64_t pool:3;
63 uint64_t back:4;
64 uint64_t i:1;
65#endif
66 } s;
67};
68
69#endif /* __CVMX_PACKET_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-pci-defs.h b/arch/mips/include/asm/octeon/cvmx-pci-defs.h
new file mode 100644
index 000000000..be56b693b
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pci-defs.h
@@ -0,0 +1,2037 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_PCI_DEFS_H__
29#define __CVMX_PCI_DEFS_H__
30
31#define CVMX_PCI_BAR1_INDEXX(offset) (0x0000000000000100ull + ((offset) & 31) * 4)
32#define CVMX_PCI_BIST_REG (0x00000000000001C0ull)
33#define CVMX_PCI_CFG00 (0x0000000000000000ull)
34#define CVMX_PCI_CFG01 (0x0000000000000004ull)
35#define CVMX_PCI_CFG02 (0x0000000000000008ull)
36#define CVMX_PCI_CFG03 (0x000000000000000Cull)
37#define CVMX_PCI_CFG04 (0x0000000000000010ull)
38#define CVMX_PCI_CFG05 (0x0000000000000014ull)
39#define CVMX_PCI_CFG06 (0x0000000000000018ull)
40#define CVMX_PCI_CFG07 (0x000000000000001Cull)
41#define CVMX_PCI_CFG08 (0x0000000000000020ull)
42#define CVMX_PCI_CFG09 (0x0000000000000024ull)
43#define CVMX_PCI_CFG10 (0x0000000000000028ull)
44#define CVMX_PCI_CFG11 (0x000000000000002Cull)
45#define CVMX_PCI_CFG12 (0x0000000000000030ull)
46#define CVMX_PCI_CFG13 (0x0000000000000034ull)
47#define CVMX_PCI_CFG15 (0x000000000000003Cull)
48#define CVMX_PCI_CFG16 (0x0000000000000040ull)
49#define CVMX_PCI_CFG17 (0x0000000000000044ull)
50#define CVMX_PCI_CFG18 (0x0000000000000048ull)
51#define CVMX_PCI_CFG19 (0x000000000000004Cull)
52#define CVMX_PCI_CFG20 (0x0000000000000050ull)
53#define CVMX_PCI_CFG21 (0x0000000000000054ull)
54#define CVMX_PCI_CFG22 (0x0000000000000058ull)
55#define CVMX_PCI_CFG56 (0x00000000000000E0ull)
56#define CVMX_PCI_CFG57 (0x00000000000000E4ull)
57#define CVMX_PCI_CFG58 (0x00000000000000E8ull)
58#define CVMX_PCI_CFG59 (0x00000000000000ECull)
59#define CVMX_PCI_CFG60 (0x00000000000000F0ull)
60#define CVMX_PCI_CFG61 (0x00000000000000F4ull)
61#define CVMX_PCI_CFG62 (0x00000000000000F8ull)
62#define CVMX_PCI_CFG63 (0x00000000000000FCull)
63#define CVMX_PCI_CNT_REG (0x00000000000001B8ull)
64#define CVMX_PCI_CTL_STATUS_2 (0x000000000000018Cull)
65#define CVMX_PCI_DBELL_X(offset) (0x0000000000000080ull + ((offset) & 3) * 8)
66#define CVMX_PCI_DMA_CNT0 CVMX_PCI_DMA_CNTX(0)
67#define CVMX_PCI_DMA_CNT1 CVMX_PCI_DMA_CNTX(1)
68#define CVMX_PCI_DMA_CNTX(offset) (0x00000000000000A0ull + ((offset) & 1) * 8)
69#define CVMX_PCI_DMA_INT_LEV0 CVMX_PCI_DMA_INT_LEVX(0)
70#define CVMX_PCI_DMA_INT_LEV1 CVMX_PCI_DMA_INT_LEVX(1)
71#define CVMX_PCI_DMA_INT_LEVX(offset) (0x00000000000000A4ull + ((offset) & 1) * 8)
72#define CVMX_PCI_DMA_TIME0 CVMX_PCI_DMA_TIMEX(0)
73#define CVMX_PCI_DMA_TIME1 CVMX_PCI_DMA_TIMEX(1)
74#define CVMX_PCI_DMA_TIMEX(offset) (0x00000000000000B0ull + ((offset) & 1) * 4)
75#define CVMX_PCI_INSTR_COUNT0 CVMX_PCI_INSTR_COUNTX(0)
76#define CVMX_PCI_INSTR_COUNT1 CVMX_PCI_INSTR_COUNTX(1)
77#define CVMX_PCI_INSTR_COUNT2 CVMX_PCI_INSTR_COUNTX(2)
78#define CVMX_PCI_INSTR_COUNT3 CVMX_PCI_INSTR_COUNTX(3)
79#define CVMX_PCI_INSTR_COUNTX(offset) (0x0000000000000084ull + ((offset) & 3) * 8)
80#define CVMX_PCI_INT_ENB (0x0000000000000038ull)
81#define CVMX_PCI_INT_ENB2 (0x00000000000001A0ull)
82#define CVMX_PCI_INT_SUM (0x0000000000000030ull)
83#define CVMX_PCI_INT_SUM2 (0x0000000000000198ull)
84#define CVMX_PCI_MSI_RCV (0x00000000000000F0ull)
85#define CVMX_PCI_PKTS_SENT0 CVMX_PCI_PKTS_SENTX(0)
86#define CVMX_PCI_PKTS_SENT1 CVMX_PCI_PKTS_SENTX(1)
87#define CVMX_PCI_PKTS_SENT2 CVMX_PCI_PKTS_SENTX(2)
88#define CVMX_PCI_PKTS_SENT3 CVMX_PCI_PKTS_SENTX(3)
89#define CVMX_PCI_PKTS_SENTX(offset) (0x0000000000000040ull + ((offset) & 3) * 16)
90#define CVMX_PCI_PKTS_SENT_INT_LEV0 CVMX_PCI_PKTS_SENT_INT_LEVX(0)
91#define CVMX_PCI_PKTS_SENT_INT_LEV1 CVMX_PCI_PKTS_SENT_INT_LEVX(1)
92#define CVMX_PCI_PKTS_SENT_INT_LEV2 CVMX_PCI_PKTS_SENT_INT_LEVX(2)
93#define CVMX_PCI_PKTS_SENT_INT_LEV3 CVMX_PCI_PKTS_SENT_INT_LEVX(3)
94#define CVMX_PCI_PKTS_SENT_INT_LEVX(offset) (0x0000000000000048ull + ((offset) & 3) * 16)
95#define CVMX_PCI_PKTS_SENT_TIME0 CVMX_PCI_PKTS_SENT_TIMEX(0)
96#define CVMX_PCI_PKTS_SENT_TIME1 CVMX_PCI_PKTS_SENT_TIMEX(1)
97#define CVMX_PCI_PKTS_SENT_TIME2 CVMX_PCI_PKTS_SENT_TIMEX(2)
98#define CVMX_PCI_PKTS_SENT_TIME3 CVMX_PCI_PKTS_SENT_TIMEX(3)
99#define CVMX_PCI_PKTS_SENT_TIMEX(offset) (0x000000000000004Cull + ((offset) & 3) * 16)
100#define CVMX_PCI_PKT_CREDITS0 CVMX_PCI_PKT_CREDITSX(0)
101#define CVMX_PCI_PKT_CREDITS1 CVMX_PCI_PKT_CREDITSX(1)
102#define CVMX_PCI_PKT_CREDITS2 CVMX_PCI_PKT_CREDITSX(2)
103#define CVMX_PCI_PKT_CREDITS3 CVMX_PCI_PKT_CREDITSX(3)
104#define CVMX_PCI_PKT_CREDITSX(offset) (0x0000000000000044ull + ((offset) & 3) * 16)
105#define CVMX_PCI_READ_CMD_6 (0x0000000000000180ull)
106#define CVMX_PCI_READ_CMD_C (0x0000000000000184ull)
107#define CVMX_PCI_READ_CMD_E (0x0000000000000188ull)
108#define CVMX_PCI_READ_TIMEOUT (CVMX_ADD_IO_SEG(0x00011F00000000B0ull))
109#define CVMX_PCI_SCM_REG (0x00000000000001A8ull)
110#define CVMX_PCI_TSR_REG (0x00000000000001B0ull)
111#define CVMX_PCI_WIN_RD_ADDR (0x0000000000000008ull)
112#define CVMX_PCI_WIN_RD_DATA (0x0000000000000020ull)
113#define CVMX_PCI_WIN_WR_ADDR (0x0000000000000000ull)
114#define CVMX_PCI_WIN_WR_DATA (0x0000000000000010ull)
115#define CVMX_PCI_WIN_WR_MASK (0x0000000000000018ull)
116
117union cvmx_pci_bar1_indexx {
118 uint32_t u32;
119 struct cvmx_pci_bar1_indexx_s {
120#ifdef __BIG_ENDIAN_BITFIELD
121 uint32_t reserved_18_31:14;
122 uint32_t addr_idx:14;
123 uint32_t ca:1;
124 uint32_t end_swp:2;
125 uint32_t addr_v:1;
126#else
127 uint32_t addr_v:1;
128 uint32_t end_swp:2;
129 uint32_t ca:1;
130 uint32_t addr_idx:14;
131 uint32_t reserved_18_31:14;
132#endif
133 } s;
134};
135
136union cvmx_pci_bist_reg {
137 uint64_t u64;
138 struct cvmx_pci_bist_reg_s {
139#ifdef __BIG_ENDIAN_BITFIELD
140 uint64_t reserved_10_63:54;
141 uint64_t rsp_bs:1;
142 uint64_t dma0_bs:1;
143 uint64_t cmd0_bs:1;
144 uint64_t cmd_bs:1;
145 uint64_t csr2p_bs:1;
146 uint64_t csrr_bs:1;
147 uint64_t rsp2p_bs:1;
148 uint64_t csr2n_bs:1;
149 uint64_t dat2n_bs:1;
150 uint64_t dbg2n_bs:1;
151#else
152 uint64_t dbg2n_bs:1;
153 uint64_t dat2n_bs:1;
154 uint64_t csr2n_bs:1;
155 uint64_t rsp2p_bs:1;
156 uint64_t csrr_bs:1;
157 uint64_t csr2p_bs:1;
158 uint64_t cmd_bs:1;
159 uint64_t cmd0_bs:1;
160 uint64_t dma0_bs:1;
161 uint64_t rsp_bs:1;
162 uint64_t reserved_10_63:54;
163#endif
164 } s;
165};
166
167union cvmx_pci_cfg00 {
168 uint32_t u32;
169 struct cvmx_pci_cfg00_s {
170#ifdef __BIG_ENDIAN_BITFIELD
171 uint32_t devid:16;
172 uint32_t vendid:16;
173#else
174 uint32_t vendid:16;
175 uint32_t devid:16;
176#endif
177 } s;
178};
179
180union cvmx_pci_cfg01 {
181 uint32_t u32;
182 struct cvmx_pci_cfg01_s {
183#ifdef __BIG_ENDIAN_BITFIELD
184 uint32_t dpe:1;
185 uint32_t sse:1;
186 uint32_t rma:1;
187 uint32_t rta:1;
188 uint32_t sta:1;
189 uint32_t devt:2;
190 uint32_t mdpe:1;
191 uint32_t fbb:1;
192 uint32_t reserved_22_22:1;
193 uint32_t m66:1;
194 uint32_t cle:1;
195 uint32_t i_stat:1;
196 uint32_t reserved_11_18:8;
197 uint32_t i_dis:1;
198 uint32_t fbbe:1;
199 uint32_t see:1;
200 uint32_t ads:1;
201 uint32_t pee:1;
202 uint32_t vps:1;
203 uint32_t mwice:1;
204 uint32_t scse:1;
205 uint32_t me:1;
206 uint32_t msae:1;
207 uint32_t isae:1;
208#else
209 uint32_t isae:1;
210 uint32_t msae:1;
211 uint32_t me:1;
212 uint32_t scse:1;
213 uint32_t mwice:1;
214 uint32_t vps:1;
215 uint32_t pee:1;
216 uint32_t ads:1;
217 uint32_t see:1;
218 uint32_t fbbe:1;
219 uint32_t i_dis:1;
220 uint32_t reserved_11_18:8;
221 uint32_t i_stat:1;
222 uint32_t cle:1;
223 uint32_t m66:1;
224 uint32_t reserved_22_22:1;
225 uint32_t fbb:1;
226 uint32_t mdpe:1;
227 uint32_t devt:2;
228 uint32_t sta:1;
229 uint32_t rta:1;
230 uint32_t rma:1;
231 uint32_t sse:1;
232 uint32_t dpe:1;
233#endif
234 } s;
235};
236
237union cvmx_pci_cfg02 {
238 uint32_t u32;
239 struct cvmx_pci_cfg02_s {
240#ifdef __BIG_ENDIAN_BITFIELD
241 uint32_t cc:24;
242 uint32_t rid:8;
243#else
244 uint32_t rid:8;
245 uint32_t cc:24;
246#endif
247 } s;
248};
249
250union cvmx_pci_cfg03 {
251 uint32_t u32;
252 struct cvmx_pci_cfg03_s {
253#ifdef __BIG_ENDIAN_BITFIELD
254 uint32_t bcap:1;
255 uint32_t brb:1;
256 uint32_t reserved_28_29:2;
257 uint32_t bcod:4;
258 uint32_t ht:8;
259 uint32_t lt:8;
260 uint32_t cls:8;
261#else
262 uint32_t cls:8;
263 uint32_t lt:8;
264 uint32_t ht:8;
265 uint32_t bcod:4;
266 uint32_t reserved_28_29:2;
267 uint32_t brb:1;
268 uint32_t bcap:1;
269#endif
270 } s;
271};
272
273union cvmx_pci_cfg04 {
274 uint32_t u32;
275 struct cvmx_pci_cfg04_s {
276#ifdef __BIG_ENDIAN_BITFIELD
277 uint32_t lbase:20;
278 uint32_t lbasez:8;
279 uint32_t pf:1;
280 uint32_t typ:2;
281 uint32_t mspc:1;
282#else
283 uint32_t mspc:1;
284 uint32_t typ:2;
285 uint32_t pf:1;
286 uint32_t lbasez:8;
287 uint32_t lbase:20;
288#endif
289 } s;
290};
291
292union cvmx_pci_cfg05 {
293 uint32_t u32;
294 struct cvmx_pci_cfg05_s {
295#ifdef __BIG_ENDIAN_BITFIELD
296 uint32_t hbase:32;
297#else
298 uint32_t hbase:32;
299#endif
300 } s;
301};
302
303union cvmx_pci_cfg06 {
304 uint32_t u32;
305 struct cvmx_pci_cfg06_s {
306#ifdef __BIG_ENDIAN_BITFIELD
307 uint32_t lbase:5;
308 uint32_t lbasez:23;
309 uint32_t pf:1;
310 uint32_t typ:2;
311 uint32_t mspc:1;
312#else
313 uint32_t mspc:1;
314 uint32_t typ:2;
315 uint32_t pf:1;
316 uint32_t lbasez:23;
317 uint32_t lbase:5;
318#endif
319 } s;
320};
321
322union cvmx_pci_cfg07 {
323 uint32_t u32;
324 struct cvmx_pci_cfg07_s {
325#ifdef __BIG_ENDIAN_BITFIELD
326 uint32_t hbase:32;
327#else
328 uint32_t hbase:32;
329#endif
330 } s;
331};
332
333union cvmx_pci_cfg08 {
334 uint32_t u32;
335 struct cvmx_pci_cfg08_s {
336#ifdef __BIG_ENDIAN_BITFIELD
337 uint32_t lbasez:28;
338 uint32_t pf:1;
339 uint32_t typ:2;
340 uint32_t mspc:1;
341#else
342 uint32_t mspc:1;
343 uint32_t typ:2;
344 uint32_t pf:1;
345 uint32_t lbasez:28;
346#endif
347 } s;
348};
349
350union cvmx_pci_cfg09 {
351 uint32_t u32;
352 struct cvmx_pci_cfg09_s {
353#ifdef __BIG_ENDIAN_BITFIELD
354 uint32_t hbase:25;
355 uint32_t hbasez:7;
356#else
357 uint32_t hbasez:7;
358 uint32_t hbase:25;
359#endif
360 } s;
361};
362
363union cvmx_pci_cfg10 {
364 uint32_t u32;
365 struct cvmx_pci_cfg10_s {
366#ifdef __BIG_ENDIAN_BITFIELD
367 uint32_t cisp:32;
368#else
369 uint32_t cisp:32;
370#endif
371 } s;
372};
373
374union cvmx_pci_cfg11 {
375 uint32_t u32;
376 struct cvmx_pci_cfg11_s {
377#ifdef __BIG_ENDIAN_BITFIELD
378 uint32_t ssid:16;
379 uint32_t ssvid:16;
380#else
381 uint32_t ssvid:16;
382 uint32_t ssid:16;
383#endif
384 } s;
385};
386
387union cvmx_pci_cfg12 {
388 uint32_t u32;
389 struct cvmx_pci_cfg12_s {
390#ifdef __BIG_ENDIAN_BITFIELD
391 uint32_t erbar:16;
392 uint32_t erbarz:5;
393 uint32_t reserved_1_10:10;
394 uint32_t erbar_en:1;
395#else
396 uint32_t erbar_en:1;
397 uint32_t reserved_1_10:10;
398 uint32_t erbarz:5;
399 uint32_t erbar:16;
400#endif
401 } s;
402};
403
404union cvmx_pci_cfg13 {
405 uint32_t u32;
406 struct cvmx_pci_cfg13_s {
407#ifdef __BIG_ENDIAN_BITFIELD
408 uint32_t reserved_8_31:24;
409 uint32_t cp:8;
410#else
411 uint32_t cp:8;
412 uint32_t reserved_8_31:24;
413#endif
414 } s;
415};
416
417union cvmx_pci_cfg15 {
418 uint32_t u32;
419 struct cvmx_pci_cfg15_s {
420#ifdef __BIG_ENDIAN_BITFIELD
421 uint32_t ml:8;
422 uint32_t mg:8;
423 uint32_t inta:8;
424 uint32_t il:8;
425#else
426 uint32_t il:8;
427 uint32_t inta:8;
428 uint32_t mg:8;
429 uint32_t ml:8;
430#endif
431 } s;
432};
433
434union cvmx_pci_cfg16 {
435 uint32_t u32;
436 struct cvmx_pci_cfg16_s {
437#ifdef __BIG_ENDIAN_BITFIELD
438 uint32_t trdnpr:1;
439 uint32_t trdard:1;
440 uint32_t rdsati:1;
441 uint32_t trdrs:1;
442 uint32_t trtae:1;
443 uint32_t twsei:1;
444 uint32_t twsen:1;
445 uint32_t twtae:1;
446 uint32_t tmae:1;
447 uint32_t tslte:3;
448 uint32_t tilt:4;
449 uint32_t pbe:12;
450 uint32_t dppmr:1;
451 uint32_t reserved_2_2:1;
452 uint32_t tswc:1;
453 uint32_t mltd:1;
454#else
455 uint32_t mltd:1;
456 uint32_t tswc:1;
457 uint32_t reserved_2_2:1;
458 uint32_t dppmr:1;
459 uint32_t pbe:12;
460 uint32_t tilt:4;
461 uint32_t tslte:3;
462 uint32_t tmae:1;
463 uint32_t twtae:1;
464 uint32_t twsen:1;
465 uint32_t twsei:1;
466 uint32_t trtae:1;
467 uint32_t trdrs:1;
468 uint32_t rdsati:1;
469 uint32_t trdard:1;
470 uint32_t trdnpr:1;
471#endif
472 } s;
473};
474
475union cvmx_pci_cfg17 {
476 uint32_t u32;
477 struct cvmx_pci_cfg17_s {
478#ifdef __BIG_ENDIAN_BITFIELD
479 uint32_t tscme:32;
480#else
481 uint32_t tscme:32;
482#endif
483 } s;
484};
485
486union cvmx_pci_cfg18 {
487 uint32_t u32;
488 struct cvmx_pci_cfg18_s {
489#ifdef __BIG_ENDIAN_BITFIELD
490 uint32_t tdsrps:32;
491#else
492 uint32_t tdsrps:32;
493#endif
494 } s;
495};
496
497union cvmx_pci_cfg19 {
498 uint32_t u32;
499 struct cvmx_pci_cfg19_s {
500#ifdef __BIG_ENDIAN_BITFIELD
501 uint32_t mrbcm:1;
502 uint32_t mrbci:1;
503 uint32_t mdwe:1;
504 uint32_t mdre:1;
505 uint32_t mdrimc:1;
506 uint32_t mdrrmc:3;
507 uint32_t tmes:8;
508 uint32_t teci:1;
509 uint32_t tmei:1;
510 uint32_t tmse:1;
511 uint32_t tmdpes:1;
512 uint32_t tmapes:1;
513 uint32_t reserved_9_10:2;
514 uint32_t tibcd:1;
515 uint32_t tibde:1;
516 uint32_t reserved_6_6:1;
517 uint32_t tidomc:1;
518 uint32_t tdomc:5;
519#else
520 uint32_t tdomc:5;
521 uint32_t tidomc:1;
522 uint32_t reserved_6_6:1;
523 uint32_t tibde:1;
524 uint32_t tibcd:1;
525 uint32_t reserved_9_10:2;
526 uint32_t tmapes:1;
527 uint32_t tmdpes:1;
528 uint32_t tmse:1;
529 uint32_t tmei:1;
530 uint32_t teci:1;
531 uint32_t tmes:8;
532 uint32_t mdrrmc:3;
533 uint32_t mdrimc:1;
534 uint32_t mdre:1;
535 uint32_t mdwe:1;
536 uint32_t mrbci:1;
537 uint32_t mrbcm:1;
538#endif
539 } s;
540};
541
542union cvmx_pci_cfg20 {
543 uint32_t u32;
544 struct cvmx_pci_cfg20_s {
545#ifdef __BIG_ENDIAN_BITFIELD
546 uint32_t mdsp:32;
547#else
548 uint32_t mdsp:32;
549#endif
550 } s;
551};
552
553union cvmx_pci_cfg21 {
554 uint32_t u32;
555 struct cvmx_pci_cfg21_s {
556#ifdef __BIG_ENDIAN_BITFIELD
557 uint32_t scmre:32;
558#else
559 uint32_t scmre:32;
560#endif
561 } s;
562};
563
564union cvmx_pci_cfg22 {
565 uint32_t u32;
566 struct cvmx_pci_cfg22_s {
567#ifdef __BIG_ENDIAN_BITFIELD
568 uint32_t mac:7;
569 uint32_t reserved_19_24:6;
570 uint32_t flush:1;
571 uint32_t mra:1;
572 uint32_t mtta:1;
573 uint32_t mrv:8;
574 uint32_t mttv:8;
575#else
576 uint32_t mttv:8;
577 uint32_t mrv:8;
578 uint32_t mtta:1;
579 uint32_t mra:1;
580 uint32_t flush:1;
581 uint32_t reserved_19_24:6;
582 uint32_t mac:7;
583#endif
584 } s;
585};
586
587union cvmx_pci_cfg56 {
588 uint32_t u32;
589 struct cvmx_pci_cfg56_s {
590#ifdef __BIG_ENDIAN_BITFIELD
591 uint32_t reserved_23_31:9;
592 uint32_t most:3;
593 uint32_t mmbc:2;
594 uint32_t roe:1;
595 uint32_t dpere:1;
596 uint32_t ncp:8;
597 uint32_t pxcid:8;
598#else
599 uint32_t pxcid:8;
600 uint32_t ncp:8;
601 uint32_t dpere:1;
602 uint32_t roe:1;
603 uint32_t mmbc:2;
604 uint32_t most:3;
605 uint32_t reserved_23_31:9;
606#endif
607 } s;
608};
609
610union cvmx_pci_cfg57 {
611 uint32_t u32;
612 struct cvmx_pci_cfg57_s {
613#ifdef __BIG_ENDIAN_BITFIELD
614 uint32_t reserved_30_31:2;
615 uint32_t scemr:1;
616 uint32_t mcrsd:3;
617 uint32_t mostd:3;
618 uint32_t mmrbcd:2;
619 uint32_t dc:1;
620 uint32_t usc:1;
621 uint32_t scd:1;
622 uint32_t m133:1;
623 uint32_t w64:1;
624 uint32_t bn:8;
625 uint32_t dn:5;
626 uint32_t fn:3;
627#else
628 uint32_t fn:3;
629 uint32_t dn:5;
630 uint32_t bn:8;
631 uint32_t w64:1;
632 uint32_t m133:1;
633 uint32_t scd:1;
634 uint32_t usc:1;
635 uint32_t dc:1;
636 uint32_t mmrbcd:2;
637 uint32_t mostd:3;
638 uint32_t mcrsd:3;
639 uint32_t scemr:1;
640 uint32_t reserved_30_31:2;
641#endif
642 } s;
643};
644
645union cvmx_pci_cfg58 {
646 uint32_t u32;
647 struct cvmx_pci_cfg58_s {
648#ifdef __BIG_ENDIAN_BITFIELD
649 uint32_t pmes:5;
650 uint32_t d2s:1;
651 uint32_t d1s:1;
652 uint32_t auxc:3;
653 uint32_t dsi:1;
654 uint32_t reserved_20_20:1;
655 uint32_t pmec:1;
656 uint32_t pcimiv:3;
657 uint32_t ncp:8;
658 uint32_t pmcid:8;
659#else
660 uint32_t pmcid:8;
661 uint32_t ncp:8;
662 uint32_t pcimiv:3;
663 uint32_t pmec:1;
664 uint32_t reserved_20_20:1;
665 uint32_t dsi:1;
666 uint32_t auxc:3;
667 uint32_t d1s:1;
668 uint32_t d2s:1;
669 uint32_t pmes:5;
670#endif
671 } s;
672};
673
674union cvmx_pci_cfg59 {
675 uint32_t u32;
676 struct cvmx_pci_cfg59_s {
677#ifdef __BIG_ENDIAN_BITFIELD
678 uint32_t pmdia:8;
679 uint32_t bpccen:1;
680 uint32_t bd3h:1;
681 uint32_t reserved_16_21:6;
682 uint32_t pmess:1;
683 uint32_t pmedsia:2;
684 uint32_t pmds:4;
685 uint32_t pmeens:1;
686 uint32_t reserved_2_7:6;
687 uint32_t ps:2;
688#else
689 uint32_t ps:2;
690 uint32_t reserved_2_7:6;
691 uint32_t pmeens:1;
692 uint32_t pmds:4;
693 uint32_t pmedsia:2;
694 uint32_t pmess:1;
695 uint32_t reserved_16_21:6;
696 uint32_t bd3h:1;
697 uint32_t bpccen:1;
698 uint32_t pmdia:8;
699#endif
700 } s;
701};
702
703union cvmx_pci_cfg60 {
704 uint32_t u32;
705 struct cvmx_pci_cfg60_s {
706#ifdef __BIG_ENDIAN_BITFIELD
707 uint32_t reserved_24_31:8;
708 uint32_t m64:1;
709 uint32_t mme:3;
710 uint32_t mmc:3;
711 uint32_t msien:1;
712 uint32_t ncp:8;
713 uint32_t msicid:8;
714#else
715 uint32_t msicid:8;
716 uint32_t ncp:8;
717 uint32_t msien:1;
718 uint32_t mmc:3;
719 uint32_t mme:3;
720 uint32_t m64:1;
721 uint32_t reserved_24_31:8;
722#endif
723 } s;
724};
725
726union cvmx_pci_cfg61 {
727 uint32_t u32;
728 struct cvmx_pci_cfg61_s {
729#ifdef __BIG_ENDIAN_BITFIELD
730 uint32_t msi31t2:30;
731 uint32_t reserved_0_1:2;
732#else
733 uint32_t reserved_0_1:2;
734 uint32_t msi31t2:30;
735#endif
736 } s;
737};
738
739union cvmx_pci_cfg62 {
740 uint32_t u32;
741 struct cvmx_pci_cfg62_s {
742#ifdef __BIG_ENDIAN_BITFIELD
743 uint32_t msi:32;
744#else
745 uint32_t msi:32;
746#endif
747 } s;
748};
749
750union cvmx_pci_cfg63 {
751 uint32_t u32;
752 struct cvmx_pci_cfg63_s {
753#ifdef __BIG_ENDIAN_BITFIELD
754 uint32_t reserved_16_31:16;
755 uint32_t msimd:16;
756#else
757 uint32_t msimd:16;
758 uint32_t reserved_16_31:16;
759#endif
760 } s;
761};
762
763union cvmx_pci_cnt_reg {
764 uint64_t u64;
765 struct cvmx_pci_cnt_reg_s {
766#ifdef __BIG_ENDIAN_BITFIELD
767 uint64_t reserved_38_63:26;
768 uint64_t hm_pcix:1;
769 uint64_t hm_speed:2;
770 uint64_t ap_pcix:1;
771 uint64_t ap_speed:2;
772 uint64_t pcicnt:32;
773#else
774 uint64_t pcicnt:32;
775 uint64_t ap_speed:2;
776 uint64_t ap_pcix:1;
777 uint64_t hm_speed:2;
778 uint64_t hm_pcix:1;
779 uint64_t reserved_38_63:26;
780#endif
781 } s;
782};
783
784union cvmx_pci_ctl_status_2 {
785 uint32_t u32;
786 struct cvmx_pci_ctl_status_2_s {
787#ifdef __BIG_ENDIAN_BITFIELD
788 uint32_t reserved_29_31:3;
789 uint32_t bb1_hole:3;
790 uint32_t bb1_siz:1;
791 uint32_t bb_ca:1;
792 uint32_t bb_es:2;
793 uint32_t bb1:1;
794 uint32_t bb0:1;
795 uint32_t erst_n:1;
796 uint32_t bar2pres:1;
797 uint32_t scmtyp:1;
798 uint32_t scm:1;
799 uint32_t en_wfilt:1;
800 uint32_t reserved_14_14:1;
801 uint32_t ap_pcix:1;
802 uint32_t ap_64ad:1;
803 uint32_t b12_bist:1;
804 uint32_t pmo_amod:1;
805 uint32_t pmo_fpc:3;
806 uint32_t tsr_hwm:3;
807 uint32_t bar2_enb:1;
808 uint32_t bar2_esx:2;
809 uint32_t bar2_cax:1;
810#else
811 uint32_t bar2_cax:1;
812 uint32_t bar2_esx:2;
813 uint32_t bar2_enb:1;
814 uint32_t tsr_hwm:3;
815 uint32_t pmo_fpc:3;
816 uint32_t pmo_amod:1;
817 uint32_t b12_bist:1;
818 uint32_t ap_64ad:1;
819 uint32_t ap_pcix:1;
820 uint32_t reserved_14_14:1;
821 uint32_t en_wfilt:1;
822 uint32_t scm:1;
823 uint32_t scmtyp:1;
824 uint32_t bar2pres:1;
825 uint32_t erst_n:1;
826 uint32_t bb0:1;
827 uint32_t bb1:1;
828 uint32_t bb_es:2;
829 uint32_t bb_ca:1;
830 uint32_t bb1_siz:1;
831 uint32_t bb1_hole:3;
832 uint32_t reserved_29_31:3;
833#endif
834 } s;
835 struct cvmx_pci_ctl_status_2_cn31xx {
836#ifdef __BIG_ENDIAN_BITFIELD
837 uint32_t reserved_20_31:12;
838 uint32_t erst_n:1;
839 uint32_t bar2pres:1;
840 uint32_t scmtyp:1;
841 uint32_t scm:1;
842 uint32_t en_wfilt:1;
843 uint32_t reserved_14_14:1;
844 uint32_t ap_pcix:1;
845 uint32_t ap_64ad:1;
846 uint32_t b12_bist:1;
847 uint32_t pmo_amod:1;
848 uint32_t pmo_fpc:3;
849 uint32_t tsr_hwm:3;
850 uint32_t bar2_enb:1;
851 uint32_t bar2_esx:2;
852 uint32_t bar2_cax:1;
853#else
854 uint32_t bar2_cax:1;
855 uint32_t bar2_esx:2;
856 uint32_t bar2_enb:1;
857 uint32_t tsr_hwm:3;
858 uint32_t pmo_fpc:3;
859 uint32_t pmo_amod:1;
860 uint32_t b12_bist:1;
861 uint32_t ap_64ad:1;
862 uint32_t ap_pcix:1;
863 uint32_t reserved_14_14:1;
864 uint32_t en_wfilt:1;
865 uint32_t scm:1;
866 uint32_t scmtyp:1;
867 uint32_t bar2pres:1;
868 uint32_t erst_n:1;
869 uint32_t reserved_20_31:12;
870#endif
871 } cn31xx;
872};
873
874union cvmx_pci_dbellx {
875 uint32_t u32;
876 struct cvmx_pci_dbellx_s {
877#ifdef __BIG_ENDIAN_BITFIELD
878 uint32_t reserved_16_31:16;
879 uint32_t inc_val:16;
880#else
881 uint32_t inc_val:16;
882 uint32_t reserved_16_31:16;
883#endif
884 } s;
885};
886
887union cvmx_pci_dma_cntx {
888 uint32_t u32;
889 struct cvmx_pci_dma_cntx_s {
890#ifdef __BIG_ENDIAN_BITFIELD
891 uint32_t dma_cnt:32;
892#else
893 uint32_t dma_cnt:32;
894#endif
895 } s;
896};
897
898union cvmx_pci_dma_int_levx {
899 uint32_t u32;
900 struct cvmx_pci_dma_int_levx_s {
901#ifdef __BIG_ENDIAN_BITFIELD
902 uint32_t pkt_cnt:32;
903#else
904 uint32_t pkt_cnt:32;
905#endif
906 } s;
907};
908
909union cvmx_pci_dma_timex {
910 uint32_t u32;
911 struct cvmx_pci_dma_timex_s {
912#ifdef __BIG_ENDIAN_BITFIELD
913 uint32_t dma_time:32;
914#else
915 uint32_t dma_time:32;
916#endif
917 } s;
918};
919
920union cvmx_pci_instr_countx {
921 uint32_t u32;
922 struct cvmx_pci_instr_countx_s {
923#ifdef __BIG_ENDIAN_BITFIELD
924 uint32_t icnt:32;
925#else
926 uint32_t icnt:32;
927#endif
928 } s;
929};
930
931union cvmx_pci_int_enb {
932 uint64_t u64;
933 struct cvmx_pci_int_enb_s {
934#ifdef __BIG_ENDIAN_BITFIELD
935 uint64_t reserved_34_63:30;
936 uint64_t ill_rd:1;
937 uint64_t ill_wr:1;
938 uint64_t win_wr:1;
939 uint64_t dma1_fi:1;
940 uint64_t dma0_fi:1;
941 uint64_t idtime1:1;
942 uint64_t idtime0:1;
943 uint64_t idcnt1:1;
944 uint64_t idcnt0:1;
945 uint64_t iptime3:1;
946 uint64_t iptime2:1;
947 uint64_t iptime1:1;
948 uint64_t iptime0:1;
949 uint64_t ipcnt3:1;
950 uint64_t ipcnt2:1;
951 uint64_t ipcnt1:1;
952 uint64_t ipcnt0:1;
953 uint64_t irsl_int:1;
954 uint64_t ill_rrd:1;
955 uint64_t ill_rwr:1;
956 uint64_t idperr:1;
957 uint64_t iaperr:1;
958 uint64_t iserr:1;
959 uint64_t itsr_abt:1;
960 uint64_t imsc_msg:1;
961 uint64_t imsi_mabt:1;
962 uint64_t imsi_tabt:1;
963 uint64_t imsi_per:1;
964 uint64_t imr_tto:1;
965 uint64_t imr_abt:1;
966 uint64_t itr_abt:1;
967 uint64_t imr_wtto:1;
968 uint64_t imr_wabt:1;
969 uint64_t itr_wabt:1;
970#else
971 uint64_t itr_wabt:1;
972 uint64_t imr_wabt:1;
973 uint64_t imr_wtto:1;
974 uint64_t itr_abt:1;
975 uint64_t imr_abt:1;
976 uint64_t imr_tto:1;
977 uint64_t imsi_per:1;
978 uint64_t imsi_tabt:1;
979 uint64_t imsi_mabt:1;
980 uint64_t imsc_msg:1;
981 uint64_t itsr_abt:1;
982 uint64_t iserr:1;
983 uint64_t iaperr:1;
984 uint64_t idperr:1;
985 uint64_t ill_rwr:1;
986 uint64_t ill_rrd:1;
987 uint64_t irsl_int:1;
988 uint64_t ipcnt0:1;
989 uint64_t ipcnt1:1;
990 uint64_t ipcnt2:1;
991 uint64_t ipcnt3:1;
992 uint64_t iptime0:1;
993 uint64_t iptime1:1;
994 uint64_t iptime2:1;
995 uint64_t iptime3:1;
996 uint64_t idcnt0:1;
997 uint64_t idcnt1:1;
998 uint64_t idtime0:1;
999 uint64_t idtime1:1;
1000 uint64_t dma0_fi:1;
1001 uint64_t dma1_fi:1;
1002 uint64_t win_wr:1;
1003 uint64_t ill_wr:1;
1004 uint64_t ill_rd:1;
1005 uint64_t reserved_34_63:30;
1006#endif
1007 } s;
1008 struct cvmx_pci_int_enb_cn30xx {
1009#ifdef __BIG_ENDIAN_BITFIELD
1010 uint64_t reserved_34_63:30;
1011 uint64_t ill_rd:1;
1012 uint64_t ill_wr:1;
1013 uint64_t win_wr:1;
1014 uint64_t dma1_fi:1;
1015 uint64_t dma0_fi:1;
1016 uint64_t idtime1:1;
1017 uint64_t idtime0:1;
1018 uint64_t idcnt1:1;
1019 uint64_t idcnt0:1;
1020 uint64_t reserved_22_24:3;
1021 uint64_t iptime0:1;
1022 uint64_t reserved_18_20:3;
1023 uint64_t ipcnt0:1;
1024 uint64_t irsl_int:1;
1025 uint64_t ill_rrd:1;
1026 uint64_t ill_rwr:1;
1027 uint64_t idperr:1;
1028 uint64_t iaperr:1;
1029 uint64_t iserr:1;
1030 uint64_t itsr_abt:1;
1031 uint64_t imsc_msg:1;
1032 uint64_t imsi_mabt:1;
1033 uint64_t imsi_tabt:1;
1034 uint64_t imsi_per:1;
1035 uint64_t imr_tto:1;
1036 uint64_t imr_abt:1;
1037 uint64_t itr_abt:1;
1038 uint64_t imr_wtto:1;
1039 uint64_t imr_wabt:1;
1040 uint64_t itr_wabt:1;
1041#else
1042 uint64_t itr_wabt:1;
1043 uint64_t imr_wabt:1;
1044 uint64_t imr_wtto:1;
1045 uint64_t itr_abt:1;
1046 uint64_t imr_abt:1;
1047 uint64_t imr_tto:1;
1048 uint64_t imsi_per:1;
1049 uint64_t imsi_tabt:1;
1050 uint64_t imsi_mabt:1;
1051 uint64_t imsc_msg:1;
1052 uint64_t itsr_abt:1;
1053 uint64_t iserr:1;
1054 uint64_t iaperr:1;
1055 uint64_t idperr:1;
1056 uint64_t ill_rwr:1;
1057 uint64_t ill_rrd:1;
1058 uint64_t irsl_int:1;
1059 uint64_t ipcnt0:1;
1060 uint64_t reserved_18_20:3;
1061 uint64_t iptime0:1;
1062 uint64_t reserved_22_24:3;
1063 uint64_t idcnt0:1;
1064 uint64_t idcnt1:1;
1065 uint64_t idtime0:1;
1066 uint64_t idtime1:1;
1067 uint64_t dma0_fi:1;
1068 uint64_t dma1_fi:1;
1069 uint64_t win_wr:1;
1070 uint64_t ill_wr:1;
1071 uint64_t ill_rd:1;
1072 uint64_t reserved_34_63:30;
1073#endif
1074 } cn30xx;
1075 struct cvmx_pci_int_enb_cn31xx {
1076#ifdef __BIG_ENDIAN_BITFIELD
1077 uint64_t reserved_34_63:30;
1078 uint64_t ill_rd:1;
1079 uint64_t ill_wr:1;
1080 uint64_t win_wr:1;
1081 uint64_t dma1_fi:1;
1082 uint64_t dma0_fi:1;
1083 uint64_t idtime1:1;
1084 uint64_t idtime0:1;
1085 uint64_t idcnt1:1;
1086 uint64_t idcnt0:1;
1087 uint64_t reserved_23_24:2;
1088 uint64_t iptime1:1;
1089 uint64_t iptime0:1;
1090 uint64_t reserved_19_20:2;
1091 uint64_t ipcnt1:1;
1092 uint64_t ipcnt0:1;
1093 uint64_t irsl_int:1;
1094 uint64_t ill_rrd:1;
1095 uint64_t ill_rwr:1;
1096 uint64_t idperr:1;
1097 uint64_t iaperr:1;
1098 uint64_t iserr:1;
1099 uint64_t itsr_abt:1;
1100 uint64_t imsc_msg:1;
1101 uint64_t imsi_mabt:1;
1102 uint64_t imsi_tabt:1;
1103 uint64_t imsi_per:1;
1104 uint64_t imr_tto:1;
1105 uint64_t imr_abt:1;
1106 uint64_t itr_abt:1;
1107 uint64_t imr_wtto:1;
1108 uint64_t imr_wabt:1;
1109 uint64_t itr_wabt:1;
1110#else
1111 uint64_t itr_wabt:1;
1112 uint64_t imr_wabt:1;
1113 uint64_t imr_wtto:1;
1114 uint64_t itr_abt:1;
1115 uint64_t imr_abt:1;
1116 uint64_t imr_tto:1;
1117 uint64_t imsi_per:1;
1118 uint64_t imsi_tabt:1;
1119 uint64_t imsi_mabt:1;
1120 uint64_t imsc_msg:1;
1121 uint64_t itsr_abt:1;
1122 uint64_t iserr:1;
1123 uint64_t iaperr:1;
1124 uint64_t idperr:1;
1125 uint64_t ill_rwr:1;
1126 uint64_t ill_rrd:1;
1127 uint64_t irsl_int:1;
1128 uint64_t ipcnt0:1;
1129 uint64_t ipcnt1:1;
1130 uint64_t reserved_19_20:2;
1131 uint64_t iptime0:1;
1132 uint64_t iptime1:1;
1133 uint64_t reserved_23_24:2;
1134 uint64_t idcnt0:1;
1135 uint64_t idcnt1:1;
1136 uint64_t idtime0:1;
1137 uint64_t idtime1:1;
1138 uint64_t dma0_fi:1;
1139 uint64_t dma1_fi:1;
1140 uint64_t win_wr:1;
1141 uint64_t ill_wr:1;
1142 uint64_t ill_rd:1;
1143 uint64_t reserved_34_63:30;
1144#endif
1145 } cn31xx;
1146};
1147
1148union cvmx_pci_int_enb2 {
1149 uint64_t u64;
1150 struct cvmx_pci_int_enb2_s {
1151#ifdef __BIG_ENDIAN_BITFIELD
1152 uint64_t reserved_34_63:30;
1153 uint64_t ill_rd:1;
1154 uint64_t ill_wr:1;
1155 uint64_t win_wr:1;
1156 uint64_t dma1_fi:1;
1157 uint64_t dma0_fi:1;
1158 uint64_t rdtime1:1;
1159 uint64_t rdtime0:1;
1160 uint64_t rdcnt1:1;
1161 uint64_t rdcnt0:1;
1162 uint64_t rptime3:1;
1163 uint64_t rptime2:1;
1164 uint64_t rptime1:1;
1165 uint64_t rptime0:1;
1166 uint64_t rpcnt3:1;
1167 uint64_t rpcnt2:1;
1168 uint64_t rpcnt1:1;
1169 uint64_t rpcnt0:1;
1170 uint64_t rrsl_int:1;
1171 uint64_t ill_rrd:1;
1172 uint64_t ill_rwr:1;
1173 uint64_t rdperr:1;
1174 uint64_t raperr:1;
1175 uint64_t rserr:1;
1176 uint64_t rtsr_abt:1;
1177 uint64_t rmsc_msg:1;
1178 uint64_t rmsi_mabt:1;
1179 uint64_t rmsi_tabt:1;
1180 uint64_t rmsi_per:1;
1181 uint64_t rmr_tto:1;
1182 uint64_t rmr_abt:1;
1183 uint64_t rtr_abt:1;
1184 uint64_t rmr_wtto:1;
1185 uint64_t rmr_wabt:1;
1186 uint64_t rtr_wabt:1;
1187#else
1188 uint64_t rtr_wabt:1;
1189 uint64_t rmr_wabt:1;
1190 uint64_t rmr_wtto:1;
1191 uint64_t rtr_abt:1;
1192 uint64_t rmr_abt:1;
1193 uint64_t rmr_tto:1;
1194 uint64_t rmsi_per:1;
1195 uint64_t rmsi_tabt:1;
1196 uint64_t rmsi_mabt:1;
1197 uint64_t rmsc_msg:1;
1198 uint64_t rtsr_abt:1;
1199 uint64_t rserr:1;
1200 uint64_t raperr:1;
1201 uint64_t rdperr:1;
1202 uint64_t ill_rwr:1;
1203 uint64_t ill_rrd:1;
1204 uint64_t rrsl_int:1;
1205 uint64_t rpcnt0:1;
1206 uint64_t rpcnt1:1;
1207 uint64_t rpcnt2:1;
1208 uint64_t rpcnt3:1;
1209 uint64_t rptime0:1;
1210 uint64_t rptime1:1;
1211 uint64_t rptime2:1;
1212 uint64_t rptime3:1;
1213 uint64_t rdcnt0:1;
1214 uint64_t rdcnt1:1;
1215 uint64_t rdtime0:1;
1216 uint64_t rdtime1:1;
1217 uint64_t dma0_fi:1;
1218 uint64_t dma1_fi:1;
1219 uint64_t win_wr:1;
1220 uint64_t ill_wr:1;
1221 uint64_t ill_rd:1;
1222 uint64_t reserved_34_63:30;
1223#endif
1224 } s;
1225 struct cvmx_pci_int_enb2_cn30xx {
1226#ifdef __BIG_ENDIAN_BITFIELD
1227 uint64_t reserved_34_63:30;
1228 uint64_t ill_rd:1;
1229 uint64_t ill_wr:1;
1230 uint64_t win_wr:1;
1231 uint64_t dma1_fi:1;
1232 uint64_t dma0_fi:1;
1233 uint64_t rdtime1:1;
1234 uint64_t rdtime0:1;
1235 uint64_t rdcnt1:1;
1236 uint64_t rdcnt0:1;
1237 uint64_t reserved_22_24:3;
1238 uint64_t rptime0:1;
1239 uint64_t reserved_18_20:3;
1240 uint64_t rpcnt0:1;
1241 uint64_t rrsl_int:1;
1242 uint64_t ill_rrd:1;
1243 uint64_t ill_rwr:1;
1244 uint64_t rdperr:1;
1245 uint64_t raperr:1;
1246 uint64_t rserr:1;
1247 uint64_t rtsr_abt:1;
1248 uint64_t rmsc_msg:1;
1249 uint64_t rmsi_mabt:1;
1250 uint64_t rmsi_tabt:1;
1251 uint64_t rmsi_per:1;
1252 uint64_t rmr_tto:1;
1253 uint64_t rmr_abt:1;
1254 uint64_t rtr_abt:1;
1255 uint64_t rmr_wtto:1;
1256 uint64_t rmr_wabt:1;
1257 uint64_t rtr_wabt:1;
1258#else
1259 uint64_t rtr_wabt:1;
1260 uint64_t rmr_wabt:1;
1261 uint64_t rmr_wtto:1;
1262 uint64_t rtr_abt:1;
1263 uint64_t rmr_abt:1;
1264 uint64_t rmr_tto:1;
1265 uint64_t rmsi_per:1;
1266 uint64_t rmsi_tabt:1;
1267 uint64_t rmsi_mabt:1;
1268 uint64_t rmsc_msg:1;
1269 uint64_t rtsr_abt:1;
1270 uint64_t rserr:1;
1271 uint64_t raperr:1;
1272 uint64_t rdperr:1;
1273 uint64_t ill_rwr:1;
1274 uint64_t ill_rrd:1;
1275 uint64_t rrsl_int:1;
1276 uint64_t rpcnt0:1;
1277 uint64_t reserved_18_20:3;
1278 uint64_t rptime0:1;
1279 uint64_t reserved_22_24:3;
1280 uint64_t rdcnt0:1;
1281 uint64_t rdcnt1:1;
1282 uint64_t rdtime0:1;
1283 uint64_t rdtime1:1;
1284 uint64_t dma0_fi:1;
1285 uint64_t dma1_fi:1;
1286 uint64_t win_wr:1;
1287 uint64_t ill_wr:1;
1288 uint64_t ill_rd:1;
1289 uint64_t reserved_34_63:30;
1290#endif
1291 } cn30xx;
1292 struct cvmx_pci_int_enb2_cn31xx {
1293#ifdef __BIG_ENDIAN_BITFIELD
1294 uint64_t reserved_34_63:30;
1295 uint64_t ill_rd:1;
1296 uint64_t ill_wr:1;
1297 uint64_t win_wr:1;
1298 uint64_t dma1_fi:1;
1299 uint64_t dma0_fi:1;
1300 uint64_t rdtime1:1;
1301 uint64_t rdtime0:1;
1302 uint64_t rdcnt1:1;
1303 uint64_t rdcnt0:1;
1304 uint64_t reserved_23_24:2;
1305 uint64_t rptime1:1;
1306 uint64_t rptime0:1;
1307 uint64_t reserved_19_20:2;
1308 uint64_t rpcnt1:1;
1309 uint64_t rpcnt0:1;
1310 uint64_t rrsl_int:1;
1311 uint64_t ill_rrd:1;
1312 uint64_t ill_rwr:1;
1313 uint64_t rdperr:1;
1314 uint64_t raperr:1;
1315 uint64_t rserr:1;
1316 uint64_t rtsr_abt:1;
1317 uint64_t rmsc_msg:1;
1318 uint64_t rmsi_mabt:1;
1319 uint64_t rmsi_tabt:1;
1320 uint64_t rmsi_per:1;
1321 uint64_t rmr_tto:1;
1322 uint64_t rmr_abt:1;
1323 uint64_t rtr_abt:1;
1324 uint64_t rmr_wtto:1;
1325 uint64_t rmr_wabt:1;
1326 uint64_t rtr_wabt:1;
1327#else
1328 uint64_t rtr_wabt:1;
1329 uint64_t rmr_wabt:1;
1330 uint64_t rmr_wtto:1;
1331 uint64_t rtr_abt:1;
1332 uint64_t rmr_abt:1;
1333 uint64_t rmr_tto:1;
1334 uint64_t rmsi_per:1;
1335 uint64_t rmsi_tabt:1;
1336 uint64_t rmsi_mabt:1;
1337 uint64_t rmsc_msg:1;
1338 uint64_t rtsr_abt:1;
1339 uint64_t rserr:1;
1340 uint64_t raperr:1;
1341 uint64_t rdperr:1;
1342 uint64_t ill_rwr:1;
1343 uint64_t ill_rrd:1;
1344 uint64_t rrsl_int:1;
1345 uint64_t rpcnt0:1;
1346 uint64_t rpcnt1:1;
1347 uint64_t reserved_19_20:2;
1348 uint64_t rptime0:1;
1349 uint64_t rptime1:1;
1350 uint64_t reserved_23_24:2;
1351 uint64_t rdcnt0:1;
1352 uint64_t rdcnt1:1;
1353 uint64_t rdtime0:1;
1354 uint64_t rdtime1:1;
1355 uint64_t dma0_fi:1;
1356 uint64_t dma1_fi:1;
1357 uint64_t win_wr:1;
1358 uint64_t ill_wr:1;
1359 uint64_t ill_rd:1;
1360 uint64_t reserved_34_63:30;
1361#endif
1362 } cn31xx;
1363};
1364
1365union cvmx_pci_int_sum {
1366 uint64_t u64;
1367 struct cvmx_pci_int_sum_s {
1368#ifdef __BIG_ENDIAN_BITFIELD
1369 uint64_t reserved_34_63:30;
1370 uint64_t ill_rd:1;
1371 uint64_t ill_wr:1;
1372 uint64_t win_wr:1;
1373 uint64_t dma1_fi:1;
1374 uint64_t dma0_fi:1;
1375 uint64_t dtime1:1;
1376 uint64_t dtime0:1;
1377 uint64_t dcnt1:1;
1378 uint64_t dcnt0:1;
1379 uint64_t ptime3:1;
1380 uint64_t ptime2:1;
1381 uint64_t ptime1:1;
1382 uint64_t ptime0:1;
1383 uint64_t pcnt3:1;
1384 uint64_t pcnt2:1;
1385 uint64_t pcnt1:1;
1386 uint64_t pcnt0:1;
1387 uint64_t rsl_int:1;
1388 uint64_t ill_rrd:1;
1389 uint64_t ill_rwr:1;
1390 uint64_t dperr:1;
1391 uint64_t aperr:1;
1392 uint64_t serr:1;
1393 uint64_t tsr_abt:1;
1394 uint64_t msc_msg:1;
1395 uint64_t msi_mabt:1;
1396 uint64_t msi_tabt:1;
1397 uint64_t msi_per:1;
1398 uint64_t mr_tto:1;
1399 uint64_t mr_abt:1;
1400 uint64_t tr_abt:1;
1401 uint64_t mr_wtto:1;
1402 uint64_t mr_wabt:1;
1403 uint64_t tr_wabt:1;
1404#else
1405 uint64_t tr_wabt:1;
1406 uint64_t mr_wabt:1;
1407 uint64_t mr_wtto:1;
1408 uint64_t tr_abt:1;
1409 uint64_t mr_abt:1;
1410 uint64_t mr_tto:1;
1411 uint64_t msi_per:1;
1412 uint64_t msi_tabt:1;
1413 uint64_t msi_mabt:1;
1414 uint64_t msc_msg:1;
1415 uint64_t tsr_abt:1;
1416 uint64_t serr:1;
1417 uint64_t aperr:1;
1418 uint64_t dperr:1;
1419 uint64_t ill_rwr:1;
1420 uint64_t ill_rrd:1;
1421 uint64_t rsl_int:1;
1422 uint64_t pcnt0:1;
1423 uint64_t pcnt1:1;
1424 uint64_t pcnt2:1;
1425 uint64_t pcnt3:1;
1426 uint64_t ptime0:1;
1427 uint64_t ptime1:1;
1428 uint64_t ptime2:1;
1429 uint64_t ptime3:1;
1430 uint64_t dcnt0:1;
1431 uint64_t dcnt1:1;
1432 uint64_t dtime0:1;
1433 uint64_t dtime1:1;
1434 uint64_t dma0_fi:1;
1435 uint64_t dma1_fi:1;
1436 uint64_t win_wr:1;
1437 uint64_t ill_wr:1;
1438 uint64_t ill_rd:1;
1439 uint64_t reserved_34_63:30;
1440#endif
1441 } s;
1442 struct cvmx_pci_int_sum_cn30xx {
1443#ifdef __BIG_ENDIAN_BITFIELD
1444 uint64_t reserved_34_63:30;
1445 uint64_t ill_rd:1;
1446 uint64_t ill_wr:1;
1447 uint64_t win_wr:1;
1448 uint64_t dma1_fi:1;
1449 uint64_t dma0_fi:1;
1450 uint64_t dtime1:1;
1451 uint64_t dtime0:1;
1452 uint64_t dcnt1:1;
1453 uint64_t dcnt0:1;
1454 uint64_t reserved_22_24:3;
1455 uint64_t ptime0:1;
1456 uint64_t reserved_18_20:3;
1457 uint64_t pcnt0:1;
1458 uint64_t rsl_int:1;
1459 uint64_t ill_rrd:1;
1460 uint64_t ill_rwr:1;
1461 uint64_t dperr:1;
1462 uint64_t aperr:1;
1463 uint64_t serr:1;
1464 uint64_t tsr_abt:1;
1465 uint64_t msc_msg:1;
1466 uint64_t msi_mabt:1;
1467 uint64_t msi_tabt:1;
1468 uint64_t msi_per:1;
1469 uint64_t mr_tto:1;
1470 uint64_t mr_abt:1;
1471 uint64_t tr_abt:1;
1472 uint64_t mr_wtto:1;
1473 uint64_t mr_wabt:1;
1474 uint64_t tr_wabt:1;
1475#else
1476 uint64_t tr_wabt:1;
1477 uint64_t mr_wabt:1;
1478 uint64_t mr_wtto:1;
1479 uint64_t tr_abt:1;
1480 uint64_t mr_abt:1;
1481 uint64_t mr_tto:1;
1482 uint64_t msi_per:1;
1483 uint64_t msi_tabt:1;
1484 uint64_t msi_mabt:1;
1485 uint64_t msc_msg:1;
1486 uint64_t tsr_abt:1;
1487 uint64_t serr:1;
1488 uint64_t aperr:1;
1489 uint64_t dperr:1;
1490 uint64_t ill_rwr:1;
1491 uint64_t ill_rrd:1;
1492 uint64_t rsl_int:1;
1493 uint64_t pcnt0:1;
1494 uint64_t reserved_18_20:3;
1495 uint64_t ptime0:1;
1496 uint64_t reserved_22_24:3;
1497 uint64_t dcnt0:1;
1498 uint64_t dcnt1:1;
1499 uint64_t dtime0:1;
1500 uint64_t dtime1:1;
1501 uint64_t dma0_fi:1;
1502 uint64_t dma1_fi:1;
1503 uint64_t win_wr:1;
1504 uint64_t ill_wr:1;
1505 uint64_t ill_rd:1;
1506 uint64_t reserved_34_63:30;
1507#endif
1508 } cn30xx;
1509 struct cvmx_pci_int_sum_cn31xx {
1510#ifdef __BIG_ENDIAN_BITFIELD
1511 uint64_t reserved_34_63:30;
1512 uint64_t ill_rd:1;
1513 uint64_t ill_wr:1;
1514 uint64_t win_wr:1;
1515 uint64_t dma1_fi:1;
1516 uint64_t dma0_fi:1;
1517 uint64_t dtime1:1;
1518 uint64_t dtime0:1;
1519 uint64_t dcnt1:1;
1520 uint64_t dcnt0:1;
1521 uint64_t reserved_23_24:2;
1522 uint64_t ptime1:1;
1523 uint64_t ptime0:1;
1524 uint64_t reserved_19_20:2;
1525 uint64_t pcnt1:1;
1526 uint64_t pcnt0:1;
1527 uint64_t rsl_int:1;
1528 uint64_t ill_rrd:1;
1529 uint64_t ill_rwr:1;
1530 uint64_t dperr:1;
1531 uint64_t aperr:1;
1532 uint64_t serr:1;
1533 uint64_t tsr_abt:1;
1534 uint64_t msc_msg:1;
1535 uint64_t msi_mabt:1;
1536 uint64_t msi_tabt:1;
1537 uint64_t msi_per:1;
1538 uint64_t mr_tto:1;
1539 uint64_t mr_abt:1;
1540 uint64_t tr_abt:1;
1541 uint64_t mr_wtto:1;
1542 uint64_t mr_wabt:1;
1543 uint64_t tr_wabt:1;
1544#else
1545 uint64_t tr_wabt:1;
1546 uint64_t mr_wabt:1;
1547 uint64_t mr_wtto:1;
1548 uint64_t tr_abt:1;
1549 uint64_t mr_abt:1;
1550 uint64_t mr_tto:1;
1551 uint64_t msi_per:1;
1552 uint64_t msi_tabt:1;
1553 uint64_t msi_mabt:1;
1554 uint64_t msc_msg:1;
1555 uint64_t tsr_abt:1;
1556 uint64_t serr:1;
1557 uint64_t aperr:1;
1558 uint64_t dperr:1;
1559 uint64_t ill_rwr:1;
1560 uint64_t ill_rrd:1;
1561 uint64_t rsl_int:1;
1562 uint64_t pcnt0:1;
1563 uint64_t pcnt1:1;
1564 uint64_t reserved_19_20:2;
1565 uint64_t ptime0:1;
1566 uint64_t ptime1:1;
1567 uint64_t reserved_23_24:2;
1568 uint64_t dcnt0:1;
1569 uint64_t dcnt1:1;
1570 uint64_t dtime0:1;
1571 uint64_t dtime1:1;
1572 uint64_t dma0_fi:1;
1573 uint64_t dma1_fi:1;
1574 uint64_t win_wr:1;
1575 uint64_t ill_wr:1;
1576 uint64_t ill_rd:1;
1577 uint64_t reserved_34_63:30;
1578#endif
1579 } cn31xx;
1580};
1581
1582union cvmx_pci_int_sum2 {
1583 uint64_t u64;
1584 struct cvmx_pci_int_sum2_s {
1585#ifdef __BIG_ENDIAN_BITFIELD
1586 uint64_t reserved_34_63:30;
1587 uint64_t ill_rd:1;
1588 uint64_t ill_wr:1;
1589 uint64_t win_wr:1;
1590 uint64_t dma1_fi:1;
1591 uint64_t dma0_fi:1;
1592 uint64_t dtime1:1;
1593 uint64_t dtime0:1;
1594 uint64_t dcnt1:1;
1595 uint64_t dcnt0:1;
1596 uint64_t ptime3:1;
1597 uint64_t ptime2:1;
1598 uint64_t ptime1:1;
1599 uint64_t ptime0:1;
1600 uint64_t pcnt3:1;
1601 uint64_t pcnt2:1;
1602 uint64_t pcnt1:1;
1603 uint64_t pcnt0:1;
1604 uint64_t rsl_int:1;
1605 uint64_t ill_rrd:1;
1606 uint64_t ill_rwr:1;
1607 uint64_t dperr:1;
1608 uint64_t aperr:1;
1609 uint64_t serr:1;
1610 uint64_t tsr_abt:1;
1611 uint64_t msc_msg:1;
1612 uint64_t msi_mabt:1;
1613 uint64_t msi_tabt:1;
1614 uint64_t msi_per:1;
1615 uint64_t mr_tto:1;
1616 uint64_t mr_abt:1;
1617 uint64_t tr_abt:1;
1618 uint64_t mr_wtto:1;
1619 uint64_t mr_wabt:1;
1620 uint64_t tr_wabt:1;
1621#else
1622 uint64_t tr_wabt:1;
1623 uint64_t mr_wabt:1;
1624 uint64_t mr_wtto:1;
1625 uint64_t tr_abt:1;
1626 uint64_t mr_abt:1;
1627 uint64_t mr_tto:1;
1628 uint64_t msi_per:1;
1629 uint64_t msi_tabt:1;
1630 uint64_t msi_mabt:1;
1631 uint64_t msc_msg:1;
1632 uint64_t tsr_abt:1;
1633 uint64_t serr:1;
1634 uint64_t aperr:1;
1635 uint64_t dperr:1;
1636 uint64_t ill_rwr:1;
1637 uint64_t ill_rrd:1;
1638 uint64_t rsl_int:1;
1639 uint64_t pcnt0:1;
1640 uint64_t pcnt1:1;
1641 uint64_t pcnt2:1;
1642 uint64_t pcnt3:1;
1643 uint64_t ptime0:1;
1644 uint64_t ptime1:1;
1645 uint64_t ptime2:1;
1646 uint64_t ptime3:1;
1647 uint64_t dcnt0:1;
1648 uint64_t dcnt1:1;
1649 uint64_t dtime0:1;
1650 uint64_t dtime1:1;
1651 uint64_t dma0_fi:1;
1652 uint64_t dma1_fi:1;
1653 uint64_t win_wr:1;
1654 uint64_t ill_wr:1;
1655 uint64_t ill_rd:1;
1656 uint64_t reserved_34_63:30;
1657#endif
1658 } s;
1659 struct cvmx_pci_int_sum2_cn30xx {
1660#ifdef __BIG_ENDIAN_BITFIELD
1661 uint64_t reserved_34_63:30;
1662 uint64_t ill_rd:1;
1663 uint64_t ill_wr:1;
1664 uint64_t win_wr:1;
1665 uint64_t dma1_fi:1;
1666 uint64_t dma0_fi:1;
1667 uint64_t dtime1:1;
1668 uint64_t dtime0:1;
1669 uint64_t dcnt1:1;
1670 uint64_t dcnt0:1;
1671 uint64_t reserved_22_24:3;
1672 uint64_t ptime0:1;
1673 uint64_t reserved_18_20:3;
1674 uint64_t pcnt0:1;
1675 uint64_t rsl_int:1;
1676 uint64_t ill_rrd:1;
1677 uint64_t ill_rwr:1;
1678 uint64_t dperr:1;
1679 uint64_t aperr:1;
1680 uint64_t serr:1;
1681 uint64_t tsr_abt:1;
1682 uint64_t msc_msg:1;
1683 uint64_t msi_mabt:1;
1684 uint64_t msi_tabt:1;
1685 uint64_t msi_per:1;
1686 uint64_t mr_tto:1;
1687 uint64_t mr_abt:1;
1688 uint64_t tr_abt:1;
1689 uint64_t mr_wtto:1;
1690 uint64_t mr_wabt:1;
1691 uint64_t tr_wabt:1;
1692#else
1693 uint64_t tr_wabt:1;
1694 uint64_t mr_wabt:1;
1695 uint64_t mr_wtto:1;
1696 uint64_t tr_abt:1;
1697 uint64_t mr_abt:1;
1698 uint64_t mr_tto:1;
1699 uint64_t msi_per:1;
1700 uint64_t msi_tabt:1;
1701 uint64_t msi_mabt:1;
1702 uint64_t msc_msg:1;
1703 uint64_t tsr_abt:1;
1704 uint64_t serr:1;
1705 uint64_t aperr:1;
1706 uint64_t dperr:1;
1707 uint64_t ill_rwr:1;
1708 uint64_t ill_rrd:1;
1709 uint64_t rsl_int:1;
1710 uint64_t pcnt0:1;
1711 uint64_t reserved_18_20:3;
1712 uint64_t ptime0:1;
1713 uint64_t reserved_22_24:3;
1714 uint64_t dcnt0:1;
1715 uint64_t dcnt1:1;
1716 uint64_t dtime0:1;
1717 uint64_t dtime1:1;
1718 uint64_t dma0_fi:1;
1719 uint64_t dma1_fi:1;
1720 uint64_t win_wr:1;
1721 uint64_t ill_wr:1;
1722 uint64_t ill_rd:1;
1723 uint64_t reserved_34_63:30;
1724#endif
1725 } cn30xx;
1726 struct cvmx_pci_int_sum2_cn31xx {
1727#ifdef __BIG_ENDIAN_BITFIELD
1728 uint64_t reserved_34_63:30;
1729 uint64_t ill_rd:1;
1730 uint64_t ill_wr:1;
1731 uint64_t win_wr:1;
1732 uint64_t dma1_fi:1;
1733 uint64_t dma0_fi:1;
1734 uint64_t dtime1:1;
1735 uint64_t dtime0:1;
1736 uint64_t dcnt1:1;
1737 uint64_t dcnt0:1;
1738 uint64_t reserved_23_24:2;
1739 uint64_t ptime1:1;
1740 uint64_t ptime0:1;
1741 uint64_t reserved_19_20:2;
1742 uint64_t pcnt1:1;
1743 uint64_t pcnt0:1;
1744 uint64_t rsl_int:1;
1745 uint64_t ill_rrd:1;
1746 uint64_t ill_rwr:1;
1747 uint64_t dperr:1;
1748 uint64_t aperr:1;
1749 uint64_t serr:1;
1750 uint64_t tsr_abt:1;
1751 uint64_t msc_msg:1;
1752 uint64_t msi_mabt:1;
1753 uint64_t msi_tabt:1;
1754 uint64_t msi_per:1;
1755 uint64_t mr_tto:1;
1756 uint64_t mr_abt:1;
1757 uint64_t tr_abt:1;
1758 uint64_t mr_wtto:1;
1759 uint64_t mr_wabt:1;
1760 uint64_t tr_wabt:1;
1761#else
1762 uint64_t tr_wabt:1;
1763 uint64_t mr_wabt:1;
1764 uint64_t mr_wtto:1;
1765 uint64_t tr_abt:1;
1766 uint64_t mr_abt:1;
1767 uint64_t mr_tto:1;
1768 uint64_t msi_per:1;
1769 uint64_t msi_tabt:1;
1770 uint64_t msi_mabt:1;
1771 uint64_t msc_msg:1;
1772 uint64_t tsr_abt:1;
1773 uint64_t serr:1;
1774 uint64_t aperr:1;
1775 uint64_t dperr:1;
1776 uint64_t ill_rwr:1;
1777 uint64_t ill_rrd:1;
1778 uint64_t rsl_int:1;
1779 uint64_t pcnt0:1;
1780 uint64_t pcnt1:1;
1781 uint64_t reserved_19_20:2;
1782 uint64_t ptime0:1;
1783 uint64_t ptime1:1;
1784 uint64_t reserved_23_24:2;
1785 uint64_t dcnt0:1;
1786 uint64_t dcnt1:1;
1787 uint64_t dtime0:1;
1788 uint64_t dtime1:1;
1789 uint64_t dma0_fi:1;
1790 uint64_t dma1_fi:1;
1791 uint64_t win_wr:1;
1792 uint64_t ill_wr:1;
1793 uint64_t ill_rd:1;
1794 uint64_t reserved_34_63:30;
1795#endif
1796 } cn31xx;
1797};
1798
1799union cvmx_pci_msi_rcv {
1800 uint32_t u32;
1801 struct cvmx_pci_msi_rcv_s {
1802#ifdef __BIG_ENDIAN_BITFIELD
1803 uint32_t reserved_6_31:26;
1804 uint32_t intr:6;
1805#else
1806 uint32_t intr:6;
1807 uint32_t reserved_6_31:26;
1808#endif
1809 } s;
1810};
1811
1812union cvmx_pci_pkt_creditsx {
1813 uint32_t u32;
1814 struct cvmx_pci_pkt_creditsx_s {
1815#ifdef __BIG_ENDIAN_BITFIELD
1816 uint32_t pkt_cnt:16;
1817 uint32_t ptr_cnt:16;
1818#else
1819 uint32_t ptr_cnt:16;
1820 uint32_t pkt_cnt:16;
1821#endif
1822 } s;
1823};
1824
1825union cvmx_pci_pkts_sentx {
1826 uint32_t u32;
1827 struct cvmx_pci_pkts_sentx_s {
1828#ifdef __BIG_ENDIAN_BITFIELD
1829 uint32_t pkt_cnt:32;
1830#else
1831 uint32_t pkt_cnt:32;
1832#endif
1833 } s;
1834};
1835
1836union cvmx_pci_pkts_sent_int_levx {
1837 uint32_t u32;
1838 struct cvmx_pci_pkts_sent_int_levx_s {
1839#ifdef __BIG_ENDIAN_BITFIELD
1840 uint32_t pkt_cnt:32;
1841#else
1842 uint32_t pkt_cnt:32;
1843#endif
1844 } s;
1845};
1846
1847union cvmx_pci_pkts_sent_timex {
1848 uint32_t u32;
1849 struct cvmx_pci_pkts_sent_timex_s {
1850#ifdef __BIG_ENDIAN_BITFIELD
1851 uint32_t pkt_time:32;
1852#else
1853 uint32_t pkt_time:32;
1854#endif
1855 } s;
1856};
1857
1858union cvmx_pci_read_cmd_6 {
1859 uint32_t u32;
1860 struct cvmx_pci_read_cmd_6_s {
1861#ifdef __BIG_ENDIAN_BITFIELD
1862 uint32_t reserved_9_31:23;
1863 uint32_t min_data:6;
1864 uint32_t prefetch:3;
1865#else
1866 uint32_t prefetch:3;
1867 uint32_t min_data:6;
1868 uint32_t reserved_9_31:23;
1869#endif
1870 } s;
1871};
1872
1873union cvmx_pci_read_cmd_c {
1874 uint32_t u32;
1875 struct cvmx_pci_read_cmd_c_s {
1876#ifdef __BIG_ENDIAN_BITFIELD
1877 uint32_t reserved_9_31:23;
1878 uint32_t min_data:6;
1879 uint32_t prefetch:3;
1880#else
1881 uint32_t prefetch:3;
1882 uint32_t min_data:6;
1883 uint32_t reserved_9_31:23;
1884#endif
1885 } s;
1886};
1887
1888union cvmx_pci_read_cmd_e {
1889 uint32_t u32;
1890 struct cvmx_pci_read_cmd_e_s {
1891#ifdef __BIG_ENDIAN_BITFIELD
1892 uint32_t reserved_9_31:23;
1893 uint32_t min_data:6;
1894 uint32_t prefetch:3;
1895#else
1896 uint32_t prefetch:3;
1897 uint32_t min_data:6;
1898 uint32_t reserved_9_31:23;
1899#endif
1900 } s;
1901};
1902
1903union cvmx_pci_read_timeout {
1904 uint64_t u64;
1905 struct cvmx_pci_read_timeout_s {
1906#ifdef __BIG_ENDIAN_BITFIELD
1907 uint64_t reserved_32_63:32;
1908 uint64_t enb:1;
1909 uint64_t cnt:31;
1910#else
1911 uint64_t cnt:31;
1912 uint64_t enb:1;
1913 uint64_t reserved_32_63:32;
1914#endif
1915 } s;
1916};
1917
1918union cvmx_pci_scm_reg {
1919 uint64_t u64;
1920 struct cvmx_pci_scm_reg_s {
1921#ifdef __BIG_ENDIAN_BITFIELD
1922 uint64_t reserved_32_63:32;
1923 uint64_t scm:32;
1924#else
1925 uint64_t scm:32;
1926 uint64_t reserved_32_63:32;
1927#endif
1928 } s;
1929};
1930
1931union cvmx_pci_tsr_reg {
1932 uint64_t u64;
1933 struct cvmx_pci_tsr_reg_s {
1934#ifdef __BIG_ENDIAN_BITFIELD
1935 uint64_t reserved_36_63:28;
1936 uint64_t tsr:36;
1937#else
1938 uint64_t tsr:36;
1939 uint64_t reserved_36_63:28;
1940#endif
1941 } s;
1942};
1943
1944union cvmx_pci_win_rd_addr {
1945 uint64_t u64;
1946 struct cvmx_pci_win_rd_addr_s {
1947#ifdef __BIG_ENDIAN_BITFIELD
1948 uint64_t reserved_49_63:15;
1949 uint64_t iobit:1;
1950 uint64_t reserved_0_47:48;
1951#else
1952 uint64_t reserved_0_47:48;
1953 uint64_t iobit:1;
1954 uint64_t reserved_49_63:15;
1955#endif
1956 } s;
1957 struct cvmx_pci_win_rd_addr_cn30xx {
1958#ifdef __BIG_ENDIAN_BITFIELD
1959 uint64_t reserved_49_63:15;
1960 uint64_t iobit:1;
1961 uint64_t rd_addr:46;
1962 uint64_t reserved_0_1:2;
1963#else
1964 uint64_t reserved_0_1:2;
1965 uint64_t rd_addr:46;
1966 uint64_t iobit:1;
1967 uint64_t reserved_49_63:15;
1968#endif
1969 } cn30xx;
1970 struct cvmx_pci_win_rd_addr_cn38xx {
1971#ifdef __BIG_ENDIAN_BITFIELD
1972 uint64_t reserved_49_63:15;
1973 uint64_t iobit:1;
1974 uint64_t rd_addr:45;
1975 uint64_t reserved_0_2:3;
1976#else
1977 uint64_t reserved_0_2:3;
1978 uint64_t rd_addr:45;
1979 uint64_t iobit:1;
1980 uint64_t reserved_49_63:15;
1981#endif
1982 } cn38xx;
1983};
1984
1985union cvmx_pci_win_rd_data {
1986 uint64_t u64;
1987 struct cvmx_pci_win_rd_data_s {
1988#ifdef __BIG_ENDIAN_BITFIELD
1989 uint64_t rd_data:64;
1990#else
1991 uint64_t rd_data:64;
1992#endif
1993 } s;
1994};
1995
1996union cvmx_pci_win_wr_addr {
1997 uint64_t u64;
1998 struct cvmx_pci_win_wr_addr_s {
1999#ifdef __BIG_ENDIAN_BITFIELD
2000 uint64_t reserved_49_63:15;
2001 uint64_t iobit:1;
2002 uint64_t wr_addr:45;
2003 uint64_t reserved_0_2:3;
2004#else
2005 uint64_t reserved_0_2:3;
2006 uint64_t wr_addr:45;
2007 uint64_t iobit:1;
2008 uint64_t reserved_49_63:15;
2009#endif
2010 } s;
2011};
2012
2013union cvmx_pci_win_wr_data {
2014 uint64_t u64;
2015 struct cvmx_pci_win_wr_data_s {
2016#ifdef __BIG_ENDIAN_BITFIELD
2017 uint64_t wr_data:64;
2018#else
2019 uint64_t wr_data:64;
2020#endif
2021 } s;
2022};
2023
2024union cvmx_pci_win_wr_mask {
2025 uint64_t u64;
2026 struct cvmx_pci_win_wr_mask_s {
2027#ifdef __BIG_ENDIAN_BITFIELD
2028 uint64_t reserved_8_63:56;
2029 uint64_t wr_mask:8;
2030#else
2031 uint64_t wr_mask:8;
2032 uint64_t reserved_8_63:56;
2033#endif
2034 } s;
2035};
2036
2037#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pciercx-defs.h b/arch/mips/include/asm/octeon/cvmx-pciercx-defs.h
new file mode 100644
index 000000000..e2dce1acf
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pciercx-defs.h
@@ -0,0 +1,368 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2017 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_PCIERCX_DEFS_H__
29#define __CVMX_PCIERCX_DEFS_H__
30
31#include <uapi/asm/bitfield.h>
32
33#define CVMX_PCIERCX_CFG001(block_id) (0x0000000000000004ull)
34#define CVMX_PCIERCX_CFG006(block_id) (0x0000000000000018ull)
35#define CVMX_PCIERCX_CFG008(block_id) (0x0000000000000020ull)
36#define CVMX_PCIERCX_CFG009(block_id) (0x0000000000000024ull)
37#define CVMX_PCIERCX_CFG010(block_id) (0x0000000000000028ull)
38#define CVMX_PCIERCX_CFG011(block_id) (0x000000000000002Cull)
39#define CVMX_PCIERCX_CFG030(block_id) (0x0000000000000078ull)
40#define CVMX_PCIERCX_CFG031(block_id) (0x000000000000007Cull)
41#define CVMX_PCIERCX_CFG032(block_id) (0x0000000000000080ull)
42#define CVMX_PCIERCX_CFG034(block_id) (0x0000000000000088ull)
43#define CVMX_PCIERCX_CFG035(block_id) (0x000000000000008Cull)
44#define CVMX_PCIERCX_CFG040(block_id) (0x00000000000000A0ull)
45#define CVMX_PCIERCX_CFG066(block_id) (0x0000000000000108ull)
46#define CVMX_PCIERCX_CFG069(block_id) (0x0000000000000114ull)
47#define CVMX_PCIERCX_CFG070(block_id) (0x0000000000000118ull)
48#define CVMX_PCIERCX_CFG075(block_id) (0x000000000000012Cull)
49#define CVMX_PCIERCX_CFG448(block_id) (0x0000000000000700ull)
50#define CVMX_PCIERCX_CFG452(block_id) (0x0000000000000710ull)
51#define CVMX_PCIERCX_CFG455(block_id) (0x000000000000071Cull)
52#define CVMX_PCIERCX_CFG515(block_id) (0x000000000000080Cull)
53
54union cvmx_pciercx_cfg001 {
55 uint32_t u32;
56 struct cvmx_pciercx_cfg001_s {
57 __BITFIELD_FIELD(uint32_t dpe:1,
58 __BITFIELD_FIELD(uint32_t sse:1,
59 __BITFIELD_FIELD(uint32_t rma:1,
60 __BITFIELD_FIELD(uint32_t rta:1,
61 __BITFIELD_FIELD(uint32_t sta:1,
62 __BITFIELD_FIELD(uint32_t devt:2,
63 __BITFIELD_FIELD(uint32_t mdpe:1,
64 __BITFIELD_FIELD(uint32_t fbb:1,
65 __BITFIELD_FIELD(uint32_t reserved_22_22:1,
66 __BITFIELD_FIELD(uint32_t m66:1,
67 __BITFIELD_FIELD(uint32_t cl:1,
68 __BITFIELD_FIELD(uint32_t i_stat:1,
69 __BITFIELD_FIELD(uint32_t reserved_11_18:8,
70 __BITFIELD_FIELD(uint32_t i_dis:1,
71 __BITFIELD_FIELD(uint32_t fbbe:1,
72 __BITFIELD_FIELD(uint32_t see:1,
73 __BITFIELD_FIELD(uint32_t ids_wcc:1,
74 __BITFIELD_FIELD(uint32_t per:1,
75 __BITFIELD_FIELD(uint32_t vps:1,
76 __BITFIELD_FIELD(uint32_t mwice:1,
77 __BITFIELD_FIELD(uint32_t scse:1,
78 __BITFIELD_FIELD(uint32_t me:1,
79 __BITFIELD_FIELD(uint32_t msae:1,
80 __BITFIELD_FIELD(uint32_t isae:1,
81 ;))))))))))))))))))))))))
82 } s;
83};
84
85union cvmx_pciercx_cfg006 {
86 uint32_t u32;
87 struct cvmx_pciercx_cfg006_s {
88 __BITFIELD_FIELD(uint32_t slt:8,
89 __BITFIELD_FIELD(uint32_t subbnum:8,
90 __BITFIELD_FIELD(uint32_t sbnum:8,
91 __BITFIELD_FIELD(uint32_t pbnum:8,
92 ;))))
93 } s;
94};
95
96union cvmx_pciercx_cfg008 {
97 uint32_t u32;
98 struct cvmx_pciercx_cfg008_s {
99 __BITFIELD_FIELD(uint32_t ml_addr:12,
100 __BITFIELD_FIELD(uint32_t reserved_16_19:4,
101 __BITFIELD_FIELD(uint32_t mb_addr:12,
102 __BITFIELD_FIELD(uint32_t reserved_0_3:4,
103 ;))))
104 } s;
105};
106
107union cvmx_pciercx_cfg009 {
108 uint32_t u32;
109 struct cvmx_pciercx_cfg009_s {
110 __BITFIELD_FIELD(uint32_t lmem_limit:12,
111 __BITFIELD_FIELD(uint32_t reserved_17_19:3,
112 __BITFIELD_FIELD(uint32_t mem64b:1,
113 __BITFIELD_FIELD(uint32_t lmem_base:12,
114 __BITFIELD_FIELD(uint32_t reserved_1_3:3,
115 __BITFIELD_FIELD(uint32_t mem64a:1,
116 ;))))))
117 } s;
118};
119
120union cvmx_pciercx_cfg010 {
121 uint32_t u32;
122 struct cvmx_pciercx_cfg010_s {
123 uint32_t umem_base;
124 } s;
125};
126
127union cvmx_pciercx_cfg011 {
128 uint32_t u32;
129 struct cvmx_pciercx_cfg011_s {
130 uint32_t umem_limit;
131 } s;
132};
133
134union cvmx_pciercx_cfg030 {
135 uint32_t u32;
136 struct cvmx_pciercx_cfg030_s {
137 __BITFIELD_FIELD(uint32_t reserved_22_31:10,
138 __BITFIELD_FIELD(uint32_t tp:1,
139 __BITFIELD_FIELD(uint32_t ap_d:1,
140 __BITFIELD_FIELD(uint32_t ur_d:1,
141 __BITFIELD_FIELD(uint32_t fe_d:1,
142 __BITFIELD_FIELD(uint32_t nfe_d:1,
143 __BITFIELD_FIELD(uint32_t ce_d:1,
144 __BITFIELD_FIELD(uint32_t reserved_15_15:1,
145 __BITFIELD_FIELD(uint32_t mrrs:3,
146 __BITFIELD_FIELD(uint32_t ns_en:1,
147 __BITFIELD_FIELD(uint32_t ap_en:1,
148 __BITFIELD_FIELD(uint32_t pf_en:1,
149 __BITFIELD_FIELD(uint32_t etf_en:1,
150 __BITFIELD_FIELD(uint32_t mps:3,
151 __BITFIELD_FIELD(uint32_t ro_en:1,
152 __BITFIELD_FIELD(uint32_t ur_en:1,
153 __BITFIELD_FIELD(uint32_t fe_en:1,
154 __BITFIELD_FIELD(uint32_t nfe_en:1,
155 __BITFIELD_FIELD(uint32_t ce_en:1,
156 ;)))))))))))))))))))
157 } s;
158};
159
160union cvmx_pciercx_cfg031 {
161 uint32_t u32;
162 struct cvmx_pciercx_cfg031_s {
163 __BITFIELD_FIELD(uint32_t pnum:8,
164 __BITFIELD_FIELD(uint32_t reserved_23_23:1,
165 __BITFIELD_FIELD(uint32_t aspm:1,
166 __BITFIELD_FIELD(uint32_t lbnc:1,
167 __BITFIELD_FIELD(uint32_t dllarc:1,
168 __BITFIELD_FIELD(uint32_t sderc:1,
169 __BITFIELD_FIELD(uint32_t cpm:1,
170 __BITFIELD_FIELD(uint32_t l1el:3,
171 __BITFIELD_FIELD(uint32_t l0el:3,
172 __BITFIELD_FIELD(uint32_t aslpms:2,
173 __BITFIELD_FIELD(uint32_t mlw:6,
174 __BITFIELD_FIELD(uint32_t mls:4,
175 ;))))))))))))
176 } s;
177};
178
179union cvmx_pciercx_cfg032 {
180 uint32_t u32;
181 struct cvmx_pciercx_cfg032_s {
182 __BITFIELD_FIELD(uint32_t lab:1,
183 __BITFIELD_FIELD(uint32_t lbm:1,
184 __BITFIELD_FIELD(uint32_t dlla:1,
185 __BITFIELD_FIELD(uint32_t scc:1,
186 __BITFIELD_FIELD(uint32_t lt:1,
187 __BITFIELD_FIELD(uint32_t reserved_26_26:1,
188 __BITFIELD_FIELD(uint32_t nlw:6,
189 __BITFIELD_FIELD(uint32_t ls:4,
190 __BITFIELD_FIELD(uint32_t reserved_12_15:4,
191 __BITFIELD_FIELD(uint32_t lab_int_enb:1,
192 __BITFIELD_FIELD(uint32_t lbm_int_enb:1,
193 __BITFIELD_FIELD(uint32_t hawd:1,
194 __BITFIELD_FIELD(uint32_t ecpm:1,
195 __BITFIELD_FIELD(uint32_t es:1,
196 __BITFIELD_FIELD(uint32_t ccc:1,
197 __BITFIELD_FIELD(uint32_t rl:1,
198 __BITFIELD_FIELD(uint32_t ld:1,
199 __BITFIELD_FIELD(uint32_t rcb:1,
200 __BITFIELD_FIELD(uint32_t reserved_2_2:1,
201 __BITFIELD_FIELD(uint32_t aslpc:2,
202 ;))))))))))))))))))))
203 } s;
204};
205
206union cvmx_pciercx_cfg034 {
207 uint32_t u32;
208 struct cvmx_pciercx_cfg034_s {
209 __BITFIELD_FIELD(uint32_t reserved_25_31:7,
210 __BITFIELD_FIELD(uint32_t dlls_c:1,
211 __BITFIELD_FIELD(uint32_t emis:1,
212 __BITFIELD_FIELD(uint32_t pds:1,
213 __BITFIELD_FIELD(uint32_t mrlss:1,
214 __BITFIELD_FIELD(uint32_t ccint_d:1,
215 __BITFIELD_FIELD(uint32_t pd_c:1,
216 __BITFIELD_FIELD(uint32_t mrls_c:1,
217 __BITFIELD_FIELD(uint32_t pf_d:1,
218 __BITFIELD_FIELD(uint32_t abp_d:1,
219 __BITFIELD_FIELD(uint32_t reserved_13_15:3,
220 __BITFIELD_FIELD(uint32_t dlls_en:1,
221 __BITFIELD_FIELD(uint32_t emic:1,
222 __BITFIELD_FIELD(uint32_t pcc:1,
223 __BITFIELD_FIELD(uint32_t pic:1,
224 __BITFIELD_FIELD(uint32_t aic:1,
225 __BITFIELD_FIELD(uint32_t hpint_en:1,
226 __BITFIELD_FIELD(uint32_t ccint_en:1,
227 __BITFIELD_FIELD(uint32_t pd_en:1,
228 __BITFIELD_FIELD(uint32_t mrls_en:1,
229 __BITFIELD_FIELD(uint32_t pf_en:1,
230 __BITFIELD_FIELD(uint32_t abp_en:1,
231 ;))))))))))))))))))))))
232 } s;
233};
234
235union cvmx_pciercx_cfg035 {
236 uint32_t u32;
237 struct cvmx_pciercx_cfg035_s {
238 __BITFIELD_FIELD(uint32_t reserved_17_31:15,
239 __BITFIELD_FIELD(uint32_t crssv:1,
240 __BITFIELD_FIELD(uint32_t reserved_5_15:11,
241 __BITFIELD_FIELD(uint32_t crssve:1,
242 __BITFIELD_FIELD(uint32_t pmeie:1,
243 __BITFIELD_FIELD(uint32_t sefee:1,
244 __BITFIELD_FIELD(uint32_t senfee:1,
245 __BITFIELD_FIELD(uint32_t secee:1,
246 ;))))))))
247 } s;
248};
249
250union cvmx_pciercx_cfg040 {
251 uint32_t u32;
252 struct cvmx_pciercx_cfg040_s {
253 __BITFIELD_FIELD(uint32_t reserved_22_31:10,
254 __BITFIELD_FIELD(uint32_t ler:1,
255 __BITFIELD_FIELD(uint32_t ep3s:1,
256 __BITFIELD_FIELD(uint32_t ep2s:1,
257 __BITFIELD_FIELD(uint32_t ep1s:1,
258 __BITFIELD_FIELD(uint32_t eqc:1,
259 __BITFIELD_FIELD(uint32_t cdl:1,
260 __BITFIELD_FIELD(uint32_t cde:4,
261 __BITFIELD_FIELD(uint32_t csos:1,
262 __BITFIELD_FIELD(uint32_t emc:1,
263 __BITFIELD_FIELD(uint32_t tm:3,
264 __BITFIELD_FIELD(uint32_t sde:1,
265 __BITFIELD_FIELD(uint32_t hasd:1,
266 __BITFIELD_FIELD(uint32_t ec:1,
267 __BITFIELD_FIELD(uint32_t tls:4,
268 ;)))))))))))))))
269 } s;
270};
271
272union cvmx_pciercx_cfg070 {
273 uint32_t u32;
274 struct cvmx_pciercx_cfg070_s {
275 __BITFIELD_FIELD(uint32_t reserved_12_31:20,
276 __BITFIELD_FIELD(uint32_t tplp:1,
277 __BITFIELD_FIELD(uint32_t reserved_9_10:2,
278 __BITFIELD_FIELD(uint32_t ce:1,
279 __BITFIELD_FIELD(uint32_t cc:1,
280 __BITFIELD_FIELD(uint32_t ge:1,
281 __BITFIELD_FIELD(uint32_t gc:1,
282 __BITFIELD_FIELD(uint32_t fep:5,
283 ;))))))))
284 } s;
285};
286
287union cvmx_pciercx_cfg075 {
288 uint32_t u32;
289 struct cvmx_pciercx_cfg075_s {
290 __BITFIELD_FIELD(uint32_t reserved_3_31:29,
291 __BITFIELD_FIELD(uint32_t fere:1,
292 __BITFIELD_FIELD(uint32_t nfere:1,
293 __BITFIELD_FIELD(uint32_t cere:1,
294 ;))))
295 } s;
296};
297
298union cvmx_pciercx_cfg448 {
299 uint32_t u32;
300 struct cvmx_pciercx_cfg448_s {
301 __BITFIELD_FIELD(uint32_t rtl:16,
302 __BITFIELD_FIELD(uint32_t rtltl:16,
303 ;))
304 } s;
305};
306
307union cvmx_pciercx_cfg452 {
308 uint32_t u32;
309 struct cvmx_pciercx_cfg452_s {
310 __BITFIELD_FIELD(uint32_t reserved_26_31:6,
311 __BITFIELD_FIELD(uint32_t eccrc:1,
312 __BITFIELD_FIELD(uint32_t reserved_22_24:3,
313 __BITFIELD_FIELD(uint32_t lme:6,
314 __BITFIELD_FIELD(uint32_t reserved_12_15:4,
315 __BITFIELD_FIELD(uint32_t link_rate:4,
316 __BITFIELD_FIELD(uint32_t flm:1,
317 __BITFIELD_FIELD(uint32_t reserved_6_6:1,
318 __BITFIELD_FIELD(uint32_t dllle:1,
319 __BITFIELD_FIELD(uint32_t reserved_4_4:1,
320 __BITFIELD_FIELD(uint32_t ra:1,
321 __BITFIELD_FIELD(uint32_t le:1,
322 __BITFIELD_FIELD(uint32_t sd:1,
323 __BITFIELD_FIELD(uint32_t omr:1,
324 ;))))))))))))))
325 } s;
326};
327
328union cvmx_pciercx_cfg455 {
329 uint32_t u32;
330 struct cvmx_pciercx_cfg455_s {
331 __BITFIELD_FIELD(uint32_t m_cfg0_filt:1,
332 __BITFIELD_FIELD(uint32_t m_io_filt:1,
333 __BITFIELD_FIELD(uint32_t msg_ctrl:1,
334 __BITFIELD_FIELD(uint32_t m_cpl_ecrc_filt:1,
335 __BITFIELD_FIELD(uint32_t m_ecrc_filt:1,
336 __BITFIELD_FIELD(uint32_t m_cpl_len_err:1,
337 __BITFIELD_FIELD(uint32_t m_cpl_attr_err:1,
338 __BITFIELD_FIELD(uint32_t m_cpl_tc_err:1,
339 __BITFIELD_FIELD(uint32_t m_cpl_fun_err:1,
340 __BITFIELD_FIELD(uint32_t m_cpl_rid_err:1,
341 __BITFIELD_FIELD(uint32_t m_cpl_tag_err:1,
342 __BITFIELD_FIELD(uint32_t m_lk_filt:1,
343 __BITFIELD_FIELD(uint32_t m_cfg1_filt:1,
344 __BITFIELD_FIELD(uint32_t m_bar_match:1,
345 __BITFIELD_FIELD(uint32_t m_pois_filt:1,
346 __BITFIELD_FIELD(uint32_t m_fun:1,
347 __BITFIELD_FIELD(uint32_t dfcwt:1,
348 __BITFIELD_FIELD(uint32_t reserved_11_14:4,
349 __BITFIELD_FIELD(uint32_t skpiv:11,
350 ;)))))))))))))))))))
351 } s;
352};
353
354union cvmx_pciercx_cfg515 {
355 uint32_t u32;
356 struct cvmx_pciercx_cfg515_s {
357 __BITFIELD_FIELD(uint32_t reserved_21_31:11,
358 __BITFIELD_FIELD(uint32_t s_d_e:1,
359 __BITFIELD_FIELD(uint32_t ctcrb:1,
360 __BITFIELD_FIELD(uint32_t cpyts:1,
361 __BITFIELD_FIELD(uint32_t dsc:1,
362 __BITFIELD_FIELD(uint32_t le:9,
363 __BITFIELD_FIELD(uint32_t n_fts:8,
364 ;)))))))
365 } s;
366};
367
368#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pcsx-defs.h b/arch/mips/include/asm/octeon/cvmx-pcsx-defs.h
new file mode 100644
index 000000000..5f013269a
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pcsx-defs.h
@@ -0,0 +1,826 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (C) 2003-2018 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_PCSX_DEFS_H__
29#define __CVMX_PCSX_DEFS_H__
30
31static inline uint64_t CVMX_PCSX_ANX_ADV_REG(unsigned long offset, unsigned long block_id)
32{
33 switch (cvmx_get_octeon_family()) {
34 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
35 return CVMX_ADD_IO_SEG(0x00011800B0001010ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
36 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
37 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
38 return CVMX_ADD_IO_SEG(0x00011800B0001010ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
39 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
40 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
41 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
42 return CVMX_ADD_IO_SEG(0x00011800B0001010ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
43 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
44 return CVMX_ADD_IO_SEG(0x00011800B0001010ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
45 }
46 return CVMX_ADD_IO_SEG(0x00011800B0001010ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
47}
48
49static inline uint64_t CVMX_PCSX_ANX_EXT_ST_REG(unsigned long offset, unsigned long block_id)
50{
51 switch (cvmx_get_octeon_family()) {
52 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
53 return CVMX_ADD_IO_SEG(0x00011800B0001028ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
54 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
55 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
56 return CVMX_ADD_IO_SEG(0x00011800B0001028ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
57 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
58 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
59 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
60 return CVMX_ADD_IO_SEG(0x00011800B0001028ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
61 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
62 return CVMX_ADD_IO_SEG(0x00011800B0001028ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
63 }
64 return CVMX_ADD_IO_SEG(0x00011800B0001028ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
65}
66
67static inline uint64_t CVMX_PCSX_ANX_LP_ABIL_REG(unsigned long offset, unsigned long block_id)
68{
69 switch (cvmx_get_octeon_family()) {
70 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
71 return CVMX_ADD_IO_SEG(0x00011800B0001018ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
72 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
73 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
74 return CVMX_ADD_IO_SEG(0x00011800B0001018ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
75 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
76 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
77 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
78 return CVMX_ADD_IO_SEG(0x00011800B0001018ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
79 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
80 return CVMX_ADD_IO_SEG(0x00011800B0001018ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
81 }
82 return CVMX_ADD_IO_SEG(0x00011800B0001018ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
83}
84
85static inline uint64_t CVMX_PCSX_ANX_RESULTS_REG(unsigned long offset, unsigned long block_id)
86{
87 switch (cvmx_get_octeon_family()) {
88 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
89 return CVMX_ADD_IO_SEG(0x00011800B0001020ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
90 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
91 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
92 return CVMX_ADD_IO_SEG(0x00011800B0001020ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
93 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
94 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
95 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
96 return CVMX_ADD_IO_SEG(0x00011800B0001020ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
97 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
98 return CVMX_ADD_IO_SEG(0x00011800B0001020ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
99 }
100 return CVMX_ADD_IO_SEG(0x00011800B0001020ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
101}
102
103static inline uint64_t CVMX_PCSX_INTX_EN_REG(unsigned long offset, unsigned long block_id)
104{
105 switch (cvmx_get_octeon_family()) {
106 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
107 return CVMX_ADD_IO_SEG(0x00011800B0001088ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
108 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
109 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
110 return CVMX_ADD_IO_SEG(0x00011800B0001088ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
111 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
112 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
113 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
114 return CVMX_ADD_IO_SEG(0x00011800B0001088ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
115 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
116 return CVMX_ADD_IO_SEG(0x00011800B0001088ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
117 }
118 return CVMX_ADD_IO_SEG(0x00011800B0001088ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
119}
120
121static inline uint64_t CVMX_PCSX_INTX_REG(unsigned long offset, unsigned long block_id)
122{
123 switch (cvmx_get_octeon_family()) {
124 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
125 return CVMX_ADD_IO_SEG(0x00011800B0001080ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
126 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
127 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
128 return CVMX_ADD_IO_SEG(0x00011800B0001080ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
129 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
130 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
131 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
132 return CVMX_ADD_IO_SEG(0x00011800B0001080ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
133 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
134 return CVMX_ADD_IO_SEG(0x00011800B0001080ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
135 }
136 return CVMX_ADD_IO_SEG(0x00011800B0001080ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
137}
138
139static inline uint64_t CVMX_PCSX_LINKX_TIMER_COUNT_REG(unsigned long offset, unsigned long block_id)
140{
141 switch (cvmx_get_octeon_family()) {
142 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
143 return CVMX_ADD_IO_SEG(0x00011800B0001040ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
144 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
145 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
146 return CVMX_ADD_IO_SEG(0x00011800B0001040ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
147 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
148 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
149 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
150 return CVMX_ADD_IO_SEG(0x00011800B0001040ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
151 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
152 return CVMX_ADD_IO_SEG(0x00011800B0001040ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
153 }
154 return CVMX_ADD_IO_SEG(0x00011800B0001040ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
155}
156
157static inline uint64_t CVMX_PCSX_LOG_ANLX_REG(unsigned long offset, unsigned long block_id)
158{
159 switch (cvmx_get_octeon_family()) {
160 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
161 return CVMX_ADD_IO_SEG(0x00011800B0001090ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
162 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
163 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
164 return CVMX_ADD_IO_SEG(0x00011800B0001090ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
165 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
166 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
167 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
168 return CVMX_ADD_IO_SEG(0x00011800B0001090ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
169 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
170 return CVMX_ADD_IO_SEG(0x00011800B0001090ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
171 }
172 return CVMX_ADD_IO_SEG(0x00011800B0001090ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
173}
174
175static inline uint64_t CVMX_PCSX_MISCX_CTL_REG(unsigned long offset, unsigned long block_id)
176{
177 switch (cvmx_get_octeon_family()) {
178 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
179 return CVMX_ADD_IO_SEG(0x00011800B0001078ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
180 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
181 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
182 return CVMX_ADD_IO_SEG(0x00011800B0001078ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
183 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
184 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
185 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
186 return CVMX_ADD_IO_SEG(0x00011800B0001078ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
187 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
188 return CVMX_ADD_IO_SEG(0x00011800B0001078ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
189 }
190 return CVMX_ADD_IO_SEG(0x00011800B0001078ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
191}
192
193static inline uint64_t CVMX_PCSX_MRX_CONTROL_REG(unsigned long offset, unsigned long block_id)
194{
195 switch (cvmx_get_octeon_family()) {
196 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
197 return CVMX_ADD_IO_SEG(0x00011800B0001000ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
198 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
199 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
200 return CVMX_ADD_IO_SEG(0x00011800B0001000ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
201 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
202 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
203 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
204 return CVMX_ADD_IO_SEG(0x00011800B0001000ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
205 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
206 return CVMX_ADD_IO_SEG(0x00011800B0001000ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
207 }
208 return CVMX_ADD_IO_SEG(0x00011800B0001000ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
209}
210
211static inline uint64_t CVMX_PCSX_MRX_STATUS_REG(unsigned long offset, unsigned long block_id)
212{
213 switch (cvmx_get_octeon_family()) {
214 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
215 return CVMX_ADD_IO_SEG(0x00011800B0001008ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
216 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
217 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
218 return CVMX_ADD_IO_SEG(0x00011800B0001008ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
219 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
220 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
221 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
222 return CVMX_ADD_IO_SEG(0x00011800B0001008ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
223 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
224 return CVMX_ADD_IO_SEG(0x00011800B0001008ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
225 }
226 return CVMX_ADD_IO_SEG(0x00011800B0001008ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
227}
228
229static inline uint64_t CVMX_PCSX_RXX_STATES_REG(unsigned long offset, unsigned long block_id)
230{
231 switch (cvmx_get_octeon_family()) {
232 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
233 return CVMX_ADD_IO_SEG(0x00011800B0001058ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
234 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
235 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
236 return CVMX_ADD_IO_SEG(0x00011800B0001058ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
237 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
238 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
239 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
240 return CVMX_ADD_IO_SEG(0x00011800B0001058ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
241 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
242 return CVMX_ADD_IO_SEG(0x00011800B0001058ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
243 }
244 return CVMX_ADD_IO_SEG(0x00011800B0001058ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
245}
246
247static inline uint64_t CVMX_PCSX_RXX_SYNC_REG(unsigned long offset, unsigned long block_id)
248{
249 switch (cvmx_get_octeon_family()) {
250 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
251 return CVMX_ADD_IO_SEG(0x00011800B0001050ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
252 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
253 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
254 return CVMX_ADD_IO_SEG(0x00011800B0001050ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
255 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
256 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
257 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
258 return CVMX_ADD_IO_SEG(0x00011800B0001050ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
259 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
260 return CVMX_ADD_IO_SEG(0x00011800B0001050ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
261 }
262 return CVMX_ADD_IO_SEG(0x00011800B0001050ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
263}
264
265static inline uint64_t CVMX_PCSX_SGMX_AN_ADV_REG(unsigned long offset, unsigned long block_id)
266{
267 switch (cvmx_get_octeon_family()) {
268 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
269 return CVMX_ADD_IO_SEG(0x00011800B0001068ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
270 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
271 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
272 return CVMX_ADD_IO_SEG(0x00011800B0001068ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
273 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
274 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
275 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
276 return CVMX_ADD_IO_SEG(0x00011800B0001068ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
277 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
278 return CVMX_ADD_IO_SEG(0x00011800B0001068ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
279 }
280 return CVMX_ADD_IO_SEG(0x00011800B0001068ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
281}
282
283static inline uint64_t CVMX_PCSX_SGMX_LP_ADV_REG(unsigned long offset, unsigned long block_id)
284{
285 switch (cvmx_get_octeon_family()) {
286 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
287 return CVMX_ADD_IO_SEG(0x00011800B0001070ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
288 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
289 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
290 return CVMX_ADD_IO_SEG(0x00011800B0001070ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
291 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
292 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
293 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
294 return CVMX_ADD_IO_SEG(0x00011800B0001070ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
295 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
296 return CVMX_ADD_IO_SEG(0x00011800B0001070ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
297 }
298 return CVMX_ADD_IO_SEG(0x00011800B0001070ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
299}
300
301static inline uint64_t CVMX_PCSX_TXX_STATES_REG(unsigned long offset, unsigned long block_id)
302{
303 switch (cvmx_get_octeon_family()) {
304 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
305 return CVMX_ADD_IO_SEG(0x00011800B0001060ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
306 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
307 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
308 return CVMX_ADD_IO_SEG(0x00011800B0001060ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
309 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
310 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
311 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
312 return CVMX_ADD_IO_SEG(0x00011800B0001060ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
313 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
314 return CVMX_ADD_IO_SEG(0x00011800B0001060ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
315 }
316 return CVMX_ADD_IO_SEG(0x00011800B0001060ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
317}
318
319static inline uint64_t CVMX_PCSX_TX_RXX_POLARITY_REG(unsigned long offset, unsigned long block_id)
320{
321 switch (cvmx_get_octeon_family()) {
322 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
323 return CVMX_ADD_IO_SEG(0x00011800B0001048ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
324 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
325 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
326 return CVMX_ADD_IO_SEG(0x00011800B0001048ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
327 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
328 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
329 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
330 return CVMX_ADD_IO_SEG(0x00011800B0001048ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
331 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
332 return CVMX_ADD_IO_SEG(0x00011800B0001048ull) + ((offset) + (block_id) * 0x4000ull) * 1024;
333 }
334 return CVMX_ADD_IO_SEG(0x00011800B0001048ull) + ((offset) + (block_id) * 0x20000ull) * 1024;
335}
336
337void __cvmx_interrupt_pcsx_intx_en_reg_enable(int index, int block);
338
339union cvmx_pcsx_anx_adv_reg {
340 uint64_t u64;
341 struct cvmx_pcsx_anx_adv_reg_s {
342#ifdef __BIG_ENDIAN_BITFIELD
343 uint64_t reserved_16_63:48;
344 uint64_t np:1;
345 uint64_t reserved_14_14:1;
346 uint64_t rem_flt:2;
347 uint64_t reserved_9_11:3;
348 uint64_t pause:2;
349 uint64_t hfd:1;
350 uint64_t fd:1;
351 uint64_t reserved_0_4:5;
352#else
353 uint64_t reserved_0_4:5;
354 uint64_t fd:1;
355 uint64_t hfd:1;
356 uint64_t pause:2;
357 uint64_t reserved_9_11:3;
358 uint64_t rem_flt:2;
359 uint64_t reserved_14_14:1;
360 uint64_t np:1;
361 uint64_t reserved_16_63:48;
362#endif
363 } s;
364};
365
366union cvmx_pcsx_anx_ext_st_reg {
367 uint64_t u64;
368 struct cvmx_pcsx_anx_ext_st_reg_s {
369#ifdef __BIG_ENDIAN_BITFIELD
370 uint64_t reserved_16_63:48;
371 uint64_t thou_xfd:1;
372 uint64_t thou_xhd:1;
373 uint64_t thou_tfd:1;
374 uint64_t thou_thd:1;
375 uint64_t reserved_0_11:12;
376#else
377 uint64_t reserved_0_11:12;
378 uint64_t thou_thd:1;
379 uint64_t thou_tfd:1;
380 uint64_t thou_xhd:1;
381 uint64_t thou_xfd:1;
382 uint64_t reserved_16_63:48;
383#endif
384 } s;
385};
386
387union cvmx_pcsx_anx_lp_abil_reg {
388 uint64_t u64;
389 struct cvmx_pcsx_anx_lp_abil_reg_s {
390#ifdef __BIG_ENDIAN_BITFIELD
391 uint64_t reserved_16_63:48;
392 uint64_t np:1;
393 uint64_t ack:1;
394 uint64_t rem_flt:2;
395 uint64_t reserved_9_11:3;
396 uint64_t pause:2;
397 uint64_t hfd:1;
398 uint64_t fd:1;
399 uint64_t reserved_0_4:5;
400#else
401 uint64_t reserved_0_4:5;
402 uint64_t fd:1;
403 uint64_t hfd:1;
404 uint64_t pause:2;
405 uint64_t reserved_9_11:3;
406 uint64_t rem_flt:2;
407 uint64_t ack:1;
408 uint64_t np:1;
409 uint64_t reserved_16_63:48;
410#endif
411 } s;
412};
413
414union cvmx_pcsx_anx_results_reg {
415 uint64_t u64;
416 struct cvmx_pcsx_anx_results_reg_s {
417#ifdef __BIG_ENDIAN_BITFIELD
418 uint64_t reserved_7_63:57;
419 uint64_t pause:2;
420 uint64_t spd:2;
421 uint64_t an_cpt:1;
422 uint64_t dup:1;
423 uint64_t link_ok:1;
424#else
425 uint64_t link_ok:1;
426 uint64_t dup:1;
427 uint64_t an_cpt:1;
428 uint64_t spd:2;
429 uint64_t pause:2;
430 uint64_t reserved_7_63:57;
431#endif
432 } s;
433};
434
435union cvmx_pcsx_intx_en_reg {
436 uint64_t u64;
437 struct cvmx_pcsx_intx_en_reg_s {
438#ifdef __BIG_ENDIAN_BITFIELD
439 uint64_t reserved_13_63:51;
440 uint64_t dbg_sync_en:1;
441 uint64_t dup:1;
442 uint64_t sync_bad_en:1;
443 uint64_t an_bad_en:1;
444 uint64_t rxlock_en:1;
445 uint64_t rxbad_en:1;
446 uint64_t rxerr_en:1;
447 uint64_t txbad_en:1;
448 uint64_t txfifo_en:1;
449 uint64_t txfifu_en:1;
450 uint64_t an_err_en:1;
451 uint64_t xmit_en:1;
452 uint64_t lnkspd_en:1;
453#else
454 uint64_t lnkspd_en:1;
455 uint64_t xmit_en:1;
456 uint64_t an_err_en:1;
457 uint64_t txfifu_en:1;
458 uint64_t txfifo_en:1;
459 uint64_t txbad_en:1;
460 uint64_t rxerr_en:1;
461 uint64_t rxbad_en:1;
462 uint64_t rxlock_en:1;
463 uint64_t an_bad_en:1;
464 uint64_t sync_bad_en:1;
465 uint64_t dup:1;
466 uint64_t dbg_sync_en:1;
467 uint64_t reserved_13_63:51;
468#endif
469 } s;
470 struct cvmx_pcsx_intx_en_reg_cn52xx {
471#ifdef __BIG_ENDIAN_BITFIELD
472 uint64_t reserved_12_63:52;
473 uint64_t dup:1;
474 uint64_t sync_bad_en:1;
475 uint64_t an_bad_en:1;
476 uint64_t rxlock_en:1;
477 uint64_t rxbad_en:1;
478 uint64_t rxerr_en:1;
479 uint64_t txbad_en:1;
480 uint64_t txfifo_en:1;
481 uint64_t txfifu_en:1;
482 uint64_t an_err_en:1;
483 uint64_t xmit_en:1;
484 uint64_t lnkspd_en:1;
485#else
486 uint64_t lnkspd_en:1;
487 uint64_t xmit_en:1;
488 uint64_t an_err_en:1;
489 uint64_t txfifu_en:1;
490 uint64_t txfifo_en:1;
491 uint64_t txbad_en:1;
492 uint64_t rxerr_en:1;
493 uint64_t rxbad_en:1;
494 uint64_t rxlock_en:1;
495 uint64_t an_bad_en:1;
496 uint64_t sync_bad_en:1;
497 uint64_t dup:1;
498 uint64_t reserved_12_63:52;
499#endif
500 } cn52xx;
501};
502
503union cvmx_pcsx_intx_reg {
504 uint64_t u64;
505 struct cvmx_pcsx_intx_reg_s {
506#ifdef __BIG_ENDIAN_BITFIELD
507 uint64_t reserved_13_63:51;
508 uint64_t dbg_sync:1;
509 uint64_t dup:1;
510 uint64_t sync_bad:1;
511 uint64_t an_bad:1;
512 uint64_t rxlock:1;
513 uint64_t rxbad:1;
514 uint64_t rxerr:1;
515 uint64_t txbad:1;
516 uint64_t txfifo:1;
517 uint64_t txfifu:1;
518 uint64_t an_err:1;
519 uint64_t xmit:1;
520 uint64_t lnkspd:1;
521#else
522 uint64_t lnkspd:1;
523 uint64_t xmit:1;
524 uint64_t an_err:1;
525 uint64_t txfifu:1;
526 uint64_t txfifo:1;
527 uint64_t txbad:1;
528 uint64_t rxerr:1;
529 uint64_t rxbad:1;
530 uint64_t rxlock:1;
531 uint64_t an_bad:1;
532 uint64_t sync_bad:1;
533 uint64_t dup:1;
534 uint64_t dbg_sync:1;
535 uint64_t reserved_13_63:51;
536#endif
537 } s;
538 struct cvmx_pcsx_intx_reg_cn52xx {
539#ifdef __BIG_ENDIAN_BITFIELD
540 uint64_t reserved_12_63:52;
541 uint64_t dup:1;
542 uint64_t sync_bad:1;
543 uint64_t an_bad:1;
544 uint64_t rxlock:1;
545 uint64_t rxbad:1;
546 uint64_t rxerr:1;
547 uint64_t txbad:1;
548 uint64_t txfifo:1;
549 uint64_t txfifu:1;
550 uint64_t an_err:1;
551 uint64_t xmit:1;
552 uint64_t lnkspd:1;
553#else
554 uint64_t lnkspd:1;
555 uint64_t xmit:1;
556 uint64_t an_err:1;
557 uint64_t txfifu:1;
558 uint64_t txfifo:1;
559 uint64_t txbad:1;
560 uint64_t rxerr:1;
561 uint64_t rxbad:1;
562 uint64_t rxlock:1;
563 uint64_t an_bad:1;
564 uint64_t sync_bad:1;
565 uint64_t dup:1;
566 uint64_t reserved_12_63:52;
567#endif
568 } cn52xx;
569};
570
571union cvmx_pcsx_linkx_timer_count_reg {
572 uint64_t u64;
573 struct cvmx_pcsx_linkx_timer_count_reg_s {
574#ifdef __BIG_ENDIAN_BITFIELD
575 uint64_t reserved_16_63:48;
576 uint64_t count:16;
577#else
578 uint64_t count:16;
579 uint64_t reserved_16_63:48;
580#endif
581 } s;
582};
583
584union cvmx_pcsx_log_anlx_reg {
585 uint64_t u64;
586 struct cvmx_pcsx_log_anlx_reg_s {
587#ifdef __BIG_ENDIAN_BITFIELD
588 uint64_t reserved_4_63:60;
589 uint64_t lafifovfl:1;
590 uint64_t la_en:1;
591 uint64_t pkt_sz:2;
592#else
593 uint64_t pkt_sz:2;
594 uint64_t la_en:1;
595 uint64_t lafifovfl:1;
596 uint64_t reserved_4_63:60;
597#endif
598 } s;
599};
600
601union cvmx_pcsx_miscx_ctl_reg {
602 uint64_t u64;
603 struct cvmx_pcsx_miscx_ctl_reg_s {
604#ifdef __BIG_ENDIAN_BITFIELD
605 uint64_t reserved_13_63:51;
606 uint64_t sgmii:1;
607 uint64_t gmxeno:1;
608 uint64_t loopbck2:1;
609 uint64_t mac_phy:1;
610 uint64_t mode:1;
611 uint64_t an_ovrd:1;
612 uint64_t samp_pt:7;
613#else
614 uint64_t samp_pt:7;
615 uint64_t an_ovrd:1;
616 uint64_t mode:1;
617 uint64_t mac_phy:1;
618 uint64_t loopbck2:1;
619 uint64_t gmxeno:1;
620 uint64_t sgmii:1;
621 uint64_t reserved_13_63:51;
622#endif
623 } s;
624};
625
626union cvmx_pcsx_mrx_control_reg {
627 uint64_t u64;
628 struct cvmx_pcsx_mrx_control_reg_s {
629#ifdef __BIG_ENDIAN_BITFIELD
630 uint64_t reserved_16_63:48;
631 uint64_t reset:1;
632 uint64_t loopbck1:1;
633 uint64_t spdlsb:1;
634 uint64_t an_en:1;
635 uint64_t pwr_dn:1;
636 uint64_t reserved_10_10:1;
637 uint64_t rst_an:1;
638 uint64_t dup:1;
639 uint64_t coltst:1;
640 uint64_t spdmsb:1;
641 uint64_t uni:1;
642 uint64_t reserved_0_4:5;
643#else
644 uint64_t reserved_0_4:5;
645 uint64_t uni:1;
646 uint64_t spdmsb:1;
647 uint64_t coltst:1;
648 uint64_t dup:1;
649 uint64_t rst_an:1;
650 uint64_t reserved_10_10:1;
651 uint64_t pwr_dn:1;
652 uint64_t an_en:1;
653 uint64_t spdlsb:1;
654 uint64_t loopbck1:1;
655 uint64_t reset:1;
656 uint64_t reserved_16_63:48;
657#endif
658 } s;
659};
660
661union cvmx_pcsx_mrx_status_reg {
662 uint64_t u64;
663 struct cvmx_pcsx_mrx_status_reg_s {
664#ifdef __BIG_ENDIAN_BITFIELD
665 uint64_t reserved_16_63:48;
666 uint64_t hun_t4:1;
667 uint64_t hun_xfd:1;
668 uint64_t hun_xhd:1;
669 uint64_t ten_fd:1;
670 uint64_t ten_hd:1;
671 uint64_t hun_t2fd:1;
672 uint64_t hun_t2hd:1;
673 uint64_t ext_st:1;
674 uint64_t reserved_7_7:1;
675 uint64_t prb_sup:1;
676 uint64_t an_cpt:1;
677 uint64_t rm_flt:1;
678 uint64_t an_abil:1;
679 uint64_t lnk_st:1;
680 uint64_t reserved_1_1:1;
681 uint64_t extnd:1;
682#else
683 uint64_t extnd:1;
684 uint64_t reserved_1_1:1;
685 uint64_t lnk_st:1;
686 uint64_t an_abil:1;
687 uint64_t rm_flt:1;
688 uint64_t an_cpt:1;
689 uint64_t prb_sup:1;
690 uint64_t reserved_7_7:1;
691 uint64_t ext_st:1;
692 uint64_t hun_t2hd:1;
693 uint64_t hun_t2fd:1;
694 uint64_t ten_hd:1;
695 uint64_t ten_fd:1;
696 uint64_t hun_xhd:1;
697 uint64_t hun_xfd:1;
698 uint64_t hun_t4:1;
699 uint64_t reserved_16_63:48;
700#endif
701 } s;
702};
703
704union cvmx_pcsx_rxx_states_reg {
705 uint64_t u64;
706 struct cvmx_pcsx_rxx_states_reg_s {
707#ifdef __BIG_ENDIAN_BITFIELD
708 uint64_t reserved_16_63:48;
709 uint64_t rx_bad:1;
710 uint64_t rx_st:5;
711 uint64_t sync_bad:1;
712 uint64_t sync:4;
713 uint64_t an_bad:1;
714 uint64_t an_st:4;
715#else
716 uint64_t an_st:4;
717 uint64_t an_bad:1;
718 uint64_t sync:4;
719 uint64_t sync_bad:1;
720 uint64_t rx_st:5;
721 uint64_t rx_bad:1;
722 uint64_t reserved_16_63:48;
723#endif
724 } s;
725};
726
727union cvmx_pcsx_rxx_sync_reg {
728 uint64_t u64;
729 struct cvmx_pcsx_rxx_sync_reg_s {
730#ifdef __BIG_ENDIAN_BITFIELD
731 uint64_t reserved_2_63:62;
732 uint64_t sync:1;
733 uint64_t bit_lock:1;
734#else
735 uint64_t bit_lock:1;
736 uint64_t sync:1;
737 uint64_t reserved_2_63:62;
738#endif
739 } s;
740};
741
742union cvmx_pcsx_sgmx_an_adv_reg {
743 uint64_t u64;
744 struct cvmx_pcsx_sgmx_an_adv_reg_s {
745#ifdef __BIG_ENDIAN_BITFIELD
746 uint64_t reserved_16_63:48;
747 uint64_t link:1;
748 uint64_t ack:1;
749 uint64_t reserved_13_13:1;
750 uint64_t dup:1;
751 uint64_t speed:2;
752 uint64_t reserved_1_9:9;
753 uint64_t one:1;
754#else
755 uint64_t one:1;
756 uint64_t reserved_1_9:9;
757 uint64_t speed:2;
758 uint64_t dup:1;
759 uint64_t reserved_13_13:1;
760 uint64_t ack:1;
761 uint64_t link:1;
762 uint64_t reserved_16_63:48;
763#endif
764 } s;
765};
766
767union cvmx_pcsx_sgmx_lp_adv_reg {
768 uint64_t u64;
769 struct cvmx_pcsx_sgmx_lp_adv_reg_s {
770#ifdef __BIG_ENDIAN_BITFIELD
771 uint64_t reserved_16_63:48;
772 uint64_t link:1;
773 uint64_t reserved_13_14:2;
774 uint64_t dup:1;
775 uint64_t speed:2;
776 uint64_t reserved_1_9:9;
777 uint64_t one:1;
778#else
779 uint64_t one:1;
780 uint64_t reserved_1_9:9;
781 uint64_t speed:2;
782 uint64_t dup:1;
783 uint64_t reserved_13_14:2;
784 uint64_t link:1;
785 uint64_t reserved_16_63:48;
786#endif
787 } s;
788};
789
790union cvmx_pcsx_txx_states_reg {
791 uint64_t u64;
792 struct cvmx_pcsx_txx_states_reg_s {
793#ifdef __BIG_ENDIAN_BITFIELD
794 uint64_t reserved_7_63:57;
795 uint64_t xmit:2;
796 uint64_t tx_bad:1;
797 uint64_t ord_st:4;
798#else
799 uint64_t ord_st:4;
800 uint64_t tx_bad:1;
801 uint64_t xmit:2;
802 uint64_t reserved_7_63:57;
803#endif
804 } s;
805};
806
807union cvmx_pcsx_tx_rxx_polarity_reg {
808 uint64_t u64;
809 struct cvmx_pcsx_tx_rxx_polarity_reg_s {
810#ifdef __BIG_ENDIAN_BITFIELD
811 uint64_t reserved_4_63:60;
812 uint64_t rxovrd:1;
813 uint64_t autorxpl:1;
814 uint64_t rxplrt:1;
815 uint64_t txplrt:1;
816#else
817 uint64_t txplrt:1;
818 uint64_t rxplrt:1;
819 uint64_t autorxpl:1;
820 uint64_t rxovrd:1;
821 uint64_t reserved_4_63:60;
822#endif
823 } s;
824};
825
826#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pcsxx-defs.h b/arch/mips/include/asm/octeon/cvmx-pcsxx-defs.h
new file mode 100644
index 000000000..b353775ee
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pcsxx-defs.h
@@ -0,0 +1,664 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (C) 2003-2018 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_PCSXX_DEFS_H__
29#define __CVMX_PCSXX_DEFS_H__
30
31static inline uint64_t CVMX_PCSXX_10GBX_STATUS_REG(unsigned long block_id)
32{
33 switch (cvmx_get_octeon_family()) {
34 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
35 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
36 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
37 return CVMX_ADD_IO_SEG(0x00011800B0000828ull) + (block_id) * 0x8000000ull;
38 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
39 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
40 return CVMX_ADD_IO_SEG(0x00011800B0000828ull) + (block_id) * 0x8000000ull;
41 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
42 return CVMX_ADD_IO_SEG(0x00011800B0000828ull) + (block_id) * 0x1000000ull;
43 }
44 return CVMX_ADD_IO_SEG(0x00011800B0000828ull) + (block_id) * 0x1000000ull;
45}
46
47static inline uint64_t CVMX_PCSXX_BIST_STATUS_REG(unsigned long block_id)
48{
49 switch (cvmx_get_octeon_family()) {
50 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
51 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
52 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
53 return CVMX_ADD_IO_SEG(0x00011800B0000870ull) + (block_id) * 0x8000000ull;
54 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
55 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
56 return CVMX_ADD_IO_SEG(0x00011800B0000870ull) + (block_id) * 0x8000000ull;
57 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
58 return CVMX_ADD_IO_SEG(0x00011800B0000870ull) + (block_id) * 0x1000000ull;
59 }
60 return CVMX_ADD_IO_SEG(0x00011800B0000870ull) + (block_id) * 0x1000000ull;
61}
62
63static inline uint64_t CVMX_PCSXX_BIT_LOCK_STATUS_REG(unsigned long block_id)
64{
65 switch (cvmx_get_octeon_family()) {
66 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
67 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
68 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
69 return CVMX_ADD_IO_SEG(0x00011800B0000850ull) + (block_id) * 0x8000000ull;
70 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
71 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
72 return CVMX_ADD_IO_SEG(0x00011800B0000850ull) + (block_id) * 0x8000000ull;
73 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
74 return CVMX_ADD_IO_SEG(0x00011800B0000850ull) + (block_id) * 0x1000000ull;
75 }
76 return CVMX_ADD_IO_SEG(0x00011800B0000850ull) + (block_id) * 0x1000000ull;
77}
78
79static inline uint64_t CVMX_PCSXX_CONTROL1_REG(unsigned long block_id)
80{
81 switch (cvmx_get_octeon_family()) {
82 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
83 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
84 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
85 return CVMX_ADD_IO_SEG(0x00011800B0000800ull) + (block_id) * 0x8000000ull;
86 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
87 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
88 return CVMX_ADD_IO_SEG(0x00011800B0000800ull) + (block_id) * 0x8000000ull;
89 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
90 return CVMX_ADD_IO_SEG(0x00011800B0000800ull) + (block_id) * 0x1000000ull;
91 }
92 return CVMX_ADD_IO_SEG(0x00011800B0000800ull) + (block_id) * 0x1000000ull;
93}
94
95static inline uint64_t CVMX_PCSXX_CONTROL2_REG(unsigned long block_id)
96{
97 switch (cvmx_get_octeon_family()) {
98 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
99 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
100 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
101 return CVMX_ADD_IO_SEG(0x00011800B0000818ull) + (block_id) * 0x8000000ull;
102 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
103 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
104 return CVMX_ADD_IO_SEG(0x00011800B0000818ull) + (block_id) * 0x8000000ull;
105 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
106 return CVMX_ADD_IO_SEG(0x00011800B0000818ull) + (block_id) * 0x1000000ull;
107 }
108 return CVMX_ADD_IO_SEG(0x00011800B0000818ull) + (block_id) * 0x1000000ull;
109}
110
111static inline uint64_t CVMX_PCSXX_INT_EN_REG(unsigned long block_id)
112{
113 switch (cvmx_get_octeon_family()) {
114 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
115 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
116 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
117 return CVMX_ADD_IO_SEG(0x00011800B0000860ull) + (block_id) * 0x8000000ull;
118 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
119 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
120 return CVMX_ADD_IO_SEG(0x00011800B0000860ull) + (block_id) * 0x8000000ull;
121 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
122 return CVMX_ADD_IO_SEG(0x00011800B0000860ull) + (block_id) * 0x1000000ull;
123 }
124 return CVMX_ADD_IO_SEG(0x00011800B0000860ull) + (block_id) * 0x1000000ull;
125}
126
127static inline uint64_t CVMX_PCSXX_INT_REG(unsigned long block_id)
128{
129 switch (cvmx_get_octeon_family()) {
130 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
131 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
132 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
133 return CVMX_ADD_IO_SEG(0x00011800B0000858ull) + (block_id) * 0x8000000ull;
134 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
135 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
136 return CVMX_ADD_IO_SEG(0x00011800B0000858ull) + (block_id) * 0x8000000ull;
137 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
138 return CVMX_ADD_IO_SEG(0x00011800B0000858ull) + (block_id) * 0x1000000ull;
139 }
140 return CVMX_ADD_IO_SEG(0x00011800B0000858ull) + (block_id) * 0x1000000ull;
141}
142
143static inline uint64_t CVMX_PCSXX_LOG_ANL_REG(unsigned long block_id)
144{
145 switch (cvmx_get_octeon_family()) {
146 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
147 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
148 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
149 return CVMX_ADD_IO_SEG(0x00011800B0000868ull) + (block_id) * 0x8000000ull;
150 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
151 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
152 return CVMX_ADD_IO_SEG(0x00011800B0000868ull) + (block_id) * 0x8000000ull;
153 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
154 return CVMX_ADD_IO_SEG(0x00011800B0000868ull) + (block_id) * 0x1000000ull;
155 }
156 return CVMX_ADD_IO_SEG(0x00011800B0000868ull) + (block_id) * 0x1000000ull;
157}
158
159static inline uint64_t CVMX_PCSXX_MISC_CTL_REG(unsigned long block_id)
160{
161 switch (cvmx_get_octeon_family()) {
162 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
163 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
164 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
165 return CVMX_ADD_IO_SEG(0x00011800B0000848ull) + (block_id) * 0x8000000ull;
166 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
167 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
168 return CVMX_ADD_IO_SEG(0x00011800B0000848ull) + (block_id) * 0x8000000ull;
169 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
170 return CVMX_ADD_IO_SEG(0x00011800B0000848ull) + (block_id) * 0x1000000ull;
171 }
172 return CVMX_ADD_IO_SEG(0x00011800B0000848ull) + (block_id) * 0x1000000ull;
173}
174
175static inline uint64_t CVMX_PCSXX_RX_SYNC_STATES_REG(unsigned long block_id)
176{
177 switch (cvmx_get_octeon_family()) {
178 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
179 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
180 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
181 return CVMX_ADD_IO_SEG(0x00011800B0000838ull) + (block_id) * 0x8000000ull;
182 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
183 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
184 return CVMX_ADD_IO_SEG(0x00011800B0000838ull) + (block_id) * 0x8000000ull;
185 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
186 return CVMX_ADD_IO_SEG(0x00011800B0000838ull) + (block_id) * 0x1000000ull;
187 }
188 return CVMX_ADD_IO_SEG(0x00011800B0000838ull) + (block_id) * 0x1000000ull;
189}
190
191static inline uint64_t CVMX_PCSXX_SPD_ABIL_REG(unsigned long block_id)
192{
193 switch (cvmx_get_octeon_family()) {
194 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
195 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
196 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
197 return CVMX_ADD_IO_SEG(0x00011800B0000810ull) + (block_id) * 0x8000000ull;
198 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
199 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
200 return CVMX_ADD_IO_SEG(0x00011800B0000810ull) + (block_id) * 0x8000000ull;
201 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
202 return CVMX_ADD_IO_SEG(0x00011800B0000810ull) + (block_id) * 0x1000000ull;
203 }
204 return CVMX_ADD_IO_SEG(0x00011800B0000810ull) + (block_id) * 0x1000000ull;
205}
206
207static inline uint64_t CVMX_PCSXX_STATUS1_REG(unsigned long block_id)
208{
209 switch (cvmx_get_octeon_family()) {
210 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
211 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
212 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
213 return CVMX_ADD_IO_SEG(0x00011800B0000808ull) + (block_id) * 0x8000000ull;
214 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
215 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
216 return CVMX_ADD_IO_SEG(0x00011800B0000808ull) + (block_id) * 0x8000000ull;
217 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
218 return CVMX_ADD_IO_SEG(0x00011800B0000808ull) + (block_id) * 0x1000000ull;
219 }
220 return CVMX_ADD_IO_SEG(0x00011800B0000808ull) + (block_id) * 0x1000000ull;
221}
222
223static inline uint64_t CVMX_PCSXX_STATUS2_REG(unsigned long block_id)
224{
225 switch (cvmx_get_octeon_family()) {
226 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
227 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
228 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
229 return CVMX_ADD_IO_SEG(0x00011800B0000820ull) + (block_id) * 0x8000000ull;
230 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
231 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
232 return CVMX_ADD_IO_SEG(0x00011800B0000820ull) + (block_id) * 0x8000000ull;
233 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
234 return CVMX_ADD_IO_SEG(0x00011800B0000820ull) + (block_id) * 0x1000000ull;
235 }
236 return CVMX_ADD_IO_SEG(0x00011800B0000820ull) + (block_id) * 0x1000000ull;
237}
238
239static inline uint64_t CVMX_PCSXX_TX_RX_POLARITY_REG(unsigned long block_id)
240{
241 switch (cvmx_get_octeon_family()) {
242 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
243 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
244 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
245 return CVMX_ADD_IO_SEG(0x00011800B0000840ull) + (block_id) * 0x8000000ull;
246 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
247 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
248 return CVMX_ADD_IO_SEG(0x00011800B0000840ull) + (block_id) * 0x8000000ull;
249 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
250 return CVMX_ADD_IO_SEG(0x00011800B0000840ull) + (block_id) * 0x1000000ull;
251 }
252 return CVMX_ADD_IO_SEG(0x00011800B0000840ull) + (block_id) * 0x1000000ull;
253}
254
255static inline uint64_t CVMX_PCSXX_TX_RX_STATES_REG(unsigned long block_id)
256{
257 switch (cvmx_get_octeon_family()) {
258 case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
259 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
260 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
261 return CVMX_ADD_IO_SEG(0x00011800B0000830ull) + (block_id) * 0x8000000ull;
262 case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
263 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
264 return CVMX_ADD_IO_SEG(0x00011800B0000830ull) + (block_id) * 0x8000000ull;
265 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
266 return CVMX_ADD_IO_SEG(0x00011800B0000830ull) + (block_id) * 0x1000000ull;
267 }
268 return CVMX_ADD_IO_SEG(0x00011800B0000830ull) + (block_id) * 0x1000000ull;
269}
270
271void __cvmx_interrupt_pcsxx_int_en_reg_enable(int index);
272
273union cvmx_pcsxx_10gbx_status_reg {
274 uint64_t u64;
275 struct cvmx_pcsxx_10gbx_status_reg_s {
276#ifdef __BIG_ENDIAN_BITFIELD
277 uint64_t reserved_13_63:51;
278 uint64_t alignd:1;
279 uint64_t pattst:1;
280 uint64_t reserved_4_10:7;
281 uint64_t l3sync:1;
282 uint64_t l2sync:1;
283 uint64_t l1sync:1;
284 uint64_t l0sync:1;
285#else
286 uint64_t l0sync:1;
287 uint64_t l1sync:1;
288 uint64_t l2sync:1;
289 uint64_t l3sync:1;
290 uint64_t reserved_4_10:7;
291 uint64_t pattst:1;
292 uint64_t alignd:1;
293 uint64_t reserved_13_63:51;
294#endif
295 } s;
296};
297
298union cvmx_pcsxx_bist_status_reg {
299 uint64_t u64;
300 struct cvmx_pcsxx_bist_status_reg_s {
301#ifdef __BIG_ENDIAN_BITFIELD
302 uint64_t reserved_1_63:63;
303 uint64_t bist_status:1;
304#else
305 uint64_t bist_status:1;
306 uint64_t reserved_1_63:63;
307#endif
308 } s;
309};
310
311union cvmx_pcsxx_bit_lock_status_reg {
312 uint64_t u64;
313 struct cvmx_pcsxx_bit_lock_status_reg_s {
314#ifdef __BIG_ENDIAN_BITFIELD
315 uint64_t reserved_4_63:60;
316 uint64_t bitlck3:1;
317 uint64_t bitlck2:1;
318 uint64_t bitlck1:1;
319 uint64_t bitlck0:1;
320#else
321 uint64_t bitlck0:1;
322 uint64_t bitlck1:1;
323 uint64_t bitlck2:1;
324 uint64_t bitlck3:1;
325 uint64_t reserved_4_63:60;
326#endif
327 } s;
328};
329
330union cvmx_pcsxx_control1_reg {
331 uint64_t u64;
332 struct cvmx_pcsxx_control1_reg_s {
333#ifdef __BIG_ENDIAN_BITFIELD
334 uint64_t reserved_16_63:48;
335 uint64_t reset:1;
336 uint64_t loopbck1:1;
337 uint64_t spdsel1:1;
338 uint64_t reserved_12_12:1;
339 uint64_t lo_pwr:1;
340 uint64_t reserved_7_10:4;
341 uint64_t spdsel0:1;
342 uint64_t spd:4;
343 uint64_t reserved_0_1:2;
344#else
345 uint64_t reserved_0_1:2;
346 uint64_t spd:4;
347 uint64_t spdsel0:1;
348 uint64_t reserved_7_10:4;
349 uint64_t lo_pwr:1;
350 uint64_t reserved_12_12:1;
351 uint64_t spdsel1:1;
352 uint64_t loopbck1:1;
353 uint64_t reset:1;
354 uint64_t reserved_16_63:48;
355#endif
356 } s;
357};
358
359union cvmx_pcsxx_control2_reg {
360 uint64_t u64;
361 struct cvmx_pcsxx_control2_reg_s {
362#ifdef __BIG_ENDIAN_BITFIELD
363 uint64_t reserved_2_63:62;
364 uint64_t type:2;
365#else
366 uint64_t type:2;
367 uint64_t reserved_2_63:62;
368#endif
369 } s;
370};
371
372union cvmx_pcsxx_int_en_reg {
373 uint64_t u64;
374 struct cvmx_pcsxx_int_en_reg_s {
375#ifdef __BIG_ENDIAN_BITFIELD
376 uint64_t reserved_7_63:57;
377 uint64_t dbg_sync_en:1;
378 uint64_t algnlos_en:1;
379 uint64_t synlos_en:1;
380 uint64_t bitlckls_en:1;
381 uint64_t rxsynbad_en:1;
382 uint64_t rxbad_en:1;
383 uint64_t txflt_en:1;
384#else
385 uint64_t txflt_en:1;
386 uint64_t rxbad_en:1;
387 uint64_t rxsynbad_en:1;
388 uint64_t bitlckls_en:1;
389 uint64_t synlos_en:1;
390 uint64_t algnlos_en:1;
391 uint64_t dbg_sync_en:1;
392 uint64_t reserved_7_63:57;
393#endif
394 } s;
395 struct cvmx_pcsxx_int_en_reg_cn52xx {
396#ifdef __BIG_ENDIAN_BITFIELD
397 uint64_t reserved_6_63:58;
398 uint64_t algnlos_en:1;
399 uint64_t synlos_en:1;
400 uint64_t bitlckls_en:1;
401 uint64_t rxsynbad_en:1;
402 uint64_t rxbad_en:1;
403 uint64_t txflt_en:1;
404#else
405 uint64_t txflt_en:1;
406 uint64_t rxbad_en:1;
407 uint64_t rxsynbad_en:1;
408 uint64_t bitlckls_en:1;
409 uint64_t synlos_en:1;
410 uint64_t algnlos_en:1;
411 uint64_t reserved_6_63:58;
412#endif
413 } cn52xx;
414};
415
416union cvmx_pcsxx_int_reg {
417 uint64_t u64;
418 struct cvmx_pcsxx_int_reg_s {
419#ifdef __BIG_ENDIAN_BITFIELD
420 uint64_t reserved_7_63:57;
421 uint64_t dbg_sync:1;
422 uint64_t algnlos:1;
423 uint64_t synlos:1;
424 uint64_t bitlckls:1;
425 uint64_t rxsynbad:1;
426 uint64_t rxbad:1;
427 uint64_t txflt:1;
428#else
429 uint64_t txflt:1;
430 uint64_t rxbad:1;
431 uint64_t rxsynbad:1;
432 uint64_t bitlckls:1;
433 uint64_t synlos:1;
434 uint64_t algnlos:1;
435 uint64_t dbg_sync:1;
436 uint64_t reserved_7_63:57;
437#endif
438 } s;
439 struct cvmx_pcsxx_int_reg_cn52xx {
440#ifdef __BIG_ENDIAN_BITFIELD
441 uint64_t reserved_6_63:58;
442 uint64_t algnlos:1;
443 uint64_t synlos:1;
444 uint64_t bitlckls:1;
445 uint64_t rxsynbad:1;
446 uint64_t rxbad:1;
447 uint64_t txflt:1;
448#else
449 uint64_t txflt:1;
450 uint64_t rxbad:1;
451 uint64_t rxsynbad:1;
452 uint64_t bitlckls:1;
453 uint64_t synlos:1;
454 uint64_t algnlos:1;
455 uint64_t reserved_6_63:58;
456#endif
457 } cn52xx;
458};
459
460union cvmx_pcsxx_log_anl_reg {
461 uint64_t u64;
462 struct cvmx_pcsxx_log_anl_reg_s {
463#ifdef __BIG_ENDIAN_BITFIELD
464 uint64_t reserved_7_63:57;
465 uint64_t enc_mode:1;
466 uint64_t drop_ln:2;
467 uint64_t lafifovfl:1;
468 uint64_t la_en:1;
469 uint64_t pkt_sz:2;
470#else
471 uint64_t pkt_sz:2;
472 uint64_t la_en:1;
473 uint64_t lafifovfl:1;
474 uint64_t drop_ln:2;
475 uint64_t enc_mode:1;
476 uint64_t reserved_7_63:57;
477#endif
478 } s;
479};
480
481union cvmx_pcsxx_misc_ctl_reg {
482 uint64_t u64;
483 struct cvmx_pcsxx_misc_ctl_reg_s {
484#ifdef __BIG_ENDIAN_BITFIELD
485 uint64_t reserved_4_63:60;
486 uint64_t tx_swap:1;
487 uint64_t rx_swap:1;
488 uint64_t xaui:1;
489 uint64_t gmxeno:1;
490#else
491 uint64_t gmxeno:1;
492 uint64_t xaui:1;
493 uint64_t rx_swap:1;
494 uint64_t tx_swap:1;
495 uint64_t reserved_4_63:60;
496#endif
497 } s;
498};
499
500union cvmx_pcsxx_rx_sync_states_reg {
501 uint64_t u64;
502 struct cvmx_pcsxx_rx_sync_states_reg_s {
503#ifdef __BIG_ENDIAN_BITFIELD
504 uint64_t reserved_16_63:48;
505 uint64_t sync3st:4;
506 uint64_t sync2st:4;
507 uint64_t sync1st:4;
508 uint64_t sync0st:4;
509#else
510 uint64_t sync0st:4;
511 uint64_t sync1st:4;
512 uint64_t sync2st:4;
513 uint64_t sync3st:4;
514 uint64_t reserved_16_63:48;
515#endif
516 } s;
517};
518
519union cvmx_pcsxx_spd_abil_reg {
520 uint64_t u64;
521 struct cvmx_pcsxx_spd_abil_reg_s {
522#ifdef __BIG_ENDIAN_BITFIELD
523 uint64_t reserved_2_63:62;
524 uint64_t tenpasst:1;
525 uint64_t tengb:1;
526#else
527 uint64_t tengb:1;
528 uint64_t tenpasst:1;
529 uint64_t reserved_2_63:62;
530#endif
531 } s;
532};
533
534union cvmx_pcsxx_status1_reg {
535 uint64_t u64;
536 struct cvmx_pcsxx_status1_reg_s {
537#ifdef __BIG_ENDIAN_BITFIELD
538 uint64_t reserved_8_63:56;
539 uint64_t flt:1;
540 uint64_t reserved_3_6:4;
541 uint64_t rcv_lnk:1;
542 uint64_t lpable:1;
543 uint64_t reserved_0_0:1;
544#else
545 uint64_t reserved_0_0:1;
546 uint64_t lpable:1;
547 uint64_t rcv_lnk:1;
548 uint64_t reserved_3_6:4;
549 uint64_t flt:1;
550 uint64_t reserved_8_63:56;
551#endif
552 } s;
553};
554
555union cvmx_pcsxx_status2_reg {
556 uint64_t u64;
557 struct cvmx_pcsxx_status2_reg_s {
558#ifdef __BIG_ENDIAN_BITFIELD
559 uint64_t reserved_16_63:48;
560 uint64_t dev:2;
561 uint64_t reserved_12_13:2;
562 uint64_t xmtflt:1;
563 uint64_t rcvflt:1;
564 uint64_t reserved_3_9:7;
565 uint64_t tengb_w:1;
566 uint64_t tengb_x:1;
567 uint64_t tengb_r:1;
568#else
569 uint64_t tengb_r:1;
570 uint64_t tengb_x:1;
571 uint64_t tengb_w:1;
572 uint64_t reserved_3_9:7;
573 uint64_t rcvflt:1;
574 uint64_t xmtflt:1;
575 uint64_t reserved_12_13:2;
576 uint64_t dev:2;
577 uint64_t reserved_16_63:48;
578#endif
579 } s;
580};
581
582union cvmx_pcsxx_tx_rx_polarity_reg {
583 uint64_t u64;
584 struct cvmx_pcsxx_tx_rx_polarity_reg_s {
585#ifdef __BIG_ENDIAN_BITFIELD
586 uint64_t reserved_10_63:54;
587 uint64_t xor_rxplrt:4;
588 uint64_t xor_txplrt:4;
589 uint64_t rxplrt:1;
590 uint64_t txplrt:1;
591#else
592 uint64_t txplrt:1;
593 uint64_t rxplrt:1;
594 uint64_t xor_txplrt:4;
595 uint64_t xor_rxplrt:4;
596 uint64_t reserved_10_63:54;
597#endif
598 } s;
599 struct cvmx_pcsxx_tx_rx_polarity_reg_cn52xxp1 {
600#ifdef __BIG_ENDIAN_BITFIELD
601 uint64_t reserved_2_63:62;
602 uint64_t rxplrt:1;
603 uint64_t txplrt:1;
604#else
605 uint64_t txplrt:1;
606 uint64_t rxplrt:1;
607 uint64_t reserved_2_63:62;
608#endif
609 } cn52xxp1;
610};
611
612union cvmx_pcsxx_tx_rx_states_reg {
613 uint64_t u64;
614 struct cvmx_pcsxx_tx_rx_states_reg_s {
615#ifdef __BIG_ENDIAN_BITFIELD
616 uint64_t reserved_14_63:50;
617 uint64_t term_err:1;
618 uint64_t syn3bad:1;
619 uint64_t syn2bad:1;
620 uint64_t syn1bad:1;
621 uint64_t syn0bad:1;
622 uint64_t rxbad:1;
623 uint64_t algn_st:3;
624 uint64_t rx_st:2;
625 uint64_t tx_st:3;
626#else
627 uint64_t tx_st:3;
628 uint64_t rx_st:2;
629 uint64_t algn_st:3;
630 uint64_t rxbad:1;
631 uint64_t syn0bad:1;
632 uint64_t syn1bad:1;
633 uint64_t syn2bad:1;
634 uint64_t syn3bad:1;
635 uint64_t term_err:1;
636 uint64_t reserved_14_63:50;
637#endif
638 } s;
639 struct cvmx_pcsxx_tx_rx_states_reg_cn52xxp1 {
640#ifdef __BIG_ENDIAN_BITFIELD
641 uint64_t reserved_13_63:51;
642 uint64_t syn3bad:1;
643 uint64_t syn2bad:1;
644 uint64_t syn1bad:1;
645 uint64_t syn0bad:1;
646 uint64_t rxbad:1;
647 uint64_t algn_st:3;
648 uint64_t rx_st:2;
649 uint64_t tx_st:3;
650#else
651 uint64_t tx_st:3;
652 uint64_t rx_st:2;
653 uint64_t algn_st:3;
654 uint64_t rxbad:1;
655 uint64_t syn0bad:1;
656 uint64_t syn1bad:1;
657 uint64_t syn2bad:1;
658 uint64_t syn3bad:1;
659 uint64_t reserved_13_63:51;
660#endif
661 } cn52xxp1;
662};
663
664#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pemx-defs.h b/arch/mips/include/asm/octeon/cvmx-pemx-defs.h
new file mode 100644
index 000000000..d2d6dba93
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pemx-defs.h
@@ -0,0 +1,651 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_PEMX_DEFS_H__
29#define __CVMX_PEMX_DEFS_H__
30
31#define CVMX_PEMX_BAR1_INDEXX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C00000A8ull) + (((offset) & 15) + ((block_id) & 1) * 0x200000ull) * 8)
32#define CVMX_PEMX_BAR2_MASK(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000130ull) + ((block_id) & 1) * 0x1000000ull)
33#define CVMX_PEMX_BAR_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000128ull) + ((block_id) & 1) * 0x1000000ull)
34#define CVMX_PEMX_BIST_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000018ull) + ((block_id) & 1) * 0x1000000ull)
35#define CVMX_PEMX_BIST_STATUS2(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000420ull) + ((block_id) & 1) * 0x1000000ull)
36#define CVMX_PEMX_CFG_RD(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000030ull) + ((block_id) & 1) * 0x1000000ull)
37#define CVMX_PEMX_CFG_WR(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000028ull) + ((block_id) & 1) * 0x1000000ull)
38#define CVMX_PEMX_CPL_LUT_VALID(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000098ull) + ((block_id) & 1) * 0x1000000ull)
39#define CVMX_PEMX_CTL_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000000ull) + ((block_id) & 1) * 0x1000000ull)
40#define CVMX_PEMX_DBG_INFO(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000008ull) + ((block_id) & 1) * 0x1000000ull)
41#define CVMX_PEMX_DBG_INFO_EN(block_id) (CVMX_ADD_IO_SEG(0x00011800C00000A0ull) + ((block_id) & 1) * 0x1000000ull)
42#define CVMX_PEMX_DIAG_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000020ull) + ((block_id) & 1) * 0x1000000ull)
43#define CVMX_PEMX_INB_READ_CREDITS(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000138ull) + ((block_id) & 1) * 0x1000000ull)
44#define CVMX_PEMX_INT_ENB(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000410ull) + ((block_id) & 1) * 0x1000000ull)
45#define CVMX_PEMX_INT_ENB_INT(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000418ull) + ((block_id) & 1) * 0x1000000ull)
46#define CVMX_PEMX_INT_SUM(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000408ull) + ((block_id) & 1) * 0x1000000ull)
47#define CVMX_PEMX_P2N_BAR0_START(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000080ull) + ((block_id) & 1) * 0x1000000ull)
48#define CVMX_PEMX_P2N_BAR1_START(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000088ull) + ((block_id) & 1) * 0x1000000ull)
49#define CVMX_PEMX_P2N_BAR2_START(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000090ull) + ((block_id) & 1) * 0x1000000ull)
50#define CVMX_PEMX_P2P_BARX_END(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C0000048ull) + (((offset) & 3) + ((block_id) & 1) * 0x100000ull) * 16)
51#define CVMX_PEMX_P2P_BARX_START(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C0000040ull) + (((offset) & 3) + ((block_id) & 1) * 0x100000ull) * 16)
52#define CVMX_PEMX_TLP_CREDITS(block_id) (CVMX_ADD_IO_SEG(0x00011800C0000038ull) + ((block_id) & 1) * 0x1000000ull)
53
54union cvmx_pemx_bar1_indexx {
55 uint64_t u64;
56 struct cvmx_pemx_bar1_indexx_s {
57#ifdef __BIG_ENDIAN_BITFIELD
58 uint64_t reserved_20_63:44;
59 uint64_t addr_idx:16;
60 uint64_t ca:1;
61 uint64_t end_swp:2;
62 uint64_t addr_v:1;
63#else
64 uint64_t addr_v:1;
65 uint64_t end_swp:2;
66 uint64_t ca:1;
67 uint64_t addr_idx:16;
68 uint64_t reserved_20_63:44;
69#endif
70 } s;
71};
72
73union cvmx_pemx_bar2_mask {
74 uint64_t u64;
75 struct cvmx_pemx_bar2_mask_s {
76#ifdef __BIG_ENDIAN_BITFIELD
77 uint64_t reserved_38_63:26;
78 uint64_t mask:35;
79 uint64_t reserved_0_2:3;
80#else
81 uint64_t reserved_0_2:3;
82 uint64_t mask:35;
83 uint64_t reserved_38_63:26;
84#endif
85 } s;
86};
87
88union cvmx_pemx_bar_ctl {
89 uint64_t u64;
90 struct cvmx_pemx_bar_ctl_s {
91#ifdef __BIG_ENDIAN_BITFIELD
92 uint64_t reserved_7_63:57;
93 uint64_t bar1_siz:3;
94 uint64_t bar2_enb:1;
95 uint64_t bar2_esx:2;
96 uint64_t bar2_cax:1;
97#else
98 uint64_t bar2_cax:1;
99 uint64_t bar2_esx:2;
100 uint64_t bar2_enb:1;
101 uint64_t bar1_siz:3;
102 uint64_t reserved_7_63:57;
103#endif
104 } s;
105};
106
107union cvmx_pemx_bist_status {
108 uint64_t u64;
109 struct cvmx_pemx_bist_status_s {
110#ifdef __BIG_ENDIAN_BITFIELD
111 uint64_t reserved_8_63:56;
112 uint64_t retry:1;
113 uint64_t rqdata0:1;
114 uint64_t rqdata1:1;
115 uint64_t rqdata2:1;
116 uint64_t rqdata3:1;
117 uint64_t rqhdr1:1;
118 uint64_t rqhdr0:1;
119 uint64_t sot:1;
120#else
121 uint64_t sot:1;
122 uint64_t rqhdr0:1;
123 uint64_t rqhdr1:1;
124 uint64_t rqdata3:1;
125 uint64_t rqdata2:1;
126 uint64_t rqdata1:1;
127 uint64_t rqdata0:1;
128 uint64_t retry:1;
129 uint64_t reserved_8_63:56;
130#endif
131 } s;
132};
133
134union cvmx_pemx_bist_status2 {
135 uint64_t u64;
136 struct cvmx_pemx_bist_status2_s {
137#ifdef __BIG_ENDIAN_BITFIELD
138 uint64_t reserved_10_63:54;
139 uint64_t e2p_cpl:1;
140 uint64_t e2p_n:1;
141 uint64_t e2p_p:1;
142 uint64_t peai_p2e:1;
143 uint64_t pef_tpf1:1;
144 uint64_t pef_tpf0:1;
145 uint64_t pef_tnf:1;
146 uint64_t pef_tcf1:1;
147 uint64_t pef_tc0:1;
148 uint64_t ppf:1;
149#else
150 uint64_t ppf:1;
151 uint64_t pef_tc0:1;
152 uint64_t pef_tcf1:1;
153 uint64_t pef_tnf:1;
154 uint64_t pef_tpf0:1;
155 uint64_t pef_tpf1:1;
156 uint64_t peai_p2e:1;
157 uint64_t e2p_p:1;
158 uint64_t e2p_n:1;
159 uint64_t e2p_cpl:1;
160 uint64_t reserved_10_63:54;
161#endif
162 } s;
163};
164
165union cvmx_pemx_cfg_rd {
166 uint64_t u64;
167 struct cvmx_pemx_cfg_rd_s {
168#ifdef __BIG_ENDIAN_BITFIELD
169 uint64_t data:32;
170 uint64_t addr:32;
171#else
172 uint64_t addr:32;
173 uint64_t data:32;
174#endif
175 } s;
176};
177
178union cvmx_pemx_cfg_wr {
179 uint64_t u64;
180 struct cvmx_pemx_cfg_wr_s {
181#ifdef __BIG_ENDIAN_BITFIELD
182 uint64_t data:32;
183 uint64_t addr:32;
184#else
185 uint64_t addr:32;
186 uint64_t data:32;
187#endif
188 } s;
189};
190
191union cvmx_pemx_cpl_lut_valid {
192 uint64_t u64;
193 struct cvmx_pemx_cpl_lut_valid_s {
194#ifdef __BIG_ENDIAN_BITFIELD
195 uint64_t reserved_32_63:32;
196 uint64_t tag:32;
197#else
198 uint64_t tag:32;
199 uint64_t reserved_32_63:32;
200#endif
201 } s;
202};
203
204union cvmx_pemx_ctl_status {
205 uint64_t u64;
206 struct cvmx_pemx_ctl_status_s {
207#ifdef __BIG_ENDIAN_BITFIELD
208 uint64_t reserved_48_63:16;
209 uint64_t auto_sd:1;
210 uint64_t dnum:5;
211 uint64_t pbus:8;
212 uint64_t reserved_32_33:2;
213 uint64_t cfg_rtry:16;
214 uint64_t reserved_12_15:4;
215 uint64_t pm_xtoff:1;
216 uint64_t pm_xpme:1;
217 uint64_t ob_p_cmd:1;
218 uint64_t reserved_7_8:2;
219 uint64_t nf_ecrc:1;
220 uint64_t dly_one:1;
221 uint64_t lnk_enb:1;
222 uint64_t ro_ctlp:1;
223 uint64_t fast_lm:1;
224 uint64_t inv_ecrc:1;
225 uint64_t inv_lcrc:1;
226#else
227 uint64_t inv_lcrc:1;
228 uint64_t inv_ecrc:1;
229 uint64_t fast_lm:1;
230 uint64_t ro_ctlp:1;
231 uint64_t lnk_enb:1;
232 uint64_t dly_one:1;
233 uint64_t nf_ecrc:1;
234 uint64_t reserved_7_8:2;
235 uint64_t ob_p_cmd:1;
236 uint64_t pm_xpme:1;
237 uint64_t pm_xtoff:1;
238 uint64_t reserved_12_15:4;
239 uint64_t cfg_rtry:16;
240 uint64_t reserved_32_33:2;
241 uint64_t pbus:8;
242 uint64_t dnum:5;
243 uint64_t auto_sd:1;
244 uint64_t reserved_48_63:16;
245#endif
246 } s;
247};
248
249union cvmx_pemx_dbg_info {
250 uint64_t u64;
251 struct cvmx_pemx_dbg_info_s {
252#ifdef __BIG_ENDIAN_BITFIELD
253 uint64_t reserved_31_63:33;
254 uint64_t ecrc_e:1;
255 uint64_t rawwpp:1;
256 uint64_t racpp:1;
257 uint64_t ramtlp:1;
258 uint64_t rarwdns:1;
259 uint64_t caar:1;
260 uint64_t racca:1;
261 uint64_t racur:1;
262 uint64_t rauc:1;
263 uint64_t rqo:1;
264 uint64_t fcuv:1;
265 uint64_t rpe:1;
266 uint64_t fcpvwt:1;
267 uint64_t dpeoosd:1;
268 uint64_t rtwdle:1;
269 uint64_t rdwdle:1;
270 uint64_t mre:1;
271 uint64_t rte:1;
272 uint64_t acto:1;
273 uint64_t rvdm:1;
274 uint64_t rumep:1;
275 uint64_t rptamrc:1;
276 uint64_t rpmerc:1;
277 uint64_t rfemrc:1;
278 uint64_t rnfemrc:1;
279 uint64_t rcemrc:1;
280 uint64_t rpoison:1;
281 uint64_t recrce:1;
282 uint64_t rtlplle:1;
283 uint64_t rtlpmal:1;
284 uint64_t spoison:1;
285#else
286 uint64_t spoison:1;
287 uint64_t rtlpmal:1;
288 uint64_t rtlplle:1;
289 uint64_t recrce:1;
290 uint64_t rpoison:1;
291 uint64_t rcemrc:1;
292 uint64_t rnfemrc:1;
293 uint64_t rfemrc:1;
294 uint64_t rpmerc:1;
295 uint64_t rptamrc:1;
296 uint64_t rumep:1;
297 uint64_t rvdm:1;
298 uint64_t acto:1;
299 uint64_t rte:1;
300 uint64_t mre:1;
301 uint64_t rdwdle:1;
302 uint64_t rtwdle:1;
303 uint64_t dpeoosd:1;
304 uint64_t fcpvwt:1;
305 uint64_t rpe:1;
306 uint64_t fcuv:1;
307 uint64_t rqo:1;
308 uint64_t rauc:1;
309 uint64_t racur:1;
310 uint64_t racca:1;
311 uint64_t caar:1;
312 uint64_t rarwdns:1;
313 uint64_t ramtlp:1;
314 uint64_t racpp:1;
315 uint64_t rawwpp:1;
316 uint64_t ecrc_e:1;
317 uint64_t reserved_31_63:33;
318#endif
319 } s;
320};
321
322union cvmx_pemx_dbg_info_en {
323 uint64_t u64;
324 struct cvmx_pemx_dbg_info_en_s {
325#ifdef __BIG_ENDIAN_BITFIELD
326 uint64_t reserved_31_63:33;
327 uint64_t ecrc_e:1;
328 uint64_t rawwpp:1;
329 uint64_t racpp:1;
330 uint64_t ramtlp:1;
331 uint64_t rarwdns:1;
332 uint64_t caar:1;
333 uint64_t racca:1;
334 uint64_t racur:1;
335 uint64_t rauc:1;
336 uint64_t rqo:1;
337 uint64_t fcuv:1;
338 uint64_t rpe:1;
339 uint64_t fcpvwt:1;
340 uint64_t dpeoosd:1;
341 uint64_t rtwdle:1;
342 uint64_t rdwdle:1;
343 uint64_t mre:1;
344 uint64_t rte:1;
345 uint64_t acto:1;
346 uint64_t rvdm:1;
347 uint64_t rumep:1;
348 uint64_t rptamrc:1;
349 uint64_t rpmerc:1;
350 uint64_t rfemrc:1;
351 uint64_t rnfemrc:1;
352 uint64_t rcemrc:1;
353 uint64_t rpoison:1;
354 uint64_t recrce:1;
355 uint64_t rtlplle:1;
356 uint64_t rtlpmal:1;
357 uint64_t spoison:1;
358#else
359 uint64_t spoison:1;
360 uint64_t rtlpmal:1;
361 uint64_t rtlplle:1;
362 uint64_t recrce:1;
363 uint64_t rpoison:1;
364 uint64_t rcemrc:1;
365 uint64_t rnfemrc:1;
366 uint64_t rfemrc:1;
367 uint64_t rpmerc:1;
368 uint64_t rptamrc:1;
369 uint64_t rumep:1;
370 uint64_t rvdm:1;
371 uint64_t acto:1;
372 uint64_t rte:1;
373 uint64_t mre:1;
374 uint64_t rdwdle:1;
375 uint64_t rtwdle:1;
376 uint64_t dpeoosd:1;
377 uint64_t fcpvwt:1;
378 uint64_t rpe:1;
379 uint64_t fcuv:1;
380 uint64_t rqo:1;
381 uint64_t rauc:1;
382 uint64_t racur:1;
383 uint64_t racca:1;
384 uint64_t caar:1;
385 uint64_t rarwdns:1;
386 uint64_t ramtlp:1;
387 uint64_t racpp:1;
388 uint64_t rawwpp:1;
389 uint64_t ecrc_e:1;
390 uint64_t reserved_31_63:33;
391#endif
392 } s;
393};
394
395union cvmx_pemx_diag_status {
396 uint64_t u64;
397 struct cvmx_pemx_diag_status_s {
398#ifdef __BIG_ENDIAN_BITFIELD
399 uint64_t reserved_4_63:60;
400 uint64_t pm_dst:1;
401 uint64_t pm_stat:1;
402 uint64_t pm_en:1;
403 uint64_t aux_en:1;
404#else
405 uint64_t aux_en:1;
406 uint64_t pm_en:1;
407 uint64_t pm_stat:1;
408 uint64_t pm_dst:1;
409 uint64_t reserved_4_63:60;
410#endif
411 } s;
412};
413
414union cvmx_pemx_inb_read_credits {
415 uint64_t u64;
416 struct cvmx_pemx_inb_read_credits_s {
417#ifdef __BIG_ENDIAN_BITFIELD
418 uint64_t reserved_6_63:58;
419 uint64_t num:6;
420#else
421 uint64_t num:6;
422 uint64_t reserved_6_63:58;
423#endif
424 } s;
425};
426
427union cvmx_pemx_int_enb {
428 uint64_t u64;
429 struct cvmx_pemx_int_enb_s {
430#ifdef __BIG_ENDIAN_BITFIELD
431 uint64_t reserved_14_63:50;
432 uint64_t crs_dr:1;
433 uint64_t crs_er:1;
434 uint64_t rdlk:1;
435 uint64_t exc:1;
436 uint64_t un_bx:1;
437 uint64_t un_b2:1;
438 uint64_t un_b1:1;
439 uint64_t up_bx:1;
440 uint64_t up_b2:1;
441 uint64_t up_b1:1;
442 uint64_t pmem:1;
443 uint64_t pmei:1;
444 uint64_t se:1;
445 uint64_t aeri:1;
446#else
447 uint64_t aeri:1;
448 uint64_t se:1;
449 uint64_t pmei:1;
450 uint64_t pmem:1;
451 uint64_t up_b1:1;
452 uint64_t up_b2:1;
453 uint64_t up_bx:1;
454 uint64_t un_b1:1;
455 uint64_t un_b2:1;
456 uint64_t un_bx:1;
457 uint64_t exc:1;
458 uint64_t rdlk:1;
459 uint64_t crs_er:1;
460 uint64_t crs_dr:1;
461 uint64_t reserved_14_63:50;
462#endif
463 } s;
464};
465
466union cvmx_pemx_int_enb_int {
467 uint64_t u64;
468 struct cvmx_pemx_int_enb_int_s {
469#ifdef __BIG_ENDIAN_BITFIELD
470 uint64_t reserved_14_63:50;
471 uint64_t crs_dr:1;
472 uint64_t crs_er:1;
473 uint64_t rdlk:1;
474 uint64_t exc:1;
475 uint64_t un_bx:1;
476 uint64_t un_b2:1;
477 uint64_t un_b1:1;
478 uint64_t up_bx:1;
479 uint64_t up_b2:1;
480 uint64_t up_b1:1;
481 uint64_t pmem:1;
482 uint64_t pmei:1;
483 uint64_t se:1;
484 uint64_t aeri:1;
485#else
486 uint64_t aeri:1;
487 uint64_t se:1;
488 uint64_t pmei:1;
489 uint64_t pmem:1;
490 uint64_t up_b1:1;
491 uint64_t up_b2:1;
492 uint64_t up_bx:1;
493 uint64_t un_b1:1;
494 uint64_t un_b2:1;
495 uint64_t un_bx:1;
496 uint64_t exc:1;
497 uint64_t rdlk:1;
498 uint64_t crs_er:1;
499 uint64_t crs_dr:1;
500 uint64_t reserved_14_63:50;
501#endif
502 } s;
503};
504
505union cvmx_pemx_int_sum {
506 uint64_t u64;
507 struct cvmx_pemx_int_sum_s {
508#ifdef __BIG_ENDIAN_BITFIELD
509 uint64_t reserved_14_63:50;
510 uint64_t crs_dr:1;
511 uint64_t crs_er:1;
512 uint64_t rdlk:1;
513 uint64_t exc:1;
514 uint64_t un_bx:1;
515 uint64_t un_b2:1;
516 uint64_t un_b1:1;
517 uint64_t up_bx:1;
518 uint64_t up_b2:1;
519 uint64_t up_b1:1;
520 uint64_t pmem:1;
521 uint64_t pmei:1;
522 uint64_t se:1;
523 uint64_t aeri:1;
524#else
525 uint64_t aeri:1;
526 uint64_t se:1;
527 uint64_t pmei:1;
528 uint64_t pmem:1;
529 uint64_t up_b1:1;
530 uint64_t up_b2:1;
531 uint64_t up_bx:1;
532 uint64_t un_b1:1;
533 uint64_t un_b2:1;
534 uint64_t un_bx:1;
535 uint64_t exc:1;
536 uint64_t rdlk:1;
537 uint64_t crs_er:1;
538 uint64_t crs_dr:1;
539 uint64_t reserved_14_63:50;
540#endif
541 } s;
542};
543
544union cvmx_pemx_p2n_bar0_start {
545 uint64_t u64;
546 struct cvmx_pemx_p2n_bar0_start_s {
547#ifdef __BIG_ENDIAN_BITFIELD
548 uint64_t addr:50;
549 uint64_t reserved_0_13:14;
550#else
551 uint64_t reserved_0_13:14;
552 uint64_t addr:50;
553#endif
554 } s;
555};
556
557union cvmx_pemx_p2n_bar1_start {
558 uint64_t u64;
559 struct cvmx_pemx_p2n_bar1_start_s {
560#ifdef __BIG_ENDIAN_BITFIELD
561 uint64_t addr:38;
562 uint64_t reserved_0_25:26;
563#else
564 uint64_t reserved_0_25:26;
565 uint64_t addr:38;
566#endif
567 } s;
568};
569
570union cvmx_pemx_p2n_bar2_start {
571 uint64_t u64;
572 struct cvmx_pemx_p2n_bar2_start_s {
573#ifdef __BIG_ENDIAN_BITFIELD
574 uint64_t addr:23;
575 uint64_t reserved_0_40:41;
576#else
577 uint64_t reserved_0_40:41;
578 uint64_t addr:23;
579#endif
580 } s;
581};
582
583union cvmx_pemx_p2p_barx_end {
584 uint64_t u64;
585 struct cvmx_pemx_p2p_barx_end_s {
586#ifdef __BIG_ENDIAN_BITFIELD
587 uint64_t addr:52;
588 uint64_t reserved_0_11:12;
589#else
590 uint64_t reserved_0_11:12;
591 uint64_t addr:52;
592#endif
593 } s;
594};
595
596union cvmx_pemx_p2p_barx_start {
597 uint64_t u64;
598 struct cvmx_pemx_p2p_barx_start_s {
599#ifdef __BIG_ENDIAN_BITFIELD
600 uint64_t addr:52;
601 uint64_t reserved_0_11:12;
602#else
603 uint64_t reserved_0_11:12;
604 uint64_t addr:52;
605#endif
606 } s;
607};
608
609union cvmx_pemx_tlp_credits {
610 uint64_t u64;
611 struct cvmx_pemx_tlp_credits_s {
612#ifdef __BIG_ENDIAN_BITFIELD
613 uint64_t reserved_56_63:8;
614 uint64_t peai_ppf:8;
615 uint64_t pem_cpl:8;
616 uint64_t pem_np:8;
617 uint64_t pem_p:8;
618 uint64_t sli_cpl:8;
619 uint64_t sli_np:8;
620 uint64_t sli_p:8;
621#else
622 uint64_t sli_p:8;
623 uint64_t sli_np:8;
624 uint64_t sli_cpl:8;
625 uint64_t pem_p:8;
626 uint64_t pem_np:8;
627 uint64_t pem_cpl:8;
628 uint64_t peai_ppf:8;
629 uint64_t reserved_56_63:8;
630#endif
631 } s;
632 struct cvmx_pemx_tlp_credits_cn61xx {
633#ifdef __BIG_ENDIAN_BITFIELD
634 uint64_t reserved_56_63:8;
635 uint64_t peai_ppf:8;
636 uint64_t reserved_24_47:24;
637 uint64_t sli_cpl:8;
638 uint64_t sli_np:8;
639 uint64_t sli_p:8;
640#else
641 uint64_t sli_p:8;
642 uint64_t sli_np:8;
643 uint64_t sli_cpl:8;
644 uint64_t reserved_24_47:24;
645 uint64_t peai_ppf:8;
646 uint64_t reserved_56_63:8;
647#endif
648 } cn61xx;
649};
650
651#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pescx-defs.h b/arch/mips/include/asm/octeon/cvmx-pescx-defs.h
new file mode 100644
index 000000000..665610825
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pescx-defs.h
@@ -0,0 +1,579 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_PESCX_DEFS_H__
29#define __CVMX_PESCX_DEFS_H__
30
31#define CVMX_PESCX_BIST_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000018ull) + ((block_id) & 1) * 0x8000000ull)
32#define CVMX_PESCX_BIST_STATUS2(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000418ull) + ((block_id) & 1) * 0x8000000ull)
33#define CVMX_PESCX_CFG_RD(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000030ull) + ((block_id) & 1) * 0x8000000ull)
34#define CVMX_PESCX_CFG_WR(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000028ull) + ((block_id) & 1) * 0x8000000ull)
35#define CVMX_PESCX_CPL_LUT_VALID(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000098ull) + ((block_id) & 1) * 0x8000000ull)
36#define CVMX_PESCX_CTL_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000000ull) + ((block_id) & 1) * 0x8000000ull)
37#define CVMX_PESCX_CTL_STATUS2(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000400ull) + ((block_id) & 1) * 0x8000000ull)
38#define CVMX_PESCX_DBG_INFO(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000008ull) + ((block_id) & 1) * 0x8000000ull)
39#define CVMX_PESCX_DBG_INFO_EN(block_id) (CVMX_ADD_IO_SEG(0x00011800C80000A0ull) + ((block_id) & 1) * 0x8000000ull)
40#define CVMX_PESCX_DIAG_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000020ull) + ((block_id) & 1) * 0x8000000ull)
41#define CVMX_PESCX_P2N_BAR0_START(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000080ull) + ((block_id) & 1) * 0x8000000ull)
42#define CVMX_PESCX_P2N_BAR1_START(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000088ull) + ((block_id) & 1) * 0x8000000ull)
43#define CVMX_PESCX_P2N_BAR2_START(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000090ull) + ((block_id) & 1) * 0x8000000ull)
44#define CVMX_PESCX_P2P_BARX_END(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000048ull) + (((offset) & 3) + ((block_id) & 1) * 0x800000ull) * 16)
45#define CVMX_PESCX_P2P_BARX_START(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000040ull) + (((offset) & 3) + ((block_id) & 1) * 0x800000ull) * 16)
46#define CVMX_PESCX_TLP_CREDITS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000038ull) + ((block_id) & 1) * 0x8000000ull)
47
48union cvmx_pescx_bist_status {
49 uint64_t u64;
50 struct cvmx_pescx_bist_status_s {
51#ifdef __BIG_ENDIAN_BITFIELD
52 uint64_t reserved_13_63:51;
53 uint64_t rqdata5:1;
54 uint64_t ctlp_or:1;
55 uint64_t ntlp_or:1;
56 uint64_t ptlp_or:1;
57 uint64_t retry:1;
58 uint64_t rqdata0:1;
59 uint64_t rqdata1:1;
60 uint64_t rqdata2:1;
61 uint64_t rqdata3:1;
62 uint64_t rqdata4:1;
63 uint64_t rqhdr1:1;
64 uint64_t rqhdr0:1;
65 uint64_t sot:1;
66#else
67 uint64_t sot:1;
68 uint64_t rqhdr0:1;
69 uint64_t rqhdr1:1;
70 uint64_t rqdata4:1;
71 uint64_t rqdata3:1;
72 uint64_t rqdata2:1;
73 uint64_t rqdata1:1;
74 uint64_t rqdata0:1;
75 uint64_t retry:1;
76 uint64_t ptlp_or:1;
77 uint64_t ntlp_or:1;
78 uint64_t ctlp_or:1;
79 uint64_t rqdata5:1;
80 uint64_t reserved_13_63:51;
81#endif
82 } s;
83 struct cvmx_pescx_bist_status_cn52xxp1 {
84#ifdef __BIG_ENDIAN_BITFIELD
85 uint64_t reserved_12_63:52;
86 uint64_t ctlp_or:1;
87 uint64_t ntlp_or:1;
88 uint64_t ptlp_or:1;
89 uint64_t retry:1;
90 uint64_t rqdata0:1;
91 uint64_t rqdata1:1;
92 uint64_t rqdata2:1;
93 uint64_t rqdata3:1;
94 uint64_t rqdata4:1;
95 uint64_t rqhdr1:1;
96 uint64_t rqhdr0:1;
97 uint64_t sot:1;
98#else
99 uint64_t sot:1;
100 uint64_t rqhdr0:1;
101 uint64_t rqhdr1:1;
102 uint64_t rqdata4:1;
103 uint64_t rqdata3:1;
104 uint64_t rqdata2:1;
105 uint64_t rqdata1:1;
106 uint64_t rqdata0:1;
107 uint64_t retry:1;
108 uint64_t ptlp_or:1;
109 uint64_t ntlp_or:1;
110 uint64_t ctlp_or:1;
111 uint64_t reserved_12_63:52;
112#endif
113 } cn52xxp1;
114};
115
116union cvmx_pescx_bist_status2 {
117 uint64_t u64;
118 struct cvmx_pescx_bist_status2_s {
119#ifdef __BIG_ENDIAN_BITFIELD
120 uint64_t reserved_14_63:50;
121 uint64_t cto_p2e:1;
122 uint64_t e2p_cpl:1;
123 uint64_t e2p_n:1;
124 uint64_t e2p_p:1;
125 uint64_t e2p_rsl:1;
126 uint64_t dbg_p2e:1;
127 uint64_t peai_p2e:1;
128 uint64_t rsl_p2e:1;
129 uint64_t pef_tpf1:1;
130 uint64_t pef_tpf0:1;
131 uint64_t pef_tnf:1;
132 uint64_t pef_tcf1:1;
133 uint64_t pef_tc0:1;
134 uint64_t ppf:1;
135#else
136 uint64_t ppf:1;
137 uint64_t pef_tc0:1;
138 uint64_t pef_tcf1:1;
139 uint64_t pef_tnf:1;
140 uint64_t pef_tpf0:1;
141 uint64_t pef_tpf1:1;
142 uint64_t rsl_p2e:1;
143 uint64_t peai_p2e:1;
144 uint64_t dbg_p2e:1;
145 uint64_t e2p_rsl:1;
146 uint64_t e2p_p:1;
147 uint64_t e2p_n:1;
148 uint64_t e2p_cpl:1;
149 uint64_t cto_p2e:1;
150 uint64_t reserved_14_63:50;
151#endif
152 } s;
153};
154
155union cvmx_pescx_cfg_rd {
156 uint64_t u64;
157 struct cvmx_pescx_cfg_rd_s {
158#ifdef __BIG_ENDIAN_BITFIELD
159 uint64_t data:32;
160 uint64_t addr:32;
161#else
162 uint64_t addr:32;
163 uint64_t data:32;
164#endif
165 } s;
166};
167
168union cvmx_pescx_cfg_wr {
169 uint64_t u64;
170 struct cvmx_pescx_cfg_wr_s {
171#ifdef __BIG_ENDIAN_BITFIELD
172 uint64_t data:32;
173 uint64_t addr:32;
174#else
175 uint64_t addr:32;
176 uint64_t data:32;
177#endif
178 } s;
179};
180
181union cvmx_pescx_cpl_lut_valid {
182 uint64_t u64;
183 struct cvmx_pescx_cpl_lut_valid_s {
184#ifdef __BIG_ENDIAN_BITFIELD
185 uint64_t reserved_32_63:32;
186 uint64_t tag:32;
187#else
188 uint64_t tag:32;
189 uint64_t reserved_32_63:32;
190#endif
191 } s;
192};
193
194union cvmx_pescx_ctl_status {
195 uint64_t u64;
196 struct cvmx_pescx_ctl_status_s {
197#ifdef __BIG_ENDIAN_BITFIELD
198 uint64_t reserved_28_63:36;
199 uint64_t dnum:5;
200 uint64_t pbus:8;
201 uint64_t qlm_cfg:2;
202 uint64_t lane_swp:1;
203 uint64_t pm_xtoff:1;
204 uint64_t pm_xpme:1;
205 uint64_t ob_p_cmd:1;
206 uint64_t reserved_7_8:2;
207 uint64_t nf_ecrc:1;
208 uint64_t dly_one:1;
209 uint64_t lnk_enb:1;
210 uint64_t ro_ctlp:1;
211 uint64_t reserved_2_2:1;
212 uint64_t inv_ecrc:1;
213 uint64_t inv_lcrc:1;
214#else
215 uint64_t inv_lcrc:1;
216 uint64_t inv_ecrc:1;
217 uint64_t reserved_2_2:1;
218 uint64_t ro_ctlp:1;
219 uint64_t lnk_enb:1;
220 uint64_t dly_one:1;
221 uint64_t nf_ecrc:1;
222 uint64_t reserved_7_8:2;
223 uint64_t ob_p_cmd:1;
224 uint64_t pm_xpme:1;
225 uint64_t pm_xtoff:1;
226 uint64_t lane_swp:1;
227 uint64_t qlm_cfg:2;
228 uint64_t pbus:8;
229 uint64_t dnum:5;
230 uint64_t reserved_28_63:36;
231#endif
232 } s;
233 struct cvmx_pescx_ctl_status_cn56xx {
234#ifdef __BIG_ENDIAN_BITFIELD
235 uint64_t reserved_28_63:36;
236 uint64_t dnum:5;
237 uint64_t pbus:8;
238 uint64_t qlm_cfg:2;
239 uint64_t reserved_12_12:1;
240 uint64_t pm_xtoff:1;
241 uint64_t pm_xpme:1;
242 uint64_t ob_p_cmd:1;
243 uint64_t reserved_7_8:2;
244 uint64_t nf_ecrc:1;
245 uint64_t dly_one:1;
246 uint64_t lnk_enb:1;
247 uint64_t ro_ctlp:1;
248 uint64_t reserved_2_2:1;
249 uint64_t inv_ecrc:1;
250 uint64_t inv_lcrc:1;
251#else
252 uint64_t inv_lcrc:1;
253 uint64_t inv_ecrc:1;
254 uint64_t reserved_2_2:1;
255 uint64_t ro_ctlp:1;
256 uint64_t lnk_enb:1;
257 uint64_t dly_one:1;
258 uint64_t nf_ecrc:1;
259 uint64_t reserved_7_8:2;
260 uint64_t ob_p_cmd:1;
261 uint64_t pm_xpme:1;
262 uint64_t pm_xtoff:1;
263 uint64_t reserved_12_12:1;
264 uint64_t qlm_cfg:2;
265 uint64_t pbus:8;
266 uint64_t dnum:5;
267 uint64_t reserved_28_63:36;
268#endif
269 } cn56xx;
270};
271
272union cvmx_pescx_ctl_status2 {
273 uint64_t u64;
274 struct cvmx_pescx_ctl_status2_s {
275#ifdef __BIG_ENDIAN_BITFIELD
276 uint64_t reserved_2_63:62;
277 uint64_t pclk_run:1;
278 uint64_t pcierst:1;
279#else
280 uint64_t pcierst:1;
281 uint64_t pclk_run:1;
282 uint64_t reserved_2_63:62;
283#endif
284 } s;
285 struct cvmx_pescx_ctl_status2_cn52xxp1 {
286#ifdef __BIG_ENDIAN_BITFIELD
287 uint64_t reserved_1_63:63;
288 uint64_t pcierst:1;
289#else
290 uint64_t pcierst:1;
291 uint64_t reserved_1_63:63;
292#endif
293 } cn52xxp1;
294};
295
296union cvmx_pescx_dbg_info {
297 uint64_t u64;
298 struct cvmx_pescx_dbg_info_s {
299#ifdef __BIG_ENDIAN_BITFIELD
300 uint64_t reserved_31_63:33;
301 uint64_t ecrc_e:1;
302 uint64_t rawwpp:1;
303 uint64_t racpp:1;
304 uint64_t ramtlp:1;
305 uint64_t rarwdns:1;
306 uint64_t caar:1;
307 uint64_t racca:1;
308 uint64_t racur:1;
309 uint64_t rauc:1;
310 uint64_t rqo:1;
311 uint64_t fcuv:1;
312 uint64_t rpe:1;
313 uint64_t fcpvwt:1;
314 uint64_t dpeoosd:1;
315 uint64_t rtwdle:1;
316 uint64_t rdwdle:1;
317 uint64_t mre:1;
318 uint64_t rte:1;
319 uint64_t acto:1;
320 uint64_t rvdm:1;
321 uint64_t rumep:1;
322 uint64_t rptamrc:1;
323 uint64_t rpmerc:1;
324 uint64_t rfemrc:1;
325 uint64_t rnfemrc:1;
326 uint64_t rcemrc:1;
327 uint64_t rpoison:1;
328 uint64_t recrce:1;
329 uint64_t rtlplle:1;
330 uint64_t rtlpmal:1;
331 uint64_t spoison:1;
332#else
333 uint64_t spoison:1;
334 uint64_t rtlpmal:1;
335 uint64_t rtlplle:1;
336 uint64_t recrce:1;
337 uint64_t rpoison:1;
338 uint64_t rcemrc:1;
339 uint64_t rnfemrc:1;
340 uint64_t rfemrc:1;
341 uint64_t rpmerc:1;
342 uint64_t rptamrc:1;
343 uint64_t rumep:1;
344 uint64_t rvdm:1;
345 uint64_t acto:1;
346 uint64_t rte:1;
347 uint64_t mre:1;
348 uint64_t rdwdle:1;
349 uint64_t rtwdle:1;
350 uint64_t dpeoosd:1;
351 uint64_t fcpvwt:1;
352 uint64_t rpe:1;
353 uint64_t fcuv:1;
354 uint64_t rqo:1;
355 uint64_t rauc:1;
356 uint64_t racur:1;
357 uint64_t racca:1;
358 uint64_t caar:1;
359 uint64_t rarwdns:1;
360 uint64_t ramtlp:1;
361 uint64_t racpp:1;
362 uint64_t rawwpp:1;
363 uint64_t ecrc_e:1;
364 uint64_t reserved_31_63:33;
365#endif
366 } s;
367};
368
369union cvmx_pescx_dbg_info_en {
370 uint64_t u64;
371 struct cvmx_pescx_dbg_info_en_s {
372#ifdef __BIG_ENDIAN_BITFIELD
373 uint64_t reserved_31_63:33;
374 uint64_t ecrc_e:1;
375 uint64_t rawwpp:1;
376 uint64_t racpp:1;
377 uint64_t ramtlp:1;
378 uint64_t rarwdns:1;
379 uint64_t caar:1;
380 uint64_t racca:1;
381 uint64_t racur:1;
382 uint64_t rauc:1;
383 uint64_t rqo:1;
384 uint64_t fcuv:1;
385 uint64_t rpe:1;
386 uint64_t fcpvwt:1;
387 uint64_t dpeoosd:1;
388 uint64_t rtwdle:1;
389 uint64_t rdwdle:1;
390 uint64_t mre:1;
391 uint64_t rte:1;
392 uint64_t acto:1;
393 uint64_t rvdm:1;
394 uint64_t rumep:1;
395 uint64_t rptamrc:1;
396 uint64_t rpmerc:1;
397 uint64_t rfemrc:1;
398 uint64_t rnfemrc:1;
399 uint64_t rcemrc:1;
400 uint64_t rpoison:1;
401 uint64_t recrce:1;
402 uint64_t rtlplle:1;
403 uint64_t rtlpmal:1;
404 uint64_t spoison:1;
405#else
406 uint64_t spoison:1;
407 uint64_t rtlpmal:1;
408 uint64_t rtlplle:1;
409 uint64_t recrce:1;
410 uint64_t rpoison:1;
411 uint64_t rcemrc:1;
412 uint64_t rnfemrc:1;
413 uint64_t rfemrc:1;
414 uint64_t rpmerc:1;
415 uint64_t rptamrc:1;
416 uint64_t rumep:1;
417 uint64_t rvdm:1;
418 uint64_t acto:1;
419 uint64_t rte:1;
420 uint64_t mre:1;
421 uint64_t rdwdle:1;
422 uint64_t rtwdle:1;
423 uint64_t dpeoosd:1;
424 uint64_t fcpvwt:1;
425 uint64_t rpe:1;
426 uint64_t fcuv:1;
427 uint64_t rqo:1;
428 uint64_t rauc:1;
429 uint64_t racur:1;
430 uint64_t racca:1;
431 uint64_t caar:1;
432 uint64_t rarwdns:1;
433 uint64_t ramtlp:1;
434 uint64_t racpp:1;
435 uint64_t rawwpp:1;
436 uint64_t ecrc_e:1;
437 uint64_t reserved_31_63:33;
438#endif
439 } s;
440};
441
442union cvmx_pescx_diag_status {
443 uint64_t u64;
444 struct cvmx_pescx_diag_status_s {
445#ifdef __BIG_ENDIAN_BITFIELD
446 uint64_t reserved_4_63:60;
447 uint64_t pm_dst:1;
448 uint64_t pm_stat:1;
449 uint64_t pm_en:1;
450 uint64_t aux_en:1;
451#else
452 uint64_t aux_en:1;
453 uint64_t pm_en:1;
454 uint64_t pm_stat:1;
455 uint64_t pm_dst:1;
456 uint64_t reserved_4_63:60;
457#endif
458 } s;
459};
460
461union cvmx_pescx_p2n_bar0_start {
462 uint64_t u64;
463 struct cvmx_pescx_p2n_bar0_start_s {
464#ifdef __BIG_ENDIAN_BITFIELD
465 uint64_t addr:50;
466 uint64_t reserved_0_13:14;
467#else
468 uint64_t reserved_0_13:14;
469 uint64_t addr:50;
470#endif
471 } s;
472};
473
474union cvmx_pescx_p2n_bar1_start {
475 uint64_t u64;
476 struct cvmx_pescx_p2n_bar1_start_s {
477#ifdef __BIG_ENDIAN_BITFIELD
478 uint64_t addr:38;
479 uint64_t reserved_0_25:26;
480#else
481 uint64_t reserved_0_25:26;
482 uint64_t addr:38;
483#endif
484 } s;
485};
486
487union cvmx_pescx_p2n_bar2_start {
488 uint64_t u64;
489 struct cvmx_pescx_p2n_bar2_start_s {
490#ifdef __BIG_ENDIAN_BITFIELD
491 uint64_t addr:25;
492 uint64_t reserved_0_38:39;
493#else
494 uint64_t reserved_0_38:39;
495 uint64_t addr:25;
496#endif
497 } s;
498};
499
500union cvmx_pescx_p2p_barx_end {
501 uint64_t u64;
502 struct cvmx_pescx_p2p_barx_end_s {
503#ifdef __BIG_ENDIAN_BITFIELD
504 uint64_t addr:52;
505 uint64_t reserved_0_11:12;
506#else
507 uint64_t reserved_0_11:12;
508 uint64_t addr:52;
509#endif
510 } s;
511};
512
513union cvmx_pescx_p2p_barx_start {
514 uint64_t u64;
515 struct cvmx_pescx_p2p_barx_start_s {
516#ifdef __BIG_ENDIAN_BITFIELD
517 uint64_t addr:52;
518 uint64_t reserved_0_11:12;
519#else
520 uint64_t reserved_0_11:12;
521 uint64_t addr:52;
522#endif
523 } s;
524};
525
526union cvmx_pescx_tlp_credits {
527 uint64_t u64;
528 struct cvmx_pescx_tlp_credits_s {
529#ifdef __BIG_ENDIAN_BITFIELD
530 uint64_t reserved_0_63:64;
531#else
532 uint64_t reserved_0_63:64;
533#endif
534 } s;
535 struct cvmx_pescx_tlp_credits_cn52xx {
536#ifdef __BIG_ENDIAN_BITFIELD
537 uint64_t reserved_56_63:8;
538 uint64_t peai_ppf:8;
539 uint64_t pesc_cpl:8;
540 uint64_t pesc_np:8;
541 uint64_t pesc_p:8;
542 uint64_t npei_cpl:8;
543 uint64_t npei_np:8;
544 uint64_t npei_p:8;
545#else
546 uint64_t npei_p:8;
547 uint64_t npei_np:8;
548 uint64_t npei_cpl:8;
549 uint64_t pesc_p:8;
550 uint64_t pesc_np:8;
551 uint64_t pesc_cpl:8;
552 uint64_t peai_ppf:8;
553 uint64_t reserved_56_63:8;
554#endif
555 } cn52xx;
556 struct cvmx_pescx_tlp_credits_cn52xxp1 {
557#ifdef __BIG_ENDIAN_BITFIELD
558 uint64_t reserved_38_63:26;
559 uint64_t peai_ppf:8;
560 uint64_t pesc_cpl:5;
561 uint64_t pesc_np:5;
562 uint64_t pesc_p:5;
563 uint64_t npei_cpl:5;
564 uint64_t npei_np:5;
565 uint64_t npei_p:5;
566#else
567 uint64_t npei_p:5;
568 uint64_t npei_np:5;
569 uint64_t npei_cpl:5;
570 uint64_t pesc_p:5;
571 uint64_t pesc_np:5;
572 uint64_t pesc_cpl:5;
573 uint64_t peai_ppf:8;
574 uint64_t reserved_38_63:26;
575#endif
576 } cn52xxp1;
577};
578
579#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pexp-defs.h b/arch/mips/include/asm/octeon/cvmx-pexp-defs.h
new file mode 100644
index 000000000..eb673f351
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pexp-defs.h
@@ -0,0 +1,224 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_PEXP_DEFS_H__
29#define __CVMX_PEXP_DEFS_H__
30
31#define CVMX_PEXP_NPEI_BAR1_INDEXX(offset) (CVMX_ADD_IO_SEG(0x00011F0000008000ull) + ((offset) & 31) * 16)
32#define CVMX_PEXP_NPEI_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011F0000008580ull))
33#define CVMX_PEXP_NPEI_BIST_STATUS2 (CVMX_ADD_IO_SEG(0x00011F0000008680ull))
34#define CVMX_PEXP_NPEI_CTL_PORT0 (CVMX_ADD_IO_SEG(0x00011F0000008250ull))
35#define CVMX_PEXP_NPEI_CTL_PORT1 (CVMX_ADD_IO_SEG(0x00011F0000008260ull))
36#define CVMX_PEXP_NPEI_CTL_STATUS (CVMX_ADD_IO_SEG(0x00011F0000008570ull))
37#define CVMX_PEXP_NPEI_CTL_STATUS2 (CVMX_ADD_IO_SEG(0x00011F000000BC00ull))
38#define CVMX_PEXP_NPEI_DATA_OUT_CNT (CVMX_ADD_IO_SEG(0x00011F00000085F0ull))
39#define CVMX_PEXP_NPEI_DBG_DATA (CVMX_ADD_IO_SEG(0x00011F0000008510ull))
40#define CVMX_PEXP_NPEI_DBG_SELECT (CVMX_ADD_IO_SEG(0x00011F0000008500ull))
41#define CVMX_PEXP_NPEI_DMA0_INT_LEVEL (CVMX_ADD_IO_SEG(0x00011F00000085C0ull))
42#define CVMX_PEXP_NPEI_DMA1_INT_LEVEL (CVMX_ADD_IO_SEG(0x00011F00000085D0ull))
43#define CVMX_PEXP_NPEI_DMAX_COUNTS(offset) (CVMX_ADD_IO_SEG(0x00011F0000008450ull) + ((offset) & 7) * 16)
44#define CVMX_PEXP_NPEI_DMAX_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F00000083B0ull) + ((offset) & 7) * 16)
45#define CVMX_PEXP_NPEI_DMAX_IBUFF_SADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000008400ull) + ((offset) & 7) * 16)
46#define CVMX_PEXP_NPEI_DMAX_NADDR(offset) (CVMX_ADD_IO_SEG(0x00011F00000084A0ull) + ((offset) & 7) * 16)
47#define CVMX_PEXP_NPEI_DMA_CNTS (CVMX_ADD_IO_SEG(0x00011F00000085E0ull))
48#define CVMX_PEXP_NPEI_DMA_CONTROL (CVMX_ADD_IO_SEG(0x00011F00000083A0ull))
49#define CVMX_PEXP_NPEI_DMA_PCIE_REQ_NUM (CVMX_ADD_IO_SEG(0x00011F00000085B0ull))
50#define CVMX_PEXP_NPEI_DMA_STATE1 (CVMX_ADD_IO_SEG(0x00011F00000086C0ull))
51#define CVMX_PEXP_NPEI_DMA_STATE1_P1 (CVMX_ADD_IO_SEG(0x00011F0000008680ull))
52#define CVMX_PEXP_NPEI_DMA_STATE2 (CVMX_ADD_IO_SEG(0x00011F00000086D0ull))
53#define CVMX_PEXP_NPEI_DMA_STATE2_P1 (CVMX_ADD_IO_SEG(0x00011F0000008690ull))
54#define CVMX_PEXP_NPEI_DMA_STATE3_P1 (CVMX_ADD_IO_SEG(0x00011F00000086A0ull))
55#define CVMX_PEXP_NPEI_DMA_STATE4_P1 (CVMX_ADD_IO_SEG(0x00011F00000086B0ull))
56#define CVMX_PEXP_NPEI_DMA_STATE5_P1 (CVMX_ADD_IO_SEG(0x00011F00000086C0ull))
57#define CVMX_PEXP_NPEI_INT_A_ENB (CVMX_ADD_IO_SEG(0x00011F0000008560ull))
58#define CVMX_PEXP_NPEI_INT_A_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BCE0ull))
59#define CVMX_PEXP_NPEI_INT_A_SUM (CVMX_ADD_IO_SEG(0x00011F0000008550ull))
60#define CVMX_PEXP_NPEI_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000008540ull))
61#define CVMX_PEXP_NPEI_INT_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BCD0ull))
62#define CVMX_PEXP_NPEI_INT_INFO (CVMX_ADD_IO_SEG(0x00011F0000008590ull))
63#define CVMX_PEXP_NPEI_INT_SUM (CVMX_ADD_IO_SEG(0x00011F0000008530ull))
64#define CVMX_PEXP_NPEI_INT_SUM2 (CVMX_ADD_IO_SEG(0x00011F000000BCC0ull))
65#define CVMX_PEXP_NPEI_LAST_WIN_RDATA0 (CVMX_ADD_IO_SEG(0x00011F0000008600ull))
66#define CVMX_PEXP_NPEI_LAST_WIN_RDATA1 (CVMX_ADD_IO_SEG(0x00011F0000008610ull))
67#define CVMX_PEXP_NPEI_MEM_ACCESS_CTL (CVMX_ADD_IO_SEG(0x00011F00000084F0ull))
68#define CVMX_PEXP_NPEI_MEM_ACCESS_SUBIDX(offset) (CVMX_ADD_IO_SEG(0x00011F0000008280ull) + ((offset) & 31) * 16 - 16*12)
69#define CVMX_PEXP_NPEI_MSI_ENB0 (CVMX_ADD_IO_SEG(0x00011F000000BC50ull))
70#define CVMX_PEXP_NPEI_MSI_ENB1 (CVMX_ADD_IO_SEG(0x00011F000000BC60ull))
71#define CVMX_PEXP_NPEI_MSI_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BC70ull))
72#define CVMX_PEXP_NPEI_MSI_ENB3 (CVMX_ADD_IO_SEG(0x00011F000000BC80ull))
73#define CVMX_PEXP_NPEI_MSI_RCV0 (CVMX_ADD_IO_SEG(0x00011F000000BC10ull))
74#define CVMX_PEXP_NPEI_MSI_RCV1 (CVMX_ADD_IO_SEG(0x00011F000000BC20ull))
75#define CVMX_PEXP_NPEI_MSI_RCV2 (CVMX_ADD_IO_SEG(0x00011F000000BC30ull))
76#define CVMX_PEXP_NPEI_MSI_RCV3 (CVMX_ADD_IO_SEG(0x00011F000000BC40ull))
77#define CVMX_PEXP_NPEI_MSI_RD_MAP (CVMX_ADD_IO_SEG(0x00011F000000BCA0ull))
78#define CVMX_PEXP_NPEI_MSI_W1C_ENB0 (CVMX_ADD_IO_SEG(0x00011F000000BCF0ull))
79#define CVMX_PEXP_NPEI_MSI_W1C_ENB1 (CVMX_ADD_IO_SEG(0x00011F000000BD00ull))
80#define CVMX_PEXP_NPEI_MSI_W1C_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BD10ull))
81#define CVMX_PEXP_NPEI_MSI_W1C_ENB3 (CVMX_ADD_IO_SEG(0x00011F000000BD20ull))
82#define CVMX_PEXP_NPEI_MSI_W1S_ENB0 (CVMX_ADD_IO_SEG(0x00011F000000BD30ull))
83#define CVMX_PEXP_NPEI_MSI_W1S_ENB1 (CVMX_ADD_IO_SEG(0x00011F000000BD40ull))
84#define CVMX_PEXP_NPEI_MSI_W1S_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BD50ull))
85#define CVMX_PEXP_NPEI_MSI_W1S_ENB3 (CVMX_ADD_IO_SEG(0x00011F000000BD60ull))
86#define CVMX_PEXP_NPEI_MSI_WR_MAP (CVMX_ADD_IO_SEG(0x00011F000000BC90ull))
87#define CVMX_PEXP_NPEI_PCIE_CREDIT_CNT (CVMX_ADD_IO_SEG(0x00011F000000BD70ull))
88#define CVMX_PEXP_NPEI_PCIE_MSI_RCV (CVMX_ADD_IO_SEG(0x00011F000000BCB0ull))
89#define CVMX_PEXP_NPEI_PCIE_MSI_RCV_B1 (CVMX_ADD_IO_SEG(0x00011F0000008650ull))
90#define CVMX_PEXP_NPEI_PCIE_MSI_RCV_B2 (CVMX_ADD_IO_SEG(0x00011F0000008660ull))
91#define CVMX_PEXP_NPEI_PCIE_MSI_RCV_B3 (CVMX_ADD_IO_SEG(0x00011F0000008670ull))
92#define CVMX_PEXP_NPEI_PKTX_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F000000A400ull) + ((offset) & 31) * 16)
93#define CVMX_PEXP_NPEI_PKTX_INSTR_BADDR(offset) (CVMX_ADD_IO_SEG(0x00011F000000A800ull) + ((offset) & 31) * 16)
94#define CVMX_PEXP_NPEI_PKTX_INSTR_BAOFF_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F000000AC00ull) + ((offset) & 31) * 16)
95#define CVMX_PEXP_NPEI_PKTX_INSTR_FIFO_RSIZE(offset) (CVMX_ADD_IO_SEG(0x00011F000000B000ull) + ((offset) & 31) * 16)
96#define CVMX_PEXP_NPEI_PKTX_INSTR_HEADER(offset) (CVMX_ADD_IO_SEG(0x00011F000000B400ull) + ((offset) & 31) * 16)
97#define CVMX_PEXP_NPEI_PKTX_IN_BP(offset) (CVMX_ADD_IO_SEG(0x00011F000000B800ull) + ((offset) & 31) * 16)
98#define CVMX_PEXP_NPEI_PKTX_SLIST_BADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000009400ull) + ((offset) & 31) * 16)
99#define CVMX_PEXP_NPEI_PKTX_SLIST_BAOFF_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F0000009800ull) + ((offset) & 31) * 16)
100#define CVMX_PEXP_NPEI_PKTX_SLIST_FIFO_RSIZE(offset) (CVMX_ADD_IO_SEG(0x00011F0000009C00ull) + ((offset) & 31) * 16)
101#define CVMX_PEXP_NPEI_PKT_CNT_INT (CVMX_ADD_IO_SEG(0x00011F0000009110ull))
102#define CVMX_PEXP_NPEI_PKT_CNT_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000009130ull))
103#define CVMX_PEXP_NPEI_PKT_DATA_OUT_ES (CVMX_ADD_IO_SEG(0x00011F00000090B0ull))
104#define CVMX_PEXP_NPEI_PKT_DATA_OUT_NS (CVMX_ADD_IO_SEG(0x00011F00000090A0ull))
105#define CVMX_PEXP_NPEI_PKT_DATA_OUT_ROR (CVMX_ADD_IO_SEG(0x00011F0000009090ull))
106#define CVMX_PEXP_NPEI_PKT_DPADDR (CVMX_ADD_IO_SEG(0x00011F0000009080ull))
107#define CVMX_PEXP_NPEI_PKT_INPUT_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000009150ull))
108#define CVMX_PEXP_NPEI_PKT_INSTR_ENB (CVMX_ADD_IO_SEG(0x00011F0000009000ull))
109#define CVMX_PEXP_NPEI_PKT_INSTR_RD_SIZE (CVMX_ADD_IO_SEG(0x00011F0000009190ull))
110#define CVMX_PEXP_NPEI_PKT_INSTR_SIZE (CVMX_ADD_IO_SEG(0x00011F0000009020ull))
111#define CVMX_PEXP_NPEI_PKT_INT_LEVELS (CVMX_ADD_IO_SEG(0x00011F0000009100ull))
112#define CVMX_PEXP_NPEI_PKT_IN_BP (CVMX_ADD_IO_SEG(0x00011F00000086B0ull))
113#define CVMX_PEXP_NPEI_PKT_IN_DONEX_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F000000A000ull) + ((offset) & 31) * 16)
114#define CVMX_PEXP_NPEI_PKT_IN_INSTR_COUNTS (CVMX_ADD_IO_SEG(0x00011F00000086A0ull))
115#define CVMX_PEXP_NPEI_PKT_IN_PCIE_PORT (CVMX_ADD_IO_SEG(0x00011F00000091A0ull))
116#define CVMX_PEXP_NPEI_PKT_IPTR (CVMX_ADD_IO_SEG(0x00011F0000009070ull))
117#define CVMX_PEXP_NPEI_PKT_OUTPUT_WMARK (CVMX_ADD_IO_SEG(0x00011F0000009160ull))
118#define CVMX_PEXP_NPEI_PKT_OUT_BMODE (CVMX_ADD_IO_SEG(0x00011F00000090D0ull))
119#define CVMX_PEXP_NPEI_PKT_OUT_ENB (CVMX_ADD_IO_SEG(0x00011F0000009010ull))
120#define CVMX_PEXP_NPEI_PKT_PCIE_PORT (CVMX_ADD_IO_SEG(0x00011F00000090E0ull))
121#define CVMX_PEXP_NPEI_PKT_PORT_IN_RST (CVMX_ADD_IO_SEG(0x00011F0000008690ull))
122#define CVMX_PEXP_NPEI_PKT_SLIST_ES (CVMX_ADD_IO_SEG(0x00011F0000009050ull))
123#define CVMX_PEXP_NPEI_PKT_SLIST_ID_SIZE (CVMX_ADD_IO_SEG(0x00011F0000009180ull))
124#define CVMX_PEXP_NPEI_PKT_SLIST_NS (CVMX_ADD_IO_SEG(0x00011F0000009040ull))
125#define CVMX_PEXP_NPEI_PKT_SLIST_ROR (CVMX_ADD_IO_SEG(0x00011F0000009030ull))
126#define CVMX_PEXP_NPEI_PKT_TIME_INT (CVMX_ADD_IO_SEG(0x00011F0000009120ull))
127#define CVMX_PEXP_NPEI_PKT_TIME_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000009140ull))
128#define CVMX_PEXP_NPEI_RSL_INT_BLOCKS (CVMX_ADD_IO_SEG(0x00011F0000008520ull))
129#define CVMX_PEXP_NPEI_SCRATCH_1 (CVMX_ADD_IO_SEG(0x00011F0000008270ull))
130#define CVMX_PEXP_NPEI_STATE1 (CVMX_ADD_IO_SEG(0x00011F0000008620ull))
131#define CVMX_PEXP_NPEI_STATE2 (CVMX_ADD_IO_SEG(0x00011F0000008630ull))
132#define CVMX_PEXP_NPEI_STATE3 (CVMX_ADD_IO_SEG(0x00011F0000008640ull))
133#define CVMX_PEXP_NPEI_WINDOW_CTL (CVMX_ADD_IO_SEG(0x00011F0000008380ull))
134#define CVMX_PEXP_SLI_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011F0000010580ull))
135#define CVMX_PEXP_SLI_CTL_PORTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000010050ull) + ((offset) & 3) * 16)
136#define CVMX_PEXP_SLI_CTL_STATUS (CVMX_ADD_IO_SEG(0x00011F0000010570ull))
137#define CVMX_PEXP_SLI_DATA_OUT_CNT (CVMX_ADD_IO_SEG(0x00011F00000105F0ull))
138#define CVMX_PEXP_SLI_DBG_DATA (CVMX_ADD_IO_SEG(0x00011F0000010310ull))
139#define CVMX_PEXP_SLI_DBG_SELECT (CVMX_ADD_IO_SEG(0x00011F0000010300ull))
140#define CVMX_PEXP_SLI_DMAX_CNT(offset) (CVMX_ADD_IO_SEG(0x00011F0000010400ull) + ((offset) & 1) * 16)
141#define CVMX_PEXP_SLI_DMAX_INT_LEVEL(offset) (CVMX_ADD_IO_SEG(0x00011F00000103E0ull) + ((offset) & 1) * 16)
142#define CVMX_PEXP_SLI_DMAX_TIM(offset) (CVMX_ADD_IO_SEG(0x00011F0000010420ull) + ((offset) & 1) * 16)
143#define CVMX_PEXP_SLI_INT_ENB_CIU (CVMX_ADD_IO_SEG(0x00011F0000013CD0ull))
144#define CVMX_PEXP_SLI_INT_ENB_PORTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000010340ull) + ((offset) & 1) * 16)
145#define CVMX_PEXP_SLI_INT_SUM (CVMX_ADD_IO_SEG(0x00011F0000010330ull))
146#define CVMX_PEXP_SLI_LAST_WIN_RDATA0 (CVMX_ADD_IO_SEG(0x00011F0000010600ull))
147#define CVMX_PEXP_SLI_LAST_WIN_RDATA1 (CVMX_ADD_IO_SEG(0x00011F0000010610ull))
148#define CVMX_PEXP_SLI_LAST_WIN_RDATA2 (CVMX_ADD_IO_SEG(0x00011F00000106C0ull))
149#define CVMX_PEXP_SLI_LAST_WIN_RDATA3 (CVMX_ADD_IO_SEG(0x00011F00000106D0ull))
150#define CVMX_PEXP_SLI_MAC_CREDIT_CNT (CVMX_ADD_IO_SEG(0x00011F0000013D70ull))
151#define CVMX_PEXP_SLI_MAC_CREDIT_CNT2 (CVMX_ADD_IO_SEG(0x00011F0000013E10ull))
152#define CVMX_PEXP_SLI_MEM_ACCESS_CTL (CVMX_ADD_IO_SEG(0x00011F00000102F0ull))
153#define CVMX_PEXP_SLI_MEM_ACCESS_SUBIDX(offset) (CVMX_ADD_IO_SEG(0x00011F00000100E0ull) + ((offset) & 31) * 16 - 16*12)
154#define CVMX_PEXP_SLI_MSI_ENB0 (CVMX_ADD_IO_SEG(0x00011F0000013C50ull))
155#define CVMX_PEXP_SLI_MSI_ENB1 (CVMX_ADD_IO_SEG(0x00011F0000013C60ull))
156#define CVMX_PEXP_SLI_MSI_ENB2 (CVMX_ADD_IO_SEG(0x00011F0000013C70ull))
157#define CVMX_PEXP_SLI_MSI_ENB3 (CVMX_ADD_IO_SEG(0x00011F0000013C80ull))
158#define CVMX_PEXP_SLI_MSI_RCV0 (CVMX_ADD_IO_SEG(0x00011F0000013C10ull))
159#define CVMX_PEXP_SLI_MSI_RCV1 (CVMX_ADD_IO_SEG(0x00011F0000013C20ull))
160#define CVMX_PEXP_SLI_MSI_RCV2 (CVMX_ADD_IO_SEG(0x00011F0000013C30ull))
161#define CVMX_PEXP_SLI_MSI_RCV3 (CVMX_ADD_IO_SEG(0x00011F0000013C40ull))
162#define CVMX_PEXP_SLI_MSI_RD_MAP (CVMX_ADD_IO_SEG(0x00011F0000013CA0ull))
163#define CVMX_PEXP_SLI_MSI_W1C_ENB0 (CVMX_ADD_IO_SEG(0x00011F0000013CF0ull))
164#define CVMX_PEXP_SLI_MSI_W1C_ENB1 (CVMX_ADD_IO_SEG(0x00011F0000013D00ull))
165#define CVMX_PEXP_SLI_MSI_W1C_ENB2 (CVMX_ADD_IO_SEG(0x00011F0000013D10ull))
166#define CVMX_PEXP_SLI_MSI_W1C_ENB3 (CVMX_ADD_IO_SEG(0x00011F0000013D20ull))
167#define CVMX_PEXP_SLI_MSI_W1S_ENB0 (CVMX_ADD_IO_SEG(0x00011F0000013D30ull))
168#define CVMX_PEXP_SLI_MSI_W1S_ENB1 (CVMX_ADD_IO_SEG(0x00011F0000013D40ull))
169#define CVMX_PEXP_SLI_MSI_W1S_ENB2 (CVMX_ADD_IO_SEG(0x00011F0000013D50ull))
170#define CVMX_PEXP_SLI_MSI_W1S_ENB3 (CVMX_ADD_IO_SEG(0x00011F0000013D60ull))
171#define CVMX_PEXP_SLI_MSI_WR_MAP (CVMX_ADD_IO_SEG(0x00011F0000013C90ull))
172#define CVMX_PEXP_SLI_PCIE_MSI_RCV (CVMX_ADD_IO_SEG(0x00011F0000013CB0ull))
173#define CVMX_PEXP_SLI_PCIE_MSI_RCV_B1 (CVMX_ADD_IO_SEG(0x00011F0000010650ull))
174#define CVMX_PEXP_SLI_PCIE_MSI_RCV_B2 (CVMX_ADD_IO_SEG(0x00011F0000010660ull))
175#define CVMX_PEXP_SLI_PCIE_MSI_RCV_B3 (CVMX_ADD_IO_SEG(0x00011F0000010670ull))
176#define CVMX_PEXP_SLI_PKTX_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F0000012400ull) + ((offset) & 31) * 16)
177#define CVMX_PEXP_SLI_PKTX_INSTR_BADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000012800ull) + ((offset) & 31) * 16)
178#define CVMX_PEXP_SLI_PKTX_INSTR_BAOFF_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F0000012C00ull) + ((offset) & 31) * 16)
179#define CVMX_PEXP_SLI_PKTX_INSTR_FIFO_RSIZE(offset) (CVMX_ADD_IO_SEG(0x00011F0000013000ull) + ((offset) & 31) * 16)
180#define CVMX_PEXP_SLI_PKTX_INSTR_HEADER(offset) (CVMX_ADD_IO_SEG(0x00011F0000013400ull) + ((offset) & 31) * 16)
181#define CVMX_PEXP_SLI_PKTX_IN_BP(offset) (CVMX_ADD_IO_SEG(0x00011F0000013800ull) + ((offset) & 31) * 16)
182#define CVMX_PEXP_SLI_PKTX_OUT_SIZE(offset) (CVMX_ADD_IO_SEG(0x00011F0000010C00ull) + ((offset) & 31) * 16)
183#define CVMX_PEXP_SLI_PKTX_SLIST_BADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000011400ull) + ((offset) & 31) * 16)
184#define CVMX_PEXP_SLI_PKTX_SLIST_BAOFF_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F0000011800ull) + ((offset) & 31) * 16)
185#define CVMX_PEXP_SLI_PKTX_SLIST_FIFO_RSIZE(offset) (CVMX_ADD_IO_SEG(0x00011F0000011C00ull) + ((offset) & 31) * 16)
186#define CVMX_PEXP_SLI_PKT_CNT_INT (CVMX_ADD_IO_SEG(0x00011F0000011130ull))
187#define CVMX_PEXP_SLI_PKT_CNT_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000011150ull))
188#define CVMX_PEXP_SLI_PKT_CTL (CVMX_ADD_IO_SEG(0x00011F0000011220ull))
189#define CVMX_PEXP_SLI_PKT_DATA_OUT_ES (CVMX_ADD_IO_SEG(0x00011F00000110B0ull))
190#define CVMX_PEXP_SLI_PKT_DATA_OUT_NS (CVMX_ADD_IO_SEG(0x00011F00000110A0ull))
191#define CVMX_PEXP_SLI_PKT_DATA_OUT_ROR (CVMX_ADD_IO_SEG(0x00011F0000011090ull))
192#define CVMX_PEXP_SLI_PKT_DPADDR (CVMX_ADD_IO_SEG(0x00011F0000011080ull))
193#define CVMX_PEXP_SLI_PKT_INPUT_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000011170ull))
194#define CVMX_PEXP_SLI_PKT_INSTR_ENB (CVMX_ADD_IO_SEG(0x00011F0000011000ull))
195#define CVMX_PEXP_SLI_PKT_INSTR_RD_SIZE (CVMX_ADD_IO_SEG(0x00011F00000111A0ull))
196#define CVMX_PEXP_SLI_PKT_INSTR_SIZE (CVMX_ADD_IO_SEG(0x00011F0000011020ull))
197#define CVMX_PEXP_SLI_PKT_INT_LEVELS (CVMX_ADD_IO_SEG(0x00011F0000011120ull))
198#define CVMX_PEXP_SLI_PKT_IN_BP (CVMX_ADD_IO_SEG(0x00011F0000011210ull))
199#define CVMX_PEXP_SLI_PKT_IN_DONEX_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F0000012000ull) + ((offset) & 31) * 16)
200#define CVMX_PEXP_SLI_PKT_IN_INSTR_COUNTS (CVMX_ADD_IO_SEG(0x00011F0000011200ull))
201#define CVMX_PEXP_SLI_PKT_IN_PCIE_PORT (CVMX_ADD_IO_SEG(0x00011F00000111B0ull))
202#define CVMX_PEXP_SLI_PKT_IPTR (CVMX_ADD_IO_SEG(0x00011F0000011070ull))
203#define CVMX_PEXP_SLI_PKT_OUTPUT_WMARK (CVMX_ADD_IO_SEG(0x00011F0000011180ull))
204#define CVMX_PEXP_SLI_PKT_OUT_BMODE (CVMX_ADD_IO_SEG(0x00011F00000110D0ull))
205#define CVMX_PEXP_SLI_PKT_OUT_BP_EN (CVMX_ADD_IO_SEG(0x00011F0000011240ull))
206#define CVMX_PEXP_SLI_PKT_OUT_ENB (CVMX_ADD_IO_SEG(0x00011F0000011010ull))
207#define CVMX_PEXP_SLI_PKT_PCIE_PORT (CVMX_ADD_IO_SEG(0x00011F00000110E0ull))
208#define CVMX_PEXP_SLI_PKT_PORT_IN_RST (CVMX_ADD_IO_SEG(0x00011F00000111F0ull))
209#define CVMX_PEXP_SLI_PKT_SLIST_ES (CVMX_ADD_IO_SEG(0x00011F0000011050ull))
210#define CVMX_PEXP_SLI_PKT_SLIST_NS (CVMX_ADD_IO_SEG(0x00011F0000011040ull))
211#define CVMX_PEXP_SLI_PKT_SLIST_ROR (CVMX_ADD_IO_SEG(0x00011F0000011030ull))
212#define CVMX_PEXP_SLI_PKT_TIME_INT (CVMX_ADD_IO_SEG(0x00011F0000011140ull))
213#define CVMX_PEXP_SLI_PKT_TIME_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000011160ull))
214#define CVMX_PEXP_SLI_PORTX_PKIND(offset) (CVMX_ADD_IO_SEG(0x00011F0000010800ull) + ((offset) & 31) * 16)
215#define CVMX_PEXP_SLI_S2M_PORTX_CTL(offset) (CVMX_ADD_IO_SEG(0x00011F0000013D80ull) + ((offset) & 3) * 16)
216#define CVMX_PEXP_SLI_SCRATCH_1 (CVMX_ADD_IO_SEG(0x00011F00000103C0ull))
217#define CVMX_PEXP_SLI_SCRATCH_2 (CVMX_ADD_IO_SEG(0x00011F00000103D0ull))
218#define CVMX_PEXP_SLI_STATE1 (CVMX_ADD_IO_SEG(0x00011F0000010620ull))
219#define CVMX_PEXP_SLI_STATE2 (CVMX_ADD_IO_SEG(0x00011F0000010630ull))
220#define CVMX_PEXP_SLI_STATE3 (CVMX_ADD_IO_SEG(0x00011F0000010640ull))
221#define CVMX_PEXP_SLI_TX_PIPE (CVMX_ADD_IO_SEG(0x00011F0000011230ull))
222#define CVMX_PEXP_SLI_WINDOW_CTL (CVMX_ADD_IO_SEG(0x00011F00000102E0ull))
223
224#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pip-defs.h b/arch/mips/include/asm/octeon/cvmx-pip-defs.h
new file mode 100644
index 000000000..e42f411bd
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pip-defs.h
@@ -0,0 +1,2734 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_PIP_DEFS_H__
29#define __CVMX_PIP_DEFS_H__
30
31/*
32 * Enumeration representing the amount of packet processing
33 * and validation performed by the input hardware.
34 */
35enum cvmx_pip_port_parse_mode {
36 /*
37 * Packet input doesn't perform any processing of the input
38 * packet.
39 */
40 CVMX_PIP_PORT_CFG_MODE_NONE = 0ull,
41 /*
42 * Full packet processing is performed with pointer starting
43 * at the L2 (ethernet MAC) header.
44 */
45 CVMX_PIP_PORT_CFG_MODE_SKIPL2 = 1ull,
46 /*
47 * Input packets are assumed to be IP. Results from non IP
48 * packets is undefined. Pointers reference the beginning of
49 * the IP header.
50 */
51 CVMX_PIP_PORT_CFG_MODE_SKIPIP = 2ull
52};
53
54#define CVMX_PIP_ALT_SKIP_CFGX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002A00ull) + ((offset) & 3) * 8)
55#define CVMX_PIP_BCK_PRS (CVMX_ADD_IO_SEG(0x00011800A0000038ull))
56#define CVMX_PIP_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011800A0000000ull))
57#define CVMX_PIP_BSEL_EXT_CFGX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002800ull) + ((offset) & 3) * 16)
58#define CVMX_PIP_BSEL_EXT_POSX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002808ull) + ((offset) & 3) * 16)
59#define CVMX_PIP_BSEL_TBL_ENTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0003000ull) + ((offset) & 511) * 8)
60#define CVMX_PIP_CLKEN (CVMX_ADD_IO_SEG(0x00011800A0000040ull))
61#define CVMX_PIP_CRC_CTLX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000040ull) + ((offset) & 1) * 8)
62#define CVMX_PIP_CRC_IVX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000050ull) + ((offset) & 1) * 8)
63#define CVMX_PIP_DEC_IPSECX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000080ull) + ((offset) & 3) * 8)
64#define CVMX_PIP_DSA_SRC_GRP (CVMX_ADD_IO_SEG(0x00011800A0000190ull))
65#define CVMX_PIP_DSA_VID_GRP (CVMX_ADD_IO_SEG(0x00011800A0000198ull))
66#define CVMX_PIP_FRM_LEN_CHKX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000180ull) + ((offset) & 1) * 8)
67#define CVMX_PIP_GBL_CFG (CVMX_ADD_IO_SEG(0x00011800A0000028ull))
68#define CVMX_PIP_GBL_CTL (CVMX_ADD_IO_SEG(0x00011800A0000020ull))
69#define CVMX_PIP_HG_PRI_QOS (CVMX_ADD_IO_SEG(0x00011800A00001A0ull))
70#define CVMX_PIP_INT_EN (CVMX_ADD_IO_SEG(0x00011800A0000010ull))
71#define CVMX_PIP_INT_REG (CVMX_ADD_IO_SEG(0x00011800A0000008ull))
72#define CVMX_PIP_IP_OFFSET (CVMX_ADD_IO_SEG(0x00011800A0000060ull))
73#define CVMX_PIP_PRI_TBLX(offset) (CVMX_ADD_IO_SEG(0x00011800A0004000ull) + ((offset) & 255) * 8)
74#define CVMX_PIP_PRT_CFGBX(offset) (CVMX_ADD_IO_SEG(0x00011800A0008000ull) + ((offset) & 63) * 8)
75#define CVMX_PIP_PRT_CFGX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000200ull) + ((offset) & 63) * 8)
76#define CVMX_PIP_PRT_TAGX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000400ull) + ((offset) & 63) * 8)
77#define CVMX_PIP_QOS_DIFFX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000600ull) + ((offset) & 63) * 8)
78#define CVMX_PIP_QOS_VLANX(offset) (CVMX_ADD_IO_SEG(0x00011800A00000C0ull) + ((offset) & 7) * 8)
79#define CVMX_PIP_QOS_WATCHX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000100ull) + ((offset) & 7) * 8)
80#define CVMX_PIP_RAW_WORD (CVMX_ADD_IO_SEG(0x00011800A00000B0ull))
81#define CVMX_PIP_SFT_RST (CVMX_ADD_IO_SEG(0x00011800A0000030ull))
82#define CVMX_PIP_STAT0_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000800ull) + ((offset) & 63) * 80)
83#define CVMX_PIP_STAT0_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040000ull) + ((offset) & 63) * 128)
84#define CVMX_PIP_STAT10_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0001480ull) + ((offset) & 63) * 16)
85#define CVMX_PIP_STAT10_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040050ull) + ((offset) & 63) * 128)
86#define CVMX_PIP_STAT11_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0001488ull) + ((offset) & 63) * 16)
87#define CVMX_PIP_STAT11_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040058ull) + ((offset) & 63) * 128)
88#define CVMX_PIP_STAT1_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000808ull) + ((offset) & 63) * 80)
89#define CVMX_PIP_STAT1_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040008ull) + ((offset) & 63) * 128)
90#define CVMX_PIP_STAT2_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000810ull) + ((offset) & 63) * 80)
91#define CVMX_PIP_STAT2_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040010ull) + ((offset) & 63) * 128)
92#define CVMX_PIP_STAT3_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000818ull) + ((offset) & 63) * 80)
93#define CVMX_PIP_STAT3_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040018ull) + ((offset) & 63) * 128)
94#define CVMX_PIP_STAT4_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000820ull) + ((offset) & 63) * 80)
95#define CVMX_PIP_STAT4_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040020ull) + ((offset) & 63) * 128)
96#define CVMX_PIP_STAT5_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000828ull) + ((offset) & 63) * 80)
97#define CVMX_PIP_STAT5_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040028ull) + ((offset) & 63) * 128)
98#define CVMX_PIP_STAT6_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000830ull) + ((offset) & 63) * 80)
99#define CVMX_PIP_STAT6_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040030ull) + ((offset) & 63) * 128)
100#define CVMX_PIP_STAT7_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000838ull) + ((offset) & 63) * 80)
101#define CVMX_PIP_STAT7_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040038ull) + ((offset) & 63) * 128)
102#define CVMX_PIP_STAT8_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000840ull) + ((offset) & 63) * 80)
103#define CVMX_PIP_STAT8_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040040ull) + ((offset) & 63) * 128)
104#define CVMX_PIP_STAT9_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0000848ull) + ((offset) & 63) * 80)
105#define CVMX_PIP_STAT9_X(offset) (CVMX_ADD_IO_SEG(0x00011800A0040048ull) + ((offset) & 63) * 128)
106#define CVMX_PIP_STAT_CTL (CVMX_ADD_IO_SEG(0x00011800A0000018ull))
107#define CVMX_PIP_STAT_INB_ERRSX(offset) (CVMX_ADD_IO_SEG(0x00011800A0001A10ull) + ((offset) & 63) * 32)
108#define CVMX_PIP_STAT_INB_ERRS_PKNDX(offset) (CVMX_ADD_IO_SEG(0x00011800A0020010ull) + ((offset) & 63) * 32)
109#define CVMX_PIP_STAT_INB_OCTSX(offset) (CVMX_ADD_IO_SEG(0x00011800A0001A08ull) + ((offset) & 63) * 32)
110#define CVMX_PIP_STAT_INB_OCTS_PKNDX(offset) (CVMX_ADD_IO_SEG(0x00011800A0020008ull) + ((offset) & 63) * 32)
111#define CVMX_PIP_STAT_INB_PKTSX(offset) (CVMX_ADD_IO_SEG(0x00011800A0001A00ull) + ((offset) & 63) * 32)
112#define CVMX_PIP_STAT_INB_PKTS_PKNDX(offset) (CVMX_ADD_IO_SEG(0x00011800A0020000ull) + ((offset) & 63) * 32)
113#define CVMX_PIP_SUB_PKIND_FCSX(block_id) (CVMX_ADD_IO_SEG(0x00011800A0080000ull))
114#define CVMX_PIP_TAG_INCX(offset) (CVMX_ADD_IO_SEG(0x00011800A0001800ull) + ((offset) & 63) * 8)
115#define CVMX_PIP_TAG_MASK (CVMX_ADD_IO_SEG(0x00011800A0000070ull))
116#define CVMX_PIP_TAG_SECRET (CVMX_ADD_IO_SEG(0x00011800A0000068ull))
117#define CVMX_PIP_TODO_ENTRY (CVMX_ADD_IO_SEG(0x00011800A0000078ull))
118#define CVMX_PIP_VLAN_ETYPESX(offset) (CVMX_ADD_IO_SEG(0x00011800A00001C0ull) + ((offset) & 1) * 8)
119#define CVMX_PIP_XSTAT0_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002000ull) + ((offset) & 63) * 80 - 80*40)
120#define CVMX_PIP_XSTAT10_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0001700ull) + ((offset) & 63) * 16 - 16*40)
121#define CVMX_PIP_XSTAT11_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0001708ull) + ((offset) & 63) * 16 - 16*40)
122#define CVMX_PIP_XSTAT1_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002008ull) + ((offset) & 63) * 80 - 80*40)
123#define CVMX_PIP_XSTAT2_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002010ull) + ((offset) & 63) * 80 - 80*40)
124#define CVMX_PIP_XSTAT3_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002018ull) + ((offset) & 63) * 80 - 80*40)
125#define CVMX_PIP_XSTAT4_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002020ull) + ((offset) & 63) * 80 - 80*40)
126#define CVMX_PIP_XSTAT5_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002028ull) + ((offset) & 63) * 80 - 80*40)
127#define CVMX_PIP_XSTAT6_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002030ull) + ((offset) & 63) * 80 - 80*40)
128#define CVMX_PIP_XSTAT7_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002038ull) + ((offset) & 63) * 80 - 80*40)
129#define CVMX_PIP_XSTAT8_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002040ull) + ((offset) & 63) * 80 - 80*40)
130#define CVMX_PIP_XSTAT9_PRTX(offset) (CVMX_ADD_IO_SEG(0x00011800A0002048ull) + ((offset) & 63) * 80 - 80*40)
131
132union cvmx_pip_alt_skip_cfgx {
133 uint64_t u64;
134 struct cvmx_pip_alt_skip_cfgx_s {
135#ifdef __BIG_ENDIAN_BITFIELD
136 uint64_t reserved_57_63:7;
137 uint64_t len:1;
138 uint64_t reserved_46_55:10;
139 uint64_t bit1:6;
140 uint64_t reserved_38_39:2;
141 uint64_t bit0:6;
142 uint64_t reserved_23_31:9;
143 uint64_t skip3:7;
144 uint64_t reserved_15_15:1;
145 uint64_t skip2:7;
146 uint64_t reserved_7_7:1;
147 uint64_t skip1:7;
148#else
149 uint64_t skip1:7;
150 uint64_t reserved_7_7:1;
151 uint64_t skip2:7;
152 uint64_t reserved_15_15:1;
153 uint64_t skip3:7;
154 uint64_t reserved_23_31:9;
155 uint64_t bit0:6;
156 uint64_t reserved_38_39:2;
157 uint64_t bit1:6;
158 uint64_t reserved_46_55:10;
159 uint64_t len:1;
160 uint64_t reserved_57_63:7;
161#endif
162 } s;
163};
164
165union cvmx_pip_bck_prs {
166 uint64_t u64;
167 struct cvmx_pip_bck_prs_s {
168#ifdef __BIG_ENDIAN_BITFIELD
169 uint64_t bckprs:1;
170 uint64_t reserved_13_62:50;
171 uint64_t hiwater:5;
172 uint64_t reserved_5_7:3;
173 uint64_t lowater:5;
174#else
175 uint64_t lowater:5;
176 uint64_t reserved_5_7:3;
177 uint64_t hiwater:5;
178 uint64_t reserved_13_62:50;
179 uint64_t bckprs:1;
180#endif
181 } s;
182};
183
184union cvmx_pip_bist_status {
185 uint64_t u64;
186 struct cvmx_pip_bist_status_s {
187#ifdef __BIG_ENDIAN_BITFIELD
188 uint64_t reserved_22_63:42;
189 uint64_t bist:22;
190#else
191 uint64_t bist:22;
192 uint64_t reserved_22_63:42;
193#endif
194 } s;
195 struct cvmx_pip_bist_status_cn30xx {
196#ifdef __BIG_ENDIAN_BITFIELD
197 uint64_t reserved_18_63:46;
198 uint64_t bist:18;
199#else
200 uint64_t bist:18;
201 uint64_t reserved_18_63:46;
202#endif
203 } cn30xx;
204 struct cvmx_pip_bist_status_cn50xx {
205#ifdef __BIG_ENDIAN_BITFIELD
206 uint64_t reserved_17_63:47;
207 uint64_t bist:17;
208#else
209 uint64_t bist:17;
210 uint64_t reserved_17_63:47;
211#endif
212 } cn50xx;
213 struct cvmx_pip_bist_status_cn61xx {
214#ifdef __BIG_ENDIAN_BITFIELD
215 uint64_t reserved_20_63:44;
216 uint64_t bist:20;
217#else
218 uint64_t bist:20;
219 uint64_t reserved_20_63:44;
220#endif
221 } cn61xx;
222};
223
224union cvmx_pip_bsel_ext_cfgx {
225 uint64_t u64;
226 struct cvmx_pip_bsel_ext_cfgx_s {
227#ifdef __BIG_ENDIAN_BITFIELD
228 uint64_t reserved_56_63:8;
229 uint64_t upper_tag:16;
230 uint64_t tag:8;
231 uint64_t reserved_25_31:7;
232 uint64_t offset:9;
233 uint64_t reserved_7_15:9;
234 uint64_t skip:7;
235#else
236 uint64_t skip:7;
237 uint64_t reserved_7_15:9;
238 uint64_t offset:9;
239 uint64_t reserved_25_31:7;
240 uint64_t tag:8;
241 uint64_t upper_tag:16;
242 uint64_t reserved_56_63:8;
243#endif
244 } s;
245};
246
247union cvmx_pip_bsel_ext_posx {
248 uint64_t u64;
249 struct cvmx_pip_bsel_ext_posx_s {
250#ifdef __BIG_ENDIAN_BITFIELD
251 uint64_t pos7_val:1;
252 uint64_t pos7:7;
253 uint64_t pos6_val:1;
254 uint64_t pos6:7;
255 uint64_t pos5_val:1;
256 uint64_t pos5:7;
257 uint64_t pos4_val:1;
258 uint64_t pos4:7;
259 uint64_t pos3_val:1;
260 uint64_t pos3:7;
261 uint64_t pos2_val:1;
262 uint64_t pos2:7;
263 uint64_t pos1_val:1;
264 uint64_t pos1:7;
265 uint64_t pos0_val:1;
266 uint64_t pos0:7;
267#else
268 uint64_t pos0:7;
269 uint64_t pos0_val:1;
270 uint64_t pos1:7;
271 uint64_t pos1_val:1;
272 uint64_t pos2:7;
273 uint64_t pos2_val:1;
274 uint64_t pos3:7;
275 uint64_t pos3_val:1;
276 uint64_t pos4:7;
277 uint64_t pos4_val:1;
278 uint64_t pos5:7;
279 uint64_t pos5_val:1;
280 uint64_t pos6:7;
281 uint64_t pos6_val:1;
282 uint64_t pos7:7;
283 uint64_t pos7_val:1;
284#endif
285 } s;
286};
287
288union cvmx_pip_bsel_tbl_entx {
289 uint64_t u64;
290 struct cvmx_pip_bsel_tbl_entx_s {
291#ifdef __BIG_ENDIAN_BITFIELD
292 uint64_t tag_en:1;
293 uint64_t grp_en:1;
294 uint64_t tt_en:1;
295 uint64_t qos_en:1;
296 uint64_t reserved_40_59:20;
297 uint64_t tag:8;
298 uint64_t reserved_22_31:10;
299 uint64_t grp:6;
300 uint64_t reserved_10_15:6;
301 uint64_t tt:2;
302 uint64_t reserved_3_7:5;
303 uint64_t qos:3;
304#else
305 uint64_t qos:3;
306 uint64_t reserved_3_7:5;
307 uint64_t tt:2;
308 uint64_t reserved_10_15:6;
309 uint64_t grp:6;
310 uint64_t reserved_22_31:10;
311 uint64_t tag:8;
312 uint64_t reserved_40_59:20;
313 uint64_t qos_en:1;
314 uint64_t tt_en:1;
315 uint64_t grp_en:1;
316 uint64_t tag_en:1;
317#endif
318 } s;
319 struct cvmx_pip_bsel_tbl_entx_cn61xx {
320#ifdef __BIG_ENDIAN_BITFIELD
321 uint64_t tag_en:1;
322 uint64_t grp_en:1;
323 uint64_t tt_en:1;
324 uint64_t qos_en:1;
325 uint64_t reserved_40_59:20;
326 uint64_t tag:8;
327 uint64_t reserved_20_31:12;
328 uint64_t grp:4;
329 uint64_t reserved_10_15:6;
330 uint64_t tt:2;
331 uint64_t reserved_3_7:5;
332 uint64_t qos:3;
333#else
334 uint64_t qos:3;
335 uint64_t reserved_3_7:5;
336 uint64_t tt:2;
337 uint64_t reserved_10_15:6;
338 uint64_t grp:4;
339 uint64_t reserved_20_31:12;
340 uint64_t tag:8;
341 uint64_t reserved_40_59:20;
342 uint64_t qos_en:1;
343 uint64_t tt_en:1;
344 uint64_t grp_en:1;
345 uint64_t tag_en:1;
346#endif
347 } cn61xx;
348};
349
350union cvmx_pip_clken {
351 uint64_t u64;
352 struct cvmx_pip_clken_s {
353#ifdef __BIG_ENDIAN_BITFIELD
354 uint64_t reserved_1_63:63;
355 uint64_t clken:1;
356#else
357 uint64_t clken:1;
358 uint64_t reserved_1_63:63;
359#endif
360 } s;
361};
362
363union cvmx_pip_crc_ctlx {
364 uint64_t u64;
365 struct cvmx_pip_crc_ctlx_s {
366#ifdef __BIG_ENDIAN_BITFIELD
367 uint64_t reserved_2_63:62;
368 uint64_t invres:1;
369 uint64_t reflect:1;
370#else
371 uint64_t reflect:1;
372 uint64_t invres:1;
373 uint64_t reserved_2_63:62;
374#endif
375 } s;
376};
377
378union cvmx_pip_crc_ivx {
379 uint64_t u64;
380 struct cvmx_pip_crc_ivx_s {
381#ifdef __BIG_ENDIAN_BITFIELD
382 uint64_t reserved_32_63:32;
383 uint64_t iv:32;
384#else
385 uint64_t iv:32;
386 uint64_t reserved_32_63:32;
387#endif
388 } s;
389};
390
391union cvmx_pip_dec_ipsecx {
392 uint64_t u64;
393 struct cvmx_pip_dec_ipsecx_s {
394#ifdef __BIG_ENDIAN_BITFIELD
395 uint64_t reserved_18_63:46;
396 uint64_t tcp:1;
397 uint64_t udp:1;
398 uint64_t dprt:16;
399#else
400 uint64_t dprt:16;
401 uint64_t udp:1;
402 uint64_t tcp:1;
403 uint64_t reserved_18_63:46;
404#endif
405 } s;
406};
407
408union cvmx_pip_dsa_src_grp {
409 uint64_t u64;
410 struct cvmx_pip_dsa_src_grp_s {
411#ifdef __BIG_ENDIAN_BITFIELD
412 uint64_t map15:4;
413 uint64_t map14:4;
414 uint64_t map13:4;
415 uint64_t map12:4;
416 uint64_t map11:4;
417 uint64_t map10:4;
418 uint64_t map9:4;
419 uint64_t map8:4;
420 uint64_t map7:4;
421 uint64_t map6:4;
422 uint64_t map5:4;
423 uint64_t map4:4;
424 uint64_t map3:4;
425 uint64_t map2:4;
426 uint64_t map1:4;
427 uint64_t map0:4;
428#else
429 uint64_t map0:4;
430 uint64_t map1:4;
431 uint64_t map2:4;
432 uint64_t map3:4;
433 uint64_t map4:4;
434 uint64_t map5:4;
435 uint64_t map6:4;
436 uint64_t map7:4;
437 uint64_t map8:4;
438 uint64_t map9:4;
439 uint64_t map10:4;
440 uint64_t map11:4;
441 uint64_t map12:4;
442 uint64_t map13:4;
443 uint64_t map14:4;
444 uint64_t map15:4;
445#endif
446 } s;
447};
448
449union cvmx_pip_dsa_vid_grp {
450 uint64_t u64;
451 struct cvmx_pip_dsa_vid_grp_s {
452#ifdef __BIG_ENDIAN_BITFIELD
453 uint64_t map15:4;
454 uint64_t map14:4;
455 uint64_t map13:4;
456 uint64_t map12:4;
457 uint64_t map11:4;
458 uint64_t map10:4;
459 uint64_t map9:4;
460 uint64_t map8:4;
461 uint64_t map7:4;
462 uint64_t map6:4;
463 uint64_t map5:4;
464 uint64_t map4:4;
465 uint64_t map3:4;
466 uint64_t map2:4;
467 uint64_t map1:4;
468 uint64_t map0:4;
469#else
470 uint64_t map0:4;
471 uint64_t map1:4;
472 uint64_t map2:4;
473 uint64_t map3:4;
474 uint64_t map4:4;
475 uint64_t map5:4;
476 uint64_t map6:4;
477 uint64_t map7:4;
478 uint64_t map8:4;
479 uint64_t map9:4;
480 uint64_t map10:4;
481 uint64_t map11:4;
482 uint64_t map12:4;
483 uint64_t map13:4;
484 uint64_t map14:4;
485 uint64_t map15:4;
486#endif
487 } s;
488};
489
490union cvmx_pip_frm_len_chkx {
491 uint64_t u64;
492 struct cvmx_pip_frm_len_chkx_s {
493#ifdef __BIG_ENDIAN_BITFIELD
494 uint64_t reserved_32_63:32;
495 uint64_t maxlen:16;
496 uint64_t minlen:16;
497#else
498 uint64_t minlen:16;
499 uint64_t maxlen:16;
500 uint64_t reserved_32_63:32;
501#endif
502 } s;
503};
504
505union cvmx_pip_gbl_cfg {
506 uint64_t u64;
507 struct cvmx_pip_gbl_cfg_s {
508#ifdef __BIG_ENDIAN_BITFIELD
509 uint64_t reserved_19_63:45;
510 uint64_t tag_syn:1;
511 uint64_t ip6_udp:1;
512 uint64_t max_l2:1;
513 uint64_t reserved_11_15:5;
514 uint64_t raw_shf:3;
515 uint64_t reserved_3_7:5;
516 uint64_t nip_shf:3;
517#else
518 uint64_t nip_shf:3;
519 uint64_t reserved_3_7:5;
520 uint64_t raw_shf:3;
521 uint64_t reserved_11_15:5;
522 uint64_t max_l2:1;
523 uint64_t ip6_udp:1;
524 uint64_t tag_syn:1;
525 uint64_t reserved_19_63:45;
526#endif
527 } s;
528};
529
530union cvmx_pip_gbl_ctl {
531 uint64_t u64;
532 struct cvmx_pip_gbl_ctl_s {
533#ifdef __BIG_ENDIAN_BITFIELD
534 uint64_t reserved_29_63:35;
535 uint64_t egrp_dis:1;
536 uint64_t ihmsk_dis:1;
537 uint64_t dsa_grp_tvid:1;
538 uint64_t dsa_grp_scmd:1;
539 uint64_t dsa_grp_sid:1;
540 uint64_t reserved_21_23:3;
541 uint64_t ring_en:1;
542 uint64_t reserved_17_19:3;
543 uint64_t ignrs:1;
544 uint64_t vs_wqe:1;
545 uint64_t vs_qos:1;
546 uint64_t l2_mal:1;
547 uint64_t tcp_flag:1;
548 uint64_t l4_len:1;
549 uint64_t l4_chk:1;
550 uint64_t l4_prt:1;
551 uint64_t l4_mal:1;
552 uint64_t reserved_6_7:2;
553 uint64_t ip6_eext:2;
554 uint64_t ip4_opts:1;
555 uint64_t ip_hop:1;
556 uint64_t ip_mal:1;
557 uint64_t ip_chk:1;
558#else
559 uint64_t ip_chk:1;
560 uint64_t ip_mal:1;
561 uint64_t ip_hop:1;
562 uint64_t ip4_opts:1;
563 uint64_t ip6_eext:2;
564 uint64_t reserved_6_7:2;
565 uint64_t l4_mal:1;
566 uint64_t l4_prt:1;
567 uint64_t l4_chk:1;
568 uint64_t l4_len:1;
569 uint64_t tcp_flag:1;
570 uint64_t l2_mal:1;
571 uint64_t vs_qos:1;
572 uint64_t vs_wqe:1;
573 uint64_t ignrs:1;
574 uint64_t reserved_17_19:3;
575 uint64_t ring_en:1;
576 uint64_t reserved_21_23:3;
577 uint64_t dsa_grp_sid:1;
578 uint64_t dsa_grp_scmd:1;
579 uint64_t dsa_grp_tvid:1;
580 uint64_t ihmsk_dis:1;
581 uint64_t egrp_dis:1;
582 uint64_t reserved_29_63:35;
583#endif
584 } s;
585 struct cvmx_pip_gbl_ctl_cn30xx {
586#ifdef __BIG_ENDIAN_BITFIELD
587 uint64_t reserved_17_63:47;
588 uint64_t ignrs:1;
589 uint64_t vs_wqe:1;
590 uint64_t vs_qos:1;
591 uint64_t l2_mal:1;
592 uint64_t tcp_flag:1;
593 uint64_t l4_len:1;
594 uint64_t l4_chk:1;
595 uint64_t l4_prt:1;
596 uint64_t l4_mal:1;
597 uint64_t reserved_6_7:2;
598 uint64_t ip6_eext:2;
599 uint64_t ip4_opts:1;
600 uint64_t ip_hop:1;
601 uint64_t ip_mal:1;
602 uint64_t ip_chk:1;
603#else
604 uint64_t ip_chk:1;
605 uint64_t ip_mal:1;
606 uint64_t ip_hop:1;
607 uint64_t ip4_opts:1;
608 uint64_t ip6_eext:2;
609 uint64_t reserved_6_7:2;
610 uint64_t l4_mal:1;
611 uint64_t l4_prt:1;
612 uint64_t l4_chk:1;
613 uint64_t l4_len:1;
614 uint64_t tcp_flag:1;
615 uint64_t l2_mal:1;
616 uint64_t vs_qos:1;
617 uint64_t vs_wqe:1;
618 uint64_t ignrs:1;
619 uint64_t reserved_17_63:47;
620#endif
621 } cn30xx;
622 struct cvmx_pip_gbl_ctl_cn52xx {
623#ifdef __BIG_ENDIAN_BITFIELD
624 uint64_t reserved_27_63:37;
625 uint64_t dsa_grp_tvid:1;
626 uint64_t dsa_grp_scmd:1;
627 uint64_t dsa_grp_sid:1;
628 uint64_t reserved_21_23:3;
629 uint64_t ring_en:1;
630 uint64_t reserved_17_19:3;
631 uint64_t ignrs:1;
632 uint64_t vs_wqe:1;
633 uint64_t vs_qos:1;
634 uint64_t l2_mal:1;
635 uint64_t tcp_flag:1;
636 uint64_t l4_len:1;
637 uint64_t l4_chk:1;
638 uint64_t l4_prt:1;
639 uint64_t l4_mal:1;
640 uint64_t reserved_6_7:2;
641 uint64_t ip6_eext:2;
642 uint64_t ip4_opts:1;
643 uint64_t ip_hop:1;
644 uint64_t ip_mal:1;
645 uint64_t ip_chk:1;
646#else
647 uint64_t ip_chk:1;
648 uint64_t ip_mal:1;
649 uint64_t ip_hop:1;
650 uint64_t ip4_opts:1;
651 uint64_t ip6_eext:2;
652 uint64_t reserved_6_7:2;
653 uint64_t l4_mal:1;
654 uint64_t l4_prt:1;
655 uint64_t l4_chk:1;
656 uint64_t l4_len:1;
657 uint64_t tcp_flag:1;
658 uint64_t l2_mal:1;
659 uint64_t vs_qos:1;
660 uint64_t vs_wqe:1;
661 uint64_t ignrs:1;
662 uint64_t reserved_17_19:3;
663 uint64_t ring_en:1;
664 uint64_t reserved_21_23:3;
665 uint64_t dsa_grp_sid:1;
666 uint64_t dsa_grp_scmd:1;
667 uint64_t dsa_grp_tvid:1;
668 uint64_t reserved_27_63:37;
669#endif
670 } cn52xx;
671 struct cvmx_pip_gbl_ctl_cn56xxp1 {
672#ifdef __BIG_ENDIAN_BITFIELD
673 uint64_t reserved_21_63:43;
674 uint64_t ring_en:1;
675 uint64_t reserved_17_19:3;
676 uint64_t ignrs:1;
677 uint64_t vs_wqe:1;
678 uint64_t vs_qos:1;
679 uint64_t l2_mal:1;
680 uint64_t tcp_flag:1;
681 uint64_t l4_len:1;
682 uint64_t l4_chk:1;
683 uint64_t l4_prt:1;
684 uint64_t l4_mal:1;
685 uint64_t reserved_6_7:2;
686 uint64_t ip6_eext:2;
687 uint64_t ip4_opts:1;
688 uint64_t ip_hop:1;
689 uint64_t ip_mal:1;
690 uint64_t ip_chk:1;
691#else
692 uint64_t ip_chk:1;
693 uint64_t ip_mal:1;
694 uint64_t ip_hop:1;
695 uint64_t ip4_opts:1;
696 uint64_t ip6_eext:2;
697 uint64_t reserved_6_7:2;
698 uint64_t l4_mal:1;
699 uint64_t l4_prt:1;
700 uint64_t l4_chk:1;
701 uint64_t l4_len:1;
702 uint64_t tcp_flag:1;
703 uint64_t l2_mal:1;
704 uint64_t vs_qos:1;
705 uint64_t vs_wqe:1;
706 uint64_t ignrs:1;
707 uint64_t reserved_17_19:3;
708 uint64_t ring_en:1;
709 uint64_t reserved_21_63:43;
710#endif
711 } cn56xxp1;
712 struct cvmx_pip_gbl_ctl_cn61xx {
713#ifdef __BIG_ENDIAN_BITFIELD
714 uint64_t reserved_28_63:36;
715 uint64_t ihmsk_dis:1;
716 uint64_t dsa_grp_tvid:1;
717 uint64_t dsa_grp_scmd:1;
718 uint64_t dsa_grp_sid:1;
719 uint64_t reserved_21_23:3;
720 uint64_t ring_en:1;
721 uint64_t reserved_17_19:3;
722 uint64_t ignrs:1;
723 uint64_t vs_wqe:1;
724 uint64_t vs_qos:1;
725 uint64_t l2_mal:1;
726 uint64_t tcp_flag:1;
727 uint64_t l4_len:1;
728 uint64_t l4_chk:1;
729 uint64_t l4_prt:1;
730 uint64_t l4_mal:1;
731 uint64_t reserved_6_7:2;
732 uint64_t ip6_eext:2;
733 uint64_t ip4_opts:1;
734 uint64_t ip_hop:1;
735 uint64_t ip_mal:1;
736 uint64_t ip_chk:1;
737#else
738 uint64_t ip_chk:1;
739 uint64_t ip_mal:1;
740 uint64_t ip_hop:1;
741 uint64_t ip4_opts:1;
742 uint64_t ip6_eext:2;
743 uint64_t reserved_6_7:2;
744 uint64_t l4_mal:1;
745 uint64_t l4_prt:1;
746 uint64_t l4_chk:1;
747 uint64_t l4_len:1;
748 uint64_t tcp_flag:1;
749 uint64_t l2_mal:1;
750 uint64_t vs_qos:1;
751 uint64_t vs_wqe:1;
752 uint64_t ignrs:1;
753 uint64_t reserved_17_19:3;
754 uint64_t ring_en:1;
755 uint64_t reserved_21_23:3;
756 uint64_t dsa_grp_sid:1;
757 uint64_t dsa_grp_scmd:1;
758 uint64_t dsa_grp_tvid:1;
759 uint64_t ihmsk_dis:1;
760 uint64_t reserved_28_63:36;
761#endif
762 } cn61xx;
763 struct cvmx_pip_gbl_ctl_cn68xx {
764#ifdef __BIG_ENDIAN_BITFIELD
765 uint64_t reserved_29_63:35;
766 uint64_t egrp_dis:1;
767 uint64_t ihmsk_dis:1;
768 uint64_t dsa_grp_tvid:1;
769 uint64_t dsa_grp_scmd:1;
770 uint64_t dsa_grp_sid:1;
771 uint64_t reserved_17_23:7;
772 uint64_t ignrs:1;
773 uint64_t vs_wqe:1;
774 uint64_t vs_qos:1;
775 uint64_t l2_mal:1;
776 uint64_t tcp_flag:1;
777 uint64_t l4_len:1;
778 uint64_t l4_chk:1;
779 uint64_t l4_prt:1;
780 uint64_t l4_mal:1;
781 uint64_t reserved_6_7:2;
782 uint64_t ip6_eext:2;
783 uint64_t ip4_opts:1;
784 uint64_t ip_hop:1;
785 uint64_t ip_mal:1;
786 uint64_t ip_chk:1;
787#else
788 uint64_t ip_chk:1;
789 uint64_t ip_mal:1;
790 uint64_t ip_hop:1;
791 uint64_t ip4_opts:1;
792 uint64_t ip6_eext:2;
793 uint64_t reserved_6_7:2;
794 uint64_t l4_mal:1;
795 uint64_t l4_prt:1;
796 uint64_t l4_chk:1;
797 uint64_t l4_len:1;
798 uint64_t tcp_flag:1;
799 uint64_t l2_mal:1;
800 uint64_t vs_qos:1;
801 uint64_t vs_wqe:1;
802 uint64_t ignrs:1;
803 uint64_t reserved_17_23:7;
804 uint64_t dsa_grp_sid:1;
805 uint64_t dsa_grp_scmd:1;
806 uint64_t dsa_grp_tvid:1;
807 uint64_t ihmsk_dis:1;
808 uint64_t egrp_dis:1;
809 uint64_t reserved_29_63:35;
810#endif
811 } cn68xx;
812 struct cvmx_pip_gbl_ctl_cn68xxp1 {
813#ifdef __BIG_ENDIAN_BITFIELD
814 uint64_t reserved_28_63:36;
815 uint64_t ihmsk_dis:1;
816 uint64_t dsa_grp_tvid:1;
817 uint64_t dsa_grp_scmd:1;
818 uint64_t dsa_grp_sid:1;
819 uint64_t reserved_17_23:7;
820 uint64_t ignrs:1;
821 uint64_t vs_wqe:1;
822 uint64_t vs_qos:1;
823 uint64_t l2_mal:1;
824 uint64_t tcp_flag:1;
825 uint64_t l4_len:1;
826 uint64_t l4_chk:1;
827 uint64_t l4_prt:1;
828 uint64_t l4_mal:1;
829 uint64_t reserved_6_7:2;
830 uint64_t ip6_eext:2;
831 uint64_t ip4_opts:1;
832 uint64_t ip_hop:1;
833 uint64_t ip_mal:1;
834 uint64_t ip_chk:1;
835#else
836 uint64_t ip_chk:1;
837 uint64_t ip_mal:1;
838 uint64_t ip_hop:1;
839 uint64_t ip4_opts:1;
840 uint64_t ip6_eext:2;
841 uint64_t reserved_6_7:2;
842 uint64_t l4_mal:1;
843 uint64_t l4_prt:1;
844 uint64_t l4_chk:1;
845 uint64_t l4_len:1;
846 uint64_t tcp_flag:1;
847 uint64_t l2_mal:1;
848 uint64_t vs_qos:1;
849 uint64_t vs_wqe:1;
850 uint64_t ignrs:1;
851 uint64_t reserved_17_23:7;
852 uint64_t dsa_grp_sid:1;
853 uint64_t dsa_grp_scmd:1;
854 uint64_t dsa_grp_tvid:1;
855 uint64_t ihmsk_dis:1;
856 uint64_t reserved_28_63:36;
857#endif
858 } cn68xxp1;
859};
860
861union cvmx_pip_hg_pri_qos {
862 uint64_t u64;
863 struct cvmx_pip_hg_pri_qos_s {
864#ifdef __BIG_ENDIAN_BITFIELD
865 uint64_t reserved_13_63:51;
866 uint64_t up_qos:1;
867 uint64_t reserved_11_11:1;
868 uint64_t qos:3;
869 uint64_t reserved_6_7:2;
870 uint64_t pri:6;
871#else
872 uint64_t pri:6;
873 uint64_t reserved_6_7:2;
874 uint64_t qos:3;
875 uint64_t reserved_11_11:1;
876 uint64_t up_qos:1;
877 uint64_t reserved_13_63:51;
878#endif
879 } s;
880};
881
882union cvmx_pip_int_en {
883 uint64_t u64;
884 struct cvmx_pip_int_en_s {
885#ifdef __BIG_ENDIAN_BITFIELD
886 uint64_t reserved_13_63:51;
887 uint64_t punyerr:1;
888 uint64_t lenerr:1;
889 uint64_t maxerr:1;
890 uint64_t minerr:1;
891 uint64_t beperr:1;
892 uint64_t feperr:1;
893 uint64_t todoovr:1;
894 uint64_t skprunt:1;
895 uint64_t badtag:1;
896 uint64_t prtnxa:1;
897 uint64_t bckprs:1;
898 uint64_t crcerr:1;
899 uint64_t pktdrp:1;
900#else
901 uint64_t pktdrp:1;
902 uint64_t crcerr:1;
903 uint64_t bckprs:1;
904 uint64_t prtnxa:1;
905 uint64_t badtag:1;
906 uint64_t skprunt:1;
907 uint64_t todoovr:1;
908 uint64_t feperr:1;
909 uint64_t beperr:1;
910 uint64_t minerr:1;
911 uint64_t maxerr:1;
912 uint64_t lenerr:1;
913 uint64_t punyerr:1;
914 uint64_t reserved_13_63:51;
915#endif
916 } s;
917 struct cvmx_pip_int_en_cn30xx {
918#ifdef __BIG_ENDIAN_BITFIELD
919 uint64_t reserved_9_63:55;
920 uint64_t beperr:1;
921 uint64_t feperr:1;
922 uint64_t todoovr:1;
923 uint64_t skprunt:1;
924 uint64_t badtag:1;
925 uint64_t prtnxa:1;
926 uint64_t bckprs:1;
927 uint64_t crcerr:1;
928 uint64_t pktdrp:1;
929#else
930 uint64_t pktdrp:1;
931 uint64_t crcerr:1;
932 uint64_t bckprs:1;
933 uint64_t prtnxa:1;
934 uint64_t badtag:1;
935 uint64_t skprunt:1;
936 uint64_t todoovr:1;
937 uint64_t feperr:1;
938 uint64_t beperr:1;
939 uint64_t reserved_9_63:55;
940#endif
941 } cn30xx;
942 struct cvmx_pip_int_en_cn50xx {
943#ifdef __BIG_ENDIAN_BITFIELD
944 uint64_t reserved_12_63:52;
945 uint64_t lenerr:1;
946 uint64_t maxerr:1;
947 uint64_t minerr:1;
948 uint64_t beperr:1;
949 uint64_t feperr:1;
950 uint64_t todoovr:1;
951 uint64_t skprunt:1;
952 uint64_t badtag:1;
953 uint64_t prtnxa:1;
954 uint64_t bckprs:1;
955 uint64_t reserved_1_1:1;
956 uint64_t pktdrp:1;
957#else
958 uint64_t pktdrp:1;
959 uint64_t reserved_1_1:1;
960 uint64_t bckprs:1;
961 uint64_t prtnxa:1;
962 uint64_t badtag:1;
963 uint64_t skprunt:1;
964 uint64_t todoovr:1;
965 uint64_t feperr:1;
966 uint64_t beperr:1;
967 uint64_t minerr:1;
968 uint64_t maxerr:1;
969 uint64_t lenerr:1;
970 uint64_t reserved_12_63:52;
971#endif
972 } cn50xx;
973 struct cvmx_pip_int_en_cn52xx {
974#ifdef __BIG_ENDIAN_BITFIELD
975 uint64_t reserved_13_63:51;
976 uint64_t punyerr:1;
977 uint64_t lenerr:1;
978 uint64_t maxerr:1;
979 uint64_t minerr:1;
980 uint64_t beperr:1;
981 uint64_t feperr:1;
982 uint64_t todoovr:1;
983 uint64_t skprunt:1;
984 uint64_t badtag:1;
985 uint64_t prtnxa:1;
986 uint64_t bckprs:1;
987 uint64_t reserved_1_1:1;
988 uint64_t pktdrp:1;
989#else
990 uint64_t pktdrp:1;
991 uint64_t reserved_1_1:1;
992 uint64_t bckprs:1;
993 uint64_t prtnxa:1;
994 uint64_t badtag:1;
995 uint64_t skprunt:1;
996 uint64_t todoovr:1;
997 uint64_t feperr:1;
998 uint64_t beperr:1;
999 uint64_t minerr:1;
1000 uint64_t maxerr:1;
1001 uint64_t lenerr:1;
1002 uint64_t punyerr:1;
1003 uint64_t reserved_13_63:51;
1004#endif
1005 } cn52xx;
1006 struct cvmx_pip_int_en_cn56xxp1 {
1007#ifdef __BIG_ENDIAN_BITFIELD
1008 uint64_t reserved_12_63:52;
1009 uint64_t lenerr:1;
1010 uint64_t maxerr:1;
1011 uint64_t minerr:1;
1012 uint64_t beperr:1;
1013 uint64_t feperr:1;
1014 uint64_t todoovr:1;
1015 uint64_t skprunt:1;
1016 uint64_t badtag:1;
1017 uint64_t prtnxa:1;
1018 uint64_t bckprs:1;
1019 uint64_t crcerr:1;
1020 uint64_t pktdrp:1;
1021#else
1022 uint64_t pktdrp:1;
1023 uint64_t crcerr:1;
1024 uint64_t bckprs:1;
1025 uint64_t prtnxa:1;
1026 uint64_t badtag:1;
1027 uint64_t skprunt:1;
1028 uint64_t todoovr:1;
1029 uint64_t feperr:1;
1030 uint64_t beperr:1;
1031 uint64_t minerr:1;
1032 uint64_t maxerr:1;
1033 uint64_t lenerr:1;
1034 uint64_t reserved_12_63:52;
1035#endif
1036 } cn56xxp1;
1037 struct cvmx_pip_int_en_cn58xx {
1038#ifdef __BIG_ENDIAN_BITFIELD
1039 uint64_t reserved_13_63:51;
1040 uint64_t punyerr:1;
1041 uint64_t reserved_9_11:3;
1042 uint64_t beperr:1;
1043 uint64_t feperr:1;
1044 uint64_t todoovr:1;
1045 uint64_t skprunt:1;
1046 uint64_t badtag:1;
1047 uint64_t prtnxa:1;
1048 uint64_t bckprs:1;
1049 uint64_t crcerr:1;
1050 uint64_t pktdrp:1;
1051#else
1052 uint64_t pktdrp:1;
1053 uint64_t crcerr:1;
1054 uint64_t bckprs:1;
1055 uint64_t prtnxa:1;
1056 uint64_t badtag:1;
1057 uint64_t skprunt:1;
1058 uint64_t todoovr:1;
1059 uint64_t feperr:1;
1060 uint64_t beperr:1;
1061 uint64_t reserved_9_11:3;
1062 uint64_t punyerr:1;
1063 uint64_t reserved_13_63:51;
1064#endif
1065 } cn58xx;
1066};
1067
1068union cvmx_pip_int_reg {
1069 uint64_t u64;
1070 struct cvmx_pip_int_reg_s {
1071#ifdef __BIG_ENDIAN_BITFIELD
1072 uint64_t reserved_13_63:51;
1073 uint64_t punyerr:1;
1074 uint64_t lenerr:1;
1075 uint64_t maxerr:1;
1076 uint64_t minerr:1;
1077 uint64_t beperr:1;
1078 uint64_t feperr:1;
1079 uint64_t todoovr:1;
1080 uint64_t skprunt:1;
1081 uint64_t badtag:1;
1082 uint64_t prtnxa:1;
1083 uint64_t bckprs:1;
1084 uint64_t crcerr:1;
1085 uint64_t pktdrp:1;
1086#else
1087 uint64_t pktdrp:1;
1088 uint64_t crcerr:1;
1089 uint64_t bckprs:1;
1090 uint64_t prtnxa:1;
1091 uint64_t badtag:1;
1092 uint64_t skprunt:1;
1093 uint64_t todoovr:1;
1094 uint64_t feperr:1;
1095 uint64_t beperr:1;
1096 uint64_t minerr:1;
1097 uint64_t maxerr:1;
1098 uint64_t lenerr:1;
1099 uint64_t punyerr:1;
1100 uint64_t reserved_13_63:51;
1101#endif
1102 } s;
1103 struct cvmx_pip_int_reg_cn30xx {
1104#ifdef __BIG_ENDIAN_BITFIELD
1105 uint64_t reserved_9_63:55;
1106 uint64_t beperr:1;
1107 uint64_t feperr:1;
1108 uint64_t todoovr:1;
1109 uint64_t skprunt:1;
1110 uint64_t badtag:1;
1111 uint64_t prtnxa:1;
1112 uint64_t bckprs:1;
1113 uint64_t crcerr:1;
1114 uint64_t pktdrp:1;
1115#else
1116 uint64_t pktdrp:1;
1117 uint64_t crcerr:1;
1118 uint64_t bckprs:1;
1119 uint64_t prtnxa:1;
1120 uint64_t badtag:1;
1121 uint64_t skprunt:1;
1122 uint64_t todoovr:1;
1123 uint64_t feperr:1;
1124 uint64_t beperr:1;
1125 uint64_t reserved_9_63:55;
1126#endif
1127 } cn30xx;
1128 struct cvmx_pip_int_reg_cn50xx {
1129#ifdef __BIG_ENDIAN_BITFIELD
1130 uint64_t reserved_12_63:52;
1131 uint64_t lenerr:1;
1132 uint64_t maxerr:1;
1133 uint64_t minerr:1;
1134 uint64_t beperr:1;
1135 uint64_t feperr:1;
1136 uint64_t todoovr:1;
1137 uint64_t skprunt:1;
1138 uint64_t badtag:1;
1139 uint64_t prtnxa:1;
1140 uint64_t bckprs:1;
1141 uint64_t reserved_1_1:1;
1142 uint64_t pktdrp:1;
1143#else
1144 uint64_t pktdrp:1;
1145 uint64_t reserved_1_1:1;
1146 uint64_t bckprs:1;
1147 uint64_t prtnxa:1;
1148 uint64_t badtag:1;
1149 uint64_t skprunt:1;
1150 uint64_t todoovr:1;
1151 uint64_t feperr:1;
1152 uint64_t beperr:1;
1153 uint64_t minerr:1;
1154 uint64_t maxerr:1;
1155 uint64_t lenerr:1;
1156 uint64_t reserved_12_63:52;
1157#endif
1158 } cn50xx;
1159 struct cvmx_pip_int_reg_cn52xx {
1160#ifdef __BIG_ENDIAN_BITFIELD
1161 uint64_t reserved_13_63:51;
1162 uint64_t punyerr:1;
1163 uint64_t lenerr:1;
1164 uint64_t maxerr:1;
1165 uint64_t minerr:1;
1166 uint64_t beperr:1;
1167 uint64_t feperr:1;
1168 uint64_t todoovr:1;
1169 uint64_t skprunt:1;
1170 uint64_t badtag:1;
1171 uint64_t prtnxa:1;
1172 uint64_t bckprs:1;
1173 uint64_t reserved_1_1:1;
1174 uint64_t pktdrp:1;
1175#else
1176 uint64_t pktdrp:1;
1177 uint64_t reserved_1_1:1;
1178 uint64_t bckprs:1;
1179 uint64_t prtnxa:1;
1180 uint64_t badtag:1;
1181 uint64_t skprunt:1;
1182 uint64_t todoovr:1;
1183 uint64_t feperr:1;
1184 uint64_t beperr:1;
1185 uint64_t minerr:1;
1186 uint64_t maxerr:1;
1187 uint64_t lenerr:1;
1188 uint64_t punyerr:1;
1189 uint64_t reserved_13_63:51;
1190#endif
1191 } cn52xx;
1192 struct cvmx_pip_int_reg_cn56xxp1 {
1193#ifdef __BIG_ENDIAN_BITFIELD
1194 uint64_t reserved_12_63:52;
1195 uint64_t lenerr:1;
1196 uint64_t maxerr:1;
1197 uint64_t minerr:1;
1198 uint64_t beperr:1;
1199 uint64_t feperr:1;
1200 uint64_t todoovr:1;
1201 uint64_t skprunt:1;
1202 uint64_t badtag:1;
1203 uint64_t prtnxa:1;
1204 uint64_t bckprs:1;
1205 uint64_t crcerr:1;
1206 uint64_t pktdrp:1;
1207#else
1208 uint64_t pktdrp:1;
1209 uint64_t crcerr:1;
1210 uint64_t bckprs:1;
1211 uint64_t prtnxa:1;
1212 uint64_t badtag:1;
1213 uint64_t skprunt:1;
1214 uint64_t todoovr:1;
1215 uint64_t feperr:1;
1216 uint64_t beperr:1;
1217 uint64_t minerr:1;
1218 uint64_t maxerr:1;
1219 uint64_t lenerr:1;
1220 uint64_t reserved_12_63:52;
1221#endif
1222 } cn56xxp1;
1223 struct cvmx_pip_int_reg_cn58xx {
1224#ifdef __BIG_ENDIAN_BITFIELD
1225 uint64_t reserved_13_63:51;
1226 uint64_t punyerr:1;
1227 uint64_t reserved_9_11:3;
1228 uint64_t beperr:1;
1229 uint64_t feperr:1;
1230 uint64_t todoovr:1;
1231 uint64_t skprunt:1;
1232 uint64_t badtag:1;
1233 uint64_t prtnxa:1;
1234 uint64_t bckprs:1;
1235 uint64_t crcerr:1;
1236 uint64_t pktdrp:1;
1237#else
1238 uint64_t pktdrp:1;
1239 uint64_t crcerr:1;
1240 uint64_t bckprs:1;
1241 uint64_t prtnxa:1;
1242 uint64_t badtag:1;
1243 uint64_t skprunt:1;
1244 uint64_t todoovr:1;
1245 uint64_t feperr:1;
1246 uint64_t beperr:1;
1247 uint64_t reserved_9_11:3;
1248 uint64_t punyerr:1;
1249 uint64_t reserved_13_63:51;
1250#endif
1251 } cn58xx;
1252};
1253
1254union cvmx_pip_ip_offset {
1255 uint64_t u64;
1256 struct cvmx_pip_ip_offset_s {
1257#ifdef __BIG_ENDIAN_BITFIELD
1258 uint64_t reserved_3_63:61;
1259 uint64_t offset:3;
1260#else
1261 uint64_t offset:3;
1262 uint64_t reserved_3_63:61;
1263#endif
1264 } s;
1265};
1266
1267union cvmx_pip_pri_tblx {
1268 uint64_t u64;
1269 struct cvmx_pip_pri_tblx_s {
1270#ifdef __BIG_ENDIAN_BITFIELD
1271 uint64_t diff2_padd:8;
1272 uint64_t hg2_padd:8;
1273 uint64_t vlan2_padd:8;
1274 uint64_t reserved_38_39:2;
1275 uint64_t diff2_bpid:6;
1276 uint64_t reserved_30_31:2;
1277 uint64_t hg2_bpid:6;
1278 uint64_t reserved_22_23:2;
1279 uint64_t vlan2_bpid:6;
1280 uint64_t reserved_11_15:5;
1281 uint64_t diff2_qos:3;
1282 uint64_t reserved_7_7:1;
1283 uint64_t hg2_qos:3;
1284 uint64_t reserved_3_3:1;
1285 uint64_t vlan2_qos:3;
1286#else
1287 uint64_t vlan2_qos:3;
1288 uint64_t reserved_3_3:1;
1289 uint64_t hg2_qos:3;
1290 uint64_t reserved_7_7:1;
1291 uint64_t diff2_qos:3;
1292 uint64_t reserved_11_15:5;
1293 uint64_t vlan2_bpid:6;
1294 uint64_t reserved_22_23:2;
1295 uint64_t hg2_bpid:6;
1296 uint64_t reserved_30_31:2;
1297 uint64_t diff2_bpid:6;
1298 uint64_t reserved_38_39:2;
1299 uint64_t vlan2_padd:8;
1300 uint64_t hg2_padd:8;
1301 uint64_t diff2_padd:8;
1302#endif
1303 } s;
1304};
1305
1306union cvmx_pip_prt_cfgx {
1307 uint64_t u64;
1308 struct cvmx_pip_prt_cfgx_s {
1309#ifdef __BIG_ENDIAN_BITFIELD
1310 uint64_t reserved_55_63:9;
1311 uint64_t ih_pri:1;
1312 uint64_t len_chk_sel:1;
1313 uint64_t pad_len:1;
1314 uint64_t vlan_len:1;
1315 uint64_t lenerr_en:1;
1316 uint64_t maxerr_en:1;
1317 uint64_t minerr_en:1;
1318 uint64_t grp_wat_47:4;
1319 uint64_t qos_wat_47:4;
1320 uint64_t reserved_37_39:3;
1321 uint64_t rawdrp:1;
1322 uint64_t tag_inc:2;
1323 uint64_t dyn_rs:1;
1324 uint64_t inst_hdr:1;
1325 uint64_t grp_wat:4;
1326 uint64_t hg_qos:1;
1327 uint64_t qos:3;
1328 uint64_t qos_wat:4;
1329 uint64_t qos_vsel:1;
1330 uint64_t qos_vod:1;
1331 uint64_t qos_diff:1;
1332 uint64_t qos_vlan:1;
1333 uint64_t reserved_13_15:3;
1334 uint64_t crc_en:1;
1335 uint64_t higig_en:1;
1336 uint64_t dsa_en:1;
1337 uint64_t mode:2;
1338 uint64_t reserved_7_7:1;
1339 uint64_t skip:7;
1340#else
1341 uint64_t skip:7;
1342 uint64_t reserved_7_7:1;
1343 uint64_t mode:2;
1344 uint64_t dsa_en:1;
1345 uint64_t higig_en:1;
1346 uint64_t crc_en:1;
1347 uint64_t reserved_13_15:3;
1348 uint64_t qos_vlan:1;
1349 uint64_t qos_diff:1;
1350 uint64_t qos_vod:1;
1351 uint64_t qos_vsel:1;
1352 uint64_t qos_wat:4;
1353 uint64_t qos:3;
1354 uint64_t hg_qos:1;
1355 uint64_t grp_wat:4;
1356 uint64_t inst_hdr:1;
1357 uint64_t dyn_rs:1;
1358 uint64_t tag_inc:2;
1359 uint64_t rawdrp:1;
1360 uint64_t reserved_37_39:3;
1361 uint64_t qos_wat_47:4;
1362 uint64_t grp_wat_47:4;
1363 uint64_t minerr_en:1;
1364 uint64_t maxerr_en:1;
1365 uint64_t lenerr_en:1;
1366 uint64_t vlan_len:1;
1367 uint64_t pad_len:1;
1368 uint64_t len_chk_sel:1;
1369 uint64_t ih_pri:1;
1370 uint64_t reserved_55_63:9;
1371#endif
1372 } s;
1373 struct cvmx_pip_prt_cfgx_cn30xx {
1374#ifdef __BIG_ENDIAN_BITFIELD
1375 uint64_t reserved_37_63:27;
1376 uint64_t rawdrp:1;
1377 uint64_t tag_inc:2;
1378 uint64_t dyn_rs:1;
1379 uint64_t inst_hdr:1;
1380 uint64_t grp_wat:4;
1381 uint64_t reserved_27_27:1;
1382 uint64_t qos:3;
1383 uint64_t qos_wat:4;
1384 uint64_t reserved_18_19:2;
1385 uint64_t qos_diff:1;
1386 uint64_t qos_vlan:1;
1387 uint64_t reserved_10_15:6;
1388 uint64_t mode:2;
1389 uint64_t reserved_7_7:1;
1390 uint64_t skip:7;
1391#else
1392 uint64_t skip:7;
1393 uint64_t reserved_7_7:1;
1394 uint64_t mode:2;
1395 uint64_t reserved_10_15:6;
1396 uint64_t qos_vlan:1;
1397 uint64_t qos_diff:1;
1398 uint64_t reserved_18_19:2;
1399 uint64_t qos_wat:4;
1400 uint64_t qos:3;
1401 uint64_t reserved_27_27:1;
1402 uint64_t grp_wat:4;
1403 uint64_t inst_hdr:1;
1404 uint64_t dyn_rs:1;
1405 uint64_t tag_inc:2;
1406 uint64_t rawdrp:1;
1407 uint64_t reserved_37_63:27;
1408#endif
1409 } cn30xx;
1410 struct cvmx_pip_prt_cfgx_cn38xx {
1411#ifdef __BIG_ENDIAN_BITFIELD
1412 uint64_t reserved_37_63:27;
1413 uint64_t rawdrp:1;
1414 uint64_t tag_inc:2;
1415 uint64_t dyn_rs:1;
1416 uint64_t inst_hdr:1;
1417 uint64_t grp_wat:4;
1418 uint64_t reserved_27_27:1;
1419 uint64_t qos:3;
1420 uint64_t qos_wat:4;
1421 uint64_t reserved_18_19:2;
1422 uint64_t qos_diff:1;
1423 uint64_t qos_vlan:1;
1424 uint64_t reserved_13_15:3;
1425 uint64_t crc_en:1;
1426 uint64_t reserved_10_11:2;
1427 uint64_t mode:2;
1428 uint64_t reserved_7_7:1;
1429 uint64_t skip:7;
1430#else
1431 uint64_t skip:7;
1432 uint64_t reserved_7_7:1;
1433 uint64_t mode:2;
1434 uint64_t reserved_10_11:2;
1435 uint64_t crc_en:1;
1436 uint64_t reserved_13_15:3;
1437 uint64_t qos_vlan:1;
1438 uint64_t qos_diff:1;
1439 uint64_t reserved_18_19:2;
1440 uint64_t qos_wat:4;
1441 uint64_t qos:3;
1442 uint64_t reserved_27_27:1;
1443 uint64_t grp_wat:4;
1444 uint64_t inst_hdr:1;
1445 uint64_t dyn_rs:1;
1446 uint64_t tag_inc:2;
1447 uint64_t rawdrp:1;
1448 uint64_t reserved_37_63:27;
1449#endif
1450 } cn38xx;
1451 struct cvmx_pip_prt_cfgx_cn50xx {
1452#ifdef __BIG_ENDIAN_BITFIELD
1453 uint64_t reserved_53_63:11;
1454 uint64_t pad_len:1;
1455 uint64_t vlan_len:1;
1456 uint64_t lenerr_en:1;
1457 uint64_t maxerr_en:1;
1458 uint64_t minerr_en:1;
1459 uint64_t grp_wat_47:4;
1460 uint64_t qos_wat_47:4;
1461 uint64_t reserved_37_39:3;
1462 uint64_t rawdrp:1;
1463 uint64_t tag_inc:2;
1464 uint64_t dyn_rs:1;
1465 uint64_t inst_hdr:1;
1466 uint64_t grp_wat:4;
1467 uint64_t reserved_27_27:1;
1468 uint64_t qos:3;
1469 uint64_t qos_wat:4;
1470 uint64_t reserved_19_19:1;
1471 uint64_t qos_vod:1;
1472 uint64_t qos_diff:1;
1473 uint64_t qos_vlan:1;
1474 uint64_t reserved_13_15:3;
1475 uint64_t crc_en:1;
1476 uint64_t reserved_10_11:2;
1477 uint64_t mode:2;
1478 uint64_t reserved_7_7:1;
1479 uint64_t skip:7;
1480#else
1481 uint64_t skip:7;
1482 uint64_t reserved_7_7:1;
1483 uint64_t mode:2;
1484 uint64_t reserved_10_11:2;
1485 uint64_t crc_en:1;
1486 uint64_t reserved_13_15:3;
1487 uint64_t qos_vlan:1;
1488 uint64_t qos_diff:1;
1489 uint64_t qos_vod:1;
1490 uint64_t reserved_19_19:1;
1491 uint64_t qos_wat:4;
1492 uint64_t qos:3;
1493 uint64_t reserved_27_27:1;
1494 uint64_t grp_wat:4;
1495 uint64_t inst_hdr:1;
1496 uint64_t dyn_rs:1;
1497 uint64_t tag_inc:2;
1498 uint64_t rawdrp:1;
1499 uint64_t reserved_37_39:3;
1500 uint64_t qos_wat_47:4;
1501 uint64_t grp_wat_47:4;
1502 uint64_t minerr_en:1;
1503 uint64_t maxerr_en:1;
1504 uint64_t lenerr_en:1;
1505 uint64_t vlan_len:1;
1506 uint64_t pad_len:1;
1507 uint64_t reserved_53_63:11;
1508#endif
1509 } cn50xx;
1510 struct cvmx_pip_prt_cfgx_cn52xx {
1511#ifdef __BIG_ENDIAN_BITFIELD
1512 uint64_t reserved_53_63:11;
1513 uint64_t pad_len:1;
1514 uint64_t vlan_len:1;
1515 uint64_t lenerr_en:1;
1516 uint64_t maxerr_en:1;
1517 uint64_t minerr_en:1;
1518 uint64_t grp_wat_47:4;
1519 uint64_t qos_wat_47:4;
1520 uint64_t reserved_37_39:3;
1521 uint64_t rawdrp:1;
1522 uint64_t tag_inc:2;
1523 uint64_t dyn_rs:1;
1524 uint64_t inst_hdr:1;
1525 uint64_t grp_wat:4;
1526 uint64_t hg_qos:1;
1527 uint64_t qos:3;
1528 uint64_t qos_wat:4;
1529 uint64_t qos_vsel:1;
1530 uint64_t qos_vod:1;
1531 uint64_t qos_diff:1;
1532 uint64_t qos_vlan:1;
1533 uint64_t reserved_13_15:3;
1534 uint64_t crc_en:1;
1535 uint64_t higig_en:1;
1536 uint64_t dsa_en:1;
1537 uint64_t mode:2;
1538 uint64_t reserved_7_7:1;
1539 uint64_t skip:7;
1540#else
1541 uint64_t skip:7;
1542 uint64_t reserved_7_7:1;
1543 uint64_t mode:2;
1544 uint64_t dsa_en:1;
1545 uint64_t higig_en:1;
1546 uint64_t crc_en:1;
1547 uint64_t reserved_13_15:3;
1548 uint64_t qos_vlan:1;
1549 uint64_t qos_diff:1;
1550 uint64_t qos_vod:1;
1551 uint64_t qos_vsel:1;
1552 uint64_t qos_wat:4;
1553 uint64_t qos:3;
1554 uint64_t hg_qos:1;
1555 uint64_t grp_wat:4;
1556 uint64_t inst_hdr:1;
1557 uint64_t dyn_rs:1;
1558 uint64_t tag_inc:2;
1559 uint64_t rawdrp:1;
1560 uint64_t reserved_37_39:3;
1561 uint64_t qos_wat_47:4;
1562 uint64_t grp_wat_47:4;
1563 uint64_t minerr_en:1;
1564 uint64_t maxerr_en:1;
1565 uint64_t lenerr_en:1;
1566 uint64_t vlan_len:1;
1567 uint64_t pad_len:1;
1568 uint64_t reserved_53_63:11;
1569#endif
1570 } cn52xx;
1571 struct cvmx_pip_prt_cfgx_cn58xx {
1572#ifdef __BIG_ENDIAN_BITFIELD
1573 uint64_t reserved_37_63:27;
1574 uint64_t rawdrp:1;
1575 uint64_t tag_inc:2;
1576 uint64_t dyn_rs:1;
1577 uint64_t inst_hdr:1;
1578 uint64_t grp_wat:4;
1579 uint64_t reserved_27_27:1;
1580 uint64_t qos:3;
1581 uint64_t qos_wat:4;
1582 uint64_t reserved_19_19:1;
1583 uint64_t qos_vod:1;
1584 uint64_t qos_diff:1;
1585 uint64_t qos_vlan:1;
1586 uint64_t reserved_13_15:3;
1587 uint64_t crc_en:1;
1588 uint64_t reserved_10_11:2;
1589 uint64_t mode:2;
1590 uint64_t reserved_7_7:1;
1591 uint64_t skip:7;
1592#else
1593 uint64_t skip:7;
1594 uint64_t reserved_7_7:1;
1595 uint64_t mode:2;
1596 uint64_t reserved_10_11:2;
1597 uint64_t crc_en:1;
1598 uint64_t reserved_13_15:3;
1599 uint64_t qos_vlan:1;
1600 uint64_t qos_diff:1;
1601 uint64_t qos_vod:1;
1602 uint64_t reserved_19_19:1;
1603 uint64_t qos_wat:4;
1604 uint64_t qos:3;
1605 uint64_t reserved_27_27:1;
1606 uint64_t grp_wat:4;
1607 uint64_t inst_hdr:1;
1608 uint64_t dyn_rs:1;
1609 uint64_t tag_inc:2;
1610 uint64_t rawdrp:1;
1611 uint64_t reserved_37_63:27;
1612#endif
1613 } cn58xx;
1614 struct cvmx_pip_prt_cfgx_cn68xx {
1615#ifdef __BIG_ENDIAN_BITFIELD
1616 uint64_t reserved_55_63:9;
1617 uint64_t ih_pri:1;
1618 uint64_t len_chk_sel:1;
1619 uint64_t pad_len:1;
1620 uint64_t vlan_len:1;
1621 uint64_t lenerr_en:1;
1622 uint64_t maxerr_en:1;
1623 uint64_t minerr_en:1;
1624 uint64_t grp_wat_47:4;
1625 uint64_t qos_wat_47:4;
1626 uint64_t reserved_37_39:3;
1627 uint64_t rawdrp:1;
1628 uint64_t tag_inc:2;
1629 uint64_t dyn_rs:1;
1630 uint64_t inst_hdr:1;
1631 uint64_t grp_wat:4;
1632 uint64_t hg_qos:1;
1633 uint64_t qos:3;
1634 uint64_t qos_wat:4;
1635 uint64_t reserved_19_19:1;
1636 uint64_t qos_vod:1;
1637 uint64_t qos_diff:1;
1638 uint64_t qos_vlan:1;
1639 uint64_t reserved_13_15:3;
1640 uint64_t crc_en:1;
1641 uint64_t higig_en:1;
1642 uint64_t dsa_en:1;
1643 uint64_t mode:2;
1644 uint64_t reserved_7_7:1;
1645 uint64_t skip:7;
1646#else
1647 uint64_t skip:7;
1648 uint64_t reserved_7_7:1;
1649 uint64_t mode:2;
1650 uint64_t dsa_en:1;
1651 uint64_t higig_en:1;
1652 uint64_t crc_en:1;
1653 uint64_t reserved_13_15:3;
1654 uint64_t qos_vlan:1;
1655 uint64_t qos_diff:1;
1656 uint64_t qos_vod:1;
1657 uint64_t reserved_19_19:1;
1658 uint64_t qos_wat:4;
1659 uint64_t qos:3;
1660 uint64_t hg_qos:1;
1661 uint64_t grp_wat:4;
1662 uint64_t inst_hdr:1;
1663 uint64_t dyn_rs:1;
1664 uint64_t tag_inc:2;
1665 uint64_t rawdrp:1;
1666 uint64_t reserved_37_39:3;
1667 uint64_t qos_wat_47:4;
1668 uint64_t grp_wat_47:4;
1669 uint64_t minerr_en:1;
1670 uint64_t maxerr_en:1;
1671 uint64_t lenerr_en:1;
1672 uint64_t vlan_len:1;
1673 uint64_t pad_len:1;
1674 uint64_t len_chk_sel:1;
1675 uint64_t ih_pri:1;
1676 uint64_t reserved_55_63:9;
1677#endif
1678 } cn68xx;
1679};
1680
1681union cvmx_pip_prt_cfgbx {
1682 uint64_t u64;
1683 struct cvmx_pip_prt_cfgbx_s {
1684#ifdef __BIG_ENDIAN_BITFIELD
1685 uint64_t reserved_39_63:25;
1686 uint64_t alt_skp_sel:2;
1687 uint64_t alt_skp_en:1;
1688 uint64_t reserved_35_35:1;
1689 uint64_t bsel_num:2;
1690 uint64_t bsel_en:1;
1691 uint64_t reserved_24_31:8;
1692 uint64_t base:8;
1693 uint64_t reserved_6_15:10;
1694 uint64_t bpid:6;
1695#else
1696 uint64_t bpid:6;
1697 uint64_t reserved_6_15:10;
1698 uint64_t base:8;
1699 uint64_t reserved_24_31:8;
1700 uint64_t bsel_en:1;
1701 uint64_t bsel_num:2;
1702 uint64_t reserved_35_35:1;
1703 uint64_t alt_skp_en:1;
1704 uint64_t alt_skp_sel:2;
1705 uint64_t reserved_39_63:25;
1706#endif
1707 } s;
1708 struct cvmx_pip_prt_cfgbx_cn61xx {
1709#ifdef __BIG_ENDIAN_BITFIELD
1710 uint64_t reserved_39_63:25;
1711 uint64_t alt_skp_sel:2;
1712 uint64_t alt_skp_en:1;
1713 uint64_t reserved_35_35:1;
1714 uint64_t bsel_num:2;
1715 uint64_t bsel_en:1;
1716 uint64_t reserved_0_31:32;
1717#else
1718 uint64_t reserved_0_31:32;
1719 uint64_t bsel_en:1;
1720 uint64_t bsel_num:2;
1721 uint64_t reserved_35_35:1;
1722 uint64_t alt_skp_en:1;
1723 uint64_t alt_skp_sel:2;
1724 uint64_t reserved_39_63:25;
1725#endif
1726 } cn61xx;
1727 struct cvmx_pip_prt_cfgbx_cn66xx {
1728#ifdef __BIG_ENDIAN_BITFIELD
1729 uint64_t reserved_39_63:25;
1730 uint64_t alt_skp_sel:2;
1731 uint64_t alt_skp_en:1;
1732 uint64_t reserved_0_35:36;
1733#else
1734 uint64_t reserved_0_35:36;
1735 uint64_t alt_skp_en:1;
1736 uint64_t alt_skp_sel:2;
1737 uint64_t reserved_39_63:25;
1738#endif
1739 } cn66xx;
1740 struct cvmx_pip_prt_cfgbx_cn68xxp1 {
1741#ifdef __BIG_ENDIAN_BITFIELD
1742 uint64_t reserved_24_63:40;
1743 uint64_t base:8;
1744 uint64_t reserved_6_15:10;
1745 uint64_t bpid:6;
1746#else
1747 uint64_t bpid:6;
1748 uint64_t reserved_6_15:10;
1749 uint64_t base:8;
1750 uint64_t reserved_24_63:40;
1751#endif
1752 } cn68xxp1;
1753};
1754
1755union cvmx_pip_prt_tagx {
1756 uint64_t u64;
1757 struct cvmx_pip_prt_tagx_s {
1758#ifdef __BIG_ENDIAN_BITFIELD
1759 uint64_t reserved_54_63:10;
1760 uint64_t portadd_en:1;
1761 uint64_t inc_hwchk:1;
1762 uint64_t reserved_50_51:2;
1763 uint64_t grptagbase_msb:2;
1764 uint64_t reserved_46_47:2;
1765 uint64_t grptagmask_msb:2;
1766 uint64_t reserved_42_43:2;
1767 uint64_t grp_msb:2;
1768 uint64_t grptagbase:4;
1769 uint64_t grptagmask:4;
1770 uint64_t grptag:1;
1771 uint64_t grptag_mskip:1;
1772 uint64_t tag_mode:2;
1773 uint64_t inc_vs:2;
1774 uint64_t inc_vlan:1;
1775 uint64_t inc_prt_flag:1;
1776 uint64_t ip6_dprt_flag:1;
1777 uint64_t ip4_dprt_flag:1;
1778 uint64_t ip6_sprt_flag:1;
1779 uint64_t ip4_sprt_flag:1;
1780 uint64_t ip6_nxth_flag:1;
1781 uint64_t ip4_pctl_flag:1;
1782 uint64_t ip6_dst_flag:1;
1783 uint64_t ip4_dst_flag:1;
1784 uint64_t ip6_src_flag:1;
1785 uint64_t ip4_src_flag:1;
1786 uint64_t tcp6_tag_type:2;
1787 uint64_t tcp4_tag_type:2;
1788 uint64_t ip6_tag_type:2;
1789 uint64_t ip4_tag_type:2;
1790 uint64_t non_tag_type:2;
1791 uint64_t grp:4;
1792#else
1793 uint64_t grp:4;
1794 uint64_t non_tag_type:2;
1795 uint64_t ip4_tag_type:2;
1796 uint64_t ip6_tag_type:2;
1797 uint64_t tcp4_tag_type:2;
1798 uint64_t tcp6_tag_type:2;
1799 uint64_t ip4_src_flag:1;
1800 uint64_t ip6_src_flag:1;
1801 uint64_t ip4_dst_flag:1;
1802 uint64_t ip6_dst_flag:1;
1803 uint64_t ip4_pctl_flag:1;
1804 uint64_t ip6_nxth_flag:1;
1805 uint64_t ip4_sprt_flag:1;
1806 uint64_t ip6_sprt_flag:1;
1807 uint64_t ip4_dprt_flag:1;
1808 uint64_t ip6_dprt_flag:1;
1809 uint64_t inc_prt_flag:1;
1810 uint64_t inc_vlan:1;
1811 uint64_t inc_vs:2;
1812 uint64_t tag_mode:2;
1813 uint64_t grptag_mskip:1;
1814 uint64_t grptag:1;
1815 uint64_t grptagmask:4;
1816 uint64_t grptagbase:4;
1817 uint64_t grp_msb:2;
1818 uint64_t reserved_42_43:2;
1819 uint64_t grptagmask_msb:2;
1820 uint64_t reserved_46_47:2;
1821 uint64_t grptagbase_msb:2;
1822 uint64_t reserved_50_51:2;
1823 uint64_t inc_hwchk:1;
1824 uint64_t portadd_en:1;
1825 uint64_t reserved_54_63:10;
1826#endif
1827 } s;
1828 struct cvmx_pip_prt_tagx_cn30xx {
1829#ifdef __BIG_ENDIAN_BITFIELD
1830 uint64_t reserved_40_63:24;
1831 uint64_t grptagbase:4;
1832 uint64_t grptagmask:4;
1833 uint64_t grptag:1;
1834 uint64_t reserved_30_30:1;
1835 uint64_t tag_mode:2;
1836 uint64_t inc_vs:2;
1837 uint64_t inc_vlan:1;
1838 uint64_t inc_prt_flag:1;
1839 uint64_t ip6_dprt_flag:1;
1840 uint64_t ip4_dprt_flag:1;
1841 uint64_t ip6_sprt_flag:1;
1842 uint64_t ip4_sprt_flag:1;
1843 uint64_t ip6_nxth_flag:1;
1844 uint64_t ip4_pctl_flag:1;
1845 uint64_t ip6_dst_flag:1;
1846 uint64_t ip4_dst_flag:1;
1847 uint64_t ip6_src_flag:1;
1848 uint64_t ip4_src_flag:1;
1849 uint64_t tcp6_tag_type:2;
1850 uint64_t tcp4_tag_type:2;
1851 uint64_t ip6_tag_type:2;
1852 uint64_t ip4_tag_type:2;
1853 uint64_t non_tag_type:2;
1854 uint64_t grp:4;
1855#else
1856 uint64_t grp:4;
1857 uint64_t non_tag_type:2;
1858 uint64_t ip4_tag_type:2;
1859 uint64_t ip6_tag_type:2;
1860 uint64_t tcp4_tag_type:2;
1861 uint64_t tcp6_tag_type:2;
1862 uint64_t ip4_src_flag:1;
1863 uint64_t ip6_src_flag:1;
1864 uint64_t ip4_dst_flag:1;
1865 uint64_t ip6_dst_flag:1;
1866 uint64_t ip4_pctl_flag:1;
1867 uint64_t ip6_nxth_flag:1;
1868 uint64_t ip4_sprt_flag:1;
1869 uint64_t ip6_sprt_flag:1;
1870 uint64_t ip4_dprt_flag:1;
1871 uint64_t ip6_dprt_flag:1;
1872 uint64_t inc_prt_flag:1;
1873 uint64_t inc_vlan:1;
1874 uint64_t inc_vs:2;
1875 uint64_t tag_mode:2;
1876 uint64_t reserved_30_30:1;
1877 uint64_t grptag:1;
1878 uint64_t grptagmask:4;
1879 uint64_t grptagbase:4;
1880 uint64_t reserved_40_63:24;
1881#endif
1882 } cn30xx;
1883 struct cvmx_pip_prt_tagx_cn50xx {
1884#ifdef __BIG_ENDIAN_BITFIELD
1885 uint64_t reserved_40_63:24;
1886 uint64_t grptagbase:4;
1887 uint64_t grptagmask:4;
1888 uint64_t grptag:1;
1889 uint64_t grptag_mskip:1;
1890 uint64_t tag_mode:2;
1891 uint64_t inc_vs:2;
1892 uint64_t inc_vlan:1;
1893 uint64_t inc_prt_flag:1;
1894 uint64_t ip6_dprt_flag:1;
1895 uint64_t ip4_dprt_flag:1;
1896 uint64_t ip6_sprt_flag:1;
1897 uint64_t ip4_sprt_flag:1;
1898 uint64_t ip6_nxth_flag:1;
1899 uint64_t ip4_pctl_flag:1;
1900 uint64_t ip6_dst_flag:1;
1901 uint64_t ip4_dst_flag:1;
1902 uint64_t ip6_src_flag:1;
1903 uint64_t ip4_src_flag:1;
1904 uint64_t tcp6_tag_type:2;
1905 uint64_t tcp4_tag_type:2;
1906 uint64_t ip6_tag_type:2;
1907 uint64_t ip4_tag_type:2;
1908 uint64_t non_tag_type:2;
1909 uint64_t grp:4;
1910#else
1911 uint64_t grp:4;
1912 uint64_t non_tag_type:2;
1913 uint64_t ip4_tag_type:2;
1914 uint64_t ip6_tag_type:2;
1915 uint64_t tcp4_tag_type:2;
1916 uint64_t tcp6_tag_type:2;
1917 uint64_t ip4_src_flag:1;
1918 uint64_t ip6_src_flag:1;
1919 uint64_t ip4_dst_flag:1;
1920 uint64_t ip6_dst_flag:1;
1921 uint64_t ip4_pctl_flag:1;
1922 uint64_t ip6_nxth_flag:1;
1923 uint64_t ip4_sprt_flag:1;
1924 uint64_t ip6_sprt_flag:1;
1925 uint64_t ip4_dprt_flag:1;
1926 uint64_t ip6_dprt_flag:1;
1927 uint64_t inc_prt_flag:1;
1928 uint64_t inc_vlan:1;
1929 uint64_t inc_vs:2;
1930 uint64_t tag_mode:2;
1931 uint64_t grptag_mskip:1;
1932 uint64_t grptag:1;
1933 uint64_t grptagmask:4;
1934 uint64_t grptagbase:4;
1935 uint64_t reserved_40_63:24;
1936#endif
1937 } cn50xx;
1938};
1939
1940union cvmx_pip_qos_diffx {
1941 uint64_t u64;
1942 struct cvmx_pip_qos_diffx_s {
1943#ifdef __BIG_ENDIAN_BITFIELD
1944 uint64_t reserved_3_63:61;
1945 uint64_t qos:3;
1946#else
1947 uint64_t qos:3;
1948 uint64_t reserved_3_63:61;
1949#endif
1950 } s;
1951};
1952
1953union cvmx_pip_qos_vlanx {
1954 uint64_t u64;
1955 struct cvmx_pip_qos_vlanx_s {
1956#ifdef __BIG_ENDIAN_BITFIELD
1957 uint64_t reserved_7_63:57;
1958 uint64_t qos1:3;
1959 uint64_t reserved_3_3:1;
1960 uint64_t qos:3;
1961#else
1962 uint64_t qos:3;
1963 uint64_t reserved_3_3:1;
1964 uint64_t qos1:3;
1965 uint64_t reserved_7_63:57;
1966#endif
1967 } s;
1968 struct cvmx_pip_qos_vlanx_cn30xx {
1969#ifdef __BIG_ENDIAN_BITFIELD
1970 uint64_t reserved_3_63:61;
1971 uint64_t qos:3;
1972#else
1973 uint64_t qos:3;
1974 uint64_t reserved_3_63:61;
1975#endif
1976 } cn30xx;
1977};
1978
1979union cvmx_pip_qos_watchx {
1980 uint64_t u64;
1981 struct cvmx_pip_qos_watchx_s {
1982#ifdef __BIG_ENDIAN_BITFIELD
1983 uint64_t reserved_48_63:16;
1984 uint64_t mask:16;
1985 uint64_t reserved_30_31:2;
1986 uint64_t grp:6;
1987 uint64_t reserved_23_23:1;
1988 uint64_t qos:3;
1989 uint64_t reserved_19_19:1;
1990 uint64_t match_type:3;
1991 uint64_t match_value:16;
1992#else
1993 uint64_t match_value:16;
1994 uint64_t match_type:3;
1995 uint64_t reserved_19_19:1;
1996 uint64_t qos:3;
1997 uint64_t reserved_23_23:1;
1998 uint64_t grp:6;
1999 uint64_t reserved_30_31:2;
2000 uint64_t mask:16;
2001 uint64_t reserved_48_63:16;
2002#endif
2003 } s;
2004 struct cvmx_pip_qos_watchx_cn30xx {
2005#ifdef __BIG_ENDIAN_BITFIELD
2006 uint64_t reserved_48_63:16;
2007 uint64_t mask:16;
2008 uint64_t reserved_28_31:4;
2009 uint64_t grp:4;
2010 uint64_t reserved_23_23:1;
2011 uint64_t qos:3;
2012 uint64_t reserved_18_19:2;
2013 uint64_t match_type:2;
2014 uint64_t match_value:16;
2015#else
2016 uint64_t match_value:16;
2017 uint64_t match_type:2;
2018 uint64_t reserved_18_19:2;
2019 uint64_t qos:3;
2020 uint64_t reserved_23_23:1;
2021 uint64_t grp:4;
2022 uint64_t reserved_28_31:4;
2023 uint64_t mask:16;
2024 uint64_t reserved_48_63:16;
2025#endif
2026 } cn30xx;
2027 struct cvmx_pip_qos_watchx_cn50xx {
2028#ifdef __BIG_ENDIAN_BITFIELD
2029 uint64_t reserved_48_63:16;
2030 uint64_t mask:16;
2031 uint64_t reserved_28_31:4;
2032 uint64_t grp:4;
2033 uint64_t reserved_23_23:1;
2034 uint64_t qos:3;
2035 uint64_t reserved_19_19:1;
2036 uint64_t match_type:3;
2037 uint64_t match_value:16;
2038#else
2039 uint64_t match_value:16;
2040 uint64_t match_type:3;
2041 uint64_t reserved_19_19:1;
2042 uint64_t qos:3;
2043 uint64_t reserved_23_23:1;
2044 uint64_t grp:4;
2045 uint64_t reserved_28_31:4;
2046 uint64_t mask:16;
2047 uint64_t reserved_48_63:16;
2048#endif
2049 } cn50xx;
2050};
2051
2052union cvmx_pip_raw_word {
2053 uint64_t u64;
2054 struct cvmx_pip_raw_word_s {
2055#ifdef __BIG_ENDIAN_BITFIELD
2056 uint64_t reserved_56_63:8;
2057 uint64_t word:56;
2058#else
2059 uint64_t word:56;
2060 uint64_t reserved_56_63:8;
2061#endif
2062 } s;
2063};
2064
2065union cvmx_pip_sft_rst {
2066 uint64_t u64;
2067 struct cvmx_pip_sft_rst_s {
2068#ifdef __BIG_ENDIAN_BITFIELD
2069 uint64_t reserved_1_63:63;
2070 uint64_t rst:1;
2071#else
2072 uint64_t rst:1;
2073 uint64_t reserved_1_63:63;
2074#endif
2075 } s;
2076};
2077
2078union cvmx_pip_stat0_x {
2079 uint64_t u64;
2080 struct cvmx_pip_stat0_x_s {
2081#ifdef __BIG_ENDIAN_BITFIELD
2082 uint64_t drp_pkts:32;
2083 uint64_t drp_octs:32;
2084#else
2085 uint64_t drp_octs:32;
2086 uint64_t drp_pkts:32;
2087#endif
2088 } s;
2089};
2090
2091union cvmx_pip_stat0_prtx {
2092 uint64_t u64;
2093 struct cvmx_pip_stat0_prtx_s {
2094#ifdef __BIG_ENDIAN_BITFIELD
2095 uint64_t drp_pkts:32;
2096 uint64_t drp_octs:32;
2097#else
2098 uint64_t drp_octs:32;
2099 uint64_t drp_pkts:32;
2100#endif
2101 } s;
2102};
2103
2104union cvmx_pip_stat10_x {
2105 uint64_t u64;
2106 struct cvmx_pip_stat10_x_s {
2107#ifdef __BIG_ENDIAN_BITFIELD
2108 uint64_t bcast:32;
2109 uint64_t mcast:32;
2110#else
2111 uint64_t mcast:32;
2112 uint64_t bcast:32;
2113#endif
2114 } s;
2115};
2116
2117union cvmx_pip_stat10_prtx {
2118 uint64_t u64;
2119 struct cvmx_pip_stat10_prtx_s {
2120#ifdef __BIG_ENDIAN_BITFIELD
2121 uint64_t bcast:32;
2122 uint64_t mcast:32;
2123#else
2124 uint64_t mcast:32;
2125 uint64_t bcast:32;
2126#endif
2127 } s;
2128};
2129
2130union cvmx_pip_stat11_x {
2131 uint64_t u64;
2132 struct cvmx_pip_stat11_x_s {
2133#ifdef __BIG_ENDIAN_BITFIELD
2134 uint64_t bcast:32;
2135 uint64_t mcast:32;
2136#else
2137 uint64_t mcast:32;
2138 uint64_t bcast:32;
2139#endif
2140 } s;
2141};
2142
2143union cvmx_pip_stat11_prtx {
2144 uint64_t u64;
2145 struct cvmx_pip_stat11_prtx_s {
2146#ifdef __BIG_ENDIAN_BITFIELD
2147 uint64_t bcast:32;
2148 uint64_t mcast:32;
2149#else
2150 uint64_t mcast:32;
2151 uint64_t bcast:32;
2152#endif
2153 } s;
2154};
2155
2156union cvmx_pip_stat1_x {
2157 uint64_t u64;
2158 struct cvmx_pip_stat1_x_s {
2159#ifdef __BIG_ENDIAN_BITFIELD
2160 uint64_t reserved_48_63:16;
2161 uint64_t octs:48;
2162#else
2163 uint64_t octs:48;
2164 uint64_t reserved_48_63:16;
2165#endif
2166 } s;
2167};
2168
2169union cvmx_pip_stat1_prtx {
2170 uint64_t u64;
2171 struct cvmx_pip_stat1_prtx_s {
2172#ifdef __BIG_ENDIAN_BITFIELD
2173 uint64_t reserved_48_63:16;
2174 uint64_t octs:48;
2175#else
2176 uint64_t octs:48;
2177 uint64_t reserved_48_63:16;
2178#endif
2179 } s;
2180};
2181
2182union cvmx_pip_stat2_x {
2183 uint64_t u64;
2184 struct cvmx_pip_stat2_x_s {
2185#ifdef __BIG_ENDIAN_BITFIELD
2186 uint64_t pkts:32;
2187 uint64_t raw:32;
2188#else
2189 uint64_t raw:32;
2190 uint64_t pkts:32;
2191#endif
2192 } s;
2193};
2194
2195union cvmx_pip_stat2_prtx {
2196 uint64_t u64;
2197 struct cvmx_pip_stat2_prtx_s {
2198#ifdef __BIG_ENDIAN_BITFIELD
2199 uint64_t pkts:32;
2200 uint64_t raw:32;
2201#else
2202 uint64_t raw:32;
2203 uint64_t pkts:32;
2204#endif
2205 } s;
2206};
2207
2208union cvmx_pip_stat3_x {
2209 uint64_t u64;
2210 struct cvmx_pip_stat3_x_s {
2211#ifdef __BIG_ENDIAN_BITFIELD
2212 uint64_t bcst:32;
2213 uint64_t mcst:32;
2214#else
2215 uint64_t mcst:32;
2216 uint64_t bcst:32;
2217#endif
2218 } s;
2219};
2220
2221union cvmx_pip_stat3_prtx {
2222 uint64_t u64;
2223 struct cvmx_pip_stat3_prtx_s {
2224#ifdef __BIG_ENDIAN_BITFIELD
2225 uint64_t bcst:32;
2226 uint64_t mcst:32;
2227#else
2228 uint64_t mcst:32;
2229 uint64_t bcst:32;
2230#endif
2231 } s;
2232};
2233
2234union cvmx_pip_stat4_x {
2235 uint64_t u64;
2236 struct cvmx_pip_stat4_x_s {
2237#ifdef __BIG_ENDIAN_BITFIELD
2238 uint64_t h65to127:32;
2239 uint64_t h64:32;
2240#else
2241 uint64_t h64:32;
2242 uint64_t h65to127:32;
2243#endif
2244 } s;
2245};
2246
2247union cvmx_pip_stat4_prtx {
2248 uint64_t u64;
2249 struct cvmx_pip_stat4_prtx_s {
2250#ifdef __BIG_ENDIAN_BITFIELD
2251 uint64_t h65to127:32;
2252 uint64_t h64:32;
2253#else
2254 uint64_t h64:32;
2255 uint64_t h65to127:32;
2256#endif
2257 } s;
2258};
2259
2260union cvmx_pip_stat5_x {
2261 uint64_t u64;
2262 struct cvmx_pip_stat5_x_s {
2263#ifdef __BIG_ENDIAN_BITFIELD
2264 uint64_t h256to511:32;
2265 uint64_t h128to255:32;
2266#else
2267 uint64_t h128to255:32;
2268 uint64_t h256to511:32;
2269#endif
2270 } s;
2271};
2272
2273union cvmx_pip_stat5_prtx {
2274 uint64_t u64;
2275 struct cvmx_pip_stat5_prtx_s {
2276#ifdef __BIG_ENDIAN_BITFIELD
2277 uint64_t h256to511:32;
2278 uint64_t h128to255:32;
2279#else
2280 uint64_t h128to255:32;
2281 uint64_t h256to511:32;
2282#endif
2283 } s;
2284};
2285
2286union cvmx_pip_stat6_x {
2287 uint64_t u64;
2288 struct cvmx_pip_stat6_x_s {
2289#ifdef __BIG_ENDIAN_BITFIELD
2290 uint64_t h1024to1518:32;
2291 uint64_t h512to1023:32;
2292#else
2293 uint64_t h512to1023:32;
2294 uint64_t h1024to1518:32;
2295#endif
2296 } s;
2297};
2298
2299union cvmx_pip_stat6_prtx {
2300 uint64_t u64;
2301 struct cvmx_pip_stat6_prtx_s {
2302#ifdef __BIG_ENDIAN_BITFIELD
2303 uint64_t h1024to1518:32;
2304 uint64_t h512to1023:32;
2305#else
2306 uint64_t h512to1023:32;
2307 uint64_t h1024to1518:32;
2308#endif
2309 } s;
2310};
2311
2312union cvmx_pip_stat7_x {
2313 uint64_t u64;
2314 struct cvmx_pip_stat7_x_s {
2315#ifdef __BIG_ENDIAN_BITFIELD
2316 uint64_t fcs:32;
2317 uint64_t h1519:32;
2318#else
2319 uint64_t h1519:32;
2320 uint64_t fcs:32;
2321#endif
2322 } s;
2323};
2324
2325union cvmx_pip_stat7_prtx {
2326 uint64_t u64;
2327 struct cvmx_pip_stat7_prtx_s {
2328#ifdef __BIG_ENDIAN_BITFIELD
2329 uint64_t fcs:32;
2330 uint64_t h1519:32;
2331#else
2332 uint64_t h1519:32;
2333 uint64_t fcs:32;
2334#endif
2335 } s;
2336};
2337
2338union cvmx_pip_stat8_x {
2339 uint64_t u64;
2340 struct cvmx_pip_stat8_x_s {
2341#ifdef __BIG_ENDIAN_BITFIELD
2342 uint64_t frag:32;
2343 uint64_t undersz:32;
2344#else
2345 uint64_t undersz:32;
2346 uint64_t frag:32;
2347#endif
2348 } s;
2349};
2350
2351union cvmx_pip_stat8_prtx {
2352 uint64_t u64;
2353 struct cvmx_pip_stat8_prtx_s {
2354#ifdef __BIG_ENDIAN_BITFIELD
2355 uint64_t frag:32;
2356 uint64_t undersz:32;
2357#else
2358 uint64_t undersz:32;
2359 uint64_t frag:32;
2360#endif
2361 } s;
2362};
2363
2364union cvmx_pip_stat9_x {
2365 uint64_t u64;
2366 struct cvmx_pip_stat9_x_s {
2367#ifdef __BIG_ENDIAN_BITFIELD
2368 uint64_t jabber:32;
2369 uint64_t oversz:32;
2370#else
2371 uint64_t oversz:32;
2372 uint64_t jabber:32;
2373#endif
2374 } s;
2375};
2376
2377union cvmx_pip_stat9_prtx {
2378 uint64_t u64;
2379 struct cvmx_pip_stat9_prtx_s {
2380#ifdef __BIG_ENDIAN_BITFIELD
2381 uint64_t jabber:32;
2382 uint64_t oversz:32;
2383#else
2384 uint64_t oversz:32;
2385 uint64_t jabber:32;
2386#endif
2387 } s;
2388};
2389
2390union cvmx_pip_stat_ctl {
2391 uint64_t u64;
2392 struct cvmx_pip_stat_ctl_s {
2393#ifdef __BIG_ENDIAN_BITFIELD
2394 uint64_t reserved_9_63:55;
2395 uint64_t mode:1;
2396 uint64_t reserved_1_7:7;
2397 uint64_t rdclr:1;
2398#else
2399 uint64_t rdclr:1;
2400 uint64_t reserved_1_7:7;
2401 uint64_t mode:1;
2402 uint64_t reserved_9_63:55;
2403#endif
2404 } s;
2405 struct cvmx_pip_stat_ctl_cn30xx {
2406#ifdef __BIG_ENDIAN_BITFIELD
2407 uint64_t reserved_1_63:63;
2408 uint64_t rdclr:1;
2409#else
2410 uint64_t rdclr:1;
2411 uint64_t reserved_1_63:63;
2412#endif
2413 } cn30xx;
2414};
2415
2416union cvmx_pip_stat_inb_errsx {
2417 uint64_t u64;
2418 struct cvmx_pip_stat_inb_errsx_s {
2419#ifdef __BIG_ENDIAN_BITFIELD
2420 uint64_t reserved_16_63:48;
2421 uint64_t errs:16;
2422#else
2423 uint64_t errs:16;
2424 uint64_t reserved_16_63:48;
2425#endif
2426 } s;
2427};
2428
2429union cvmx_pip_stat_inb_errs_pkndx {
2430 uint64_t u64;
2431 struct cvmx_pip_stat_inb_errs_pkndx_s {
2432#ifdef __BIG_ENDIAN_BITFIELD
2433 uint64_t reserved_16_63:48;
2434 uint64_t errs:16;
2435#else
2436 uint64_t errs:16;
2437 uint64_t reserved_16_63:48;
2438#endif
2439 } s;
2440};
2441
2442union cvmx_pip_stat_inb_octsx {
2443 uint64_t u64;
2444 struct cvmx_pip_stat_inb_octsx_s {
2445#ifdef __BIG_ENDIAN_BITFIELD
2446 uint64_t reserved_48_63:16;
2447 uint64_t octs:48;
2448#else
2449 uint64_t octs:48;
2450 uint64_t reserved_48_63:16;
2451#endif
2452 } s;
2453};
2454
2455union cvmx_pip_stat_inb_octs_pkndx {
2456 uint64_t u64;
2457 struct cvmx_pip_stat_inb_octs_pkndx_s {
2458#ifdef __BIG_ENDIAN_BITFIELD
2459 uint64_t reserved_48_63:16;
2460 uint64_t octs:48;
2461#else
2462 uint64_t octs:48;
2463 uint64_t reserved_48_63:16;
2464#endif
2465 } s;
2466};
2467
2468union cvmx_pip_stat_inb_pktsx {
2469 uint64_t u64;
2470 struct cvmx_pip_stat_inb_pktsx_s {
2471#ifdef __BIG_ENDIAN_BITFIELD
2472 uint64_t reserved_32_63:32;
2473 uint64_t pkts:32;
2474#else
2475 uint64_t pkts:32;
2476 uint64_t reserved_32_63:32;
2477#endif
2478 } s;
2479};
2480
2481union cvmx_pip_stat_inb_pkts_pkndx {
2482 uint64_t u64;
2483 struct cvmx_pip_stat_inb_pkts_pkndx_s {
2484#ifdef __BIG_ENDIAN_BITFIELD
2485 uint64_t reserved_32_63:32;
2486 uint64_t pkts:32;
2487#else
2488 uint64_t pkts:32;
2489 uint64_t reserved_32_63:32;
2490#endif
2491 } s;
2492};
2493
2494union cvmx_pip_sub_pkind_fcsx {
2495 uint64_t u64;
2496 struct cvmx_pip_sub_pkind_fcsx_s {
2497#ifdef __BIG_ENDIAN_BITFIELD
2498 uint64_t port_bit:64;
2499#else
2500 uint64_t port_bit:64;
2501#endif
2502 } s;
2503};
2504
2505union cvmx_pip_tag_incx {
2506 uint64_t u64;
2507 struct cvmx_pip_tag_incx_s {
2508#ifdef __BIG_ENDIAN_BITFIELD
2509 uint64_t reserved_8_63:56;
2510 uint64_t en:8;
2511#else
2512 uint64_t en:8;
2513 uint64_t reserved_8_63:56;
2514#endif
2515 } s;
2516};
2517
2518union cvmx_pip_tag_mask {
2519 uint64_t u64;
2520 struct cvmx_pip_tag_mask_s {
2521#ifdef __BIG_ENDIAN_BITFIELD
2522 uint64_t reserved_16_63:48;
2523 uint64_t mask:16;
2524#else
2525 uint64_t mask:16;
2526 uint64_t reserved_16_63:48;
2527#endif
2528 } s;
2529};
2530
2531union cvmx_pip_tag_secret {
2532 uint64_t u64;
2533 struct cvmx_pip_tag_secret_s {
2534#ifdef __BIG_ENDIAN_BITFIELD
2535 uint64_t reserved_32_63:32;
2536 uint64_t dst:16;
2537 uint64_t src:16;
2538#else
2539 uint64_t src:16;
2540 uint64_t dst:16;
2541 uint64_t reserved_32_63:32;
2542#endif
2543 } s;
2544};
2545
2546union cvmx_pip_todo_entry {
2547 uint64_t u64;
2548 struct cvmx_pip_todo_entry_s {
2549#ifdef __BIG_ENDIAN_BITFIELD
2550 uint64_t val:1;
2551 uint64_t reserved_62_62:1;
2552 uint64_t entry:62;
2553#else
2554 uint64_t entry:62;
2555 uint64_t reserved_62_62:1;
2556 uint64_t val:1;
2557#endif
2558 } s;
2559};
2560
2561union cvmx_pip_vlan_etypesx {
2562 uint64_t u64;
2563 struct cvmx_pip_vlan_etypesx_s {
2564#ifdef __BIG_ENDIAN_BITFIELD
2565 uint64_t type3:16;
2566 uint64_t type2:16;
2567 uint64_t type1:16;
2568 uint64_t type0:16;
2569#else
2570 uint64_t type0:16;
2571 uint64_t type1:16;
2572 uint64_t type2:16;
2573 uint64_t type3:16;
2574#endif
2575 } s;
2576};
2577
2578union cvmx_pip_xstat0_prtx {
2579 uint64_t u64;
2580 struct cvmx_pip_xstat0_prtx_s {
2581#ifdef __BIG_ENDIAN_BITFIELD
2582 uint64_t drp_pkts:32;
2583 uint64_t drp_octs:32;
2584#else
2585 uint64_t drp_octs:32;
2586 uint64_t drp_pkts:32;
2587#endif
2588 } s;
2589};
2590
2591union cvmx_pip_xstat10_prtx {
2592 uint64_t u64;
2593 struct cvmx_pip_xstat10_prtx_s {
2594#ifdef __BIG_ENDIAN_BITFIELD
2595 uint64_t bcast:32;
2596 uint64_t mcast:32;
2597#else
2598 uint64_t mcast:32;
2599 uint64_t bcast:32;
2600#endif
2601 } s;
2602};
2603
2604union cvmx_pip_xstat11_prtx {
2605 uint64_t u64;
2606 struct cvmx_pip_xstat11_prtx_s {
2607#ifdef __BIG_ENDIAN_BITFIELD
2608 uint64_t bcast:32;
2609 uint64_t mcast:32;
2610#else
2611 uint64_t mcast:32;
2612 uint64_t bcast:32;
2613#endif
2614 } s;
2615};
2616
2617union cvmx_pip_xstat1_prtx {
2618 uint64_t u64;
2619 struct cvmx_pip_xstat1_prtx_s {
2620#ifdef __BIG_ENDIAN_BITFIELD
2621 uint64_t reserved_48_63:16;
2622 uint64_t octs:48;
2623#else
2624 uint64_t octs:48;
2625 uint64_t reserved_48_63:16;
2626#endif
2627 } s;
2628};
2629
2630union cvmx_pip_xstat2_prtx {
2631 uint64_t u64;
2632 struct cvmx_pip_xstat2_prtx_s {
2633#ifdef __BIG_ENDIAN_BITFIELD
2634 uint64_t pkts:32;
2635 uint64_t raw:32;
2636#else
2637 uint64_t raw:32;
2638 uint64_t pkts:32;
2639#endif
2640 } s;
2641};
2642
2643union cvmx_pip_xstat3_prtx {
2644 uint64_t u64;
2645 struct cvmx_pip_xstat3_prtx_s {
2646#ifdef __BIG_ENDIAN_BITFIELD
2647 uint64_t bcst:32;
2648 uint64_t mcst:32;
2649#else
2650 uint64_t mcst:32;
2651 uint64_t bcst:32;
2652#endif
2653 } s;
2654};
2655
2656union cvmx_pip_xstat4_prtx {
2657 uint64_t u64;
2658 struct cvmx_pip_xstat4_prtx_s {
2659#ifdef __BIG_ENDIAN_BITFIELD
2660 uint64_t h65to127:32;
2661 uint64_t h64:32;
2662#else
2663 uint64_t h64:32;
2664 uint64_t h65to127:32;
2665#endif
2666 } s;
2667};
2668
2669union cvmx_pip_xstat5_prtx {
2670 uint64_t u64;
2671 struct cvmx_pip_xstat5_prtx_s {
2672#ifdef __BIG_ENDIAN_BITFIELD
2673 uint64_t h256to511:32;
2674 uint64_t h128to255:32;
2675#else
2676 uint64_t h128to255:32;
2677 uint64_t h256to511:32;
2678#endif
2679 } s;
2680};
2681
2682union cvmx_pip_xstat6_prtx {
2683 uint64_t u64;
2684 struct cvmx_pip_xstat6_prtx_s {
2685#ifdef __BIG_ENDIAN_BITFIELD
2686 uint64_t h1024to1518:32;
2687 uint64_t h512to1023:32;
2688#else
2689 uint64_t h512to1023:32;
2690 uint64_t h1024to1518:32;
2691#endif
2692 } s;
2693};
2694
2695union cvmx_pip_xstat7_prtx {
2696 uint64_t u64;
2697 struct cvmx_pip_xstat7_prtx_s {
2698#ifdef __BIG_ENDIAN_BITFIELD
2699 uint64_t fcs:32;
2700 uint64_t h1519:32;
2701#else
2702 uint64_t h1519:32;
2703 uint64_t fcs:32;
2704#endif
2705 } s;
2706};
2707
2708union cvmx_pip_xstat8_prtx {
2709 uint64_t u64;
2710 struct cvmx_pip_xstat8_prtx_s {
2711#ifdef __BIG_ENDIAN_BITFIELD
2712 uint64_t frag:32;
2713 uint64_t undersz:32;
2714#else
2715 uint64_t undersz:32;
2716 uint64_t frag:32;
2717#endif
2718 } s;
2719};
2720
2721union cvmx_pip_xstat9_prtx {
2722 uint64_t u64;
2723 struct cvmx_pip_xstat9_prtx_s {
2724#ifdef __BIG_ENDIAN_BITFIELD
2725 uint64_t jabber:32;
2726 uint64_t oversz:32;
2727#else
2728 uint64_t oversz:32;
2729 uint64_t jabber:32;
2730#endif
2731 } s;
2732};
2733
2734#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pip.h b/arch/mips/include/asm/octeon/cvmx-pip.h
new file mode 100644
index 000000000..01ca7267a
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pip.h
@@ -0,0 +1,524 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 * Interface to the hardware Packet Input Processing unit.
30 *
31 */
32
33#ifndef __CVMX_PIP_H__
34#define __CVMX_PIP_H__
35
36#include <asm/octeon/cvmx-wqe.h>
37#include <asm/octeon/cvmx-fpa.h>
38#include <asm/octeon/cvmx-pip-defs.h>
39
40#define CVMX_PIP_NUM_INPUT_PORTS 48
41#define CVMX_PIP_NUM_WATCHERS 4
42
43/*
44 * Encodes the different error and exception codes
45 */
46typedef enum {
47 CVMX_PIP_L4_NO_ERR = 0ull,
48 /*
49 * 1 = TCP (UDP) packet not long enough to cover TCP (UDP)
50 * header
51 */
52 CVMX_PIP_L4_MAL_ERR = 1ull,
53 /* 2 = TCP/UDP checksum failure */
54 CVMX_PIP_CHK_ERR = 2ull,
55 /*
56 * 3 = TCP/UDP length check (TCP/UDP length does not match IP
57 * length).
58 */
59 CVMX_PIP_L4_LENGTH_ERR = 3ull,
60 /* 4 = illegal TCP/UDP port (either source or dest port is zero) */
61 CVMX_PIP_BAD_PRT_ERR = 4ull,
62 /* 8 = TCP flags = FIN only */
63 CVMX_PIP_TCP_FLG8_ERR = 8ull,
64 /* 9 = TCP flags = 0 */
65 CVMX_PIP_TCP_FLG9_ERR = 9ull,
66 /* 10 = TCP flags = FIN+RST+* */
67 CVMX_PIP_TCP_FLG10_ERR = 10ull,
68 /* 11 = TCP flags = SYN+URG+* */
69 CVMX_PIP_TCP_FLG11_ERR = 11ull,
70 /* 12 = TCP flags = SYN+RST+* */
71 CVMX_PIP_TCP_FLG12_ERR = 12ull,
72 /* 13 = TCP flags = SYN+FIN+* */
73 CVMX_PIP_TCP_FLG13_ERR = 13ull
74} cvmx_pip_l4_err_t;
75
76typedef enum {
77
78 CVMX_PIP_IP_NO_ERR = 0ull,
79 /* 1 = not IPv4 or IPv6 */
80 CVMX_PIP_NOT_IP = 1ull,
81 /* 2 = IPv4 header checksum violation */
82 CVMX_PIP_IPV4_HDR_CHK = 2ull,
83 /* 3 = malformed (packet not long enough to cover IP hdr) */
84 CVMX_PIP_IP_MAL_HDR = 3ull,
85 /* 4 = malformed (packet not long enough to cover len in IP hdr) */
86 CVMX_PIP_IP_MAL_PKT = 4ull,
87 /* 5 = TTL / hop count equal zero */
88 CVMX_PIP_TTL_HOP = 5ull,
89 /* 6 = IPv4 options / IPv6 early extension headers */
90 CVMX_PIP_OPTS = 6ull
91} cvmx_pip_ip_exc_t;
92
93/**
94 * NOTES
95 * late collision (data received before collision)
96 * late collisions cannot be detected by the receiver
97 * they would appear as JAM bits which would appear as bad FCS
98 * or carrier extend error which is CVMX_PIP_EXTEND_ERR
99 */
100typedef enum {
101 /* No error */
102 CVMX_PIP_RX_NO_ERR = 0ull,
103 /* RGM+SPI 1 = partially received packet (buffering/bandwidth
104 * not adequate) */
105 CVMX_PIP_PARTIAL_ERR = 1ull,
106 /* RGM+SPI 2 = receive packet too large and truncated */
107 CVMX_PIP_JABBER_ERR = 2ull,
108 /*
109 * RGM 3 = max frame error (pkt len > max frame len) (with FCS
110 * error)
111 */
112 CVMX_PIP_OVER_FCS_ERR = 3ull,
113 /* RGM+SPI 4 = max frame error (pkt len > max frame len) */
114 CVMX_PIP_OVER_ERR = 4ull,
115 /*
116 * RGM 5 = nibble error (data not byte multiple - 100M and 10M
117 * only)
118 */
119 CVMX_PIP_ALIGN_ERR = 5ull,
120 /*
121 * RGM 6 = min frame error (pkt len < min frame len) (with FCS
122 * error)
123 */
124 CVMX_PIP_UNDER_FCS_ERR = 6ull,
125 /* RGM 7 = FCS error */
126 CVMX_PIP_GMX_FCS_ERR = 7ull,
127 /* RGM+SPI 8 = min frame error (pkt len < min frame len) */
128 CVMX_PIP_UNDER_ERR = 8ull,
129 /* RGM 9 = Frame carrier extend error */
130 CVMX_PIP_EXTEND_ERR = 9ull,
131 /*
132 * RGM 10 = length mismatch (len did not match len in L2
133 * length/type)
134 */
135 CVMX_PIP_LENGTH_ERR = 10ull,
136 /* RGM 11 = Frame error (some or all data bits marked err) */
137 CVMX_PIP_DAT_ERR = 11ull,
138 /* SPI 11 = DIP4 error */
139 CVMX_PIP_DIP_ERR = 11ull,
140 /*
141 * RGM 12 = packet was not large enough to pass the skipper -
142 * no inspection could occur.
143 */
144 CVMX_PIP_SKIP_ERR = 12ull,
145 /*
146 * RGM 13 = studder error (data not repeated - 100M and 10M
147 * only)
148 */
149 CVMX_PIP_NIBBLE_ERR = 13ull,
150 /* RGM+SPI 16 = FCS error */
151 CVMX_PIP_PIP_FCS = 16L,
152 /*
153 * RGM+SPI+PCI 17 = packet was not large enough to pass the
154 * skipper - no inspection could occur.
155 */
156 CVMX_PIP_PIP_SKIP_ERR = 17L,
157 /*
158 * RGM+SPI+PCI 18 = malformed l2 (packet not long enough to
159 * cover L2 hdr).
160 */
161 CVMX_PIP_PIP_L2_MAL_HDR = 18L
162 /*
163 * NOTES: xx = late collision (data received before collision)
164 * late collisions cannot be detected by the receiver
165 * they would appear as JAM bits which would appear as
166 * bad FCS or carrier extend error which is
167 * CVMX_PIP_EXTEND_ERR
168 */
169} cvmx_pip_rcv_err_t;
170
171/**
172 * This defines the err_code field errors in the work Q entry
173 */
174typedef union {
175 cvmx_pip_l4_err_t l4_err;
176 cvmx_pip_ip_exc_t ip_exc;
177 cvmx_pip_rcv_err_t rcv_err;
178} cvmx_pip_err_t;
179
180/**
181 * Status statistics for a port
182 */
183typedef struct {
184 /* Inbound octets marked to be dropped by the IPD */
185 uint32_t dropped_octets;
186 /* Inbound packets marked to be dropped by the IPD */
187 uint32_t dropped_packets;
188 /* RAW PCI Packets received by PIP per port */
189 uint32_t pci_raw_packets;
190 /* Number of octets processed by PIP */
191 uint32_t octets;
192 /* Number of packets processed by PIP */
193 uint32_t packets;
194 /*
195 * Number of identified L2 multicast packets. Does not
196 * include broadcast packets. Only includes packets whose
197 * parse mode is SKIP_TO_L2
198 */
199 uint32_t multicast_packets;
200 /*
201 * Number of identified L2 broadcast packets. Does not
202 * include multicast packets. Only includes packets whose
203 * parse mode is SKIP_TO_L2
204 */
205 uint32_t broadcast_packets;
206 /* Number of 64B packets */
207 uint32_t len_64_packets;
208 /* Number of 65-127B packets */
209 uint32_t len_65_127_packets;
210 /* Number of 128-255B packets */
211 uint32_t len_128_255_packets;
212 /* Number of 256-511B packets */
213 uint32_t len_256_511_packets;
214 /* Number of 512-1023B packets */
215 uint32_t len_512_1023_packets;
216 /* Number of 1024-1518B packets */
217 uint32_t len_1024_1518_packets;
218 /* Number of 1519-max packets */
219 uint32_t len_1519_max_packets;
220 /* Number of packets with FCS or Align opcode errors */
221 uint32_t fcs_align_err_packets;
222 /* Number of packets with length < min */
223 uint32_t runt_packets;
224 /* Number of packets with length < min and FCS error */
225 uint32_t runt_crc_packets;
226 /* Number of packets with length > max */
227 uint32_t oversize_packets;
228 /* Number of packets with length > max and FCS error */
229 uint32_t oversize_crc_packets;
230 /* Number of packets without GMX/SPX/PCI errors received by PIP */
231 uint32_t inb_packets;
232 /*
233 * Total number of octets from all packets received by PIP,
234 * including CRC
235 */
236 uint64_t inb_octets;
237 /* Number of packets with GMX/SPX/PCI errors received by PIP */
238 uint16_t inb_errors;
239} cvmx_pip_port_status_t;
240
241/**
242 * Definition of the PIP custom header that can be prepended
243 * to a packet by external hardware.
244 */
245typedef union {
246 uint64_t u64;
247 struct {
248 /*
249 * Documented as R - Set if the Packet is RAWFULL. If
250 * set, this header must be the full 8 bytes.
251 */
252 uint64_t rawfull:1;
253 /* Must be zero */
254 uint64_t reserved0:5;
255 /* PIP parse mode for this packet */
256 uint64_t parse_mode:2;
257 /* Must be zero */
258 uint64_t reserved1:1;
259 /*
260 * Skip amount, including this header, to the
261 * beginning of the packet
262 */
263 uint64_t skip_len:7;
264 /* Must be zero */
265 uint64_t reserved2:6;
266 /* POW input queue for this packet */
267 uint64_t qos:3;
268 /* POW input group for this packet */
269 uint64_t grp:4;
270 /*
271 * Flag to store this packet in the work queue entry,
272 * if possible
273 */
274 uint64_t rs:1;
275 /* POW input tag type */
276 uint64_t tag_type:2;
277 /* POW input tag */
278 uint64_t tag:32;
279 } s;
280} cvmx_pip_pkt_inst_hdr_t;
281
282/* CSR typedefs have been moved to cvmx-csr-*.h */
283
284/**
285 * Configure an ethernet input port
286 *
287 * @port_num: Port number to configure
288 * @port_cfg: Port hardware configuration
289 * @port_tag_cfg:
290 * Port POW tagging configuration
291 */
292static inline void cvmx_pip_config_port(uint64_t port_num,
293 union cvmx_pip_prt_cfgx port_cfg,
294 union cvmx_pip_prt_tagx port_tag_cfg)
295{
296 cvmx_write_csr(CVMX_PIP_PRT_CFGX(port_num), port_cfg.u64);
297 cvmx_write_csr(CVMX_PIP_PRT_TAGX(port_num), port_tag_cfg.u64);
298}
299#if 0
300/**
301 * @deprecated This function is a thin wrapper around the Pass1 version
302 * of the CVMX_PIP_QOS_WATCHX CSR; Pass2 has added a field for
303 * setting the group that is incompatible with this function,
304 * the preferred upgrade path is to use the CSR directly.
305 *
306 * Configure the global QoS packet watchers. Each watcher is
307 * capable of matching a field in a packet to determine the
308 * QoS queue for scheduling.
309 *
310 * @watcher: Watcher number to configure (0 - 3).
311 * @match_type: Watcher match type
312 * @match_value:
313 * Value the watcher will match against
314 * @qos: QoS queue for packets matching this watcher
315 */
316static inline void cvmx_pip_config_watcher(uint64_t watcher,
317 cvmx_pip_qos_watch_types match_type,
318 uint64_t match_value, uint64_t qos)
319{
320 cvmx_pip_port_watcher_cfg_t watcher_config;
321
322 watcher_config.u64 = 0;
323 watcher_config.s.match_type = match_type;
324 watcher_config.s.match_value = match_value;
325 watcher_config.s.qos = qos;
326
327 cvmx_write_csr(CVMX_PIP_QOS_WATCHX(watcher), watcher_config.u64);
328}
329#endif
330/**
331 * Configure the VLAN priority to QoS queue mapping.
332 *
333 * @vlan_priority:
334 * VLAN priority (0-7)
335 * @qos: QoS queue for packets matching this watcher
336 */
337static inline void cvmx_pip_config_vlan_qos(uint64_t vlan_priority,
338 uint64_t qos)
339{
340 union cvmx_pip_qos_vlanx pip_qos_vlanx;
341 pip_qos_vlanx.u64 = 0;
342 pip_qos_vlanx.s.qos = qos;
343 cvmx_write_csr(CVMX_PIP_QOS_VLANX(vlan_priority), pip_qos_vlanx.u64);
344}
345
346/**
347 * Configure the Diffserv to QoS queue mapping.
348 *
349 * @diffserv: Diffserv field value (0-63)
350 * @qos: QoS queue for packets matching this watcher
351 */
352static inline void cvmx_pip_config_diffserv_qos(uint64_t diffserv, uint64_t qos)
353{
354 union cvmx_pip_qos_diffx pip_qos_diffx;
355 pip_qos_diffx.u64 = 0;
356 pip_qos_diffx.s.qos = qos;
357 cvmx_write_csr(CVMX_PIP_QOS_DIFFX(diffserv), pip_qos_diffx.u64);
358}
359
360/**
361 * Get the status counters for a port.
362 *
363 * @port_num: Port number to get statistics for.
364 * @clear: Set to 1 to clear the counters after they are read
365 * @status: Where to put the results.
366 */
367static inline void cvmx_pip_get_port_status(uint64_t port_num, uint64_t clear,
368 cvmx_pip_port_status_t *status)
369{
370 union cvmx_pip_stat_ctl pip_stat_ctl;
371 union cvmx_pip_stat0_prtx stat0;
372 union cvmx_pip_stat1_prtx stat1;
373 union cvmx_pip_stat2_prtx stat2;
374 union cvmx_pip_stat3_prtx stat3;
375 union cvmx_pip_stat4_prtx stat4;
376 union cvmx_pip_stat5_prtx stat5;
377 union cvmx_pip_stat6_prtx stat6;
378 union cvmx_pip_stat7_prtx stat7;
379 union cvmx_pip_stat8_prtx stat8;
380 union cvmx_pip_stat9_prtx stat9;
381 union cvmx_pip_stat_inb_pktsx pip_stat_inb_pktsx;
382 union cvmx_pip_stat_inb_octsx pip_stat_inb_octsx;
383 union cvmx_pip_stat_inb_errsx pip_stat_inb_errsx;
384
385 pip_stat_ctl.u64 = 0;
386 pip_stat_ctl.s.rdclr = clear;
387 cvmx_write_csr(CVMX_PIP_STAT_CTL, pip_stat_ctl.u64);
388
389 stat0.u64 = cvmx_read_csr(CVMX_PIP_STAT0_PRTX(port_num));
390 stat1.u64 = cvmx_read_csr(CVMX_PIP_STAT1_PRTX(port_num));
391 stat2.u64 = cvmx_read_csr(CVMX_PIP_STAT2_PRTX(port_num));
392 stat3.u64 = cvmx_read_csr(CVMX_PIP_STAT3_PRTX(port_num));
393 stat4.u64 = cvmx_read_csr(CVMX_PIP_STAT4_PRTX(port_num));
394 stat5.u64 = cvmx_read_csr(CVMX_PIP_STAT5_PRTX(port_num));
395 stat6.u64 = cvmx_read_csr(CVMX_PIP_STAT6_PRTX(port_num));
396 stat7.u64 = cvmx_read_csr(CVMX_PIP_STAT7_PRTX(port_num));
397 stat8.u64 = cvmx_read_csr(CVMX_PIP_STAT8_PRTX(port_num));
398 stat9.u64 = cvmx_read_csr(CVMX_PIP_STAT9_PRTX(port_num));
399 pip_stat_inb_pktsx.u64 =
400 cvmx_read_csr(CVMX_PIP_STAT_INB_PKTSX(port_num));
401 pip_stat_inb_octsx.u64 =
402 cvmx_read_csr(CVMX_PIP_STAT_INB_OCTSX(port_num));
403 pip_stat_inb_errsx.u64 =
404 cvmx_read_csr(CVMX_PIP_STAT_INB_ERRSX(port_num));
405
406 status->dropped_octets = stat0.s.drp_octs;
407 status->dropped_packets = stat0.s.drp_pkts;
408 status->octets = stat1.s.octs;
409 status->pci_raw_packets = stat2.s.raw;
410 status->packets = stat2.s.pkts;
411 status->multicast_packets = stat3.s.mcst;
412 status->broadcast_packets = stat3.s.bcst;
413 status->len_64_packets = stat4.s.h64;
414 status->len_65_127_packets = stat4.s.h65to127;
415 status->len_128_255_packets = stat5.s.h128to255;
416 status->len_256_511_packets = stat5.s.h256to511;
417 status->len_512_1023_packets = stat6.s.h512to1023;
418 status->len_1024_1518_packets = stat6.s.h1024to1518;
419 status->len_1519_max_packets = stat7.s.h1519;
420 status->fcs_align_err_packets = stat7.s.fcs;
421 status->runt_packets = stat8.s.undersz;
422 status->runt_crc_packets = stat8.s.frag;
423 status->oversize_packets = stat9.s.oversz;
424 status->oversize_crc_packets = stat9.s.jabber;
425 status->inb_packets = pip_stat_inb_pktsx.s.pkts;
426 status->inb_octets = pip_stat_inb_octsx.s.octs;
427 status->inb_errors = pip_stat_inb_errsx.s.errs;
428
429 if (cvmx_octeon_is_pass1()) {
430 /*
431 * Kludge to fix Octeon Pass 1 errata - Drop counts
432 * don't work.
433 */
434 if (status->inb_packets > status->packets)
435 status->dropped_packets =
436 status->inb_packets - status->packets;
437 else
438 status->dropped_packets = 0;
439 if (status->inb_octets - status->inb_packets * 4 >
440 status->octets)
441 status->dropped_octets =
442 status->inb_octets - status->inb_packets * 4 -
443 status->octets;
444 else
445 status->dropped_octets = 0;
446 }
447}
448
449/**
450 * Configure the hardware CRC engine
451 *
452 * @interface: Interface to configure (0 or 1)
453 * @invert_result:
454 * Invert the result of the CRC
455 * @reflect: Reflect
456 * @initialization_vector:
457 * CRC initialization vector
458 */
459static inline void cvmx_pip_config_crc(uint64_t interface,
460 uint64_t invert_result, uint64_t reflect,
461 uint32_t initialization_vector)
462{
463 if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX)) {
464 union cvmx_pip_crc_ctlx config;
465 union cvmx_pip_crc_ivx pip_crc_ivx;
466
467 config.u64 = 0;
468 config.s.invres = invert_result;
469 config.s.reflect = reflect;
470 cvmx_write_csr(CVMX_PIP_CRC_CTLX(interface), config.u64);
471
472 pip_crc_ivx.u64 = 0;
473 pip_crc_ivx.s.iv = initialization_vector;
474 cvmx_write_csr(CVMX_PIP_CRC_IVX(interface), pip_crc_ivx.u64);
475 }
476}
477
478/**
479 * Clear all bits in a tag mask. This should be called on
480 * startup before any calls to cvmx_pip_tag_mask_set. Each bit
481 * set in the final mask represent a byte used in the packet for
482 * tag generation.
483 *
484 * @mask_index: Which tag mask to clear (0..3)
485 */
486static inline void cvmx_pip_tag_mask_clear(uint64_t mask_index)
487{
488 uint64_t index;
489 union cvmx_pip_tag_incx pip_tag_incx;
490 pip_tag_incx.u64 = 0;
491 pip_tag_incx.s.en = 0;
492 for (index = mask_index * 16; index < (mask_index + 1) * 16; index++)
493 cvmx_write_csr(CVMX_PIP_TAG_INCX(index), pip_tag_incx.u64);
494}
495
496/**
497 * Sets a range of bits in the tag mask. The tag mask is used
498 * when the cvmx_pip_port_tag_cfg_t tag_mode is non zero.
499 * There are four separate masks that can be configured.
500 *
501 * @mask_index: Which tag mask to modify (0..3)
502 * @offset: Offset into the bitmask to set bits at. Use the GCC macro
503 * offsetof() to determine the offsets into packet headers.
504 * For example, offsetof(ethhdr, protocol) returns the offset
505 * of the ethernet protocol field. The bitmask selects which
506 * bytes to include the tag, with bit offset X selecting
507 * byte at offset X from the beginning of the packet data.
508 * @len: Number of bytes to include. Usually this is the sizeof()
509 * the field.
510 */
511static inline void cvmx_pip_tag_mask_set(uint64_t mask_index, uint64_t offset,
512 uint64_t len)
513{
514 while (len--) {
515 union cvmx_pip_tag_incx pip_tag_incx;
516 uint64_t index = mask_index * 16 + offset / 8;
517 pip_tag_incx.u64 = cvmx_read_csr(CVMX_PIP_TAG_INCX(index));
518 pip_tag_incx.s.en |= 0x80 >> (offset & 0x7);
519 cvmx_write_csr(CVMX_PIP_TAG_INCX(index), pip_tag_incx.u64);
520 offset++;
521 }
522}
523
524#endif /* __CVMX_PIP_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-pko-defs.h b/arch/mips/include/asm/octeon/cvmx-pko-defs.h
new file mode 100644
index 000000000..7e14c0d32
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pko-defs.h
@@ -0,0 +1,2205 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_PKO_DEFS_H__
29#define __CVMX_PKO_DEFS_H__
30
31#define CVMX_PKO_MEM_COUNT0 (CVMX_ADD_IO_SEG(0x0001180050001080ull))
32#define CVMX_PKO_MEM_COUNT1 (CVMX_ADD_IO_SEG(0x0001180050001088ull))
33#define CVMX_PKO_MEM_DEBUG0 (CVMX_ADD_IO_SEG(0x0001180050001100ull))
34#define CVMX_PKO_MEM_DEBUG1 (CVMX_ADD_IO_SEG(0x0001180050001108ull))
35#define CVMX_PKO_MEM_DEBUG10 (CVMX_ADD_IO_SEG(0x0001180050001150ull))
36#define CVMX_PKO_MEM_DEBUG11 (CVMX_ADD_IO_SEG(0x0001180050001158ull))
37#define CVMX_PKO_MEM_DEBUG12 (CVMX_ADD_IO_SEG(0x0001180050001160ull))
38#define CVMX_PKO_MEM_DEBUG13 (CVMX_ADD_IO_SEG(0x0001180050001168ull))
39#define CVMX_PKO_MEM_DEBUG14 (CVMX_ADD_IO_SEG(0x0001180050001170ull))
40#define CVMX_PKO_MEM_DEBUG2 (CVMX_ADD_IO_SEG(0x0001180050001110ull))
41#define CVMX_PKO_MEM_DEBUG3 (CVMX_ADD_IO_SEG(0x0001180050001118ull))
42#define CVMX_PKO_MEM_DEBUG4 (CVMX_ADD_IO_SEG(0x0001180050001120ull))
43#define CVMX_PKO_MEM_DEBUG5 (CVMX_ADD_IO_SEG(0x0001180050001128ull))
44#define CVMX_PKO_MEM_DEBUG6 (CVMX_ADD_IO_SEG(0x0001180050001130ull))
45#define CVMX_PKO_MEM_DEBUG7 (CVMX_ADD_IO_SEG(0x0001180050001138ull))
46#define CVMX_PKO_MEM_DEBUG8 (CVMX_ADD_IO_SEG(0x0001180050001140ull))
47#define CVMX_PKO_MEM_DEBUG9 (CVMX_ADD_IO_SEG(0x0001180050001148ull))
48#define CVMX_PKO_MEM_IPORT_PTRS (CVMX_ADD_IO_SEG(0x0001180050001030ull))
49#define CVMX_PKO_MEM_IPORT_QOS (CVMX_ADD_IO_SEG(0x0001180050001038ull))
50#define CVMX_PKO_MEM_IQUEUE_PTRS (CVMX_ADD_IO_SEG(0x0001180050001040ull))
51#define CVMX_PKO_MEM_IQUEUE_QOS (CVMX_ADD_IO_SEG(0x0001180050001048ull))
52#define CVMX_PKO_MEM_PORT_PTRS (CVMX_ADD_IO_SEG(0x0001180050001010ull))
53#define CVMX_PKO_MEM_PORT_QOS (CVMX_ADD_IO_SEG(0x0001180050001018ull))
54#define CVMX_PKO_MEM_PORT_RATE0 (CVMX_ADD_IO_SEG(0x0001180050001020ull))
55#define CVMX_PKO_MEM_PORT_RATE1 (CVMX_ADD_IO_SEG(0x0001180050001028ull))
56#define CVMX_PKO_MEM_QUEUE_PTRS (CVMX_ADD_IO_SEG(0x0001180050001000ull))
57#define CVMX_PKO_MEM_QUEUE_QOS (CVMX_ADD_IO_SEG(0x0001180050001008ull))
58#define CVMX_PKO_MEM_THROTTLE_INT (CVMX_ADD_IO_SEG(0x0001180050001058ull))
59#define CVMX_PKO_MEM_THROTTLE_PIPE (CVMX_ADD_IO_SEG(0x0001180050001050ull))
60#define CVMX_PKO_REG_BIST_RESULT (CVMX_ADD_IO_SEG(0x0001180050000080ull))
61#define CVMX_PKO_REG_CMD_BUF (CVMX_ADD_IO_SEG(0x0001180050000010ull))
62#define CVMX_PKO_REG_CRC_CTLX(offset) (CVMX_ADD_IO_SEG(0x0001180050000028ull) + ((offset) & 1) * 8)
63#define CVMX_PKO_REG_CRC_ENABLE (CVMX_ADD_IO_SEG(0x0001180050000020ull))
64#define CVMX_PKO_REG_CRC_IVX(offset) (CVMX_ADD_IO_SEG(0x0001180050000038ull) + ((offset) & 1) * 8)
65#define CVMX_PKO_REG_DEBUG0 (CVMX_ADD_IO_SEG(0x0001180050000098ull))
66#define CVMX_PKO_REG_DEBUG1 (CVMX_ADD_IO_SEG(0x00011800500000A0ull))
67#define CVMX_PKO_REG_DEBUG2 (CVMX_ADD_IO_SEG(0x00011800500000A8ull))
68#define CVMX_PKO_REG_DEBUG3 (CVMX_ADD_IO_SEG(0x00011800500000B0ull))
69#define CVMX_PKO_REG_DEBUG4 (CVMX_ADD_IO_SEG(0x00011800500000B8ull))
70#define CVMX_PKO_REG_ENGINE_INFLIGHT (CVMX_ADD_IO_SEG(0x0001180050000050ull))
71#define CVMX_PKO_REG_ENGINE_INFLIGHT1 (CVMX_ADD_IO_SEG(0x0001180050000318ull))
72#define CVMX_PKO_REG_ENGINE_STORAGEX(offset) (CVMX_ADD_IO_SEG(0x0001180050000300ull) + ((offset) & 1) * 8)
73#define CVMX_PKO_REG_ENGINE_THRESH (CVMX_ADD_IO_SEG(0x0001180050000058ull))
74#define CVMX_PKO_REG_ERROR (CVMX_ADD_IO_SEG(0x0001180050000088ull))
75#define CVMX_PKO_REG_FLAGS (CVMX_ADD_IO_SEG(0x0001180050000000ull))
76#define CVMX_PKO_REG_GMX_PORT_MODE (CVMX_ADD_IO_SEG(0x0001180050000018ull))
77#define CVMX_PKO_REG_INT_MASK (CVMX_ADD_IO_SEG(0x0001180050000090ull))
78#define CVMX_PKO_REG_LOOPBACK_BPID (CVMX_ADD_IO_SEG(0x0001180050000118ull))
79#define CVMX_PKO_REG_LOOPBACK_PKIND (CVMX_ADD_IO_SEG(0x0001180050000068ull))
80#define CVMX_PKO_REG_MIN_PKT (CVMX_ADD_IO_SEG(0x0001180050000070ull))
81#define CVMX_PKO_REG_PREEMPT (CVMX_ADD_IO_SEG(0x0001180050000110ull))
82#define CVMX_PKO_REG_QUEUE_MODE (CVMX_ADD_IO_SEG(0x0001180050000048ull))
83#define CVMX_PKO_REG_QUEUE_PREEMPT (CVMX_ADD_IO_SEG(0x0001180050000108ull))
84#define CVMX_PKO_REG_QUEUE_PTRS1 (CVMX_ADD_IO_SEG(0x0001180050000100ull))
85#define CVMX_PKO_REG_READ_IDX (CVMX_ADD_IO_SEG(0x0001180050000008ull))
86#define CVMX_PKO_REG_THROTTLE (CVMX_ADD_IO_SEG(0x0001180050000078ull))
87#define CVMX_PKO_REG_TIMESTAMP (CVMX_ADD_IO_SEG(0x0001180050000060ull))
88
89union cvmx_pko_mem_count0 {
90 uint64_t u64;
91 struct cvmx_pko_mem_count0_s {
92#ifdef __BIG_ENDIAN_BITFIELD
93 uint64_t reserved_32_63:32;
94 uint64_t count:32;
95#else
96 uint64_t count:32;
97 uint64_t reserved_32_63:32;
98#endif
99 } s;
100};
101
102union cvmx_pko_mem_count1 {
103 uint64_t u64;
104 struct cvmx_pko_mem_count1_s {
105#ifdef __BIG_ENDIAN_BITFIELD
106 uint64_t reserved_48_63:16;
107 uint64_t count:48;
108#else
109 uint64_t count:48;
110 uint64_t reserved_48_63:16;
111#endif
112 } s;
113};
114
115union cvmx_pko_mem_debug0 {
116 uint64_t u64;
117 struct cvmx_pko_mem_debug0_s {
118#ifdef __BIG_ENDIAN_BITFIELD
119 uint64_t fau:28;
120 uint64_t cmd:14;
121 uint64_t segs:6;
122 uint64_t size:16;
123#else
124 uint64_t size:16;
125 uint64_t segs:6;
126 uint64_t cmd:14;
127 uint64_t fau:28;
128#endif
129 } s;
130};
131
132union cvmx_pko_mem_debug1 {
133 uint64_t u64;
134 struct cvmx_pko_mem_debug1_s {
135#ifdef __BIG_ENDIAN_BITFIELD
136 uint64_t i:1;
137 uint64_t back:4;
138 uint64_t pool:3;
139 uint64_t size:16;
140 uint64_t ptr:40;
141#else
142 uint64_t ptr:40;
143 uint64_t size:16;
144 uint64_t pool:3;
145 uint64_t back:4;
146 uint64_t i:1;
147#endif
148 } s;
149};
150
151union cvmx_pko_mem_debug10 {
152 uint64_t u64;
153 struct cvmx_pko_mem_debug10_s {
154#ifdef __BIG_ENDIAN_BITFIELD
155 uint64_t reserved_0_63:64;
156#else
157 uint64_t reserved_0_63:64;
158#endif
159 } s;
160 struct cvmx_pko_mem_debug10_cn30xx {
161#ifdef __BIG_ENDIAN_BITFIELD
162 uint64_t fau:28;
163 uint64_t cmd:14;
164 uint64_t segs:6;
165 uint64_t size:16;
166#else
167 uint64_t size:16;
168 uint64_t segs:6;
169 uint64_t cmd:14;
170 uint64_t fau:28;
171#endif
172 } cn30xx;
173 struct cvmx_pko_mem_debug10_cn50xx {
174#ifdef __BIG_ENDIAN_BITFIELD
175 uint64_t reserved_49_63:15;
176 uint64_t ptrs1:17;
177 uint64_t reserved_17_31:15;
178 uint64_t ptrs2:17;
179#else
180 uint64_t ptrs2:17;
181 uint64_t reserved_17_31:15;
182 uint64_t ptrs1:17;
183 uint64_t reserved_49_63:15;
184#endif
185 } cn50xx;
186};
187
188union cvmx_pko_mem_debug11 {
189 uint64_t u64;
190 struct cvmx_pko_mem_debug11_s {
191#ifdef __BIG_ENDIAN_BITFIELD
192 uint64_t i:1;
193 uint64_t back:4;
194 uint64_t pool:3;
195 uint64_t size:16;
196 uint64_t reserved_0_39:40;
197#else
198 uint64_t reserved_0_39:40;
199 uint64_t size:16;
200 uint64_t pool:3;
201 uint64_t back:4;
202 uint64_t i:1;
203#endif
204 } s;
205 struct cvmx_pko_mem_debug11_cn30xx {
206#ifdef __BIG_ENDIAN_BITFIELD
207 uint64_t i:1;
208 uint64_t back:4;
209 uint64_t pool:3;
210 uint64_t size:16;
211 uint64_t ptr:40;
212#else
213 uint64_t ptr:40;
214 uint64_t size:16;
215 uint64_t pool:3;
216 uint64_t back:4;
217 uint64_t i:1;
218#endif
219 } cn30xx;
220 struct cvmx_pko_mem_debug11_cn50xx {
221#ifdef __BIG_ENDIAN_BITFIELD
222 uint64_t reserved_23_63:41;
223 uint64_t maj:1;
224 uint64_t uid:3;
225 uint64_t sop:1;
226 uint64_t len:1;
227 uint64_t chk:1;
228 uint64_t cnt:13;
229 uint64_t mod:3;
230#else
231 uint64_t mod:3;
232 uint64_t cnt:13;
233 uint64_t chk:1;
234 uint64_t len:1;
235 uint64_t sop:1;
236 uint64_t uid:3;
237 uint64_t maj:1;
238 uint64_t reserved_23_63:41;
239#endif
240 } cn50xx;
241};
242
243union cvmx_pko_mem_debug12 {
244 uint64_t u64;
245 struct cvmx_pko_mem_debug12_s {
246#ifdef __BIG_ENDIAN_BITFIELD
247 uint64_t reserved_0_63:64;
248#else
249 uint64_t reserved_0_63:64;
250#endif
251 } s;
252 struct cvmx_pko_mem_debug12_cn30xx {
253#ifdef __BIG_ENDIAN_BITFIELD
254 uint64_t data:64;
255#else
256 uint64_t data:64;
257#endif
258 } cn30xx;
259 struct cvmx_pko_mem_debug12_cn50xx {
260#ifdef __BIG_ENDIAN_BITFIELD
261 uint64_t fau:28;
262 uint64_t cmd:14;
263 uint64_t segs:6;
264 uint64_t size:16;
265#else
266 uint64_t size:16;
267 uint64_t segs:6;
268 uint64_t cmd:14;
269 uint64_t fau:28;
270#endif
271 } cn50xx;
272 struct cvmx_pko_mem_debug12_cn68xx {
273#ifdef __BIG_ENDIAN_BITFIELD
274 uint64_t state:64;
275#else
276 uint64_t state:64;
277#endif
278 } cn68xx;
279};
280
281union cvmx_pko_mem_debug13 {
282 uint64_t u64;
283 struct cvmx_pko_mem_debug13_s {
284#ifdef __BIG_ENDIAN_BITFIELD
285 uint64_t reserved_0_63:64;
286#else
287 uint64_t reserved_0_63:64;
288#endif
289 } s;
290 struct cvmx_pko_mem_debug13_cn30xx {
291#ifdef __BIG_ENDIAN_BITFIELD
292 uint64_t reserved_51_63:13;
293 uint64_t widx:17;
294 uint64_t ridx2:17;
295 uint64_t widx2:17;
296#else
297 uint64_t widx2:17;
298 uint64_t ridx2:17;
299 uint64_t widx:17;
300 uint64_t reserved_51_63:13;
301#endif
302 } cn30xx;
303 struct cvmx_pko_mem_debug13_cn50xx {
304#ifdef __BIG_ENDIAN_BITFIELD
305 uint64_t i:1;
306 uint64_t back:4;
307 uint64_t pool:3;
308 uint64_t size:16;
309 uint64_t ptr:40;
310#else
311 uint64_t ptr:40;
312 uint64_t size:16;
313 uint64_t pool:3;
314 uint64_t back:4;
315 uint64_t i:1;
316#endif
317 } cn50xx;
318 struct cvmx_pko_mem_debug13_cn68xx {
319#ifdef __BIG_ENDIAN_BITFIELD
320 uint64_t state:64;
321#else
322 uint64_t state:64;
323#endif
324 } cn68xx;
325};
326
327union cvmx_pko_mem_debug14 {
328 uint64_t u64;
329 struct cvmx_pko_mem_debug14_s {
330#ifdef __BIG_ENDIAN_BITFIELD
331 uint64_t reserved_0_63:64;
332#else
333 uint64_t reserved_0_63:64;
334#endif
335 } s;
336 struct cvmx_pko_mem_debug14_cn30xx {
337#ifdef __BIG_ENDIAN_BITFIELD
338 uint64_t reserved_17_63:47;
339 uint64_t ridx:17;
340#else
341 uint64_t ridx:17;
342 uint64_t reserved_17_63:47;
343#endif
344 } cn30xx;
345 struct cvmx_pko_mem_debug14_cn52xx {
346#ifdef __BIG_ENDIAN_BITFIELD
347 uint64_t data:64;
348#else
349 uint64_t data:64;
350#endif
351 } cn52xx;
352};
353
354union cvmx_pko_mem_debug2 {
355 uint64_t u64;
356 struct cvmx_pko_mem_debug2_s {
357#ifdef __BIG_ENDIAN_BITFIELD
358 uint64_t i:1;
359 uint64_t back:4;
360 uint64_t pool:3;
361 uint64_t size:16;
362 uint64_t ptr:40;
363#else
364 uint64_t ptr:40;
365 uint64_t size:16;
366 uint64_t pool:3;
367 uint64_t back:4;
368 uint64_t i:1;
369#endif
370 } s;
371};
372
373union cvmx_pko_mem_debug3 {
374 uint64_t u64;
375 struct cvmx_pko_mem_debug3_s {
376#ifdef __BIG_ENDIAN_BITFIELD
377 uint64_t reserved_0_63:64;
378#else
379 uint64_t reserved_0_63:64;
380#endif
381 } s;
382 struct cvmx_pko_mem_debug3_cn30xx {
383#ifdef __BIG_ENDIAN_BITFIELD
384 uint64_t i:1;
385 uint64_t back:4;
386 uint64_t pool:3;
387 uint64_t size:16;
388 uint64_t ptr:40;
389#else
390 uint64_t ptr:40;
391 uint64_t size:16;
392 uint64_t pool:3;
393 uint64_t back:4;
394 uint64_t i:1;
395#endif
396 } cn30xx;
397 struct cvmx_pko_mem_debug3_cn50xx {
398#ifdef __BIG_ENDIAN_BITFIELD
399 uint64_t data:64;
400#else
401 uint64_t data:64;
402#endif
403 } cn50xx;
404};
405
406union cvmx_pko_mem_debug4 {
407 uint64_t u64;
408 struct cvmx_pko_mem_debug4_s {
409#ifdef __BIG_ENDIAN_BITFIELD
410 uint64_t reserved_0_63:64;
411#else
412 uint64_t reserved_0_63:64;
413#endif
414 } s;
415 struct cvmx_pko_mem_debug4_cn30xx {
416#ifdef __BIG_ENDIAN_BITFIELD
417 uint64_t data:64;
418#else
419 uint64_t data:64;
420#endif
421 } cn30xx;
422 struct cvmx_pko_mem_debug4_cn50xx {
423#ifdef __BIG_ENDIAN_BITFIELD
424 uint64_t cmnd_segs:3;
425 uint64_t cmnd_siz:16;
426 uint64_t cmnd_off:6;
427 uint64_t uid:3;
428 uint64_t dread_sop:1;
429 uint64_t init_dwrite:1;
430 uint64_t chk_once:1;
431 uint64_t chk_mode:1;
432 uint64_t active:1;
433 uint64_t static_p:1;
434 uint64_t qos:3;
435 uint64_t qcb_ridx:5;
436 uint64_t qid_off_max:4;
437 uint64_t qid_off:4;
438 uint64_t qid_base:8;
439 uint64_t wait:1;
440 uint64_t minor:2;
441 uint64_t major:3;
442#else
443 uint64_t major:3;
444 uint64_t minor:2;
445 uint64_t wait:1;
446 uint64_t qid_base:8;
447 uint64_t qid_off:4;
448 uint64_t qid_off_max:4;
449 uint64_t qcb_ridx:5;
450 uint64_t qos:3;
451 uint64_t static_p:1;
452 uint64_t active:1;
453 uint64_t chk_mode:1;
454 uint64_t chk_once:1;
455 uint64_t init_dwrite:1;
456 uint64_t dread_sop:1;
457 uint64_t uid:3;
458 uint64_t cmnd_off:6;
459 uint64_t cmnd_siz:16;
460 uint64_t cmnd_segs:3;
461#endif
462 } cn50xx;
463 struct cvmx_pko_mem_debug4_cn52xx {
464#ifdef __BIG_ENDIAN_BITFIELD
465 uint64_t curr_siz:8;
466 uint64_t curr_off:16;
467 uint64_t cmnd_segs:6;
468 uint64_t cmnd_siz:16;
469 uint64_t cmnd_off:6;
470 uint64_t uid:2;
471 uint64_t dread_sop:1;
472 uint64_t init_dwrite:1;
473 uint64_t chk_once:1;
474 uint64_t chk_mode:1;
475 uint64_t wait:1;
476 uint64_t minor:2;
477 uint64_t major:3;
478#else
479 uint64_t major:3;
480 uint64_t minor:2;
481 uint64_t wait:1;
482 uint64_t chk_mode:1;
483 uint64_t chk_once:1;
484 uint64_t init_dwrite:1;
485 uint64_t dread_sop:1;
486 uint64_t uid:2;
487 uint64_t cmnd_off:6;
488 uint64_t cmnd_siz:16;
489 uint64_t cmnd_segs:6;
490 uint64_t curr_off:16;
491 uint64_t curr_siz:8;
492#endif
493 } cn52xx;
494};
495
496union cvmx_pko_mem_debug5 {
497 uint64_t u64;
498 struct cvmx_pko_mem_debug5_s {
499#ifdef __BIG_ENDIAN_BITFIELD
500 uint64_t reserved_0_63:64;
501#else
502 uint64_t reserved_0_63:64;
503#endif
504 } s;
505 struct cvmx_pko_mem_debug5_cn30xx {
506#ifdef __BIG_ENDIAN_BITFIELD
507 uint64_t dwri_mod:1;
508 uint64_t dwri_sop:1;
509 uint64_t dwri_len:1;
510 uint64_t dwri_cnt:13;
511 uint64_t cmnd_siz:16;
512 uint64_t uid:1;
513 uint64_t xfer_wor:1;
514 uint64_t xfer_dwr:1;
515 uint64_t cbuf_fre:1;
516 uint64_t reserved_27_27:1;
517 uint64_t chk_mode:1;
518 uint64_t active:1;
519 uint64_t qos:3;
520 uint64_t qcb_ridx:5;
521 uint64_t qid_off:3;
522 uint64_t qid_base:7;
523 uint64_t wait:1;
524 uint64_t minor:2;
525 uint64_t major:4;
526#else
527 uint64_t major:4;
528 uint64_t minor:2;
529 uint64_t wait:1;
530 uint64_t qid_base:7;
531 uint64_t qid_off:3;
532 uint64_t qcb_ridx:5;
533 uint64_t qos:3;
534 uint64_t active:1;
535 uint64_t chk_mode:1;
536 uint64_t reserved_27_27:1;
537 uint64_t cbuf_fre:1;
538 uint64_t xfer_dwr:1;
539 uint64_t xfer_wor:1;
540 uint64_t uid:1;
541 uint64_t cmnd_siz:16;
542 uint64_t dwri_cnt:13;
543 uint64_t dwri_len:1;
544 uint64_t dwri_sop:1;
545 uint64_t dwri_mod:1;
546#endif
547 } cn30xx;
548 struct cvmx_pko_mem_debug5_cn50xx {
549#ifdef __BIG_ENDIAN_BITFIELD
550 uint64_t curr_ptr:29;
551 uint64_t curr_siz:16;
552 uint64_t curr_off:16;
553 uint64_t cmnd_segs:3;
554#else
555 uint64_t cmnd_segs:3;
556 uint64_t curr_off:16;
557 uint64_t curr_siz:16;
558 uint64_t curr_ptr:29;
559#endif
560 } cn50xx;
561 struct cvmx_pko_mem_debug5_cn52xx {
562#ifdef __BIG_ENDIAN_BITFIELD
563 uint64_t reserved_54_63:10;
564 uint64_t nxt_inflt:6;
565 uint64_t curr_ptr:40;
566 uint64_t curr_siz:8;
567#else
568 uint64_t curr_siz:8;
569 uint64_t curr_ptr:40;
570 uint64_t nxt_inflt:6;
571 uint64_t reserved_54_63:10;
572#endif
573 } cn52xx;
574 struct cvmx_pko_mem_debug5_cn61xx {
575#ifdef __BIG_ENDIAN_BITFIELD
576 uint64_t reserved_56_63:8;
577 uint64_t ptp:1;
578 uint64_t major_3:1;
579 uint64_t nxt_inflt:6;
580 uint64_t curr_ptr:40;
581 uint64_t curr_siz:8;
582#else
583 uint64_t curr_siz:8;
584 uint64_t curr_ptr:40;
585 uint64_t nxt_inflt:6;
586 uint64_t major_3:1;
587 uint64_t ptp:1;
588 uint64_t reserved_56_63:8;
589#endif
590 } cn61xx;
591 struct cvmx_pko_mem_debug5_cn68xx {
592#ifdef __BIG_ENDIAN_BITFIELD
593 uint64_t reserved_57_63:7;
594 uint64_t uid_2:1;
595 uint64_t ptp:1;
596 uint64_t major_3:1;
597 uint64_t nxt_inflt:6;
598 uint64_t curr_ptr:40;
599 uint64_t curr_siz:8;
600#else
601 uint64_t curr_siz:8;
602 uint64_t curr_ptr:40;
603 uint64_t nxt_inflt:6;
604 uint64_t major_3:1;
605 uint64_t ptp:1;
606 uint64_t uid_2:1;
607 uint64_t reserved_57_63:7;
608#endif
609 } cn68xx;
610};
611
612union cvmx_pko_mem_debug6 {
613 uint64_t u64;
614 struct cvmx_pko_mem_debug6_s {
615#ifdef __BIG_ENDIAN_BITFIELD
616 uint64_t reserved_37_63:27;
617 uint64_t qid_offres:4;
618 uint64_t qid_offths:4;
619 uint64_t preempter:1;
620 uint64_t preemptee:1;
621 uint64_t preempted:1;
622 uint64_t active:1;
623 uint64_t statc:1;
624 uint64_t qos:3;
625 uint64_t qcb_ridx:5;
626 uint64_t qid_offmax:4;
627 uint64_t reserved_0_11:12;
628#else
629 uint64_t reserved_0_11:12;
630 uint64_t qid_offmax:4;
631 uint64_t qcb_ridx:5;
632 uint64_t qos:3;
633 uint64_t statc:1;
634 uint64_t active:1;
635 uint64_t preempted:1;
636 uint64_t preemptee:1;
637 uint64_t preempter:1;
638 uint64_t qid_offths:4;
639 uint64_t qid_offres:4;
640 uint64_t reserved_37_63:27;
641#endif
642 } s;
643 struct cvmx_pko_mem_debug6_cn30xx {
644#ifdef __BIG_ENDIAN_BITFIELD
645 uint64_t reserved_11_63:53;
646 uint64_t qid_offm:3;
647 uint64_t static_p:1;
648 uint64_t work_min:3;
649 uint64_t dwri_chk:1;
650 uint64_t dwri_uid:1;
651 uint64_t dwri_mod:2;
652#else
653 uint64_t dwri_mod:2;
654 uint64_t dwri_uid:1;
655 uint64_t dwri_chk:1;
656 uint64_t work_min:3;
657 uint64_t static_p:1;
658 uint64_t qid_offm:3;
659 uint64_t reserved_11_63:53;
660#endif
661 } cn30xx;
662 struct cvmx_pko_mem_debug6_cn50xx {
663#ifdef __BIG_ENDIAN_BITFIELD
664 uint64_t reserved_11_63:53;
665 uint64_t curr_ptr:11;
666#else
667 uint64_t curr_ptr:11;
668 uint64_t reserved_11_63:53;
669#endif
670 } cn50xx;
671 struct cvmx_pko_mem_debug6_cn52xx {
672#ifdef __BIG_ENDIAN_BITFIELD
673 uint64_t reserved_37_63:27;
674 uint64_t qid_offres:4;
675 uint64_t qid_offths:4;
676 uint64_t preempter:1;
677 uint64_t preemptee:1;
678 uint64_t preempted:1;
679 uint64_t active:1;
680 uint64_t statc:1;
681 uint64_t qos:3;
682 uint64_t qcb_ridx:5;
683 uint64_t qid_offmax:4;
684 uint64_t qid_off:4;
685 uint64_t qid_base:8;
686#else
687 uint64_t qid_base:8;
688 uint64_t qid_off:4;
689 uint64_t qid_offmax:4;
690 uint64_t qcb_ridx:5;
691 uint64_t qos:3;
692 uint64_t statc:1;
693 uint64_t active:1;
694 uint64_t preempted:1;
695 uint64_t preemptee:1;
696 uint64_t preempter:1;
697 uint64_t qid_offths:4;
698 uint64_t qid_offres:4;
699 uint64_t reserved_37_63:27;
700#endif
701 } cn52xx;
702};
703
704union cvmx_pko_mem_debug7 {
705 uint64_t u64;
706 struct cvmx_pko_mem_debug7_s {
707#ifdef __BIG_ENDIAN_BITFIELD
708 uint64_t reserved_0_63:64;
709#else
710 uint64_t reserved_0_63:64;
711#endif
712 } s;
713 struct cvmx_pko_mem_debug7_cn30xx {
714#ifdef __BIG_ENDIAN_BITFIELD
715 uint64_t reserved_58_63:6;
716 uint64_t dwb:9;
717 uint64_t start:33;
718 uint64_t size:16;
719#else
720 uint64_t size:16;
721 uint64_t start:33;
722 uint64_t dwb:9;
723 uint64_t reserved_58_63:6;
724#endif
725 } cn30xx;
726 struct cvmx_pko_mem_debug7_cn50xx {
727#ifdef __BIG_ENDIAN_BITFIELD
728 uint64_t qos:5;
729 uint64_t tail:1;
730 uint64_t buf_siz:13;
731 uint64_t buf_ptr:33;
732 uint64_t qcb_widx:6;
733 uint64_t qcb_ridx:6;
734#else
735 uint64_t qcb_ridx:6;
736 uint64_t qcb_widx:6;
737 uint64_t buf_ptr:33;
738 uint64_t buf_siz:13;
739 uint64_t tail:1;
740 uint64_t qos:5;
741#endif
742 } cn50xx;
743 struct cvmx_pko_mem_debug7_cn68xx {
744#ifdef __BIG_ENDIAN_BITFIELD
745 uint64_t qos:3;
746 uint64_t tail:1;
747 uint64_t buf_siz:13;
748 uint64_t buf_ptr:33;
749 uint64_t qcb_widx:7;
750 uint64_t qcb_ridx:7;
751#else
752 uint64_t qcb_ridx:7;
753 uint64_t qcb_widx:7;
754 uint64_t buf_ptr:33;
755 uint64_t buf_siz:13;
756 uint64_t tail:1;
757 uint64_t qos:3;
758#endif
759 } cn68xx;
760};
761
762union cvmx_pko_mem_debug8 {
763 uint64_t u64;
764 struct cvmx_pko_mem_debug8_s {
765#ifdef __BIG_ENDIAN_BITFIELD
766 uint64_t reserved_59_63:5;
767 uint64_t tail:1;
768 uint64_t buf_siz:13;
769 uint64_t reserved_0_44:45;
770#else
771 uint64_t reserved_0_44:45;
772 uint64_t buf_siz:13;
773 uint64_t tail:1;
774 uint64_t reserved_59_63:5;
775#endif
776 } s;
777 struct cvmx_pko_mem_debug8_cn30xx {
778#ifdef __BIG_ENDIAN_BITFIELD
779 uint64_t qos:5;
780 uint64_t tail:1;
781 uint64_t buf_siz:13;
782 uint64_t buf_ptr:33;
783 uint64_t qcb_widx:6;
784 uint64_t qcb_ridx:6;
785#else
786 uint64_t qcb_ridx:6;
787 uint64_t qcb_widx:6;
788 uint64_t buf_ptr:33;
789 uint64_t buf_siz:13;
790 uint64_t tail:1;
791 uint64_t qos:5;
792#endif
793 } cn30xx;
794 struct cvmx_pko_mem_debug8_cn50xx {
795#ifdef __BIG_ENDIAN_BITFIELD
796 uint64_t reserved_28_63:36;
797 uint64_t doorbell:20;
798 uint64_t reserved_6_7:2;
799 uint64_t static_p:1;
800 uint64_t s_tail:1;
801 uint64_t static_q:1;
802 uint64_t qos:3;
803#else
804 uint64_t qos:3;
805 uint64_t static_q:1;
806 uint64_t s_tail:1;
807 uint64_t static_p:1;
808 uint64_t reserved_6_7:2;
809 uint64_t doorbell:20;
810 uint64_t reserved_28_63:36;
811#endif
812 } cn50xx;
813 struct cvmx_pko_mem_debug8_cn52xx {
814#ifdef __BIG_ENDIAN_BITFIELD
815 uint64_t reserved_29_63:35;
816 uint64_t preempter:1;
817 uint64_t doorbell:20;
818 uint64_t reserved_7_7:1;
819 uint64_t preemptee:1;
820 uint64_t static_p:1;
821 uint64_t s_tail:1;
822 uint64_t static_q:1;
823 uint64_t qos:3;
824#else
825 uint64_t qos:3;
826 uint64_t static_q:1;
827 uint64_t s_tail:1;
828 uint64_t static_p:1;
829 uint64_t preemptee:1;
830 uint64_t reserved_7_7:1;
831 uint64_t doorbell:20;
832 uint64_t preempter:1;
833 uint64_t reserved_29_63:35;
834#endif
835 } cn52xx;
836 struct cvmx_pko_mem_debug8_cn61xx {
837#ifdef __BIG_ENDIAN_BITFIELD
838 uint64_t reserved_42_63:22;
839 uint64_t qid_qqos:8;
840 uint64_t reserved_33_33:1;
841 uint64_t qid_idx:4;
842 uint64_t preempter:1;
843 uint64_t doorbell:20;
844 uint64_t reserved_7_7:1;
845 uint64_t preemptee:1;
846 uint64_t static_p:1;
847 uint64_t s_tail:1;
848 uint64_t static_q:1;
849 uint64_t qos:3;
850#else
851 uint64_t qos:3;
852 uint64_t static_q:1;
853 uint64_t s_tail:1;
854 uint64_t static_p:1;
855 uint64_t preemptee:1;
856 uint64_t reserved_7_7:1;
857 uint64_t doorbell:20;
858 uint64_t preempter:1;
859 uint64_t qid_idx:4;
860 uint64_t reserved_33_33:1;
861 uint64_t qid_qqos:8;
862 uint64_t reserved_42_63:22;
863#endif
864 } cn61xx;
865 struct cvmx_pko_mem_debug8_cn68xx {
866#ifdef __BIG_ENDIAN_BITFIELD
867 uint64_t reserved_37_63:27;
868 uint64_t preempter:1;
869 uint64_t doorbell:20;
870 uint64_t reserved_9_15:7;
871 uint64_t preemptee:1;
872 uint64_t static_p:1;
873 uint64_t s_tail:1;
874 uint64_t static_q:1;
875 uint64_t qos:5;
876#else
877 uint64_t qos:5;
878 uint64_t static_q:1;
879 uint64_t s_tail:1;
880 uint64_t static_p:1;
881 uint64_t preemptee:1;
882 uint64_t reserved_9_15:7;
883 uint64_t doorbell:20;
884 uint64_t preempter:1;
885 uint64_t reserved_37_63:27;
886#endif
887 } cn68xx;
888};
889
890union cvmx_pko_mem_debug9 {
891 uint64_t u64;
892 struct cvmx_pko_mem_debug9_s {
893#ifdef __BIG_ENDIAN_BITFIELD
894 uint64_t reserved_49_63:15;
895 uint64_t ptrs0:17;
896 uint64_t reserved_0_31:32;
897#else
898 uint64_t reserved_0_31:32;
899 uint64_t ptrs0:17;
900 uint64_t reserved_49_63:15;
901#endif
902 } s;
903 struct cvmx_pko_mem_debug9_cn30xx {
904#ifdef __BIG_ENDIAN_BITFIELD
905 uint64_t reserved_28_63:36;
906 uint64_t doorbell:20;
907 uint64_t reserved_5_7:3;
908 uint64_t s_tail:1;
909 uint64_t static_q:1;
910 uint64_t qos:3;
911#else
912 uint64_t qos:3;
913 uint64_t static_q:1;
914 uint64_t s_tail:1;
915 uint64_t reserved_5_7:3;
916 uint64_t doorbell:20;
917 uint64_t reserved_28_63:36;
918#endif
919 } cn30xx;
920 struct cvmx_pko_mem_debug9_cn38xx {
921#ifdef __BIG_ENDIAN_BITFIELD
922 uint64_t reserved_28_63:36;
923 uint64_t doorbell:20;
924 uint64_t reserved_6_7:2;
925 uint64_t static_p:1;
926 uint64_t s_tail:1;
927 uint64_t static_q:1;
928 uint64_t qos:3;
929#else
930 uint64_t qos:3;
931 uint64_t static_q:1;
932 uint64_t s_tail:1;
933 uint64_t static_p:1;
934 uint64_t reserved_6_7:2;
935 uint64_t doorbell:20;
936 uint64_t reserved_28_63:36;
937#endif
938 } cn38xx;
939 struct cvmx_pko_mem_debug9_cn50xx {
940#ifdef __BIG_ENDIAN_BITFIELD
941 uint64_t reserved_49_63:15;
942 uint64_t ptrs0:17;
943 uint64_t reserved_17_31:15;
944 uint64_t ptrs3:17;
945#else
946 uint64_t ptrs3:17;
947 uint64_t reserved_17_31:15;
948 uint64_t ptrs0:17;
949 uint64_t reserved_49_63:15;
950#endif
951 } cn50xx;
952};
953
954union cvmx_pko_mem_iport_ptrs {
955 uint64_t u64;
956 struct cvmx_pko_mem_iport_ptrs_s {
957#ifdef __BIG_ENDIAN_BITFIELD
958 uint64_t reserved_63_63:1;
959 uint64_t crc:1;
960 uint64_t static_p:1;
961 uint64_t qos_mask:8;
962 uint64_t min_pkt:3;
963 uint64_t reserved_31_49:19;
964 uint64_t pipe:7;
965 uint64_t reserved_21_23:3;
966 uint64_t intr:5;
967 uint64_t reserved_13_15:3;
968 uint64_t eid:5;
969 uint64_t reserved_7_7:1;
970 uint64_t ipid:7;
971#else
972 uint64_t ipid:7;
973 uint64_t reserved_7_7:1;
974 uint64_t eid:5;
975 uint64_t reserved_13_15:3;
976 uint64_t intr:5;
977 uint64_t reserved_21_23:3;
978 uint64_t pipe:7;
979 uint64_t reserved_31_49:19;
980 uint64_t min_pkt:3;
981 uint64_t qos_mask:8;
982 uint64_t static_p:1;
983 uint64_t crc:1;
984 uint64_t reserved_63_63:1;
985#endif
986 } s;
987};
988
989union cvmx_pko_mem_iport_qos {
990 uint64_t u64;
991 struct cvmx_pko_mem_iport_qos_s {
992#ifdef __BIG_ENDIAN_BITFIELD
993 uint64_t reserved_61_63:3;
994 uint64_t qos_mask:8;
995 uint64_t reserved_13_52:40;
996 uint64_t eid:5;
997 uint64_t reserved_7_7:1;
998 uint64_t ipid:7;
999#else
1000 uint64_t ipid:7;
1001 uint64_t reserved_7_7:1;
1002 uint64_t eid:5;
1003 uint64_t reserved_13_52:40;
1004 uint64_t qos_mask:8;
1005 uint64_t reserved_61_63:3;
1006#endif
1007 } s;
1008};
1009
1010union cvmx_pko_mem_iqueue_ptrs {
1011 uint64_t u64;
1012 struct cvmx_pko_mem_iqueue_ptrs_s {
1013#ifdef __BIG_ENDIAN_BITFIELD
1014 uint64_t s_tail:1;
1015 uint64_t static_p:1;
1016 uint64_t static_q:1;
1017 uint64_t qos_mask:8;
1018 uint64_t buf_ptr:31;
1019 uint64_t tail:1;
1020 uint64_t index:5;
1021 uint64_t reserved_15_15:1;
1022 uint64_t ipid:7;
1023 uint64_t qid:8;
1024#else
1025 uint64_t qid:8;
1026 uint64_t ipid:7;
1027 uint64_t reserved_15_15:1;
1028 uint64_t index:5;
1029 uint64_t tail:1;
1030 uint64_t buf_ptr:31;
1031 uint64_t qos_mask:8;
1032 uint64_t static_q:1;
1033 uint64_t static_p:1;
1034 uint64_t s_tail:1;
1035#endif
1036 } s;
1037};
1038
1039union cvmx_pko_mem_iqueue_qos {
1040 uint64_t u64;
1041 struct cvmx_pko_mem_iqueue_qos_s {
1042#ifdef __BIG_ENDIAN_BITFIELD
1043 uint64_t reserved_61_63:3;
1044 uint64_t qos_mask:8;
1045 uint64_t reserved_15_52:38;
1046 uint64_t ipid:7;
1047 uint64_t qid:8;
1048#else
1049 uint64_t qid:8;
1050 uint64_t ipid:7;
1051 uint64_t reserved_15_52:38;
1052 uint64_t qos_mask:8;
1053 uint64_t reserved_61_63:3;
1054#endif
1055 } s;
1056};
1057
1058union cvmx_pko_mem_port_ptrs {
1059 uint64_t u64;
1060 struct cvmx_pko_mem_port_ptrs_s {
1061#ifdef __BIG_ENDIAN_BITFIELD
1062 uint64_t reserved_62_63:2;
1063 uint64_t static_p:1;
1064 uint64_t qos_mask:8;
1065 uint64_t reserved_16_52:37;
1066 uint64_t bp_port:6;
1067 uint64_t eid:4;
1068 uint64_t pid:6;
1069#else
1070 uint64_t pid:6;
1071 uint64_t eid:4;
1072 uint64_t bp_port:6;
1073 uint64_t reserved_16_52:37;
1074 uint64_t qos_mask:8;
1075 uint64_t static_p:1;
1076 uint64_t reserved_62_63:2;
1077#endif
1078 } s;
1079};
1080
1081union cvmx_pko_mem_port_qos {
1082 uint64_t u64;
1083 struct cvmx_pko_mem_port_qos_s {
1084#ifdef __BIG_ENDIAN_BITFIELD
1085 uint64_t reserved_61_63:3;
1086 uint64_t qos_mask:8;
1087 uint64_t reserved_10_52:43;
1088 uint64_t eid:4;
1089 uint64_t pid:6;
1090#else
1091 uint64_t pid:6;
1092 uint64_t eid:4;
1093 uint64_t reserved_10_52:43;
1094 uint64_t qos_mask:8;
1095 uint64_t reserved_61_63:3;
1096#endif
1097 } s;
1098};
1099
1100union cvmx_pko_mem_port_rate0 {
1101 uint64_t u64;
1102 struct cvmx_pko_mem_port_rate0_s {
1103#ifdef __BIG_ENDIAN_BITFIELD
1104 uint64_t reserved_51_63:13;
1105 uint64_t rate_word:19;
1106 uint64_t rate_pkt:24;
1107 uint64_t reserved_7_7:1;
1108 uint64_t pid:7;
1109#else
1110 uint64_t pid:7;
1111 uint64_t reserved_7_7:1;
1112 uint64_t rate_pkt:24;
1113 uint64_t rate_word:19;
1114 uint64_t reserved_51_63:13;
1115#endif
1116 } s;
1117 struct cvmx_pko_mem_port_rate0_cn52xx {
1118#ifdef __BIG_ENDIAN_BITFIELD
1119 uint64_t reserved_51_63:13;
1120 uint64_t rate_word:19;
1121 uint64_t rate_pkt:24;
1122 uint64_t reserved_6_7:2;
1123 uint64_t pid:6;
1124#else
1125 uint64_t pid:6;
1126 uint64_t reserved_6_7:2;
1127 uint64_t rate_pkt:24;
1128 uint64_t rate_word:19;
1129 uint64_t reserved_51_63:13;
1130#endif
1131 } cn52xx;
1132};
1133
1134union cvmx_pko_mem_port_rate1 {
1135 uint64_t u64;
1136 struct cvmx_pko_mem_port_rate1_s {
1137#ifdef __BIG_ENDIAN_BITFIELD
1138 uint64_t reserved_32_63:32;
1139 uint64_t rate_lim:24;
1140 uint64_t reserved_7_7:1;
1141 uint64_t pid:7;
1142#else
1143 uint64_t pid:7;
1144 uint64_t reserved_7_7:1;
1145 uint64_t rate_lim:24;
1146 uint64_t reserved_32_63:32;
1147#endif
1148 } s;
1149 struct cvmx_pko_mem_port_rate1_cn52xx {
1150#ifdef __BIG_ENDIAN_BITFIELD
1151 uint64_t reserved_32_63:32;
1152 uint64_t rate_lim:24;
1153 uint64_t reserved_6_7:2;
1154 uint64_t pid:6;
1155#else
1156 uint64_t pid:6;
1157 uint64_t reserved_6_7:2;
1158 uint64_t rate_lim:24;
1159 uint64_t reserved_32_63:32;
1160#endif
1161 } cn52xx;
1162};
1163
1164union cvmx_pko_mem_queue_ptrs {
1165 uint64_t u64;
1166 struct cvmx_pko_mem_queue_ptrs_s {
1167#ifdef __BIG_ENDIAN_BITFIELD
1168 uint64_t s_tail:1;
1169 uint64_t static_p:1;
1170 uint64_t static_q:1;
1171 uint64_t qos_mask:8;
1172 uint64_t buf_ptr:36;
1173 uint64_t tail:1;
1174 uint64_t index:3;
1175 uint64_t port:6;
1176 uint64_t queue:7;
1177#else
1178 uint64_t queue:7;
1179 uint64_t port:6;
1180 uint64_t index:3;
1181 uint64_t tail:1;
1182 uint64_t buf_ptr:36;
1183 uint64_t qos_mask:8;
1184 uint64_t static_q:1;
1185 uint64_t static_p:1;
1186 uint64_t s_tail:1;
1187#endif
1188 } s;
1189};
1190
1191union cvmx_pko_mem_queue_qos {
1192 uint64_t u64;
1193 struct cvmx_pko_mem_queue_qos_s {
1194#ifdef __BIG_ENDIAN_BITFIELD
1195 uint64_t reserved_61_63:3;
1196 uint64_t qos_mask:8;
1197 uint64_t reserved_13_52:40;
1198 uint64_t pid:6;
1199 uint64_t qid:7;
1200#else
1201 uint64_t qid:7;
1202 uint64_t pid:6;
1203 uint64_t reserved_13_52:40;
1204 uint64_t qos_mask:8;
1205 uint64_t reserved_61_63:3;
1206#endif
1207 } s;
1208};
1209
1210union cvmx_pko_mem_throttle_int {
1211 uint64_t u64;
1212 struct cvmx_pko_mem_throttle_int_s {
1213#ifdef __BIG_ENDIAN_BITFIELD
1214 uint64_t reserved_47_63:17;
1215 uint64_t word:15;
1216 uint64_t reserved_14_31:18;
1217 uint64_t packet:6;
1218 uint64_t reserved_5_7:3;
1219 uint64_t intr:5;
1220#else
1221 uint64_t intr:5;
1222 uint64_t reserved_5_7:3;
1223 uint64_t packet:6;
1224 uint64_t reserved_14_31:18;
1225 uint64_t word:15;
1226 uint64_t reserved_47_63:17;
1227#endif
1228 } s;
1229};
1230
1231union cvmx_pko_mem_throttle_pipe {
1232 uint64_t u64;
1233 struct cvmx_pko_mem_throttle_pipe_s {
1234#ifdef __BIG_ENDIAN_BITFIELD
1235 uint64_t reserved_47_63:17;
1236 uint64_t word:15;
1237 uint64_t reserved_14_31:18;
1238 uint64_t packet:6;
1239 uint64_t reserved_7_7:1;
1240 uint64_t pipe:7;
1241#else
1242 uint64_t pipe:7;
1243 uint64_t reserved_7_7:1;
1244 uint64_t packet:6;
1245 uint64_t reserved_14_31:18;
1246 uint64_t word:15;
1247 uint64_t reserved_47_63:17;
1248#endif
1249 } s;
1250};
1251
1252union cvmx_pko_reg_bist_result {
1253 uint64_t u64;
1254 struct cvmx_pko_reg_bist_result_s {
1255#ifdef __BIG_ENDIAN_BITFIELD
1256 uint64_t reserved_0_63:64;
1257#else
1258 uint64_t reserved_0_63:64;
1259#endif
1260 } s;
1261 struct cvmx_pko_reg_bist_result_cn30xx {
1262#ifdef __BIG_ENDIAN_BITFIELD
1263 uint64_t reserved_27_63:37;
1264 uint64_t psb2:5;
1265 uint64_t count:1;
1266 uint64_t rif:1;
1267 uint64_t wif:1;
1268 uint64_t ncb:1;
1269 uint64_t out:1;
1270 uint64_t crc:1;
1271 uint64_t chk:1;
1272 uint64_t qsb:2;
1273 uint64_t qcb:2;
1274 uint64_t pdb:4;
1275 uint64_t psb:7;
1276#else
1277 uint64_t psb:7;
1278 uint64_t pdb:4;
1279 uint64_t qcb:2;
1280 uint64_t qsb:2;
1281 uint64_t chk:1;
1282 uint64_t crc:1;
1283 uint64_t out:1;
1284 uint64_t ncb:1;
1285 uint64_t wif:1;
1286 uint64_t rif:1;
1287 uint64_t count:1;
1288 uint64_t psb2:5;
1289 uint64_t reserved_27_63:37;
1290#endif
1291 } cn30xx;
1292 struct cvmx_pko_reg_bist_result_cn50xx {
1293#ifdef __BIG_ENDIAN_BITFIELD
1294 uint64_t reserved_33_63:31;
1295 uint64_t csr:1;
1296 uint64_t iob:1;
1297 uint64_t out_crc:1;
1298 uint64_t out_ctl:3;
1299 uint64_t out_sta:1;
1300 uint64_t out_wif:1;
1301 uint64_t prt_chk:3;
1302 uint64_t prt_nxt:1;
1303 uint64_t prt_psb:6;
1304 uint64_t ncb_inb:2;
1305 uint64_t prt_qcb:2;
1306 uint64_t prt_qsb:3;
1307 uint64_t dat_dat:4;
1308 uint64_t dat_ptr:4;
1309#else
1310 uint64_t dat_ptr:4;
1311 uint64_t dat_dat:4;
1312 uint64_t prt_qsb:3;
1313 uint64_t prt_qcb:2;
1314 uint64_t ncb_inb:2;
1315 uint64_t prt_psb:6;
1316 uint64_t prt_nxt:1;
1317 uint64_t prt_chk:3;
1318 uint64_t out_wif:1;
1319 uint64_t out_sta:1;
1320 uint64_t out_ctl:3;
1321 uint64_t out_crc:1;
1322 uint64_t iob:1;
1323 uint64_t csr:1;
1324 uint64_t reserved_33_63:31;
1325#endif
1326 } cn50xx;
1327 struct cvmx_pko_reg_bist_result_cn52xx {
1328#ifdef __BIG_ENDIAN_BITFIELD
1329 uint64_t reserved_35_63:29;
1330 uint64_t csr:1;
1331 uint64_t iob:1;
1332 uint64_t out_dat:1;
1333 uint64_t out_ctl:3;
1334 uint64_t out_sta:1;
1335 uint64_t out_wif:1;
1336 uint64_t prt_chk:3;
1337 uint64_t prt_nxt:1;
1338 uint64_t prt_psb:8;
1339 uint64_t ncb_inb:2;
1340 uint64_t prt_qcb:2;
1341 uint64_t prt_qsb:3;
1342 uint64_t prt_ctl:2;
1343 uint64_t dat_dat:2;
1344 uint64_t dat_ptr:4;
1345#else
1346 uint64_t dat_ptr:4;
1347 uint64_t dat_dat:2;
1348 uint64_t prt_ctl:2;
1349 uint64_t prt_qsb:3;
1350 uint64_t prt_qcb:2;
1351 uint64_t ncb_inb:2;
1352 uint64_t prt_psb:8;
1353 uint64_t prt_nxt:1;
1354 uint64_t prt_chk:3;
1355 uint64_t out_wif:1;
1356 uint64_t out_sta:1;
1357 uint64_t out_ctl:3;
1358 uint64_t out_dat:1;
1359 uint64_t iob:1;
1360 uint64_t csr:1;
1361 uint64_t reserved_35_63:29;
1362#endif
1363 } cn52xx;
1364 struct cvmx_pko_reg_bist_result_cn68xx {
1365#ifdef __BIG_ENDIAN_BITFIELD
1366 uint64_t reserved_36_63:28;
1367 uint64_t crc:1;
1368 uint64_t csr:1;
1369 uint64_t iob:1;
1370 uint64_t out_dat:1;
1371 uint64_t reserved_31_31:1;
1372 uint64_t out_ctl:2;
1373 uint64_t out_sta:1;
1374 uint64_t out_wif:1;
1375 uint64_t prt_chk:3;
1376 uint64_t prt_nxt:1;
1377 uint64_t prt_psb7:1;
1378 uint64_t reserved_21_21:1;
1379 uint64_t prt_psb:6;
1380 uint64_t ncb_inb:2;
1381 uint64_t prt_qcb:2;
1382 uint64_t prt_qsb:3;
1383 uint64_t prt_ctl:2;
1384 uint64_t dat_dat:2;
1385 uint64_t dat_ptr:4;
1386#else
1387 uint64_t dat_ptr:4;
1388 uint64_t dat_dat:2;
1389 uint64_t prt_ctl:2;
1390 uint64_t prt_qsb:3;
1391 uint64_t prt_qcb:2;
1392 uint64_t ncb_inb:2;
1393 uint64_t prt_psb:6;
1394 uint64_t reserved_21_21:1;
1395 uint64_t prt_psb7:1;
1396 uint64_t prt_nxt:1;
1397 uint64_t prt_chk:3;
1398 uint64_t out_wif:1;
1399 uint64_t out_sta:1;
1400 uint64_t out_ctl:2;
1401 uint64_t reserved_31_31:1;
1402 uint64_t out_dat:1;
1403 uint64_t iob:1;
1404 uint64_t csr:1;
1405 uint64_t crc:1;
1406 uint64_t reserved_36_63:28;
1407#endif
1408 } cn68xx;
1409 struct cvmx_pko_reg_bist_result_cn68xxp1 {
1410#ifdef __BIG_ENDIAN_BITFIELD
1411 uint64_t reserved_35_63:29;
1412 uint64_t csr:1;
1413 uint64_t iob:1;
1414 uint64_t out_dat:1;
1415 uint64_t reserved_31_31:1;
1416 uint64_t out_ctl:2;
1417 uint64_t out_sta:1;
1418 uint64_t out_wif:1;
1419 uint64_t prt_chk:3;
1420 uint64_t prt_nxt:1;
1421 uint64_t prt_psb7:1;
1422 uint64_t reserved_21_21:1;
1423 uint64_t prt_psb:6;
1424 uint64_t ncb_inb:2;
1425 uint64_t prt_qcb:2;
1426 uint64_t prt_qsb:3;
1427 uint64_t prt_ctl:2;
1428 uint64_t dat_dat:2;
1429 uint64_t dat_ptr:4;
1430#else
1431 uint64_t dat_ptr:4;
1432 uint64_t dat_dat:2;
1433 uint64_t prt_ctl:2;
1434 uint64_t prt_qsb:3;
1435 uint64_t prt_qcb:2;
1436 uint64_t ncb_inb:2;
1437 uint64_t prt_psb:6;
1438 uint64_t reserved_21_21:1;
1439 uint64_t prt_psb7:1;
1440 uint64_t prt_nxt:1;
1441 uint64_t prt_chk:3;
1442 uint64_t out_wif:1;
1443 uint64_t out_sta:1;
1444 uint64_t out_ctl:2;
1445 uint64_t reserved_31_31:1;
1446 uint64_t out_dat:1;
1447 uint64_t iob:1;
1448 uint64_t csr:1;
1449 uint64_t reserved_35_63:29;
1450#endif
1451 } cn68xxp1;
1452};
1453
1454union cvmx_pko_reg_cmd_buf {
1455 uint64_t u64;
1456 struct cvmx_pko_reg_cmd_buf_s {
1457#ifdef __BIG_ENDIAN_BITFIELD
1458 uint64_t reserved_23_63:41;
1459 uint64_t pool:3;
1460 uint64_t reserved_13_19:7;
1461 uint64_t size:13;
1462#else
1463 uint64_t size:13;
1464 uint64_t reserved_13_19:7;
1465 uint64_t pool:3;
1466 uint64_t reserved_23_63:41;
1467#endif
1468 } s;
1469};
1470
1471union cvmx_pko_reg_crc_ctlx {
1472 uint64_t u64;
1473 struct cvmx_pko_reg_crc_ctlx_s {
1474#ifdef __BIG_ENDIAN_BITFIELD
1475 uint64_t reserved_2_63:62;
1476 uint64_t invres:1;
1477 uint64_t refin:1;
1478#else
1479 uint64_t refin:1;
1480 uint64_t invres:1;
1481 uint64_t reserved_2_63:62;
1482#endif
1483 } s;
1484};
1485
1486union cvmx_pko_reg_crc_enable {
1487 uint64_t u64;
1488 struct cvmx_pko_reg_crc_enable_s {
1489#ifdef __BIG_ENDIAN_BITFIELD
1490 uint64_t reserved_32_63:32;
1491 uint64_t enable:32;
1492#else
1493 uint64_t enable:32;
1494 uint64_t reserved_32_63:32;
1495#endif
1496 } s;
1497};
1498
1499union cvmx_pko_reg_crc_ivx {
1500 uint64_t u64;
1501 struct cvmx_pko_reg_crc_ivx_s {
1502#ifdef __BIG_ENDIAN_BITFIELD
1503 uint64_t reserved_32_63:32;
1504 uint64_t iv:32;
1505#else
1506 uint64_t iv:32;
1507 uint64_t reserved_32_63:32;
1508#endif
1509 } s;
1510};
1511
1512union cvmx_pko_reg_debug0 {
1513 uint64_t u64;
1514 struct cvmx_pko_reg_debug0_s {
1515#ifdef __BIG_ENDIAN_BITFIELD
1516 uint64_t asserts:64;
1517#else
1518 uint64_t asserts:64;
1519#endif
1520 } s;
1521 struct cvmx_pko_reg_debug0_cn30xx {
1522#ifdef __BIG_ENDIAN_BITFIELD
1523 uint64_t reserved_17_63:47;
1524 uint64_t asserts:17;
1525#else
1526 uint64_t asserts:17;
1527 uint64_t reserved_17_63:47;
1528#endif
1529 } cn30xx;
1530};
1531
1532union cvmx_pko_reg_debug1 {
1533 uint64_t u64;
1534 struct cvmx_pko_reg_debug1_s {
1535#ifdef __BIG_ENDIAN_BITFIELD
1536 uint64_t asserts:64;
1537#else
1538 uint64_t asserts:64;
1539#endif
1540 } s;
1541};
1542
1543union cvmx_pko_reg_debug2 {
1544 uint64_t u64;
1545 struct cvmx_pko_reg_debug2_s {
1546#ifdef __BIG_ENDIAN_BITFIELD
1547 uint64_t asserts:64;
1548#else
1549 uint64_t asserts:64;
1550#endif
1551 } s;
1552};
1553
1554union cvmx_pko_reg_debug3 {
1555 uint64_t u64;
1556 struct cvmx_pko_reg_debug3_s {
1557#ifdef __BIG_ENDIAN_BITFIELD
1558 uint64_t asserts:64;
1559#else
1560 uint64_t asserts:64;
1561#endif
1562 } s;
1563};
1564
1565union cvmx_pko_reg_debug4 {
1566 uint64_t u64;
1567 struct cvmx_pko_reg_debug4_s {
1568#ifdef __BIG_ENDIAN_BITFIELD
1569 uint64_t asserts:64;
1570#else
1571 uint64_t asserts:64;
1572#endif
1573 } s;
1574};
1575
1576union cvmx_pko_reg_engine_inflight {
1577 uint64_t u64;
1578 struct cvmx_pko_reg_engine_inflight_s {
1579#ifdef __BIG_ENDIAN_BITFIELD
1580 uint64_t engine15:4;
1581 uint64_t engine14:4;
1582 uint64_t engine13:4;
1583 uint64_t engine12:4;
1584 uint64_t engine11:4;
1585 uint64_t engine10:4;
1586 uint64_t engine9:4;
1587 uint64_t engine8:4;
1588 uint64_t engine7:4;
1589 uint64_t engine6:4;
1590 uint64_t engine5:4;
1591 uint64_t engine4:4;
1592 uint64_t engine3:4;
1593 uint64_t engine2:4;
1594 uint64_t engine1:4;
1595 uint64_t engine0:4;
1596#else
1597 uint64_t engine0:4;
1598 uint64_t engine1:4;
1599 uint64_t engine2:4;
1600 uint64_t engine3:4;
1601 uint64_t engine4:4;
1602 uint64_t engine5:4;
1603 uint64_t engine6:4;
1604 uint64_t engine7:4;
1605 uint64_t engine8:4;
1606 uint64_t engine9:4;
1607 uint64_t engine10:4;
1608 uint64_t engine11:4;
1609 uint64_t engine12:4;
1610 uint64_t engine13:4;
1611 uint64_t engine14:4;
1612 uint64_t engine15:4;
1613#endif
1614 } s;
1615 struct cvmx_pko_reg_engine_inflight_cn52xx {
1616#ifdef __BIG_ENDIAN_BITFIELD
1617 uint64_t reserved_40_63:24;
1618 uint64_t engine9:4;
1619 uint64_t engine8:4;
1620 uint64_t engine7:4;
1621 uint64_t engine6:4;
1622 uint64_t engine5:4;
1623 uint64_t engine4:4;
1624 uint64_t engine3:4;
1625 uint64_t engine2:4;
1626 uint64_t engine1:4;
1627 uint64_t engine0:4;
1628#else
1629 uint64_t engine0:4;
1630 uint64_t engine1:4;
1631 uint64_t engine2:4;
1632 uint64_t engine3:4;
1633 uint64_t engine4:4;
1634 uint64_t engine5:4;
1635 uint64_t engine6:4;
1636 uint64_t engine7:4;
1637 uint64_t engine8:4;
1638 uint64_t engine9:4;
1639 uint64_t reserved_40_63:24;
1640#endif
1641 } cn52xx;
1642 struct cvmx_pko_reg_engine_inflight_cn61xx {
1643#ifdef __BIG_ENDIAN_BITFIELD
1644 uint64_t reserved_56_63:8;
1645 uint64_t engine13:4;
1646 uint64_t engine12:4;
1647 uint64_t engine11:4;
1648 uint64_t engine10:4;
1649 uint64_t engine9:4;
1650 uint64_t engine8:4;
1651 uint64_t engine7:4;
1652 uint64_t engine6:4;
1653 uint64_t engine5:4;
1654 uint64_t engine4:4;
1655 uint64_t engine3:4;
1656 uint64_t engine2:4;
1657 uint64_t engine1:4;
1658 uint64_t engine0:4;
1659#else
1660 uint64_t engine0:4;
1661 uint64_t engine1:4;
1662 uint64_t engine2:4;
1663 uint64_t engine3:4;
1664 uint64_t engine4:4;
1665 uint64_t engine5:4;
1666 uint64_t engine6:4;
1667 uint64_t engine7:4;
1668 uint64_t engine8:4;
1669 uint64_t engine9:4;
1670 uint64_t engine10:4;
1671 uint64_t engine11:4;
1672 uint64_t engine12:4;
1673 uint64_t engine13:4;
1674 uint64_t reserved_56_63:8;
1675#endif
1676 } cn61xx;
1677 struct cvmx_pko_reg_engine_inflight_cn63xx {
1678#ifdef __BIG_ENDIAN_BITFIELD
1679 uint64_t reserved_48_63:16;
1680 uint64_t engine11:4;
1681 uint64_t engine10:4;
1682 uint64_t engine9:4;
1683 uint64_t engine8:4;
1684 uint64_t engine7:4;
1685 uint64_t engine6:4;
1686 uint64_t engine5:4;
1687 uint64_t engine4:4;
1688 uint64_t engine3:4;
1689 uint64_t engine2:4;
1690 uint64_t engine1:4;
1691 uint64_t engine0:4;
1692#else
1693 uint64_t engine0:4;
1694 uint64_t engine1:4;
1695 uint64_t engine2:4;
1696 uint64_t engine3:4;
1697 uint64_t engine4:4;
1698 uint64_t engine5:4;
1699 uint64_t engine6:4;
1700 uint64_t engine7:4;
1701 uint64_t engine8:4;
1702 uint64_t engine9:4;
1703 uint64_t engine10:4;
1704 uint64_t engine11:4;
1705 uint64_t reserved_48_63:16;
1706#endif
1707 } cn63xx;
1708};
1709
1710union cvmx_pko_reg_engine_inflight1 {
1711 uint64_t u64;
1712 struct cvmx_pko_reg_engine_inflight1_s {
1713#ifdef __BIG_ENDIAN_BITFIELD
1714 uint64_t reserved_16_63:48;
1715 uint64_t engine19:4;
1716 uint64_t engine18:4;
1717 uint64_t engine17:4;
1718 uint64_t engine16:4;
1719#else
1720 uint64_t engine16:4;
1721 uint64_t engine17:4;
1722 uint64_t engine18:4;
1723 uint64_t engine19:4;
1724 uint64_t reserved_16_63:48;
1725#endif
1726 } s;
1727};
1728
1729union cvmx_pko_reg_engine_storagex {
1730 uint64_t u64;
1731 struct cvmx_pko_reg_engine_storagex_s {
1732#ifdef __BIG_ENDIAN_BITFIELD
1733 uint64_t engine15:4;
1734 uint64_t engine14:4;
1735 uint64_t engine13:4;
1736 uint64_t engine12:4;
1737 uint64_t engine11:4;
1738 uint64_t engine10:4;
1739 uint64_t engine9:4;
1740 uint64_t engine8:4;
1741 uint64_t engine7:4;
1742 uint64_t engine6:4;
1743 uint64_t engine5:4;
1744 uint64_t engine4:4;
1745 uint64_t engine3:4;
1746 uint64_t engine2:4;
1747 uint64_t engine1:4;
1748 uint64_t engine0:4;
1749#else
1750 uint64_t engine0:4;
1751 uint64_t engine1:4;
1752 uint64_t engine2:4;
1753 uint64_t engine3:4;
1754 uint64_t engine4:4;
1755 uint64_t engine5:4;
1756 uint64_t engine6:4;
1757 uint64_t engine7:4;
1758 uint64_t engine8:4;
1759 uint64_t engine9:4;
1760 uint64_t engine10:4;
1761 uint64_t engine11:4;
1762 uint64_t engine12:4;
1763 uint64_t engine13:4;
1764 uint64_t engine14:4;
1765 uint64_t engine15:4;
1766#endif
1767 } s;
1768};
1769
1770union cvmx_pko_reg_engine_thresh {
1771 uint64_t u64;
1772 struct cvmx_pko_reg_engine_thresh_s {
1773#ifdef __BIG_ENDIAN_BITFIELD
1774 uint64_t reserved_20_63:44;
1775 uint64_t mask:20;
1776#else
1777 uint64_t mask:20;
1778 uint64_t reserved_20_63:44;
1779#endif
1780 } s;
1781 struct cvmx_pko_reg_engine_thresh_cn52xx {
1782#ifdef __BIG_ENDIAN_BITFIELD
1783 uint64_t reserved_10_63:54;
1784 uint64_t mask:10;
1785#else
1786 uint64_t mask:10;
1787 uint64_t reserved_10_63:54;
1788#endif
1789 } cn52xx;
1790 struct cvmx_pko_reg_engine_thresh_cn61xx {
1791#ifdef __BIG_ENDIAN_BITFIELD
1792 uint64_t reserved_14_63:50;
1793 uint64_t mask:14;
1794#else
1795 uint64_t mask:14;
1796 uint64_t reserved_14_63:50;
1797#endif
1798 } cn61xx;
1799 struct cvmx_pko_reg_engine_thresh_cn63xx {
1800#ifdef __BIG_ENDIAN_BITFIELD
1801 uint64_t reserved_12_63:52;
1802 uint64_t mask:12;
1803#else
1804 uint64_t mask:12;
1805 uint64_t reserved_12_63:52;
1806#endif
1807 } cn63xx;
1808};
1809
1810union cvmx_pko_reg_error {
1811 uint64_t u64;
1812 struct cvmx_pko_reg_error_s {
1813#ifdef __BIG_ENDIAN_BITFIELD
1814 uint64_t reserved_4_63:60;
1815 uint64_t loopback:1;
1816 uint64_t currzero:1;
1817 uint64_t doorbell:1;
1818 uint64_t parity:1;
1819#else
1820 uint64_t parity:1;
1821 uint64_t doorbell:1;
1822 uint64_t currzero:1;
1823 uint64_t loopback:1;
1824 uint64_t reserved_4_63:60;
1825#endif
1826 } s;
1827 struct cvmx_pko_reg_error_cn30xx {
1828#ifdef __BIG_ENDIAN_BITFIELD
1829 uint64_t reserved_2_63:62;
1830 uint64_t doorbell:1;
1831 uint64_t parity:1;
1832#else
1833 uint64_t parity:1;
1834 uint64_t doorbell:1;
1835 uint64_t reserved_2_63:62;
1836#endif
1837 } cn30xx;
1838 struct cvmx_pko_reg_error_cn50xx {
1839#ifdef __BIG_ENDIAN_BITFIELD
1840 uint64_t reserved_3_63:61;
1841 uint64_t currzero:1;
1842 uint64_t doorbell:1;
1843 uint64_t parity:1;
1844#else
1845 uint64_t parity:1;
1846 uint64_t doorbell:1;
1847 uint64_t currzero:1;
1848 uint64_t reserved_3_63:61;
1849#endif
1850 } cn50xx;
1851};
1852
1853union cvmx_pko_reg_flags {
1854 uint64_t u64;
1855 struct cvmx_pko_reg_flags_s {
1856#ifdef __BIG_ENDIAN_BITFIELD
1857 uint64_t reserved_9_63:55;
1858 uint64_t dis_perf3:1;
1859 uint64_t dis_perf2:1;
1860 uint64_t dis_perf1:1;
1861 uint64_t dis_perf0:1;
1862 uint64_t ena_throttle:1;
1863 uint64_t reset:1;
1864 uint64_t store_be:1;
1865 uint64_t ena_dwb:1;
1866 uint64_t ena_pko:1;
1867#else
1868 uint64_t ena_pko:1;
1869 uint64_t ena_dwb:1;
1870 uint64_t store_be:1;
1871 uint64_t reset:1;
1872 uint64_t ena_throttle:1;
1873 uint64_t dis_perf0:1;
1874 uint64_t dis_perf1:1;
1875 uint64_t dis_perf2:1;
1876 uint64_t dis_perf3:1;
1877 uint64_t reserved_9_63:55;
1878#endif
1879 } s;
1880 struct cvmx_pko_reg_flags_cn30xx {
1881#ifdef __BIG_ENDIAN_BITFIELD
1882 uint64_t reserved_4_63:60;
1883 uint64_t reset:1;
1884 uint64_t store_be:1;
1885 uint64_t ena_dwb:1;
1886 uint64_t ena_pko:1;
1887#else
1888 uint64_t ena_pko:1;
1889 uint64_t ena_dwb:1;
1890 uint64_t store_be:1;
1891 uint64_t reset:1;
1892 uint64_t reserved_4_63:60;
1893#endif
1894 } cn30xx;
1895 struct cvmx_pko_reg_flags_cn61xx {
1896#ifdef __BIG_ENDIAN_BITFIELD
1897 uint64_t reserved_9_63:55;
1898 uint64_t dis_perf3:1;
1899 uint64_t dis_perf2:1;
1900 uint64_t reserved_4_6:3;
1901 uint64_t reset:1;
1902 uint64_t store_be:1;
1903 uint64_t ena_dwb:1;
1904 uint64_t ena_pko:1;
1905#else
1906 uint64_t ena_pko:1;
1907 uint64_t ena_dwb:1;
1908 uint64_t store_be:1;
1909 uint64_t reset:1;
1910 uint64_t reserved_4_6:3;
1911 uint64_t dis_perf2:1;
1912 uint64_t dis_perf3:1;
1913 uint64_t reserved_9_63:55;
1914#endif
1915 } cn61xx;
1916 struct cvmx_pko_reg_flags_cn68xxp1 {
1917#ifdef __BIG_ENDIAN_BITFIELD
1918 uint64_t reserved_7_63:57;
1919 uint64_t dis_perf1:1;
1920 uint64_t dis_perf0:1;
1921 uint64_t ena_throttle:1;
1922 uint64_t reset:1;
1923 uint64_t store_be:1;
1924 uint64_t ena_dwb:1;
1925 uint64_t ena_pko:1;
1926#else
1927 uint64_t ena_pko:1;
1928 uint64_t ena_dwb:1;
1929 uint64_t store_be:1;
1930 uint64_t reset:1;
1931 uint64_t ena_throttle:1;
1932 uint64_t dis_perf0:1;
1933 uint64_t dis_perf1:1;
1934 uint64_t reserved_7_63:57;
1935#endif
1936 } cn68xxp1;
1937};
1938
1939union cvmx_pko_reg_gmx_port_mode {
1940 uint64_t u64;
1941 struct cvmx_pko_reg_gmx_port_mode_s {
1942#ifdef __BIG_ENDIAN_BITFIELD
1943 uint64_t reserved_6_63:58;
1944 uint64_t mode1:3;
1945 uint64_t mode0:3;
1946#else
1947 uint64_t mode0:3;
1948 uint64_t mode1:3;
1949 uint64_t reserved_6_63:58;
1950#endif
1951 } s;
1952};
1953
1954union cvmx_pko_reg_int_mask {
1955 uint64_t u64;
1956 struct cvmx_pko_reg_int_mask_s {
1957#ifdef __BIG_ENDIAN_BITFIELD
1958 uint64_t reserved_4_63:60;
1959 uint64_t loopback:1;
1960 uint64_t currzero:1;
1961 uint64_t doorbell:1;
1962 uint64_t parity:1;
1963#else
1964 uint64_t parity:1;
1965 uint64_t doorbell:1;
1966 uint64_t currzero:1;
1967 uint64_t loopback:1;
1968 uint64_t reserved_4_63:60;
1969#endif
1970 } s;
1971 struct cvmx_pko_reg_int_mask_cn30xx {
1972#ifdef __BIG_ENDIAN_BITFIELD
1973 uint64_t reserved_2_63:62;
1974 uint64_t doorbell:1;
1975 uint64_t parity:1;
1976#else
1977 uint64_t parity:1;
1978 uint64_t doorbell:1;
1979 uint64_t reserved_2_63:62;
1980#endif
1981 } cn30xx;
1982 struct cvmx_pko_reg_int_mask_cn50xx {
1983#ifdef __BIG_ENDIAN_BITFIELD
1984 uint64_t reserved_3_63:61;
1985 uint64_t currzero:1;
1986 uint64_t doorbell:1;
1987 uint64_t parity:1;
1988#else
1989 uint64_t parity:1;
1990 uint64_t doorbell:1;
1991 uint64_t currzero:1;
1992 uint64_t reserved_3_63:61;
1993#endif
1994 } cn50xx;
1995};
1996
1997union cvmx_pko_reg_loopback_bpid {
1998 uint64_t u64;
1999 struct cvmx_pko_reg_loopback_bpid_s {
2000#ifdef __BIG_ENDIAN_BITFIELD
2001 uint64_t reserved_59_63:5;
2002 uint64_t bpid7:6;
2003 uint64_t reserved_52_52:1;
2004 uint64_t bpid6:6;
2005 uint64_t reserved_45_45:1;
2006 uint64_t bpid5:6;
2007 uint64_t reserved_38_38:1;
2008 uint64_t bpid4:6;
2009 uint64_t reserved_31_31:1;
2010 uint64_t bpid3:6;
2011 uint64_t reserved_24_24:1;
2012 uint64_t bpid2:6;
2013 uint64_t reserved_17_17:1;
2014 uint64_t bpid1:6;
2015 uint64_t reserved_10_10:1;
2016 uint64_t bpid0:6;
2017 uint64_t reserved_0_3:4;
2018#else
2019 uint64_t reserved_0_3:4;
2020 uint64_t bpid0:6;
2021 uint64_t reserved_10_10:1;
2022 uint64_t bpid1:6;
2023 uint64_t reserved_17_17:1;
2024 uint64_t bpid2:6;
2025 uint64_t reserved_24_24:1;
2026 uint64_t bpid3:6;
2027 uint64_t reserved_31_31:1;
2028 uint64_t bpid4:6;
2029 uint64_t reserved_38_38:1;
2030 uint64_t bpid5:6;
2031 uint64_t reserved_45_45:1;
2032 uint64_t bpid6:6;
2033 uint64_t reserved_52_52:1;
2034 uint64_t bpid7:6;
2035 uint64_t reserved_59_63:5;
2036#endif
2037 } s;
2038};
2039
2040union cvmx_pko_reg_loopback_pkind {
2041 uint64_t u64;
2042 struct cvmx_pko_reg_loopback_pkind_s {
2043#ifdef __BIG_ENDIAN_BITFIELD
2044 uint64_t reserved_59_63:5;
2045 uint64_t pkind7:6;
2046 uint64_t reserved_52_52:1;
2047 uint64_t pkind6:6;
2048 uint64_t reserved_45_45:1;
2049 uint64_t pkind5:6;
2050 uint64_t reserved_38_38:1;
2051 uint64_t pkind4:6;
2052 uint64_t reserved_31_31:1;
2053 uint64_t pkind3:6;
2054 uint64_t reserved_24_24:1;
2055 uint64_t pkind2:6;
2056 uint64_t reserved_17_17:1;
2057 uint64_t pkind1:6;
2058 uint64_t reserved_10_10:1;
2059 uint64_t pkind0:6;
2060 uint64_t num_ports:4;
2061#else
2062 uint64_t num_ports:4;
2063 uint64_t pkind0:6;
2064 uint64_t reserved_10_10:1;
2065 uint64_t pkind1:6;
2066 uint64_t reserved_17_17:1;
2067 uint64_t pkind2:6;
2068 uint64_t reserved_24_24:1;
2069 uint64_t pkind3:6;
2070 uint64_t reserved_31_31:1;
2071 uint64_t pkind4:6;
2072 uint64_t reserved_38_38:1;
2073 uint64_t pkind5:6;
2074 uint64_t reserved_45_45:1;
2075 uint64_t pkind6:6;
2076 uint64_t reserved_52_52:1;
2077 uint64_t pkind7:6;
2078 uint64_t reserved_59_63:5;
2079#endif
2080 } s;
2081};
2082
2083union cvmx_pko_reg_min_pkt {
2084 uint64_t u64;
2085 struct cvmx_pko_reg_min_pkt_s {
2086#ifdef __BIG_ENDIAN_BITFIELD
2087 uint64_t size7:8;
2088 uint64_t size6:8;
2089 uint64_t size5:8;
2090 uint64_t size4:8;
2091 uint64_t size3:8;
2092 uint64_t size2:8;
2093 uint64_t size1:8;
2094 uint64_t size0:8;
2095#else
2096 uint64_t size0:8;
2097 uint64_t size1:8;
2098 uint64_t size2:8;
2099 uint64_t size3:8;
2100 uint64_t size4:8;
2101 uint64_t size5:8;
2102 uint64_t size6:8;
2103 uint64_t size7:8;
2104#endif
2105 } s;
2106};
2107
2108union cvmx_pko_reg_preempt {
2109 uint64_t u64;
2110 struct cvmx_pko_reg_preempt_s {
2111#ifdef __BIG_ENDIAN_BITFIELD
2112 uint64_t reserved_16_63:48;
2113 uint64_t min_size:16;
2114#else
2115 uint64_t min_size:16;
2116 uint64_t reserved_16_63:48;
2117#endif
2118 } s;
2119};
2120
2121union cvmx_pko_reg_queue_mode {
2122 uint64_t u64;
2123 struct cvmx_pko_reg_queue_mode_s {
2124#ifdef __BIG_ENDIAN_BITFIELD
2125 uint64_t reserved_2_63:62;
2126 uint64_t mode:2;
2127#else
2128 uint64_t mode:2;
2129 uint64_t reserved_2_63:62;
2130#endif
2131 } s;
2132};
2133
2134union cvmx_pko_reg_queue_preempt {
2135 uint64_t u64;
2136 struct cvmx_pko_reg_queue_preempt_s {
2137#ifdef __BIG_ENDIAN_BITFIELD
2138 uint64_t reserved_2_63:62;
2139 uint64_t preemptee:1;
2140 uint64_t preempter:1;
2141#else
2142 uint64_t preempter:1;
2143 uint64_t preemptee:1;
2144 uint64_t reserved_2_63:62;
2145#endif
2146 } s;
2147};
2148
2149union cvmx_pko_reg_queue_ptrs1 {
2150 uint64_t u64;
2151 struct cvmx_pko_reg_queue_ptrs1_s {
2152#ifdef __BIG_ENDIAN_BITFIELD
2153 uint64_t reserved_2_63:62;
2154 uint64_t idx3:1;
2155 uint64_t qid7:1;
2156#else
2157 uint64_t qid7:1;
2158 uint64_t idx3:1;
2159 uint64_t reserved_2_63:62;
2160#endif
2161 } s;
2162};
2163
2164union cvmx_pko_reg_read_idx {
2165 uint64_t u64;
2166 struct cvmx_pko_reg_read_idx_s {
2167#ifdef __BIG_ENDIAN_BITFIELD
2168 uint64_t reserved_16_63:48;
2169 uint64_t inc:8;
2170 uint64_t index:8;
2171#else
2172 uint64_t index:8;
2173 uint64_t inc:8;
2174 uint64_t reserved_16_63:48;
2175#endif
2176 } s;
2177};
2178
2179union cvmx_pko_reg_throttle {
2180 uint64_t u64;
2181 struct cvmx_pko_reg_throttle_s {
2182#ifdef __BIG_ENDIAN_BITFIELD
2183 uint64_t reserved_32_63:32;
2184 uint64_t int_mask:32;
2185#else
2186 uint64_t int_mask:32;
2187 uint64_t reserved_32_63:32;
2188#endif
2189 } s;
2190};
2191
2192union cvmx_pko_reg_timestamp {
2193 uint64_t u64;
2194 struct cvmx_pko_reg_timestamp_s {
2195#ifdef __BIG_ENDIAN_BITFIELD
2196 uint64_t reserved_4_63:60;
2197 uint64_t wqe_word:4;
2198#else
2199 uint64_t wqe_word:4;
2200 uint64_t reserved_4_63:60;
2201#endif
2202 } s;
2203};
2204
2205#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pko.h b/arch/mips/include/asm/octeon/cvmx-pko.h
new file mode 100644
index 000000000..03fb64b13
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pko.h
@@ -0,0 +1,643 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 *
30 * Interface to the hardware Packet Output unit.
31 *
32 * Starting with SDK 1.7.0, the PKO output functions now support
33 * two types of locking. CVMX_PKO_LOCK_ATOMIC_TAG continues to
34 * function similarly to previous SDKs by using POW atomic tags
35 * to preserve ordering and exclusivity. As a new option, you
36 * can now pass CVMX_PKO_LOCK_CMD_QUEUE which uses a ll/sc
37 * memory based locking instead. This locking has the advantage
38 * of not affecting the tag state but doesn't preserve packet
39 * ordering. CVMX_PKO_LOCK_CMD_QUEUE is appropriate in most
40 * generic code while CVMX_PKO_LOCK_CMD_QUEUE should be used
41 * with hand tuned fast path code.
42 *
43 * Some of other SDK differences visible to the command queuing:
44 * - PKO indexes are no longer stored in the FAU. A large
45 * percentage of the FAU register block used to be tied up
46 * maintaining PKO queue pointers. These are now stored in a
47 * global named block.
48 * - The PKO <b>use_locking</b> parameter can now have a global
49 * effect. Since all application use the same named block,
50 * queue locking correctly applies across all operating
51 * systems when using CVMX_PKO_LOCK_CMD_QUEUE.
52 * - PKO 3 word commands are now supported. Use
53 * cvmx_pko_send_packet_finish3().
54 *
55 */
56
57#ifndef __CVMX_PKO_H__
58#define __CVMX_PKO_H__
59
60#include <asm/octeon/cvmx-fpa.h>
61#include <asm/octeon/cvmx-pow.h>
62#include <asm/octeon/cvmx-cmd-queue.h>
63#include <asm/octeon/cvmx-pko-defs.h>
64
65/* Adjust the command buffer size by 1 word so that in the case of using only
66 * two word PKO commands no command words stradle buffers. The useful values
67 * for this are 0 and 1. */
68#define CVMX_PKO_COMMAND_BUFFER_SIZE_ADJUST (1)
69
70#define CVMX_PKO_MAX_OUTPUT_QUEUES_STATIC 256
71#define CVMX_PKO_MAX_OUTPUT_QUEUES ((OCTEON_IS_MODEL(OCTEON_CN31XX) || \
72 OCTEON_IS_MODEL(OCTEON_CN3010) || OCTEON_IS_MODEL(OCTEON_CN3005) || \
73 OCTEON_IS_MODEL(OCTEON_CN50XX)) ? 32 : \
74 (OCTEON_IS_MODEL(OCTEON_CN58XX) || \
75 OCTEON_IS_MODEL(OCTEON_CN56XX)) ? 256 : 128)
76#define CVMX_PKO_NUM_OUTPUT_PORTS 40
77/* use this for queues that are not used */
78#define CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID 63
79#define CVMX_PKO_QUEUE_STATIC_PRIORITY 9
80#define CVMX_PKO_ILLEGAL_QUEUE 0xFFFF
81#define CVMX_PKO_MAX_QUEUE_DEPTH 0
82
83typedef enum {
84 CVMX_PKO_SUCCESS,
85 CVMX_PKO_INVALID_PORT,
86 CVMX_PKO_INVALID_QUEUE,
87 CVMX_PKO_INVALID_PRIORITY,
88 CVMX_PKO_NO_MEMORY,
89 CVMX_PKO_PORT_ALREADY_SETUP,
90 CVMX_PKO_CMD_QUEUE_INIT_ERROR
91} cvmx_pko_status_t;
92
93/**
94 * This enumeration represents the differnet locking modes supported by PKO.
95 */
96typedef enum {
97 /*
98 * PKO doesn't do any locking. It is the responsibility of the
99 * application to make sure that no other core is accessing
100 * the same queue at the same time
101 */
102 CVMX_PKO_LOCK_NONE = 0,
103 /*
104 * PKO performs an atomic tagswitch to insure exclusive access
105 * to the output queue. This will maintain packet ordering on
106 * output.
107 */
108 CVMX_PKO_LOCK_ATOMIC_TAG = 1,
109 /*
110 * PKO uses the common command queue locks to insure exclusive
111 * access to the output queue. This is a memory based
112 * ll/sc. This is the most portable locking mechanism.
113 */
114 CVMX_PKO_LOCK_CMD_QUEUE = 2,
115} cvmx_pko_lock_t;
116
117typedef struct {
118 uint32_t packets;
119 uint64_t octets;
120 uint64_t doorbell;
121} cvmx_pko_port_status_t;
122
123/**
124 * This structure defines the address to use on a packet enqueue
125 */
126typedef union {
127 uint64_t u64;
128 struct {
129#ifdef __BIG_ENDIAN_BITFIELD
130 /* Must CVMX_IO_SEG */
131 uint64_t mem_space:2;
132 /* Must be zero */
133 uint64_t reserved:13;
134 /* Must be one */
135 uint64_t is_io:1;
136 /* The ID of the device on the non-coherent bus */
137 uint64_t did:8;
138 /* Must be zero */
139 uint64_t reserved2:4;
140 /* Must be zero */
141 uint64_t reserved3:18;
142 /*
143 * The hardware likes to have the output port in
144 * addition to the output queue,
145 */
146 uint64_t port:6;
147 /*
148 * The output queue to send the packet to (0-127 are
149 * legal)
150 */
151 uint64_t queue:9;
152 /* Must be zero */
153 uint64_t reserved4:3;
154#else
155 uint64_t reserved4:3;
156 uint64_t queue:9;
157 uint64_t port:9;
158 uint64_t reserved3:15;
159 uint64_t reserved2:4;
160 uint64_t did:8;
161 uint64_t is_io:1;
162 uint64_t reserved:13;
163 uint64_t mem_space:2;
164#endif
165 } s;
166} cvmx_pko_doorbell_address_t;
167
168/**
169 * Structure of the first packet output command word.
170 */
171union cvmx_pko_command_word0 {
172 uint64_t u64;
173 struct {
174#ifdef __BIG_ENDIAN_BITFIELD
175 /*
176 * The size of the reg1 operation - could be 8, 16,
177 * 32, or 64 bits.
178 */
179 uint64_t size1:2;
180 /*
181 * The size of the reg0 operation - could be 8, 16,
182 * 32, or 64 bits.
183 */
184 uint64_t size0:2;
185 /*
186 * If set, subtract 1, if clear, subtract packet
187 * size.
188 */
189 uint64_t subone1:1;
190 /*
191 * The register, subtract will be done if reg1 is
192 * non-zero.
193 */
194 uint64_t reg1:11;
195 /* If set, subtract 1, if clear, subtract packet size */
196 uint64_t subone0:1;
197 /* The register, subtract will be done if reg0 is non-zero */
198 uint64_t reg0:11;
199 /*
200 * When set, interpret segment pointer and segment
201 * bytes in little endian order.
202 */
203 uint64_t le:1;
204 /*
205 * When set, packet data not allocated in L2 cache by
206 * PKO.
207 */
208 uint64_t n2:1;
209 /*
210 * If set and rsp is set, word3 contains a pointer to
211 * a work queue entry.
212 */
213 uint64_t wqp:1;
214 /* If set, the hardware will send a response when done */
215 uint64_t rsp:1;
216 /*
217 * If set, the supplied pkt_ptr is really a pointer to
218 * a list of pkt_ptr's.
219 */
220 uint64_t gather:1;
221 /*
222 * If ipoffp1 is non zero, (ipoffp1-1) is the number
223 * of bytes to IP header, and the hardware will
224 * calculate and insert the UDP/TCP checksum.
225 */
226 uint64_t ipoffp1:7;
227 /*
228 * If set, ignore the I bit (force to zero) from all
229 * pointer structures.
230 */
231 uint64_t ignore_i:1;
232 /*
233 * If clear, the hardware will attempt to free the
234 * buffers containing the packet.
235 */
236 uint64_t dontfree:1;
237 /*
238 * The total number of segs in the packet, if gather
239 * set, also gather list length.
240 */
241 uint64_t segs:6;
242 /* Including L2, but no trailing CRC */
243 uint64_t total_bytes:16;
244#else
245 uint64_t total_bytes:16;
246 uint64_t segs:6;
247 uint64_t dontfree:1;
248 uint64_t ignore_i:1;
249 uint64_t ipoffp1:7;
250 uint64_t gather:1;
251 uint64_t rsp:1;
252 uint64_t wqp:1;
253 uint64_t n2:1;
254 uint64_t le:1;
255 uint64_t reg0:11;
256 uint64_t subone0:1;
257 uint64_t reg1:11;
258 uint64_t subone1:1;
259 uint64_t size0:2;
260 uint64_t size1:2;
261#endif
262 } s;
263};
264
265/* CSR typedefs have been moved to cvmx-csr-*.h */
266
267/**
268 * Definition of internal state for Packet output processing
269 */
270typedef struct {
271 /* ptr to start of buffer, offset kept in FAU reg */
272 uint64_t *start_ptr;
273} cvmx_pko_state_elem_t;
274
275/**
276 * Call before any other calls to initialize the packet
277 * output system.
278 */
279extern void cvmx_pko_initialize_global(void);
280extern int cvmx_pko_initialize_local(void);
281
282/**
283 * Enables the packet output hardware. It must already be
284 * configured.
285 */
286extern void cvmx_pko_enable(void);
287
288/**
289 * Disables the packet output. Does not affect any configuration.
290 */
291extern void cvmx_pko_disable(void);
292
293/**
294 * Shutdown and free resources required by packet output.
295 */
296
297extern void cvmx_pko_shutdown(void);
298
299/**
300 * Configure a output port and the associated queues for use.
301 *
302 * @port: Port to configure.
303 * @base_queue: First queue number to associate with this port.
304 * @num_queues: Number of queues t oassociate with this port
305 * @priority: Array of priority levels for each queue. Values are
306 * allowed to be 1-8. A value of 8 get 8 times the traffic
307 * of a value of 1. There must be num_queues elements in the
308 * array.
309 */
310extern cvmx_pko_status_t cvmx_pko_config_port(uint64_t port,
311 uint64_t base_queue,
312 uint64_t num_queues,
313 const uint64_t priority[]);
314
315/**
316 * Ring the packet output doorbell. This tells the packet
317 * output hardware that "len" command words have been added
318 * to its pending list. This command includes the required
319 * CVMX_SYNCWS before the doorbell ring.
320 *
321 * @port: Port the packet is for
322 * @queue: Queue the packet is for
323 * @len: Length of the command in 64 bit words
324 */
325static inline void cvmx_pko_doorbell(uint64_t port, uint64_t queue,
326 uint64_t len)
327{
328 cvmx_pko_doorbell_address_t ptr;
329
330 ptr.u64 = 0;
331 ptr.s.mem_space = CVMX_IO_SEG;
332 ptr.s.did = CVMX_OCT_DID_PKT_SEND;
333 ptr.s.is_io = 1;
334 ptr.s.port = port;
335 ptr.s.queue = queue;
336 /*
337 * Need to make sure output queue data is in DRAM before
338 * doorbell write.
339 */
340 CVMX_SYNCWS;
341 cvmx_write_io(ptr.u64, len);
342}
343
344/**
345 * Prepare to send a packet. This may initiate a tag switch to
346 * get exclusive access to the output queue structure, and
347 * performs other prep work for the packet send operation.
348 *
349 * cvmx_pko_send_packet_finish() MUST be called after this function is called,
350 * and must be called with the same port/queue/use_locking arguments.
351 *
352 * The use_locking parameter allows the caller to use three
353 * possible locking modes.
354 * - CVMX_PKO_LOCK_NONE
355 * - PKO doesn't do any locking. It is the responsibility
356 * of the application to make sure that no other core
357 * is accessing the same queue at the same time.
358 * - CVMX_PKO_LOCK_ATOMIC_TAG
359 * - PKO performs an atomic tagswitch to insure exclusive
360 * access to the output queue. This will maintain
361 * packet ordering on output.
362 * - CVMX_PKO_LOCK_CMD_QUEUE
363 * - PKO uses the common command queue locks to insure
364 * exclusive access to the output queue. This is a
365 * memory based ll/sc. This is the most portable
366 * locking mechanism.
367 *
368 * NOTE: If atomic locking is used, the POW entry CANNOT be
369 * descheduled, as it does not contain a valid WQE pointer.
370 *
371 * @port: Port to send it on
372 * @queue: Queue to use
373 * @use_locking: CVMX_PKO_LOCK_NONE, CVMX_PKO_LOCK_ATOMIC_TAG, or
374 * CVMX_PKO_LOCK_CMD_QUEUE
375 */
376
377static inline void cvmx_pko_send_packet_prepare(uint64_t port, uint64_t queue,
378 cvmx_pko_lock_t use_locking)
379{
380 if (use_locking == CVMX_PKO_LOCK_ATOMIC_TAG) {
381 /*
382 * Must do a full switch here to handle all cases. We
383 * use a fake WQE pointer, as the POW does not access
384 * this memory. The WQE pointer and group are only
385 * used if this work is descheduled, which is not
386 * supported by the
387 * cvmx_pko_send_packet_prepare/cvmx_pko_send_packet_finish
388 * combination. Note that this is a special case in
389 * which these fake values can be used - this is not a
390 * general technique.
391 */
392 uint32_t tag =
393 CVMX_TAG_SW_BITS_INTERNAL << CVMX_TAG_SW_SHIFT |
394 CVMX_TAG_SUBGROUP_PKO << CVMX_TAG_SUBGROUP_SHIFT |
395 (CVMX_TAG_SUBGROUP_MASK & queue);
396 cvmx_pow_tag_sw_full((struct cvmx_wqe *) cvmx_phys_to_ptr(0x80), tag,
397 CVMX_POW_TAG_TYPE_ATOMIC, 0);
398 }
399}
400
401/**
402 * Complete packet output. cvmx_pko_send_packet_prepare() must be
403 * called exactly once before this, and the same parameters must be
404 * passed to both cvmx_pko_send_packet_prepare() and
405 * cvmx_pko_send_packet_finish().
406 *
407 * @port: Port to send it on
408 * @queue: Queue to use
409 * @pko_command:
410 * PKO HW command word
411 * @packet: Packet to send
412 * @use_locking: CVMX_PKO_LOCK_NONE, CVMX_PKO_LOCK_ATOMIC_TAG, or
413 * CVMX_PKO_LOCK_CMD_QUEUE
414 *
415 * Returns: CVMX_PKO_SUCCESS on success, or error code on
416 * failure of output
417 */
418static inline cvmx_pko_status_t cvmx_pko_send_packet_finish(
419 uint64_t port,
420 uint64_t queue,
421 union cvmx_pko_command_word0 pko_command,
422 union cvmx_buf_ptr packet,
423 cvmx_pko_lock_t use_locking)
424{
425 cvmx_cmd_queue_result_t result;
426 if (use_locking == CVMX_PKO_LOCK_ATOMIC_TAG)
427 cvmx_pow_tag_sw_wait();
428 result = cvmx_cmd_queue_write2(CVMX_CMD_QUEUE_PKO(queue),
429 (use_locking == CVMX_PKO_LOCK_CMD_QUEUE),
430 pko_command.u64, packet.u64);
431 if (likely(result == CVMX_CMD_QUEUE_SUCCESS)) {
432 cvmx_pko_doorbell(port, queue, 2);
433 return CVMX_PKO_SUCCESS;
434 } else if ((result == CVMX_CMD_QUEUE_NO_MEMORY)
435 || (result == CVMX_CMD_QUEUE_FULL)) {
436 return CVMX_PKO_NO_MEMORY;
437 } else {
438 return CVMX_PKO_INVALID_QUEUE;
439 }
440}
441
442/**
443 * Complete packet output. cvmx_pko_send_packet_prepare() must be
444 * called exactly once before this, and the same parameters must be
445 * passed to both cvmx_pko_send_packet_prepare() and
446 * cvmx_pko_send_packet_finish().
447 *
448 * @port: Port to send it on
449 * @queue: Queue to use
450 * @pko_command:
451 * PKO HW command word
452 * @packet: Packet to send
453 * @addr: Plysical address of a work queue entry or physical address
454 * to zero on complete.
455 * @use_locking: CVMX_PKO_LOCK_NONE, CVMX_PKO_LOCK_ATOMIC_TAG, or
456 * CVMX_PKO_LOCK_CMD_QUEUE
457 *
458 * Returns: CVMX_PKO_SUCCESS on success, or error code on
459 * failure of output
460 */
461static inline cvmx_pko_status_t cvmx_pko_send_packet_finish3(
462 uint64_t port,
463 uint64_t queue,
464 union cvmx_pko_command_word0 pko_command,
465 union cvmx_buf_ptr packet,
466 uint64_t addr,
467 cvmx_pko_lock_t use_locking)
468{
469 cvmx_cmd_queue_result_t result;
470 if (use_locking == CVMX_PKO_LOCK_ATOMIC_TAG)
471 cvmx_pow_tag_sw_wait();
472 result = cvmx_cmd_queue_write3(CVMX_CMD_QUEUE_PKO(queue),
473 (use_locking == CVMX_PKO_LOCK_CMD_QUEUE),
474 pko_command.u64, packet.u64, addr);
475 if (likely(result == CVMX_CMD_QUEUE_SUCCESS)) {
476 cvmx_pko_doorbell(port, queue, 3);
477 return CVMX_PKO_SUCCESS;
478 } else if ((result == CVMX_CMD_QUEUE_NO_MEMORY)
479 || (result == CVMX_CMD_QUEUE_FULL)) {
480 return CVMX_PKO_NO_MEMORY;
481 } else {
482 return CVMX_PKO_INVALID_QUEUE;
483 }
484}
485
486/**
487 * Return the pko output queue associated with a port and a specific core.
488 * In normal mode (PKO lockless operation is disabled), the value returned
489 * is the base queue.
490 *
491 * @port: Port number
492 * @core: Core to get queue for
493 *
494 * Returns Core-specific output queue
495 */
496static inline int cvmx_pko_get_base_queue_per_core(int port, int core)
497{
498#ifndef CVMX_HELPER_PKO_MAX_PORTS_INTERFACE0
499#define CVMX_HELPER_PKO_MAX_PORTS_INTERFACE0 16
500#endif
501#ifndef CVMX_HELPER_PKO_MAX_PORTS_INTERFACE1
502#define CVMX_HELPER_PKO_MAX_PORTS_INTERFACE1 16
503#endif
504
505 if (port < CVMX_PKO_MAX_PORTS_INTERFACE0)
506 return port * CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 + core;
507 else if (port >= 16 && port < 16 + CVMX_PKO_MAX_PORTS_INTERFACE1)
508 return CVMX_PKO_MAX_PORTS_INTERFACE0 *
509 CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 + (port -
510 16) *
511 CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 + core;
512 else if ((port >= 32) && (port < 36))
513 return CVMX_PKO_MAX_PORTS_INTERFACE0 *
514 CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 +
515 CVMX_PKO_MAX_PORTS_INTERFACE1 *
516 CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 + (port -
517 32) *
518 CVMX_PKO_QUEUES_PER_PORT_PCI;
519 else if ((port >= 36) && (port < 40))
520 return CVMX_PKO_MAX_PORTS_INTERFACE0 *
521 CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 +
522 CVMX_PKO_MAX_PORTS_INTERFACE1 *
523 CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 +
524 4 * CVMX_PKO_QUEUES_PER_PORT_PCI + (port -
525 36) *
526 CVMX_PKO_QUEUES_PER_PORT_LOOP;
527 else
528 /* Given the limit on the number of ports we can map to
529 * CVMX_MAX_OUTPUT_QUEUES_STATIC queues (currently 256,
530 * divided among all cores), the remaining unmapped ports
531 * are assigned an illegal queue number */
532 return CVMX_PKO_ILLEGAL_QUEUE;
533}
534
535/**
536 * For a given port number, return the base pko output queue
537 * for the port.
538 *
539 * @port: Port number
540 * Returns Base output queue
541 */
542static inline int cvmx_pko_get_base_queue(int port)
543{
544 if (OCTEON_IS_MODEL(OCTEON_CN68XX))
545 return port;
546
547 return cvmx_pko_get_base_queue_per_core(port, 0);
548}
549
550/**
551 * For a given port number, return the number of pko output queues.
552 *
553 * @port: Port number
554 * Returns Number of output queues
555 */
556static inline int cvmx_pko_get_num_queues(int port)
557{
558 if (port < 16)
559 return CVMX_PKO_QUEUES_PER_PORT_INTERFACE0;
560 else if (port < 32)
561 return CVMX_PKO_QUEUES_PER_PORT_INTERFACE1;
562 else if (port < 36)
563 return CVMX_PKO_QUEUES_PER_PORT_PCI;
564 else if (port < 40)
565 return CVMX_PKO_QUEUES_PER_PORT_LOOP;
566 else
567 return 0;
568}
569
570/**
571 * Get the status counters for a port.
572 *
573 * @port_num: Port number to get statistics for.
574 * @clear: Set to 1 to clear the counters after they are read
575 * @status: Where to put the results.
576 */
577static inline void cvmx_pko_get_port_status(uint64_t port_num, uint64_t clear,
578 cvmx_pko_port_status_t *status)
579{
580 union cvmx_pko_reg_read_idx pko_reg_read_idx;
581 union cvmx_pko_mem_count0 pko_mem_count0;
582 union cvmx_pko_mem_count1 pko_mem_count1;
583
584 pko_reg_read_idx.u64 = 0;
585 pko_reg_read_idx.s.index = port_num;
586 cvmx_write_csr(CVMX_PKO_REG_READ_IDX, pko_reg_read_idx.u64);
587
588 pko_mem_count0.u64 = cvmx_read_csr(CVMX_PKO_MEM_COUNT0);
589 status->packets = pko_mem_count0.s.count;
590 if (clear) {
591 pko_mem_count0.s.count = port_num;
592 cvmx_write_csr(CVMX_PKO_MEM_COUNT0, pko_mem_count0.u64);
593 }
594
595 pko_mem_count1.u64 = cvmx_read_csr(CVMX_PKO_MEM_COUNT1);
596 status->octets = pko_mem_count1.s.count;
597 if (clear) {
598 pko_mem_count1.s.count = port_num;
599 cvmx_write_csr(CVMX_PKO_MEM_COUNT1, pko_mem_count1.u64);
600 }
601
602 if (OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
603 union cvmx_pko_mem_debug9 debug9;
604 pko_reg_read_idx.s.index = cvmx_pko_get_base_queue(port_num);
605 cvmx_write_csr(CVMX_PKO_REG_READ_IDX, pko_reg_read_idx.u64);
606 debug9.u64 = cvmx_read_csr(CVMX_PKO_MEM_DEBUG9);
607 status->doorbell = debug9.cn38xx.doorbell;
608 } else {
609 union cvmx_pko_mem_debug8 debug8;
610 pko_reg_read_idx.s.index = cvmx_pko_get_base_queue(port_num);
611 cvmx_write_csr(CVMX_PKO_REG_READ_IDX, pko_reg_read_idx.u64);
612 debug8.u64 = cvmx_read_csr(CVMX_PKO_MEM_DEBUG8);
613 status->doorbell = debug8.cn50xx.doorbell;
614 }
615}
616
617/**
618 * Rate limit a PKO port to a max packets/sec. This function is only
619 * supported on CN57XX, CN56XX, CN55XX, and CN54XX.
620 *
621 * @port: Port to rate limit
622 * @packets_s: Maximum packet/sec
623 * @burst: Maximum number of packets to burst in a row before rate
624 * limiting cuts in.
625 *
626 * Returns Zero on success, negative on failure
627 */
628extern int cvmx_pko_rate_limit_packets(int port, int packets_s, int burst);
629
630/**
631 * Rate limit a PKO port to a max bits/sec. This function is only
632 * supported on CN57XX, CN56XX, CN55XX, and CN54XX.
633 *
634 * @port: Port to rate limit
635 * @bits_s: PKO rate limit in bits/sec
636 * @burst: Maximum number of bits to burst before rate
637 * limiting cuts in.
638 *
639 * Returns Zero on success, negative on failure
640 */
641extern int cvmx_pko_rate_limit_bits(int port, uint64_t bits_s, int burst);
642
643#endif /* __CVMX_PKO_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-pow-defs.h b/arch/mips/include/asm/octeon/cvmx-pow-defs.h
new file mode 100644
index 000000000..474dd5443
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pow-defs.h
@@ -0,0 +1,1001 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_POW_DEFS_H__
29#define __CVMX_POW_DEFS_H__
30
31#define CVMX_POW_BIST_STAT (CVMX_ADD_IO_SEG(0x00016700000003F8ull))
32#define CVMX_POW_DS_PC (CVMX_ADD_IO_SEG(0x0001670000000398ull))
33#define CVMX_POW_ECC_ERR (CVMX_ADD_IO_SEG(0x0001670000000218ull))
34#define CVMX_POW_INT_CTL (CVMX_ADD_IO_SEG(0x0001670000000220ull))
35#define CVMX_POW_IQ_CNTX(offset) (CVMX_ADD_IO_SEG(0x0001670000000340ull) + ((offset) & 7) * 8)
36#define CVMX_POW_IQ_COM_CNT (CVMX_ADD_IO_SEG(0x0001670000000388ull))
37#define CVMX_POW_IQ_INT (CVMX_ADD_IO_SEG(0x0001670000000238ull))
38#define CVMX_POW_IQ_INT_EN (CVMX_ADD_IO_SEG(0x0001670000000240ull))
39#define CVMX_POW_IQ_THRX(offset) (CVMX_ADD_IO_SEG(0x00016700000003A0ull) + ((offset) & 7) * 8)
40#define CVMX_POW_NOS_CNT (CVMX_ADD_IO_SEG(0x0001670000000228ull))
41#define CVMX_POW_NW_TIM (CVMX_ADD_IO_SEG(0x0001670000000210ull))
42#define CVMX_POW_PF_RST_MSK (CVMX_ADD_IO_SEG(0x0001670000000230ull))
43#define CVMX_POW_PP_GRP_MSKX(offset) (CVMX_ADD_IO_SEG(0x0001670000000000ull) + ((offset) & 15) * 8)
44#define CVMX_POW_QOS_RNDX(offset) (CVMX_ADD_IO_SEG(0x00016700000001C0ull) + ((offset) & 7) * 8)
45#define CVMX_POW_QOS_THRX(offset) (CVMX_ADD_IO_SEG(0x0001670000000180ull) + ((offset) & 7) * 8)
46#define CVMX_POW_TS_PC (CVMX_ADD_IO_SEG(0x0001670000000390ull))
47#define CVMX_POW_WA_COM_PC (CVMX_ADD_IO_SEG(0x0001670000000380ull))
48#define CVMX_POW_WA_PCX(offset) (CVMX_ADD_IO_SEG(0x0001670000000300ull) + ((offset) & 7) * 8)
49#define CVMX_POW_WQ_INT (CVMX_ADD_IO_SEG(0x0001670000000200ull))
50#define CVMX_POW_WQ_INT_CNTX(offset) (CVMX_ADD_IO_SEG(0x0001670000000100ull) + ((offset) & 15) * 8)
51#define CVMX_POW_WQ_INT_PC (CVMX_ADD_IO_SEG(0x0001670000000208ull))
52#define CVMX_POW_WQ_INT_THRX(offset) (CVMX_ADD_IO_SEG(0x0001670000000080ull) + ((offset) & 15) * 8)
53#define CVMX_POW_WS_PCX(offset) (CVMX_ADD_IO_SEG(0x0001670000000280ull) + ((offset) & 15) * 8)
54
55#define CVMX_SSO_WQ_INT (CVMX_ADD_IO_SEG(0x0001670000001000ull))
56#define CVMX_SSO_WQ_IQ_DIS (CVMX_ADD_IO_SEG(0x0001670000001010ull))
57#define CVMX_SSO_WQ_INT_PC (CVMX_ADD_IO_SEG(0x0001670000001020ull))
58#define CVMX_SSO_PPX_GRP_MSK(offset) (CVMX_ADD_IO_SEG(0x0001670000006000ull) + ((offset) & 31) * 8)
59#define CVMX_SSO_WQ_INT_THRX(offset) (CVMX_ADD_IO_SEG(0x0001670000007000ull) + ((offset) & 63) * 8)
60
61union cvmx_pow_bist_stat {
62 uint64_t u64;
63 struct cvmx_pow_bist_stat_s {
64#ifdef __BIG_ENDIAN_BITFIELD
65 uint64_t reserved_32_63:32;
66 uint64_t pp:16;
67 uint64_t reserved_0_15:16;
68#else
69 uint64_t reserved_0_15:16;
70 uint64_t pp:16;
71 uint64_t reserved_32_63:32;
72#endif
73 } s;
74 struct cvmx_pow_bist_stat_cn30xx {
75#ifdef __BIG_ENDIAN_BITFIELD
76 uint64_t reserved_17_63:47;
77 uint64_t pp:1;
78 uint64_t reserved_9_15:7;
79 uint64_t cam:1;
80 uint64_t nbt1:1;
81 uint64_t nbt0:1;
82 uint64_t index:1;
83 uint64_t fidx:1;
84 uint64_t nbr1:1;
85 uint64_t nbr0:1;
86 uint64_t pend:1;
87 uint64_t adr:1;
88#else
89 uint64_t adr:1;
90 uint64_t pend:1;
91 uint64_t nbr0:1;
92 uint64_t nbr1:1;
93 uint64_t fidx:1;
94 uint64_t index:1;
95 uint64_t nbt0:1;
96 uint64_t nbt1:1;
97 uint64_t cam:1;
98 uint64_t reserved_9_15:7;
99 uint64_t pp:1;
100 uint64_t reserved_17_63:47;
101#endif
102 } cn30xx;
103 struct cvmx_pow_bist_stat_cn31xx {
104#ifdef __BIG_ENDIAN_BITFIELD
105 uint64_t reserved_18_63:46;
106 uint64_t pp:2;
107 uint64_t reserved_9_15:7;
108 uint64_t cam:1;
109 uint64_t nbt1:1;
110 uint64_t nbt0:1;
111 uint64_t index:1;
112 uint64_t fidx:1;
113 uint64_t nbr1:1;
114 uint64_t nbr0:1;
115 uint64_t pend:1;
116 uint64_t adr:1;
117#else
118 uint64_t adr:1;
119 uint64_t pend:1;
120 uint64_t nbr0:1;
121 uint64_t nbr1:1;
122 uint64_t fidx:1;
123 uint64_t index:1;
124 uint64_t nbt0:1;
125 uint64_t nbt1:1;
126 uint64_t cam:1;
127 uint64_t reserved_9_15:7;
128 uint64_t pp:2;
129 uint64_t reserved_18_63:46;
130#endif
131 } cn31xx;
132 struct cvmx_pow_bist_stat_cn38xx {
133#ifdef __BIG_ENDIAN_BITFIELD
134 uint64_t reserved_32_63:32;
135 uint64_t pp:16;
136 uint64_t reserved_10_15:6;
137 uint64_t cam:1;
138 uint64_t nbt:1;
139 uint64_t index:1;
140 uint64_t fidx:1;
141 uint64_t nbr1:1;
142 uint64_t nbr0:1;
143 uint64_t pend1:1;
144 uint64_t pend0:1;
145 uint64_t adr1:1;
146 uint64_t adr0:1;
147#else
148 uint64_t adr0:1;
149 uint64_t adr1:1;
150 uint64_t pend0:1;
151 uint64_t pend1:1;
152 uint64_t nbr0:1;
153 uint64_t nbr1:1;
154 uint64_t fidx:1;
155 uint64_t index:1;
156 uint64_t nbt:1;
157 uint64_t cam:1;
158 uint64_t reserved_10_15:6;
159 uint64_t pp:16;
160 uint64_t reserved_32_63:32;
161#endif
162 } cn38xx;
163 struct cvmx_pow_bist_stat_cn52xx {
164#ifdef __BIG_ENDIAN_BITFIELD
165 uint64_t reserved_20_63:44;
166 uint64_t pp:4;
167 uint64_t reserved_9_15:7;
168 uint64_t cam:1;
169 uint64_t nbt1:1;
170 uint64_t nbt0:1;
171 uint64_t index:1;
172 uint64_t fidx:1;
173 uint64_t nbr1:1;
174 uint64_t nbr0:1;
175 uint64_t pend:1;
176 uint64_t adr:1;
177#else
178 uint64_t adr:1;
179 uint64_t pend:1;
180 uint64_t nbr0:1;
181 uint64_t nbr1:1;
182 uint64_t fidx:1;
183 uint64_t index:1;
184 uint64_t nbt0:1;
185 uint64_t nbt1:1;
186 uint64_t cam:1;
187 uint64_t reserved_9_15:7;
188 uint64_t pp:4;
189 uint64_t reserved_20_63:44;
190#endif
191 } cn52xx;
192 struct cvmx_pow_bist_stat_cn56xx {
193#ifdef __BIG_ENDIAN_BITFIELD
194 uint64_t reserved_28_63:36;
195 uint64_t pp:12;
196 uint64_t reserved_10_15:6;
197 uint64_t cam:1;
198 uint64_t nbt:1;
199 uint64_t index:1;
200 uint64_t fidx:1;
201 uint64_t nbr1:1;
202 uint64_t nbr0:1;
203 uint64_t pend1:1;
204 uint64_t pend0:1;
205 uint64_t adr1:1;
206 uint64_t adr0:1;
207#else
208 uint64_t adr0:1;
209 uint64_t adr1:1;
210 uint64_t pend0:1;
211 uint64_t pend1:1;
212 uint64_t nbr0:1;
213 uint64_t nbr1:1;
214 uint64_t fidx:1;
215 uint64_t index:1;
216 uint64_t nbt:1;
217 uint64_t cam:1;
218 uint64_t reserved_10_15:6;
219 uint64_t pp:12;
220 uint64_t reserved_28_63:36;
221#endif
222 } cn56xx;
223 struct cvmx_pow_bist_stat_cn61xx {
224#ifdef __BIG_ENDIAN_BITFIELD
225 uint64_t reserved_20_63:44;
226 uint64_t pp:4;
227 uint64_t reserved_12_15:4;
228 uint64_t cam:1;
229 uint64_t nbr:3;
230 uint64_t nbt:4;
231 uint64_t index:1;
232 uint64_t fidx:1;
233 uint64_t pend:1;
234 uint64_t adr:1;
235#else
236 uint64_t adr:1;
237 uint64_t pend:1;
238 uint64_t fidx:1;
239 uint64_t index:1;
240 uint64_t nbt:4;
241 uint64_t nbr:3;
242 uint64_t cam:1;
243 uint64_t reserved_12_15:4;
244 uint64_t pp:4;
245 uint64_t reserved_20_63:44;
246#endif
247 } cn61xx;
248 struct cvmx_pow_bist_stat_cn63xx {
249#ifdef __BIG_ENDIAN_BITFIELD
250 uint64_t reserved_22_63:42;
251 uint64_t pp:6;
252 uint64_t reserved_12_15:4;
253 uint64_t cam:1;
254 uint64_t nbr:3;
255 uint64_t nbt:4;
256 uint64_t index:1;
257 uint64_t fidx:1;
258 uint64_t pend:1;
259 uint64_t adr:1;
260#else
261 uint64_t adr:1;
262 uint64_t pend:1;
263 uint64_t fidx:1;
264 uint64_t index:1;
265 uint64_t nbt:4;
266 uint64_t nbr:3;
267 uint64_t cam:1;
268 uint64_t reserved_12_15:4;
269 uint64_t pp:6;
270 uint64_t reserved_22_63:42;
271#endif
272 } cn63xx;
273 struct cvmx_pow_bist_stat_cn66xx {
274#ifdef __BIG_ENDIAN_BITFIELD
275 uint64_t reserved_26_63:38;
276 uint64_t pp:10;
277 uint64_t reserved_12_15:4;
278 uint64_t cam:1;
279 uint64_t nbr:3;
280 uint64_t nbt:4;
281 uint64_t index:1;
282 uint64_t fidx:1;
283 uint64_t pend:1;
284 uint64_t adr:1;
285#else
286 uint64_t adr:1;
287 uint64_t pend:1;
288 uint64_t fidx:1;
289 uint64_t index:1;
290 uint64_t nbt:4;
291 uint64_t nbr:3;
292 uint64_t cam:1;
293 uint64_t reserved_12_15:4;
294 uint64_t pp:10;
295 uint64_t reserved_26_63:38;
296#endif
297 } cn66xx;
298};
299
300union cvmx_pow_ds_pc {
301 uint64_t u64;
302 struct cvmx_pow_ds_pc_s {
303#ifdef __BIG_ENDIAN_BITFIELD
304 uint64_t reserved_32_63:32;
305 uint64_t ds_pc:32;
306#else
307 uint64_t ds_pc:32;
308 uint64_t reserved_32_63:32;
309#endif
310 } s;
311};
312
313union cvmx_pow_ecc_err {
314 uint64_t u64;
315 struct cvmx_pow_ecc_err_s {
316#ifdef __BIG_ENDIAN_BITFIELD
317 uint64_t reserved_45_63:19;
318 uint64_t iop_ie:13;
319 uint64_t reserved_29_31:3;
320 uint64_t iop:13;
321 uint64_t reserved_14_15:2;
322 uint64_t rpe_ie:1;
323 uint64_t rpe:1;
324 uint64_t reserved_9_11:3;
325 uint64_t syn:5;
326 uint64_t dbe_ie:1;
327 uint64_t sbe_ie:1;
328 uint64_t dbe:1;
329 uint64_t sbe:1;
330#else
331 uint64_t sbe:1;
332 uint64_t dbe:1;
333 uint64_t sbe_ie:1;
334 uint64_t dbe_ie:1;
335 uint64_t syn:5;
336 uint64_t reserved_9_11:3;
337 uint64_t rpe:1;
338 uint64_t rpe_ie:1;
339 uint64_t reserved_14_15:2;
340 uint64_t iop:13;
341 uint64_t reserved_29_31:3;
342 uint64_t iop_ie:13;
343 uint64_t reserved_45_63:19;
344#endif
345 } s;
346 struct cvmx_pow_ecc_err_cn31xx {
347#ifdef __BIG_ENDIAN_BITFIELD
348 uint64_t reserved_14_63:50;
349 uint64_t rpe_ie:1;
350 uint64_t rpe:1;
351 uint64_t reserved_9_11:3;
352 uint64_t syn:5;
353 uint64_t dbe_ie:1;
354 uint64_t sbe_ie:1;
355 uint64_t dbe:1;
356 uint64_t sbe:1;
357#else
358 uint64_t sbe:1;
359 uint64_t dbe:1;
360 uint64_t sbe_ie:1;
361 uint64_t dbe_ie:1;
362 uint64_t syn:5;
363 uint64_t reserved_9_11:3;
364 uint64_t rpe:1;
365 uint64_t rpe_ie:1;
366 uint64_t reserved_14_63:50;
367#endif
368 } cn31xx;
369};
370
371union cvmx_pow_int_ctl {
372 uint64_t u64;
373 struct cvmx_pow_int_ctl_s {
374#ifdef __BIG_ENDIAN_BITFIELD
375 uint64_t reserved_6_63:58;
376 uint64_t pfr_dis:1;
377 uint64_t nbr_thr:5;
378#else
379 uint64_t nbr_thr:5;
380 uint64_t pfr_dis:1;
381 uint64_t reserved_6_63:58;
382#endif
383 } s;
384};
385
386union cvmx_pow_iq_cntx {
387 uint64_t u64;
388 struct cvmx_pow_iq_cntx_s {
389#ifdef __BIG_ENDIAN_BITFIELD
390 uint64_t reserved_32_63:32;
391 uint64_t iq_cnt:32;
392#else
393 uint64_t iq_cnt:32;
394 uint64_t reserved_32_63:32;
395#endif
396 } s;
397};
398
399union cvmx_pow_iq_com_cnt {
400 uint64_t u64;
401 struct cvmx_pow_iq_com_cnt_s {
402#ifdef __BIG_ENDIAN_BITFIELD
403 uint64_t reserved_32_63:32;
404 uint64_t iq_cnt:32;
405#else
406 uint64_t iq_cnt:32;
407 uint64_t reserved_32_63:32;
408#endif
409 } s;
410};
411
412union cvmx_pow_iq_int {
413 uint64_t u64;
414 struct cvmx_pow_iq_int_s {
415#ifdef __BIG_ENDIAN_BITFIELD
416 uint64_t reserved_8_63:56;
417 uint64_t iq_int:8;
418#else
419 uint64_t iq_int:8;
420 uint64_t reserved_8_63:56;
421#endif
422 } s;
423};
424
425union cvmx_pow_iq_int_en {
426 uint64_t u64;
427 struct cvmx_pow_iq_int_en_s {
428#ifdef __BIG_ENDIAN_BITFIELD
429 uint64_t reserved_8_63:56;
430 uint64_t int_en:8;
431#else
432 uint64_t int_en:8;
433 uint64_t reserved_8_63:56;
434#endif
435 } s;
436};
437
438union cvmx_pow_iq_thrx {
439 uint64_t u64;
440 struct cvmx_pow_iq_thrx_s {
441#ifdef __BIG_ENDIAN_BITFIELD
442 uint64_t reserved_32_63:32;
443 uint64_t iq_thr:32;
444#else
445 uint64_t iq_thr:32;
446 uint64_t reserved_32_63:32;
447#endif
448 } s;
449};
450
451union cvmx_pow_nos_cnt {
452 uint64_t u64;
453 struct cvmx_pow_nos_cnt_s {
454#ifdef __BIG_ENDIAN_BITFIELD
455 uint64_t reserved_12_63:52;
456 uint64_t nos_cnt:12;
457#else
458 uint64_t nos_cnt:12;
459 uint64_t reserved_12_63:52;
460#endif
461 } s;
462 struct cvmx_pow_nos_cnt_cn30xx {
463#ifdef __BIG_ENDIAN_BITFIELD
464 uint64_t reserved_7_63:57;
465 uint64_t nos_cnt:7;
466#else
467 uint64_t nos_cnt:7;
468 uint64_t reserved_7_63:57;
469#endif
470 } cn30xx;
471 struct cvmx_pow_nos_cnt_cn31xx {
472#ifdef __BIG_ENDIAN_BITFIELD
473 uint64_t reserved_9_63:55;
474 uint64_t nos_cnt:9;
475#else
476 uint64_t nos_cnt:9;
477 uint64_t reserved_9_63:55;
478#endif
479 } cn31xx;
480 struct cvmx_pow_nos_cnt_cn52xx {
481#ifdef __BIG_ENDIAN_BITFIELD
482 uint64_t reserved_10_63:54;
483 uint64_t nos_cnt:10;
484#else
485 uint64_t nos_cnt:10;
486 uint64_t reserved_10_63:54;
487#endif
488 } cn52xx;
489 struct cvmx_pow_nos_cnt_cn63xx {
490#ifdef __BIG_ENDIAN_BITFIELD
491 uint64_t reserved_11_63:53;
492 uint64_t nos_cnt:11;
493#else
494 uint64_t nos_cnt:11;
495 uint64_t reserved_11_63:53;
496#endif
497 } cn63xx;
498};
499
500union cvmx_pow_nw_tim {
501 uint64_t u64;
502 struct cvmx_pow_nw_tim_s {
503#ifdef __BIG_ENDIAN_BITFIELD
504 uint64_t reserved_10_63:54;
505 uint64_t nw_tim:10;
506#else
507 uint64_t nw_tim:10;
508 uint64_t reserved_10_63:54;
509#endif
510 } s;
511};
512
513union cvmx_pow_pf_rst_msk {
514 uint64_t u64;
515 struct cvmx_pow_pf_rst_msk_s {
516#ifdef __BIG_ENDIAN_BITFIELD
517 uint64_t reserved_8_63:56;
518 uint64_t rst_msk:8;
519#else
520 uint64_t rst_msk:8;
521 uint64_t reserved_8_63:56;
522#endif
523 } s;
524};
525
526union cvmx_pow_pp_grp_mskx {
527 uint64_t u64;
528 struct cvmx_pow_pp_grp_mskx_s {
529#ifdef __BIG_ENDIAN_BITFIELD
530 uint64_t reserved_48_63:16;
531 uint64_t qos7_pri:4;
532 uint64_t qos6_pri:4;
533 uint64_t qos5_pri:4;
534 uint64_t qos4_pri:4;
535 uint64_t qos3_pri:4;
536 uint64_t qos2_pri:4;
537 uint64_t qos1_pri:4;
538 uint64_t qos0_pri:4;
539 uint64_t grp_msk:16;
540#else
541 uint64_t grp_msk:16;
542 uint64_t qos0_pri:4;
543 uint64_t qos1_pri:4;
544 uint64_t qos2_pri:4;
545 uint64_t qos3_pri:4;
546 uint64_t qos4_pri:4;
547 uint64_t qos5_pri:4;
548 uint64_t qos6_pri:4;
549 uint64_t qos7_pri:4;
550 uint64_t reserved_48_63:16;
551#endif
552 } s;
553 struct cvmx_pow_pp_grp_mskx_cn30xx {
554#ifdef __BIG_ENDIAN_BITFIELD
555 uint64_t reserved_16_63:48;
556 uint64_t grp_msk:16;
557#else
558 uint64_t grp_msk:16;
559 uint64_t reserved_16_63:48;
560#endif
561 } cn30xx;
562};
563
564union cvmx_pow_qos_rndx {
565 uint64_t u64;
566 struct cvmx_pow_qos_rndx_s {
567#ifdef __BIG_ENDIAN_BITFIELD
568 uint64_t reserved_32_63:32;
569 uint64_t rnd_p3:8;
570 uint64_t rnd_p2:8;
571 uint64_t rnd_p1:8;
572 uint64_t rnd:8;
573#else
574 uint64_t rnd:8;
575 uint64_t rnd_p1:8;
576 uint64_t rnd_p2:8;
577 uint64_t rnd_p3:8;
578 uint64_t reserved_32_63:32;
579#endif
580 } s;
581};
582
583union cvmx_pow_qos_thrx {
584 uint64_t u64;
585 struct cvmx_pow_qos_thrx_s {
586#ifdef __BIG_ENDIAN_BITFIELD
587 uint64_t reserved_60_63:4;
588 uint64_t des_cnt:12;
589 uint64_t buf_cnt:12;
590 uint64_t free_cnt:12;
591 uint64_t reserved_23_23:1;
592 uint64_t max_thr:11;
593 uint64_t reserved_11_11:1;
594 uint64_t min_thr:11;
595#else
596 uint64_t min_thr:11;
597 uint64_t reserved_11_11:1;
598 uint64_t max_thr:11;
599 uint64_t reserved_23_23:1;
600 uint64_t free_cnt:12;
601 uint64_t buf_cnt:12;
602 uint64_t des_cnt:12;
603 uint64_t reserved_60_63:4;
604#endif
605 } s;
606 struct cvmx_pow_qos_thrx_cn30xx {
607#ifdef __BIG_ENDIAN_BITFIELD
608 uint64_t reserved_55_63:9;
609 uint64_t des_cnt:7;
610 uint64_t reserved_43_47:5;
611 uint64_t buf_cnt:7;
612 uint64_t reserved_31_35:5;
613 uint64_t free_cnt:7;
614 uint64_t reserved_18_23:6;
615 uint64_t max_thr:6;
616 uint64_t reserved_6_11:6;
617 uint64_t min_thr:6;
618#else
619 uint64_t min_thr:6;
620 uint64_t reserved_6_11:6;
621 uint64_t max_thr:6;
622 uint64_t reserved_18_23:6;
623 uint64_t free_cnt:7;
624 uint64_t reserved_31_35:5;
625 uint64_t buf_cnt:7;
626 uint64_t reserved_43_47:5;
627 uint64_t des_cnt:7;
628 uint64_t reserved_55_63:9;
629#endif
630 } cn30xx;
631 struct cvmx_pow_qos_thrx_cn31xx {
632#ifdef __BIG_ENDIAN_BITFIELD
633 uint64_t reserved_57_63:7;
634 uint64_t des_cnt:9;
635 uint64_t reserved_45_47:3;
636 uint64_t buf_cnt:9;
637 uint64_t reserved_33_35:3;
638 uint64_t free_cnt:9;
639 uint64_t reserved_20_23:4;
640 uint64_t max_thr:8;
641 uint64_t reserved_8_11:4;
642 uint64_t min_thr:8;
643#else
644 uint64_t min_thr:8;
645 uint64_t reserved_8_11:4;
646 uint64_t max_thr:8;
647 uint64_t reserved_20_23:4;
648 uint64_t free_cnt:9;
649 uint64_t reserved_33_35:3;
650 uint64_t buf_cnt:9;
651 uint64_t reserved_45_47:3;
652 uint64_t des_cnt:9;
653 uint64_t reserved_57_63:7;
654#endif
655 } cn31xx;
656 struct cvmx_pow_qos_thrx_cn52xx {
657#ifdef __BIG_ENDIAN_BITFIELD
658 uint64_t reserved_58_63:6;
659 uint64_t des_cnt:10;
660 uint64_t reserved_46_47:2;
661 uint64_t buf_cnt:10;
662 uint64_t reserved_34_35:2;
663 uint64_t free_cnt:10;
664 uint64_t reserved_21_23:3;
665 uint64_t max_thr:9;
666 uint64_t reserved_9_11:3;
667 uint64_t min_thr:9;
668#else
669 uint64_t min_thr:9;
670 uint64_t reserved_9_11:3;
671 uint64_t max_thr:9;
672 uint64_t reserved_21_23:3;
673 uint64_t free_cnt:10;
674 uint64_t reserved_34_35:2;
675 uint64_t buf_cnt:10;
676 uint64_t reserved_46_47:2;
677 uint64_t des_cnt:10;
678 uint64_t reserved_58_63:6;
679#endif
680 } cn52xx;
681 struct cvmx_pow_qos_thrx_cn63xx {
682#ifdef __BIG_ENDIAN_BITFIELD
683 uint64_t reserved_59_63:5;
684 uint64_t des_cnt:11;
685 uint64_t reserved_47_47:1;
686 uint64_t buf_cnt:11;
687 uint64_t reserved_35_35:1;
688 uint64_t free_cnt:11;
689 uint64_t reserved_22_23:2;
690 uint64_t max_thr:10;
691 uint64_t reserved_10_11:2;
692 uint64_t min_thr:10;
693#else
694 uint64_t min_thr:10;
695 uint64_t reserved_10_11:2;
696 uint64_t max_thr:10;
697 uint64_t reserved_22_23:2;
698 uint64_t free_cnt:11;
699 uint64_t reserved_35_35:1;
700 uint64_t buf_cnt:11;
701 uint64_t reserved_47_47:1;
702 uint64_t des_cnt:11;
703 uint64_t reserved_59_63:5;
704#endif
705 } cn63xx;
706};
707
708union cvmx_pow_ts_pc {
709 uint64_t u64;
710 struct cvmx_pow_ts_pc_s {
711#ifdef __BIG_ENDIAN_BITFIELD
712 uint64_t reserved_32_63:32;
713 uint64_t ts_pc:32;
714#else
715 uint64_t ts_pc:32;
716 uint64_t reserved_32_63:32;
717#endif
718 } s;
719};
720
721union cvmx_pow_wa_com_pc {
722 uint64_t u64;
723 struct cvmx_pow_wa_com_pc_s {
724#ifdef __BIG_ENDIAN_BITFIELD
725 uint64_t reserved_32_63:32;
726 uint64_t wa_pc:32;
727#else
728 uint64_t wa_pc:32;
729 uint64_t reserved_32_63:32;
730#endif
731 } s;
732};
733
734union cvmx_pow_wa_pcx {
735 uint64_t u64;
736 struct cvmx_pow_wa_pcx_s {
737#ifdef __BIG_ENDIAN_BITFIELD
738 uint64_t reserved_32_63:32;
739 uint64_t wa_pc:32;
740#else
741 uint64_t wa_pc:32;
742 uint64_t reserved_32_63:32;
743#endif
744 } s;
745};
746
747union cvmx_pow_wq_int {
748 uint64_t u64;
749 struct cvmx_pow_wq_int_s {
750#ifdef __BIG_ENDIAN_BITFIELD
751 uint64_t reserved_32_63:32;
752 uint64_t iq_dis:16;
753 uint64_t wq_int:16;
754#else
755 uint64_t wq_int:16;
756 uint64_t iq_dis:16;
757 uint64_t reserved_32_63:32;
758#endif
759 } s;
760};
761
762union cvmx_pow_wq_int_cntx {
763 uint64_t u64;
764 struct cvmx_pow_wq_int_cntx_s {
765#ifdef __BIG_ENDIAN_BITFIELD
766 uint64_t reserved_28_63:36;
767 uint64_t tc_cnt:4;
768 uint64_t ds_cnt:12;
769 uint64_t iq_cnt:12;
770#else
771 uint64_t iq_cnt:12;
772 uint64_t ds_cnt:12;
773 uint64_t tc_cnt:4;
774 uint64_t reserved_28_63:36;
775#endif
776 } s;
777 struct cvmx_pow_wq_int_cntx_cn30xx {
778#ifdef __BIG_ENDIAN_BITFIELD
779 uint64_t reserved_28_63:36;
780 uint64_t tc_cnt:4;
781 uint64_t reserved_19_23:5;
782 uint64_t ds_cnt:7;
783 uint64_t reserved_7_11:5;
784 uint64_t iq_cnt:7;
785#else
786 uint64_t iq_cnt:7;
787 uint64_t reserved_7_11:5;
788 uint64_t ds_cnt:7;
789 uint64_t reserved_19_23:5;
790 uint64_t tc_cnt:4;
791 uint64_t reserved_28_63:36;
792#endif
793 } cn30xx;
794 struct cvmx_pow_wq_int_cntx_cn31xx {
795#ifdef __BIG_ENDIAN_BITFIELD
796 uint64_t reserved_28_63:36;
797 uint64_t tc_cnt:4;
798 uint64_t reserved_21_23:3;
799 uint64_t ds_cnt:9;
800 uint64_t reserved_9_11:3;
801 uint64_t iq_cnt:9;
802#else
803 uint64_t iq_cnt:9;
804 uint64_t reserved_9_11:3;
805 uint64_t ds_cnt:9;
806 uint64_t reserved_21_23:3;
807 uint64_t tc_cnt:4;
808 uint64_t reserved_28_63:36;
809#endif
810 } cn31xx;
811 struct cvmx_pow_wq_int_cntx_cn52xx {
812#ifdef __BIG_ENDIAN_BITFIELD
813 uint64_t reserved_28_63:36;
814 uint64_t tc_cnt:4;
815 uint64_t reserved_22_23:2;
816 uint64_t ds_cnt:10;
817 uint64_t reserved_10_11:2;
818 uint64_t iq_cnt:10;
819#else
820 uint64_t iq_cnt:10;
821 uint64_t reserved_10_11:2;
822 uint64_t ds_cnt:10;
823 uint64_t reserved_22_23:2;
824 uint64_t tc_cnt:4;
825 uint64_t reserved_28_63:36;
826#endif
827 } cn52xx;
828 struct cvmx_pow_wq_int_cntx_cn63xx {
829#ifdef __BIG_ENDIAN_BITFIELD
830 uint64_t reserved_28_63:36;
831 uint64_t tc_cnt:4;
832 uint64_t reserved_23_23:1;
833 uint64_t ds_cnt:11;
834 uint64_t reserved_11_11:1;
835 uint64_t iq_cnt:11;
836#else
837 uint64_t iq_cnt:11;
838 uint64_t reserved_11_11:1;
839 uint64_t ds_cnt:11;
840 uint64_t reserved_23_23:1;
841 uint64_t tc_cnt:4;
842 uint64_t reserved_28_63:36;
843#endif
844 } cn63xx;
845};
846
847union cvmx_pow_wq_int_pc {
848 uint64_t u64;
849 struct cvmx_pow_wq_int_pc_s {
850#ifdef __BIG_ENDIAN_BITFIELD
851 uint64_t reserved_60_63:4;
852 uint64_t pc:28;
853 uint64_t reserved_28_31:4;
854 uint64_t pc_thr:20;
855 uint64_t reserved_0_7:8;
856#else
857 uint64_t reserved_0_7:8;
858 uint64_t pc_thr:20;
859 uint64_t reserved_28_31:4;
860 uint64_t pc:28;
861 uint64_t reserved_60_63:4;
862#endif
863 } s;
864};
865
866union cvmx_pow_wq_int_thrx {
867 uint64_t u64;
868 struct cvmx_pow_wq_int_thrx_s {
869#ifdef __BIG_ENDIAN_BITFIELD
870 uint64_t reserved_29_63:35;
871 uint64_t tc_en:1;
872 uint64_t tc_thr:4;
873 uint64_t reserved_23_23:1;
874 uint64_t ds_thr:11;
875 uint64_t reserved_11_11:1;
876 uint64_t iq_thr:11;
877#else
878 uint64_t iq_thr:11;
879 uint64_t reserved_11_11:1;
880 uint64_t ds_thr:11;
881 uint64_t reserved_23_23:1;
882 uint64_t tc_thr:4;
883 uint64_t tc_en:1;
884 uint64_t reserved_29_63:35;
885#endif
886 } s;
887 struct cvmx_pow_wq_int_thrx_cn30xx {
888#ifdef __BIG_ENDIAN_BITFIELD
889 uint64_t reserved_29_63:35;
890 uint64_t tc_en:1;
891 uint64_t tc_thr:4;
892 uint64_t reserved_18_23:6;
893 uint64_t ds_thr:6;
894 uint64_t reserved_6_11:6;
895 uint64_t iq_thr:6;
896#else
897 uint64_t iq_thr:6;
898 uint64_t reserved_6_11:6;
899 uint64_t ds_thr:6;
900 uint64_t reserved_18_23:6;
901 uint64_t tc_thr:4;
902 uint64_t tc_en:1;
903 uint64_t reserved_29_63:35;
904#endif
905 } cn30xx;
906 struct cvmx_pow_wq_int_thrx_cn31xx {
907#ifdef __BIG_ENDIAN_BITFIELD
908 uint64_t reserved_29_63:35;
909 uint64_t tc_en:1;
910 uint64_t tc_thr:4;
911 uint64_t reserved_20_23:4;
912 uint64_t ds_thr:8;
913 uint64_t reserved_8_11:4;
914 uint64_t iq_thr:8;
915#else
916 uint64_t iq_thr:8;
917 uint64_t reserved_8_11:4;
918 uint64_t ds_thr:8;
919 uint64_t reserved_20_23:4;
920 uint64_t tc_thr:4;
921 uint64_t tc_en:1;
922 uint64_t reserved_29_63:35;
923#endif
924 } cn31xx;
925 struct cvmx_pow_wq_int_thrx_cn52xx {
926#ifdef __BIG_ENDIAN_BITFIELD
927 uint64_t reserved_29_63:35;
928 uint64_t tc_en:1;
929 uint64_t tc_thr:4;
930 uint64_t reserved_21_23:3;
931 uint64_t ds_thr:9;
932 uint64_t reserved_9_11:3;
933 uint64_t iq_thr:9;
934#else
935 uint64_t iq_thr:9;
936 uint64_t reserved_9_11:3;
937 uint64_t ds_thr:9;
938 uint64_t reserved_21_23:3;
939 uint64_t tc_thr:4;
940 uint64_t tc_en:1;
941 uint64_t reserved_29_63:35;
942#endif
943 } cn52xx;
944 struct cvmx_pow_wq_int_thrx_cn63xx {
945#ifdef __BIG_ENDIAN_BITFIELD
946 uint64_t reserved_29_63:35;
947 uint64_t tc_en:1;
948 uint64_t tc_thr:4;
949 uint64_t reserved_22_23:2;
950 uint64_t ds_thr:10;
951 uint64_t reserved_10_11:2;
952 uint64_t iq_thr:10;
953#else
954 uint64_t iq_thr:10;
955 uint64_t reserved_10_11:2;
956 uint64_t ds_thr:10;
957 uint64_t reserved_22_23:2;
958 uint64_t tc_thr:4;
959 uint64_t tc_en:1;
960 uint64_t reserved_29_63:35;
961#endif
962 } cn63xx;
963};
964
965union cvmx_pow_ws_pcx {
966 uint64_t u64;
967 struct cvmx_pow_ws_pcx_s {
968#ifdef __BIG_ENDIAN_BITFIELD
969 uint64_t reserved_32_63:32;
970 uint64_t ws_pc:32;
971#else
972 uint64_t ws_pc:32;
973 uint64_t reserved_32_63:32;
974#endif
975 } s;
976};
977
978union cvmx_sso_wq_int_thrx {
979 uint64_t u64;
980 struct {
981#ifdef __BIG_ENDIAN_BITFIELD
982 uint64_t reserved_33_63:31;
983 uint64_t tc_en:1;
984 uint64_t tc_thr:4;
985 uint64_t reserved_26_27:2;
986 uint64_t ds_thr:12;
987 uint64_t reserved_12_13:2;
988 uint64_t iq_thr:12;
989#else
990 uint64_t iq_thr:12;
991 uint64_t reserved_12_13:2;
992 uint64_t ds_thr:12;
993 uint64_t reserved_26_27:2;
994 uint64_t tc_thr:4;
995 uint64_t tc_en:1;
996 uint64_t reserved_33_63:31;
997#endif
998 } s;
999};
1000
1001#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pow.h b/arch/mips/include/asm/octeon/cvmx-pow.h
new file mode 100644
index 000000000..a3b23811e
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-pow.h
@@ -0,0 +1,2215 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 * Interface to the hardware Packet Order / Work unit.
30 *
31 * New, starting with SDK 1.7.0, cvmx-pow supports a number of
32 * extended consistency checks. The define
33 * CVMX_ENABLE_POW_CHECKS controls the runtime insertion of POW
34 * internal state checks to find common programming errors. If
35 * CVMX_ENABLE_POW_CHECKS is not defined, checks are by default
36 * enabled. For example, cvmx-pow will check for the following
37 * program errors or POW state inconsistency.
38 * - Requesting a POW operation with an active tag switch in
39 * progress.
40 * - Waiting for a tag switch to complete for an excessively
41 * long period. This is normally a sign of an error in locking
42 * causing deadlock.
43 * - Illegal tag switches from NULL_NULL.
44 * - Illegal tag switches from NULL.
45 * - Illegal deschedule request.
46 * - WQE pointer not matching the one attached to the core by
47 * the POW.
48 *
49 */
50
51#ifndef __CVMX_POW_H__
52#define __CVMX_POW_H__
53
54#include <asm/octeon/cvmx-pow-defs.h>
55
56#include <asm/octeon/cvmx-scratch.h>
57#include <asm/octeon/cvmx-wqe.h>
58
59/* Default to having all POW constancy checks turned on */
60#ifndef CVMX_ENABLE_POW_CHECKS
61#define CVMX_ENABLE_POW_CHECKS 1
62#endif
63
64enum cvmx_pow_tag_type {
65 /* Tag ordering is maintained */
66 CVMX_POW_TAG_TYPE_ORDERED = 0L,
67 /* Tag ordering is maintained, and at most one PP has the tag */
68 CVMX_POW_TAG_TYPE_ATOMIC = 1L,
69 /*
70 * The work queue entry from the order - NEVER tag switch from
71 * NULL to NULL
72 */
73 CVMX_POW_TAG_TYPE_NULL = 2L,
74 /* A tag switch to NULL, and there is no space reserved in POW
75 * - NEVER tag switch to NULL_NULL
76 * - NEVER tag switch from NULL_NULL
77 * - NULL_NULL is entered at the beginning of time and on a deschedule.
78 * - NULL_NULL can be exited by a new work request. A NULL_SWITCH
79 * load can also switch the state to NULL
80 */
81 CVMX_POW_TAG_TYPE_NULL_NULL = 3L
82};
83
84/**
85 * Wait flag values for pow functions.
86 */
87typedef enum {
88 CVMX_POW_WAIT = 1,
89 CVMX_POW_NO_WAIT = 0,
90} cvmx_pow_wait_t;
91
92/**
93 * POW tag operations. These are used in the data stored to the POW.
94 */
95typedef enum {
96 /*
97 * switch the tag (only) for this PP
98 * - the previous tag should be non-NULL in this case
99 * - tag switch response required
100 * - fields used: op, type, tag
101 */
102 CVMX_POW_TAG_OP_SWTAG = 0L,
103 /*
104 * switch the tag for this PP, with full information
105 * - this should be used when the previous tag is NULL
106 * - tag switch response required
107 * - fields used: address, op, grp, type, tag
108 */
109 CVMX_POW_TAG_OP_SWTAG_FULL = 1L,
110 /*
111 * switch the tag (and/or group) for this PP and de-schedule
112 * - OK to keep the tag the same and only change the group
113 * - fields used: op, no_sched, grp, type, tag
114 */
115 CVMX_POW_TAG_OP_SWTAG_DESCH = 2L,
116 /*
117 * just de-schedule
118 * - fields used: op, no_sched
119 */
120 CVMX_POW_TAG_OP_DESCH = 3L,
121 /*
122 * create an entirely new work queue entry
123 * - fields used: address, op, qos, grp, type, tag
124 */
125 CVMX_POW_TAG_OP_ADDWQ = 4L,
126 /*
127 * just update the work queue pointer and grp for this PP
128 * - fields used: address, op, grp
129 */
130 CVMX_POW_TAG_OP_UPDATE_WQP_GRP = 5L,
131 /*
132 * set the no_sched bit on the de-schedule list
133 *
134 * - does nothing if the selected entry is not on the
135 * de-schedule list
136 *
137 * - does nothing if the stored work queue pointer does not
138 * match the address field
139 *
140 * - fields used: address, index, op
141 *
142 * Before issuing a *_NSCHED operation, SW must guarantee
143 * that all prior deschedules and set/clr NSCHED operations
144 * are complete and all prior switches are complete. The
145 * hardware provides the opsdone bit and swdone bit for SW
146 * polling. After issuing a *_NSCHED operation, SW must
147 * guarantee that the set/clr NSCHED is complete before any
148 * subsequent operations.
149 */
150 CVMX_POW_TAG_OP_SET_NSCHED = 6L,
151 /*
152 * clears the no_sched bit on the de-schedule list
153 *
154 * - does nothing if the selected entry is not on the
155 * de-schedule list
156 *
157 * - does nothing if the stored work queue pointer does not
158 * match the address field
159 *
160 * - fields used: address, index, op
161 *
162 * Before issuing a *_NSCHED operation, SW must guarantee that
163 * all prior deschedules and set/clr NSCHED operations are
164 * complete and all prior switches are complete. The hardware
165 * provides the opsdone bit and swdone bit for SW
166 * polling. After issuing a *_NSCHED operation, SW must
167 * guarantee that the set/clr NSCHED is complete before any
168 * subsequent operations.
169 */
170 CVMX_POW_TAG_OP_CLR_NSCHED = 7L,
171 /* do nothing */
172 CVMX_POW_TAG_OP_NOP = 15L
173} cvmx_pow_tag_op_t;
174
175/**
176 * This structure defines the store data on a store to POW
177 */
178typedef union {
179 uint64_t u64;
180 struct {
181#ifdef __BIG_ENDIAN_BITFIELD
182 /*
183 * Don't reschedule this entry. no_sched is used for
184 * CVMX_POW_TAG_OP_SWTAG_DESCH and
185 * CVMX_POW_TAG_OP_DESCH
186 */
187 uint64_t no_sched:1;
188 uint64_t unused:2;
189 /* Tontains index of entry for a CVMX_POW_TAG_OP_*_NSCHED */
190 uint64_t index:13;
191 /* The operation to perform */
192 cvmx_pow_tag_op_t op:4;
193 uint64_t unused2:2;
194 /*
195 * The QOS level for the packet. qos is only used for
196 * CVMX_POW_TAG_OP_ADDWQ
197 */
198 uint64_t qos:3;
199 /*
200 * The group that the work queue entry will be
201 * scheduled to grp is used for CVMX_POW_TAG_OP_ADDWQ,
202 * CVMX_POW_TAG_OP_SWTAG_FULL,
203 * CVMX_POW_TAG_OP_SWTAG_DESCH, and
204 * CVMX_POW_TAG_OP_UPDATE_WQP_GRP
205 */
206 uint64_t grp:4;
207 /*
208 * The type of the tag. type is used for everything
209 * except CVMX_POW_TAG_OP_DESCH,
210 * CVMX_POW_TAG_OP_UPDATE_WQP_GRP, and
211 * CVMX_POW_TAG_OP_*_NSCHED
212 */
213 uint64_t type:3;
214 /*
215 * The actual tag. tag is used for everything except
216 * CVMX_POW_TAG_OP_DESCH,
217 * CVMX_POW_TAG_OP_UPDATE_WQP_GRP, and
218 * CVMX_POW_TAG_OP_*_NSCHED
219 */
220 uint64_t tag:32;
221#else
222 uint64_t tag:32;
223 uint64_t type:3;
224 uint64_t grp:4;
225 uint64_t qos:3;
226 uint64_t unused2:2;
227 cvmx_pow_tag_op_t op:4;
228 uint64_t index:13;
229 uint64_t unused:2;
230 uint64_t no_sched:1;
231#endif
232 } s;
233} cvmx_pow_tag_req_t;
234
235/**
236 * This structure describes the address to load stuff from POW
237 */
238typedef union {
239 uint64_t u64;
240
241 /**
242 * Address for new work request loads (did<2:0> == 0)
243 */
244 struct {
245#ifdef __BIG_ENDIAN_BITFIELD
246 /* Mips64 address region. Should be CVMX_IO_SEG */
247 uint64_t mem_region:2;
248 /* Must be zero */
249 uint64_t reserved_49_61:13;
250 /* Must be one */
251 uint64_t is_io:1;
252 /* the ID of POW -- did<2:0> == 0 in this case */
253 uint64_t did:8;
254 /* Must be zero */
255 uint64_t reserved_4_39:36;
256 /*
257 * If set, don't return load response until work is
258 * available.
259 */
260 uint64_t wait:1;
261 /* Must be zero */
262 uint64_t reserved_0_2:3;
263#else
264 uint64_t reserved_0_2:3;
265 uint64_t wait:1;
266 uint64_t reserved_4_39:36;
267 uint64_t did:8;
268 uint64_t is_io:1;
269 uint64_t reserved_49_61:13;
270 uint64_t mem_region:2;
271#endif
272 } swork;
273
274 /**
275 * Address for loads to get POW internal status
276 */
277 struct {
278#ifdef __BIG_ENDIAN_BITFIELD
279 /* Mips64 address region. Should be CVMX_IO_SEG */
280 uint64_t mem_region:2;
281 /* Must be zero */
282 uint64_t reserved_49_61:13;
283 /* Must be one */
284 uint64_t is_io:1;
285 /* the ID of POW -- did<2:0> == 1 in this case */
286 uint64_t did:8;
287 /* Must be zero */
288 uint64_t reserved_10_39:30;
289 /* The core id to get status for */
290 uint64_t coreid:4;
291 /*
292 * If set and get_cur is set, return reverse tag-list
293 * pointer rather than forward tag-list pointer.
294 */
295 uint64_t get_rev:1;
296 /*
297 * If set, return current status rather than pending
298 * status.
299 */
300 uint64_t get_cur:1;
301 /*
302 * If set, get the work-queue pointer rather than
303 * tag/type.
304 */
305 uint64_t get_wqp:1;
306 /* Must be zero */
307 uint64_t reserved_0_2:3;
308#else
309 uint64_t reserved_0_2:3;
310 uint64_t get_wqp:1;
311 uint64_t get_cur:1;
312 uint64_t get_rev:1;
313 uint64_t coreid:4;
314 uint64_t reserved_10_39:30;
315 uint64_t did:8;
316 uint64_t is_io:1;
317 uint64_t reserved_49_61:13;
318 uint64_t mem_region:2;
319#endif
320 } sstatus;
321
322 /**
323 * Address for memory loads to get POW internal state
324 */
325 struct {
326#ifdef __BIG_ENDIAN_BITFIELD
327 /* Mips64 address region. Should be CVMX_IO_SEG */
328 uint64_t mem_region:2;
329 /* Must be zero */
330 uint64_t reserved_49_61:13;
331 /* Must be one */
332 uint64_t is_io:1;
333 /* the ID of POW -- did<2:0> == 2 in this case */
334 uint64_t did:8;
335 /* Must be zero */
336 uint64_t reserved_16_39:24;
337 /* POW memory index */
338 uint64_t index:11;
339 /*
340 * If set, return deschedule information rather than
341 * the standard response for work-queue index (invalid
342 * if the work-queue entry is not on the deschedule
343 * list).
344 */
345 uint64_t get_des:1;
346 /*
347 * If set, get the work-queue pointer rather than
348 * tag/type (no effect when get_des set).
349 */
350 uint64_t get_wqp:1;
351 /* Must be zero */
352 uint64_t reserved_0_2:3;
353#else
354 uint64_t reserved_0_2:3;
355 uint64_t get_wqp:1;
356 uint64_t get_des:1;
357 uint64_t index:11;
358 uint64_t reserved_16_39:24;
359 uint64_t did:8;
360 uint64_t is_io:1;
361 uint64_t reserved_49_61:13;
362 uint64_t mem_region:2;
363#endif
364 } smemload;
365
366 /**
367 * Address for index/pointer loads
368 */
369 struct {
370#ifdef __BIG_ENDIAN_BITFIELD
371 /* Mips64 address region. Should be CVMX_IO_SEG */
372 uint64_t mem_region:2;
373 /* Must be zero */
374 uint64_t reserved_49_61:13;
375 /* Must be one */
376 uint64_t is_io:1;
377 /* the ID of POW -- did<2:0> == 3 in this case */
378 uint64_t did:8;
379 /* Must be zero */
380 uint64_t reserved_9_39:31;
381 /*
382 * when {get_rmt ==0 AND get_des_get_tail == 0}, this
383 * field selects one of eight POW internal-input
384 * queues (0-7), one per QOS level; values 8-15 are
385 * illegal in this case; when {get_rmt ==0 AND
386 * get_des_get_tail == 1}, this field selects one of
387 * 16 deschedule lists (per group); when get_rmt ==1,
388 * this field selects one of 16 memory-input queue
389 * lists. The two memory-input queue lists associated
390 * with each QOS level are:
391 *
392 * - qosgrp = 0, qosgrp = 8: QOS0
393 * - qosgrp = 1, qosgrp = 9: QOS1
394 * - qosgrp = 2, qosgrp = 10: QOS2
395 * - qosgrp = 3, qosgrp = 11: QOS3
396 * - qosgrp = 4, qosgrp = 12: QOS4
397 * - qosgrp = 5, qosgrp = 13: QOS5
398 * - qosgrp = 6, qosgrp = 14: QOS6
399 * - qosgrp = 7, qosgrp = 15: QOS7
400 */
401 uint64_t qosgrp:4;
402 /*
403 * If set and get_rmt is clear, return deschedule list
404 * indexes rather than indexes for the specified qos
405 * level; if set and get_rmt is set, return the tail
406 * pointer rather than the head pointer for the
407 * specified qos level.
408 */
409 uint64_t get_des_get_tail:1;
410 /*
411 * If set, return remote pointers rather than the
412 * local indexes for the specified qos level.
413 */
414 uint64_t get_rmt:1;
415 /* Must be zero */
416 uint64_t reserved_0_2:3;
417#else
418 uint64_t reserved_0_2:3;
419 uint64_t get_rmt:1;
420 uint64_t get_des_get_tail:1;
421 uint64_t qosgrp:4;
422 uint64_t reserved_9_39:31;
423 uint64_t did:8;
424 uint64_t is_io:1;
425 uint64_t reserved_49_61:13;
426 uint64_t mem_region:2;
427#endif
428 } sindexload;
429
430 /**
431 * address for NULL_RD request (did<2:0> == 4) when this is read,
432 * HW attempts to change the state to NULL if it is NULL_NULL (the
433 * hardware cannot switch from NULL_NULL to NULL if a POW entry is
434 * not available - software may need to recover by finishing
435 * another piece of work before a POW entry can ever become
436 * available.)
437 */
438 struct {
439#ifdef __BIG_ENDIAN_BITFIELD
440 /* Mips64 address region. Should be CVMX_IO_SEG */
441 uint64_t mem_region:2;
442 /* Must be zero */
443 uint64_t reserved_49_61:13;
444 /* Must be one */
445 uint64_t is_io:1;
446 /* the ID of POW -- did<2:0> == 4 in this case */
447 uint64_t did:8;
448 /* Must be zero */
449 uint64_t reserved_0_39:40;
450#else
451 uint64_t reserved_0_39:40;
452 uint64_t did:8;
453 uint64_t is_io:1;
454 uint64_t reserved_49_61:13;
455 uint64_t mem_region:2;
456#endif
457 } snull_rd;
458} cvmx_pow_load_addr_t;
459
460/**
461 * This structure defines the response to a load/SENDSINGLE to POW
462 * (except CSR reads)
463 */
464typedef union {
465 uint64_t u64;
466
467 /**
468 * Response to new work request loads
469 */
470 struct {
471#ifdef __BIG_ENDIAN_BITFIELD
472 /*
473 * Set when no new work queue entry was returned. *
474 * If there was de-scheduled work, the HW will
475 * definitely return it. When this bit is set, it
476 * could mean either mean:
477 *
478 * - There was no work, or
479 *
480 * - There was no work that the HW could find. This
481 * case can happen, regardless of the wait bit value
482 * in the original request, when there is work in
483 * the IQ's that is too deep down the list.
484 */
485 uint64_t no_work:1;
486 /* Must be zero */
487 uint64_t reserved_40_62:23;
488 /* 36 in O1 -- the work queue pointer */
489 uint64_t addr:40;
490#else
491 uint64_t addr:40;
492 uint64_t reserved_40_62:23;
493 uint64_t no_work:1;
494#endif
495 } s_work;
496
497 /**
498 * Result for a POW Status Load (when get_cur==0 and get_wqp==0)
499 */
500 struct {
501#ifdef __BIG_ENDIAN_BITFIELD
502 uint64_t reserved_62_63:2;
503 /* Set when there is a pending non-NULL SWTAG or
504 * SWTAG_FULL, and the POW entry has not left the list
505 * for the original tag. */
506 uint64_t pend_switch:1;
507 /* Set when SWTAG_FULL and pend_switch is set. */
508 uint64_t pend_switch_full:1;
509 /*
510 * Set when there is a pending NULL SWTAG, or an
511 * implicit switch to NULL.
512 */
513 uint64_t pend_switch_null:1;
514 /* Set when there is a pending DESCHED or SWTAG_DESCHED. */
515 uint64_t pend_desched:1;
516 /*
517 * Set when there is a pending SWTAG_DESCHED and
518 * pend_desched is set.
519 */
520 uint64_t pend_desched_switch:1;
521 /* Set when nosched is desired and pend_desched is set. */
522 uint64_t pend_nosched:1;
523 /* Set when there is a pending GET_WORK. */
524 uint64_t pend_new_work:1;
525 /*
526 * When pend_new_work is set, this bit indicates that
527 * the wait bit was set.
528 */
529 uint64_t pend_new_work_wait:1;
530 /* Set when there is a pending NULL_RD. */
531 uint64_t pend_null_rd:1;
532 /* Set when there is a pending CLR_NSCHED. */
533 uint64_t pend_nosched_clr:1;
534 uint64_t reserved_51:1;
535 /* This is the index when pend_nosched_clr is set. */
536 uint64_t pend_index:11;
537 /*
538 * This is the new_grp when (pend_desched AND
539 * pend_desched_switch) is set.
540 */
541 uint64_t pend_grp:4;
542 uint64_t reserved_34_35:2;
543 /*
544 * This is the tag type when pend_switch or
545 * (pend_desched AND pend_desched_switch) are set.
546 */
547 uint64_t pend_type:2;
548 /*
549 * - this is the tag when pend_switch or (pend_desched
550 * AND pend_desched_switch) are set.
551 */
552 uint64_t pend_tag:32;
553#else
554 uint64_t pend_tag:32;
555 uint64_t pend_type:2;
556 uint64_t reserved_34_35:2;
557 uint64_t pend_grp:4;
558 uint64_t pend_index:11;
559 uint64_t reserved_51:1;
560 uint64_t pend_nosched_clr:1;
561 uint64_t pend_null_rd:1;
562 uint64_t pend_new_work_wait:1;
563 uint64_t pend_new_work:1;
564 uint64_t pend_nosched:1;
565 uint64_t pend_desched_switch:1;
566 uint64_t pend_desched:1;
567 uint64_t pend_switch_null:1;
568 uint64_t pend_switch_full:1;
569 uint64_t pend_switch:1;
570 uint64_t reserved_62_63:2;
571#endif
572 } s_sstatus0;
573
574 /**
575 * Result for a POW Status Load (when get_cur==0 and get_wqp==1)
576 */
577 struct {
578#ifdef __BIG_ENDIAN_BITFIELD
579 uint64_t reserved_62_63:2;
580 /*
581 * Set when there is a pending non-NULL SWTAG or
582 * SWTAG_FULL, and the POW entry has not left the list
583 * for the original tag.
584 */
585 uint64_t pend_switch:1;
586 /* Set when SWTAG_FULL and pend_switch is set. */
587 uint64_t pend_switch_full:1;
588 /*
589 * Set when there is a pending NULL SWTAG, or an
590 * implicit switch to NULL.
591 */
592 uint64_t pend_switch_null:1;
593 /*
594 * Set when there is a pending DESCHED or
595 * SWTAG_DESCHED.
596 */
597 uint64_t pend_desched:1;
598 /*
599 * Set when there is a pending SWTAG_DESCHED and
600 * pend_desched is set.
601 */
602 uint64_t pend_desched_switch:1;
603 /* Set when nosched is desired and pend_desched is set. */
604 uint64_t pend_nosched:1;
605 /* Set when there is a pending GET_WORK. */
606 uint64_t pend_new_work:1;
607 /*
608 * When pend_new_work is set, this bit indicates that
609 * the wait bit was set.
610 */
611 uint64_t pend_new_work_wait:1;
612 /* Set when there is a pending NULL_RD. */
613 uint64_t pend_null_rd:1;
614 /* Set when there is a pending CLR_NSCHED. */
615 uint64_t pend_nosched_clr:1;
616 uint64_t reserved_51:1;
617 /* This is the index when pend_nosched_clr is set. */
618 uint64_t pend_index:11;
619 /*
620 * This is the new_grp when (pend_desched AND
621 * pend_desched_switch) is set.
622 */
623 uint64_t pend_grp:4;
624 /* This is the wqp when pend_nosched_clr is set. */
625 uint64_t pend_wqp:36;
626#else
627 uint64_t pend_wqp:36;
628 uint64_t pend_grp:4;
629 uint64_t pend_index:11;
630 uint64_t reserved_51:1;
631 uint64_t pend_nosched_clr:1;
632 uint64_t pend_null_rd:1;
633 uint64_t pend_new_work_wait:1;
634 uint64_t pend_new_work:1;
635 uint64_t pend_nosched:1;
636 uint64_t pend_desched_switch:1;
637 uint64_t pend_desched:1;
638 uint64_t pend_switch_null:1;
639 uint64_t pend_switch_full:1;
640 uint64_t pend_switch:1;
641 uint64_t reserved_62_63:2;
642#endif
643 } s_sstatus1;
644
645 /**
646 * Result for a POW Status Load (when get_cur==1, get_wqp==0, and
647 * get_rev==0)
648 */
649 struct {
650#ifdef __BIG_ENDIAN_BITFIELD
651 uint64_t reserved_62_63:2;
652 /*
653 * Points to the next POW entry in the tag list when
654 * tail == 0 (and tag_type is not NULL or NULL_NULL).
655 */
656 uint64_t link_index:11;
657 /* The POW entry attached to the core. */
658 uint64_t index:11;
659 /*
660 * The group attached to the core (updated when new
661 * tag list entered on SWTAG_FULL).
662 */
663 uint64_t grp:4;
664 /*
665 * Set when this POW entry is at the head of its tag
666 * list (also set when in the NULL or NULL_NULL
667 * state).
668 */
669 uint64_t head:1;
670 /*
671 * Set when this POW entry is at the tail of its tag
672 * list (also set when in the NULL or NULL_NULL
673 * state).
674 */
675 uint64_t tail:1;
676 /*
677 * The tag type attached to the core (updated when new
678 * tag list entered on SWTAG, SWTAG_FULL, or
679 * SWTAG_DESCHED).
680 */
681 uint64_t tag_type:2;
682 /*
683 * The tag attached to the core (updated when new tag
684 * list entered on SWTAG, SWTAG_FULL, or
685 * SWTAG_DESCHED).
686 */
687 uint64_t tag:32;
688#else
689 uint64_t tag:32;
690 uint64_t tag_type:2;
691 uint64_t tail:1;
692 uint64_t head:1;
693 uint64_t grp:4;
694 uint64_t index:11;
695 uint64_t link_index:11;
696 uint64_t reserved_62_63:2;
697#endif
698 } s_sstatus2;
699
700 /**
701 * Result for a POW Status Load (when get_cur==1, get_wqp==0, and get_rev==1)
702 */
703 struct {
704#ifdef __BIG_ENDIAN_BITFIELD
705 uint64_t reserved_62_63:2;
706 /*
707 * Points to the prior POW entry in the tag list when
708 * head == 0 (and tag_type is not NULL or
709 * NULL_NULL). This field is unpredictable when the
710 * core's state is NULL or NULL_NULL.
711 */
712 uint64_t revlink_index:11;
713 /* The POW entry attached to the core. */
714 uint64_t index:11;
715 /*
716 * The group attached to the core (updated when new
717 * tag list entered on SWTAG_FULL).
718 */
719 uint64_t grp:4;
720 /* Set when this POW entry is at the head of its tag
721 * list (also set when in the NULL or NULL_NULL
722 * state).
723 */
724 uint64_t head:1;
725 /*
726 * Set when this POW entry is at the tail of its tag
727 * list (also set when in the NULL or NULL_NULL
728 * state).
729 */
730 uint64_t tail:1;
731 /*
732 * The tag type attached to the core (updated when new
733 * tag list entered on SWTAG, SWTAG_FULL, or
734 * SWTAG_DESCHED).
735 */
736 uint64_t tag_type:2;
737 /*
738 * The tag attached to the core (updated when new tag
739 * list entered on SWTAG, SWTAG_FULL, or
740 * SWTAG_DESCHED).
741 */
742 uint64_t tag:32;
743#else
744 uint64_t tag:32;
745 uint64_t tag_type:2;
746 uint64_t tail:1;
747 uint64_t head:1;
748 uint64_t grp:4;
749 uint64_t index:11;
750 uint64_t revlink_index:11;
751 uint64_t reserved_62_63:2;
752#endif
753 } s_sstatus3;
754
755 /**
756 * Result for a POW Status Load (when get_cur==1, get_wqp==1, and
757 * get_rev==0)
758 */
759 struct {
760#ifdef __BIG_ENDIAN_BITFIELD
761 uint64_t reserved_62_63:2;
762 /*
763 * Points to the next POW entry in the tag list when
764 * tail == 0 (and tag_type is not NULL or NULL_NULL).
765 */
766 uint64_t link_index:11;
767 /* The POW entry attached to the core. */
768 uint64_t index:11;
769 /*
770 * The group attached to the core (updated when new
771 * tag list entered on SWTAG_FULL).
772 */
773 uint64_t grp:4;
774 /*
775 * The wqp attached to the core (updated when new tag
776 * list entered on SWTAG_FULL).
777 */
778 uint64_t wqp:36;
779#else
780 uint64_t wqp:36;
781 uint64_t grp:4;
782 uint64_t index:11;
783 uint64_t link_index:11;
784 uint64_t reserved_62_63:2;
785#endif
786 } s_sstatus4;
787
788 /**
789 * Result for a POW Status Load (when get_cur==1, get_wqp==1, and
790 * get_rev==1)
791 */
792 struct {
793#ifdef __BIG_ENDIAN_BITFIELD
794 uint64_t reserved_62_63:2;
795 /*
796 * Points to the prior POW entry in the tag list when
797 * head == 0 (and tag_type is not NULL or
798 * NULL_NULL). This field is unpredictable when the
799 * core's state is NULL or NULL_NULL.
800 */
801 uint64_t revlink_index:11;
802 /* The POW entry attached to the core. */
803 uint64_t index:11;
804 /*
805 * The group attached to the core (updated when new
806 * tag list entered on SWTAG_FULL).
807 */
808 uint64_t grp:4;
809 /*
810 * The wqp attached to the core (updated when new tag
811 * list entered on SWTAG_FULL).
812 */
813 uint64_t wqp:36;
814#else
815 uint64_t wqp:36;
816 uint64_t grp:4;
817 uint64_t index:11;
818 uint64_t revlink_index:11;
819 uint64_t reserved_62_63:2;
820#endif
821 } s_sstatus5;
822
823 /**
824 * Result For POW Memory Load (get_des == 0 and get_wqp == 0)
825 */
826 struct {
827#ifdef __BIG_ENDIAN_BITFIELD
828 uint64_t reserved_51_63:13;
829 /*
830 * The next entry in the input, free, descheduled_head
831 * list (unpredictable if entry is the tail of the
832 * list).
833 */
834 uint64_t next_index:11;
835 /* The group of the POW entry. */
836 uint64_t grp:4;
837 uint64_t reserved_35:1;
838 /*
839 * Set when this POW entry is at the tail of its tag
840 * list (also set when in the NULL or NULL_NULL
841 * state).
842 */
843 uint64_t tail:1;
844 /* The tag type of the POW entry. */
845 uint64_t tag_type:2;
846 /* The tag of the POW entry. */
847 uint64_t tag:32;
848#else
849 uint64_t tag:32;
850 uint64_t tag_type:2;
851 uint64_t tail:1;
852 uint64_t reserved_35:1;
853 uint64_t grp:4;
854 uint64_t next_index:11;
855 uint64_t reserved_51_63:13;
856#endif
857 } s_smemload0;
858
859 /**
860 * Result For POW Memory Load (get_des == 0 and get_wqp == 1)
861 */
862 struct {
863#ifdef __BIG_ENDIAN_BITFIELD
864 uint64_t reserved_51_63:13;
865 /*
866 * The next entry in the input, free, descheduled_head
867 * list (unpredictable if entry is the tail of the
868 * list).
869 */
870 uint64_t next_index:11;
871 /* The group of the POW entry. */
872 uint64_t grp:4;
873 /* The WQP held in the POW entry. */
874 uint64_t wqp:36;
875#else
876 uint64_t wqp:36;
877 uint64_t grp:4;
878 uint64_t next_index:11;
879 uint64_t reserved_51_63:13;
880#endif
881 } s_smemload1;
882
883 /**
884 * Result For POW Memory Load (get_des == 1)
885 */
886 struct {
887#ifdef __BIG_ENDIAN_BITFIELD
888 uint64_t reserved_51_63:13;
889 /*
890 * The next entry in the tag list connected to the
891 * descheduled head.
892 */
893 uint64_t fwd_index:11;
894 /* The group of the POW entry. */
895 uint64_t grp:4;
896 /* The nosched bit for the POW entry. */
897 uint64_t nosched:1;
898 /* There is a pending tag switch */
899 uint64_t pend_switch:1;
900 /*
901 * The next tag type for the new tag list when
902 * pend_switch is set.
903 */
904 uint64_t pend_type:2;
905 /*
906 * The next tag for the new tag list when pend_switch
907 * is set.
908 */
909 uint64_t pend_tag:32;
910#else
911 uint64_t pend_tag:32;
912 uint64_t pend_type:2;
913 uint64_t pend_switch:1;
914 uint64_t nosched:1;
915 uint64_t grp:4;
916 uint64_t fwd_index:11;
917 uint64_t reserved_51_63:13;
918#endif
919 } s_smemload2;
920
921 /**
922 * Result For POW Index/Pointer Load (get_rmt == 0/get_des_get_tail == 0)
923 */
924 struct {
925#ifdef __BIG_ENDIAN_BITFIELD
926 uint64_t reserved_52_63:12;
927 /*
928 * set when there is one or more POW entries on the
929 * free list.
930 */
931 uint64_t free_val:1;
932 /*
933 * set when there is exactly one POW entry on the free
934 * list.
935 */
936 uint64_t free_one:1;
937 uint64_t reserved_49:1;
938 /*
939 * when free_val is set, indicates the first entry on
940 * the free list.
941 */
942 uint64_t free_head:11;
943 uint64_t reserved_37:1;
944 /*
945 * when free_val is set, indicates the last entry on
946 * the free list.
947 */
948 uint64_t free_tail:11;
949 /*
950 * set when there is one or more POW entries on the
951 * input Q list selected by qosgrp.
952 */
953 uint64_t loc_val:1;
954 /*
955 * set when there is exactly one POW entry on the
956 * input Q list selected by qosgrp.
957 */
958 uint64_t loc_one:1;
959 uint64_t reserved_23:1;
960 /*
961 * when loc_val is set, indicates the first entry on
962 * the input Q list selected by qosgrp.
963 */
964 uint64_t loc_head:11;
965 uint64_t reserved_11:1;
966 /*
967 * when loc_val is set, indicates the last entry on
968 * the input Q list selected by qosgrp.
969 */
970 uint64_t loc_tail:11;
971#else
972 uint64_t loc_tail:11;
973 uint64_t reserved_11:1;
974 uint64_t loc_head:11;
975 uint64_t reserved_23:1;
976 uint64_t loc_one:1;
977 uint64_t loc_val:1;
978 uint64_t free_tail:11;
979 uint64_t reserved_37:1;
980 uint64_t free_head:11;
981 uint64_t reserved_49:1;
982 uint64_t free_one:1;
983 uint64_t free_val:1;
984 uint64_t reserved_52_63:12;
985#endif
986 } sindexload0;
987
988 /**
989 * Result For POW Index/Pointer Load (get_rmt == 0/get_des_get_tail == 1)
990 */
991 struct {
992#ifdef __BIG_ENDIAN_BITFIELD
993 uint64_t reserved_52_63:12;
994 /*
995 * set when there is one or more POW entries on the
996 * nosched list.
997 */
998 uint64_t nosched_val:1;
999 /*
1000 * set when there is exactly one POW entry on the
1001 * nosched list.
1002 */
1003 uint64_t nosched_one:1;
1004 uint64_t reserved_49:1;
1005 /*
1006 * when nosched_val is set, indicates the first entry
1007 * on the nosched list.
1008 */
1009 uint64_t nosched_head:11;
1010 uint64_t reserved_37:1;
1011 /*
1012 * when nosched_val is set, indicates the last entry
1013 * on the nosched list.
1014 */
1015 uint64_t nosched_tail:11;
1016 /*
1017 * set when there is one or more descheduled heads on
1018 * the descheduled list selected by qosgrp.
1019 */
1020 uint64_t des_val:1;
1021 /*
1022 * set when there is exactly one descheduled head on
1023 * the descheduled list selected by qosgrp.
1024 */
1025 uint64_t des_one:1;
1026 uint64_t reserved_23:1;
1027 /*
1028 * when des_val is set, indicates the first
1029 * descheduled head on the descheduled list selected
1030 * by qosgrp.
1031 */
1032 uint64_t des_head:11;
1033 uint64_t reserved_11:1;
1034 /*
1035 * when des_val is set, indicates the last descheduled
1036 * head on the descheduled list selected by qosgrp.
1037 */
1038 uint64_t des_tail:11;
1039#else
1040 uint64_t des_tail:11;
1041 uint64_t reserved_11:1;
1042 uint64_t des_head:11;
1043 uint64_t reserved_23:1;
1044 uint64_t des_one:1;
1045 uint64_t des_val:1;
1046 uint64_t nosched_tail:11;
1047 uint64_t reserved_37:1;
1048 uint64_t nosched_head:11;
1049 uint64_t reserved_49:1;
1050 uint64_t nosched_one:1;
1051 uint64_t nosched_val:1;
1052 uint64_t reserved_52_63:12;
1053#endif
1054 } sindexload1;
1055
1056 /**
1057 * Result For POW Index/Pointer Load (get_rmt == 1/get_des_get_tail == 0)
1058 */
1059 struct {
1060#ifdef __BIG_ENDIAN_BITFIELD
1061 uint64_t reserved_39_63:25;
1062 /*
1063 * Set when this DRAM list is the current head
1064 * (i.e. is the next to be reloaded when the POW
1065 * hardware reloads a POW entry from DRAM). The POW
1066 * hardware alternates between the two DRAM lists
1067 * associated with a QOS level when it reloads work
1068 * from DRAM into the POW unit.
1069 */
1070 uint64_t rmt_is_head:1;
1071 /*
1072 * Set when the DRAM portion of the input Q list
1073 * selected by qosgrp contains one or more pieces of
1074 * work.
1075 */
1076 uint64_t rmt_val:1;
1077 /*
1078 * Set when the DRAM portion of the input Q list
1079 * selected by qosgrp contains exactly one piece of
1080 * work.
1081 */
1082 uint64_t rmt_one:1;
1083 /*
1084 * When rmt_val is set, indicates the first piece of
1085 * work on the DRAM input Q list selected by
1086 * qosgrp.
1087 */
1088 uint64_t rmt_head:36;
1089#else
1090 uint64_t rmt_head:36;
1091 uint64_t rmt_one:1;
1092 uint64_t rmt_val:1;
1093 uint64_t rmt_is_head:1;
1094 uint64_t reserved_39_63:25;
1095#endif
1096 } sindexload2;
1097
1098 /**
1099 * Result For POW Index/Pointer Load (get_rmt ==
1100 * 1/get_des_get_tail == 1)
1101 */
1102 struct {
1103#ifdef __BIG_ENDIAN_BITFIELD
1104 uint64_t reserved_39_63:25;
1105 /*
1106 * set when this DRAM list is the current head
1107 * (i.e. is the next to be reloaded when the POW
1108 * hardware reloads a POW entry from DRAM). The POW
1109 * hardware alternates between the two DRAM lists
1110 * associated with a QOS level when it reloads work
1111 * from DRAM into the POW unit.
1112 */
1113 uint64_t rmt_is_head:1;
1114 /*
1115 * set when the DRAM portion of the input Q list
1116 * selected by qosgrp contains one or more pieces of
1117 * work.
1118 */
1119 uint64_t rmt_val:1;
1120 /*
1121 * set when the DRAM portion of the input Q list
1122 * selected by qosgrp contains exactly one piece of
1123 * work.
1124 */
1125 uint64_t rmt_one:1;
1126 /*
1127 * when rmt_val is set, indicates the last piece of
1128 * work on the DRAM input Q list selected by
1129 * qosgrp.
1130 */
1131 uint64_t rmt_tail:36;
1132#else
1133 uint64_t rmt_tail:36;
1134 uint64_t rmt_one:1;
1135 uint64_t rmt_val:1;
1136 uint64_t rmt_is_head:1;
1137 uint64_t reserved_39_63:25;
1138#endif
1139 } sindexload3;
1140
1141 /**
1142 * Response to NULL_RD request loads
1143 */
1144 struct {
1145#ifdef __BIG_ENDIAN_BITFIELD
1146 uint64_t unused:62;
1147 /* of type cvmx_pow_tag_type_t. state is one of the
1148 * following:
1149 *
1150 * - CVMX_POW_TAG_TYPE_ORDERED
1151 * - CVMX_POW_TAG_TYPE_ATOMIC
1152 * - CVMX_POW_TAG_TYPE_NULL
1153 * - CVMX_POW_TAG_TYPE_NULL_NULL
1154 */
1155 uint64_t state:2;
1156#else
1157 uint64_t state:2;
1158 uint64_t unused:62;
1159#endif
1160 } s_null_rd;
1161
1162} cvmx_pow_tag_load_resp_t;
1163
1164/**
1165 * This structure describes the address used for stores to the POW.
1166 * The store address is meaningful on stores to the POW. The
1167 * hardware assumes that an aligned 64-bit store was used for all
1168 * these stores. Note the assumption that the work queue entry is
1169 * aligned on an 8-byte boundary (since the low-order 3 address bits
1170 * must be zero). Note that not all fields are used by all
1171 * operations.
1172 *
1173 * NOTE: The following is the behavior of the pending switch bit at the PP
1174 * for POW stores (i.e. when did<7:3> == 0xc)
1175 * - did<2:0> == 0 => pending switch bit is set
1176 * - did<2:0> == 1 => no affect on the pending switch bit
1177 * - did<2:0> == 3 => pending switch bit is cleared
1178 * - did<2:0> == 7 => no affect on the pending switch bit
1179 * - did<2:0> == others => must not be used
1180 * - No other loads/stores have an affect on the pending switch bit
1181 * - The switch bus from POW can clear the pending switch bit
1182 *
1183 * NOTE: did<2:0> == 2 is used by the HW for a special single-cycle
1184 * ADDWQ command that only contains the pointer). SW must never use
1185 * did<2:0> == 2.
1186 */
1187typedef union {
1188 /**
1189 * Unsigned 64 bit integer representation of store address
1190 */
1191 uint64_t u64;
1192
1193 struct {
1194#ifdef __BIG_ENDIAN_BITFIELD
1195 /* Memory region. Should be CVMX_IO_SEG in most cases */
1196 uint64_t mem_reg:2;
1197 uint64_t reserved_49_61:13; /* Must be zero */
1198 uint64_t is_io:1; /* Must be one */
1199 /* Device ID of POW. Note that different sub-dids are used. */
1200 uint64_t did:8;
1201 uint64_t reserved_36_39:4; /* Must be zero */
1202 /* Address field. addr<2:0> must be zero */
1203 uint64_t addr:36;
1204#else
1205 uint64_t addr:36;
1206 uint64_t reserved_36_39:4;
1207 uint64_t did:8;
1208 uint64_t is_io:1;
1209 uint64_t reserved_49_61:13;
1210 uint64_t mem_reg:2;
1211#endif
1212 } stag;
1213} cvmx_pow_tag_store_addr_t;
1214
1215/**
1216 * decode of the store data when an IOBDMA SENDSINGLE is sent to POW
1217 */
1218typedef union {
1219 uint64_t u64;
1220
1221 struct {
1222#ifdef __BIG_ENDIAN_BITFIELD
1223 /*
1224 * the (64-bit word) location in scratchpad to write
1225 * to (if len != 0)
1226 */
1227 uint64_t scraddr:8;
1228 /* the number of words in the response (0 => no response) */
1229 uint64_t len:8;
1230 /* the ID of the device on the non-coherent bus */
1231 uint64_t did:8;
1232 uint64_t unused:36;
1233 /* if set, don't return load response until work is available */
1234 uint64_t wait:1;
1235 uint64_t unused2:3;
1236#else
1237 uint64_t unused2:3;
1238 uint64_t wait:1;
1239 uint64_t unused:36;
1240 uint64_t did:8;
1241 uint64_t len:8;
1242 uint64_t scraddr:8;
1243#endif
1244 } s;
1245
1246} cvmx_pow_iobdma_store_t;
1247
1248/* CSR typedefs have been moved to cvmx-csr-*.h */
1249
1250/**
1251 * Get the POW tag for this core. This returns the current
1252 * tag type, tag, group, and POW entry index associated with
1253 * this core. Index is only valid if the tag type isn't NULL_NULL.
1254 * If a tag switch is pending this routine returns the tag before
1255 * the tag switch, not after.
1256 *
1257 * Returns Current tag
1258 */
1259static inline cvmx_pow_tag_req_t cvmx_pow_get_current_tag(void)
1260{
1261 cvmx_pow_load_addr_t load_addr;
1262 cvmx_pow_tag_load_resp_t load_resp;
1263 cvmx_pow_tag_req_t result;
1264
1265 load_addr.u64 = 0;
1266 load_addr.sstatus.mem_region = CVMX_IO_SEG;
1267 load_addr.sstatus.is_io = 1;
1268 load_addr.sstatus.did = CVMX_OCT_DID_TAG_TAG1;
1269 load_addr.sstatus.coreid = cvmx_get_core_num();
1270 load_addr.sstatus.get_cur = 1;
1271 load_resp.u64 = cvmx_read_csr(load_addr.u64);
1272 result.u64 = 0;
1273 result.s.grp = load_resp.s_sstatus2.grp;
1274 result.s.index = load_resp.s_sstatus2.index;
1275 result.s.type = load_resp.s_sstatus2.tag_type;
1276 result.s.tag = load_resp.s_sstatus2.tag;
1277 return result;
1278}
1279
1280/**
1281 * Get the POW WQE for this core. This returns the work queue
1282 * entry currently associated with this core.
1283 *
1284 * Returns WQE pointer
1285 */
1286static inline struct cvmx_wqe *cvmx_pow_get_current_wqp(void)
1287{
1288 cvmx_pow_load_addr_t load_addr;
1289 cvmx_pow_tag_load_resp_t load_resp;
1290
1291 load_addr.u64 = 0;
1292 load_addr.sstatus.mem_region = CVMX_IO_SEG;
1293 load_addr.sstatus.is_io = 1;
1294 load_addr.sstatus.did = CVMX_OCT_DID_TAG_TAG1;
1295 load_addr.sstatus.coreid = cvmx_get_core_num();
1296 load_addr.sstatus.get_cur = 1;
1297 load_addr.sstatus.get_wqp = 1;
1298 load_resp.u64 = cvmx_read_csr(load_addr.u64);
1299 return (struct cvmx_wqe *) cvmx_phys_to_ptr(load_resp.s_sstatus4.wqp);
1300}
1301
1302#ifndef CVMX_MF_CHORD
1303#define CVMX_MF_CHORD(dest) CVMX_RDHWR(dest, 30)
1304#endif
1305
1306/**
1307 * Print a warning if a tag switch is pending for this core
1308 *
1309 * @function: Function name checking for a pending tag switch
1310 */
1311static inline void __cvmx_pow_warn_if_pending_switch(const char *function)
1312{
1313 uint64_t switch_complete;
1314 CVMX_MF_CHORD(switch_complete);
1315 if (!switch_complete)
1316 pr_warn("%s called with tag switch in progress\n", function);
1317}
1318
1319/**
1320 * Waits for a tag switch to complete by polling the completion bit.
1321 * Note that switches to NULL complete immediately and do not need
1322 * to be waited for.
1323 */
1324static inline void cvmx_pow_tag_sw_wait(void)
1325{
1326 const uint64_t MAX_CYCLES = 1ull << 31;
1327 uint64_t switch_complete;
1328 uint64_t start_cycle = cvmx_get_cycle();
1329 while (1) {
1330 CVMX_MF_CHORD(switch_complete);
1331 if (unlikely(switch_complete))
1332 break;
1333 if (unlikely(cvmx_get_cycle() > start_cycle + MAX_CYCLES)) {
1334 pr_warn("Tag switch is taking a long time, possible deadlock\n");
1335 start_cycle = -MAX_CYCLES - 1;
1336 }
1337 }
1338}
1339
1340/**
1341 * Synchronous work request. Requests work from the POW.
1342 * This function does NOT wait for previous tag switches to complete,
1343 * so the caller must ensure that there is not a pending tag switch.
1344 *
1345 * @wait: When set, call stalls until work becomes avaiable, or times out.
1346 * If not set, returns immediately.
1347 *
1348 * Returns: the WQE pointer from POW. Returns NULL if no work
1349 * was available.
1350 */
1351static inline struct cvmx_wqe *cvmx_pow_work_request_sync_nocheck(cvmx_pow_wait_t
1352 wait)
1353{
1354 cvmx_pow_load_addr_t ptr;
1355 cvmx_pow_tag_load_resp_t result;
1356
1357 if (CVMX_ENABLE_POW_CHECKS)
1358 __cvmx_pow_warn_if_pending_switch(__func__);
1359
1360 ptr.u64 = 0;
1361 ptr.swork.mem_region = CVMX_IO_SEG;
1362 ptr.swork.is_io = 1;
1363 ptr.swork.did = CVMX_OCT_DID_TAG_SWTAG;
1364 ptr.swork.wait = wait;
1365
1366 result.u64 = cvmx_read_csr(ptr.u64);
1367
1368 if (result.s_work.no_work)
1369 return NULL;
1370 else
1371 return (struct cvmx_wqe *) cvmx_phys_to_ptr(result.s_work.addr);
1372}
1373
1374/**
1375 * Synchronous work request. Requests work from the POW.
1376 * This function waits for any previous tag switch to complete before
1377 * requesting the new work.
1378 *
1379 * @wait: When set, call stalls until work becomes avaiable, or times out.
1380 * If not set, returns immediately.
1381 *
1382 * Returns: the WQE pointer from POW. Returns NULL if no work
1383 * was available.
1384 */
1385static inline struct cvmx_wqe *cvmx_pow_work_request_sync(cvmx_pow_wait_t wait)
1386{
1387 if (CVMX_ENABLE_POW_CHECKS)
1388 __cvmx_pow_warn_if_pending_switch(__func__);
1389
1390 /* Must not have a switch pending when requesting work */
1391 cvmx_pow_tag_sw_wait();
1392 return cvmx_pow_work_request_sync_nocheck(wait);
1393
1394}
1395
1396/**
1397 * Synchronous null_rd request. Requests a switch out of NULL_NULL POW state.
1398 * This function waits for any previous tag switch to complete before
1399 * requesting the null_rd.
1400 *
1401 * Returns: the POW state of type cvmx_pow_tag_type_t.
1402 */
1403static inline enum cvmx_pow_tag_type cvmx_pow_work_request_null_rd(void)
1404{
1405 cvmx_pow_load_addr_t ptr;
1406 cvmx_pow_tag_load_resp_t result;
1407
1408 if (CVMX_ENABLE_POW_CHECKS)
1409 __cvmx_pow_warn_if_pending_switch(__func__);
1410
1411 /* Must not have a switch pending when requesting work */
1412 cvmx_pow_tag_sw_wait();
1413
1414 ptr.u64 = 0;
1415 ptr.snull_rd.mem_region = CVMX_IO_SEG;
1416 ptr.snull_rd.is_io = 1;
1417 ptr.snull_rd.did = CVMX_OCT_DID_TAG_NULL_RD;
1418
1419 result.u64 = cvmx_read_csr(ptr.u64);
1420
1421 return (enum cvmx_pow_tag_type) result.s_null_rd.state;
1422}
1423
1424/**
1425 * Asynchronous work request. Work is requested from the POW unit,
1426 * and should later be checked with function
1427 * cvmx_pow_work_response_async. This function does NOT wait for
1428 * previous tag switches to complete, so the caller must ensure that
1429 * there is not a pending tag switch.
1430 *
1431 * @scr_addr: Scratch memory address that response will be returned
1432 * to, which is either a valid WQE, or a response with the
1433 * invalid bit set. Byte address, must be 8 byte aligned.
1434 *
1435 * @wait: 1 to cause response to wait for work to become available (or
1436 * timeout), 0 to cause response to return immediately
1437 */
1438static inline void cvmx_pow_work_request_async_nocheck(int scr_addr,
1439 cvmx_pow_wait_t wait)
1440{
1441 cvmx_pow_iobdma_store_t data;
1442
1443 if (CVMX_ENABLE_POW_CHECKS)
1444 __cvmx_pow_warn_if_pending_switch(__func__);
1445
1446 /* scr_addr must be 8 byte aligned */
1447 data.s.scraddr = scr_addr >> 3;
1448 data.s.len = 1;
1449 data.s.did = CVMX_OCT_DID_TAG_SWTAG;
1450 data.s.wait = wait;
1451 cvmx_send_single(data.u64);
1452}
1453
1454/**
1455 * Asynchronous work request. Work is requested from the POW unit,
1456 * and should later be checked with function
1457 * cvmx_pow_work_response_async. This function waits for any previous
1458 * tag switch to complete before requesting the new work.
1459 *
1460 * @scr_addr: Scratch memory address that response will be returned
1461 * to, which is either a valid WQE, or a response with the
1462 * invalid bit set. Byte address, must be 8 byte aligned.
1463 *
1464 * @wait: 1 to cause response to wait for work to become available (or
1465 * timeout), 0 to cause response to return immediately
1466 */
1467static inline void cvmx_pow_work_request_async(int scr_addr,
1468 cvmx_pow_wait_t wait)
1469{
1470 if (CVMX_ENABLE_POW_CHECKS)
1471 __cvmx_pow_warn_if_pending_switch(__func__);
1472
1473 /* Must not have a switch pending when requesting work */
1474 cvmx_pow_tag_sw_wait();
1475 cvmx_pow_work_request_async_nocheck(scr_addr, wait);
1476}
1477
1478/**
1479 * Gets result of asynchronous work request. Performs a IOBDMA sync
1480 * to wait for the response.
1481 *
1482 * @scr_addr: Scratch memory address to get result from Byte address,
1483 * must be 8 byte aligned.
1484 *
1485 * Returns: the WQE from the scratch register, or NULL if no
1486 * work was available.
1487 */
1488static inline struct cvmx_wqe *cvmx_pow_work_response_async(int scr_addr)
1489{
1490 cvmx_pow_tag_load_resp_t result;
1491
1492 CVMX_SYNCIOBDMA;
1493 result.u64 = cvmx_scratch_read64(scr_addr);
1494
1495 if (result.s_work.no_work)
1496 return NULL;
1497 else
1498 return (struct cvmx_wqe *) cvmx_phys_to_ptr(result.s_work.addr);
1499}
1500
1501/**
1502 * Checks if a work queue entry pointer returned by a work
1503 * request is valid. It may be invalid due to no work
1504 * being available or due to a timeout.
1505 *
1506 * @wqe_ptr: pointer to a work queue entry returned by the POW
1507 *
1508 * Returns 0 if pointer is valid
1509 * 1 if invalid (no work was returned)
1510 */
1511static inline uint64_t cvmx_pow_work_invalid(struct cvmx_wqe *wqe_ptr)
1512{
1513 return wqe_ptr == NULL;
1514}
1515
1516/**
1517 * Starts a tag switch to the provided tag value and tag type.
1518 * Completion for the tag switch must be checked for separately. This
1519 * function does NOT update the work queue entry in dram to match tag
1520 * value and type, so the application must keep track of these if they
1521 * are important to the application. This tag switch command must not
1522 * be used for switches to NULL, as the tag switch pending bit will be
1523 * set by the switch request, but never cleared by the hardware.
1524 *
1525 * NOTE: This should not be used when switching from a NULL tag. Use
1526 * cvmx_pow_tag_sw_full() instead.
1527 *
1528 * This function does no checks, so the caller must ensure that any
1529 * previous tag switch has completed.
1530 *
1531 * @tag: new tag value
1532 * @tag_type: new tag type (ordered or atomic)
1533 */
1534static inline void cvmx_pow_tag_sw_nocheck(uint32_t tag,
1535 enum cvmx_pow_tag_type tag_type)
1536{
1537 cvmx_addr_t ptr;
1538 cvmx_pow_tag_req_t tag_req;
1539
1540 if (CVMX_ENABLE_POW_CHECKS) {
1541 cvmx_pow_tag_req_t current_tag;
1542 __cvmx_pow_warn_if_pending_switch(__func__);
1543 current_tag = cvmx_pow_get_current_tag();
1544 if (current_tag.s.type == CVMX_POW_TAG_TYPE_NULL_NULL)
1545 pr_warn("%s called with NULL_NULL tag\n", __func__);
1546 if (current_tag.s.type == CVMX_POW_TAG_TYPE_NULL)
1547 pr_warn("%s called with NULL tag\n", __func__);
1548 if ((current_tag.s.type == tag_type)
1549 && (current_tag.s.tag == tag))
1550 pr_warn("%s called to perform a tag switch to the same tag\n",
1551 __func__);
1552 if (tag_type == CVMX_POW_TAG_TYPE_NULL)
1553 pr_warn("%s called to perform a tag switch to NULL. Use cvmx_pow_tag_sw_null() instead\n",
1554 __func__);
1555 }
1556
1557 /*
1558 * Note that WQE in DRAM is not updated here, as the POW does
1559 * not read from DRAM once the WQE is in flight. See hardware
1560 * manual for complete details. It is the application's
1561 * responsibility to keep track of the current tag value if
1562 * that is important.
1563 */
1564
1565 tag_req.u64 = 0;
1566 tag_req.s.op = CVMX_POW_TAG_OP_SWTAG;
1567 tag_req.s.tag = tag;
1568 tag_req.s.type = tag_type;
1569
1570 ptr.u64 = 0;
1571 ptr.sio.mem_region = CVMX_IO_SEG;
1572 ptr.sio.is_io = 1;
1573 ptr.sio.did = CVMX_OCT_DID_TAG_SWTAG;
1574
1575 /* once this store arrives at POW, it will attempt the switch
1576 software must wait for the switch to complete separately */
1577 cvmx_write_io(ptr.u64, tag_req.u64);
1578}
1579
1580/**
1581 * Starts a tag switch to the provided tag value and tag type.
1582 * Completion for the tag switch must be checked for separately. This
1583 * function does NOT update the work queue entry in dram to match tag
1584 * value and type, so the application must keep track of these if they
1585 * are important to the application. This tag switch command must not
1586 * be used for switches to NULL, as the tag switch pending bit will be
1587 * set by the switch request, but never cleared by the hardware.
1588 *
1589 * NOTE: This should not be used when switching from a NULL tag. Use
1590 * cvmx_pow_tag_sw_full() instead.
1591 *
1592 * This function waits for any previous tag switch to complete, and also
1593 * displays an error on tag switches to NULL.
1594 *
1595 * @tag: new tag value
1596 * @tag_type: new tag type (ordered or atomic)
1597 */
1598static inline void cvmx_pow_tag_sw(uint32_t tag,
1599 enum cvmx_pow_tag_type tag_type)
1600{
1601 if (CVMX_ENABLE_POW_CHECKS)
1602 __cvmx_pow_warn_if_pending_switch(__func__);
1603
1604 /*
1605 * Note that WQE in DRAM is not updated here, as the POW does
1606 * not read from DRAM once the WQE is in flight. See hardware
1607 * manual for complete details. It is the application's
1608 * responsibility to keep track of the current tag value if
1609 * that is important.
1610 */
1611
1612 /*
1613 * Ensure that there is not a pending tag switch, as a tag
1614 * switch cannot be started if a previous switch is still
1615 * pending.
1616 */
1617 cvmx_pow_tag_sw_wait();
1618 cvmx_pow_tag_sw_nocheck(tag, tag_type);
1619}
1620
1621/**
1622 * Starts a tag switch to the provided tag value and tag type.
1623 * Completion for the tag switch must be checked for separately. This
1624 * function does NOT update the work queue entry in dram to match tag
1625 * value and type, so the application must keep track of these if they
1626 * are important to the application. This tag switch command must not
1627 * be used for switches to NULL, as the tag switch pending bit will be
1628 * set by the switch request, but never cleared by the hardware.
1629 *
1630 * This function must be used for tag switches from NULL.
1631 *
1632 * This function does no checks, so the caller must ensure that any
1633 * previous tag switch has completed.
1634 *
1635 * @wqp: pointer to work queue entry to submit. This entry is
1636 * updated to match the other parameters
1637 * @tag: tag value to be assigned to work queue entry
1638 * @tag_type: type of tag
1639 * @group: group value for the work queue entry.
1640 */
1641static inline void cvmx_pow_tag_sw_full_nocheck(struct cvmx_wqe *wqp, uint32_t tag,
1642 enum cvmx_pow_tag_type tag_type,
1643 uint64_t group)
1644{
1645 cvmx_addr_t ptr;
1646 cvmx_pow_tag_req_t tag_req;
1647
1648 if (CVMX_ENABLE_POW_CHECKS) {
1649 cvmx_pow_tag_req_t current_tag;
1650 __cvmx_pow_warn_if_pending_switch(__func__);
1651 current_tag = cvmx_pow_get_current_tag();
1652 if (current_tag.s.type == CVMX_POW_TAG_TYPE_NULL_NULL)
1653 pr_warn("%s called with NULL_NULL tag\n", __func__);
1654 if ((current_tag.s.type == tag_type)
1655 && (current_tag.s.tag == tag))
1656 pr_warn("%s called to perform a tag switch to the same tag\n",
1657 __func__);
1658 if (tag_type == CVMX_POW_TAG_TYPE_NULL)
1659 pr_warn("%s called to perform a tag switch to NULL. Use cvmx_pow_tag_sw_null() instead\n",
1660 __func__);
1661 if (wqp != cvmx_phys_to_ptr(0x80))
1662 if (wqp != cvmx_pow_get_current_wqp())
1663 pr_warn("%s passed WQE(%p) doesn't match the address in the POW(%p)\n",
1664 __func__, wqp,
1665 cvmx_pow_get_current_wqp());
1666 }
1667
1668 /*
1669 * Note that WQE in DRAM is not updated here, as the POW does
1670 * not read from DRAM once the WQE is in flight. See hardware
1671 * manual for complete details. It is the application's
1672 * responsibility to keep track of the current tag value if
1673 * that is important.
1674 */
1675
1676 tag_req.u64 = 0;
1677 tag_req.s.op = CVMX_POW_TAG_OP_SWTAG_FULL;
1678 tag_req.s.tag = tag;
1679 tag_req.s.type = tag_type;
1680 tag_req.s.grp = group;
1681
1682 ptr.u64 = 0;
1683 ptr.sio.mem_region = CVMX_IO_SEG;
1684 ptr.sio.is_io = 1;
1685 ptr.sio.did = CVMX_OCT_DID_TAG_SWTAG;
1686 ptr.sio.offset = CAST64(wqp);
1687
1688 /*
1689 * once this store arrives at POW, it will attempt the switch
1690 * software must wait for the switch to complete separately.
1691 */
1692 cvmx_write_io(ptr.u64, tag_req.u64);
1693}
1694
1695/**
1696 * Starts a tag switch to the provided tag value and tag type.
1697 * Completion for the tag switch must be checked for separately. This
1698 * function does NOT update the work queue entry in dram to match tag
1699 * value and type, so the application must keep track of these if they
1700 * are important to the application. This tag switch command must not
1701 * be used for switches to NULL, as the tag switch pending bit will be
1702 * set by the switch request, but never cleared by the hardware.
1703 *
1704 * This function must be used for tag switches from NULL.
1705 *
1706 * This function waits for any pending tag switches to complete
1707 * before requesting the tag switch.
1708 *
1709 * @wqp: pointer to work queue entry to submit. This entry is updated
1710 * to match the other parameters
1711 * @tag: tag value to be assigned to work queue entry
1712 * @tag_type: type of tag
1713 * @group: group value for the work queue entry.
1714 */
1715static inline void cvmx_pow_tag_sw_full(struct cvmx_wqe *wqp, uint32_t tag,
1716 enum cvmx_pow_tag_type tag_type,
1717 uint64_t group)
1718{
1719 if (CVMX_ENABLE_POW_CHECKS)
1720 __cvmx_pow_warn_if_pending_switch(__func__);
1721
1722 /*
1723 * Ensure that there is not a pending tag switch, as a tag
1724 * switch cannot be started if a previous switch is still
1725 * pending.
1726 */
1727 cvmx_pow_tag_sw_wait();
1728 cvmx_pow_tag_sw_full_nocheck(wqp, tag, tag_type, group);
1729}
1730
1731/**
1732 * Switch to a NULL tag, which ends any ordering or
1733 * synchronization provided by the POW for the current
1734 * work queue entry. This operation completes immediately,
1735 * so completion should not be waited for.
1736 * This function does NOT wait for previous tag switches to complete,
1737 * so the caller must ensure that any previous tag switches have completed.
1738 */
1739static inline void cvmx_pow_tag_sw_null_nocheck(void)
1740{
1741 cvmx_addr_t ptr;
1742 cvmx_pow_tag_req_t tag_req;
1743
1744 if (CVMX_ENABLE_POW_CHECKS) {
1745 cvmx_pow_tag_req_t current_tag;
1746 __cvmx_pow_warn_if_pending_switch(__func__);
1747 current_tag = cvmx_pow_get_current_tag();
1748 if (current_tag.s.type == CVMX_POW_TAG_TYPE_NULL_NULL)
1749 pr_warn("%s called with NULL_NULL tag\n", __func__);
1750 if (current_tag.s.type == CVMX_POW_TAG_TYPE_NULL)
1751 pr_warn("%s called when we already have a NULL tag\n",
1752 __func__);
1753 }
1754
1755 tag_req.u64 = 0;
1756 tag_req.s.op = CVMX_POW_TAG_OP_SWTAG;
1757 tag_req.s.type = CVMX_POW_TAG_TYPE_NULL;
1758
1759 ptr.u64 = 0;
1760 ptr.sio.mem_region = CVMX_IO_SEG;
1761 ptr.sio.is_io = 1;
1762 ptr.sio.did = CVMX_OCT_DID_TAG_TAG1;
1763
1764 cvmx_write_io(ptr.u64, tag_req.u64);
1765
1766 /* switch to NULL completes immediately */
1767}
1768
1769/**
1770 * Switch to a NULL tag, which ends any ordering or
1771 * synchronization provided by the POW for the current
1772 * work queue entry. This operation completes immediately,
1773 * so completion should not be waited for.
1774 * This function waits for any pending tag switches to complete
1775 * before requesting the switch to NULL.
1776 */
1777static inline void cvmx_pow_tag_sw_null(void)
1778{
1779 if (CVMX_ENABLE_POW_CHECKS)
1780 __cvmx_pow_warn_if_pending_switch(__func__);
1781
1782 /*
1783 * Ensure that there is not a pending tag switch, as a tag
1784 * switch cannot be started if a previous switch is still
1785 * pending.
1786 */
1787 cvmx_pow_tag_sw_wait();
1788 cvmx_pow_tag_sw_null_nocheck();
1789
1790 /* switch to NULL completes immediately */
1791}
1792
1793/**
1794 * Submits work to an input queue. This function updates the work
1795 * queue entry in DRAM to match the arguments given. Note that the
1796 * tag provided is for the work queue entry submitted, and is
1797 * unrelated to the tag that the core currently holds.
1798 *
1799 * @wqp: pointer to work queue entry to submit. This entry is
1800 * updated to match the other parameters
1801 * @tag: tag value to be assigned to work queue entry
1802 * @tag_type: type of tag
1803 * @qos: Input queue to add to.
1804 * @grp: group value for the work queue entry.
1805 */
1806static inline void cvmx_pow_work_submit(struct cvmx_wqe *wqp, uint32_t tag,
1807 enum cvmx_pow_tag_type tag_type,
1808 uint64_t qos, uint64_t grp)
1809{
1810 cvmx_addr_t ptr;
1811 cvmx_pow_tag_req_t tag_req;
1812
1813 wqp->word1.tag = tag;
1814 wqp->word1.tag_type = tag_type;
1815
1816 cvmx_wqe_set_qos(wqp, qos);
1817 cvmx_wqe_set_grp(wqp, grp);
1818
1819 tag_req.u64 = 0;
1820 tag_req.s.op = CVMX_POW_TAG_OP_ADDWQ;
1821 tag_req.s.type = tag_type;
1822 tag_req.s.tag = tag;
1823 tag_req.s.qos = qos;
1824 tag_req.s.grp = grp;
1825
1826 ptr.u64 = 0;
1827 ptr.sio.mem_region = CVMX_IO_SEG;
1828 ptr.sio.is_io = 1;
1829 ptr.sio.did = CVMX_OCT_DID_TAG_TAG1;
1830 ptr.sio.offset = cvmx_ptr_to_phys(wqp);
1831
1832 /*
1833 * SYNC write to memory before the work submit. This is
1834 * necessary as POW may read values from DRAM at this time.
1835 */
1836 CVMX_SYNCWS;
1837 cvmx_write_io(ptr.u64, tag_req.u64);
1838}
1839
1840/**
1841 * This function sets the group mask for a core. The group mask
1842 * indicates which groups each core will accept work from. There are
1843 * 16 groups.
1844 *
1845 * @core_num: core to apply mask to
1846 * @mask: Group mask. There are 16 groups, so only bits 0-15 are valid,
1847 * representing groups 0-15.
1848 * Each 1 bit in the mask enables the core to accept work from
1849 * the corresponding group.
1850 */
1851static inline void cvmx_pow_set_group_mask(uint64_t core_num, uint64_t mask)
1852{
1853 union cvmx_pow_pp_grp_mskx grp_msk;
1854
1855 grp_msk.u64 = cvmx_read_csr(CVMX_POW_PP_GRP_MSKX(core_num));
1856 grp_msk.s.grp_msk = mask;
1857 cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(core_num), grp_msk.u64);
1858}
1859
1860/**
1861 * This function sets POW static priorities for a core. Each input queue has
1862 * an associated priority value.
1863 *
1864 * @core_num: core to apply priorities to
1865 * @priority: Vector of 8 priorities, one per POW Input Queue (0-7).
1866 * Highest priority is 0 and lowest is 7. A priority value
1867 * of 0xF instructs POW to skip the Input Queue when
1868 * scheduling to this specific core.
1869 * NOTE: priorities should not have gaps in values, meaning
1870 * {0,1,1,1,1,1,1,1} is a valid configuration while
1871 * {0,2,2,2,2,2,2,2} is not.
1872 */
1873static inline void cvmx_pow_set_priority(uint64_t core_num,
1874 const uint8_t priority[])
1875{
1876 /* POW priorities are supported on CN5xxx and later */
1877 if (!OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
1878 union cvmx_pow_pp_grp_mskx grp_msk;
1879
1880 grp_msk.u64 = cvmx_read_csr(CVMX_POW_PP_GRP_MSKX(core_num));
1881 grp_msk.s.qos0_pri = priority[0];
1882 grp_msk.s.qos1_pri = priority[1];
1883 grp_msk.s.qos2_pri = priority[2];
1884 grp_msk.s.qos3_pri = priority[3];
1885 grp_msk.s.qos4_pri = priority[4];
1886 grp_msk.s.qos5_pri = priority[5];
1887 grp_msk.s.qos6_pri = priority[6];
1888 grp_msk.s.qos7_pri = priority[7];
1889
1890 /* Detect gaps between priorities and flag error */
1891 {
1892 int i;
1893 uint32_t prio_mask = 0;
1894
1895 for (i = 0; i < 8; i++)
1896 if (priority[i] != 0xF)
1897 prio_mask |= 1 << priority[i];
1898
1899 if (prio_mask ^ ((1 << cvmx_pop(prio_mask)) - 1)) {
1900 pr_err("POW static priorities should be "
1901 "contiguous (0x%llx)\n",
1902 (unsigned long long)prio_mask);
1903 return;
1904 }
1905 }
1906
1907 cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(core_num), grp_msk.u64);
1908 }
1909}
1910
1911/**
1912 * Performs a tag switch and then an immediate deschedule. This completes
1913 * immediately, so completion must not be waited for. This function does NOT
1914 * update the wqe in DRAM to match arguments.
1915 *
1916 * This function does NOT wait for any prior tag switches to complete, so the
1917 * calling code must do this.
1918 *
1919 * Note the following CAVEAT of the Octeon HW behavior when
1920 * re-scheduling DE-SCHEDULEd items whose (next) state is
1921 * ORDERED:
1922 * - If there are no switches pending at the time that the
1923 * HW executes the de-schedule, the HW will only re-schedule
1924 * the head of the FIFO associated with the given tag. This
1925 * means that in many respects, the HW treats this ORDERED
1926 * tag as an ATOMIC tag. Note that in the SWTAG_DESCH
1927 * case (to an ORDERED tag), the HW will do the switch
1928 * before the deschedule whenever it is possible to do
1929 * the switch immediately, so it may often look like
1930 * this case.
1931 * - If there is a pending switch to ORDERED at the time
1932 * the HW executes the de-schedule, the HW will perform
1933 * the switch at the time it re-schedules, and will be
1934 * able to reschedule any/all of the entries with the
1935 * same tag.
1936 * Due to this behavior, the RECOMMENDATION to software is
1937 * that they have a (next) state of ATOMIC when they
1938 * DE-SCHEDULE. If an ORDERED tag is what was really desired,
1939 * SW can choose to immediately switch to an ORDERED tag
1940 * after the work (that has an ATOMIC tag) is re-scheduled.
1941 * Note that since there are never any tag switches pending
1942 * when the HW re-schedules, this switch can be IMMEDIATE upon
1943 * the reception of the pointer during the re-schedule.
1944 *
1945 * @tag: New tag value
1946 * @tag_type: New tag type
1947 * @group: New group value
1948 * @no_sched: Control whether this work queue entry will be rescheduled.
1949 * - 1 : don't schedule this work
1950 * - 0 : allow this work to be scheduled.
1951 */
1952static inline void cvmx_pow_tag_sw_desched_nocheck(
1953 uint32_t tag,
1954 enum cvmx_pow_tag_type tag_type,
1955 uint64_t group,
1956 uint64_t no_sched)
1957{
1958 cvmx_addr_t ptr;
1959 cvmx_pow_tag_req_t tag_req;
1960
1961 if (CVMX_ENABLE_POW_CHECKS) {
1962 cvmx_pow_tag_req_t current_tag;
1963 __cvmx_pow_warn_if_pending_switch(__func__);
1964 current_tag = cvmx_pow_get_current_tag();
1965 if (current_tag.s.type == CVMX_POW_TAG_TYPE_NULL_NULL)
1966 pr_warn("%s called with NULL_NULL tag\n", __func__);
1967 if (current_tag.s.type == CVMX_POW_TAG_TYPE_NULL)
1968 pr_warn("%s called with NULL tag. Deschedule not allowed from NULL state\n",
1969 __func__);
1970 if ((current_tag.s.type != CVMX_POW_TAG_TYPE_ATOMIC)
1971 && (tag_type != CVMX_POW_TAG_TYPE_ATOMIC))
1972 pr_warn("%s called where neither the before or after tag is ATOMIC\n",
1973 __func__);
1974 }
1975
1976 tag_req.u64 = 0;
1977 tag_req.s.op = CVMX_POW_TAG_OP_SWTAG_DESCH;
1978 tag_req.s.tag = tag;
1979 tag_req.s.type = tag_type;
1980 tag_req.s.grp = group;
1981 tag_req.s.no_sched = no_sched;
1982
1983 ptr.u64 = 0;
1984 ptr.sio.mem_region = CVMX_IO_SEG;
1985 ptr.sio.is_io = 1;
1986 ptr.sio.did = CVMX_OCT_DID_TAG_TAG3;
1987 /*
1988 * since TAG3 is used, this store will clear the local pending
1989 * switch bit.
1990 */
1991 cvmx_write_io(ptr.u64, tag_req.u64);
1992}
1993
1994/**
1995 * Performs a tag switch and then an immediate deschedule. This completes
1996 * immediately, so completion must not be waited for. This function does NOT
1997 * update the wqe in DRAM to match arguments.
1998 *
1999 * This function waits for any prior tag switches to complete, so the
2000 * calling code may call this function with a pending tag switch.
2001 *
2002 * Note the following CAVEAT of the Octeon HW behavior when
2003 * re-scheduling DE-SCHEDULEd items whose (next) state is
2004 * ORDERED:
2005 * - If there are no switches pending at the time that the
2006 * HW executes the de-schedule, the HW will only re-schedule
2007 * the head of the FIFO associated with the given tag. This
2008 * means that in many respects, the HW treats this ORDERED
2009 * tag as an ATOMIC tag. Note that in the SWTAG_DESCH
2010 * case (to an ORDERED tag), the HW will do the switch
2011 * before the deschedule whenever it is possible to do
2012 * the switch immediately, so it may often look like
2013 * this case.
2014 * - If there is a pending switch to ORDERED at the time
2015 * the HW executes the de-schedule, the HW will perform
2016 * the switch at the time it re-schedules, and will be
2017 * able to reschedule any/all of the entries with the
2018 * same tag.
2019 * Due to this behavior, the RECOMMENDATION to software is
2020 * that they have a (next) state of ATOMIC when they
2021 * DE-SCHEDULE. If an ORDERED tag is what was really desired,
2022 * SW can choose to immediately switch to an ORDERED tag
2023 * after the work (that has an ATOMIC tag) is re-scheduled.
2024 * Note that since there are never any tag switches pending
2025 * when the HW re-schedules, this switch can be IMMEDIATE upon
2026 * the reception of the pointer during the re-schedule.
2027 *
2028 * @tag: New tag value
2029 * @tag_type: New tag type
2030 * @group: New group value
2031 * @no_sched: Control whether this work queue entry will be rescheduled.
2032 * - 1 : don't schedule this work
2033 * - 0 : allow this work to be scheduled.
2034 */
2035static inline void cvmx_pow_tag_sw_desched(uint32_t tag,
2036 enum cvmx_pow_tag_type tag_type,
2037 uint64_t group, uint64_t no_sched)
2038{
2039 if (CVMX_ENABLE_POW_CHECKS)
2040 __cvmx_pow_warn_if_pending_switch(__func__);
2041
2042 /* Need to make sure any writes to the work queue entry are complete */
2043 CVMX_SYNCWS;
2044 /*
2045 * Ensure that there is not a pending tag switch, as a tag
2046 * switch cannot be started if a previous switch is still
2047 * pending.
2048 */
2049 cvmx_pow_tag_sw_wait();
2050 cvmx_pow_tag_sw_desched_nocheck(tag, tag_type, group, no_sched);
2051}
2052
2053/**
2054 * Deschedules the current work queue entry.
2055 *
2056 * @no_sched: no schedule flag value to be set on the work queue
2057 * entry. If this is set the entry will not be
2058 * rescheduled.
2059 */
2060static inline void cvmx_pow_desched(uint64_t no_sched)
2061{
2062 cvmx_addr_t ptr;
2063 cvmx_pow_tag_req_t tag_req;
2064
2065 if (CVMX_ENABLE_POW_CHECKS) {
2066 cvmx_pow_tag_req_t current_tag;
2067 __cvmx_pow_warn_if_pending_switch(__func__);
2068 current_tag = cvmx_pow_get_current_tag();
2069 if (current_tag.s.type == CVMX_POW_TAG_TYPE_NULL_NULL)
2070 pr_warn("%s called with NULL_NULL tag\n", __func__);
2071 if (current_tag.s.type == CVMX_POW_TAG_TYPE_NULL)
2072 pr_warn("%s called with NULL tag. Deschedule not expected from NULL state\n",
2073 __func__);
2074 }
2075
2076 /* Need to make sure any writes to the work queue entry are complete */
2077 CVMX_SYNCWS;
2078
2079 tag_req.u64 = 0;
2080 tag_req.s.op = CVMX_POW_TAG_OP_DESCH;
2081 tag_req.s.no_sched = no_sched;
2082
2083 ptr.u64 = 0;
2084 ptr.sio.mem_region = CVMX_IO_SEG;
2085 ptr.sio.is_io = 1;
2086 ptr.sio.did = CVMX_OCT_DID_TAG_TAG3;
2087 /*
2088 * since TAG3 is used, this store will clear the local pending
2089 * switch bit.
2090 */
2091 cvmx_write_io(ptr.u64, tag_req.u64);
2092}
2093
2094/****************************************************
2095* Define usage of bits within the 32 bit tag values.
2096*****************************************************/
2097
2098/*
2099 * Number of bits of the tag used by software. The SW bits are always
2100 * a contiguous block of the high starting at bit 31. The hardware
2101 * bits are always the low bits. By default, the top 8 bits of the
2102 * tag are reserved for software, and the low 24 are set by the IPD
2103 * unit.
2104 */
2105#define CVMX_TAG_SW_BITS (8)
2106#define CVMX_TAG_SW_SHIFT (32 - CVMX_TAG_SW_BITS)
2107
2108/* Below is the list of values for the top 8 bits of the tag. */
2109/*
2110 * Tag values with top byte of this value are reserved for internal
2111 * executive uses.
2112 */
2113#define CVMX_TAG_SW_BITS_INTERNAL 0x1
2114/* The executive divides the remaining 24 bits as follows:
2115 * - the upper 8 bits (bits 23 - 16 of the tag) define a subgroup
2116 *
2117 * - the lower 16 bits (bits 15 - 0 of the tag) define are the value
2118 * with the subgroup
2119 *
2120 * Note that this section describes the format of tags generated by
2121 * software - refer to the hardware documentation for a description of
2122 * the tags values generated by the packet input hardware. Subgroups
2123 * are defined here.
2124 */
2125/* Mask for the value portion of the tag */
2126#define CVMX_TAG_SUBGROUP_MASK 0xFFFF
2127#define CVMX_TAG_SUBGROUP_SHIFT 16
2128#define CVMX_TAG_SUBGROUP_PKO 0x1
2129
2130/* End of executive tag subgroup definitions */
2131
2132/*
2133 * The remaining values software bit values 0x2 - 0xff are available
2134 * for application use.
2135 */
2136
2137/**
2138 * This function creates a 32 bit tag value from the two values provided.
2139 *
2140 * @sw_bits: The upper bits (number depends on configuration) are set
2141 * to this value. The remainder of bits are set by the
2142 * hw_bits parameter.
2143 *
2144 * @hw_bits: The lower bits (number depends on configuration) are set
2145 * to this value. The remainder of bits are set by the
2146 * sw_bits parameter.
2147 *
2148 * Returns 32 bit value of the combined hw and sw bits.
2149 */
2150static inline uint32_t cvmx_pow_tag_compose(uint64_t sw_bits, uint64_t hw_bits)
2151{
2152 return ((sw_bits & cvmx_build_mask(CVMX_TAG_SW_BITS)) <<
2153 CVMX_TAG_SW_SHIFT) |
2154 (hw_bits & cvmx_build_mask(32 - CVMX_TAG_SW_BITS));
2155}
2156
2157/**
2158 * Extracts the bits allocated for software use from the tag
2159 *
2160 * @tag: 32 bit tag value
2161 *
2162 * Returns N bit software tag value, where N is configurable with the
2163 * CVMX_TAG_SW_BITS define
2164 */
2165static inline uint32_t cvmx_pow_tag_get_sw_bits(uint64_t tag)
2166{
2167 return (tag >> (32 - CVMX_TAG_SW_BITS)) &
2168 cvmx_build_mask(CVMX_TAG_SW_BITS);
2169}
2170
2171/**
2172 *
2173 * Extracts the bits allocated for hardware use from the tag
2174 *
2175 * @tag: 32 bit tag value
2176 *
2177 * Returns (32 - N) bit software tag value, where N is configurable
2178 * with the CVMX_TAG_SW_BITS define
2179 */
2180static inline uint32_t cvmx_pow_tag_get_hw_bits(uint64_t tag)
2181{
2182 return tag & cvmx_build_mask(32 - CVMX_TAG_SW_BITS);
2183}
2184
2185/**
2186 * Store the current POW internal state into the supplied
2187 * buffer. It is recommended that you pass a buffer of at least
2188 * 128KB. The format of the capture may change based on SDK
2189 * version and Octeon chip.
2190 *
2191 * @buffer: Buffer to store capture into
2192 * @buffer_size:
2193 * The size of the supplied buffer
2194 *
2195 * Returns Zero on success, negative on failure
2196 */
2197extern int cvmx_pow_capture(void *buffer, int buffer_size);
2198
2199/**
2200 * Dump a POW capture to the console in a human readable format.
2201 *
2202 * @buffer: POW capture from cvmx_pow_capture()
2203 * @buffer_size:
2204 * Size of the buffer
2205 */
2206extern void cvmx_pow_display(void *buffer, int buffer_size);
2207
2208/**
2209 * Return the number of POW entries supported by this chip
2210 *
2211 * Returns Number of POW entries
2212 */
2213extern int cvmx_pow_get_num_entries(void);
2214
2215#endif /* __CVMX_POW_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-rnm-defs.h b/arch/mips/include/asm/octeon/cvmx-rnm-defs.h
new file mode 100644
index 000000000..94295d2fe
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-rnm-defs.h
@@ -0,0 +1,171 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_RNM_DEFS_H__
29#define __CVMX_RNM_DEFS_H__
30
31#define CVMX_RNM_BIST_STATUS (CVMX_ADD_IO_SEG(0x0001180040000008ull))
32#define CVMX_RNM_CTL_STATUS (CVMX_ADD_IO_SEG(0x0001180040000000ull))
33#define CVMX_RNM_EER_DBG (CVMX_ADD_IO_SEG(0x0001180040000018ull))
34#define CVMX_RNM_EER_KEY (CVMX_ADD_IO_SEG(0x0001180040000010ull))
35#define CVMX_RNM_SERIAL_NUM (CVMX_ADD_IO_SEG(0x0001180040000020ull))
36
37union cvmx_rnm_bist_status {
38 uint64_t u64;
39 struct cvmx_rnm_bist_status_s {
40#ifdef __BIG_ENDIAN_BITFIELD
41 uint64_t reserved_2_63:62;
42 uint64_t rrc:1;
43 uint64_t mem:1;
44#else
45 uint64_t mem:1;
46 uint64_t rrc:1;
47 uint64_t reserved_2_63:62;
48#endif
49 } s;
50};
51
52union cvmx_rnm_ctl_status {
53 uint64_t u64;
54 struct cvmx_rnm_ctl_status_s {
55#ifdef __BIG_ENDIAN_BITFIELD
56 uint64_t reserved_12_63:52;
57 uint64_t dis_mak:1;
58 uint64_t eer_lck:1;
59 uint64_t eer_val:1;
60 uint64_t ent_sel:4;
61 uint64_t exp_ent:1;
62 uint64_t rng_rst:1;
63 uint64_t rnm_rst:1;
64 uint64_t rng_en:1;
65 uint64_t ent_en:1;
66#else
67 uint64_t ent_en:1;
68 uint64_t rng_en:1;
69 uint64_t rnm_rst:1;
70 uint64_t rng_rst:1;
71 uint64_t exp_ent:1;
72 uint64_t ent_sel:4;
73 uint64_t eer_val:1;
74 uint64_t eer_lck:1;
75 uint64_t dis_mak:1;
76 uint64_t reserved_12_63:52;
77#endif
78 } s;
79 struct cvmx_rnm_ctl_status_cn30xx {
80#ifdef __BIG_ENDIAN_BITFIELD
81 uint64_t reserved_4_63:60;
82 uint64_t rng_rst:1;
83 uint64_t rnm_rst:1;
84 uint64_t rng_en:1;
85 uint64_t ent_en:1;
86#else
87 uint64_t ent_en:1;
88 uint64_t rng_en:1;
89 uint64_t rnm_rst:1;
90 uint64_t rng_rst:1;
91 uint64_t reserved_4_63:60;
92#endif
93 } cn30xx;
94 struct cvmx_rnm_ctl_status_cn50xx {
95#ifdef __BIG_ENDIAN_BITFIELD
96 uint64_t reserved_9_63:55;
97 uint64_t ent_sel:4;
98 uint64_t exp_ent:1;
99 uint64_t rng_rst:1;
100 uint64_t rnm_rst:1;
101 uint64_t rng_en:1;
102 uint64_t ent_en:1;
103#else
104 uint64_t ent_en:1;
105 uint64_t rng_en:1;
106 uint64_t rnm_rst:1;
107 uint64_t rng_rst:1;
108 uint64_t exp_ent:1;
109 uint64_t ent_sel:4;
110 uint64_t reserved_9_63:55;
111#endif
112 } cn50xx;
113 struct cvmx_rnm_ctl_status_cn63xx {
114#ifdef __BIG_ENDIAN_BITFIELD
115 uint64_t reserved_11_63:53;
116 uint64_t eer_lck:1;
117 uint64_t eer_val:1;
118 uint64_t ent_sel:4;
119 uint64_t exp_ent:1;
120 uint64_t rng_rst:1;
121 uint64_t rnm_rst:1;
122 uint64_t rng_en:1;
123 uint64_t ent_en:1;
124#else
125 uint64_t ent_en:1;
126 uint64_t rng_en:1;
127 uint64_t rnm_rst:1;
128 uint64_t rng_rst:1;
129 uint64_t exp_ent:1;
130 uint64_t ent_sel:4;
131 uint64_t eer_val:1;
132 uint64_t eer_lck:1;
133 uint64_t reserved_11_63:53;
134#endif
135 } cn63xx;
136};
137
138union cvmx_rnm_eer_dbg {
139 uint64_t u64;
140 struct cvmx_rnm_eer_dbg_s {
141#ifdef __BIG_ENDIAN_BITFIELD
142 uint64_t dat:64;
143#else
144 uint64_t dat:64;
145#endif
146 } s;
147};
148
149union cvmx_rnm_eer_key {
150 uint64_t u64;
151 struct cvmx_rnm_eer_key_s {
152#ifdef __BIG_ENDIAN_BITFIELD
153 uint64_t key:64;
154#else
155 uint64_t key:64;
156#endif
157 } s;
158};
159
160union cvmx_rnm_serial_num {
161 uint64_t u64;
162 struct cvmx_rnm_serial_num_s {
163#ifdef __BIG_ENDIAN_BITFIELD
164 uint64_t dat:64;
165#else
166 uint64_t dat:64;
167#endif
168 } s;
169};
170
171#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-rst-defs.h b/arch/mips/include/asm/octeon/cvmx-rst-defs.h
new file mode 100644
index 000000000..accc9977d
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-rst-defs.h
@@ -0,0 +1,278 @@
1/***********************license start***************
2 * Author: Cavium Inc.
3 *
4 * Contact: support@cavium.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2014 Cavium Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Inc. for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_RST_DEFS_H__
29#define __CVMX_RST_DEFS_H__
30
31#define CVMX_RST_BOOT (CVMX_ADD_IO_SEG(0x0001180006001600ull))
32#define CVMX_RST_CFG (CVMX_ADD_IO_SEG(0x0001180006001610ull))
33#define CVMX_RST_CKILL (CVMX_ADD_IO_SEG(0x0001180006001638ull))
34#define CVMX_RST_CTLX(offset) (CVMX_ADD_IO_SEG(0x0001180006001640ull) + ((offset) & 3) * 8)
35#define CVMX_RST_DELAY (CVMX_ADD_IO_SEG(0x0001180006001608ull))
36#define CVMX_RST_ECO (CVMX_ADD_IO_SEG(0x00011800060017B8ull))
37#define CVMX_RST_INT (CVMX_ADD_IO_SEG(0x0001180006001628ull))
38#define CVMX_RST_OCX (CVMX_ADD_IO_SEG(0x0001180006001618ull))
39#define CVMX_RST_POWER_DBG (CVMX_ADD_IO_SEG(0x0001180006001708ull))
40#define CVMX_RST_PP_POWER (CVMX_ADD_IO_SEG(0x0001180006001700ull))
41#define CVMX_RST_SOFT_PRSTX(offset) (CVMX_ADD_IO_SEG(0x00011800060016C0ull) + ((offset) & 3) * 8)
42#define CVMX_RST_SOFT_RST (CVMX_ADD_IO_SEG(0x0001180006001680ull))
43
44union cvmx_rst_boot {
45 uint64_t u64;
46 struct cvmx_rst_boot_s {
47#ifdef __BIG_ENDIAN_BITFIELD
48 uint64_t chipkill:1;
49 uint64_t jtcsrdis:1;
50 uint64_t ejtagdis:1;
51 uint64_t romen:1;
52 uint64_t ckill_ppdis:1;
53 uint64_t jt_tstmode:1;
54 uint64_t vrm_err:1;
55 uint64_t reserved_37_56:20;
56 uint64_t c_mul:7;
57 uint64_t pnr_mul:6;
58 uint64_t reserved_21_23:3;
59 uint64_t lboot_oci:3;
60 uint64_t lboot_ext:6;
61 uint64_t lboot:10;
62 uint64_t rboot:1;
63 uint64_t rboot_pin:1;
64#else
65 uint64_t rboot_pin:1;
66 uint64_t rboot:1;
67 uint64_t lboot:10;
68 uint64_t lboot_ext:6;
69 uint64_t lboot_oci:3;
70 uint64_t reserved_21_23:3;
71 uint64_t pnr_mul:6;
72 uint64_t c_mul:7;
73 uint64_t reserved_37_56:20;
74 uint64_t vrm_err:1;
75 uint64_t jt_tstmode:1;
76 uint64_t ckill_ppdis:1;
77 uint64_t romen:1;
78 uint64_t ejtagdis:1;
79 uint64_t jtcsrdis:1;
80 uint64_t chipkill:1;
81#endif
82 } s;
83};
84
85union cvmx_rst_cfg {
86 uint64_t u64;
87 struct cvmx_rst_cfg_s {
88#ifdef __BIG_ENDIAN_BITFIELD
89 uint64_t bist_delay:58;
90 uint64_t reserved_3_5:3;
91 uint64_t cntl_clr_bist:1;
92 uint64_t warm_clr_bist:1;
93 uint64_t soft_clr_bist:1;
94#else
95 uint64_t soft_clr_bist:1;
96 uint64_t warm_clr_bist:1;
97 uint64_t cntl_clr_bist:1;
98 uint64_t reserved_3_5:3;
99 uint64_t bist_delay:58;
100#endif
101 } s;
102};
103
104union cvmx_rst_ckill {
105 uint64_t u64;
106 struct cvmx_rst_ckill_s {
107#ifdef __BIG_ENDIAN_BITFIELD
108 uint64_t reserved_47_63:17;
109 uint64_t timer:47;
110#else
111 uint64_t timer:47;
112 uint64_t reserved_47_63:17;
113#endif
114 } s;
115};
116
117union cvmx_rst_ctlx {
118 uint64_t u64;
119 struct cvmx_rst_ctlx_s {
120#ifdef __BIG_ENDIAN_BITFIELD
121 uint64_t reserved_10_63:54;
122 uint64_t prst_link:1;
123 uint64_t rst_done:1;
124 uint64_t rst_link:1;
125 uint64_t host_mode:1;
126 uint64_t reserved_4_5:2;
127 uint64_t rst_drv:1;
128 uint64_t rst_rcv:1;
129 uint64_t rst_chip:1;
130 uint64_t rst_val:1;
131#else
132 uint64_t rst_val:1;
133 uint64_t rst_chip:1;
134 uint64_t rst_rcv:1;
135 uint64_t rst_drv:1;
136 uint64_t reserved_4_5:2;
137 uint64_t host_mode:1;
138 uint64_t rst_link:1;
139 uint64_t rst_done:1;
140 uint64_t prst_link:1;
141 uint64_t reserved_10_63:54;
142#endif
143 } s;
144};
145
146union cvmx_rst_delay {
147 uint64_t u64;
148 struct cvmx_rst_delay_s {
149#ifdef __BIG_ENDIAN_BITFIELD
150 uint64_t reserved_32_63:32;
151 uint64_t warm_rst_dly:16;
152 uint64_t soft_rst_dly:16;
153#else
154 uint64_t soft_rst_dly:16;
155 uint64_t warm_rst_dly:16;
156 uint64_t reserved_32_63:32;
157#endif
158 } s;
159};
160
161union cvmx_rst_eco {
162 uint64_t u64;
163 struct cvmx_rst_eco_s {
164#ifdef __BIG_ENDIAN_BITFIELD
165 uint64_t reserved_32_63:32;
166 uint64_t eco_rw:32;
167#else
168 uint64_t eco_rw:32;
169 uint64_t reserved_32_63:32;
170#endif
171 } s;
172};
173
174union cvmx_rst_int {
175 uint64_t u64;
176 struct cvmx_rst_int_s {
177#ifdef __BIG_ENDIAN_BITFIELD
178 uint64_t reserved_12_63:52;
179 uint64_t perst:4;
180 uint64_t reserved_4_7:4;
181 uint64_t rst_link:4;
182#else
183 uint64_t rst_link:4;
184 uint64_t reserved_4_7:4;
185 uint64_t perst:4;
186 uint64_t reserved_12_63:52;
187#endif
188 } s;
189 struct cvmx_rst_int_cn70xx {
190#ifdef __BIG_ENDIAN_BITFIELD
191 uint64_t reserved_11_63:53;
192 uint64_t perst:3;
193 uint64_t reserved_3_7:5;
194 uint64_t rst_link:3;
195#else
196 uint64_t rst_link:3;
197 uint64_t reserved_3_7:5;
198 uint64_t perst:3;
199 uint64_t reserved_11_63:53;
200#endif
201 } cn70xx;
202};
203
204union cvmx_rst_ocx {
205 uint64_t u64;
206 struct cvmx_rst_ocx_s {
207#ifdef __BIG_ENDIAN_BITFIELD
208 uint64_t reserved_3_63:61;
209 uint64_t rst_link:3;
210#else
211 uint64_t rst_link:3;
212 uint64_t reserved_3_63:61;
213#endif
214 } s;
215};
216
217union cvmx_rst_power_dbg {
218 uint64_t u64;
219 struct cvmx_rst_power_dbg_s {
220#ifdef __BIG_ENDIAN_BITFIELD
221 uint64_t reserved_3_63:61;
222 uint64_t str:3;
223#else
224 uint64_t str:3;
225 uint64_t reserved_3_63:61;
226#endif
227 } s;
228};
229
230union cvmx_rst_pp_power {
231 uint64_t u64;
232 struct cvmx_rst_pp_power_s {
233#ifdef __BIG_ENDIAN_BITFIELD
234 uint64_t reserved_48_63:16;
235 uint64_t gate:48;
236#else
237 uint64_t gate:48;
238 uint64_t reserved_48_63:16;
239#endif
240 } s;
241 struct cvmx_rst_pp_power_cn70xx {
242#ifdef __BIG_ENDIAN_BITFIELD
243 uint64_t reserved_4_63:60;
244 uint64_t gate:4;
245#else
246 uint64_t gate:4;
247 uint64_t reserved_4_63:60;
248#endif
249 } cn70xx;
250};
251
252union cvmx_rst_soft_prstx {
253 uint64_t u64;
254 struct cvmx_rst_soft_prstx_s {
255#ifdef __BIG_ENDIAN_BITFIELD
256 uint64_t reserved_1_63:63;
257 uint64_t soft_prst:1;
258#else
259 uint64_t soft_prst:1;
260 uint64_t reserved_1_63:63;
261#endif
262 } s;
263};
264
265union cvmx_rst_soft_rst {
266 uint64_t u64;
267 struct cvmx_rst_soft_rst_s {
268#ifdef __BIG_ENDIAN_BITFIELD
269 uint64_t reserved_1_63:63;
270 uint64_t soft_rst:1;
271#else
272 uint64_t soft_rst:1;
273 uint64_t reserved_1_63:63;
274#endif
275 } s;
276};
277
278#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-scratch.h b/arch/mips/include/asm/octeon/cvmx-scratch.h
new file mode 100644
index 000000000..8d21cc5e4
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-scratch.h
@@ -0,0 +1,139 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 *
30 * This file provides support for the processor local scratch memory.
31 * Scratch memory is byte addressable - all addresses are byte addresses.
32 *
33 */
34
35#ifndef __CVMX_SCRATCH_H__
36#define __CVMX_SCRATCH_H__
37
38/*
39 * Note: This define must be a long, not a long long in order to
40 * compile without warnings for both 32bit and 64bit.
41 */
42#define CVMX_SCRATCH_BASE (-32768l) /* 0xffffffffffff8000 */
43
44/**
45 * Reads an 8 bit value from the processor local scratchpad memory.
46 *
47 * @address: byte address to read from
48 *
49 * Returns value read
50 */
51static inline uint8_t cvmx_scratch_read8(uint64_t address)
52{
53 return *CASTPTR(volatile uint8_t, CVMX_SCRATCH_BASE + address);
54}
55
56/**
57 * Reads a 16 bit value from the processor local scratchpad memory.
58 *
59 * @address: byte address to read from
60 *
61 * Returns value read
62 */
63static inline uint16_t cvmx_scratch_read16(uint64_t address)
64{
65 return *CASTPTR(volatile uint16_t, CVMX_SCRATCH_BASE + address);
66}
67
68/**
69 * Reads a 32 bit value from the processor local scratchpad memory.
70 *
71 * @address: byte address to read from
72 *
73 * Returns value read
74 */
75static inline uint32_t cvmx_scratch_read32(uint64_t address)
76{
77 return *CASTPTR(volatile uint32_t, CVMX_SCRATCH_BASE + address);
78}
79
80/**
81 * Reads a 64 bit value from the processor local scratchpad memory.
82 *
83 * @address: byte address to read from
84 *
85 * Returns value read
86 */
87static inline uint64_t cvmx_scratch_read64(uint64_t address)
88{
89 return *CASTPTR(volatile uint64_t, CVMX_SCRATCH_BASE + address);
90}
91
92/**
93 * Writes an 8 bit value to the processor local scratchpad memory.
94 *
95 * @address: byte address to write to
96 * @value: value to write
97 */
98static inline void cvmx_scratch_write8(uint64_t address, uint64_t value)
99{
100 *CASTPTR(volatile uint8_t, CVMX_SCRATCH_BASE + address) =
101 (uint8_t) value;
102}
103
104/**
105 * Writes a 32 bit value to the processor local scratchpad memory.
106 *
107 * @address: byte address to write to
108 * @value: value to write
109 */
110static inline void cvmx_scratch_write16(uint64_t address, uint64_t value)
111{
112 *CASTPTR(volatile uint16_t, CVMX_SCRATCH_BASE + address) =
113 (uint16_t) value;
114}
115
116/**
117 * Writes a 16 bit value to the processor local scratchpad memory.
118 *
119 * @address: byte address to write to
120 * @value: value to write
121 */
122static inline void cvmx_scratch_write32(uint64_t address, uint64_t value)
123{
124 *CASTPTR(volatile uint32_t, CVMX_SCRATCH_BASE + address) =
125 (uint32_t) value;
126}
127
128/**
129 * Writes a 64 bit value to the processor local scratchpad memory.
130 *
131 * @address: byte address to write to
132 * @value: value to write
133 */
134static inline void cvmx_scratch_write64(uint64_t address, uint64_t value)
135{
136 *CASTPTR(volatile uint64_t, CVMX_SCRATCH_BASE + address) = value;
137}
138
139#endif /* __CVMX_SCRATCH_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-sli-defs.h b/arch/mips/include/asm/octeon/cvmx-sli-defs.h
new file mode 100644
index 000000000..5ef6c3815
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-sli-defs.h
@@ -0,0 +1,129 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2017 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_SLI_DEFS_H__
29#define __CVMX_SLI_DEFS_H__
30
31#include <uapi/asm/bitfield.h>
32
33#define CVMX_SLI_PCIE_MSI_RCV CVMX_SLI_PCIE_MSI_RCV_FUNC()
34static inline uint64_t CVMX_SLI_PCIE_MSI_RCV_FUNC(void)
35{
36 switch (cvmx_get_octeon_family()) {
37 case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
38 case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
39 case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
40 case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
41 case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
42 case OCTEON_CN70XX & OCTEON_FAMILY_MASK:
43 return 0x0000000000003CB0ull;
44 case OCTEON_CNF75XX & OCTEON_FAMILY_MASK:
45 case OCTEON_CN73XX & OCTEON_FAMILY_MASK:
46 case OCTEON_CN78XX & OCTEON_FAMILY_MASK:
47 if (OCTEON_IS_MODEL(OCTEON_CN78XX_PASS1_X))
48 return 0x0000000000003CB0ull;
49 fallthrough;
50 default:
51 return 0x0000000000023CB0ull;
52 }
53}
54
55
56union cvmx_sli_ctl_portx {
57 uint64_t u64;
58 struct cvmx_sli_ctl_portx_s {
59 __BITFIELD_FIELD(uint64_t reserved_22_63:42,
60 __BITFIELD_FIELD(uint64_t intd:1,
61 __BITFIELD_FIELD(uint64_t intc:1,
62 __BITFIELD_FIELD(uint64_t intb:1,
63 __BITFIELD_FIELD(uint64_t inta:1,
64 __BITFIELD_FIELD(uint64_t dis_port:1,
65 __BITFIELD_FIELD(uint64_t waitl_com:1,
66 __BITFIELD_FIELD(uint64_t intd_map:2,
67 __BITFIELD_FIELD(uint64_t intc_map:2,
68 __BITFIELD_FIELD(uint64_t intb_map:2,
69 __BITFIELD_FIELD(uint64_t inta_map:2,
70 __BITFIELD_FIELD(uint64_t ctlp_ro:1,
71 __BITFIELD_FIELD(uint64_t reserved_6_6:1,
72 __BITFIELD_FIELD(uint64_t ptlp_ro:1,
73 __BITFIELD_FIELD(uint64_t reserved_1_4:4,
74 __BITFIELD_FIELD(uint64_t wait_com:1,
75 ;))))))))))))))))
76 } s;
77};
78
79union cvmx_sli_mem_access_ctl {
80 uint64_t u64;
81 struct cvmx_sli_mem_access_ctl_s {
82 __BITFIELD_FIELD(uint64_t reserved_14_63:50,
83 __BITFIELD_FIELD(uint64_t max_word:4,
84 __BITFIELD_FIELD(uint64_t timer:10,
85 ;)))
86 } s;
87};
88
89union cvmx_sli_s2m_portx_ctl {
90 uint64_t u64;
91 struct cvmx_sli_s2m_portx_ctl_s {
92 __BITFIELD_FIELD(uint64_t reserved_5_63:59,
93 __BITFIELD_FIELD(uint64_t wind_d:1,
94 __BITFIELD_FIELD(uint64_t bar0_d:1,
95 __BITFIELD_FIELD(uint64_t mrrs:3,
96 ;))))
97 } s;
98};
99
100union cvmx_sli_mem_access_subidx {
101 uint64_t u64;
102 struct cvmx_sli_mem_access_subidx_s {
103 __BITFIELD_FIELD(uint64_t reserved_43_63:21,
104 __BITFIELD_FIELD(uint64_t zero:1,
105 __BITFIELD_FIELD(uint64_t port:3,
106 __BITFIELD_FIELD(uint64_t nmerge:1,
107 __BITFIELD_FIELD(uint64_t esr:2,
108 __BITFIELD_FIELD(uint64_t esw:2,
109 __BITFIELD_FIELD(uint64_t wtype:2,
110 __BITFIELD_FIELD(uint64_t rtype:2,
111 __BITFIELD_FIELD(uint64_t ba:30,
112 ;)))))))))
113 } s;
114 struct cvmx_sli_mem_access_subidx_cn68xx {
115 __BITFIELD_FIELD(uint64_t reserved_43_63:21,
116 __BITFIELD_FIELD(uint64_t zero:1,
117 __BITFIELD_FIELD(uint64_t port:3,
118 __BITFIELD_FIELD(uint64_t nmerge:1,
119 __BITFIELD_FIELD(uint64_t esr:2,
120 __BITFIELD_FIELD(uint64_t esw:2,
121 __BITFIELD_FIELD(uint64_t wtype:2,
122 __BITFIELD_FIELD(uint64_t rtype:2,
123 __BITFIELD_FIELD(uint64_t ba:28,
124 __BITFIELD_FIELD(uint64_t reserved_0_1:2,
125 ;))))))))))
126 } cn68xx;
127};
128
129#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-spi.h b/arch/mips/include/asm/octeon/cvmx-spi.h
new file mode 100644
index 000000000..d5038cc4b
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-spi.h
@@ -0,0 +1,269 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 *
30 * This file contains defines for the SPI interface
31 */
32#ifndef __CVMX_SPI_H__
33#define __CVMX_SPI_H__
34
35#include <asm/octeon/cvmx-gmxx-defs.h>
36
37/* CSR typedefs have been moved to cvmx-csr-*.h */
38
39typedef enum {
40 CVMX_SPI_MODE_UNKNOWN = 0,
41 CVMX_SPI_MODE_TX_HALFPLEX = 1,
42 CVMX_SPI_MODE_RX_HALFPLEX = 2,
43 CVMX_SPI_MODE_DUPLEX = 3
44} cvmx_spi_mode_t;
45
46/** Callbacks structure to customize SPI4 initialization sequence */
47typedef struct {
48 /** Called to reset SPI4 DLL */
49 int (*reset_cb) (int interface, cvmx_spi_mode_t mode);
50
51 /** Called to setup calendar */
52 int (*calendar_setup_cb) (int interface, cvmx_spi_mode_t mode,
53 int num_ports);
54
55 /** Called for Tx and Rx clock detection */
56 int (*clock_detect_cb) (int interface, cvmx_spi_mode_t mode,
57 int timeout);
58
59 /** Called to perform link training */
60 int (*training_cb) (int interface, cvmx_spi_mode_t mode, int timeout);
61
62 /** Called for calendar data synchronization */
63 int (*calendar_sync_cb) (int interface, cvmx_spi_mode_t mode,
64 int timeout);
65
66 /** Called when interface is up */
67 int (*interface_up_cb) (int interface, cvmx_spi_mode_t mode);
68
69} cvmx_spi_callbacks_t;
70
71/**
72 * Return true if the supplied interface is configured for SPI
73 *
74 * @interface: Interface to check
75 * Returns True if interface is SPI
76 */
77static inline int cvmx_spi_is_spi_interface(int interface)
78{
79 uint64_t gmxState = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface));
80 return (gmxState & 0x2) && (gmxState & 0x1);
81}
82
83/**
84 * Initialize and start the SPI interface.
85 *
86 * @interface: The identifier of the packet interface to configure and
87 * use as a SPI interface.
88 * @mode: The operating mode for the SPI interface. The interface
89 * can operate as a full duplex (both Tx and Rx data paths
90 * active) or as a halfplex (either the Tx data path is
91 * active or the Rx data path is active, but not both).
92 * @timeout: Timeout to wait for clock synchronization in seconds
93 * @num_ports: Number of SPI ports to configure
94 *
95 * Returns Zero on success, negative of failure.
96 */
97extern int cvmx_spi_start_interface(int interface, cvmx_spi_mode_t mode,
98 int timeout, int num_ports);
99
100/**
101 * This routine restarts the SPI interface after it has lost synchronization
102 * with its corespondant system.
103 *
104 * @interface: The identifier of the packet interface to configure and
105 * use as a SPI interface.
106 * @mode: The operating mode for the SPI interface. The interface
107 * can operate as a full duplex (both Tx and Rx data paths
108 * active) or as a halfplex (either the Tx data path is
109 * active or the Rx data path is active, but not both).
110 * @timeout: Timeout to wait for clock synchronization in seconds
111 * Returns Zero on success, negative of failure.
112 */
113extern int cvmx_spi_restart_interface(int interface, cvmx_spi_mode_t mode,
114 int timeout);
115
116/**
117 * Return non-zero if the SPI interface has a SPI4000 attached
118 *
119 * @interface: SPI interface the SPI4000 is connected to
120 *
121 * Returns
122 */
123static inline int cvmx_spi4000_is_present(int interface)
124{
125 return 0;
126}
127
128/**
129 * Initialize the SPI4000 for use
130 *
131 * @interface: SPI interface the SPI4000 is connected to
132 */
133static inline int cvmx_spi4000_initialize(int interface)
134{
135 return 0;
136}
137
138/**
139 * Poll all the SPI4000 port and check its speed
140 *
141 * @interface: Interface the SPI4000 is on
142 * @port: Port to poll (0-9)
143 * Returns Status of the port. 0=down. All other values the port is up.
144 */
145static inline union cvmx_gmxx_rxx_rx_inbnd cvmx_spi4000_check_speed(
146 int interface,
147 int port)
148{
149 union cvmx_gmxx_rxx_rx_inbnd r;
150 r.u64 = 0;
151 return r;
152}
153
154/**
155 * Get current SPI4 initialization callbacks
156 *
157 * @callbacks: Pointer to the callbacks structure.to fill
158 *
159 * Returns Pointer to cvmx_spi_callbacks_t structure.
160 */
161extern void cvmx_spi_get_callbacks(cvmx_spi_callbacks_t *callbacks);
162
163/**
164 * Set new SPI4 initialization callbacks
165 *
166 * @new_callbacks: Pointer to an updated callbacks structure.
167 */
168extern void cvmx_spi_set_callbacks(cvmx_spi_callbacks_t *new_callbacks);
169
170/**
171 * Callback to perform SPI4 reset
172 *
173 * @interface: The identifier of the packet interface to configure and
174 * use as a SPI interface.
175 * @mode: The operating mode for the SPI interface. The interface
176 * can operate as a full duplex (both Tx and Rx data paths
177 * active) or as a halfplex (either the Tx data path is
178 * active or the Rx data path is active, but not both).
179 *
180 * Returns Zero on success, non-zero error code on failure (will cause
181 * SPI initialization to abort)
182 */
183extern int cvmx_spi_reset_cb(int interface, cvmx_spi_mode_t mode);
184
185/**
186 * Callback to setup calendar and miscellaneous settings before clock
187 * detection
188 *
189 * @interface: The identifier of the packet interface to configure and
190 * use as a SPI interface.
191 * @mode: The operating mode for the SPI interface. The interface
192 * can operate as a full duplex (both Tx and Rx data paths
193 * active) or as a halfplex (either the Tx data path is
194 * active or the Rx data path is active, but not both).
195 * @num_ports: Number of ports to configure on SPI
196 *
197 * Returns Zero on success, non-zero error code on failure (will cause
198 * SPI initialization to abort)
199 */
200extern int cvmx_spi_calendar_setup_cb(int interface, cvmx_spi_mode_t mode,
201 int num_ports);
202
203/**
204 * Callback to perform clock detection
205 *
206 * @interface: The identifier of the packet interface to configure and
207 * use as a SPI interface.
208 * @mode: The operating mode for the SPI interface. The interface
209 * can operate as a full duplex (both Tx and Rx data paths
210 * active) or as a halfplex (either the Tx data path is
211 * active or the Rx data path is active, but not both).
212 * @timeout: Timeout to wait for clock synchronization in seconds
213 *
214 * Returns Zero on success, non-zero error code on failure (will cause
215 * SPI initialization to abort)
216 */
217extern int cvmx_spi_clock_detect_cb(int interface, cvmx_spi_mode_t mode,
218 int timeout);
219
220/**
221 * Callback to perform link training
222 *
223 * @interface: The identifier of the packet interface to configure and
224 * use as a SPI interface.
225 * @mode: The operating mode for the SPI interface. The interface
226 * can operate as a full duplex (both Tx and Rx data paths
227 * active) or as a halfplex (either the Tx data path is
228 * active or the Rx data path is active, but not both).
229 * @timeout: Timeout to wait for link to be trained (in seconds)
230 *
231 * Returns Zero on success, non-zero error code on failure (will cause
232 * SPI initialization to abort)
233 */
234extern int cvmx_spi_training_cb(int interface, cvmx_spi_mode_t mode,
235 int timeout);
236
237/**
238 * Callback to perform calendar data synchronization
239 *
240 * @interface: The identifier of the packet interface to configure and
241 * use as a SPI interface.
242 * @mode: The operating mode for the SPI interface. The interface
243 * can operate as a full duplex (both Tx and Rx data paths
244 * active) or as a halfplex (either the Tx data path is
245 * active or the Rx data path is active, but not both).
246 * @timeout: Timeout to wait for calendar data in seconds
247 *
248 * Returns Zero on success, non-zero error code on failure (will cause
249 * SPI initialization to abort)
250 */
251extern int cvmx_spi_calendar_sync_cb(int interface, cvmx_spi_mode_t mode,
252 int timeout);
253
254/**
255 * Callback to handle interface up
256 *
257 * @interface: The identifier of the packet interface to configure and
258 * use as a SPI interface.
259 * @mode: The operating mode for the SPI interface. The interface
260 * can operate as a full duplex (both Tx and Rx data paths
261 * active) or as a halfplex (either the Tx data path is
262 * active or the Rx data path is active, but not both).
263 *
264 * Returns Zero on success, non-zero error code on failure (will cause
265 * SPI initialization to abort)
266 */
267extern int cvmx_spi_interface_up_cb(int interface, cvmx_spi_mode_t mode);
268
269#endif /* __CVMX_SPI_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-spinlock.h b/arch/mips/include/asm/octeon/cvmx-spinlock.h
new file mode 100644
index 000000000..4f09cff8b
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-spinlock.h
@@ -0,0 +1,232 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 * Implementation of spinlocks for Octeon CVMX. Although similar in
30 * function to Linux kernel spinlocks, they are not compatible.
31 * Octeon CVMX spinlocks are only used to synchronize with the boot
32 * monitor and other non-Linux programs running in the system.
33 */
34
35#ifndef __CVMX_SPINLOCK_H__
36#define __CVMX_SPINLOCK_H__
37
38#include <asm/octeon/cvmx-asm.h>
39
40/* Spinlocks for Octeon */
41
42/* define these to enable recursive spinlock debugging */
43/*#define CVMX_SPINLOCK_DEBUG */
44
45/**
46 * Spinlocks for Octeon CVMX
47 */
48typedef struct {
49 volatile uint32_t value;
50} cvmx_spinlock_t;
51
52/* note - macros not expanded in inline ASM, so values hardcoded */
53#define CVMX_SPINLOCK_UNLOCKED_VAL 0
54#define CVMX_SPINLOCK_LOCKED_VAL 1
55
56#define CVMX_SPINLOCK_UNLOCKED_INITIALIZER {CVMX_SPINLOCK_UNLOCKED_VAL}
57
58/**
59 * Initialize a spinlock
60 *
61 * @lock: Lock to initialize
62 */
63static inline void cvmx_spinlock_init(cvmx_spinlock_t *lock)
64{
65 lock->value = CVMX_SPINLOCK_UNLOCKED_VAL;
66}
67
68/**
69 * Return non-zero if the spinlock is currently locked
70 *
71 * @lock: Lock to check
72 * Returns Non-zero if locked
73 */
74static inline int cvmx_spinlock_locked(cvmx_spinlock_t *lock)
75{
76 return lock->value != CVMX_SPINLOCK_UNLOCKED_VAL;
77}
78
79/**
80 * Releases lock
81 *
82 * @lock: pointer to lock structure
83 */
84static inline void cvmx_spinlock_unlock(cvmx_spinlock_t *lock)
85{
86 CVMX_SYNCWS;
87 lock->value = 0;
88 CVMX_SYNCWS;
89}
90
91/**
92 * Attempts to take the lock, but does not spin if lock is not available.
93 * May take some time to acquire the lock even if it is available
94 * due to the ll/sc not succeeding.
95 *
96 * @lock: pointer to lock structure
97 *
98 * Returns 0: lock successfully taken
99 * 1: lock not taken, held by someone else
100 * These return values match the Linux semantics.
101 */
102
103static inline unsigned int cvmx_spinlock_trylock(cvmx_spinlock_t *lock)
104{
105 unsigned int tmp;
106
107 __asm__ __volatile__(".set noreorder \n"
108 "1: ll %[tmp], %[val] \n"
109 /* if lock held, fail immediately */
110 " bnez %[tmp], 2f \n"
111 " li %[tmp], 1 \n"
112 " sc %[tmp], %[val] \n"
113 " beqz %[tmp], 1b \n"
114 " li %[tmp], 0 \n"
115 "2: \n"
116 ".set reorder \n" :
117 [val] "+m"(lock->value), [tmp] "=&r"(tmp)
118 : : "memory");
119
120 return tmp != 0; /* normalize to 0 or 1 */
121}
122
123/**
124 * Gets lock, spins until lock is taken
125 *
126 * @lock: pointer to lock structure
127 */
128static inline void cvmx_spinlock_lock(cvmx_spinlock_t *lock)
129{
130 unsigned int tmp;
131
132 __asm__ __volatile__(".set noreorder \n"
133 "1: ll %[tmp], %[val] \n"
134 " bnez %[tmp], 1b \n"
135 " li %[tmp], 1 \n"
136 " sc %[tmp], %[val] \n"
137 " beqz %[tmp], 1b \n"
138 " nop \n"
139 ".set reorder \n" :
140 [val] "+m"(lock->value), [tmp] "=&r"(tmp)
141 : : "memory");
142
143}
144
145/** ********************************************************************
146 * Bit spinlocks
147 * These spinlocks use a single bit (bit 31) of a 32 bit word for locking.
148 * The rest of the bits in the word are left undisturbed. This enables more
149 * compact data structures as only 1 bit is consumed for the lock.
150 *
151 */
152
153/**
154 * Gets lock, spins until lock is taken
155 * Preserves the low 31 bits of the 32 bit
156 * word used for the lock.
157 *
158 *
159 * @word: word to lock bit 31 of
160 */
161static inline void cvmx_spinlock_bit_lock(uint32_t *word)
162{
163 unsigned int tmp;
164 unsigned int sav;
165
166 __asm__ __volatile__(".set noreorder \n"
167 ".set noat \n"
168 "1: ll %[tmp], %[val] \n"
169 " bbit1 %[tmp], 31, 1b \n"
170 " li $at, 1 \n"
171 " ins %[tmp], $at, 31, 1 \n"
172 " sc %[tmp], %[val] \n"
173 " beqz %[tmp], 1b \n"
174 " nop \n"
175 ".set at \n"
176 ".set reorder \n" :
177 [val] "+m"(*word), [tmp] "=&r"(tmp), [sav] "=&r"(sav)
178 : : "memory");
179
180}
181
182/**
183 * Attempts to get lock, returns immediately with success/failure
184 * Preserves the low 31 bits of the 32 bit
185 * word used for the lock.
186 *
187 *
188 * @word: word to lock bit 31 of
189 * Returns 0: lock successfully taken
190 * 1: lock not taken, held by someone else
191 * These return values match the Linux semantics.
192 */
193static inline unsigned int cvmx_spinlock_bit_trylock(uint32_t *word)
194{
195 unsigned int tmp;
196
197 __asm__ __volatile__(".set noreorder\n\t"
198 ".set noat\n"
199 "1: ll %[tmp], %[val] \n"
200 /* if lock held, fail immediately */
201 " bbit1 %[tmp], 31, 2f \n"
202 " li $at, 1 \n"
203 " ins %[tmp], $at, 31, 1 \n"
204 " sc %[tmp], %[val] \n"
205 " beqz %[tmp], 1b \n"
206 " li %[tmp], 0 \n"
207 "2: \n"
208 ".set at \n"
209 ".set reorder \n" :
210 [val] "+m"(*word), [tmp] "=&r"(tmp)
211 : : "memory");
212
213 return tmp != 0; /* normalize to 0 or 1 */
214}
215
216/**
217 * Releases bit lock
218 *
219 * Unconditionally clears bit 31 of the lock word. Note that this is
220 * done non-atomically, as this implementation assumes that the rest
221 * of the bits in the word are protected by the lock.
222 *
223 * @word: word to unlock bit 31 in
224 */
225static inline void cvmx_spinlock_bit_unlock(uint32_t *word)
226{
227 CVMX_SYNCWS;
228 *word &= ~(1UL << 31);
229 CVMX_SYNCWS;
230}
231
232#endif /* __CVMX_SPINLOCK_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-spxx-defs.h b/arch/mips/include/asm/octeon/cvmx-spxx-defs.h
new file mode 100644
index 000000000..8471ed2de
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-spxx-defs.h
@@ -0,0 +1,446 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (C) 2003-2018 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_SPXX_DEFS_H__
29#define __CVMX_SPXX_DEFS_H__
30
31#define CVMX_SPXX_BCKPRS_CNT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000340ull) + ((block_id) & 1) * 0x8000000ull)
32#define CVMX_SPXX_BIST_STAT(block_id) (CVMX_ADD_IO_SEG(0x00011800900007F8ull) + ((block_id) & 1) * 0x8000000ull)
33#define CVMX_SPXX_CLK_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000348ull) + ((block_id) & 1) * 0x8000000ull)
34#define CVMX_SPXX_CLK_STAT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000350ull) + ((block_id) & 1) * 0x8000000ull)
35#define CVMX_SPXX_DBG_DESKEW_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000368ull) + ((block_id) & 1) * 0x8000000ull)
36#define CVMX_SPXX_DBG_DESKEW_STATE(block_id) (CVMX_ADD_IO_SEG(0x0001180090000370ull) + ((block_id) & 1) * 0x8000000ull)
37#define CVMX_SPXX_DRV_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000358ull) + ((block_id) & 1) * 0x8000000ull)
38#define CVMX_SPXX_ERR_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000320ull) + ((block_id) & 1) * 0x8000000ull)
39#define CVMX_SPXX_INT_DAT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000318ull) + ((block_id) & 1) * 0x8000000ull)
40#define CVMX_SPXX_INT_MSK(block_id) (CVMX_ADD_IO_SEG(0x0001180090000308ull) + ((block_id) & 1) * 0x8000000ull)
41#define CVMX_SPXX_INT_REG(block_id) (CVMX_ADD_IO_SEG(0x0001180090000300ull) + ((block_id) & 1) * 0x8000000ull)
42#define CVMX_SPXX_INT_SYNC(block_id) (CVMX_ADD_IO_SEG(0x0001180090000310ull) + ((block_id) & 1) * 0x8000000ull)
43#define CVMX_SPXX_TPA_ACC(block_id) (CVMX_ADD_IO_SEG(0x0001180090000338ull) + ((block_id) & 1) * 0x8000000ull)
44#define CVMX_SPXX_TPA_MAX(block_id) (CVMX_ADD_IO_SEG(0x0001180090000330ull) + ((block_id) & 1) * 0x8000000ull)
45#define CVMX_SPXX_TPA_SEL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000328ull) + ((block_id) & 1) * 0x8000000ull)
46#define CVMX_SPXX_TRN4_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000360ull) + ((block_id) & 1) * 0x8000000ull)
47
48void __cvmx_interrupt_spxx_int_msk_enable(int index);
49
50union cvmx_spxx_bckprs_cnt {
51 uint64_t u64;
52 struct cvmx_spxx_bckprs_cnt_s {
53#ifdef __BIG_ENDIAN_BITFIELD
54 uint64_t reserved_32_63:32;
55 uint64_t cnt:32;
56#else
57 uint64_t cnt:32;
58 uint64_t reserved_32_63:32;
59#endif
60 } s;
61};
62
63union cvmx_spxx_bist_stat {
64 uint64_t u64;
65 struct cvmx_spxx_bist_stat_s {
66#ifdef __BIG_ENDIAN_BITFIELD
67 uint64_t reserved_3_63:61;
68 uint64_t stat2:1;
69 uint64_t stat1:1;
70 uint64_t stat0:1;
71#else
72 uint64_t stat0:1;
73 uint64_t stat1:1;
74 uint64_t stat2:1;
75 uint64_t reserved_3_63:61;
76#endif
77 } s;
78};
79
80union cvmx_spxx_clk_ctl {
81 uint64_t u64;
82 struct cvmx_spxx_clk_ctl_s {
83#ifdef __BIG_ENDIAN_BITFIELD
84 uint64_t reserved_17_63:47;
85 uint64_t seetrn:1;
86 uint64_t reserved_12_15:4;
87 uint64_t clkdly:5;
88 uint64_t runbist:1;
89 uint64_t statdrv:1;
90 uint64_t statrcv:1;
91 uint64_t sndtrn:1;
92 uint64_t drptrn:1;
93 uint64_t rcvtrn:1;
94 uint64_t srxdlck:1;
95#else
96 uint64_t srxdlck:1;
97 uint64_t rcvtrn:1;
98 uint64_t drptrn:1;
99 uint64_t sndtrn:1;
100 uint64_t statrcv:1;
101 uint64_t statdrv:1;
102 uint64_t runbist:1;
103 uint64_t clkdly:5;
104 uint64_t reserved_12_15:4;
105 uint64_t seetrn:1;
106 uint64_t reserved_17_63:47;
107#endif
108 } s;
109};
110
111union cvmx_spxx_clk_stat {
112 uint64_t u64;
113 struct cvmx_spxx_clk_stat_s {
114#ifdef __BIG_ENDIAN_BITFIELD
115 uint64_t reserved_11_63:53;
116 uint64_t stxcal:1;
117 uint64_t reserved_9_9:1;
118 uint64_t srxtrn:1;
119 uint64_t s4clk1:1;
120 uint64_t s4clk0:1;
121 uint64_t d4clk1:1;
122 uint64_t d4clk0:1;
123 uint64_t reserved_0_3:4;
124#else
125 uint64_t reserved_0_3:4;
126 uint64_t d4clk0:1;
127 uint64_t d4clk1:1;
128 uint64_t s4clk0:1;
129 uint64_t s4clk1:1;
130 uint64_t srxtrn:1;
131 uint64_t reserved_9_9:1;
132 uint64_t stxcal:1;
133 uint64_t reserved_11_63:53;
134#endif
135 } s;
136};
137
138union cvmx_spxx_dbg_deskew_ctl {
139 uint64_t u64;
140 struct cvmx_spxx_dbg_deskew_ctl_s {
141#ifdef __BIG_ENDIAN_BITFIELD
142 uint64_t reserved_30_63:34;
143 uint64_t fallnop:1;
144 uint64_t fall8:1;
145 uint64_t reserved_26_27:2;
146 uint64_t sstep_go:1;
147 uint64_t sstep:1;
148 uint64_t reserved_22_23:2;
149 uint64_t clrdly:1;
150 uint64_t dec:1;
151 uint64_t inc:1;
152 uint64_t mux:1;
153 uint64_t offset:5;
154 uint64_t bitsel:5;
155 uint64_t offdly:6;
156 uint64_t dllfrc:1;
157 uint64_t dlldis:1;
158#else
159 uint64_t dlldis:1;
160 uint64_t dllfrc:1;
161 uint64_t offdly:6;
162 uint64_t bitsel:5;
163 uint64_t offset:5;
164 uint64_t mux:1;
165 uint64_t inc:1;
166 uint64_t dec:1;
167 uint64_t clrdly:1;
168 uint64_t reserved_22_23:2;
169 uint64_t sstep:1;
170 uint64_t sstep_go:1;
171 uint64_t reserved_26_27:2;
172 uint64_t fall8:1;
173 uint64_t fallnop:1;
174 uint64_t reserved_30_63:34;
175#endif
176 } s;
177};
178
179union cvmx_spxx_dbg_deskew_state {
180 uint64_t u64;
181 struct cvmx_spxx_dbg_deskew_state_s {
182#ifdef __BIG_ENDIAN_BITFIELD
183 uint64_t reserved_9_63:55;
184 uint64_t testres:1;
185 uint64_t unxterm:1;
186 uint64_t muxsel:2;
187 uint64_t offset:5;
188#else
189 uint64_t offset:5;
190 uint64_t muxsel:2;
191 uint64_t unxterm:1;
192 uint64_t testres:1;
193 uint64_t reserved_9_63:55;
194#endif
195 } s;
196};
197
198union cvmx_spxx_drv_ctl {
199 uint64_t u64;
200 struct cvmx_spxx_drv_ctl_s {
201#ifdef __BIG_ENDIAN_BITFIELD
202 uint64_t reserved_0_63:64;
203#else
204 uint64_t reserved_0_63:64;
205#endif
206 } s;
207 struct cvmx_spxx_drv_ctl_cn38xx {
208#ifdef __BIG_ENDIAN_BITFIELD
209 uint64_t reserved_16_63:48;
210 uint64_t stx4ncmp:4;
211 uint64_t stx4pcmp:4;
212 uint64_t srx4cmp:8;
213#else
214 uint64_t srx4cmp:8;
215 uint64_t stx4pcmp:4;
216 uint64_t stx4ncmp:4;
217 uint64_t reserved_16_63:48;
218#endif
219 } cn38xx;
220 struct cvmx_spxx_drv_ctl_cn58xx {
221#ifdef __BIG_ENDIAN_BITFIELD
222 uint64_t reserved_24_63:40;
223 uint64_t stx4ncmp:4;
224 uint64_t stx4pcmp:4;
225 uint64_t reserved_10_15:6;
226 uint64_t srx4cmp:10;
227#else
228 uint64_t srx4cmp:10;
229 uint64_t reserved_10_15:6;
230 uint64_t stx4pcmp:4;
231 uint64_t stx4ncmp:4;
232 uint64_t reserved_24_63:40;
233#endif
234 } cn58xx;
235};
236
237union cvmx_spxx_err_ctl {
238 uint64_t u64;
239 struct cvmx_spxx_err_ctl_s {
240#ifdef __BIG_ENDIAN_BITFIELD
241 uint64_t reserved_9_63:55;
242 uint64_t prtnxa:1;
243 uint64_t dipcls:1;
244 uint64_t dippay:1;
245 uint64_t reserved_4_5:2;
246 uint64_t errcnt:4;
247#else
248 uint64_t errcnt:4;
249 uint64_t reserved_4_5:2;
250 uint64_t dippay:1;
251 uint64_t dipcls:1;
252 uint64_t prtnxa:1;
253 uint64_t reserved_9_63:55;
254#endif
255 } s;
256};
257
258union cvmx_spxx_int_dat {
259 uint64_t u64;
260 struct cvmx_spxx_int_dat_s {
261#ifdef __BIG_ENDIAN_BITFIELD
262 uint64_t reserved_32_63:32;
263 uint64_t mul:1;
264 uint64_t reserved_14_30:17;
265 uint64_t calbnk:2;
266 uint64_t rsvop:4;
267 uint64_t prt:8;
268#else
269 uint64_t prt:8;
270 uint64_t rsvop:4;
271 uint64_t calbnk:2;
272 uint64_t reserved_14_30:17;
273 uint64_t mul:1;
274 uint64_t reserved_32_63:32;
275#endif
276 } s;
277};
278
279union cvmx_spxx_int_msk {
280 uint64_t u64;
281 struct cvmx_spxx_int_msk_s {
282#ifdef __BIG_ENDIAN_BITFIELD
283 uint64_t reserved_12_63:52;
284 uint64_t calerr:1;
285 uint64_t syncerr:1;
286 uint64_t diperr:1;
287 uint64_t tpaovr:1;
288 uint64_t rsverr:1;
289 uint64_t drwnng:1;
290 uint64_t clserr:1;
291 uint64_t spiovr:1;
292 uint64_t reserved_2_3:2;
293 uint64_t abnorm:1;
294 uint64_t prtnxa:1;
295#else
296 uint64_t prtnxa:1;
297 uint64_t abnorm:1;
298 uint64_t reserved_2_3:2;
299 uint64_t spiovr:1;
300 uint64_t clserr:1;
301 uint64_t drwnng:1;
302 uint64_t rsverr:1;
303 uint64_t tpaovr:1;
304 uint64_t diperr:1;
305 uint64_t syncerr:1;
306 uint64_t calerr:1;
307 uint64_t reserved_12_63:52;
308#endif
309 } s;
310};
311
312union cvmx_spxx_int_reg {
313 uint64_t u64;
314 struct cvmx_spxx_int_reg_s {
315#ifdef __BIG_ENDIAN_BITFIELD
316 uint64_t reserved_32_63:32;
317 uint64_t spf:1;
318 uint64_t reserved_12_30:19;
319 uint64_t calerr:1;
320 uint64_t syncerr:1;
321 uint64_t diperr:1;
322 uint64_t tpaovr:1;
323 uint64_t rsverr:1;
324 uint64_t drwnng:1;
325 uint64_t clserr:1;
326 uint64_t spiovr:1;
327 uint64_t reserved_2_3:2;
328 uint64_t abnorm:1;
329 uint64_t prtnxa:1;
330#else
331 uint64_t prtnxa:1;
332 uint64_t abnorm:1;
333 uint64_t reserved_2_3:2;
334 uint64_t spiovr:1;
335 uint64_t clserr:1;
336 uint64_t drwnng:1;
337 uint64_t rsverr:1;
338 uint64_t tpaovr:1;
339 uint64_t diperr:1;
340 uint64_t syncerr:1;
341 uint64_t calerr:1;
342 uint64_t reserved_12_30:19;
343 uint64_t spf:1;
344 uint64_t reserved_32_63:32;
345#endif
346 } s;
347};
348
349union cvmx_spxx_int_sync {
350 uint64_t u64;
351 struct cvmx_spxx_int_sync_s {
352#ifdef __BIG_ENDIAN_BITFIELD
353 uint64_t reserved_12_63:52;
354 uint64_t calerr:1;
355 uint64_t syncerr:1;
356 uint64_t diperr:1;
357 uint64_t tpaovr:1;
358 uint64_t rsverr:1;
359 uint64_t drwnng:1;
360 uint64_t clserr:1;
361 uint64_t spiovr:1;
362 uint64_t reserved_2_3:2;
363 uint64_t abnorm:1;
364 uint64_t prtnxa:1;
365#else
366 uint64_t prtnxa:1;
367 uint64_t abnorm:1;
368 uint64_t reserved_2_3:2;
369 uint64_t spiovr:1;
370 uint64_t clserr:1;
371 uint64_t drwnng:1;
372 uint64_t rsverr:1;
373 uint64_t tpaovr:1;
374 uint64_t diperr:1;
375 uint64_t syncerr:1;
376 uint64_t calerr:1;
377 uint64_t reserved_12_63:52;
378#endif
379 } s;
380};
381
382union cvmx_spxx_tpa_acc {
383 uint64_t u64;
384 struct cvmx_spxx_tpa_acc_s {
385#ifdef __BIG_ENDIAN_BITFIELD
386 uint64_t reserved_32_63:32;
387 uint64_t cnt:32;
388#else
389 uint64_t cnt:32;
390 uint64_t reserved_32_63:32;
391#endif
392 } s;
393};
394
395union cvmx_spxx_tpa_max {
396 uint64_t u64;
397 struct cvmx_spxx_tpa_max_s {
398#ifdef __BIG_ENDIAN_BITFIELD
399 uint64_t reserved_32_63:32;
400 uint64_t max:32;
401#else
402 uint64_t max:32;
403 uint64_t reserved_32_63:32;
404#endif
405 } s;
406};
407
408union cvmx_spxx_tpa_sel {
409 uint64_t u64;
410 struct cvmx_spxx_tpa_sel_s {
411#ifdef __BIG_ENDIAN_BITFIELD
412 uint64_t reserved_4_63:60;
413 uint64_t prtsel:4;
414#else
415 uint64_t prtsel:4;
416 uint64_t reserved_4_63:60;
417#endif
418 } s;
419};
420
421union cvmx_spxx_trn4_ctl {
422 uint64_t u64;
423 struct cvmx_spxx_trn4_ctl_s {
424#ifdef __BIG_ENDIAN_BITFIELD
425 uint64_t reserved_13_63:51;
426 uint64_t trntest:1;
427 uint64_t jitter:3;
428 uint64_t clr_boot:1;
429 uint64_t set_boot:1;
430 uint64_t maxdist:5;
431 uint64_t macro_en:1;
432 uint64_t mux_en:1;
433#else
434 uint64_t mux_en:1;
435 uint64_t macro_en:1;
436 uint64_t maxdist:5;
437 uint64_t set_boot:1;
438 uint64_t clr_boot:1;
439 uint64_t jitter:3;
440 uint64_t trntest:1;
441 uint64_t reserved_13_63:51;
442#endif
443 } s;
444};
445
446#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-sriox-defs.h b/arch/mips/include/asm/octeon/cvmx-sriox-defs.h
new file mode 100644
index 000000000..34d0fadb5
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-sriox-defs.h
@@ -0,0 +1,1614 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_SRIOX_DEFS_H__
29#define __CVMX_SRIOX_DEFS_H__
30
31#define CVMX_SRIOX_ACC_CTRL(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000148ull) + ((block_id) & 3) * 0x1000000ull)
32#define CVMX_SRIOX_ASMBLY_ID(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000200ull) + ((block_id) & 3) * 0x1000000ull)
33#define CVMX_SRIOX_ASMBLY_INFO(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000208ull) + ((block_id) & 3) * 0x1000000ull)
34#define CVMX_SRIOX_BELL_RESP_CTRL(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000310ull) + ((block_id) & 3) * 0x1000000ull)
35#define CVMX_SRIOX_BIST_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000108ull) + ((block_id) & 3) * 0x1000000ull)
36#define CVMX_SRIOX_IMSG_CTRL(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000508ull) + ((block_id) & 3) * 0x1000000ull)
37#define CVMX_SRIOX_IMSG_INST_HDRX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000510ull) + (((offset) & 1) + ((block_id) & 3) * 0x200000ull) * 8)
38#define CVMX_SRIOX_IMSG_QOS_GRPX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000600ull) + (((offset) & 31) + ((block_id) & 3) * 0x200000ull) * 8)
39#define CVMX_SRIOX_IMSG_STATUSX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000700ull) + (((offset) & 31) + ((block_id) & 3) * 0x200000ull) * 8)
40#define CVMX_SRIOX_IMSG_VPORT_THR(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000500ull) + ((block_id) & 3) * 0x1000000ull)
41#define CVMX_SRIOX_IMSG_VPORT_THR2(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000528ull) + ((block_id) & 3) * 0x1000000ull)
42#define CVMX_SRIOX_INT2_ENABLE(block_id) (CVMX_ADD_IO_SEG(0x00011800C80003E0ull) + ((block_id) & 3) * 0x1000000ull)
43#define CVMX_SRIOX_INT2_REG(block_id) (CVMX_ADD_IO_SEG(0x00011800C80003E8ull) + ((block_id) & 3) * 0x1000000ull)
44#define CVMX_SRIOX_INT_ENABLE(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000110ull) + ((block_id) & 3) * 0x1000000ull)
45#define CVMX_SRIOX_INT_INFO0(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000120ull) + ((block_id) & 3) * 0x1000000ull)
46#define CVMX_SRIOX_INT_INFO1(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000128ull) + ((block_id) & 3) * 0x1000000ull)
47#define CVMX_SRIOX_INT_INFO2(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000130ull) + ((block_id) & 3) * 0x1000000ull)
48#define CVMX_SRIOX_INT_INFO3(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000138ull) + ((block_id) & 3) * 0x1000000ull)
49#define CVMX_SRIOX_INT_REG(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000118ull) + ((block_id) & 3) * 0x1000000ull)
50#define CVMX_SRIOX_IP_FEATURE(block_id) (CVMX_ADD_IO_SEG(0x00011800C80003F8ull) + ((block_id) & 3) * 0x1000000ull)
51#define CVMX_SRIOX_MAC_BUFFERS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000390ull) + ((block_id) & 3) * 0x1000000ull)
52#define CVMX_SRIOX_MAINT_OP(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000158ull) + ((block_id) & 3) * 0x1000000ull)
53#define CVMX_SRIOX_MAINT_RD_DATA(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000160ull) + ((block_id) & 3) * 0x1000000ull)
54#define CVMX_SRIOX_MCE_TX_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000240ull) + ((block_id) & 3) * 0x1000000ull)
55#define CVMX_SRIOX_MEM_OP_CTRL(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000168ull) + ((block_id) & 3) * 0x1000000ull)
56#define CVMX_SRIOX_OMSG_CTRLX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000488ull) + (((offset) & 1) + ((block_id) & 3) * 0x40000ull) * 64)
57#define CVMX_SRIOX_OMSG_DONE_COUNTSX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C80004B0ull) + (((offset) & 1) + ((block_id) & 3) * 0x40000ull) * 64)
58#define CVMX_SRIOX_OMSG_FMP_MRX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000498ull) + (((offset) & 1) + ((block_id) & 3) * 0x40000ull) * 64)
59#define CVMX_SRIOX_OMSG_NMP_MRX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C80004A0ull) + (((offset) & 1) + ((block_id) & 3) * 0x40000ull) * 64)
60#define CVMX_SRIOX_OMSG_PORTX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000480ull) + (((offset) & 1) + ((block_id) & 3) * 0x40000ull) * 64)
61#define CVMX_SRIOX_OMSG_SILO_THR(block_id) (CVMX_ADD_IO_SEG(0x00011800C80004F8ull) + ((block_id) & 3) * 0x1000000ull)
62#define CVMX_SRIOX_OMSG_SP_MRX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000490ull) + (((offset) & 1) + ((block_id) & 3) * 0x40000ull) * 64)
63#define CVMX_SRIOX_PRIOX_IN_USE(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C80003C0ull) + (((offset) & 3) + ((block_id) & 3) * 0x200000ull) * 8)
64#define CVMX_SRIOX_RX_BELL(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000308ull) + ((block_id) & 3) * 0x1000000ull)
65#define CVMX_SRIOX_RX_BELL_SEQ(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000300ull) + ((block_id) & 3) * 0x1000000ull)
66#define CVMX_SRIOX_RX_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000380ull) + ((block_id) & 3) * 0x1000000ull)
67#define CVMX_SRIOX_S2M_TYPEX(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000180ull) + (((offset) & 15) + ((block_id) & 3) * 0x200000ull) * 8)
68#define CVMX_SRIOX_SEQ(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000278ull) + ((block_id) & 3) * 0x1000000ull)
69#define CVMX_SRIOX_STATUS_REG(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000100ull) + ((block_id) & 3) * 0x1000000ull)
70#define CVMX_SRIOX_TAG_CTRL(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000178ull) + ((block_id) & 3) * 0x1000000ull)
71#define CVMX_SRIOX_TLP_CREDITS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000150ull) + ((block_id) & 3) * 0x1000000ull)
72#define CVMX_SRIOX_TX_BELL(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000280ull) + ((block_id) & 3) * 0x1000000ull)
73#define CVMX_SRIOX_TX_BELL_INFO(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000288ull) + ((block_id) & 3) * 0x1000000ull)
74#define CVMX_SRIOX_TX_CTRL(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000170ull) + ((block_id) & 3) * 0x1000000ull)
75#define CVMX_SRIOX_TX_EMPHASIS(block_id) (CVMX_ADD_IO_SEG(0x00011800C80003F0ull) + ((block_id) & 3) * 0x1000000ull)
76#define CVMX_SRIOX_TX_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000388ull) + ((block_id) & 3) * 0x1000000ull)
77#define CVMX_SRIOX_WR_DONE_COUNTS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000340ull) + ((block_id) & 3) * 0x1000000ull)
78
79union cvmx_sriox_acc_ctrl {
80 uint64_t u64;
81 struct cvmx_sriox_acc_ctrl_s {
82#ifdef __BIG_ENDIAN_BITFIELD
83 uint64_t reserved_7_63:57;
84 uint64_t deny_adr2:1;
85 uint64_t deny_adr1:1;
86 uint64_t deny_adr0:1;
87 uint64_t reserved_3_3:1;
88 uint64_t deny_bar2:1;
89 uint64_t deny_bar1:1;
90 uint64_t deny_bar0:1;
91#else
92 uint64_t deny_bar0:1;
93 uint64_t deny_bar1:1;
94 uint64_t deny_bar2:1;
95 uint64_t reserved_3_3:1;
96 uint64_t deny_adr0:1;
97 uint64_t deny_adr1:1;
98 uint64_t deny_adr2:1;
99 uint64_t reserved_7_63:57;
100#endif
101 } s;
102 struct cvmx_sriox_acc_ctrl_cn63xx {
103#ifdef __BIG_ENDIAN_BITFIELD
104 uint64_t reserved_3_63:61;
105 uint64_t deny_bar2:1;
106 uint64_t deny_bar1:1;
107 uint64_t deny_bar0:1;
108#else
109 uint64_t deny_bar0:1;
110 uint64_t deny_bar1:1;
111 uint64_t deny_bar2:1;
112 uint64_t reserved_3_63:61;
113#endif
114 } cn63xx;
115};
116
117union cvmx_sriox_asmbly_id {
118 uint64_t u64;
119 struct cvmx_sriox_asmbly_id_s {
120#ifdef __BIG_ENDIAN_BITFIELD
121 uint64_t reserved_32_63:32;
122 uint64_t assy_id:16;
123 uint64_t assy_ven:16;
124#else
125 uint64_t assy_ven:16;
126 uint64_t assy_id:16;
127 uint64_t reserved_32_63:32;
128#endif
129 } s;
130};
131
132union cvmx_sriox_asmbly_info {
133 uint64_t u64;
134 struct cvmx_sriox_asmbly_info_s {
135#ifdef __BIG_ENDIAN_BITFIELD
136 uint64_t reserved_32_63:32;
137 uint64_t assy_rev:16;
138 uint64_t reserved_0_15:16;
139#else
140 uint64_t reserved_0_15:16;
141 uint64_t assy_rev:16;
142 uint64_t reserved_32_63:32;
143#endif
144 } s;
145};
146
147union cvmx_sriox_bell_resp_ctrl {
148 uint64_t u64;
149 struct cvmx_sriox_bell_resp_ctrl_s {
150#ifdef __BIG_ENDIAN_BITFIELD
151 uint64_t reserved_6_63:58;
152 uint64_t rp1_sid:1;
153 uint64_t rp0_sid:2;
154 uint64_t rp1_pid:1;
155 uint64_t rp0_pid:2;
156#else
157 uint64_t rp0_pid:2;
158 uint64_t rp1_pid:1;
159 uint64_t rp0_sid:2;
160 uint64_t rp1_sid:1;
161 uint64_t reserved_6_63:58;
162#endif
163 } s;
164};
165
166union cvmx_sriox_bist_status {
167 uint64_t u64;
168 struct cvmx_sriox_bist_status_s {
169#ifdef __BIG_ENDIAN_BITFIELD
170 uint64_t reserved_45_63:19;
171 uint64_t lram:1;
172 uint64_t mram:2;
173 uint64_t cram:2;
174 uint64_t bell:2;
175 uint64_t otag:2;
176 uint64_t itag:1;
177 uint64_t ofree:1;
178 uint64_t rtn:2;
179 uint64_t obulk:4;
180 uint64_t optrs:4;
181 uint64_t oarb2:2;
182 uint64_t rxbuf2:2;
183 uint64_t oarb:2;
184 uint64_t ispf:1;
185 uint64_t ospf:1;
186 uint64_t txbuf:2;
187 uint64_t rxbuf:2;
188 uint64_t imsg:5;
189 uint64_t omsg:7;
190#else
191 uint64_t omsg:7;
192 uint64_t imsg:5;
193 uint64_t rxbuf:2;
194 uint64_t txbuf:2;
195 uint64_t ospf:1;
196 uint64_t ispf:1;
197 uint64_t oarb:2;
198 uint64_t rxbuf2:2;
199 uint64_t oarb2:2;
200 uint64_t optrs:4;
201 uint64_t obulk:4;
202 uint64_t rtn:2;
203 uint64_t ofree:1;
204 uint64_t itag:1;
205 uint64_t otag:2;
206 uint64_t bell:2;
207 uint64_t cram:2;
208 uint64_t mram:2;
209 uint64_t lram:1;
210 uint64_t reserved_45_63:19;
211#endif
212 } s;
213 struct cvmx_sriox_bist_status_cn63xx {
214#ifdef __BIG_ENDIAN_BITFIELD
215 uint64_t reserved_44_63:20;
216 uint64_t mram:2;
217 uint64_t cram:2;
218 uint64_t bell:2;
219 uint64_t otag:2;
220 uint64_t itag:1;
221 uint64_t ofree:1;
222 uint64_t rtn:2;
223 uint64_t obulk:4;
224 uint64_t optrs:4;
225 uint64_t oarb2:2;
226 uint64_t rxbuf2:2;
227 uint64_t oarb:2;
228 uint64_t ispf:1;
229 uint64_t ospf:1;
230 uint64_t txbuf:2;
231 uint64_t rxbuf:2;
232 uint64_t imsg:5;
233 uint64_t omsg:7;
234#else
235 uint64_t omsg:7;
236 uint64_t imsg:5;
237 uint64_t rxbuf:2;
238 uint64_t txbuf:2;
239 uint64_t ospf:1;
240 uint64_t ispf:1;
241 uint64_t oarb:2;
242 uint64_t rxbuf2:2;
243 uint64_t oarb2:2;
244 uint64_t optrs:4;
245 uint64_t obulk:4;
246 uint64_t rtn:2;
247 uint64_t ofree:1;
248 uint64_t itag:1;
249 uint64_t otag:2;
250 uint64_t bell:2;
251 uint64_t cram:2;
252 uint64_t mram:2;
253 uint64_t reserved_44_63:20;
254#endif
255 } cn63xx;
256 struct cvmx_sriox_bist_status_cn63xxp1 {
257#ifdef __BIG_ENDIAN_BITFIELD
258 uint64_t reserved_44_63:20;
259 uint64_t mram:2;
260 uint64_t cram:2;
261 uint64_t bell:2;
262 uint64_t otag:2;
263 uint64_t itag:1;
264 uint64_t ofree:1;
265 uint64_t rtn:2;
266 uint64_t obulk:4;
267 uint64_t optrs:4;
268 uint64_t reserved_20_23:4;
269 uint64_t oarb:2;
270 uint64_t ispf:1;
271 uint64_t ospf:1;
272 uint64_t txbuf:2;
273 uint64_t rxbuf:2;
274 uint64_t imsg:5;
275 uint64_t omsg:7;
276#else
277 uint64_t omsg:7;
278 uint64_t imsg:5;
279 uint64_t rxbuf:2;
280 uint64_t txbuf:2;
281 uint64_t ospf:1;
282 uint64_t ispf:1;
283 uint64_t oarb:2;
284 uint64_t reserved_20_23:4;
285 uint64_t optrs:4;
286 uint64_t obulk:4;
287 uint64_t rtn:2;
288 uint64_t ofree:1;
289 uint64_t itag:1;
290 uint64_t otag:2;
291 uint64_t bell:2;
292 uint64_t cram:2;
293 uint64_t mram:2;
294 uint64_t reserved_44_63:20;
295#endif
296 } cn63xxp1;
297};
298
299union cvmx_sriox_imsg_ctrl {
300 uint64_t u64;
301 struct cvmx_sriox_imsg_ctrl_s {
302#ifdef __BIG_ENDIAN_BITFIELD
303 uint64_t reserved_32_63:32;
304 uint64_t to_mode:1;
305 uint64_t reserved_30_30:1;
306 uint64_t rsp_thr:6;
307 uint64_t reserved_22_23:2;
308 uint64_t rp1_sid:1;
309 uint64_t rp0_sid:2;
310 uint64_t rp1_pid:1;
311 uint64_t rp0_pid:2;
312 uint64_t reserved_15_15:1;
313 uint64_t prt_sel:3;
314 uint64_t lttr:4;
315 uint64_t prio:4;
316 uint64_t mbox:4;
317#else
318 uint64_t mbox:4;
319 uint64_t prio:4;
320 uint64_t lttr:4;
321 uint64_t prt_sel:3;
322 uint64_t reserved_15_15:1;
323 uint64_t rp0_pid:2;
324 uint64_t rp1_pid:1;
325 uint64_t rp0_sid:2;
326 uint64_t rp1_sid:1;
327 uint64_t reserved_22_23:2;
328 uint64_t rsp_thr:6;
329 uint64_t reserved_30_30:1;
330 uint64_t to_mode:1;
331 uint64_t reserved_32_63:32;
332#endif
333 } s;
334};
335
336union cvmx_sriox_imsg_inst_hdrx {
337 uint64_t u64;
338 struct cvmx_sriox_imsg_inst_hdrx_s {
339#ifdef __BIG_ENDIAN_BITFIELD
340 uint64_t r:1;
341 uint64_t reserved_58_62:5;
342 uint64_t pm:2;
343 uint64_t reserved_55_55:1;
344 uint64_t sl:7;
345 uint64_t reserved_46_47:2;
346 uint64_t nqos:1;
347 uint64_t ngrp:1;
348 uint64_t ntt:1;
349 uint64_t ntag:1;
350 uint64_t reserved_35_41:7;
351 uint64_t rs:1;
352 uint64_t tt:2;
353 uint64_t tag:32;
354#else
355 uint64_t tag:32;
356 uint64_t tt:2;
357 uint64_t rs:1;
358 uint64_t reserved_35_41:7;
359 uint64_t ntag:1;
360 uint64_t ntt:1;
361 uint64_t ngrp:1;
362 uint64_t nqos:1;
363 uint64_t reserved_46_47:2;
364 uint64_t sl:7;
365 uint64_t reserved_55_55:1;
366 uint64_t pm:2;
367 uint64_t reserved_58_62:5;
368 uint64_t r:1;
369#endif
370 } s;
371};
372
373union cvmx_sriox_imsg_qos_grpx {
374 uint64_t u64;
375 struct cvmx_sriox_imsg_qos_grpx_s {
376#ifdef __BIG_ENDIAN_BITFIELD
377 uint64_t reserved_63_63:1;
378 uint64_t qos7:3;
379 uint64_t grp7:4;
380 uint64_t reserved_55_55:1;
381 uint64_t qos6:3;
382 uint64_t grp6:4;
383 uint64_t reserved_47_47:1;
384 uint64_t qos5:3;
385 uint64_t grp5:4;
386 uint64_t reserved_39_39:1;
387 uint64_t qos4:3;
388 uint64_t grp4:4;
389 uint64_t reserved_31_31:1;
390 uint64_t qos3:3;
391 uint64_t grp3:4;
392 uint64_t reserved_23_23:1;
393 uint64_t qos2:3;
394 uint64_t grp2:4;
395 uint64_t reserved_15_15:1;
396 uint64_t qos1:3;
397 uint64_t grp1:4;
398 uint64_t reserved_7_7:1;
399 uint64_t qos0:3;
400 uint64_t grp0:4;
401#else
402 uint64_t grp0:4;
403 uint64_t qos0:3;
404 uint64_t reserved_7_7:1;
405 uint64_t grp1:4;
406 uint64_t qos1:3;
407 uint64_t reserved_15_15:1;
408 uint64_t grp2:4;
409 uint64_t qos2:3;
410 uint64_t reserved_23_23:1;
411 uint64_t grp3:4;
412 uint64_t qos3:3;
413 uint64_t reserved_31_31:1;
414 uint64_t grp4:4;
415 uint64_t qos4:3;
416 uint64_t reserved_39_39:1;
417 uint64_t grp5:4;
418 uint64_t qos5:3;
419 uint64_t reserved_47_47:1;
420 uint64_t grp6:4;
421 uint64_t qos6:3;
422 uint64_t reserved_55_55:1;
423 uint64_t grp7:4;
424 uint64_t qos7:3;
425 uint64_t reserved_63_63:1;
426#endif
427 } s;
428};
429
430union cvmx_sriox_imsg_statusx {
431 uint64_t u64;
432 struct cvmx_sriox_imsg_statusx_s {
433#ifdef __BIG_ENDIAN_BITFIELD
434 uint64_t val1:1;
435 uint64_t err1:1;
436 uint64_t toe1:1;
437 uint64_t toc1:1;
438 uint64_t prt1:1;
439 uint64_t reserved_58_58:1;
440 uint64_t tt1:1;
441 uint64_t dis1:1;
442 uint64_t seg1:4;
443 uint64_t mbox1:2;
444 uint64_t lttr1:2;
445 uint64_t sid1:16;
446 uint64_t val0:1;
447 uint64_t err0:1;
448 uint64_t toe0:1;
449 uint64_t toc0:1;
450 uint64_t prt0:1;
451 uint64_t reserved_26_26:1;
452 uint64_t tt0:1;
453 uint64_t dis0:1;
454 uint64_t seg0:4;
455 uint64_t mbox0:2;
456 uint64_t lttr0:2;
457 uint64_t sid0:16;
458#else
459 uint64_t sid0:16;
460 uint64_t lttr0:2;
461 uint64_t mbox0:2;
462 uint64_t seg0:4;
463 uint64_t dis0:1;
464 uint64_t tt0:1;
465 uint64_t reserved_26_26:1;
466 uint64_t prt0:1;
467 uint64_t toc0:1;
468 uint64_t toe0:1;
469 uint64_t err0:1;
470 uint64_t val0:1;
471 uint64_t sid1:16;
472 uint64_t lttr1:2;
473 uint64_t mbox1:2;
474 uint64_t seg1:4;
475 uint64_t dis1:1;
476 uint64_t tt1:1;
477 uint64_t reserved_58_58:1;
478 uint64_t prt1:1;
479 uint64_t toc1:1;
480 uint64_t toe1:1;
481 uint64_t err1:1;
482 uint64_t val1:1;
483#endif
484 } s;
485};
486
487union cvmx_sriox_imsg_vport_thr {
488 uint64_t u64;
489 struct cvmx_sriox_imsg_vport_thr_s {
490#ifdef __BIG_ENDIAN_BITFIELD
491 uint64_t reserved_54_63:10;
492 uint64_t max_tot:6;
493 uint64_t reserved_46_47:2;
494 uint64_t max_s1:6;
495 uint64_t reserved_38_39:2;
496 uint64_t max_s0:6;
497 uint64_t sp_vport:1;
498 uint64_t reserved_20_30:11;
499 uint64_t buf_thr:4;
500 uint64_t reserved_14_15:2;
501 uint64_t max_p1:6;
502 uint64_t reserved_6_7:2;
503 uint64_t max_p0:6;
504#else
505 uint64_t max_p0:6;
506 uint64_t reserved_6_7:2;
507 uint64_t max_p1:6;
508 uint64_t reserved_14_15:2;
509 uint64_t buf_thr:4;
510 uint64_t reserved_20_30:11;
511 uint64_t sp_vport:1;
512 uint64_t max_s0:6;
513 uint64_t reserved_38_39:2;
514 uint64_t max_s1:6;
515 uint64_t reserved_46_47:2;
516 uint64_t max_tot:6;
517 uint64_t reserved_54_63:10;
518#endif
519 } s;
520};
521
522union cvmx_sriox_imsg_vport_thr2 {
523 uint64_t u64;
524 struct cvmx_sriox_imsg_vport_thr2_s {
525#ifdef __BIG_ENDIAN_BITFIELD
526 uint64_t reserved_46_63:18;
527 uint64_t max_s3:6;
528 uint64_t reserved_38_39:2;
529 uint64_t max_s2:6;
530 uint64_t reserved_0_31:32;
531#else
532 uint64_t reserved_0_31:32;
533 uint64_t max_s2:6;
534 uint64_t reserved_38_39:2;
535 uint64_t max_s3:6;
536 uint64_t reserved_46_63:18;
537#endif
538 } s;
539};
540
541union cvmx_sriox_int2_enable {
542 uint64_t u64;
543 struct cvmx_sriox_int2_enable_s {
544#ifdef __BIG_ENDIAN_BITFIELD
545 uint64_t reserved_1_63:63;
546 uint64_t pko_rst:1;
547#else
548 uint64_t pko_rst:1;
549 uint64_t reserved_1_63:63;
550#endif
551 } s;
552};
553
554union cvmx_sriox_int2_reg {
555 uint64_t u64;
556 struct cvmx_sriox_int2_reg_s {
557#ifdef __BIG_ENDIAN_BITFIELD
558 uint64_t reserved_32_63:32;
559 uint64_t int_sum:1;
560 uint64_t reserved_1_30:30;
561 uint64_t pko_rst:1;
562#else
563 uint64_t pko_rst:1;
564 uint64_t reserved_1_30:30;
565 uint64_t int_sum:1;
566 uint64_t reserved_32_63:32;
567#endif
568 } s;
569};
570
571union cvmx_sriox_int_enable {
572 uint64_t u64;
573 struct cvmx_sriox_int_enable_s {
574#ifdef __BIG_ENDIAN_BITFIELD
575 uint64_t reserved_27_63:37;
576 uint64_t zero_pkt:1;
577 uint64_t ttl_tout:1;
578 uint64_t fail:1;
579 uint64_t degrade:1;
580 uint64_t mac_buf:1;
581 uint64_t f_error:1;
582 uint64_t rtry_err:1;
583 uint64_t pko_err:1;
584 uint64_t omsg_err:1;
585 uint64_t omsg1:1;
586 uint64_t omsg0:1;
587 uint64_t link_up:1;
588 uint64_t link_dwn:1;
589 uint64_t phy_erb:1;
590 uint64_t log_erb:1;
591 uint64_t soft_rx:1;
592 uint64_t soft_tx:1;
593 uint64_t mce_rx:1;
594 uint64_t mce_tx:1;
595 uint64_t wr_done:1;
596 uint64_t sli_err:1;
597 uint64_t deny_wr:1;
598 uint64_t bar_err:1;
599 uint64_t maint_op:1;
600 uint64_t rxbell:1;
601 uint64_t bell_err:1;
602 uint64_t txbell:1;
603#else
604 uint64_t txbell:1;
605 uint64_t bell_err:1;
606 uint64_t rxbell:1;
607 uint64_t maint_op:1;
608 uint64_t bar_err:1;
609 uint64_t deny_wr:1;
610 uint64_t sli_err:1;
611 uint64_t wr_done:1;
612 uint64_t mce_tx:1;
613 uint64_t mce_rx:1;
614 uint64_t soft_tx:1;
615 uint64_t soft_rx:1;
616 uint64_t log_erb:1;
617 uint64_t phy_erb:1;
618 uint64_t link_dwn:1;
619 uint64_t link_up:1;
620 uint64_t omsg0:1;
621 uint64_t omsg1:1;
622 uint64_t omsg_err:1;
623 uint64_t pko_err:1;
624 uint64_t rtry_err:1;
625 uint64_t f_error:1;
626 uint64_t mac_buf:1;
627 uint64_t degrade:1;
628 uint64_t fail:1;
629 uint64_t ttl_tout:1;
630 uint64_t zero_pkt:1;
631 uint64_t reserved_27_63:37;
632#endif
633 } s;
634 struct cvmx_sriox_int_enable_cn63xxp1 {
635#ifdef __BIG_ENDIAN_BITFIELD
636 uint64_t reserved_22_63:42;
637 uint64_t f_error:1;
638 uint64_t rtry_err:1;
639 uint64_t pko_err:1;
640 uint64_t omsg_err:1;
641 uint64_t omsg1:1;
642 uint64_t omsg0:1;
643 uint64_t link_up:1;
644 uint64_t link_dwn:1;
645 uint64_t phy_erb:1;
646 uint64_t log_erb:1;
647 uint64_t soft_rx:1;
648 uint64_t soft_tx:1;
649 uint64_t mce_rx:1;
650 uint64_t mce_tx:1;
651 uint64_t wr_done:1;
652 uint64_t sli_err:1;
653 uint64_t deny_wr:1;
654 uint64_t bar_err:1;
655 uint64_t maint_op:1;
656 uint64_t rxbell:1;
657 uint64_t bell_err:1;
658 uint64_t txbell:1;
659#else
660 uint64_t txbell:1;
661 uint64_t bell_err:1;
662 uint64_t rxbell:1;
663 uint64_t maint_op:1;
664 uint64_t bar_err:1;
665 uint64_t deny_wr:1;
666 uint64_t sli_err:1;
667 uint64_t wr_done:1;
668 uint64_t mce_tx:1;
669 uint64_t mce_rx:1;
670 uint64_t soft_tx:1;
671 uint64_t soft_rx:1;
672 uint64_t log_erb:1;
673 uint64_t phy_erb:1;
674 uint64_t link_dwn:1;
675 uint64_t link_up:1;
676 uint64_t omsg0:1;
677 uint64_t omsg1:1;
678 uint64_t omsg_err:1;
679 uint64_t pko_err:1;
680 uint64_t rtry_err:1;
681 uint64_t f_error:1;
682 uint64_t reserved_22_63:42;
683#endif
684 } cn63xxp1;
685};
686
687union cvmx_sriox_int_info0 {
688 uint64_t u64;
689 struct cvmx_sriox_int_info0_s {
690#ifdef __BIG_ENDIAN_BITFIELD
691 uint64_t cmd:4;
692 uint64_t type:4;
693 uint64_t tag:8;
694 uint64_t reserved_42_47:6;
695 uint64_t length:10;
696 uint64_t status:3;
697 uint64_t reserved_16_28:13;
698 uint64_t be0:8;
699 uint64_t be1:8;
700#else
701 uint64_t be1:8;
702 uint64_t be0:8;
703 uint64_t reserved_16_28:13;
704 uint64_t status:3;
705 uint64_t length:10;
706 uint64_t reserved_42_47:6;
707 uint64_t tag:8;
708 uint64_t type:4;
709 uint64_t cmd:4;
710#endif
711 } s;
712};
713
714union cvmx_sriox_int_info1 {
715 uint64_t u64;
716 struct cvmx_sriox_int_info1_s {
717#ifdef __BIG_ENDIAN_BITFIELD
718 uint64_t info1:64;
719#else
720 uint64_t info1:64;
721#endif
722 } s;
723};
724
725union cvmx_sriox_int_info2 {
726 uint64_t u64;
727 struct cvmx_sriox_int_info2_s {
728#ifdef __BIG_ENDIAN_BITFIELD
729 uint64_t prio:2;
730 uint64_t tt:1;
731 uint64_t sis:1;
732 uint64_t ssize:4;
733 uint64_t did:16;
734 uint64_t xmbox:4;
735 uint64_t mbox:2;
736 uint64_t letter:2;
737 uint64_t rsrvd:30;
738 uint64_t lns:1;
739 uint64_t intr:1;
740#else
741 uint64_t intr:1;
742 uint64_t lns:1;
743 uint64_t rsrvd:30;
744 uint64_t letter:2;
745 uint64_t mbox:2;
746 uint64_t xmbox:4;
747 uint64_t did:16;
748 uint64_t ssize:4;
749 uint64_t sis:1;
750 uint64_t tt:1;
751 uint64_t prio:2;
752#endif
753 } s;
754};
755
756union cvmx_sriox_int_info3 {
757 uint64_t u64;
758 struct cvmx_sriox_int_info3_s {
759#ifdef __BIG_ENDIAN_BITFIELD
760 uint64_t prio:2;
761 uint64_t tt:2;
762 uint64_t type:4;
763 uint64_t other:48;
764 uint64_t reserved_0_7:8;
765#else
766 uint64_t reserved_0_7:8;
767 uint64_t other:48;
768 uint64_t type:4;
769 uint64_t tt:2;
770 uint64_t prio:2;
771#endif
772 } s;
773};
774
775union cvmx_sriox_int_reg {
776 uint64_t u64;
777 struct cvmx_sriox_int_reg_s {
778#ifdef __BIG_ENDIAN_BITFIELD
779 uint64_t reserved_32_63:32;
780 uint64_t int2_sum:1;
781 uint64_t reserved_27_30:4;
782 uint64_t zero_pkt:1;
783 uint64_t ttl_tout:1;
784 uint64_t fail:1;
785 uint64_t degrad:1;
786 uint64_t mac_buf:1;
787 uint64_t f_error:1;
788 uint64_t rtry_err:1;
789 uint64_t pko_err:1;
790 uint64_t omsg_err:1;
791 uint64_t omsg1:1;
792 uint64_t omsg0:1;
793 uint64_t link_up:1;
794 uint64_t link_dwn:1;
795 uint64_t phy_erb:1;
796 uint64_t log_erb:1;
797 uint64_t soft_rx:1;
798 uint64_t soft_tx:1;
799 uint64_t mce_rx:1;
800 uint64_t mce_tx:1;
801 uint64_t wr_done:1;
802 uint64_t sli_err:1;
803 uint64_t deny_wr:1;
804 uint64_t bar_err:1;
805 uint64_t maint_op:1;
806 uint64_t rxbell:1;
807 uint64_t bell_err:1;
808 uint64_t txbell:1;
809#else
810 uint64_t txbell:1;
811 uint64_t bell_err:1;
812 uint64_t rxbell:1;
813 uint64_t maint_op:1;
814 uint64_t bar_err:1;
815 uint64_t deny_wr:1;
816 uint64_t sli_err:1;
817 uint64_t wr_done:1;
818 uint64_t mce_tx:1;
819 uint64_t mce_rx:1;
820 uint64_t soft_tx:1;
821 uint64_t soft_rx:1;
822 uint64_t log_erb:1;
823 uint64_t phy_erb:1;
824 uint64_t link_dwn:1;
825 uint64_t link_up:1;
826 uint64_t omsg0:1;
827 uint64_t omsg1:1;
828 uint64_t omsg_err:1;
829 uint64_t pko_err:1;
830 uint64_t rtry_err:1;
831 uint64_t f_error:1;
832 uint64_t mac_buf:1;
833 uint64_t degrad:1;
834 uint64_t fail:1;
835 uint64_t ttl_tout:1;
836 uint64_t zero_pkt:1;
837 uint64_t reserved_27_30:4;
838 uint64_t int2_sum:1;
839 uint64_t reserved_32_63:32;
840#endif
841 } s;
842 struct cvmx_sriox_int_reg_cn63xxp1 {
843#ifdef __BIG_ENDIAN_BITFIELD
844 uint64_t reserved_22_63:42;
845 uint64_t f_error:1;
846 uint64_t rtry_err:1;
847 uint64_t pko_err:1;
848 uint64_t omsg_err:1;
849 uint64_t omsg1:1;
850 uint64_t omsg0:1;
851 uint64_t link_up:1;
852 uint64_t link_dwn:1;
853 uint64_t phy_erb:1;
854 uint64_t log_erb:1;
855 uint64_t soft_rx:1;
856 uint64_t soft_tx:1;
857 uint64_t mce_rx:1;
858 uint64_t mce_tx:1;
859 uint64_t wr_done:1;
860 uint64_t sli_err:1;
861 uint64_t deny_wr:1;
862 uint64_t bar_err:1;
863 uint64_t maint_op:1;
864 uint64_t rxbell:1;
865 uint64_t bell_err:1;
866 uint64_t txbell:1;
867#else
868 uint64_t txbell:1;
869 uint64_t bell_err:1;
870 uint64_t rxbell:1;
871 uint64_t maint_op:1;
872 uint64_t bar_err:1;
873 uint64_t deny_wr:1;
874 uint64_t sli_err:1;
875 uint64_t wr_done:1;
876 uint64_t mce_tx:1;
877 uint64_t mce_rx:1;
878 uint64_t soft_tx:1;
879 uint64_t soft_rx:1;
880 uint64_t log_erb:1;
881 uint64_t phy_erb:1;
882 uint64_t link_dwn:1;
883 uint64_t link_up:1;
884 uint64_t omsg0:1;
885 uint64_t omsg1:1;
886 uint64_t omsg_err:1;
887 uint64_t pko_err:1;
888 uint64_t rtry_err:1;
889 uint64_t f_error:1;
890 uint64_t reserved_22_63:42;
891#endif
892 } cn63xxp1;
893};
894
895union cvmx_sriox_ip_feature {
896 uint64_t u64;
897 struct cvmx_sriox_ip_feature_s {
898#ifdef __BIG_ENDIAN_BITFIELD
899 uint64_t ops:32;
900 uint64_t reserved_15_31:17;
901 uint64_t no_vmin:1;
902 uint64_t a66:1;
903 uint64_t a50:1;
904 uint64_t reserved_11_11:1;
905 uint64_t tx_flow:1;
906 uint64_t pt_width:2;
907 uint64_t tx_pol:4;
908 uint64_t rx_pol:4;
909#else
910 uint64_t rx_pol:4;
911 uint64_t tx_pol:4;
912 uint64_t pt_width:2;
913 uint64_t tx_flow:1;
914 uint64_t reserved_11_11:1;
915 uint64_t a50:1;
916 uint64_t a66:1;
917 uint64_t no_vmin:1;
918 uint64_t reserved_15_31:17;
919 uint64_t ops:32;
920#endif
921 } s;
922 struct cvmx_sriox_ip_feature_cn63xx {
923#ifdef __BIG_ENDIAN_BITFIELD
924 uint64_t ops:32;
925 uint64_t reserved_14_31:18;
926 uint64_t a66:1;
927 uint64_t a50:1;
928 uint64_t reserved_11_11:1;
929 uint64_t tx_flow:1;
930 uint64_t pt_width:2;
931 uint64_t tx_pol:4;
932 uint64_t rx_pol:4;
933#else
934 uint64_t rx_pol:4;
935 uint64_t tx_pol:4;
936 uint64_t pt_width:2;
937 uint64_t tx_flow:1;
938 uint64_t reserved_11_11:1;
939 uint64_t a50:1;
940 uint64_t a66:1;
941 uint64_t reserved_14_31:18;
942 uint64_t ops:32;
943#endif
944 } cn63xx;
945};
946
947union cvmx_sriox_mac_buffers {
948 uint64_t u64;
949 struct cvmx_sriox_mac_buffers_s {
950#ifdef __BIG_ENDIAN_BITFIELD
951 uint64_t reserved_56_63:8;
952 uint64_t tx_enb:8;
953 uint64_t reserved_44_47:4;
954 uint64_t tx_inuse:4;
955 uint64_t tx_stat:8;
956 uint64_t reserved_24_31:8;
957 uint64_t rx_enb:8;
958 uint64_t reserved_12_15:4;
959 uint64_t rx_inuse:4;
960 uint64_t rx_stat:8;
961#else
962 uint64_t rx_stat:8;
963 uint64_t rx_inuse:4;
964 uint64_t reserved_12_15:4;
965 uint64_t rx_enb:8;
966 uint64_t reserved_24_31:8;
967 uint64_t tx_stat:8;
968 uint64_t tx_inuse:4;
969 uint64_t reserved_44_47:4;
970 uint64_t tx_enb:8;
971 uint64_t reserved_56_63:8;
972#endif
973 } s;
974};
975
976union cvmx_sriox_maint_op {
977 uint64_t u64;
978 struct cvmx_sriox_maint_op_s {
979#ifdef __BIG_ENDIAN_BITFIELD
980 uint64_t wr_data:32;
981 uint64_t reserved_27_31:5;
982 uint64_t fail:1;
983 uint64_t pending:1;
984 uint64_t op:1;
985 uint64_t addr:24;
986#else
987 uint64_t addr:24;
988 uint64_t op:1;
989 uint64_t pending:1;
990 uint64_t fail:1;
991 uint64_t reserved_27_31:5;
992 uint64_t wr_data:32;
993#endif
994 } s;
995};
996
997union cvmx_sriox_maint_rd_data {
998 uint64_t u64;
999 struct cvmx_sriox_maint_rd_data_s {
1000#ifdef __BIG_ENDIAN_BITFIELD
1001 uint64_t reserved_33_63:31;
1002 uint64_t valid:1;
1003 uint64_t rd_data:32;
1004#else
1005 uint64_t rd_data:32;
1006 uint64_t valid:1;
1007 uint64_t reserved_33_63:31;
1008#endif
1009 } s;
1010};
1011
1012union cvmx_sriox_mce_tx_ctl {
1013 uint64_t u64;
1014 struct cvmx_sriox_mce_tx_ctl_s {
1015#ifdef __BIG_ENDIAN_BITFIELD
1016 uint64_t reserved_1_63:63;
1017 uint64_t mce:1;
1018#else
1019 uint64_t mce:1;
1020 uint64_t reserved_1_63:63;
1021#endif
1022 } s;
1023};
1024
1025union cvmx_sriox_mem_op_ctrl {
1026 uint64_t u64;
1027 struct cvmx_sriox_mem_op_ctrl_s {
1028#ifdef __BIG_ENDIAN_BITFIELD
1029 uint64_t reserved_10_63:54;
1030 uint64_t rr_ro:1;
1031 uint64_t w_ro:1;
1032 uint64_t reserved_6_7:2;
1033 uint64_t rp1_sid:1;
1034 uint64_t rp0_sid:2;
1035 uint64_t rp1_pid:1;
1036 uint64_t rp0_pid:2;
1037#else
1038 uint64_t rp0_pid:2;
1039 uint64_t rp1_pid:1;
1040 uint64_t rp0_sid:2;
1041 uint64_t rp1_sid:1;
1042 uint64_t reserved_6_7:2;
1043 uint64_t w_ro:1;
1044 uint64_t rr_ro:1;
1045 uint64_t reserved_10_63:54;
1046#endif
1047 } s;
1048};
1049
1050union cvmx_sriox_omsg_ctrlx {
1051 uint64_t u64;
1052 struct cvmx_sriox_omsg_ctrlx_s {
1053#ifdef __BIG_ENDIAN_BITFIELD
1054 uint64_t testmode:1;
1055 uint64_t reserved_37_62:26;
1056 uint64_t silo_max:5;
1057 uint64_t rtry_thr:16;
1058 uint64_t rtry_en:1;
1059 uint64_t reserved_11_14:4;
1060 uint64_t idm_tt:1;
1061 uint64_t idm_sis:1;
1062 uint64_t idm_did:1;
1063 uint64_t lttr_sp:4;
1064 uint64_t lttr_mp:4;
1065#else
1066 uint64_t lttr_mp:4;
1067 uint64_t lttr_sp:4;
1068 uint64_t idm_did:1;
1069 uint64_t idm_sis:1;
1070 uint64_t idm_tt:1;
1071 uint64_t reserved_11_14:4;
1072 uint64_t rtry_en:1;
1073 uint64_t rtry_thr:16;
1074 uint64_t silo_max:5;
1075 uint64_t reserved_37_62:26;
1076 uint64_t testmode:1;
1077#endif
1078 } s;
1079 struct cvmx_sriox_omsg_ctrlx_cn63xxp1 {
1080#ifdef __BIG_ENDIAN_BITFIELD
1081 uint64_t testmode:1;
1082 uint64_t reserved_32_62:31;
1083 uint64_t rtry_thr:16;
1084 uint64_t rtry_en:1;
1085 uint64_t reserved_11_14:4;
1086 uint64_t idm_tt:1;
1087 uint64_t idm_sis:1;
1088 uint64_t idm_did:1;
1089 uint64_t lttr_sp:4;
1090 uint64_t lttr_mp:4;
1091#else
1092 uint64_t lttr_mp:4;
1093 uint64_t lttr_sp:4;
1094 uint64_t idm_did:1;
1095 uint64_t idm_sis:1;
1096 uint64_t idm_tt:1;
1097 uint64_t reserved_11_14:4;
1098 uint64_t rtry_en:1;
1099 uint64_t rtry_thr:16;
1100 uint64_t reserved_32_62:31;
1101 uint64_t testmode:1;
1102#endif
1103 } cn63xxp1;
1104};
1105
1106union cvmx_sriox_omsg_done_countsx {
1107 uint64_t u64;
1108 struct cvmx_sriox_omsg_done_countsx_s {
1109#ifdef __BIG_ENDIAN_BITFIELD
1110 uint64_t reserved_32_63:32;
1111 uint64_t bad:16;
1112 uint64_t good:16;
1113#else
1114 uint64_t good:16;
1115 uint64_t bad:16;
1116 uint64_t reserved_32_63:32;
1117#endif
1118 } s;
1119};
1120
1121union cvmx_sriox_omsg_fmp_mrx {
1122 uint64_t u64;
1123 struct cvmx_sriox_omsg_fmp_mrx_s {
1124#ifdef __BIG_ENDIAN_BITFIELD
1125 uint64_t reserved_15_63:49;
1126 uint64_t ctlr_sp:1;
1127 uint64_t ctlr_fmp:1;
1128 uint64_t ctlr_nmp:1;
1129 uint64_t id_sp:1;
1130 uint64_t id_fmp:1;
1131 uint64_t id_nmp:1;
1132 uint64_t id_psd:1;
1133 uint64_t mbox_sp:1;
1134 uint64_t mbox_fmp:1;
1135 uint64_t mbox_nmp:1;
1136 uint64_t mbox_psd:1;
1137 uint64_t all_sp:1;
1138 uint64_t all_fmp:1;
1139 uint64_t all_nmp:1;
1140 uint64_t all_psd:1;
1141#else
1142 uint64_t all_psd:1;
1143 uint64_t all_nmp:1;
1144 uint64_t all_fmp:1;
1145 uint64_t all_sp:1;
1146 uint64_t mbox_psd:1;
1147 uint64_t mbox_nmp:1;
1148 uint64_t mbox_fmp:1;
1149 uint64_t mbox_sp:1;
1150 uint64_t id_psd:1;
1151 uint64_t id_nmp:1;
1152 uint64_t id_fmp:1;
1153 uint64_t id_sp:1;
1154 uint64_t ctlr_nmp:1;
1155 uint64_t ctlr_fmp:1;
1156 uint64_t ctlr_sp:1;
1157 uint64_t reserved_15_63:49;
1158#endif
1159 } s;
1160};
1161
1162union cvmx_sriox_omsg_nmp_mrx {
1163 uint64_t u64;
1164 struct cvmx_sriox_omsg_nmp_mrx_s {
1165#ifdef __BIG_ENDIAN_BITFIELD
1166 uint64_t reserved_15_63:49;
1167 uint64_t ctlr_sp:1;
1168 uint64_t ctlr_fmp:1;
1169 uint64_t ctlr_nmp:1;
1170 uint64_t id_sp:1;
1171 uint64_t id_fmp:1;
1172 uint64_t id_nmp:1;
1173 uint64_t reserved_8_8:1;
1174 uint64_t mbox_sp:1;
1175 uint64_t mbox_fmp:1;
1176 uint64_t mbox_nmp:1;
1177 uint64_t reserved_4_4:1;
1178 uint64_t all_sp:1;
1179 uint64_t all_fmp:1;
1180 uint64_t all_nmp:1;
1181 uint64_t reserved_0_0:1;
1182#else
1183 uint64_t reserved_0_0:1;
1184 uint64_t all_nmp:1;
1185 uint64_t all_fmp:1;
1186 uint64_t all_sp:1;
1187 uint64_t reserved_4_4:1;
1188 uint64_t mbox_nmp:1;
1189 uint64_t mbox_fmp:1;
1190 uint64_t mbox_sp:1;
1191 uint64_t reserved_8_8:1;
1192 uint64_t id_nmp:1;
1193 uint64_t id_fmp:1;
1194 uint64_t id_sp:1;
1195 uint64_t ctlr_nmp:1;
1196 uint64_t ctlr_fmp:1;
1197 uint64_t ctlr_sp:1;
1198 uint64_t reserved_15_63:49;
1199#endif
1200 } s;
1201};
1202
1203union cvmx_sriox_omsg_portx {
1204 uint64_t u64;
1205 struct cvmx_sriox_omsg_portx_s {
1206#ifdef __BIG_ENDIAN_BITFIELD
1207 uint64_t reserved_32_63:32;
1208 uint64_t enable:1;
1209 uint64_t reserved_3_30:28;
1210 uint64_t port:3;
1211#else
1212 uint64_t port:3;
1213 uint64_t reserved_3_30:28;
1214 uint64_t enable:1;
1215 uint64_t reserved_32_63:32;
1216#endif
1217 } s;
1218 struct cvmx_sriox_omsg_portx_cn63xx {
1219#ifdef __BIG_ENDIAN_BITFIELD
1220 uint64_t reserved_32_63:32;
1221 uint64_t enable:1;
1222 uint64_t reserved_2_30:29;
1223 uint64_t port:2;
1224#else
1225 uint64_t port:2;
1226 uint64_t reserved_2_30:29;
1227 uint64_t enable:1;
1228 uint64_t reserved_32_63:32;
1229#endif
1230 } cn63xx;
1231};
1232
1233union cvmx_sriox_omsg_silo_thr {
1234 uint64_t u64;
1235 struct cvmx_sriox_omsg_silo_thr_s {
1236#ifdef __BIG_ENDIAN_BITFIELD
1237 uint64_t reserved_5_63:59;
1238 uint64_t tot_silo:5;
1239#else
1240 uint64_t tot_silo:5;
1241 uint64_t reserved_5_63:59;
1242#endif
1243 } s;
1244};
1245
1246union cvmx_sriox_omsg_sp_mrx {
1247 uint64_t u64;
1248 struct cvmx_sriox_omsg_sp_mrx_s {
1249#ifdef __BIG_ENDIAN_BITFIELD
1250 uint64_t reserved_16_63:48;
1251 uint64_t xmbox_sp:1;
1252 uint64_t ctlr_sp:1;
1253 uint64_t ctlr_fmp:1;
1254 uint64_t ctlr_nmp:1;
1255 uint64_t id_sp:1;
1256 uint64_t id_fmp:1;
1257 uint64_t id_nmp:1;
1258 uint64_t id_psd:1;
1259 uint64_t mbox_sp:1;
1260 uint64_t mbox_fmp:1;
1261 uint64_t mbox_nmp:1;
1262 uint64_t mbox_psd:1;
1263 uint64_t all_sp:1;
1264 uint64_t all_fmp:1;
1265 uint64_t all_nmp:1;
1266 uint64_t all_psd:1;
1267#else
1268 uint64_t all_psd:1;
1269 uint64_t all_nmp:1;
1270 uint64_t all_fmp:1;
1271 uint64_t all_sp:1;
1272 uint64_t mbox_psd:1;
1273 uint64_t mbox_nmp:1;
1274 uint64_t mbox_fmp:1;
1275 uint64_t mbox_sp:1;
1276 uint64_t id_psd:1;
1277 uint64_t id_nmp:1;
1278 uint64_t id_fmp:1;
1279 uint64_t id_sp:1;
1280 uint64_t ctlr_nmp:1;
1281 uint64_t ctlr_fmp:1;
1282 uint64_t ctlr_sp:1;
1283 uint64_t xmbox_sp:1;
1284 uint64_t reserved_16_63:48;
1285#endif
1286 } s;
1287};
1288
1289union cvmx_sriox_priox_in_use {
1290 uint64_t u64;
1291 struct cvmx_sriox_priox_in_use_s {
1292#ifdef __BIG_ENDIAN_BITFIELD
1293 uint64_t reserved_32_63:32;
1294 uint64_t end_cnt:16;
1295 uint64_t start_cnt:16;
1296#else
1297 uint64_t start_cnt:16;
1298 uint64_t end_cnt:16;
1299 uint64_t reserved_32_63:32;
1300#endif
1301 } s;
1302};
1303
1304union cvmx_sriox_rx_bell {
1305 uint64_t u64;
1306 struct cvmx_sriox_rx_bell_s {
1307#ifdef __BIG_ENDIAN_BITFIELD
1308 uint64_t reserved_48_63:16;
1309 uint64_t data:16;
1310 uint64_t src_id:16;
1311 uint64_t count:8;
1312 uint64_t reserved_5_7:3;
1313 uint64_t dest_id:1;
1314 uint64_t id16:1;
1315 uint64_t reserved_2_2:1;
1316 uint64_t priority:2;
1317#else
1318 uint64_t priority:2;
1319 uint64_t reserved_2_2:1;
1320 uint64_t id16:1;
1321 uint64_t dest_id:1;
1322 uint64_t reserved_5_7:3;
1323 uint64_t count:8;
1324 uint64_t src_id:16;
1325 uint64_t data:16;
1326 uint64_t reserved_48_63:16;
1327#endif
1328 } s;
1329};
1330
1331union cvmx_sriox_rx_bell_seq {
1332 uint64_t u64;
1333 struct cvmx_sriox_rx_bell_seq_s {
1334#ifdef __BIG_ENDIAN_BITFIELD
1335 uint64_t reserved_40_63:24;
1336 uint64_t count:8;
1337 uint64_t seq:32;
1338#else
1339 uint64_t seq:32;
1340 uint64_t count:8;
1341 uint64_t reserved_40_63:24;
1342#endif
1343 } s;
1344};
1345
1346union cvmx_sriox_rx_status {
1347 uint64_t u64;
1348 struct cvmx_sriox_rx_status_s {
1349#ifdef __BIG_ENDIAN_BITFIELD
1350 uint64_t rtn_pr3:8;
1351 uint64_t rtn_pr2:8;
1352 uint64_t rtn_pr1:8;
1353 uint64_t reserved_28_39:12;
1354 uint64_t mbox:4;
1355 uint64_t comp:8;
1356 uint64_t reserved_13_15:3;
1357 uint64_t n_post:5;
1358 uint64_t post:8;
1359#else
1360 uint64_t post:8;
1361 uint64_t n_post:5;
1362 uint64_t reserved_13_15:3;
1363 uint64_t comp:8;
1364 uint64_t mbox:4;
1365 uint64_t reserved_28_39:12;
1366 uint64_t rtn_pr1:8;
1367 uint64_t rtn_pr2:8;
1368 uint64_t rtn_pr3:8;
1369#endif
1370 } s;
1371};
1372
1373union cvmx_sriox_s2m_typex {
1374 uint64_t u64;
1375 struct cvmx_sriox_s2m_typex_s {
1376#ifdef __BIG_ENDIAN_BITFIELD
1377 uint64_t reserved_19_63:45;
1378 uint64_t wr_op:3;
1379 uint64_t reserved_15_15:1;
1380 uint64_t rd_op:3;
1381 uint64_t wr_prior:2;
1382 uint64_t rd_prior:2;
1383 uint64_t reserved_6_7:2;
1384 uint64_t src_id:1;
1385 uint64_t id16:1;
1386 uint64_t reserved_2_3:2;
1387 uint64_t iaow_sel:2;
1388#else
1389 uint64_t iaow_sel:2;
1390 uint64_t reserved_2_3:2;
1391 uint64_t id16:1;
1392 uint64_t src_id:1;
1393 uint64_t reserved_6_7:2;
1394 uint64_t rd_prior:2;
1395 uint64_t wr_prior:2;
1396 uint64_t rd_op:3;
1397 uint64_t reserved_15_15:1;
1398 uint64_t wr_op:3;
1399 uint64_t reserved_19_63:45;
1400#endif
1401 } s;
1402};
1403
1404union cvmx_sriox_seq {
1405 uint64_t u64;
1406 struct cvmx_sriox_seq_s {
1407#ifdef __BIG_ENDIAN_BITFIELD
1408 uint64_t reserved_32_63:32;
1409 uint64_t seq:32;
1410#else
1411 uint64_t seq:32;
1412 uint64_t reserved_32_63:32;
1413#endif
1414 } s;
1415};
1416
1417union cvmx_sriox_status_reg {
1418 uint64_t u64;
1419 struct cvmx_sriox_status_reg_s {
1420#ifdef __BIG_ENDIAN_BITFIELD
1421 uint64_t reserved_2_63:62;
1422 uint64_t access:1;
1423 uint64_t srio:1;
1424#else
1425 uint64_t srio:1;
1426 uint64_t access:1;
1427 uint64_t reserved_2_63:62;
1428#endif
1429 } s;
1430};
1431
1432union cvmx_sriox_tag_ctrl {
1433 uint64_t u64;
1434 struct cvmx_sriox_tag_ctrl_s {
1435#ifdef __BIG_ENDIAN_BITFIELD
1436 uint64_t reserved_17_63:47;
1437 uint64_t o_clr:1;
1438 uint64_t reserved_13_15:3;
1439 uint64_t otag:5;
1440 uint64_t reserved_5_7:3;
1441 uint64_t itag:5;
1442#else
1443 uint64_t itag:5;
1444 uint64_t reserved_5_7:3;
1445 uint64_t otag:5;
1446 uint64_t reserved_13_15:3;
1447 uint64_t o_clr:1;
1448 uint64_t reserved_17_63:47;
1449#endif
1450 } s;
1451};
1452
1453union cvmx_sriox_tlp_credits {
1454 uint64_t u64;
1455 struct cvmx_sriox_tlp_credits_s {
1456#ifdef __BIG_ENDIAN_BITFIELD
1457 uint64_t reserved_28_63:36;
1458 uint64_t mbox:4;
1459 uint64_t comp:8;
1460 uint64_t reserved_13_15:3;
1461 uint64_t n_post:5;
1462 uint64_t post:8;
1463#else
1464 uint64_t post:8;
1465 uint64_t n_post:5;
1466 uint64_t reserved_13_15:3;
1467 uint64_t comp:8;
1468 uint64_t mbox:4;
1469 uint64_t reserved_28_63:36;
1470#endif
1471 } s;
1472};
1473
1474union cvmx_sriox_tx_bell {
1475 uint64_t u64;
1476 struct cvmx_sriox_tx_bell_s {
1477#ifdef __BIG_ENDIAN_BITFIELD
1478 uint64_t reserved_48_63:16;
1479 uint64_t data:16;
1480 uint64_t dest_id:16;
1481 uint64_t reserved_9_15:7;
1482 uint64_t pending:1;
1483 uint64_t reserved_5_7:3;
1484 uint64_t src_id:1;
1485 uint64_t id16:1;
1486 uint64_t reserved_2_2:1;
1487 uint64_t priority:2;
1488#else
1489 uint64_t priority:2;
1490 uint64_t reserved_2_2:1;
1491 uint64_t id16:1;
1492 uint64_t src_id:1;
1493 uint64_t reserved_5_7:3;
1494 uint64_t pending:1;
1495 uint64_t reserved_9_15:7;
1496 uint64_t dest_id:16;
1497 uint64_t data:16;
1498 uint64_t reserved_48_63:16;
1499#endif
1500 } s;
1501};
1502
1503union cvmx_sriox_tx_bell_info {
1504 uint64_t u64;
1505 struct cvmx_sriox_tx_bell_info_s {
1506#ifdef __BIG_ENDIAN_BITFIELD
1507 uint64_t reserved_48_63:16;
1508 uint64_t data:16;
1509 uint64_t dest_id:16;
1510 uint64_t reserved_8_15:8;
1511 uint64_t timeout:1;
1512 uint64_t error:1;
1513 uint64_t retry:1;
1514 uint64_t src_id:1;
1515 uint64_t id16:1;
1516 uint64_t reserved_2_2:1;
1517 uint64_t priority:2;
1518#else
1519 uint64_t priority:2;
1520 uint64_t reserved_2_2:1;
1521 uint64_t id16:1;
1522 uint64_t src_id:1;
1523 uint64_t retry:1;
1524 uint64_t error:1;
1525 uint64_t timeout:1;
1526 uint64_t reserved_8_15:8;
1527 uint64_t dest_id:16;
1528 uint64_t data:16;
1529 uint64_t reserved_48_63:16;
1530#endif
1531 } s;
1532};
1533
1534union cvmx_sriox_tx_ctrl {
1535 uint64_t u64;
1536 struct cvmx_sriox_tx_ctrl_s {
1537#ifdef __BIG_ENDIAN_BITFIELD
1538 uint64_t reserved_53_63:11;
1539 uint64_t tag_th2:5;
1540 uint64_t reserved_45_47:3;
1541 uint64_t tag_th1:5;
1542 uint64_t reserved_37_39:3;
1543 uint64_t tag_th0:5;
1544 uint64_t reserved_20_31:12;
1545 uint64_t tx_th2:4;
1546 uint64_t reserved_12_15:4;
1547 uint64_t tx_th1:4;
1548 uint64_t reserved_4_7:4;
1549 uint64_t tx_th0:4;
1550#else
1551 uint64_t tx_th0:4;
1552 uint64_t reserved_4_7:4;
1553 uint64_t tx_th1:4;
1554 uint64_t reserved_12_15:4;
1555 uint64_t tx_th2:4;
1556 uint64_t reserved_20_31:12;
1557 uint64_t tag_th0:5;
1558 uint64_t reserved_37_39:3;
1559 uint64_t tag_th1:5;
1560 uint64_t reserved_45_47:3;
1561 uint64_t tag_th2:5;
1562 uint64_t reserved_53_63:11;
1563#endif
1564 } s;
1565};
1566
1567union cvmx_sriox_tx_emphasis {
1568 uint64_t u64;
1569 struct cvmx_sriox_tx_emphasis_s {
1570#ifdef __BIG_ENDIAN_BITFIELD
1571 uint64_t reserved_4_63:60;
1572 uint64_t emph:4;
1573#else
1574 uint64_t emph:4;
1575 uint64_t reserved_4_63:60;
1576#endif
1577 } s;
1578};
1579
1580union cvmx_sriox_tx_status {
1581 uint64_t u64;
1582 struct cvmx_sriox_tx_status_s {
1583#ifdef __BIG_ENDIAN_BITFIELD
1584 uint64_t reserved_32_63:32;
1585 uint64_t s2m_pr3:8;
1586 uint64_t s2m_pr2:8;
1587 uint64_t s2m_pr1:8;
1588 uint64_t s2m_pr0:8;
1589#else
1590 uint64_t s2m_pr0:8;
1591 uint64_t s2m_pr1:8;
1592 uint64_t s2m_pr2:8;
1593 uint64_t s2m_pr3:8;
1594 uint64_t reserved_32_63:32;
1595#endif
1596 } s;
1597};
1598
1599union cvmx_sriox_wr_done_counts {
1600 uint64_t u64;
1601 struct cvmx_sriox_wr_done_counts_s {
1602#ifdef __BIG_ENDIAN_BITFIELD
1603 uint64_t reserved_32_63:32;
1604 uint64_t bad:16;
1605 uint64_t good:16;
1606#else
1607 uint64_t good:16;
1608 uint64_t bad:16;
1609 uint64_t reserved_32_63:32;
1610#endif
1611 } s;
1612};
1613
1614#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-srxx-defs.h b/arch/mips/include/asm/octeon/cvmx-srxx-defs.h
new file mode 100644
index 000000000..76b2a42f5
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-srxx-defs.h
@@ -0,0 +1,140 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_SRXX_DEFS_H__
29#define __CVMX_SRXX_DEFS_H__
30
31#define CVMX_SRXX_COM_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000200ull) + ((block_id) & 1) * 0x8000000ull)
32#define CVMX_SRXX_IGN_RX_FULL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000218ull) + ((block_id) & 1) * 0x8000000ull)
33#define CVMX_SRXX_SPI4_CALX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180090000000ull) + (((offset) & 31) + ((block_id) & 1) * 0x1000000ull) * 8)
34#define CVMX_SRXX_SPI4_STAT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000208ull) + ((block_id) & 1) * 0x8000000ull)
35#define CVMX_SRXX_SW_TICK_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000220ull) + ((block_id) & 1) * 0x8000000ull)
36#define CVMX_SRXX_SW_TICK_DAT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000228ull) + ((block_id) & 1) * 0x8000000ull)
37
38union cvmx_srxx_com_ctl {
39 uint64_t u64;
40 struct cvmx_srxx_com_ctl_s {
41#ifdef __BIG_ENDIAN_BITFIELD
42 uint64_t reserved_8_63:56;
43 uint64_t prts:4;
44 uint64_t st_en:1;
45 uint64_t reserved_1_2:2;
46 uint64_t inf_en:1;
47#else
48 uint64_t inf_en:1;
49 uint64_t reserved_1_2:2;
50 uint64_t st_en:1;
51 uint64_t prts:4;
52 uint64_t reserved_8_63:56;
53#endif
54 } s;
55};
56
57union cvmx_srxx_ign_rx_full {
58 uint64_t u64;
59 struct cvmx_srxx_ign_rx_full_s {
60#ifdef __BIG_ENDIAN_BITFIELD
61 uint64_t reserved_16_63:48;
62 uint64_t ignore:16;
63#else
64 uint64_t ignore:16;
65 uint64_t reserved_16_63:48;
66#endif
67 } s;
68};
69
70union cvmx_srxx_spi4_calx {
71 uint64_t u64;
72 struct cvmx_srxx_spi4_calx_s {
73#ifdef __BIG_ENDIAN_BITFIELD
74 uint64_t reserved_17_63:47;
75 uint64_t oddpar:1;
76 uint64_t prt3:4;
77 uint64_t prt2:4;
78 uint64_t prt1:4;
79 uint64_t prt0:4;
80#else
81 uint64_t prt0:4;
82 uint64_t prt1:4;
83 uint64_t prt2:4;
84 uint64_t prt3:4;
85 uint64_t oddpar:1;
86 uint64_t reserved_17_63:47;
87#endif
88 } s;
89};
90
91union cvmx_srxx_spi4_stat {
92 uint64_t u64;
93 struct cvmx_srxx_spi4_stat_s {
94#ifdef __BIG_ENDIAN_BITFIELD
95 uint64_t reserved_16_63:48;
96 uint64_t m:8;
97 uint64_t reserved_7_7:1;
98 uint64_t len:7;
99#else
100 uint64_t len:7;
101 uint64_t reserved_7_7:1;
102 uint64_t m:8;
103 uint64_t reserved_16_63:48;
104#endif
105 } s;
106};
107
108union cvmx_srxx_sw_tick_ctl {
109 uint64_t u64;
110 struct cvmx_srxx_sw_tick_ctl_s {
111#ifdef __BIG_ENDIAN_BITFIELD
112 uint64_t reserved_14_63:50;
113 uint64_t eop:1;
114 uint64_t sop:1;
115 uint64_t mod:4;
116 uint64_t opc:4;
117 uint64_t adr:4;
118#else
119 uint64_t adr:4;
120 uint64_t opc:4;
121 uint64_t mod:4;
122 uint64_t sop:1;
123 uint64_t eop:1;
124 uint64_t reserved_14_63:50;
125#endif
126 } s;
127};
128
129union cvmx_srxx_sw_tick_dat {
130 uint64_t u64;
131 struct cvmx_srxx_sw_tick_dat_s {
132#ifdef __BIG_ENDIAN_BITFIELD
133 uint64_t dat:64;
134#else
135 uint64_t dat:64;
136#endif
137 } s;
138};
139
140#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-stxx-defs.h b/arch/mips/include/asm/octeon/cvmx-stxx-defs.h
new file mode 100644
index 000000000..f49d82145
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-stxx-defs.h
@@ -0,0 +1,330 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (C) 2003-2018 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_STXX_DEFS_H__
29#define __CVMX_STXX_DEFS_H__
30
31#define CVMX_STXX_ARB_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000608ull) + ((block_id) & 1) * 0x8000000ull)
32#define CVMX_STXX_BCKPRS_CNT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000688ull) + ((block_id) & 1) * 0x8000000ull)
33#define CVMX_STXX_COM_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000600ull) + ((block_id) & 1) * 0x8000000ull)
34#define CVMX_STXX_DIP_CNT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000690ull) + ((block_id) & 1) * 0x8000000ull)
35#define CVMX_STXX_IGN_CAL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000610ull) + ((block_id) & 1) * 0x8000000ull)
36#define CVMX_STXX_INT_MSK(block_id) (CVMX_ADD_IO_SEG(0x00011800900006A0ull) + ((block_id) & 1) * 0x8000000ull)
37#define CVMX_STXX_INT_REG(block_id) (CVMX_ADD_IO_SEG(0x0001180090000698ull) + ((block_id) & 1) * 0x8000000ull)
38#define CVMX_STXX_INT_SYNC(block_id) (CVMX_ADD_IO_SEG(0x00011800900006A8ull) + ((block_id) & 1) * 0x8000000ull)
39#define CVMX_STXX_MIN_BST(block_id) (CVMX_ADD_IO_SEG(0x0001180090000618ull) + ((block_id) & 1) * 0x8000000ull)
40#define CVMX_STXX_SPI4_CALX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180090000400ull) + (((offset) & 31) + ((block_id) & 1) * 0x1000000ull) * 8)
41#define CVMX_STXX_SPI4_DAT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000628ull) + ((block_id) & 1) * 0x8000000ull)
42#define CVMX_STXX_SPI4_STAT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000630ull) + ((block_id) & 1) * 0x8000000ull)
43#define CVMX_STXX_STAT_BYTES_HI(block_id) (CVMX_ADD_IO_SEG(0x0001180090000648ull) + ((block_id) & 1) * 0x8000000ull)
44#define CVMX_STXX_STAT_BYTES_LO(block_id) (CVMX_ADD_IO_SEG(0x0001180090000680ull) + ((block_id) & 1) * 0x8000000ull)
45#define CVMX_STXX_STAT_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000638ull) + ((block_id) & 1) * 0x8000000ull)
46#define CVMX_STXX_STAT_PKT_XMT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000640ull) + ((block_id) & 1) * 0x8000000ull)
47
48void __cvmx_interrupt_stxx_int_msk_enable(int index);
49
50union cvmx_stxx_arb_ctl {
51 uint64_t u64;
52 struct cvmx_stxx_arb_ctl_s {
53#ifdef __BIG_ENDIAN_BITFIELD
54 uint64_t reserved_6_63:58;
55 uint64_t mintrn:1;
56 uint64_t reserved_4_4:1;
57 uint64_t igntpa:1;
58 uint64_t reserved_0_2:3;
59#else
60 uint64_t reserved_0_2:3;
61 uint64_t igntpa:1;
62 uint64_t reserved_4_4:1;
63 uint64_t mintrn:1;
64 uint64_t reserved_6_63:58;
65#endif
66 } s;
67};
68
69union cvmx_stxx_bckprs_cnt {
70 uint64_t u64;
71 struct cvmx_stxx_bckprs_cnt_s {
72#ifdef __BIG_ENDIAN_BITFIELD
73 uint64_t reserved_32_63:32;
74 uint64_t cnt:32;
75#else
76 uint64_t cnt:32;
77 uint64_t reserved_32_63:32;
78#endif
79 } s;
80};
81
82union cvmx_stxx_com_ctl {
83 uint64_t u64;
84 struct cvmx_stxx_com_ctl_s {
85#ifdef __BIG_ENDIAN_BITFIELD
86 uint64_t reserved_4_63:60;
87 uint64_t st_en:1;
88 uint64_t reserved_1_2:2;
89 uint64_t inf_en:1;
90#else
91 uint64_t inf_en:1;
92 uint64_t reserved_1_2:2;
93 uint64_t st_en:1;
94 uint64_t reserved_4_63:60;
95#endif
96 } s;
97};
98
99union cvmx_stxx_dip_cnt {
100 uint64_t u64;
101 struct cvmx_stxx_dip_cnt_s {
102#ifdef __BIG_ENDIAN_BITFIELD
103 uint64_t reserved_8_63:56;
104 uint64_t frmmax:4;
105 uint64_t dipmax:4;
106#else
107 uint64_t dipmax:4;
108 uint64_t frmmax:4;
109 uint64_t reserved_8_63:56;
110#endif
111 } s;
112};
113
114union cvmx_stxx_ign_cal {
115 uint64_t u64;
116 struct cvmx_stxx_ign_cal_s {
117#ifdef __BIG_ENDIAN_BITFIELD
118 uint64_t reserved_16_63:48;
119 uint64_t igntpa:16;
120#else
121 uint64_t igntpa:16;
122 uint64_t reserved_16_63:48;
123#endif
124 } s;
125};
126
127union cvmx_stxx_int_msk {
128 uint64_t u64;
129 struct cvmx_stxx_int_msk_s {
130#ifdef __BIG_ENDIAN_BITFIELD
131 uint64_t reserved_8_63:56;
132 uint64_t frmerr:1;
133 uint64_t unxfrm:1;
134 uint64_t nosync:1;
135 uint64_t diperr:1;
136 uint64_t datovr:1;
137 uint64_t ovrbst:1;
138 uint64_t calpar1:1;
139 uint64_t calpar0:1;
140#else
141 uint64_t calpar0:1;
142 uint64_t calpar1:1;
143 uint64_t ovrbst:1;
144 uint64_t datovr:1;
145 uint64_t diperr:1;
146 uint64_t nosync:1;
147 uint64_t unxfrm:1;
148 uint64_t frmerr:1;
149 uint64_t reserved_8_63:56;
150#endif
151 } s;
152};
153
154union cvmx_stxx_int_reg {
155 uint64_t u64;
156 struct cvmx_stxx_int_reg_s {
157#ifdef __BIG_ENDIAN_BITFIELD
158 uint64_t reserved_9_63:55;
159 uint64_t syncerr:1;
160 uint64_t frmerr:1;
161 uint64_t unxfrm:1;
162 uint64_t nosync:1;
163 uint64_t diperr:1;
164 uint64_t datovr:1;
165 uint64_t ovrbst:1;
166 uint64_t calpar1:1;
167 uint64_t calpar0:1;
168#else
169 uint64_t calpar0:1;
170 uint64_t calpar1:1;
171 uint64_t ovrbst:1;
172 uint64_t datovr:1;
173 uint64_t diperr:1;
174 uint64_t nosync:1;
175 uint64_t unxfrm:1;
176 uint64_t frmerr:1;
177 uint64_t syncerr:1;
178 uint64_t reserved_9_63:55;
179#endif
180 } s;
181};
182
183union cvmx_stxx_int_sync {
184 uint64_t u64;
185 struct cvmx_stxx_int_sync_s {
186#ifdef __BIG_ENDIAN_BITFIELD
187 uint64_t reserved_8_63:56;
188 uint64_t frmerr:1;
189 uint64_t unxfrm:1;
190 uint64_t nosync:1;
191 uint64_t diperr:1;
192 uint64_t datovr:1;
193 uint64_t ovrbst:1;
194 uint64_t calpar1:1;
195 uint64_t calpar0:1;
196#else
197 uint64_t calpar0:1;
198 uint64_t calpar1:1;
199 uint64_t ovrbst:1;
200 uint64_t datovr:1;
201 uint64_t diperr:1;
202 uint64_t nosync:1;
203 uint64_t unxfrm:1;
204 uint64_t frmerr:1;
205 uint64_t reserved_8_63:56;
206#endif
207 } s;
208};
209
210union cvmx_stxx_min_bst {
211 uint64_t u64;
212 struct cvmx_stxx_min_bst_s {
213#ifdef __BIG_ENDIAN_BITFIELD
214 uint64_t reserved_9_63:55;
215 uint64_t minb:9;
216#else
217 uint64_t minb:9;
218 uint64_t reserved_9_63:55;
219#endif
220 } s;
221};
222
223union cvmx_stxx_spi4_calx {
224 uint64_t u64;
225 struct cvmx_stxx_spi4_calx_s {
226#ifdef __BIG_ENDIAN_BITFIELD
227 uint64_t reserved_17_63:47;
228 uint64_t oddpar:1;
229 uint64_t prt3:4;
230 uint64_t prt2:4;
231 uint64_t prt1:4;
232 uint64_t prt0:4;
233#else
234 uint64_t prt0:4;
235 uint64_t prt1:4;
236 uint64_t prt2:4;
237 uint64_t prt3:4;
238 uint64_t oddpar:1;
239 uint64_t reserved_17_63:47;
240#endif
241 } s;
242};
243
244union cvmx_stxx_spi4_dat {
245 uint64_t u64;
246 struct cvmx_stxx_spi4_dat_s {
247#ifdef __BIG_ENDIAN_BITFIELD
248 uint64_t reserved_32_63:32;
249 uint64_t alpha:16;
250 uint64_t max_t:16;
251#else
252 uint64_t max_t:16;
253 uint64_t alpha:16;
254 uint64_t reserved_32_63:32;
255#endif
256 } s;
257};
258
259union cvmx_stxx_spi4_stat {
260 uint64_t u64;
261 struct cvmx_stxx_spi4_stat_s {
262#ifdef __BIG_ENDIAN_BITFIELD
263 uint64_t reserved_16_63:48;
264 uint64_t m:8;
265 uint64_t reserved_7_7:1;
266 uint64_t len:7;
267#else
268 uint64_t len:7;
269 uint64_t reserved_7_7:1;
270 uint64_t m:8;
271 uint64_t reserved_16_63:48;
272#endif
273 } s;
274};
275
276union cvmx_stxx_stat_bytes_hi {
277 uint64_t u64;
278 struct cvmx_stxx_stat_bytes_hi_s {
279#ifdef __BIG_ENDIAN_BITFIELD
280 uint64_t reserved_32_63:32;
281 uint64_t cnt:32;
282#else
283 uint64_t cnt:32;
284 uint64_t reserved_32_63:32;
285#endif
286 } s;
287};
288
289union cvmx_stxx_stat_bytes_lo {
290 uint64_t u64;
291 struct cvmx_stxx_stat_bytes_lo_s {
292#ifdef __BIG_ENDIAN_BITFIELD
293 uint64_t reserved_32_63:32;
294 uint64_t cnt:32;
295#else
296 uint64_t cnt:32;
297 uint64_t reserved_32_63:32;
298#endif
299 } s;
300};
301
302union cvmx_stxx_stat_ctl {
303 uint64_t u64;
304 struct cvmx_stxx_stat_ctl_s {
305#ifdef __BIG_ENDIAN_BITFIELD
306 uint64_t reserved_5_63:59;
307 uint64_t clr:1;
308 uint64_t bckprs:4;
309#else
310 uint64_t bckprs:4;
311 uint64_t clr:1;
312 uint64_t reserved_5_63:59;
313#endif
314 } s;
315};
316
317union cvmx_stxx_stat_pkt_xmt {
318 uint64_t u64;
319 struct cvmx_stxx_stat_pkt_xmt_s {
320#ifdef __BIG_ENDIAN_BITFIELD
321 uint64_t reserved_32_63:32;
322 uint64_t cnt:32;
323#else
324 uint64_t cnt:32;
325 uint64_t reserved_32_63:32;
326#endif
327 } s;
328};
329
330#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-sysinfo.h b/arch/mips/include/asm/octeon/cvmx-sysinfo.h
new file mode 100644
index 000000000..c6c3ee39c
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-sysinfo.h
@@ -0,0 +1,125 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2016 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 * This module provides system/board information obtained by the bootloader.
30 */
31
32#ifndef __CVMX_SYSINFO_H__
33#define __CVMX_SYSINFO_H__
34
35#include "cvmx-coremask.h"
36
37#define OCTEON_SERIAL_LEN 20
38/**
39 * Structure describing application specific information.
40 * __cvmx_app_init() populates this from the cvmx boot descriptor.
41 * This structure is private to simple executive applications, so
42 * no versioning is required.
43 *
44 * This structure must be provided with some fields set in order to
45 * use simple executive functions in other applications (Linux kernel,
46 * u-boot, etc.) The cvmx_sysinfo_minimal_initialize() function is
47 * provided to set the required values in these cases.
48 */
49struct cvmx_sysinfo {
50 /* System wide variables */
51 /* installed DRAM in system, in bytes */
52 uint64_t system_dram_size;
53
54 /* ptr to memory descriptor block */
55 uint64_t phy_mem_desc_addr;
56
57 /* Application image specific variables */
58 /* stack top address (virtual) */
59 uint64_t stack_top;
60 /* heap base address (virtual) */
61 uint64_t heap_base;
62 /* stack size in bytes */
63 uint32_t stack_size;
64 /* heap size in bytes */
65 uint32_t heap_size;
66 /* coremask defining cores running application */
67 struct cvmx_coremask core_mask;
68 /* Deprecated, use cvmx_coremask_first_core() to select init core */
69 uint32_t init_core;
70
71 /* exception base address, as set by bootloader */
72 uint64_t exception_base_addr;
73
74 /* cpu clock speed in hz */
75 uint32_t cpu_clock_hz;
76
77 /* dram data rate in hz (data rate = 2 * clock rate */
78 uint32_t dram_data_rate_hz;
79
80
81 uint16_t board_type;
82 uint8_t board_rev_major;
83 uint8_t board_rev_minor;
84 uint8_t mac_addr_base[6];
85 uint8_t mac_addr_count;
86 char board_serial_number[OCTEON_SERIAL_LEN];
87 /*
88 * Several boards support compact flash on the Octeon boot
89 * bus. The CF memory spaces may be mapped to different
90 * addresses on different boards. These values will be 0 if
91 * CF is not present. Note that these addresses are physical
92 * addresses, and it is up to the application to use the
93 * proper addressing mode (XKPHYS, KSEG0, etc.)
94 */
95 uint64_t compact_flash_common_base_addr;
96 uint64_t compact_flash_attribute_base_addr;
97 /*
98 * Base address of the LED display (as on EBT3000 board) This
99 * will be 0 if LED display not present. Note that this
100 * address is a physical address, and it is up to the
101 * application to use the proper addressing mode (XKPHYS,
102 * KSEG0, etc.)
103 */
104 uint64_t led_display_base_addr;
105 /* DFA reference clock in hz (if applicable)*/
106 uint32_t dfa_ref_clock_hz;
107 /* configuration flags from bootloader */
108 uint32_t bootloader_config_flags;
109
110 /* Uart number used for console */
111 uint8_t console_uart_num;
112};
113
114/**
115 * This function returns the system/board information as obtained
116 * by the bootloader.
117 *
118 *
119 * Returns Pointer to the boot information structure
120 *
121 */
122
123extern struct cvmx_sysinfo *cvmx_sysinfo_get(void);
124
125#endif /* __CVMX_SYSINFO_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx-uctlx-defs.h b/arch/mips/include/asm/octeon/cvmx-uctlx-defs.h
new file mode 100644
index 000000000..6cf228016
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-uctlx-defs.h
@@ -0,0 +1,386 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2012 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_UCTLX_DEFS_H__
29#define __CVMX_UCTLX_DEFS_H__
30
31#define CVMX_UCTLX_BIST_STATUS(block_id) (CVMX_ADD_IO_SEG(0x000118006F0000A0ull))
32#define CVMX_UCTLX_CLK_RST_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000000ull))
33#define CVMX_UCTLX_EHCI_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000080ull))
34#define CVMX_UCTLX_EHCI_FLA(block_id) (CVMX_ADD_IO_SEG(0x000118006F0000A8ull))
35#define CVMX_UCTLX_ERTO_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000090ull))
36#define CVMX_UCTLX_IF_ENA(block_id) (CVMX_ADD_IO_SEG(0x000118006F000030ull))
37#define CVMX_UCTLX_INT_ENA(block_id) (CVMX_ADD_IO_SEG(0x000118006F000028ull))
38#define CVMX_UCTLX_INT_REG(block_id) (CVMX_ADD_IO_SEG(0x000118006F000020ull))
39#define CVMX_UCTLX_OHCI_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000088ull))
40#define CVMX_UCTLX_ORTO_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000098ull))
41#define CVMX_UCTLX_PPAF_WM(block_id) (CVMX_ADD_IO_SEG(0x000118006F000038ull))
42#define CVMX_UCTLX_UPHY_CTL_STATUS(block_id) (CVMX_ADD_IO_SEG(0x000118006F000008ull))
43#define CVMX_UCTLX_UPHY_PORTX_CTL_STATUS(offset, block_id) (CVMX_ADD_IO_SEG(0x000118006F000010ull) + (((offset) & 1) + ((block_id) & 0) * 0x0ull) * 8)
44
45union cvmx_uctlx_bist_status {
46 uint64_t u64;
47 struct cvmx_uctlx_bist_status_s {
48#ifdef __BIG_ENDIAN_BITFIELD
49 uint64_t reserved_6_63:58;
50 uint64_t data_bis:1;
51 uint64_t desc_bis:1;
52 uint64_t erbm_bis:1;
53 uint64_t orbm_bis:1;
54 uint64_t wrbm_bis:1;
55 uint64_t ppaf_bis:1;
56#else
57 uint64_t ppaf_bis:1;
58 uint64_t wrbm_bis:1;
59 uint64_t orbm_bis:1;
60 uint64_t erbm_bis:1;
61 uint64_t desc_bis:1;
62 uint64_t data_bis:1;
63 uint64_t reserved_6_63:58;
64#endif
65 } s;
66};
67
68union cvmx_uctlx_clk_rst_ctl {
69 uint64_t u64;
70 struct cvmx_uctlx_clk_rst_ctl_s {
71#ifdef __BIG_ENDIAN_BITFIELD
72 uint64_t reserved_25_63:39;
73 uint64_t clear_bist:1;
74 uint64_t start_bist:1;
75 uint64_t ehci_sm:1;
76 uint64_t ohci_clkcktrst:1;
77 uint64_t ohci_sm:1;
78 uint64_t ohci_susp_lgcy:1;
79 uint64_t app_start_clk:1;
80 uint64_t o_clkdiv_rst:1;
81 uint64_t h_clkdiv_byp:1;
82 uint64_t h_clkdiv_rst:1;
83 uint64_t h_clkdiv_en:1;
84 uint64_t o_clkdiv_en:1;
85 uint64_t h_div:4;
86 uint64_t p_refclk_sel:2;
87 uint64_t p_refclk_div:2;
88 uint64_t reserved_4_4:1;
89 uint64_t p_com_on:1;
90 uint64_t p_por:1;
91 uint64_t p_prst:1;
92 uint64_t hrst:1;
93#else
94 uint64_t hrst:1;
95 uint64_t p_prst:1;
96 uint64_t p_por:1;
97 uint64_t p_com_on:1;
98 uint64_t reserved_4_4:1;
99 uint64_t p_refclk_div:2;
100 uint64_t p_refclk_sel:2;
101 uint64_t h_div:4;
102 uint64_t o_clkdiv_en:1;
103 uint64_t h_clkdiv_en:1;
104 uint64_t h_clkdiv_rst:1;
105 uint64_t h_clkdiv_byp:1;
106 uint64_t o_clkdiv_rst:1;
107 uint64_t app_start_clk:1;
108 uint64_t ohci_susp_lgcy:1;
109 uint64_t ohci_sm:1;
110 uint64_t ohci_clkcktrst:1;
111 uint64_t ehci_sm:1;
112 uint64_t start_bist:1;
113 uint64_t clear_bist:1;
114 uint64_t reserved_25_63:39;
115#endif
116 } s;
117};
118
119union cvmx_uctlx_ehci_ctl {
120 uint64_t u64;
121 struct cvmx_uctlx_ehci_ctl_s {
122#ifdef __BIG_ENDIAN_BITFIELD
123 uint64_t reserved_20_63:44;
124 uint64_t desc_rbm:1;
125 uint64_t reg_nb:1;
126 uint64_t l2c_dc:1;
127 uint64_t l2c_bc:1;
128 uint64_t l2c_0pag:1;
129 uint64_t l2c_stt:1;
130 uint64_t l2c_buff_emod:2;
131 uint64_t l2c_desc_emod:2;
132 uint64_t inv_reg_a2:1;
133 uint64_t ehci_64b_addr_en:1;
134 uint64_t l2c_addr_msb:8;
135#else
136 uint64_t l2c_addr_msb:8;
137 uint64_t ehci_64b_addr_en:1;
138 uint64_t inv_reg_a2:1;
139 uint64_t l2c_desc_emod:2;
140 uint64_t l2c_buff_emod:2;
141 uint64_t l2c_stt:1;
142 uint64_t l2c_0pag:1;
143 uint64_t l2c_bc:1;
144 uint64_t l2c_dc:1;
145 uint64_t reg_nb:1;
146 uint64_t desc_rbm:1;
147 uint64_t reserved_20_63:44;
148#endif
149 } s;
150};
151
152union cvmx_uctlx_ehci_fla {
153 uint64_t u64;
154 struct cvmx_uctlx_ehci_fla_s {
155#ifdef __BIG_ENDIAN_BITFIELD
156 uint64_t reserved_6_63:58;
157 uint64_t fla:6;
158#else
159 uint64_t fla:6;
160 uint64_t reserved_6_63:58;
161#endif
162 } s;
163};
164
165union cvmx_uctlx_erto_ctl {
166 uint64_t u64;
167 struct cvmx_uctlx_erto_ctl_s {
168#ifdef __BIG_ENDIAN_BITFIELD
169 uint64_t reserved_32_63:32;
170 uint64_t to_val:27;
171 uint64_t reserved_0_4:5;
172#else
173 uint64_t reserved_0_4:5;
174 uint64_t to_val:27;
175 uint64_t reserved_32_63:32;
176#endif
177 } s;
178};
179
180union cvmx_uctlx_if_ena {
181 uint64_t u64;
182 struct cvmx_uctlx_if_ena_s {
183#ifdef __BIG_ENDIAN_BITFIELD
184 uint64_t reserved_1_63:63;
185 uint64_t en:1;
186#else
187 uint64_t en:1;
188 uint64_t reserved_1_63:63;
189#endif
190 } s;
191};
192
193union cvmx_uctlx_int_ena {
194 uint64_t u64;
195 struct cvmx_uctlx_int_ena_s {
196#ifdef __BIG_ENDIAN_BITFIELD
197 uint64_t reserved_8_63:56;
198 uint64_t ec_ovf_e:1;
199 uint64_t oc_ovf_e:1;
200 uint64_t wb_pop_e:1;
201 uint64_t wb_psh_f:1;
202 uint64_t cf_psh_f:1;
203 uint64_t or_psh_f:1;
204 uint64_t er_psh_f:1;
205 uint64_t pp_psh_f:1;
206#else
207 uint64_t pp_psh_f:1;
208 uint64_t er_psh_f:1;
209 uint64_t or_psh_f:1;
210 uint64_t cf_psh_f:1;
211 uint64_t wb_psh_f:1;
212 uint64_t wb_pop_e:1;
213 uint64_t oc_ovf_e:1;
214 uint64_t ec_ovf_e:1;
215 uint64_t reserved_8_63:56;
216#endif
217 } s;
218};
219
220union cvmx_uctlx_int_reg {
221 uint64_t u64;
222 struct cvmx_uctlx_int_reg_s {
223#ifdef __BIG_ENDIAN_BITFIELD
224 uint64_t reserved_8_63:56;
225 uint64_t ec_ovf_e:1;
226 uint64_t oc_ovf_e:1;
227 uint64_t wb_pop_e:1;
228 uint64_t wb_psh_f:1;
229 uint64_t cf_psh_f:1;
230 uint64_t or_psh_f:1;
231 uint64_t er_psh_f:1;
232 uint64_t pp_psh_f:1;
233#else
234 uint64_t pp_psh_f:1;
235 uint64_t er_psh_f:1;
236 uint64_t or_psh_f:1;
237 uint64_t cf_psh_f:1;
238 uint64_t wb_psh_f:1;
239 uint64_t wb_pop_e:1;
240 uint64_t oc_ovf_e:1;
241 uint64_t ec_ovf_e:1;
242 uint64_t reserved_8_63:56;
243#endif
244 } s;
245};
246
247union cvmx_uctlx_ohci_ctl {
248 uint64_t u64;
249 struct cvmx_uctlx_ohci_ctl_s {
250#ifdef __BIG_ENDIAN_BITFIELD
251 uint64_t reserved_19_63:45;
252 uint64_t reg_nb:1;
253 uint64_t l2c_dc:1;
254 uint64_t l2c_bc:1;
255 uint64_t l2c_0pag:1;
256 uint64_t l2c_stt:1;
257 uint64_t l2c_buff_emod:2;
258 uint64_t l2c_desc_emod:2;
259 uint64_t inv_reg_a2:1;
260 uint64_t reserved_8_8:1;
261 uint64_t l2c_addr_msb:8;
262#else
263 uint64_t l2c_addr_msb:8;
264 uint64_t reserved_8_8:1;
265 uint64_t inv_reg_a2:1;
266 uint64_t l2c_desc_emod:2;
267 uint64_t l2c_buff_emod:2;
268 uint64_t l2c_stt:1;
269 uint64_t l2c_0pag:1;
270 uint64_t l2c_bc:1;
271 uint64_t l2c_dc:1;
272 uint64_t reg_nb:1;
273 uint64_t reserved_19_63:45;
274#endif
275 } s;
276};
277
278union cvmx_uctlx_orto_ctl {
279 uint64_t u64;
280 struct cvmx_uctlx_orto_ctl_s {
281#ifdef __BIG_ENDIAN_BITFIELD
282 uint64_t reserved_32_63:32;
283 uint64_t to_val:24;
284 uint64_t reserved_0_7:8;
285#else
286 uint64_t reserved_0_7:8;
287 uint64_t to_val:24;
288 uint64_t reserved_32_63:32;
289#endif
290 } s;
291};
292
293union cvmx_uctlx_ppaf_wm {
294 uint64_t u64;
295 struct cvmx_uctlx_ppaf_wm_s {
296#ifdef __BIG_ENDIAN_BITFIELD
297 uint64_t reserved_5_63:59;
298 uint64_t wm:5;
299#else
300 uint64_t wm:5;
301 uint64_t reserved_5_63:59;
302#endif
303 } s;
304};
305
306union cvmx_uctlx_uphy_ctl_status {
307 uint64_t u64;
308 struct cvmx_uctlx_uphy_ctl_status_s {
309#ifdef __BIG_ENDIAN_BITFIELD
310 uint64_t reserved_10_63:54;
311 uint64_t bist_done:1;
312 uint64_t bist_err:1;
313 uint64_t hsbist:1;
314 uint64_t fsbist:1;
315 uint64_t lsbist:1;
316 uint64_t siddq:1;
317 uint64_t vtest_en:1;
318 uint64_t uphy_bist:1;
319 uint64_t bist_en:1;
320 uint64_t ate_reset:1;
321#else
322 uint64_t ate_reset:1;
323 uint64_t bist_en:1;
324 uint64_t uphy_bist:1;
325 uint64_t vtest_en:1;
326 uint64_t siddq:1;
327 uint64_t lsbist:1;
328 uint64_t fsbist:1;
329 uint64_t hsbist:1;
330 uint64_t bist_err:1;
331 uint64_t bist_done:1;
332 uint64_t reserved_10_63:54;
333#endif
334 } s;
335};
336
337union cvmx_uctlx_uphy_portx_ctl_status {
338 uint64_t u64;
339 struct cvmx_uctlx_uphy_portx_ctl_status_s {
340#ifdef __BIG_ENDIAN_BITFIELD
341 uint64_t reserved_43_63:21;
342 uint64_t tdata_out:4;
343 uint64_t txbiststuffenh:1;
344 uint64_t txbiststuffen:1;
345 uint64_t dmpulldown:1;
346 uint64_t dppulldown:1;
347 uint64_t vbusvldext:1;
348 uint64_t portreset:1;
349 uint64_t txhsvxtune:2;
350 uint64_t txvreftune:4;
351 uint64_t txrisetune:1;
352 uint64_t txpreemphasistune:1;
353 uint64_t txfslstune:4;
354 uint64_t sqrxtune:3;
355 uint64_t compdistune:3;
356 uint64_t loop_en:1;
357 uint64_t tclk:1;
358 uint64_t tdata_sel:1;
359 uint64_t taddr_in:4;
360 uint64_t tdata_in:8;
361#else
362 uint64_t tdata_in:8;
363 uint64_t taddr_in:4;
364 uint64_t tdata_sel:1;
365 uint64_t tclk:1;
366 uint64_t loop_en:1;
367 uint64_t compdistune:3;
368 uint64_t sqrxtune:3;
369 uint64_t txfslstune:4;
370 uint64_t txpreemphasistune:1;
371 uint64_t txrisetune:1;
372 uint64_t txvreftune:4;
373 uint64_t txhsvxtune:2;
374 uint64_t portreset:1;
375 uint64_t vbusvldext:1;
376 uint64_t dppulldown:1;
377 uint64_t dmpulldown:1;
378 uint64_t txbiststuffen:1;
379 uint64_t txbiststuffenh:1;
380 uint64_t tdata_out:4;
381 uint64_t reserved_43_63:21;
382#endif
383 } s;
384};
385
386#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-wqe.h b/arch/mips/include/asm/octeon/cvmx-wqe.h
new file mode 100644
index 000000000..9cec2299b
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-wqe.h
@@ -0,0 +1,658 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/**
29 *
30 * This header file defines the work queue entry (wqe) data structure.
31 * Since this is a commonly used structure that depends on structures
32 * from several hardware blocks, those definitions have been placed
33 * in this file to create a single point of definition of the wqe
34 * format.
35 * Data structures are still named according to the block that they
36 * relate to.
37 *
38 */
39
40#ifndef __CVMX_WQE_H__
41#define __CVMX_WQE_H__
42
43#include <asm/octeon/cvmx-packet.h>
44
45
46#define OCT_TAG_TYPE_STRING(x) \
47 (((x) == CVMX_POW_TAG_TYPE_ORDERED) ? "ORDERED" : \
48 (((x) == CVMX_POW_TAG_TYPE_ATOMIC) ? "ATOMIC" : \
49 (((x) == CVMX_POW_TAG_TYPE_NULL) ? "NULL" : \
50 "NULL_NULL")))
51
52/**
53 * HW decode / err_code in work queue entry
54 */
55typedef union {
56 uint64_t u64;
57
58 /* Use this struct if the hardware determines that the packet is IP */
59 struct {
60#ifdef __BIG_ENDIAN_BITFIELD
61 /* HW sets this to the number of buffers used by this packet */
62 uint64_t bufs:8;
63 /* HW sets to the number of L2 bytes prior to the IP */
64 uint64_t ip_offset:8;
65 /* set to 1 if we found DSA/VLAN in the L2 */
66 uint64_t vlan_valid:1;
67 /* Set to 1 if the DSA/VLAN tag is stacked */
68 uint64_t vlan_stacked:1;
69 uint64_t unassigned:1;
70 /* HW sets to the DSA/VLAN CFI flag (valid when vlan_valid) */
71 uint64_t vlan_cfi:1;
72 /* HW sets to the DSA/VLAN_ID field (valid when vlan_valid) */
73 uint64_t vlan_id:12;
74 /* Ring Identifier (if PCIe). Requires PIP_GBL_CTL[RING_EN]=1 */
75 uint64_t pr:4;
76 uint64_t unassigned2:8;
77 /* the packet needs to be decompressed */
78 uint64_t dec_ipcomp:1;
79 /* the packet is either TCP or UDP */
80 uint64_t tcp_or_udp:1;
81 /* the packet needs to be decrypted (ESP or AH) */
82 uint64_t dec_ipsec:1;
83 /* the packet is IPv6 */
84 uint64_t is_v6:1;
85
86 /*
87 * (rcv_error, not_IP, IP_exc, is_frag, L4_error,
88 * software, etc.).
89 */
90
91 /*
92 * reserved for software use, hardware will clear on
93 * packet creation.
94 */
95 uint64_t software:1;
96 /* exceptional conditions below */
97 /* the receive interface hardware detected an L4 error
98 * (only applies if !is_frag) (only applies if
99 * !rcv_error && !not_IP && !IP_exc && !is_frag)
100 * failure indicated in err_code below, decode:
101 *
102 * - 1 = Malformed L4
103 * - 2 = L4 Checksum Error: the L4 checksum value is
104 * - 3 = UDP Length Error: The UDP length field would
105 * make the UDP data longer than what remains in
106 * the IP packet (as defined by the IP header
107 * length field).
108 * - 4 = Bad L4 Port: either the source or destination
109 * TCP/UDP port is 0.
110 * - 8 = TCP FIN Only: the packet is TCP and only the
111 * FIN flag set.
112 * - 9 = TCP No Flags: the packet is TCP and no flags
113 * are set.
114 * - 10 = TCP FIN RST: the packet is TCP and both FIN
115 * and RST are set.
116 * - 11 = TCP SYN URG: the packet is TCP and both SYN
117 * and URG are set.
118 * - 12 = TCP SYN RST: the packet is TCP and both SYN
119 * and RST are set.
120 * - 13 = TCP SYN FIN: the packet is TCP and both SYN
121 * and FIN are set.
122 */
123 uint64_t L4_error:1;
124 /* set if the packet is a fragment */
125 uint64_t is_frag:1;
126 /* the receive interface hardware detected an IP error
127 * / exception (only applies if !rcv_error && !not_IP)
128 * failure indicated in err_code below, decode:
129 *
130 * - 1 = Not IP: the IP version field is neither 4 nor
131 * 6.
132 * - 2 = IPv4 Header Checksum Error: the IPv4 header
133 * has a checksum violation.
134 * - 3 = IP Malformed Header: the packet is not long
135 * enough to contain the IP header.
136 * - 4 = IP Malformed: the packet is not long enough
137 * to contain the bytes indicated by the IP
138 * header. Pad is allowed.
139 * - 5 = IP TTL Hop: the IPv4 TTL field or the IPv6
140 * Hop Count field are zero.
141 * - 6 = IP Options
142 */
143 uint64_t IP_exc:1;
144 /*
145 * Set if the hardware determined that the packet is a
146 * broadcast.
147 */
148 uint64_t is_bcast:1;
149 /*
150 * St if the hardware determined that the packet is a
151 * multi-cast.
152 */
153 uint64_t is_mcast:1;
154 /*
155 * Set if the packet may not be IP (must be zero in
156 * this case).
157 */
158 uint64_t not_IP:1;
159 /*
160 * The receive interface hardware detected a receive
161 * error (must be zero in this case).
162 */
163 uint64_t rcv_error:1;
164 /* lower err_code = first-level descriptor of the
165 * work */
166 /* zero for packet submitted by hardware that isn't on
167 * the slow path */
168 /* type is cvmx_pip_err_t */
169 uint64_t err_code:8;
170#else
171 uint64_t err_code:8;
172 uint64_t rcv_error:1;
173 uint64_t not_IP:1;
174 uint64_t is_mcast:1;
175 uint64_t is_bcast:1;
176 uint64_t IP_exc:1;
177 uint64_t is_frag:1;
178 uint64_t L4_error:1;
179 uint64_t software:1;
180 uint64_t is_v6:1;
181 uint64_t dec_ipsec:1;
182 uint64_t tcp_or_udp:1;
183 uint64_t dec_ipcomp:1;
184 uint64_t unassigned2:4;
185 uint64_t unassigned2a:4;
186 uint64_t pr:4;
187 uint64_t vlan_id:12;
188 uint64_t vlan_cfi:1;
189 uint64_t unassigned:1;
190 uint64_t vlan_stacked:1;
191 uint64_t vlan_valid:1;
192 uint64_t ip_offset:8;
193 uint64_t bufs:8;
194#endif
195 } s;
196 struct {
197#ifdef __BIG_ENDIAN_BITFIELD
198 uint64_t bufs:8;
199 uint64_t ip_offset:8;
200 uint64_t vlan_valid:1;
201 uint64_t vlan_stacked:1;
202 uint64_t unassigned:1;
203 uint64_t vlan_cfi:1;
204 uint64_t vlan_id:12;
205 uint64_t port:12; /* MAC/PIP port number. */
206 uint64_t dec_ipcomp:1;
207 uint64_t tcp_or_udp:1;
208 uint64_t dec_ipsec:1;
209 uint64_t is_v6:1;
210 uint64_t software:1;
211 uint64_t L4_error:1;
212 uint64_t is_frag:1;
213 uint64_t IP_exc:1;
214 uint64_t is_bcast:1;
215 uint64_t is_mcast:1;
216 uint64_t not_IP:1;
217 uint64_t rcv_error:1;
218 uint64_t err_code:8;
219#else
220 uint64_t err_code:8;
221 uint64_t rcv_error:1;
222 uint64_t not_IP:1;
223 uint64_t is_mcast:1;
224 uint64_t is_bcast:1;
225 uint64_t IP_exc:1;
226 uint64_t is_frag:1;
227 uint64_t L4_error:1;
228 uint64_t software:1;
229 uint64_t is_v6:1;
230 uint64_t dec_ipsec:1;
231 uint64_t tcp_or_udp:1;
232 uint64_t dec_ipcomp:1;
233 uint64_t port:12;
234 uint64_t vlan_id:12;
235 uint64_t vlan_cfi:1;
236 uint64_t unassigned:1;
237 uint64_t vlan_stacked:1;
238 uint64_t vlan_valid:1;
239 uint64_t ip_offset:8;
240 uint64_t bufs:8;
241#endif
242 } s_cn68xx;
243
244 /* use this to get at the 16 vlan bits */
245 struct {
246#ifdef __BIG_ENDIAN_BITFIELD
247 uint64_t unused1:16;
248 uint64_t vlan:16;
249 uint64_t unused2:32;
250#else
251 uint64_t unused2:32;
252 uint64_t vlan:16;
253 uint64_t unused1:16;
254
255#endif
256 } svlan;
257
258 /*
259 * use this struct if the hardware could not determine that
260 * the packet is ip.
261 */
262 struct {
263#ifdef __BIG_ENDIAN_BITFIELD
264 /*
265 * HW sets this to the number of buffers used by this
266 * packet.
267 */
268 uint64_t bufs:8;
269 uint64_t unused:8;
270 /* set to 1 if we found DSA/VLAN in the L2 */
271 uint64_t vlan_valid:1;
272 /* Set to 1 if the DSA/VLAN tag is stacked */
273 uint64_t vlan_stacked:1;
274 uint64_t unassigned:1;
275 /*
276 * HW sets to the DSA/VLAN CFI flag (valid when
277 * vlan_valid)
278 */
279 uint64_t vlan_cfi:1;
280 /*
281 * HW sets to the DSA/VLAN_ID field (valid when
282 * vlan_valid).
283 */
284 uint64_t vlan_id:12;
285 /*
286 * Ring Identifier (if PCIe). Requires
287 * PIP_GBL_CTL[RING_EN]=1
288 */
289 uint64_t pr:4;
290 uint64_t unassigned2:12;
291 /*
292 * reserved for software use, hardware will clear on
293 * packet creation.
294 */
295 uint64_t software:1;
296 uint64_t unassigned3:1;
297 /*
298 * set if the hardware determined that the packet is
299 * rarp.
300 */
301 uint64_t is_rarp:1;
302 /*
303 * set if the hardware determined that the packet is
304 * arp
305 */
306 uint64_t is_arp:1;
307 /*
308 * set if the hardware determined that the packet is a
309 * broadcast.
310 */
311 uint64_t is_bcast:1;
312 /*
313 * set if the hardware determined that the packet is a
314 * multi-cast
315 */
316 uint64_t is_mcast:1;
317 /*
318 * set if the packet may not be IP (must be one in
319 * this case)
320 */
321 uint64_t not_IP:1;
322 /* The receive interface hardware detected a receive
323 * error. Failure indicated in err_code below,
324 * decode:
325 *
326 * - 1 = partial error: a packet was partially
327 * received, but internal buffering / bandwidth
328 * was not adequate to receive the entire
329 * packet.
330 * - 2 = jabber error: the RGMII packet was too large
331 * and is truncated.
332 * - 3 = overrun error: the RGMII packet is longer
333 * than allowed and had an FCS error.
334 * - 4 = oversize error: the RGMII packet is longer
335 * than allowed.
336 * - 5 = alignment error: the RGMII packet is not an
337 * integer number of bytes
338 * and had an FCS error (100M and 10M only).
339 * - 6 = fragment error: the RGMII packet is shorter
340 * than allowed and had an FCS error.
341 * - 7 = GMX FCS error: the RGMII packet had an FCS
342 * error.
343 * - 8 = undersize error: the RGMII packet is shorter
344 * than allowed.
345 * - 9 = extend error: the RGMII packet had an extend
346 * error.
347 * - 10 = length mismatch error: the RGMII packet had
348 * a length that did not match the length field
349 * in the L2 HDR.
350 * - 11 = RGMII RX error/SPI4 DIP4 Error: the RGMII
351 * packet had one or more data reception errors
352 * (RXERR) or the SPI4 packet had one or more
353 * DIP4 errors.
354 * - 12 = RGMII skip error/SPI4 Abort Error: the RGMII
355 * packet was not large enough to cover the
356 * skipped bytes or the SPI4 packet was
357 * terminated with an About EOPS.
358 * - 13 = RGMII nibble error/SPI4 Port NXA Error: the
359 * RGMII packet had a studder error (data not
360 * repeated - 10/100M only) or the SPI4 packet
361 * was sent to an NXA.
362 * - 16 = FCS error: a SPI4.2 packet had an FCS error.
363 * - 17 = Skip error: a packet was not large enough to
364 * cover the skipped bytes.
365 * - 18 = L2 header malformed: the packet is not long
366 * enough to contain the L2.
367 */
368
369 uint64_t rcv_error:1;
370 /*
371 * lower err_code = first-level descriptor of the
372 * work
373 */
374 /*
375 * zero for packet submitted by hardware that isn't on
376 * the slow path
377 */
378 /* type is cvmx_pip_err_t (union, so can't use directly */
379 uint64_t err_code:8;
380#else
381 uint64_t err_code:8;
382 uint64_t rcv_error:1;
383 uint64_t not_IP:1;
384 uint64_t is_mcast:1;
385 uint64_t is_bcast:1;
386 uint64_t is_arp:1;
387 uint64_t is_rarp:1;
388 uint64_t unassigned3:1;
389 uint64_t software:1;
390 uint64_t unassigned2:4;
391 uint64_t unassigned2a:8;
392 uint64_t pr:4;
393 uint64_t vlan_id:12;
394 uint64_t vlan_cfi:1;
395 uint64_t unassigned:1;
396 uint64_t vlan_stacked:1;
397 uint64_t vlan_valid:1;
398 uint64_t unused:8;
399 uint64_t bufs:8;
400#endif
401 } snoip;
402
403} cvmx_pip_wqe_word2;
404
405union cvmx_pip_wqe_word0 {
406 struct {
407#ifdef __BIG_ENDIAN_BITFIELD
408 /**
409 * raw chksum result generated by the HW
410 */
411 uint16_t hw_chksum;
412 /**
413 * Field unused by hardware - available for software
414 */
415 uint8_t unused;
416 /**
417 * Next pointer used by hardware for list maintenance.
418 * May be written/read by HW before the work queue
419 * entry is scheduled to a PP (Only 36 bits used in
420 * Octeon 1)
421 */
422 uint64_t next_ptr:40;
423#else
424 uint64_t next_ptr:40;
425 uint8_t unused;
426 uint16_t hw_chksum;
427#endif
428 } cn38xx;
429 struct {
430#ifdef __BIG_ENDIAN_BITFIELD
431 uint64_t l4ptr:8; /* 56..63 */
432 uint64_t unused0:8; /* 48..55 */
433 uint64_t l3ptr:8; /* 40..47 */
434 uint64_t l2ptr:8; /* 32..39 */
435 uint64_t unused1:18; /* 14..31 */
436 uint64_t bpid:6; /* 8..13 */
437 uint64_t unused2:2; /* 6..7 */
438 uint64_t pknd:6; /* 0..5 */
439#else
440 uint64_t pknd:6; /* 0..5 */
441 uint64_t unused2:2; /* 6..7 */
442 uint64_t bpid:6; /* 8..13 */
443 uint64_t unused1:18; /* 14..31 */
444 uint64_t l2ptr:8; /* 32..39 */
445 uint64_t l3ptr:8; /* 40..47 */
446 uint64_t unused0:8; /* 48..55 */
447 uint64_t l4ptr:8; /* 56..63 */
448#endif
449 } cn68xx;
450};
451
452union cvmx_wqe_word0 {
453 uint64_t u64;
454 union cvmx_pip_wqe_word0 pip;
455};
456
457union cvmx_wqe_word1 {
458 uint64_t u64;
459 struct {
460#ifdef __BIG_ENDIAN_BITFIELD
461 uint64_t len:16;
462 uint64_t varies:14;
463 /**
464 * the type of the tag (ORDERED, ATOMIC, NULL)
465 */
466 uint64_t tag_type:2;
467 uint64_t tag:32;
468#else
469 uint64_t tag:32;
470 uint64_t tag_type:2;
471 uint64_t varies:14;
472 uint64_t len:16;
473#endif
474 };
475 struct {
476#ifdef __BIG_ENDIAN_BITFIELD
477 uint64_t len:16;
478 uint64_t zero_0:1;
479 /**
480 * HW sets this to what it thought the priority of
481 * the input packet was
482 */
483 uint64_t qos:3;
484
485 uint64_t zero_1:1;
486 /**
487 * the group that the work queue entry will be scheduled to
488 */
489 uint64_t grp:6;
490 uint64_t zero_2:3;
491 uint64_t tag_type:2;
492 uint64_t tag:32;
493#else
494 uint64_t tag:32;
495 uint64_t tag_type:2;
496 uint64_t zero_2:3;
497 uint64_t grp:6;
498 uint64_t zero_1:1;
499 uint64_t qos:3;
500 uint64_t zero_0:1;
501 uint64_t len:16;
502#endif
503 } cn68xx;
504 struct {
505#ifdef __BIG_ENDIAN_BITFIELD
506 /**
507 * HW sets to the total number of bytes in the packet
508 */
509 uint64_t len:16;
510 /**
511 * HW sets this to input physical port
512 */
513 uint64_t ipprt:6;
514
515 /**
516 * HW sets this to what it thought the priority of
517 * the input packet was
518 */
519 uint64_t qos:3;
520
521 /**
522 * the group that the work queue entry will be scheduled to
523 */
524 uint64_t grp:4;
525 /**
526 * the type of the tag (ORDERED, ATOMIC, NULL)
527 */
528 uint64_t tag_type:3;
529 /**
530 * the synchronization/ordering tag
531 */
532 uint64_t tag:32;
533#else
534 uint64_t tag:32;
535 uint64_t tag_type:2;
536 uint64_t zero_2:1;
537 uint64_t grp:4;
538 uint64_t qos:3;
539 uint64_t ipprt:6;
540 uint64_t len:16;
541#endif
542 } cn38xx;
543};
544
545/**
546 * Work queue entry format
547 *
548 * must be 8-byte aligned
549 */
550struct cvmx_wqe {
551
552 /*****************************************************************
553 * WORD 0
554 * HW WRITE: the following 64 bits are filled by HW when a packet arrives
555 */
556 union cvmx_wqe_word0 word0;
557
558 /*****************************************************************
559 * WORD 1
560 * HW WRITE: the following 64 bits are filled by HW when a packet arrives
561 */
562 union cvmx_wqe_word1 word1;
563
564 /**
565 * WORD 2 HW WRITE: the following 64-bits are filled in by
566 * hardware when a packet arrives This indicates a variety of
567 * status and error conditions.
568 */
569 cvmx_pip_wqe_word2 word2;
570
571 /**
572 * Pointer to the first segment of the packet.
573 */
574 union cvmx_buf_ptr packet_ptr;
575
576 /**
577 * HW WRITE: octeon will fill in a programmable amount from the
578 * packet, up to (at most, but perhaps less) the amount
579 * needed to fill the work queue entry to 128 bytes
580 *
581 * If the packet is recognized to be IP, the hardware starts
582 * (except that the IPv4 header is padded for appropriate
583 * alignment) writing here where the IP header starts. If the
584 * packet is not recognized to be IP, the hardware starts
585 * writing the beginning of the packet here.
586 */
587 uint8_t packet_data[96];
588
589 /**
590 * If desired, SW can make the work Q entry any length. For the
591 * purposes of discussion here, Assume 128B always, as this is all that
592 * the hardware deals with.
593 *
594 */
595
596} CVMX_CACHE_LINE_ALIGNED;
597
598static inline int cvmx_wqe_get_port(struct cvmx_wqe *work)
599{
600 int port;
601
602 if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
603 port = work->word2.s_cn68xx.port;
604 else
605 port = work->word1.cn38xx.ipprt;
606
607 return port;
608}
609
610static inline void cvmx_wqe_set_port(struct cvmx_wqe *work, int port)
611{
612 if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
613 work->word2.s_cn68xx.port = port;
614 else
615 work->word1.cn38xx.ipprt = port;
616}
617
618static inline int cvmx_wqe_get_grp(struct cvmx_wqe *work)
619{
620 int grp;
621
622 if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
623 grp = work->word1.cn68xx.grp;
624 else
625 grp = work->word1.cn38xx.grp;
626
627 return grp;
628}
629
630static inline void cvmx_wqe_set_grp(struct cvmx_wqe *work, int grp)
631{
632 if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
633 work->word1.cn68xx.grp = grp;
634 else
635 work->word1.cn38xx.grp = grp;
636}
637
638static inline int cvmx_wqe_get_qos(struct cvmx_wqe *work)
639{
640 int qos;
641
642 if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
643 qos = work->word1.cn68xx.qos;
644 else
645 qos = work->word1.cn38xx.qos;
646
647 return qos;
648}
649
650static inline void cvmx_wqe_set_qos(struct cvmx_wqe *work, int qos)
651{
652 if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
653 work->word1.cn68xx.qos = qos;
654 else
655 work->word1.cn38xx.qos = qos;
656}
657
658#endif /* __CVMX_WQE_H__ */
diff --git a/arch/mips/include/asm/octeon/cvmx.h b/arch/mips/include/asm/octeon/cvmx.h
new file mode 100644
index 000000000..25854abc9
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx.h
@@ -0,0 +1,495 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2017 Cavium, Inc.
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_H__
29#define __CVMX_H__
30
31#include <linux/kernel.h>
32#include <linux/string.h>
33#include <linux/delay.h>
34
35enum cvmx_mips_space {
36 CVMX_MIPS_SPACE_XKSEG = 3LL,
37 CVMX_MIPS_SPACE_XKPHYS = 2LL,
38 CVMX_MIPS_SPACE_XSSEG = 1LL,
39 CVMX_MIPS_SPACE_XUSEG = 0LL
40};
41
42/* These macros for use when using 32 bit pointers. */
43#define CVMX_MIPS32_SPACE_KSEG0 1l
44#define CVMX_ADD_SEG32(segment, add) \
45 (((int32_t)segment << 31) | (int32_t)(add))
46
47#define CVMX_IO_SEG CVMX_MIPS_SPACE_XKPHYS
48
49/* These macros simplify the process of creating common IO addresses */
50#define CVMX_ADD_SEG(segment, add) \
51 ((((uint64_t)segment) << 62) | (add))
52#ifndef CVMX_ADD_IO_SEG
53#define CVMX_ADD_IO_SEG(add) CVMX_ADD_SEG(CVMX_IO_SEG, (add))
54#endif
55
56#include <asm/octeon/cvmx-asm.h>
57#include <asm/octeon/cvmx-packet.h>
58#include <asm/octeon/cvmx-sysinfo.h>
59
60#include <asm/octeon/cvmx-ciu-defs.h>
61#include <asm/octeon/cvmx-ciu3-defs.h>
62#include <asm/octeon/cvmx-gpio-defs.h>
63#include <asm/octeon/cvmx-iob-defs.h>
64#include <asm/octeon/cvmx-ipd-defs.h>
65#include <asm/octeon/cvmx-l2c-defs.h>
66#include <asm/octeon/cvmx-l2d-defs.h>
67#include <asm/octeon/cvmx-l2t-defs.h>
68#include <asm/octeon/cvmx-led-defs.h>
69#include <asm/octeon/cvmx-mio-defs.h>
70#include <asm/octeon/cvmx-pow-defs.h>
71
72#include <asm/octeon/cvmx-bootinfo.h>
73#include <asm/octeon/cvmx-bootmem.h>
74#include <asm/octeon/cvmx-l2c.h>
75
76#ifndef CVMX_ENABLE_DEBUG_PRINTS
77#define CVMX_ENABLE_DEBUG_PRINTS 1
78#endif
79
80#if CVMX_ENABLE_DEBUG_PRINTS
81#define cvmx_dprintf printk
82#else
83#define cvmx_dprintf(...) {}
84#endif
85
86#define CVMX_MAX_CORES (16)
87#define CVMX_CACHE_LINE_SIZE (128) /* In bytes */
88#define CVMX_CACHE_LINE_MASK (CVMX_CACHE_LINE_SIZE - 1) /* In bytes */
89#define CVMX_CACHE_LINE_ALIGNED __attribute__ ((aligned(CVMX_CACHE_LINE_SIZE)))
90#define CAST64(v) ((long long)(long)(v))
91#define CASTPTR(type, v) ((type *)(long)(v))
92
93/*
94 * Returns processor ID, different Linux and simple exec versions
95 * provided in the cvmx-app-init*.c files.
96 */
97static inline uint32_t cvmx_get_proc_id(void) __attribute__ ((pure));
98static inline uint32_t cvmx_get_proc_id(void)
99{
100 uint32_t id;
101 asm("mfc0 %0, $15,0" : "=r"(id));
102 return id;
103}
104
105/* turn the variable name into a string */
106#define CVMX_TMP_STR(x) CVMX_TMP_STR2(x)
107#define CVMX_TMP_STR2(x) #x
108
109/**
110 * Builds a bit mask given the required size in bits.
111 *
112 * @bits: Number of bits in the mask
113 * Returns The mask
114 */ static inline uint64_t cvmx_build_mask(uint64_t bits)
115{
116 return ~((~0x0ull) << bits);
117}
118
119/**
120 * Builds a memory address for I/O based on the Major and Sub DID.
121 *
122 * @major_did: 5 bit major did
123 * @sub_did: 3 bit sub did
124 * Returns I/O base address
125 */
126static inline uint64_t cvmx_build_io_address(uint64_t major_did,
127 uint64_t sub_did)
128{
129 return (0x1ull << 48) | (major_did << 43) | (sub_did << 40);
130}
131
132/**
133 * Perform mask and shift to place the supplied value into
134 * the supplied bit rage.
135 *
136 * Example: cvmx_build_bits(39,24,value)
137 * <pre>
138 * 6 5 4 3 3 2 1
139 * 3 5 7 9 1 3 5 7 0
140 * +-------+-------+-------+-------+-------+-------+-------+------+
141 * 000000000000000000000000___________value000000000000000000000000
142 * </pre>
143 *
144 * @high_bit: Highest bit value can occupy (inclusive) 0-63
145 * @low_bit: Lowest bit value can occupy inclusive 0-high_bit
146 * @value: Value to use
147 * Returns Value masked and shifted
148 */
149static inline uint64_t cvmx_build_bits(uint64_t high_bit,
150 uint64_t low_bit, uint64_t value)
151{
152 return (value & cvmx_build_mask(high_bit - low_bit + 1)) << low_bit;
153}
154
155/**
156 * Convert a memory pointer (void*) into a hardware compatible
157 * memory address (uint64_t). Octeon hardware widgets don't
158 * understand logical addresses.
159 *
160 * @ptr: C style memory pointer
161 * Returns Hardware physical address
162 */
163static inline uint64_t cvmx_ptr_to_phys(void *ptr)
164{
165 if (sizeof(void *) == 8) {
166 /*
167 * We're running in 64 bit mode. Normally this means
168 * that we can use 40 bits of address space (the
169 * hardware limit). Unfortunately there is one case
170 * were we need to limit this to 30 bits, sign
171 * extended 32 bit. Although these are 64 bits wide,
172 * only 30 bits can be used.
173 */
174 if ((CAST64(ptr) >> 62) == 3)
175 return CAST64(ptr) & cvmx_build_mask(30);
176 else
177 return CAST64(ptr) & cvmx_build_mask(40);
178 } else {
179 return (long)(ptr) & 0x1fffffff;
180 }
181}
182
183/**
184 * Convert a hardware physical address (uint64_t) into a
185 * memory pointer (void *).
186 *
187 * @physical_address:
188 * Hardware physical address to memory
189 * Returns Pointer to memory
190 */
191static inline void *cvmx_phys_to_ptr(uint64_t physical_address)
192{
193 if (sizeof(void *) == 8) {
194 /* Just set the top bit, avoiding any TLB ugliness */
195 return CASTPTR(void,
196 CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
197 physical_address));
198 } else {
199 return CASTPTR(void,
200 CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0,
201 physical_address));
202 }
203}
204
205/* The following #if controls the definition of the macro
206 CVMX_BUILD_WRITE64. This macro is used to build a store operation to
207 a full 64bit address. With a 64bit ABI, this can be done with a simple
208 pointer access. 32bit ABIs require more complicated assembly */
209
210/* We have a full 64bit ABI. Writing to a 64bit address can be done with
211 a simple volatile pointer */
212#define CVMX_BUILD_WRITE64(TYPE, ST) \
213static inline void cvmx_write64_##TYPE(uint64_t addr, TYPE##_t val) \
214{ \
215 *CASTPTR(volatile TYPE##_t, addr) = val; \
216}
217
218
219/* The following #if controls the definition of the macro
220 CVMX_BUILD_READ64. This macro is used to build a load operation from
221 a full 64bit address. With a 64bit ABI, this can be done with a simple
222 pointer access. 32bit ABIs require more complicated assembly */
223
224/* We have a full 64bit ABI. Writing to a 64bit address can be done with
225 a simple volatile pointer */
226#define CVMX_BUILD_READ64(TYPE, LT) \
227static inline TYPE##_t cvmx_read64_##TYPE(uint64_t addr) \
228{ \
229 return *CASTPTR(volatile TYPE##_t, addr); \
230}
231
232
233/* The following defines 8 functions for writing to a 64bit address. Each
234 takes two arguments, the address and the value to write.
235 cvmx_write64_int64 cvmx_write64_uint64
236 cvmx_write64_int32 cvmx_write64_uint32
237 cvmx_write64_int16 cvmx_write64_uint16
238 cvmx_write64_int8 cvmx_write64_uint8 */
239CVMX_BUILD_WRITE64(int64, "sd");
240CVMX_BUILD_WRITE64(int32, "sw");
241CVMX_BUILD_WRITE64(int16, "sh");
242CVMX_BUILD_WRITE64(int8, "sb");
243CVMX_BUILD_WRITE64(uint64, "sd");
244CVMX_BUILD_WRITE64(uint32, "sw");
245CVMX_BUILD_WRITE64(uint16, "sh");
246CVMX_BUILD_WRITE64(uint8, "sb");
247#define cvmx_write64 cvmx_write64_uint64
248
249/* The following defines 8 functions for reading from a 64bit address. Each
250 takes the address as the only argument
251 cvmx_read64_int64 cvmx_read64_uint64
252 cvmx_read64_int32 cvmx_read64_uint32
253 cvmx_read64_int16 cvmx_read64_uint16
254 cvmx_read64_int8 cvmx_read64_uint8 */
255CVMX_BUILD_READ64(int64, "ld");
256CVMX_BUILD_READ64(int32, "lw");
257CVMX_BUILD_READ64(int16, "lh");
258CVMX_BUILD_READ64(int8, "lb");
259CVMX_BUILD_READ64(uint64, "ld");
260CVMX_BUILD_READ64(uint32, "lw");
261CVMX_BUILD_READ64(uint16, "lhu");
262CVMX_BUILD_READ64(uint8, "lbu");
263#define cvmx_read64 cvmx_read64_uint64
264
265
266static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val)
267{
268 cvmx_write64(csr_addr, val);
269
270 /*
271 * Perform an immediate read after every write to an RSL
272 * register to force the write to complete. It doesn't matter
273 * what RSL read we do, so we choose CVMX_MIO_BOOT_BIST_STAT
274 * because it is fast and harmless.
275 */
276 if (((csr_addr >> 40) & 0x7ffff) == (0x118))
277 cvmx_read64(CVMX_MIO_BOOT_BIST_STAT);
278}
279
280static inline void cvmx_writeq_csr(void __iomem *csr_addr, uint64_t val)
281{
282 cvmx_write_csr((__force uint64_t)csr_addr, val);
283}
284
285static inline void cvmx_write_io(uint64_t io_addr, uint64_t val)
286{
287 cvmx_write64(io_addr, val);
288
289}
290
291static inline uint64_t cvmx_read_csr(uint64_t csr_addr)
292{
293 uint64_t val = cvmx_read64(csr_addr);
294 return val;
295}
296
297static inline uint64_t cvmx_readq_csr(void __iomem *csr_addr)
298{
299 return cvmx_read_csr((__force uint64_t) csr_addr);
300}
301
302static inline void cvmx_send_single(uint64_t data)
303{
304 const uint64_t CVMX_IOBDMA_SENDSINGLE = 0xffffffffffffa200ull;
305 cvmx_write64(CVMX_IOBDMA_SENDSINGLE, data);
306}
307
308static inline void cvmx_read_csr_async(uint64_t scraddr, uint64_t csr_addr)
309{
310 union {
311 uint64_t u64;
312 struct {
313 uint64_t scraddr:8;
314 uint64_t len:8;
315 uint64_t addr:48;
316 } s;
317 } addr;
318 addr.u64 = csr_addr;
319 addr.s.scraddr = scraddr >> 3;
320 addr.s.len = 1;
321 cvmx_send_single(addr.u64);
322}
323
324/* Return true if Octeon is CN38XX pass 1 */
325static inline int cvmx_octeon_is_pass1(void)
326{
327#if OCTEON_IS_COMMON_BINARY()
328 return 0; /* Pass 1 isn't supported for common binaries */
329#else
330/* Now that we know we're built for a specific model, only check CN38XX */
331#if OCTEON_IS_MODEL(OCTEON_CN38XX)
332 return cvmx_get_proc_id() == OCTEON_CN38XX_PASS1;
333#else
334 return 0; /* Built for non CN38XX chip, we're not CN38XX pass1 */
335#endif
336#endif
337}
338
339static inline unsigned int cvmx_get_core_num(void)
340{
341 unsigned int core_num;
342 CVMX_RDHWRNV(core_num, 0);
343 return core_num;
344}
345
346/* Maximum # of bits to define core in node */
347#define CVMX_NODE_NO_SHIFT 7
348#define CVMX_NODE_MASK 0x3
349static inline unsigned int cvmx_get_node_num(void)
350{
351 unsigned int core_num = cvmx_get_core_num();
352
353 return (core_num >> CVMX_NODE_NO_SHIFT) & CVMX_NODE_MASK;
354}
355
356static inline unsigned int cvmx_get_local_core_num(void)
357{
358 return cvmx_get_core_num() & ((1 << CVMX_NODE_NO_SHIFT) - 1);
359}
360
361#define CVMX_NODE_BITS (2) /* Number of bits to define a node */
362#define CVMX_MAX_NODES (1 << CVMX_NODE_BITS)
363#define CVMX_NODE_IO_SHIFT (36)
364#define CVMX_NODE_MEM_SHIFT (40)
365#define CVMX_NODE_IO_MASK ((uint64_t)CVMX_NODE_MASK << CVMX_NODE_IO_SHIFT)
366
367static inline void cvmx_write_csr_node(uint64_t node, uint64_t csr_addr,
368 uint64_t val)
369{
370 uint64_t composite_csr_addr, node_addr;
371
372 node_addr = (node & CVMX_NODE_MASK) << CVMX_NODE_IO_SHIFT;
373 composite_csr_addr = (csr_addr & ~CVMX_NODE_IO_MASK) | node_addr;
374
375 cvmx_write64_uint64(composite_csr_addr, val);
376 if (((csr_addr >> 40) & 0x7ffff) == (0x118))
377 cvmx_read64_uint64(CVMX_MIO_BOOT_BIST_STAT | node_addr);
378}
379
380static inline uint64_t cvmx_read_csr_node(uint64_t node, uint64_t csr_addr)
381{
382 uint64_t node_addr;
383
384 node_addr = (csr_addr & ~CVMX_NODE_IO_MASK) |
385 (node & CVMX_NODE_MASK) << CVMX_NODE_IO_SHIFT;
386 return cvmx_read_csr(node_addr);
387}
388
389/**
390 * Returns the number of bits set in the provided value.
391 * Simple wrapper for POP instruction.
392 *
393 * @val: 32 bit value to count set bits in
394 *
395 * Returns Number of bits set
396 */
397static inline uint32_t cvmx_pop(uint32_t val)
398{
399 uint32_t pop;
400 CVMX_POP(pop, val);
401 return pop;
402}
403
404/**
405 * Returns the number of bits set in the provided value.
406 * Simple wrapper for DPOP instruction.
407 *
408 * @val: 64 bit value to count set bits in
409 *
410 * Returns Number of bits set
411 */
412static inline int cvmx_dpop(uint64_t val)
413{
414 int pop;
415 CVMX_DPOP(pop, val);
416 return pop;
417}
418
419/**
420 * Provide current cycle counter as a return value
421 *
422 * Returns current cycle counter
423 */
424
425static inline uint64_t cvmx_get_cycle(void)
426{
427 uint64_t cycle;
428 CVMX_RDHWR(cycle, 31);
429 return cycle;
430}
431
432/**
433 * Reads a chip global cycle counter. This counts CPU cycles since
434 * chip reset. The counter is 64 bit.
435 * This register does not exist on CN38XX pass 1 silicion
436 *
437 * Returns Global chip cycle count since chip reset.
438 */
439static inline uint64_t cvmx_get_cycle_global(void)
440{
441 if (cvmx_octeon_is_pass1())
442 return 0;
443 else
444 return cvmx_read64(CVMX_IPD_CLK_COUNT);
445}
446
447/**
448 * This macro spins on a field waiting for it to reach a value. It
449 * is common in code to need to wait for a specific field in a CSR
450 * to match a specific value. Conceptually this macro expands to:
451 *
452 * 1) read csr at "address" with a csr typedef of "type"
453 * 2) Check if ("type".s."field" "op" "value")
454 * 3) If #2 isn't true loop to #1 unless too much time has passed.
455 */
456#define CVMX_WAIT_FOR_FIELD64(address, type, field, op, value, timeout_usec)\
457 ( \
458{ \
459 int result; \
460 do { \
461 uint64_t done = cvmx_get_cycle() + (uint64_t)timeout_usec * \
462 cvmx_sysinfo_get()->cpu_clock_hz / 1000000; \
463 type c; \
464 while (1) { \
465 c.u64 = cvmx_read_csr(address); \
466 if ((c.s.field) op(value)) { \
467 result = 0; \
468 break; \
469 } else if (cvmx_get_cycle() > done) { \
470 result = -1; \
471 break; \
472 } else \
473 __delay(100); \
474 } \
475 } while (0); \
476 result; \
477})
478
479/***************************************************************************/
480
481/* Return the number of cores available in the chip */
482static inline uint32_t cvmx_octeon_num_cores(void)
483{
484 u64 ciu_fuse_reg;
485 u64 ciu_fuse;
486
487 if (OCTEON_IS_OCTEON3() && !OCTEON_IS_MODEL(OCTEON_CN70XX))
488 ciu_fuse_reg = CVMX_CIU3_FUSE;
489 else
490 ciu_fuse_reg = CVMX_CIU_FUSE;
491 ciu_fuse = cvmx_read_csr(ciu_fuse_reg);
492 return cvmx_dpop(ciu_fuse);
493}
494
495#endif /* __CVMX_H__ */
diff --git a/arch/mips/include/asm/octeon/octeon-feature.h b/arch/mips/include/asm/octeon/octeon-feature.h
new file mode 100644
index 000000000..a19ca3b27
--- /dev/null
+++ b/arch/mips/include/asm/octeon/octeon-feature.h
@@ -0,0 +1,213 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28/*
29 * File defining checks for different Octeon features.
30 */
31
32#ifndef __OCTEON_FEATURE_H__
33#define __OCTEON_FEATURE_H__
34#include <asm/octeon/cvmx-mio-defs.h>
35#include <asm/octeon/cvmx-rnm-defs.h>
36
37enum octeon_feature {
38 /* CN68XX uses port kinds for packet interface */
39 OCTEON_FEATURE_PKND,
40 /* CN68XX has different fields in word0 - word2 */
41 OCTEON_FEATURE_CN68XX_WQE,
42 /*
43 * Octeon models in the CN5XXX family and higher support
44 * atomic add instructions to memory (saa/saad).
45 */
46 OCTEON_FEATURE_SAAD,
47 /* Does this Octeon support the ZIP offload engine? */
48 OCTEON_FEATURE_ZIP,
49 OCTEON_FEATURE_DORM_CRYPTO,
50 /* Does this Octeon support PCI express? */
51 OCTEON_FEATURE_PCIE,
52 /* Does this Octeon support SRIOs */
53 OCTEON_FEATURE_SRIO,
54 /* Does this Octeon support Interlaken */
55 OCTEON_FEATURE_ILK,
56 /* Some Octeon models support internal memory for storing
57 * cryptographic keys */
58 OCTEON_FEATURE_KEY_MEMORY,
59 /* Octeon has a LED controller for banks of external LEDs */
60 OCTEON_FEATURE_LED_CONTROLLER,
61 /* Octeon has a trace buffer */
62 OCTEON_FEATURE_TRA,
63 /* Octeon has a management port */
64 OCTEON_FEATURE_MGMT_PORT,
65 /* Octeon has a raid unit */
66 OCTEON_FEATURE_RAID,
67 /* Octeon has a builtin USB */
68 OCTEON_FEATURE_USB,
69 /* Octeon IPD can run without using work queue entries */
70 OCTEON_FEATURE_NO_WPTR,
71 /* Octeon has DFA state machines */
72 OCTEON_FEATURE_DFA,
73 /* Octeon MDIO block supports clause 45 transactions for 10
74 * Gig support */
75 OCTEON_FEATURE_MDIO_CLAUSE_45,
76 /*
77 * CN52XX and CN56XX used a block named NPEI for PCIe
78 * access. Newer chips replaced this with SLI+DPI.
79 */
80 OCTEON_FEATURE_NPEI,
81 OCTEON_FEATURE_HFA,
82 OCTEON_FEATURE_DFM,
83 OCTEON_FEATURE_CIU2,
84 OCTEON_FEATURE_CIU3,
85 /* Octeon has FPA first seen on 78XX */
86 OCTEON_FEATURE_FPA3,
87 OCTEON_FEATURE_FAU,
88 OCTEON_MAX_FEATURE
89};
90
91enum octeon_feature_bits {
92 OCTEON_HAS_CRYPTO = 0x0001, /* Crypto acceleration using COP2 */
93};
94extern enum octeon_feature_bits __octeon_feature_bits;
95
96/**
97 * octeon_has_crypto() - Check if this OCTEON has crypto acceleration support.
98 *
99 * Returns: Non-zero if the feature exists. Zero if the feature does not exist.
100 */
101static inline int octeon_has_crypto(void)
102{
103 return __octeon_feature_bits & OCTEON_HAS_CRYPTO;
104}
105
106/**
107 * Determine if the current Octeon supports a specific feature. These
108 * checks have been optimized to be fairly quick, but they should still
109 * be kept out of fast path code.
110 *
111 * @feature: Feature to check for. This should always be a constant so the
112 * compiler can remove the switch statement through optimization.
113 *
114 * Returns Non zero if the feature exists. Zero if the feature does not
115 * exist.
116 */
117static inline bool octeon_has_feature(enum octeon_feature feature)
118{
119 switch (feature) {
120 case OCTEON_FEATURE_SAAD:
121 return !OCTEON_IS_MODEL(OCTEON_CN3XXX);
122
123 case OCTEON_FEATURE_DORM_CRYPTO:
124 if (OCTEON_IS_MODEL(OCTEON_CN6XXX)) {
125 union cvmx_mio_fus_dat2 fus_2;
126 fus_2.u64 = cvmx_read_csr(CVMX_MIO_FUS_DAT2);
127 return !fus_2.s.nocrypto && !fus_2.s.nomul && fus_2.s.dorm_crypto;
128 } else {
129 return false;
130 }
131
132 case OCTEON_FEATURE_PCIE:
133 return OCTEON_IS_MODEL(OCTEON_CN56XX)
134 || OCTEON_IS_MODEL(OCTEON_CN52XX)
135 || OCTEON_IS_MODEL(OCTEON_CN6XXX)
136 || OCTEON_IS_MODEL(OCTEON_CN7XXX);
137
138 case OCTEON_FEATURE_SRIO:
139 return OCTEON_IS_MODEL(OCTEON_CN63XX)
140 || OCTEON_IS_MODEL(OCTEON_CN66XX);
141
142 case OCTEON_FEATURE_ILK:
143 return (OCTEON_IS_MODEL(OCTEON_CN68XX));
144
145 case OCTEON_FEATURE_KEY_MEMORY:
146 return OCTEON_IS_MODEL(OCTEON_CN38XX)
147 || OCTEON_IS_MODEL(OCTEON_CN58XX)
148 || OCTEON_IS_MODEL(OCTEON_CN56XX)
149 || OCTEON_IS_MODEL(OCTEON_CN6XXX);
150
151 case OCTEON_FEATURE_LED_CONTROLLER:
152 return OCTEON_IS_MODEL(OCTEON_CN38XX)
153 || OCTEON_IS_MODEL(OCTEON_CN58XX)
154 || OCTEON_IS_MODEL(OCTEON_CN56XX);
155
156 case OCTEON_FEATURE_TRA:
157 return !(OCTEON_IS_MODEL(OCTEON_CN30XX)
158 || OCTEON_IS_MODEL(OCTEON_CN50XX));
159 case OCTEON_FEATURE_MGMT_PORT:
160 return OCTEON_IS_MODEL(OCTEON_CN56XX)
161 || OCTEON_IS_MODEL(OCTEON_CN52XX)
162 || OCTEON_IS_MODEL(OCTEON_CN6XXX);
163
164 case OCTEON_FEATURE_RAID:
165 return OCTEON_IS_MODEL(OCTEON_CN56XX)
166 || OCTEON_IS_MODEL(OCTEON_CN52XX)
167 || OCTEON_IS_MODEL(OCTEON_CN6XXX);
168
169 case OCTEON_FEATURE_USB:
170 return !(OCTEON_IS_MODEL(OCTEON_CN38XX)
171 || OCTEON_IS_MODEL(OCTEON_CN58XX));
172
173 case OCTEON_FEATURE_NO_WPTR:
174 return (OCTEON_IS_MODEL(OCTEON_CN56XX)
175 || OCTEON_IS_MODEL(OCTEON_CN52XX)
176 || OCTEON_IS_MODEL(OCTEON_CN6XXX))
177 && !OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)
178 && !OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X);
179
180 case OCTEON_FEATURE_MDIO_CLAUSE_45:
181 return !(OCTEON_IS_MODEL(OCTEON_CN3XXX)
182 || OCTEON_IS_MODEL(OCTEON_CN58XX)
183 || OCTEON_IS_MODEL(OCTEON_CN50XX));
184
185 case OCTEON_FEATURE_NPEI:
186 return OCTEON_IS_MODEL(OCTEON_CN56XX)
187 || OCTEON_IS_MODEL(OCTEON_CN52XX);
188
189 case OCTEON_FEATURE_PKND:
190 return OCTEON_IS_MODEL(OCTEON_CN68XX);
191
192 case OCTEON_FEATURE_CN68XX_WQE:
193 return OCTEON_IS_MODEL(OCTEON_CN68XX);
194
195 case OCTEON_FEATURE_CIU2:
196 return OCTEON_IS_MODEL(OCTEON_CN68XX);
197 case OCTEON_FEATURE_CIU3:
198 case OCTEON_FEATURE_FPA3:
199 return OCTEON_IS_MODEL(OCTEON_CN78XX)
200 || OCTEON_IS_MODEL(OCTEON_CNF75XX)
201 || OCTEON_IS_MODEL(OCTEON_CN73XX);
202 case OCTEON_FEATURE_FAU:
203 return !(OCTEON_IS_MODEL(OCTEON_CN78XX)
204 || OCTEON_IS_MODEL(OCTEON_CNF75XX)
205 || OCTEON_IS_MODEL(OCTEON_CN73XX));
206
207 default:
208 break;
209 }
210 return false;
211}
212
213#endif /* __OCTEON_FEATURE_H__ */
diff --git a/arch/mips/include/asm/octeon/octeon-model.h b/arch/mips/include/asm/octeon/octeon-model.h
new file mode 100644
index 000000000..6c68517c2
--- /dev/null
+++ b/arch/mips/include/asm/octeon/octeon-model.h
@@ -0,0 +1,409 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2010 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27#ifndef __OCTEON_MODEL_H__
28#define __OCTEON_MODEL_H__
29
30/*
31 * The defines below should be used with the OCTEON_IS_MODEL() macro
32 * to determine what model of chip the software is running on. Models
33 * ending in 'XX' match multiple models (families), while specific
34 * models match only that model. If a pass (revision) is specified,
35 * then only that revision will be matched. Care should be taken when
36 * checking for both specific models and families that the specific
37 * models are checked for first. While these defines are similar to
38 * the processor ID, they are not intended to be used by anything
39 * other that the OCTEON_IS_MODEL framework, and the values are
40 * subject to change at anytime without notice.
41 *
42 * NOTE: only the OCTEON_IS_MODEL() macro/function and the OCTEON_CN*
43 * macros should be used outside of this file. All other macros are
44 * for internal use only, and may change without notice.
45 */
46
47#define OCTEON_FAMILY_MASK 0x00ffff00
48#define OCTEON_PRID_MASK 0x00ffffff
49
50/* Flag bits in top byte */
51/* Ignores revision in model checks */
52#define OM_IGNORE_REVISION 0x01000000
53/* Check submodels */
54#define OM_CHECK_SUBMODEL 0x02000000
55/* Match all models previous than the one specified */
56#define OM_MATCH_PREVIOUS_MODELS 0x04000000
57/* Ignores the minor revison on newer parts */
58#define OM_IGNORE_MINOR_REVISION 0x08000000
59#define OM_FLAG_MASK 0xff000000
60
61/* Match all cn5XXX Octeon models. */
62#define OM_MATCH_5XXX_FAMILY_MODELS 0x20000000
63/* Match all cn6XXX Octeon models. */
64#define OM_MATCH_6XXX_FAMILY_MODELS 0x40000000
65/* Match all cnf7XXX Octeon models. */
66#define OM_MATCH_F7XXX_FAMILY_MODELS 0x80000000
67/* Match all cn7XXX Octeon models. */
68#define OM_MATCH_7XXX_FAMILY_MODELS 0x10000000
69#define OM_MATCH_FAMILY_MODELS (OM_MATCH_5XXX_FAMILY_MODELS | \
70 OM_MATCH_6XXX_FAMILY_MODELS | \
71 OM_MATCH_F7XXX_FAMILY_MODELS | \
72 OM_MATCH_7XXX_FAMILY_MODELS)
73/*
74 * CN7XXX models with new revision encoding
75 */
76
77#define OCTEON_CNF75XX_PASS1_0 0x000d9800
78#define OCTEON_CNF75XX (OCTEON_CNF75XX_PASS1_0 | OM_IGNORE_REVISION)
79#define OCTEON_CNF75XX_PASS1_X (OCTEON_CNF75XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
80
81#define OCTEON_CN73XX_PASS1_0 0x000d9700
82#define OCTEON_CN73XX_PASS1_1 0x000d9701
83#define OCTEON_CN73XX (OCTEON_CN73XX_PASS1_0 | OM_IGNORE_REVISION)
84#define OCTEON_CN73XX_PASS1_X (OCTEON_CN73XX_PASS1_0 | \
85 OM_IGNORE_MINOR_REVISION)
86
87#define OCTEON_CN70XX_PASS1_0 0x000d9600
88#define OCTEON_CN70XX_PASS1_1 0x000d9601
89#define OCTEON_CN70XX_PASS1_2 0x000d9602
90
91#define OCTEON_CN70XX_PASS2_0 0x000d9608
92
93#define OCTEON_CN70XX (OCTEON_CN70XX_PASS1_0 | OM_IGNORE_REVISION)
94#define OCTEON_CN70XX_PASS1_X (OCTEON_CN70XX_PASS1_0 | \
95 OM_IGNORE_MINOR_REVISION)
96#define OCTEON_CN70XX_PASS2_X (OCTEON_CN70XX_PASS2_0 | \
97 OM_IGNORE_MINOR_REVISION)
98
99#define OCTEON_CN71XX OCTEON_CN70XX
100
101#define OCTEON_CN78XX_PASS1_0 0x000d9500
102#define OCTEON_CN78XX_PASS1_1 0x000d9501
103#define OCTEON_CN78XX_PASS2_0 0x000d9508
104
105#define OCTEON_CN78XX (OCTEON_CN78XX_PASS1_0 | OM_IGNORE_REVISION)
106#define OCTEON_CN78XX_PASS1_X (OCTEON_CN78XX_PASS1_0 | \
107 OM_IGNORE_MINOR_REVISION)
108#define OCTEON_CN78XX_PASS2_X (OCTEON_CN78XX_PASS2_0 | \
109 OM_IGNORE_MINOR_REVISION)
110
111#define OCTEON_CN76XX (0x000d9540 | OM_CHECK_SUBMODEL)
112
113/*
114 * CNF7XXX models with new revision encoding
115 */
116#define OCTEON_CNF71XX_PASS1_0 0x000d9400
117#define OCTEON_CNF71XX_PASS1_1 0x000d9401
118
119#define OCTEON_CNF71XX (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_REVISION)
120#define OCTEON_CNF71XX_PASS1_X (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
121
122/*
123 * CN6XXX models with new revision encoding
124 */
125#define OCTEON_CN68XX_PASS1_0 0x000d9100
126#define OCTEON_CN68XX_PASS1_1 0x000d9101
127#define OCTEON_CN68XX_PASS1_2 0x000d9102
128#define OCTEON_CN68XX_PASS2_0 0x000d9108
129#define OCTEON_CN68XX_PASS2_1 0x000d9109
130#define OCTEON_CN68XX_PASS2_2 0x000d910a
131
132#define OCTEON_CN68XX (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_REVISION)
133#define OCTEON_CN68XX_PASS1_X (OCTEON_CN68XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
134#define OCTEON_CN68XX_PASS2_X (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
135
136#define OCTEON_CN68XX_PASS1 OCTEON_CN68XX_PASS1_X
137#define OCTEON_CN68XX_PASS2 OCTEON_CN68XX_PASS2_X
138
139#define OCTEON_CN66XX_PASS1_0 0x000d9200
140#define OCTEON_CN66XX_PASS1_2 0x000d9202
141
142#define OCTEON_CN66XX (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_REVISION)
143#define OCTEON_CN66XX_PASS1_X (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
144
145#define OCTEON_CN63XX_PASS1_0 0x000d9000
146#define OCTEON_CN63XX_PASS1_1 0x000d9001
147#define OCTEON_CN63XX_PASS1_2 0x000d9002
148#define OCTEON_CN63XX_PASS2_0 0x000d9008
149#define OCTEON_CN63XX_PASS2_1 0x000d9009
150#define OCTEON_CN63XX_PASS2_2 0x000d900a
151
152#define OCTEON_CN63XX (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_REVISION)
153#define OCTEON_CN63XX_PASS1_X (OCTEON_CN63XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
154#define OCTEON_CN63XX_PASS2_X (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
155
156/* CN62XX is same as CN63XX with 1 MB cache */
157#define OCTEON_CN62XX OCTEON_CN63XX
158
159#define OCTEON_CN61XX_PASS1_0 0x000d9300
160#define OCTEON_CN61XX_PASS1_1 0x000d9301
161
162#define OCTEON_CN61XX (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_REVISION)
163#define OCTEON_CN61XX_PASS1_X (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
164
165/* CN60XX is same as CN61XX with 512 KB cache */
166#define OCTEON_CN60XX OCTEON_CN61XX
167
168/*
169 * CN5XXX models with new revision encoding
170 */
171#define OCTEON_CN58XX_PASS1_0 0x000d0300
172#define OCTEON_CN58XX_PASS1_1 0x000d0301
173#define OCTEON_CN58XX_PASS1_2 0x000d0303
174#define OCTEON_CN58XX_PASS2_0 0x000d0308
175#define OCTEON_CN58XX_PASS2_1 0x000d0309
176#define OCTEON_CN58XX_PASS2_2 0x000d030a
177#define OCTEON_CN58XX_PASS2_3 0x000d030b
178
179#define OCTEON_CN58XX (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_REVISION)
180#define OCTEON_CN58XX_PASS1_X (OCTEON_CN58XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
181#define OCTEON_CN58XX_PASS2_X (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
182#define OCTEON_CN58XX_PASS1 OCTEON_CN58XX_PASS1_X
183#define OCTEON_CN58XX_PASS2 OCTEON_CN58XX_PASS2_X
184
185#define OCTEON_CN56XX_PASS1_0 0x000d0400
186#define OCTEON_CN56XX_PASS1_1 0x000d0401
187#define OCTEON_CN56XX_PASS2_0 0x000d0408
188#define OCTEON_CN56XX_PASS2_1 0x000d0409
189
190#define OCTEON_CN56XX (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_REVISION)
191#define OCTEON_CN56XX_PASS1_X (OCTEON_CN56XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
192#define OCTEON_CN56XX_PASS2_X (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
193#define OCTEON_CN56XX_PASS1 OCTEON_CN56XX_PASS1_X
194#define OCTEON_CN56XX_PASS2 OCTEON_CN56XX_PASS2_X
195
196#define OCTEON_CN57XX OCTEON_CN56XX
197#define OCTEON_CN57XX_PASS1 OCTEON_CN56XX_PASS1
198#define OCTEON_CN57XX_PASS2 OCTEON_CN56XX_PASS2
199
200#define OCTEON_CN55XX OCTEON_CN56XX
201#define OCTEON_CN55XX_PASS1 OCTEON_CN56XX_PASS1
202#define OCTEON_CN55XX_PASS2 OCTEON_CN56XX_PASS2
203
204#define OCTEON_CN54XX OCTEON_CN56XX
205#define OCTEON_CN54XX_PASS1 OCTEON_CN56XX_PASS1
206#define OCTEON_CN54XX_PASS2 OCTEON_CN56XX_PASS2
207
208#define OCTEON_CN50XX_PASS1_0 0x000d0600
209
210#define OCTEON_CN50XX (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_REVISION)
211#define OCTEON_CN50XX_PASS1_X (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
212#define OCTEON_CN50XX_PASS1 OCTEON_CN50XX_PASS1_X
213
214/*
215 * NOTE: Octeon CN5000F model is not identifiable using the
216 * OCTEON_IS_MODEL() functions, but are treated as CN50XX.
217 */
218
219#define OCTEON_CN52XX_PASS1_0 0x000d0700
220#define OCTEON_CN52XX_PASS2_0 0x000d0708
221
222#define OCTEON_CN52XX (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_REVISION)
223#define OCTEON_CN52XX_PASS1_X (OCTEON_CN52XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
224#define OCTEON_CN52XX_PASS2_X (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
225#define OCTEON_CN52XX_PASS1 OCTEON_CN52XX_PASS1_X
226#define OCTEON_CN52XX_PASS2 OCTEON_CN52XX_PASS2_X
227
228/*
229 * CN3XXX models with old revision enconding
230 */
231#define OCTEON_CN38XX_PASS1 0x000d0000
232#define OCTEON_CN38XX_PASS2 0x000d0001
233#define OCTEON_CN38XX_PASS3 0x000d0003
234#define OCTEON_CN38XX (OCTEON_CN38XX_PASS3 | OM_IGNORE_REVISION)
235
236#define OCTEON_CN36XX OCTEON_CN38XX
237#define OCTEON_CN36XX_PASS2 OCTEON_CN38XX_PASS2
238#define OCTEON_CN36XX_PASS3 OCTEON_CN38XX_PASS3
239
240/* The OCTEON_CN31XX matches CN31XX models and the CN3020 */
241#define OCTEON_CN31XX_PASS1 0x000d0100
242#define OCTEON_CN31XX_PASS1_1 0x000d0102
243#define OCTEON_CN31XX (OCTEON_CN31XX_PASS1 | OM_IGNORE_REVISION)
244
245/*
246 * This model is only used for internal checks, it is not a valid
247 * model for the OCTEON_MODEL environment variable. This matches the
248 * CN3010 and CN3005 but NOT the CN3020.
249 */
250#define OCTEON_CN30XX_PASS1 0x000d0200
251#define OCTEON_CN30XX_PASS1_1 0x000d0202
252#define OCTEON_CN30XX (OCTEON_CN30XX_PASS1 | OM_IGNORE_REVISION)
253
254#define OCTEON_CN3005_PASS1 (0x000d0210 | OM_CHECK_SUBMODEL)
255#define OCTEON_CN3005_PASS1_0 (0x000d0210 | OM_CHECK_SUBMODEL)
256#define OCTEON_CN3005_PASS1_1 (0x000d0212 | OM_CHECK_SUBMODEL)
257#define OCTEON_CN3005 (OCTEON_CN3005_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)
258
259#define OCTEON_CN3010_PASS1 (0x000d0200 | OM_CHECK_SUBMODEL)
260#define OCTEON_CN3010_PASS1_0 (0x000d0200 | OM_CHECK_SUBMODEL)
261#define OCTEON_CN3010_PASS1_1 (0x000d0202 | OM_CHECK_SUBMODEL)
262#define OCTEON_CN3010 (OCTEON_CN3010_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)
263
264#define OCTEON_CN3020_PASS1 (0x000d0110 | OM_CHECK_SUBMODEL)
265#define OCTEON_CN3020_PASS1_0 (0x000d0110 | OM_CHECK_SUBMODEL)
266#define OCTEON_CN3020_PASS1_1 (0x000d0112 | OM_CHECK_SUBMODEL)
267#define OCTEON_CN3020 (OCTEON_CN3020_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)
268
269/*
270 * This matches the complete family of CN3xxx CPUs, and not subsequent
271 * models
272 */
273#define OCTEON_CN3XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_PREVIOUS_MODELS | OM_IGNORE_REVISION)
274#define OCTEON_CN5XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_5XXX_FAMILY_MODELS)
275#define OCTEON_CN6XXX (OCTEON_CN63XX_PASS1_0 | OM_MATCH_6XXX_FAMILY_MODELS)
276#define OCTEON_CNF7XXX (OCTEON_CNF71XX_PASS1_0 | \
277 OM_MATCH_F7XXX_FAMILY_MODELS)
278#define OCTEON_CN7XXX (OCTEON_CN78XX_PASS1_0 | \
279 OM_MATCH_7XXX_FAMILY_MODELS)
280
281/* The revision byte (low byte) has two different encodings.
282 * CN3XXX:
283 *
284 * bits
285 * <7:5>: reserved (0)
286 * <4>: alternate package
287 * <3:0>: revision
288 *
289 * CN5XXX and older models:
290 *
291 * bits
292 * <7>: reserved (0)
293 * <6>: alternate package
294 * <5:3>: major revision
295 * <2:0>: minor revision
296 *
297 */
298
299/* Masks used for the various types of model/family/revision matching */
300#define OCTEON_38XX_FAMILY_MASK 0x00ffff00
301#define OCTEON_38XX_FAMILY_REV_MASK 0x00ffff0f
302#define OCTEON_38XX_MODEL_MASK 0x00ffff10
303#define OCTEON_38XX_MODEL_REV_MASK (OCTEON_38XX_FAMILY_REV_MASK | OCTEON_38XX_MODEL_MASK)
304
305/* CN5XXX and later use different layout of bits in the revision ID field */
306#define OCTEON_58XX_FAMILY_MASK OCTEON_38XX_FAMILY_MASK
307#define OCTEON_58XX_FAMILY_REV_MASK 0x00ffff3f
308#define OCTEON_58XX_MODEL_MASK 0x00ffff40
309#define OCTEON_58XX_MODEL_REV_MASK (OCTEON_58XX_FAMILY_REV_MASK | OCTEON_58XX_MODEL_MASK)
310#define OCTEON_58XX_MODEL_MINOR_REV_MASK (OCTEON_58XX_MODEL_REV_MASK & 0x00ffff38)
311#define OCTEON_5XXX_MODEL_MASK 0x00ff0fc0
312
313static inline uint32_t cvmx_get_proc_id(void) __attribute__ ((pure));
314static inline uint64_t cvmx_read_csr(uint64_t csr_addr);
315
316#define __OCTEON_MATCH_MASK__(x, y, z) (((x) & (z)) == ((y) & (z)))
317
318/*
319 * __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model)
320 * returns true if chip_model is identical or belong to the OCTEON
321 * model group specified in arg_model.
322 */
323/* NOTE: This for internal use only! */
324#define __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model) \
325((((arg_model & OCTEON_38XX_FAMILY_MASK) < OCTEON_CN58XX_PASS1_0) && ( \
326 ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \
327 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_MASK)) || \
328 ((((arg_model) & (OM_FLAG_MASK)) == 0) \
329 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_REV_MASK)) || \
330 ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \
331 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_MASK)) || \
332 ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \
333 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_REV_MASK)) || \
334 ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \
335 && (((chip_model) & OCTEON_38XX_MODEL_MASK) < ((arg_model) & OCTEON_38XX_MODEL_MASK))) \
336 )) || \
337 (((arg_model & OCTEON_38XX_FAMILY_MASK) >= OCTEON_CN58XX_PASS1_0) && ( \
338 ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \
339 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \
340 ((((arg_model) & (OM_FLAG_MASK)) == 0) \
341 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_REV_MASK)) || \
342 ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_MINOR_REVISION) \
343 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MINOR_REV_MASK)) || \
344 ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \
345 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_MASK)) || \
346 ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \
347 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \
348 ((((arg_model) & (OM_MATCH_5XXX_FAMILY_MODELS)) == OM_MATCH_5XXX_FAMILY_MODELS) \
349 && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN58XX_PASS1_0) \
350 && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CN63XX_PASS1_0)) || \
351 ((((arg_model) & (OM_MATCH_6XXX_FAMILY_MODELS)) == OM_MATCH_6XXX_FAMILY_MODELS) \
352 && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN63XX_PASS1_0) \
353 && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CNF71XX_PASS1_0)) || \
354 ((((arg_model) & (OM_MATCH_F7XXX_FAMILY_MODELS)) == OM_MATCH_F7XXX_FAMILY_MODELS) \
355 && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CNF71XX_PASS1_0) \
356 && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CN78XX_PASS1_0)) || \
357 ((((arg_model) & (OM_MATCH_7XXX_FAMILY_MODELS)) == OM_MATCH_7XXX_FAMILY_MODELS) \
358 && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN78XX_PASS1_0)) || \
359 ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \
360 && (((chip_model) & OCTEON_58XX_MODEL_MASK) < ((arg_model) & OCTEON_58XX_MODEL_MASK))) \
361 )))
362
363/* NOTE: This for internal use only!!!!! */
364static inline int __octeon_is_model_runtime__(uint32_t model)
365{
366 uint32_t cpuid = cvmx_get_proc_id();
367
368 return __OCTEON_IS_MODEL_COMPILE__(model, cpuid);
369}
370
371/*
372 * The OCTEON_IS_MODEL macro should be used for all Octeon model checking done
373 * in a program.
374 * This should be kept runtime if at all possible and must be conditionalized
375 * with OCTEON_IS_COMMON_BINARY() if runtime checking support is required.
376 *
377 * Use of the macro in preprocessor directives ( #if OCTEON_IS_MODEL(...) )
378 * is NOT SUPPORTED, and should be replaced with CVMX_COMPILED_FOR()
379 * I.e.:
380 * #if OCTEON_IS_MODEL(OCTEON_CN56XX) -> #if CVMX_COMPILED_FOR(OCTEON_CN56XX)
381 */
382#define OCTEON_IS_MODEL(x) __octeon_is_model_runtime__(x)
383#define OCTEON_IS_COMMON_BINARY() 1
384#undef OCTEON_MODEL
385
386#define OCTEON_IS_OCTEON1() OCTEON_IS_MODEL(OCTEON_CN3XXX)
387#define OCTEON_IS_OCTEONPLUS() OCTEON_IS_MODEL(OCTEON_CN5XXX)
388#define OCTEON_IS_OCTEON2() \
389 (OCTEON_IS_MODEL(OCTEON_CN6XXX) || OCTEON_IS_MODEL(OCTEON_CNF71XX))
390
391#define OCTEON_IS_OCTEON3() OCTEON_IS_MODEL(OCTEON_CN7XXX)
392
393#define OCTEON_IS_OCTEON1PLUS() (OCTEON_IS_OCTEON1() || OCTEON_IS_OCTEONPLUS())
394
395const char *__init octeon_model_get_string(uint32_t chip_id);
396
397/*
398 * Return the octeon family, i.e., ProcessorID of the PrID register.
399 *
400 * @return the octeon family on success, ((unint32_t)-1) on error.
401 */
402static inline uint32_t cvmx_get_octeon_family(void)
403{
404 return cvmx_get_proc_id() & OCTEON_FAMILY_MASK;
405}
406
407#include <asm/octeon/octeon-feature.h>
408
409#endif /* __OCTEON_MODEL_H__ */
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h
new file mode 100644
index 000000000..08d48f37c
--- /dev/null
+++ b/arch/mips/include/asm/octeon/octeon.h
@@ -0,0 +1,366 @@
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-2008 Cavium Networks
7 */
8#ifndef __ASM_OCTEON_OCTEON_H
9#define __ASM_OCTEON_OCTEON_H
10
11#include <asm/octeon/cvmx.h>
12#include <asm/bitfield.h>
13
14extern uint64_t octeon_bootmem_alloc_range_phys(uint64_t size,
15 uint64_t alignment,
16 uint64_t min_addr,
17 uint64_t max_addr,
18 int do_locking);
19extern void *octeon_bootmem_alloc(uint64_t size, uint64_t alignment,
20 int do_locking);
21extern void *octeon_bootmem_alloc_range(uint64_t size, uint64_t alignment,
22 uint64_t min_addr, uint64_t max_addr,
23 int do_locking);
24extern void *octeon_bootmem_alloc_named(uint64_t size, uint64_t alignment,
25 char *name);
26extern void *octeon_bootmem_alloc_named_range(uint64_t size, uint64_t min_addr,
27 uint64_t max_addr, uint64_t align,
28 char *name);
29extern void *octeon_bootmem_alloc_named_address(uint64_t size, uint64_t address,
30 char *name);
31extern int octeon_bootmem_free_named(char *name);
32extern void octeon_bootmem_lock(void);
33extern void octeon_bootmem_unlock(void);
34
35extern int octeon_is_simulation(void);
36extern int octeon_is_pci_host(void);
37extern int octeon_usb_is_ref_clk(void);
38extern uint64_t octeon_get_clock_rate(void);
39extern u64 octeon_get_io_clock_rate(void);
40extern const char *octeon_board_type_string(void);
41extern const char *octeon_get_pci_interrupts(void);
42extern int octeon_get_southbridge_interrupt(void);
43extern int octeon_get_boot_coremask(void);
44extern int octeon_get_boot_num_arguments(void);
45extern const char *octeon_get_boot_argument(int arg);
46extern void octeon_hal_setup_reserved32(void);
47extern void octeon_user_io_init(void);
48
49extern void octeon_init_cvmcount(void);
50extern void octeon_setup_delays(void);
51extern void octeon_io_clk_delay(unsigned long);
52
53#define OCTEON_ARGV_MAX_ARGS 64
54#define OCTEON_SERIAL_LEN 20
55
56struct octeon_boot_descriptor {
57#ifdef __BIG_ENDIAN_BITFIELD
58 /* Start of block referenced by assembly code - do not change! */
59 uint32_t desc_version;
60 uint32_t desc_size;
61 uint64_t stack_top;
62 uint64_t heap_base;
63 uint64_t heap_end;
64 /* Only used by bootloader */
65 uint64_t entry_point;
66 uint64_t desc_vaddr;
67 /* End of This block referenced by assembly code - do not change! */
68 uint32_t exception_base_addr;
69 uint32_t stack_size;
70 uint32_t heap_size;
71 /* Argc count for application. */
72 uint32_t argc;
73 uint32_t argv[OCTEON_ARGV_MAX_ARGS];
74
75#define BOOT_FLAG_INIT_CORE (1 << 0)
76#define OCTEON_BL_FLAG_DEBUG (1 << 1)
77#define OCTEON_BL_FLAG_NO_MAGIC (1 << 2)
78 /* If set, use uart1 for console */
79#define OCTEON_BL_FLAG_CONSOLE_UART1 (1 << 3)
80 /* If set, use PCI console */
81#define OCTEON_BL_FLAG_CONSOLE_PCI (1 << 4)
82 /* Call exit on break on serial port */
83#define OCTEON_BL_FLAG_BREAK (1 << 5)
84
85 uint32_t flags;
86 uint32_t core_mask;
87 /* DRAM size in megabyes. */
88 uint32_t dram_size;
89 /* physical address of free memory descriptor block. */
90 uint32_t phy_mem_desc_addr;
91 /* used to pass flags from app to debugger. */
92 uint32_t debugger_flags_base_addr;
93 /* CPU clock speed, in hz. */
94 uint32_t eclock_hz;
95 /* DRAM clock speed, in hz. */
96 uint32_t dclock_hz;
97 /* SPI4 clock in hz. */
98 uint32_t spi_clock_hz;
99 uint16_t board_type;
100 uint8_t board_rev_major;
101 uint8_t board_rev_minor;
102 uint16_t chip_type;
103 uint8_t chip_rev_major;
104 uint8_t chip_rev_minor;
105 char board_serial_number[OCTEON_SERIAL_LEN];
106 uint8_t mac_addr_base[6];
107 uint8_t mac_addr_count;
108 uint64_t cvmx_desc_vaddr;
109#else
110 uint32_t desc_size;
111 uint32_t desc_version;
112 uint64_t stack_top;
113 uint64_t heap_base;
114 uint64_t heap_end;
115 /* Only used by bootloader */
116 uint64_t entry_point;
117 uint64_t desc_vaddr;
118 /* End of This block referenced by assembly code - do not change! */
119 uint32_t stack_size;
120 uint32_t exception_base_addr;
121 uint32_t argc;
122 uint32_t heap_size;
123 /*
124 * Argc count for application.
125 * Warning low bit scrambled in little-endian.
126 */
127 uint32_t argv[OCTEON_ARGV_MAX_ARGS];
128
129#define BOOT_FLAG_INIT_CORE (1 << 0)
130#define OCTEON_BL_FLAG_DEBUG (1 << 1)
131#define OCTEON_BL_FLAG_NO_MAGIC (1 << 2)
132 /* If set, use uart1 for console */
133#define OCTEON_BL_FLAG_CONSOLE_UART1 (1 << 3)
134 /* If set, use PCI console */
135#define OCTEON_BL_FLAG_CONSOLE_PCI (1 << 4)
136 /* Call exit on break on serial port */
137#define OCTEON_BL_FLAG_BREAK (1 << 5)
138
139 uint32_t core_mask;
140 uint32_t flags;
141 /* physical address of free memory descriptor block. */
142 uint32_t phy_mem_desc_addr;
143 /* DRAM size in megabyes. */
144 uint32_t dram_size;
145 /* CPU clock speed, in hz. */
146 uint32_t eclock_hz;
147 /* used to pass flags from app to debugger. */
148 uint32_t debugger_flags_base_addr;
149 /* SPI4 clock in hz. */
150 uint32_t spi_clock_hz;
151 /* DRAM clock speed, in hz. */
152 uint32_t dclock_hz;
153 uint8_t chip_rev_minor;
154 uint8_t chip_rev_major;
155 uint16_t chip_type;
156 uint8_t board_rev_minor;
157 uint8_t board_rev_major;
158 uint16_t board_type;
159
160 uint64_t unused1[4]; /* Not even filled in by bootloader. */
161
162 uint64_t cvmx_desc_vaddr;
163#endif
164};
165
166union octeon_cvmemctl {
167 uint64_t u64;
168 struct {
169 /* RO 1 = BIST fail, 0 = BIST pass */
170 __BITFIELD_FIELD(uint64_t tlbbist:1,
171 /* RO 1 = BIST fail, 0 = BIST pass */
172 __BITFIELD_FIELD(uint64_t l1cbist:1,
173 /* RO 1 = BIST fail, 0 = BIST pass */
174 __BITFIELD_FIELD(uint64_t l1dbist:1,
175 /* RO 1 = BIST fail, 0 = BIST pass */
176 __BITFIELD_FIELD(uint64_t dcmbist:1,
177 /* RO 1 = BIST fail, 0 = BIST pass */
178 __BITFIELD_FIELD(uint64_t ptgbist:1,
179 /* RO 1 = BIST fail, 0 = BIST pass */
180 __BITFIELD_FIELD(uint64_t wbfbist:1,
181 /* Reserved */
182 __BITFIELD_FIELD(uint64_t reserved:17,
183 /* OCTEON II - TLB replacement policy: 0 = bitmask LRU; 1 = NLU.
184 * This field selects between the TLB replacement policies:
185 * bitmask LRU or NLU. Bitmask LRU maintains a mask of
186 * recently used TLB entries and avoids them as new entries
187 * are allocated. NLU simply guarantees that the next
188 * allocation is not the last used TLB entry. */
189 __BITFIELD_FIELD(uint64_t tlbnlu:1,
190 /* OCTEON II - Selects the bit in the counter used for
191 * releasing a PAUSE. This counter trips every 2(8+PAUSETIME)
192 * cycles. If not already released, the cnMIPS II core will
193 * always release a given PAUSE instruction within
194 * 2(8+PAUSETIME). If the counter trip happens to line up,
195 * the cnMIPS II core may release the PAUSE instantly. */
196 __BITFIELD_FIELD(uint64_t pausetime:3,
197 /* OCTEON II - This field is an extension of
198 * CvmMemCtl[DIDTTO] */
199 __BITFIELD_FIELD(uint64_t didtto2:1,
200 /* R/W If set, marked write-buffer entries time out
201 * the same as other entries; if clear, marked
202 * write-buffer entries use the maximum timeout. */
203 __BITFIELD_FIELD(uint64_t dismarkwblongto:1,
204 /* R/W If set, a merged store does not clear the
205 * write-buffer entry timeout state. */
206 __BITFIELD_FIELD(uint64_t dismrgclrwbto:1,
207 /* R/W Two bits that are the MSBs of the resultant
208 * CVMSEG LM word location for an IOBDMA. The other 8
209 * bits come from the SCRADDR field of the IOBDMA. */
210 __BITFIELD_FIELD(uint64_t iobdmascrmsb:2,
211 /* R/W If set, SYNCWS and SYNCS only order marked
212 * stores; if clear, SYNCWS and SYNCS only order
213 * unmarked stores. SYNCWSMARKED has no effect when
214 * DISSYNCWS is set. */
215 __BITFIELD_FIELD(uint64_t syncwsmarked:1,
216 /* R/W If set, SYNCWS acts as SYNCW and SYNCS acts as
217 * SYNC. */
218 __BITFIELD_FIELD(uint64_t dissyncws:1,
219 /* R/W If set, no stall happens on write buffer
220 * full. */
221 __BITFIELD_FIELD(uint64_t diswbfst:1,
222 /* R/W If set (and SX set), supervisor-level
223 * loads/stores can use XKPHYS addresses with
224 * VA<48>==0 */
225 __BITFIELD_FIELD(uint64_t xkmemenas:1,
226 /* R/W If set (and UX set), user-level loads/stores
227 * can use XKPHYS addresses with VA<48>==0 */
228 __BITFIELD_FIELD(uint64_t xkmemenau:1,
229 /* R/W If set (and SX set), supervisor-level
230 * loads/stores can use XKPHYS addresses with
231 * VA<48>==1 */
232 __BITFIELD_FIELD(uint64_t xkioenas:1,
233 /* R/W If set (and UX set), user-level loads/stores
234 * can use XKPHYS addresses with VA<48>==1 */
235 __BITFIELD_FIELD(uint64_t xkioenau:1,
236 /* R/W If set, all stores act as SYNCW (NOMERGE must
237 * be set when this is set) RW, reset to 0. */
238 __BITFIELD_FIELD(uint64_t allsyncw:1,
239 /* R/W If set, no stores merge, and all stores reach
240 * the coherent bus in order. */
241 __BITFIELD_FIELD(uint64_t nomerge:1,
242 /* R/W Selects the bit in the counter used for DID
243 * time-outs 0 = 231, 1 = 230, 2 = 229, 3 =
244 * 214. Actual time-out is between 1x and 2x this
245 * interval. For example, with DIDTTO=3, expiration
246 * interval is between 16K and 32K. */
247 __BITFIELD_FIELD(uint64_t didtto:2,
248 /* R/W If set, the (mem) CSR clock never turns off. */
249 __BITFIELD_FIELD(uint64_t csrckalwys:1,
250 /* R/W If set, mclk never turns off. */
251 __BITFIELD_FIELD(uint64_t mclkalwys:1,
252 /* R/W Selects the bit in the counter used for write
253 * buffer flush time-outs (WBFLT+11) is the bit
254 * position in an internal counter used to determine
255 * expiration. The write buffer expires between 1x and
256 * 2x this interval. For example, with WBFLT = 0, a
257 * write buffer expires between 2K and 4K cycles after
258 * the write buffer entry is allocated. */
259 __BITFIELD_FIELD(uint64_t wbfltime:3,
260 /* R/W If set, do not put Istream in the L2 cache. */
261 __BITFIELD_FIELD(uint64_t istrnol2:1,
262 /* R/W The write buffer threshold. */
263 __BITFIELD_FIELD(uint64_t wbthresh:4,
264 /* Reserved */
265 __BITFIELD_FIELD(uint64_t reserved2:2,
266 /* R/W If set, CVMSEG is available for loads/stores in
267 * kernel/debug mode. */
268 __BITFIELD_FIELD(uint64_t cvmsegenak:1,
269 /* R/W If set, CVMSEG is available for loads/stores in
270 * supervisor mode. */
271 __BITFIELD_FIELD(uint64_t cvmsegenas:1,
272 /* R/W If set, CVMSEG is available for loads/stores in
273 * user mode. */
274 __BITFIELD_FIELD(uint64_t cvmsegenau:1,
275 /* R/W Size of local memory in cache blocks, 54 (6912
276 * bytes) is max legal value. */
277 __BITFIELD_FIELD(uint64_t lmemsz:6,
278 ;)))))))))))))))))))))))))))))))))
279 } s;
280};
281
282extern void octeon_check_cpu_bist(void);
283
284int octeon_prune_device_tree(void);
285extern const char __appended_dtb;
286extern const char __dtb_octeon_3xxx_begin;
287extern const char __dtb_octeon_68xx_begin;
288
289/**
290 * Write a 32bit value to the Octeon NPI register space
291 *
292 * @address: Address to write to
293 * @val: Value to write
294 */
295static inline void octeon_npi_write32(uint64_t address, uint32_t val)
296{
297 cvmx_write64_uint32(address ^ 4, val);
298 cvmx_read64_uint32(address ^ 4);
299}
300
301#ifdef CONFIG_SMP
302void octeon_setup_smp(void);
303#else
304static inline void octeon_setup_smp(void) {}
305#endif
306
307struct irq_domain;
308struct device_node;
309struct irq_data;
310struct irq_chip;
311void octeon_ciu3_mbox_send(int cpu, unsigned int mbox);
312int octeon_irq_ciu3_xlat(struct irq_domain *d,
313 struct device_node *node,
314 const u32 *intspec,
315 unsigned int intsize,
316 unsigned long *out_hwirq,
317 unsigned int *out_type);
318void octeon_irq_ciu3_enable(struct irq_data *data);
319void octeon_irq_ciu3_disable(struct irq_data *data);
320void octeon_irq_ciu3_ack(struct irq_data *data);
321void octeon_irq_ciu3_mask(struct irq_data *data);
322void octeon_irq_ciu3_mask_ack(struct irq_data *data);
323int octeon_irq_ciu3_mapx(struct irq_domain *d, unsigned int virq,
324 irq_hw_number_t hw, struct irq_chip *chip);
325
326/* Octeon multiplier save/restore routines from octeon_switch.S */
327void octeon_mult_save(void);
328void octeon_mult_restore(void);
329void octeon_mult_save_end(void);
330void octeon_mult_restore_end(void);
331void octeon_mult_save3(void);
332void octeon_mult_save3_end(void);
333void octeon_mult_save2(void);
334void octeon_mult_save2_end(void);
335void octeon_mult_restore3(void);
336void octeon_mult_restore3_end(void);
337void octeon_mult_restore2(void);
338void octeon_mult_restore2_end(void);
339
340/**
341 * Read a 32bit value from the Octeon NPI register space
342 *
343 * @address: Address to read
344 * Returns The result
345 */
346static inline uint32_t octeon_npi_read32(uint64_t address)
347{
348 return cvmx_read64_uint32(address ^ 4);
349}
350
351extern struct cvmx_bootinfo *octeon_bootinfo;
352
353extern uint64_t octeon_bootloader_entry_addr;
354
355extern void (*octeon_irq_setup_secondary)(void);
356
357typedef void (*octeon_irq_ip4_handler_t)(void);
358void octeon_irq_set_ip4_handler(octeon_irq_ip4_handler_t);
359
360extern void octeon_fixup_irqs(void);
361
362extern struct semaphore octeon_bootbus_sem;
363
364struct irq_domain *octeon_irq_get_block_domain(int node, uint8_t block);
365
366#endif /* __ASM_OCTEON_OCTEON_H */
diff --git a/arch/mips/include/asm/octeon/pci-octeon.h b/arch/mips/include/asm/octeon/pci-octeon.h
new file mode 100644
index 000000000..b12d9a3fb
--- /dev/null
+++ b/arch/mips/include/asm/octeon/pci-octeon.h
@@ -0,0 +1,69 @@
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-2009 Cavium Networks
7 */
8
9#ifndef __PCI_OCTEON_H__
10#define __PCI_OCTEON_H__
11
12#include <linux/pci.h>
13
14/*
15 * The physical memory base mapped by BAR1. 256MB at the end of the
16 * first 4GB.
17 */
18#define CVMX_PCIE_BAR1_PHYS_BASE ((1ull << 32) - (1ull << 28))
19#define CVMX_PCIE_BAR1_PHYS_SIZE (1ull << 28)
20
21/*
22 * The RC base of BAR1. gen1 has a 39-bit BAR2, gen2 has 41-bit BAR2,
23 * place BAR1 so it is the same for both.
24 */
25#define CVMX_PCIE_BAR1_RC_BASE (1ull << 41)
26
27/*
28 * pcibios_map_irq() is defined inside pci-octeon.c. All it does is
29 * call the Octeon specific version pointed to by this variable. This
30 * function needs to change for PCI or PCIe based hosts.
31 */
32extern int (*octeon_pcibios_map_irq)(const struct pci_dev *dev,
33 u8 slot, u8 pin);
34
35/*
36 * For PCI (not PCIe) the BAR2 base address.
37 */
38#define OCTEON_BAR2_PCI_ADDRESS 0x8000000000ull
39
40/*
41 * For PCI (not PCIe) the base of the memory mapped by BAR1
42 */
43extern u64 octeon_bar1_pci_phys;
44
45/*
46 * The following defines are used when octeon_dma_bar_type =
47 * OCTEON_DMA_BAR_TYPE_BIG
48 */
49#define OCTEON_PCI_BAR1_HOLE_BITS 5
50#define OCTEON_PCI_BAR1_HOLE_SIZE (1ul<<(OCTEON_PCI_BAR1_HOLE_BITS+3))
51
52enum octeon_dma_bar_type {
53 OCTEON_DMA_BAR_TYPE_INVALID,
54 OCTEON_DMA_BAR_TYPE_SMALL,
55 OCTEON_DMA_BAR_TYPE_BIG,
56 OCTEON_DMA_BAR_TYPE_PCIE,
57 OCTEON_DMA_BAR_TYPE_PCIE2
58};
59
60/*
61 * This tells the DMA mapping system in dma-octeon.c how to map PCI
62 * DMA addresses.
63 */
64extern enum octeon_dma_bar_type octeon_dma_bar_type;
65
66void octeon_pci_dma_init(void);
67extern char *octeon_swiotlb;
68
69#endif
diff --git a/arch/mips/include/asm/paccess.h b/arch/mips/include/asm/paccess.h
new file mode 100644
index 000000000..af81ab0da
--- /dev/null
+++ b/arch/mips/include/asm/paccess.h
@@ -0,0 +1,114 @@
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-existent memory or
11 * devices.
12 */
13#ifndef _ASM_PACCESS_H
14#define _ASM_PACCESS_H
15
16#include <linux/errno.h>
17
18#ifdef CONFIG_32BIT
19#define __PA_ADDR ".word"
20#endif
21#ifdef CONFIG_64BIT
22#define __PA_ADDR ".dword"
23#endif
24
25extern asmlinkage void handle_ibe(void);
26extern asmlinkage void handle_dbe(void);
27
28#define put_dbe(x, ptr) __put_dbe((x), (ptr), sizeof(*(ptr)))
29#define get_dbe(x, ptr) __get_dbe((x), (ptr), sizeof(*(ptr)))
30
31struct __large_pstruct { unsigned long buf[100]; };
32#define __mp(x) (*(struct __large_pstruct *)(x))
33
34#define __get_dbe(x, ptr, size) \
35({ \
36 long __gu_err; \
37 __typeof__(*(ptr)) __gu_val; \
38 unsigned long __gu_addr; \
39 __asm__("":"=r" (__gu_val)); \
40 __gu_addr = (unsigned long) (ptr); \
41 __asm__("":"=r" (__gu_err)); \
42 switch (size) { \
43 case 1: __get_dbe_asm("lb"); break; \
44 case 2: __get_dbe_asm("lh"); break; \
45 case 4: __get_dbe_asm("lw"); break; \
46 case 8: __get_dbe_asm("ld"); break; \
47 default: __get_dbe_unknown(); break; \
48 } \
49 x = (__typeof__(*(ptr))) __gu_val; \
50 __gu_err; \
51})
52
53#define __get_dbe_asm(insn) \
54{ \
55 __asm__ __volatile__( \
56 "1:\t" insn "\t%1,%2\n\t" \
57 "move\t%0,$0\n" \
58 "2:\n\t" \
59 ".insn\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 ".insn\n\t" \
99 ".section\t.fixup,\"ax\"\n" \
100 "3:\tli\t%0,%3\n\t" \
101 "j\t2b\n\t" \
102 ".previous\n\t" \
103 ".section\t__dbe_table,\"a\"\n\t" \
104 __PA_ADDR "\t1b, 3b\n\t" \
105 ".previous" \
106 : "=r" (__pu_err) \
107 : "r" (__pu_val), "o" (__mp(__pu_addr)), "i" (-EFAULT)); \
108}
109
110extern void __put_dbe_unknown(void);
111
112extern unsigned long search_dbe_table(unsigned long addr);
113
114#endif /* _ASM_PACCESS_H */
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
new file mode 100644
index 000000000..6a77bc4a6
--- /dev/null
+++ b/arch/mips/include/asm/page.h
@@ -0,0 +1,261 @@
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 <spaces.h>
13#include <linux/const.h>
14#include <linux/kernel.h>
15#include <asm/mipsregs.h>
16
17/*
18 * PAGE_SHIFT determines the page size
19 */
20#ifdef CONFIG_PAGE_SIZE_4KB
21#define PAGE_SHIFT 12
22#endif
23#ifdef CONFIG_PAGE_SIZE_8KB
24#define PAGE_SHIFT 13
25#endif
26#ifdef CONFIG_PAGE_SIZE_16KB
27#define PAGE_SHIFT 14
28#endif
29#ifdef CONFIG_PAGE_SIZE_32KB
30#define PAGE_SHIFT 15
31#endif
32#ifdef CONFIG_PAGE_SIZE_64KB
33#define PAGE_SHIFT 16
34#endif
35#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
36#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
37
38/*
39 * This is used for calculating the real page sizes
40 * for FTLB or VTLB + FTLB configurations.
41 */
42static inline unsigned int page_size_ftlb(unsigned int mmuextdef)
43{
44 switch (mmuextdef) {
45 case MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT:
46 if (PAGE_SIZE == (1 << 30))
47 return 5;
48 if (PAGE_SIZE == (1llu << 32))
49 return 6;
50 if (PAGE_SIZE > (256 << 10))
51 return 7; /* reserved */
52 fallthrough;
53 case MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT:
54 return (PAGE_SHIFT - 10) / 2;
55 default:
56 panic("Invalid FTLB configuration with Conf4_mmuextdef=%d value\n",
57 mmuextdef >> 14);
58 }
59}
60
61#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
62#define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3)
63#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
64#define HPAGE_MASK (~(HPAGE_SIZE - 1))
65#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
66#else /* !CONFIG_MIPS_HUGE_TLB_SUPPORT */
67#define HPAGE_SHIFT ({BUILD_BUG(); 0; })
68#define HPAGE_SIZE ({BUILD_BUG(); 0; })
69#define HPAGE_MASK ({BUILD_BUG(); 0; })
70#define HUGETLB_PAGE_ORDER ({BUILD_BUG(); 0; })
71#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
72
73#include <linux/pfn.h>
74
75extern void build_clear_page(void);
76extern void build_copy_page(void);
77
78/*
79 * It's normally defined only for FLATMEM config but it's
80 * used in our early mem init code for all memory models.
81 * So always define it.
82 */
83#ifdef CONFIG_MIPS_AUTO_PFN_OFFSET
84extern unsigned long ARCH_PFN_OFFSET;
85# define ARCH_PFN_OFFSET ARCH_PFN_OFFSET
86#else
87# define ARCH_PFN_OFFSET PFN_UP(PHYS_OFFSET)
88#endif
89
90extern void clear_page(void * page);
91extern void copy_page(void * to, void * from);
92
93extern unsigned long shm_align_mask;
94
95static inline unsigned long pages_do_alias(unsigned long addr1,
96 unsigned long addr2)
97{
98 return (addr1 ^ addr2) & shm_align_mask;
99}
100
101struct page;
102
103static inline void clear_user_page(void *addr, unsigned long vaddr,
104 struct page *page)
105{
106 extern void (*flush_data_cache_page)(unsigned long addr);
107
108 clear_page(addr);
109 if (pages_do_alias((unsigned long) addr, vaddr & PAGE_MASK))
110 flush_data_cache_page((unsigned long)addr);
111}
112
113struct vm_area_struct;
114extern void copy_user_highpage(struct page *to, struct page *from,
115 unsigned long vaddr, struct vm_area_struct *vma);
116
117#define __HAVE_ARCH_COPY_USER_HIGHPAGE
118
119/*
120 * These are used to make use of C type-checking..
121 */
122#ifdef CONFIG_PHYS_ADDR_T_64BIT
123 #ifdef CONFIG_CPU_MIPS32
124 typedef struct { unsigned long pte_low, pte_high; } pte_t;
125 #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
126 #define __pte(x) ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
127 #else
128 typedef struct { unsigned long long pte; } pte_t;
129 #define pte_val(x) ((x).pte)
130 #define __pte(x) ((pte_t) { (x) } )
131 #endif
132#else
133typedef struct { unsigned long pte; } pte_t;
134#define pte_val(x) ((x).pte)
135#define __pte(x) ((pte_t) { (x) } )
136#endif
137typedef struct page *pgtable_t;
138
139/*
140 * Right now we don't support 4-level pagetables, so all pud-related
141 * definitions come from <asm-generic/pgtable-nopud.h>.
142 */
143
144/*
145 * Finall the top of the hierarchy, the pgd
146 */
147typedef struct { unsigned long pgd; } pgd_t;
148#define pgd_val(x) ((x).pgd)
149#define __pgd(x) ((pgd_t) { (x) } )
150
151/*
152 * Manipulate page protection bits
153 */
154typedef struct { unsigned long pgprot; } pgprot_t;
155#define pgprot_val(x) ((x).pgprot)
156#define __pgprot(x) ((pgprot_t) { (x) } )
157#define pte_pgprot(x) __pgprot(pte_val(x) & ~_PFN_MASK)
158
159/*
160 * On R4000-style MMUs where a TLB entry is mapping a adjacent even / odd
161 * pair of pages we only have a single global bit per pair of pages. When
162 * writing to the TLB make sure we always have the bit set for both pages
163 * or none. This macro is used to access the `buddy' of the pte we're just
164 * working on.
165 */
166#define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
167
168/*
169 * __pa()/__va() should be used only during mem init.
170 */
171static inline unsigned long ___pa(unsigned long x)
172{
173 if (IS_ENABLED(CONFIG_64BIT)) {
174 /*
175 * For MIPS64 the virtual address may either be in one of
176 * the compatibility segements ckseg0 or ckseg1, or it may
177 * be in xkphys.
178 */
179 return x < CKSEG0 ? XPHYSADDR(x) : CPHYSADDR(x);
180 }
181
182 if (!IS_ENABLED(CONFIG_EVA)) {
183 /*
184 * We're using the standard MIPS32 legacy memory map, ie.
185 * the address x is going to be in kseg0 or kseg1. We can
186 * handle either case by masking out the desired bits using
187 * CPHYSADDR.
188 */
189 return CPHYSADDR(x);
190 }
191
192 /*
193 * EVA is in use so the memory map could be anything, making it not
194 * safe to just mask out bits.
195 */
196 return x - PAGE_OFFSET + PHYS_OFFSET;
197}
198#define __pa(x) ___pa((unsigned long)(x))
199#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
200#include <asm/io.h>
201
202/*
203 * RELOC_HIDE was originally added by 6007b903dfe5f1d13e0c711ac2894bdd4a61b1ad
204 * (lmo) rsp. 8431fd094d625b94d364fe393076ccef88e6ce18 (kernel.org). The
205 * discussion can be found in lkml posting
206 * <a2ebde260608230500o3407b108hc03debb9da6e62c@mail.gmail.com> which is
207 * archived at http://lists.linuxcoding.com/kernel/2006-q3/msg17360.html
208 *
209 * It is unclear if the misscompilations mentioned in
210 * http://lkml.org/lkml/2010/8/8/138 also affect MIPS so we keep this one
211 * until GCC 3.x has been retired before we can apply
212 * https://patchwork.linux-mips.org/patch/1541/
213 */
214
215#ifndef __pa_symbol
216#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
217#endif
218
219#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
220
221#ifdef CONFIG_FLATMEM
222
223static inline int pfn_valid(unsigned long pfn)
224{
225 /* avoid <linux/mm.h> include hell */
226 extern unsigned long max_mapnr;
227 unsigned long pfn_offset = ARCH_PFN_OFFSET;
228
229 return pfn >= pfn_offset && pfn < max_mapnr;
230}
231
232#elif defined(CONFIG_SPARSEMEM)
233
234/* pfn_valid is defined in linux/mmzone.h */
235
236#elif defined(CONFIG_NEED_MULTIPLE_NODES)
237
238#define pfn_valid(pfn) \
239({ \
240 unsigned long __pfn = (pfn); \
241 int __n = pfn_to_nid(__pfn); \
242 ((__n >= 0) ? (__pfn < NODE_DATA(__n)->node_start_pfn + \
243 NODE_DATA(__n)->node_spanned_pages) \
244 : 0); \
245})
246
247#endif
248
249#define virt_to_pfn(kaddr) PFN_DOWN(virt_to_phys((void *)(kaddr)))
250#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))
251
252extern bool __virt_addr_valid(const volatile void *kaddr);
253#define virt_addr_valid(kaddr) \
254 __virt_addr_valid((const volatile void *) (kaddr))
255
256#define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC
257
258#include <asm-generic/memory_model.h>
259#include <asm-generic/getorder.h>
260
261#endif /* _ASM_PAGE_H */
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
new file mode 100644
index 000000000..6f4864920
--- /dev/null
+++ b/arch/mips/include/asm/pci.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#ifndef _ASM_PCI_H
7#define _ASM_PCI_H
8
9#include <linux/mm.h>
10
11#ifdef __KERNEL__
12
13/*
14 * This file essentially defines the interface between board
15 * specific PCI code and MIPS common PCI code. Should potentially put
16 * into include/asm/pci.h file.
17 */
18
19#include <linux/ioport.h>
20#include <linux/list.h>
21#include <linux/of.h>
22
23#ifdef CONFIG_PCI_DRIVERS_LEGACY
24
25/*
26 * Each pci channel is a top-level PCI bus seem by CPU. A machine with
27 * multiple PCI channels may have multiple PCI host controllers or a
28 * single controller supporting multiple channels.
29 */
30struct pci_controller {
31 struct list_head list;
32 struct pci_bus *bus;
33 struct device_node *of_node;
34
35 struct pci_ops *pci_ops;
36 struct resource *mem_resource;
37 unsigned long mem_offset;
38 struct resource *io_resource;
39 unsigned long io_offset;
40 unsigned long io_map_base;
41 struct resource *busn_resource;
42
43#ifndef CONFIG_PCI_DOMAINS_GENERIC
44 unsigned int index;
45 /* For compatibility with current (as of July 2003) pciutils
46 and XFree86. Eventually will be removed. */
47 unsigned int need_domain_info;
48#endif
49
50 /* Optional access methods for reading/writing the bus number
51 of the PCI controller */
52 int (*get_busno)(void);
53 void (*set_busno)(int busno);
54};
55
56/*
57 * Used by boards to register their PCI busses before the actual scanning.
58 */
59extern void register_pci_controller(struct pci_controller *hose);
60
61/*
62 * board supplied pci irq fixup routine
63 */
64extern int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
65
66/* Do platform specific device initialization at pci_enable_device() time */
67extern int pcibios_plat_dev_init(struct pci_dev *dev);
68
69extern char * (*pcibios_plat_setup)(char *str);
70
71#ifdef CONFIG_OF
72/* this function parses memory ranges from a device node */
73extern void pci_load_of_ranges(struct pci_controller *hose,
74 struct device_node *node);
75#else
76static inline void pci_load_of_ranges(struct pci_controller *hose,
77 struct device_node *node) {}
78#endif
79
80#ifdef CONFIG_PCI_DOMAINS_GENERIC
81static inline void set_pci_need_domain_info(struct pci_controller *hose,
82 int need_domain_info)
83{
84 /* nothing to do */
85}
86#elif defined(CONFIG_PCI_DOMAINS)
87static inline void set_pci_need_domain_info(struct pci_controller *hose,
88 int need_domain_info)
89{
90 hose->need_domain_info = need_domain_info;
91}
92#endif /* CONFIG_PCI_DOMAINS */
93
94#endif
95
96/* Can be used to override the logic in pci_scan_bus for skipping
97 already-configured bus numbers - to be used for buggy BIOSes
98 or architectures with incomplete PCI setup by the loader */
99static inline unsigned int pcibios_assign_all_busses(void)
100{
101 return 1;
102}
103
104extern unsigned long PCIBIOS_MIN_IO;
105extern unsigned long PCIBIOS_MIN_MEM;
106
107#define PCIBIOS_MIN_CARDBUS_IO 0x4000
108
109#define HAVE_PCI_MMAP
110#define ARCH_GENERIC_PCI_MMAP_RESOURCE
111
112/*
113 * Dynamic DMA mapping stuff.
114 * MIPS has everything mapped statically.
115 */
116
117#include <linux/types.h>
118#include <linux/slab.h>
119#include <linux/scatterlist.h>
120#include <linux/string.h>
121#include <asm/io.h>
122
123#ifdef CONFIG_PCI_DOMAINS_GENERIC
124static inline int pci_proc_domain(struct pci_bus *bus)
125{
126 return pci_domain_nr(bus);
127}
128#elif defined(CONFIG_PCI_DOMAINS)
129#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
130
131static inline int pci_proc_domain(struct pci_bus *bus)
132{
133 struct pci_controller *hose = bus->sysdata;
134 return hose->need_domain_info;
135}
136#endif /* CONFIG_PCI_DOMAINS */
137
138#endif /* __KERNEL__ */
139
140/* Do platform specific device initialization at pci_enable_device() time */
141extern int pcibios_plat_dev_init(struct pci_dev *dev);
142
143/* Chances are this interrupt is wired PC-style ... */
144static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
145{
146 return channel ? 15 : 14;
147}
148
149#endif /* _ASM_PCI_H */
diff --git a/arch/mips/include/asm/pci/bridge.h b/arch/mips/include/asm/pci/bridge.h
new file mode 100644
index 000000000..9c476a040
--- /dev/null
+++ b/arch/mips/include/asm/pci/bridge.h
@@ -0,0 +1,825 @@
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#include <asm/sn/types.h>
19
20/* I/O page size */
21
22#define IOPFNSHIFT 12 /* 4K per mapped page */
23
24#define IOPGSIZE (1 << IOPFNSHIFT)
25#define IOPG(x) ((x) >> IOPFNSHIFT)
26#define IOPGOFF(x) ((x) & (IOPGSIZE-1))
27
28/* Bridge RAM sizes */
29
30#define BRIDGE_ATE_RAM_SIZE 0x00000400 /* 1kB ATE RAM */
31
32#define BRIDGE_CONFIG_BASE 0x20000
33#define BRIDGE_CONFIG1_BASE 0x28000
34#define BRIDGE_CONFIG_END 0x30000
35#define BRIDGE_CONFIG_SLOT_SIZE 0x1000
36
37#define BRIDGE_SSRAM_512K 0x00080000 /* 512kB */
38#define BRIDGE_SSRAM_128K 0x00020000 /* 128kB */
39#define BRIDGE_SSRAM_64K 0x00010000 /* 64kB */
40#define BRIDGE_SSRAM_0K 0x00000000 /* 0kB */
41
42/* ========================================================================
43 * Bridge address map
44 */
45
46#ifndef __ASSEMBLY__
47
48#define ATE_V 0x01
49#define ATE_CO 0x02
50#define ATE_PREC 0x04
51#define ATE_PREF 0x08
52#define ATE_BAR 0x10
53
54#define ATE_PFNSHIFT 12
55#define ATE_TIDSHIFT 8
56#define ATE_RMFSHIFT 48
57
58#define mkate(xaddr, xid, attr) (((xaddr) & 0x0000fffffffff000ULL) | \
59 ((xid)<<ATE_TIDSHIFT) | \
60 (attr))
61
62#define BRIDGE_INTERNAL_ATES 128
63
64/*
65 * It is generally preferred that hardware registers on the bridge
66 * are located from C code via this structure.
67 *
68 * Generated from Bridge spec dated 04oct95
69 */
70
71struct bridge_regs {
72 /* Local Registers 0x000000-0x00FFFF */
73
74 /* standard widget configuration 0x000000-0x000057 */
75 widget_cfg_t b_widget; /* 0x000000 */
76
77 /* helper fieldnames for accessing bridge widget */
78
79#define b_wid_id b_widget.w_id
80#define b_wid_stat b_widget.w_status
81#define b_wid_err_upper b_widget.w_err_upper_addr
82#define b_wid_err_lower b_widget.w_err_lower_addr
83#define b_wid_control b_widget.w_control
84#define b_wid_req_timeout b_widget.w_req_timeout
85#define b_wid_int_upper b_widget.w_intdest_upper_addr
86#define b_wid_int_lower b_widget.w_intdest_lower_addr
87#define b_wid_err_cmdword b_widget.w_err_cmd_word
88#define b_wid_llp b_widget.w_llp_cfg
89#define b_wid_tflush b_widget.w_tflush
90
91 /* bridge-specific widget configuration 0x000058-0x00007F */
92 u32 _pad_000058;
93 u32 b_wid_aux_err; /* 0x00005C */
94 u32 _pad_000060;
95 u32 b_wid_resp_upper; /* 0x000064 */
96 u32 _pad_000068;
97 u32 b_wid_resp_lower; /* 0x00006C */
98 u32 _pad_000070;
99 u32 b_wid_tst_pin_ctrl; /* 0x000074 */
100 u32 _pad_000078[2];
101
102 /* PMU & Map 0x000080-0x00008F */
103 u32 _pad_000080;
104 u32 b_dir_map; /* 0x000084 */
105 u32 _pad_000088[2];
106
107 /* SSRAM 0x000090-0x00009F */
108 u32 _pad_000090;
109 u32 b_ram_perr; /* 0x000094 */
110 u32 _pad_000098[2];
111
112 /* Arbitration 0x0000A0-0x0000AF */
113 u32 _pad_0000A0;
114 u32 b_arb; /* 0x0000A4 */
115 u32 _pad_0000A8[2];
116
117 /* Number In A Can 0x0000B0-0x0000BF */
118 u32 _pad_0000B0;
119 u32 b_nic; /* 0x0000B4 */
120 u32 _pad_0000B8[2];
121
122 /* PCI/GIO 0x0000C0-0x0000FF */
123 u32 _pad_0000C0;
124 u32 b_bus_timeout; /* 0x0000C4 */
125#define b_pci_bus_timeout b_bus_timeout
126
127 u32 _pad_0000C8;
128 u32 b_pci_cfg; /* 0x0000CC */
129 u32 _pad_0000D0;
130 u32 b_pci_err_upper; /* 0x0000D4 */
131 u32 _pad_0000D8;
132 u32 b_pci_err_lower; /* 0x0000DC */
133 u32 _pad_0000E0[8];
134#define b_gio_err_lower b_pci_err_lower
135#define b_gio_err_upper b_pci_err_upper
136
137 /* Interrupt 0x000100-0x0001FF */
138 u32 _pad_000100;
139 u32 b_int_status; /* 0x000104 */
140 u32 _pad_000108;
141 u32 b_int_enable; /* 0x00010C */
142 u32 _pad_000110;
143 u32 b_int_rst_stat; /* 0x000114 */
144 u32 _pad_000118;
145 u32 b_int_mode; /* 0x00011C */
146 u32 _pad_000120;
147 u32 b_int_device; /* 0x000124 */
148 u32 _pad_000128;
149 u32 b_int_host_err; /* 0x00012C */
150
151 struct {
152 u32 __pad; /* 0x0001{30,,,68} */
153 u32 addr; /* 0x0001{34,,,6C} */
154 } b_int_addr[8]; /* 0x000130 */
155
156 u32 _pad_000170[36];
157
158 /* Device 0x000200-0x0003FF */
159 struct {
160 u32 __pad; /* 0x0002{00,,,38} */
161 u32 reg; /* 0x0002{04,,,3C} */
162 } b_device[8]; /* 0x000200 */
163
164 struct {
165 u32 __pad; /* 0x0002{40,,,78} */
166 u32 reg; /* 0x0002{44,,,7C} */
167 } b_wr_req_buf[8]; /* 0x000240 */
168
169 struct {
170 u32 __pad; /* 0x0002{80,,,88} */
171 u32 reg; /* 0x0002{84,,,8C} */
172 } b_rrb_map[2]; /* 0x000280 */
173#define b_even_resp b_rrb_map[0].reg /* 0x000284 */
174#define b_odd_resp b_rrb_map[1].reg /* 0x00028C */
175
176 u32 _pad_000290;
177 u32 b_resp_status; /* 0x000294 */
178 u32 _pad_000298;
179 u32 b_resp_clear; /* 0x00029C */
180
181 u32 _pad_0002A0[24];
182
183 char _pad_000300[0x10000 - 0x000300];
184
185 /* Internal Address Translation Entry RAM 0x010000-0x0103FF */
186 union {
187 u64 wr; /* write-only */
188 struct {
189 u32 _p_pad;
190 u32 rd; /* read-only */
191 } hi;
192 } b_int_ate_ram[128];
193
194 char _pad_010400[0x11000 - 0x010400];
195
196 /* Internal Address Translation Entry RAM LOW 0x011000-0x0113FF */
197 struct {
198 u32 _p_pad;
199 u32 rd; /* read-only */
200 } b_int_ate_ram_lo[128];
201
202 char _pad_011400[0x20000 - 0x011400];
203
204 /* PCI Device Configuration Spaces 0x020000-0x027FFF */
205 union { /* make all access sizes available. */
206 u8 c[0x1000 / 1];
207 u16 s[0x1000 / 2];
208 u32 l[0x1000 / 4];
209 u64 d[0x1000 / 8];
210 union {
211 u8 c[0x100 / 1];
212 u16 s[0x100 / 2];
213 u32 l[0x100 / 4];
214 u64 d[0x100 / 8];
215 } f[8];
216 } b_type0_cfg_dev[8]; /* 0x020000 */
217
218 /* PCI Type 1 Configuration Space 0x028000-0x028FFF */
219 union { /* make all access sizes available. */
220 u8 c[0x1000 / 1];
221 u16 s[0x1000 / 2];
222 u32 l[0x1000 / 4];
223 u64 d[0x1000 / 8];
224 } b_type1_cfg; /* 0x028000-0x029000 */
225
226 char _pad_029000[0x007000]; /* 0x029000-0x030000 */
227
228 /* PCI Interrupt Acknowledge Cycle 0x030000 */
229 union {
230 u8 c[8 / 1];
231 u16 s[8 / 2];
232 u32 l[8 / 4];
233 u64 d[8 / 8];
234 } b_pci_iack; /* 0x030000 */
235
236 u8 _pad_030007[0x04fff8]; /* 0x030008-0x07FFFF */
237
238 /* External Address Translation Entry RAM 0x080000-0x0FFFFF */
239 u64 b_ext_ate_ram[0x10000];
240
241 /* Reserved 0x100000-0x1FFFFF */
242 char _pad_100000[0x200000-0x100000];
243
244 /* PCI/GIO Device Spaces 0x200000-0xBFFFFF */
245 union { /* make all access sizes available. */
246 u8 c[0x100000 / 1];
247 u16 s[0x100000 / 2];
248 u32 l[0x100000 / 4];
249 u64 d[0x100000 / 8];
250 } b_devio_raw[10]; /* 0x200000 */
251
252 /* b_devio macro is a bit strange; it reflects the
253 * fact that the Bridge ASIC provides 2M for the
254 * first two DevIO windows and 1M for the other six.
255 */
256#define b_devio(n) b_devio_raw[((n)<2)?(n*2):(n+2)]
257
258 /* External Flash Proms 1,0 0xC00000-0xFFFFFF */
259 union { /* make all access sizes available. */
260 u8 c[0x400000 / 1]; /* read-only */
261 u16 s[0x400000 / 2]; /* read-write */
262 u32 l[0x400000 / 4]; /* read-only */
263 u64 d[0x400000 / 8]; /* read-only */
264 } b_external_flash; /* 0xC00000 */
265};
266
267/*
268 * Field formats for Error Command Word and Auxiliary Error Command Word
269 * of bridge.
270 */
271struct bridge_err_cmdword {
272 union {
273 u32 cmd_word;
274 struct {
275 u32 didn:4, /* Destination ID */
276 sidn:4, /* Source ID */
277 pactyp:4, /* Packet type */
278 tnum:5, /* Trans Number */
279 coh:1, /* Coh Transaction */
280 ds:2, /* Data size */
281 gbr:1, /* GBR enable */
282 vbpm:1, /* VBPM message */
283 error:1, /* Error occurred */
284 barr:1, /* Barrier op */
285 rsvd:8;
286 } berr_st;
287 } berr_un;
288};
289
290#define berr_field berr_un.berr_st
291#endif /* !__ASSEMBLY__ */
292
293/*
294 * The values of these macros can and should be crosschecked
295 * regularly against the offsets of the like-named fields
296 * within the bridge_regs structure above.
297 */
298
299/* Byte offset macros for Bridge internal registers */
300
301#define BRIDGE_WID_ID WIDGET_ID
302#define BRIDGE_WID_STAT WIDGET_STATUS
303#define BRIDGE_WID_ERR_UPPER WIDGET_ERR_UPPER_ADDR
304#define BRIDGE_WID_ERR_LOWER WIDGET_ERR_LOWER_ADDR
305#define BRIDGE_WID_CONTROL WIDGET_CONTROL
306#define BRIDGE_WID_REQ_TIMEOUT WIDGET_REQ_TIMEOUT
307#define BRIDGE_WID_INT_UPPER WIDGET_INTDEST_UPPER_ADDR
308#define BRIDGE_WID_INT_LOWER WIDGET_INTDEST_LOWER_ADDR
309#define BRIDGE_WID_ERR_CMDWORD WIDGET_ERR_CMD_WORD
310#define BRIDGE_WID_LLP WIDGET_LLP_CFG
311#define BRIDGE_WID_TFLUSH WIDGET_TFLUSH
312
313#define BRIDGE_WID_AUX_ERR 0x00005C /* Aux Error Command Word */
314#define BRIDGE_WID_RESP_UPPER 0x000064 /* Response Buf Upper Addr */
315#define BRIDGE_WID_RESP_LOWER 0x00006C /* Response Buf Lower Addr */
316#define BRIDGE_WID_TST_PIN_CTRL 0x000074 /* Test pin control */
317
318#define BRIDGE_DIR_MAP 0x000084 /* Direct Map reg */
319
320#define BRIDGE_RAM_PERR 0x000094 /* SSRAM Parity Error */
321
322#define BRIDGE_ARB 0x0000A4 /* Arbitration Priority reg */
323
324#define BRIDGE_NIC 0x0000B4 /* Number In A Can */
325
326#define BRIDGE_BUS_TIMEOUT 0x0000C4 /* Bus Timeout Register */
327#define BRIDGE_PCI_BUS_TIMEOUT BRIDGE_BUS_TIMEOUT
328#define BRIDGE_PCI_CFG 0x0000CC /* PCI Type 1 Config reg */
329#define BRIDGE_PCI_ERR_UPPER 0x0000D4 /* PCI error Upper Addr */
330#define BRIDGE_PCI_ERR_LOWER 0x0000DC /* PCI error Lower Addr */
331
332#define BRIDGE_INT_STATUS 0x000104 /* Interrupt Status */
333#define BRIDGE_INT_ENABLE 0x00010C /* Interrupt Enables */
334#define BRIDGE_INT_RST_STAT 0x000114 /* Reset Intr Status */
335#define BRIDGE_INT_MODE 0x00011C /* Interrupt Mode */
336#define BRIDGE_INT_DEVICE 0x000124 /* Interrupt Device */
337#define BRIDGE_INT_HOST_ERR 0x00012C /* Host Error Field */
338
339#define BRIDGE_INT_ADDR0 0x000134 /* Host Address Reg */
340#define BRIDGE_INT_ADDR_OFF 0x000008 /* Host Addr offset (1..7) */
341#define BRIDGE_INT_ADDR(x) (BRIDGE_INT_ADDR0+(x)*BRIDGE_INT_ADDR_OFF)
342
343#define BRIDGE_DEVICE0 0x000204 /* Device 0 */
344#define BRIDGE_DEVICE_OFF 0x000008 /* Device offset (1..7) */
345#define BRIDGE_DEVICE(x) (BRIDGE_DEVICE0+(x)*BRIDGE_DEVICE_OFF)
346
347#define BRIDGE_WR_REQ_BUF0 0x000244 /* Write Request Buffer 0 */
348#define BRIDGE_WR_REQ_BUF_OFF 0x000008 /* Buffer Offset (1..7) */
349#define BRIDGE_WR_REQ_BUF(x) (BRIDGE_WR_REQ_BUF0+(x)*BRIDGE_WR_REQ_BUF_OFF)
350
351#define BRIDGE_EVEN_RESP 0x000284 /* Even Device Response Buf */
352#define BRIDGE_ODD_RESP 0x00028C /* Odd Device Response Buf */
353
354#define BRIDGE_RESP_STATUS 0x000294 /* Read Response Status reg */
355#define BRIDGE_RESP_CLEAR 0x00029C /* Read Response Clear reg */
356
357/* Byte offset macros for Bridge I/O space */
358
359#define BRIDGE_ATE_RAM 0x00010000 /* Internal Addr Xlat Ram */
360
361#define BRIDGE_TYPE0_CFG_DEV0 0x00020000 /* Type 0 Cfg, Device 0 */
362#define BRIDGE_TYPE0_CFG_SLOT_OFF 0x00001000 /* Type 0 Cfg Slot Offset (1..7) */
363#define BRIDGE_TYPE0_CFG_FUNC_OFF 0x00000100 /* Type 0 Cfg Func Offset (1..7) */
364#define BRIDGE_TYPE0_CFG_DEV(s) (BRIDGE_TYPE0_CFG_DEV0+\
365 (s)*BRIDGE_TYPE0_CFG_SLOT_OFF)
366#define BRIDGE_TYPE0_CFG_DEVF(s, f) (BRIDGE_TYPE0_CFG_DEV0+\
367 (s)*BRIDGE_TYPE0_CFG_SLOT_OFF+\
368 (f)*BRIDGE_TYPE0_CFG_FUNC_OFF)
369
370#define BRIDGE_TYPE1_CFG 0x00028000 /* Type 1 Cfg space */
371
372#define BRIDGE_PCI_IACK 0x00030000 /* PCI Interrupt Ack */
373#define BRIDGE_EXT_SSRAM 0x00080000 /* Extern SSRAM (ATE) */
374
375/* Byte offset macros for Bridge device IO spaces */
376
377#define BRIDGE_DEV_CNT 8 /* Up to 8 devices per bridge */
378#define BRIDGE_DEVIO0 0x00200000 /* Device IO 0 Addr */
379#define BRIDGE_DEVIO1 0x00400000 /* Device IO 1 Addr */
380#define BRIDGE_DEVIO2 0x00600000 /* Device IO 2 Addr */
381#define BRIDGE_DEVIO_OFF 0x00100000 /* Device IO Offset (3..7) */
382
383#define BRIDGE_DEVIO_2MB 0x00200000 /* Device IO Offset (0..1) */
384#define BRIDGE_DEVIO_1MB 0x00100000 /* Device IO Offset (2..7) */
385
386#define BRIDGE_DEVIO(x) ((x)<=1 ? BRIDGE_DEVIO0+(x)*BRIDGE_DEVIO_2MB : BRIDGE_DEVIO2+((x)-2)*BRIDGE_DEVIO_1MB)
387
388#define BRIDGE_EXTERNAL_FLASH 0x00C00000 /* External Flash PROMS */
389
390/* ========================================================================
391 * Bridge register bit field definitions
392 */
393
394/* Widget part number of bridge */
395#define BRIDGE_WIDGET_PART_NUM 0xc002
396#define XBRIDGE_WIDGET_PART_NUM 0xd002
397
398/* Manufacturer of bridge */
399#define BRIDGE_WIDGET_MFGR_NUM 0x036
400#define XBRIDGE_WIDGET_MFGR_NUM 0x024
401
402/* Revision numbers for known Bridge revisions */
403#define BRIDGE_REV_A 0x1
404#define BRIDGE_REV_B 0x2
405#define BRIDGE_REV_C 0x3
406#define BRIDGE_REV_D 0x4
407
408/* Bridge widget status register bits definition */
409
410#define BRIDGE_STAT_LLP_REC_CNT (0xFFu << 24)
411#define BRIDGE_STAT_LLP_TX_CNT (0xFF << 16)
412#define BRIDGE_STAT_FLASH_SELECT (0x1 << 6)
413#define BRIDGE_STAT_PCI_GIO_N (0x1 << 5)
414#define BRIDGE_STAT_PENDING (0x1F << 0)
415
416/* Bridge widget control register bits definition */
417#define BRIDGE_CTRL_FLASH_WR_EN (0x1ul << 31)
418#define BRIDGE_CTRL_EN_CLK50 (0x1 << 30)
419#define BRIDGE_CTRL_EN_CLK40 (0x1 << 29)
420#define BRIDGE_CTRL_EN_CLK33 (0x1 << 28)
421#define BRIDGE_CTRL_RST(n) ((n) << 24)
422#define BRIDGE_CTRL_RST_MASK (BRIDGE_CTRL_RST(0xF))
423#define BRIDGE_CTRL_RST_PIN(x) (BRIDGE_CTRL_RST(0x1 << (x)))
424#define BRIDGE_CTRL_IO_SWAP (0x1 << 23)
425#define BRIDGE_CTRL_MEM_SWAP (0x1 << 22)
426#define BRIDGE_CTRL_PAGE_SIZE (0x1 << 21)
427#define BRIDGE_CTRL_SS_PAR_BAD (0x1 << 20)
428#define BRIDGE_CTRL_SS_PAR_EN (0x1 << 19)
429#define BRIDGE_CTRL_SSRAM_SIZE(n) ((n) << 17)
430#define BRIDGE_CTRL_SSRAM_SIZE_MASK (BRIDGE_CTRL_SSRAM_SIZE(0x3))
431#define BRIDGE_CTRL_SSRAM_512K (BRIDGE_CTRL_SSRAM_SIZE(0x3))
432#define BRIDGE_CTRL_SSRAM_128K (BRIDGE_CTRL_SSRAM_SIZE(0x2))
433#define BRIDGE_CTRL_SSRAM_64K (BRIDGE_CTRL_SSRAM_SIZE(0x1))
434#define BRIDGE_CTRL_SSRAM_1K (BRIDGE_CTRL_SSRAM_SIZE(0x0))
435#define BRIDGE_CTRL_F_BAD_PKT (0x1 << 16)
436#define BRIDGE_CTRL_LLP_XBAR_CRD(n) ((n) << 12)
437#define BRIDGE_CTRL_LLP_XBAR_CRD_MASK (BRIDGE_CTRL_LLP_XBAR_CRD(0xf))
438#define BRIDGE_CTRL_CLR_RLLP_CNT (0x1 << 11)
439#define BRIDGE_CTRL_CLR_TLLP_CNT (0x1 << 10)
440#define BRIDGE_CTRL_SYS_END (0x1 << 9)
441#define BRIDGE_CTRL_MAX_TRANS(n) ((n) << 4)
442#define BRIDGE_CTRL_MAX_TRANS_MASK (BRIDGE_CTRL_MAX_TRANS(0x1f))
443#define BRIDGE_CTRL_WIDGET_ID(n) ((n) << 0)
444#define BRIDGE_CTRL_WIDGET_ID_MASK (BRIDGE_CTRL_WIDGET_ID(0xf))
445
446/* Bridge Response buffer Error Upper Register bit fields definition */
447#define BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT (20)
448#define BRIDGE_RESP_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT)
449#define BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT (16)
450#define BRIDGE_RESP_ERRUPPR_BUFNUM_MASK (0xF << BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT)
451#define BRIDGE_RESP_ERRRUPPR_BUFMASK (0xFFFF)
452
453#define BRIDGE_RESP_ERRUPPR_BUFNUM(x) \
454 (((x) & BRIDGE_RESP_ERRUPPR_BUFNUM_MASK) >> \
455 BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT)
456
457#define BRIDGE_RESP_ERRUPPR_DEVICE(x) \
458 (((x) & BRIDGE_RESP_ERRUPPR_DEVNUM_MASK) >> \
459 BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT)
460
461/* Bridge direct mapping register bits definition */
462#define BRIDGE_DIRMAP_W_ID_SHFT 20
463#define BRIDGE_DIRMAP_W_ID (0xf << BRIDGE_DIRMAP_W_ID_SHFT)
464#define BRIDGE_DIRMAP_RMF_64 (0x1 << 18)
465#define BRIDGE_DIRMAP_ADD512 (0x1 << 17)
466#define BRIDGE_DIRMAP_OFF (0x1ffff << 0)
467#define BRIDGE_DIRMAP_OFF_ADDRSHFT (31) /* lsbit of DIRMAP_OFF is xtalk address bit 31 */
468
469/* Bridge Arbitration register bits definition */
470#define BRIDGE_ARB_REQ_WAIT_TICK(x) ((x) << 16)
471#define BRIDGE_ARB_REQ_WAIT_TICK_MASK BRIDGE_ARB_REQ_WAIT_TICK(0x3)
472#define BRIDGE_ARB_REQ_WAIT_EN(x) ((x) << 8)
473#define BRIDGE_ARB_REQ_WAIT_EN_MASK BRIDGE_ARB_REQ_WAIT_EN(0xff)
474#define BRIDGE_ARB_FREEZE_GNT (1 << 6)
475#define BRIDGE_ARB_HPRI_RING_B2 (1 << 5)
476#define BRIDGE_ARB_HPRI_RING_B1 (1 << 4)
477#define BRIDGE_ARB_HPRI_RING_B0 (1 << 3)
478#define BRIDGE_ARB_LPRI_RING_B2 (1 << 2)
479#define BRIDGE_ARB_LPRI_RING_B1 (1 << 1)
480#define BRIDGE_ARB_LPRI_RING_B0 (1 << 0)
481
482/* Bridge Bus time-out register bits definition */
483#define BRIDGE_BUS_PCI_RETRY_HLD(x) ((x) << 16)
484#define BRIDGE_BUS_PCI_RETRY_HLD_MASK BRIDGE_BUS_PCI_RETRY_HLD(0x1f)
485#define BRIDGE_BUS_GIO_TIMEOUT (1 << 12)
486#define BRIDGE_BUS_PCI_RETRY_CNT(x) ((x) << 0)
487#define BRIDGE_BUS_PCI_RETRY_MASK BRIDGE_BUS_PCI_RETRY_CNT(0x3ff)
488
489/* Bridge interrupt status register bits definition */
490#define BRIDGE_ISR_MULTI_ERR (0x1u << 31)
491#define BRIDGE_ISR_PMU_ESIZE_FAULT (0x1 << 30)
492#define BRIDGE_ISR_UNEXP_RESP (0x1 << 29)
493#define BRIDGE_ISR_BAD_XRESP_PKT (0x1 << 28)
494#define BRIDGE_ISR_BAD_XREQ_PKT (0x1 << 27)
495#define BRIDGE_ISR_RESP_XTLK_ERR (0x1 << 26)
496#define BRIDGE_ISR_REQ_XTLK_ERR (0x1 << 25)
497#define BRIDGE_ISR_INVLD_ADDR (0x1 << 24)
498#define BRIDGE_ISR_UNSUPPORTED_XOP (0x1 << 23)
499#define BRIDGE_ISR_XREQ_FIFO_OFLOW (0x1 << 22)
500#define BRIDGE_ISR_LLP_REC_SNERR (0x1 << 21)
501#define BRIDGE_ISR_LLP_REC_CBERR (0x1 << 20)
502#define BRIDGE_ISR_LLP_RCTY (0x1 << 19)
503#define BRIDGE_ISR_LLP_TX_RETRY (0x1 << 18)
504#define BRIDGE_ISR_LLP_TCTY (0x1 << 17)
505#define BRIDGE_ISR_SSRAM_PERR (0x1 << 16)
506#define BRIDGE_ISR_PCI_ABORT (0x1 << 15)
507#define BRIDGE_ISR_PCI_PARITY (0x1 << 14)
508#define BRIDGE_ISR_PCI_SERR (0x1 << 13)
509#define BRIDGE_ISR_PCI_PERR (0x1 << 12)
510#define BRIDGE_ISR_PCI_MST_TIMEOUT (0x1 << 11)
511#define BRIDGE_ISR_GIO_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT
512#define BRIDGE_ISR_PCI_RETRY_CNT (0x1 << 10)
513#define BRIDGE_ISR_XREAD_REQ_TIMEOUT (0x1 << 9)
514#define BRIDGE_ISR_GIO_B_ENBL_ERR (0x1 << 8)
515#define BRIDGE_ISR_INT_MSK (0xff << 0)
516#define BRIDGE_ISR_INT(x) (0x1 << (x))
517
518#define BRIDGE_ISR_LINK_ERROR \
519 (BRIDGE_ISR_LLP_REC_SNERR|BRIDGE_ISR_LLP_REC_CBERR| \
520 BRIDGE_ISR_LLP_RCTY|BRIDGE_ISR_LLP_TX_RETRY| \
521 BRIDGE_ISR_LLP_TCTY)
522
523#define BRIDGE_ISR_PCIBUS_PIOERR \
524 (BRIDGE_ISR_PCI_MST_TIMEOUT|BRIDGE_ISR_PCI_ABORT)
525
526#define BRIDGE_ISR_PCIBUS_ERROR \
527 (BRIDGE_ISR_PCIBUS_PIOERR|BRIDGE_ISR_PCI_PERR| \
528 BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_RETRY_CNT| \
529 BRIDGE_ISR_PCI_PARITY)
530
531#define BRIDGE_ISR_XTALK_ERROR \
532 (BRIDGE_ISR_XREAD_REQ_TIMEOUT|BRIDGE_ISR_XREQ_FIFO_OFLOW|\
533 BRIDGE_ISR_UNSUPPORTED_XOP|BRIDGE_ISR_INVLD_ADDR| \
534 BRIDGE_ISR_REQ_XTLK_ERR|BRIDGE_ISR_RESP_XTLK_ERR| \
535 BRIDGE_ISR_BAD_XREQ_PKT|BRIDGE_ISR_BAD_XRESP_PKT| \
536 BRIDGE_ISR_UNEXP_RESP)
537
538#define BRIDGE_ISR_ERRORS \
539 (BRIDGE_ISR_LINK_ERROR|BRIDGE_ISR_PCIBUS_ERROR| \
540 BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR| \
541 BRIDGE_ISR_PMU_ESIZE_FAULT)
542
543/*
544 * List of Errors which are fatal and kill the system
545 */
546#define BRIDGE_ISR_ERROR_FATAL \
547 ((BRIDGE_ISR_XTALK_ERROR & ~BRIDGE_ISR_XREAD_REQ_TIMEOUT)|\
548 BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_PARITY )
549
550#define BRIDGE_ISR_ERROR_DUMP \
551 (BRIDGE_ISR_PCIBUS_ERROR|BRIDGE_ISR_PMU_ESIZE_FAULT| \
552 BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR)
553
554/* Bridge interrupt enable register bits definition */
555#define BRIDGE_IMR_UNEXP_RESP BRIDGE_ISR_UNEXP_RESP
556#define BRIDGE_IMR_PMU_ESIZE_FAULT BRIDGE_ISR_PMU_ESIZE_FAULT
557#define BRIDGE_IMR_BAD_XRESP_PKT BRIDGE_ISR_BAD_XRESP_PKT
558#define BRIDGE_IMR_BAD_XREQ_PKT BRIDGE_ISR_BAD_XREQ_PKT
559#define BRIDGE_IMR_RESP_XTLK_ERR BRIDGE_ISR_RESP_XTLK_ERR
560#define BRIDGE_IMR_REQ_XTLK_ERR BRIDGE_ISR_REQ_XTLK_ERR
561#define BRIDGE_IMR_INVLD_ADDR BRIDGE_ISR_INVLD_ADDR
562#define BRIDGE_IMR_UNSUPPORTED_XOP BRIDGE_ISR_UNSUPPORTED_XOP
563#define BRIDGE_IMR_XREQ_FIFO_OFLOW BRIDGE_ISR_XREQ_FIFO_OFLOW
564#define BRIDGE_IMR_LLP_REC_SNERR BRIDGE_ISR_LLP_REC_SNERR
565#define BRIDGE_IMR_LLP_REC_CBERR BRIDGE_ISR_LLP_REC_CBERR
566#define BRIDGE_IMR_LLP_RCTY BRIDGE_ISR_LLP_RCTY
567#define BRIDGE_IMR_LLP_TX_RETRY BRIDGE_ISR_LLP_TX_RETRY
568#define BRIDGE_IMR_LLP_TCTY BRIDGE_ISR_LLP_TCTY
569#define BRIDGE_IMR_SSRAM_PERR BRIDGE_ISR_SSRAM_PERR
570#define BRIDGE_IMR_PCI_ABORT BRIDGE_ISR_PCI_ABORT
571#define BRIDGE_IMR_PCI_PARITY BRIDGE_ISR_PCI_PARITY
572#define BRIDGE_IMR_PCI_SERR BRIDGE_ISR_PCI_SERR
573#define BRIDGE_IMR_PCI_PERR BRIDGE_ISR_PCI_PERR
574#define BRIDGE_IMR_PCI_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT
575#define BRIDGE_IMR_GIO_MST_TIMEOUT BRIDGE_ISR_GIO_MST_TIMEOUT
576#define BRIDGE_IMR_PCI_RETRY_CNT BRIDGE_ISR_PCI_RETRY_CNT
577#define BRIDGE_IMR_XREAD_REQ_TIMEOUT BRIDGE_ISR_XREAD_REQ_TIMEOUT
578#define BRIDGE_IMR_GIO_B_ENBL_ERR BRIDGE_ISR_GIO_B_ENBL_ERR
579#define BRIDGE_IMR_INT_MSK BRIDGE_ISR_INT_MSK
580#define BRIDGE_IMR_INT(x) BRIDGE_ISR_INT(x)
581
582/* Bridge interrupt reset register bits definition */
583#define BRIDGE_IRR_MULTI_CLR (0x1 << 6)
584#define BRIDGE_IRR_CRP_GRP_CLR (0x1 << 5)
585#define BRIDGE_IRR_RESP_BUF_GRP_CLR (0x1 << 4)
586#define BRIDGE_IRR_REQ_DSP_GRP_CLR (0x1 << 3)
587#define BRIDGE_IRR_LLP_GRP_CLR (0x1 << 2)
588#define BRIDGE_IRR_SSRAM_GRP_CLR (0x1 << 1)
589#define BRIDGE_IRR_PCI_GRP_CLR (0x1 << 0)
590#define BRIDGE_IRR_GIO_GRP_CLR (0x1 << 0)
591#define BRIDGE_IRR_ALL_CLR 0x7f
592
593#define BRIDGE_IRR_CRP_GRP (BRIDGE_ISR_UNEXP_RESP | \
594 BRIDGE_ISR_XREQ_FIFO_OFLOW)
595#define BRIDGE_IRR_RESP_BUF_GRP (BRIDGE_ISR_BAD_XRESP_PKT | \
596 BRIDGE_ISR_RESP_XTLK_ERR | \
597 BRIDGE_ISR_XREAD_REQ_TIMEOUT)
598#define BRIDGE_IRR_REQ_DSP_GRP (BRIDGE_ISR_UNSUPPORTED_XOP | \
599 BRIDGE_ISR_BAD_XREQ_PKT | \
600 BRIDGE_ISR_REQ_XTLK_ERR | \
601 BRIDGE_ISR_INVLD_ADDR)
602#define BRIDGE_IRR_LLP_GRP (BRIDGE_ISR_LLP_REC_SNERR | \
603 BRIDGE_ISR_LLP_REC_CBERR | \
604 BRIDGE_ISR_LLP_RCTY | \
605 BRIDGE_ISR_LLP_TX_RETRY | \
606 BRIDGE_ISR_LLP_TCTY)
607#define BRIDGE_IRR_SSRAM_GRP (BRIDGE_ISR_SSRAM_PERR | \
608 BRIDGE_ISR_PMU_ESIZE_FAULT)
609#define BRIDGE_IRR_PCI_GRP (BRIDGE_ISR_PCI_ABORT | \
610 BRIDGE_ISR_PCI_PARITY | \
611 BRIDGE_ISR_PCI_SERR | \
612 BRIDGE_ISR_PCI_PERR | \
613 BRIDGE_ISR_PCI_MST_TIMEOUT | \
614 BRIDGE_ISR_PCI_RETRY_CNT)
615
616#define BRIDGE_IRR_GIO_GRP (BRIDGE_ISR_GIO_B_ENBL_ERR | \
617 BRIDGE_ISR_GIO_MST_TIMEOUT)
618
619/* Bridge INT_DEV register bits definition */
620#define BRIDGE_INT_DEV_SHFT(n) ((n)*3)
621#define BRIDGE_INT_DEV_MASK(n) (0x7 << BRIDGE_INT_DEV_SHFT(n))
622#define BRIDGE_INT_DEV_SET(_dev, _line) (_dev << BRIDGE_INT_DEV_SHFT(_line))
623
624/* Bridge interrupt(x) register bits definition */
625#define BRIDGE_INT_ADDR_HOST 0x0003FF00
626#define BRIDGE_INT_ADDR_FLD 0x000000FF
627
628#define BRIDGE_TMO_PCI_RETRY_HLD_MASK 0x1f0000
629#define BRIDGE_TMO_GIO_TIMEOUT_MASK 0x001000
630#define BRIDGE_TMO_PCI_RETRY_CNT_MASK 0x0003ff
631
632#define BRIDGE_TMO_PCI_RETRY_CNT_MAX 0x3ff
633
634/*
635 * The NASID should be shifted by this amount and stored into the
636 * interrupt(x) register.
637 */
638#define BRIDGE_INT_ADDR_NASID_SHFT 8
639
640/*
641 * The BRIDGE_INT_ADDR_DEST_IO bit should be set to send an interrupt to
642 * memory.
643 */
644#define BRIDGE_INT_ADDR_DEST_IO (1 << 17)
645#define BRIDGE_INT_ADDR_DEST_MEM 0
646#define BRIDGE_INT_ADDR_MASK (1 << 17)
647
648/* Bridge device(x) register bits definition */
649#define BRIDGE_DEV_ERR_LOCK_EN 0x10000000
650#define BRIDGE_DEV_PAGE_CHK_DIS 0x08000000
651#define BRIDGE_DEV_FORCE_PCI_PAR 0x04000000
652#define BRIDGE_DEV_VIRTUAL_EN 0x02000000
653#define BRIDGE_DEV_PMU_WRGA_EN 0x01000000
654#define BRIDGE_DEV_DIR_WRGA_EN 0x00800000
655#define BRIDGE_DEV_DEV_SIZE 0x00400000
656#define BRIDGE_DEV_RT 0x00200000
657#define BRIDGE_DEV_SWAP_PMU 0x00100000
658#define BRIDGE_DEV_SWAP_DIR 0x00080000
659#define BRIDGE_DEV_PREF 0x00040000
660#define BRIDGE_DEV_PRECISE 0x00020000
661#define BRIDGE_DEV_COH 0x00010000
662#define BRIDGE_DEV_BARRIER 0x00008000
663#define BRIDGE_DEV_GBR 0x00004000
664#define BRIDGE_DEV_DEV_SWAP 0x00002000
665#define BRIDGE_DEV_DEV_IO_MEM 0x00001000
666#define BRIDGE_DEV_OFF_MASK 0x00000fff
667#define BRIDGE_DEV_OFF_ADDR_SHFT 20
668
669#define BRIDGE_DEV_PMU_BITS (BRIDGE_DEV_PMU_WRGA_EN | \
670 BRIDGE_DEV_SWAP_PMU)
671#define BRIDGE_DEV_D32_BITS (BRIDGE_DEV_DIR_WRGA_EN | \
672 BRIDGE_DEV_SWAP_DIR | \
673 BRIDGE_DEV_PREF | \
674 BRIDGE_DEV_PRECISE | \
675 BRIDGE_DEV_COH | \
676 BRIDGE_DEV_BARRIER)
677#define BRIDGE_DEV_D64_BITS (BRIDGE_DEV_DIR_WRGA_EN | \
678 BRIDGE_DEV_SWAP_DIR | \
679 BRIDGE_DEV_COH | \
680 BRIDGE_DEV_BARRIER)
681
682/* Bridge Error Upper register bit field definition */
683#define BRIDGE_ERRUPPR_DEVMASTER (0x1 << 20) /* Device was master */
684#define BRIDGE_ERRUPPR_PCIVDEV (0x1 << 19) /* Virtual Req value */
685#define BRIDGE_ERRUPPR_DEVNUM_SHFT (16)
686#define BRIDGE_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_ERRUPPR_DEVNUM_SHFT)
687#define BRIDGE_ERRUPPR_DEVICE(err) (((err) >> BRIDGE_ERRUPPR_DEVNUM_SHFT) & 0x7)
688#define BRIDGE_ERRUPPR_ADDRMASK (0xFFFF)
689
690/* Bridge interrupt mode register bits definition */
691#define BRIDGE_INTMODE_CLR_PKT_EN(x) (0x1 << (x))
692
693/* this should be written to the xbow's link_control(x) register */
694#define BRIDGE_CREDIT 3
695
696/* RRB assignment register */
697#define BRIDGE_RRB_EN 0x8 /* after shifting down */
698#define BRIDGE_RRB_DEV 0x7 /* after shifting down */
699#define BRIDGE_RRB_VDEV 0x4 /* after shifting down */
700#define BRIDGE_RRB_PDEV 0x3 /* after shifting down */
701
702/* RRB status register */
703#define BRIDGE_RRB_VALID(r) (0x00010000<<(r))
704#define BRIDGE_RRB_INUSE(r) (0x00000001<<(r))
705
706/* RRB clear register */
707#define BRIDGE_RRB_CLEAR(r) (0x00000001<<(r))
708
709/* xbox system controller declarations */
710#define XBOX_BRIDGE_WID 8
711#define FLASH_PROM1_BASE 0xE00000 /* To read the xbox sysctlr status */
712#define XBOX_RPS_EXISTS 1 << 6 /* RPS bit in status register */
713#define XBOX_RPS_FAIL 1 << 4 /* RPS status bit in register */
714
715/* ========================================================================
716 */
717/*
718 * Macros for Xtalk to Bridge bus (PCI/GIO) PIO
719 * refer to section 4.2.1 of Bridge Spec for xtalk to PCI/GIO PIO mappings
720 */
721/* XTALK addresses that map into Bridge Bus addr space */
722#define BRIDGE_PIO32_XTALK_ALIAS_BASE 0x000040000000L
723#define BRIDGE_PIO32_XTALK_ALIAS_LIMIT 0x00007FFFFFFFL
724#define BRIDGE_PIO64_XTALK_ALIAS_BASE 0x000080000000L
725#define BRIDGE_PIO64_XTALK_ALIAS_LIMIT 0x0000BFFFFFFFL
726#define BRIDGE_PCIIO_XTALK_ALIAS_BASE 0x000100000000L
727#define BRIDGE_PCIIO_XTALK_ALIAS_LIMIT 0x0001FFFFFFFFL
728
729/* Ranges of PCI bus space that can be accessed via PIO from xtalk */
730#define BRIDGE_MIN_PIO_ADDR_MEM 0x00000000 /* 1G PCI memory space */
731#define BRIDGE_MAX_PIO_ADDR_MEM 0x3fffffff
732#define BRIDGE_MIN_PIO_ADDR_IO 0x00000000 /* 4G PCI IO space */
733#define BRIDGE_MAX_PIO_ADDR_IO 0xffffffff
734
735/* XTALK addresses that map into PCI addresses */
736#define BRIDGE_PCI_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE
737#define BRIDGE_PCI_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT
738#define BRIDGE_PCI_MEM64_BASE BRIDGE_PIO64_XTALK_ALIAS_BASE
739#define BRIDGE_PCI_MEM64_LIMIT BRIDGE_PIO64_XTALK_ALIAS_LIMIT
740#define BRIDGE_PCI_IO_BASE BRIDGE_PCIIO_XTALK_ALIAS_BASE
741#define BRIDGE_PCI_IO_LIMIT BRIDGE_PCIIO_XTALK_ALIAS_LIMIT
742
743/*
744 * Macros for Bridge bus (PCI/GIO) to Xtalk DMA
745 */
746/* Bridge Bus DMA addresses */
747#define BRIDGE_LOCAL_BASE 0
748#define BRIDGE_DMA_MAPPED_BASE 0x40000000
749#define BRIDGE_DMA_MAPPED_SIZE 0x40000000 /* 1G Bytes */
750#define BRIDGE_DMA_DIRECT_BASE 0x80000000
751#define BRIDGE_DMA_DIRECT_SIZE 0x80000000 /* 2G Bytes */
752
753#define PCI32_LOCAL_BASE BRIDGE_LOCAL_BASE
754
755/* PCI addresses of regions decoded by Bridge for DMA */
756#define PCI32_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE
757#define PCI32_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE
758
759#define IS_PCI32_LOCAL(x) ((ulong_t)(x) < PCI32_MAPPED_BASE)
760#define IS_PCI32_MAPPED(x) ((ulong_t)(x) < PCI32_DIRECT_BASE && \
761 (ulong_t)(x) >= PCI32_MAPPED_BASE)
762#define IS_PCI32_DIRECT(x) ((ulong_t)(x) >= PCI32_MAPPED_BASE)
763#define IS_PCI64(x) ((ulong_t)(x) >= PCI64_BASE)
764
765/*
766 * The GIO address space.
767 */
768/* Xtalk to GIO PIO */
769#define BRIDGE_GIO_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE
770#define BRIDGE_GIO_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT
771
772#define GIO_LOCAL_BASE BRIDGE_LOCAL_BASE
773
774/* GIO addresses of regions decoded by Bridge for DMA */
775#define GIO_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE
776#define GIO_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE
777
778#define IS_GIO_LOCAL(x) ((ulong_t)(x) < GIO_MAPPED_BASE)
779#define IS_GIO_MAPPED(x) ((ulong_t)(x) < GIO_DIRECT_BASE && \
780 (ulong_t)(x) >= GIO_MAPPED_BASE)
781#define IS_GIO_DIRECT(x) ((ulong_t)(x) >= GIO_MAPPED_BASE)
782
783/* PCI to xtalk mapping */
784
785/* given a DIR_OFF value and a pci/gio 32 bits direct address, determine
786 * which xtalk address is accessed
787 */
788#define BRIDGE_DIRECT_32_SEG_SIZE BRIDGE_DMA_DIRECT_SIZE
789#define BRIDGE_DIRECT_32_TO_XTALK(dir_off,adr) \
790 ((dir_off) * BRIDGE_DIRECT_32_SEG_SIZE + \
791 ((adr) & (BRIDGE_DIRECT_32_SEG_SIZE - 1)) + PHYS_RAMBASE)
792
793/* 64-bit address attribute masks */
794#define PCI64_ATTR_TARG_MASK 0xf000000000000000
795#define PCI64_ATTR_TARG_SHFT 60
796#define PCI64_ATTR_PREF 0x0800000000000000
797#define PCI64_ATTR_PREC 0x0400000000000000
798#define PCI64_ATTR_VIRTUAL 0x0200000000000000
799#define PCI64_ATTR_BAR 0x0100000000000000
800#define PCI64_ATTR_RMF_MASK 0x00ff000000000000
801#define PCI64_ATTR_RMF_SHFT 48
802
803struct bridge_controller {
804 struct resource busn;
805 struct bridge_regs *base;
806 unsigned long baddr;
807 unsigned long intr_addr;
808 struct irq_domain *domain;
809 unsigned int pci_int[8][2];
810 unsigned int int_mapping[8][2];
811 u32 ioc3_sid[8];
812 nasid_t nasid;
813};
814
815#define BRIDGE_CONTROLLER(bus) \
816 ((struct bridge_controller *)((bus)->sysdata))
817
818#define bridge_read(bc, reg) __raw_readl(&bc->base->reg)
819#define bridge_write(bc, reg, val) __raw_writel(val, &bc->base->reg)
820#define bridge_set(bc, reg, val) \
821 __raw_writel(__raw_readl(&bc->base->reg) | (val), &bc->base->reg)
822#define bridge_clr(bc, reg, val) \
823 __raw_writel(__raw_readl(&bc->base->reg) & ~(val), &bc->base->reg)
824
825#endif /* _ASM_PCI_BRIDGE_H */
diff --git a/arch/mips/include/asm/perf_event.h b/arch/mips/include/asm/perf_event.h
new file mode 100644
index 000000000..0babf6bbb
--- /dev/null
+++ b/arch/mips/include/asm/perf_event.h
@@ -0,0 +1,12 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * linux/arch/mips/include/asm/perf_event.h
4 *
5 * Copyright (C) 2010 MIPS Technologies, Inc.
6 * Author: Deng-Cheng Zhu
7 */
8
9#ifndef __MIPS_PERF_EVENT_H__
10#define __MIPS_PERF_EVENT_H__
11/* Leave it empty here. The file is required by linux/perf_event.h */
12#endif /* __MIPS_PERF_EVENT_H__ */
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
new file mode 100644
index 000000000..71153c369
--- /dev/null
+++ b/arch/mips/include/asm/pgalloc.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) 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/highmem.h>
13#include <linux/mm.h>
14#include <linux/sched.h>
15
16#define __HAVE_ARCH_PMD_ALLOC_ONE
17#define __HAVE_ARCH_PUD_ALLOC_ONE
18#define __HAVE_ARCH_PGD_FREE
19#include <asm-generic/pgalloc.h>
20
21static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
22 pte_t *pte)
23{
24 set_pmd(pmd, __pmd((unsigned long)pte));
25}
26
27static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
28 pgtable_t pte)
29{
30 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
31}
32#define pmd_pgtable(pmd) pmd_page(pmd)
33
34/*
35 * Initialize a new pmd table with invalid pointers.
36 */
37extern void pmd_init(unsigned long page, unsigned long pagetable);
38
39#ifndef __PAGETABLE_PMD_FOLDED
40
41static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
42{
43 set_pud(pud, __pud((unsigned long)pmd));
44}
45#endif
46
47/*
48 * Initialize a new pgd / pmd table with invalid pointers.
49 */
50extern void pgd_init(unsigned long page);
51extern pgd_t *pgd_alloc(struct mm_struct *mm);
52
53static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
54{
55 free_pages((unsigned long)pgd, PGD_ORDER);
56}
57
58#define __pte_free_tlb(tlb,pte,address) \
59do { \
60 pgtable_pte_page_dtor(pte); \
61 tlb_remove_page((tlb), pte); \
62} while (0)
63
64#ifndef __PAGETABLE_PMD_FOLDED
65
66static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
67{
68 pmd_t *pmd;
69 struct page *pg;
70
71 pg = alloc_pages(GFP_KERNEL_ACCOUNT, PMD_ORDER);
72 if (!pg)
73 return NULL;
74
75 if (!pgtable_pmd_page_ctor(pg)) {
76 __free_pages(pg, PMD_ORDER);
77 return NULL;
78 }
79
80 pmd = (pmd_t *)page_address(pg);
81 pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
82 return pmd;
83}
84
85#define __pmd_free_tlb(tlb, x, addr) pmd_free((tlb)->mm, x)
86
87#endif
88
89#ifndef __PAGETABLE_PUD_FOLDED
90
91static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
92{
93 pud_t *pud;
94
95 pud = (pud_t *) __get_free_pages(GFP_KERNEL, PUD_ORDER);
96 if (pud)
97 pud_init((unsigned long)pud, (unsigned long)invalid_pmd_table);
98 return pud;
99}
100
101static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4d, pud_t *pud)
102{
103 set_p4d(p4d, __p4d((unsigned long)pud));
104}
105
106#define __pud_free_tlb(tlb, x, addr) pud_free((tlb)->mm, x)
107
108#endif /* __PAGETABLE_PUD_FOLDED */
109
110extern void pagetable_init(void);
111
112#endif /* _ASM_PGALLOC_H */
diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h
new file mode 100644
index 000000000..6c0532d7b
--- /dev/null
+++ b/arch/mips/include/asm/pgtable-32.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 * 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 <asm/addrspace.h>
13#include <asm/page.h>
14
15#include <linux/linkage.h>
16#include <asm/cachectl.h>
17#include <asm/fixmap.h>
18
19#include <asm-generic/pgtable-nopmd.h>
20
21#ifdef CONFIG_HIGHMEM
22#include <asm/highmem.h>
23#endif
24
25/*
26 * Regarding 32-bit MIPS huge page support (and the tradeoff it entails):
27 *
28 * We use the same huge page sizes as 64-bit MIPS. Assuming a 4KB page size,
29 * our 2-level table layout would normally have a PGD entry cover a contiguous
30 * 4MB virtual address region (pointing to a 4KB PTE page of 1,024 32-bit pte_t
31 * pointers, each pointing to a 4KB physical page). The problem is that 4MB,
32 * spanning both halves of a TLB EntryLo0,1 pair, requires 2MB hardware page
33 * support, not one of the standard supported sizes (1MB,4MB,16MB,...).
34 * To correct for this, when huge pages are enabled, we halve the number of
35 * pointers a PTE page holds, making its last half go to waste. Correspondingly,
36 * we double the number of PGD pages. Overall, page table memory overhead
37 * increases to match 64-bit MIPS, but PTE lookups remain CPU cache-friendly.
38 *
39 * NOTE: We don't yet support huge pages if extended-addressing is enabled
40 * (i.e. EVA, XPA, 36-bit Alchemy/Netlogic).
41 */
42
43extern int temp_tlb_entry;
44
45/*
46 * - add_temporary_entry() add a temporary TLB entry. We use TLB entries
47 * starting at the top and working down. This is for populating the
48 * TLB before trap_init() puts the TLB miss handler in place. It
49 * should be used only for entries matching the actual page tables,
50 * to prevent inconsistencies.
51 */
52extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
53 unsigned long entryhi, unsigned long pagemask);
54
55/*
56 * Basically we have the same two-level (which is the logical three level
57 * Linux page table layout folded) page tables as the i386. Some day
58 * when we have proper page coloring support we can have a 1% quicker
59 * tlb refill handling mechanism, but for now it is a bit slower but
60 * works even with the cache aliasing problem the R4k and above have.
61 */
62
63/* PGDIR_SHIFT determines what a third-level page table entry can map */
64#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT) && !defined(CONFIG_PHYS_ADDR_T_64BIT)
65# define PGDIR_SHIFT (2 * PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2 - 1)
66#else
67# define PGDIR_SHIFT (2 * PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2)
68#endif
69
70#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
71#define PGDIR_MASK (~(PGDIR_SIZE-1))
72
73/*
74 * Entries per page directory level: we use two-level, so
75 * we don't really have any PUD/PMD directory physically.
76 */
77#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT) && !defined(CONFIG_PHYS_ADDR_T_64BIT)
78# define __PGD_ORDER (32 - 3 * PAGE_SHIFT + PGD_T_LOG2 + PTE_T_LOG2 + 1)
79#else
80# define __PGD_ORDER (32 - 3 * PAGE_SHIFT + PGD_T_LOG2 + PTE_T_LOG2)
81#endif
82
83#define PGD_ORDER (__PGD_ORDER >= 0 ? __PGD_ORDER : 0)
84#define PUD_ORDER aieeee_attempt_to_allocate_pud
85#define PMD_ORDER aieeee_attempt_to_allocate_pmd
86#define PTE_ORDER 0
87
88#define PTRS_PER_PGD (USER_PTRS_PER_PGD * 2)
89#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT) && !defined(CONFIG_PHYS_ADDR_T_64BIT)
90# define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t) / 2)
91#else
92# define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
93#endif
94
95#define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE)
96#define FIRST_USER_ADDRESS 0UL
97
98#define VMALLOC_START MAP_BASE
99
100#define PKMAP_END ((FIXADDR_START) & ~((LAST_PKMAP << PAGE_SHIFT)-1))
101#define PKMAP_BASE (PKMAP_END - PAGE_SIZE * LAST_PKMAP)
102
103#ifdef CONFIG_HIGHMEM
104# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
105#else
106# define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
107#endif
108
109#ifdef CONFIG_PHYS_ADDR_T_64BIT
110#define pte_ERROR(e) \
111 printk("%s:%d: bad pte %016Lx.\n", __FILE__, __LINE__, pte_val(e))
112#else
113#define pte_ERROR(e) \
114 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
115#endif
116#define pgd_ERROR(e) \
117 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
118
119extern void load_pgd(unsigned long pg_dir);
120
121extern pte_t invalid_pte_table[PTRS_PER_PTE];
122
123/*
124 * Empty pgd/pmd entries point to the invalid_pte_table.
125 */
126static inline int pmd_none(pmd_t pmd)
127{
128 return pmd_val(pmd) == (unsigned long) invalid_pte_table;
129}
130
131static inline int pmd_bad(pmd_t pmd)
132{
133#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
134 /* pmd_huge(pmd) but inline */
135 if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
136 return 0;
137#endif
138
139 if (unlikely(pmd_val(pmd) & ~PAGE_MASK))
140 return 1;
141
142 return 0;
143}
144
145static inline int pmd_present(pmd_t pmd)
146{
147 return pmd_val(pmd) != (unsigned long) invalid_pte_table;
148}
149
150static inline void pmd_clear(pmd_t *pmdp)
151{
152 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
153}
154
155#if defined(CONFIG_XPA)
156
157#define MAX_POSSIBLE_PHYSMEM_BITS 40
158#define pte_pfn(x) (((unsigned long)((x).pte_high >> _PFN_SHIFT)) | (unsigned long)((x).pte_low << _PAGE_PRESENT_SHIFT))
159static inline pte_t
160pfn_pte(unsigned long pfn, pgprot_t prot)
161{
162 pte_t pte;
163
164 pte.pte_low = (pfn >> _PAGE_PRESENT_SHIFT) |
165 (pgprot_val(prot) & ~_PFNX_MASK);
166 pte.pte_high = (pfn << _PFN_SHIFT) |
167 (pgprot_val(prot) & ~_PFN_MASK);
168 return pte;
169}
170
171#elif defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32)
172
173#define MAX_POSSIBLE_PHYSMEM_BITS 36
174#define pte_pfn(x) ((unsigned long)((x).pte_high >> 6))
175
176static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
177{
178 pte_t pte;
179
180 pte.pte_high = (pfn << 6) | (pgprot_val(prot) & 0x3f);
181 pte.pte_low = pgprot_val(prot);
182
183 return pte;
184}
185
186#else
187
188#define MAX_POSSIBLE_PHYSMEM_BITS 32
189#ifdef CONFIG_CPU_VR41XX
190#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
191#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
192#else
193#define pte_pfn(x) ((unsigned long)((x).pte >> _PFN_SHIFT))
194#define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << _PFN_SHIFT) | pgprot_val(prot))
195#define pfn_pmd(pfn, prot) __pmd(((unsigned long long)(pfn) << _PFN_SHIFT) | pgprot_val(prot))
196#endif
197#endif /* defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) */
198
199#define pte_page(x) pfn_to_page(pte_pfn(x))
200
201#if defined(CONFIG_CPU_R3K_TLB)
202
203/* Swap entries must have VALID bit cleared. */
204#define __swp_type(x) (((x).val >> 10) & 0x1f)
205#define __swp_offset(x) ((x).val >> 15)
206#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 10) | ((offset) << 15) })
207#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
208#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
209
210#else
211
212#if defined(CONFIG_XPA)
213
214/* Swap entries must have VALID and GLOBAL bits cleared. */
215#define __swp_type(x) (((x).val >> 4) & 0x1f)
216#define __swp_offset(x) ((x).val >> 9)
217#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 4) | ((offset) << 9) })
218#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high })
219#define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val })
220
221#elif defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32)
222
223/* Swap entries must have VALID and GLOBAL bits cleared. */
224#define __swp_type(x) (((x).val >> 2) & 0x1f)
225#define __swp_offset(x) ((x).val >> 7)
226#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 7) })
227#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high })
228#define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val })
229
230#else
231/*
232 * Constraints:
233 * _PAGE_PRESENT at bit 0
234 * _PAGE_MODIFIED at bit 4
235 * _PAGE_GLOBAL at bit 6
236 * _PAGE_VALID at bit 7
237 */
238#define __swp_type(x) (((x).val >> 8) & 0x1f)
239#define __swp_offset(x) ((x).val >> 13)
240#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
241#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
242#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
243
244#endif /* defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) */
245
246#endif /* defined(CONFIG_CPU_R3K_TLB) */
247
248#endif /* _ASM_PGTABLE_32_H */
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
new file mode 100644
index 000000000..1e7d6ce9d
--- /dev/null
+++ b/arch/mips/include/asm/pgtable-64.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, 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/compiler.h>
13#include <linux/linkage.h>
14
15#include <asm/addrspace.h>
16#include <asm/page.h>
17#include <asm/cachectl.h>
18#include <asm/fixmap.h>
19
20#if CONFIG_PGTABLE_LEVELS == 2
21#include <asm-generic/pgtable-nopmd.h>
22#elif CONFIG_PGTABLE_LEVELS == 3
23#include <asm-generic/pgtable-nopud.h>
24#else
25#include <asm-generic/pgtable-nop4d.h>
26#endif
27
28/*
29 * Each address space has 2 4K pages as its page directory, giving 1024
30 * (== PTRS_PER_PGD) 8 byte pointers to pmd tables. Each pmd table is a
31 * single 4K page, giving 512 (== PTRS_PER_PMD) 8 byte pointers to page
32 * tables. Each page table is also a single 4K page, giving 512 (==
33 * PTRS_PER_PTE) 8 byte ptes. Each pud entry is initialized to point to
34 * invalid_pmd_table, each pmd entry is initialized to point to
35 * invalid_pte_table, each pte is initialized to 0.
36 *
37 * Kernel mappings: kernel mappings are held in the swapper_pg_table.
38 * The layout is identical to userspace except it's indexed with the
39 * fault address - VMALLOC_START.
40 */
41
42
43/* PGDIR_SHIFT determines what a third-level page table entry can map */
44#ifdef __PAGETABLE_PMD_FOLDED
45#define PGDIR_SHIFT (PAGE_SHIFT + PAGE_SHIFT + PTE_ORDER - 3)
46#else
47
48/* PMD_SHIFT determines the size of the area a second-level page table can map */
49#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3))
50#define PMD_SIZE (1UL << PMD_SHIFT)
51#define PMD_MASK (~(PMD_SIZE-1))
52
53# ifdef __PAGETABLE_PUD_FOLDED
54# define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3))
55# endif
56#endif
57
58#ifndef __PAGETABLE_PUD_FOLDED
59#define PUD_SHIFT (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3))
60#define PUD_SIZE (1UL << PUD_SHIFT)
61#define PUD_MASK (~(PUD_SIZE-1))
62#define PGDIR_SHIFT (PUD_SHIFT + (PAGE_SHIFT + PUD_ORDER - 3))
63#endif
64
65#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
66#define PGDIR_MASK (~(PGDIR_SIZE-1))
67
68/*
69 * For 4kB page size we use a 3 level page tree and an 8kB pud, which
70 * permits us mapping 40 bits of virtual address space.
71 *
72 * We used to implement 41 bits by having an order 1 pmd level but that seemed
73 * rather pointless.
74 *
75 * For 8kB page size we use a 3 level page tree which permits a total of
76 * 8TB of address space. Alternatively a 33-bit / 8GB organization using
77 * two levels would be easy to implement.
78 *
79 * For 16kB page size we use a 2 level page tree which permits a total of
80 * 36 bits of virtual address space. We could add a third level but it seems
81 * like at the moment there's no need for this.
82 *
83 * For 64kB page size we use a 2 level page table tree for a total of 42 bits
84 * of virtual address space.
85 */
86#ifdef CONFIG_PAGE_SIZE_4KB
87# ifdef CONFIG_MIPS_VA_BITS_48
88# define PGD_ORDER 0
89# define PUD_ORDER 0
90# else
91# define PGD_ORDER 1
92# define PUD_ORDER aieeee_attempt_to_allocate_pud
93# endif
94#define PMD_ORDER 0
95#define PTE_ORDER 0
96#endif
97#ifdef CONFIG_PAGE_SIZE_8KB
98#define PGD_ORDER 0
99#define PUD_ORDER aieeee_attempt_to_allocate_pud
100#define PMD_ORDER 0
101#define PTE_ORDER 0
102#endif
103#ifdef CONFIG_PAGE_SIZE_16KB
104#ifdef CONFIG_MIPS_VA_BITS_48
105#define PGD_ORDER 1
106#else
107#define PGD_ORDER 0
108#endif
109#define PUD_ORDER aieeee_attempt_to_allocate_pud
110#define PMD_ORDER 0
111#define PTE_ORDER 0
112#endif
113#ifdef CONFIG_PAGE_SIZE_32KB
114#define PGD_ORDER 0
115#define PUD_ORDER aieeee_attempt_to_allocate_pud
116#define PMD_ORDER 0
117#define PTE_ORDER 0
118#endif
119#ifdef CONFIG_PAGE_SIZE_64KB
120#define PGD_ORDER 0
121#define PUD_ORDER aieeee_attempt_to_allocate_pud
122#ifdef CONFIG_MIPS_VA_BITS_48
123#define PMD_ORDER 0
124#else
125#define PMD_ORDER aieeee_attempt_to_allocate_pmd
126#endif
127#define PTE_ORDER 0
128#endif
129
130#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
131#ifndef __PAGETABLE_PUD_FOLDED
132#define PTRS_PER_PUD ((PAGE_SIZE << PUD_ORDER) / sizeof(pud_t))
133#endif
134#ifndef __PAGETABLE_PMD_FOLDED
135#define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t))
136#endif
137#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
138
139#define USER_PTRS_PER_PGD ((TASK_SIZE64 / PGDIR_SIZE)?(TASK_SIZE64 / PGDIR_SIZE):1)
140#define FIRST_USER_ADDRESS 0UL
141
142/*
143 * TLB refill handlers also map the vmalloc area into xuseg. Avoid
144 * the first couple of pages so NULL pointer dereferences will still
145 * reliably trap.
146 */
147#define VMALLOC_START (MAP_BASE + (2 * PAGE_SIZE))
148#define VMALLOC_END \
149 (MAP_BASE + \
150 min(PTRS_PER_PGD * PTRS_PER_PUD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE, \
151 (1UL << cpu_vmbits)) - (1UL << 32))
152
153#if defined(CONFIG_MODULES) && defined(KBUILD_64BIT_SYM32) && \
154 VMALLOC_START != CKSSEG
155/* Load modules into 32bit-compatible segment. */
156#define MODULE_START CKSSEG
157#define MODULE_END (FIXADDR_START-2*PAGE_SIZE)
158#endif
159
160#define pte_ERROR(e) \
161 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
162#ifndef __PAGETABLE_PMD_FOLDED
163#define pmd_ERROR(e) \
164 printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
165#endif
166#ifndef __PAGETABLE_PUD_FOLDED
167#define pud_ERROR(e) \
168 printk("%s:%d: bad pud %016lx.\n", __FILE__, __LINE__, pud_val(e))
169#endif
170#define pgd_ERROR(e) \
171 printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
172
173extern pte_t invalid_pte_table[PTRS_PER_PTE];
174
175#ifndef __PAGETABLE_PUD_FOLDED
176/*
177 * For 4-level pagetables we defines these ourselves, for 3-level the
178 * definitions are below, for 2-level the
179 * definitions are supplied by <asm-generic/pgtable-nopmd.h>.
180 */
181typedef struct { unsigned long pud; } pud_t;
182#define pud_val(x) ((x).pud)
183#define __pud(x) ((pud_t) { (x) })
184
185extern pud_t invalid_pud_table[PTRS_PER_PUD];
186
187/*
188 * Empty pgd entries point to the invalid_pud_table.
189 */
190static inline int p4d_none(p4d_t p4d)
191{
192 return p4d_val(p4d) == (unsigned long)invalid_pud_table;
193}
194
195static inline int p4d_bad(p4d_t p4d)
196{
197 if (unlikely(p4d_val(p4d) & ~PAGE_MASK))
198 return 1;
199
200 return 0;
201}
202
203static inline int p4d_present(p4d_t p4d)
204{
205 return p4d_val(p4d) != (unsigned long)invalid_pud_table;
206}
207
208static inline void p4d_clear(p4d_t *p4dp)
209{
210 p4d_val(*p4dp) = (unsigned long)invalid_pud_table;
211}
212
213static inline unsigned long p4d_page_vaddr(p4d_t p4d)
214{
215 return p4d_val(p4d);
216}
217
218#define p4d_phys(p4d) virt_to_phys((void *)p4d_val(p4d))
219#define p4d_page(p4d) (pfn_to_page(p4d_phys(p4d) >> PAGE_SHIFT))
220
221#define p4d_index(address) (((address) >> P4D_SHIFT) & (PTRS_PER_P4D - 1))
222
223static inline void set_p4d(p4d_t *p4d, p4d_t p4dval)
224{
225 *p4d = p4dval;
226}
227
228#endif
229
230#ifndef __PAGETABLE_PMD_FOLDED
231/*
232 * For 3-level pagetables we defines these ourselves, for 2-level the
233 * definitions are supplied by <asm-generic/pgtable-nopmd.h>.
234 */
235typedef struct { unsigned long pmd; } pmd_t;
236#define pmd_val(x) ((x).pmd)
237#define __pmd(x) ((pmd_t) { (x) } )
238
239
240extern pmd_t invalid_pmd_table[PTRS_PER_PMD];
241#endif
242
243/*
244 * Empty pgd/pmd entries point to the invalid_pte_table.
245 */
246static inline int pmd_none(pmd_t pmd)
247{
248 return pmd_val(pmd) == (unsigned long) invalid_pte_table;
249}
250
251static inline int pmd_bad(pmd_t pmd)
252{
253#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
254 /* pmd_huge(pmd) but inline */
255 if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
256 return 0;
257#endif
258
259 if (unlikely(pmd_val(pmd) & ~PAGE_MASK))
260 return 1;
261
262 return 0;
263}
264
265static inline int pmd_present(pmd_t pmd)
266{
267#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
268 if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
269 return pmd_val(pmd) & _PAGE_PRESENT;
270#endif
271
272 return pmd_val(pmd) != (unsigned long) invalid_pte_table;
273}
274
275static inline void pmd_clear(pmd_t *pmdp)
276{
277 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
278}
279#ifndef __PAGETABLE_PMD_FOLDED
280
281/*
282 * Empty pud entries point to the invalid_pmd_table.
283 */
284static inline int pud_none(pud_t pud)
285{
286 return pud_val(pud) == (unsigned long) invalid_pmd_table;
287}
288
289static inline int pud_bad(pud_t pud)
290{
291 return pud_val(pud) & ~PAGE_MASK;
292}
293
294static inline int pud_present(pud_t pud)
295{
296 return pud_val(pud) != (unsigned long) invalid_pmd_table;
297}
298
299static inline void pud_clear(pud_t *pudp)
300{
301 pud_val(*pudp) = ((unsigned long) invalid_pmd_table);
302}
303#endif
304
305#define pte_page(x) pfn_to_page(pte_pfn(x))
306
307#ifdef CONFIG_CPU_VR41XX
308#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
309#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
310#else
311#define pte_pfn(x) ((unsigned long)((x).pte >> _PFN_SHIFT))
312#define pfn_pte(pfn, prot) __pte(((pfn) << _PFN_SHIFT) | pgprot_val(prot))
313#define pfn_pmd(pfn, prot) __pmd(((pfn) << _PFN_SHIFT) | pgprot_val(prot))
314#endif
315
316#ifndef __PAGETABLE_PMD_FOLDED
317static inline unsigned long pud_page_vaddr(pud_t pud)
318{
319 return pud_val(pud);
320}
321#define pud_phys(pud) virt_to_phys((void *)pud_val(pud))
322#define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
323
324#endif
325
326/*
327 * Initialize a new pgd / pmd table with invalid pointers.
328 */
329extern void pgd_init(unsigned long page);
330extern void pud_init(unsigned long page, unsigned long pagetable);
331extern void pmd_init(unsigned long page, unsigned long pagetable);
332
333/*
334 * Non-present pages: high 40 bits are offset, next 8 bits type,
335 * low 16 bits zero.
336 */
337static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
338{ pte_t pte; pte_val(pte) = (type << 16) | (offset << 24); return pte; }
339
340#define __swp_type(x) (((x).val >> 16) & 0xff)
341#define __swp_offset(x) ((x).val >> 24)
342#define __swp_entry(type, offset) ((swp_entry_t) { pte_val(mk_swap_pte((type), (offset))) })
343#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
344#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
345
346#endif /* _ASM_PGTABLE_64_H */
diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h
new file mode 100644
index 000000000..2362842ee
--- /dev/null
+++ b/arch/mips/include/asm/pgtable-bits.h
@@ -0,0 +1,285 @@
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
14/*
15 * Note that we shift the lower 32bits of each EntryLo[01] entry
16 * 6 bits to the left. That way we can convert the PFN into the
17 * physical address by a single 'and' operation and gain 6 additional
18 * bits for storing information which isn't present in a normal
19 * MIPS page table.
20 *
21 * Similar to the Alpha port, we need to keep track of the ref
22 * and mod bits in software. We have a software "yeah you can read
23 * from this page" bit, and a hardware one which actually lets the
24 * process read from the page. On the same token we have a software
25 * writable bit and the real hardware one which actually lets the
26 * process write to the page, this keeps a mod bit via the hardware
27 * dirty bit.
28 *
29 * Certain revisions of the R4000 and R5000 have a bug where if a
30 * certain sequence occurs in the last 3 instructions of an executable
31 * page, and the following page is not mapped, the cpu can do
32 * unpredictable things. The code (when it is written) to deal with
33 * this problem will be in the update_mmu_cache() code for the r4k.
34 */
35#if defined(CONFIG_XPA)
36
37/*
38 * Page table bit offsets used for 64 bit physical addressing on
39 * MIPS32r5 with XPA.
40 */
41enum pgtable_bits {
42 /* Used by TLB hardware (placed in EntryLo*) */
43 _PAGE_NO_EXEC_SHIFT,
44 _PAGE_NO_READ_SHIFT,
45 _PAGE_GLOBAL_SHIFT,
46 _PAGE_VALID_SHIFT,
47 _PAGE_DIRTY_SHIFT,
48 _CACHE_SHIFT,
49
50 /* Used only by software (masked out before writing EntryLo*) */
51 _PAGE_PRESENT_SHIFT = 24,
52 _PAGE_WRITE_SHIFT,
53 _PAGE_ACCESSED_SHIFT,
54 _PAGE_MODIFIED_SHIFT,
55#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
56 _PAGE_SPECIAL_SHIFT,
57#endif
58#if defined(CONFIG_HAVE_ARCH_SOFT_DIRTY)
59 _PAGE_SOFT_DIRTY_SHIFT,
60#endif
61};
62
63/*
64 * Bits for extended EntryLo0/EntryLo1 registers
65 */
66#define _PFNX_MASK 0xffffff
67
68#elif defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32)
69
70/*
71 * Page table bit offsets used for 36 bit physical addressing on MIPS32,
72 * for example with Alchemy or Netlogic XLP/XLR.
73 */
74enum pgtable_bits {
75 /* Used by TLB hardware (placed in EntryLo*) */
76 _PAGE_GLOBAL_SHIFT,
77 _PAGE_VALID_SHIFT,
78 _PAGE_DIRTY_SHIFT,
79 _CACHE_SHIFT,
80
81 /* Used only by software (masked out before writing EntryLo*) */
82 _PAGE_PRESENT_SHIFT = _CACHE_SHIFT + 3,
83 _PAGE_NO_READ_SHIFT,
84 _PAGE_WRITE_SHIFT,
85 _PAGE_ACCESSED_SHIFT,
86 _PAGE_MODIFIED_SHIFT,
87#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
88 _PAGE_SPECIAL_SHIFT,
89#endif
90#if defined(CONFIG_HAVE_ARCH_SOFT_DIRTY)
91 _PAGE_SOFT_DIRTY_SHIFT,
92#endif
93};
94
95#elif defined(CONFIG_CPU_R3K_TLB)
96
97/* Page table bits used for r3k systems */
98enum pgtable_bits {
99 /* Used only by software (writes to EntryLo ignored) */
100 _PAGE_PRESENT_SHIFT,
101 _PAGE_NO_READ_SHIFT,
102 _PAGE_WRITE_SHIFT,
103 _PAGE_ACCESSED_SHIFT,
104 _PAGE_MODIFIED_SHIFT,
105#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
106 _PAGE_SPECIAL_SHIFT,
107#endif
108#if defined(CONFIG_HAVE_ARCH_SOFT_DIRTY)
109 _PAGE_SOFT_DIRTY_SHIFT,
110#endif
111
112 /* Used by TLB hardware (placed in EntryLo) */
113 _PAGE_GLOBAL_SHIFT = 8,
114 _PAGE_VALID_SHIFT,
115 _PAGE_DIRTY_SHIFT,
116 _CACHE_UNCACHED_SHIFT,
117};
118
119#else
120
121/* Page table bits used for r4k systems */
122enum pgtable_bits {
123 /* Used only by software (masked out before writing EntryLo*) */
124 _PAGE_PRESENT_SHIFT,
125#if !defined(CONFIG_CPU_HAS_RIXI)
126 _PAGE_NO_READ_SHIFT,
127#endif
128 _PAGE_WRITE_SHIFT,
129 _PAGE_ACCESSED_SHIFT,
130 _PAGE_MODIFIED_SHIFT,
131#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
132 _PAGE_HUGE_SHIFT,
133#endif
134#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
135 _PAGE_SPECIAL_SHIFT,
136#endif
137#if defined(CONFIG_HAVE_ARCH_SOFT_DIRTY)
138 _PAGE_SOFT_DIRTY_SHIFT,
139#endif
140 /* Used by TLB hardware (placed in EntryLo*) */
141#if defined(CONFIG_CPU_HAS_RIXI)
142 _PAGE_NO_EXEC_SHIFT,
143 _PAGE_NO_READ_SHIFT,
144#endif
145 _PAGE_GLOBAL_SHIFT,
146 _PAGE_VALID_SHIFT,
147 _PAGE_DIRTY_SHIFT,
148 _CACHE_SHIFT,
149};
150
151#endif /* defined(CONFIG_PHYS_ADDR_T_64BIT && defined(CONFIG_CPU_MIPS32) */
152
153/* Used only by software */
154#define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT)
155#define _PAGE_WRITE (1 << _PAGE_WRITE_SHIFT)
156#define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT)
157#define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT)
158#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
159# define _PAGE_HUGE (1 << _PAGE_HUGE_SHIFT)
160#endif
161#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
162# define _PAGE_SPECIAL (1 << _PAGE_SPECIAL_SHIFT)
163#else
164# define _PAGE_SPECIAL 0
165#endif
166#if defined(CONFIG_HAVE_ARCH_SOFT_DIRTY)
167# define _PAGE_SOFT_DIRTY (1 << _PAGE_SOFT_DIRTY_SHIFT)
168#else
169# define _PAGE_SOFT_DIRTY 0
170#endif
171
172/* Used by TLB hardware (placed in EntryLo*) */
173#if defined(CONFIG_XPA)
174# define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT)
175#elif defined(CONFIG_CPU_HAS_RIXI)
176# define _PAGE_NO_EXEC (cpu_has_rixi ? (1 << _PAGE_NO_EXEC_SHIFT) : 0)
177#endif
178#define _PAGE_NO_READ (1 << _PAGE_NO_READ_SHIFT)
179#define _PAGE_GLOBAL (1 << _PAGE_GLOBAL_SHIFT)
180#define _PAGE_VALID (1 << _PAGE_VALID_SHIFT)
181#define _PAGE_DIRTY (1 << _PAGE_DIRTY_SHIFT)
182#if defined(CONFIG_CPU_R3K_TLB)
183# define _CACHE_UNCACHED (1 << _CACHE_UNCACHED_SHIFT)
184# define _CACHE_MASK _CACHE_UNCACHED
185# define _PFN_SHIFT PAGE_SHIFT
186#else
187# define _CACHE_MASK (7 << _CACHE_SHIFT)
188# define _PFN_SHIFT (PAGE_SHIFT - 12 + _CACHE_SHIFT + 3)
189#endif
190
191#ifndef _PAGE_NO_EXEC
192#define _PAGE_NO_EXEC 0
193#endif
194
195#define _PAGE_SILENT_READ _PAGE_VALID
196#define _PAGE_SILENT_WRITE _PAGE_DIRTY
197
198#define _PFN_MASK (~((1 << (_PFN_SHIFT)) - 1))
199
200/*
201 * The final layouts of the PTE bits are:
202 *
203 * 64-bit, R1 or earlier: CCC D V G [S H] M A W R P
204 * 32-bit, R1 or earler: CCC D V G M A W R P
205 * 64-bit, R2 or later: CCC D V G RI/R XI [S H] M A W P
206 * 32-bit, R2 or later: CCC D V G RI/R XI M A W P
207 */
208
209
210/*
211 * pte_to_entrylo converts a page table entry (PTE) into a Mips
212 * entrylo0/1 value.
213 */
214static inline uint64_t pte_to_entrylo(unsigned long pte_val)
215{
216#ifdef CONFIG_CPU_HAS_RIXI
217 if (cpu_has_rixi) {
218 int sa;
219#ifdef CONFIG_32BIT
220 sa = 31 - _PAGE_NO_READ_SHIFT;
221#else
222 sa = 63 - _PAGE_NO_READ_SHIFT;
223#endif
224 /*
225 * C has no way to express that this is a DSRL
226 * _PAGE_NO_EXEC_SHIFT followed by a ROTR 2. Luckily
227 * in the fast path this is done in assembly
228 */
229 return (pte_val >> _PAGE_GLOBAL_SHIFT) |
230 ((pte_val & (_PAGE_NO_EXEC | _PAGE_NO_READ)) << sa);
231 }
232#endif
233
234 return pte_val >> _PAGE_GLOBAL_SHIFT;
235}
236
237/*
238 * Cache attributes
239 */
240#if defined(CONFIG_CPU_R3K_TLB)
241
242#define _CACHE_CACHABLE_NONCOHERENT 0
243#define _CACHE_UNCACHED_ACCELERATED _CACHE_UNCACHED
244
245#elif defined(CONFIG_CPU_SB1)
246
247/* No penalty for being coherent on the SB1, so just
248 use it for "noncoherent" spaces, too. Shouldn't hurt. */
249
250#define _CACHE_CACHABLE_NONCOHERENT (5<<_CACHE_SHIFT)
251
252#endif
253
254#ifndef _CACHE_CACHABLE_NO_WA
255#define _CACHE_CACHABLE_NO_WA (0<<_CACHE_SHIFT)
256#endif
257#ifndef _CACHE_CACHABLE_WA
258#define _CACHE_CACHABLE_WA (1<<_CACHE_SHIFT)
259#endif
260#ifndef _CACHE_UNCACHED
261#define _CACHE_UNCACHED (2<<_CACHE_SHIFT)
262#endif
263#ifndef _CACHE_CACHABLE_NONCOHERENT
264#define _CACHE_CACHABLE_NONCOHERENT (3<<_CACHE_SHIFT)
265#endif
266#ifndef _CACHE_CACHABLE_CE
267#define _CACHE_CACHABLE_CE (4<<_CACHE_SHIFT)
268#endif
269#ifndef _CACHE_CACHABLE_COW
270#define _CACHE_CACHABLE_COW (5<<_CACHE_SHIFT)
271#endif
272#ifndef _CACHE_CACHABLE_CUW
273#define _CACHE_CACHABLE_CUW (6<<_CACHE_SHIFT)
274#endif
275#ifndef _CACHE_UNCACHED_ACCELERATED
276#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT)
277#endif
278
279#define __READABLE (_PAGE_SILENT_READ | _PAGE_ACCESSED)
280#define __WRITEABLE (_PAGE_SILENT_WRITE | _PAGE_WRITE | _PAGE_MODIFIED)
281
282#define _PAGE_CHG_MASK (_PAGE_ACCESSED | _PAGE_MODIFIED | \
283 _PAGE_SOFT_DIRTY | _PFN_MASK | _CACHE_MASK)
284
285#endif /* _ASM_PGTABLE_BITS_H */
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
new file mode 100644
index 000000000..e5ef0fdd4
--- /dev/null
+++ b/arch/mips/include/asm/pgtable.h
@@ -0,0 +1,744 @@
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 <linux/mm_types.h>
12#include <linux/mmzone.h>
13#ifdef CONFIG_32BIT
14#include <asm/pgtable-32.h>
15#endif
16#ifdef CONFIG_64BIT
17#include <asm/pgtable-64.h>
18#endif
19
20#include <asm/cmpxchg.h>
21#include <asm/io.h>
22#include <asm/pgtable-bits.h>
23#include <asm/cpu-features.h>
24
25struct mm_struct;
26struct vm_area_struct;
27
28#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_NO_READ | \
29 _page_cachable_default)
30#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_WRITE | \
31 _page_cachable_default)
32#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_NO_EXEC | \
33 _page_cachable_default)
34#define PAGE_READONLY __pgprot(_PAGE_PRESENT | \
35 _page_cachable_default)
36#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
37 _PAGE_GLOBAL | _page_cachable_default)
38#define PAGE_KERNEL_NC __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
39 _PAGE_GLOBAL | _CACHE_CACHABLE_NONCOHERENT)
40#define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \
41 __WRITEABLE | _PAGE_GLOBAL | _CACHE_UNCACHED)
42
43/*
44 * If _PAGE_NO_EXEC is not defined, we can't do page protection for
45 * execute, and consider it to be the same as read. Also, write
46 * permissions imply read permissions. This is the closest we can get
47 * by reasonable means..
48 */
49
50/*
51 * Dummy values to fill the table in mmap.c
52 * The real values will be generated at runtime
53 */
54#define __P000 __pgprot(0)
55#define __P001 __pgprot(0)
56#define __P010 __pgprot(0)
57#define __P011 __pgprot(0)
58#define __P100 __pgprot(0)
59#define __P101 __pgprot(0)
60#define __P110 __pgprot(0)
61#define __P111 __pgprot(0)
62
63#define __S000 __pgprot(0)
64#define __S001 __pgprot(0)
65#define __S010 __pgprot(0)
66#define __S011 __pgprot(0)
67#define __S100 __pgprot(0)
68#define __S101 __pgprot(0)
69#define __S110 __pgprot(0)
70#define __S111 __pgprot(0)
71
72extern unsigned long _page_cachable_default;
73
74/*
75 * ZERO_PAGE is a global shared page that is always zero; used
76 * for zero-mapped memory areas etc..
77 */
78
79extern unsigned long empty_zero_page;
80extern unsigned long zero_page_mask;
81
82#define ZERO_PAGE(vaddr) \
83 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
84#define __HAVE_COLOR_ZERO_PAGE
85
86extern void paging_init(void);
87
88/*
89 * Conversion functions: convert a page and protection to a page entry,
90 * and a page entry and page directory to the page they refer to.
91 */
92#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
93
94#define __pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
95#ifndef CONFIG_TRANSPARENT_HUGEPAGE
96#define pmd_page(pmd) __pmd_page(pmd)
97#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
98
99#define pmd_page_vaddr(pmd) pmd_val(pmd)
100
101#define htw_stop() \
102do { \
103 unsigned long flags; \
104 \
105 if (cpu_has_htw) { \
106 local_irq_save(flags); \
107 if(!raw_current_cpu_data.htw_seq++) { \
108 write_c0_pwctl(read_c0_pwctl() & \
109 ~(1 << MIPS_PWCTL_PWEN_SHIFT)); \
110 back_to_back_c0_hazard(); \
111 } \
112 local_irq_restore(flags); \
113 } \
114} while(0)
115
116#define htw_start() \
117do { \
118 unsigned long flags; \
119 \
120 if (cpu_has_htw) { \
121 local_irq_save(flags); \
122 if (!--raw_current_cpu_data.htw_seq) { \
123 write_c0_pwctl(read_c0_pwctl() | \
124 (1 << MIPS_PWCTL_PWEN_SHIFT)); \
125 back_to_back_c0_hazard(); \
126 } \
127 local_irq_restore(flags); \
128 } \
129} while(0)
130
131static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
132 pte_t *ptep, pte_t pteval);
133
134#if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32)
135
136#ifdef CONFIG_XPA
137# define pte_none(pte) (!(((pte).pte_high) & ~_PAGE_GLOBAL))
138#else
139# define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL))
140#endif
141
142#define pte_present(pte) ((pte).pte_low & _PAGE_PRESENT)
143#define pte_no_exec(pte) ((pte).pte_low & _PAGE_NO_EXEC)
144
145static inline void set_pte(pte_t *ptep, pte_t pte)
146{
147 ptep->pte_high = pte.pte_high;
148 smp_wmb();
149 ptep->pte_low = pte.pte_low;
150
151#ifdef CONFIG_XPA
152 if (pte.pte_high & _PAGE_GLOBAL) {
153#else
154 if (pte.pte_low & _PAGE_GLOBAL) {
155#endif
156 pte_t *buddy = ptep_buddy(ptep);
157 /*
158 * Make sure the buddy is global too (if it's !none,
159 * it better already be global)
160 */
161 if (pte_none(*buddy)) {
162 if (!IS_ENABLED(CONFIG_XPA))
163 buddy->pte_low |= _PAGE_GLOBAL;
164 buddy->pte_high |= _PAGE_GLOBAL;
165 }
166 }
167}
168
169static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
170{
171 pte_t null = __pte(0);
172
173 htw_stop();
174 /* Preserve global status for the pair */
175 if (IS_ENABLED(CONFIG_XPA)) {
176 if (ptep_buddy(ptep)->pte_high & _PAGE_GLOBAL)
177 null.pte_high = _PAGE_GLOBAL;
178 } else {
179 if (ptep_buddy(ptep)->pte_low & _PAGE_GLOBAL)
180 null.pte_low = null.pte_high = _PAGE_GLOBAL;
181 }
182
183 set_pte_at(mm, addr, ptep, null);
184 htw_start();
185}
186#else
187
188#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
189#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
190#define pte_no_exec(pte) (pte_val(pte) & _PAGE_NO_EXEC)
191
192/*
193 * Certain architectures need to do special things when pte's
194 * within a page table are directly modified. Thus, the following
195 * hook is made available.
196 */
197static inline void set_pte(pte_t *ptep, pte_t pteval)
198{
199 *ptep = pteval;
200#if !defined(CONFIG_CPU_R3K_TLB)
201 if (pte_val(pteval) & _PAGE_GLOBAL) {
202 pte_t *buddy = ptep_buddy(ptep);
203 /*
204 * Make sure the buddy is global too (if it's !none,
205 * it better already be global)
206 */
207# if defined(CONFIG_PHYS_ADDR_T_64BIT) && !defined(CONFIG_CPU_MIPS32)
208 cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL);
209# else
210 cmpxchg(&buddy->pte, 0, _PAGE_GLOBAL);
211# endif
212 }
213#endif
214}
215
216static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
217{
218 htw_stop();
219#if !defined(CONFIG_CPU_R3K_TLB)
220 /* Preserve global status for the pair */
221 if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL)
222 set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL));
223 else
224#endif
225 set_pte_at(mm, addr, ptep, __pte(0));
226 htw_start();
227}
228#endif
229
230static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
231 pte_t *ptep, pte_t pteval)
232{
233 extern void __update_cache(unsigned long address, pte_t pte);
234
235 if (!pte_present(pteval))
236 goto cache_sync_done;
237
238 if (pte_present(*ptep) && (pte_pfn(*ptep) == pte_pfn(pteval)))
239 goto cache_sync_done;
240
241 __update_cache(addr, pteval);
242cache_sync_done:
243 set_pte(ptep, pteval);
244}
245
246/*
247 * (pmds are folded into puds so this doesn't get actually called,
248 * but the define is needed for a generic inline function.)
249 */
250#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
251
252#ifndef __PAGETABLE_PMD_FOLDED
253/*
254 * (puds are folded into pgds so this doesn't get actually called,
255 * but the define is needed for a generic inline function.)
256 */
257#define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0)
258#endif
259
260#define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1)
261#define PMD_T_LOG2 (__builtin_ffs(sizeof(pmd_t)) - 1)
262#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
263
264/*
265 * We used to declare this array with size but gcc 3.3 and older are not able
266 * to find that this expression is a constant, so the size is dropped.
267 */
268extern pgd_t swapper_pg_dir[];
269
270/*
271 * Platform specific pte_special() and pte_mkspecial() definitions
272 * are required only when ARCH_HAS_PTE_SPECIAL is enabled.
273 */
274#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
275#if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32)
276static inline int pte_special(pte_t pte)
277{
278 return pte.pte_low & _PAGE_SPECIAL;
279}
280
281static inline pte_t pte_mkspecial(pte_t pte)
282{
283 pte.pte_low |= _PAGE_SPECIAL;
284 return pte;
285}
286#else
287static inline int pte_special(pte_t pte)
288{
289 return pte_val(pte) & _PAGE_SPECIAL;
290}
291
292static inline pte_t pte_mkspecial(pte_t pte)
293{
294 pte_val(pte) |= _PAGE_SPECIAL;
295 return pte;
296}
297#endif
298#endif /* CONFIG_ARCH_HAS_PTE_SPECIAL */
299
300/*
301 * The following only work if pte_present() is true.
302 * Undefined behaviour if not..
303 */
304#if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32)
305static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; }
306static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; }
307static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; }
308
309static inline pte_t pte_wrprotect(pte_t pte)
310{
311 pte.pte_low &= ~_PAGE_WRITE;
312 if (!IS_ENABLED(CONFIG_XPA))
313 pte.pte_low &= ~_PAGE_SILENT_WRITE;
314 pte.pte_high &= ~_PAGE_SILENT_WRITE;
315 return pte;
316}
317
318static inline pte_t pte_mkclean(pte_t pte)
319{
320 pte.pte_low &= ~_PAGE_MODIFIED;
321 if (!IS_ENABLED(CONFIG_XPA))
322 pte.pte_low &= ~_PAGE_SILENT_WRITE;
323 pte.pte_high &= ~_PAGE_SILENT_WRITE;
324 return pte;
325}
326
327static inline pte_t pte_mkold(pte_t pte)
328{
329 pte.pte_low &= ~_PAGE_ACCESSED;
330 if (!IS_ENABLED(CONFIG_XPA))
331 pte.pte_low &= ~_PAGE_SILENT_READ;
332 pte.pte_high &= ~_PAGE_SILENT_READ;
333 return pte;
334}
335
336static inline pte_t pte_mkwrite(pte_t pte)
337{
338 pte.pte_low |= _PAGE_WRITE;
339 if (pte.pte_low & _PAGE_MODIFIED) {
340 if (!IS_ENABLED(CONFIG_XPA))
341 pte.pte_low |= _PAGE_SILENT_WRITE;
342 pte.pte_high |= _PAGE_SILENT_WRITE;
343 }
344 return pte;
345}
346
347static inline pte_t pte_mkdirty(pte_t pte)
348{
349 pte.pte_low |= _PAGE_MODIFIED;
350 if (pte.pte_low & _PAGE_WRITE) {
351 if (!IS_ENABLED(CONFIG_XPA))
352 pte.pte_low |= _PAGE_SILENT_WRITE;
353 pte.pte_high |= _PAGE_SILENT_WRITE;
354 }
355 return pte;
356}
357
358static inline pte_t pte_mkyoung(pte_t pte)
359{
360 pte.pte_low |= _PAGE_ACCESSED;
361 if (!(pte.pte_low & _PAGE_NO_READ)) {
362 if (!IS_ENABLED(CONFIG_XPA))
363 pte.pte_low |= _PAGE_SILENT_READ;
364 pte.pte_high |= _PAGE_SILENT_READ;
365 }
366 return pte;
367}
368#else
369static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
370static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
371static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
372
373static inline pte_t pte_wrprotect(pte_t pte)
374{
375 pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
376 return pte;
377}
378
379static inline pte_t pte_mkclean(pte_t pte)
380{
381 pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE);
382 return pte;
383}
384
385static inline pte_t pte_mkold(pte_t pte)
386{
387 pte_val(pte) &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ);
388 return pte;
389}
390
391static inline pte_t pte_mkwrite(pte_t pte)
392{
393 pte_val(pte) |= _PAGE_WRITE;
394 if (pte_val(pte) & _PAGE_MODIFIED)
395 pte_val(pte) |= _PAGE_SILENT_WRITE;
396 return pte;
397}
398
399static inline pte_t pte_mkdirty(pte_t pte)
400{
401 pte_val(pte) |= _PAGE_MODIFIED | _PAGE_SOFT_DIRTY;
402 if (pte_val(pte) & _PAGE_WRITE)
403 pte_val(pte) |= _PAGE_SILENT_WRITE;
404 return pte;
405}
406
407static inline pte_t pte_mkyoung(pte_t pte)
408{
409 pte_val(pte) |= _PAGE_ACCESSED;
410 if (!(pte_val(pte) & _PAGE_NO_READ))
411 pte_val(pte) |= _PAGE_SILENT_READ;
412 return pte;
413}
414
415#define pte_sw_mkyoung pte_mkyoung
416
417#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
418static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_HUGE; }
419
420static inline pte_t pte_mkhuge(pte_t pte)
421{
422 pte_val(pte) |= _PAGE_HUGE;
423 return pte;
424}
425#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
426
427#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
428static inline bool pte_soft_dirty(pte_t pte)
429{
430 return pte_val(pte) & _PAGE_SOFT_DIRTY;
431}
432#define pte_swp_soft_dirty pte_soft_dirty
433
434static inline pte_t pte_mksoft_dirty(pte_t pte)
435{
436 pte_val(pte) |= _PAGE_SOFT_DIRTY;
437 return pte;
438}
439#define pte_swp_mksoft_dirty pte_mksoft_dirty
440
441static inline pte_t pte_clear_soft_dirty(pte_t pte)
442{
443 pte_val(pte) &= ~(_PAGE_SOFT_DIRTY);
444 return pte;
445}
446#define pte_swp_clear_soft_dirty pte_clear_soft_dirty
447
448#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
449
450#endif
451
452/*
453 * Macro to make mark a page protection value as "uncacheable". Note
454 * that "protection" is really a misnomer here as the protection value
455 * contains the memory attribute bits, dirty bits, and various other
456 * bits as well.
457 */
458#define pgprot_noncached pgprot_noncached
459
460static inline pgprot_t pgprot_noncached(pgprot_t _prot)
461{
462 unsigned long prot = pgprot_val(_prot);
463
464 prot = (prot & ~_CACHE_MASK) | _CACHE_UNCACHED;
465
466 return __pgprot(prot);
467}
468
469#define pgprot_writecombine pgprot_writecombine
470
471static inline pgprot_t pgprot_writecombine(pgprot_t _prot)
472{
473 unsigned long prot = pgprot_val(_prot);
474
475 /* cpu_data[0].writecombine is already shifted by _CACHE_SHIFT */
476 prot = (prot & ~_CACHE_MASK) | cpu_data[0].writecombine;
477
478 return __pgprot(prot);
479}
480
481static inline void flush_tlb_fix_spurious_fault(struct vm_area_struct *vma,
482 unsigned long address)
483{
484}
485
486#define __HAVE_ARCH_PTE_SAME
487static inline int pte_same(pte_t pte_a, pte_t pte_b)
488{
489 return pte_val(pte_a) == pte_val(pte_b);
490}
491
492#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
493static inline int ptep_set_access_flags(struct vm_area_struct *vma,
494 unsigned long address, pte_t *ptep,
495 pte_t entry, int dirty)
496{
497 if (!pte_same(*ptep, entry))
498 set_pte_at(vma->vm_mm, address, ptep, entry);
499 /*
500 * update_mmu_cache will unconditionally execute, handling both
501 * the case that the PTE changed and the spurious fault case.
502 */
503 return true;
504}
505
506/*
507 * Conversion functions: convert a page and protection to a page entry,
508 * and a page entry and page directory to the page they refer to.
509 */
510#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
511
512#if defined(CONFIG_XPA)
513static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
514{
515 pte.pte_low &= (_PAGE_MODIFIED | _PAGE_ACCESSED | _PFNX_MASK);
516 pte.pte_high &= (_PFN_MASK | _CACHE_MASK);
517 pte.pte_low |= pgprot_val(newprot) & ~_PFNX_MASK;
518 pte.pte_high |= pgprot_val(newprot) & ~(_PFN_MASK | _CACHE_MASK);
519 return pte;
520}
521#elif defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32)
522static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
523{
524 pte.pte_low &= _PAGE_CHG_MASK;
525 pte.pte_high &= (_PFN_MASK | _CACHE_MASK);
526 pte.pte_low |= pgprot_val(newprot);
527 pte.pte_high |= pgprot_val(newprot) & ~(_PFN_MASK | _CACHE_MASK);
528 return pte;
529}
530#else
531static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
532{
533 pte_val(pte) &= _PAGE_CHG_MASK;
534 pte_val(pte) |= pgprot_val(newprot) & ~_PAGE_CHG_MASK;
535 if ((pte_val(pte) & _PAGE_ACCESSED) && !(pte_val(pte) & _PAGE_NO_READ))
536 pte_val(pte) |= _PAGE_SILENT_READ;
537 return pte;
538}
539#endif
540
541
542extern void __update_tlb(struct vm_area_struct *vma, unsigned long address,
543 pte_t pte);
544
545static inline void update_mmu_cache(struct vm_area_struct *vma,
546 unsigned long address, pte_t *ptep)
547{
548 pte_t pte = *ptep;
549 __update_tlb(vma, address, pte);
550}
551
552#define __HAVE_ARCH_UPDATE_MMU_TLB
553#define update_mmu_tlb update_mmu_cache
554
555static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
556 unsigned long address, pmd_t *pmdp)
557{
558 pte_t pte = *(pte_t *)pmdp;
559
560 __update_tlb(vma, address, pte);
561}
562
563#define kern_addr_valid(addr) (1)
564
565/*
566 * Allow physical addresses to be fixed up to help 36-bit peripherals.
567 */
568#ifdef CONFIG_MIPS_FIXUP_BIGPHYS_ADDR
569phys_addr_t fixup_bigphys_addr(phys_addr_t addr, phys_addr_t size);
570int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long vaddr,
571 unsigned long pfn, unsigned long size, pgprot_t prot);
572#define io_remap_pfn_range io_remap_pfn_range
573#else
574#define fixup_bigphys_addr(addr, size) (addr)
575#endif /* CONFIG_MIPS_FIXUP_BIGPHYS_ADDR */
576
577#ifdef CONFIG_TRANSPARENT_HUGEPAGE
578
579/* We don't have hardware dirty/accessed bits, generic_pmdp_establish is fine.*/
580#define pmdp_establish generic_pmdp_establish
581
582#define has_transparent_hugepage has_transparent_hugepage
583extern int has_transparent_hugepage(void);
584
585static inline int pmd_trans_huge(pmd_t pmd)
586{
587 return !!(pmd_val(pmd) & _PAGE_HUGE);
588}
589
590static inline pmd_t pmd_mkhuge(pmd_t pmd)
591{
592 pmd_val(pmd) |= _PAGE_HUGE;
593
594 return pmd;
595}
596
597extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
598 pmd_t *pmdp, pmd_t pmd);
599
600#define pmd_write pmd_write
601static inline int pmd_write(pmd_t pmd)
602{
603 return !!(pmd_val(pmd) & _PAGE_WRITE);
604}
605
606static inline pmd_t pmd_wrprotect(pmd_t pmd)
607{
608 pmd_val(pmd) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
609 return pmd;
610}
611
612static inline pmd_t pmd_mkwrite(pmd_t pmd)
613{
614 pmd_val(pmd) |= _PAGE_WRITE;
615 if (pmd_val(pmd) & _PAGE_MODIFIED)
616 pmd_val(pmd) |= _PAGE_SILENT_WRITE;
617
618 return pmd;
619}
620
621static inline int pmd_dirty(pmd_t pmd)
622{
623 return !!(pmd_val(pmd) & _PAGE_MODIFIED);
624}
625
626static inline pmd_t pmd_mkclean(pmd_t pmd)
627{
628 pmd_val(pmd) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE);
629 return pmd;
630}
631
632static inline pmd_t pmd_mkdirty(pmd_t pmd)
633{
634 pmd_val(pmd) |= _PAGE_MODIFIED | _PAGE_SOFT_DIRTY;
635 if (pmd_val(pmd) & _PAGE_WRITE)
636 pmd_val(pmd) |= _PAGE_SILENT_WRITE;
637
638 return pmd;
639}
640
641static inline int pmd_young(pmd_t pmd)
642{
643 return !!(pmd_val(pmd) & _PAGE_ACCESSED);
644}
645
646static inline pmd_t pmd_mkold(pmd_t pmd)
647{
648 pmd_val(pmd) &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ);
649
650 return pmd;
651}
652
653static inline pmd_t pmd_mkyoung(pmd_t pmd)
654{
655 pmd_val(pmd) |= _PAGE_ACCESSED;
656
657 if (!(pmd_val(pmd) & _PAGE_NO_READ))
658 pmd_val(pmd) |= _PAGE_SILENT_READ;
659
660 return pmd;
661}
662
663#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
664static inline int pmd_soft_dirty(pmd_t pmd)
665{
666 return !!(pmd_val(pmd) & _PAGE_SOFT_DIRTY);
667}
668
669static inline pmd_t pmd_mksoft_dirty(pmd_t pmd)
670{
671 pmd_val(pmd) |= _PAGE_SOFT_DIRTY;
672 return pmd;
673}
674
675static inline pmd_t pmd_clear_soft_dirty(pmd_t pmd)
676{
677 pmd_val(pmd) &= ~(_PAGE_SOFT_DIRTY);
678 return pmd;
679}
680
681#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
682
683/* Extern to avoid header file madness */
684extern pmd_t mk_pmd(struct page *page, pgprot_t prot);
685
686static inline unsigned long pmd_pfn(pmd_t pmd)
687{
688 return pmd_val(pmd) >> _PFN_SHIFT;
689}
690
691static inline struct page *pmd_page(pmd_t pmd)
692{
693 if (pmd_trans_huge(pmd))
694 return pfn_to_page(pmd_pfn(pmd));
695
696 return pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT);
697}
698
699static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
700{
701 pmd_val(pmd) = (pmd_val(pmd) & (_PAGE_CHG_MASK | _PAGE_HUGE)) |
702 (pgprot_val(newprot) & ~_PAGE_CHG_MASK);
703 return pmd;
704}
705
706static inline pmd_t pmd_mkinvalid(pmd_t pmd)
707{
708 pmd_val(pmd) &= ~(_PAGE_PRESENT | _PAGE_VALID | _PAGE_DIRTY);
709
710 return pmd;
711}
712
713/*
714 * The generic version pmdp_huge_get_and_clear uses a version of pmd_clear() with a
715 * different prototype.
716 */
717#define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR
718static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
719 unsigned long address, pmd_t *pmdp)
720{
721 pmd_t old = *pmdp;
722
723 pmd_clear(pmdp);
724
725 return old;
726}
727
728#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
729
730#ifdef _PAGE_HUGE
731#define pmd_leaf(pmd) ((pmd_val(pmd) & _PAGE_HUGE) != 0)
732#define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0)
733#endif
734
735#define gup_fast_permitted(start, end) (!cpu_has_dc_aliases)
736
737/*
738 * We provide our own get_unmapped area to cope with the virtual aliasing
739 * constraints placed on us by the cache architecture.
740 */
741#define HAVE_ARCH_UNMAPPED_AREA
742#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
743
744#endif /* _ASM_PGTABLE_H */
diff --git a/arch/mips/include/asm/pm-cps.h b/arch/mips/include/asm/pm-cps.h
new file mode 100644
index 000000000..efd96e919
--- /dev/null
+++ b/arch/mips/include/asm/pm-cps.h
@@ -0,0 +1,49 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2014 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_PM_CPS_H__
8#define __MIPS_ASM_PM_CPS_H__
9
10/*
11 * The CM & CPC can only handle coherence & power control on a per-core basis,
12 * thus in an MT system the VP(E)s within each core are coupled and can only
13 * enter or exit states requiring CM or CPC assistance in unison.
14 */
15#if defined(CONFIG_CPU_MIPSR6)
16# define coupled_coherence cpu_has_vp
17#elif defined(CONFIG_MIPS_MT)
18# define coupled_coherence cpu_has_mipsmt
19#else
20# define coupled_coherence 0
21#endif
22
23/* Enumeration of possible PM states */
24enum cps_pm_state {
25 CPS_PM_NC_WAIT, /* MIPS wait instruction, non-coherent */
26 CPS_PM_CLOCK_GATED, /* Core clock gated */
27 CPS_PM_POWER_GATED, /* Core power gated */
28 CPS_PM_STATE_COUNT,
29};
30
31/**
32 * cps_pm_support_state - determine whether the system supports a PM state
33 * @state: the state to test for support
34 *
35 * Returns true if the system supports the given state, otherwise false.
36 */
37extern bool cps_pm_support_state(enum cps_pm_state state);
38
39/**
40 * cps_pm_enter_state - enter a PM state
41 * @state: the state to enter
42 *
43 * Enter the given PM state. If coupled_coherence is non-zero then it is
44 * expected that this function be called at approximately the same time on
45 * each coupled CPU. Returns 0 on successful entry & exit, otherwise -errno.
46 */
47extern int cps_pm_enter_state(enum cps_pm_state state);
48
49#endif /* __MIPS_ASM_PM_CPS_H__ */
diff --git a/arch/mips/include/asm/pm.h b/arch/mips/include/asm/pm.h
new file mode 100644
index 000000000..10bb7b640
--- /dev/null
+++ b/arch/mips/include/asm/pm.h
@@ -0,0 +1,155 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2014 Imagination Technologies Ltd
4 *
5 * PM helper macros for CPU power off (e.g. Suspend-to-RAM).
6 */
7
8#ifndef __ASM_PM_H
9#define __ASM_PM_H
10
11#ifdef __ASSEMBLY__
12
13#include <asm/asm-offsets.h>
14#include <asm/asm.h>
15#include <asm/mipsregs.h>
16#include <asm/regdef.h>
17
18/* Save CPU state to stack for suspend to RAM */
19.macro SUSPEND_SAVE_REGS
20 subu sp, PT_SIZE
21 /* Call preserved GPRs */
22 LONG_S $16, PT_R16(sp)
23 LONG_S $17, PT_R17(sp)
24 LONG_S $18, PT_R18(sp)
25 LONG_S $19, PT_R19(sp)
26 LONG_S $20, PT_R20(sp)
27 LONG_S $21, PT_R21(sp)
28 LONG_S $22, PT_R22(sp)
29 LONG_S $23, PT_R23(sp)
30 LONG_S $28, PT_R28(sp)
31 LONG_S $30, PT_R30(sp)
32 LONG_S $31, PT_R31(sp)
33 /* A couple of CP0 registers with space in pt_regs */
34 mfc0 k0, CP0_STATUS
35 LONG_S k0, PT_STATUS(sp)
36.endm
37
38/* Restore CPU state from stack after resume from RAM */
39.macro RESUME_RESTORE_REGS_RETURN
40 .set push
41 .set noreorder
42 /* A couple of CP0 registers with space in pt_regs */
43 LONG_L k0, PT_STATUS(sp)
44 mtc0 k0, CP0_STATUS
45 /* Call preserved GPRs */
46 LONG_L $16, PT_R16(sp)
47 LONG_L $17, PT_R17(sp)
48 LONG_L $18, PT_R18(sp)
49 LONG_L $19, PT_R19(sp)
50 LONG_L $20, PT_R20(sp)
51 LONG_L $21, PT_R21(sp)
52 LONG_L $22, PT_R22(sp)
53 LONG_L $23, PT_R23(sp)
54 LONG_L $28, PT_R28(sp)
55 LONG_L $30, PT_R30(sp)
56 LONG_L $31, PT_R31(sp)
57 /* Pop and return */
58 jr ra
59 addiu sp, PT_SIZE
60 .set pop
61.endm
62
63/* Get address of static suspend state into t1 */
64.macro LA_STATIC_SUSPEND
65 la t1, mips_static_suspend_state
66.endm
67
68/* Save important CPU state for early restoration to global data */
69.macro SUSPEND_SAVE_STATIC
70#ifdef CONFIG_EVA
71 /*
72 * Segment configuration is saved in global data where it can be easily
73 * reloaded without depending on the segment configuration.
74 */
75 mfc0 k0, CP0_PAGEMASK, 2 /* SegCtl0 */
76 LONG_S k0, SSS_SEGCTL0(t1)
77 mfc0 k0, CP0_PAGEMASK, 3 /* SegCtl1 */
78 LONG_S k0, SSS_SEGCTL1(t1)
79 mfc0 k0, CP0_PAGEMASK, 4 /* SegCtl2 */
80 LONG_S k0, SSS_SEGCTL2(t1)
81#endif
82 /* save stack pointer (pointing to GPRs) */
83 LONG_S sp, SSS_SP(t1)
84.endm
85
86/* Restore important CPU state early from global data */
87.macro RESUME_RESTORE_STATIC
88#ifdef CONFIG_EVA
89 /*
90 * Segment configuration must be restored prior to any access to
91 * allocated memory, as it may reside outside of the legacy kernel
92 * segments.
93 */
94 LONG_L k0, SSS_SEGCTL0(t1)
95 mtc0 k0, CP0_PAGEMASK, 2 /* SegCtl0 */
96 LONG_L k0, SSS_SEGCTL1(t1)
97 mtc0 k0, CP0_PAGEMASK, 3 /* SegCtl1 */
98 LONG_L k0, SSS_SEGCTL2(t1)
99 mtc0 k0, CP0_PAGEMASK, 4 /* SegCtl2 */
100 tlbw_use_hazard
101#endif
102 /* restore stack pointer (pointing to GPRs) */
103 LONG_L sp, SSS_SP(t1)
104.endm
105
106/* flush caches to make sure context has reached memory */
107.macro SUSPEND_CACHE_FLUSH
108 .extern __wback_cache_all
109 .set push
110 .set noreorder
111 la t1, __wback_cache_all
112 LONG_L t0, 0(t1)
113 jalr t0
114 nop
115 .set pop
116 .endm
117
118/* Save suspend state and flush data caches to RAM */
119.macro SUSPEND_SAVE
120 SUSPEND_SAVE_REGS
121 LA_STATIC_SUSPEND
122 SUSPEND_SAVE_STATIC
123 SUSPEND_CACHE_FLUSH
124.endm
125
126/* Restore saved state after resume from RAM and return */
127.macro RESUME_RESTORE_RETURN
128 LA_STATIC_SUSPEND
129 RESUME_RESTORE_STATIC
130 RESUME_RESTORE_REGS_RETURN
131.endm
132
133#else /* __ASSEMBLY__ */
134
135/**
136 * struct mips_static_suspend_state - Core saved CPU state across S2R.
137 * @segctl: CP0 Segment control registers.
138 * @sp: Stack frame where GP register context is saved.
139 *
140 * This structure contains minimal CPU state that must be saved in static kernel
141 * data in order to be able to restore the rest of the state. This includes
142 * segmentation configuration in the case of EVA being enabled, as they must be
143 * restored prior to any kmalloc'd memory being referenced (even the stack
144 * pointer).
145 */
146struct mips_static_suspend_state {
147#ifdef CONFIG_EVA
148 unsigned long segctl[3];
149#endif
150 unsigned long sp;
151};
152
153#endif /* !__ASSEMBLY__ */
154
155#endif /* __ASM_PM_HELPERS_H */
diff --git a/arch/mips/include/asm/prefetch.h b/arch/mips/include/asm/prefetch.h
new file mode 100644
index 000000000..a56594f36
--- /dev/null
+++ b/arch/mips/include/asm/prefetch.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 (C) 2003 by Ralf Baechle
7 */
8#ifndef __ASM_PREFETCH_H
9#define __ASM_PREFETCH_H
10
11
12/*
13 * R5000 and RM5200 implements pref and prefx instructions but they're nops, so
14 * rather than wasting time we pretend these processors don't support
15 * prefetching at all.
16 *
17 * R5432 implements Load, Store, LoadStreamed, StoreStreamed, LoadRetained,
18 * StoreRetained and WriteBackInvalidate but not Pref_PrepareForStore.
19 *
20 * Hell (and the book on my shelf I can't open ...) know what the R8000 does.
21 *
22 * RM7000 version 1.0 interprets all hints as Pref_Load; version 2.0 implements
23 * Pref_PrepareForStore also.
24 *
25 * RM9000 is MIPS IV but implements prefetching like MIPS32/MIPS64; it's
26 * Pref_WriteBackInvalidate is a nop and Pref_PrepareForStore is broken in
27 * current versions due to erratum G105.
28 *
29 * VR5500 (including VR5701 and VR7701) only implement load prefetch.
30 *
31 * Finally MIPS32 and MIPS64 implement all of the following hints.
32 */
33
34#define Pref_Load 0
35#define Pref_Store 1
36 /* 2 and 3 are reserved */
37#define Pref_LoadStreamed 4
38#define Pref_StoreStreamed 5
39#define Pref_LoadRetained 6
40#define Pref_StoreRetained 7
41 /* 8 ... 24 are reserved */
42#define Pref_WriteBackInvalidate 25
43#define Pref_PrepareForStore 30
44
45#ifdef __ASSEMBLY__
46
47 .macro __pref hint addr
48#ifdef CONFIG_CPU_HAS_PREFETCH
49 pref \hint, \addr
50#endif
51 .endm
52
53 .macro pref_load addr
54 __pref Pref_Load, \addr
55 .endm
56
57 .macro pref_store addr
58 __pref Pref_Store, \addr
59 .endm
60
61 .macro pref_load_streamed addr
62 __pref Pref_LoadStreamed, \addr
63 .endm
64
65 .macro pref_store_streamed addr
66 __pref Pref_StoreStreamed, \addr
67 .endm
68
69 .macro pref_load_retained addr
70 __pref Pref_LoadRetained, \addr
71 .endm
72
73 .macro pref_store_retained addr
74 __pref Pref_StoreRetained, \addr
75 .endm
76
77 .macro pref_wback_inv addr
78 __pref Pref_WriteBackInvalidate, \addr
79 .endm
80
81 .macro pref_prepare_for_store addr
82 __pref Pref_PrepareForStore, \addr
83 .endm
84
85#endif
86
87#endif /* __ASM_PREFETCH_H */
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
new file mode 100644
index 000000000..7834e7c0c
--- /dev/null
+++ b/arch/mips/include/asm/processor.h
@@ -0,0 +1,425 @@
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/atomic.h>
15#include <linux/cpumask.h>
16#include <linux/sizes.h>
17#include <linux/threads.h>
18
19#include <asm/cachectl.h>
20#include <asm/cpu.h>
21#include <asm/cpu-info.h>
22#include <asm/dsemul.h>
23#include <asm/mipsregs.h>
24#include <asm/prefetch.h>
25#include <asm/vdso/processor.h>
26
27/*
28 * System setup and hardware flags..
29 */
30
31extern unsigned int vced_count, vcei_count;
32extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
33
34#ifdef CONFIG_32BIT
35#ifdef CONFIG_KVM_GUEST
36/* User space process size is limited to 1GB in KVM Guest Mode */
37#define TASK_SIZE 0x3fff8000UL
38#else
39/*
40 * User space process size: 2GB. This is hardcoded into a few places,
41 * so don't change it unless you know what you are doing.
42 */
43#define TASK_SIZE 0x80000000UL
44#endif
45
46#define STACK_TOP_MAX TASK_SIZE
47
48#define TASK_IS_32BIT_ADDR 1
49
50#endif
51
52#ifdef CONFIG_64BIT
53/*
54 * User space process size: 1TB. This is hardcoded into a few places,
55 * so don't change it unless you know what you are doing. TASK_SIZE
56 * is limited to 1TB by the R4000 architecture; R10000 and better can
57 * support 16TB; the architectural reserve for future expansion is
58 * 8192EB ...
59 */
60#define TASK_SIZE32 0x7fff8000UL
61#ifdef CONFIG_MIPS_VA_BITS_48
62#define TASK_SIZE64 (0x1UL << ((cpu_data[0].vmbits>48)?48:cpu_data[0].vmbits))
63#else
64#define TASK_SIZE64 0x10000000000UL
65#endif
66#define TASK_SIZE (test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64)
67#define STACK_TOP_MAX TASK_SIZE64
68
69#define TASK_SIZE_OF(tsk) \
70 (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64)
71
72#define TASK_IS_32BIT_ADDR test_thread_flag(TIF_32BIT_ADDR)
73
74#endif
75
76#define VDSO_RANDOMIZE_SIZE (TASK_IS_32BIT_ADDR ? SZ_1M : SZ_64M)
77
78extern unsigned long mips_stack_top(void);
79#define STACK_TOP mips_stack_top()
80
81/*
82 * This decides where the kernel will search for a free chunk of vm
83 * space during mmap's.
84 */
85#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
86
87
88#define NUM_FPU_REGS 32
89
90#ifdef CONFIG_CPU_HAS_MSA
91# define FPU_REG_WIDTH 128
92#else
93# define FPU_REG_WIDTH 64
94#endif
95
96union fpureg {
97 __u32 val32[FPU_REG_WIDTH / 32];
98 __u64 val64[FPU_REG_WIDTH / 64];
99};
100
101#ifdef CONFIG_CPU_LITTLE_ENDIAN
102# define FPR_IDX(width, idx) (idx)
103#else
104# define FPR_IDX(width, idx) ((idx) ^ ((64 / (width)) - 1))
105#endif
106
107#define BUILD_FPR_ACCESS(width) \
108static inline u##width get_fpr##width(union fpureg *fpr, unsigned idx) \
109{ \
110 return fpr->val##width[FPR_IDX(width, idx)]; \
111} \
112 \
113static inline void set_fpr##width(union fpureg *fpr, unsigned idx, \
114 u##width val) \
115{ \
116 fpr->val##width[FPR_IDX(width, idx)] = val; \
117}
118
119BUILD_FPR_ACCESS(32)
120BUILD_FPR_ACCESS(64)
121
122/*
123 * It would be nice to add some more fields for emulator statistics,
124 * the additional information is private to the FPU emulator for now.
125 * See arch/mips/include/asm/fpu_emulator.h.
126 */
127
128struct mips_fpu_struct {
129 union fpureg fpr[NUM_FPU_REGS];
130 unsigned int fcr31;
131 unsigned int msacsr;
132};
133
134#define NUM_DSP_REGS 6
135
136typedef unsigned long dspreg_t;
137
138struct mips_dsp_state {
139 dspreg_t dspr[NUM_DSP_REGS];
140 unsigned int dspcontrol;
141};
142
143#define INIT_CPUMASK { \
144 {0,} \
145}
146
147struct mips3264_watch_reg_state {
148 /* The width of watchlo is 32 in a 32 bit kernel and 64 in a
149 64 bit kernel. We use unsigned long as it has the same
150 property. */
151 unsigned long watchlo[NUM_WATCH_REGS];
152 /* Only the mask and IRW bits from watchhi. */
153 u16 watchhi[NUM_WATCH_REGS];
154};
155
156union mips_watch_reg_state {
157 struct mips3264_watch_reg_state mips3264;
158};
159
160#if defined(CONFIG_CPU_CAVIUM_OCTEON)
161
162struct octeon_cop2_state {
163 /* DMFC2 rt, 0x0201 */
164 unsigned long cop2_crc_iv;
165 /* DMFC2 rt, 0x0202 (Set with DMTC2 rt, 0x1202) */
166 unsigned long cop2_crc_length;
167 /* DMFC2 rt, 0x0200 (set with DMTC2 rt, 0x4200) */
168 unsigned long cop2_crc_poly;
169 /* DMFC2 rt, 0x0402; DMFC2 rt, 0x040A */
170 unsigned long cop2_llm_dat[2];
171 /* DMFC2 rt, 0x0084 */
172 unsigned long cop2_3des_iv;
173 /* DMFC2 rt, 0x0080; DMFC2 rt, 0x0081; DMFC2 rt, 0x0082 */
174 unsigned long cop2_3des_key[3];
175 /* DMFC2 rt, 0x0088 (Set with DMTC2 rt, 0x0098) */
176 unsigned long cop2_3des_result;
177 /* DMFC2 rt, 0x0111 (FIXME: Read Pass1 Errata) */
178 unsigned long cop2_aes_inp0;
179 /* DMFC2 rt, 0x0102; DMFC2 rt, 0x0103 */
180 unsigned long cop2_aes_iv[2];
181 /* DMFC2 rt, 0x0104; DMFC2 rt, 0x0105; DMFC2 rt, 0x0106; DMFC2
182 * rt, 0x0107 */
183 unsigned long cop2_aes_key[4];
184 /* DMFC2 rt, 0x0110 */
185 unsigned long cop2_aes_keylen;
186 /* DMFC2 rt, 0x0100; DMFC2 rt, 0x0101 */
187 unsigned long cop2_aes_result[2];
188 /* DMFC2 rt, 0x0240; DMFC2 rt, 0x0241; DMFC2 rt, 0x0242; DMFC2
189 * rt, 0x0243; DMFC2 rt, 0x0244; DMFC2 rt, 0x0245; DMFC2 rt,
190 * 0x0246; DMFC2 rt, 0x0247; DMFC2 rt, 0x0248; DMFC2 rt,
191 * 0x0249; DMFC2 rt, 0x024A; DMFC2 rt, 0x024B; DMFC2 rt,
192 * 0x024C; DMFC2 rt, 0x024D; DMFC2 rt, 0x024E - Pass2 */
193 unsigned long cop2_hsh_datw[15];
194 /* DMFC2 rt, 0x0250; DMFC2 rt, 0x0251; DMFC2 rt, 0x0252; DMFC2
195 * rt, 0x0253; DMFC2 rt, 0x0254; DMFC2 rt, 0x0255; DMFC2 rt,
196 * 0x0256; DMFC2 rt, 0x0257 - Pass2 */
197 unsigned long cop2_hsh_ivw[8];
198 /* DMFC2 rt, 0x0258; DMFC2 rt, 0x0259 - Pass2 */
199 unsigned long cop2_gfm_mult[2];
200 /* DMFC2 rt, 0x025E - Pass2 */
201 unsigned long cop2_gfm_poly;
202 /* DMFC2 rt, 0x025A; DMFC2 rt, 0x025B - Pass2 */
203 unsigned long cop2_gfm_result[2];
204 /* DMFC2 rt, 0x24F, DMFC2 rt, 0x50, OCTEON III */
205 unsigned long cop2_sha3[2];
206};
207#define COP2_INIT \
208 .cp2 = {0,},
209
210struct octeon_cvmseg_state {
211 unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE]
212 [cpu_dcache_line_size() / sizeof(unsigned long)];
213};
214
215#elif defined(CONFIG_CPU_XLP)
216struct nlm_cop2_state {
217 u64 rx[4];
218 u64 tx[4];
219 u32 tx_msg_status;
220 u32 rx_msg_status;
221};
222
223#define COP2_INIT \
224 .cp2 = {{0}, {0}, 0, 0},
225#else
226#define COP2_INIT
227#endif
228
229typedef struct {
230 unsigned long seg;
231} mm_segment_t;
232
233#ifdef CONFIG_CPU_HAS_MSA
234# define ARCH_MIN_TASKALIGN 16
235# define FPU_ALIGN __aligned(16)
236#else
237# define ARCH_MIN_TASKALIGN 8
238# define FPU_ALIGN
239#endif
240
241struct mips_abi;
242
243/*
244 * If you change thread_struct remember to change the #defines below too!
245 */
246struct thread_struct {
247 /* Saved main processor registers. */
248 unsigned long reg16;
249 unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
250 unsigned long reg29, reg30, reg31;
251
252 /* Saved cp0 stuff. */
253 unsigned long cp0_status;
254
255#ifdef CONFIG_MIPS_FP_SUPPORT
256 /* Saved fpu/fpu emulator stuff. */
257 struct mips_fpu_struct fpu FPU_ALIGN;
258 /* Assigned branch delay slot 'emulation' frame */
259 atomic_t bd_emu_frame;
260 /* PC of the branch from a branch delay slot 'emulation' */
261 unsigned long bd_emu_branch_pc;
262 /* PC to continue from following a branch delay slot 'emulation' */
263 unsigned long bd_emu_cont_pc;
264#endif
265#ifdef CONFIG_MIPS_MT_FPAFF
266 /* Emulated instruction count */
267 unsigned long emulated_fp;
268 /* Saved per-thread scheduler affinity mask */
269 cpumask_t user_cpus_allowed;
270#endif /* CONFIG_MIPS_MT_FPAFF */
271
272 /* Saved state of the DSP ASE, if available. */
273 struct mips_dsp_state dsp;
274
275 /* Saved watch register state, if available. */
276 union mips_watch_reg_state watch;
277
278 /* Other stuff associated with the thread. */
279 unsigned long cp0_badvaddr; /* Last user fault */
280 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
281 unsigned long error_code;
282 unsigned long trap_nr;
283#ifdef CONFIG_CPU_CAVIUM_OCTEON
284 struct octeon_cop2_state cp2 __attribute__ ((__aligned__(128)));
285 struct octeon_cvmseg_state cvmseg __attribute__ ((__aligned__(128)));
286#endif
287#ifdef CONFIG_CPU_XLP
288 struct nlm_cop2_state cp2;
289#endif
290 struct mips_abi *abi;
291};
292
293#ifdef CONFIG_MIPS_MT_FPAFF
294#define FPAFF_INIT \
295 .emulated_fp = 0, \
296 .user_cpus_allowed = INIT_CPUMASK,
297#else
298#define FPAFF_INIT
299#endif /* CONFIG_MIPS_MT_FPAFF */
300
301#ifdef CONFIG_MIPS_FP_SUPPORT
302# define FPU_INIT \
303 .fpu = { \
304 .fpr = {{{0,},},}, \
305 .fcr31 = 0, \
306 .msacsr = 0, \
307 }, \
308 /* Delay slot emulation */ \
309 .bd_emu_frame = ATOMIC_INIT(BD_EMUFRAME_NONE), \
310 .bd_emu_branch_pc = 0, \
311 .bd_emu_cont_pc = 0,
312#else
313# define FPU_INIT
314#endif
315
316#define INIT_THREAD { \
317 /* \
318 * Saved main processor registers \
319 */ \
320 .reg16 = 0, \
321 .reg17 = 0, \
322 .reg18 = 0, \
323 .reg19 = 0, \
324 .reg20 = 0, \
325 .reg21 = 0, \
326 .reg22 = 0, \
327 .reg23 = 0, \
328 .reg29 = 0, \
329 .reg30 = 0, \
330 .reg31 = 0, \
331 /* \
332 * Saved cp0 stuff \
333 */ \
334 .cp0_status = 0, \
335 /* \
336 * Saved FPU/FPU emulator stuff \
337 */ \
338 FPU_INIT \
339 /* \
340 * FPU affinity state (null if not FPAFF) \
341 */ \
342 FPAFF_INIT \
343 /* \
344 * Saved DSP stuff \
345 */ \
346 .dsp = { \
347 .dspr = {0, }, \
348 .dspcontrol = 0, \
349 }, \
350 /* \
351 * saved watch register stuff \
352 */ \
353 .watch = {{{0,},},}, \
354 /* \
355 * Other stuff associated with the process \
356 */ \
357 .cp0_badvaddr = 0, \
358 .cp0_baduaddr = 0, \
359 .error_code = 0, \
360 .trap_nr = 0, \
361 /* \
362 * Platform specific cop2 registers(null if no COP2) \
363 */ \
364 COP2_INIT \
365}
366
367struct task_struct;
368
369/* Free all resources held by a thread. */
370#define release_thread(thread) do { } while(0)
371
372/*
373 * Do necessary setup to start up a newly executed thread.
374 */
375extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp);
376
377static inline void flush_thread(void)
378{
379}
380
381unsigned long get_wchan(struct task_struct *p);
382
383#define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + \
384 THREAD_SIZE - 32 - sizeof(struct pt_regs))
385#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk))
386#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
387#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
388#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
389
390/*
391 * Return_address is a replacement for __builtin_return_address(count)
392 * which on certain architectures cannot reasonably be implemented in GCC
393 * (MIPS, Alpha) or is unusable with -fomit-frame-pointer (i386).
394 * Note that __builtin_return_address(x>=1) is forbidden because GCC
395 * aborts compilation on some CPUs. It's simply not possible to unwind
396 * some CPU's stackframes.
397 *
398 * __builtin_return_address works only for non-leaf functions. We avoid the
399 * overhead of a function call by forcing the compiler to save the return
400 * address register on the stack.
401 */
402#define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
403
404#ifdef CONFIG_CPU_HAS_PREFETCH
405
406#define ARCH_HAS_PREFETCH
407#define prefetch(x) __builtin_prefetch((x), 0, 1)
408
409#define ARCH_HAS_PREFETCHW
410#define prefetchw(x) __builtin_prefetch((x), 1, 1)
411
412#endif
413
414/*
415 * Functions & macros implementing the PR_GET_FP_MODE & PR_SET_FP_MODE options
416 * to the prctl syscall.
417 */
418extern int mips_get_process_fp_mode(struct task_struct *task);
419extern int mips_set_process_fp_mode(struct task_struct *task,
420 unsigned int value);
421
422#define GET_FP_MODE(task) mips_get_process_fp_mode(task)
423#define SET_FP_MODE(task,value) mips_set_process_fp_mode(task, value)
424
425#endif /* _ASM_PROCESSOR_H */
diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
new file mode 100644
index 000000000..c42e07671
--- /dev/null
+++ b/arch/mips/include/asm/prom.h
@@ -0,0 +1,30 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/mips/include/asm/prom.h
4 *
5 * Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com>
6 */
7#ifndef __ASM_PROM_H
8#define __ASM_PROM_H
9
10#ifdef CONFIG_USE_OF
11#include <linux/bug.h>
12#include <linux/io.h>
13#include <linux/types.h>
14#include <asm/bootinfo.h>
15
16extern void device_tree_init(void);
17
18struct boot_param_header;
19
20extern void __dt_setup_arch(void *bph);
21extern int __dt_register_buses(const char *bus0, const char *bus1);
22
23#else /* CONFIG_OF */
24static inline void device_tree_init(void) { }
25#endif /* CONFIG_OF */
26
27extern char *mips_get_machine_name(void);
28extern void mips_set_machine_name(const char *name);
29
30#endif /* __ASM_PROM_H */
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
new file mode 100644
index 000000000..1e76774b3
--- /dev/null
+++ b/arch/mips/include/asm/ptrace.h
@@ -0,0 +1,189 @@
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
13#include <linux/compiler.h>
14#include <linux/linkage.h>
15#include <linux/types.h>
16#include <asm/isadep.h>
17#include <asm/page.h>
18#include <asm/thread_info.h>
19#include <uapi/asm/ptrace.h>
20
21/*
22 * This struct defines the way the registers are stored on the stack during a
23 * system call/exception. As usual the registers k0/k1 aren't being saved.
24 *
25 * If you add a register here, also add it to regoffset_table[] in
26 * arch/mips/kernel/ptrace.c.
27 */
28struct pt_regs {
29#ifdef CONFIG_32BIT
30 /* Pad bytes for argument save space on the stack. */
31 unsigned long pad0[8];
32#endif
33
34 /* Saved main processor registers. */
35 unsigned long regs[32];
36
37 /* Saved special registers. */
38 unsigned long cp0_status;
39 unsigned long hi;
40 unsigned long lo;
41#ifdef CONFIG_CPU_HAS_SMARTMIPS
42 unsigned long acx;
43#endif
44 unsigned long cp0_badvaddr;
45 unsigned long cp0_cause;
46 unsigned long cp0_epc;
47#ifdef CONFIG_CPU_CAVIUM_OCTEON
48 unsigned long long mpl[6]; /* MTM{0-5} */
49 unsigned long long mtp[6]; /* MTP{0-5} */
50#endif
51 unsigned long __last[0];
52} __aligned(8);
53
54static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
55{
56 return regs->regs[31];
57}
58
59static inline void instruction_pointer_set(struct pt_regs *regs,
60 unsigned long val)
61{
62 regs->cp0_epc = val;
63}
64
65/* Query offset/name of register from its name/offset */
66extern int regs_query_register_offset(const char *name);
67#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last))
68
69/**
70 * regs_get_register() - get register value from its offset
71 * @regs: pt_regs from which register value is gotten.
72 * @offset: offset number of the register.
73 *
74 * regs_get_register returns the value of a register. The @offset is the
75 * offset of the register in struct pt_regs address which specified by @regs.
76 * If @offset is bigger than MAX_REG_OFFSET, this returns 0.
77 */
78static inline unsigned long regs_get_register(struct pt_regs *regs,
79 unsigned int offset)
80{
81 if (unlikely(offset > MAX_REG_OFFSET))
82 return 0;
83
84 return *(unsigned long *)((unsigned long)regs + offset);
85}
86
87/**
88 * regs_within_kernel_stack() - check the address in the stack
89 * @regs: pt_regs which contains kernel stack pointer.
90 * @addr: address which is checked.
91 *
92 * regs_within_kernel_stack() checks @addr is within the kernel stack page(s).
93 * If @addr is within the kernel stack, it returns true. If not, returns false.
94 */
95static inline int regs_within_kernel_stack(struct pt_regs *regs,
96 unsigned long addr)
97{
98 return ((addr & ~(THREAD_SIZE - 1)) ==
99 (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1)));
100}
101
102/**
103 * regs_get_kernel_stack_nth() - get Nth entry of the stack
104 * @regs: pt_regs which contains kernel stack pointer.
105 * @n: stack entry number.
106 *
107 * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
108 * is specified by @regs. If the @n th entry is NOT in the kernel stack,
109 * this returns 0.
110 */
111static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
112 unsigned int n)
113{
114 unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
115
116 addr += n;
117 if (regs_within_kernel_stack(regs, (unsigned long)addr))
118 return *addr;
119 else
120 return 0;
121}
122
123struct task_struct;
124
125extern int ptrace_getregs(struct task_struct *child,
126 struct user_pt_regs __user *data);
127extern int ptrace_setregs(struct task_struct *child,
128 struct user_pt_regs __user *data);
129
130extern int ptrace_getfpregs(struct task_struct *child, __u32 __user *data);
131extern int ptrace_setfpregs(struct task_struct *child, __u32 __user *data);
132
133extern int ptrace_get_watch_regs(struct task_struct *child,
134 struct pt_watch_regs __user *addr);
135extern int ptrace_set_watch_regs(struct task_struct *child,
136 struct pt_watch_regs __user *addr);
137
138/*
139 * Does the process account for user or for system time?
140 */
141#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER)
142
143static inline int is_syscall_success(struct pt_regs *regs)
144{
145 return !regs->regs[7];
146}
147
148static inline long regs_return_value(struct pt_regs *regs)
149{
150 if (is_syscall_success(regs) || !user_mode(regs))
151 return regs->regs[2];
152 else
153 return -regs->regs[2];
154}
155
156#define instruction_pointer(regs) ((regs)->cp0_epc)
157#define profile_pc(regs) instruction_pointer(regs)
158
159extern asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall);
160extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);
161
162extern void die(const char *, struct pt_regs *) __noreturn;
163
164static inline void die_if_kernel(const char *str, struct pt_regs *regs)
165{
166 if (unlikely(!user_mode(regs)))
167 die(str, regs);
168}
169
170#define current_pt_regs() \
171({ \
172 unsigned long sp = (unsigned long)__builtin_frame_address(0); \
173 (struct pt_regs *)((sp | (THREAD_SIZE - 1)) + 1 - 32) - 1; \
174})
175
176/* Helpers for working with the user stack pointer */
177
178static inline unsigned long user_stack_pointer(struct pt_regs *regs)
179{
180 return regs->regs[29];
181}
182
183static inline void user_stack_pointer_set(struct pt_regs *regs,
184 unsigned long val)
185{
186 regs->regs[29] = val;
187}
188
189#endif /* _ASM_PTRACE_H */
diff --git a/arch/mips/include/asm/r4k-timer.h b/arch/mips/include/asm/r4k-timer.h
new file mode 100644
index 000000000..6e7361629
--- /dev/null
+++ b/arch/mips/include/asm/r4k-timer.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) 2008 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_R4K_TIMER_H
9#define __ASM_R4K_TIMER_H
10
11#include <linux/compiler.h>
12
13#ifdef CONFIG_SYNC_R4K
14
15extern void synchronise_count_master(int cpu);
16extern void synchronise_count_slave(int cpu);
17
18#else
19
20static inline void synchronise_count_master(int cpu)
21{
22}
23
24static inline void synchronise_count_slave(int cpu)
25{
26}
27
28#endif
29
30#endif /* __ASM_R4K_TIMER_H */
diff --git a/arch/mips/include/asm/r4kcache.h b/arch/mips/include/asm/r4kcache.h
new file mode 100644
index 000000000..15ab16f99
--- /dev/null
+++ b/arch/mips/include/asm/r4kcache.h
@@ -0,0 +1,379 @@
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 (davem@davemloft.net)
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 <linux/stringify.h>
16
17#include <asm/asm.h>
18#include <asm/asm-eva.h>
19#include <asm/cacheops.h>
20#include <asm/compiler.h>
21#include <asm/cpu-features.h>
22#include <asm/cpu-type.h>
23#include <asm/mipsmtregs.h>
24#include <asm/mmzone.h>
25#include <asm/unroll.h>
26#include <linux/uaccess.h> /* for uaccess_kernel() */
27
28extern void (*r4k_blast_dcache)(void);
29extern void (*r4k_blast_icache)(void);
30
31/*
32 * This macro return a properly sign-extended address suitable as base address
33 * for indexed cache operations. Two issues here:
34 *
35 * - The MIPS32 and MIPS64 specs permit an implementation to directly derive
36 * the index bits from the virtual address. This breaks with tradition
37 * set by the R4000. To keep unpleasant surprises from happening we pick
38 * an address in KSEG0 / CKSEG0.
39 * - We need a properly sign extended address for 64-bit code. To get away
40 * without ifdefs we let the compiler do it by a type cast.
41 */
42#define INDEX_BASE CKSEG0
43
44#define _cache_op(insn, op, addr) \
45 __asm__ __volatile__( \
46 " .set push \n" \
47 " .set noreorder \n" \
48 " .set "MIPS_ISA_ARCH_LEVEL" \n" \
49 " " insn("%0", "%1") " \n" \
50 " .set pop \n" \
51 : \
52 : "i" (op), "R" (*(unsigned char *)(addr)))
53
54#define cache_op(op, addr) \
55 _cache_op(kernel_cache, op, addr)
56
57static inline void flush_icache_line_indexed(unsigned long addr)
58{
59 cache_op(Index_Invalidate_I, addr);
60}
61
62static inline void flush_dcache_line_indexed(unsigned long addr)
63{
64 cache_op(Index_Writeback_Inv_D, addr);
65}
66
67static inline void flush_scache_line_indexed(unsigned long addr)
68{
69 cache_op(Index_Writeback_Inv_SD, addr);
70}
71
72static inline void flush_icache_line(unsigned long addr)
73{
74 switch (boot_cpu_type()) {
75 case CPU_LOONGSON2EF:
76 cache_op(Hit_Invalidate_I_Loongson2, addr);
77 break;
78
79 default:
80 cache_op(Hit_Invalidate_I, addr);
81 break;
82 }
83}
84
85static inline void flush_dcache_line(unsigned long addr)
86{
87 cache_op(Hit_Writeback_Inv_D, addr);
88}
89
90static inline void invalidate_dcache_line(unsigned long addr)
91{
92 cache_op(Hit_Invalidate_D, addr);
93}
94
95static inline void invalidate_scache_line(unsigned long addr)
96{
97 cache_op(Hit_Invalidate_SD, addr);
98}
99
100static inline void flush_scache_line(unsigned long addr)
101{
102 cache_op(Hit_Writeback_Inv_SD, addr);
103}
104
105#define protected_cache_op(op,addr) \
106({ \
107 int __err = 0; \
108 __asm__ __volatile__( \
109 " .set push \n" \
110 " .set noreorder \n" \
111 " .set "MIPS_ISA_ARCH_LEVEL" \n" \
112 "1: cache %1, (%2) \n" \
113 "2: .insn \n" \
114 " .set pop \n" \
115 " .section .fixup,\"ax\" \n" \
116 "3: li %0, %3 \n" \
117 " j 2b \n" \
118 " .previous \n" \
119 " .section __ex_table,\"a\" \n" \
120 " "STR(PTR)" 1b, 3b \n" \
121 " .previous" \
122 : "+r" (__err) \
123 : "i" (op), "r" (addr), "i" (-EFAULT)); \
124 __err; \
125})
126
127
128#define protected_cachee_op(op,addr) \
129({ \
130 int __err = 0; \
131 __asm__ __volatile__( \
132 " .set push \n" \
133 " .set noreorder \n" \
134 " .set mips0 \n" \
135 " .set eva \n" \
136 "1: cachee %1, (%2) \n" \
137 "2: .insn \n" \
138 " .set pop \n" \
139 " .section .fixup,\"ax\" \n" \
140 "3: li %0, %3 \n" \
141 " j 2b \n" \
142 " .previous \n" \
143 " .section __ex_table,\"a\" \n" \
144 " "STR(PTR)" 1b, 3b \n" \
145 " .previous" \
146 : "+r" (__err) \
147 : "i" (op), "r" (addr), "i" (-EFAULT)); \
148 __err; \
149})
150
151/*
152 * The next two are for badland addresses like signal trampolines.
153 */
154static inline int protected_flush_icache_line(unsigned long addr)
155{
156 switch (boot_cpu_type()) {
157 case CPU_LOONGSON2EF:
158 return protected_cache_op(Hit_Invalidate_I_Loongson2, addr);
159
160 default:
161#ifdef CONFIG_EVA
162 return protected_cachee_op(Hit_Invalidate_I, addr);
163#else
164 return protected_cache_op(Hit_Invalidate_I, addr);
165#endif
166 }
167}
168
169/*
170 * R10000 / R12000 hazard - these processors don't support the Hit_Writeback_D
171 * cacheop so we use Hit_Writeback_Inv_D which is supported by all R4000-style
172 * caches. We're talking about one cacheline unnecessarily getting invalidated
173 * here so the penalty isn't overly hard.
174 */
175static inline int protected_writeback_dcache_line(unsigned long addr)
176{
177#ifdef CONFIG_EVA
178 return protected_cachee_op(Hit_Writeback_Inv_D, addr);
179#else
180 return protected_cache_op(Hit_Writeback_Inv_D, addr);
181#endif
182}
183
184static inline int protected_writeback_scache_line(unsigned long addr)
185{
186#ifdef CONFIG_EVA
187 return protected_cachee_op(Hit_Writeback_Inv_SD, addr);
188#else
189 return protected_cache_op(Hit_Writeback_Inv_SD, addr);
190#endif
191}
192
193/*
194 * This one is RM7000-specific
195 */
196static inline void invalidate_tcache_page(unsigned long addr)
197{
198 cache_op(Page_Invalidate_T, addr);
199}
200
201#define cache_unroll(times, insn, op, addr, lsize) do { \
202 int i = 0; \
203 unroll(times, _cache_op, insn, op, (addr) + (i++ * (lsize))); \
204} while (0)
205
206/* build blast_xxx, blast_xxx_page, blast_xxx_page_indexed */
207#define __BUILD_BLAST_CACHE(pfx, desc, indexop, hitop, lsize, extra) \
208static inline void extra##blast_##pfx##cache##lsize(void) \
209{ \
210 unsigned long start = INDEX_BASE; \
211 unsigned long end = start + current_cpu_data.desc.waysize; \
212 unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
213 unsigned long ws_end = current_cpu_data.desc.ways << \
214 current_cpu_data.desc.waybit; \
215 unsigned long ws, addr; \
216 \
217 for (ws = 0; ws < ws_end; ws += ws_inc) \
218 for (addr = start; addr < end; addr += lsize * 32) \
219 cache_unroll(32, kernel_cache, indexop, \
220 addr | ws, lsize); \
221} \
222 \
223static inline void extra##blast_##pfx##cache##lsize##_page(unsigned long page) \
224{ \
225 unsigned long start = page; \
226 unsigned long end = page + PAGE_SIZE; \
227 \
228 do { \
229 cache_unroll(32, kernel_cache, hitop, start, lsize); \
230 start += lsize * 32; \
231 } while (start < end); \
232} \
233 \
234static inline void extra##blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
235{ \
236 unsigned long indexmask = current_cpu_data.desc.waysize - 1; \
237 unsigned long start = INDEX_BASE + (page & indexmask); \
238 unsigned long end = start + PAGE_SIZE; \
239 unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
240 unsigned long ws_end = current_cpu_data.desc.ways << \
241 current_cpu_data.desc.waybit; \
242 unsigned long ws, addr; \
243 \
244 for (ws = 0; ws < ws_end; ws += ws_inc) \
245 for (addr = start; addr < end; addr += lsize * 32) \
246 cache_unroll(32, kernel_cache, indexop, \
247 addr | ws, lsize); \
248}
249
250__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16, )
251__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16, )
252__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16, )
253__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32, )
254__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32, )
255__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I_Loongson2, 32, loongson2_)
256__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32, )
257__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64, )
258__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64, )
259__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64, )
260__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 128, )
261__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 128, )
262__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128, )
263
264__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16, )
265__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 32, )
266__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 16, )
267__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 32, )
268__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 64, )
269__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128, )
270
271#define __BUILD_BLAST_USER_CACHE(pfx, desc, indexop, hitop, lsize) \
272static inline void blast_##pfx##cache##lsize##_user_page(unsigned long page) \
273{ \
274 unsigned long start = page; \
275 unsigned long end = page + PAGE_SIZE; \
276 \
277 do { \
278 cache_unroll(32, user_cache, hitop, start, lsize); \
279 start += lsize * 32; \
280 } while (start < end); \
281}
282
283__BUILD_BLAST_USER_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D,
284 16)
285__BUILD_BLAST_USER_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16)
286__BUILD_BLAST_USER_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D,
287 32)
288__BUILD_BLAST_USER_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32)
289__BUILD_BLAST_USER_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D,
290 64)
291__BUILD_BLAST_USER_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64)
292
293/* build blast_xxx_range, protected_blast_xxx_range */
294#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot, extra) \
295static inline void prot##extra##blast_##pfx##cache##_range(unsigned long start, \
296 unsigned long end) \
297{ \
298 unsigned long lsize = cpu_##desc##_line_size(); \
299 unsigned long addr = start & ~(lsize - 1); \
300 unsigned long aend = (end - 1) & ~(lsize - 1); \
301 \
302 while (1) { \
303 prot##cache_op(hitop, addr); \
304 if (addr == aend) \
305 break; \
306 addr += lsize; \
307 } \
308}
309
310#ifndef CONFIG_EVA
311
312__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_, )
313__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_, )
314
315#else
316
317#define __BUILD_PROT_BLAST_CACHE_RANGE(pfx, desc, hitop) \
318static inline void protected_blast_##pfx##cache##_range(unsigned long start,\
319 unsigned long end) \
320{ \
321 unsigned long lsize = cpu_##desc##_line_size(); \
322 unsigned long addr = start & ~(lsize - 1); \
323 unsigned long aend = (end - 1) & ~(lsize - 1); \
324 \
325 if (!uaccess_kernel()) { \
326 while (1) { \
327 protected_cachee_op(hitop, addr); \
328 if (addr == aend) \
329 break; \
330 addr += lsize; \
331 } \
332 } else { \
333 while (1) { \
334 protected_cache_op(hitop, addr); \
335 if (addr == aend) \
336 break; \
337 addr += lsize; \
338 } \
339 \
340 } \
341}
342
343__BUILD_PROT_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D)
344__BUILD_PROT_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I)
345
346#endif
347__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_, )
348__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I_Loongson2, \
349 protected_, loongson2_)
350__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, , )
351__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, , )
352__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, , )
353/* blast_inv_dcache_range */
354__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, , )
355__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, , )
356
357/* Currently, this is very specific to Loongson-3 */
358#define __BUILD_BLAST_CACHE_NODE(pfx, desc, indexop, hitop, lsize) \
359static inline void blast_##pfx##cache##lsize##_node(long node) \
360{ \
361 unsigned long start = CAC_BASE | nid_to_addrbase(node); \
362 unsigned long end = start + current_cpu_data.desc.waysize; \
363 unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
364 unsigned long ws_end = current_cpu_data.desc.ways << \
365 current_cpu_data.desc.waybit; \
366 unsigned long ws, addr; \
367 \
368 for (ws = 0; ws < ws_end; ws += ws_inc) \
369 for (addr = start; addr < end; addr += lsize * 32) \
370 cache_unroll(32, kernel_cache, indexop, \
371 addr | ws, lsize); \
372}
373
374__BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16)
375__BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32)
376__BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
377__BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
378
379#endif /* _ASM_R4KCACHE_H */
diff --git a/arch/mips/include/asm/reboot.h b/arch/mips/include/asm/reboot.h
new file mode 100644
index 000000000..e48c0bfab
--- /dev/null
+++ b/arch/mips/include/asm/reboot.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 * Copyright (C) 1997, 1999, 2001, 06 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);
14
15#endif /* _ASM_REBOOT_H */
diff --git a/arch/mips/include/asm/reg.h b/arch/mips/include/asm/reg.h
new file mode 100644
index 000000000..84dc7e2e2
--- /dev/null
+++ b/arch/mips/include/asm/reg.h
@@ -0,0 +1 @@
#include <uapi/asm/reg.h>
diff --git a/arch/mips/include/asm/regdef.h b/arch/mips/include/asm/regdef.h
new file mode 100644
index 000000000..3c687df1d
--- /dev/null
+++ b/arch/mips/include/asm/regdef.h
@@ -0,0 +1,106 @@
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 * Copyright (C) 2011 Wind River Systems,
10 * written by Ralf Baechle <ralf@linux-mips.org>
11 */
12#ifndef _ASM_REGDEF_H
13#define _ASM_REGDEF_H
14
15#include <asm/sgidefs.h>
16
17#if _MIPS_SIM == _MIPS_SIM_ABI32
18
19/*
20 * Symbolic register names for 32 bit ABI
21 */
22#define zero $0 /* wired zero */
23#define AT $1 /* assembler temp - uppercase because of ".set at" */
24#define v0 $2 /* return value */
25#define v1 $3
26#define a0 $4 /* argument registers */
27#define a1 $5
28#define a2 $6
29#define a3 $7
30#define t0 $8 /* caller saved */
31#define t1 $9
32#define t2 $10
33#define t3 $11
34#define t4 $12
35#define ta0 $12
36#define t5 $13
37#define ta1 $13
38#define t6 $14
39#define ta2 $14
40#define t7 $15
41#define ta3 $15
42#define s0 $16 /* callee saved */
43#define s1 $17
44#define s2 $18
45#define s3 $19
46#define s4 $20
47#define s5 $21
48#define s6 $22
49#define s7 $23
50#define t8 $24 /* caller saved */
51#define t9 $25
52#define jp $25 /* PIC jump register */
53#define k0 $26 /* kernel scratch */
54#define k1 $27
55#define gp $28 /* global pointer */
56#define sp $29 /* stack pointer */
57#define fp $30 /* frame pointer */
58#define s8 $30 /* same like fp! */
59#define ra $31 /* return address */
60
61#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
62
63#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
64
65#define zero $0 /* wired zero */
66#define AT $at /* assembler temp - uppercase because of ".set at" */
67#define v0 $2 /* return value - caller saved */
68#define v1 $3
69#define a0 $4 /* argument registers */
70#define a1 $5
71#define a2 $6
72#define a3 $7
73#define a4 $8 /* arg reg 64 bit; caller saved in 32 bit */
74#define ta0 $8
75#define a5 $9
76#define ta1 $9
77#define a6 $10
78#define ta2 $10
79#define a7 $11
80#define ta3 $11
81#define t0 $12 /* caller saved */
82#define t1 $13
83#define t2 $14
84#define t3 $15
85#define s0 $16 /* callee saved */
86#define s1 $17
87#define s2 $18
88#define s3 $19
89#define s4 $20
90#define s5 $21
91#define s6 $22
92#define s7 $23
93#define t8 $24 /* caller saved */
94#define t9 $25 /* callee address for PIC/temp */
95#define jp $25 /* PIC jump register */
96#define k0 $26 /* kernel temporary */
97#define k1 $27
98#define gp $28 /* global pointer - caller saved for PIC */
99#define sp $29 /* stack pointer */
100#define fp $30 /* frame pointer */
101#define s8 $30 /* callee saved */
102#define ra $31 /* return address */
103
104#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
105
106#endif /* _ASM_REGDEF_H */
diff --git a/arch/mips/include/asm/rtlx.h b/arch/mips/include/asm/rtlx.h
new file mode 100644
index 000000000..c10206548
--- /dev/null
+++ b/arch/mips/include/asm/rtlx.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) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
8 */
9#ifndef __ASM_RTLX_H_
10#define __ASM_RTLX_H_
11
12#include <irq.h>
13
14#define RTLX_MODULE_NAME "rtlx"
15
16#define LX_NODE_BASE 10
17
18#define MIPS_CPU_RTLX_IRQ 0
19
20#define RTLX_VERSION 2
21#define RTLX_xID 0x12345600
22#define RTLX_ID (RTLX_xID | RTLX_VERSION)
23#define RTLX_BUFFER_SIZE 2048
24#define RTLX_CHANNELS 8
25
26#define RTLX_CHANNEL_STDIO 0
27#define RTLX_CHANNEL_DBG 1
28#define RTLX_CHANNEL_SYSIO 2
29
30void rtlx_starting(int vpe);
31void rtlx_stopping(int vpe);
32
33int rtlx_open(int index, int can_sleep);
34int rtlx_release(int index);
35ssize_t rtlx_read(int index, void __user *buff, size_t count);
36ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
37unsigned int rtlx_read_poll(int index, int can_sleep);
38unsigned int rtlx_write_poll(int index);
39
40int __init rtlx_module_init(void);
41void __exit rtlx_module_exit(void);
42
43void _interrupt_sp(void);
44
45extern struct vpe_notifications rtlx_notify;
46extern const struct file_operations rtlx_fops;
47extern void (*aprp_hook)(void);
48
49enum rtlx_state {
50 RTLX_STATE_UNUSED = 0,
51 RTLX_STATE_INITIALISED,
52 RTLX_STATE_REMOTE_READY,
53 RTLX_STATE_OPENED
54};
55
56extern struct chan_waitqueues {
57 wait_queue_head_t rt_queue;
58 wait_queue_head_t lx_queue;
59 atomic_t in_open;
60 struct mutex mutex;
61} channel_wqs[RTLX_CHANNELS];
62
63/* each channel supports read and write.
64 linux (vpe0) reads lx_buffer and writes rt_buffer
65 SP (vpe1) reads rt_buffer and writes lx_buffer
66*/
67struct rtlx_channel {
68 enum rtlx_state rt_state;
69 enum rtlx_state lx_state;
70
71 int buffer_size;
72
73 /* read and write indexes per buffer */
74 int rt_write, rt_read;
75 char *rt_buffer;
76
77 int lx_write, lx_read;
78 char *lx_buffer;
79};
80
81extern struct rtlx_info {
82 unsigned long id;
83 enum rtlx_state state;
84 int ap_int_pending; /* Status of 0 or 1 for CONFIG_MIPS_CMP only */
85
86 struct rtlx_channel channel[RTLX_CHANNELS];
87} *rtlx;
88#endif /* __ASM_RTLX_H_ */
diff --git a/arch/mips/include/asm/seccomp.h b/arch/mips/include/asm/seccomp.h
new file mode 100644
index 000000000..aa809589a
--- /dev/null
+++ b/arch/mips/include/asm/seccomp.h
@@ -0,0 +1,35 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_SECCOMP_H
3
4#include <linux/unistd.h>
5
6#ifdef CONFIG_COMPAT
7static inline const int *get_compat_mode1_syscalls(void)
8{
9 static const int syscalls_O32[] = {
10 __NR_O32_Linux + 3, __NR_O32_Linux + 4,
11 __NR_O32_Linux + 1, __NR_O32_Linux + 193,
12 -1, /* negative terminated */
13 };
14 static const int syscalls_N32[] = {
15 __NR_N32_Linux + 0, __NR_N32_Linux + 1,
16 __NR_N32_Linux + 58, __NR_N32_Linux + 211,
17 -1, /* negative terminated */
18 };
19
20 if (IS_ENABLED(CONFIG_MIPS32_O32) && test_thread_flag(TIF_32BIT_REGS))
21 return syscalls_O32;
22
23 if (IS_ENABLED(CONFIG_MIPS32_N32))
24 return syscalls_N32;
25
26 BUG();
27}
28
29#define get_compat_mode1_syscalls get_compat_mode1_syscalls
30
31#endif /* CONFIG_COMPAT */
32
33#include <asm-generic/seccomp.h>
34
35#endif /* __ASM_SECCOMP_H */
diff --git a/arch/mips/include/asm/setup.h b/arch/mips/include/asm/setup.h
new file mode 100644
index 000000000..8c56b862f
--- /dev/null
+++ b/arch/mips/include/asm/setup.h
@@ -0,0 +1,31 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _MIPS_SETUP_H
3#define _MIPS_SETUP_H
4
5#include <linux/types.h>
6#include <uapi/asm/setup.h>
7
8extern void prom_putchar(char);
9extern void setup_early_printk(void);
10
11#ifdef CONFIG_EARLY_PRINTK_8250
12extern void setup_8250_early_printk_port(unsigned long base,
13 unsigned int reg_shift, unsigned int timeout);
14#else
15static inline void setup_8250_early_printk_port(unsigned long base,
16 unsigned int reg_shift, unsigned int timeout) {}
17#endif
18
19void set_handler(unsigned long offset, const void *addr, unsigned long len);
20extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len);
21
22typedef void (*vi_handler_t)(void);
23extern void *set_vi_handler(int n, vi_handler_t addr);
24
25extern void *set_except_vector(int n, void *addr);
26extern unsigned long ebase;
27extern unsigned int hwrena;
28extern void per_cpu_trap_init(bool);
29extern void cpu_cache_init(void);
30
31#endif /* __SETUP_H */
diff --git a/arch/mips/include/asm/sgi/gio.h b/arch/mips/include/asm/sgi/gio.h
new file mode 100644
index 000000000..24be2b425
--- /dev/null
+++ b/arch/mips/include/asm/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/arch/mips/include/asm/sgi/heart.h b/arch/mips/include/asm/sgi/heart.h
new file mode 100644
index 000000000..0d0375195
--- /dev/null
+++ b/arch/mips/include/asm/sgi/heart.h
@@ -0,0 +1,323 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * HEART chip definitions
4 *
5 * Copyright (C) 2004-2007 Stanislaw Skowronek <skylark@unaligned.org>
6 * 2009 Johannes Dickgreber <tanzy@gmx.de>
7 * 2007-2015 Joshua Kinard <kumba@gentoo.org>
8 */
9#ifndef __ASM_SGI_HEART_H
10#define __ASM_SGI_HEART_H
11
12#include <linux/types.h>
13#include <linux/time.h>
14
15/*
16 * There are 8 DIMM slots on an IP30 system
17 * board, which are grouped into four banks
18 */
19#define HEART_MEMORY_BANKS 4
20
21/* HEART can support up to four CPUs */
22#define HEART_MAX_CPUS 4
23
24#define HEART_XKPHYS_BASE ((void *)(IO_BASE | 0x000000000ff00000ULL))
25
26/**
27 * struct ip30_heart_regs - struct that maps IP30 HEART registers.
28 * @mode: HEART_MODE - Purpose Unknown, machine reset called from here.
29 * @sdram_mode: HEART_SDRAM_MODE - purpose unknown.
30 * @mem_refresh: HEART_MEM_REF - purpose unknown.
31 * @mem_req_arb: HEART_MEM_REQ_ARB - purpose unknown.
32 * @mem_cfg.q: union for 64bit access to HEART_MEMCFG - 4x 64bit registers.
33 * @mem_cfg.l: union for 32bit access to HEART_MEMCFG - 8x 32bit registers.
34 * @fc_mode: HEART_FC_MODE - Purpose Unknown, possibly for GFX flow control.
35 * @fc_timer_limit: HEART_FC_TIMER_LIMIT - purpose unknown.
36 * @fc_addr: HEART_FC0_ADDR, HEART_FC1_ADDR - purpose unknown.
37 * @fc_credit_cnt: HEART_FC0_CR_CNT, HEART_FC1_CR_CNT - purpose unknown.
38 * @fc_timer: HEART_FC0_TIMER, HEART_FC1_TIMER - purpose unknown.
39 * @status: HEART_STATUS - HEART status information.
40 * @bus_err_addr: HEART_BERR_ADDR - likely contains addr of recent SIGBUS.
41 * @bus_err_misc: HEART_BERR_MISC - purpose unknown.
42 * @mem_err_addr: HEART_MEMERR_ADDR - likely contains addr of recent mem err.
43 * @mem_err_data: HEART_MEMERR_DATA - purpose unknown.
44 * @piur_acc_err: HEART_PIUR_ACC_ERR - likely for access err to HEART regs.
45 * @mlan_clock_div: HEART_MLAN_CLK_DIV - MicroLAN clock divider.
46 * @mlan_ctrl: HEART_MLAN_CTL - MicroLAN control.
47 * @__pad0: 0x0f40 bytes of padding -> next HEART register 0x01000.
48 * @undefined: Undefined/diag register, write to it triggers PIUR_ACC_ERR.
49 * @__pad1: 0xeff8 bytes of padding -> next HEART register 0x10000.
50 * @imr: HEART_IMR0 to HEART_IMR3 - per-cpu interrupt mask register.
51 * @set_isr: HEART_SET_ISR - set interrupt status register.
52 * @clear_isr: HEART_CLR_ISR - clear interrupt status register.
53 * @isr: HEART_ISR - interrupt status register (read-only).
54 * @imsr: HEART_IMSR - purpose unknown.
55 * @cause: HEART_CAUSE - HEART cause information.
56 * @__pad2: 0xffb8 bytes of padding -> next HEART register 0x20000.
57 * @count: HEART_COUNT - 52-bit counter.
58 * @__pad3: 0xfff8 bytes of padding -> next HEART register 0x30000.
59 * @compare: HEART_COMPARE - 24-bit compare.
60 * @__pad4: 0xfff8 bytes of padding -> next HEART register 0x40000.
61 * @trigger: HEART_TRIGGER - purpose unknown.
62 * @__pad5: 0xfff8 bytes of padding -> next HEART register 0x50000.
63 * @cpuid: HEART_PRID - contains CPU ID of CPU currently accessing HEART.
64 * @__pad6: 0xfff8 bytes of padding -> next HEART register 0x60000.
65 * @sync: HEART_SYNC - purpose unknown.
66 *
67 * HEART is the main system controller ASIC for IP30 system. It incorporates
68 * a memory controller, interrupt status/cause/set/clear management, basic
69 * timer with count/compare, and other functionality. For Linux, not all of
70 * HEART's functions are fully understood.
71 *
72 * Implementation note: All HEART registers are 64bits-wide, but the mem_cfg
73 * register only reports correct values if queried in 32bits. Hence the need
74 * for a union. Even though mem_cfg.l has 8 array slots, we only ever query
75 * up to 4 of those. IP30 has 8 DIMM slots arranged into 4 banks, w/ 2 DIMMs
76 * per bank. Each 32bit read accesses one of these banks. Perhaps HEART was
77 * designed to address up to 8 banks (16 DIMMs)? We may never know.
78 */
79struct ip30_heart_regs { /* 0x0ff00000 */
80 u64 mode; /* + 0x00000 */
81 /* Memory */
82 u64 sdram_mode; /* + 0x00008 */
83 u64 mem_refresh; /* + 0x00010 */
84 u64 mem_req_arb; /* + 0x00018 */
85 union {
86 u64 q[HEART_MEMORY_BANKS]; /* readq() */
87 u32 l[HEART_MEMORY_BANKS * 2]; /* readl() */
88 } mem_cfg; /* + 0x00020 */
89 /* Flow control (gfx?) */
90 u64 fc_mode; /* + 0x00040 */
91 u64 fc_timer_limit; /* + 0x00048 */
92 u64 fc_addr[2]; /* + 0x00050 */
93 u64 fc_credit_cnt[2]; /* + 0x00060 */
94 u64 fc_timer[2]; /* + 0x00070 */
95 /* Status */
96 u64 status; /* + 0x00080 */
97 /* Bus error */
98 u64 bus_err_addr; /* + 0x00088 */
99 u64 bus_err_misc; /* + 0x00090 */
100 /* Memory error */
101 u64 mem_err_addr; /* + 0x00098 */
102 u64 mem_err_data; /* + 0x000a0 */
103 /* Misc */
104 u64 piur_acc_err; /* + 0x000a8 */
105 u64 mlan_clock_div; /* + 0x000b0 */
106 u64 mlan_ctrl; /* + 0x000b8 */
107 u64 __pad0[0x01e8]; /* + 0x000c0 + 0x0f40 */
108 /* Undefined */
109 u64 undefined; /* + 0x01000 */
110 u64 __pad1[0x1dff]; /* + 0x01008 + 0xeff8 */
111 /* Interrupts */
112 u64 imr[HEART_MAX_CPUS]; /* + 0x10000 */
113 u64 set_isr; /* + 0x10020 */
114 u64 clear_isr; /* + 0x10028 */
115 u64 isr; /* + 0x10030 */
116 u64 imsr; /* + 0x10038 */
117 u64 cause; /* + 0x10040 */
118 u64 __pad2[0x1ff7]; /* + 0x10048 + 0xffb8 */
119 /* Timer */
120 u64 count; /* + 0x20000 */
121 u64 __pad3[0x1fff]; /* + 0x20008 + 0xfff8 */
122 u64 compare; /* + 0x30000 */
123 u64 __pad4[0x1fff]; /* + 0x30008 + 0xfff8 */
124 u64 trigger; /* + 0x40000 */
125 u64 __pad5[0x1fff]; /* + 0x40008 + 0xfff8 */
126 /* Misc */
127 u64 cpuid; /* + 0x50000 */
128 u64 __pad6[0x1fff]; /* + 0x50008 + 0xfff8 */
129 u64 sync; /* + 0x60000 */
130};
131
132
133/* For timer-related bits. */
134#define HEART_NS_PER_CYCLE 80
135#define HEART_CYCLES_PER_SEC (NSEC_PER_SEC / HEART_NS_PER_CYCLE)
136
137
138/*
139 * XXX: Everything below this comment will either go away or be cleaned
140 * up to fit in better with Linux. A lot of the bit definitions for
141 * HEART were derived from IRIX's sys/RACER/heart.h header file.
142 */
143
144/* HEART Masks */
145#define HEART_ATK_MASK 0x0007ffffffffffff /* HEART attack mask */
146#define HEART_ACK_ALL_MASK 0xffffffffffffffff /* Ack everything */
147#define HEART_CLR_ALL_MASK 0x0000000000000000 /* Clear all */
148#define HEART_BR_ERR_MASK 0x7ff8000000000000 /* BRIDGE error mask */
149#define HEART_CPU0_ERR_MASK 0x8ff8000000000000 /* CPU0 error mask */
150#define HEART_CPU1_ERR_MASK 0x97f8000000000000 /* CPU1 error mask */
151#define HEART_CPU2_ERR_MASK 0xa7f8000000000000 /* CPU2 error mask */
152#define HEART_CPU3_ERR_MASK 0xc7f8000000000000 /* CPU3 error mask */
153#define HEART_ERR_MASK 0x1ff /* HEART error mask */
154#define HEART_ERR_MASK_START 51 /* HEART error start */
155#define HEART_ERR_MASK_END 63 /* HEART error end */
156
157/* Bits in the HEART_MODE register. */
158#define HM_PROC_DISABLE_SHFT 60
159#define HM_PROC_DISABLE_MSK (0xfUL << HM_PROC_DISABLE_SHFT)
160#define HM_PROC_DISABLE(x) (0x1UL << (x) + HM_PROC_DISABLE_SHFT)
161#define HM_MAX_PSR (0x7UL << 57)
162#define HM_MAX_IOSR (0x7UL << 54)
163#define HM_MAX_PEND_IOSR (0x7UL << 51)
164#define HM_TRIG_SRC_SEL_MSK (0x7UL << 48)
165#define HM_TRIG_HEART_EXC (0x0UL << 48)
166#define HM_TRIG_REG_BIT (0x1UL << 48)
167#define HM_TRIG_SYSCLK (0x2UL << 48)
168#define HM_TRIG_MEMCLK_2X (0x3UL << 48)
169#define HM_TRIG_MEMCLK (0x4UL << 48)
170#define HM_TRIG_IOCLK (0x5UL << 48)
171#define HM_PIU_TEST_MODE (0xfUL << 40)
172#define HM_GP_FLAG_MSK (0xfUL << 36)
173#define HM_GP_FLAG(x) BIT((x) + 36)
174#define HM_MAX_PROC_HYST (0xfUL << 32)
175#define HM_LLP_WRST_AFTER_RST BIT(28)
176#define HM_LLP_LINK_RST BIT(27)
177#define HM_LLP_WARM_RST BIT(26)
178#define HM_COR_ECC_LCK BIT(25)
179#define HM_REDUCED_PWR BIT(24)
180#define HM_COLD_RST BIT(23)
181#define HM_SW_RST BIT(22)
182#define HM_MEM_FORCE_WR BIT(21)
183#define HM_DB_ERR_GEN BIT(20)
184#define HM_SB_ERR_GEN BIT(19)
185#define HM_CACHED_PIO_EN BIT(18)
186#define HM_CACHED_PROM_EN BIT(17)
187#define HM_PE_SYS_COR_ERE BIT(16)
188#define HM_GLOBAL_ECC_EN BIT(15)
189#define HM_IO_COH_EN BIT(14)
190#define HM_INT_EN BIT(13)
191#define HM_DATA_CHK_EN BIT(12)
192#define HM_REF_EN BIT(11)
193#define HM_BAD_SYSWR_ERE BIT(10)
194#define HM_BAD_SYSRD_ERE BIT(9)
195#define HM_SYSSTATE_ERE BIT(8)
196#define HM_SYSCMD_ERE BIT(7)
197#define HM_NCOR_SYS_ERE BIT(6)
198#define HM_COR_SYS_ERE BIT(5)
199#define HM_DATA_ELMNT_ERE BIT(4)
200#define HM_MEM_ADDR_PROC_ERE BIT(3)
201#define HM_MEM_ADDR_IO_ERE BIT(2)
202#define HM_NCOR_MEM_ERE BIT(1)
203#define HM_COR_MEM_ERE BIT(0)
204
205/* Bits in the HEART_MEM_REF register. */
206#define HEART_MEMREF_REFS(x) ((0xfUL & (x)) << 16)
207#define HEART_MEMREF_PERIOD(x) ((0xffffUL & (x)))
208#define HEART_MEMREF_REFS_VAL HEART_MEMREF_REFS(8)
209#define HEART_MEMREF_PERIOD_VAL HEART_MEMREF_PERIOD(0x4000)
210#define HEART_MEMREF_VAL (HEART_MEMREF_REFS_VAL | \
211 HEART_MEMREF_PERIOD_VAL)
212
213/* Bits in the HEART_MEM_REQ_ARB register. */
214#define HEART_MEMARB_IODIS (1 << 20)
215#define HEART_MEMARB_MAXPMWRQS (15 << 16)
216#define HEART_MEMARB_MAXPMRRQS (15 << 12)
217#define HEART_MEMARB_MAXPMRQS (15 << 8)
218#define HEART_MEMARB_MAXRRRQS (15 << 4)
219#define HEART_MEMARB_MAXGBRRQS (15)
220
221/* Bits in the HEART_MEMCFG<x> registers. */
222#define HEART_MEMCFG_VALID 0x80000000 /* Bank is valid */
223#define HEART_MEMCFG_DENSITY 0x01c00000 /* Mem density */
224#define HEART_MEMCFG_SIZE_MASK 0x003f0000 /* Mem size mask */
225#define HEART_MEMCFG_ADDR_MASK 0x000001ff /* Base addr mask */
226#define HEART_MEMCFG_SIZE_SHIFT 16 /* Mem size shift */
227#define HEART_MEMCFG_DENSITY_SHIFT 22 /* Density Shift */
228#define HEART_MEMCFG_UNIT_SHIFT 25 /* Unit Shift, 32MB */
229
230/* Bits in the HEART_STATUS register */
231#define HEART_STAT_HSTL_SDRV BIT(14)
232#define HEART_STAT_FC_CR_OUT(x) BIT((x) + 12)
233#define HEART_STAT_DIR_CNNCT BIT(11)
234#define HEART_STAT_TRITON BIT(10)
235#define HEART_STAT_R4K BIT(9)
236#define HEART_STAT_BIG_ENDIAN BIT(8)
237#define HEART_STAT_PROC_SHFT 4
238#define HEART_STAT_PROC_MSK (0xfUL << HEART_STAT_PROC_SHFT)
239#define HEART_STAT_PROC_ACTIVE(x) (0x1UL << ((x) + HEART_STAT_PROC_SHFT))
240#define HEART_STAT_WIDGET_ID 0xf
241
242/* Bits in the HEART_CAUSE register */
243#define HC_PE_SYS_COR_ERR_MSK (0xfUL << 60)
244#define HC_PE_SYS_COR_ERR(x) BIT((x) + 60)
245#define HC_PIOWDB_OFLOW BIT(44)
246#define HC_PIORWRB_OFLOW BIT(43)
247#define HC_PIUR_ACC_ERR BIT(42)
248#define HC_BAD_SYSWR_ERR BIT(41)
249#define HC_BAD_SYSRD_ERR BIT(40)
250#define HC_SYSSTATE_ERR_MSK (0xfUL << 36)
251#define HC_SYSSTATE_ERR(x) BIT((x) + 36)
252#define HC_SYSCMD_ERR_MSK (0xfUL << 32)
253#define HC_SYSCMD_ERR(x) BIT((x) + 32)
254#define HC_NCOR_SYSAD_ERR_MSK (0xfUL << 28)
255#define HC_NCOR_SYSAD_ERR(x) BIT((x) + 28)
256#define HC_COR_SYSAD_ERR_MSK (0xfUL << 24)
257#define HC_COR_SYSAD_ERR(x) BIT((x) + 24)
258#define HC_DATA_ELMNT_ERR_MSK (0xfUL << 20)
259#define HC_DATA_ELMNT_ERR(x) BIT((x) + 20)
260#define HC_WIDGET_ERR BIT(16)
261#define HC_MEM_ADDR_ERR_PROC_MSK (0xfUL << 4)
262#define HC_MEM_ADDR_ERR_PROC(x) BIT((x) + 4)
263#define HC_MEM_ADDR_ERR_IO BIT(2)
264#define HC_NCOR_MEM_ERR BIT(1)
265#define HC_COR_MEM_ERR BIT(0)
266
267/*
268 * HEART has 64 interrupt vectors available to it, subdivided into five
269 * priority levels. They are numbered 0 to 63.
270 */
271#define HEART_NUM_IRQS 64
272
273/*
274 * These are the five interrupt priority levels and their corresponding
275 * CPU IPx interrupt pins.
276 *
277 * Level 4 - Error Interrupts.
278 * Level 3 - HEART timer interrupt.
279 * Level 2 - CPU IPI, CPU debug, power putton, general device interrupts.
280 * Level 1 - General device interrupts.
281 * Level 0 - General device GFX flow control interrupts.
282 */
283#define HEART_L4_INT_MASK 0xfff8000000000000ULL /* IP6 */
284#define HEART_L3_INT_MASK 0x0004000000000000ULL /* IP5 */
285#define HEART_L2_INT_MASK 0x0003ffff00000000ULL /* IP4 */
286#define HEART_L1_INT_MASK 0x00000000ffff0000ULL /* IP3 */
287#define HEART_L0_INT_MASK 0x000000000000ffffULL /* IP2 */
288
289/* HEART L0 Interrupts (Low Priority) */
290#define HEART_L0_INT_GENERIC 0
291#define HEART_L0_INT_FLOW_CTRL_HWTR_0 1
292#define HEART_L0_INT_FLOW_CTRL_HWTR_1 2
293
294/* HEART L2 Interrupts (High Priority) */
295#define HEART_L2_INT_RESCHED_CPU_0 46
296#define HEART_L2_INT_RESCHED_CPU_1 47
297#define HEART_L2_INT_CALL_CPU_0 48
298#define HEART_L2_INT_CALL_CPU_1 49
299
300/* HEART L3 Interrupts (Compare/Counter Timer) */
301#define HEART_L3_INT_TIMER 50
302
303/* HEART L4 Interrupts (Errors) */
304#define HEART_L4_INT_XWID_ERR_9 51
305#define HEART_L4_INT_XWID_ERR_A 52
306#define HEART_L4_INT_XWID_ERR_B 53
307#define HEART_L4_INT_XWID_ERR_C 54
308#define HEART_L4_INT_XWID_ERR_D 55
309#define HEART_L4_INT_XWID_ERR_E 56
310#define HEART_L4_INT_XWID_ERR_F 57
311#define HEART_L4_INT_XWID_ERR_XBOW 58
312#define HEART_L4_INT_CPU_BUS_ERR_0 59
313#define HEART_L4_INT_CPU_BUS_ERR_1 60
314#define HEART_L4_INT_CPU_BUS_ERR_2 61
315#define HEART_L4_INT_CPU_BUS_ERR_3 62
316#define HEART_L4_INT_HEART_EXCP 63
317
318extern struct ip30_heart_regs __iomem *heart_regs;
319
320#define heart_read ____raw_readq
321#define heart_write ____raw_writeq
322
323#endif /* __ASM_SGI_HEART_H */
diff --git a/arch/mips/include/asm/sgi/hpc3.h b/arch/mips/include/asm/sgi/hpc3.h
new file mode 100644
index 000000000..c0e3dc029
--- /dev/null
+++ b/arch/mips/include/asm/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 * completely 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 reset; /* reset register */
132#define HPC3_ERST_CRESET 0x1 /* Reset dma channel and external controller */
133#define HPC3_ERST_CLRIRQ 0x2 /* Clear channel interrupt */
134#define HPC3_ERST_LBACK 0x4 /* Enable diagnostic loopback mode of Seeq8003 */
135
136 volatile u32 dconfig; /* DMA configuration register */
137#define HPC3_EDCFG_D1 0x0000f /* Cycles to spend in D1 state for PIO */
138#define HPC3_EDCFG_D2 0x000f0 /* Cycles to spend in D2 state for PIO */
139#define HPC3_EDCFG_D3 0x00f00 /* Cycles to spend in D3 state for PIO */
140#define HPC3_EDCFG_WCTRL 0x01000 /* Enable writes of desc into ex ctrl port */
141#define HPC3_EDCFG_FRXDC 0x02000 /* Clear eop stat bits upon rxdc, hw seeq fix */
142#define HPC3_EDCFG_FEOP 0x04000 /* Bad packet marker timeout enable */
143#define HPC3_EDCFG_FIRQ 0x08000 /* Another bad packet timeout enable */
144#define HPC3_EDCFG_PTO 0x30000 /* Programmed timeout value for above two */
145
146 volatile u32 pconfig; /* PIO configuration register */
147#define HPC3_EPCFG_P1 0x000f /* Cycles to spend in P1 state for PIO */
148#define HPC3_EPCFG_P2 0x00f0 /* Cycles to spend in P2 state for PIO */
149#define HPC3_EPCFG_P3 0x0f00 /* Cycles to spend in P3 state for PIO */
150#define HPC3_EPCFG_TST 0x1000 /* Diagnostic 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 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/arch/mips/include/asm/sgi/ioc.h b/arch/mips/include/asm/sgi/ioc.h
new file mode 100644
index 000000000..53c6b1ca6
--- /dev/null
+++ b/arch/mips/include/asm/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 aligned 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) & 0x1e) >> 1)
142#define SGIOC_SYSID_CHIPREV(x) (((x) & 0xe0) >> 5)
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 threshold */
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/arch/mips/include/asm/sgi/ip22.h b/arch/mips/include/asm/sgi/ip22.h
new file mode 100644
index 000000000..87ec9eaa0
--- /dev/null
+++ b/arch/mips/include/asm/sgi/ip22.h
@@ -0,0 +1,80 @@
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 interrupts
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 <irq.h>
25#include <asm/sgi/ioc.h>
26
27#define SGINT_EISA 0 /* 16 EISA irq levels (Indigo2) */
28#define SGINT_CPU MIPS_CPU_IRQ_BASE /* MIPS CPU define 8 interrupt sources */
29#define SGINT_LOCAL0 (SGINT_CPU+8) /* 8 local0 irq levels */
30#define SGINT_LOCAL1 (SGINT_CPU+16) /* 8 local1 irq levels */
31#define SGINT_LOCAL2 (SGINT_CPU+24) /* 8 local2 vectored irq levels */
32#define SGINT_LOCAL3 (SGINT_CPU+32) /* 8 local3 vectored irq levels */
33#define SGINT_END (SGINT_CPU+40) /* End of 'spaces' */
34
35/*
36 * Individual interrupt definitions for the Indy and Indigo2
37 */
38
39#define SGI_SOFT_0_IRQ SGINT_CPU + 0
40#define SGI_SOFT_1_IRQ SGINT_CPU + 1
41#define SGI_LOCAL_0_IRQ SGINT_CPU + 2
42#define SGI_LOCAL_1_IRQ SGINT_CPU + 3
43#define SGI_8254_0_IRQ SGINT_CPU + 4
44#define SGI_8254_1_IRQ SGINT_CPU + 5
45#define SGI_BUSERR_IRQ SGINT_CPU + 6
46#define SGI_TIMER_IRQ SGINT_CPU + 7
47
48#define SGI_FIFO_IRQ SGINT_LOCAL0 + 0 /* FIFO full */
49#define SGI_GIO_0_IRQ SGI_FIFO_IRQ /* GIO-0 */
50#define SGI_WD93_0_IRQ SGINT_LOCAL0 + 1 /* 1st onboard WD93 */
51#define SGI_WD93_1_IRQ SGINT_LOCAL0 + 2 /* 2nd onboard WD93 */
52#define SGI_ENET_IRQ SGINT_LOCAL0 + 3 /* onboard ethernet */
53#define SGI_MCDMA_IRQ SGINT_LOCAL0 + 4 /* MC DMA done */
54#define SGI_PARPORT_IRQ SGINT_LOCAL0 + 5 /* Parallel port */
55#define SGI_GIO_1_IRQ SGINT_LOCAL0 + 6 /* GE / GIO-1 / 2nd-HPC */
56#define SGI_MAP_0_IRQ SGINT_LOCAL0 + 7 /* Mappable interrupt 0 */
57
58#define SGI_GPL0_IRQ SGINT_LOCAL1 + 0 /* General Purpose LOCAL1_N<0> */
59#define SGI_PANEL_IRQ SGINT_LOCAL1 + 1 /* front panel */
60#define SGI_GPL2_IRQ SGINT_LOCAL1 + 2 /* General Purpose LOCAL1_N<2> */
61#define SGI_MAP_1_IRQ SGINT_LOCAL1 + 3 /* Mappable interrupt 1 */
62#define SGI_HPCDMA_IRQ SGINT_LOCAL1 + 4 /* HPC DMA done */
63#define SGI_ACFAIL_IRQ SGINT_LOCAL1 + 5 /* AC fail */
64#define SGI_VINO_IRQ SGINT_LOCAL1 + 6 /* Indy VINO */
65#define SGI_GIO_2_IRQ SGINT_LOCAL1 + 7 /* Vert retrace / GIO-2 */
66
67/* Mapped interrupts. These interrupts may be mapped to either 0, or 1 */
68#define SGI_VERT_IRQ SGINT_LOCAL2 + 0 /* INT3: newport vertical status */
69#define SGI_EISA_IRQ SGINT_LOCAL2 + 3 /* EISA interrupts */
70#define SGI_KEYBD_IRQ SGINT_LOCAL2 + 4 /* keyboard */
71#define SGI_SERIAL_IRQ SGINT_LOCAL2 + 5 /* onboard serial */
72#define SGI_GIOEXP0_IRQ (SGINT_LOCAL2 + 6) /* Indy GIO EXP0 */
73#define SGI_GIOEXP1_IRQ (SGINT_LOCAL2 + 7) /* Indy GIO EXP1 */
74
75#define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE)
76
77extern unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg);
78extern unsigned short ip22_nvram_read(int reg);
79
80#endif
diff --git a/arch/mips/include/asm/sgi/mc.h b/arch/mips/include/asm/sgi/mc.h
new file mode 100644
index 000000000..3a070cec9
--- /dev/null
+++ b/arch/mips/include/asm/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 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/arch/mips/include/asm/sgi/pi1.h b/arch/mips/include/asm/sgi/pi1.h
new file mode 100644
index 000000000..88b814ef3
--- /dev/null
+++ b/arch/mips/include/asm/sgi/pi1.h
@@ -0,0 +1,72 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * pi1.h: Definitions for SGI PI1 parallel port
4 */
5
6#ifndef _SGI_PI1_H
7#define _SGI_PI1_H
8
9struct pi1_regs {
10 u8 _data[3];
11 volatile u8 data;
12 u8 _ctrl[3];
13 volatile u8 ctrl;
14#define PI1_CTRL_STROBE_N 0x01
15#define PI1_CTRL_AFD_N 0x02
16#define PI1_CTRL_INIT_N 0x04
17#define PI1_CTRL_SLIN_N 0x08
18#define PI1_CTRL_IRQ_ENA 0x10
19#define PI1_CTRL_DIR 0x20
20#define PI1_CTRL_SEL 0x40
21 u8 _status[3];
22 volatile u8 status;
23#define PI1_STAT_DEVID 0x03 /* bits 0-1 */
24#define PI1_STAT_NOINK 0x04 /* SGI MODE only */
25#define PI1_STAT_ERROR 0x08
26#define PI1_STAT_ONLINE 0x10
27#define PI1_STAT_PE 0x20
28#define PI1_STAT_ACK 0x40
29#define PI1_STAT_BUSY 0x80
30 u8 _dmactrl[3];
31 volatile u8 dmactrl;
32#define PI1_DMACTRL_FIFO_EMPTY 0x01 /* fifo empty R/O */
33#define PI1_DMACTRL_ABORT 0x02 /* reset DMA and internal fifo W/O */
34#define PI1_DMACTRL_STDMODE 0x00 /* bits 2-3 */
35#define PI1_DMACTRL_SGIMODE 0x04 /* bits 2-3 */
36#define PI1_DMACTRL_RICOHMODE 0x08 /* bits 2-3 */
37#define PI1_DMACTRL_HPMODE 0x0c /* bits 2-3 */
38#define PI1_DMACTRL_BLKMODE 0x10 /* block mode */
39#define PI1_DMACTRL_FIFO_CLEAR 0x20 /* clear fifo W/O */
40#define PI1_DMACTRL_READ 0x40 /* read */
41#define PI1_DMACTRL_RUN 0x80 /* pedal to the metal */
42 u8 _intstat[3];
43 volatile u8 intstat;
44#define PI1_INTSTAT_ACK 0x04
45#define PI1_INTSTAT_FEMPTY 0x08
46#define PI1_INTSTAT_NOINK 0x10
47#define PI1_INTSTAT_ONLINE 0x20
48#define PI1_INTSTAT_ERR 0x40
49#define PI1_INTSTAT_PE 0x80
50 u8 _intmask[3];
51 volatile u8 intmask; /* enabled low, reset high*/
52#define PI1_INTMASK_ACK 0x04
53#define PI1_INTMASK_FIFO_EMPTY 0x08
54#define PI1_INTMASK_NOINK 0x10
55#define PI1_INTMASK_ONLINE 0x20
56#define PI1_INTMASK_ERR 0x40
57#define PI1_INTMASK_PE 0x80
58 u8 _timer1[3];
59 volatile u8 timer1;
60#define PI1_TIME1 0x27
61 u8 _timer2[3];
62 volatile u8 timer2;
63#define PI1_TIME2 0x13
64 u8 _timer3[3];
65 volatile u8 timer3;
66#define PI1_TIME3 0x10
67 u8 _timer4[3];
68 volatile u8 timer4;
69#define PI1_TIME4 0x00
70};
71
72#endif
diff --git a/arch/mips/include/asm/sgi/seeq.h b/arch/mips/include/asm/sgi/seeq.h
new file mode 100644
index 000000000..af0ffd768
--- /dev/null
+++ b/arch/mips/include/asm/sgi/seeq.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 * Copyright (C) 2007 by Ralf Baechle
7 */
8#ifndef __ASM_SGI_SEEQ_H
9#define __ASM_SGI_SEEQ_H
10
11#include <linux/if_ether.h>
12
13#include <asm/sgi/hpc3.h>
14
15struct sgiseeq_platform_data {
16 struct hpc3_regs *hpc;
17 unsigned int irq;
18 unsigned char mac[ETH_ALEN];
19};
20
21#endif /* __ASM_SGI_SEEQ_H */
diff --git a/arch/mips/include/asm/sgi/wd.h b/arch/mips/include/asm/sgi/wd.h
new file mode 100644
index 000000000..0d6c3a4da
--- /dev/null
+++ b/arch/mips/include/asm/sgi/wd.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) 2007 by Ralf Baechle
7 */
8#ifndef __ASM_SGI_WD_H
9#define __ASM_SGI_WD_H
10
11#include <asm/sgi/hpc3.h>
12
13struct sgiwd93_platform_data {
14 unsigned int unit;
15 unsigned int irq;
16 struct hpc3_scsiregs *hregs;
17 unsigned char *wdregs;
18};
19
20#endif /* __ASM_SGI_WD_H */
diff --git a/arch/mips/include/asm/sgialib.h b/arch/mips/include/asm/sgialib.h
new file mode 100644
index 000000000..80f900417
--- /dev/null
+++ b/arch/mips/include/asm/sgialib.h
@@ -0,0 +1,61 @@
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 (davem@davemloft.net)
9 * Copyright (C) 2001, 2002 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SGIALIB_H
12#define _ASM_SGIALIB_H
13
14#include <linux/compiler.h>
15#include <asm/sgiarcs.h>
16
17extern struct linux_romvec *romvec;
18
19extern int prom_flags;
20
21#define PROM_FLAG_ARCS 1
22#define PROM_FLAG_USE_AS_CONSOLE 2
23#define PROM_FLAG_DONT_FREE_TEMP 4
24
25/* Simple char-by-char console I/O. */
26extern char prom_getchar(void);
27
28/* Get next memory descriptor after CURR, returns first descriptor
29 * in chain is CURR is NULL.
30 */
31extern struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr);
32#define PROM_NULL_MDESC ((struct linux_mdesc *) 0)
33
34/* Called by prom_init to setup the physical memory pmemblock
35 * array.
36 */
37extern void prom_meminit(void);
38
39/* PROM device tree library routines. */
40#define PROM_NULL_COMPONENT ((pcomponent *) 0)
41
42/* This is called at prom_init time to identify the
43 * ARC architecture we are running on
44 */
45extern void prom_identify_arch(void);
46
47/* Environment variable routines. */
48extern PCHAR ArcGetEnvironmentVariable(PCHAR name);
49
50/* ARCS command line parsing. */
51extern void prom_init_cmdline(int argc, LONG *argv);
52
53/* File operations. */
54extern LONG ArcRead(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
55extern LONG ArcWrite(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
56
57/* Misc. routines. */
58extern VOID ArcEnterInteractiveMode(VOID) __noreturn;
59extern DISPLAY_STATUS *ArcGetDisplayStatus(ULONG FileID);
60
61#endif /* _ASM_SGIALIB_H */
diff --git a/arch/mips/include/asm/sgiarcs.h b/arch/mips/include/asm/sgiarcs.h
new file mode 100644
index 000000000..e1512cab1
--- /dev/null
+++ b/arch/mips/include/asm/sgiarcs.h
@@ -0,0 +1,505 @@
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 (davem@davemloft.net)
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/kernel.h>
16
17#include <asm/types.h>
18#include <asm/fw/arc/types.h>
19
20/* Various ARCS error codes. */
21#define PROM_ESUCCESS 0x00
22#define PROM_E2BIG 0x01
23#define PROM_EACCESS 0x02
24#define PROM_EAGAIN 0x03
25#define PROM_EBADF 0x04
26#define PROM_EBUSY 0x05
27#define PROM_EFAULT 0x06
28#define PROM_EINVAL 0x07
29#define PROM_EIO 0x08
30#define PROM_EISDIR 0x09
31#define PROM_EMFILE 0x0a
32#define PROM_EMLINK 0x0b
33#define PROM_ENAMETOOLONG 0x0c
34#define PROM_ENODEV 0x0d
35#define PROM_ENOENT 0x0e
36#define PROM_ENOEXEC 0x0f
37#define PROM_ENOMEM 0x10
38#define PROM_ENOSPC 0x11
39#define PROM_ENOTDIR 0x12
40#define PROM_ENOTTY 0x13
41#define PROM_ENXIO 0x14
42#define PROM_EROFS 0x15
43/* SGI ARCS specific errno's. */
44#define PROM_EADDRNOTAVAIL 0x1f
45#define PROM_ETIMEDOUT 0x20
46#define PROM_ECONNABORTED 0x21
47#define PROM_ENOCONNECT 0x22
48
49/* Device classes, types, and identifiers for prom
50 * device inventory queries.
51 */
52enum linux_devclass {
53 system, processor, cache, adapter, controller, peripheral, memory
54};
55
56enum linux_devtypes {
57 /* Generic stuff. */
58 Arc, Cpu, Fpu,
59
60 /* Primary insn and data caches. */
61 picache, pdcache,
62
63 /* Secondary insn, data, and combined caches. */
64 sicache, sdcache, sccache,
65
66 memdev, eisa_adapter, tc_adapter, scsi_adapter, dti_adapter,
67 multifunc_adapter, dsk_controller, tp_controller, cdrom_controller,
68 worm_controller, serial_controller, net_controller, disp_controller,
69 parallel_controller, ptr_controller, kbd_controller, audio_controller,
70 misc_controller, disk_peripheral, flpy_peripheral, tp_peripheral,
71 modem_peripheral, monitor_peripheral, printer_peripheral,
72 ptr_peripheral, kbd_peripheral, term_peripheral, line_peripheral,
73 net_peripheral, misc_peripheral, anon
74};
75
76enum linux_identifier {
77 bogus, ronly, removable, consin, consout, input, output
78};
79
80/* A prom device tree component. */
81struct linux_component {
82 enum linux_devclass class; /* node class */
83 enum linux_devtypes type; /* node type */
84 enum linux_identifier iflags; /* node flags */
85 USHORT vers; /* node version */
86 USHORT rev; /* node revision */
87 ULONG key; /* completely magic */
88 ULONG amask; /* XXX affinity mask??? */
89 ULONG cdsize; /* size of configuration data */
90 ULONG ilen; /* length of string identifier */
91 _PULONG iname; /* string identifier */
92};
93typedef struct linux_component pcomponent;
94
95struct linux_sysid {
96 char vend[8], prod[8];
97};
98
99/* ARCS prom memory descriptors. */
100enum arcs_memtypes {
101 arcs_eblock, /* exception block */
102 arcs_rvpage, /* ARCS romvec page */
103 arcs_fcontig, /* Contiguous and free */
104 arcs_free, /* Generic free memory */
105 arcs_bmem, /* Borken memory, don't use */
106 arcs_prog, /* A loaded program resides here */
107 arcs_atmp, /* ARCS temporary storage area, wish Sparc OpenBoot told this */
108 arcs_aperm, /* ARCS permanent storage... */
109};
110
111/* ARC has slightly different types than ARCS */
112enum arc_memtypes {
113 arc_eblock, /* exception block */
114 arc_rvpage, /* romvec page */
115 arc_free, /* Generic free memory */
116 arc_bmem, /* Borken memory, don't use */
117 arc_prog, /* A loaded program resides here */
118 arc_atmp, /* temporary storage area */
119 arc_aperm, /* permanent storage */
120 arc_fcontig, /* Contiguous and free */
121};
122
123union linux_memtypes {
124 enum arcs_memtypes arcs;
125 enum arc_memtypes arc;
126};
127
128struct linux_mdesc {
129 union linux_memtypes type;
130 ULONG base;
131 ULONG pages;
132};
133
134/* Time of day descriptor. */
135struct linux_tinfo {
136 unsigned short yr;
137 unsigned short mnth;
138 unsigned short day;
139 unsigned short hr;
140 unsigned short min;
141 unsigned short sec;
142 unsigned short msec;
143};
144
145/* ARCS virtual dirents. */
146struct linux_vdirent {
147 ULONG namelen;
148 unsigned char attr;
149 char fname[32]; /* XXX empirical, should be a define */
150};
151
152/* Other stuff for files. */
153enum linux_omode {
154 rdonly, wronly, rdwr, wronly_creat, rdwr_creat,
155 wronly_ssede, rdwr_ssede, dirent, dirent_creat
156};
157
158enum linux_seekmode {
159 absolute, relative
160};
161
162enum linux_mountops {
163 media_load, media_unload
164};
165
166/* This prom has a bolixed design. */
167struct linux_bigint {
168#ifdef __MIPSEL__
169 u32 lo;
170 s32 hi;
171#else /* !(__MIPSEL__) */
172 s32 hi;
173 u32 lo;
174#endif
175};
176
177struct linux_finfo {
178 struct linux_bigint begin;
179 struct linux_bigint end;
180 struct linux_bigint cur;
181 enum linux_devtypes dtype;
182 unsigned long namelen;
183 unsigned char attr;
184 char name[32]; /* XXX empirical, should be define */
185};
186
187/* This describes the vector containing function pointers to the ARC
188 firmware functions. */
189struct linux_romvec {
190 LONG load; /* Load an executable image. */
191 LONG invoke; /* Invoke a standalong image. */
192 LONG exec; /* Load and begin execution of a
193 standalone image. */
194 LONG halt; /* Halt the machine. */
195 LONG pdown; /* Power down the machine. */
196 LONG restart; /* XXX soft reset??? */
197 LONG reboot; /* Reboot the machine. */
198 LONG imode; /* Enter PROM interactive mode. */
199 LONG _unused1; /* Was ReturnFromMain(). */
200
201 /* PROM device tree interface. */
202 LONG next_component;
203 LONG child_component;
204 LONG parent_component;
205 LONG component_data;
206 LONG child_add;
207 LONG comp_del;
208 LONG component_by_path;
209
210 /* Misc. stuff. */
211 LONG cfg_save;
212 LONG get_sysid;
213
214 /* Probing for memory. */
215 LONG get_mdesc;
216 LONG _unused2; /* was Signal() */
217
218 LONG get_tinfo;
219 LONG get_rtime;
220
221 /* File type operations. */
222 LONG get_vdirent;
223 LONG open;
224 LONG close;
225 LONG read;
226 LONG get_rstatus;
227 LONG write;
228 LONG seek;
229 LONG mount;
230
231 /* Dealing with firmware environment variables. */
232 LONG get_evar;
233 LONG set_evar;
234
235 LONG get_finfo;
236 LONG set_finfo;
237
238 /* Miscellaneous. */
239 LONG cache_flush;
240 LONG TestUnicodeCharacter; /* ARC; not sure if ARCS too */
241 LONG GetDisplayStatus;
242};
243
244/* The SGI ARCS parameter block is in a fixed location for standalone
245 * programs to access PROM facilities easily.
246 */
247typedef struct _SYSTEM_PARAMETER_BLOCK {
248 ULONG magic; /* magic cookie */
249#define PROMBLOCK_MAGIC 0x53435241
250
251 ULONG len; /* length of parm block */
252 USHORT ver; /* ARCS firmware version */
253 USHORT rev; /* ARCS firmware revision */
254 _PLONG rs_block; /* Restart block. */
255 _PLONG dbg_block; /* Debug block. */
256 _PLONG gevect; /* XXX General vector??? */
257 _PLONG utlbvect; /* XXX UTLB vector??? */
258 ULONG rveclen; /* Size of romvec struct. */
259 _PVOID romvec; /* Function interface. */
260 ULONG pveclen; /* Length of private vector. */
261 _PVOID pvector; /* Private vector. */
262 ULONG adap_cnt; /* Adapter count. */
263 ULONG adap_typ0; /* First adapter type. */
264 ULONG adap_vcnt0; /* Adapter 0 vector count. */
265 _PVOID adap_vector; /* Adapter 0 vector ptr. */
266 ULONG adap_typ1; /* Second adapter type. */
267 ULONG adap_vcnt1; /* Adapter 1 vector count. */
268 _PVOID adap_vector1; /* Adapter 1 vector ptr. */
269 /* More adapter vectors go here... */
270} SYSTEM_PARAMETER_BLOCK, *PSYSTEM_PARAMETER_BLOCK;
271
272#define PROMBLOCK ((PSYSTEM_PARAMETER_BLOCK) (int)0xA0001000)
273#define ROMVECTOR ((struct linux_romvec *) (long)(PROMBLOCK)->romvec)
274
275/* Cache layout parameter block. */
276union linux_cache_key {
277 struct param {
278#ifdef __MIPSEL__
279 unsigned short size;
280 unsigned char lsize;
281 unsigned char bsize;
282#else /* !(__MIPSEL__) */
283 unsigned char bsize;
284 unsigned char lsize;
285 unsigned short size;
286#endif
287 } info;
288 unsigned long allinfo;
289};
290
291/* Configuration data. */
292struct linux_cdata {
293 char *name;
294 int mlen;
295 enum linux_devtypes type;
296};
297
298/* Common SGI ARCS firmware file descriptors. */
299#define SGIPROM_STDIN 0
300#define SGIPROM_STDOUT 1
301
302/* Common SGI ARCS firmware file types. */
303#define SGIPROM_ROFILE 0x01 /* read-only file */
304#define SGIPROM_HFILE 0x02 /* hidden file */
305#define SGIPROM_SFILE 0x04 /* System file */
306#define SGIPROM_AFILE 0x08 /* Archive file */
307#define SGIPROM_DFILE 0x10 /* Directory file */
308#define SGIPROM_DELFILE 0x20 /* Deleted file */
309
310/* SGI ARCS boot record information. */
311struct sgi_partition {
312 unsigned char flag;
313#define SGIPART_UNUSED 0x00
314#define SGIPART_ACTIVE 0x80
315
316 unsigned char shead, ssect, scyl; /* unused */
317 unsigned char systype; /* OS type, Irix or NT */
318 unsigned char ehead, esect, ecyl; /* unused */
319 unsigned char rsect0, rsect1, rsect2, rsect3;
320 unsigned char tsect0, tsect1, tsect2, tsect3;
321};
322
323#define SGIBBLOCK_MAGIC 0xaa55
324#define SGIBBLOCK_MAXPART 0x0004
325
326struct sgi_bootblock {
327 unsigned char _unused[446];
328 struct sgi_partition partitions[SGIBBLOCK_MAXPART];
329 unsigned short magic;
330};
331
332/* BIOS parameter block. */
333struct sgi_bparm_block {
334 unsigned short bytes_sect; /* bytes per sector */
335 unsigned char sect_clust; /* sectors per cluster */
336 unsigned short sect_resv; /* reserved sectors */
337 unsigned char nfats; /* # of allocation tables */
338 unsigned short nroot_dirents; /* # of root directory entries */
339 unsigned short sect_volume; /* sectors in volume */
340 unsigned char media_type; /* media descriptor */
341 unsigned short sect_fat; /* sectors per allocation table */
342 unsigned short sect_track; /* sectors per track */
343 unsigned short nheads; /* # of heads */
344 unsigned short nhsects; /* # of hidden sectors */
345};
346
347struct sgi_bsector {
348 unsigned char jmpinfo[3];
349 unsigned char manuf_name[8];
350 struct sgi_bparm_block info;
351};
352
353/* Debugging block used with SGI symmon symbolic debugger. */
354#define SMB_DEBUG_MAGIC 0xfeeddead
355struct linux_smonblock {
356 unsigned long magic;
357 void (*handler)(void); /* Breakpoint routine. */
358 unsigned long dtable_base; /* Base addr of dbg table. */
359 int (*printf)(const char *fmt, ...);
360 unsigned long btable_base; /* Breakpoint table. */
361 unsigned long mpflushreqs; /* SMP cache flush request list. */
362 unsigned long ntab; /* Name table. */
363 unsigned long stab; /* Symbol table. */
364 int smax; /* Max # of symbols. */
365};
366
367/*
368 * Macros for calling a 32-bit ARC implementation from 64-bit code
369 */
370
371#if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32)
372
373extern long call_o32(long vec, void *stack, ...);
374
375extern u64 o32_stk[4096];
376#define O32_STK (&o32_stk[ARRAY_SIZE(o32_stk)])
377
378#define ARC_CALL0(dest) \
379({ long __res; \
380 long __vec = (long) romvec->dest; \
381 __res = call_o32(__vec, O32_STK); \
382 __res; \
383})
384
385#define ARC_CALL1(dest, a1) \
386({ long __res; \
387 int __a1 = (int) (long) (a1); \
388 long __vec = (long) romvec->dest; \
389 __res = call_o32(__vec, O32_STK, __a1); \
390 __res; \
391})
392
393#define ARC_CALL2(dest, a1, a2) \
394({ long __res; \
395 int __a1 = (int) (long) (a1); \
396 int __a2 = (int) (long) (a2); \
397 long __vec = (long) romvec->dest; \
398 __res = call_o32(__vec, O32_STK, __a1, __a2); \
399 __res; \
400})
401
402#define ARC_CALL3(dest, a1, a2, a3) \
403({ long __res; \
404 int __a1 = (int) (long) (a1); \
405 int __a2 = (int) (long) (a2); \
406 int __a3 = (int) (long) (a3); \
407 long __vec = (long) romvec->dest; \
408 __res = call_o32(__vec, O32_STK, __a1, __a2, __a3); \
409 __res; \
410})
411
412#define ARC_CALL4(dest, a1, a2, a3, a4) \
413({ long __res; \
414 int __a1 = (int) (long) (a1); \
415 int __a2 = (int) (long) (a2); \
416 int __a3 = (int) (long) (a3); \
417 int __a4 = (int) (long) (a4); \
418 long __vec = (long) romvec->dest; \
419 __res = call_o32(__vec, O32_STK, __a1, __a2, __a3, __a4); \
420 __res; \
421})
422
423#define ARC_CALL5(dest, a1, a2, a3, a4, a5) \
424({ long __res; \
425 int __a1 = (int) (long) (a1); \
426 int __a2 = (int) (long) (a2); \
427 int __a3 = (int) (long) (a3); \
428 int __a4 = (int) (long) (a4); \
429 int __a5 = (int) (long) (a5); \
430 long __vec = (long) romvec->dest; \
431 __res = call_o32(__vec, O32_STK, __a1, __a2, __a3, __a4, __a5); \
432 __res; \
433})
434
435#endif /* defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32) */
436
437#if (defined(CONFIG_32BIT) && defined(CONFIG_FW_ARC32)) || \
438 (defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC64))
439
440#define ARC_CALL0(dest) \
441({ long __res; \
442 long (*__vec)(void) = (void *) romvec->dest; \
443 \
444 __res = __vec(); \
445 __res; \
446})
447
448#define ARC_CALL1(dest, a1) \
449({ long __res; \
450 long __a1 = (long) (a1); \
451 long (*__vec)(long) = (void *) romvec->dest; \
452 \
453 __res = __vec(__a1); \
454 __res; \
455})
456
457#define ARC_CALL2(dest, a1, a2) \
458({ long __res; \
459 long __a1 = (long) (a1); \
460 long __a2 = (long) (a2); \
461 long (*__vec)(long, long) = (void *) romvec->dest; \
462 \
463 __res = __vec(__a1, __a2); \
464 __res; \
465})
466
467#define ARC_CALL3(dest, a1, a2, a3) \
468({ long __res; \
469 long __a1 = (long) (a1); \
470 long __a2 = (long) (a2); \
471 long __a3 = (long) (a3); \
472 long (*__vec)(long, long, long) = (void *) romvec->dest; \
473 \
474 __res = __vec(__a1, __a2, __a3); \
475 __res; \
476})
477
478#define ARC_CALL4(dest, a1, a2, a3, a4) \
479({ long __res; \
480 long __a1 = (long) (a1); \
481 long __a2 = (long) (a2); \
482 long __a3 = (long) (a3); \
483 long __a4 = (long) (a4); \
484 long (*__vec)(long, long, long, long) = (void *) romvec->dest; \
485 \
486 __res = __vec(__a1, __a2, __a3, __a4); \
487 __res; \
488})
489
490#define ARC_CALL5(dest, a1, a2, a3, a4, a5) \
491({ long __res; \
492 long __a1 = (long) (a1); \
493 long __a2 = (long) (a2); \
494 long __a3 = (long) (a3); \
495 long __a4 = (long) (a4); \
496 long __a5 = (long) (a5); \
497 long (*__vec)(long, long, long, long, long); \
498 __vec = (void *) romvec->dest; \
499 \
500 __res = __vec(__a1, __a2, __a3, __a4, __a5); \
501 __res; \
502})
503#endif /* both kernel and ARC either 32-bit or 64-bit */
504
505#endif /* _ASM_SGIARCS_H */
diff --git a/arch/mips/include/asm/shmparam.h b/arch/mips/include/asm/shmparam.h
new file mode 100644
index 000000000..324d04042
--- /dev/null
+++ b/arch/mips/include/asm/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/arch/mips/include/asm/sibyte/bcm1480_int.h b/arch/mips/include/asm/sibyte/bcm1480_int.h
new file mode 100644
index 000000000..18cf4b105
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/bcm1480_int.h
@@ -0,0 +1,299 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * BCM1280/BCM1480 Board Support Package
4 *
5 * Interrupt Mapper definitions File: bcm1480_int.h
6 *
7 * This module contains constants for manipulating the
8 * BCM1255/BCM1280/BCM1455/BCM1480's interrupt mapper and
9 * definitions for the interrupt sources.
10 *
11 * BCM1480 specification level: 1X55_1X80-UM100-D4 (11/24/03)
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 ********************************************************************* */
19
20
21#ifndef _BCM1480_INT_H
22#define _BCM1480_INT_H
23
24#include <asm/sibyte/sb1250_defs.h>
25
26/* *********************************************************************
27 * Interrupt Mapper Constants
28 ********************************************************************* */
29
30/*
31 * The interrupt mapper deals with 128-bit logical registers that are
32 * implemented as pairs of 64-bit registers, with the "low" 64 bits in
33 * a register that has an address 0x1000 higher(!) than the
34 * corresponding "high" register.
35 *
36 * For appropriate registers, bit 0 of the "high" register is a
37 * cascade bit that summarizes (as a bit-OR) the 64 bits of the "low"
38 * register.
39 */
40
41/*
42 * This entire file uses _BCM1480_ in all the symbols because it is
43 * entirely BCM1480 specific.
44 */
45
46/*
47 * Interrupt sources (Table 22)
48 */
49
50#define K_BCM1480_INT_SOURCES 128
51
52#define _BCM1480_INT_HIGH(k) (k)
53#define _BCM1480_INT_LOW(k) ((k)+64)
54
55#define K_BCM1480_INT_ADDR_TRAP _BCM1480_INT_HIGH(1)
56#define K_BCM1480_INT_GPIO_0 _BCM1480_INT_HIGH(4)
57#define K_BCM1480_INT_GPIO_1 _BCM1480_INT_HIGH(5)
58#define K_BCM1480_INT_GPIO_2 _BCM1480_INT_HIGH(6)
59#define K_BCM1480_INT_GPIO_3 _BCM1480_INT_HIGH(7)
60#define K_BCM1480_INT_PCI_INTA _BCM1480_INT_HIGH(8)
61#define K_BCM1480_INT_PCI_INTB _BCM1480_INT_HIGH(9)
62#define K_BCM1480_INT_PCI_INTC _BCM1480_INT_HIGH(10)
63#define K_BCM1480_INT_PCI_INTD _BCM1480_INT_HIGH(11)
64#define K_BCM1480_INT_CYCLE_CP0 _BCM1480_INT_HIGH(12)
65#define K_BCM1480_INT_CYCLE_CP1 _BCM1480_INT_HIGH(13)
66#define K_BCM1480_INT_CYCLE_CP2 _BCM1480_INT_HIGH(14)
67#define K_BCM1480_INT_CYCLE_CP3 _BCM1480_INT_HIGH(15)
68#define K_BCM1480_INT_TIMER_0 _BCM1480_INT_HIGH(20)
69#define K_BCM1480_INT_TIMER_1 _BCM1480_INT_HIGH(21)
70#define K_BCM1480_INT_TIMER_2 _BCM1480_INT_HIGH(22)
71#define K_BCM1480_INT_TIMER_3 _BCM1480_INT_HIGH(23)
72#define K_BCM1480_INT_DM_CH_0 _BCM1480_INT_HIGH(28)
73#define K_BCM1480_INT_DM_CH_1 _BCM1480_INT_HIGH(29)
74#define K_BCM1480_INT_DM_CH_2 _BCM1480_INT_HIGH(30)
75#define K_BCM1480_INT_DM_CH_3 _BCM1480_INT_HIGH(31)
76#define K_BCM1480_INT_MAC_0 _BCM1480_INT_HIGH(36)
77#define K_BCM1480_INT_MAC_0_CH1 _BCM1480_INT_HIGH(37)
78#define K_BCM1480_INT_MAC_1 _BCM1480_INT_HIGH(38)
79#define K_BCM1480_INT_MAC_1_CH1 _BCM1480_INT_HIGH(39)
80#define K_BCM1480_INT_MAC_2 _BCM1480_INT_HIGH(40)
81#define K_BCM1480_INT_MAC_2_CH1 _BCM1480_INT_HIGH(41)
82#define K_BCM1480_INT_MAC_3 _BCM1480_INT_HIGH(42)
83#define K_BCM1480_INT_MAC_3_CH1 _BCM1480_INT_HIGH(43)
84#define K_BCM1480_INT_PMI_LOW _BCM1480_INT_HIGH(52)
85#define K_BCM1480_INT_PMI_HIGH _BCM1480_INT_HIGH(53)
86#define K_BCM1480_INT_PMO_LOW _BCM1480_INT_HIGH(54)
87#define K_BCM1480_INT_PMO_HIGH _BCM1480_INT_HIGH(55)
88#define K_BCM1480_INT_MBOX_0_0 _BCM1480_INT_HIGH(56)
89#define K_BCM1480_INT_MBOX_0_1 _BCM1480_INT_HIGH(57)
90#define K_BCM1480_INT_MBOX_0_2 _BCM1480_INT_HIGH(58)
91#define K_BCM1480_INT_MBOX_0_3 _BCM1480_INT_HIGH(59)
92#define K_BCM1480_INT_MBOX_1_0 _BCM1480_INT_HIGH(60)
93#define K_BCM1480_INT_MBOX_1_1 _BCM1480_INT_HIGH(61)
94#define K_BCM1480_INT_MBOX_1_2 _BCM1480_INT_HIGH(62)
95#define K_BCM1480_INT_MBOX_1_3 _BCM1480_INT_HIGH(63)
96
97#define K_BCM1480_INT_BAD_ECC _BCM1480_INT_LOW(1)
98#define K_BCM1480_INT_COR_ECC _BCM1480_INT_LOW(2)
99#define K_BCM1480_INT_IO_BUS _BCM1480_INT_LOW(3)
100#define K_BCM1480_INT_PERF_CNT _BCM1480_INT_LOW(4)
101#define K_BCM1480_INT_SW_PERF_CNT _BCM1480_INT_LOW(5)
102#define K_BCM1480_INT_TRACE_FREEZE _BCM1480_INT_LOW(6)
103#define K_BCM1480_INT_SW_TRACE_FREEZE _BCM1480_INT_LOW(7)
104#define K_BCM1480_INT_WATCHDOG_TIMER_0 _BCM1480_INT_LOW(8)
105#define K_BCM1480_INT_WATCHDOG_TIMER_1 _BCM1480_INT_LOW(9)
106#define K_BCM1480_INT_WATCHDOG_TIMER_2 _BCM1480_INT_LOW(10)
107#define K_BCM1480_INT_WATCHDOG_TIMER_3 _BCM1480_INT_LOW(11)
108#define K_BCM1480_INT_PCI_ERROR _BCM1480_INT_LOW(16)
109#define K_BCM1480_INT_PCI_RESET _BCM1480_INT_LOW(17)
110#define K_BCM1480_INT_NODE_CONTROLLER _BCM1480_INT_LOW(18)
111#define K_BCM1480_INT_HOST_BRIDGE _BCM1480_INT_LOW(19)
112#define K_BCM1480_INT_PORT_0_FATAL _BCM1480_INT_LOW(20)
113#define K_BCM1480_INT_PORT_0_NONFATAL _BCM1480_INT_LOW(21)
114#define K_BCM1480_INT_PORT_1_FATAL _BCM1480_INT_LOW(22)
115#define K_BCM1480_INT_PORT_1_NONFATAL _BCM1480_INT_LOW(23)
116#define K_BCM1480_INT_PORT_2_FATAL _BCM1480_INT_LOW(24)
117#define K_BCM1480_INT_PORT_2_NONFATAL _BCM1480_INT_LOW(25)
118#define K_BCM1480_INT_LDT_SMI _BCM1480_INT_LOW(32)
119#define K_BCM1480_INT_LDT_NMI _BCM1480_INT_LOW(33)
120#define K_BCM1480_INT_LDT_INIT _BCM1480_INT_LOW(34)
121#define K_BCM1480_INT_LDT_STARTUP _BCM1480_INT_LOW(35)
122#define K_BCM1480_INT_LDT_EXT _BCM1480_INT_LOW(36)
123#define K_BCM1480_INT_SMB_0 _BCM1480_INT_LOW(40)
124#define K_BCM1480_INT_SMB_1 _BCM1480_INT_LOW(41)
125#define K_BCM1480_INT_PCMCIA _BCM1480_INT_LOW(42)
126#define K_BCM1480_INT_UART_0 _BCM1480_INT_LOW(44)
127#define K_BCM1480_INT_UART_1 _BCM1480_INT_LOW(45)
128#define K_BCM1480_INT_UART_2 _BCM1480_INT_LOW(46)
129#define K_BCM1480_INT_UART_3 _BCM1480_INT_LOW(47)
130#define K_BCM1480_INT_GPIO_4 _BCM1480_INT_LOW(52)
131#define K_BCM1480_INT_GPIO_5 _BCM1480_INT_LOW(53)
132#define K_BCM1480_INT_GPIO_6 _BCM1480_INT_LOW(54)
133#define K_BCM1480_INT_GPIO_7 _BCM1480_INT_LOW(55)
134#define K_BCM1480_INT_GPIO_8 _BCM1480_INT_LOW(56)
135#define K_BCM1480_INT_GPIO_9 _BCM1480_INT_LOW(57)
136#define K_BCM1480_INT_GPIO_10 _BCM1480_INT_LOW(58)
137#define K_BCM1480_INT_GPIO_11 _BCM1480_INT_LOW(59)
138#define K_BCM1480_INT_GPIO_12 _BCM1480_INT_LOW(60)
139#define K_BCM1480_INT_GPIO_13 _BCM1480_INT_LOW(61)
140#define K_BCM1480_INT_GPIO_14 _BCM1480_INT_LOW(62)
141#define K_BCM1480_INT_GPIO_15 _BCM1480_INT_LOW(63)
142
143/*
144 * Mask values for each interrupt
145 */
146
147#define _BCM1480_INT_MASK(w, n) _SB_MAKEMASK(w, ((n) & 0x3F))
148#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F))
149#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6)
150
151#define M_BCM1480_INT_CASCADE _BCM1480_INT_MASK1(_BCM1480_INT_HIGH(0))
152
153#define M_BCM1480_INT_ADDR_TRAP _BCM1480_INT_MASK1(K_BCM1480_INT_ADDR_TRAP)
154#define M_BCM1480_INT_GPIO_0 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_0)
155#define M_BCM1480_INT_GPIO_1 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_1)
156#define M_BCM1480_INT_GPIO_2 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_2)
157#define M_BCM1480_INT_GPIO_3 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_3)
158#define M_BCM1480_INT_PCI_INTA _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTA)
159#define M_BCM1480_INT_PCI_INTB _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTB)
160#define M_BCM1480_INT_PCI_INTC _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTC)
161#define M_BCM1480_INT_PCI_INTD _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTD)
162#define M_BCM1480_INT_CYCLE_CP0 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP0)
163#define M_BCM1480_INT_CYCLE_CP1 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP1)
164#define M_BCM1480_INT_CYCLE_CP2 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP2)
165#define M_BCM1480_INT_CYCLE_CP3 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP3)
166#define M_BCM1480_INT_TIMER_0 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_0)
167#define M_BCM1480_INT_TIMER_1 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_1)
168#define M_BCM1480_INT_TIMER_2 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_2)
169#define M_BCM1480_INT_TIMER_3 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_3)
170#define M_BCM1480_INT_DM_CH_0 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_0)
171#define M_BCM1480_INT_DM_CH_1 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_1)
172#define M_BCM1480_INT_DM_CH_2 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_2)
173#define M_BCM1480_INT_DM_CH_3 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_3)
174#define M_BCM1480_INT_MAC_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_0)
175#define M_BCM1480_INT_MAC_0_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_0_CH1)
176#define M_BCM1480_INT_MAC_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_1)
177#define M_BCM1480_INT_MAC_1_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_1_CH1)
178#define M_BCM1480_INT_MAC_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_2)
179#define M_BCM1480_INT_MAC_2_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_2_CH1)
180#define M_BCM1480_INT_MAC_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_3)
181#define M_BCM1480_INT_MAC_3_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_3_CH1)
182#define M_BCM1480_INT_PMI_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_LOW)
183#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH)
184#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW)
185#define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH)
186#define M_BCM1480_INT_MBOX_ALL _BCM1480_INT_MASK(8, K_BCM1480_INT_MBOX_0_0)
187#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0)
188#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1)
189#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2)
190#define M_BCM1480_INT_MBOX_0_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_3)
191#define M_BCM1480_INT_MBOX_1_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_0)
192#define M_BCM1480_INT_MBOX_1_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_1)
193#define M_BCM1480_INT_MBOX_1_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_2)
194#define M_BCM1480_INT_MBOX_1_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_3)
195#define M_BCM1480_INT_BAD_ECC _BCM1480_INT_MASK1(K_BCM1480_INT_BAD_ECC)
196#define M_BCM1480_INT_COR_ECC _BCM1480_INT_MASK1(K_BCM1480_INT_COR_ECC)
197#define M_BCM1480_INT_IO_BUS _BCM1480_INT_MASK1(K_BCM1480_INT_IO_BUS)
198#define M_BCM1480_INT_PERF_CNT _BCM1480_INT_MASK1(K_BCM1480_INT_PERF_CNT)
199#define M_BCM1480_INT_SW_PERF_CNT _BCM1480_INT_MASK1(K_BCM1480_INT_SW_PERF_CNT)
200#define M_BCM1480_INT_TRACE_FREEZE _BCM1480_INT_MASK1(K_BCM1480_INT_TRACE_FREEZE)
201#define M_BCM1480_INT_SW_TRACE_FREEZE _BCM1480_INT_MASK1(K_BCM1480_INT_SW_TRACE_FREEZE)
202#define M_BCM1480_INT_WATCHDOG_TIMER_0 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_0)
203#define M_BCM1480_INT_WATCHDOG_TIMER_1 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_1)
204#define M_BCM1480_INT_WATCHDOG_TIMER_2 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_2)
205#define M_BCM1480_INT_WATCHDOG_TIMER_3 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_3)
206#define M_BCM1480_INT_PCI_ERROR _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_ERROR)
207#define M_BCM1480_INT_PCI_RESET _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_RESET)
208#define M_BCM1480_INT_NODE_CONTROLLER _BCM1480_INT_MASK1(K_BCM1480_INT_NODE_CONTROLLER)
209#define M_BCM1480_INT_HOST_BRIDGE _BCM1480_INT_MASK1(K_BCM1480_INT_HOST_BRIDGE)
210#define M_BCM1480_INT_PORT_0_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_0_FATAL)
211#define M_BCM1480_INT_PORT_0_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_0_NONFATAL)
212#define M_BCM1480_INT_PORT_1_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_1_FATAL)
213#define M_BCM1480_INT_PORT_1_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_1_NONFATAL)
214#define M_BCM1480_INT_PORT_2_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_2_FATAL)
215#define M_BCM1480_INT_PORT_2_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_2_NONFATAL)
216#define M_BCM1480_INT_LDT_SMI _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_SMI)
217#define M_BCM1480_INT_LDT_NMI _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_NMI)
218#define M_BCM1480_INT_LDT_INIT _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_INIT)
219#define M_BCM1480_INT_LDT_STARTUP _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_STARTUP)
220#define M_BCM1480_INT_LDT_EXT _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_EXT)
221#define M_BCM1480_INT_SMB_0 _BCM1480_INT_MASK1(K_BCM1480_INT_SMB_0)
222#define M_BCM1480_INT_SMB_1 _BCM1480_INT_MASK1(K_BCM1480_INT_SMB_1)
223#define M_BCM1480_INT_PCMCIA _BCM1480_INT_MASK1(K_BCM1480_INT_PCMCIA)
224#define M_BCM1480_INT_UART_0 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_0)
225#define M_BCM1480_INT_UART_1 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_1)
226#define M_BCM1480_INT_UART_2 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_2)
227#define M_BCM1480_INT_UART_3 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_3)
228#define M_BCM1480_INT_GPIO_4 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_4)
229#define M_BCM1480_INT_GPIO_5 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_5)
230#define M_BCM1480_INT_GPIO_6 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_6)
231#define M_BCM1480_INT_GPIO_7 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_7)
232#define M_BCM1480_INT_GPIO_8 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_8)
233#define M_BCM1480_INT_GPIO_9 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_9)
234#define M_BCM1480_INT_GPIO_10 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_10)
235#define M_BCM1480_INT_GPIO_11 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_11)
236#define M_BCM1480_INT_GPIO_12 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_12)
237#define M_BCM1480_INT_GPIO_13 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_13)
238#define M_BCM1480_INT_GPIO_14 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_14)
239#define M_BCM1480_INT_GPIO_15 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_15)
240
241/*
242 * Interrupt mappings (Table 18)
243 */
244
245#define K_BCM1480_INT_MAP_I0 0 /* interrupt pins on processor */
246#define K_BCM1480_INT_MAP_I1 1
247#define K_BCM1480_INT_MAP_I2 2
248#define K_BCM1480_INT_MAP_I3 3
249#define K_BCM1480_INT_MAP_I4 4
250#define K_BCM1480_INT_MAP_I5 5
251#define K_BCM1480_INT_MAP_NMI 6 /* nonmaskable */
252#define K_BCM1480_INT_MAP_DINT 7 /* debug interrupt */
253
254/*
255 * Interrupt LDT Set Register (Table 19)
256 */
257
258#define S_BCM1480_INT_HT_INTMSG 0
259#define M_BCM1480_INT_HT_INTMSG _SB_MAKEMASK(3, S_BCM1480_INT_HT_INTMSG)
260#define V_BCM1480_INT_HT_INTMSG(x) _SB_MAKEVALUE(x, S_BCM1480_INT_HT_INTMSG)
261#define G_BCM1480_INT_HT_INTMSG(x) _SB_GETVALUE(x, S_BCM1480_INT_HT_INTMSG, M_BCM1480_INT_HT_INTMSG)
262
263#define K_BCM1480_INT_HT_INTMSG_FIXED 0
264#define K_BCM1480_INT_HT_INTMSG_ARBITRATED 1
265#define K_BCM1480_INT_HT_INTMSG_SMI 2
266#define K_BCM1480_INT_HT_INTMSG_NMI 3
267#define K_BCM1480_INT_HT_INTMSG_INIT 4
268#define K_BCM1480_INT_HT_INTMSG_STARTUP 5
269#define K_BCM1480_INT_HT_INTMSG_EXTINT 6
270#define K_BCM1480_INT_HT_INTMSG_RESERVED 7
271
272#define M_BCM1480_INT_HT_TRIGGERMODE _SB_MAKEMASK1(3)
273#define V_BCM1480_INT_HT_EDGETRIGGER 0
274#define V_BCM1480_INT_HT_LEVELTRIGGER M_BCM1480_INT_HT_TRIGGERMODE
275
276#define M_BCM1480_INT_HT_DESTMODE _SB_MAKEMASK1(4)
277#define V_BCM1480_INT_HT_PHYSICALDEST 0
278#define V_BCM1480_INT_HT_LOGICALDEST M_BCM1480_INT_HT_DESTMODE
279
280#define S_BCM1480_INT_HT_INTDEST 5
281#define M_BCM1480_INT_HT_INTDEST _SB_MAKEMASK(8, S_BCM1480_INT_HT_INTDEST)
282#define V_BCM1480_INT_HT_INTDEST(x) _SB_MAKEVALUE(x, S_BCM1480_INT_HT_INTDEST)
283#define G_BCM1480_INT_HT_INTDEST(x) _SB_GETVALUE(x, S_BCM1480_INT_HT_INTDEST, M_BCM1480_INT_HT_INTDEST)
284
285#define S_BCM1480_INT_HT_VECTOR 13
286#define M_BCM1480_INT_HT_VECTOR _SB_MAKEMASK(8, S_BCM1480_INT_HT_VECTOR)
287#define V_BCM1480_INT_HT_VECTOR(x) _SB_MAKEVALUE(x, S_BCM1480_INT_HT_VECTOR)
288#define G_BCM1480_INT_HT_VECTOR(x) _SB_GETVALUE(x, S_BCM1480_INT_HT_VECTOR, M_BCM1480_INT_HT_VECTOR)
289
290/*
291 * Vector prefix (Table 4-7)
292 */
293
294#define M_BCM1480_HTVECT_RAISE_INTLDT_HIGH 0x00
295#define M_BCM1480_HTVECT_RAISE_MBOX_0 0x40
296#define M_BCM1480_HTVECT_RAISE_INTLDT_LO 0x80
297#define M_BCM1480_HTVECT_RAISE_MBOX_1 0xC0
298
299#endif /* _BCM1480_INT_H */
diff --git a/arch/mips/include/asm/sibyte/bcm1480_l2c.h b/arch/mips/include/asm/sibyte/bcm1480_l2c.h
new file mode 100644
index 000000000..f6f3a1989
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/bcm1480_l2c.h
@@ -0,0 +1,163 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * BCM1280/BCM1480 Board Support Package
4 *
5 * L2 Cache constants and macros File: bcm1480_l2c.h
6 *
7 * This module contains constants useful for manipulating the
8 * level 2 cache.
9 *
10 * BCM1400 specification level: 1280-UM100-D2 (11/14/03)
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _BCM1480_L2C_H
21#define _BCM1480_L2C_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25/*
26 * Format of level 2 cache management address (Table 55)
27 */
28
29#define S_BCM1480_L2C_MGMT_INDEX 5
30#define M_BCM1480_L2C_MGMT_INDEX _SB_MAKEMASK(12, S_BCM1480_L2C_MGMT_INDEX)
31#define V_BCM1480_L2C_MGMT_INDEX(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_MGMT_INDEX)
32#define G_BCM1480_L2C_MGMT_INDEX(x) _SB_GETVALUE(x, S_BCM1480_L2C_MGMT_INDEX, M_BCM1480_L2C_MGMT_INDEX)
33
34#define S_BCM1480_L2C_MGMT_WAY 17
35#define M_BCM1480_L2C_MGMT_WAY _SB_MAKEMASK(3, S_BCM1480_L2C_MGMT_WAY)
36#define V_BCM1480_L2C_MGMT_WAY(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_MGMT_WAY)
37#define G_BCM1480_L2C_MGMT_WAY(x) _SB_GETVALUE(x, S_BCM1480_L2C_MGMT_WAY, M_BCM1480_L2C_MGMT_WAY)
38
39#define M_BCM1480_L2C_MGMT_DIRTY _SB_MAKEMASK1(20)
40#define M_BCM1480_L2C_MGMT_VALID _SB_MAKEMASK1(21)
41
42#define S_BCM1480_L2C_MGMT_ECC_DIAG 22
43#define M_BCM1480_L2C_MGMT_ECC_DIAG _SB_MAKEMASK(2, S_BCM1480_L2C_MGMT_ECC_DIAG)
44#define V_BCM1480_L2C_MGMT_ECC_DIAG(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_MGMT_ECC_DIAG)
45#define G_BCM1480_L2C_MGMT_ECC_DIAG(x) _SB_GETVALUE(x, S_BCM1480_L2C_MGMT_ECC_DIAG, M_BCM1480_L2C_MGMT_ECC_DIAG)
46
47#define A_BCM1480_L2C_MGMT_TAG_BASE 0x00D0000000
48
49#define BCM1480_L2C_ENTRIES_PER_WAY 4096
50#define BCM1480_L2C_NUM_WAYS 8
51
52
53/*
54 * Level 2 Cache Tag register (Table 59)
55 */
56
57#define S_BCM1480_L2C_TAG_MBZ 0
58#define M_BCM1480_L2C_TAG_MBZ _SB_MAKEMASK(5, S_BCM1480_L2C_TAG_MBZ)
59
60#define S_BCM1480_L2C_TAG_INDEX 5
61#define M_BCM1480_L2C_TAG_INDEX _SB_MAKEMASK(12, S_BCM1480_L2C_TAG_INDEX)
62#define V_BCM1480_L2C_TAG_INDEX(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_TAG_INDEX)
63#define G_BCM1480_L2C_TAG_INDEX(x) _SB_GETVALUE(x, S_BCM1480_L2C_TAG_INDEX, M_BCM1480_L2C_TAG_INDEX)
64
65/* Note that index bit 16 is also tag bit 40 */
66#define S_BCM1480_L2C_TAG_TAG 17
67#define M_BCM1480_L2C_TAG_TAG _SB_MAKEMASK(23, S_BCM1480_L2C_TAG_TAG)
68#define V_BCM1480_L2C_TAG_TAG(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_TAG_TAG)
69#define G_BCM1480_L2C_TAG_TAG(x) _SB_GETVALUE(x, S_BCM1480_L2C_TAG_TAG, M_BCM1480_L2C_TAG_TAG)
70
71#define S_BCM1480_L2C_TAG_ECC 40
72#define M_BCM1480_L2C_TAG_ECC _SB_MAKEMASK(6, S_BCM1480_L2C_TAG_ECC)
73#define V_BCM1480_L2C_TAG_ECC(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_TAG_ECC)
74#define G_BCM1480_L2C_TAG_ECC(x) _SB_GETVALUE(x, S_BCM1480_L2C_TAG_ECC, M_BCM1480_L2C_TAG_ECC)
75
76#define S_BCM1480_L2C_TAG_WAY 46
77#define M_BCM1480_L2C_TAG_WAY _SB_MAKEMASK(3, S_BCM1480_L2C_TAG_WAY)
78#define V_BCM1480_L2C_TAG_WAY(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_TAG_WAY)
79#define G_BCM1480_L2C_TAG_WAY(x) _SB_GETVALUE(x, S_BCM1480_L2C_TAG_WAY, M_BCM1480_L2C_TAG_WAY)
80
81#define M_BCM1480_L2C_TAG_DIRTY _SB_MAKEMASK1(49)
82#define M_BCM1480_L2C_TAG_VALID _SB_MAKEMASK1(50)
83
84#define S_BCM1480_L2C_DATA_ECC 51
85#define M_BCM1480_L2C_DATA_ECC _SB_MAKEMASK(10, S_BCM1480_L2C_DATA_ECC)
86#define V_BCM1480_L2C_DATA_ECC(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_DATA_ECC)
87#define G_BCM1480_L2C_DATA_ECC(x) _SB_GETVALUE(x, S_BCM1480_L2C_DATA_ECC, M_BCM1480_L2C_DATA_ECC)
88
89
90/*
91 * L2 Misc0 Value Register (Table 60)
92 */
93
94#define S_BCM1480_L2C_MISC0_WAY_REMOTE 0
95#define M_BCM1480_L2C_MISC0_WAY_REMOTE _SB_MAKEMASK(8, S_BCM1480_L2C_MISC0_WAY_REMOTE)
96#define G_BCM1480_L2C_MISC0_WAY_REMOTE(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_WAY_REMOTE, M_BCM1480_L2C_MISC0_WAY_REMOTE)
97
98#define S_BCM1480_L2C_MISC0_WAY_LOCAL 8
99#define M_BCM1480_L2C_MISC0_WAY_LOCAL _SB_MAKEMASK(8, S_BCM1480_L2C_MISC0_WAY_LOCAL)
100#define G_BCM1480_L2C_MISC0_WAY_LOCAL(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_WAY_LOCAL, M_BCM1480_L2C_MISC0_WAY_LOCAL)
101
102#define S_BCM1480_L2C_MISC0_WAY_ENABLE 16
103#define M_BCM1480_L2C_MISC0_WAY_ENABLE _SB_MAKEMASK(8, S_BCM1480_L2C_MISC0_WAY_ENABLE)
104#define G_BCM1480_L2C_MISC0_WAY_ENABLE(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_WAY_ENABLE, M_BCM1480_L2C_MISC0_WAY_ENABLE)
105
106#define S_BCM1480_L2C_MISC0_CACHE_DISABLE 24
107#define M_BCM1480_L2C_MISC0_CACHE_DISABLE _SB_MAKEMASK(2, S_BCM1480_L2C_MISC0_CACHE_DISABLE)
108#define G_BCM1480_L2C_MISC0_CACHE_DISABLE(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_CACHE_DISABLE, M_BCM1480_L2C_MISC0_CACHE_DISABLE)
109
110#define S_BCM1480_L2C_MISC0_CACHE_QUAD 26
111#define M_BCM1480_L2C_MISC0_CACHE_QUAD _SB_MAKEMASK(2, S_BCM1480_L2C_MISC0_CACHE_QUAD)
112#define G_BCM1480_L2C_MISC0_CACHE_QUAD(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_CACHE_QUAD, M_BCM1480_L2C_MISC0_CACHE_QUAD)
113
114#define S_BCM1480_L2C_MISC0_MC_PRIORITY 30
115#define M_BCM1480_L2C_MISC0_MC_PRIORITY _SB_MAKEMASK1(S_BCM1480_L2C_MISC0_MC_PRIORITY)
116
117#define S_BCM1480_L2C_MISC0_ECC_CLEANUP 31
118#define M_BCM1480_L2C_MISC0_ECC_CLEANUP _SB_MAKEMASK1(S_BCM1480_L2C_MISC0_ECC_CLEANUP)
119
120
121/*
122 * L2 Misc1 Value Register (Table 60)
123 */
124
125#define S_BCM1480_L2C_MISC1_WAY_AGENT_0 0
126#define M_BCM1480_L2C_MISC1_WAY_AGENT_0 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_0)
127#define G_BCM1480_L2C_MISC1_WAY_AGENT_0(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_0, M_BCM1480_L2C_MISC1_WAY_AGENT_0)
128
129#define S_BCM1480_L2C_MISC1_WAY_AGENT_1 8
130#define M_BCM1480_L2C_MISC1_WAY_AGENT_1 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_1)
131#define G_BCM1480_L2C_MISC1_WAY_AGENT_1(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_1, M_BCM1480_L2C_MISC1_WAY_AGENT_1)
132
133#define S_BCM1480_L2C_MISC1_WAY_AGENT_2 16
134#define M_BCM1480_L2C_MISC1_WAY_AGENT_2 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_2)
135#define G_BCM1480_L2C_MISC1_WAY_AGENT_2(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_2, M_BCM1480_L2C_MISC1_WAY_AGENT_2)
136
137#define S_BCM1480_L2C_MISC1_WAY_AGENT_3 24
138#define M_BCM1480_L2C_MISC1_WAY_AGENT_3 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_3)
139#define G_BCM1480_L2C_MISC1_WAY_AGENT_3(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_3, M_BCM1480_L2C_MISC1_WAY_AGENT_3)
140
141#define S_BCM1480_L2C_MISC1_WAY_AGENT_4 32
142#define M_BCM1480_L2C_MISC1_WAY_AGENT_4 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_4)
143#define G_BCM1480_L2C_MISC1_WAY_AGENT_4(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_4, M_BCM1480_L2C_MISC1_WAY_AGENT_4)
144
145
146/*
147 * L2 Misc2 Value Register (Table 60)
148 */
149
150#define S_BCM1480_L2C_MISC2_WAY_AGENT_8 0
151#define M_BCM1480_L2C_MISC2_WAY_AGENT_8 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC2_WAY_AGENT_8)
152#define G_BCM1480_L2C_MISC2_WAY_AGENT_8(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC2_WAY_AGENT_8, M_BCM1480_L2C_MISC2_WAY_AGENT_8)
153
154#define S_BCM1480_L2C_MISC2_WAY_AGENT_9 8
155#define M_BCM1480_L2C_MISC2_WAY_AGENT_9 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC2_WAY_AGENT_9)
156#define G_BCM1480_L2C_MISC2_WAY_AGENT_9(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC2_WAY_AGENT_9, M_BCM1480_L2C_MISC2_WAY_AGENT_9)
157
158#define S_BCM1480_L2C_MISC2_WAY_AGENT_A 16
159#define M_BCM1480_L2C_MISC2_WAY_AGENT_A _SB_MAKEMASK(8, S_BCM1480_L2C_MISC2_WAY_AGENT_A)
160#define G_BCM1480_L2C_MISC2_WAY_AGENT_A(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC2_WAY_AGENT_A, M_BCM1480_L2C_MISC2_WAY_AGENT_A)
161
162
163#endif /* _BCM1480_L2C_H */
diff --git a/arch/mips/include/asm/sibyte/bcm1480_mc.h b/arch/mips/include/asm/sibyte/bcm1480_mc.h
new file mode 100644
index 000000000..1d9b62d47
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/bcm1480_mc.h
@@ -0,0 +1,971 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * BCM1280/BCM1480 Board Support Package
4 *
5 * Memory Controller constants File: bcm1480_mc.h
6 *
7 * This module contains constants and macros useful for
8 * programming the memory controller.
9 *
10 * BCM1400 specification level: 1280-UM100-D1 (11/14/03 Review Copy)
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _BCM1480_MC_H
21#define _BCM1480_MC_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25/*
26 * Memory Channel Configuration Register (Table 81)
27 */
28
29#define S_BCM1480_MC_INTLV0 0
30#define M_BCM1480_MC_INTLV0 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV0)
31#define V_BCM1480_MC_INTLV0(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV0)
32#define G_BCM1480_MC_INTLV0(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV0, M_BCM1480_MC_INTLV0)
33#define V_BCM1480_MC_INTLV0_DEFAULT V_BCM1480_MC_INTLV0(0)
34
35#define S_BCM1480_MC_INTLV1 8
36#define M_BCM1480_MC_INTLV1 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV1)
37#define V_BCM1480_MC_INTLV1(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV1)
38#define G_BCM1480_MC_INTLV1(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV1, M_BCM1480_MC_INTLV1)
39#define V_BCM1480_MC_INTLV1_DEFAULT V_BCM1480_MC_INTLV1(0)
40
41#define S_BCM1480_MC_INTLV2 16
42#define M_BCM1480_MC_INTLV2 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV2)
43#define V_BCM1480_MC_INTLV2(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV2)
44#define G_BCM1480_MC_INTLV2(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV2, M_BCM1480_MC_INTLV2)
45#define V_BCM1480_MC_INTLV2_DEFAULT V_BCM1480_MC_INTLV2(0)
46
47#define S_BCM1480_MC_CS_MODE 32
48#define M_BCM1480_MC_CS_MODE _SB_MAKEMASK(8, S_BCM1480_MC_CS_MODE)
49#define V_BCM1480_MC_CS_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS_MODE)
50#define G_BCM1480_MC_CS_MODE(x) _SB_GETVALUE(x, S_BCM1480_MC_CS_MODE, M_BCM1480_MC_CS_MODE)
51#define V_BCM1480_MC_CS_MODE_DEFAULT V_BCM1480_MC_CS_MODE(0)
52
53#define V_BCM1480_MC_CONFIG_DEFAULT (V_BCM1480_MC_INTLV0_DEFAULT | \
54 V_BCM1480_MC_INTLV1_DEFAULT | \
55 V_BCM1480_MC_INTLV2_DEFAULT | \
56 V_BCM1480_MC_CS_MODE_DEFAULT)
57
58#define K_BCM1480_MC_CS01_MODE 0x03
59#define K_BCM1480_MC_CS02_MODE 0x05
60#define K_BCM1480_MC_CS0123_MODE 0x0F
61#define K_BCM1480_MC_CS0246_MODE 0x55
62#define K_BCM1480_MC_CS0145_MODE 0x33
63#define K_BCM1480_MC_CS0167_MODE 0xC3
64#define K_BCM1480_MC_CSFULL_MODE 0xFF
65
66/*
67 * Chip Select Start Address Register (Table 82)
68 */
69
70#define S_BCM1480_MC_CS0_START 0
71#define M_BCM1480_MC_CS0_START _SB_MAKEMASK(12, S_BCM1480_MC_CS0_START)
72#define V_BCM1480_MC_CS0_START(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS0_START)
73#define G_BCM1480_MC_CS0_START(x) _SB_GETVALUE(x, S_BCM1480_MC_CS0_START, M_BCM1480_MC_CS0_START)
74
75#define S_BCM1480_MC_CS1_START 16
76#define M_BCM1480_MC_CS1_START _SB_MAKEMASK(12, S_BCM1480_MC_CS1_START)
77#define V_BCM1480_MC_CS1_START(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS1_START)
78#define G_BCM1480_MC_CS1_START(x) _SB_GETVALUE(x, S_BCM1480_MC_CS1_START, M_BCM1480_MC_CS1_START)
79
80#define S_BCM1480_MC_CS2_START 32
81#define M_BCM1480_MC_CS2_START _SB_MAKEMASK(12, S_BCM1480_MC_CS2_START)
82#define V_BCM1480_MC_CS2_START(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS2_START)
83#define G_BCM1480_MC_CS2_START(x) _SB_GETVALUE(x, S_BCM1480_MC_CS2_START, M_BCM1480_MC_CS2_START)
84
85#define S_BCM1480_MC_CS3_START 48
86#define M_BCM1480_MC_CS3_START _SB_MAKEMASK(12, S_BCM1480_MC_CS3_START)
87#define V_BCM1480_MC_CS3_START(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS3_START)
88#define G_BCM1480_MC_CS3_START(x) _SB_GETVALUE(x, S_BCM1480_MC_CS3_START, M_BCM1480_MC_CS3_START)
89
90/*
91 * Chip Select End Address Register (Table 83)
92 */
93
94#define S_BCM1480_MC_CS0_END 0
95#define M_BCM1480_MC_CS0_END _SB_MAKEMASK(12, S_BCM1480_MC_CS0_END)
96#define V_BCM1480_MC_CS0_END(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS0_END)
97#define G_BCM1480_MC_CS0_END(x) _SB_GETVALUE(x, S_BCM1480_MC_CS0_END, M_BCM1480_MC_CS0_END)
98
99#define S_BCM1480_MC_CS1_END 16
100#define M_BCM1480_MC_CS1_END _SB_MAKEMASK(12, S_BCM1480_MC_CS1_END)
101#define V_BCM1480_MC_CS1_END(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS1_END)
102#define G_BCM1480_MC_CS1_END(x) _SB_GETVALUE(x, S_BCM1480_MC_CS1_END, M_BCM1480_MC_CS1_END)
103
104#define S_BCM1480_MC_CS2_END 32
105#define M_BCM1480_MC_CS2_END _SB_MAKEMASK(12, S_BCM1480_MC_CS2_END)
106#define V_BCM1480_MC_CS2_END(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS2_END)
107#define G_BCM1480_MC_CS2_END(x) _SB_GETVALUE(x, S_BCM1480_MC_CS2_END, M_BCM1480_MC_CS2_END)
108
109#define S_BCM1480_MC_CS3_END 48
110#define M_BCM1480_MC_CS3_END _SB_MAKEMASK(12, S_BCM1480_MC_CS3_END)
111#define V_BCM1480_MC_CS3_END(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS3_END)
112#define G_BCM1480_MC_CS3_END(x) _SB_GETVALUE(x, S_BCM1480_MC_CS3_END, M_BCM1480_MC_CS3_END)
113
114/*
115 * Row Address Bit Select Register 0 (Table 84)
116 */
117
118#define S_BCM1480_MC_ROW00 0
119#define M_BCM1480_MC_ROW00 _SB_MAKEMASK(6, S_BCM1480_MC_ROW00)
120#define V_BCM1480_MC_ROW00(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW00)
121#define G_BCM1480_MC_ROW00(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW00, M_BCM1480_MC_ROW00)
122
123#define S_BCM1480_MC_ROW01 8
124#define M_BCM1480_MC_ROW01 _SB_MAKEMASK(6, S_BCM1480_MC_ROW01)
125#define V_BCM1480_MC_ROW01(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW01)
126#define G_BCM1480_MC_ROW01(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW01, M_BCM1480_MC_ROW01)
127
128#define S_BCM1480_MC_ROW02 16
129#define M_BCM1480_MC_ROW02 _SB_MAKEMASK(6, S_BCM1480_MC_ROW02)
130#define V_BCM1480_MC_ROW02(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW02)
131#define G_BCM1480_MC_ROW02(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW02, M_BCM1480_MC_ROW02)
132
133#define S_BCM1480_MC_ROW03 24
134#define M_BCM1480_MC_ROW03 _SB_MAKEMASK(6, S_BCM1480_MC_ROW03)
135#define V_BCM1480_MC_ROW03(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW03)
136#define G_BCM1480_MC_ROW03(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW03, M_BCM1480_MC_ROW03)
137
138#define S_BCM1480_MC_ROW04 32
139#define M_BCM1480_MC_ROW04 _SB_MAKEMASK(6, S_BCM1480_MC_ROW04)
140#define V_BCM1480_MC_ROW04(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW04)
141#define G_BCM1480_MC_ROW04(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW04, M_BCM1480_MC_ROW04)
142
143#define S_BCM1480_MC_ROW05 40
144#define M_BCM1480_MC_ROW05 _SB_MAKEMASK(6, S_BCM1480_MC_ROW05)
145#define V_BCM1480_MC_ROW05(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW05)
146#define G_BCM1480_MC_ROW05(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW05, M_BCM1480_MC_ROW05)
147
148#define S_BCM1480_MC_ROW06 48
149#define M_BCM1480_MC_ROW06 _SB_MAKEMASK(6, S_BCM1480_MC_ROW06)
150#define V_BCM1480_MC_ROW06(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW06)
151#define G_BCM1480_MC_ROW06(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW06, M_BCM1480_MC_ROW06)
152
153#define S_BCM1480_MC_ROW07 56
154#define M_BCM1480_MC_ROW07 _SB_MAKEMASK(6, S_BCM1480_MC_ROW07)
155#define V_BCM1480_MC_ROW07(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW07)
156#define G_BCM1480_MC_ROW07(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW07, M_BCM1480_MC_ROW07)
157
158/*
159 * Row Address Bit Select Register 1 (Table 85)
160 */
161
162#define S_BCM1480_MC_ROW08 0
163#define M_BCM1480_MC_ROW08 _SB_MAKEMASK(6, S_BCM1480_MC_ROW08)
164#define V_BCM1480_MC_ROW08(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW08)
165#define G_BCM1480_MC_ROW08(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW08, M_BCM1480_MC_ROW08)
166
167#define S_BCM1480_MC_ROW09 8
168#define M_BCM1480_MC_ROW09 _SB_MAKEMASK(6, S_BCM1480_MC_ROW09)
169#define V_BCM1480_MC_ROW09(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW09)
170#define G_BCM1480_MC_ROW09(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW09, M_BCM1480_MC_ROW09)
171
172#define S_BCM1480_MC_ROW10 16
173#define M_BCM1480_MC_ROW10 _SB_MAKEMASK(6, S_BCM1480_MC_ROW10)
174#define V_BCM1480_MC_ROW10(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW10)
175#define G_BCM1480_MC_ROW10(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW10, M_BCM1480_MC_ROW10)
176
177#define S_BCM1480_MC_ROW11 24
178#define M_BCM1480_MC_ROW11 _SB_MAKEMASK(6, S_BCM1480_MC_ROW11)
179#define V_BCM1480_MC_ROW11(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW11)
180#define G_BCM1480_MC_ROW11(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW11, M_BCM1480_MC_ROW11)
181
182#define S_BCM1480_MC_ROW12 32
183#define M_BCM1480_MC_ROW12 _SB_MAKEMASK(6, S_BCM1480_MC_ROW12)
184#define V_BCM1480_MC_ROW12(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW12)
185#define G_BCM1480_MC_ROW12(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW12, M_BCM1480_MC_ROW12)
186
187#define S_BCM1480_MC_ROW13 40
188#define M_BCM1480_MC_ROW13 _SB_MAKEMASK(6, S_BCM1480_MC_ROW13)
189#define V_BCM1480_MC_ROW13(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW13)
190#define G_BCM1480_MC_ROW13(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW13, M_BCM1480_MC_ROW13)
191
192#define S_BCM1480_MC_ROW14 48
193#define M_BCM1480_MC_ROW14 _SB_MAKEMASK(6, S_BCM1480_MC_ROW14)
194#define V_BCM1480_MC_ROW14(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW14)
195#define G_BCM1480_MC_ROW14(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW14, M_BCM1480_MC_ROW14)
196
197#define K_BCM1480_MC_ROWX_BIT_SPACING 8
198
199/*
200 * Column Address Bit Select Register 0 (Table 86)
201 */
202
203#define S_BCM1480_MC_COL00 0
204#define M_BCM1480_MC_COL00 _SB_MAKEMASK(6, S_BCM1480_MC_COL00)
205#define V_BCM1480_MC_COL00(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL00)
206#define G_BCM1480_MC_COL00(x) _SB_GETVALUE(x, S_BCM1480_MC_COL00, M_BCM1480_MC_COL00)
207
208#define S_BCM1480_MC_COL01 8
209#define M_BCM1480_MC_COL01 _SB_MAKEMASK(6, S_BCM1480_MC_COL01)
210#define V_BCM1480_MC_COL01(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL01)
211#define G_BCM1480_MC_COL01(x) _SB_GETVALUE(x, S_BCM1480_MC_COL01, M_BCM1480_MC_COL01)
212
213#define S_BCM1480_MC_COL02 16
214#define M_BCM1480_MC_COL02 _SB_MAKEMASK(6, S_BCM1480_MC_COL02)
215#define V_BCM1480_MC_COL02(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL02)
216#define G_BCM1480_MC_COL02(x) _SB_GETVALUE(x, S_BCM1480_MC_COL02, M_BCM1480_MC_COL02)
217
218#define S_BCM1480_MC_COL03 24
219#define M_BCM1480_MC_COL03 _SB_MAKEMASK(6, S_BCM1480_MC_COL03)
220#define V_BCM1480_MC_COL03(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL03)
221#define G_BCM1480_MC_COL03(x) _SB_GETVALUE(x, S_BCM1480_MC_COL03, M_BCM1480_MC_COL03)
222
223#define S_BCM1480_MC_COL04 32
224#define M_BCM1480_MC_COL04 _SB_MAKEMASK(6, S_BCM1480_MC_COL04)
225#define V_BCM1480_MC_COL04(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL04)
226#define G_BCM1480_MC_COL04(x) _SB_GETVALUE(x, S_BCM1480_MC_COL04, M_BCM1480_MC_COL04)
227
228#define S_BCM1480_MC_COL05 40
229#define M_BCM1480_MC_COL05 _SB_MAKEMASK(6, S_BCM1480_MC_COL05)
230#define V_BCM1480_MC_COL05(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL05)
231#define G_BCM1480_MC_COL05(x) _SB_GETVALUE(x, S_BCM1480_MC_COL05, M_BCM1480_MC_COL05)
232
233#define S_BCM1480_MC_COL06 48
234#define M_BCM1480_MC_COL06 _SB_MAKEMASK(6, S_BCM1480_MC_COL06)
235#define V_BCM1480_MC_COL06(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL06)
236#define G_BCM1480_MC_COL06(x) _SB_GETVALUE(x, S_BCM1480_MC_COL06, M_BCM1480_MC_COL06)
237
238#define S_BCM1480_MC_COL07 56
239#define M_BCM1480_MC_COL07 _SB_MAKEMASK(6, S_BCM1480_MC_COL07)
240#define V_BCM1480_MC_COL07(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL07)
241#define G_BCM1480_MC_COL07(x) _SB_GETVALUE(x, S_BCM1480_MC_COL07, M_BCM1480_MC_COL07)
242
243/*
244 * Column Address Bit Select Register 1 (Table 87)
245 */
246
247#define S_BCM1480_MC_COL08 0
248#define M_BCM1480_MC_COL08 _SB_MAKEMASK(6, S_BCM1480_MC_COL08)
249#define V_BCM1480_MC_COL08(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL08)
250#define G_BCM1480_MC_COL08(x) _SB_GETVALUE(x, S_BCM1480_MC_COL08, M_BCM1480_MC_COL08)
251
252#define S_BCM1480_MC_COL09 8
253#define M_BCM1480_MC_COL09 _SB_MAKEMASK(6, S_BCM1480_MC_COL09)
254#define V_BCM1480_MC_COL09(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL09)
255#define G_BCM1480_MC_COL09(x) _SB_GETVALUE(x, S_BCM1480_MC_COL09, M_BCM1480_MC_COL09)
256
257#define S_BCM1480_MC_COL10 16 /* not a valid position, must be prog as 0 */
258
259#define S_BCM1480_MC_COL11 24
260#define M_BCM1480_MC_COL11 _SB_MAKEMASK(6, S_BCM1480_MC_COL11)
261#define V_BCM1480_MC_COL11(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL11)
262#define G_BCM1480_MC_COL11(x) _SB_GETVALUE(x, S_BCM1480_MC_COL11, M_BCM1480_MC_COL11)
263
264#define S_BCM1480_MC_COL12 32
265#define M_BCM1480_MC_COL12 _SB_MAKEMASK(6, S_BCM1480_MC_COL12)
266#define V_BCM1480_MC_COL12(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL12)
267#define G_BCM1480_MC_COL12(x) _SB_GETVALUE(x, S_BCM1480_MC_COL12, M_BCM1480_MC_COL12)
268
269#define S_BCM1480_MC_COL13 40
270#define M_BCM1480_MC_COL13 _SB_MAKEMASK(6, S_BCM1480_MC_COL13)
271#define V_BCM1480_MC_COL13(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL13)
272#define G_BCM1480_MC_COL13(x) _SB_GETVALUE(x, S_BCM1480_MC_COL13, M_BCM1480_MC_COL13)
273
274#define S_BCM1480_MC_COL14 48
275#define M_BCM1480_MC_COL14 _SB_MAKEMASK(6, S_BCM1480_MC_COL14)
276#define V_BCM1480_MC_COL14(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL14)
277#define G_BCM1480_MC_COL14(x) _SB_GETVALUE(x, S_BCM1480_MC_COL14, M_BCM1480_MC_COL14)
278
279#define K_BCM1480_MC_COLX_BIT_SPACING 8
280
281/*
282 * CS0 and CS1 Bank Address Bit Select Register (Table 88)
283 */
284
285#define S_BCM1480_MC_CS01_BANK0 0
286#define M_BCM1480_MC_CS01_BANK0 _SB_MAKEMASK(6, S_BCM1480_MC_CS01_BANK0)
287#define V_BCM1480_MC_CS01_BANK0(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS01_BANK0)
288#define G_BCM1480_MC_CS01_BANK0(x) _SB_GETVALUE(x, S_BCM1480_MC_CS01_BANK0, M_BCM1480_MC_CS01_BANK0)
289
290#define S_BCM1480_MC_CS01_BANK1 8
291#define M_BCM1480_MC_CS01_BANK1 _SB_MAKEMASK(6, S_BCM1480_MC_CS01_BANK1)
292#define V_BCM1480_MC_CS01_BANK1(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS01_BANK1)
293#define G_BCM1480_MC_CS01_BANK1(x) _SB_GETVALUE(x, S_BCM1480_MC_CS01_BANK1, M_BCM1480_MC_CS01_BANK1)
294
295#define S_BCM1480_MC_CS01_BANK2 16
296#define M_BCM1480_MC_CS01_BANK2 _SB_MAKEMASK(6, S_BCM1480_MC_CS01_BANK2)
297#define V_BCM1480_MC_CS01_BANK2(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS01_BANK2)
298#define G_BCM1480_MC_CS01_BANK2(x) _SB_GETVALUE(x, S_BCM1480_MC_CS01_BANK2, M_BCM1480_MC_CS01_BANK2)
299
300/*
301 * CS2 and CS3 Bank Address Bit Select Register (Table 89)
302 */
303
304#define S_BCM1480_MC_CS23_BANK0 0
305#define M_BCM1480_MC_CS23_BANK0 _SB_MAKEMASK(6, S_BCM1480_MC_CS23_BANK0)
306#define V_BCM1480_MC_CS23_BANK0(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS23_BANK0)
307#define G_BCM1480_MC_CS23_BANK0(x) _SB_GETVALUE(x, S_BCM1480_MC_CS23_BANK0, M_BCM1480_MC_CS23_BANK0)
308
309#define S_BCM1480_MC_CS23_BANK1 8
310#define M_BCM1480_MC_CS23_BANK1 _SB_MAKEMASK(6, S_BCM1480_MC_CS23_BANK1)
311#define V_BCM1480_MC_CS23_BANK1(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS23_BANK1)
312#define G_BCM1480_MC_CS23_BANK1(x) _SB_GETVALUE(x, S_BCM1480_MC_CS23_BANK1, M_BCM1480_MC_CS23_BANK1)
313
314#define S_BCM1480_MC_CS23_BANK2 16
315#define M_BCM1480_MC_CS23_BANK2 _SB_MAKEMASK(6, S_BCM1480_MC_CS23_BANK2)
316#define V_BCM1480_MC_CS23_BANK2(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS23_BANK2)
317#define G_BCM1480_MC_CS23_BANK2(x) _SB_GETVALUE(x, S_BCM1480_MC_CS23_BANK2, M_BCM1480_MC_CS23_BANK2)
318
319#define K_BCM1480_MC_CSXX_BANKX_BIT_SPACING 8
320
321/*
322 * DRAM Command Register (Table 90)
323 */
324
325#define S_BCM1480_MC_COMMAND 0
326#define M_BCM1480_MC_COMMAND _SB_MAKEMASK(4, S_BCM1480_MC_COMMAND)
327#define V_BCM1480_MC_COMMAND(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COMMAND)
328#define G_BCM1480_MC_COMMAND(x) _SB_GETVALUE(x, S_BCM1480_MC_COMMAND, M_BCM1480_MC_COMMAND)
329
330#define K_BCM1480_MC_COMMAND_EMRS 0
331#define K_BCM1480_MC_COMMAND_MRS 1
332#define K_BCM1480_MC_COMMAND_PRE 2
333#define K_BCM1480_MC_COMMAND_AR 3
334#define K_BCM1480_MC_COMMAND_SETRFSH 4
335#define K_BCM1480_MC_COMMAND_CLRRFSH 5
336#define K_BCM1480_MC_COMMAND_SETPWRDN 6
337#define K_BCM1480_MC_COMMAND_CLRPWRDN 7
338
339#if SIBYTE_HDR_FEATURE(1480, PASS2)
340#define K_BCM1480_MC_COMMAND_EMRS2 8
341#define K_BCM1480_MC_COMMAND_EMRS3 9
342#define K_BCM1480_MC_COMMAND_ENABLE_MCLK 10
343#define K_BCM1480_MC_COMMAND_DISABLE_MCLK 11
344#endif
345
346#define V_BCM1480_MC_COMMAND_EMRS V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_EMRS)
347#define V_BCM1480_MC_COMMAND_MRS V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_MRS)
348#define V_BCM1480_MC_COMMAND_PRE V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_PRE)
349#define V_BCM1480_MC_COMMAND_AR V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_AR)
350#define V_BCM1480_MC_COMMAND_SETRFSH V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_SETRFSH)
351#define V_BCM1480_MC_COMMAND_CLRRFSH V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_CLRRFSH)
352#define V_BCM1480_MC_COMMAND_SETPWRDN V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_SETPWRDN)
353#define V_BCM1480_MC_COMMAND_CLRPWRDN V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_CLRPWRDN)
354
355#if SIBYTE_HDR_FEATURE(1480, PASS2)
356#define V_BCM1480_MC_COMMAND_EMRS2 V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_EMRS2)
357#define V_BCM1480_MC_COMMAND_EMRS3 V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_EMRS3)
358#define V_BCM1480_MC_COMMAND_ENABLE_MCLK V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_ENABLE_MCLK)
359#define V_BCM1480_MC_COMMAND_DISABLE_MCLK V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_DISABLE_MCLK)
360#endif
361
362#define S_BCM1480_MC_CS0 4
363#define M_BCM1480_MC_CS0 _SB_MAKEMASK1(4)
364#define M_BCM1480_MC_CS1 _SB_MAKEMASK1(5)
365#define M_BCM1480_MC_CS2 _SB_MAKEMASK1(6)
366#define M_BCM1480_MC_CS3 _SB_MAKEMASK1(7)
367#define M_BCM1480_MC_CS4 _SB_MAKEMASK1(8)
368#define M_BCM1480_MC_CS5 _SB_MAKEMASK1(9)
369#define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10)
370#define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11)
371
372#define M_BCM1480_MC_CS _SB_MAKEMASK(8, S_BCM1480_MC_CS0)
373#define V_BCM1480_MC_CS(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS0)
374#define G_BCM1480_MC_CS(x) _SB_GETVALUE(x, S_BCM1480_MC_CS0, M_BCM1480_MC_CS0)
375
376#define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16)
377
378/*
379 * DRAM Mode Register (Table 91)
380 */
381
382#define S_BCM1480_MC_EMODE 0
383#define M_BCM1480_MC_EMODE _SB_MAKEMASK(15, S_BCM1480_MC_EMODE)
384#define V_BCM1480_MC_EMODE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_EMODE)
385#define G_BCM1480_MC_EMODE(x) _SB_GETVALUE(x, S_BCM1480_MC_EMODE, M_BCM1480_MC_EMODE)
386#define V_BCM1480_MC_EMODE_DEFAULT V_BCM1480_MC_EMODE(0)
387
388#define S_BCM1480_MC_MODE 16
389#define M_BCM1480_MC_MODE _SB_MAKEMASK(15, S_BCM1480_MC_MODE)
390#define V_BCM1480_MC_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_MODE)
391#define G_BCM1480_MC_MODE(x) _SB_GETVALUE(x, S_BCM1480_MC_MODE, M_BCM1480_MC_MODE)
392#define V_BCM1480_MC_MODE_DEFAULT V_BCM1480_MC_MODE(0)
393
394#define S_BCM1480_MC_DRAM_TYPE 32
395#define M_BCM1480_MC_DRAM_TYPE _SB_MAKEMASK(4, S_BCM1480_MC_DRAM_TYPE)
396#define V_BCM1480_MC_DRAM_TYPE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DRAM_TYPE)
397#define G_BCM1480_MC_DRAM_TYPE(x) _SB_GETVALUE(x, S_BCM1480_MC_DRAM_TYPE, M_BCM1480_MC_DRAM_TYPE)
398
399#define K_BCM1480_MC_DRAM_TYPE_JEDEC 0
400#define K_BCM1480_MC_DRAM_TYPE_FCRAM 1
401
402#if SIBYTE_HDR_FEATURE(1480, PASS2)
403#define K_BCM1480_MC_DRAM_TYPE_DDR2 2
404#endif
405
406#define K_BCM1480_MC_DRAM_TYPE_DDR2_PASS1 0
407
408#define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC)
409#define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM)
410
411#if SIBYTE_HDR_FEATURE(1480, PASS2)
412#define V_BCM1480_MC_DRAM_TYPE_DDR2 V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_DDR2)
413#endif
414
415#define M_BCM1480_MC_GANGED _SB_MAKEMASK1(36)
416#define M_BCM1480_MC_BY9_INTF _SB_MAKEMASK1(37)
417#define M_BCM1480_MC_FORCE_ECC64 _SB_MAKEMASK1(38)
418#define M_BCM1480_MC_ECC_DISABLE _SB_MAKEMASK1(39)
419
420#define S_BCM1480_MC_PG_POLICY 40
421#define M_BCM1480_MC_PG_POLICY _SB_MAKEMASK(2, S_BCM1480_MC_PG_POLICY)
422#define V_BCM1480_MC_PG_POLICY(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PG_POLICY)
423#define G_BCM1480_MC_PG_POLICY(x) _SB_GETVALUE(x, S_BCM1480_MC_PG_POLICY, M_BCM1480_MC_PG_POLICY)
424
425#define K_BCM1480_MC_PG_POLICY_CLOSED 0
426#define K_BCM1480_MC_PG_POLICY_CAS_TIME_CHK 1
427
428#define V_BCM1480_MC_PG_POLICY_CLOSED V_BCM1480_MC_PG_POLICY(K_BCM1480_MC_PG_POLICY_CLOSED)
429#define V_BCM1480_MC_PG_POLICY_CAS_TIME_CHK V_BCM1480_MC_PG_POLICY(K_BCM1480_MC_PG_POLICY_CAS_TIME_CHK)
430
431#if SIBYTE_HDR_FEATURE(1480, PASS2)
432#define M_BCM1480_MC_2T_CMD _SB_MAKEMASK1(42)
433#define M_BCM1480_MC_ECC_COR_DIS _SB_MAKEMASK1(43)
434#endif
435
436#define V_BCM1480_MC_DRAMMODE_DEFAULT V_BCM1480_MC_EMODE_DEFAULT | V_BCM1480_MC_MODE_DEFAULT | V_BCM1480_MC_DRAM_TYPE_JEDEC | \
437 V_BCM1480_MC_PG_POLICY(K_BCM1480_MC_PG_POLICY_CAS_TIME_CHK)
438
439/*
440 * Memory Clock Configuration Register (Table 92)
441 */
442
443#define S_BCM1480_MC_CLK_RATIO 0
444#define M_BCM1480_MC_CLK_RATIO _SB_MAKEMASK(6, S_BCM1480_MC_CLK_RATIO)
445#define V_BCM1480_MC_CLK_RATIO(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CLK_RATIO)
446#define G_BCM1480_MC_CLK_RATIO(x) _SB_GETVALUE(x, S_BCM1480_MC_CLK_RATIO, M_BCM1480_MC_CLK_RATIO)
447
448#define V_BCM1480_MC_CLK_RATIO_DEFAULT V_BCM1480_MC_CLK_RATIO(10)
449
450#define S_BCM1480_MC_REF_RATE 8
451#define M_BCM1480_MC_REF_RATE _SB_MAKEMASK(8, S_BCM1480_MC_REF_RATE)
452#define V_BCM1480_MC_REF_RATE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_REF_RATE)
453#define G_BCM1480_MC_REF_RATE(x) _SB_GETVALUE(x, S_BCM1480_MC_REF_RATE, M_BCM1480_MC_REF_RATE)
454
455#define K_BCM1480_MC_REF_RATE_100MHz 0x31
456#define K_BCM1480_MC_REF_RATE_200MHz 0x62
457#define K_BCM1480_MC_REF_RATE_400MHz 0xC4
458
459#define V_BCM1480_MC_REF_RATE_100MHz V_BCM1480_MC_REF_RATE(K_BCM1480_MC_REF_RATE_100MHz)
460#define V_BCM1480_MC_REF_RATE_200MHz V_BCM1480_MC_REF_RATE(K_BCM1480_MC_REF_RATE_200MHz)
461#define V_BCM1480_MC_REF_RATE_400MHz V_BCM1480_MC_REF_RATE(K_BCM1480_MC_REF_RATE_400MHz)
462#define V_BCM1480_MC_REF_RATE_DEFAULT V_BCM1480_MC_REF_RATE_400MHz
463
464#if SIBYTE_HDR_FEATURE(1480, PASS2)
465#define M_BCM1480_MC_AUTO_REF_DIS _SB_MAKEMASK1(16)
466#endif
467
468/*
469 * ODT Register (Table 99)
470 */
471
472#if SIBYTE_HDR_FEATURE(1480, PASS2)
473#define M_BCM1480_MC_RD_ODT0_CS0 _SB_MAKEMASK1(0)
474#define M_BCM1480_MC_RD_ODT0_CS2 _SB_MAKEMASK1(1)
475#define M_BCM1480_MC_RD_ODT0_CS4 _SB_MAKEMASK1(2)
476#define M_BCM1480_MC_RD_ODT0_CS6 _SB_MAKEMASK1(3)
477#define M_BCM1480_MC_WR_ODT0_CS0 _SB_MAKEMASK1(4)
478#define M_BCM1480_MC_WR_ODT0_CS2 _SB_MAKEMASK1(5)
479#define M_BCM1480_MC_WR_ODT0_CS4 _SB_MAKEMASK1(6)
480#define M_BCM1480_MC_WR_ODT0_CS6 _SB_MAKEMASK1(7)
481#define M_BCM1480_MC_RD_ODT2_CS0 _SB_MAKEMASK1(8)
482#define M_BCM1480_MC_RD_ODT2_CS2 _SB_MAKEMASK1(9)
483#define M_BCM1480_MC_RD_ODT2_CS4 _SB_MAKEMASK1(10)
484#define M_BCM1480_MC_RD_ODT2_CS6 _SB_MAKEMASK1(11)
485#define M_BCM1480_MC_WR_ODT2_CS0 _SB_MAKEMASK1(12)
486#define M_BCM1480_MC_WR_ODT2_CS2 _SB_MAKEMASK1(13)
487#define M_BCM1480_MC_WR_ODT2_CS4 _SB_MAKEMASK1(14)
488#define M_BCM1480_MC_WR_ODT2_CS6 _SB_MAKEMASK1(15)
489#define M_BCM1480_MC_RD_ODT4_CS0 _SB_MAKEMASK1(16)
490#define M_BCM1480_MC_RD_ODT4_CS2 _SB_MAKEMASK1(17)
491#define M_BCM1480_MC_RD_ODT4_CS4 _SB_MAKEMASK1(18)
492#define M_BCM1480_MC_RD_ODT4_CS6 _SB_MAKEMASK1(19)
493#define M_BCM1480_MC_WR_ODT4_CS0 _SB_MAKEMASK1(20)
494#define M_BCM1480_MC_WR_ODT4_CS2 _SB_MAKEMASK1(21)
495#define M_BCM1480_MC_WR_ODT4_CS4 _SB_MAKEMASK1(22)
496#define M_BCM1480_MC_WR_ODT4_CS6 _SB_MAKEMASK1(23)
497#define M_BCM1480_MC_RD_ODT6_CS0 _SB_MAKEMASK1(24)
498#define M_BCM1480_MC_RD_ODT6_CS2 _SB_MAKEMASK1(25)
499#define M_BCM1480_MC_RD_ODT6_CS4 _SB_MAKEMASK1(26)
500#define M_BCM1480_MC_RD_ODT6_CS6 _SB_MAKEMASK1(27)
501#define M_BCM1480_MC_WR_ODT6_CS0 _SB_MAKEMASK1(28)
502#define M_BCM1480_MC_WR_ODT6_CS2 _SB_MAKEMASK1(29)
503#define M_BCM1480_MC_WR_ODT6_CS4 _SB_MAKEMASK1(30)
504#define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31)
505
506#define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32)
507
508#define S_BCM1480_MC_ODT0 0
509#define M_BCM1480_MC_ODT0 _SB_MAKEMASK(8, S_BCM1480_MC_ODT0)
510#define V_BCM1480_MC_ODT0(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ODT0)
511
512#define S_BCM1480_MC_ODT2 8
513#define M_BCM1480_MC_ODT2 _SB_MAKEMASK(8, S_BCM1480_MC_ODT2)
514#define V_BCM1480_MC_ODT2(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ODT2)
515
516#define S_BCM1480_MC_ODT4 16
517#define M_BCM1480_MC_ODT4 _SB_MAKEMASK(8, S_BCM1480_MC_ODT4)
518#define V_BCM1480_MC_ODT4(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ODT4)
519
520#define S_BCM1480_MC_ODT6 24
521#define M_BCM1480_MC_ODT6 _SB_MAKEMASK(8, S_BCM1480_MC_ODT6)
522#define V_BCM1480_MC_ODT6(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ODT6)
523#endif
524
525/*
526 * Memory DLL Configuration Register (Table 93)
527 */
528
529#define S_BCM1480_MC_ADDR_COARSE_ADJ 0
530#define M_BCM1480_MC_ADDR_COARSE_ADJ _SB_MAKEMASK(6, S_BCM1480_MC_ADDR_COARSE_ADJ)
531#define V_BCM1480_MC_ADDR_COARSE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ADDR_COARSE_ADJ)
532#define G_BCM1480_MC_ADDR_COARSE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_ADDR_COARSE_ADJ, M_BCM1480_MC_ADDR_COARSE_ADJ)
533#define V_BCM1480_MC_ADDR_COARSE_ADJ_DEFAULT V_BCM1480_MC_ADDR_COARSE_ADJ(0x0)
534
535#if SIBYTE_HDR_FEATURE(1480, PASS2)
536#define S_BCM1480_MC_ADDR_FREQ_RANGE 8
537#define M_BCM1480_MC_ADDR_FREQ_RANGE _SB_MAKEMASK(4, S_BCM1480_MC_ADDR_FREQ_RANGE)
538#define V_BCM1480_MC_ADDR_FREQ_RANGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ADDR_FREQ_RANGE)
539#define G_BCM1480_MC_ADDR_FREQ_RANGE(x) _SB_GETVALUE(x, S_BCM1480_MC_ADDR_FREQ_RANGE, M_BCM1480_MC_ADDR_FREQ_RANGE)
540#define V_BCM1480_MC_ADDR_FREQ_RANGE_DEFAULT V_BCM1480_MC_ADDR_FREQ_RANGE(0x4)
541#endif
542
543#define S_BCM1480_MC_ADDR_FINE_ADJ 8
544#define M_BCM1480_MC_ADDR_FINE_ADJ _SB_MAKEMASK(4, S_BCM1480_MC_ADDR_FINE_ADJ)
545#define V_BCM1480_MC_ADDR_FINE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ADDR_FINE_ADJ)
546#define G_BCM1480_MC_ADDR_FINE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_ADDR_FINE_ADJ, M_BCM1480_MC_ADDR_FINE_ADJ)
547#define V_BCM1480_MC_ADDR_FINE_ADJ_DEFAULT V_BCM1480_MC_ADDR_FINE_ADJ(0x8)
548
549#define S_BCM1480_MC_DQI_COARSE_ADJ 16
550#define M_BCM1480_MC_DQI_COARSE_ADJ _SB_MAKEMASK(6, S_BCM1480_MC_DQI_COARSE_ADJ)
551#define V_BCM1480_MC_DQI_COARSE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQI_COARSE_ADJ)
552#define G_BCM1480_MC_DQI_COARSE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_DQI_COARSE_ADJ, M_BCM1480_MC_DQI_COARSE_ADJ)
553#define V_BCM1480_MC_DQI_COARSE_ADJ_DEFAULT V_BCM1480_MC_DQI_COARSE_ADJ(0x0)
554
555#if SIBYTE_HDR_FEATURE(1480, PASS2)
556#define S_BCM1480_MC_DQI_FREQ_RANGE 24
557#define M_BCM1480_MC_DQI_FREQ_RANGE _SB_MAKEMASK(4, S_BCM1480_MC_DQI_FREQ_RANGE)
558#define V_BCM1480_MC_DQI_FREQ_RANGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQI_FREQ_RANGE)
559#define G_BCM1480_MC_DQI_FREQ_RANGE(x) _SB_GETVALUE(x, S_BCM1480_MC_DQI_FREQ_RANGE, M_BCM1480_MC_DQI_FREQ_RANGE)
560#define V_BCM1480_MC_DQI_FREQ_RANGE_DEFAULT V_BCM1480_MC_DQI_FREQ_RANGE(0x4)
561#endif
562
563#define S_BCM1480_MC_DQI_FINE_ADJ 24
564#define M_BCM1480_MC_DQI_FINE_ADJ _SB_MAKEMASK(4, S_BCM1480_MC_DQI_FINE_ADJ)
565#define V_BCM1480_MC_DQI_FINE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQI_FINE_ADJ)
566#define G_BCM1480_MC_DQI_FINE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_DQI_FINE_ADJ, M_BCM1480_MC_DQI_FINE_ADJ)
567#define V_BCM1480_MC_DQI_FINE_ADJ_DEFAULT V_BCM1480_MC_DQI_FINE_ADJ(0x8)
568
569#define S_BCM1480_MC_DQO_COARSE_ADJ 32
570#define M_BCM1480_MC_DQO_COARSE_ADJ _SB_MAKEMASK(6, S_BCM1480_MC_DQO_COARSE_ADJ)
571#define V_BCM1480_MC_DQO_COARSE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQO_COARSE_ADJ)
572#define G_BCM1480_MC_DQO_COARSE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_DQO_COARSE_ADJ, M_BCM1480_MC_DQO_COARSE_ADJ)
573#define V_BCM1480_MC_DQO_COARSE_ADJ_DEFAULT V_BCM1480_MC_DQO_COARSE_ADJ(0x0)
574
575#if SIBYTE_HDR_FEATURE(1480, PASS2)
576#define S_BCM1480_MC_DQO_FREQ_RANGE 40
577#define M_BCM1480_MC_DQO_FREQ_RANGE _SB_MAKEMASK(4, S_BCM1480_MC_DQO_FREQ_RANGE)
578#define V_BCM1480_MC_DQO_FREQ_RANGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQO_FREQ_RANGE)
579#define G_BCM1480_MC_DQO_FREQ_RANGE(x) _SB_GETVALUE(x, S_BCM1480_MC_DQO_FREQ_RANGE, M_BCM1480_MC_DQO_FREQ_RANGE)
580#define V_BCM1480_MC_DQO_FREQ_RANGE_DEFAULT V_BCM1480_MC_DQO_FREQ_RANGE(0x4)
581#endif
582
583#define S_BCM1480_MC_DQO_FINE_ADJ 40
584#define M_BCM1480_MC_DQO_FINE_ADJ _SB_MAKEMASK(4, S_BCM1480_MC_DQO_FINE_ADJ)
585#define V_BCM1480_MC_DQO_FINE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQO_FINE_ADJ)
586#define G_BCM1480_MC_DQO_FINE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_DQO_FINE_ADJ, M_BCM1480_MC_DQO_FINE_ADJ)
587#define V_BCM1480_MC_DQO_FINE_ADJ_DEFAULT V_BCM1480_MC_DQO_FINE_ADJ(0x8)
588
589#if SIBYTE_HDR_FEATURE(1480, PASS2)
590#define S_BCM1480_MC_DLL_PDSEL 44
591#define M_BCM1480_MC_DLL_PDSEL _SB_MAKEMASK(2, S_BCM1480_MC_DLL_PDSEL)
592#define V_BCM1480_MC_DLL_PDSEL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_PDSEL)
593#define G_BCM1480_MC_DLL_PDSEL(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_PDSEL, M_BCM1480_MC_DLL_PDSEL)
594#define V_BCM1480_MC_DLL_DEFAULT_PDSEL V_BCM1480_MC_DLL_PDSEL(0x0)
595
596#define M_BCM1480_MC_DLL_REGBYPASS _SB_MAKEMASK1(46)
597#define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47)
598#endif
599
600#define S_BCM1480_MC_DLL_DEFAULT 48
601#define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6, S_BCM1480_MC_DLL_DEFAULT)
602#define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_DEFAULT)
603#define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_DEFAULT, M_BCM1480_MC_DLL_DEFAULT)
604#define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10)
605
606#if SIBYTE_HDR_FEATURE(1480, PASS2)
607#define S_BCM1480_MC_DLL_REGCTRL 54
608#define M_BCM1480_MC_DLL_REGCTRL _SB_MAKEMASK(2, S_BCM1480_MC_DLL_REGCTRL)
609#define V_BCM1480_MC_DLL_REGCTRL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_REGCTRL)
610#define G_BCM1480_MC_DLL_REGCTRL(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_REGCTRL, M_BCM1480_MC_DLL_REGCTRL)
611#define V_BCM1480_MC_DLL_DEFAULT_REGCTRL V_BCM1480_MC_DLL_REGCTRL(0x0)
612#endif
613
614#if SIBYTE_HDR_FEATURE(1480, PASS2)
615#define S_BCM1480_MC_DLL_FREQ_RANGE 56
616#define M_BCM1480_MC_DLL_FREQ_RANGE _SB_MAKEMASK(4, S_BCM1480_MC_DLL_FREQ_RANGE)
617#define V_BCM1480_MC_DLL_FREQ_RANGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_FREQ_RANGE)
618#define G_BCM1480_MC_DLL_FREQ_RANGE(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_FREQ_RANGE, M_BCM1480_MC_DLL_FREQ_RANGE)
619#define V_BCM1480_MC_DLL_FREQ_RANGE_DEFAULT V_BCM1480_MC_DLL_FREQ_RANGE(0x4)
620#endif
621
622#define S_BCM1480_MC_DLL_STEP_SIZE 56
623#define M_BCM1480_MC_DLL_STEP_SIZE _SB_MAKEMASK(4, S_BCM1480_MC_DLL_STEP_SIZE)
624#define V_BCM1480_MC_DLL_STEP_SIZE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_STEP_SIZE)
625#define G_BCM1480_MC_DLL_STEP_SIZE(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_STEP_SIZE, M_BCM1480_MC_DLL_STEP_SIZE)
626#define V_BCM1480_MC_DLL_STEP_SIZE_DEFAULT V_BCM1480_MC_DLL_STEP_SIZE(0x8)
627
628#if SIBYTE_HDR_FEATURE(1480, PASS2)
629#define S_BCM1480_MC_DLL_BGCTRL 60
630#define M_BCM1480_MC_DLL_BGCTRL _SB_MAKEMASK(2, S_BCM1480_MC_DLL_BGCTRL)
631#define V_BCM1480_MC_DLL_BGCTRL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_BGCTRL)
632#define G_BCM1480_MC_DLL_BGCTRL(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_BGCTRL, M_BCM1480_MC_DLL_BGCTRL)
633#define V_BCM1480_MC_DLL_DEFAULT_BGCTRL V_BCM1480_MC_DLL_BGCTRL(0x0)
634#endif
635
636#define M_BCM1480_MC_DLL_BYPASS _SB_MAKEMASK1(63)
637
638/*
639 * Memory Drive Configuration Register (Table 94)
640 */
641
642#define S_BCM1480_MC_RTT_BYP_PULLDOWN 0
643#define M_BCM1480_MC_RTT_BYP_PULLDOWN _SB_MAKEMASK(3, S_BCM1480_MC_RTT_BYP_PULLDOWN)
644#define V_BCM1480_MC_RTT_BYP_PULLDOWN(x) _SB_MAKEVALUE(x, S_BCM1480_MC_RTT_BYP_PULLDOWN)
645#define G_BCM1480_MC_RTT_BYP_PULLDOWN(x) _SB_GETVALUE(x, S_BCM1480_MC_RTT_BYP_PULLDOWN, M_BCM1480_MC_RTT_BYP_PULLDOWN)
646
647#define S_BCM1480_MC_RTT_BYP_PULLUP 6
648#define M_BCM1480_MC_RTT_BYP_PULLUP _SB_MAKEMASK(3, S_BCM1480_MC_RTT_BYP_PULLUP)
649#define V_BCM1480_MC_RTT_BYP_PULLUP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_RTT_BYP_PULLUP)
650#define G_BCM1480_MC_RTT_BYP_PULLUP(x) _SB_GETVALUE(x, S_BCM1480_MC_RTT_BYP_PULLUP, M_BCM1480_MC_RTT_BYP_PULLUP)
651
652#define M_BCM1480_MC_RTT_BYPASS _SB_MAKEMASK1(8)
653#define M_BCM1480_MC_RTT_COMP_MOV_AVG _SB_MAKEMASK1(9)
654
655#define S_BCM1480_MC_PVT_BYP_C1_PULLDOWN 10
656#define M_BCM1480_MC_PVT_BYP_C1_PULLDOWN _SB_MAKEMASK(4, S_BCM1480_MC_PVT_BYP_C1_PULLDOWN)
657#define V_BCM1480_MC_PVT_BYP_C1_PULLDOWN(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PVT_BYP_C1_PULLDOWN)
658#define G_BCM1480_MC_PVT_BYP_C1_PULLDOWN(x) _SB_GETVALUE(x, S_BCM1480_MC_PVT_BYP_C1_PULLDOWN, M_BCM1480_MC_PVT_BYP_C1_PULLDOWN)
659
660#define S_BCM1480_MC_PVT_BYP_C1_PULLUP 15
661#define M_BCM1480_MC_PVT_BYP_C1_PULLUP _SB_MAKEMASK(4, S_BCM1480_MC_PVT_BYP_C1_PULLUP)
662#define V_BCM1480_MC_PVT_BYP_C1_PULLUP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PVT_BYP_C1_PULLUP)
663#define G_BCM1480_MC_PVT_BYP_C1_PULLUP(x) _SB_GETVALUE(x, S_BCM1480_MC_PVT_BYP_C1_PULLUP, M_BCM1480_MC_PVT_BYP_C1_PULLUP)
664
665#define S_BCM1480_MC_PVT_BYP_C2_PULLDOWN 20
666#define M_BCM1480_MC_PVT_BYP_C2_PULLDOWN _SB_MAKEMASK(4, S_BCM1480_MC_PVT_BYP_C2_PULLDOWN)
667#define V_BCM1480_MC_PVT_BYP_C2_PULLDOWN(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PVT_BYP_C2_PULLDOWN)
668#define G_BCM1480_MC_PVT_BYP_C2_PULLDOWN(x) _SB_GETVALUE(x, S_BCM1480_MC_PVT_BYP_C2_PULLDOWN, M_BCM1480_MC_PVT_BYP_C2_PULLDOWN)
669
670#define S_BCM1480_MC_PVT_BYP_C2_PULLUP 25
671#define M_BCM1480_MC_PVT_BYP_C2_PULLUP _SB_MAKEMASK(4, S_BCM1480_MC_PVT_BYP_C2_PULLUP)
672#define V_BCM1480_MC_PVT_BYP_C2_PULLUP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PVT_BYP_C2_PULLUP)
673#define G_BCM1480_MC_PVT_BYP_C2_PULLUP(x) _SB_GETVALUE(x, S_BCM1480_MC_PVT_BYP_C2_PULLUP, M_BCM1480_MC_PVT_BYP_C2_PULLUP)
674
675#define M_BCM1480_MC_PVT_BYPASS _SB_MAKEMASK1(30)
676#define M_BCM1480_MC_PVT_COMP_MOV_AVG _SB_MAKEMASK1(31)
677
678#define M_BCM1480_MC_CLK_CLASS _SB_MAKEMASK1(34)
679#define M_BCM1480_MC_DATA_CLASS _SB_MAKEMASK1(35)
680#define M_BCM1480_MC_ADDR_CLASS _SB_MAKEMASK1(36)
681
682#define M_BCM1480_MC_DQ_ODT_75 _SB_MAKEMASK1(37)
683#define M_BCM1480_MC_DQ_ODT_150 _SB_MAKEMASK1(38)
684#define M_BCM1480_MC_DQS_ODT_75 _SB_MAKEMASK1(39)
685#define M_BCM1480_MC_DQS_ODT_150 _SB_MAKEMASK1(40)
686#define M_BCM1480_MC_DQS_DIFF _SB_MAKEMASK1(41)
687
688/*
689 * ECC Test Data Register (Table 95)
690 */
691
692#define S_BCM1480_MC_DATA_INVERT 0
693#define M_DATA_ECC_INVERT _SB_MAKEMASK(64, S_BCM1480_MC_ECC_INVERT)
694
695/*
696 * ECC Test ECC Register (Table 96)
697 */
698
699#define S_BCM1480_MC_ECC_INVERT 0
700#define M_BCM1480_MC_ECC_INVERT _SB_MAKEMASK(8, S_BCM1480_MC_ECC_INVERT)
701
702/*
703 * SDRAM Timing Register (Table 97)
704 */
705
706#define S_BCM1480_MC_tRCD 0
707#define M_BCM1480_MC_tRCD _SB_MAKEMASK(4, S_BCM1480_MC_tRCD)
708#define V_BCM1480_MC_tRCD(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRCD)
709#define G_BCM1480_MC_tRCD(x) _SB_GETVALUE(x, S_BCM1480_MC_tRCD, M_BCM1480_MC_tRCD)
710#define K_BCM1480_MC_tRCD_DEFAULT 3
711#define V_BCM1480_MC_tRCD_DEFAULT V_BCM1480_MC_tRCD(K_BCM1480_MC_tRCD_DEFAULT)
712
713#define S_BCM1480_MC_tCL 4
714#define M_BCM1480_MC_tCL _SB_MAKEMASK(4, S_BCM1480_MC_tCL)
715#define V_BCM1480_MC_tCL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tCL)
716#define G_BCM1480_MC_tCL(x) _SB_GETVALUE(x, S_BCM1480_MC_tCL, M_BCM1480_MC_tCL)
717#define K_BCM1480_MC_tCL_DEFAULT 2
718#define V_BCM1480_MC_tCL_DEFAULT V_BCM1480_MC_tCL(K_BCM1480_MC_tCL_DEFAULT)
719
720#define M_BCM1480_MC_tCrDh _SB_MAKEMASK1(8)
721
722#define S_BCM1480_MC_tWR 9
723#define M_BCM1480_MC_tWR _SB_MAKEMASK(3, S_BCM1480_MC_tWR)
724#define V_BCM1480_MC_tWR(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tWR)
725#define G_BCM1480_MC_tWR(x) _SB_GETVALUE(x, S_BCM1480_MC_tWR, M_BCM1480_MC_tWR)
726#define K_BCM1480_MC_tWR_DEFAULT 2
727#define V_BCM1480_MC_tWR_DEFAULT V_BCM1480_MC_tWR(K_BCM1480_MC_tWR_DEFAULT)
728
729#define S_BCM1480_MC_tCwD 12
730#define M_BCM1480_MC_tCwD _SB_MAKEMASK(4, S_BCM1480_MC_tCwD)
731#define V_BCM1480_MC_tCwD(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tCwD)
732#define G_BCM1480_MC_tCwD(x) _SB_GETVALUE(x, S_BCM1480_MC_tCwD, M_BCM1480_MC_tCwD)
733#define K_BCM1480_MC_tCwD_DEFAULT 1
734#define V_BCM1480_MC_tCwD_DEFAULT V_BCM1480_MC_tCwD(K_BCM1480_MC_tCwD_DEFAULT)
735
736#define S_BCM1480_MC_tRP 16
737#define M_BCM1480_MC_tRP _SB_MAKEMASK(4, S_BCM1480_MC_tRP)
738#define V_BCM1480_MC_tRP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRP)
739#define G_BCM1480_MC_tRP(x) _SB_GETVALUE(x, S_BCM1480_MC_tRP, M_BCM1480_MC_tRP)
740#define K_BCM1480_MC_tRP_DEFAULT 4
741#define V_BCM1480_MC_tRP_DEFAULT V_BCM1480_MC_tRP(K_BCM1480_MC_tRP_DEFAULT)
742
743#define S_BCM1480_MC_tRRD 20
744#define M_BCM1480_MC_tRRD _SB_MAKEMASK(4, S_BCM1480_MC_tRRD)
745#define V_BCM1480_MC_tRRD(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRRD)
746#define G_BCM1480_MC_tRRD(x) _SB_GETVALUE(x, S_BCM1480_MC_tRRD, M_BCM1480_MC_tRRD)
747#define K_BCM1480_MC_tRRD_DEFAULT 2
748#define V_BCM1480_MC_tRRD_DEFAULT V_BCM1480_MC_tRRD(K_BCM1480_MC_tRRD_DEFAULT)
749
750#define S_BCM1480_MC_tRCw 24
751#define M_BCM1480_MC_tRCw _SB_MAKEMASK(5, S_BCM1480_MC_tRCw)
752#define V_BCM1480_MC_tRCw(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRCw)
753#define G_BCM1480_MC_tRCw(x) _SB_GETVALUE(x, S_BCM1480_MC_tRCw, M_BCM1480_MC_tRCw)
754#define K_BCM1480_MC_tRCw_DEFAULT 10
755#define V_BCM1480_MC_tRCw_DEFAULT V_BCM1480_MC_tRCw(K_BCM1480_MC_tRCw_DEFAULT)
756
757#define S_BCM1480_MC_tRCr 32
758#define M_BCM1480_MC_tRCr _SB_MAKEMASK(5, S_BCM1480_MC_tRCr)
759#define V_BCM1480_MC_tRCr(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRCr)
760#define G_BCM1480_MC_tRCr(x) _SB_GETVALUE(x, S_BCM1480_MC_tRCr, M_BCM1480_MC_tRCr)
761#define K_BCM1480_MC_tRCr_DEFAULT 9
762#define V_BCM1480_MC_tRCr_DEFAULT V_BCM1480_MC_tRCr(K_BCM1480_MC_tRCr_DEFAULT)
763
764#if SIBYTE_HDR_FEATURE(1480, PASS2)
765#define S_BCM1480_MC_tFAW 40
766#define M_BCM1480_MC_tFAW _SB_MAKEMASK(6, S_BCM1480_MC_tFAW)
767#define V_BCM1480_MC_tFAW(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tFAW)
768#define G_BCM1480_MC_tFAW(x) _SB_GETVALUE(x, S_BCM1480_MC_tFAW, M_BCM1480_MC_tFAW)
769#define K_BCM1480_MC_tFAW_DEFAULT 0
770#define V_BCM1480_MC_tFAW_DEFAULT V_BCM1480_MC_tFAW(K_BCM1480_MC_tFAW_DEFAULT)
771#endif
772
773#define S_BCM1480_MC_tRFC 48
774#define M_BCM1480_MC_tRFC _SB_MAKEMASK(7, S_BCM1480_MC_tRFC)
775#define V_BCM1480_MC_tRFC(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRFC)
776#define G_BCM1480_MC_tRFC(x) _SB_GETVALUE(x, S_BCM1480_MC_tRFC, M_BCM1480_MC_tRFC)
777#define K_BCM1480_MC_tRFC_DEFAULT 12
778#define V_BCM1480_MC_tRFC_DEFAULT V_BCM1480_MC_tRFC(K_BCM1480_MC_tRFC_DEFAULT)
779
780#define S_BCM1480_MC_tFIFO 56
781#define M_BCM1480_MC_tFIFO _SB_MAKEMASK(2, S_BCM1480_MC_tFIFO)
782#define V_BCM1480_MC_tFIFO(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tFIFO)
783#define G_BCM1480_MC_tFIFO(x) _SB_GETVALUE(x, S_BCM1480_MC_tFIFO, M_BCM1480_MC_tFIFO)
784#define K_BCM1480_MC_tFIFO_DEFAULT 0
785#define V_BCM1480_MC_tFIFO_DEFAULT V_BCM1480_MC_tFIFO(K_BCM1480_MC_tFIFO_DEFAULT)
786
787#define S_BCM1480_MC_tW2R 58
788#define M_BCM1480_MC_tW2R _SB_MAKEMASK(2, S_BCM1480_MC_tW2R)
789#define V_BCM1480_MC_tW2R(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tW2R)
790#define G_BCM1480_MC_tW2R(x) _SB_GETVALUE(x, S_BCM1480_MC_tW2R, M_BCM1480_MC_tW2R)
791#define K_BCM1480_MC_tW2R_DEFAULT 1
792#define V_BCM1480_MC_tW2R_DEFAULT V_BCM1480_MC_tW2R(K_BCM1480_MC_tW2R_DEFAULT)
793
794#define S_BCM1480_MC_tR2W 60
795#define M_BCM1480_MC_tR2W _SB_MAKEMASK(2, S_BCM1480_MC_tR2W)
796#define V_BCM1480_MC_tR2W(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tR2W)
797#define G_BCM1480_MC_tR2W(x) _SB_GETVALUE(x, S_BCM1480_MC_tR2W, M_BCM1480_MC_tR2W)
798#define K_BCM1480_MC_tR2W_DEFAULT 0
799#define V_BCM1480_MC_tR2W_DEFAULT V_BCM1480_MC_tR2W(K_BCM1480_MC_tR2W_DEFAULT)
800
801#define M_BCM1480_MC_tR2R _SB_MAKEMASK1(62)
802
803#define V_BCM1480_MC_TIMING_DEFAULT (M_BCM1480_MC_tR2R | \
804 V_BCM1480_MC_tFIFO_DEFAULT | \
805 V_BCM1480_MC_tR2W_DEFAULT | \
806 V_BCM1480_MC_tW2R_DEFAULT | \
807 V_BCM1480_MC_tRFC_DEFAULT | \
808 V_BCM1480_MC_tRCr_DEFAULT | \
809 V_BCM1480_MC_tRCw_DEFAULT | \
810 V_BCM1480_MC_tRRD_DEFAULT | \
811 V_BCM1480_MC_tRP_DEFAULT | \
812 V_BCM1480_MC_tCwD_DEFAULT | \
813 V_BCM1480_MC_tWR_DEFAULT | \
814 M_BCM1480_MC_tCrDh | \
815 V_BCM1480_MC_tCL_DEFAULT | \
816 V_BCM1480_MC_tRCD_DEFAULT)
817
818/*
819 * SDRAM Timing Register 2
820 */
821
822#if SIBYTE_HDR_FEATURE(1480, PASS2)
823
824#define S_BCM1480_MC_tAL 0
825#define M_BCM1480_MC_tAL _SB_MAKEMASK(4, S_BCM1480_MC_tAL)
826#define V_BCM1480_MC_tAL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tAL)
827#define G_BCM1480_MC_tAL(x) _SB_GETVALUE(x, S_BCM1480_MC_tAL, M_BCM1480_MC_tAL)
828#define K_BCM1480_MC_tAL_DEFAULT 0
829#define V_BCM1480_MC_tAL_DEFAULT V_BCM1480_MC_tAL(K_BCM1480_MC_tAL_DEFAULT)
830
831#define S_BCM1480_MC_tRTP 4
832#define M_BCM1480_MC_tRTP _SB_MAKEMASK(3, S_BCM1480_MC_tRTP)
833#define V_BCM1480_MC_tRTP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRTP)
834#define G_BCM1480_MC_tRTP(x) _SB_GETVALUE(x, S_BCM1480_MC_tRTP, M_BCM1480_MC_tRTP)
835#define K_BCM1480_MC_tRTP_DEFAULT 2
836#define V_BCM1480_MC_tRTP_DEFAULT V_BCM1480_MC_tRTP(K_BCM1480_MC_tRTP_DEFAULT)
837
838#define S_BCM1480_MC_tW2W 8
839#define M_BCM1480_MC_tW2W _SB_MAKEMASK(2, S_BCM1480_MC_tW2W)
840#define V_BCM1480_MC_tW2W(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tW2W)
841#define G_BCM1480_MC_tW2W(x) _SB_GETVALUE(x, S_BCM1480_MC_tW2W, M_BCM1480_MC_tW2W)
842#define K_BCM1480_MC_tW2W_DEFAULT 0
843#define V_BCM1480_MC_tW2W_DEFAULT V_BCM1480_MC_tW2W(K_BCM1480_MC_tW2W_DEFAULT)
844
845#define S_BCM1480_MC_tRAP 12
846#define M_BCM1480_MC_tRAP _SB_MAKEMASK(4, S_BCM1480_MC_tRAP)
847#define V_BCM1480_MC_tRAP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRAP)
848#define G_BCM1480_MC_tRAP(x) _SB_GETVALUE(x, S_BCM1480_MC_tRAP, M_BCM1480_MC_tRAP)
849#define K_BCM1480_MC_tRAP_DEFAULT 0
850#define V_BCM1480_MC_tRAP_DEFAULT V_BCM1480_MC_tRAP(K_BCM1480_MC_tRAP_DEFAULT)
851
852#endif
853
854
855
856/*
857 * Global Registers: single instances per BCM1480
858 */
859
860/*
861 * Global Configuration Register (Table 99)
862 */
863
864#define S_BCM1480_MC_BLK_SET_MARK 8
865#define M_BCM1480_MC_BLK_SET_MARK _SB_MAKEMASK(4, S_BCM1480_MC_BLK_SET_MARK)
866#define V_BCM1480_MC_BLK_SET_MARK(x) _SB_MAKEVALUE(x, S_BCM1480_MC_BLK_SET_MARK)
867#define G_BCM1480_MC_BLK_SET_MARK(x) _SB_GETVALUE(x, S_BCM1480_MC_BLK_SET_MARK, M_BCM1480_MC_BLK_SET_MARK)
868
869#define S_BCM1480_MC_BLK_CLR_MARK 12
870#define M_BCM1480_MC_BLK_CLR_MARK _SB_MAKEMASK(4, S_BCM1480_MC_BLK_CLR_MARK)
871#define V_BCM1480_MC_BLK_CLR_MARK(x) _SB_MAKEVALUE(x, S_BCM1480_MC_BLK_CLR_MARK)
872#define G_BCM1480_MC_BLK_CLR_MARK(x) _SB_GETVALUE(x, S_BCM1480_MC_BLK_CLR_MARK, M_BCM1480_MC_BLK_CLR_MARK)
873
874#define M_BCM1480_MC_PKT_PRIORITY _SB_MAKEMASK1(16)
875
876#define S_BCM1480_MC_MAX_AGE 20
877#define M_BCM1480_MC_MAX_AGE _SB_MAKEMASK(4, S_BCM1480_MC_MAX_AGE)
878#define V_BCM1480_MC_MAX_AGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_MAX_AGE)
879#define G_BCM1480_MC_MAX_AGE(x) _SB_GETVALUE(x, S_BCM1480_MC_MAX_AGE, M_BCM1480_MC_MAX_AGE)
880
881#define M_BCM1480_MC_BERR_DISABLE _SB_MAKEMASK1(29)
882#define M_BCM1480_MC_FORCE_SEQ _SB_MAKEMASK1(30)
883#define M_BCM1480_MC_VGEN _SB_MAKEMASK1(32)
884
885#define S_BCM1480_MC_SLEW 33
886#define M_BCM1480_MC_SLEW _SB_MAKEMASK(2, S_BCM1480_MC_SLEW)
887#define V_BCM1480_MC_SLEW(x) _SB_MAKEVALUE(x, S_BCM1480_MC_SLEW)
888#define G_BCM1480_MC_SLEW(x) _SB_GETVALUE(x, S_BCM1480_MC_SLEW, M_BCM1480_MC_SLEW)
889
890#define M_BCM1480_MC_SSTL_VOLTAGE _SB_MAKEMASK1(35)
891
892/*
893 * Global Channel Interleave Register (Table 100)
894 */
895
896#define S_BCM1480_MC_INTLV0 0
897#define M_BCM1480_MC_INTLV0 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV0)
898#define V_BCM1480_MC_INTLV0(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV0)
899#define G_BCM1480_MC_INTLV0(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV0, M_BCM1480_MC_INTLV0)
900
901#define S_BCM1480_MC_INTLV1 8
902#define M_BCM1480_MC_INTLV1 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV1)
903#define V_BCM1480_MC_INTLV1(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV1)
904#define G_BCM1480_MC_INTLV1(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV1, M_BCM1480_MC_INTLV1)
905
906#define S_BCM1480_MC_INTLV_MODE 16
907#define M_BCM1480_MC_INTLV_MODE _SB_MAKEMASK(3, S_BCM1480_MC_INTLV_MODE)
908#define V_BCM1480_MC_INTLV_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV_MODE)
909#define G_BCM1480_MC_INTLV_MODE(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV_MODE, M_BCM1480_MC_INTLV_MODE)
910
911#define K_BCM1480_MC_INTLV_MODE_NONE 0x0
912#define K_BCM1480_MC_INTLV_MODE_01 0x1
913#define K_BCM1480_MC_INTLV_MODE_23 0x2
914#define K_BCM1480_MC_INTLV_MODE_01_23 0x3
915#define K_BCM1480_MC_INTLV_MODE_0123 0x4
916
917#define V_BCM1480_MC_INTLV_MODE_NONE V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_NONE)
918#define V_BCM1480_MC_INTLV_MODE_01 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_01)
919#define V_BCM1480_MC_INTLV_MODE_23 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_23)
920#define V_BCM1480_MC_INTLV_MODE_01_23 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_01_23)
921#define V_BCM1480_MC_INTLV_MODE_0123 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_0123)
922
923/*
924 * ECC Status Register
925 */
926
927#define S_BCM1480_MC_ECC_ERR_ADDR 0
928#define M_BCM1480_MC_ECC_ERR_ADDR _SB_MAKEMASK(37, S_BCM1480_MC_ECC_ERR_ADDR)
929#define V_BCM1480_MC_ECC_ERR_ADDR(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ECC_ERR_ADDR)
930#define G_BCM1480_MC_ECC_ERR_ADDR(x) _SB_GETVALUE(x, S_BCM1480_MC_ECC_ERR_ADDR, M_BCM1480_MC_ECC_ERR_ADDR)
931
932#if SIBYTE_HDR_FEATURE(1480, PASS2)
933#define M_BCM1480_MC_ECC_ERR_RMW _SB_MAKEMASK1(60)
934#endif
935
936#define M_BCM1480_MC_ECC_MULT_ERR_DET _SB_MAKEMASK1(61)
937#define M_BCM1480_MC_ECC_UERR_DET _SB_MAKEMASK1(62)
938#define M_BCM1480_MC_ECC_CERR_DET _SB_MAKEMASK1(63)
939
940/*
941 * Global ECC Address Register (Table 102)
942 */
943
944#define S_BCM1480_MC_ECC_CORR_ADDR 0
945#define M_BCM1480_MC_ECC_CORR_ADDR _SB_MAKEMASK(37, S_BCM1480_MC_ECC_CORR_ADDR)
946#define V_BCM1480_MC_ECC_CORR_ADDR(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ECC_CORR_ADDR)
947#define G_BCM1480_MC_ECC_CORR_ADDR(x) _SB_GETVALUE(x, S_BCM1480_MC_ECC_CORR_ADDR, M_BCM1480_MC_ECC_CORR_ADDR)
948
949/*
950 * Global ECC Correction Register (Table 103)
951 */
952
953#define S_BCM1480_MC_ECC_CORRECT 0
954#define M_BCM1480_MC_ECC_CORRECT _SB_MAKEMASK(64, S_BCM1480_MC_ECC_CORRECT)
955#define V_BCM1480_MC_ECC_CORRECT(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ECC_CORRECT)
956#define G_BCM1480_MC_ECC_CORRECT(x) _SB_GETVALUE(x, S_BCM1480_MC_ECC_CORRECT, M_BCM1480_MC_ECC_CORRECT)
957
958/*
959 * Global ECC Performance Counters Control Register (Table 104)
960 */
961
962#define S_BCM1480_MC_CHANNEL_SELECT 0
963#define M_BCM1480_MC_CHANNEL_SELECT _SB_MAKEMASK(4, S_BCM1480_MC_CHANNEL_SELECT)
964#define V_BCM1480_MC_CHANNEL_SELECT(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CHANNEL_SELECT)
965#define G_BCM1480_MC_CHANNEL_SELECT(x) _SB_GETVALUE(x, S_BCM1480_MC_CHANNEL_SELECT, M_BCM1480_MC_CHANNEL_SELECT)
966#define K_BCM1480_MC_CHANNEL_SELECT_0 0x1
967#define K_BCM1480_MC_CHANNEL_SELECT_1 0x2
968#define K_BCM1480_MC_CHANNEL_SELECT_2 0x4
969#define K_BCM1480_MC_CHANNEL_SELECT_3 0x8
970
971#endif /* _BCM1480_MC_H */
diff --git a/arch/mips/include/asm/sibyte/bcm1480_regs.h b/arch/mips/include/asm/sibyte/bcm1480_regs.h
new file mode 100644
index 000000000..ef12ede26
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/bcm1480_regs.h
@@ -0,0 +1,889 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * BCM1255/BCM1280/BCM1455/BCM1480 Board Support Package
4 *
5 * Register Definitions File: bcm1480_regs.h
6 *
7 * This module contains the addresses of the on-chip peripherals
8 * on the BCM1280 and BCM1480.
9 *
10 * BCM1480 specification level: 1X55_1X80-UM100-D4 (11/24/03)
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19#ifndef _BCM1480_REGS_H
20#define _BCM1480_REGS_H
21
22#include <asm/sibyte/sb1250_defs.h>
23
24/* *********************************************************************
25 * Pull in the BCM1250's registers since a great deal of the 1480's
26 * functions are the same as the BCM1250.
27 ********************************************************************* */
28
29#include <asm/sibyte/sb1250_regs.h>
30
31
32/* *********************************************************************
33 * Some general notes:
34 *
35 * Register addresses are grouped by function and follow the order
36 * of the User Manual.
37 *
38 * For the most part, when there is more than one peripheral
39 * of the same type on the SOC, the constants below will be
40 * offsets from the base of each peripheral. For example,
41 * the MAC registers are described as offsets from the first
42 * MAC register, and there will be a MAC_REGISTER() macro
43 * to calculate the base address of a given MAC.
44 *
45 * The information in this file is based on the BCM1X55/BCM1X80
46 * User Manual, Document 1X55_1X80-UM100-R, 22/12/03.
47 *
48 * This file is basically a "what's new" header file. Since the
49 * BCM1250 and the new BCM1480 (and derivatives) share many common
50 * features, this file contains only what's new or changed from
51 * the 1250. (above, you can see that we include the 1250 symbols
52 * to get the base functionality).
53 *
54 * In software, be sure to use the correct symbols, particularly
55 * for blocks that are different between the two chip families.
56 * All BCM1480-specific symbols have _BCM1480_ in their names,
57 * and all BCM1250-specific and "base" functions that are common in
58 * both chips have no special names (this is for compatibility with
59 * older include files). Therefore, if you're working with the
60 * SCD, which is very different on each chip, A_SCD_xxx implies
61 * the BCM1250 version and A_BCM1480_SCD_xxx implies the BCM1480
62 * version.
63 ********************************************************************* */
64
65
66/* *********************************************************************
67 * Memory Controller Registers (Section 6)
68 ********************************************************************* */
69
70#define A_BCM1480_MC_BASE_0 0x0010050000
71#define A_BCM1480_MC_BASE_1 0x0010051000
72#define A_BCM1480_MC_BASE_2 0x0010052000
73#define A_BCM1480_MC_BASE_3 0x0010053000
74#define BCM1480_MC_REGISTER_SPACING 0x1000
75
76#define A_BCM1480_MC_BASE(ctlid) (A_BCM1480_MC_BASE_0+(ctlid)*BCM1480_MC_REGISTER_SPACING)
77#define A_BCM1480_MC_REGISTER(ctlid, reg) (A_BCM1480_MC_BASE(ctlid)+(reg))
78
79#define R_BCM1480_MC_CONFIG 0x0000000100
80#define R_BCM1480_MC_CS_START 0x0000000120
81#define R_BCM1480_MC_CS_END 0x0000000140
82#define S_BCM1480_MC_CS_STARTEND 24
83
84#define R_BCM1480_MC_CS01_ROW0 0x0000000180
85#define R_BCM1480_MC_CS01_ROW1 0x00000001A0
86#define R_BCM1480_MC_CS23_ROW0 0x0000000200
87#define R_BCM1480_MC_CS23_ROW1 0x0000000220
88#define R_BCM1480_MC_CS01_COL0 0x0000000280
89#define R_BCM1480_MC_CS01_COL1 0x00000002A0
90#define R_BCM1480_MC_CS23_COL0 0x0000000300
91#define R_BCM1480_MC_CS23_COL1 0x0000000320
92
93#define R_BCM1480_MC_CSX_BASE 0x0000000180
94#define R_BCM1480_MC_CSX_ROW0 0x0000000000 /* relative to CSX_BASE */
95#define R_BCM1480_MC_CSX_ROW1 0x0000000020 /* relative to CSX_BASE */
96#define R_BCM1480_MC_CSX_COL0 0x0000000100 /* relative to CSX_BASE */
97#define R_BCM1480_MC_CSX_COL1 0x0000000120 /* relative to CSX_BASE */
98#define BCM1480_MC_CSX_SPACING 0x0000000080 /* CS23 relative to CS01 */
99
100#define R_BCM1480_MC_CS01_BA 0x0000000380
101#define R_BCM1480_MC_CS23_BA 0x00000003A0
102#define R_BCM1480_MC_DRAMCMD 0x0000000400
103#define R_BCM1480_MC_DRAMMODE 0x0000000420
104#define R_BCM1480_MC_CLOCK_CFG 0x0000000440
105#define R_BCM1480_MC_MCLK_CFG R_BCM1480_MC_CLOCK_CFG
106#define R_BCM1480_MC_TEST_DATA 0x0000000480
107#define R_BCM1480_MC_TEST_ECC 0x00000004A0
108#define R_BCM1480_MC_TIMING1 0x00000004C0
109#define R_BCM1480_MC_TIMING2 0x00000004E0
110#define R_BCM1480_MC_DLL_CFG 0x0000000500
111#define R_BCM1480_MC_DRIVE_CFG 0x0000000520
112
113#if SIBYTE_HDR_FEATURE(1480, PASS2)
114#define R_BCM1480_MC_ODT 0x0000000460
115#define R_BCM1480_MC_ECC_STATUS 0x0000000540
116#endif
117
118/* Global registers (single instance) */
119#define A_BCM1480_MC_GLB_CONFIG 0x0010054100
120#define A_BCM1480_MC_GLB_INTLV 0x0010054120
121#define A_BCM1480_MC_GLB_ECC_STATUS 0x0010054140
122#define A_BCM1480_MC_GLB_ECC_ADDR 0x0010054160
123#define A_BCM1480_MC_GLB_ECC_CORRECT 0x0010054180
124#define A_BCM1480_MC_GLB_PERF_CNT_CONTROL 0x00100541A0
125
126/* *********************************************************************
127 * L2 Cache Control Registers (Section 5)
128 ********************************************************************* */
129
130#define A_BCM1480_L2_BASE 0x0010040000
131
132#define A_BCM1480_L2_READ_TAG 0x0010040018
133#define A_BCM1480_L2_ECC_TAG 0x0010040038
134#define A_BCM1480_L2_MISC0_VALUE 0x0010040058
135#define A_BCM1480_L2_MISC1_VALUE 0x0010040078
136#define A_BCM1480_L2_MISC2_VALUE 0x0010040098
137#define A_BCM1480_L2_MISC_CONFIG 0x0010040040 /* x040 */
138#define A_BCM1480_L2_CACHE_DISABLE 0x0010040060 /* x060 */
139#define A_BCM1480_L2_MAKECACHEDISABLE(x) (A_BCM1480_L2_CACHE_DISABLE | (((x)&0xF) << 12))
140#define A_BCM1480_L2_WAY_ENABLE_3_0 0x0010040080 /* x080 */
141#define A_BCM1480_L2_WAY_ENABLE_7_4 0x00100400A0 /* x0A0 */
142#define A_BCM1480_L2_MAKE_WAY_ENABLE_LO(x) (A_BCM1480_L2_WAY_ENABLE_3_0 | (((x)&0xF) << 12))
143#define A_BCM1480_L2_MAKE_WAY_ENABLE_HI(x) (A_BCM1480_L2_WAY_ENABLE_7_4 | (((x)&0xF) << 12))
144#define A_BCM1480_L2_MAKE_WAY_DISABLE_LO(x) (A_BCM1480_L2_WAY_ENABLE_3_0 | (((~x)&0xF) << 12))
145#define A_BCM1480_L2_MAKE_WAY_DISABLE_HI(x) (A_BCM1480_L2_WAY_ENABLE_7_4 | (((~x)&0xF) << 12))
146#define A_BCM1480_L2_WAY_LOCAL_3_0 0x0010040100 /* x100 */
147#define A_BCM1480_L2_WAY_LOCAL_7_4 0x0010040120 /* x120 */
148#define A_BCM1480_L2_WAY_REMOTE_3_0 0x0010040140 /* x140 */
149#define A_BCM1480_L2_WAY_REMOTE_7_4 0x0010040160 /* x160 */
150#define A_BCM1480_L2_WAY_AGENT_3_0 0x00100400C0 /* xxC0 */
151#define A_BCM1480_L2_WAY_AGENT_7_4 0x00100400E0 /* xxE0 */
152#define A_BCM1480_L2_WAY_ENABLE(A, banks) (A | (((~(banks))&0x0F) << 8))
153#define A_BCM1480_L2_BANK_BASE 0x00D0300000
154#define A_BCM1480_L2_BANK_ADDRESS(b) (A_BCM1480_L2_BANK_BASE | (((b)&0x7)<<17))
155#define A_BCM1480_L2_MGMT_TAG_BASE 0x00D0000000
156
157
158/* *********************************************************************
159 * PCI-X Interface Registers (Section 7)
160 ********************************************************************* */
161
162#define A_BCM1480_PCI_BASE 0x0010061400
163
164#define A_BCM1480_PCI_RESET 0x0010061400
165#define A_BCM1480_PCI_DLL 0x0010061500
166
167#define A_BCM1480_PCI_TYPE00_HEADER 0x002E000000
168
169/* *********************************************************************
170 * Ethernet MAC Registers (Section 11) and DMA Registers (Section 10.6)
171 ********************************************************************* */
172
173/* No register changes with Rev.C BCM1250, but one additional MAC */
174
175#define A_BCM1480_MAC_BASE_2 0x0010066000
176
177#ifndef A_MAC_BASE_2
178#define A_MAC_BASE_2 A_BCM1480_MAC_BASE_2
179#endif
180
181#define A_BCM1480_MAC_BASE_3 0x0010067000
182#define A_MAC_BASE_3 A_BCM1480_MAC_BASE_3
183
184#define R_BCM1480_MAC_DMA_OODPKTLOST 0x00000038
185
186#ifndef R_MAC_DMA_OODPKTLOST
187#define R_MAC_DMA_OODPKTLOST R_BCM1480_MAC_DMA_OODPKTLOST
188#endif
189
190
191/* *********************************************************************
192 * DUART Registers (Section 14)
193 ********************************************************************* */
194
195/* No significant differences from BCM1250, two DUARTs */
196
197/* Conventions, per user manual:
198 * DUART generic, channels A,B,C,D
199 * DUART0 implementing channels A,B
200 * DUART1 inplementing channels C,D
201 */
202
203#define BCM1480_DUART_NUM_PORTS 4
204
205#define A_BCM1480_DUART0 0x0010060000
206#define A_BCM1480_DUART1 0x0010060400
207#define A_BCM1480_DUART(chan) ((((chan)&2) == 0)? A_BCM1480_DUART0 : A_BCM1480_DUART1)
208
209#define BCM1480_DUART_CHANREG_SPACING 0x100
210#define A_BCM1480_DUART_CHANREG(chan, reg) \
211 (A_BCM1480_DUART(chan) + \
212 BCM1480_DUART_CHANREG_SPACING * (((chan) & 1) + 1) + (reg))
213#define A_BCM1480_DUART_CTRLREG(chan, reg) \
214 (A_BCM1480_DUART(chan) + \
215 BCM1480_DUART_CHANREG_SPACING * 3 + (reg))
216
217#define DUART_IMRISR_SPACING 0x20
218#define DUART_INCHNG_SPACING 0x10
219
220#define R_BCM1480_DUART_IMRREG(chan) \
221 (R_DUART_IMR_A + ((chan) & 1) * DUART_IMRISR_SPACING)
222#define R_BCM1480_DUART_ISRREG(chan) \
223 (R_DUART_ISR_A + ((chan) & 1) * DUART_IMRISR_SPACING)
224#define R_BCM1480_DUART_INCHREG(chan) \
225 (R_DUART_IN_CHNG_A + ((chan) & 1) * DUART_INCHNG_SPACING)
226
227#define A_BCM1480_DUART_IMRREG(chan) \
228 (A_BCM1480_DUART_CTRLREG((chan), R_BCM1480_DUART_IMRREG(chan)))
229#define A_BCM1480_DUART_ISRREG(chan) \
230 (A_BCM1480_DUART_CTRLREG((chan), R_BCM1480_DUART_ISRREG(chan)))
231
232#define A_BCM1480_DUART_IN_PORT(chan) \
233 (A_BCM1480_DUART_CTRLREG((chan), R_DUART_IN_PORT))
234
235/*
236 * These constants are the absolute addresses.
237 */
238
239#define A_BCM1480_DUART_MODE_REG_1_C 0x0010060400
240#define A_BCM1480_DUART_MODE_REG_2_C 0x0010060410
241#define A_BCM1480_DUART_STATUS_C 0x0010060420
242#define A_BCM1480_DUART_CLK_SEL_C 0x0010060430
243#define A_BCM1480_DUART_FULL_CTL_C 0x0010060440
244#define A_BCM1480_DUART_CMD_C 0x0010060450
245#define A_BCM1480_DUART_RX_HOLD_C 0x0010060460
246#define A_BCM1480_DUART_TX_HOLD_C 0x0010060470
247#define A_BCM1480_DUART_OPCR_C 0x0010060480
248#define A_BCM1480_DUART_AUX_CTRL_C 0x0010060490
249
250#define A_BCM1480_DUART_MODE_REG_1_D 0x0010060500
251#define A_BCM1480_DUART_MODE_REG_2_D 0x0010060510
252#define A_BCM1480_DUART_STATUS_D 0x0010060520
253#define A_BCM1480_DUART_CLK_SEL_D 0x0010060530
254#define A_BCM1480_DUART_FULL_CTL_D 0x0010060540
255#define A_BCM1480_DUART_CMD_D 0x0010060550
256#define A_BCM1480_DUART_RX_HOLD_D 0x0010060560
257#define A_BCM1480_DUART_TX_HOLD_D 0x0010060570
258#define A_BCM1480_DUART_OPCR_D 0x0010060580
259#define A_BCM1480_DUART_AUX_CTRL_D 0x0010060590
260
261#define A_BCM1480_DUART_INPORT_CHNG_CD 0x0010060600
262#define A_BCM1480_DUART_AUX_CTRL_CD 0x0010060610
263#define A_BCM1480_DUART_ISR_C 0x0010060620
264#define A_BCM1480_DUART_IMR_C 0x0010060630
265#define A_BCM1480_DUART_ISR_D 0x0010060640
266#define A_BCM1480_DUART_IMR_D 0x0010060650
267#define A_BCM1480_DUART_OUT_PORT_CD 0x0010060660
268#define A_BCM1480_DUART_OPCR_CD 0x0010060670
269#define A_BCM1480_DUART_IN_PORT_CD 0x0010060680
270#define A_BCM1480_DUART_ISR_CD 0x0010060690
271#define A_BCM1480_DUART_IMR_CD 0x00100606A0
272#define A_BCM1480_DUART_SET_OPR_CD 0x00100606B0
273#define A_BCM1480_DUART_CLEAR_OPR_CD 0x00100606C0
274#define A_BCM1480_DUART_INPORT_CHNG_C 0x00100606D0
275#define A_BCM1480_DUART_INPORT_CHNG_D 0x00100606E0
276
277
278/* *********************************************************************
279 * Generic Bus Registers (Section 15) and PCMCIA Registers (Section 16)
280 ********************************************************************* */
281
282#define A_BCM1480_IO_PCMCIA_CFG_B 0x0010061A58
283#define A_BCM1480_IO_PCMCIA_STATUS_B 0x0010061A68
284
285/* *********************************************************************
286 * GPIO Registers (Section 17)
287 ********************************************************************* */
288
289/* One additional GPIO register, placed _before_ the BCM1250's GPIO block base */
290
291#define A_BCM1480_GPIO_INT_ADD_TYPE 0x0010061A78
292#define R_BCM1480_GPIO_INT_ADD_TYPE (-8)
293
294#define A_GPIO_INT_ADD_TYPE A_BCM1480_GPIO_INT_ADD_TYPE
295#define R_GPIO_INT_ADD_TYPE R_BCM1480_GPIO_INT_ADD_TYPE
296
297/* *********************************************************************
298 * SMBus Registers (Section 18)
299 ********************************************************************* */
300
301/* No changes from BCM1250 */
302
303/* *********************************************************************
304 * Timer Registers (Sections 4.6)
305 ********************************************************************* */
306
307/* BCM1480 has two additional watchdogs */
308
309/* Watchdog timers */
310
311#define A_BCM1480_SCD_WDOG_2 0x0010022050
312#define A_BCM1480_SCD_WDOG_3 0x0010022150
313
314#define BCM1480_SCD_NUM_WDOGS 4
315
316#define A_BCM1480_SCD_WDOG_BASE(w) (A_BCM1480_SCD_WDOG_0+((w)&2)*0x1000 + ((w)&1)*0x100)
317#define A_BCM1480_SCD_WDOG_REGISTER(w, r) (A_BCM1480_SCD_WDOG_BASE(w) + (r))
318
319#define A_BCM1480_SCD_WDOG_INIT_2 0x0010022050
320#define A_BCM1480_SCD_WDOG_CNT_2 0x0010022058
321#define A_BCM1480_SCD_WDOG_CFG_2 0x0010022060
322
323#define A_BCM1480_SCD_WDOG_INIT_3 0x0010022150
324#define A_BCM1480_SCD_WDOG_CNT_3 0x0010022158
325#define A_BCM1480_SCD_WDOG_CFG_3 0x0010022160
326
327/* BCM1480 has two additional compare registers */
328
329#define A_BCM1480_SCD_ZBBUS_CYCLE_COUNT A_SCD_ZBBUS_CYCLE_COUNT
330#define A_BCM1480_SCD_ZBBUS_CYCLE_CP_BASE 0x0010020C00
331#define A_BCM1480_SCD_ZBBUS_CYCLE_CP0 A_SCD_ZBBUS_CYCLE_CP0
332#define A_BCM1480_SCD_ZBBUS_CYCLE_CP1 A_SCD_ZBBUS_CYCLE_CP1
333#define A_BCM1480_SCD_ZBBUS_CYCLE_CP2 0x0010020C10
334#define A_BCM1480_SCD_ZBBUS_CYCLE_CP3 0x0010020C18
335
336/* *********************************************************************
337 * System Control Registers (Section 4.2)
338 ********************************************************************* */
339
340/* Scratch register in different place */
341
342#define A_BCM1480_SCD_SCRATCH 0x100200A0
343
344/* *********************************************************************
345 * System Address Trap Registers (Section 4.9)
346 ********************************************************************* */
347
348/* No changes from BCM1250 */
349
350/* *********************************************************************
351 * System Interrupt Mapper Registers (Sections 4.3-4.5)
352 ********************************************************************* */
353
354#define A_BCM1480_IMR_CPU0_BASE 0x0010020000
355#define A_BCM1480_IMR_CPU1_BASE 0x0010022000
356#define A_BCM1480_IMR_CPU2_BASE 0x0010024000
357#define A_BCM1480_IMR_CPU3_BASE 0x0010026000
358#define BCM1480_IMR_REGISTER_SPACING 0x2000
359#define BCM1480_IMR_REGISTER_SPACING_SHIFT 13
360
361#define A_BCM1480_IMR_MAPPER(cpu) (A_BCM1480_IMR_CPU0_BASE+(cpu)*BCM1480_IMR_REGISTER_SPACING)
362#define A_BCM1480_IMR_REGISTER(cpu, reg) (A_BCM1480_IMR_MAPPER(cpu)+(reg))
363
364/* Most IMR registers are 128 bits, implemented as non-contiguous
365 64-bit registers high (_H) and low (_L) */
366#define BCM1480_IMR_HL_SPACING 0x1000
367
368#define R_BCM1480_IMR_INTERRUPT_DIAG_H 0x0010
369#define R_BCM1480_IMR_LDT_INTERRUPT_H 0x0018
370#define R_BCM1480_IMR_LDT_INTERRUPT_CLR_H 0x0020
371#define R_BCM1480_IMR_INTERRUPT_MASK_H 0x0028
372#define R_BCM1480_IMR_INTERRUPT_TRACE_H 0x0038
373#define R_BCM1480_IMR_INTERRUPT_SOURCE_STATUS_H 0x0040
374#define R_BCM1480_IMR_LDT_INTERRUPT_SET 0x0048
375#define R_BCM1480_IMR_MAILBOX_0_CPU 0x00C0
376#define R_BCM1480_IMR_MAILBOX_0_SET_CPU 0x00C8
377#define R_BCM1480_IMR_MAILBOX_0_CLR_CPU 0x00D0
378#define R_BCM1480_IMR_MAILBOX_1_CPU 0x00E0
379#define R_BCM1480_IMR_MAILBOX_1_SET_CPU 0x00E8
380#define R_BCM1480_IMR_MAILBOX_1_CLR_CPU 0x00F0
381#define R_BCM1480_IMR_INTERRUPT_STATUS_BASE_H 0x0100
382#define BCM1480_IMR_INTERRUPT_STATUS_COUNT 8
383#define R_BCM1480_IMR_INTERRUPT_MAP_BASE_H 0x0200
384#define BCM1480_IMR_INTERRUPT_MAP_COUNT 64
385
386#define R_BCM1480_IMR_INTERRUPT_DIAG_L 0x1010
387#define R_BCM1480_IMR_LDT_INTERRUPT_L 0x1018
388#define R_BCM1480_IMR_LDT_INTERRUPT_CLR_L 0x1020
389#define R_BCM1480_IMR_INTERRUPT_MASK_L 0x1028
390#define R_BCM1480_IMR_INTERRUPT_TRACE_L 0x1038
391#define R_BCM1480_IMR_INTERRUPT_SOURCE_STATUS_L 0x1040
392#define R_BCM1480_IMR_INTERRUPT_STATUS_BASE_L 0x1100
393#define R_BCM1480_IMR_INTERRUPT_MAP_BASE_L 0x1200
394
395#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU0_BASE 0x0010028000
396#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU1_BASE 0x0010028100
397#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU2_BASE 0x0010028200
398#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU3_BASE 0x0010028300
399#define BCM1480_IMR_ALIAS_MAILBOX_SPACING 0100
400
401#define A_BCM1480_IMR_ALIAS_MAILBOX(cpu) (A_BCM1480_IMR_ALIAS_MAILBOX_CPU0_BASE + \
402 (cpu)*BCM1480_IMR_ALIAS_MAILBOX_SPACING)
403#define A_BCM1480_IMR_ALIAS_MAILBOX_REGISTER(cpu, reg) (A_BCM1480_IMR_ALIAS_MAILBOX(cpu)+(reg))
404
405#define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000
406#define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008
407
408/*
409 * these macros work together to build the address of a mailbox
410 * register, e.g., A_BCM1480_MAILBOX_REGISTER(0,R_BCM1480_IMR_MAILBOX_SET,2)
411 * for mbox_0_set_cpu2 returns 0x00100240C8
412 */
413#define R_BCM1480_IMR_MAILBOX_CPU 0x00
414#define R_BCM1480_IMR_MAILBOX_SET 0x08
415#define R_BCM1480_IMR_MAILBOX_CLR 0x10
416#define R_BCM1480_IMR_MAILBOX_NUM_SPACING 0x20
417#define A_BCM1480_MAILBOX_REGISTER(num, reg, cpu) \
418 (A_BCM1480_IMR_CPU0_BASE + \
419 (num * R_BCM1480_IMR_MAILBOX_NUM_SPACING) + \
420 (cpu * BCM1480_IMR_REGISTER_SPACING) + \
421 (R_BCM1480_IMR_MAILBOX_0_CPU + reg))
422
423/* *********************************************************************
424 * System Performance Counter Registers (Section 4.7)
425 ********************************************************************* */
426
427/* BCM1480 has four more performance counter registers, and two control
428 registers. */
429
430#define A_BCM1480_SCD_PERF_CNT_BASE 0x00100204C0
431
432#define A_BCM1480_SCD_PERF_CNT_CFG0 0x00100204C0
433#define A_BCM1480_SCD_PERF_CNT_CFG_0 A_BCM1480_SCD_PERF_CNT_CFG0
434#define A_BCM1480_SCD_PERF_CNT_CFG1 0x00100204C8
435#define A_BCM1480_SCD_PERF_CNT_CFG_1 A_BCM1480_SCD_PERF_CNT_CFG1
436
437#define A_BCM1480_SCD_PERF_CNT_0 A_SCD_PERF_CNT_0
438#define A_BCM1480_SCD_PERF_CNT_1 A_SCD_PERF_CNT_1
439#define A_BCM1480_SCD_PERF_CNT_2 A_SCD_PERF_CNT_2
440#define A_BCM1480_SCD_PERF_CNT_3 A_SCD_PERF_CNT_3
441
442#define A_BCM1480_SCD_PERF_CNT_4 0x00100204F0
443#define A_BCM1480_SCD_PERF_CNT_5 0x00100204F8
444#define A_BCM1480_SCD_PERF_CNT_6 0x0010020500
445#define A_BCM1480_SCD_PERF_CNT_7 0x0010020508
446
447#define BCM1480_SCD_NUM_PERF_CNT 8
448#define BCM1480_SCD_PERF_CNT_SPACING 8
449#define A_BCM1480_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*BCM1480_SCD_PERF_CNT_SPACING))
450
451/* *********************************************************************
452 * System Bus Watcher Registers (Section 4.8)
453 ********************************************************************* */
454
455
456/* Same as 1250 except BUS_ERR_STATUS_DEBUG is in a different place. */
457
458#define A_BCM1480_BUS_ERR_STATUS_DEBUG 0x00100208D8
459
460/* *********************************************************************
461 * System Debug Controller Registers (Section 19)
462 ********************************************************************* */
463
464/* Same as 1250 */
465
466/* *********************************************************************
467 * System Trace Unit Registers (Sections 4.10)
468 ********************************************************************* */
469
470/* Same as 1250 */
471
472/* *********************************************************************
473 * Data Mover DMA Registers (Section 10.7)
474 ********************************************************************* */
475
476/* Same as 1250 */
477
478
479/* *********************************************************************
480 * HyperTransport Interface Registers (Section 8)
481 ********************************************************************* */
482
483#define BCM1480_HT_NUM_PORTS 3
484#define BCM1480_HT_PORT_SPACING 0x800
485#define A_BCM1480_HT_PORT_HEADER(x) (A_BCM1480_HT_PORT0_HEADER + ((x)*BCM1480_HT_PORT_SPACING))
486
487#define A_BCM1480_HT_PORT0_HEADER 0x00FE000000
488#define A_BCM1480_HT_PORT1_HEADER 0x00FE000800
489#define A_BCM1480_HT_PORT2_HEADER 0x00FE001000
490#define A_BCM1480_HT_TYPE00_HEADER 0x00FE002000
491
492
493/* *********************************************************************
494 * Node Controller Registers (Section 9)
495 ********************************************************************* */
496
497#define A_BCM1480_NC_BASE 0x00DFBD0000
498
499#define A_BCM1480_NC_RLD_FIELD 0x00DFBD0000
500#define A_BCM1480_NC_RLD_TRIGGER 0x00DFBD0020
501#define A_BCM1480_NC_RLD_BAD_ERROR 0x00DFBD0040
502#define A_BCM1480_NC_RLD_COR_ERROR 0x00DFBD0060
503#define A_BCM1480_NC_RLD_ECC_STATUS 0x00DFBD0080
504#define A_BCM1480_NC_RLD_WAY_ENABLE 0x00DFBD00A0
505#define A_BCM1480_NC_RLD_RANDOM_LFSR 0x00DFBD00C0
506
507#define A_BCM1480_NC_INTERRUPT_STATUS 0x00DFBD00E0
508#define A_BCM1480_NC_INTERRUPT_ENABLE 0x00DFBD0100
509#define A_BCM1480_NC_TIMEOUT_COUNTER 0x00DFBD0120
510#define A_BCM1480_NC_TIMEOUT_COUNTER_SEL 0x00DFBD0140
511
512#define A_BCM1480_NC_CREDIT_STATUS_REG0 0x00DFBD0200
513#define A_BCM1480_NC_CREDIT_STATUS_REG1 0x00DFBD0220
514#define A_BCM1480_NC_CREDIT_STATUS_REG2 0x00DFBD0240
515#define A_BCM1480_NC_CREDIT_STATUS_REG3 0x00DFBD0260
516#define A_BCM1480_NC_CREDIT_STATUS_REG4 0x00DFBD0280
517#define A_BCM1480_NC_CREDIT_STATUS_REG5 0x00DFBD02A0
518#define A_BCM1480_NC_CREDIT_STATUS_REG6 0x00DFBD02C0
519#define A_BCM1480_NC_CREDIT_STATUS_REG7 0x00DFBD02E0
520#define A_BCM1480_NC_CREDIT_STATUS_REG8 0x00DFBD0300
521#define A_BCM1480_NC_CREDIT_STATUS_REG9 0x00DFBD0320
522#define A_BCM1480_NC_CREDIT_STATUS_REG10 0x00DFBE0000
523#define A_BCM1480_NC_CREDIT_STATUS_REG11 0x00DFBE0020
524#define A_BCM1480_NC_CREDIT_STATUS_REG12 0x00DFBE0040
525
526#define A_BCM1480_NC_SR_TIMEOUT_COUNTER 0x00DFBE0060
527#define A_BCM1480_NC_SR_TIMEOUT_COUNTER_SEL 0x00DFBE0080
528
529
530/* *********************************************************************
531 * H&R Block Configuration Registers (Section 12.4)
532 ********************************************************************* */
533
534#define A_BCM1480_HR_BASE_0 0x00DF820000
535#define A_BCM1480_HR_BASE_1 0x00DF8A0000
536#define A_BCM1480_HR_BASE_2 0x00DF920000
537#define BCM1480_HR_REGISTER_SPACING 0x80000
538
539#define A_BCM1480_HR_BASE(idx) (A_BCM1480_HR_BASE_0 + ((idx)*BCM1480_HR_REGISTER_SPACING))
540#define A_BCM1480_HR_REGISTER(idx, reg) (A_BCM1480_HR_BASE(idx) + (reg))
541
542#define R_BCM1480_HR_CFG 0x0000000000
543
544#define R_BCM1480_HR_MAPPING 0x0000010010
545
546#define BCM1480_HR_RULE_SPACING 0x0000000010
547#define BCM1480_HR_NUM_RULES 16
548#define BCM1480_HR_OP_OFFSET 0x0000000100
549#define BCM1480_HR_TYPE_OFFSET 0x0000000108
550#define R_BCM1480_HR_RULE_OP(idx) (BCM1480_HR_OP_OFFSET + ((idx)*BCM1480_HR_RULE_SPACING))
551#define R_BCM1480_HR_RULE_TYPE(idx) (BCM1480_HR_TYPE_OFFSET + ((idx)*BCM1480_HR_RULE_SPACING))
552
553#define BCM1480_HR_LEAF_SPACING 0x0000000010
554#define BCM1480_HR_NUM_LEAVES 10
555#define BCM1480_HR_LEAF_OFFSET 0x0000000300
556#define R_BCM1480_HR_HA_LEAF0(idx) (BCM1480_HR_LEAF_OFFSET + ((idx)*BCM1480_HR_LEAF_SPACING))
557
558#define R_BCM1480_HR_EX_LEAF0 0x00000003A0
559
560#define BCM1480_HR_PATH_SPACING 0x0000000010
561#define BCM1480_HR_NUM_PATHS 16
562#define BCM1480_HR_PATH_OFFSET 0x0000000600
563#define R_BCM1480_HR_PATH(idx) (BCM1480_HR_PATH_OFFSET + ((idx)*BCM1480_HR_PATH_SPACING))
564
565#define R_BCM1480_HR_PATH_DEFAULT 0x0000000700
566
567#define BCM1480_HR_ROUTE_SPACING 8
568#define BCM1480_HR_NUM_ROUTES 512
569#define BCM1480_HR_ROUTE_OFFSET 0x0000001000
570#define R_BCM1480_HR_RT_WORD(idx) (BCM1480_HR_ROUTE_OFFSET + ((idx)*BCM1480_HR_ROUTE_SPACING))
571
572
573/* checked to here - ehs */
574/* *********************************************************************
575 * Packet Manager DMA Registers (Section 12.5)
576 ********************************************************************* */
577
578#define A_BCM1480_PM_BASE 0x0010056000
579
580#define A_BCM1480_PMI_LCL_0 0x0010058000
581#define A_BCM1480_PMO_LCL_0 0x001005C000
582#define A_BCM1480_PMI_OFFSET_0 (A_BCM1480_PMI_LCL_0 - A_BCM1480_PM_BASE)
583#define A_BCM1480_PMO_OFFSET_0 (A_BCM1480_PMO_LCL_0 - A_BCM1480_PM_BASE)
584
585#define BCM1480_PM_LCL_REGISTER_SPACING 0x100
586#define BCM1480_PM_NUM_CHANNELS 32
587
588#define A_BCM1480_PMI_LCL_BASE(idx) (A_BCM1480_PMI_LCL_0 + ((idx)*BCM1480_PM_LCL_REGISTER_SPACING))
589#define A_BCM1480_PMI_LCL_REGISTER(idx, reg) (A_BCM1480_PMI_LCL_BASE(idx) + (reg))
590#define A_BCM1480_PMO_LCL_BASE(idx) (A_BCM1480_PMO_LCL_0 + ((idx)*BCM1480_PM_LCL_REGISTER_SPACING))
591#define A_BCM1480_PMO_LCL_REGISTER(idx, reg) (A_BCM1480_PMO_LCL_BASE(idx) + (reg))
592
593#define BCM1480_PM_INT_PACKING 8
594#define BCM1480_PM_INT_FUNCTION_SPACING 0x40
595#define BCM1480_PM_INT_NUM_FUNCTIONS 3
596
597/*
598 * DMA channel registers relative to A_BCM1480_PMI_LCL_BASE(n) and A_BCM1480_PMO_LCL_BASE(n)
599 */
600
601#define R_BCM1480_PM_BASE_SIZE 0x0000000000
602#define R_BCM1480_PM_CNT 0x0000000008
603#define R_BCM1480_PM_PFCNT 0x0000000010
604#define R_BCM1480_PM_LAST 0x0000000018
605#define R_BCM1480_PM_PFINDX 0x0000000020
606#define R_BCM1480_PM_INT_WMK 0x0000000028
607#define R_BCM1480_PM_CONFIG0 0x0000000030
608#define R_BCM1480_PM_LOCALDEBUG 0x0000000078
609#define R_BCM1480_PM_CACHEABILITY 0x0000000080 /* PMI only */
610#define R_BCM1480_PM_INT_CNFG 0x0000000088
611#define R_BCM1480_PM_DESC_MERGE_TIMER 0x0000000090
612#define R_BCM1480_PM_LOCALDEBUG_PIB 0x00000000F8 /* PMI only */
613#define R_BCM1480_PM_LOCALDEBUG_POB 0x00000000F8 /* PMO only */
614
615/*
616 * Global Registers (Not Channelized)
617 */
618
619#define A_BCM1480_PMI_GLB_0 0x0010056000
620#define A_BCM1480_PMO_GLB_0 0x0010057000
621
622/*
623 * PM to TX Mapping Register relative to A_BCM1480_PMI_GLB_0 and A_BCM1480_PMO_GLB_0
624 */
625
626#define R_BCM1480_PM_PMO_MAPPING 0x00000008C8 /* PMO only */
627
628#define A_BCM1480_PM_PMO_MAPPING (A_BCM1480_PMO_GLB_0 + R_BCM1480_PM_PMO_MAPPING)
629
630/*
631 * Interrupt mapping registers
632 */
633
634
635#define A_BCM1480_PMI_INT_0 0x0010056800
636#define A_BCM1480_PMI_INT(q) (A_BCM1480_PMI_INT_0 + ((q>>8)<<8))
637#define A_BCM1480_PMI_INT_OFFSET_0 (A_BCM1480_PMI_INT_0 - A_BCM1480_PM_BASE)
638#define A_BCM1480_PMO_INT_0 0x0010057800
639#define A_BCM1480_PMO_INT(q) (A_BCM1480_PMO_INT_0 + ((q>>8)<<8))
640#define A_BCM1480_PMO_INT_OFFSET_0 (A_BCM1480_PMO_INT_0 - A_BCM1480_PM_BASE)
641
642/*
643 * Interrupt registers relative to A_BCM1480_PMI_INT_0 and A_BCM1480_PMO_INT_0
644 */
645
646#define R_BCM1480_PM_INT_ST 0x0000000000
647#define R_BCM1480_PM_INT_MSK 0x0000000040
648#define R_BCM1480_PM_INT_CLR 0x0000000080
649#define R_BCM1480_PM_MRGD_INT 0x00000000C0
650
651/*
652 * Debug registers (global)
653 */
654
655#define A_BCM1480_PM_GLOBALDEBUGMODE_PMI 0x0010056000
656#define A_BCM1480_PM_GLOBALDEBUG_PID 0x00100567F8
657#define A_BCM1480_PM_GLOBALDEBUG_PIB 0x0010056FF8
658#define A_BCM1480_PM_GLOBALDEBUGMODE_PMO 0x0010057000
659#define A_BCM1480_PM_GLOBALDEBUG_POD 0x00100577F8
660#define A_BCM1480_PM_GLOBALDEBUG_POB 0x0010057FF8
661
662/* *********************************************************************
663 * Switch performance counters
664 ********************************************************************* */
665
666#define A_BCM1480_SWPERF_CFG 0xdfb91800
667#define A_BCM1480_SWPERF_CNT0 0xdfb91880
668#define A_BCM1480_SWPERF_CNT1 0xdfb91888
669#define A_BCM1480_SWPERF_CNT2 0xdfb91890
670#define A_BCM1480_SWPERF_CNT3 0xdfb91898
671
672
673/* *********************************************************************
674 * Switch Trace Unit
675 ********************************************************************* */
676
677#define A_BCM1480_SWTRC_MATCH_CONTROL_0 0xDFB91000
678#define A_BCM1480_SWTRC_MATCH_DATA_VALUE_0 0xDFB91100
679#define A_BCM1480_SWTRC_MATCH_DATA_MASK_0 0xDFB91108
680#define A_BCM1480_SWTRC_MATCH_TAG_VALUE_0 0xDFB91200
681#define A_BCM1480_SWTRC_MATCH_TAG_MAKS_0 0xDFB91208
682#define A_BCM1480_SWTRC_EVENT_0 0xDFB91300
683#define A_BCM1480_SWTRC_SEQUENCE_0 0xDFB91400
684
685#define A_BCM1480_SWTRC_CFG 0xDFB91500
686#define A_BCM1480_SWTRC_READ 0xDFB91508
687
688#define A_BCM1480_SWDEBUG_SCHEDSTOP 0xDFB92000
689
690#define A_BCM1480_SWTRC_MATCH_CONTROL(x) (A_BCM1480_SWTRC_MATCH_CONTROL_0 + ((x)*8))
691#define A_BCM1480_SWTRC_EVENT(x) (A_BCM1480_SWTRC_EVENT_0 + ((x)*8))
692#define A_BCM1480_SWTRC_SEQUENCE(x) (A_BCM1480_SWTRC_SEQUENCE_0 + ((x)*8))
693
694#define A_BCM1480_SWTRC_MATCH_DATA_VALUE(x) (A_BCM1480_SWTRC_MATCH_DATA_VALUE_0 + ((x)*16))
695#define A_BCM1480_SWTRC_MATCH_DATA_MASK(x) (A_BCM1480_SWTRC_MATCH_DATA_MASK_0 + ((x)*16))
696#define A_BCM1480_SWTRC_MATCH_TAG_VALUE(x) (A_BCM1480_SWTRC_MATCH_TAG_VALUE_0 + ((x)*16))
697#define A_BCM1480_SWTRC_MATCH_TAG_MASK(x) (A_BCM1480_SWTRC_MATCH_TAG_MASK_0 + ((x)*16))
698
699
700
701/* *********************************************************************
702 * High-Speed Port Registers (Section 13)
703 ********************************************************************* */
704
705#define A_BCM1480_HSP_BASE_0 0x00DF810000
706#define A_BCM1480_HSP_BASE_1 0x00DF890000
707#define A_BCM1480_HSP_BASE_2 0x00DF910000
708#define BCM1480_HSP_REGISTER_SPACING 0x80000
709
710#define A_BCM1480_HSP_BASE(idx) (A_BCM1480_HSP_BASE_0 + ((idx)*BCM1480_HSP_REGISTER_SPACING))
711#define A_BCM1480_HSP_REGISTER(idx, reg) (A_BCM1480_HSP_BASE(idx) + (reg))
712
713#define R_BCM1480_HSP_RX_SPI4_CFG_0 0x0000000000
714#define R_BCM1480_HSP_RX_SPI4_CFG_1 0x0000000008
715#define R_BCM1480_HSP_RX_SPI4_DESKEW_OVERRIDE 0x0000000010
716#define R_BCM1480_HSP_RX_SPI4_DESKEW_DATAPATH 0x0000000018
717#define R_BCM1480_HSP_RX_SPI4_PORT_INT_EN 0x0000000020
718#define R_BCM1480_HSP_RX_SPI4_PORT_INT_STATUS 0x0000000028
719
720#define R_BCM1480_HSP_RX_SPI4_CALENDAR_0 0x0000000200
721#define R_BCM1480_HSP_RX_SPI4_CALENDAR_1 0x0000000208
722
723#define R_BCM1480_HSP_RX_PLL_CNFG 0x0000000800
724#define R_BCM1480_HSP_RX_CALIBRATION 0x0000000808
725#define R_BCM1480_HSP_RX_TEST 0x0000000810
726#define R_BCM1480_HSP_RX_DIAG_DETAILS 0x0000000818
727#define R_BCM1480_HSP_RX_DIAG_CRC_0 0x0000000820
728#define R_BCM1480_HSP_RX_DIAG_CRC_1 0x0000000828
729#define R_BCM1480_HSP_RX_DIAG_HTCMD 0x0000000830
730#define R_BCM1480_HSP_RX_DIAG_PKTCTL 0x0000000838
731
732#define R_BCM1480_HSP_RX_VIS_FLCTRL_COUNTER 0x0000000870
733
734#define R_BCM1480_HSP_RX_PKT_RAMALLOC_0 0x0000020020
735#define R_BCM1480_HSP_RX_PKT_RAMALLOC_1 0x0000020028
736#define R_BCM1480_HSP_RX_PKT_RAMALLOC_2 0x0000020030
737#define R_BCM1480_HSP_RX_PKT_RAMALLOC_3 0x0000020038
738#define R_BCM1480_HSP_RX_PKT_RAMALLOC_4 0x0000020040
739#define R_BCM1480_HSP_RX_PKT_RAMALLOC_5 0x0000020048
740#define R_BCM1480_HSP_RX_PKT_RAMALLOC_6 0x0000020050
741#define R_BCM1480_HSP_RX_PKT_RAMALLOC_7 0x0000020058
742#define R_BCM1480_HSP_RX_PKT_RAMALLOC(idx) (R_BCM1480_HSP_RX_PKT_RAMALLOC_0 + 8*(idx))
743
744/* XXX Following registers were shuffled. Renamed/renumbered per errata. */
745#define R_BCM1480_HSP_RX_HT_RAMALLOC_0 0x0000020078
746#define R_BCM1480_HSP_RX_HT_RAMALLOC_1 0x0000020080
747#define R_BCM1480_HSP_RX_HT_RAMALLOC_2 0x0000020088
748#define R_BCM1480_HSP_RX_HT_RAMALLOC_3 0x0000020090
749#define R_BCM1480_HSP_RX_HT_RAMALLOC_4 0x0000020098
750#define R_BCM1480_HSP_RX_HT_RAMALLOC_5 0x00000200A0
751
752#define R_BCM1480_HSP_RX_SPI_WATERMARK_0 0x00000200B0
753#define R_BCM1480_HSP_RX_SPI_WATERMARK_1 0x00000200B8
754#define R_BCM1480_HSP_RX_SPI_WATERMARK_2 0x00000200C0
755#define R_BCM1480_HSP_RX_SPI_WATERMARK_3 0x00000200C8
756#define R_BCM1480_HSP_RX_SPI_WATERMARK_4 0x00000200D0
757#define R_BCM1480_HSP_RX_SPI_WATERMARK_5 0x00000200D8
758#define R_BCM1480_HSP_RX_SPI_WATERMARK_6 0x00000200E0
759#define R_BCM1480_HSP_RX_SPI_WATERMARK_7 0x00000200E8
760#define R_BCM1480_HSP_RX_SPI_WATERMARK(idx) (R_BCM1480_HSP_RX_SPI_WATERMARK_0 + 8*(idx))
761
762#define R_BCM1480_HSP_RX_VIS_CMDQ_0 0x00000200F0
763#define R_BCM1480_HSP_RX_VIS_CMDQ_1 0x00000200F8
764#define R_BCM1480_HSP_RX_VIS_CMDQ_2 0x0000020100
765#define R_BCM1480_HSP_RX_RAM_READCTL 0x0000020108
766#define R_BCM1480_HSP_RX_RAM_READWINDOW 0x0000020110
767#define R_BCM1480_HSP_RX_RF_READCTL 0x0000020118
768#define R_BCM1480_HSP_RX_RF_READWINDOW 0x0000020120
769
770#define R_BCM1480_HSP_TX_SPI4_CFG_0 0x0000040000
771#define R_BCM1480_HSP_TX_SPI4_CFG_1 0x0000040008
772#define R_BCM1480_HSP_TX_SPI4_TRAINING_FMT 0x0000040010
773
774#define R_BCM1480_HSP_TX_PKT_RAMALLOC_0 0x0000040020
775#define R_BCM1480_HSP_TX_PKT_RAMALLOC_1 0x0000040028
776#define R_BCM1480_HSP_TX_PKT_RAMALLOC_2 0x0000040030
777#define R_BCM1480_HSP_TX_PKT_RAMALLOC_3 0x0000040038
778#define R_BCM1480_HSP_TX_PKT_RAMALLOC_4 0x0000040040
779#define R_BCM1480_HSP_TX_PKT_RAMALLOC_5 0x0000040048
780#define R_BCM1480_HSP_TX_PKT_RAMALLOC_6 0x0000040050
781#define R_BCM1480_HSP_TX_PKT_RAMALLOC_7 0x0000040058
782#define R_BCM1480_HSP_TX_PKT_RAMALLOC(idx) (R_BCM1480_HSP_TX_PKT_RAMALLOC_0 + 8*(idx))
783#define R_BCM1480_HSP_TX_NPC_RAMALLOC 0x0000040078
784#define R_BCM1480_HSP_TX_RSP_RAMALLOC 0x0000040080
785#define R_BCM1480_HSP_TX_PC_RAMALLOC 0x0000040088
786#define R_BCM1480_HSP_TX_HTCC_RAMALLOC_0 0x0000040090
787#define R_BCM1480_HSP_TX_HTCC_RAMALLOC_1 0x0000040098
788#define R_BCM1480_HSP_TX_HTCC_RAMALLOC_2 0x00000400A0
789
790#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_0 0x00000400B0
791#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_1 0x00000400B8
792#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_2 0x00000400C0
793#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_3 0x00000400C8
794#define R_BCM1480_HSP_TX_PKT_RXPHITCNT(idx) (R_BCM1480_HSP_TX_PKT_RXPHITCNT_0 + 8*(idx))
795#define R_BCM1480_HSP_TX_HTIO_RXPHITCNT 0x00000400D0
796#define R_BCM1480_HSP_TX_HTCC_RXPHITCNT 0x00000400D8
797
798#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_0 0x00000400E0
799#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_1 0x00000400E8
800#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_2 0x00000400F0
801#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_3 0x00000400F8
802#define R_BCM1480_HSP_TX_PKT_TXPHITCNT(idx) (R_BCM1480_HSP_TX_PKT_TXPHITCNT_0 + 8*(idx))
803#define R_BCM1480_HSP_TX_HTIO_TXPHITCNT 0x0000040100
804#define R_BCM1480_HSP_TX_HTCC_TXPHITCNT 0x0000040108
805
806#define R_BCM1480_HSP_TX_SPI4_CALENDAR_0 0x0000040200
807#define R_BCM1480_HSP_TX_SPI4_CALENDAR_1 0x0000040208
808
809#define R_BCM1480_HSP_TX_PLL_CNFG 0x0000040800
810#define R_BCM1480_HSP_TX_CALIBRATION 0x0000040808
811#define R_BCM1480_HSP_TX_TEST 0x0000040810
812
813#define R_BCM1480_HSP_TX_VIS_CMDQ_0 0x0000040840
814#define R_BCM1480_HSP_TX_VIS_CMDQ_1 0x0000040848
815#define R_BCM1480_HSP_TX_VIS_CMDQ_2 0x0000040850
816#define R_BCM1480_HSP_TX_RAM_READCTL 0x0000040860
817#define R_BCM1480_HSP_TX_RAM_READWINDOW 0x0000040868
818#define R_BCM1480_HSP_TX_RF_READCTL 0x0000040870
819#define R_BCM1480_HSP_TX_RF_READWINDOW 0x0000040878
820
821#define R_BCM1480_HSP_TX_SPI4_PORT_INT_STATUS 0x0000040880
822#define R_BCM1480_HSP_TX_SPI4_PORT_INT_EN 0x0000040888
823
824#define R_BCM1480_HSP_TX_NEXT_ADDR_BASE 0x000040400
825#define R_BCM1480_HSP_TX_NEXT_ADDR_REGISTER(x) (R_BCM1480_HSP_TX_NEXT_ADDR_BASE+ 8*(x))
826
827
828
829/* *********************************************************************
830 * Physical Address Map (Table 10 and Figure 7)
831 ********************************************************************* */
832
833#define A_BCM1480_PHYS_MEMORY_0 _SB_MAKE64(0x0000000000)
834#define A_BCM1480_PHYS_MEMORY_SIZE _SB_MAKE64((256*1024*1024))
835#define A_BCM1480_PHYS_SYSTEM_CTL _SB_MAKE64(0x0010000000)
836#define A_BCM1480_PHYS_IO_SYSTEM _SB_MAKE64(0x0010060000)
837#define A_BCM1480_PHYS_GENBUS _SB_MAKE64(0x0010090000)
838#define A_BCM1480_PHYS_GENBUS_END _SB_MAKE64(0x0028000000)
839#define A_BCM1480_PHYS_PCI_MISC_MATCH_BYTES _SB_MAKE64(0x0028000000)
840#define A_BCM1480_PHYS_PCI_IACK_MATCH_BYTES _SB_MAKE64(0x0029000000)
841#define A_BCM1480_PHYS_PCI_IO_MATCH_BYTES _SB_MAKE64(0x002C000000)
842#define A_BCM1480_PHYS_PCI_CFG_MATCH_BYTES _SB_MAKE64(0x002E000000)
843#define A_BCM1480_PHYS_PCI_OMAP_MATCH_BYTES _SB_MAKE64(0x002F000000)
844#define A_BCM1480_PHYS_PCI_MEM_MATCH_BYTES _SB_MAKE64(0x0030000000)
845#define A_BCM1480_PHYS_HT_MEM_MATCH_BYTES _SB_MAKE64(0x0040000000)
846#define A_BCM1480_PHYS_HT_MEM_MATCH_BITS _SB_MAKE64(0x0060000000)
847#define A_BCM1480_PHYS_MEMORY_1 _SB_MAKE64(0x0080000000)
848#define A_BCM1480_PHYS_MEMORY_2 _SB_MAKE64(0x0090000000)
849#define A_BCM1480_PHYS_PCI_MISC_MATCH_BITS _SB_MAKE64(0x00A8000000)
850#define A_BCM1480_PHYS_PCI_IACK_MATCH_BITS _SB_MAKE64(0x00A9000000)
851#define A_BCM1480_PHYS_PCI_IO_MATCH_BITS _SB_MAKE64(0x00AC000000)
852#define A_BCM1480_PHYS_PCI_CFG_MATCH_BITS _SB_MAKE64(0x00AE000000)
853#define A_BCM1480_PHYS_PCI_OMAP_MATCH_BITS _SB_MAKE64(0x00AF000000)
854#define A_BCM1480_PHYS_PCI_MEM_MATCH_BITS _SB_MAKE64(0x00B0000000)
855#define A_BCM1480_PHYS_MEMORY_3 _SB_MAKE64(0x00C0000000)
856#define A_BCM1480_PHYS_L2_CACHE_TEST _SB_MAKE64(0x00D0000000)
857#define A_BCM1480_PHYS_HT_SPECIAL_MATCH_BYTES _SB_MAKE64(0x00D8000000)
858#define A_BCM1480_PHYS_HT_IO_MATCH_BYTES _SB_MAKE64(0x00DC000000)
859#define A_BCM1480_PHYS_HT_CFG_MATCH_BYTES _SB_MAKE64(0x00DE000000)
860#define A_BCM1480_PHYS_HS_SUBSYS _SB_MAKE64(0x00DF000000)
861#define A_BCM1480_PHYS_HT_SPECIAL_MATCH_BITS _SB_MAKE64(0x00F8000000)
862#define A_BCM1480_PHYS_HT_IO_MATCH_BITS _SB_MAKE64(0x00FC000000)
863#define A_BCM1480_PHYS_HT_CFG_MATCH_BITS _SB_MAKE64(0x00FE000000)
864#define A_BCM1480_PHYS_MEMORY_EXP _SB_MAKE64(0x0100000000)
865#define A_BCM1480_PHYS_MEMORY_EXP_SIZE _SB_MAKE64((508*1024*1024*1024))
866#define A_BCM1480_PHYS_PCI_UPPER _SB_MAKE64(0x1000000000)
867#define A_BCM1480_PHYS_HT_UPPER_MATCH_BYTES _SB_MAKE64(0x2000000000)
868#define A_BCM1480_PHYS_HT_UPPER_MATCH_BITS _SB_MAKE64(0x3000000000)
869#define A_BCM1480_PHYS_HT_NODE_ALIAS _SB_MAKE64(0x4000000000)
870#define A_BCM1480_PHYS_HT_FULLACCESS _SB_MAKE64(0xF000000000)
871
872
873/* *********************************************************************
874 * L2 Cache as RAM (Table 54)
875 ********************************************************************* */
876
877#define A_BCM1480_PHYS_L2CACHE_WAY_SIZE _SB_MAKE64(0x0000020000)
878#define BCM1480_PHYS_L2CACHE_NUM_WAYS 8
879#define A_BCM1480_PHYS_L2CACHE_TOTAL_SIZE _SB_MAKE64(0x0000100000)
880#define A_BCM1480_PHYS_L2CACHE_WAY0 _SB_MAKE64(0x00D0300000)
881#define A_BCM1480_PHYS_L2CACHE_WAY1 _SB_MAKE64(0x00D0320000)
882#define A_BCM1480_PHYS_L2CACHE_WAY2 _SB_MAKE64(0x00D0340000)
883#define A_BCM1480_PHYS_L2CACHE_WAY3 _SB_MAKE64(0x00D0360000)
884#define A_BCM1480_PHYS_L2CACHE_WAY4 _SB_MAKE64(0x00D0380000)
885#define A_BCM1480_PHYS_L2CACHE_WAY5 _SB_MAKE64(0x00D03A0000)
886#define A_BCM1480_PHYS_L2CACHE_WAY6 _SB_MAKE64(0x00D03C0000)
887#define A_BCM1480_PHYS_L2CACHE_WAY7 _SB_MAKE64(0x00D03E0000)
888
889#endif /* _BCM1480_REGS_H */
diff --git a/arch/mips/include/asm/sibyte/bcm1480_scd.h b/arch/mips/include/asm/sibyte/bcm1480_scd.h
new file mode 100644
index 000000000..87f37086d
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/bcm1480_scd.h
@@ -0,0 +1,393 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * BCM1280/BCM1400 Board Support Package
4 *
5 * SCD Constants and Macros File: bcm1480_scd.h
6 *
7 * This module contains constants and macros useful for
8 * manipulating the System Control and Debug module.
9 *
10 * BCM1400 specification level: 1X55_1X80-UM100-R (12/18/03)
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003,2004,2005
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19#ifndef _BCM1480_SCD_H
20#define _BCM1480_SCD_H
21
22#include <asm/sibyte/sb1250_defs.h>
23
24/* *********************************************************************
25 * Pull in the BCM1250's SCD since lots of stuff is the same.
26 ********************************************************************* */
27
28#include <asm/sibyte/sb1250_scd.h>
29
30/* *********************************************************************
31 * Some general notes:
32 *
33 * This file is basically a "what's new" header file. Since the
34 * BCM1250 and the new BCM1480 (and derivatives) share many common
35 * features, this file contains only what's new or changed from
36 * the 1250. (above, you can see that we include the 1250 symbols
37 * to get the base functionality).
38 *
39 * In software, be sure to use the correct symbols, particularly
40 * for blocks that are different between the two chip families.
41 * All BCM1480-specific symbols have _BCM1480_ in their names,
42 * and all BCM1250-specific and "base" functions that are common in
43 * both chips have no special names (this is for compatibility with
44 * older include files). Therefore, if you're working with the
45 * SCD, which is very different on each chip, A_SCD_xxx implies
46 * the BCM1250 version and A_BCM1480_SCD_xxx implies the BCM1480
47 * version.
48 ********************************************************************* */
49
50/* *********************************************************************
51 * System control/debug registers
52 ********************************************************************* */
53
54/*
55 * System Identification and Revision Register (Table 12)
56 * Register: SCD_SYSTEM_REVISION
57 * This register is field compatible with the 1250.
58 */
59
60/*
61 * New part definitions
62 */
63
64#define K_SYS_PART_BCM1480 0x1406
65#define K_SYS_PART_BCM1280 0x1206
66#define K_SYS_PART_BCM1455 0x1407
67#define K_SYS_PART_BCM1255 0x1257
68#define K_SYS_PART_BCM1158 0x1156
69
70/*
71 * Manufacturing Information Register (Table 14)
72 * Register: SCD_SYSTEM_MANUF
73 */
74
75/*
76 * System Configuration Register (Table 15)
77 * Register: SCD_SYSTEM_CFG
78 * Entire register is different from 1250, all new constants below
79 */
80
81#define M_BCM1480_SYS_RESERVED0 _SB_MAKEMASK1(0)
82#define M_BCM1480_SYS_HT_MINRSTCNT _SB_MAKEMASK1(1)
83#define M_BCM1480_SYS_RESERVED2 _SB_MAKEMASK1(2)
84#define M_BCM1480_SYS_RESERVED3 _SB_MAKEMASK1(3)
85#define M_BCM1480_SYS_RESERVED4 _SB_MAKEMASK1(4)
86#define M_BCM1480_SYS_IOB_DIV _SB_MAKEMASK1(5)
87
88#define S_BCM1480_SYS_PLL_DIV _SB_MAKE64(6)
89#define M_BCM1480_SYS_PLL_DIV _SB_MAKEMASK(5, S_BCM1480_SYS_PLL_DIV)
90#define V_BCM1480_SYS_PLL_DIV(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_PLL_DIV)
91#define G_BCM1480_SYS_PLL_DIV(x) _SB_GETVALUE(x, S_BCM1480_SYS_PLL_DIV, M_BCM1480_SYS_PLL_DIV)
92
93#define S_BCM1480_SYS_SW_DIV _SB_MAKE64(11)
94#define M_BCM1480_SYS_SW_DIV _SB_MAKEMASK(5, S_BCM1480_SYS_SW_DIV)
95#define V_BCM1480_SYS_SW_DIV(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_SW_DIV)
96#define G_BCM1480_SYS_SW_DIV(x) _SB_GETVALUE(x, S_BCM1480_SYS_SW_DIV, M_BCM1480_SYS_SW_DIV)
97
98#define M_BCM1480_SYS_PCMCIA_ENABLE _SB_MAKEMASK1(16)
99#define M_BCM1480_SYS_DUART1_ENABLE _SB_MAKEMASK1(17)
100
101#define S_BCM1480_SYS_BOOT_MODE _SB_MAKE64(18)
102#define M_BCM1480_SYS_BOOT_MODE _SB_MAKEMASK(2, S_BCM1480_SYS_BOOT_MODE)
103#define V_BCM1480_SYS_BOOT_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_BOOT_MODE)
104#define G_BCM1480_SYS_BOOT_MODE(x) _SB_GETVALUE(x, S_BCM1480_SYS_BOOT_MODE, M_BCM1480_SYS_BOOT_MODE)
105#define K_BCM1480_SYS_BOOT_MODE_ROM32 0
106#define K_BCM1480_SYS_BOOT_MODE_ROM8 1
107#define K_BCM1480_SYS_BOOT_MODE_SMBUS_SMALL 2
108#define K_BCM1480_SYS_BOOT_MODE_SMBUS_BIG 3
109#define M_BCM1480_SYS_BOOT_MODE_SMBUS _SB_MAKEMASK1(19)
110
111#define M_BCM1480_SYS_PCI_HOST _SB_MAKEMASK1(20)
112#define M_BCM1480_SYS_PCI_ARBITER _SB_MAKEMASK1(21)
113#define M_BCM1480_SYS_BIG_ENDIAN _SB_MAKEMASK1(22)
114#define M_BCM1480_SYS_GENCLK_EN _SB_MAKEMASK1(23)
115#define M_BCM1480_SYS_GEN_PARITY_EN _SB_MAKEMASK1(24)
116#define M_BCM1480_SYS_RESERVED25 _SB_MAKEMASK1(25)
117
118#define S_BCM1480_SYS_CONFIG 26
119#define M_BCM1480_SYS_CONFIG _SB_MAKEMASK(6, S_BCM1480_SYS_CONFIG)
120#define V_BCM1480_SYS_CONFIG(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_CONFIG)
121#define G_BCM1480_SYS_CONFIG(x) _SB_GETVALUE(x, S_BCM1480_SYS_CONFIG, M_BCM1480_SYS_CONFIG)
122
123#define M_BCM1480_SYS_RESERVED32 _SB_MAKEMASK(32, 15)
124
125#define S_BCM1480_SYS_NODEID 47
126#define M_BCM1480_SYS_NODEID _SB_MAKEMASK(4, S_BCM1480_SYS_NODEID)
127#define V_BCM1480_SYS_NODEID(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_NODEID)
128#define G_BCM1480_SYS_NODEID(x) _SB_GETVALUE(x, S_BCM1480_SYS_NODEID, M_BCM1480_SYS_NODEID)
129
130#define M_BCM1480_SYS_CCNUMA_EN _SB_MAKEMASK1(51)
131#define M_BCM1480_SYS_CPU_RESET_0 _SB_MAKEMASK1(52)
132#define M_BCM1480_SYS_CPU_RESET_1 _SB_MAKEMASK1(53)
133#define M_BCM1480_SYS_CPU_RESET_2 _SB_MAKEMASK1(54)
134#define M_BCM1480_SYS_CPU_RESET_3 _SB_MAKEMASK1(55)
135#define S_BCM1480_SYS_DISABLECPU0 56
136#define M_BCM1480_SYS_DISABLECPU0 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU0)
137#define S_BCM1480_SYS_DISABLECPU1 57
138#define M_BCM1480_SYS_DISABLECPU1 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU1)
139#define S_BCM1480_SYS_DISABLECPU2 58
140#define M_BCM1480_SYS_DISABLECPU2 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU2)
141#define S_BCM1480_SYS_DISABLECPU3 59
142#define M_BCM1480_SYS_DISABLECPU3 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU3)
143
144#define M_BCM1480_SYS_SB_SOFTRES _SB_MAKEMASK1(60)
145#define M_BCM1480_SYS_EXT_RESET _SB_MAKEMASK1(61)
146#define M_BCM1480_SYS_SYSTEM_RESET _SB_MAKEMASK1(62)
147#define M_BCM1480_SYS_SW_FLAG _SB_MAKEMASK1(63)
148
149/*
150 * Scratch Register (Table 16)
151 * Register: SCD_SYSTEM_SCRATCH
152 * Same as BCM1250
153 */
154
155
156/*
157 * Mailbox Registers (Table 17)
158 * Registers: SCD_MBOX_{0,1}_CPU_x
159 * Same as BCM1250
160 */
161
162
163/*
164 * See bcm1480_int.h for interrupt mapper registers.
165 */
166
167
168/*
169 * Watchdog Timer Initial Count Registers (Table 23)
170 * Registers: SCD_WDOG_INIT_CNT_x
171 *
172 * The watchdogs are almost the same as the 1250, except
173 * the configuration register has more bits to control the
174 * other CPUs.
175 */
176
177
178/*
179 * Watchdog Timer Configuration Registers (Table 25)
180 * Registers: SCD_WDOG_CFG_x
181 */
182
183#define M_BCM1480_SCD_WDOG_ENABLE _SB_MAKEMASK1(0)
184
185#define S_BCM1480_SCD_WDOG_RESET_TYPE 2
186#define M_BCM1480_SCD_WDOG_RESET_TYPE _SB_MAKEMASK(5, S_BCM1480_SCD_WDOG_RESET_TYPE)
187#define V_BCM1480_SCD_WDOG_RESET_TYPE(x) _SB_MAKEVALUE(x, S_BCM1480_SCD_WDOG_RESET_TYPE)
188#define G_BCM1480_SCD_WDOG_RESET_TYPE(x) _SB_GETVALUE(x, S_BCM1480_SCD_WDOG_RESET_TYPE, M_BCM1480_SCD_WDOG_RESET_TYPE)
189
190#define K_BCM1480_SCD_WDOG_RESET_FULL 0 /* actually, (x & 1) == 0 */
191#define K_BCM1480_SCD_WDOG_RESET_SOFT 1
192#define K_BCM1480_SCD_WDOG_RESET_CPU0 3
193#define K_BCM1480_SCD_WDOG_RESET_CPU1 5
194#define K_BCM1480_SCD_WDOG_RESET_CPU2 9
195#define K_BCM1480_SCD_WDOG_RESET_CPU3 17
196#define K_BCM1480_SCD_WDOG_RESET_ALL_CPUS 31
197
198
199#define M_BCM1480_SCD_WDOG_HAS_RESET _SB_MAKEMASK1(8)
200
201/*
202 * General Timer Initial Count Registers (Table 26)
203 * Registers: SCD_TIMER_INIT_x
204 *
205 * The timer registers are the same as the BCM1250
206 */
207
208
209/*
210 * ZBbus Count Register (Table 29)
211 * Register: ZBBUS_CYCLE_COUNT
212 *
213 * Same as BCM1250
214 */
215
216/*
217 * ZBbus Compare Registers (Table 30)
218 * Registers: ZBBUS_CYCLE_CPx
219 *
220 * Same as BCM1250
221 */
222
223
224/*
225 * System Performance Counter Configuration Register (Table 31)
226 * Register: PERF_CNT_CFG_0
227 *
228 * SPC_CFG_SRC[0-3] is the same as the 1250.
229 * SPC_CFG_SRC[4-7] only exist on the 1480
230 * The clear/enable bits are in different locations on the 1250 and 1480.
231 */
232
233#define S_SPC_CFG_SRC4 32
234#define M_SPC_CFG_SRC4 _SB_MAKEMASK(8, S_SPC_CFG_SRC4)
235#define V_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC4)
236#define G_SPC_CFG_SRC4(x) _SB_GETVALUE(x, S_SPC_CFG_SRC4, M_SPC_CFG_SRC4)
237
238#define S_SPC_CFG_SRC5 40
239#define M_SPC_CFG_SRC5 _SB_MAKEMASK(8, S_SPC_CFG_SRC5)
240#define V_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC5)
241#define G_SPC_CFG_SRC5(x) _SB_GETVALUE(x, S_SPC_CFG_SRC5, M_SPC_CFG_SRC5)
242
243#define S_SPC_CFG_SRC6 48
244#define M_SPC_CFG_SRC6 _SB_MAKEMASK(8, S_SPC_CFG_SRC6)
245#define V_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC6)
246#define G_SPC_CFG_SRC6(x) _SB_GETVALUE(x, S_SPC_CFG_SRC6, M_SPC_CFG_SRC6)
247
248#define S_SPC_CFG_SRC7 56
249#define M_SPC_CFG_SRC7 _SB_MAKEMASK(8, S_SPC_CFG_SRC7)
250#define V_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC7)
251#define G_SPC_CFG_SRC7(x) _SB_GETVALUE(x, S_SPC_CFG_SRC7, M_SPC_CFG_SRC7)
252
253/*
254 * System Performance Counter Control Register (Table 32)
255 * Register: PERF_CNT_CFG_1
256 * BCM1480 specific
257 */
258#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0)
259#define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1)
260#if SIBYTE_HDR_FEATURE_CHIP(1480)
261#define M_SPC_CFG_CLEAR M_BCM1480_SPC_CFG_CLEAR
262#define M_SPC_CFG_ENABLE M_BCM1480_SPC_CFG_ENABLE
263#endif
264
265/*
266 * System Performance Counters (Table 33)
267 * Registers: PERF_CNT_x
268 */
269
270#define S_BCM1480_SPC_CNT_COUNT 0
271#define M_BCM1480_SPC_CNT_COUNT _SB_MAKEMASK(40, S_BCM1480_SPC_CNT_COUNT)
272#define V_BCM1480_SPC_CNT_COUNT(x) _SB_MAKEVALUE(x, S_BCM1480_SPC_CNT_COUNT)
273#define G_BCM1480_SPC_CNT_COUNT(x) _SB_GETVALUE(x, S_BCM1480_SPC_CNT_COUNT, M_BCM1480_SPC_CNT_COUNT)
274
275#define M_BCM1480_SPC_CNT_OFLOW _SB_MAKEMASK1(40)
276
277
278/*
279 * Bus Watcher Error Status Register (Tables 36, 37)
280 * Registers: BUS_ERR_STATUS, BUS_ERR_STATUS_DEBUG
281 * Same as BCM1250.
282 */
283
284/*
285 * Bus Watcher Error Data Registers (Table 38)
286 * Registers: BUS_ERR_DATA_x
287 * Same as BCM1250.
288 */
289
290/*
291 * Bus Watcher L2 ECC Counter Register (Table 39)
292 * Register: BUS_L2_ERRORS
293 * Same as BCM1250.
294 */
295
296
297/*
298 * Bus Watcher Memory and I/O Error Counter Register (Table 40)
299 * Register: BUS_MEM_IO_ERRORS
300 * Same as BCM1250.
301 */
302
303
304/*
305 * Address Trap Registers
306 *
307 * Register layout same as BCM1250, almost. The bus agents
308 * are different, and the address trap configuration bits are
309 * slightly different.
310 */
311
312#define M_BCM1480_ATRAP_INDEX _SB_MAKEMASK(4, 0)
313#define M_BCM1480_ATRAP_ADDRESS _SB_MAKEMASK(40, 0)
314
315#define S_BCM1480_ATRAP_CFG_CNT 0
316#define M_BCM1480_ATRAP_CFG_CNT _SB_MAKEMASK(3, S_BCM1480_ATRAP_CFG_CNT)
317#define V_BCM1480_ATRAP_CFG_CNT(x) _SB_MAKEVALUE(x, S_BCM1480_ATRAP_CFG_CNT)
318#define G_BCM1480_ATRAP_CFG_CNT(x) _SB_GETVALUE(x, S_BCM1480_ATRAP_CFG_CNT, M_BCM1480_ATRAP_CFG_CNT)
319
320#define M_BCM1480_ATRAP_CFG_WRITE _SB_MAKEMASK1(3)
321#define M_BCM1480_ATRAP_CFG_ALL _SB_MAKEMASK1(4)
322#define M_BCM1480_ATRAP_CFG_INV _SB_MAKEMASK1(5)
323#define M_BCM1480_ATRAP_CFG_USESRC _SB_MAKEMASK1(6)
324#define M_BCM1480_ATRAP_CFG_SRCINV _SB_MAKEMASK1(7)
325
326#define S_BCM1480_ATRAP_CFG_AGENTID 8
327#define M_BCM1480_ATRAP_CFG_AGENTID _SB_MAKEMASK(4, S_BCM1480_ATRAP_CFG_AGENTID)
328#define V_BCM1480_ATRAP_CFG_AGENTID(x) _SB_MAKEVALUE(x, S_BCM1480_ATRAP_CFG_AGENTID)
329#define G_BCM1480_ATRAP_CFG_AGENTID(x) _SB_GETVALUE(x, S_BCM1480_ATRAP_CFG_AGENTID, M_BCM1480_ATRAP_CFG_AGENTID)
330
331
332#define K_BCM1480_BUS_AGENT_CPU0 0
333#define K_BCM1480_BUS_AGENT_CPU1 1
334#define K_BCM1480_BUS_AGENT_NC 2
335#define K_BCM1480_BUS_AGENT_IOB 3
336#define K_BCM1480_BUS_AGENT_SCD 4
337#define K_BCM1480_BUS_AGENT_L2C 6
338#define K_BCM1480_BUS_AGENT_MC 7
339#define K_BCM1480_BUS_AGENT_CPU2 8
340#define K_BCM1480_BUS_AGENT_CPU3 9
341#define K_BCM1480_BUS_AGENT_PM 10
342
343#define S_BCM1480_ATRAP_CFG_CATTR 12
344#define M_BCM1480_ATRAP_CFG_CATTR _SB_MAKEMASK(2, S_BCM1480_ATRAP_CFG_CATTR)
345#define V_BCM1480_ATRAP_CFG_CATTR(x) _SB_MAKEVALUE(x, S_BCM1480_ATRAP_CFG_CATTR)
346#define G_BCM1480_ATRAP_CFG_CATTR(x) _SB_GETVALUE(x, S_BCM1480_ATRAP_CFG_CATTR, M_BCM1480_ATRAP_CFG_CATTR)
347
348#define K_BCM1480_ATRAP_CFG_CATTR_IGNORE 0
349#define K_BCM1480_ATRAP_CFG_CATTR_UNC 1
350#define K_BCM1480_ATRAP_CFG_CATTR_NONCOH 2
351#define K_BCM1480_ATRAP_CFG_CATTR_COHERENT 3
352
353#define M_BCM1480_ATRAP_CFG_CATTRINV _SB_MAKEMASK1(14)
354
355
356/*
357 * Trace Event Registers (Table 47)
358 * Same as BCM1250.
359 */
360
361/*
362 * Trace Sequence Control Registers (Table 48)
363 * Registers: TRACE_SEQUENCE_x
364 *
365 * Same as BCM1250 except for two new fields.
366 */
367
368
369#define M_BCM1480_SCD_TRSEQ_TID_MATCH_EN _SB_MAKEMASK1(25)
370
371#define S_BCM1480_SCD_TRSEQ_SWFUNC 26
372#define M_BCM1480_SCD_TRSEQ_SWFUNC _SB_MAKEMASK(2, S_BCM1480_SCD_TRSEQ_SWFUNC)
373#define V_BCM1480_SCD_TRSEQ_SWFUNC(x) _SB_MAKEVALUE(x, S_BCM1480_SCD_TRSEQ_SWFUNC)
374#define G_BCM1480_SCD_TRSEQ_SWFUNC(x) _SB_GETVALUE(x, S_BCM1480_SCD_TRSEQ_SWFUNC, M_BCM1480_SCD_TRSEQ_SWFUNC)
375
376/*
377 * Trace Control Register (Table 49)
378 * Register: TRACE_CFG
379 *
380 * BCM1480 changes to this register (other than location of the CUR_ADDR field)
381 * are defined below.
382 */
383
384#define S_BCM1480_SCD_TRACE_CFG_MODE 16
385#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2, S_BCM1480_SCD_TRACE_CFG_MODE)
386#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_SCD_TRACE_CFG_MODE)
387#define G_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_GETVALUE(x, S_BCM1480_SCD_TRACE_CFG_MODE, M_BCM1480_SCD_TRACE_CFG_MODE)
388
389#define K_BCM1480_SCD_TRACE_CFG_MODE_BLOCKERS 0
390#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1
391#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2
392
393#endif /* _BCM1480_SCD_H */
diff --git a/arch/mips/include/asm/sibyte/bigsur.h b/arch/mips/include/asm/sibyte/bigsur.h
new file mode 100644
index 000000000..86c876196
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/bigsur.h
@@ -0,0 +1,35 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation
4 */
5#ifndef __ASM_SIBYTE_BIGSUR_H
6#define __ASM_SIBYTE_BIGSUR_H
7
8#include <asm/sibyte/sb1250.h>
9#include <asm/sibyte/bcm1480_int.h>
10
11#ifdef CONFIG_SIBYTE_BIGSUR
12#define SIBYTE_BOARD_NAME "BCM91x80A/B (BigSur)"
13#define SIBYTE_HAVE_PCMCIA 1
14#define SIBYTE_HAVE_IDE 1
15#endif
16
17/* Generic bus chip selects */
18#define LEDS_CS 3
19#define LEDS_PHYS 0x100a0000
20
21#ifdef SIBYTE_HAVE_IDE
22#define IDE_CS 4
23#define IDE_PHYS 0x100b0000
24#define K_GPIO_GB_IDE 4
25#define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE)
26#endif
27
28#ifdef SIBYTE_HAVE_PCMCIA
29#define PCMCIA_CS 6
30#define PCMCIA_PHYS 0x11000000
31#define K_GPIO_PC_READY 9
32#define K_INT_PC_READY (K_INT_GPIO_0 + K_GPIO_PC_READY)
33#endif
34
35#endif /* __ASM_SIBYTE_BIGSUR_H */
diff --git a/arch/mips/include/asm/sibyte/board.h b/arch/mips/include/asm/sibyte/board.h
new file mode 100644
index 000000000..20fe2f16c
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/board.h
@@ -0,0 +1,55 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation
4 */
5
6#ifndef _SIBYTE_BOARD_H
7#define _SIBYTE_BOARD_H
8
9#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_CRHONE) || \
10 defined(CONFIG_SIBYTE_CRHINE) || defined(CONFIG_SIBYTE_LITTLESUR)
11#include <asm/sibyte/swarm.h>
12#endif
13
14#if defined(CONFIG_SIBYTE_SENTOSA) || defined(CONFIG_SIBYTE_RHONE)
15#include <asm/sibyte/sentosa.h>
16#endif
17
18#ifdef CONFIG_SIBYTE_CARMEL
19#include <asm/sibyte/carmel.h>
20#endif
21
22#ifdef CONFIG_SIBYTE_BIGSUR
23#include <asm/sibyte/bigsur.h>
24#endif
25
26#ifdef __ASSEMBLY__
27
28#ifdef LEDS_PHYS
29#define setleds(t0, t1, c0, c1, c2, c3) \
30 li t0, (LEDS_PHYS|0xa0000000); \
31 li t1, c0; \
32 sb t1, 0x18(t0); \
33 li t1, c1; \
34 sb t1, 0x10(t0); \
35 li t1, c2; \
36 sb t1, 0x08(t0); \
37 li t1, c3; \
38 sb t1, 0x00(t0)
39#else
40#define setleds(t0, t1, c0, c1, c2, c3)
41#endif /* LEDS_PHYS */
42
43#else
44
45void swarm_setup(void);
46
47#ifdef LEDS_PHYS
48extern void setleds(char *str);
49#else
50#define setleds(s) do { } while (0)
51#endif /* LEDS_PHYS */
52
53#endif /* __ASSEMBLY__ */
54
55#endif /* _SIBYTE_BOARD_H */
diff --git a/arch/mips/include/asm/sibyte/carmel.h b/arch/mips/include/asm/sibyte/carmel.h
new file mode 100644
index 000000000..c6730d7a6
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/carmel.h
@@ -0,0 +1,45 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2002 Broadcom Corporation
4 */
5#ifndef __ASM_SIBYTE_CARMEL_H
6#define __ASM_SIBYTE_CARMEL_H
7
8#include <asm/sibyte/sb1250.h>
9#include <asm/sibyte/sb1250_int.h>
10
11#define SIBYTE_BOARD_NAME "Carmel"
12
13#define GPIO_PHY_INTERRUPT 2
14#define GPIO_NONMASKABLE_INT 3
15#define GPIO_CF_INSERTED 6
16#define GPIO_MONTEREY_RESET 7
17#define GPIO_QUADUART_INT 8
18#define GPIO_CF_INT 9
19#define GPIO_FPGA_CCLK 10
20#define GPIO_FPGA_DOUT 11
21#define GPIO_FPGA_DIN 12
22#define GPIO_FPGA_PGM 13
23#define GPIO_FPGA_DONE 14
24#define GPIO_FPGA_INIT 15
25
26#define LEDS_CS 2
27#define LEDS_PHYS 0x100C0000
28#define MLEDS_CS 3
29#define MLEDS_PHYS 0x100A0000
30#define UART_CS 4
31#define UART_PHYS 0x100D0000
32#define ARAVALI_CS 5
33#define ARAVALI_PHYS 0x11000000
34#define IDE_CS 6
35#define IDE_PHYS 0x100B0000
36#define ARAVALI2_CS 7
37#define ARAVALI2_PHYS 0x100E0000
38
39#if defined(CONFIG_SIBYTE_CARMEL)
40#define K_GPIO_GB_IDE 9
41#define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE)
42#endif
43
44
45#endif /* __ASM_SIBYTE_CARMEL_H */
diff --git a/arch/mips/include/asm/sibyte/sb1250.h b/arch/mips/include/asm/sibyte/sb1250.h
new file mode 100644
index 000000000..dbde5f93f
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250.h
@@ -0,0 +1,55 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
4 */
5
6#ifndef _ASM_SIBYTE_SB1250_H
7#define _ASM_SIBYTE_SB1250_H
8
9/*
10 * yymmddpp: year, month, day, patch.
11 * should sync with Makefile EXTRAVERSION
12 */
13#define SIBYTE_RELEASE 0x02111403
14
15#define SB1250_NR_IRQS 64
16
17#define BCM1480_NR_IRQS 128
18#define BCM1480_NR_IRQS_HALF 64
19
20#define SB1250_DUART_MINOR_BASE 64
21
22#ifndef __ASSEMBLY__
23
24#include <asm/addrspace.h>
25
26/* For revision/pass information */
27#include <asm/sibyte/sb1250_scd.h>
28#include <asm/sibyte/bcm1480_scd.h>
29extern unsigned int sb1_pass;
30extern unsigned int soc_pass;
31extern unsigned int soc_type;
32extern unsigned int periph_rev;
33extern unsigned int zbbus_mhz;
34
35extern void sb1250_time_init(void);
36extern void sb1250_mask_irq(int cpu, int irq);
37extern void sb1250_unmask_irq(int cpu, int irq);
38
39extern void bcm1480_time_init(void);
40extern void bcm1480_mask_irq(int cpu, int irq);
41extern void bcm1480_unmask_irq(int cpu, int irq);
42
43#define AT_spin \
44 __asm__ __volatile__ ( \
45 ".set noat\n" \
46 "li $at, 0\n" \
47 "1: beqz $at, 1b\n" \
48 ".set at\n" \
49 )
50
51#endif
52
53#define IOADDR(a) ((void __iomem *)(IO_BASE + (a)))
54
55#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_defs.h b/arch/mips/include/asm/sibyte/sb1250_defs.h
new file mode 100644
index 000000000..68cd7c0b3
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_defs.h
@@ -0,0 +1,246 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * Global constants and macros File: sb1250_defs.h
6 *
7 * This file contains macros and definitions used by the other
8 * include files.
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19#ifndef _SB1250_DEFS_H
20#define _SB1250_DEFS_H
21
22/*
23 * These headers require ANSI C89 string concatenation, and GCC or other
24 * 'long long' (64-bit integer) support.
25 */
26#if !defined(__STDC__) && !defined(_MSC_VER)
27#error SiByte headers require ANSI C89 support
28#endif
29
30
31/* *********************************************************************
32 * Macros for feature tests, used to enable include file features
33 * for chip features only present in certain chip revisions.
34 *
35 * SIBYTE_HDR_FEATURES may be defined to be the mask value chip/revision
36 * which is to be exposed by the headers. If undefined, it defaults to
37 * "all features."
38 *
39 * Use like:
40 *
41 * #define SIBYTE_HDR_FEATURES SIBYTE_HDR_FMASK_112x_PASS1
42 *
43 * Generate defines only for that revision of chip.
44 *
45 * #if SIBYTE_HDR_FEATURE(chip,pass)
46 *
47 * True if header features for that revision or later of
48 * that particular chip type are enabled in SIBYTE_HDR_FEATURES.
49 * (Use this to bracket #defines for features present in a given
50 * revision and later.)
51 *
52 * Note that there is no implied ordering between chip types.
53 *
54 * Note also that 'chip' and 'pass' must textually exactly
55 * match the defines below. So, for example,
56 * SIBYTE_HDR_FEATURE(112x, PASS1) is OK, but
57 * SIBYTE_HDR_FEATURE(1120, pass1) is not (for two reasons).
58 *
59 * #if SIBYTE_HDR_FEATURE_UP_TO(chip,pass)
60 *
61 * Same as SIBYTE_HDR_FEATURE, but true for the named revision
62 * and earlier revisions of the named chip type.
63 *
64 * #if SIBYTE_HDR_FEATURE_EXACT(chip,pass)
65 *
66 * Same as SIBYTE_HDR_FEATURE, but only true for the named
67 * revision of the named chip type. (Note that this CANNOT
68 * be used to verify that you're compiling only for that
69 * particular chip/revision. It will be true any time this
70 * chip/revision is included in SIBYTE_HDR_FEATURES.)
71 *
72 * #if SIBYTE_HDR_FEATURE_CHIP(chip)
73 *
74 * True if header features for (any revision of) that chip type
75 * are enabled in SIBYTE_HDR_FEATURES. (Use this to bracket
76 * #defines for features specific to a given chip type.)
77 *
78 * Mask values currently include room for additional revisions of each
79 * chip type, but can be renumbered at will. Note that they MUST fit
80 * into 31 bits and may not include C type constructs, for safe use in
81 * CPP conditionals. Bit positions within chip types DO indicate
82 * ordering, so be careful when adding support for new minor revs.
83 ********************************************************************* */
84
85#define SIBYTE_HDR_FMASK_1250_ALL 0x000000ff
86#define SIBYTE_HDR_FMASK_1250_PASS1 0x00000001
87#define SIBYTE_HDR_FMASK_1250_PASS2 0x00000002
88#define SIBYTE_HDR_FMASK_1250_PASS3 0x00000004
89
90#define SIBYTE_HDR_FMASK_112x_ALL 0x00000f00
91#define SIBYTE_HDR_FMASK_112x_PASS1 0x00000100
92
93#define SIBYTE_HDR_FMASK_1480_ALL 0x0000f000
94#define SIBYTE_HDR_FMASK_1480_PASS1 0x00001000
95#define SIBYTE_HDR_FMASK_1480_PASS2 0x00002000
96
97/* Bit mask for chip/revision. (use _ALL for all revisions of a chip). */
98#define SIBYTE_HDR_FMASK(chip, pass) \
99 (SIBYTE_HDR_FMASK_ ## chip ## _ ## pass)
100#define SIBYTE_HDR_FMASK_ALLREVS(chip) \
101 (SIBYTE_HDR_FMASK_ ## chip ## _ALL)
102
103/* Default constant value for all chips, all revisions */
104#define SIBYTE_HDR_FMASK_ALL \
105 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL \
106 | SIBYTE_HDR_FMASK_1480_ALL)
107
108/* This one is used for the "original" BCM1250/BCM112x chips. We use this
109 to weed out constants and macros that do not exist on later chips like
110 the BCM1480 */
111#define SIBYTE_HDR_FMASK_1250_112x_ALL \
112 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL)
113#define SIBYTE_HDR_FMASK_1250_112x SIBYTE_HDR_FMASK_1250_112x_ALL
114
115#ifndef SIBYTE_HDR_FEATURES
116#define SIBYTE_HDR_FEATURES SIBYTE_HDR_FMASK_ALL
117#endif
118
119
120/* Bit mask for revisions of chip exclusively before the named revision. */
121#define SIBYTE_HDR_FMASK_BEFORE(chip, pass) \
122 ((SIBYTE_HDR_FMASK(chip, pass) - 1) & SIBYTE_HDR_FMASK_ALLREVS(chip))
123
124/* Bit mask for revisions of chip exclusively after the named revision. */
125#define SIBYTE_HDR_FMASK_AFTER(chip, pass) \
126 (~(SIBYTE_HDR_FMASK(chip, pass) \
127 | (SIBYTE_HDR_FMASK(chip, pass) - 1)) & SIBYTE_HDR_FMASK_ALLREVS(chip))
128
129
130/* True if header features enabled for (any revision of) that chip type. */
131#define SIBYTE_HDR_FEATURE_CHIP(chip) \
132 (!! (SIBYTE_HDR_FMASK_ALLREVS(chip) & SIBYTE_HDR_FEATURES))
133
134/* True for all versions of the BCM1250 and BCM1125, but not true for
135 anything else */
136#define SIBYTE_HDR_FEATURE_1250_112x \
137 (SIBYTE_HDR_FEATURE_CHIP(1250) || SIBYTE_HDR_FEATURE_CHIP(112x))
138/* (!! (SIBYTE_HDR_FEATURES & SIBYHTE_HDR_FMASK_1250_112x)) */
139
140/* True if header features enabled for that rev or later, inclusive. */
141#define SIBYTE_HDR_FEATURE(chip, pass) \
142 (!! ((SIBYTE_HDR_FMASK(chip, pass) \
143 | SIBYTE_HDR_FMASK_AFTER(chip, pass)) & SIBYTE_HDR_FEATURES))
144
145/* True if header features enabled for exactly that rev. */
146#define SIBYTE_HDR_FEATURE_EXACT(chip, pass) \
147 (!! (SIBYTE_HDR_FMASK(chip, pass) & SIBYTE_HDR_FEATURES))
148
149/* True if header features enabled for that rev or before, inclusive. */
150#define SIBYTE_HDR_FEATURE_UP_TO(chip, pass) \
151 (!! ((SIBYTE_HDR_FMASK(chip, pass) \
152 | SIBYTE_HDR_FMASK_BEFORE(chip, pass)) & SIBYTE_HDR_FEATURES))
153
154
155/* *********************************************************************
156 * Naming schemes for constants in these files:
157 *
158 * M_xxx MASK constant (identifies bits in a register).
159 * For multi-bit fields, all bits in the field will
160 * be set.
161 *
162 * K_xxx "Code" constant (value for data in a multi-bit
163 * field). The value is right justified.
164 *
165 * V_xxx "Value" constant. This is the same as the
166 * corresponding "K_xxx" constant, except it is
167 * shifted to the correct position in the register.
168 *
169 * S_xxx SHIFT constant. This is the number of bits that
170 * a field value (code) needs to be shifted
171 * (towards the left) to put the value in the right
172 * position for the register.
173 *
174 * A_xxx ADDRESS constant. This will be a physical
175 * address. Use the PHYS_TO_K1 macro to generate
176 * a K1SEG address.
177 *
178 * R_xxx RELATIVE offset constant. This is an offset from
179 * an A_xxx constant (usually the first register in
180 * a group).
181 *
182 * G_xxx(X) GET value. This macro obtains a multi-bit field
183 * from a register, masks it, and shifts it to
184 * the bottom of the register (retrieving a K_xxx
185 * value, for example).
186 *
187 * V_xxx(X) VALUE. This macro computes the value of a
188 * K_xxx constant shifted to the correct position
189 * in the register.
190 ********************************************************************* */
191
192
193
194
195/*
196 * Cast to 64-bit number. Presumably the syntax is different in
197 * assembly language.
198 *
199 * Note: you'll need to define uint32_t and uint64_t in your headers.
200 */
201
202#if !defined(__ASSEMBLY__)
203#define _SB_MAKE64(x) ((uint64_t)(x))
204#define _SB_MAKE32(x) ((uint32_t)(x))
205#else
206#define _SB_MAKE64(x) (x)
207#define _SB_MAKE32(x) (x)
208#endif
209
210
211/*
212 * Make a mask for 1 bit at position 'n'
213 */
214
215#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n))
216#define _SB_MAKEMASK1_32(n) (_SB_MAKE32(1) << _SB_MAKE32(n))
217
218/*
219 * Make a mask for 'v' bits at position 'n'
220 */
221
222#define _SB_MAKEMASK(v, n) (_SB_MAKE64((_SB_MAKE64(1)<<(v))-1) << _SB_MAKE64(n))
223#define _SB_MAKEMASK_32(v, n) (_SB_MAKE32((_SB_MAKE32(1)<<(v))-1) << _SB_MAKE32(n))
224
225/*
226 * Make a value at 'v' at bit position 'n'
227 */
228
229#define _SB_MAKEVALUE(v, n) (_SB_MAKE64(v) << _SB_MAKE64(n))
230#define _SB_MAKEVALUE_32(v, n) (_SB_MAKE32(v) << _SB_MAKE32(n))
231
232#define _SB_GETVALUE(v, n, m) ((_SB_MAKE64(v) & _SB_MAKE64(m)) >> _SB_MAKE64(n))
233#define _SB_GETVALUE_32(v, n, m) ((_SB_MAKE32(v) & _SB_MAKE32(m)) >> _SB_MAKE32(n))
234
235/*
236 * Macros to read/write on-chip registers
237 * XXX should we do the PHYS_TO_K1 here?
238 */
239
240
241#if defined(__mips64) && !defined(__ASSEMBLY__)
242#define SBWRITECSR(csr, val) *((volatile uint64_t *) PHYS_TO_K1(csr)) = (val)
243#define SBREADCSR(csr) (*((volatile uint64_t *) PHYS_TO_K1(csr)))
244#endif /* __ASSEMBLY__ */
245
246#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_dma.h b/arch/mips/include/asm/sibyte/sb1250_dma.h
new file mode 100644
index 000000000..d9678b98c
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_dma.h
@@ -0,0 +1,581 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * DMA definitions File: sb1250_dma.h
6 *
7 * This module contains constants and macros useful for
8 * programming the SB1250's DMA controllers, both the data mover
9 * and the Ethernet DMA.
10 *
11 * SB1250 specification level: User's manual 10/21/02
12 * BCM1280 specification level: User's manual 11/24/03
13 *
14 *********************************************************************
15 *
16 * Copyright 2000,2001,2002,2003
17 * Broadcom Corporation. All rights reserved.
18 *
19 ********************************************************************* */
20
21
22#ifndef _SB1250_DMA_H
23#define _SB1250_DMA_H
24
25
26#include <asm/sibyte/sb1250_defs.h>
27
28/* *********************************************************************
29 * DMA Registers
30 ********************************************************************* */
31
32/*
33 * Ethernet and Serial DMA Configuration Register 0 (Table 7-4)
34 * Registers: DMA_CONFIG0_MAC_x_RX_CH_0
35 * Registers: DMA_CONFIG0_MAC_x_TX_CH_0
36 * Registers: DMA_CONFIG0_SER_x_RX
37 * Registers: DMA_CONFIG0_SER_x_TX
38 */
39
40
41#define M_DMA_DROP _SB_MAKEMASK1(0)
42
43#define M_DMA_CHAIN_SEL _SB_MAKEMASK1(1)
44#define M_DMA_RESERVED1 _SB_MAKEMASK1(2)
45
46#define S_DMA_DESC_TYPE _SB_MAKE64(1)
47#define M_DMA_DESC_TYPE _SB_MAKEMASK(2, S_DMA_DESC_TYPE)
48#define V_DMA_DESC_TYPE(x) _SB_MAKEVALUE(x, S_DMA_DESC_TYPE)
49#define G_DMA_DESC_TYPE(x) _SB_GETVALUE(x, S_DMA_DESC_TYPE, M_DMA_DESC_TYPE)
50
51#define K_DMA_DESC_TYPE_RING_AL 0
52#define K_DMA_DESC_TYPE_CHAIN_AL 1
53
54#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
55#define K_DMA_DESC_TYPE_RING_UAL_WI 2
56#define K_DMA_DESC_TYPE_RING_UAL_RMW 3
57#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
58
59#define M_DMA_EOP_INT_EN _SB_MAKEMASK1(3)
60#define M_DMA_HWM_INT_EN _SB_MAKEMASK1(4)
61#define M_DMA_LWM_INT_EN _SB_MAKEMASK1(5)
62#define M_DMA_TBX_EN _SB_MAKEMASK1(6)
63#define M_DMA_TDX_EN _SB_MAKEMASK1(7)
64
65#define S_DMA_INT_PKTCNT _SB_MAKE64(8)
66#define M_DMA_INT_PKTCNT _SB_MAKEMASK(8, S_DMA_INT_PKTCNT)
67#define V_DMA_INT_PKTCNT(x) _SB_MAKEVALUE(x, S_DMA_INT_PKTCNT)
68#define G_DMA_INT_PKTCNT(x) _SB_GETVALUE(x, S_DMA_INT_PKTCNT, M_DMA_INT_PKTCNT)
69
70#define S_DMA_RINGSZ _SB_MAKE64(16)
71#define M_DMA_RINGSZ _SB_MAKEMASK(16, S_DMA_RINGSZ)
72#define V_DMA_RINGSZ(x) _SB_MAKEVALUE(x, S_DMA_RINGSZ)
73#define G_DMA_RINGSZ(x) _SB_GETVALUE(x, S_DMA_RINGSZ, M_DMA_RINGSZ)
74
75#define S_DMA_HIGH_WATERMARK _SB_MAKE64(32)
76#define M_DMA_HIGH_WATERMARK _SB_MAKEMASK(16, S_DMA_HIGH_WATERMARK)
77#define V_DMA_HIGH_WATERMARK(x) _SB_MAKEVALUE(x, S_DMA_HIGH_WATERMARK)
78#define G_DMA_HIGH_WATERMARK(x) _SB_GETVALUE(x, S_DMA_HIGH_WATERMARK, M_DMA_HIGH_WATERMARK)
79
80#define S_DMA_LOW_WATERMARK _SB_MAKE64(48)
81#define M_DMA_LOW_WATERMARK _SB_MAKEMASK(16, S_DMA_LOW_WATERMARK)
82#define V_DMA_LOW_WATERMARK(x) _SB_MAKEVALUE(x, S_DMA_LOW_WATERMARK)
83#define G_DMA_LOW_WATERMARK(x) _SB_GETVALUE(x, S_DMA_LOW_WATERMARK, M_DMA_LOW_WATERMARK)
84
85/*
86 * Ethernet and Serial DMA Configuration Register 1 (Table 7-5)
87 * Registers: DMA_CONFIG1_MAC_x_RX_CH_0
88 * Registers: DMA_CONFIG1_DMA_x_TX_CH_0
89 * Registers: DMA_CONFIG1_SER_x_RX
90 * Registers: DMA_CONFIG1_SER_x_TX
91 */
92
93#define M_DMA_HDR_CF_EN _SB_MAKEMASK1(0)
94#define M_DMA_ASIC_XFR_EN _SB_MAKEMASK1(1)
95#define M_DMA_PRE_ADDR_EN _SB_MAKEMASK1(2)
96#define M_DMA_FLOW_CTL_EN _SB_MAKEMASK1(3)
97#define M_DMA_NO_DSCR_UPDT _SB_MAKEMASK1(4)
98#define M_DMA_L2CA _SB_MAKEMASK1(5)
99
100#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
101#define M_DMA_RX_XTRA_STATUS _SB_MAKEMASK1(6)
102#define M_DMA_TX_CPU_PAUSE _SB_MAKEMASK1(6)
103#define M_DMA_TX_FC_PAUSE_EN _SB_MAKEMASK1(7)
104#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
105
106#define M_DMA_MBZ1 _SB_MAKEMASK(6, 15)
107
108#define S_DMA_HDR_SIZE _SB_MAKE64(21)
109#define M_DMA_HDR_SIZE _SB_MAKEMASK(9, S_DMA_HDR_SIZE)
110#define V_DMA_HDR_SIZE(x) _SB_MAKEVALUE(x, S_DMA_HDR_SIZE)
111#define G_DMA_HDR_SIZE(x) _SB_GETVALUE(x, S_DMA_HDR_SIZE, M_DMA_HDR_SIZE)
112
113#define M_DMA_MBZ2 _SB_MAKEMASK(5, 32)
114
115#define S_DMA_ASICXFR_SIZE _SB_MAKE64(37)
116#define M_DMA_ASICXFR_SIZE _SB_MAKEMASK(9, S_DMA_ASICXFR_SIZE)
117#define V_DMA_ASICXFR_SIZE(x) _SB_MAKEVALUE(x, S_DMA_ASICXFR_SIZE)
118#define G_DMA_ASICXFR_SIZE(x) _SB_GETVALUE(x, S_DMA_ASICXFR_SIZE, M_DMA_ASICXFR_SIZE)
119
120#define S_DMA_INT_TIMEOUT _SB_MAKE64(48)
121#define M_DMA_INT_TIMEOUT _SB_MAKEMASK(16, S_DMA_INT_TIMEOUT)
122#define V_DMA_INT_TIMEOUT(x) _SB_MAKEVALUE(x, S_DMA_INT_TIMEOUT)
123#define G_DMA_INT_TIMEOUT(x) _SB_GETVALUE(x, S_DMA_INT_TIMEOUT, M_DMA_INT_TIMEOUT)
124
125/*
126 * Ethernet and Serial DMA Descriptor base address (Table 7-6)
127 */
128
129#define M_DMA_DSCRBASE_MBZ _SB_MAKEMASK(4, 0)
130
131
132/*
133 * ASIC Mode Base Address (Table 7-7)
134 */
135
136#define M_DMA_ASIC_BASE_MBZ _SB_MAKEMASK(20, 0)
137
138/*
139 * DMA Descriptor Count Registers (Table 7-8)
140 */
141
142/* No bitfields */
143
144
145/*
146 * Current Descriptor Address Register (Table 7-11)
147 */
148
149#define S_DMA_CURDSCR_ADDR _SB_MAKE64(0)
150#define M_DMA_CURDSCR_ADDR _SB_MAKEMASK(40, S_DMA_CURDSCR_ADDR)
151#define S_DMA_CURDSCR_COUNT _SB_MAKE64(40)
152#define M_DMA_CURDSCR_COUNT _SB_MAKEMASK(16, S_DMA_CURDSCR_COUNT)
153
154#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
155#define M_DMA_TX_CH_PAUSE_ON _SB_MAKEMASK1(56)
156#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
157
158/*
159 * Receive Packet Drop Registers
160 */
161#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
162#define S_DMA_OODLOST_RX _SB_MAKE64(0)
163#define M_DMA_OODLOST_RX _SB_MAKEMASK(16, S_DMA_OODLOST_RX)
164#define G_DMA_OODLOST_RX(x) _SB_GETVALUE(x, S_DMA_OODLOST_RX, M_DMA_OODLOST_RX)
165
166#define S_DMA_EOP_COUNT_RX _SB_MAKE64(16)
167#define M_DMA_EOP_COUNT_RX _SB_MAKEMASK(8, S_DMA_EOP_COUNT_RX)
168#define G_DMA_EOP_COUNT_RX(x) _SB_GETVALUE(x, S_DMA_EOP_COUNT_RX, M_DMA_EOP_COUNT_RX)
169#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
170
171/* *********************************************************************
172 * DMA Descriptors
173 ********************************************************************* */
174
175/*
176 * Descriptor doubleword "A" (Table 7-12)
177 */
178
179#define S_DMA_DSCRA_OFFSET _SB_MAKE64(0)
180#define M_DMA_DSCRA_OFFSET _SB_MAKEMASK(5, S_DMA_DSCRA_OFFSET)
181#define V_DMA_DSCRA_OFFSET(x) _SB_MAKEVALUE(x, S_DMA_DSCRA_OFFSET)
182#define G_DMA_DSCRA_OFFSET(x) _SB_GETVALUE(x, S_DMA_DSCRA_OFFSET, M_DMA_DSCRA_OFFSET)
183
184/* Note: Don't shift the address over, just mask it with the mask below */
185#define S_DMA_DSCRA_A_ADDR _SB_MAKE64(5)
186#define M_DMA_DSCRA_A_ADDR _SB_MAKEMASK(35, S_DMA_DSCRA_A_ADDR)
187
188#define M_DMA_DSCRA_A_ADDR_OFFSET (M_DMA_DSCRA_OFFSET | M_DMA_DSCRA_A_ADDR)
189
190#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
191#define S_DMA_DSCRA_A_ADDR_UA _SB_MAKE64(0)
192#define M_DMA_DSCRA_A_ADDR_UA _SB_MAKEMASK(40, S_DMA_DSCRA_A_ADDR_UA)
193#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
194
195#define S_DMA_DSCRA_A_SIZE _SB_MAKE64(40)
196#define M_DMA_DSCRA_A_SIZE _SB_MAKEMASK(9, S_DMA_DSCRA_A_SIZE)
197#define V_DMA_DSCRA_A_SIZE(x) _SB_MAKEVALUE(x, S_DMA_DSCRA_A_SIZE)
198#define G_DMA_DSCRA_A_SIZE(x) _SB_GETVALUE(x, S_DMA_DSCRA_A_SIZE, M_DMA_DSCRA_A_SIZE)
199
200#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
201#define S_DMA_DSCRA_DSCR_CNT _SB_MAKE64(40)
202#define M_DMA_DSCRA_DSCR_CNT _SB_MAKEMASK(8, S_DMA_DSCRA_DSCR_CNT)
203#define G_DMA_DSCRA_DSCR_CNT(x) _SB_GETVALUE(x, S_DMA_DSCRA_DSCR_CNT, M_DMA_DSCRA_DSCR_CNT)
204#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
205
206#define M_DMA_DSCRA_INTERRUPT _SB_MAKEMASK1(49)
207#define M_DMA_DSCRA_OFFSETB _SB_MAKEMASK1(50)
208
209#define S_DMA_DSCRA_STATUS _SB_MAKE64(51)
210#define M_DMA_DSCRA_STATUS _SB_MAKEMASK(13, S_DMA_DSCRA_STATUS)
211#define V_DMA_DSCRA_STATUS(x) _SB_MAKEVALUE(x, S_DMA_DSCRA_STATUS)
212#define G_DMA_DSCRA_STATUS(x) _SB_GETVALUE(x, S_DMA_DSCRA_STATUS, M_DMA_DSCRA_STATUS)
213
214/*
215 * Descriptor doubleword "B" (Table 7-13)
216 */
217
218
219#define S_DMA_DSCRB_OPTIONS _SB_MAKE64(0)
220#define M_DMA_DSCRB_OPTIONS _SB_MAKEMASK(4, S_DMA_DSCRB_OPTIONS)
221#define V_DMA_DSCRB_OPTIONS(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_OPTIONS)
222#define G_DMA_DSCRB_OPTIONS(x) _SB_GETVALUE(x, S_DMA_DSCRB_OPTIONS, M_DMA_DSCRB_OPTIONS)
223
224#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
225#define S_DMA_DSCRB_A_SIZE _SB_MAKE64(8)
226#define M_DMA_DSCRB_A_SIZE _SB_MAKEMASK(14, S_DMA_DSCRB_A_SIZE)
227#define V_DMA_DSCRB_A_SIZE(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_A_SIZE)
228#define G_DMA_DSCRB_A_SIZE(x) _SB_GETVALUE(x, S_DMA_DSCRB_A_SIZE, M_DMA_DSCRB_A_SIZE)
229#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
230
231#define R_DMA_DSCRB_ADDR _SB_MAKE64(0x10)
232
233/* Note: Don't shift the address over, just mask it with the mask below */
234#define S_DMA_DSCRB_B_ADDR _SB_MAKE64(5)
235#define M_DMA_DSCRB_B_ADDR _SB_MAKEMASK(35, S_DMA_DSCRB_B_ADDR)
236
237#define S_DMA_DSCRB_B_SIZE _SB_MAKE64(40)
238#define M_DMA_DSCRB_B_SIZE _SB_MAKEMASK(9, S_DMA_DSCRB_B_SIZE)
239#define V_DMA_DSCRB_B_SIZE(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_B_SIZE)
240#define G_DMA_DSCRB_B_SIZE(x) _SB_GETVALUE(x, S_DMA_DSCRB_B_SIZE, M_DMA_DSCRB_B_SIZE)
241
242#define M_DMA_DSCRB_B_VALID _SB_MAKEMASK1(49)
243
244#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
245#define S_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKE64(48)
246#define M_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKEMASK(2, S_DMA_DSCRB_PKT_SIZE_MSB)
247#define V_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_PKT_SIZE_MSB)
248#define G_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_GETVALUE(x, S_DMA_DSCRB_PKT_SIZE_MSB, M_DMA_DSCRB_PKT_SIZE_MSB)
249#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
250
251#define S_DMA_DSCRB_PKT_SIZE _SB_MAKE64(50)
252#define M_DMA_DSCRB_PKT_SIZE _SB_MAKEMASK(14, S_DMA_DSCRB_PKT_SIZE)
253#define V_DMA_DSCRB_PKT_SIZE(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_PKT_SIZE)
254#define G_DMA_DSCRB_PKT_SIZE(x) _SB_GETVALUE(x, S_DMA_DSCRB_PKT_SIZE, M_DMA_DSCRB_PKT_SIZE)
255
256/*
257 * from pass2 some bits in dscr_b are also used for rx status
258 */
259#define S_DMA_DSCRB_STATUS _SB_MAKE64(0)
260#define M_DMA_DSCRB_STATUS _SB_MAKEMASK(1, S_DMA_DSCRB_STATUS)
261#define V_DMA_DSCRB_STATUS(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_STATUS)
262#define G_DMA_DSCRB_STATUS(x) _SB_GETVALUE(x, S_DMA_DSCRB_STATUS, M_DMA_DSCRB_STATUS)
263
264/*
265 * Ethernet Descriptor Status Bits (Table 7-15)
266 */
267
268#define M_DMA_ETHRX_BADIP4CS _SB_MAKEMASK1(51)
269#define M_DMA_ETHRX_DSCRERR _SB_MAKEMASK1(52)
270
271#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
272/* Note: This bit is in the DSCR_B options field */
273#define M_DMA_ETHRX_BADTCPCS _SB_MAKEMASK1(0)
274#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
275
276#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
277/* Note: These bits are in the DSCR_B options field */
278#define M_DMA_ETH_VLAN_FLAG _SB_MAKEMASK1(1)
279#define M_DMA_ETH_CRC_FLAG _SB_MAKEMASK1(2)
280#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
281
282#define S_DMA_ETHRX_RXCH 53
283#define M_DMA_ETHRX_RXCH _SB_MAKEMASK(2, S_DMA_ETHRX_RXCH)
284#define V_DMA_ETHRX_RXCH(x) _SB_MAKEVALUE(x, S_DMA_ETHRX_RXCH)
285#define G_DMA_ETHRX_RXCH(x) _SB_GETVALUE(x, S_DMA_ETHRX_RXCH, M_DMA_ETHRX_RXCH)
286
287#define S_DMA_ETHRX_PKTTYPE 55
288#define M_DMA_ETHRX_PKTTYPE _SB_MAKEMASK(3, S_DMA_ETHRX_PKTTYPE)
289#define V_DMA_ETHRX_PKTTYPE(x) _SB_MAKEVALUE(x, S_DMA_ETHRX_PKTTYPE)
290#define G_DMA_ETHRX_PKTTYPE(x) _SB_GETVALUE(x, S_DMA_ETHRX_PKTTYPE, M_DMA_ETHRX_PKTTYPE)
291
292#define K_DMA_ETHRX_PKTTYPE_IPV4 0
293#define K_DMA_ETHRX_PKTTYPE_ARPV4 1
294#define K_DMA_ETHRX_PKTTYPE_802 2
295#define K_DMA_ETHRX_PKTTYPE_OTHER 3
296#define K_DMA_ETHRX_PKTTYPE_USER0 4
297#define K_DMA_ETHRX_PKTTYPE_USER1 5
298#define K_DMA_ETHRX_PKTTYPE_USER2 6
299#define K_DMA_ETHRX_PKTTYPE_USER3 7
300
301#define M_DMA_ETHRX_MATCH_HASH _SB_MAKEMASK1(58)
302#define M_DMA_ETHRX_MATCH_EXACT _SB_MAKEMASK1(59)
303#define M_DMA_ETHRX_BCAST _SB_MAKEMASK1(60)
304#define M_DMA_ETHRX_MCAST _SB_MAKEMASK1(61)
305#define M_DMA_ETHRX_BAD _SB_MAKEMASK1(62)
306#define M_DMA_ETHRX_SOP _SB_MAKEMASK1(63)
307
308/*
309 * Ethernet Transmit Status Bits (Table 7-16)
310 */
311
312#define M_DMA_ETHTX_SOP _SB_MAKEMASK1(63)
313
314/*
315 * Ethernet Transmit Options (Table 7-17)
316 */
317
318#define K_DMA_ETHTX_NOTSOP _SB_MAKE64(0x00)
319#define K_DMA_ETHTX_APPENDCRC _SB_MAKE64(0x01)
320#define K_DMA_ETHTX_REPLACECRC _SB_MAKE64(0x02)
321#define K_DMA_ETHTX_APPENDCRC_APPENDPAD _SB_MAKE64(0x03)
322#define K_DMA_ETHTX_APPENDVLAN_REPLACECRC _SB_MAKE64(0x04)
323#define K_DMA_ETHTX_REMOVEVLAN_REPLACECRC _SB_MAKE64(0x05)
324#define K_DMA_ETHTX_REPLACEVLAN_REPLACECRC _SB_MAKE64(0x6)
325#define K_DMA_ETHTX_NOMODS _SB_MAKE64(0x07)
326#define K_DMA_ETHTX_RESERVED1 _SB_MAKE64(0x08)
327#define K_DMA_ETHTX_REPLACESADDR_APPENDCRC _SB_MAKE64(0x09)
328#define K_DMA_ETHTX_REPLACESADDR_REPLACECRC _SB_MAKE64(0x0A)
329#define K_DMA_ETHTX_REPLACESADDR_APPENDCRC_APPENDPAD _SB_MAKE64(0x0B)
330#define K_DMA_ETHTX_REPLACESADDR_APPENDVLAN_REPLACECRC _SB_MAKE64(0x0C)
331#define K_DMA_ETHTX_REPLACESADDR_REMOVEVLAN_REPLACECRC _SB_MAKE64(0x0D)
332#define K_DMA_ETHTX_REPLACESADDR_REPLACEVLAN_REPLACECRC _SB_MAKE64(0x0E)
333#define K_DMA_ETHTX_RESERVED2 _SB_MAKE64(0x0F)
334
335/*
336 * Serial Receive Options (Table 7-18)
337 */
338#define M_DMA_SERRX_CRC_ERROR _SB_MAKEMASK1(56)
339#define M_DMA_SERRX_ABORT _SB_MAKEMASK1(57)
340#define M_DMA_SERRX_OCTET_ERROR _SB_MAKEMASK1(58)
341#define M_DMA_SERRX_LONGFRAME_ERROR _SB_MAKEMASK1(59)
342#define M_DMA_SERRX_SHORTFRAME_ERROR _SB_MAKEMASK1(60)
343#define M_DMA_SERRX_OVERRUN_ERROR _SB_MAKEMASK1(61)
344#define M_DMA_SERRX_GOOD _SB_MAKEMASK1(62)
345#define M_DMA_SERRX_SOP _SB_MAKEMASK1(63)
346
347/*
348 * Serial Transmit Status Bits (Table 7-20)
349 */
350
351#define M_DMA_SERTX_FLAG _SB_MAKEMASK1(63)
352
353/*
354 * Serial Transmit Options (Table 7-21)
355 */
356
357#define K_DMA_SERTX_RESERVED _SB_MAKEMASK1(0)
358#define K_DMA_SERTX_APPENDCRC _SB_MAKEMASK1(1)
359#define K_DMA_SERTX_APPENDPAD _SB_MAKEMASK1(2)
360#define K_DMA_SERTX_ABORT _SB_MAKEMASK1(3)
361
362
363/* *********************************************************************
364 * Data Mover Registers
365 ********************************************************************* */
366
367/*
368 * Data Mover Descriptor Base Address Register (Table 7-22)
369 * Register: DM_DSCR_BASE_0
370 * Register: DM_DSCR_BASE_1
371 * Register: DM_DSCR_BASE_2
372 * Register: DM_DSCR_BASE_3
373 */
374
375#define M_DM_DSCR_BASE_MBZ _SB_MAKEMASK(4, 0)
376
377/* Note: Just mask the base address and then OR it in. */
378#define S_DM_DSCR_BASE_ADDR _SB_MAKE64(4)
379#define M_DM_DSCR_BASE_ADDR _SB_MAKEMASK(36, S_DM_DSCR_BASE_ADDR)
380
381#define S_DM_DSCR_BASE_RINGSZ _SB_MAKE64(40)
382#define M_DM_DSCR_BASE_RINGSZ _SB_MAKEMASK(16, S_DM_DSCR_BASE_RINGSZ)
383#define V_DM_DSCR_BASE_RINGSZ(x) _SB_MAKEVALUE(x, S_DM_DSCR_BASE_RINGSZ)
384#define G_DM_DSCR_BASE_RINGSZ(x) _SB_GETVALUE(x, S_DM_DSCR_BASE_RINGSZ, M_DM_DSCR_BASE_RINGSZ)
385
386#define S_DM_DSCR_BASE_PRIORITY _SB_MAKE64(56)
387#define M_DM_DSCR_BASE_PRIORITY _SB_MAKEMASK(3, S_DM_DSCR_BASE_PRIORITY)
388#define V_DM_DSCR_BASE_PRIORITY(x) _SB_MAKEVALUE(x, S_DM_DSCR_BASE_PRIORITY)
389#define G_DM_DSCR_BASE_PRIORITY(x) _SB_GETVALUE(x, S_DM_DSCR_BASE_PRIORITY, M_DM_DSCR_BASE_PRIORITY)
390
391#define K_DM_DSCR_BASE_PRIORITY_1 0
392#define K_DM_DSCR_BASE_PRIORITY_2 1
393#define K_DM_DSCR_BASE_PRIORITY_4 2
394#define K_DM_DSCR_BASE_PRIORITY_8 3
395#define K_DM_DSCR_BASE_PRIORITY_16 4
396
397#define M_DM_DSCR_BASE_ACTIVE _SB_MAKEMASK1(59)
398#define M_DM_DSCR_BASE_INTERRUPT _SB_MAKEMASK1(60)
399#define M_DM_DSCR_BASE_RESET _SB_MAKEMASK1(61) /* write register */
400#define M_DM_DSCR_BASE_ERROR _SB_MAKEMASK1(61) /* read register */
401#define M_DM_DSCR_BASE_ABORT _SB_MAKEMASK1(62)
402#define M_DM_DSCR_BASE_ENABL _SB_MAKEMASK1(63)
403
404/*
405 * Data Mover Descriptor Count Register (Table 7-25)
406 */
407
408/* no bitfields */
409
410/*
411 * Data Mover Current Descriptor Address (Table 7-24)
412 * Register: DM_CUR_DSCR_ADDR_0
413 * Register: DM_CUR_DSCR_ADDR_1
414 * Register: DM_CUR_DSCR_ADDR_2
415 * Register: DM_CUR_DSCR_ADDR_3
416 */
417
418#define S_DM_CUR_DSCR_DSCR_ADDR _SB_MAKE64(0)
419#define M_DM_CUR_DSCR_DSCR_ADDR _SB_MAKEMASK(40, S_DM_CUR_DSCR_DSCR_ADDR)
420
421#define S_DM_CUR_DSCR_DSCR_COUNT _SB_MAKE64(48)
422#define M_DM_CUR_DSCR_DSCR_COUNT _SB_MAKEMASK(16, S_DM_CUR_DSCR_DSCR_COUNT)
423#define V_DM_CUR_DSCR_DSCR_COUNT(r) _SB_MAKEVALUE(r, S_DM_CUR_DSCR_DSCR_COUNT)
424#define G_DM_CUR_DSCR_DSCR_COUNT(r) _SB_GETVALUE(r, S_DM_CUR_DSCR_DSCR_COUNT,\
425 M_DM_CUR_DSCR_DSCR_COUNT)
426
427
428#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
429/*
430 * Data Mover Channel Partial Result Registers
431 * Register: DM_PARTIAL_0
432 * Register: DM_PARTIAL_1
433 * Register: DM_PARTIAL_2
434 * Register: DM_PARTIAL_3
435 */
436#define S_DM_PARTIAL_CRC_PARTIAL _SB_MAKE64(0)
437#define M_DM_PARTIAL_CRC_PARTIAL _SB_MAKEMASK(32, S_DM_PARTIAL_CRC_PARTIAL)
438#define V_DM_PARTIAL_CRC_PARTIAL(r) _SB_MAKEVALUE(r, S_DM_PARTIAL_CRC_PARTIAL)
439#define G_DM_PARTIAL_CRC_PARTIAL(r) _SB_GETVALUE(r, S_DM_PARTIAL_CRC_PARTIAL,\
440 M_DM_PARTIAL_CRC_PARTIAL)
441
442#define S_DM_PARTIAL_TCPCS_PARTIAL _SB_MAKE64(32)
443#define M_DM_PARTIAL_TCPCS_PARTIAL _SB_MAKEMASK(16, S_DM_PARTIAL_TCPCS_PARTIAL)
444#define V_DM_PARTIAL_TCPCS_PARTIAL(r) _SB_MAKEVALUE(r, S_DM_PARTIAL_TCPCS_PARTIAL)
445#define G_DM_PARTIAL_TCPCS_PARTIAL(r) _SB_GETVALUE(r, S_DM_PARTIAL_TCPCS_PARTIAL,\
446 M_DM_PARTIAL_TCPCS_PARTIAL)
447
448#define M_DM_PARTIAL_ODD_BYTE _SB_MAKEMASK1(48)
449#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
450
451
452#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
453/*
454 * Data Mover CRC Definition Registers
455 * Register: CRC_DEF_0
456 * Register: CRC_DEF_1
457 */
458#define S_CRC_DEF_CRC_INIT _SB_MAKE64(0)
459#define M_CRC_DEF_CRC_INIT _SB_MAKEMASK(32, S_CRC_DEF_CRC_INIT)
460#define V_CRC_DEF_CRC_INIT(r) _SB_MAKEVALUE(r, S_CRC_DEF_CRC_INIT)
461#define G_CRC_DEF_CRC_INIT(r) _SB_GETVALUE(r, S_CRC_DEF_CRC_INIT,\
462 M_CRC_DEF_CRC_INIT)
463
464#define S_CRC_DEF_CRC_POLY _SB_MAKE64(32)
465#define M_CRC_DEF_CRC_POLY _SB_MAKEMASK(32, S_CRC_DEF_CRC_POLY)
466#define V_CRC_DEF_CRC_POLY(r) _SB_MAKEVALUE(r, S_CRC_DEF_CRC_POLY)
467#define G_CRC_DEF_CRC_POLY(r) _SB_GETVALUE(r, S_CRC_DEF_CRC_POLY,\
468 M_CRC_DEF_CRC_POLY)
469#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
470
471
472#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
473/*
474 * Data Mover CRC/Checksum Definition Registers
475 * Register: CTCP_DEF_0
476 * Register: CTCP_DEF_1
477 */
478#define S_CTCP_DEF_CRC_TXOR _SB_MAKE64(0)
479#define M_CTCP_DEF_CRC_TXOR _SB_MAKEMASK(32, S_CTCP_DEF_CRC_TXOR)
480#define V_CTCP_DEF_CRC_TXOR(r) _SB_MAKEVALUE(r, S_CTCP_DEF_CRC_TXOR)
481#define G_CTCP_DEF_CRC_TXOR(r) _SB_GETVALUE(r, S_CTCP_DEF_CRC_TXOR,\
482 M_CTCP_DEF_CRC_TXOR)
483
484#define S_CTCP_DEF_TCPCS_INIT _SB_MAKE64(32)
485#define M_CTCP_DEF_TCPCS_INIT _SB_MAKEMASK(16, S_CTCP_DEF_TCPCS_INIT)
486#define V_CTCP_DEF_TCPCS_INIT(r) _SB_MAKEVALUE(r, S_CTCP_DEF_TCPCS_INIT)
487#define G_CTCP_DEF_TCPCS_INIT(r) _SB_GETVALUE(r, S_CTCP_DEF_TCPCS_INIT,\
488 M_CTCP_DEF_TCPCS_INIT)
489
490#define S_CTCP_DEF_CRC_WIDTH _SB_MAKE64(48)
491#define M_CTCP_DEF_CRC_WIDTH _SB_MAKEMASK(2, S_CTCP_DEF_CRC_WIDTH)
492#define V_CTCP_DEF_CRC_WIDTH(r) _SB_MAKEVALUE(r, S_CTCP_DEF_CRC_WIDTH)
493#define G_CTCP_DEF_CRC_WIDTH(r) _SB_GETVALUE(r, S_CTCP_DEF_CRC_WIDTH,\
494 M_CTCP_DEF_CRC_WIDTH)
495
496#define K_CTCP_DEF_CRC_WIDTH_4 0
497#define K_CTCP_DEF_CRC_WIDTH_2 1
498#define K_CTCP_DEF_CRC_WIDTH_1 2
499
500#define M_CTCP_DEF_CRC_BIT_ORDER _SB_MAKEMASK1(50)
501#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
502
503
504/*
505 * Data Mover Descriptor Doubleword "A" (Table 7-26)
506 */
507
508#define S_DM_DSCRA_DST_ADDR _SB_MAKE64(0)
509#define M_DM_DSCRA_DST_ADDR _SB_MAKEMASK(40, S_DM_DSCRA_DST_ADDR)
510
511#define M_DM_DSCRA_UN_DEST _SB_MAKEMASK1(40)
512#define M_DM_DSCRA_UN_SRC _SB_MAKEMASK1(41)
513#define M_DM_DSCRA_INTERRUPT _SB_MAKEMASK1(42)
514#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
515#define M_DM_DSCRA_THROTTLE _SB_MAKEMASK1(43)
516#endif /* up to 1250 PASS1 */
517
518#define S_DM_DSCRA_DIR_DEST _SB_MAKE64(44)
519#define M_DM_DSCRA_DIR_DEST _SB_MAKEMASK(2, S_DM_DSCRA_DIR_DEST)
520#define V_DM_DSCRA_DIR_DEST(x) _SB_MAKEVALUE(x, S_DM_DSCRA_DIR_DEST)
521#define G_DM_DSCRA_DIR_DEST(x) _SB_GETVALUE(x, S_DM_DSCRA_DIR_DEST, M_DM_DSCRA_DIR_DEST)
522
523#define K_DM_DSCRA_DIR_DEST_INCR 0
524#define K_DM_DSCRA_DIR_DEST_DECR 1
525#define K_DM_DSCRA_DIR_DEST_CONST 2
526
527#define V_DM_DSCRA_DIR_DEST_INCR _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_INCR, S_DM_DSCRA_DIR_DEST)
528#define V_DM_DSCRA_DIR_DEST_DECR _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_DECR, S_DM_DSCRA_DIR_DEST)
529#define V_DM_DSCRA_DIR_DEST_CONST _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_CONST, S_DM_DSCRA_DIR_DEST)
530
531#define S_DM_DSCRA_DIR_SRC _SB_MAKE64(46)
532#define M_DM_DSCRA_DIR_SRC _SB_MAKEMASK(2, S_DM_DSCRA_DIR_SRC)
533#define V_DM_DSCRA_DIR_SRC(x) _SB_MAKEVALUE(x, S_DM_DSCRA_DIR_SRC)
534#define G_DM_DSCRA_DIR_SRC(x) _SB_GETVALUE(x, S_DM_DSCRA_DIR_SRC, M_DM_DSCRA_DIR_SRC)
535
536#define K_DM_DSCRA_DIR_SRC_INCR 0
537#define K_DM_DSCRA_DIR_SRC_DECR 1
538#define K_DM_DSCRA_DIR_SRC_CONST 2
539
540#define V_DM_DSCRA_DIR_SRC_INCR _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_INCR, S_DM_DSCRA_DIR_SRC)
541#define V_DM_DSCRA_DIR_SRC_DECR _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_DECR, S_DM_DSCRA_DIR_SRC)
542#define V_DM_DSCRA_DIR_SRC_CONST _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_CONST, S_DM_DSCRA_DIR_SRC)
543
544
545#define M_DM_DSCRA_ZERO_MEM _SB_MAKEMASK1(48)
546#define M_DM_DSCRA_PREFETCH _SB_MAKEMASK1(49)
547#define M_DM_DSCRA_L2C_DEST _SB_MAKEMASK1(50)
548#define M_DM_DSCRA_L2C_SRC _SB_MAKEMASK1(51)
549
550#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
551#define M_DM_DSCRA_RD_BKOFF _SB_MAKEMASK1(52)
552#define M_DM_DSCRA_WR_BKOFF _SB_MAKEMASK1(53)
553#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
554
555#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
556#define M_DM_DSCRA_TCPCS_EN _SB_MAKEMASK1(54)
557#define M_DM_DSCRA_TCPCS_RES _SB_MAKEMASK1(55)
558#define M_DM_DSCRA_TCPCS_AP _SB_MAKEMASK1(56)
559#define M_DM_DSCRA_CRC_EN _SB_MAKEMASK1(57)
560#define M_DM_DSCRA_CRC_RES _SB_MAKEMASK1(58)
561#define M_DM_DSCRA_CRC_AP _SB_MAKEMASK1(59)
562#define M_DM_DSCRA_CRC_DFN _SB_MAKEMASK1(60)
563#define M_DM_DSCRA_CRC_XBIT _SB_MAKEMASK1(61)
564#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
565
566#define M_DM_DSCRA_RESERVED2 _SB_MAKEMASK(3, 61)
567
568/*
569 * Data Mover Descriptor Doubleword "B" (Table 7-25)
570 */
571
572#define S_DM_DSCRB_SRC_ADDR _SB_MAKE64(0)
573#define M_DM_DSCRB_SRC_ADDR _SB_MAKEMASK(40, S_DM_DSCRB_SRC_ADDR)
574
575#define S_DM_DSCRB_SRC_LENGTH _SB_MAKE64(40)
576#define M_DM_DSCRB_SRC_LENGTH _SB_MAKEMASK(20, S_DM_DSCRB_SRC_LENGTH)
577#define V_DM_DSCRB_SRC_LENGTH(x) _SB_MAKEVALUE(x, S_DM_DSCRB_SRC_LENGTH)
578#define G_DM_DSCRB_SRC_LENGTH(x) _SB_GETVALUE(x, S_DM_DSCRB_SRC_LENGTH, M_DM_DSCRB_SRC_LENGTH)
579
580
581#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_genbus.h b/arch/mips/include/asm/sibyte/sb1250_genbus.h
new file mode 100644
index 000000000..ddeb8edf5
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_genbus.h
@@ -0,0 +1,461 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * Generic Bus Constants File: sb1250_genbus.h
6 *
7 * This module contains constants and macros useful for
8 * manipulating the SB1250's Generic Bus interface
9 *
10 * SB1250 specification level: User's manual 10/21/02
11 * BCM1280 specification level: User's Manual 11/14/03
12 *
13 *********************************************************************
14 *
15 * Copyright 2000, 2001, 2002, 2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 ********************************************************************* */
19
20
21#ifndef _SB1250_GENBUS_H
22#define _SB1250_GENBUS_H
23
24#include <asm/sibyte/sb1250_defs.h>
25
26/*
27 * Generic Bus Region Configuration Registers (Table 11-4)
28 */
29
30#define S_IO_RDY_ACTIVE 0
31#define M_IO_RDY_ACTIVE _SB_MAKEMASK1(S_IO_RDY_ACTIVE)
32
33#define S_IO_ENA_RDY 1
34#define M_IO_ENA_RDY _SB_MAKEMASK1(S_IO_ENA_RDY)
35
36#define S_IO_WIDTH_SEL 2
37#define M_IO_WIDTH_SEL _SB_MAKEMASK(2, S_IO_WIDTH_SEL)
38#define K_IO_WIDTH_SEL_1 0
39#define K_IO_WIDTH_SEL_2 1
40#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
41 || SIBYTE_HDR_FEATURE_CHIP(1480)
42#define K_IO_WIDTH_SEL_1L 2
43#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
44#define K_IO_WIDTH_SEL_4 3
45#define V_IO_WIDTH_SEL(x) _SB_MAKEVALUE(x, S_IO_WIDTH_SEL)
46#define G_IO_WIDTH_SEL(x) _SB_GETVALUE(x, S_IO_WIDTH_SEL, M_IO_WIDTH_SEL)
47
48#define S_IO_PARITY_ENA 4
49#define M_IO_PARITY_ENA _SB_MAKEMASK1(S_IO_PARITY_ENA)
50#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
51 || SIBYTE_HDR_FEATURE_CHIP(1480)
52#define S_IO_BURST_EN 5
53#define M_IO_BURST_EN _SB_MAKEMASK1(S_IO_BURST_EN)
54#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
55#define S_IO_PARITY_ODD 6
56#define M_IO_PARITY_ODD _SB_MAKEMASK1(S_IO_PARITY_ODD)
57#define S_IO_NONMUX 7
58#define M_IO_NONMUX _SB_MAKEMASK1(S_IO_NONMUX)
59
60#define S_IO_TIMEOUT 8
61#define M_IO_TIMEOUT _SB_MAKEMASK(8, S_IO_TIMEOUT)
62#define V_IO_TIMEOUT(x) _SB_MAKEVALUE(x, S_IO_TIMEOUT)
63#define G_IO_TIMEOUT(x) _SB_GETVALUE(x, S_IO_TIMEOUT, M_IO_TIMEOUT)
64
65/*
66 * Generic Bus Region Size register (Table 11-5)
67 */
68
69#define S_IO_MULT_SIZE 0
70#define M_IO_MULT_SIZE _SB_MAKEMASK(12, S_IO_MULT_SIZE)
71#define V_IO_MULT_SIZE(x) _SB_MAKEVALUE(x, S_IO_MULT_SIZE)
72#define G_IO_MULT_SIZE(x) _SB_GETVALUE(x, S_IO_MULT_SIZE, M_IO_MULT_SIZE)
73
74#define S_IO_REGSIZE 16 /* # bits to shift size for this reg */
75
76/*
77 * Generic Bus Region Address (Table 11-6)
78 */
79
80#define S_IO_START_ADDR 0
81#define M_IO_START_ADDR _SB_MAKEMASK(14, S_IO_START_ADDR)
82#define V_IO_START_ADDR(x) _SB_MAKEVALUE(x, S_IO_START_ADDR)
83#define G_IO_START_ADDR(x) _SB_GETVALUE(x, S_IO_START_ADDR, M_IO_START_ADDR)
84
85#define S_IO_ADDRBASE 16 /* # bits to shift addr for this reg */
86
87#define M_IO_BLK_CACHE _SB_MAKEMASK1(15)
88
89
90/*
91 * Generic Bus Timing 0 Registers (Table 11-7)
92 */
93
94#define S_IO_ALE_WIDTH 0
95#define M_IO_ALE_WIDTH _SB_MAKEMASK(3, S_IO_ALE_WIDTH)
96#define V_IO_ALE_WIDTH(x) _SB_MAKEVALUE(x, S_IO_ALE_WIDTH)
97#define G_IO_ALE_WIDTH(x) _SB_GETVALUE(x, S_IO_ALE_WIDTH, M_IO_ALE_WIDTH)
98
99#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
100 || SIBYTE_HDR_FEATURE_CHIP(1480)
101#define M_IO_EARLY_CS _SB_MAKEMASK1(3)
102#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
103
104#define S_IO_ALE_TO_CS 4
105#define M_IO_ALE_TO_CS _SB_MAKEMASK(2, S_IO_ALE_TO_CS)
106#define V_IO_ALE_TO_CS(x) _SB_MAKEVALUE(x, S_IO_ALE_TO_CS)
107#define G_IO_ALE_TO_CS(x) _SB_GETVALUE(x, S_IO_ALE_TO_CS, M_IO_ALE_TO_CS)
108
109#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
110 || SIBYTE_HDR_FEATURE_CHIP(1480)
111#define S_IO_BURST_WIDTH _SB_MAKE64(6)
112#define M_IO_BURST_WIDTH _SB_MAKEMASK(2, S_IO_BURST_WIDTH)
113#define V_IO_BURST_WIDTH(x) _SB_MAKEVALUE(x, S_IO_BURST_WIDTH)
114#define G_IO_BURST_WIDTH(x) _SB_GETVALUE(x, S_IO_BURST_WIDTH, M_IO_BURST_WIDTH)
115#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
116
117#define S_IO_CS_WIDTH 8
118#define M_IO_CS_WIDTH _SB_MAKEMASK(5, S_IO_CS_WIDTH)
119#define V_IO_CS_WIDTH(x) _SB_MAKEVALUE(x, S_IO_CS_WIDTH)
120#define G_IO_CS_WIDTH(x) _SB_GETVALUE(x, S_IO_CS_WIDTH, M_IO_CS_WIDTH)
121
122#define S_IO_RDY_SMPLE 13
123#define M_IO_RDY_SMPLE _SB_MAKEMASK(3, S_IO_RDY_SMPLE)
124#define V_IO_RDY_SMPLE(x) _SB_MAKEVALUE(x, S_IO_RDY_SMPLE)
125#define G_IO_RDY_SMPLE(x) _SB_GETVALUE(x, S_IO_RDY_SMPLE, M_IO_RDY_SMPLE)
126
127
128/*
129 * Generic Bus Timing 1 Registers (Table 11-8)
130 */
131
132#define S_IO_ALE_TO_WRITE 0
133#define M_IO_ALE_TO_WRITE _SB_MAKEMASK(3, S_IO_ALE_TO_WRITE)
134#define V_IO_ALE_TO_WRITE(x) _SB_MAKEVALUE(x, S_IO_ALE_TO_WRITE)
135#define G_IO_ALE_TO_WRITE(x) _SB_GETVALUE(x, S_IO_ALE_TO_WRITE, M_IO_ALE_TO_WRITE)
136
137#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
138 || SIBYTE_HDR_FEATURE_CHIP(1480)
139#define M_IO_RDY_SYNC _SB_MAKEMASK1(3)
140#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
141
142#define S_IO_WRITE_WIDTH 4
143#define M_IO_WRITE_WIDTH _SB_MAKEMASK(4, S_IO_WRITE_WIDTH)
144#define V_IO_WRITE_WIDTH(x) _SB_MAKEVALUE(x, S_IO_WRITE_WIDTH)
145#define G_IO_WRITE_WIDTH(x) _SB_GETVALUE(x, S_IO_WRITE_WIDTH, M_IO_WRITE_WIDTH)
146
147#define S_IO_IDLE_CYCLE 8
148#define M_IO_IDLE_CYCLE _SB_MAKEMASK(4, S_IO_IDLE_CYCLE)
149#define V_IO_IDLE_CYCLE(x) _SB_MAKEVALUE(x, S_IO_IDLE_CYCLE)
150#define G_IO_IDLE_CYCLE(x) _SB_GETVALUE(x, S_IO_IDLE_CYCLE, M_IO_IDLE_CYCLE)
151
152#define S_IO_OE_TO_CS 12
153#define M_IO_OE_TO_CS _SB_MAKEMASK(2, S_IO_OE_TO_CS)
154#define V_IO_OE_TO_CS(x) _SB_MAKEVALUE(x, S_IO_OE_TO_CS)
155#define G_IO_OE_TO_CS(x) _SB_GETVALUE(x, S_IO_OE_TO_CS, M_IO_OE_TO_CS)
156
157#define S_IO_CS_TO_OE 14
158#define M_IO_CS_TO_OE _SB_MAKEMASK(2, S_IO_CS_TO_OE)
159#define V_IO_CS_TO_OE(x) _SB_MAKEVALUE(x, S_IO_CS_TO_OE)
160#define G_IO_CS_TO_OE(x) _SB_GETVALUE(x, S_IO_CS_TO_OE, M_IO_CS_TO_OE)
161
162/*
163 * Generic Bus Interrupt Status Register (Table 11-9)
164 */
165
166#define M_IO_CS_ERR_INT _SB_MAKEMASK(0, 8)
167#define M_IO_CS0_ERR_INT _SB_MAKEMASK1(0)
168#define M_IO_CS1_ERR_INT _SB_MAKEMASK1(1)
169#define M_IO_CS2_ERR_INT _SB_MAKEMASK1(2)
170#define M_IO_CS3_ERR_INT _SB_MAKEMASK1(3)
171#define M_IO_CS4_ERR_INT _SB_MAKEMASK1(4)
172#define M_IO_CS5_ERR_INT _SB_MAKEMASK1(5)
173#define M_IO_CS6_ERR_INT _SB_MAKEMASK1(6)
174#define M_IO_CS7_ERR_INT _SB_MAKEMASK1(7)
175
176#define M_IO_RD_PAR_INT _SB_MAKEMASK1(9)
177#define M_IO_TIMEOUT_INT _SB_MAKEMASK1(10)
178#define M_IO_ILL_ADDR_INT _SB_MAKEMASK1(11)
179#define M_IO_MULT_CS_INT _SB_MAKEMASK1(12)
180#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
181#define M_IO_COH_ERR _SB_MAKEMASK1(14)
182#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
183
184
185/*
186 * Generic Bus Output Drive Control Register 0 (Table 14-18)
187 */
188
189#define S_IO_SLEW0 0
190#define M_IO_SLEW0 _SB_MAKEMASK(2, S_IO_SLEW0)
191#define V_IO_SLEW0(x) _SB_MAKEVALUE(x, S_IO_SLEW0)
192#define G_IO_SLEW0(x) _SB_GETVALUE(x, S_IO_SLEW0, M_IO_SLEW0)
193
194#define S_IO_DRV_A 2
195#define M_IO_DRV_A _SB_MAKEMASK(2, S_IO_DRV_A)
196#define V_IO_DRV_A(x) _SB_MAKEVALUE(x, S_IO_DRV_A)
197#define G_IO_DRV_A(x) _SB_GETVALUE(x, S_IO_DRV_A, M_IO_DRV_A)
198
199#define S_IO_DRV_B 6
200#define M_IO_DRV_B _SB_MAKEMASK(2, S_IO_DRV_B)
201#define V_IO_DRV_B(x) _SB_MAKEVALUE(x, S_IO_DRV_B)
202#define G_IO_DRV_B(x) _SB_GETVALUE(x, S_IO_DRV_B, M_IO_DRV_B)
203
204#define S_IO_DRV_C 10
205#define M_IO_DRV_C _SB_MAKEMASK(2, S_IO_DRV_C)
206#define V_IO_DRV_C(x) _SB_MAKEVALUE(x, S_IO_DRV_C)
207#define G_IO_DRV_C(x) _SB_GETVALUE(x, S_IO_DRV_C, M_IO_DRV_C)
208
209#define S_IO_DRV_D 14
210#define M_IO_DRV_D _SB_MAKEMASK(2, S_IO_DRV_D)
211#define V_IO_DRV_D(x) _SB_MAKEVALUE(x, S_IO_DRV_D)
212#define G_IO_DRV_D(x) _SB_GETVALUE(x, S_IO_DRV_D, M_IO_DRV_D)
213
214/*
215 * Generic Bus Output Drive Control Register 1 (Table 14-19)
216 */
217
218#define S_IO_DRV_E 2
219#define M_IO_DRV_E _SB_MAKEMASK(2, S_IO_DRV_E)
220#define V_IO_DRV_E(x) _SB_MAKEVALUE(x, S_IO_DRV_E)
221#define G_IO_DRV_E(x) _SB_GETVALUE(x, S_IO_DRV_E, M_IO_DRV_E)
222
223#define S_IO_DRV_F 6
224#define M_IO_DRV_F _SB_MAKEMASK(2, S_IO_DRV_F)
225#define V_IO_DRV_F(x) _SB_MAKEVALUE(x, S_IO_DRV_F)
226#define G_IO_DRV_F(x) _SB_GETVALUE(x, S_IO_DRV_F, M_IO_DRV_F)
227
228#define S_IO_SLEW1 8
229#define M_IO_SLEW1 _SB_MAKEMASK(2, S_IO_SLEW1)
230#define V_IO_SLEW1(x) _SB_MAKEVALUE(x, S_IO_SLEW1)
231#define G_IO_SLEW1(x) _SB_GETVALUE(x, S_IO_SLEW1, M_IO_SLEW1)
232
233#define S_IO_DRV_G 10
234#define M_IO_DRV_G _SB_MAKEMASK(2, S_IO_DRV_G)
235#define V_IO_DRV_G(x) _SB_MAKEVALUE(x, S_IO_DRV_G)
236#define G_IO_DRV_G(x) _SB_GETVALUE(x, S_IO_DRV_G, M_IO_DRV_G)
237
238#define S_IO_SLEW2 12
239#define M_IO_SLEW2 _SB_MAKEMASK(2, S_IO_SLEW2)
240#define V_IO_SLEW2(x) _SB_MAKEVALUE(x, S_IO_SLEW2)
241#define G_IO_SLEW2(x) _SB_GETVALUE(x, S_IO_SLEW2, M_IO_SLEW2)
242
243#define S_IO_DRV_H 14
244#define M_IO_DRV_H _SB_MAKEMASK(2, S_IO_DRV_H)
245#define V_IO_DRV_H(x) _SB_MAKEVALUE(x, S_IO_DRV_H)
246#define G_IO_DRV_H(x) _SB_GETVALUE(x, S_IO_DRV_H, M_IO_DRV_H)
247
248/*
249 * Generic Bus Output Drive Control Register 2 (Table 14-20)
250 */
251
252#define S_IO_DRV_J 2
253#define M_IO_DRV_J _SB_MAKEMASK(2, S_IO_DRV_J)
254#define V_IO_DRV_J(x) _SB_MAKEVALUE(x, S_IO_DRV_J)
255#define G_IO_DRV_J(x) _SB_GETVALUE(x, S_IO_DRV_J, M_IO_DRV_J)
256
257#define S_IO_DRV_K 6
258#define M_IO_DRV_K _SB_MAKEMASK(2, S_IO_DRV_K)
259#define V_IO_DRV_K(x) _SB_MAKEVALUE(x, S_IO_DRV_K)
260#define G_IO_DRV_K(x) _SB_GETVALUE(x, S_IO_DRV_K, M_IO_DRV_K)
261
262#define S_IO_DRV_L 10
263#define M_IO_DRV_L _SB_MAKEMASK(2, S_IO_DRV_L)
264#define V_IO_DRV_L(x) _SB_MAKEVALUE(x, S_IO_DRV_L)
265#define G_IO_DRV_L(x) _SB_GETVALUE(x, S_IO_DRV_L, M_IO_DRV_L)
266
267#define S_IO_DRV_M 14
268#define M_IO_DRV_M _SB_MAKEMASK(2, S_IO_DRV_M)
269#define V_IO_DRV_M(x) _SB_MAKEVALUE(x, S_IO_DRV_M)
270#define G_IO_DRV_M(x) _SB_GETVALUE(x, S_IO_DRV_M, M_IO_DRV_M)
271
272/*
273 * Generic Bus Output Drive Control Register 3 (Table 14-21)
274 */
275
276#define S_IO_SLEW3 0
277#define M_IO_SLEW3 _SB_MAKEMASK(2, S_IO_SLEW3)
278#define V_IO_SLEW3(x) _SB_MAKEVALUE(x, S_IO_SLEW3)
279#define G_IO_SLEW3(x) _SB_GETVALUE(x, S_IO_SLEW3, M_IO_SLEW3)
280
281#define S_IO_DRV_N 2
282#define M_IO_DRV_N _SB_MAKEMASK(2, S_IO_DRV_N)
283#define V_IO_DRV_N(x) _SB_MAKEVALUE(x, S_IO_DRV_N)
284#define G_IO_DRV_N(x) _SB_GETVALUE(x, S_IO_DRV_N, M_IO_DRV_N)
285
286#define S_IO_DRV_P 6
287#define M_IO_DRV_P _SB_MAKEMASK(2, S_IO_DRV_P)
288#define V_IO_DRV_P(x) _SB_MAKEVALUE(x, S_IO_DRV_P)
289#define G_IO_DRV_P(x) _SB_GETVALUE(x, S_IO_DRV_P, M_IO_DRV_P)
290
291#define S_IO_DRV_Q 10
292#define M_IO_DRV_Q _SB_MAKEMASK(2, S_IO_DRV_Q)
293#define V_IO_DRV_Q(x) _SB_MAKEVALUE(x, S_IO_DRV_Q)
294#define G_IO_DRV_Q(x) _SB_GETVALUE(x, S_IO_DRV_Q, M_IO_DRV_Q)
295
296#define S_IO_DRV_R 14
297#define M_IO_DRV_R _SB_MAKEMASK(2, S_IO_DRV_R)
298#define V_IO_DRV_R(x) _SB_MAKEVALUE(x, S_IO_DRV_R)
299#define G_IO_DRV_R(x) _SB_GETVALUE(x, S_IO_DRV_R, M_IO_DRV_R)
300
301
302/*
303 * PCMCIA configuration register (Table 12-6)
304 */
305
306#define M_PCMCIA_CFG_ATTRMEM _SB_MAKEMASK1(0)
307#define M_PCMCIA_CFG_3VEN _SB_MAKEMASK1(1)
308#define M_PCMCIA_CFG_5VEN _SB_MAKEMASK1(2)
309#define M_PCMCIA_CFG_VPPEN _SB_MAKEMASK1(3)
310#define M_PCMCIA_CFG_RESET _SB_MAKEMASK1(4)
311#define M_PCMCIA_CFG_APWRONEN _SB_MAKEMASK1(5)
312#define M_PCMCIA_CFG_CDMASK _SB_MAKEMASK1(6)
313#define M_PCMCIA_CFG_WPMASK _SB_MAKEMASK1(7)
314#define M_PCMCIA_CFG_RDYMASK _SB_MAKEMASK1(8)
315#define M_PCMCIA_CFG_PWRCTL _SB_MAKEMASK1(9)
316
317#if SIBYTE_HDR_FEATURE_CHIP(1480)
318#define S_PCMCIA_MODE 16
319#define M_PCMCIA_MODE _SB_MAKEMASK(3, S_PCMCIA_MODE)
320#define V_PCMCIA_MODE(x) _SB_MAKEVALUE(x, S_PCMCIA_MODE)
321#define G_PCMCIA_MODE(x) _SB_GETVALUE(x, S_PCMCIA_MODE, M_PCMCIA_MODE)
322
323#define K_PCMCIA_MODE_PCMA_NOB 0 /* standard PCMCIA "A", no "B" */
324#define K_PCMCIA_MODE_IDEA_NOB 1 /* IDE "A", no "B" */
325#define K_PCMCIA_MODE_PCMIOA_NOB 2 /* PCMCIA with I/O "A", no "B" */
326#define K_PCMCIA_MODE_PCMA_PCMB 4 /* standard PCMCIA "A", standard PCMCIA "B" */
327#define K_PCMCIA_MODE_IDEA_PCMB 5 /* IDE "A", standard PCMCIA "B" */
328#define K_PCMCIA_MODE_PCMA_IDEB 6 /* standard PCMCIA "A", IDE "B" */
329#define K_PCMCIA_MODE_IDEA_IDEB 7 /* IDE "A", IDE "B" */
330#endif
331
332
333/*
334 * PCMCIA status register (Table 12-7)
335 */
336
337#define M_PCMCIA_STATUS_CD1 _SB_MAKEMASK1(0)
338#define M_PCMCIA_STATUS_CD2 _SB_MAKEMASK1(1)
339#define M_PCMCIA_STATUS_VS1 _SB_MAKEMASK1(2)
340#define M_PCMCIA_STATUS_VS2 _SB_MAKEMASK1(3)
341#define M_PCMCIA_STATUS_WP _SB_MAKEMASK1(4)
342#define M_PCMCIA_STATUS_RDY _SB_MAKEMASK1(5)
343#define M_PCMCIA_STATUS_3VEN _SB_MAKEMASK1(6)
344#define M_PCMCIA_STATUS_5VEN _SB_MAKEMASK1(7)
345#define M_PCMCIA_STATUS_CDCHG _SB_MAKEMASK1(8)
346#define M_PCMCIA_STATUS_WPCHG _SB_MAKEMASK1(9)
347#define M_PCMCIA_STATUS_RDYCHG _SB_MAKEMASK1(10)
348
349/*
350 * GPIO Interrupt Type Register (table 13-3)
351 */
352
353#define K_GPIO_INTR_DISABLE 0
354#define K_GPIO_INTR_EDGE 1
355#define K_GPIO_INTR_LEVEL 2
356#define K_GPIO_INTR_SPLIT 3
357
358#define S_GPIO_INTR_TYPEX(n) (((n)/2)*2)
359#define M_GPIO_INTR_TYPEX(n) _SB_MAKEMASK(2, S_GPIO_INTR_TYPEX(n))
360#define V_GPIO_INTR_TYPEX(n, x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPEX(n))
361#define G_GPIO_INTR_TYPEX(n, x) _SB_GETVALUE(x, S_GPIO_INTR_TYPEX(n), M_GPIO_INTR_TYPEX(n))
362
363#define S_GPIO_INTR_TYPE0 0
364#define M_GPIO_INTR_TYPE0 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE0)
365#define V_GPIO_INTR_TYPE0(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE0)
366#define G_GPIO_INTR_TYPE0(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE0, M_GPIO_INTR_TYPE0)
367
368#define S_GPIO_INTR_TYPE2 2
369#define M_GPIO_INTR_TYPE2 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE2)
370#define V_GPIO_INTR_TYPE2(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE2)
371#define G_GPIO_INTR_TYPE2(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE2, M_GPIO_INTR_TYPE2)
372
373#define S_GPIO_INTR_TYPE4 4
374#define M_GPIO_INTR_TYPE4 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE4)
375#define V_GPIO_INTR_TYPE4(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE4)
376#define G_GPIO_INTR_TYPE4(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE4, M_GPIO_INTR_TYPE4)
377
378#define S_GPIO_INTR_TYPE6 6
379#define M_GPIO_INTR_TYPE6 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE6)
380#define V_GPIO_INTR_TYPE6(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE6)
381#define G_GPIO_INTR_TYPE6(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE6, M_GPIO_INTR_TYPE6)
382
383#define S_GPIO_INTR_TYPE8 8
384#define M_GPIO_INTR_TYPE8 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE8)
385#define V_GPIO_INTR_TYPE8(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE8)
386#define G_GPIO_INTR_TYPE8(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE8, M_GPIO_INTR_TYPE8)
387
388#define S_GPIO_INTR_TYPE10 10
389#define M_GPIO_INTR_TYPE10 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE10)
390#define V_GPIO_INTR_TYPE10(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE10)
391#define G_GPIO_INTR_TYPE10(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE10, M_GPIO_INTR_TYPE10)
392
393#define S_GPIO_INTR_TYPE12 12
394#define M_GPIO_INTR_TYPE12 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE12)
395#define V_GPIO_INTR_TYPE12(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE12)
396#define G_GPIO_INTR_TYPE12(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE12, M_GPIO_INTR_TYPE12)
397
398#define S_GPIO_INTR_TYPE14 14
399#define M_GPIO_INTR_TYPE14 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE14)
400#define V_GPIO_INTR_TYPE14(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE14)
401#define G_GPIO_INTR_TYPE14(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE14, M_GPIO_INTR_TYPE14)
402
403#if SIBYTE_HDR_FEATURE_CHIP(1480)
404
405/*
406 * GPIO Interrupt Additional Type Register
407 */
408
409#define K_GPIO_INTR_BOTHEDGE 0
410#define K_GPIO_INTR_RISEEDGE 1
411#define K_GPIO_INTR_UNPRED1 2
412#define K_GPIO_INTR_UNPRED2 3
413
414#define S_GPIO_INTR_ATYPEX(n) (((n)/2)*2)
415#define M_GPIO_INTR_ATYPEX(n) _SB_MAKEMASK(2, S_GPIO_INTR_ATYPEX(n))
416#define V_GPIO_INTR_ATYPEX(n, x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPEX(n))
417#define G_GPIO_INTR_ATYPEX(n, x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPEX(n), M_GPIO_INTR_ATYPEX(n))
418
419#define S_GPIO_INTR_ATYPE0 0
420#define M_GPIO_INTR_ATYPE0 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE0)
421#define V_GPIO_INTR_ATYPE0(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE0)
422#define G_GPIO_INTR_ATYPE0(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE0, M_GPIO_INTR_ATYPE0)
423
424#define S_GPIO_INTR_ATYPE2 2
425#define M_GPIO_INTR_ATYPE2 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE2)
426#define V_GPIO_INTR_ATYPE2(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE2)
427#define G_GPIO_INTR_ATYPE2(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE2, M_GPIO_INTR_ATYPE2)
428
429#define S_GPIO_INTR_ATYPE4 4
430#define M_GPIO_INTR_ATYPE4 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE4)
431#define V_GPIO_INTR_ATYPE4(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE4)
432#define G_GPIO_INTR_ATYPE4(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE4, M_GPIO_INTR_ATYPE4)
433
434#define S_GPIO_INTR_ATYPE6 6
435#define M_GPIO_INTR_ATYPE6 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE6)
436#define V_GPIO_INTR_ATYPE6(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE6)
437#define G_GPIO_INTR_ATYPE6(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE6, M_GPIO_INTR_ATYPE6)
438
439#define S_GPIO_INTR_ATYPE8 8
440#define M_GPIO_INTR_ATYPE8 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE8)
441#define V_GPIO_INTR_ATYPE8(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE8)
442#define G_GPIO_INTR_ATYPE8(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE8, M_GPIO_INTR_ATYPE8)
443
444#define S_GPIO_INTR_ATYPE10 10
445#define M_GPIO_INTR_ATYPE10 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE10)
446#define V_GPIO_INTR_ATYPE10(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE10)
447#define G_GPIO_INTR_ATYPE10(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE10, M_GPIO_INTR_ATYPE10)
448
449#define S_GPIO_INTR_ATYPE12 12
450#define M_GPIO_INTR_ATYPE12 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE12)
451#define V_GPIO_INTR_ATYPE12(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE12)
452#define G_GPIO_INTR_ATYPE12(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE12, M_GPIO_INTR_ATYPE12)
453
454#define S_GPIO_INTR_ATYPE14 14
455#define M_GPIO_INTR_ATYPE14 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE14)
456#define V_GPIO_INTR_ATYPE14(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE14)
457#define G_GPIO_INTR_ATYPE14(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE14, M_GPIO_INTR_ATYPE14)
458#endif
459
460
461#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_int.h b/arch/mips/include/asm/sibyte/sb1250_int.h
new file mode 100644
index 000000000..2e0adb055
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_int.h
@@ -0,0 +1,235 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * Interrupt Mapper definitions File: sb1250_int.h
6 *
7 * This module contains constants for manipulating the SB1250's
8 * interrupt mapper and definitions for the interrupt sources.
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 *********************************************************************
13 *
14 * Copyright 2000, 2001, 2002, 2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _SB1250_INT_H
21#define _SB1250_INT_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25/* *********************************************************************
26 * Interrupt Mapper Constants
27 ********************************************************************* */
28
29/*
30 * Interrupt sources (Table 4-8, UM 0.2)
31 *
32 * First, the interrupt numbers.
33 */
34
35#define K_INT_SOURCES 64
36
37#define K_INT_WATCHDOG_TIMER_0 0
38#define K_INT_WATCHDOG_TIMER_1 1
39#define K_INT_TIMER_0 2
40#define K_INT_TIMER_1 3
41#define K_INT_TIMER_2 4
42#define K_INT_TIMER_3 5
43#define K_INT_SMB_0 6
44#define K_INT_SMB_1 7
45#define K_INT_UART_0 8
46#define K_INT_UART_1 9
47#define K_INT_SER_0 10
48#define K_INT_SER_1 11
49#define K_INT_PCMCIA 12
50#define K_INT_ADDR_TRAP 13
51#define K_INT_PERF_CNT 14
52#define K_INT_TRACE_FREEZE 15
53#define K_INT_BAD_ECC 16
54#define K_INT_COR_ECC 17
55#define K_INT_IO_BUS 18
56#define K_INT_MAC_0 19
57#define K_INT_MAC_1 20
58#define K_INT_MAC_2 21
59#define K_INT_DM_CH_0 22
60#define K_INT_DM_CH_1 23
61#define K_INT_DM_CH_2 24
62#define K_INT_DM_CH_3 25
63#define K_INT_MBOX_0 26
64#define K_INT_MBOX_1 27
65#define K_INT_MBOX_2 28
66#define K_INT_MBOX_3 29
67#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
68#define K_INT_CYCLE_CP0_INT 30
69#define K_INT_CYCLE_CP1_INT 31
70#endif /* 1250 PASS2 || 112x PASS1 */
71#define K_INT_GPIO_0 32
72#define K_INT_GPIO_1 33
73#define K_INT_GPIO_2 34
74#define K_INT_GPIO_3 35
75#define K_INT_GPIO_4 36
76#define K_INT_GPIO_5 37
77#define K_INT_GPIO_6 38
78#define K_INT_GPIO_7 39
79#define K_INT_GPIO_8 40
80#define K_INT_GPIO_9 41
81#define K_INT_GPIO_10 42
82#define K_INT_GPIO_11 43
83#define K_INT_GPIO_12 44
84#define K_INT_GPIO_13 45
85#define K_INT_GPIO_14 46
86#define K_INT_GPIO_15 47
87#define K_INT_LDT_FATAL 48
88#define K_INT_LDT_NONFATAL 49
89#define K_INT_LDT_SMI 50
90#define K_INT_LDT_NMI 51
91#define K_INT_LDT_INIT 52
92#define K_INT_LDT_STARTUP 53
93#define K_INT_LDT_EXT 54
94#define K_INT_PCI_ERROR 55
95#define K_INT_PCI_INTA 56
96#define K_INT_PCI_INTB 57
97#define K_INT_PCI_INTC 58
98#define K_INT_PCI_INTD 59
99#define K_INT_SPARE_2 60
100#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
101#define K_INT_MAC_0_CH1 61
102#define K_INT_MAC_1_CH1 62
103#define K_INT_MAC_2_CH1 63
104#endif /* 1250 PASS2 || 112x PASS1 */
105
106/*
107 * Mask values for each interrupt
108 */
109
110#define M_INT_WATCHDOG_TIMER_0 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_0)
111#define M_INT_WATCHDOG_TIMER_1 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_1)
112#define M_INT_TIMER_0 _SB_MAKEMASK1(K_INT_TIMER_0)
113#define M_INT_TIMER_1 _SB_MAKEMASK1(K_INT_TIMER_1)
114#define M_INT_TIMER_2 _SB_MAKEMASK1(K_INT_TIMER_2)
115#define M_INT_TIMER_3 _SB_MAKEMASK1(K_INT_TIMER_3)
116#define M_INT_SMB_0 _SB_MAKEMASK1(K_INT_SMB_0)
117#define M_INT_SMB_1 _SB_MAKEMASK1(K_INT_SMB_1)
118#define M_INT_UART_0 _SB_MAKEMASK1(K_INT_UART_0)
119#define M_INT_UART_1 _SB_MAKEMASK1(K_INT_UART_1)
120#define M_INT_SER_0 _SB_MAKEMASK1(K_INT_SER_0)
121#define M_INT_SER_1 _SB_MAKEMASK1(K_INT_SER_1)
122#define M_INT_PCMCIA _SB_MAKEMASK1(K_INT_PCMCIA)
123#define M_INT_ADDR_TRAP _SB_MAKEMASK1(K_INT_ADDR_TRAP)
124#define M_INT_PERF_CNT _SB_MAKEMASK1(K_INT_PERF_CNT)
125#define M_INT_TRACE_FREEZE _SB_MAKEMASK1(K_INT_TRACE_FREEZE)
126#define M_INT_BAD_ECC _SB_MAKEMASK1(K_INT_BAD_ECC)
127#define M_INT_COR_ECC _SB_MAKEMASK1(K_INT_COR_ECC)
128#define M_INT_IO_BUS _SB_MAKEMASK1(K_INT_IO_BUS)
129#define M_INT_MAC_0 _SB_MAKEMASK1(K_INT_MAC_0)
130#define M_INT_MAC_1 _SB_MAKEMASK1(K_INT_MAC_1)
131#define M_INT_MAC_2 _SB_MAKEMASK1(K_INT_MAC_2)
132#define M_INT_DM_CH_0 _SB_MAKEMASK1(K_INT_DM_CH_0)
133#define M_INT_DM_CH_1 _SB_MAKEMASK1(K_INT_DM_CH_1)
134#define M_INT_DM_CH_2 _SB_MAKEMASK1(K_INT_DM_CH_2)
135#define M_INT_DM_CH_3 _SB_MAKEMASK1(K_INT_DM_CH_3)
136#define M_INT_MBOX_0 _SB_MAKEMASK1(K_INT_MBOX_0)
137#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1)
138#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2)
139#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3)
140#define M_INT_MBOX_ALL _SB_MAKEMASK(4, K_INT_MBOX_0)
141#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
142#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT)
143#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT)
144#endif /* 1250 PASS2 || 112x PASS1 */
145#define M_INT_GPIO_0 _SB_MAKEMASK1(K_INT_GPIO_0)
146#define M_INT_GPIO_1 _SB_MAKEMASK1(K_INT_GPIO_1)
147#define M_INT_GPIO_2 _SB_MAKEMASK1(K_INT_GPIO_2)
148#define M_INT_GPIO_3 _SB_MAKEMASK1(K_INT_GPIO_3)
149#define M_INT_GPIO_4 _SB_MAKEMASK1(K_INT_GPIO_4)
150#define M_INT_GPIO_5 _SB_MAKEMASK1(K_INT_GPIO_5)
151#define M_INT_GPIO_6 _SB_MAKEMASK1(K_INT_GPIO_6)
152#define M_INT_GPIO_7 _SB_MAKEMASK1(K_INT_GPIO_7)
153#define M_INT_GPIO_8 _SB_MAKEMASK1(K_INT_GPIO_8)
154#define M_INT_GPIO_9 _SB_MAKEMASK1(K_INT_GPIO_9)
155#define M_INT_GPIO_10 _SB_MAKEMASK1(K_INT_GPIO_10)
156#define M_INT_GPIO_11 _SB_MAKEMASK1(K_INT_GPIO_11)
157#define M_INT_GPIO_12 _SB_MAKEMASK1(K_INT_GPIO_12)
158#define M_INT_GPIO_13 _SB_MAKEMASK1(K_INT_GPIO_13)
159#define M_INT_GPIO_14 _SB_MAKEMASK1(K_INT_GPIO_14)
160#define M_INT_GPIO_15 _SB_MAKEMASK1(K_INT_GPIO_15)
161#define M_INT_LDT_FATAL _SB_MAKEMASK1(K_INT_LDT_FATAL)
162#define M_INT_LDT_NONFATAL _SB_MAKEMASK1(K_INT_LDT_NONFATAL)
163#define M_INT_LDT_SMI _SB_MAKEMASK1(K_INT_LDT_SMI)
164#define M_INT_LDT_NMI _SB_MAKEMASK1(K_INT_LDT_NMI)
165#define M_INT_LDT_INIT _SB_MAKEMASK1(K_INT_LDT_INIT)
166#define M_INT_LDT_STARTUP _SB_MAKEMASK1(K_INT_LDT_STARTUP)
167#define M_INT_LDT_EXT _SB_MAKEMASK1(K_INT_LDT_EXT)
168#define M_INT_PCI_ERROR _SB_MAKEMASK1(K_INT_PCI_ERROR)
169#define M_INT_PCI_INTA _SB_MAKEMASK1(K_INT_PCI_INTA)
170#define M_INT_PCI_INTB _SB_MAKEMASK1(K_INT_PCI_INTB)
171#define M_INT_PCI_INTC _SB_MAKEMASK1(K_INT_PCI_INTC)
172#define M_INT_PCI_INTD _SB_MAKEMASK1(K_INT_PCI_INTD)
173#define M_INT_SPARE_2 _SB_MAKEMASK1(K_INT_SPARE_2)
174#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
175#define M_INT_MAC_0_CH1 _SB_MAKEMASK1(K_INT_MAC_0_CH1)
176#define M_INT_MAC_1_CH1 _SB_MAKEMASK1(K_INT_MAC_1_CH1)
177#define M_INT_MAC_2_CH1 _SB_MAKEMASK1(K_INT_MAC_2_CH1)
178#endif /* 1250 PASS2 || 112x PASS1 */
179
180/*
181 * Interrupt mappings
182 */
183
184#define K_INT_MAP_I0 0 /* interrupt pins on processor */
185#define K_INT_MAP_I1 1
186#define K_INT_MAP_I2 2
187#define K_INT_MAP_I3 3
188#define K_INT_MAP_I4 4
189#define K_INT_MAP_I5 5
190#define K_INT_MAP_NMI 6 /* nonmaskable */
191#define K_INT_MAP_DINT 7 /* debug interrupt */
192
193/*
194 * LDT Interrupt Set Register (table 4-5)
195 */
196
197#define S_INT_LDT_INTMSG 0
198#define M_INT_LDT_INTMSG _SB_MAKEMASK(3, S_INT_LDT_INTMSG)
199#define V_INT_LDT_INTMSG(x) _SB_MAKEVALUE(x, S_INT_LDT_INTMSG)
200#define G_INT_LDT_INTMSG(x) _SB_GETVALUE(x, S_INT_LDT_INTMSG, M_INT_LDT_INTMSG)
201
202#define K_INT_LDT_INTMSG_FIXED 0
203#define K_INT_LDT_INTMSG_ARBITRATED 1
204#define K_INT_LDT_INTMSG_SMI 2
205#define K_INT_LDT_INTMSG_NMI 3
206#define K_INT_LDT_INTMSG_INIT 4
207#define K_INT_LDT_INTMSG_STARTUP 5
208#define K_INT_LDT_INTMSG_EXTINT 6
209#define K_INT_LDT_INTMSG_RESERVED 7
210
211#define M_INT_LDT_EDGETRIGGER 0
212#define M_INT_LDT_LEVELTRIGGER _SB_MAKEMASK1(3)
213
214#define M_INT_LDT_PHYSICALDEST 0
215#define M_INT_LDT_LOGICALDEST _SB_MAKEMASK1(4)
216
217#define S_INT_LDT_INTDEST 5
218#define M_INT_LDT_INTDEST _SB_MAKEMASK(10, S_INT_LDT_INTDEST)
219#define V_INT_LDT_INTDEST(x) _SB_MAKEVALUE(x, S_INT_LDT_INTDEST)
220#define G_INT_LDT_INTDEST(x) _SB_GETVALUE(x, S_INT_LDT_INTDEST, M_INT_LDT_INTDEST)
221
222#define S_INT_LDT_VECTOR 13
223#define M_INT_LDT_VECTOR _SB_MAKEMASK(8, S_INT_LDT_VECTOR)
224#define V_INT_LDT_VECTOR(x) _SB_MAKEVALUE(x, S_INT_LDT_VECTOR)
225#define G_INT_LDT_VECTOR(x) _SB_GETVALUE(x, S_INT_LDT_VECTOR, M_INT_LDT_VECTOR)
226
227/*
228 * Vector format (Table 4-6)
229 */
230
231#define M_LDTVECT_RAISEINT 0x00
232#define M_LDTVECT_RAISEMBOX 0x40
233
234
235#endif /* 1250/112x */
diff --git a/arch/mips/include/asm/sibyte/sb1250_l2c.h b/arch/mips/include/asm/sibyte/sb1250_l2c.h
new file mode 100644
index 000000000..cd8de844b
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_l2c.h
@@ -0,0 +1,118 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * L2 Cache constants and macros File: sb1250_l2c.h
6 *
7 * This module contains constants useful for manipulating the
8 * level 2 cache.
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _SB1250_L2C_H
21#define _SB1250_L2C_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25/*
26 * Level 2 Cache Tag register (Table 5-3)
27 */
28
29#define S_L2C_TAG_MBZ 0
30#define M_L2C_TAG_MBZ _SB_MAKEMASK(5, S_L2C_TAG_MBZ)
31
32#define S_L2C_TAG_INDEX 5
33#define M_L2C_TAG_INDEX _SB_MAKEMASK(12, S_L2C_TAG_INDEX)
34#define V_L2C_TAG_INDEX(x) _SB_MAKEVALUE(x, S_L2C_TAG_INDEX)
35#define G_L2C_TAG_INDEX(x) _SB_GETVALUE(x, S_L2C_TAG_INDEX, M_L2C_TAG_INDEX)
36
37#define S_L2C_TAG_TAG 17
38#define M_L2C_TAG_TAG _SB_MAKEMASK(23, S_L2C_TAG_TAG)
39#define V_L2C_TAG_TAG(x) _SB_MAKEVALUE(x, S_L2C_TAG_TAG)
40#define G_L2C_TAG_TAG(x) _SB_GETVALUE(x, S_L2C_TAG_TAG, M_L2C_TAG_TAG)
41
42#define S_L2C_TAG_ECC 40
43#define M_L2C_TAG_ECC _SB_MAKEMASK(6, S_L2C_TAG_ECC)
44#define V_L2C_TAG_ECC(x) _SB_MAKEVALUE(x, S_L2C_TAG_ECC)
45#define G_L2C_TAG_ECC(x) _SB_GETVALUE(x, S_L2C_TAG_ECC, M_L2C_TAG_ECC)
46
47#define S_L2C_TAG_WAY 46
48#define M_L2C_TAG_WAY _SB_MAKEMASK(2, S_L2C_TAG_WAY)
49#define V_L2C_TAG_WAY(x) _SB_MAKEVALUE(x, S_L2C_TAG_WAY)
50#define G_L2C_TAG_WAY(x) _SB_GETVALUE(x, S_L2C_TAG_WAY, M_L2C_TAG_WAY)
51
52#define M_L2C_TAG_DIRTY _SB_MAKEMASK1(48)
53#define M_L2C_TAG_VALID _SB_MAKEMASK1(49)
54
55/*
56 * Format of level 2 cache management address (table 5-2)
57 */
58
59#define S_L2C_MGMT_INDEX 5
60#define M_L2C_MGMT_INDEX _SB_MAKEMASK(12, S_L2C_MGMT_INDEX)
61#define V_L2C_MGMT_INDEX(x) _SB_MAKEVALUE(x, S_L2C_MGMT_INDEX)
62#define G_L2C_MGMT_INDEX(x) _SB_GETVALUE(x, S_L2C_MGMT_INDEX, M_L2C_MGMT_INDEX)
63
64#define S_L2C_MGMT_QUADRANT 15
65#define M_L2C_MGMT_QUADRANT _SB_MAKEMASK(2, S_L2C_MGMT_QUADRANT)
66#define V_L2C_MGMT_QUADRANT(x) _SB_MAKEVALUE(x, S_L2C_MGMT_QUADRANT)
67#define G_L2C_MGMT_QUADRANT(x) _SB_GETVALUE(x, S_L2C_MGMT_QUADRANT, M_L2C_MGMT_QUADRANT)
68
69#define S_L2C_MGMT_HALF 16
70#define M_L2C_MGMT_HALF _SB_MAKEMASK(1, S_L2C_MGMT_HALF)
71
72#define S_L2C_MGMT_WAY 17
73#define M_L2C_MGMT_WAY _SB_MAKEMASK(2, S_L2C_MGMT_WAY)
74#define V_L2C_MGMT_WAY(x) _SB_MAKEVALUE(x, S_L2C_MGMT_WAY)
75#define G_L2C_MGMT_WAY(x) _SB_GETVALUE(x, S_L2C_MGMT_WAY, M_L2C_MGMT_WAY)
76
77#define S_L2C_MGMT_ECC_DIAG 21
78#define M_L2C_MGMT_ECC_DIAG _SB_MAKEMASK(2, S_L2C_MGMT_ECC_DIAG)
79#define V_L2C_MGMT_ECC_DIAG(x) _SB_MAKEVALUE(x, S_L2C_MGMT_ECC_DIAG)
80#define G_L2C_MGMT_ECC_DIAG(x) _SB_GETVALUE(x, S_L2C_MGMT_ECC_DIAG, M_L2C_MGMT_ECC_DIAG)
81
82#define S_L2C_MGMT_TAG 23
83#define M_L2C_MGMT_TAG _SB_MAKEMASK(4, S_L2C_MGMT_TAG)
84#define V_L2C_MGMT_TAG(x) _SB_MAKEVALUE(x, S_L2C_MGMT_TAG)
85#define G_L2C_MGMT_TAG(x) _SB_GETVALUE(x, S_L2C_MGMT_TAG, M_L2C_MGMT_TAG)
86
87#define M_L2C_MGMT_DIRTY _SB_MAKEMASK1(19)
88#define M_L2C_MGMT_VALID _SB_MAKEMASK1(20)
89
90#define A_L2C_MGMT_TAG_BASE 0x00D0000000
91
92#define L2C_ENTRIES_PER_WAY 4096
93#define L2C_NUM_WAYS 4
94
95
96#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
97/*
98 * L2 Read Misc. register (A_L2_READ_MISC)
99 */
100#define S_L2C_MISC_NO_WAY 10
101#define M_L2C_MISC_NO_WAY _SB_MAKEMASK(4, S_L2C_MISC_NO_WAY)
102#define V_L2C_MISC_NO_WAY(x) _SB_MAKEVALUE(x, S_L2C_MISC_NO_WAY)
103#define G_L2C_MISC_NO_WAY(x) _SB_GETVALUE(x, S_L2C_MISC_NO_WAY, M_L2C_MISC_NO_WAY)
104
105#define M_L2C_MISC_ECC_CLEANUP_DIS _SB_MAKEMASK1(9)
106#define M_L2C_MISC_MC_PRIO_LOW _SB_MAKEMASK1(8)
107#define M_L2C_MISC_SOFT_DISABLE_T _SB_MAKEMASK1(7)
108#define M_L2C_MISC_SOFT_DISABLE_B _SB_MAKEMASK1(6)
109#define M_L2C_MISC_SOFT_DISABLE_R _SB_MAKEMASK1(5)
110#define M_L2C_MISC_SOFT_DISABLE_L _SB_MAKEMASK1(4)
111#define M_L2C_MISC_SCACHE_DISABLE_T _SB_MAKEMASK1(3)
112#define M_L2C_MISC_SCACHE_DISABLE_B _SB_MAKEMASK1(2)
113#define M_L2C_MISC_SCACHE_DISABLE_R _SB_MAKEMASK1(1)
114#define M_L2C_MISC_SCACHE_DISABLE_L _SB_MAKEMASK1(0)
115#endif /* 1250 PASS3 || 112x PASS1 */
116
117
118#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_ldt.h b/arch/mips/include/asm/sibyte/sb1250_ldt.h
new file mode 100644
index 000000000..c22df8dbb
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_ldt.h
@@ -0,0 +1,409 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * LDT constants File: sb1250_ldt.h
6 *
7 * This module contains constants and macros to describe
8 * the LDT interface on the SB1250.
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 *********************************************************************
13 *
14 * Copyright 2000, 2001, 2002, 2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _SB1250_LDT_H
21#define _SB1250_LDT_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25#define K_LDT_VENDOR_SIBYTE 0x166D
26#define K_LDT_DEVICE_SB1250 0x0002
27
28/*
29 * LDT Interface Type 1 (bridge) configuration header
30 */
31
32#define R_LDT_TYPE1_DEVICEID 0x0000
33#define R_LDT_TYPE1_CMDSTATUS 0x0004
34#define R_LDT_TYPE1_CLASSREV 0x0008
35#define R_LDT_TYPE1_DEVHDR 0x000C
36#define R_LDT_TYPE1_BAR0 0x0010 /* not used */
37#define R_LDT_TYPE1_BAR1 0x0014 /* not used */
38
39#define R_LDT_TYPE1_BUSID 0x0018 /* bus ID register */
40#define R_LDT_TYPE1_SECSTATUS 0x001C /* secondary status / I/O base/limit */
41#define R_LDT_TYPE1_MEMLIMIT 0x0020
42#define R_LDT_TYPE1_PREFETCH 0x0024
43#define R_LDT_TYPE1_PREF_BASE 0x0028
44#define R_LDT_TYPE1_PREF_LIMIT 0x002C
45#define R_LDT_TYPE1_IOLIMIT 0x0030
46#define R_LDT_TYPE1_CAPPTR 0x0034
47#define R_LDT_TYPE1_ROMADDR 0x0038
48#define R_LDT_TYPE1_BRCTL 0x003C
49#define R_LDT_TYPE1_CMD 0x0040
50#define R_LDT_TYPE1_LINKCTRL 0x0044
51#define R_LDT_TYPE1_LINKFREQ 0x0048
52#define R_LDT_TYPE1_RESERVED1 0x004C
53#define R_LDT_TYPE1_SRICMD 0x0050
54#define R_LDT_TYPE1_SRITXNUM 0x0054
55#define R_LDT_TYPE1_SRIRXNUM 0x0058
56#define R_LDT_TYPE1_ERRSTATUS 0x0068
57#define R_LDT_TYPE1_SRICTRL 0x006C
58#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
59#define R_LDT_TYPE1_ADDSTATUS 0x0070
60#endif /* 1250 PASS2 || 112x PASS1 */
61#define R_LDT_TYPE1_TXBUFCNT 0x00C8
62#define R_LDT_TYPE1_EXPCRC 0x00DC
63#define R_LDT_TYPE1_RXCRC 0x00F0
64
65
66/*
67 * LDT Device ID register
68 */
69
70#define S_LDT_DEVICEID_VENDOR 0
71#define M_LDT_DEVICEID_VENDOR _SB_MAKEMASK_32(16, S_LDT_DEVICEID_VENDOR)
72#define V_LDT_DEVICEID_VENDOR(x) _SB_MAKEVALUE_32(x, S_LDT_DEVICEID_VENDOR)
73#define G_LDT_DEVICEID_VENDOR(x) _SB_GETVALUE_32(x, S_LDT_DEVICEID_VENDOR, M_LDT_DEVICEID_VENDOR)
74
75#define S_LDT_DEVICEID_DEVICEID 16
76#define M_LDT_DEVICEID_DEVICEID _SB_MAKEMASK_32(16, S_LDT_DEVICEID_DEVICEID)
77#define V_LDT_DEVICEID_DEVICEID(x) _SB_MAKEVALUE_32(x, S_LDT_DEVICEID_DEVICEID)
78#define G_LDT_DEVICEID_DEVICEID(x) _SB_GETVALUE_32(x, S_LDT_DEVICEID_DEVICEID, M_LDT_DEVICEID_DEVICEID)
79
80
81/*
82 * LDT Command Register (Table 8-13)
83 */
84
85#define M_LDT_CMD_IOSPACE_EN _SB_MAKEMASK1_32(0)
86#define M_LDT_CMD_MEMSPACE_EN _SB_MAKEMASK1_32(1)
87#define M_LDT_CMD_MASTER_EN _SB_MAKEMASK1_32(2)
88#define M_LDT_CMD_SPECCYC_EN _SB_MAKEMASK1_32(3)
89#define M_LDT_CMD_MEMWRINV_EN _SB_MAKEMASK1_32(4)
90#define M_LDT_CMD_VGAPALSNP_EN _SB_MAKEMASK1_32(5)
91#define M_LDT_CMD_PARERRRESP _SB_MAKEMASK1_32(6)
92#define M_LDT_CMD_WAITCYCCTRL _SB_MAKEMASK1_32(7)
93#define M_LDT_CMD_SERR_EN _SB_MAKEMASK1_32(8)
94#define M_LDT_CMD_FASTB2B_EN _SB_MAKEMASK1_32(9)
95
96/*
97 * LDT class and revision registers
98 */
99
100#define S_LDT_CLASSREV_REV 0
101#define M_LDT_CLASSREV_REV _SB_MAKEMASK_32(8, S_LDT_CLASSREV_REV)
102#define V_LDT_CLASSREV_REV(x) _SB_MAKEVALUE_32(x, S_LDT_CLASSREV_REV)
103#define G_LDT_CLASSREV_REV(x) _SB_GETVALUE_32(x, S_LDT_CLASSREV_REV, M_LDT_CLASSREV_REV)
104
105#define S_LDT_CLASSREV_CLASS 8
106#define M_LDT_CLASSREV_CLASS _SB_MAKEMASK_32(24, S_LDT_CLASSREV_CLASS)
107#define V_LDT_CLASSREV_CLASS(x) _SB_MAKEVALUE_32(x, S_LDT_CLASSREV_CLASS)
108#define G_LDT_CLASSREV_CLASS(x) _SB_GETVALUE_32(x, S_LDT_CLASSREV_CLASS, M_LDT_CLASSREV_CLASS)
109
110#define K_LDT_REV 0x01
111#define K_LDT_CLASS 0x060000
112
113/*
114 * Device Header (offset 0x0C)
115 */
116
117#define S_LDT_DEVHDR_CLINESZ 0
118#define M_LDT_DEVHDR_CLINESZ _SB_MAKEMASK_32(8, S_LDT_DEVHDR_CLINESZ)
119#define V_LDT_DEVHDR_CLINESZ(x) _SB_MAKEVALUE_32(x, S_LDT_DEVHDR_CLINESZ)
120#define G_LDT_DEVHDR_CLINESZ(x) _SB_GETVALUE_32(x, S_LDT_DEVHDR_CLINESZ, M_LDT_DEVHDR_CLINESZ)
121
122#define S_LDT_DEVHDR_LATTMR 8
123#define M_LDT_DEVHDR_LATTMR _SB_MAKEMASK_32(8, S_LDT_DEVHDR_LATTMR)
124#define V_LDT_DEVHDR_LATTMR(x) _SB_MAKEVALUE_32(x, S_LDT_DEVHDR_LATTMR)
125#define G_LDT_DEVHDR_LATTMR(x) _SB_GETVALUE_32(x, S_LDT_DEVHDR_LATTMR, M_LDT_DEVHDR_LATTMR)
126
127#define S_LDT_DEVHDR_HDRTYPE 16
128#define M_LDT_DEVHDR_HDRTYPE _SB_MAKEMASK_32(8, S_LDT_DEVHDR_HDRTYPE)
129#define V_LDT_DEVHDR_HDRTYPE(x) _SB_MAKEVALUE_32(x, S_LDT_DEVHDR_HDRTYPE)
130#define G_LDT_DEVHDR_HDRTYPE(x) _SB_GETVALUE_32(x, S_LDT_DEVHDR_HDRTYPE, M_LDT_DEVHDR_HDRTYPE)
131
132#define K_LDT_DEVHDR_HDRTYPE_TYPE1 1
133
134#define S_LDT_DEVHDR_BIST 24
135#define M_LDT_DEVHDR_BIST _SB_MAKEMASK_32(8, S_LDT_DEVHDR_BIST)
136#define V_LDT_DEVHDR_BIST(x) _SB_MAKEVALUE_32(x, S_LDT_DEVHDR_BIST)
137#define G_LDT_DEVHDR_BIST(x) _SB_GETVALUE_32(x, S_LDT_DEVHDR_BIST, M_LDT_DEVHDR_BIST)
138
139
140
141/*
142 * LDT Status Register (Table 8-14). Note that these constants
143 * assume you've read the command and status register
144 * together (32-bit read at offset 0x04)
145 *
146 * These bits also apply to the secondary status
147 * register (Table 8-15), offset 0x1C
148 */
149
150#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
151#define M_LDT_STATUS_VGAEN _SB_MAKEMASK1_32(3)
152#endif /* 1250 PASS2 || 112x PASS1 */
153#define M_LDT_STATUS_CAPLIST _SB_MAKEMASK1_32(20)
154#define M_LDT_STATUS_66MHZCAP _SB_MAKEMASK1_32(21)
155#define M_LDT_STATUS_RESERVED2 _SB_MAKEMASK1_32(22)
156#define M_LDT_STATUS_FASTB2BCAP _SB_MAKEMASK1_32(23)
157#define M_LDT_STATUS_MSTRDPARERR _SB_MAKEMASK1_32(24)
158
159#define S_LDT_STATUS_DEVSELTIMING 25
160#define M_LDT_STATUS_DEVSELTIMING _SB_MAKEMASK_32(2, S_LDT_STATUS_DEVSELTIMING)
161#define V_LDT_STATUS_DEVSELTIMING(x) _SB_MAKEVALUE_32(x, S_LDT_STATUS_DEVSELTIMING)
162#define G_LDT_STATUS_DEVSELTIMING(x) _SB_GETVALUE_32(x, S_LDT_STATUS_DEVSELTIMING, M_LDT_STATUS_DEVSELTIMING)
163
164#define M_LDT_STATUS_SIGDTGTABORT _SB_MAKEMASK1_32(27)
165#define M_LDT_STATUS_RCVDTGTABORT _SB_MAKEMASK1_32(28)
166#define M_LDT_STATUS_RCVDMSTRABORT _SB_MAKEMASK1_32(29)
167#define M_LDT_STATUS_SIGDSERR _SB_MAKEMASK1_32(30)
168#define M_LDT_STATUS_DETPARERR _SB_MAKEMASK1_32(31)
169
170/*
171 * Bridge Control Register (Table 8-16). Note that these
172 * constants assume you've read the register as a 32-bit
173 * read (offset 0x3C)
174 */
175
176#define M_LDT_BRCTL_PARERRRESP_EN _SB_MAKEMASK1_32(16)
177#define M_LDT_BRCTL_SERR_EN _SB_MAKEMASK1_32(17)
178#define M_LDT_BRCTL_ISA_EN _SB_MAKEMASK1_32(18)
179#define M_LDT_BRCTL_VGA_EN _SB_MAKEMASK1_32(19)
180#define M_LDT_BRCTL_MSTRABORTMODE _SB_MAKEMASK1_32(21)
181#define M_LDT_BRCTL_SECBUSRESET _SB_MAKEMASK1_32(22)
182#define M_LDT_BRCTL_FASTB2B_EN _SB_MAKEMASK1_32(23)
183#define M_LDT_BRCTL_PRIDISCARD _SB_MAKEMASK1_32(24)
184#define M_LDT_BRCTL_SECDISCARD _SB_MAKEMASK1_32(25)
185#define M_LDT_BRCTL_DISCARDSTAT _SB_MAKEMASK1_32(26)
186#define M_LDT_BRCTL_DISCARDSERR_EN _SB_MAKEMASK1_32(27)
187
188/*
189 * LDT Command Register (Table 8-17). Note that these constants
190 * assume you've read the command and status register together
191 * 32-bit read at offset 0x40
192 */
193
194#define M_LDT_CMD_WARMRESET _SB_MAKEMASK1_32(16)
195#define M_LDT_CMD_DOUBLEENDED _SB_MAKEMASK1_32(17)
196
197#define S_LDT_CMD_CAPTYPE 29
198#define M_LDT_CMD_CAPTYPE _SB_MAKEMASK_32(3, S_LDT_CMD_CAPTYPE)
199#define V_LDT_CMD_CAPTYPE(x) _SB_MAKEVALUE_32(x, S_LDT_CMD_CAPTYPE)
200#define G_LDT_CMD_CAPTYPE(x) _SB_GETVALUE_32(x, S_LDT_CMD_CAPTYPE, M_LDT_CMD_CAPTYPE)
201
202/*
203 * LDT link control register (Table 8-18), and (Table 8-19)
204 */
205
206#define M_LDT_LINKCTRL_CAPSYNCFLOOD_EN _SB_MAKEMASK1_32(1)
207#define M_LDT_LINKCTRL_CRCSTARTTEST _SB_MAKEMASK1_32(2)
208#define M_LDT_LINKCTRL_CRCFORCEERR _SB_MAKEMASK1_32(3)
209#define M_LDT_LINKCTRL_LINKFAIL _SB_MAKEMASK1_32(4)
210#define M_LDT_LINKCTRL_INITDONE _SB_MAKEMASK1_32(5)
211#define M_LDT_LINKCTRL_EOC _SB_MAKEMASK1_32(6)
212#define M_LDT_LINKCTRL_XMITOFF _SB_MAKEMASK1_32(7)
213
214#define S_LDT_LINKCTRL_CRCERR 8
215#define M_LDT_LINKCTRL_CRCERR _SB_MAKEMASK_32(4, S_LDT_LINKCTRL_CRCERR)
216#define V_LDT_LINKCTRL_CRCERR(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_CRCERR)
217#define G_LDT_LINKCTRL_CRCERR(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_CRCERR, M_LDT_LINKCTRL_CRCERR)
218
219#define S_LDT_LINKCTRL_MAXIN 16
220#define M_LDT_LINKCTRL_MAXIN _SB_MAKEMASK_32(3, S_LDT_LINKCTRL_MAXIN)
221#define V_LDT_LINKCTRL_MAXIN(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_MAXIN)
222#define G_LDT_LINKCTRL_MAXIN(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_MAXIN, M_LDT_LINKCTRL_MAXIN)
223
224#define M_LDT_LINKCTRL_DWFCLN _SB_MAKEMASK1_32(19)
225
226#define S_LDT_LINKCTRL_MAXOUT 20
227#define M_LDT_LINKCTRL_MAXOUT _SB_MAKEMASK_32(3, S_LDT_LINKCTRL_MAXOUT)
228#define V_LDT_LINKCTRL_MAXOUT(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_MAXOUT)
229#define G_LDT_LINKCTRL_MAXOUT(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_MAXOUT, M_LDT_LINKCTRL_MAXOUT)
230
231#define M_LDT_LINKCTRL_DWFCOUT _SB_MAKEMASK1_32(23)
232
233#define S_LDT_LINKCTRL_WIDTHIN 24
234#define M_LDT_LINKCTRL_WIDTHIN _SB_MAKEMASK_32(3, S_LDT_LINKCTRL_WIDTHIN)
235#define V_LDT_LINKCTRL_WIDTHIN(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_WIDTHIN)
236#define G_LDT_LINKCTRL_WIDTHIN(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_WIDTHIN, M_LDT_LINKCTRL_WIDTHIN)
237
238#define M_LDT_LINKCTRL_DWFCLIN_EN _SB_MAKEMASK1_32(27)
239
240#define S_LDT_LINKCTRL_WIDTHOUT 28
241#define M_LDT_LINKCTRL_WIDTHOUT _SB_MAKEMASK_32(3, S_LDT_LINKCTRL_WIDTHOUT)
242#define V_LDT_LINKCTRL_WIDTHOUT(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_WIDTHOUT)
243#define G_LDT_LINKCTRL_WIDTHOUT(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_WIDTHOUT, M_LDT_LINKCTRL_WIDTHOUT)
244
245#define M_LDT_LINKCTRL_DWFCOUT_EN _SB_MAKEMASK1_32(31)
246
247/*
248 * LDT Link frequency register (Table 8-20) offset 0x48
249 */
250
251#define S_LDT_LINKFREQ_FREQ 8
252#define M_LDT_LINKFREQ_FREQ _SB_MAKEMASK_32(4, S_LDT_LINKFREQ_FREQ)
253#define V_LDT_LINKFREQ_FREQ(x) _SB_MAKEVALUE_32(x, S_LDT_LINKFREQ_FREQ)
254#define G_LDT_LINKFREQ_FREQ(x) _SB_GETVALUE_32(x, S_LDT_LINKFREQ_FREQ, M_LDT_LINKFREQ_FREQ)
255
256#define K_LDT_LINKFREQ_200MHZ 0
257#define K_LDT_LINKFREQ_300MHZ 1
258#define K_LDT_LINKFREQ_400MHZ 2
259#define K_LDT_LINKFREQ_500MHZ 3
260#define K_LDT_LINKFREQ_600MHZ 4
261#define K_LDT_LINKFREQ_800MHZ 5
262#define K_LDT_LINKFREQ_1000MHZ 6
263
264/*
265 * LDT SRI Command Register (Table 8-21). Note that these constants
266 * assume you've read the command and status register together
267 * 32-bit read at offset 0x50
268 */
269
270#define M_LDT_SRICMD_SIPREADY _SB_MAKEMASK1_32(16)
271#define M_LDT_SRICMD_SYNCPTRCTL _SB_MAKEMASK1_32(17)
272#define M_LDT_SRICMD_REDUCESYNCZERO _SB_MAKEMASK1_32(18)
273#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
274#define M_LDT_SRICMD_DISSTARVATIONCNT _SB_MAKEMASK1_32(19) /* PASS1 */
275#endif /* up to 1250 PASS1 */
276#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
277#define M_LDT_SRICMD_DISMULTTXVLD _SB_MAKEMASK1_32(19)
278#define M_LDT_SRICMD_EXPENDIAN _SB_MAKEMASK1_32(26)
279#endif /* 1250 PASS2 || 112x PASS1 */
280
281
282#define S_LDT_SRICMD_RXMARGIN 20
283#define M_LDT_SRICMD_RXMARGIN _SB_MAKEMASK_32(5, S_LDT_SRICMD_RXMARGIN)
284#define V_LDT_SRICMD_RXMARGIN(x) _SB_MAKEVALUE_32(x, S_LDT_SRICMD_RXMARGIN)
285#define G_LDT_SRICMD_RXMARGIN(x) _SB_GETVALUE_32(x, S_LDT_SRICMD_RXMARGIN, M_LDT_SRICMD_RXMARGIN)
286
287#define M_LDT_SRICMD_LDTPLLCOMPAT _SB_MAKEMASK1_32(25)
288
289#define S_LDT_SRICMD_TXINITIALOFFSET 28
290#define M_LDT_SRICMD_TXINITIALOFFSET _SB_MAKEMASK_32(3, S_LDT_SRICMD_TXINITIALOFFSET)
291#define V_LDT_SRICMD_TXINITIALOFFSET(x) _SB_MAKEVALUE_32(x, S_LDT_SRICMD_TXINITIALOFFSET)
292#define G_LDT_SRICMD_TXINITIALOFFSET(x) _SB_GETVALUE_32(x, S_LDT_SRICMD_TXINITIALOFFSET, M_LDT_SRICMD_TXINITIALOFFSET)
293
294#define M_LDT_SRICMD_LINKFREQDIRECT _SB_MAKEMASK1_32(31)
295
296/*
297 * LDT Error control and status register (Table 8-22) (Table 8-23)
298 */
299
300#define M_LDT_ERRCTL_PROTFATAL_EN _SB_MAKEMASK1_32(0)
301#define M_LDT_ERRCTL_PROTNONFATAL_EN _SB_MAKEMASK1_32(1)
302#define M_LDT_ERRCTL_PROTSYNCFLOOD_EN _SB_MAKEMASK1_32(2)
303#define M_LDT_ERRCTL_OVFFATAL_EN _SB_MAKEMASK1_32(3)
304#define M_LDT_ERRCTL_OVFNONFATAL_EN _SB_MAKEMASK1_32(4)
305#define M_LDT_ERRCTL_OVFSYNCFLOOD_EN _SB_MAKEMASK1_32(5)
306#define M_LDT_ERRCTL_EOCNXAFATAL_EN _SB_MAKEMASK1_32(6)
307#define M_LDT_ERRCTL_EOCNXANONFATAL_EN _SB_MAKEMASK1_32(7)
308#define M_LDT_ERRCTL_EOCNXASYNCFLOOD_EN _SB_MAKEMASK1_32(8)
309#define M_LDT_ERRCTL_CRCFATAL_EN _SB_MAKEMASK1_32(9)
310#define M_LDT_ERRCTL_CRCNONFATAL_EN _SB_MAKEMASK1_32(10)
311#define M_LDT_ERRCTL_SERRFATAL_EN _SB_MAKEMASK1_32(11)
312#define M_LDT_ERRCTL_SRCTAGFATAL_EN _SB_MAKEMASK1_32(12)
313#define M_LDT_ERRCTL_SRCTAGNONFATAL_EN _SB_MAKEMASK1_32(13)
314#define M_LDT_ERRCTL_SRCTAGSYNCFLOOD_EN _SB_MAKEMASK1_32(14)
315#define M_LDT_ERRCTL_MAPNXAFATAL_EN _SB_MAKEMASK1_32(15)
316#define M_LDT_ERRCTL_MAPNXANONFATAL_EN _SB_MAKEMASK1_32(16)
317#define M_LDT_ERRCTL_MAPNXASYNCFLOOD_EN _SB_MAKEMASK1_32(17)
318
319#define M_LDT_ERRCTL_PROTOERR _SB_MAKEMASK1_32(24)
320#define M_LDT_ERRCTL_OVFERR _SB_MAKEMASK1_32(25)
321#define M_LDT_ERRCTL_EOCNXAERR _SB_MAKEMASK1_32(26)
322#define M_LDT_ERRCTL_SRCTAGERR _SB_MAKEMASK1_32(27)
323#define M_LDT_ERRCTL_MAPNXAERR _SB_MAKEMASK1_32(28)
324
325/*
326 * SRI Control register (Table 8-24, 8-25) Offset 0x6C
327 */
328
329#define S_LDT_SRICTRL_NEEDRESP 0
330#define M_LDT_SRICTRL_NEEDRESP _SB_MAKEMASK_32(2, S_LDT_SRICTRL_NEEDRESP)
331#define V_LDT_SRICTRL_NEEDRESP(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_NEEDRESP)
332#define G_LDT_SRICTRL_NEEDRESP(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_NEEDRESP, M_LDT_SRICTRL_NEEDRESP)
333
334#define S_LDT_SRICTRL_NEEDNPREQ 2
335#define M_LDT_SRICTRL_NEEDNPREQ _SB_MAKEMASK_32(2, S_LDT_SRICTRL_NEEDNPREQ)
336#define V_LDT_SRICTRL_NEEDNPREQ(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_NEEDNPREQ)
337#define G_LDT_SRICTRL_NEEDNPREQ(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_NEEDNPREQ, M_LDT_SRICTRL_NEEDNPREQ)
338
339#define S_LDT_SRICTRL_NEEDPREQ 4
340#define M_LDT_SRICTRL_NEEDPREQ _SB_MAKEMASK_32(2, S_LDT_SRICTRL_NEEDPREQ)
341#define V_LDT_SRICTRL_NEEDPREQ(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_NEEDPREQ)
342#define G_LDT_SRICTRL_NEEDPREQ(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_NEEDPREQ, M_LDT_SRICTRL_NEEDPREQ)
343
344#define S_LDT_SRICTRL_WANTRESP 8
345#define M_LDT_SRICTRL_WANTRESP _SB_MAKEMASK_32(2, S_LDT_SRICTRL_WANTRESP)
346#define V_LDT_SRICTRL_WANTRESP(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_WANTRESP)
347#define G_LDT_SRICTRL_WANTRESP(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_WANTRESP, M_LDT_SRICTRL_WANTRESP)
348
349#define S_LDT_SRICTRL_WANTNPREQ 10
350#define M_LDT_SRICTRL_WANTNPREQ _SB_MAKEMASK_32(2, S_LDT_SRICTRL_WANTNPREQ)
351#define V_LDT_SRICTRL_WANTNPREQ(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_WANTNPREQ)
352#define G_LDT_SRICTRL_WANTNPREQ(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_WANTNPREQ, M_LDT_SRICTRL_WANTNPREQ)
353
354#define S_LDT_SRICTRL_WANTPREQ 12
355#define M_LDT_SRICTRL_WANTPREQ _SB_MAKEMASK_32(2, S_LDT_SRICTRL_WANTPREQ)
356#define V_LDT_SRICTRL_WANTPREQ(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_WANTPREQ)
357#define G_LDT_SRICTRL_WANTPREQ(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_WANTPREQ, M_LDT_SRICTRL_WANTPREQ)
358
359#define S_LDT_SRICTRL_BUFRELSPACE 16
360#define M_LDT_SRICTRL_BUFRELSPACE _SB_MAKEMASK_32(4, S_LDT_SRICTRL_BUFRELSPACE)
361#define V_LDT_SRICTRL_BUFRELSPACE(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_BUFRELSPACE)
362#define G_LDT_SRICTRL_BUFRELSPACE(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_BUFRELSPACE, M_LDT_SRICTRL_BUFRELSPACE)
363
364/*
365 * LDT SRI Transmit Buffer Count register (Table 8-26)
366 */
367
368#define S_LDT_TXBUFCNT_PCMD 0
369#define M_LDT_TXBUFCNT_PCMD _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_PCMD)
370#define V_LDT_TXBUFCNT_PCMD(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_PCMD)
371#define G_LDT_TXBUFCNT_PCMD(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_PCMD, M_LDT_TXBUFCNT_PCMD)
372
373#define S_LDT_TXBUFCNT_PDATA 4
374#define M_LDT_TXBUFCNT_PDATA _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_PDATA)
375#define V_LDT_TXBUFCNT_PDATA(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_PDATA)
376#define G_LDT_TXBUFCNT_PDATA(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_PDATA, M_LDT_TXBUFCNT_PDATA)
377
378#define S_LDT_TXBUFCNT_NPCMD 8
379#define M_LDT_TXBUFCNT_NPCMD _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_NPCMD)
380#define V_LDT_TXBUFCNT_NPCMD(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_NPCMD)
381#define G_LDT_TXBUFCNT_NPCMD(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_NPCMD, M_LDT_TXBUFCNT_NPCMD)
382
383#define S_LDT_TXBUFCNT_NPDATA 12
384#define M_LDT_TXBUFCNT_NPDATA _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_NPDATA)
385#define V_LDT_TXBUFCNT_NPDATA(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_NPDATA)
386#define G_LDT_TXBUFCNT_NPDATA(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_NPDATA, M_LDT_TXBUFCNT_NPDATA)
387
388#define S_LDT_TXBUFCNT_RCMD 16
389#define M_LDT_TXBUFCNT_RCMD _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_RCMD)
390#define V_LDT_TXBUFCNT_RCMD(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_RCMD)
391#define G_LDT_TXBUFCNT_RCMD(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_RCMD, M_LDT_TXBUFCNT_RCMD)
392
393#define S_LDT_TXBUFCNT_RDATA 20
394#define M_LDT_TXBUFCNT_RDATA _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_RDATA)
395#define V_LDT_TXBUFCNT_RDATA(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_RDATA)
396#define G_LDT_TXBUFCNT_RDATA(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_RDATA, M_LDT_TXBUFCNT_RDATA)
397
398#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
399/*
400 * Additional Status Register
401 */
402
403#define S_LDT_ADDSTATUS_TGTDONE 0
404#define M_LDT_ADDSTATUS_TGTDONE _SB_MAKEMASK_32(8, S_LDT_ADDSTATUS_TGTDONE)
405#define V_LDT_ADDSTATUS_TGTDONE(x) _SB_MAKEVALUE_32(x, S_LDT_ADDSTATUS_TGTDONE)
406#define G_LDT_ADDSTATUS_TGTDONE(x) _SB_GETVALUE_32(x, S_LDT_ADDSTATUS_TGTDONE, M_LDT_ADDSTATUS_TGTDONE)
407#endif /* 1250 PASS2 || 112x PASS1 */
408
409#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_mac.h b/arch/mips/include/asm/sibyte/sb1250_mac.h
new file mode 100644
index 000000000..3ddbd4b5d
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_mac.h
@@ -0,0 +1,643 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * MAC constants and macros File: sb1250_mac.h
6 *
7 * This module contains constants and macros for the SB1250's
8 * ethernet controllers.
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _SB1250_MAC_H
21#define _SB1250_MAC_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25/* *********************************************************************
26 * Ethernet MAC Registers
27 ********************************************************************* */
28
29/*
30 * MAC Configuration Register (Table 9-13)
31 * Register: MAC_CFG_0
32 * Register: MAC_CFG_1
33 * Register: MAC_CFG_2
34 */
35
36
37#define M_MAC_RESERVED0 _SB_MAKEMASK1(0)
38#define M_MAC_TX_HOLD_SOP_EN _SB_MAKEMASK1(1)
39#define M_MAC_RETRY_EN _SB_MAKEMASK1(2)
40#define M_MAC_RET_DRPREQ_EN _SB_MAKEMASK1(3)
41#define M_MAC_RET_UFL_EN _SB_MAKEMASK1(4)
42#define M_MAC_BURST_EN _SB_MAKEMASK1(5)
43
44#define S_MAC_TX_PAUSE _SB_MAKE64(6)
45#define M_MAC_TX_PAUSE_CNT _SB_MAKEMASK(3, S_MAC_TX_PAUSE)
46#define V_MAC_TX_PAUSE_CNT(x) _SB_MAKEVALUE(x, S_MAC_TX_PAUSE)
47
48#define K_MAC_TX_PAUSE_CNT_512 0
49#define K_MAC_TX_PAUSE_CNT_1K 1
50#define K_MAC_TX_PAUSE_CNT_2K 2
51#define K_MAC_TX_PAUSE_CNT_4K 3
52#define K_MAC_TX_PAUSE_CNT_8K 4
53#define K_MAC_TX_PAUSE_CNT_16K 5
54#define K_MAC_TX_PAUSE_CNT_32K 6
55#define K_MAC_TX_PAUSE_CNT_64K 7
56
57#define V_MAC_TX_PAUSE_CNT_512 V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_512)
58#define V_MAC_TX_PAUSE_CNT_1K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_1K)
59#define V_MAC_TX_PAUSE_CNT_2K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_2K)
60#define V_MAC_TX_PAUSE_CNT_4K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_4K)
61#define V_MAC_TX_PAUSE_CNT_8K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_8K)
62#define V_MAC_TX_PAUSE_CNT_16K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_16K)
63#define V_MAC_TX_PAUSE_CNT_32K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_32K)
64#define V_MAC_TX_PAUSE_CNT_64K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_64K)
65
66#define M_MAC_RESERVED1 _SB_MAKEMASK(8, 9)
67
68#define M_MAC_AP_STAT_EN _SB_MAKEMASK1(17)
69
70#if SIBYTE_HDR_FEATURE_CHIP(1480)
71#define M_MAC_TIMESTAMP _SB_MAKEMASK1(18)
72#endif
73#define M_MAC_DRP_ERRPKT_EN _SB_MAKEMASK1(19)
74#define M_MAC_DRP_FCSERRPKT_EN _SB_MAKEMASK1(20)
75#define M_MAC_DRP_CODEERRPKT_EN _SB_MAKEMASK1(21)
76#define M_MAC_DRP_DRBLERRPKT_EN _SB_MAKEMASK1(22)
77#define M_MAC_DRP_RNTPKT_EN _SB_MAKEMASK1(23)
78#define M_MAC_DRP_OSZPKT_EN _SB_MAKEMASK1(24)
79#define M_MAC_DRP_LENERRPKT_EN _SB_MAKEMASK1(25)
80
81#define M_MAC_RESERVED3 _SB_MAKEMASK(6, 26)
82
83#define M_MAC_BYPASS_SEL _SB_MAKEMASK1(32)
84#define M_MAC_HDX_EN _SB_MAKEMASK1(33)
85
86#define S_MAC_SPEED_SEL _SB_MAKE64(34)
87#define M_MAC_SPEED_SEL _SB_MAKEMASK(2, S_MAC_SPEED_SEL)
88#define V_MAC_SPEED_SEL(x) _SB_MAKEVALUE(x, S_MAC_SPEED_SEL)
89#define G_MAC_SPEED_SEL(x) _SB_GETVALUE(x, S_MAC_SPEED_SEL, M_MAC_SPEED_SEL)
90
91#define K_MAC_SPEED_SEL_10MBPS 0
92#define K_MAC_SPEED_SEL_100MBPS 1
93#define K_MAC_SPEED_SEL_1000MBPS 2
94#define K_MAC_SPEED_SEL_RESERVED 3
95
96#define V_MAC_SPEED_SEL_10MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_10MBPS)
97#define V_MAC_SPEED_SEL_100MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_100MBPS)
98#define V_MAC_SPEED_SEL_1000MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_1000MBPS)
99#define V_MAC_SPEED_SEL_RESERVED V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_RESERVED)
100
101#define M_MAC_TX_CLK_EDGE_SEL _SB_MAKEMASK1(36)
102#define M_MAC_LOOPBACK_SEL _SB_MAKEMASK1(37)
103#define M_MAC_FAST_SYNC _SB_MAKEMASK1(38)
104#define M_MAC_SS_EN _SB_MAKEMASK1(39)
105
106#define S_MAC_BYPASS_CFG _SB_MAKE64(40)
107#define M_MAC_BYPASS_CFG _SB_MAKEMASK(2, S_MAC_BYPASS_CFG)
108#define V_MAC_BYPASS_CFG(x) _SB_MAKEVALUE(x, S_MAC_BYPASS_CFG)
109#define G_MAC_BYPASS_CFG(x) _SB_GETVALUE(x, S_MAC_BYPASS_CFG, M_MAC_BYPASS_CFG)
110
111#define K_MAC_BYPASS_GMII 0
112#define K_MAC_BYPASS_ENCODED 1
113#define K_MAC_BYPASS_SOP 2
114#define K_MAC_BYPASS_EOP 3
115
116#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42)
117#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43)
118
119#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
120#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44)
121#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
122
123#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
124#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45)
125#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
126
127#define S_MAC_BYPASS_IFG _SB_MAKE64(46)
128#define M_MAC_BYPASS_IFG _SB_MAKEMASK(8, S_MAC_BYPASS_IFG)
129#define V_MAC_BYPASS_IFG(x) _SB_MAKEVALUE(x, S_MAC_BYPASS_IFG)
130#define G_MAC_BYPASS_IFG(x) _SB_GETVALUE(x, S_MAC_BYPASS_IFG, M_MAC_BYPASS_IFG)
131
132#define K_MAC_FC_CMD_DISABLED 0
133#define K_MAC_FC_CMD_ENABLED 1
134#define K_MAC_FC_CMD_ENAB_FALSECARR 2
135
136#define V_MAC_FC_CMD_DISABLED V_MAC_FC_CMD(K_MAC_FC_CMD_DISABLED)
137#define V_MAC_FC_CMD_ENABLED V_MAC_FC_CMD(K_MAC_FC_CMD_ENABLED)
138#define V_MAC_FC_CMD_ENAB_FALSECARR V_MAC_FC_CMD(K_MAC_FC_CMD_ENAB_FALSECARR)
139
140#define M_MAC_FC_SEL _SB_MAKEMASK1(54)
141
142#define S_MAC_FC_CMD _SB_MAKE64(55)
143#define M_MAC_FC_CMD _SB_MAKEMASK(2, S_MAC_FC_CMD)
144#define V_MAC_FC_CMD(x) _SB_MAKEVALUE(x, S_MAC_FC_CMD)
145#define G_MAC_FC_CMD(x) _SB_GETVALUE(x, S_MAC_FC_CMD, M_MAC_FC_CMD)
146
147#define S_MAC_RX_CH_SEL _SB_MAKE64(57)
148#define M_MAC_RX_CH_SEL _SB_MAKEMASK(7, S_MAC_RX_CH_SEL)
149#define V_MAC_RX_CH_SEL(x) _SB_MAKEVALUE(x, S_MAC_RX_CH_SEL)
150#define G_MAC_RX_CH_SEL(x) _SB_GETVALUE(x, S_MAC_RX_CH_SEL, M_MAC_RX_CH_SEL)
151
152
153/*
154 * MAC Enable Registers
155 * Register: MAC_ENABLE_0
156 * Register: MAC_ENABLE_1
157 * Register: MAC_ENABLE_2
158 */
159
160#define M_MAC_RXDMA_EN0 _SB_MAKEMASK1(0)
161#define M_MAC_RXDMA_EN1 _SB_MAKEMASK1(1)
162#define M_MAC_TXDMA_EN0 _SB_MAKEMASK1(4)
163#define M_MAC_TXDMA_EN1 _SB_MAKEMASK1(5)
164
165#define M_MAC_PORT_RESET _SB_MAKEMASK1(8)
166
167#if (SIBYTE_HDR_FEATURE_CHIP(1250) || SIBYTE_HDR_FEATURE_CHIP(112x))
168#define M_MAC_RX_ENABLE _SB_MAKEMASK1(10)
169#define M_MAC_TX_ENABLE _SB_MAKEMASK1(11)
170#define M_MAC_BYP_RX_ENABLE _SB_MAKEMASK1(12)
171#define M_MAC_BYP_TX_ENABLE _SB_MAKEMASK1(13)
172#endif
173
174/*
175 * MAC reset information register (1280/1255)
176 */
177#if SIBYTE_HDR_FEATURE_CHIP(1480)
178#define M_MAC_RX_CH0_PAUSE_ON _SB_MAKEMASK1(8)
179#define M_MAC_RX_CH1_PAUSE_ON _SB_MAKEMASK1(16)
180#define M_MAC_TX_CH0_PAUSE_ON _SB_MAKEMASK1(24)
181#define M_MAC_TX_CH1_PAUSE_ON _SB_MAKEMASK1(32)
182#endif
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 Threshold 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) || SIBYTE_HDR_FEATURE_CHIP(1480)
214#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7, S_MAC_TX_WR_THRSH)
215#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
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) || SIBYTE_HDR_FEATURE_CHIP(1480)
225#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7, S_MAC_TX_RD_THRSH)
226#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
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) || SIBYTE_HDR_FEATURE_CHIP(1480)
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 || 1480 */
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) || SIBYTE_HDR_FEATURE_CHIP(1480)
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 || 1480 */
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) || SIBYTE_HDR_FEATURE_CHIP(1480)
453#define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */
454#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
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) || SIBYTE_HDR_FEATURE_CHIP(1480)
462#define M_MAC_TX_PAUSE_ON _SB_MAKEMASK1(52)
463#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
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 Receive 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 Receive 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) || SIBYTE_HDR_FEATURE_CHIP(1480)
589#define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7)
590#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
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) || SIBYTE_HDR_FEATURE_CHIP(1480)
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 || 1480 */
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/arch/mips/include/asm/sibyte/sb1250_mc.h b/arch/mips/include/asm/sibyte/sb1250_mc.h
new file mode 100644
index 000000000..c02fe823e
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_mc.h
@@ -0,0 +1,537 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * Memory Controller constants File: sb1250_mc.h
6 *
7 * This module contains constants and macros useful for
8 * programming the memory controller.
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 *********************************************************************
13 *
14 * Copyright 2000, 2001, 2002, 2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _SB1250_MC_H
21#define _SB1250_MC_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25/*
26 * Memory Channel Config Register (table 6-14)
27 */
28
29#define S_MC_RESERVED0 0
30#define M_MC_RESERVED0 _SB_MAKEMASK(8, S_MC_RESERVED0)
31
32#define S_MC_CHANNEL_SEL 8
33#define M_MC_CHANNEL_SEL _SB_MAKEMASK(8, S_MC_CHANNEL_SEL)
34#define V_MC_CHANNEL_SEL(x) _SB_MAKEVALUE(x, S_MC_CHANNEL_SEL)
35#define G_MC_CHANNEL_SEL(x) _SB_GETVALUE(x, S_MC_CHANNEL_SEL, M_MC_CHANNEL_SEL)
36
37#define S_MC_BANK0_MAP 16
38#define M_MC_BANK0_MAP _SB_MAKEMASK(4, S_MC_BANK0_MAP)
39#define V_MC_BANK0_MAP(x) _SB_MAKEVALUE(x, S_MC_BANK0_MAP)
40#define G_MC_BANK0_MAP(x) _SB_GETVALUE(x, S_MC_BANK0_MAP, M_MC_BANK0_MAP)
41
42#define K_MC_BANK0_MAP_DEFAULT 0x00
43#define V_MC_BANK0_MAP_DEFAULT V_MC_BANK0_MAP(K_MC_BANK0_MAP_DEFAULT)
44
45#define S_MC_BANK1_MAP 20
46#define M_MC_BANK1_MAP _SB_MAKEMASK(4, S_MC_BANK1_MAP)
47#define V_MC_BANK1_MAP(x) _SB_MAKEVALUE(x, S_MC_BANK1_MAP)
48#define G_MC_BANK1_MAP(x) _SB_GETVALUE(x, S_MC_BANK1_MAP, M_MC_BANK1_MAP)
49
50#define K_MC_BANK1_MAP_DEFAULT 0x08
51#define V_MC_BANK1_MAP_DEFAULT V_MC_BANK1_MAP(K_MC_BANK1_MAP_DEFAULT)
52
53#define S_MC_BANK2_MAP 24
54#define M_MC_BANK2_MAP _SB_MAKEMASK(4, S_MC_BANK2_MAP)
55#define V_MC_BANK2_MAP(x) _SB_MAKEVALUE(x, S_MC_BANK2_MAP)
56#define G_MC_BANK2_MAP(x) _SB_GETVALUE(x, S_MC_BANK2_MAP, M_MC_BANK2_MAP)
57
58#define K_MC_BANK2_MAP_DEFAULT 0x09
59#define V_MC_BANK2_MAP_DEFAULT V_MC_BANK2_MAP(K_MC_BANK2_MAP_DEFAULT)
60
61#define S_MC_BANK3_MAP 28
62#define M_MC_BANK3_MAP _SB_MAKEMASK(4, S_MC_BANK3_MAP)
63#define V_MC_BANK3_MAP(x) _SB_MAKEVALUE(x, S_MC_BANK3_MAP)
64#define G_MC_BANK3_MAP(x) _SB_GETVALUE(x, S_MC_BANK3_MAP, M_MC_BANK3_MAP)
65
66#define K_MC_BANK3_MAP_DEFAULT 0x0C
67#define V_MC_BANK3_MAP_DEFAULT V_MC_BANK3_MAP(K_MC_BANK3_MAP_DEFAULT)
68
69#define M_MC_RESERVED1 _SB_MAKEMASK(8, 32)
70
71#define S_MC_QUEUE_SIZE 40
72#define M_MC_QUEUE_SIZE _SB_MAKEMASK(4, S_MC_QUEUE_SIZE)
73#define V_MC_QUEUE_SIZE(x) _SB_MAKEVALUE(x, S_MC_QUEUE_SIZE)
74#define G_MC_QUEUE_SIZE(x) _SB_GETVALUE(x, S_MC_QUEUE_SIZE, M_MC_QUEUE_SIZE)
75#define V_MC_QUEUE_SIZE_DEFAULT V_MC_QUEUE_SIZE(0x0A)
76
77#define S_MC_AGE_LIMIT 44
78#define M_MC_AGE_LIMIT _SB_MAKEMASK(4, S_MC_AGE_LIMIT)
79#define V_MC_AGE_LIMIT(x) _SB_MAKEVALUE(x, S_MC_AGE_LIMIT)
80#define G_MC_AGE_LIMIT(x) _SB_GETVALUE(x, S_MC_AGE_LIMIT, M_MC_AGE_LIMIT)
81#define V_MC_AGE_LIMIT_DEFAULT V_MC_AGE_LIMIT(8)
82
83#define S_MC_WR_LIMIT 48
84#define M_MC_WR_LIMIT _SB_MAKEMASK(4, S_MC_WR_LIMIT)
85#define V_MC_WR_LIMIT(x) _SB_MAKEVALUE(x, S_MC_WR_LIMIT)
86#define G_MC_WR_LIMIT(x) _SB_GETVALUE(x, S_MC_WR_LIMIT, M_MC_WR_LIMIT)
87#define V_MC_WR_LIMIT_DEFAULT V_MC_WR_LIMIT(5)
88
89#define M_MC_IOB1HIGHPRIORITY _SB_MAKEMASK1(52)
90
91#define M_MC_RESERVED2 _SB_MAKEMASK(3, 53)
92
93#define S_MC_CS_MODE 56
94#define M_MC_CS_MODE _SB_MAKEMASK(4, S_MC_CS_MODE)
95#define V_MC_CS_MODE(x) _SB_MAKEVALUE(x, S_MC_CS_MODE)
96#define G_MC_CS_MODE(x) _SB_GETVALUE(x, S_MC_CS_MODE, M_MC_CS_MODE)
97
98#define K_MC_CS_MODE_MSB_CS 0
99#define K_MC_CS_MODE_INTLV_CS 15
100#define K_MC_CS_MODE_MIXED_CS_10 12
101#define K_MC_CS_MODE_MIXED_CS_30 6
102#define K_MC_CS_MODE_MIXED_CS_32 3
103
104#define V_MC_CS_MODE_MSB_CS V_MC_CS_MODE(K_MC_CS_MODE_MSB_CS)
105#define V_MC_CS_MODE_INTLV_CS V_MC_CS_MODE(K_MC_CS_MODE_INTLV_CS)
106#define V_MC_CS_MODE_MIXED_CS_10 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_10)
107#define V_MC_CS_MODE_MIXED_CS_30 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_30)
108#define V_MC_CS_MODE_MIXED_CS_32 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_32)
109
110#define M_MC_ECC_DISABLE _SB_MAKEMASK1(60)
111#define M_MC_BERR_DISABLE _SB_MAKEMASK1(61)
112#define M_MC_FORCE_SEQ _SB_MAKEMASK1(62)
113#define M_MC_DEBUG _SB_MAKEMASK1(63)
114
115#define V_MC_CONFIG_DEFAULT V_MC_WR_LIMIT_DEFAULT | V_MC_AGE_LIMIT_DEFAULT | \
116 V_MC_BANK0_MAP_DEFAULT | V_MC_BANK1_MAP_DEFAULT | \
117 V_MC_BANK2_MAP_DEFAULT | V_MC_BANK3_MAP_DEFAULT | V_MC_CHANNEL_SEL(0) | \
118 M_MC_IOB1HIGHPRIORITY | V_MC_QUEUE_SIZE_DEFAULT
119
120
121/*
122 * Memory clock config register (Table 6-15)
123 *
124 * Note: this field has been updated to be consistent with the errata to 0.2
125 */
126
127#define S_MC_CLK_RATIO 0
128#define M_MC_CLK_RATIO _SB_MAKEMASK(4, S_MC_CLK_RATIO)
129#define V_MC_CLK_RATIO(x) _SB_MAKEVALUE(x, S_MC_CLK_RATIO)
130#define G_MC_CLK_RATIO(x) _SB_GETVALUE(x, S_MC_CLK_RATIO, M_MC_CLK_RATIO)
131
132#define K_MC_CLK_RATIO_2X 4
133#define K_MC_CLK_RATIO_25X 5
134#define K_MC_CLK_RATIO_3X 6
135#define K_MC_CLK_RATIO_35X 7
136#define K_MC_CLK_RATIO_4X 8
137#define K_MC_CLK_RATIO_45X 9
138
139#define V_MC_CLK_RATIO_2X V_MC_CLK_RATIO(K_MC_CLK_RATIO_2X)
140#define V_MC_CLK_RATIO_25X V_MC_CLK_RATIO(K_MC_CLK_RATIO_25X)
141#define V_MC_CLK_RATIO_3X V_MC_CLK_RATIO(K_MC_CLK_RATIO_3X)
142#define V_MC_CLK_RATIO_35X V_MC_CLK_RATIO(K_MC_CLK_RATIO_35X)
143#define V_MC_CLK_RATIO_4X V_MC_CLK_RATIO(K_MC_CLK_RATIO_4X)
144#define V_MC_CLK_RATIO_45X V_MC_CLK_RATIO(K_MC_CLK_RATIO_45X)
145#define V_MC_CLK_RATIO_DEFAULT V_MC_CLK_RATIO_25X
146
147#define S_MC_REF_RATE 8
148#define M_MC_REF_RATE _SB_MAKEMASK(8, S_MC_REF_RATE)
149#define V_MC_REF_RATE(x) _SB_MAKEVALUE(x, S_MC_REF_RATE)
150#define G_MC_REF_RATE(x) _SB_GETVALUE(x, S_MC_REF_RATE, M_MC_REF_RATE)
151
152#define K_MC_REF_RATE_100MHz 0x62
153#define K_MC_REF_RATE_133MHz 0x81
154#define K_MC_REF_RATE_200MHz 0xC4
155
156#define V_MC_REF_RATE_100MHz V_MC_REF_RATE(K_MC_REF_RATE_100MHz)
157#define V_MC_REF_RATE_133MHz V_MC_REF_RATE(K_MC_REF_RATE_133MHz)
158#define V_MC_REF_RATE_200MHz V_MC_REF_RATE(K_MC_REF_RATE_200MHz)
159#define V_MC_REF_RATE_DEFAULT V_MC_REF_RATE_100MHz
160
161#define S_MC_CLOCK_DRIVE 16
162#define M_MC_CLOCK_DRIVE _SB_MAKEMASK(4, S_MC_CLOCK_DRIVE)
163#define V_MC_CLOCK_DRIVE(x) _SB_MAKEVALUE(x, S_MC_CLOCK_DRIVE)
164#define G_MC_CLOCK_DRIVE(x) _SB_GETVALUE(x, S_MC_CLOCK_DRIVE, M_MC_CLOCK_DRIVE)
165#define V_MC_CLOCK_DRIVE_DEFAULT V_MC_CLOCK_DRIVE(0xF)
166
167#define S_MC_DATA_DRIVE 20
168#define M_MC_DATA_DRIVE _SB_MAKEMASK(4, S_MC_DATA_DRIVE)
169#define V_MC_DATA_DRIVE(x) _SB_MAKEVALUE(x, S_MC_DATA_DRIVE)
170#define G_MC_DATA_DRIVE(x) _SB_GETVALUE(x, S_MC_DATA_DRIVE, M_MC_DATA_DRIVE)
171#define V_MC_DATA_DRIVE_DEFAULT V_MC_DATA_DRIVE(0x0)
172
173#define S_MC_ADDR_DRIVE 24
174#define M_MC_ADDR_DRIVE _SB_MAKEMASK(4, S_MC_ADDR_DRIVE)
175#define V_MC_ADDR_DRIVE(x) _SB_MAKEVALUE(x, S_MC_ADDR_DRIVE)
176#define G_MC_ADDR_DRIVE(x) _SB_GETVALUE(x, S_MC_ADDR_DRIVE, M_MC_ADDR_DRIVE)
177#define V_MC_ADDR_DRIVE_DEFAULT V_MC_ADDR_DRIVE(0x0)
178
179#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
180#define M_MC_REF_DISABLE _SB_MAKEMASK1(30)
181#endif /* 1250 PASS3 || 112x PASS1 */
182
183#define M_MC_DLL_BYPASS _SB_MAKEMASK1(31)
184
185#define S_MC_DQI_SKEW 32
186#define M_MC_DQI_SKEW _SB_MAKEMASK(8, S_MC_DQI_SKEW)
187#define V_MC_DQI_SKEW(x) _SB_MAKEVALUE(x, S_MC_DQI_SKEW)
188#define G_MC_DQI_SKEW(x) _SB_GETVALUE(x, S_MC_DQI_SKEW, M_MC_DQI_SKEW)
189#define V_MC_DQI_SKEW_DEFAULT V_MC_DQI_SKEW(0)
190
191#define S_MC_DQO_SKEW 40
192#define M_MC_DQO_SKEW _SB_MAKEMASK(8, S_MC_DQO_SKEW)
193#define V_MC_DQO_SKEW(x) _SB_MAKEVALUE(x, S_MC_DQO_SKEW)
194#define G_MC_DQO_SKEW(x) _SB_GETVALUE(x, S_MC_DQO_SKEW, M_MC_DQO_SKEW)
195#define V_MC_DQO_SKEW_DEFAULT V_MC_DQO_SKEW(0)
196
197#define S_MC_ADDR_SKEW 48
198#define M_MC_ADDR_SKEW _SB_MAKEMASK(8, S_MC_ADDR_SKEW)
199#define V_MC_ADDR_SKEW(x) _SB_MAKEVALUE(x, S_MC_ADDR_SKEW)
200#define G_MC_ADDR_SKEW(x) _SB_GETVALUE(x, S_MC_ADDR_SKEW, M_MC_ADDR_SKEW)
201#define V_MC_ADDR_SKEW_DEFAULT V_MC_ADDR_SKEW(0x0F)
202
203#define S_MC_DLL_DEFAULT 56
204#define M_MC_DLL_DEFAULT _SB_MAKEMASK(8, S_MC_DLL_DEFAULT)
205#define V_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x, S_MC_DLL_DEFAULT)
206#define G_MC_DLL_DEFAULT(x) _SB_GETVALUE(x, S_MC_DLL_DEFAULT, M_MC_DLL_DEFAULT)
207#define V_MC_DLL_DEFAULT_DEFAULT V_MC_DLL_DEFAULT(0x10)
208
209#define V_MC_CLKCONFIG_DEFAULT V_MC_DLL_DEFAULT_DEFAULT | \
210 V_MC_ADDR_SKEW_DEFAULT | \
211 V_MC_DQO_SKEW_DEFAULT | \
212 V_MC_DQI_SKEW_DEFAULT | \
213 V_MC_ADDR_DRIVE_DEFAULT | \
214 V_MC_DATA_DRIVE_DEFAULT | \
215 V_MC_CLOCK_DRIVE_DEFAULT | \
216 V_MC_REF_RATE_DEFAULT
217
218
219
220/*
221 * DRAM Command Register (Table 6-13)
222 */
223
224#define S_MC_COMMAND 0
225#define M_MC_COMMAND _SB_MAKEMASK(4, S_MC_COMMAND)
226#define V_MC_COMMAND(x) _SB_MAKEVALUE(x, S_MC_COMMAND)
227#define G_MC_COMMAND(x) _SB_GETVALUE(x, S_MC_COMMAND, M_MC_COMMAND)
228
229#define K_MC_COMMAND_EMRS 0
230#define K_MC_COMMAND_MRS 1
231#define K_MC_COMMAND_PRE 2
232#define K_MC_COMMAND_AR 3
233#define K_MC_COMMAND_SETRFSH 4
234#define K_MC_COMMAND_CLRRFSH 5
235#define K_MC_COMMAND_SETPWRDN 6
236#define K_MC_COMMAND_CLRPWRDN 7
237
238#define V_MC_COMMAND_EMRS V_MC_COMMAND(K_MC_COMMAND_EMRS)
239#define V_MC_COMMAND_MRS V_MC_COMMAND(K_MC_COMMAND_MRS)
240#define V_MC_COMMAND_PRE V_MC_COMMAND(K_MC_COMMAND_PRE)
241#define V_MC_COMMAND_AR V_MC_COMMAND(K_MC_COMMAND_AR)
242#define V_MC_COMMAND_SETRFSH V_MC_COMMAND(K_MC_COMMAND_SETRFSH)
243#define V_MC_COMMAND_CLRRFSH V_MC_COMMAND(K_MC_COMMAND_CLRRFSH)
244#define V_MC_COMMAND_SETPWRDN V_MC_COMMAND(K_MC_COMMAND_SETPWRDN)
245#define V_MC_COMMAND_CLRPWRDN V_MC_COMMAND(K_MC_COMMAND_CLRPWRDN)
246
247#define M_MC_CS0 _SB_MAKEMASK1(4)
248#define M_MC_CS1 _SB_MAKEMASK1(5)
249#define M_MC_CS2 _SB_MAKEMASK1(6)
250#define M_MC_CS3 _SB_MAKEMASK1(7)
251
252/*
253 * DRAM Mode Register (Table 6-14)
254 */
255
256#define S_MC_EMODE 0
257#define M_MC_EMODE _SB_MAKEMASK(15, S_MC_EMODE)
258#define V_MC_EMODE(x) _SB_MAKEVALUE(x, S_MC_EMODE)
259#define G_MC_EMODE(x) _SB_GETVALUE(x, S_MC_EMODE, M_MC_EMODE)
260#define V_MC_EMODE_DEFAULT V_MC_EMODE(0)
261
262#define S_MC_MODE 16
263#define M_MC_MODE _SB_MAKEMASK(15, S_MC_MODE)
264#define V_MC_MODE(x) _SB_MAKEVALUE(x, S_MC_MODE)
265#define G_MC_MODE(x) _SB_GETVALUE(x, S_MC_MODE, M_MC_MODE)
266#define V_MC_MODE_DEFAULT V_MC_MODE(0x22)
267
268#define S_MC_DRAM_TYPE 32
269#define M_MC_DRAM_TYPE _SB_MAKEMASK(3, S_MC_DRAM_TYPE)
270#define V_MC_DRAM_TYPE(x) _SB_MAKEVALUE(x, S_MC_DRAM_TYPE)
271#define G_MC_DRAM_TYPE(x) _SB_GETVALUE(x, S_MC_DRAM_TYPE, M_MC_DRAM_TYPE)
272
273#define K_MC_DRAM_TYPE_JEDEC 0
274#define K_MC_DRAM_TYPE_FCRAM 1
275#define K_MC_DRAM_TYPE_SGRAM 2
276
277#define V_MC_DRAM_TYPE_JEDEC V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_JEDEC)
278#define V_MC_DRAM_TYPE_FCRAM V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_FCRAM)
279#define V_MC_DRAM_TYPE_SGRAM V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_SGRAM)
280
281#define M_MC_EXTERNALDECODE _SB_MAKEMASK1(35)
282
283#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
284#define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36)
285#define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(37)
286#endif /* 1250 PASS3 || 112x PASS1 */
287
288
289
290/*
291 * SDRAM Timing Register (Table 6-15)
292 */
293
294#define M_MC_w2rIDLE_TWOCYCLES _SB_MAKEMASK1(60)
295#define M_MC_r2wIDLE_TWOCYCLES _SB_MAKEMASK1(61)
296#define M_MC_r2rIDLE_TWOCYCLES _SB_MAKEMASK1(62)
297
298#define S_MC_tFIFO 56
299#define M_MC_tFIFO _SB_MAKEMASK(4, S_MC_tFIFO)
300#define V_MC_tFIFO(x) _SB_MAKEVALUE(x, S_MC_tFIFO)
301#define G_MC_tFIFO(x) _SB_GETVALUE(x, S_MC_tFIFO, M_MC_tFIFO)
302#define K_MC_tFIFO_DEFAULT 1
303#define V_MC_tFIFO_DEFAULT V_MC_tFIFO(K_MC_tFIFO_DEFAULT)
304
305#define S_MC_tRFC 52
306#define M_MC_tRFC _SB_MAKEMASK(4, S_MC_tRFC)
307#define V_MC_tRFC(x) _SB_MAKEVALUE(x, S_MC_tRFC)
308#define G_MC_tRFC(x) _SB_GETVALUE(x, S_MC_tRFC, M_MC_tRFC)
309#define K_MC_tRFC_DEFAULT 12
310#define V_MC_tRFC_DEFAULT V_MC_tRFC(K_MC_tRFC_DEFAULT)
311
312#if SIBYTE_HDR_FEATURE(1250, PASS3)
313#define M_MC_tRFC_PLUS16 _SB_MAKEMASK1(51) /* 1250C3 and later. */
314#endif
315
316#define S_MC_tCwCr 40
317#define M_MC_tCwCr _SB_MAKEMASK(4, S_MC_tCwCr)
318#define V_MC_tCwCr(x) _SB_MAKEVALUE(x, S_MC_tCwCr)
319#define G_MC_tCwCr(x) _SB_GETVALUE(x, S_MC_tCwCr, M_MC_tCwCr)
320#define K_MC_tCwCr_DEFAULT 4
321#define V_MC_tCwCr_DEFAULT V_MC_tCwCr(K_MC_tCwCr_DEFAULT)
322
323#define S_MC_tRCr 28
324#define M_MC_tRCr _SB_MAKEMASK(4, S_MC_tRCr)
325#define V_MC_tRCr(x) _SB_MAKEVALUE(x, S_MC_tRCr)
326#define G_MC_tRCr(x) _SB_GETVALUE(x, S_MC_tRCr, M_MC_tRCr)
327#define K_MC_tRCr_DEFAULT 9
328#define V_MC_tRCr_DEFAULT V_MC_tRCr(K_MC_tRCr_DEFAULT)
329
330#define S_MC_tRCw 24
331#define M_MC_tRCw _SB_MAKEMASK(4, S_MC_tRCw)
332#define V_MC_tRCw(x) _SB_MAKEVALUE(x, S_MC_tRCw)
333#define G_MC_tRCw(x) _SB_GETVALUE(x, S_MC_tRCw, M_MC_tRCw)
334#define K_MC_tRCw_DEFAULT 10
335#define V_MC_tRCw_DEFAULT V_MC_tRCw(K_MC_tRCw_DEFAULT)
336
337#define S_MC_tRRD 20
338#define M_MC_tRRD _SB_MAKEMASK(4, S_MC_tRRD)
339#define V_MC_tRRD(x) _SB_MAKEVALUE(x, S_MC_tRRD)
340#define G_MC_tRRD(x) _SB_GETVALUE(x, S_MC_tRRD, M_MC_tRRD)
341#define K_MC_tRRD_DEFAULT 2
342#define V_MC_tRRD_DEFAULT V_MC_tRRD(K_MC_tRRD_DEFAULT)
343
344#define S_MC_tRP 16
345#define M_MC_tRP _SB_MAKEMASK(4, S_MC_tRP)
346#define V_MC_tRP(x) _SB_MAKEVALUE(x, S_MC_tRP)
347#define G_MC_tRP(x) _SB_GETVALUE(x, S_MC_tRP, M_MC_tRP)
348#define K_MC_tRP_DEFAULT 4
349#define V_MC_tRP_DEFAULT V_MC_tRP(K_MC_tRP_DEFAULT)
350
351#define S_MC_tCwD 8
352#define M_MC_tCwD _SB_MAKEMASK(4, S_MC_tCwD)
353#define V_MC_tCwD(x) _SB_MAKEVALUE(x, S_MC_tCwD)
354#define G_MC_tCwD(x) _SB_GETVALUE(x, S_MC_tCwD, M_MC_tCwD)
355#define K_MC_tCwD_DEFAULT 1
356#define V_MC_tCwD_DEFAULT V_MC_tCwD(K_MC_tCwD_DEFAULT)
357
358#define M_tCrDh _SB_MAKEMASK1(7)
359#define M_MC_tCrDh M_tCrDh
360
361#define S_MC_tCrD 4
362#define M_MC_tCrD _SB_MAKEMASK(3, S_MC_tCrD)
363#define V_MC_tCrD(x) _SB_MAKEVALUE(x, S_MC_tCrD)
364#define G_MC_tCrD(x) _SB_GETVALUE(x, S_MC_tCrD, M_MC_tCrD)
365#define K_MC_tCrD_DEFAULT 2
366#define V_MC_tCrD_DEFAULT V_MC_tCrD(K_MC_tCrD_DEFAULT)
367
368#define S_MC_tRCD 0
369#define M_MC_tRCD _SB_MAKEMASK(4, S_MC_tRCD)
370#define V_MC_tRCD(x) _SB_MAKEVALUE(x, S_MC_tRCD)
371#define G_MC_tRCD(x) _SB_GETVALUE(x, S_MC_tRCD, M_MC_tRCD)
372#define K_MC_tRCD_DEFAULT 3
373#define V_MC_tRCD_DEFAULT V_MC_tRCD(K_MC_tRCD_DEFAULT)
374
375#define V_MC_TIMING_DEFAULT V_MC_tFIFO(K_MC_tFIFO_DEFAULT) | \
376 V_MC_tRFC(K_MC_tRFC_DEFAULT) | \
377 V_MC_tCwCr(K_MC_tCwCr_DEFAULT) | \
378 V_MC_tRCr(K_MC_tRCr_DEFAULT) | \
379 V_MC_tRCw(K_MC_tRCw_DEFAULT) | \
380 V_MC_tRRD(K_MC_tRRD_DEFAULT) | \
381 V_MC_tRP(K_MC_tRP_DEFAULT) | \
382 V_MC_tCwD(K_MC_tCwD_DEFAULT) | \
383 V_MC_tCrD(K_MC_tCrD_DEFAULT) | \
384 V_MC_tRCD(K_MC_tRCD_DEFAULT) | \
385 M_MC_r2rIDLE_TWOCYCLES
386
387/*
388 * Errata says these are not the default
389 * M_MC_w2rIDLE_TWOCYCLES | \
390 * M_MC_r2wIDLE_TWOCYCLES | \
391 */
392
393
394/*
395 * Chip Select Start Address Register (Table 6-17)
396 */
397
398#define S_MC_CS0_START 0
399#define M_MC_CS0_START _SB_MAKEMASK(16, S_MC_CS0_START)
400#define V_MC_CS0_START(x) _SB_MAKEVALUE(x, S_MC_CS0_START)
401#define G_MC_CS0_START(x) _SB_GETVALUE(x, S_MC_CS0_START, M_MC_CS0_START)
402
403#define S_MC_CS1_START 16
404#define M_MC_CS1_START _SB_MAKEMASK(16, S_MC_CS1_START)
405#define V_MC_CS1_START(x) _SB_MAKEVALUE(x, S_MC_CS1_START)
406#define G_MC_CS1_START(x) _SB_GETVALUE(x, S_MC_CS1_START, M_MC_CS1_START)
407
408#define S_MC_CS2_START 32
409#define M_MC_CS2_START _SB_MAKEMASK(16, S_MC_CS2_START)
410#define V_MC_CS2_START(x) _SB_MAKEVALUE(x, S_MC_CS2_START)
411#define G_MC_CS2_START(x) _SB_GETVALUE(x, S_MC_CS2_START, M_MC_CS2_START)
412
413#define S_MC_CS3_START 48
414#define M_MC_CS3_START _SB_MAKEMASK(16, S_MC_CS3_START)
415#define V_MC_CS3_START(x) _SB_MAKEVALUE(x, S_MC_CS3_START)
416#define G_MC_CS3_START(x) _SB_GETVALUE(x, S_MC_CS3_START, M_MC_CS3_START)
417
418/*
419 * Chip Select End Address Register (Table 6-18)
420 */
421
422#define S_MC_CS0_END 0
423#define M_MC_CS0_END _SB_MAKEMASK(16, S_MC_CS0_END)
424#define V_MC_CS0_END(x) _SB_MAKEVALUE(x, S_MC_CS0_END)
425#define G_MC_CS0_END(x) _SB_GETVALUE(x, S_MC_CS0_END, M_MC_CS0_END)
426
427#define S_MC_CS1_END 16
428#define M_MC_CS1_END _SB_MAKEMASK(16, S_MC_CS1_END)
429#define V_MC_CS1_END(x) _SB_MAKEVALUE(x, S_MC_CS1_END)
430#define G_MC_CS1_END(x) _SB_GETVALUE(x, S_MC_CS1_END, M_MC_CS1_END)
431
432#define S_MC_CS2_END 32
433#define M_MC_CS2_END _SB_MAKEMASK(16, S_MC_CS2_END)
434#define V_MC_CS2_END(x) _SB_MAKEVALUE(x, S_MC_CS2_END)
435#define G_MC_CS2_END(x) _SB_GETVALUE(x, S_MC_CS2_END, M_MC_CS2_END)
436
437#define S_MC_CS3_END 48
438#define M_MC_CS3_END _SB_MAKEMASK(16, S_MC_CS3_END)
439#define V_MC_CS3_END(x) _SB_MAKEVALUE(x, S_MC_CS3_END)
440#define G_MC_CS3_END(x) _SB_GETVALUE(x, S_MC_CS3_END, M_MC_CS3_END)
441
442/*
443 * Chip Select Interleave Register (Table 6-19)
444 */
445
446#define S_MC_INTLV_RESERVED 0
447#define M_MC_INTLV_RESERVED _SB_MAKEMASK(5, S_MC_INTLV_RESERVED)
448
449#define S_MC_INTERLEAVE 7
450#define M_MC_INTERLEAVE _SB_MAKEMASK(18, S_MC_INTERLEAVE)
451#define V_MC_INTERLEAVE(x) _SB_MAKEVALUE(x, S_MC_INTERLEAVE)
452
453#define S_MC_INTLV_MBZ 25
454#define M_MC_INTLV_MBZ _SB_MAKEMASK(39, S_MC_INTLV_MBZ)
455
456/*
457 * Row Address Bits Register (Table 6-20)
458 */
459
460#define S_MC_RAS_RESERVED 0
461#define M_MC_RAS_RESERVED _SB_MAKEMASK(5, S_MC_RAS_RESERVED)
462
463#define S_MC_RAS_SELECT 12
464#define M_MC_RAS_SELECT _SB_MAKEMASK(25, S_MC_RAS_SELECT)
465#define V_MC_RAS_SELECT(x) _SB_MAKEVALUE(x, S_MC_RAS_SELECT)
466
467#define S_MC_RAS_MBZ 37
468#define M_MC_RAS_MBZ _SB_MAKEMASK(27, S_MC_RAS_MBZ)
469
470
471/*
472 * Column Address Bits Register (Table 6-21)
473 */
474
475#define S_MC_CAS_RESERVED 0
476#define M_MC_CAS_RESERVED _SB_MAKEMASK(5, S_MC_CAS_RESERVED)
477
478#define S_MC_CAS_SELECT 5
479#define M_MC_CAS_SELECT _SB_MAKEMASK(18, S_MC_CAS_SELECT)
480#define V_MC_CAS_SELECT(x) _SB_MAKEVALUE(x, S_MC_CAS_SELECT)
481
482#define S_MC_CAS_MBZ 23
483#define M_MC_CAS_MBZ _SB_MAKEMASK(41, S_MC_CAS_MBZ)
484
485
486/*
487 * Bank Address Address Bits Register (Table 6-22)
488 */
489
490#define S_MC_BA_RESERVED 0
491#define M_MC_BA_RESERVED _SB_MAKEMASK(5, S_MC_BA_RESERVED)
492
493#define S_MC_BA_SELECT 5
494#define M_MC_BA_SELECT _SB_MAKEMASK(20, S_MC_BA_SELECT)
495#define V_MC_BA_SELECT(x) _SB_MAKEVALUE(x, S_MC_BA_SELECT)
496
497#define S_MC_BA_MBZ 25
498#define M_MC_BA_MBZ _SB_MAKEMASK(39, S_MC_BA_MBZ)
499
500/*
501 * Chip Select Attribute Register (Table 6-23)
502 */
503
504#define K_MC_CS_ATTR_CLOSED 0
505#define K_MC_CS_ATTR_CASCHECK 1
506#define K_MC_CS_ATTR_HINT 2
507#define K_MC_CS_ATTR_OPEN 3
508
509#define S_MC_CS0_PAGE 0
510#define M_MC_CS0_PAGE _SB_MAKEMASK(2, S_MC_CS0_PAGE)
511#define V_MC_CS0_PAGE(x) _SB_MAKEVALUE(x, S_MC_CS0_PAGE)
512#define G_MC_CS0_PAGE(x) _SB_GETVALUE(x, S_MC_CS0_PAGE, M_MC_CS0_PAGE)
513
514#define S_MC_CS1_PAGE 16
515#define M_MC_CS1_PAGE _SB_MAKEMASK(2, S_MC_CS1_PAGE)
516#define V_MC_CS1_PAGE(x) _SB_MAKEVALUE(x, S_MC_CS1_PAGE)
517#define G_MC_CS1_PAGE(x) _SB_GETVALUE(x, S_MC_CS1_PAGE, M_MC_CS1_PAGE)
518
519#define S_MC_CS2_PAGE 32
520#define M_MC_CS2_PAGE _SB_MAKEMASK(2, S_MC_CS2_PAGE)
521#define V_MC_CS2_PAGE(x) _SB_MAKEVALUE(x, S_MC_CS2_PAGE)
522#define G_MC_CS2_PAGE(x) _SB_GETVALUE(x, S_MC_CS2_PAGE, M_MC_CS2_PAGE)
523
524#define S_MC_CS3_PAGE 48
525#define M_MC_CS3_PAGE _SB_MAKEMASK(2, S_MC_CS3_PAGE)
526#define V_MC_CS3_PAGE(x) _SB_MAKEVALUE(x, S_MC_CS3_PAGE)
527#define G_MC_CS3_PAGE(x) _SB_GETVALUE(x, S_MC_CS3_PAGE, M_MC_CS3_PAGE)
528
529/*
530 * ECC Test ECC Register (Table 6-25)
531 */
532
533#define S_MC_ECC_INVERT 0
534#define M_MC_ECC_INVERT _SB_MAKEMASK(8, S_MC_ECC_INVERT)
535
536
537#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_regs.h b/arch/mips/include/asm/sibyte/sb1250_regs.h
new file mode 100644
index 000000000..cdac01832
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_regs.h
@@ -0,0 +1,880 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * Register Definitions File: sb1250_regs.h
6 *
7 * This module contains the addresses of the on-chip peripherals
8 * on the SB1250.
9 *
10 * SB1250 specification level: 01/02/2002
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _SB1250_REGS_H
21#define _SB1250_REGS_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25
26/* *********************************************************************
27 * Some general notes:
28 *
29 * For the most part, when there is more than one peripheral
30 * of the same type on the SOC, the constants below will be
31 * offsets from the base of each peripheral. For example,
32 * the MAC registers are described as offsets from the first
33 * MAC register, and there will be a MAC_REGISTER() macro
34 * to calculate the base address of a given MAC.
35 *
36 * The information in this file is based on the SB1250 SOC
37 * manual version 0.2, July 2000.
38 ********************************************************************* */
39
40
41/* *********************************************************************
42 * Memory Controller Registers
43 ********************************************************************* */
44
45/*
46 * XXX: can't remove MC base 0 if 112x, since it's used by other macros,
47 * since there is one reg there (but it could get its addr/offset constant).
48 */
49
50#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
51#define A_MC_BASE_0 0x0010051000
52#define A_MC_BASE_1 0x0010052000
53#define MC_REGISTER_SPACING 0x1000
54
55#define A_MC_BASE(ctlid) ((ctlid)*MC_REGISTER_SPACING+A_MC_BASE_0)
56#define A_MC_REGISTER(ctlid, reg) (A_MC_BASE(ctlid)+(reg))
57
58#define R_MC_CONFIG 0x0000000100
59#define R_MC_DRAMCMD 0x0000000120
60#define R_MC_DRAMMODE 0x0000000140
61#define R_MC_TIMING1 0x0000000160
62#define R_MC_TIMING2 0x0000000180
63#define R_MC_CS_START 0x00000001A0
64#define R_MC_CS_END 0x00000001C0
65#define R_MC_CS_INTERLEAVE 0x00000001E0
66#define S_MC_CS_STARTEND 16
67
68#define R_MC_CSX_BASE 0x0000000200
69#define R_MC_CSX_ROW 0x0000000000 /* relative to CSX_BASE, above */
70#define R_MC_CSX_COL 0x0000000020 /* relative to CSX_BASE, above */
71#define R_MC_CSX_BA 0x0000000040 /* relative to CSX_BASE, above */
72#define MC_CSX_SPACING 0x0000000060 /* relative to CSX_BASE, above */
73
74#define R_MC_CS0_ROW 0x0000000200
75#define R_MC_CS0_COL 0x0000000220
76#define R_MC_CS0_BA 0x0000000240
77#define R_MC_CS1_ROW 0x0000000260
78#define R_MC_CS1_COL 0x0000000280
79#define R_MC_CS1_BA 0x00000002A0
80#define R_MC_CS2_ROW 0x00000002C0
81#define R_MC_CS2_COL 0x00000002E0
82#define R_MC_CS2_BA 0x0000000300
83#define R_MC_CS3_ROW 0x0000000320
84#define R_MC_CS3_COL 0x0000000340
85#define R_MC_CS3_BA 0x0000000360
86#define R_MC_CS_ATTR 0x0000000380
87#define R_MC_TEST_DATA 0x0000000400
88#define R_MC_TEST_ECC 0x0000000420
89#define R_MC_MCLK_CFG 0x0000000500
90
91#endif /* 1250 & 112x */
92
93/* *********************************************************************
94 * L2 Cache Control Registers
95 ********************************************************************* */
96
97#if SIBYTE_HDR_FEATURE_1250_112x /* This L2C only on 1250/112x */
98
99#define A_L2_READ_TAG 0x0010040018
100#define A_L2_ECC_TAG 0x0010040038
101#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
102#define A_L2_READ_MISC 0x0010040058
103#endif /* 1250 PASS3 || 112x PASS1 */
104#define A_L2_WAY_DISABLE 0x0010041000
105#define A_L2_MAKEDISABLE(x) (A_L2_WAY_DISABLE | (((~(x))&0x0F) << 8))
106#define A_L2_MGMT_TAG_BASE 0x00D0000000
107
108#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
109#define A_L2_CACHE_DISABLE 0x0010042000
110#define A_L2_MAKECACHEDISABLE(x) (A_L2_CACHE_DISABLE | (((x)&0x0F) << 8))
111#define A_L2_MISC_CONFIG 0x0010043000
112#endif /* 1250 PASS2 || 112x PASS1 */
113
114/* Backward-compatibility definitions. */
115/* XXX: discourage people from using these constants. */
116#define A_L2_READ_ADDRESS A_L2_READ_TAG
117#define A_L2_EEC_ADDRESS A_L2_ECC_TAG
118
119#endif
120
121
122/* *********************************************************************
123 * PCI Interface Registers
124 ********************************************************************* */
125
126#if SIBYTE_HDR_FEATURE_1250_112x /* This PCI/HT only on 1250/112x */
127#define A_PCI_TYPE00_HEADER 0x00DE000000
128#define A_PCI_TYPE01_HEADER 0x00DE000800
129#endif
130
131
132/* *********************************************************************
133 * Ethernet DMA and MACs
134 ********************************************************************* */
135
136#define A_MAC_BASE_0 0x0010064000
137#define A_MAC_BASE_1 0x0010065000
138#if SIBYTE_HDR_FEATURE_CHIP(1250)
139#define A_MAC_BASE_2 0x0010066000
140#endif /* 1250 */
141
142#define MAC_SPACING 0x1000
143#define MAC_DMA_TXRX_SPACING 0x0400
144#define MAC_DMA_CHANNEL_SPACING 0x0100
145#define DMA_RX 0
146#define DMA_TX 1
147#define MAC_NUM_DMACHAN 2 /* channels per direction */
148
149/* XXX: not correct; depends on SOC type. */
150#define MAC_NUM_PORTS 3
151
152#define A_MAC_CHANNEL_BASE(macnum) \
153 (A_MAC_BASE_0 + \
154 MAC_SPACING*(macnum))
155
156#define A_MAC_REGISTER(macnum,reg) \
157 (A_MAC_BASE_0 + \
158 MAC_SPACING*(macnum) + (reg))
159
160
161#define R_MAC_DMA_CHANNELS 0x800 /* Relative to A_MAC_CHANNEL_BASE */
162
163#define A_MAC_DMA_CHANNEL_BASE(macnum, txrx, chan) \
164 ((A_MAC_CHANNEL_BASE(macnum)) + \
165 R_MAC_DMA_CHANNELS + \
166 (MAC_DMA_TXRX_SPACING*(txrx)) + \
167 (MAC_DMA_CHANNEL_SPACING*(chan)))
168
169#define R_MAC_DMA_CHANNEL_BASE(txrx, chan) \
170 (R_MAC_DMA_CHANNELS + \
171 (MAC_DMA_TXRX_SPACING*(txrx)) + \
172 (MAC_DMA_CHANNEL_SPACING*(chan)))
173
174#define A_MAC_DMA_REGISTER(macnum, txrx, chan, reg) \
175 (A_MAC_DMA_CHANNEL_BASE(macnum, txrx, chan) + \
176 (reg))
177
178#define R_MAC_DMA_REGISTER(txrx, chan, reg) \
179 (R_MAC_DMA_CHANNEL_BASE(txrx, chan) + \
180 (reg))
181
182/*
183 * DMA channel registers, relative to A_MAC_DMA_CHANNEL_BASE
184 */
185
186#define R_MAC_DMA_CONFIG0 0x00000000
187#define R_MAC_DMA_CONFIG1 0x00000008
188#define R_MAC_DMA_DSCR_BASE 0x00000010
189#define R_MAC_DMA_DSCR_CNT 0x00000018
190#define R_MAC_DMA_CUR_DSCRA 0x00000020
191#define R_MAC_DMA_CUR_DSCRB 0x00000028
192#define R_MAC_DMA_CUR_DSCRADDR 0x00000030
193#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
194#define R_MAC_DMA_OODPKTLOST_RX 0x00000038 /* rx only */
195#endif /* 1250 PASS3 || 112x PASS1 */
196
197/*
198 * RMON Counters
199 */
200
201#define R_MAC_RMON_TX_BYTES 0x00000000
202#define R_MAC_RMON_COLLISIONS 0x00000008
203#define R_MAC_RMON_LATE_COL 0x00000010
204#define R_MAC_RMON_EX_COL 0x00000018
205#define R_MAC_RMON_FCS_ERROR 0x00000020
206#define R_MAC_RMON_TX_ABORT 0x00000028
207/* Counter #6 (0x30) now reserved */
208#define R_MAC_RMON_TX_BAD 0x00000038
209#define R_MAC_RMON_TX_GOOD 0x00000040
210#define R_MAC_RMON_TX_RUNT 0x00000048
211#define R_MAC_RMON_TX_OVERSIZE 0x00000050
212#define R_MAC_RMON_RX_BYTES 0x00000080
213#define R_MAC_RMON_RX_MCAST 0x00000088
214#define R_MAC_RMON_RX_BCAST 0x00000090
215#define R_MAC_RMON_RX_BAD 0x00000098
216#define R_MAC_RMON_RX_GOOD 0x000000A0
217#define R_MAC_RMON_RX_RUNT 0x000000A8
218#define R_MAC_RMON_RX_OVERSIZE 0x000000B0
219#define R_MAC_RMON_RX_FCS_ERROR 0x000000B8
220#define R_MAC_RMON_RX_LENGTH_ERROR 0x000000C0
221#define R_MAC_RMON_RX_CODE_ERROR 0x000000C8
222#define R_MAC_RMON_RX_ALIGN_ERROR 0x000000D0
223
224/* Updated to spec 0.2 */
225#define R_MAC_CFG 0x00000100
226#define R_MAC_THRSH_CFG 0x00000108
227#define R_MAC_VLANTAG 0x00000110
228#define R_MAC_FRAMECFG 0x00000118
229#define R_MAC_EOPCNT 0x00000120
230#define R_MAC_FIFO_PTRS 0x00000128
231#define R_MAC_ADFILTER_CFG 0x00000200
232#define R_MAC_ETHERNET_ADDR 0x00000208
233#define R_MAC_PKT_TYPE 0x00000210
234#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
235#define R_MAC_ADMASK0 0x00000218
236#define R_MAC_ADMASK1 0x00000220
237#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
238#define R_MAC_HASH_BASE 0x00000240
239#define R_MAC_ADDR_BASE 0x00000280
240#define R_MAC_CHLO0_BASE 0x00000300
241#define R_MAC_CHUP0_BASE 0x00000320
242#define R_MAC_ENABLE 0x00000400
243#define R_MAC_STATUS 0x00000408
244#define R_MAC_INT_MASK 0x00000410
245#define R_MAC_TXD_CTL 0x00000420
246#define R_MAC_MDIO 0x00000428
247#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
248#define R_MAC_STATUS1 0x00000430
249#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
250#define R_MAC_DEBUG_STATUS 0x00000448
251
252#define MAC_HASH_COUNT 8
253#define MAC_ADDR_COUNT 8
254#define MAC_CHMAP_COUNT 4
255
256
257/* *********************************************************************
258 * DUART Registers
259 ********************************************************************* */
260
261
262#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
263#define R_DUART_NUM_PORTS 2
264
265#define A_DUART 0x0010060000
266
267#define DUART_CHANREG_SPACING 0x100
268
269#define A_DUART_CHANREG(chan, reg) \
270 (A_DUART + DUART_CHANREG_SPACING * ((chan) + 1) + (reg))
271#endif /* 1250 & 112x */
272
273#define R_DUART_MODE_REG_1 0x000
274#define R_DUART_MODE_REG_2 0x010
275#define R_DUART_STATUS 0x020
276#define R_DUART_CLK_SEL 0x030
277#define R_DUART_CMD 0x050
278#define R_DUART_RX_HOLD 0x060
279#define R_DUART_TX_HOLD 0x070
280
281#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
282#define R_DUART_FULL_CTL 0x040
283#define R_DUART_OPCR_X 0x080
284#define R_DUART_AUXCTL_X 0x090
285#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
286
287
288/*
289 * The IMR and ISR can't be addressed with A_DUART_CHANREG,
290 * so use these macros instead.
291 */
292
293#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
294#define DUART_IMRISR_SPACING 0x20
295#define DUART_INCHNG_SPACING 0x10
296
297#define A_DUART_CTRLREG(reg) \
298 (A_DUART + DUART_CHANREG_SPACING * 3 + (reg))
299
300#define R_DUART_IMRREG(chan) \
301 (R_DUART_IMR_A + (chan) * DUART_IMRISR_SPACING)
302#define R_DUART_ISRREG(chan) \
303 (R_DUART_ISR_A + (chan) * DUART_IMRISR_SPACING)
304#define R_DUART_INCHREG(chan) \
305 (R_DUART_IN_CHNG_A + (chan) * DUART_INCHNG_SPACING)
306
307#define A_DUART_IMRREG(chan) A_DUART_CTRLREG(R_DUART_IMRREG(chan))
308#define A_DUART_ISRREG(chan) A_DUART_CTRLREG(R_DUART_ISRREG(chan))
309#define A_DUART_INCHREG(chan) A_DUART_CTRLREG(R_DUART_INCHREG(chan))
310#endif /* 1250 & 112x */
311
312#define R_DUART_AUX_CTRL 0x010
313#define R_DUART_ISR_A 0x020
314#define R_DUART_IMR_A 0x030
315#define R_DUART_ISR_B 0x040
316#define R_DUART_IMR_B 0x050
317#define R_DUART_OUT_PORT 0x060
318#define R_DUART_OPCR 0x070
319#define R_DUART_IN_PORT 0x080
320
321#define R_DUART_SET_OPR 0x0B0
322#define R_DUART_CLEAR_OPR 0x0C0
323#define R_DUART_IN_CHNG_A 0x0D0
324#define R_DUART_IN_CHNG_B 0x0E0
325
326
327/*
328 * These constants are the absolute addresses.
329 */
330
331#define A_DUART_MODE_REG_1_A 0x0010060100
332#define A_DUART_MODE_REG_2_A 0x0010060110
333#define A_DUART_STATUS_A 0x0010060120
334#define A_DUART_CLK_SEL_A 0x0010060130
335#define A_DUART_CMD_A 0x0010060150
336#define A_DUART_RX_HOLD_A 0x0010060160
337#define A_DUART_TX_HOLD_A 0x0010060170
338
339#define A_DUART_MODE_REG_1_B 0x0010060200
340#define A_DUART_MODE_REG_2_B 0x0010060210
341#define A_DUART_STATUS_B 0x0010060220
342#define A_DUART_CLK_SEL_B 0x0010060230
343#define A_DUART_CMD_B 0x0010060250
344#define A_DUART_RX_HOLD_B 0x0010060260
345#define A_DUART_TX_HOLD_B 0x0010060270
346
347#define A_DUART_INPORT_CHNG 0x0010060300
348#define A_DUART_AUX_CTRL 0x0010060310
349#define A_DUART_ISR_A 0x0010060320
350#define A_DUART_IMR_A 0x0010060330
351#define A_DUART_ISR_B 0x0010060340
352#define A_DUART_IMR_B 0x0010060350
353#define A_DUART_OUT_PORT 0x0010060360
354#define A_DUART_OPCR 0x0010060370
355#define A_DUART_IN_PORT 0x0010060380
356#define A_DUART_ISR 0x0010060390
357#define A_DUART_IMR 0x00100603A0
358#define A_DUART_SET_OPR 0x00100603B0
359#define A_DUART_CLEAR_OPR 0x00100603C0
360#define A_DUART_INPORT_CHNG_A 0x00100603D0
361#define A_DUART_INPORT_CHNG_B 0x00100603E0
362
363#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
364#define A_DUART_FULL_CTL_A 0x0010060140
365#define A_DUART_FULL_CTL_B 0x0010060240
366
367#define A_DUART_OPCR_A 0x0010060180
368#define A_DUART_OPCR_B 0x0010060280
369
370#define A_DUART_INPORT_CHNG_DEBUG 0x00100603F0
371#endif /* 1250 PASS2 || 112x PASS1 */
372
373
374/* *********************************************************************
375 * Synchronous Serial Registers
376 ********************************************************************* */
377
378
379#if SIBYTE_HDR_FEATURE_1250_112x /* sync serial only on 1250/112x */
380
381#define A_SER_BASE_0 0x0010060400
382#define A_SER_BASE_1 0x0010060800
383#define SER_SPACING 0x400
384
385#define SER_DMA_TXRX_SPACING 0x80
386
387#define SER_NUM_PORTS 2
388
389#define A_SER_CHANNEL_BASE(sernum) \
390 (A_SER_BASE_0 + \
391 SER_SPACING*(sernum))
392
393#define A_SER_REGISTER(sernum,reg) \
394 (A_SER_BASE_0 + \
395 SER_SPACING*(sernum) + (reg))
396
397
398#define R_SER_DMA_CHANNELS 0 /* Relative to A_SER_BASE_x */
399
400#define A_SER_DMA_CHANNEL_BASE(sernum,txrx) \
401 ((A_SER_CHANNEL_BASE(sernum)) + \
402 R_SER_DMA_CHANNELS + \
403 (SER_DMA_TXRX_SPACING*(txrx)))
404
405#define A_SER_DMA_REGISTER(sernum, txrx, reg) \
406 (A_SER_DMA_CHANNEL_BASE(sernum, txrx) + \
407 (reg))
408
409
410/*
411 * DMA channel registers, relative to A_SER_DMA_CHANNEL_BASE
412 */
413
414#define R_SER_DMA_CONFIG0 0x00000000
415#define R_SER_DMA_CONFIG1 0x00000008
416#define R_SER_DMA_DSCR_BASE 0x00000010
417#define R_SER_DMA_DSCR_CNT 0x00000018
418#define R_SER_DMA_CUR_DSCRA 0x00000020
419#define R_SER_DMA_CUR_DSCRB 0x00000028
420#define R_SER_DMA_CUR_DSCRADDR 0x00000030
421
422#define R_SER_DMA_CONFIG0_RX 0x00000000
423#define R_SER_DMA_CONFIG1_RX 0x00000008
424#define R_SER_DMA_DSCR_BASE_RX 0x00000010
425#define R_SER_DMA_DSCR_COUNT_RX 0x00000018
426#define R_SER_DMA_CUR_DSCR_A_RX 0x00000020
427#define R_SER_DMA_CUR_DSCR_B_RX 0x00000028
428#define R_SER_DMA_CUR_DSCR_ADDR_RX 0x00000030
429
430#define R_SER_DMA_CONFIG0_TX 0x00000080
431#define R_SER_DMA_CONFIG1_TX 0x00000088
432#define R_SER_DMA_DSCR_BASE_TX 0x00000090
433#define R_SER_DMA_DSCR_COUNT_TX 0x00000098
434#define R_SER_DMA_CUR_DSCR_A_TX 0x000000A0
435#define R_SER_DMA_CUR_DSCR_B_TX 0x000000A8
436#define R_SER_DMA_CUR_DSCR_ADDR_TX 0x000000B0
437
438#define R_SER_MODE 0x00000100
439#define R_SER_MINFRM_SZ 0x00000108
440#define R_SER_MAXFRM_SZ 0x00000110
441#define R_SER_ADDR 0x00000118
442#define R_SER_USR0_ADDR 0x00000120
443#define R_SER_USR1_ADDR 0x00000128
444#define R_SER_USR2_ADDR 0x00000130
445#define R_SER_USR3_ADDR 0x00000138
446#define R_SER_CMD 0x00000140
447#define R_SER_TX_RD_THRSH 0x00000160
448#define R_SER_TX_WR_THRSH 0x00000168
449#define R_SER_RX_RD_THRSH 0x00000170
450#define R_SER_LINE_MODE 0x00000178
451#define R_SER_DMA_ENABLE 0x00000180
452#define R_SER_INT_MASK 0x00000190
453#define R_SER_STATUS 0x00000188
454#define R_SER_STATUS_DEBUG 0x000001A8
455#define R_SER_RX_TABLE_BASE 0x00000200
456#define SER_RX_TABLE_COUNT 16
457#define R_SER_TX_TABLE_BASE 0x00000300
458#define SER_TX_TABLE_COUNT 16
459
460/* RMON Counters */
461#define R_SER_RMON_TX_BYTE_LO 0x000001C0
462#define R_SER_RMON_TX_BYTE_HI 0x000001C8
463#define R_SER_RMON_RX_BYTE_LO 0x000001D0
464#define R_SER_RMON_RX_BYTE_HI 0x000001D8
465#define R_SER_RMON_TX_UNDERRUN 0x000001E0
466#define R_SER_RMON_RX_OVERFLOW 0x000001E8
467#define R_SER_RMON_RX_ERRORS 0x000001F0
468#define R_SER_RMON_RX_BADADDR 0x000001F8
469
470#endif /* 1250/112x */
471
472/* *********************************************************************
473 * Generic Bus Registers
474 ********************************************************************* */
475
476#define IO_EXT_CFG_COUNT 8
477
478#define A_IO_EXT_BASE 0x0010061000
479#define A_IO_EXT_REG(r) (A_IO_EXT_BASE + (r))
480
481#define A_IO_EXT_CFG_BASE 0x0010061000
482#define A_IO_EXT_MULT_SIZE_BASE 0x0010061100
483#define A_IO_EXT_START_ADDR_BASE 0x0010061200
484#define A_IO_EXT_TIME_CFG0_BASE 0x0010061600
485#define A_IO_EXT_TIME_CFG1_BASE 0x0010061700
486
487#define IO_EXT_REGISTER_SPACING 8
488#define A_IO_EXT_CS_BASE(cs) (A_IO_EXT_CFG_BASE+IO_EXT_REGISTER_SPACING*(cs))
489#define R_IO_EXT_REG(reg, cs) ((cs)*IO_EXT_REGISTER_SPACING + (reg))
490
491#define R_IO_EXT_CFG 0x0000
492#define R_IO_EXT_MULT_SIZE 0x0100
493#define R_IO_EXT_START_ADDR 0x0200
494#define R_IO_EXT_TIME_CFG0 0x0600
495#define R_IO_EXT_TIME_CFG1 0x0700
496
497
498#define A_IO_INTERRUPT_STATUS 0x0010061A00
499#define A_IO_INTERRUPT_DATA0 0x0010061A10
500#define A_IO_INTERRUPT_DATA1 0x0010061A18
501#define A_IO_INTERRUPT_DATA2 0x0010061A20
502#define A_IO_INTERRUPT_DATA3 0x0010061A28
503#define A_IO_INTERRUPT_ADDR0 0x0010061A30
504#define A_IO_INTERRUPT_ADDR1 0x0010061A40
505#define A_IO_INTERRUPT_PARITY 0x0010061A50
506#define A_IO_PCMCIA_CFG 0x0010061A60
507#define A_IO_PCMCIA_STATUS 0x0010061A70
508#define A_IO_DRIVE_0 0x0010061300
509#define A_IO_DRIVE_1 0x0010061308
510#define A_IO_DRIVE_2 0x0010061310
511#define A_IO_DRIVE_3 0x0010061318
512#define A_IO_DRIVE_BASE A_IO_DRIVE_0
513#define IO_DRIVE_REGISTER_SPACING 8
514#define R_IO_DRIVE(x) ((x)*IO_DRIVE_REGISTER_SPACING)
515#define A_IO_DRIVE(x) (A_IO_DRIVE_BASE + R_IO_DRIVE(x))
516
517#define R_IO_INTERRUPT_STATUS 0x0A00
518#define R_IO_INTERRUPT_DATA0 0x0A10
519#define R_IO_INTERRUPT_DATA1 0x0A18
520#define R_IO_INTERRUPT_DATA2 0x0A20
521#define R_IO_INTERRUPT_DATA3 0x0A28
522#define R_IO_INTERRUPT_ADDR0 0x0A30
523#define R_IO_INTERRUPT_ADDR1 0x0A40
524#define R_IO_INTERRUPT_PARITY 0x0A50
525#define R_IO_PCMCIA_CFG 0x0A60
526#define R_IO_PCMCIA_STATUS 0x0A70
527
528/* *********************************************************************
529 * GPIO Registers
530 ********************************************************************* */
531
532#define A_GPIO_CLR_EDGE 0x0010061A80
533#define A_GPIO_INT_TYPE 0x0010061A88
534#define A_GPIO_INPUT_INVERT 0x0010061A90
535#define A_GPIO_GLITCH 0x0010061A98
536#define A_GPIO_READ 0x0010061AA0
537#define A_GPIO_DIRECTION 0x0010061AA8
538#define A_GPIO_PIN_CLR 0x0010061AB0
539#define A_GPIO_PIN_SET 0x0010061AB8
540
541#define A_GPIO_BASE 0x0010061A80
542
543#define R_GPIO_CLR_EDGE 0x00
544#define R_GPIO_INT_TYPE 0x08
545#define R_GPIO_INPUT_INVERT 0x10
546#define R_GPIO_GLITCH 0x18
547#define R_GPIO_READ 0x20
548#define R_GPIO_DIRECTION 0x28
549#define R_GPIO_PIN_CLR 0x30
550#define R_GPIO_PIN_SET 0x38
551
552/* *********************************************************************
553 * SMBus Registers
554 ********************************************************************* */
555
556#define A_SMB_XTRA_0 0x0010060000
557#define A_SMB_XTRA_1 0x0010060008
558#define A_SMB_FREQ_0 0x0010060010
559#define A_SMB_FREQ_1 0x0010060018
560#define A_SMB_STATUS_0 0x0010060020
561#define A_SMB_STATUS_1 0x0010060028
562#define A_SMB_CMD_0 0x0010060030
563#define A_SMB_CMD_1 0x0010060038
564#define A_SMB_START_0 0x0010060040
565#define A_SMB_START_1 0x0010060048
566#define A_SMB_DATA_0 0x0010060050
567#define A_SMB_DATA_1 0x0010060058
568#define A_SMB_CONTROL_0 0x0010060060
569#define A_SMB_CONTROL_1 0x0010060068
570#define A_SMB_PEC_0 0x0010060070
571#define A_SMB_PEC_1 0x0010060078
572
573#define A_SMB_0 0x0010060000
574#define A_SMB_1 0x0010060008
575#define SMB_REGISTER_SPACING 0x8
576#define A_SMB_BASE(idx) (A_SMB_0+(idx)*SMB_REGISTER_SPACING)
577#define A_SMB_REGISTER(idx, reg) (A_SMB_BASE(idx)+(reg))
578
579#define R_SMB_XTRA 0x0000000000
580#define R_SMB_FREQ 0x0000000010
581#define R_SMB_STATUS 0x0000000020
582#define R_SMB_CMD 0x0000000030
583#define R_SMB_START 0x0000000040
584#define R_SMB_DATA 0x0000000050
585#define R_SMB_CONTROL 0x0000000060
586#define R_SMB_PEC 0x0000000070
587
588/* *********************************************************************
589 * Timer Registers
590 ********************************************************************* */
591
592/*
593 * Watchdog timers
594 */
595
596#define A_SCD_WDOG_0 0x0010020050
597#define A_SCD_WDOG_1 0x0010020150
598#define SCD_WDOG_SPACING 0x100
599#define SCD_NUM_WDOGS 2
600#define A_SCD_WDOG_BASE(w) (A_SCD_WDOG_0+SCD_WDOG_SPACING*(w))
601#define A_SCD_WDOG_REGISTER(w, r) (A_SCD_WDOG_BASE(w) + (r))
602
603#define R_SCD_WDOG_INIT 0x0000000000
604#define R_SCD_WDOG_CNT 0x0000000008
605#define R_SCD_WDOG_CFG 0x0000000010
606
607#define A_SCD_WDOG_INIT_0 0x0010020050
608#define A_SCD_WDOG_CNT_0 0x0010020058
609#define A_SCD_WDOG_CFG_0 0x0010020060
610
611#define A_SCD_WDOG_INIT_1 0x0010020150
612#define A_SCD_WDOG_CNT_1 0x0010020158
613#define A_SCD_WDOG_CFG_1 0x0010020160
614
615/*
616 * Generic timers
617 */
618
619#define A_SCD_TIMER_0 0x0010020070
620#define A_SCD_TIMER_1 0x0010020078
621#define A_SCD_TIMER_2 0x0010020170
622#define A_SCD_TIMER_3 0x0010020178
623#define SCD_NUM_TIMERS 4
624#define A_SCD_TIMER_BASE(w) (A_SCD_TIMER_0+0x08*((w)&1)+0x100*(((w)&2)>>1))
625#define A_SCD_TIMER_REGISTER(w, r) (A_SCD_TIMER_BASE(w) + (r))
626
627#define R_SCD_TIMER_INIT 0x0000000000
628#define R_SCD_TIMER_CNT 0x0000000010
629#define R_SCD_TIMER_CFG 0x0000000020
630
631#define A_SCD_TIMER_INIT_0 0x0010020070
632#define A_SCD_TIMER_CNT_0 0x0010020080
633#define A_SCD_TIMER_CFG_0 0x0010020090
634
635#define A_SCD_TIMER_INIT_1 0x0010020078
636#define A_SCD_TIMER_CNT_1 0x0010020088
637#define A_SCD_TIMER_CFG_1 0x0010020098
638
639#define A_SCD_TIMER_INIT_2 0x0010020170
640#define A_SCD_TIMER_CNT_2 0x0010020180
641#define A_SCD_TIMER_CFG_2 0x0010020190
642
643#define A_SCD_TIMER_INIT_3 0x0010020178
644#define A_SCD_TIMER_CNT_3 0x0010020188
645#define A_SCD_TIMER_CFG_3 0x0010020198
646
647#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
648#define A_SCD_SCRATCH 0x0010020C10
649#endif /* 1250 PASS2 || 112x PASS1 */
650
651#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
652#define A_SCD_ZBBUS_CYCLE_COUNT 0x0010030000
653#define A_SCD_ZBBUS_CYCLE_CP0 0x0010020C00
654#define A_SCD_ZBBUS_CYCLE_CP1 0x0010020C08
655#endif
656
657/* *********************************************************************
658 * System Control Registers
659 ********************************************************************* */
660
661#define A_SCD_SYSTEM_REVISION 0x0010020000
662#define A_SCD_SYSTEM_CFG 0x0010020008
663#define A_SCD_SYSTEM_MANUF 0x0010038000
664
665/* *********************************************************************
666 * System Address Trap Registers
667 ********************************************************************* */
668
669#define A_ADDR_TRAP_INDEX 0x00100200B0
670#define A_ADDR_TRAP_REG 0x00100200B8
671#define A_ADDR_TRAP_UP_0 0x0010020400
672#define A_ADDR_TRAP_UP_1 0x0010020408
673#define A_ADDR_TRAP_UP_2 0x0010020410
674#define A_ADDR_TRAP_UP_3 0x0010020418
675#define A_ADDR_TRAP_DOWN_0 0x0010020420
676#define A_ADDR_TRAP_DOWN_1 0x0010020428
677#define A_ADDR_TRAP_DOWN_2 0x0010020430
678#define A_ADDR_TRAP_DOWN_3 0x0010020438
679#define A_ADDR_TRAP_CFG_0 0x0010020440
680#define A_ADDR_TRAP_CFG_1 0x0010020448
681#define A_ADDR_TRAP_CFG_2 0x0010020450
682#define A_ADDR_TRAP_CFG_3 0x0010020458
683#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
684#define A_ADDR_TRAP_REG_DEBUG 0x0010020460
685#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
686
687#define ADDR_TRAP_SPACING 8
688#define NUM_ADDR_TRAP 4
689#define A_ADDR_TRAP_UP(n) (A_ADDR_TRAP_UP_0 + ((n) * ADDR_TRAP_SPACING))
690#define A_ADDR_TRAP_DOWN(n) (A_ADDR_TRAP_DOWN_0 + ((n) * ADDR_TRAP_SPACING))
691#define A_ADDR_TRAP_CFG(n) (A_ADDR_TRAP_CFG_0 + ((n) * ADDR_TRAP_SPACING))
692
693
694/* *********************************************************************
695 * System Interrupt Mapper Registers
696 ********************************************************************* */
697
698#define A_IMR_CPU0_BASE 0x0010020000
699#define A_IMR_CPU1_BASE 0x0010022000
700#define IMR_REGISTER_SPACING 0x2000
701#define IMR_REGISTER_SPACING_SHIFT 13
702
703#define A_IMR_MAPPER(cpu) (A_IMR_CPU0_BASE+(cpu)*IMR_REGISTER_SPACING)
704#define A_IMR_REGISTER(cpu, reg) (A_IMR_MAPPER(cpu)+(reg))
705
706#define R_IMR_INTERRUPT_DIAG 0x0010
707#define R_IMR_INTERRUPT_LDT 0x0018
708#define R_IMR_INTERRUPT_MASK 0x0028
709#define R_IMR_INTERRUPT_TRACE 0x0038
710#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040
711#define R_IMR_LDT_INTERRUPT_SET 0x0048
712#define R_IMR_LDT_INTERRUPT 0x0018
713#define R_IMR_LDT_INTERRUPT_CLR 0x0020
714#define R_IMR_MAILBOX_CPU 0x00c0
715#define R_IMR_ALIAS_MAILBOX_CPU 0x1000
716#define R_IMR_MAILBOX_SET_CPU 0x00C8
717#define R_IMR_ALIAS_MAILBOX_SET_CPU 0x1008
718#define R_IMR_MAILBOX_CLR_CPU 0x00D0
719#define R_IMR_INTERRUPT_STATUS_BASE 0x0100
720#define R_IMR_INTERRUPT_STATUS_COUNT 7
721#define R_IMR_INTERRUPT_MAP_BASE 0x0200
722#define R_IMR_INTERRUPT_MAP_COUNT 64
723
724/*
725 * these macros work together to build the address of a mailbox
726 * register, e.g., A_MAILBOX_REGISTER(R_IMR_MAILBOX_SET_CPU,1)
727 * for mbox_0_set_cpu2 returns 0x00100240C8
728 */
729#define A_MAILBOX_REGISTER(reg,cpu) \
730 (A_IMR_CPU0_BASE + (cpu * IMR_REGISTER_SPACING) + reg)
731
732/* *********************************************************************
733 * System Performance Counter Registers
734 ********************************************************************* */
735
736#define A_SCD_PERF_CNT_CFG 0x00100204C0
737#define A_SCD_PERF_CNT_0 0x00100204D0
738#define A_SCD_PERF_CNT_1 0x00100204D8
739#define A_SCD_PERF_CNT_2 0x00100204E0
740#define A_SCD_PERF_CNT_3 0x00100204E8
741
742#define SCD_NUM_PERF_CNT 4
743#define SCD_PERF_CNT_SPACING 8
744#define A_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*SCD_PERF_CNT_SPACING))
745
746/* *********************************************************************
747 * System Bus Watcher Registers
748 ********************************************************************* */
749
750#define A_SCD_BUS_ERR_STATUS 0x0010020880
751#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
752#define A_SCD_BUS_ERR_STATUS_DEBUG 0x00100208D0
753#define A_BUS_ERR_STATUS_DEBUG 0x00100208D0
754#endif /* 1250 PASS2 || 112x PASS1 */
755#define A_BUS_ERR_DATA_0 0x00100208A0
756#define A_BUS_ERR_DATA_1 0x00100208A8
757#define A_BUS_ERR_DATA_2 0x00100208B0
758#define A_BUS_ERR_DATA_3 0x00100208B8
759#define A_BUS_L2_ERRORS 0x00100208C0
760#define A_BUS_MEM_IO_ERRORS 0x00100208C8
761
762/* *********************************************************************
763 * System Debug Controller Registers
764 ********************************************************************* */
765
766#define A_SCD_JTAG_BASE 0x0010000000
767
768/* *********************************************************************
769 * System Trace Buffer Registers
770 ********************************************************************* */
771
772#define A_SCD_TRACE_CFG 0x0010020A00
773#define A_SCD_TRACE_READ 0x0010020A08
774#define A_SCD_TRACE_EVENT_0 0x0010020A20
775#define A_SCD_TRACE_EVENT_1 0x0010020A28
776#define A_SCD_TRACE_EVENT_2 0x0010020A30
777#define A_SCD_TRACE_EVENT_3 0x0010020A38
778#define A_SCD_TRACE_SEQUENCE_0 0x0010020A40
779#define A_SCD_TRACE_SEQUENCE_1 0x0010020A48
780#define A_SCD_TRACE_SEQUENCE_2 0x0010020A50
781#define A_SCD_TRACE_SEQUENCE_3 0x0010020A58
782#define A_SCD_TRACE_EVENT_4 0x0010020A60
783#define A_SCD_TRACE_EVENT_5 0x0010020A68
784#define A_SCD_TRACE_EVENT_6 0x0010020A70
785#define A_SCD_TRACE_EVENT_7 0x0010020A78
786#define A_SCD_TRACE_SEQUENCE_4 0x0010020A80
787#define A_SCD_TRACE_SEQUENCE_5 0x0010020A88
788#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90
789#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98
790
791#define TRACE_REGISTER_SPACING 8
792#define TRACE_NUM_REGISTERS 8
793#define A_SCD_TRACE_EVENT(n) (((n) & 4) ? \
794 (A_SCD_TRACE_EVENT_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
795 (A_SCD_TRACE_EVENT_0 + ((n) * TRACE_REGISTER_SPACING)))
796#define A_SCD_TRACE_SEQUENCE(n) (((n) & 4) ? \
797 (A_SCD_TRACE_SEQUENCE_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
798 (A_SCD_TRACE_SEQUENCE_0 + ((n) * TRACE_REGISTER_SPACING)))
799
800/* *********************************************************************
801 * System Generic DMA Registers
802 ********************************************************************* */
803
804#define A_DM_0 0x0010020B00
805#define A_DM_1 0x0010020B20
806#define A_DM_2 0x0010020B40
807#define A_DM_3 0x0010020B60
808#define DM_REGISTER_SPACING 0x20
809#define DM_NUM_CHANNELS 4
810#define A_DM_BASE(idx) (A_DM_0 + ((idx) * DM_REGISTER_SPACING))
811#define A_DM_REGISTER(idx, reg) (A_DM_BASE(idx) + (reg))
812
813#define R_DM_DSCR_BASE 0x0000000000
814#define R_DM_DSCR_COUNT 0x0000000008
815#define R_DM_CUR_DSCR_ADDR 0x0000000010
816#define R_DM_DSCR_BASE_DEBUG 0x0000000018
817
818#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
819#define A_DM_PARTIAL_0 0x0010020ba0
820#define A_DM_PARTIAL_1 0x0010020ba8
821#define A_DM_PARTIAL_2 0x0010020bb0
822#define A_DM_PARTIAL_3 0x0010020bb8
823#define DM_PARTIAL_REGISTER_SPACING 0x8
824#define A_DM_PARTIAL(idx) (A_DM_PARTIAL_0 + ((idx) * DM_PARTIAL_REGISTER_SPACING))
825#endif /* 1250 PASS3 || 112x PASS1 */
826
827#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
828#define A_DM_CRC_0 0x0010020b80
829#define A_DM_CRC_1 0x0010020b90
830#define DM_CRC_REGISTER_SPACING 0x10
831#define DM_CRC_NUM_CHANNELS 2
832#define A_DM_CRC_BASE(idx) (A_DM_CRC_0 + ((idx) * DM_CRC_REGISTER_SPACING))
833#define A_DM_CRC_REGISTER(idx, reg) (A_DM_CRC_BASE(idx) + (reg))
834
835#define R_CRC_DEF_0 0x00
836#define R_CTCP_DEF_0 0x08
837#endif /* 1250 PASS3 || 112x PASS1 */
838
839/* *********************************************************************
840 * Physical Address Map
841 ********************************************************************* */
842
843#if SIBYTE_HDR_FEATURE_1250_112x
844#define A_PHYS_MEMORY_0 _SB_MAKE64(0x0000000000)
845#define A_PHYS_MEMORY_SIZE _SB_MAKE64((256*1024*1024))
846#define A_PHYS_SYSTEM_CTL _SB_MAKE64(0x0010000000)
847#define A_PHYS_IO_SYSTEM _SB_MAKE64(0x0010060000)
848#define A_PHYS_GENBUS _SB_MAKE64(0x0010090000)
849#define A_PHYS_GENBUS_END _SB_MAKE64(0x0040000000)
850#define A_PHYS_LDTPCI_IO_MATCH_BYTES_32 _SB_MAKE64(0x0040000000)
851#define A_PHYS_LDTPCI_IO_MATCH_BITS_32 _SB_MAKE64(0x0060000000)
852#define A_PHYS_MEMORY_1 _SB_MAKE64(0x0080000000)
853#define A_PHYS_MEMORY_2 _SB_MAKE64(0x0090000000)
854#define A_PHYS_MEMORY_3 _SB_MAKE64(0x00C0000000)
855#define A_PHYS_L2_CACHE_TEST _SB_MAKE64(0x00D0000000)
856#define A_PHYS_LDT_SPECIAL_MATCH_BYTES _SB_MAKE64(0x00D8000000)
857#define A_PHYS_LDTPCI_IO_MATCH_BYTES _SB_MAKE64(0x00DC000000)
858#define A_PHYS_LDTPCI_CFG_MATCH_BYTES _SB_MAKE64(0x00DE000000)
859#define A_PHYS_LDT_SPECIAL_MATCH_BITS _SB_MAKE64(0x00F8000000)
860#define A_PHYS_LDTPCI_IO_MATCH_BITS _SB_MAKE64(0x00FC000000)
861#define A_PHYS_LDTPCI_CFG_MATCH_BITS _SB_MAKE64(0x00FE000000)
862#define A_PHYS_MEMORY_EXP _SB_MAKE64(0x0100000000)
863#define A_PHYS_MEMORY_EXP_SIZE _SB_MAKE64((508*1024*1024*1024))
864#define A_PHYS_LDT_EXP _SB_MAKE64(0x8000000000)
865#define A_PHYS_PCI_FULLACCESS_BYTES _SB_MAKE64(0xF000000000)
866#define A_PHYS_PCI_FULLACCESS_BITS _SB_MAKE64(0xF100000000)
867#define A_PHYS_RESERVED _SB_MAKE64(0xF200000000)
868#define A_PHYS_RESERVED_SPECIAL_LDT _SB_MAKE64(0xFD00000000)
869
870#define A_PHYS_L2CACHE_WAY_SIZE _SB_MAKE64(0x0000020000)
871#define PHYS_L2CACHE_NUM_WAYS 4
872#define A_PHYS_L2CACHE_TOTAL_SIZE _SB_MAKE64(0x0000080000)
873#define A_PHYS_L2CACHE_WAY0 _SB_MAKE64(0x00D0180000)
874#define A_PHYS_L2CACHE_WAY1 _SB_MAKE64(0x00D01A0000)
875#define A_PHYS_L2CACHE_WAY2 _SB_MAKE64(0x00D01C0000)
876#define A_PHYS_L2CACHE_WAY3 _SB_MAKE64(0x00D01E0000)
877#endif
878
879
880#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_scd.h b/arch/mips/include/asm/sibyte/sb1250_scd.h
new file mode 100644
index 000000000..d099dcbef
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_scd.h
@@ -0,0 +1,641 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * SCD Constants and Macros File: sb1250_scd.h
6 *
7 * This module contains constants and macros useful for
8 * manipulating the System Control and Debug module on the 1250.
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003,2004,2005
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19#ifndef _SB1250_SCD_H
20#define _SB1250_SCD_H
21
22#include <asm/sibyte/sb1250_defs.h>
23
24/* *********************************************************************
25 * System control/debug registers
26 ********************************************************************* */
27
28/*
29 * System Revision Register (Table 4-1)
30 */
31
32#define M_SYS_RESERVED _SB_MAKEMASK(8, 0)
33
34#define S_SYS_REVISION _SB_MAKE64(8)
35#define M_SYS_REVISION _SB_MAKEMASK(8, S_SYS_REVISION)
36#define V_SYS_REVISION(x) _SB_MAKEVALUE(x, S_SYS_REVISION)
37#define G_SYS_REVISION(x) _SB_GETVALUE(x, S_SYS_REVISION, M_SYS_REVISION)
38
39#define K_SYS_REVISION_BCM1250_PASS1 0x01
40
41#define K_SYS_REVISION_BCM1250_PASS2 0x03
42#define K_SYS_REVISION_BCM1250_A1 0x03 /* Pass 2.0 WB */
43#define K_SYS_REVISION_BCM1250_A2 0x04 /* Pass 2.0 FC */
44#define K_SYS_REVISION_BCM1250_A3 0x05 /* Pass 2.1 FC */
45#define K_SYS_REVISION_BCM1250_A4 0x06 /* Pass 2.1 WB */
46#define K_SYS_REVISION_BCM1250_A6 0x07 /* OR 0x04 (A2) w/WID != 0 */
47#define K_SYS_REVISION_BCM1250_A8 0x0b /* A8/A10 */
48#define K_SYS_REVISION_BCM1250_A9 0x08
49#define K_SYS_REVISION_BCM1250_A10 K_SYS_REVISION_BCM1250_A8
50
51#define K_SYS_REVISION_BCM1250_PASS2_2 0x10
52#define K_SYS_REVISION_BCM1250_B0 K_SYS_REVISION_BCM1250_B1
53#define K_SYS_REVISION_BCM1250_B1 0x10
54#define K_SYS_REVISION_BCM1250_B2 0x11
55
56#define K_SYS_REVISION_BCM1250_C0 0x20
57#define K_SYS_REVISION_BCM1250_C1 0x21
58#define K_SYS_REVISION_BCM1250_C2 0x22
59#define K_SYS_REVISION_BCM1250_C3 0x23
60
61#if SIBYTE_HDR_FEATURE_CHIP(1250)
62/* XXX: discourage people from using these constants. */
63#define K_SYS_REVISION_PASS1 K_SYS_REVISION_BCM1250_PASS1
64#define K_SYS_REVISION_PASS2 K_SYS_REVISION_BCM1250_PASS2
65#define K_SYS_REVISION_PASS2_2 K_SYS_REVISION_BCM1250_PASS2_2
66#define K_SYS_REVISION_PASS3 K_SYS_REVISION_BCM1250_PASS3
67#define K_SYS_REVISION_BCM1250_PASS3 K_SYS_REVISION_BCM1250_C0
68#endif /* 1250 */
69
70#define K_SYS_REVISION_BCM112x_A1 0x20
71#define K_SYS_REVISION_BCM112x_A2 0x21
72#define K_SYS_REVISION_BCM112x_A3 0x22
73#define K_SYS_REVISION_BCM112x_A4 0x23
74#define K_SYS_REVISION_BCM112x_B0 0x30
75
76#define K_SYS_REVISION_BCM1480_S0 0x01
77#define K_SYS_REVISION_BCM1480_A1 0x02
78#define K_SYS_REVISION_BCM1480_A2 0x03
79#define K_SYS_REVISION_BCM1480_A3 0x04
80#define K_SYS_REVISION_BCM1480_B0 0x11
81
82/*Cache size - 23:20 of revision register*/
83#define S_SYS_L2C_SIZE _SB_MAKE64(20)
84#define M_SYS_L2C_SIZE _SB_MAKEMASK(4, S_SYS_L2C_SIZE)
85#define V_SYS_L2C_SIZE(x) _SB_MAKEVALUE(x, S_SYS_L2C_SIZE)
86#define G_SYS_L2C_SIZE(x) _SB_GETVALUE(x, S_SYS_L2C_SIZE, M_SYS_L2C_SIZE)
87
88#define K_SYS_L2C_SIZE_1MB 0
89#define K_SYS_L2C_SIZE_512KB 5
90#define K_SYS_L2C_SIZE_256KB 2
91#define K_SYS_L2C_SIZE_128KB 1
92
93#define K_SYS_L2C_SIZE_BCM1250 K_SYS_L2C_SIZE_512KB
94#define K_SYS_L2C_SIZE_BCM1125 K_SYS_L2C_SIZE_256KB
95#define K_SYS_L2C_SIZE_BCM1122 K_SYS_L2C_SIZE_128KB
96
97
98/* Number of CPU cores, bits 27:24 of revision register*/
99#define S_SYS_NUM_CPUS _SB_MAKE64(24)
100#define M_SYS_NUM_CPUS _SB_MAKEMASK(4, S_SYS_NUM_CPUS)
101#define V_SYS_NUM_CPUS(x) _SB_MAKEVALUE(x, S_SYS_NUM_CPUS)
102#define G_SYS_NUM_CPUS(x) _SB_GETVALUE(x, S_SYS_NUM_CPUS, M_SYS_NUM_CPUS)
103
104
105/* XXX: discourage people from using these constants. */
106#define S_SYS_PART _SB_MAKE64(16)
107#define M_SYS_PART _SB_MAKEMASK(16, S_SYS_PART)
108#define V_SYS_PART(x) _SB_MAKEVALUE(x, S_SYS_PART)
109#define G_SYS_PART(x) _SB_GETVALUE(x, S_SYS_PART, M_SYS_PART)
110
111/* XXX: discourage people from using these constants. */
112#define K_SYS_PART_SB1250 0x1250
113#define K_SYS_PART_BCM1120 0x1121
114#define K_SYS_PART_BCM1125 0x1123
115#define K_SYS_PART_BCM1125H 0x1124
116#define K_SYS_PART_BCM1122 0x1113
117
118
119/* The "peripheral set" (SOC type) is the low 4 bits of the "part" field. */
120#define S_SYS_SOC_TYPE _SB_MAKE64(16)
121#define M_SYS_SOC_TYPE _SB_MAKEMASK(4, S_SYS_SOC_TYPE)
122#define V_SYS_SOC_TYPE(x) _SB_MAKEVALUE(x, S_SYS_SOC_TYPE)
123#define G_SYS_SOC_TYPE(x) _SB_GETVALUE(x, S_SYS_SOC_TYPE, M_SYS_SOC_TYPE)
124
125#define K_SYS_SOC_TYPE_BCM1250 0x0
126#define K_SYS_SOC_TYPE_BCM1120 0x1
127#define K_SYS_SOC_TYPE_BCM1250_ALT 0x2 /* 1250pass2 w/ 1/4 L2. */
128#define K_SYS_SOC_TYPE_BCM1125 0x3
129#define K_SYS_SOC_TYPE_BCM1125H 0x4
130#define K_SYS_SOC_TYPE_BCM1250_ALT2 0x5 /* 1250pass2 w/ 1/2 L2. */
131#define K_SYS_SOC_TYPE_BCM1x80 0x6
132#define K_SYS_SOC_TYPE_BCM1x55 0x7
133
134/*
135 * Calculate correct SOC type given a copy of system revision register.
136 *
137 * (For the assembler version, sysrev and dest may be the same register.
138 * Also, it clobbers AT.)
139 */
140#ifdef __ASSEMBLER__
141#define SYS_SOC_TYPE(dest, sysrev) \
142 .set push ; \
143 .set reorder ; \
144 dsrl dest, sysrev, S_SYS_SOC_TYPE ; \
145 andi dest, dest, (M_SYS_SOC_TYPE >> S_SYS_SOC_TYPE); \
146 beq dest, K_SYS_SOC_TYPE_BCM1250_ALT, 991f ; \
147 beq dest, K_SYS_SOC_TYPE_BCM1250_ALT2, 991f ; \
148 b 992f ; \
149991: li dest, K_SYS_SOC_TYPE_BCM1250 ; \
150992: \
151 .set pop
152#else
153#define SYS_SOC_TYPE(sysrev) \
154 ((G_SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250_ALT \
155 || G_SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250_ALT2) \
156 ? K_SYS_SOC_TYPE_BCM1250 : G_SYS_SOC_TYPE(sysrev))
157#endif
158
159#define S_SYS_WID _SB_MAKE64(32)
160#define M_SYS_WID _SB_MAKEMASK(32, S_SYS_WID)
161#define V_SYS_WID(x) _SB_MAKEVALUE(x, S_SYS_WID)
162#define G_SYS_WID(x) _SB_GETVALUE(x, S_SYS_WID, M_SYS_WID)
163
164/*
165 * System Manufacturing Register
166 * Register: SCD_SYSTEM_MANUF
167 */
168
169#if SIBYTE_HDR_FEATURE_1250_112x
170/* Wafer ID: bits 31:0 */
171#define S_SYS_WAFERID1_200 _SB_MAKE64(0)
172#define M_SYS_WAFERID1_200 _SB_MAKEMASK(32, S_SYS_WAFERID1_200)
173#define V_SYS_WAFERID1_200(x) _SB_MAKEVALUE(x, S_SYS_WAFERID1_200)
174#define G_SYS_WAFERID1_200(x) _SB_GETVALUE(x, S_SYS_WAFERID1_200, M_SYS_WAFERID1_200)
175
176#define S_SYS_BIN _SB_MAKE64(32)
177#define M_SYS_BIN _SB_MAKEMASK(4, S_SYS_BIN)
178#define V_SYS_BIN(x) _SB_MAKEVALUE(x, S_SYS_BIN)
179#define G_SYS_BIN(x) _SB_GETVALUE(x, S_SYS_BIN, M_SYS_BIN)
180
181/* Wafer ID: bits 39:36 */
182#define S_SYS_WAFERID2_200 _SB_MAKE64(36)
183#define M_SYS_WAFERID2_200 _SB_MAKEMASK(4, S_SYS_WAFERID2_200)
184#define V_SYS_WAFERID2_200(x) _SB_MAKEVALUE(x, S_SYS_WAFERID2_200)
185#define G_SYS_WAFERID2_200(x) _SB_GETVALUE(x, S_SYS_WAFERID2_200, M_SYS_WAFERID2_200)
186
187/* Wafer ID: bits 39:0 */
188#define S_SYS_WAFERID_300 _SB_MAKE64(0)
189#define M_SYS_WAFERID_300 _SB_MAKEMASK(40, S_SYS_WAFERID_300)
190#define V_SYS_WAFERID_300(x) _SB_MAKEVALUE(x, S_SYS_WAFERID_300)
191#define G_SYS_WAFERID_300(x) _SB_GETVALUE(x, S_SYS_WAFERID_300, M_SYS_WAFERID_300)
192
193#define S_SYS_XPOS _SB_MAKE64(40)
194#define M_SYS_XPOS _SB_MAKEMASK(6, S_SYS_XPOS)
195#define V_SYS_XPOS(x) _SB_MAKEVALUE(x, S_SYS_XPOS)
196#define G_SYS_XPOS(x) _SB_GETVALUE(x, S_SYS_XPOS, M_SYS_XPOS)
197
198#define S_SYS_YPOS _SB_MAKE64(46)
199#define M_SYS_YPOS _SB_MAKEMASK(6, S_SYS_YPOS)
200#define V_SYS_YPOS(x) _SB_MAKEVALUE(x, S_SYS_YPOS)
201#define G_SYS_YPOS(x) _SB_GETVALUE(x, S_SYS_YPOS, M_SYS_YPOS)
202#endif
203
204
205/*
206 * System Config Register (Table 4-2)
207 * Register: SCD_SYSTEM_CFG
208 */
209
210#if SIBYTE_HDR_FEATURE_1250_112x
211#define M_SYS_LDT_PLL_BYP _SB_MAKEMASK1(3)
212#define M_SYS_PCI_SYNC_TEST_MODE _SB_MAKEMASK1(4)
213#define M_SYS_IOB0_DIV _SB_MAKEMASK1(5)
214#define M_SYS_IOB1_DIV _SB_MAKEMASK1(6)
215
216#define S_SYS_PLL_DIV _SB_MAKE64(7)
217#define M_SYS_PLL_DIV _SB_MAKEMASK(5, S_SYS_PLL_DIV)
218#define V_SYS_PLL_DIV(x) _SB_MAKEVALUE(x, S_SYS_PLL_DIV)
219#define G_SYS_PLL_DIV(x) _SB_GETVALUE(x, S_SYS_PLL_DIV, M_SYS_PLL_DIV)
220
221#define M_SYS_SER0_ENABLE _SB_MAKEMASK1(12)
222#define M_SYS_SER0_RSTB_EN _SB_MAKEMASK1(13)
223#define M_SYS_SER1_ENABLE _SB_MAKEMASK1(14)
224#define M_SYS_SER1_RSTB_EN _SB_MAKEMASK1(15)
225#define M_SYS_PCMCIA_ENABLE _SB_MAKEMASK1(16)
226
227#define S_SYS_BOOT_MODE _SB_MAKE64(17)
228#define M_SYS_BOOT_MODE _SB_MAKEMASK(2, S_SYS_BOOT_MODE)
229#define V_SYS_BOOT_MODE(x) _SB_MAKEVALUE(x, S_SYS_BOOT_MODE)
230#define G_SYS_BOOT_MODE(x) _SB_GETVALUE(x, S_SYS_BOOT_MODE, M_SYS_BOOT_MODE)
231#define K_SYS_BOOT_MODE_ROM32 0
232#define K_SYS_BOOT_MODE_ROM8 1
233#define K_SYS_BOOT_MODE_SMBUS_SMALL 2
234#define K_SYS_BOOT_MODE_SMBUS_BIG 3
235
236#define M_SYS_PCI_HOST _SB_MAKEMASK1(19)
237#define M_SYS_PCI_ARBITER _SB_MAKEMASK1(20)
238#define M_SYS_SOUTH_ON_LDT _SB_MAKEMASK1(21)
239#define M_SYS_BIG_ENDIAN _SB_MAKEMASK1(22)
240#define M_SYS_GENCLK_EN _SB_MAKEMASK1(23)
241#define M_SYS_LDT_TEST_EN _SB_MAKEMASK1(24)
242#define M_SYS_GEN_PARITY_EN _SB_MAKEMASK1(25)
243
244#define S_SYS_CONFIG 26
245#define M_SYS_CONFIG _SB_MAKEMASK(6, S_SYS_CONFIG)
246#define V_SYS_CONFIG(x) _SB_MAKEVALUE(x, S_SYS_CONFIG)
247#define G_SYS_CONFIG(x) _SB_GETVALUE(x, S_SYS_CONFIG, M_SYS_CONFIG)
248
249/* The following bits are writeable by JTAG only. */
250
251#define M_SYS_CLKSTOP _SB_MAKEMASK1(32)
252#define M_SYS_CLKSTEP _SB_MAKEMASK1(33)
253
254#define S_SYS_CLKCOUNT 34
255#define M_SYS_CLKCOUNT _SB_MAKEMASK(8, S_SYS_CLKCOUNT)
256#define V_SYS_CLKCOUNT(x) _SB_MAKEVALUE(x, S_SYS_CLKCOUNT)
257#define G_SYS_CLKCOUNT(x) _SB_GETVALUE(x, S_SYS_CLKCOUNT, M_SYS_CLKCOUNT)
258
259#define M_SYS_PLL_BYPASS _SB_MAKEMASK1(42)
260
261#define S_SYS_PLL_IREF 43
262#define M_SYS_PLL_IREF _SB_MAKEMASK(2, S_SYS_PLL_IREF)
263
264#define S_SYS_PLL_VCO 45
265#define M_SYS_PLL_VCO _SB_MAKEMASK(2, S_SYS_PLL_VCO)
266
267#define S_SYS_PLL_VREG 47
268#define M_SYS_PLL_VREG _SB_MAKEMASK(2, S_SYS_PLL_VREG)
269
270#define M_SYS_MEM_RESET _SB_MAKEMASK1(49)
271#define M_SYS_L2C_RESET _SB_MAKEMASK1(50)
272#define M_SYS_IO_RESET_0 _SB_MAKEMASK1(51)
273#define M_SYS_IO_RESET_1 _SB_MAKEMASK1(52)
274#define M_SYS_SCD_RESET _SB_MAKEMASK1(53)
275
276/* End of bits writable by JTAG only. */
277
278#define M_SYS_CPU_RESET_0 _SB_MAKEMASK1(54)
279#define M_SYS_CPU_RESET_1 _SB_MAKEMASK1(55)
280
281#define M_SYS_UNICPU0 _SB_MAKEMASK1(56)
282#define M_SYS_UNICPU1 _SB_MAKEMASK1(57)
283
284#define M_SYS_SB_SOFTRES _SB_MAKEMASK1(58)
285#define M_SYS_EXT_RESET _SB_MAKEMASK1(59)
286#define M_SYS_SYSTEM_RESET _SB_MAKEMASK1(60)
287
288#define M_SYS_MISR_MODE _SB_MAKEMASK1(61)
289#define M_SYS_MISR_RESET _SB_MAKEMASK1(62)
290
291#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
292#define M_SYS_SW_FLAG _SB_MAKEMASK1(63)
293#endif /* 1250 PASS2 || 112x PASS1 */
294
295#endif
296
297
298/*
299 * Mailbox Registers (Table 4-3)
300 * Registers: SCD_MBOX_CPU_x
301 */
302
303#define S_MBOX_INT_3 0
304#define M_MBOX_INT_3 _SB_MAKEMASK(16, S_MBOX_INT_3)
305#define S_MBOX_INT_2 16
306#define M_MBOX_INT_2 _SB_MAKEMASK(16, S_MBOX_INT_2)
307#define S_MBOX_INT_1 32
308#define M_MBOX_INT_1 _SB_MAKEMASK(16, S_MBOX_INT_1)
309#define S_MBOX_INT_0 48
310#define M_MBOX_INT_0 _SB_MAKEMASK(16, S_MBOX_INT_0)
311
312/*
313 * Watchdog Registers (Table 4-8) (Table 4-9) (Table 4-10)
314 * Registers: SCD_WDOG_INIT_CNT_x
315 */
316
317#define V_SCD_WDOG_FREQ 1000000
318
319#define S_SCD_WDOG_INIT 0
320#define M_SCD_WDOG_INIT _SB_MAKEMASK(23, S_SCD_WDOG_INIT)
321
322#define S_SCD_WDOG_CNT 0
323#define M_SCD_WDOG_CNT _SB_MAKEMASK(23, S_SCD_WDOG_CNT)
324
325#define S_SCD_WDOG_ENABLE 0
326#define M_SCD_WDOG_ENABLE _SB_MAKEMASK1(S_SCD_WDOG_ENABLE)
327
328#define S_SCD_WDOG_RESET_TYPE 2
329#define M_SCD_WDOG_RESET_TYPE _SB_MAKEMASK(3, S_SCD_WDOG_RESET_TYPE)
330#define V_SCD_WDOG_RESET_TYPE(x) _SB_MAKEVALUE(x, S_SCD_WDOG_RESET_TYPE)
331#define G_SCD_WDOG_RESET_TYPE(x) _SB_GETVALUE(x, S_SCD_WDOG_RESET_TYPE, M_SCD_WDOG_RESET_TYPE)
332
333#define K_SCD_WDOG_RESET_FULL 0 /* actually, (x & 1) == 0 */
334#define K_SCD_WDOG_RESET_SOFT 1
335#define K_SCD_WDOG_RESET_CPU0 3
336#define K_SCD_WDOG_RESET_CPU1 5
337#define K_SCD_WDOG_RESET_BOTH_CPUS 7
338
339/* This feature is present in 1250 C0 and later, but *not* in 112x A revs. */
340#if SIBYTE_HDR_FEATURE(1250, PASS3)
341#define S_SCD_WDOG_HAS_RESET 8
342#define M_SCD_WDOG_HAS_RESET _SB_MAKEMASK1(S_SCD_WDOG_HAS_RESET)
343#endif
344
345
346/*
347 * Timer Registers (Table 4-11) (Table 4-12) (Table 4-13)
348 */
349
350#define V_SCD_TIMER_FREQ 1000000
351
352#define S_SCD_TIMER_INIT 0
353#define M_SCD_TIMER_INIT _SB_MAKEMASK(23, S_SCD_TIMER_INIT)
354#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x, S_SCD_TIMER_INIT)
355#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x, S_SCD_TIMER_INIT, M_SCD_TIMER_INIT)
356
357#define V_SCD_TIMER_WIDTH 23
358#define S_SCD_TIMER_CNT 0
359#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH, S_SCD_TIMER_CNT)
360#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x, S_SCD_TIMER_CNT)
361#define G_SCD_TIMER_CNT(x) _SB_GETVALUE(x, S_SCD_TIMER_CNT, M_SCD_TIMER_CNT)
362
363#define M_SCD_TIMER_ENABLE _SB_MAKEMASK1(0)
364#define M_SCD_TIMER_MODE _SB_MAKEMASK1(1)
365#define M_SCD_TIMER_MODE_CONTINUOUS M_SCD_TIMER_MODE
366
367/*
368 * System Performance Counters
369 */
370
371#define S_SPC_CFG_SRC0 0
372#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8, S_SPC_CFG_SRC0)
373#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC0)
374#define G_SPC_CFG_SRC0(x) _SB_GETVALUE(x, S_SPC_CFG_SRC0, M_SPC_CFG_SRC0)
375
376#define S_SPC_CFG_SRC1 8
377#define M_SPC_CFG_SRC1 _SB_MAKEMASK(8, S_SPC_CFG_SRC1)
378#define V_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC1)
379#define G_SPC_CFG_SRC1(x) _SB_GETVALUE(x, S_SPC_CFG_SRC1, M_SPC_CFG_SRC1)
380
381#define S_SPC_CFG_SRC2 16
382#define M_SPC_CFG_SRC2 _SB_MAKEMASK(8, S_SPC_CFG_SRC2)
383#define V_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC2)
384#define G_SPC_CFG_SRC2(x) _SB_GETVALUE(x, S_SPC_CFG_SRC2, M_SPC_CFG_SRC2)
385
386#define S_SPC_CFG_SRC3 24
387#define M_SPC_CFG_SRC3 _SB_MAKEMASK(8, S_SPC_CFG_SRC3)
388#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC3)
389#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x, S_SPC_CFG_SRC3, M_SPC_CFG_SRC3)
390
391#if SIBYTE_HDR_FEATURE_1250_112x
392#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32)
393#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33)
394#endif
395
396
397/*
398 * Bus Watcher
399 */
400
401#define S_SCD_BERR_TID 8
402#define M_SCD_BERR_TID _SB_MAKEMASK(10, S_SCD_BERR_TID)
403#define V_SCD_BERR_TID(x) _SB_MAKEVALUE(x, S_SCD_BERR_TID)
404#define G_SCD_BERR_TID(x) _SB_GETVALUE(x, S_SCD_BERR_TID, M_SCD_BERR_TID)
405
406#define S_SCD_BERR_RID 18
407#define M_SCD_BERR_RID _SB_MAKEMASK(4, S_SCD_BERR_RID)
408#define V_SCD_BERR_RID(x) _SB_MAKEVALUE(x, S_SCD_BERR_RID)
409#define G_SCD_BERR_RID(x) _SB_GETVALUE(x, S_SCD_BERR_RID, M_SCD_BERR_RID)
410
411#define S_SCD_BERR_DCODE 22
412#define M_SCD_BERR_DCODE _SB_MAKEMASK(3, S_SCD_BERR_DCODE)
413#define V_SCD_BERR_DCODE(x) _SB_MAKEVALUE(x, S_SCD_BERR_DCODE)
414#define G_SCD_BERR_DCODE(x) _SB_GETVALUE(x, S_SCD_BERR_DCODE, M_SCD_BERR_DCODE)
415
416#define M_SCD_BERR_MULTERRS _SB_MAKEMASK1(30)
417
418
419#define S_SCD_L2ECC_CORR_D 0
420#define M_SCD_L2ECC_CORR_D _SB_MAKEMASK(8, S_SCD_L2ECC_CORR_D)
421#define V_SCD_L2ECC_CORR_D(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_CORR_D)
422#define G_SCD_L2ECC_CORR_D(x) _SB_GETVALUE(x, S_SCD_L2ECC_CORR_D, M_SCD_L2ECC_CORR_D)
423
424#define S_SCD_L2ECC_BAD_D 8
425#define M_SCD_L2ECC_BAD_D _SB_MAKEMASK(8, S_SCD_L2ECC_BAD_D)
426#define V_SCD_L2ECC_BAD_D(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_BAD_D)
427#define G_SCD_L2ECC_BAD_D(x) _SB_GETVALUE(x, S_SCD_L2ECC_BAD_D, M_SCD_L2ECC_BAD_D)
428
429#define S_SCD_L2ECC_CORR_T 16
430#define M_SCD_L2ECC_CORR_T _SB_MAKEMASK(8, S_SCD_L2ECC_CORR_T)
431#define V_SCD_L2ECC_CORR_T(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_CORR_T)
432#define G_SCD_L2ECC_CORR_T(x) _SB_GETVALUE(x, S_SCD_L2ECC_CORR_T, M_SCD_L2ECC_CORR_T)
433
434#define S_SCD_L2ECC_BAD_T 24
435#define M_SCD_L2ECC_BAD_T _SB_MAKEMASK(8, S_SCD_L2ECC_BAD_T)
436#define V_SCD_L2ECC_BAD_T(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_BAD_T)
437#define G_SCD_L2ECC_BAD_T(x) _SB_GETVALUE(x, S_SCD_L2ECC_BAD_T, M_SCD_L2ECC_BAD_T)
438
439#define S_SCD_MEM_ECC_CORR 0
440#define M_SCD_MEM_ECC_CORR _SB_MAKEMASK(8, S_SCD_MEM_ECC_CORR)
441#define V_SCD_MEM_ECC_CORR(x) _SB_MAKEVALUE(x, S_SCD_MEM_ECC_CORR)
442#define G_SCD_MEM_ECC_CORR(x) _SB_GETVALUE(x, S_SCD_MEM_ECC_CORR, M_SCD_MEM_ECC_CORR)
443
444#define S_SCD_MEM_ECC_BAD 8
445#define M_SCD_MEM_ECC_BAD _SB_MAKEMASK(8, S_SCD_MEM_ECC_BAD)
446#define V_SCD_MEM_ECC_BAD(x) _SB_MAKEVALUE(x, S_SCD_MEM_ECC_BAD)
447#define G_SCD_MEM_ECC_BAD(x) _SB_GETVALUE(x, S_SCD_MEM_ECC_BAD, M_SCD_MEM_ECC_BAD)
448
449#define S_SCD_MEM_BUSERR 16
450#define M_SCD_MEM_BUSERR _SB_MAKEMASK(8, S_SCD_MEM_BUSERR)
451#define V_SCD_MEM_BUSERR(x) _SB_MAKEVALUE(x, S_SCD_MEM_BUSERR)
452#define G_SCD_MEM_BUSERR(x) _SB_GETVALUE(x, S_SCD_MEM_BUSERR, M_SCD_MEM_BUSERR)
453
454
455/*
456 * Address Trap Registers
457 */
458
459#if SIBYTE_HDR_FEATURE_1250_112x
460#define M_ATRAP_INDEX _SB_MAKEMASK(4, 0)
461#define M_ATRAP_ADDRESS _SB_MAKEMASK(40, 0)
462
463#define S_ATRAP_CFG_CNT 0
464#define M_ATRAP_CFG_CNT _SB_MAKEMASK(3, S_ATRAP_CFG_CNT)
465#define V_ATRAP_CFG_CNT(x) _SB_MAKEVALUE(x, S_ATRAP_CFG_CNT)
466#define G_ATRAP_CFG_CNT(x) _SB_GETVALUE(x, S_ATRAP_CFG_CNT, M_ATRAP_CFG_CNT)
467
468#define M_ATRAP_CFG_WRITE _SB_MAKEMASK1(3)
469#define M_ATRAP_CFG_ALL _SB_MAKEMASK1(4)
470#define M_ATRAP_CFG_INV _SB_MAKEMASK1(5)
471#define M_ATRAP_CFG_USESRC _SB_MAKEMASK1(6)
472#define M_ATRAP_CFG_SRCINV _SB_MAKEMASK1(7)
473
474#define S_ATRAP_CFG_AGENTID 8
475#define M_ATRAP_CFG_AGENTID _SB_MAKEMASK(4, S_ATRAP_CFG_AGENTID)
476#define V_ATRAP_CFG_AGENTID(x) _SB_MAKEVALUE(x, S_ATRAP_CFG_AGENTID)
477#define G_ATRAP_CFG_AGENTID(x) _SB_GETVALUE(x, S_ATRAP_CFG_AGENTID, M_ATRAP_CFG_AGENTID)
478
479#define K_BUS_AGENT_CPU0 0
480#define K_BUS_AGENT_CPU1 1
481#define K_BUS_AGENT_IOB0 2
482#define K_BUS_AGENT_IOB1 3
483#define K_BUS_AGENT_SCD 4
484#define K_BUS_AGENT_L2C 6
485#define K_BUS_AGENT_MC 7
486
487#define S_ATRAP_CFG_CATTR 12
488#define M_ATRAP_CFG_CATTR _SB_MAKEMASK(3, S_ATRAP_CFG_CATTR)
489#define V_ATRAP_CFG_CATTR(x) _SB_MAKEVALUE(x, S_ATRAP_CFG_CATTR)
490#define G_ATRAP_CFG_CATTR(x) _SB_GETVALUE(x, S_ATRAP_CFG_CATTR, M_ATRAP_CFG_CATTR)
491
492#define K_ATRAP_CFG_CATTR_IGNORE 0
493#define K_ATRAP_CFG_CATTR_UNC 1
494#define K_ATRAP_CFG_CATTR_CACHEABLE 2
495#define K_ATRAP_CFG_CATTR_NONCOH 3
496#define K_ATRAP_CFG_CATTR_COHERENT 4
497#define K_ATRAP_CFG_CATTR_NOTUNC 5
498#define K_ATRAP_CFG_CATTR_NOTNONCOH 6
499#define K_ATRAP_CFG_CATTR_NOTCOHERENT 7
500
501#endif /* 1250/112x */
502
503/*
504 * Trace Buffer Config register
505 */
506
507#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
508#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
509#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
510#define M_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3)
511#define M_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4)
512#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
513#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
514#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
515#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
516#define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8)
517#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
518
519/*
520 * This field is the same on the 1250/112x and 1480, just located in
521 * a slightly different place in the register.
522 */
523#if SIBYTE_HDR_FEATURE_1250_112x
524#define S_SCD_TRACE_CFG_CUR_ADDR 10
525#else
526#if SIBYTE_HDR_FEATURE_CHIP(1480)
527#define S_SCD_TRACE_CFG_CUR_ADDR 24
528#endif /* 1480 */
529#endif /* 1250/112x */
530
531#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8, S_SCD_TRACE_CFG_CUR_ADDR)
532#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x, S_SCD_TRACE_CFG_CUR_ADDR)
533#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x, S_SCD_TRACE_CFG_CUR_ADDR, M_SCD_TRACE_CFG_CUR_ADDR)
534
535/*
536 * Trace Event registers
537 */
538
539#define S_SCD_TREVT_ADDR_MATCH 0
540#define M_SCD_TREVT_ADDR_MATCH _SB_MAKEMASK(4, S_SCD_TREVT_ADDR_MATCH)
541#define V_SCD_TREVT_ADDR_MATCH(x) _SB_MAKEVALUE(x, S_SCD_TREVT_ADDR_MATCH)
542#define G_SCD_TREVT_ADDR_MATCH(x) _SB_GETVALUE(x, S_SCD_TREVT_ADDR_MATCH, M_SCD_TREVT_ADDR_MATCH)
543
544#define M_SCD_TREVT_REQID_MATCH _SB_MAKEMASK1(4)
545#define M_SCD_TREVT_DATAID_MATCH _SB_MAKEMASK1(5)
546#define M_SCD_TREVT_RESPID_MATCH _SB_MAKEMASK1(6)
547#define M_SCD_TREVT_INTERRUPT _SB_MAKEMASK1(7)
548#define M_SCD_TREVT_DEBUG_PIN _SB_MAKEMASK1(9)
549#define M_SCD_TREVT_WRITE _SB_MAKEMASK1(10)
550#define M_SCD_TREVT_READ _SB_MAKEMASK1(11)
551
552#define S_SCD_TREVT_REQID 12
553#define M_SCD_TREVT_REQID _SB_MAKEMASK(4, S_SCD_TREVT_REQID)
554#define V_SCD_TREVT_REQID(x) _SB_MAKEVALUE(x, S_SCD_TREVT_REQID)
555#define G_SCD_TREVT_REQID(x) _SB_GETVALUE(x, S_SCD_TREVT_REQID, M_SCD_TREVT_REQID)
556
557#define S_SCD_TREVT_RESPID 16
558#define M_SCD_TREVT_RESPID _SB_MAKEMASK(4, S_SCD_TREVT_RESPID)
559#define V_SCD_TREVT_RESPID(x) _SB_MAKEVALUE(x, S_SCD_TREVT_RESPID)
560#define G_SCD_TREVT_RESPID(x) _SB_GETVALUE(x, S_SCD_TREVT_RESPID, M_SCD_TREVT_RESPID)
561
562#define S_SCD_TREVT_DATAID 20
563#define M_SCD_TREVT_DATAID _SB_MAKEMASK(4, S_SCD_TREVT_DATAID)
564#define V_SCD_TREVT_DATAID(x) _SB_MAKEVALUE(x, S_SCD_TREVT_DATAID)
565#define G_SCD_TREVT_DATAID(x) _SB_GETVALUE(x, S_SCD_TREVT_DATAID, M_SCD_TREVT_DATID)
566
567#define S_SCD_TREVT_COUNT 24
568#define M_SCD_TREVT_COUNT _SB_MAKEMASK(8, S_SCD_TREVT_COUNT)
569#define V_SCD_TREVT_COUNT(x) _SB_MAKEVALUE(x, S_SCD_TREVT_COUNT)
570#define G_SCD_TREVT_COUNT(x) _SB_GETVALUE(x, S_SCD_TREVT_COUNT, M_SCD_TREVT_COUNT)
571
572/*
573 * Trace Sequence registers
574 */
575
576#define S_SCD_TRSEQ_EVENT4 0
577#define M_SCD_TRSEQ_EVENT4 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT4)
578#define V_SCD_TRSEQ_EVENT4(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT4)
579#define G_SCD_TRSEQ_EVENT4(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT4, M_SCD_TRSEQ_EVENT4)
580
581#define S_SCD_TRSEQ_EVENT3 4
582#define M_SCD_TRSEQ_EVENT3 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT3)
583#define V_SCD_TRSEQ_EVENT3(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT3)
584#define G_SCD_TRSEQ_EVENT3(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT3, M_SCD_TRSEQ_EVENT3)
585
586#define S_SCD_TRSEQ_EVENT2 8
587#define M_SCD_TRSEQ_EVENT2 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT2)
588#define V_SCD_TRSEQ_EVENT2(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT2)
589#define G_SCD_TRSEQ_EVENT2(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT2, M_SCD_TRSEQ_EVENT2)
590
591#define S_SCD_TRSEQ_EVENT1 12
592#define M_SCD_TRSEQ_EVENT1 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT1)
593#define V_SCD_TRSEQ_EVENT1(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT1)
594#define G_SCD_TRSEQ_EVENT1(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT1, M_SCD_TRSEQ_EVENT1)
595
596#define K_SCD_TRSEQ_E0 0
597#define K_SCD_TRSEQ_E1 1
598#define K_SCD_TRSEQ_E2 2
599#define K_SCD_TRSEQ_E3 3
600#define K_SCD_TRSEQ_E0_E1 4
601#define K_SCD_TRSEQ_E1_E2 5
602#define K_SCD_TRSEQ_E2_E3 6
603#define K_SCD_TRSEQ_E0_E1_E2 7
604#define K_SCD_TRSEQ_E0_E1_E2_E3 8
605#define K_SCD_TRSEQ_E0E1 9
606#define K_SCD_TRSEQ_E0E1E2 10
607#define K_SCD_TRSEQ_E0E1E2E3 11
608#define K_SCD_TRSEQ_E0E1_E2 12
609#define K_SCD_TRSEQ_E0E1_E2E3 13
610#define K_SCD_TRSEQ_E0E1_E2_E3 14
611#define K_SCD_TRSEQ_IGNORED 15
612
613#define K_SCD_TRSEQ_TRIGGER_ALL (V_SCD_TRSEQ_EVENT1(K_SCD_TRSEQ_IGNORED) | \
614 V_SCD_TRSEQ_EVENT2(K_SCD_TRSEQ_IGNORED) | \
615 V_SCD_TRSEQ_EVENT3(K_SCD_TRSEQ_IGNORED) | \
616 V_SCD_TRSEQ_EVENT4(K_SCD_TRSEQ_IGNORED))
617
618#define S_SCD_TRSEQ_FUNCTION 16
619#define M_SCD_TRSEQ_FUNCTION _SB_MAKEMASK(4, S_SCD_TRSEQ_FUNCTION)
620#define V_SCD_TRSEQ_FUNCTION(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_FUNCTION)
621#define G_SCD_TRSEQ_FUNCTION(x) _SB_GETVALUE(x, S_SCD_TRSEQ_FUNCTION, M_SCD_TRSEQ_FUNCTION)
622
623#define K_SCD_TRSEQ_FUNC_NOP 0
624#define K_SCD_TRSEQ_FUNC_START 1
625#define K_SCD_TRSEQ_FUNC_STOP 2
626#define K_SCD_TRSEQ_FUNC_FREEZE 3
627
628#define V_SCD_TRSEQ_FUNC_NOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_NOP)
629#define V_SCD_TRSEQ_FUNC_START V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_START)
630#define V_SCD_TRSEQ_FUNC_STOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_STOP)
631#define V_SCD_TRSEQ_FUNC_FREEZE V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_FREEZE)
632
633#define M_SCD_TRSEQ_ASAMPLE _SB_MAKEMASK1(18)
634#define M_SCD_TRSEQ_DSAMPLE _SB_MAKEMASK1(19)
635#define M_SCD_TRSEQ_DEBUGPIN _SB_MAKEMASK1(20)
636#define M_SCD_TRSEQ_DEBUGCPU _SB_MAKEMASK1(21)
637#define M_SCD_TRSEQ_CLEARUSE _SB_MAKEMASK1(22)
638#define M_SCD_TRSEQ_ALLD_A _SB_MAKEMASK1(23)
639#define M_SCD_TRSEQ_ALL_A _SB_MAKEMASK1(24)
640
641#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_smbus.h b/arch/mips/include/asm/sibyte/sb1250_smbus.h
new file mode 100644
index 000000000..e854f96ff
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_smbus.h
@@ -0,0 +1,191 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * SMBUS Constants File: sb1250_smbus.h
6 *
7 * This module contains constants and macros useful for
8 * manipulating the SB1250's SMbus devices.
9 *
10 * SB1250 specification level: 10/21/02
11 * BCM1280 specification level: 11/24/03
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 ********************************************************************* */
19
20
21#ifndef _SB1250_SMBUS_H
22#define _SB1250_SMBUS_H
23
24#include <asm/sibyte/sb1250_defs.h>
25
26/*
27 * SMBus Clock Frequency Register (Table 14-2)
28 */
29
30#define S_SMB_FREQ_DIV 0
31#define M_SMB_FREQ_DIV _SB_MAKEMASK(13, S_SMB_FREQ_DIV)
32#define V_SMB_FREQ_DIV(x) _SB_MAKEVALUE(x, S_SMB_FREQ_DIV)
33
34#define K_SMB_FREQ_400KHZ 0x1F
35#define K_SMB_FREQ_100KHZ 0x7D
36#define K_SMB_FREQ_10KHZ 1250
37
38#define S_SMB_CMD 0
39#define M_SMB_CMD _SB_MAKEMASK(8, S_SMB_CMD)
40#define V_SMB_CMD(x) _SB_MAKEVALUE(x, S_SMB_CMD)
41
42/*
43 * SMBus control register (Table 14-4)
44 */
45
46#define M_SMB_ERR_INTR _SB_MAKEMASK1(0)
47#define M_SMB_FINISH_INTR _SB_MAKEMASK1(1)
48
49#define S_SMB_DATA_OUT 4
50#define M_SMB_DATA_OUT _SB_MAKEMASK1(S_SMB_DATA_OUT)
51#define V_SMB_DATA_OUT(x) _SB_MAKEVALUE(x, S_SMB_DATA_OUT)
52
53#define M_SMB_DATA_DIR _SB_MAKEMASK1(5)
54#define M_SMB_DATA_DIR_OUTPUT M_SMB_DATA_DIR
55#define M_SMB_CLK_OUT _SB_MAKEMASK1(6)
56#define M_SMB_DIRECT_ENABLE _SB_MAKEMASK1(7)
57
58/*
59 * SMBus status registers (Table 14-5)
60 */
61
62#define M_SMB_BUSY _SB_MAKEMASK1(0)
63#define M_SMB_ERROR _SB_MAKEMASK1(1)
64#define M_SMB_ERROR_TYPE _SB_MAKEMASK1(2)
65
66#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
67#define S_SMB_SCL_IN 5
68#define M_SMB_SCL_IN _SB_MAKEMASK1(S_SMB_SCL_IN)
69#define V_SMB_SCL_IN(x) _SB_MAKEVALUE(x, S_SMB_SCL_IN)
70#define G_SMB_SCL_IN(x) _SB_GETVALUE(x, S_SMB_SCL_IN, M_SMB_SCL_IN)
71#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
72
73#define S_SMB_REF 6
74#define M_SMB_REF _SB_MAKEMASK1(S_SMB_REF)
75#define V_SMB_REF(x) _SB_MAKEVALUE(x, S_SMB_REF)
76#define G_SMB_REF(x) _SB_GETVALUE(x, S_SMB_REF, M_SMB_REF)
77
78#define S_SMB_DATA_IN 7
79#define M_SMB_DATA_IN _SB_MAKEMASK1(S_SMB_DATA_IN)
80#define V_SMB_DATA_IN(x) _SB_MAKEVALUE(x, S_SMB_DATA_IN)
81#define G_SMB_DATA_IN(x) _SB_GETVALUE(x, S_SMB_DATA_IN, M_SMB_DATA_IN)
82
83/*
84 * SMBus Start/Command registers (Table 14-9)
85 */
86
87#define S_SMB_ADDR 0
88#define M_SMB_ADDR _SB_MAKEMASK(7, S_SMB_ADDR)
89#define V_SMB_ADDR(x) _SB_MAKEVALUE(x, S_SMB_ADDR)
90#define G_SMB_ADDR(x) _SB_GETVALUE(x, S_SMB_ADDR, M_SMB_ADDR)
91
92#define M_SMB_QDATA _SB_MAKEMASK1(7)
93
94#define S_SMB_TT 8
95#define M_SMB_TT _SB_MAKEMASK(3, S_SMB_TT)
96#define V_SMB_TT(x) _SB_MAKEVALUE(x, S_SMB_TT)
97#define G_SMB_TT(x) _SB_GETVALUE(x, S_SMB_TT, M_SMB_TT)
98
99#define K_SMB_TT_WR1BYTE 0
100#define K_SMB_TT_WR2BYTE 1
101#define K_SMB_TT_WR3BYTE 2
102#define K_SMB_TT_CMD_RD1BYTE 3
103#define K_SMB_TT_CMD_RD2BYTE 4
104#define K_SMB_TT_RD1BYTE 5
105#define K_SMB_TT_QUICKCMD 6
106#define K_SMB_TT_EEPROMREAD 7
107
108#define V_SMB_TT_WR1BYTE V_SMB_TT(K_SMB_TT_WR1BYTE)
109#define V_SMB_TT_WR2BYTE V_SMB_TT(K_SMB_TT_WR2BYTE)
110#define V_SMB_TT_WR3BYTE V_SMB_TT(K_SMB_TT_WR3BYTE)
111#define V_SMB_TT_CMD_RD1BYTE V_SMB_TT(K_SMB_TT_CMD_RD1BYTE)
112#define V_SMB_TT_CMD_RD2BYTE V_SMB_TT(K_SMB_TT_CMD_RD2BYTE)
113#define V_SMB_TT_RD1BYTE V_SMB_TT(K_SMB_TT_RD1BYTE)
114#define V_SMB_TT_QUICKCMD V_SMB_TT(K_SMB_TT_QUICKCMD)
115#define V_SMB_TT_EEPROMREAD V_SMB_TT(K_SMB_TT_EEPROMREAD)
116
117#define M_SMB_PEC _SB_MAKEMASK1(15)
118
119/*
120 * SMBus Data Register (Table 14-6) and SMBus Extra Register (Table 14-7)
121 */
122
123#define S_SMB_LB 0
124#define M_SMB_LB _SB_MAKEMASK(8, S_SMB_LB)
125#define V_SMB_LB(x) _SB_MAKEVALUE(x, S_SMB_LB)
126
127#define S_SMB_MB 8
128#define M_SMB_MB _SB_MAKEMASK(8, S_SMB_MB)
129#define V_SMB_MB(x) _SB_MAKEVALUE(x, S_SMB_MB)
130
131
132/*
133 * SMBus Packet Error Check register (Table 14-8)
134 */
135
136#define S_SPEC_PEC 0
137#define M_SPEC_PEC _SB_MAKEMASK(8, S_SPEC_PEC)
138#define V_SPEC_MB(x) _SB_MAKEVALUE(x, S_SPEC_PEC)
139
140
141#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
142
143#define S_SMB_CMDH 8
144#define M_SMB_CMDH _SB_MAKEMASK(8, S_SMB_CMDH)
145#define V_SMB_CMDH(x) _SB_MAKEVALUE(x, S_SMB_CMDH)
146
147#define M_SMB_EXTEND _SB_MAKEMASK1(14)
148
149#define S_SMB_DFMT 8
150#define M_SMB_DFMT _SB_MAKEMASK(3, S_SMB_DFMT)
151#define V_SMB_DFMT(x) _SB_MAKEVALUE(x, S_SMB_DFMT)
152#define G_SMB_DFMT(x) _SB_GETVALUE(x, S_SMB_DFMT, M_SMB_DFMT)
153
154#define K_SMB_DFMT_1BYTE 0
155#define K_SMB_DFMT_2BYTE 1
156#define K_SMB_DFMT_3BYTE 2
157#define K_SMB_DFMT_4BYTE 3
158#define K_SMB_DFMT_NODATA 4
159#define K_SMB_DFMT_CMD4BYTE 5
160#define K_SMB_DFMT_CMD5BYTE 6
161#define K_SMB_DFMT_RESERVED 7
162
163#define V_SMB_DFMT_1BYTE V_SMB_DFMT(K_SMB_DFMT_1BYTE)
164#define V_SMB_DFMT_2BYTE V_SMB_DFMT(K_SMB_DFMT_2BYTE)
165#define V_SMB_DFMT_3BYTE V_SMB_DFMT(K_SMB_DFMT_3BYTE)
166#define V_SMB_DFMT_4BYTE V_SMB_DFMT(K_SMB_DFMT_4BYTE)
167#define V_SMB_DFMT_NODATA V_SMB_DFMT(K_SMB_DFMT_NODATA)
168#define V_SMB_DFMT_CMD4BYTE V_SMB_DFMT(K_SMB_DFMT_CMD4BYTE)
169#define V_SMB_DFMT_CMD5BYTE V_SMB_DFMT(K_SMB_DFMT_CMD5BYTE)
170#define V_SMB_DFMT_RESERVED V_SMB_DFMT(K_SMB_DFMT_RESERVED)
171
172#define S_SMB_AFMT 11
173#define M_SMB_AFMT _SB_MAKEMASK(2, S_SMB_AFMT)
174#define V_SMB_AFMT(x) _SB_MAKEVALUE(x, S_SMB_AFMT)
175#define G_SMB_AFMT(x) _SB_GETVALUE(x, S_SMB_AFMT, M_SMB_AFMT)
176
177#define K_SMB_AFMT_NONE 0
178#define K_SMB_AFMT_ADDR 1
179#define K_SMB_AFMT_ADDR_CMD1BYTE 2
180#define K_SMB_AFMT_ADDR_CMD2BYTE 3
181
182#define V_SMB_AFMT_NONE V_SMB_AFMT(K_SMB_AFMT_NONE)
183#define V_SMB_AFMT_ADDR V_SMB_AFMT(K_SMB_AFMT_ADDR)
184#define V_SMB_AFMT_ADDR_CMD1BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD1BYTE)
185#define V_SMB_AFMT_ADDR_CMD2BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD2BYTE)
186
187#define M_SMB_DIR _SB_MAKEMASK1(13)
188
189#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
190
191#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_syncser.h b/arch/mips/include/asm/sibyte/sb1250_syncser.h
new file mode 100644
index 000000000..8b40e3f05
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_syncser.h
@@ -0,0 +1,133 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * Synchronous Serial Constants File: sb1250_syncser.h
6 *
7 * This module contains constants and macros useful for
8 * manipulating the SB1250's Synchronous Serial
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _SB1250_SYNCSER_H
21#define _SB1250_SYNCSER_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25/*
26 * Serial Mode Configuration Register
27 */
28
29#define M_SYNCSER_CRC_MODE _SB_MAKEMASK1(0)
30#define M_SYNCSER_MSB_FIRST _SB_MAKEMASK1(1)
31
32#define S_SYNCSER_FLAG_NUM 2
33#define M_SYNCSER_FLAG_NUM _SB_MAKEMASK(4, S_SYNCSER_FLAG_NUM)
34#define V_SYNCSER_FLAG_NUM _SB_MAKEVALUE(x, S_SYNCSER_FLAG_NUM)
35
36#define M_SYNCSER_FLAG_EN _SB_MAKEMASK1(6)
37#define M_SYNCSER_HDLC_EN _SB_MAKEMASK1(7)
38#define M_SYNCSER_LOOP_MODE _SB_MAKEMASK1(8)
39#define M_SYNCSER_LOOPBACK _SB_MAKEMASK1(9)
40
41/*
42 * Serial Clock Source and Line Interface Mode Register
43 */
44
45#define M_SYNCSER_RXCLK_INV _SB_MAKEMASK1(0)
46#define M_SYNCSER_RXCLK_EXT _SB_MAKEMASK1(1)
47
48#define S_SYNCSER_RXSYNC_DLY 2
49#define M_SYNCSER_RXSYNC_DLY _SB_MAKEMASK(2, S_SYNCSER_RXSYNC_DLY)
50#define V_SYNCSER_RXSYNC_DLY(x) _SB_MAKEVALUE(x, S_SYNCSER_RXSYNC_DLY)
51
52#define M_SYNCSER_RXSYNC_LOW _SB_MAKEMASK1(4)
53#define M_SYNCSER_RXSTRB_LOW _SB_MAKEMASK1(5)
54
55#define M_SYNCSER_RXSYNC_EDGE _SB_MAKEMASK1(6)
56#define M_SYNCSER_RXSYNC_INT _SB_MAKEMASK1(7)
57
58#define M_SYNCSER_TXCLK_INV _SB_MAKEMASK1(8)
59#define M_SYNCSER_TXCLK_EXT _SB_MAKEMASK1(9)
60
61#define S_SYNCSER_TXSYNC_DLY 10
62#define M_SYNCSER_TXSYNC_DLY _SB_MAKEMASK(2, S_SYNCSER_TXSYNC_DLY)
63#define V_SYNCSER_TXSYNC_DLY(x) _SB_MAKEVALUE(x, S_SYNCSER_TXSYNC_DLY)
64
65#define M_SYNCSER_TXSYNC_LOW _SB_MAKEMASK1(12)
66#define M_SYNCSER_TXSTRB_LOW _SB_MAKEMASK1(13)
67
68#define M_SYNCSER_TXSYNC_EDGE _SB_MAKEMASK1(14)
69#define M_SYNCSER_TXSYNC_INT _SB_MAKEMASK1(15)
70
71/*
72 * Serial Command Register
73 */
74
75#define M_SYNCSER_CMD_RX_EN _SB_MAKEMASK1(0)
76#define M_SYNCSER_CMD_TX_EN _SB_MAKEMASK1(1)
77#define M_SYNCSER_CMD_RX_RESET _SB_MAKEMASK1(2)
78#define M_SYNCSER_CMD_TX_RESET _SB_MAKEMASK1(3)
79#define M_SYNCSER_CMD_TX_PAUSE _SB_MAKEMASK1(5)
80
81/*
82 * Serial DMA Enable Register
83 */
84
85#define M_SYNCSER_DMA_RX_EN _SB_MAKEMASK1(0)
86#define M_SYNCSER_DMA_TX_EN _SB_MAKEMASK1(4)
87
88/*
89 * Serial Status Register
90 */
91
92#define M_SYNCSER_RX_CRCERR _SB_MAKEMASK1(0)
93#define M_SYNCSER_RX_ABORT _SB_MAKEMASK1(1)
94#define M_SYNCSER_RX_OCTET _SB_MAKEMASK1(2)
95#define M_SYNCSER_RX_LONGFRM _SB_MAKEMASK1(3)
96#define M_SYNCSER_RX_SHORTFRM _SB_MAKEMASK1(4)
97#define M_SYNCSER_RX_OVERRUN _SB_MAKEMASK1(5)
98#define M_SYNCSER_RX_SYNC_ERR _SB_MAKEMASK1(6)
99#define M_SYNCSER_TX_CRCERR _SB_MAKEMASK1(8)
100#define M_SYNCSER_TX_UNDERRUN _SB_MAKEMASK1(9)
101#define M_SYNCSER_TX_SYNC_ERR _SB_MAKEMASK1(10)
102#define M_SYNCSER_TX_PAUSE_COMPLETE _SB_MAKEMASK1(11)
103#define M_SYNCSER_RX_EOP_COUNT _SB_MAKEMASK1(16)
104#define M_SYNCSER_RX_EOP_TIMER _SB_MAKEMASK1(17)
105#define M_SYNCSER_RX_EOP_SEEN _SB_MAKEMASK1(18)
106#define M_SYNCSER_RX_HWM _SB_MAKEMASK1(19)
107#define M_SYNCSER_RX_LWM _SB_MAKEMASK1(20)
108#define M_SYNCSER_RX_DSCR _SB_MAKEMASK1(21)
109#define M_SYNCSER_RX_DERR _SB_MAKEMASK1(22)
110#define M_SYNCSER_TX_EOP_COUNT _SB_MAKEMASK1(24)
111#define M_SYNCSER_TX_EOP_TIMER _SB_MAKEMASK1(25)
112#define M_SYNCSER_TX_EOP_SEEN _SB_MAKEMASK1(26)
113#define M_SYNCSER_TX_HWM _SB_MAKEMASK1(27)
114#define M_SYNCSER_TX_LWM _SB_MAKEMASK1(28)
115#define M_SYNCSER_TX_DSCR _SB_MAKEMASK1(29)
116#define M_SYNCSER_TX_DERR _SB_MAKEMASK1(30)
117#define M_SYNCSER_TX_DZERO _SB_MAKEMASK1(31)
118
119/*
120 * Sequencer Table Entry format
121 */
122
123#define M_SYNCSER_SEQ_LAST _SB_MAKEMASK1(0)
124#define M_SYNCSER_SEQ_BYTE _SB_MAKEMASK1(1)
125
126#define S_SYNCSER_SEQ_COUNT 2
127#define M_SYNCSER_SEQ_COUNT _SB_MAKEMASK(4, S_SYNCSER_SEQ_COUNT)
128#define V_SYNCSER_SEQ_COUNT(x) _SB_MAKEVALUE(x, S_SYNCSER_SEQ_COUNT)
129
130#define M_SYNCSER_SEQ_ENABLE _SB_MAKEMASK1(6)
131#define M_SYNCSER_SEQ_STROBE _SB_MAKEMASK1(7)
132
133#endif
diff --git a/arch/mips/include/asm/sibyte/sb1250_uart.h b/arch/mips/include/asm/sibyte/sb1250_uart.h
new file mode 100644
index 000000000..da782e643
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sb1250_uart.h
@@ -0,0 +1,349 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* *********************************************************************
3 * SB1250 Board Support Package
4 *
5 * UART Constants File: sb1250_uart.h
6 *
7 * This module contains constants and macros useful for
8 * manipulating the SB1250's UARTs
9 *
10 * SB1250 specification level: User's manual 1/02/02
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 ********************************************************************* */
18
19
20#ifndef _SB1250_UART_H
21#define _SB1250_UART_H
22
23#include <asm/sibyte/sb1250_defs.h>
24
25/* **********************************************************************
26 * DUART Registers
27 ********************************************************************** */
28
29/*
30 * DUART Mode Register #1 (Table 10-3)
31 * Register: DUART_MODE_REG_1_A
32 * Register: DUART_MODE_REG_1_B
33 */
34
35#define S_DUART_BITS_PER_CHAR 0
36#define M_DUART_BITS_PER_CHAR _SB_MAKEMASK(2, S_DUART_BITS_PER_CHAR)
37#define V_DUART_BITS_PER_CHAR(x) _SB_MAKEVALUE(x, S_DUART_BITS_PER_CHAR)
38
39#define K_DUART_BITS_PER_CHAR_RSV0 0
40#define K_DUART_BITS_PER_CHAR_RSV1 1
41#define K_DUART_BITS_PER_CHAR_7 2
42#define K_DUART_BITS_PER_CHAR_8 3
43
44#define V_DUART_BITS_PER_CHAR_RSV0 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV0)
45#define V_DUART_BITS_PER_CHAR_RSV1 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV1)
46#define V_DUART_BITS_PER_CHAR_7 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_7)
47#define V_DUART_BITS_PER_CHAR_8 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_8)
48
49
50#define M_DUART_PARITY_TYPE_EVEN 0x00
51#define M_DUART_PARITY_TYPE_ODD _SB_MAKEMASK1(2)
52
53#define S_DUART_PARITY_MODE 3
54#define M_DUART_PARITY_MODE _SB_MAKEMASK(2, S_DUART_PARITY_MODE)
55#define V_DUART_PARITY_MODE(x) _SB_MAKEVALUE(x, S_DUART_PARITY_MODE)
56
57#define K_DUART_PARITY_MODE_ADD 0
58#define K_DUART_PARITY_MODE_ADD_FIXED 1
59#define K_DUART_PARITY_MODE_NONE 2
60
61#define V_DUART_PARITY_MODE_ADD V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD)
62#define V_DUART_PARITY_MODE_ADD_FIXED V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD_FIXED)
63#define V_DUART_PARITY_MODE_NONE V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_NONE)
64
65#define M_DUART_TX_IRQ_SEL_TXRDY 0
66#define M_DUART_TX_IRQ_SEL_TXEMPT _SB_MAKEMASK1(5)
67
68#define M_DUART_RX_IRQ_SEL_RXRDY 0
69#define M_DUART_RX_IRQ_SEL_RXFULL _SB_MAKEMASK1(6)
70
71#define M_DUART_RX_RTS_ENA _SB_MAKEMASK1(7)
72
73/*
74 * DUART Mode Register #2 (Table 10-4)
75 * Register: DUART_MODE_REG_2_A
76 * Register: DUART_MODE_REG_2_B
77 */
78
79#define M_DUART_MODE_RESERVED1 _SB_MAKEMASK(3, 0) /* ignored */
80
81#define M_DUART_STOP_BIT_LEN_2 _SB_MAKEMASK1(3)
82#define M_DUART_STOP_BIT_LEN_1 0
83
84#define M_DUART_TX_CTS_ENA _SB_MAKEMASK1(4)
85
86
87#define M_DUART_MODE_RESERVED2 _SB_MAKEMASK1(5) /* must be zero */
88
89#define S_DUART_CHAN_MODE 6
90#define M_DUART_CHAN_MODE _SB_MAKEMASK(2, S_DUART_CHAN_MODE)
91#define V_DUART_CHAN_MODE(x) _SB_MAKEVALUE(x, S_DUART_CHAN_MODE)
92
93#define K_DUART_CHAN_MODE_NORMAL 0
94#define K_DUART_CHAN_MODE_LCL_LOOP 2
95#define K_DUART_CHAN_MODE_REM_LOOP 3
96
97#define V_DUART_CHAN_MODE_NORMAL V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_NORMAL)
98#define V_DUART_CHAN_MODE_LCL_LOOP V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_LCL_LOOP)
99#define V_DUART_CHAN_MODE_REM_LOOP V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_REM_LOOP)
100
101/*
102 * DUART Command Register (Table 10-5)
103 * Register: DUART_CMD_A
104 * Register: DUART_CMD_B
105 */
106
107#define M_DUART_RX_EN _SB_MAKEMASK1(0)
108#define M_DUART_RX_DIS _SB_MAKEMASK1(1)
109#define M_DUART_TX_EN _SB_MAKEMASK1(2)
110#define M_DUART_TX_DIS _SB_MAKEMASK1(3)
111
112#define S_DUART_MISC_CMD 4
113#define M_DUART_MISC_CMD _SB_MAKEMASK(3, S_DUART_MISC_CMD)
114#define V_DUART_MISC_CMD(x) _SB_MAKEVALUE(x, S_DUART_MISC_CMD)
115
116#define K_DUART_MISC_CMD_NOACTION0 0
117#define K_DUART_MISC_CMD_NOACTION1 1
118#define K_DUART_MISC_CMD_RESET_RX 2
119#define K_DUART_MISC_CMD_RESET_TX 3
120#define K_DUART_MISC_CMD_NOACTION4 4
121#define K_DUART_MISC_CMD_RESET_BREAK_INT 5
122#define K_DUART_MISC_CMD_START_BREAK 6
123#define K_DUART_MISC_CMD_STOP_BREAK 7
124
125#define V_DUART_MISC_CMD_NOACTION0 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION0)
126#define V_DUART_MISC_CMD_NOACTION1 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION1)
127#define V_DUART_MISC_CMD_RESET_RX V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_RX)
128#define V_DUART_MISC_CMD_RESET_TX V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_TX)
129#define V_DUART_MISC_CMD_NOACTION4 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION4)
130#define V_DUART_MISC_CMD_RESET_BREAK_INT V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_BREAK_INT)
131#define V_DUART_MISC_CMD_START_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_START_BREAK)
132#define V_DUART_MISC_CMD_STOP_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_STOP_BREAK)
133
134#define M_DUART_CMD_RESERVED _SB_MAKEMASK1(7)
135
136/*
137 * DUART Status Register (Table 10-6)
138 * Register: DUART_STATUS_A
139 * Register: DUART_STATUS_B
140 * READ-ONLY
141 */
142
143#define M_DUART_RX_RDY _SB_MAKEMASK1(0)
144#define M_DUART_RX_FFUL _SB_MAKEMASK1(1)
145#define M_DUART_TX_RDY _SB_MAKEMASK1(2)
146#define M_DUART_TX_EMT _SB_MAKEMASK1(3)
147#define M_DUART_OVRUN_ERR _SB_MAKEMASK1(4)
148#define M_DUART_PARITY_ERR _SB_MAKEMASK1(5)
149#define M_DUART_FRM_ERR _SB_MAKEMASK1(6)
150#define M_DUART_RCVD_BRK _SB_MAKEMASK1(7)
151
152/*
153 * DUART Baud Rate Register (Table 10-7)
154 * Register: DUART_CLK_SEL_A
155 * Register: DUART_CLK_SEL_B
156 */
157
158#define M_DUART_CLK_COUNTER _SB_MAKEMASK(12, 0)
159#define V_DUART_BAUD_RATE(x) (100000000/((x)*20)-1)
160
161/*
162 * DUART Data Registers (Table 10-8 and 10-9)
163 * Register: DUART_RX_HOLD_A
164 * Register: DUART_RX_HOLD_B
165 * Register: DUART_TX_HOLD_A
166 * Register: DUART_TX_HOLD_B
167 */
168
169#define M_DUART_RX_DATA _SB_MAKEMASK(8, 0)
170#define M_DUART_TX_DATA _SB_MAKEMASK(8, 0)
171
172/*
173 * DUART Input Port Register (Table 10-10)
174 * Register: DUART_IN_PORT
175 */
176
177#define M_DUART_IN_PIN0_VAL _SB_MAKEMASK1(0)
178#define M_DUART_IN_PIN1_VAL _SB_MAKEMASK1(1)
179#define M_DUART_IN_PIN2_VAL _SB_MAKEMASK1(2)
180#define M_DUART_IN_PIN3_VAL _SB_MAKEMASK1(3)
181#define M_DUART_IN_PIN4_VAL _SB_MAKEMASK1(4)
182#define M_DUART_IN_PIN5_VAL _SB_MAKEMASK1(5)
183#define M_DUART_RIN0_PIN _SB_MAKEMASK1(6)
184#define M_DUART_RIN1_PIN _SB_MAKEMASK1(7)
185
186/*
187 * DUART Input Port Change Status Register (Tables 10-11, 10-12, and 10-13)
188 * Register: DUART_INPORT_CHNG
189 */
190
191#define S_DUART_IN_PIN_VAL 0
192#define M_DUART_IN_PIN_VAL _SB_MAKEMASK(4, S_DUART_IN_PIN_VAL)
193
194#define S_DUART_IN_PIN_CHNG 4
195#define M_DUART_IN_PIN_CHNG _SB_MAKEMASK(4, S_DUART_IN_PIN_CHNG)
196
197
198/*
199 * DUART Output port control register (Table 10-14)
200 * Register: DUART_OPCR
201 */
202
203#define M_DUART_OPCR_RESERVED0 _SB_MAKEMASK1(0) /* must be zero */
204#define M_DUART_OPC2_SEL _SB_MAKEMASK1(1)
205#define M_DUART_OPCR_RESERVED1 _SB_MAKEMASK1(2) /* must be zero */
206#define M_DUART_OPC3_SEL _SB_MAKEMASK1(3)
207#define M_DUART_OPCR_RESERVED2 _SB_MAKEMASK(4, 4) /* must be zero */
208
209/*
210 * DUART Aux Control Register (Table 10-15)
211 * Register: DUART_AUX_CTRL
212 */
213
214#define M_DUART_IP0_CHNG_ENA _SB_MAKEMASK1(0)
215#define M_DUART_IP1_CHNG_ENA _SB_MAKEMASK1(1)
216#define M_DUART_IP2_CHNG_ENA _SB_MAKEMASK1(2)
217#define M_DUART_IP3_CHNG_ENA _SB_MAKEMASK1(3)
218#define M_DUART_ACR_RESERVED _SB_MAKEMASK(4, 4)
219
220#define M_DUART_CTS_CHNG_ENA _SB_MAKEMASK1(0)
221#define M_DUART_CIN_CHNG_ENA _SB_MAKEMASK1(2)
222
223/*
224 * DUART Interrupt Status Register (Table 10-16)
225 * Register: DUART_ISR
226 */
227
228#define M_DUART_ISR_TX_A _SB_MAKEMASK1(0)
229
230#define S_DUART_ISR_RX_A 1
231#define M_DUART_ISR_RX_A _SB_MAKEMASK1(S_DUART_ISR_RX_A)
232#define V_DUART_ISR_RX_A(x) _SB_MAKEVALUE(x, S_DUART_ISR_RX_A)
233#define G_DUART_ISR_RX_A(x) _SB_GETVALUE(x, S_DUART_ISR_RX_A, M_DUART_ISR_RX_A)
234
235#define M_DUART_ISR_BRK_A _SB_MAKEMASK1(2)
236#define M_DUART_ISR_IN_A _SB_MAKEMASK1(3)
237#define M_DUART_ISR_ALL_A _SB_MAKEMASK(4, 0)
238
239#define M_DUART_ISR_TX_B _SB_MAKEMASK1(4)
240#define M_DUART_ISR_RX_B _SB_MAKEMASK1(5)
241#define M_DUART_ISR_BRK_B _SB_MAKEMASK1(6)
242#define M_DUART_ISR_IN_B _SB_MAKEMASK1(7)
243#define M_DUART_ISR_ALL_B _SB_MAKEMASK(4, 4)
244
245/*
246 * DUART Channel A Interrupt Status Register (Table 10-17)
247 * DUART Channel B Interrupt Status Register (Table 10-18)
248 * Register: DUART_ISR_A
249 * Register: DUART_ISR_B
250 */
251
252#define M_DUART_ISR_TX _SB_MAKEMASK1(0)
253#define M_DUART_ISR_RX _SB_MAKEMASK1(1)
254#define M_DUART_ISR_BRK _SB_MAKEMASK1(2)
255#define M_DUART_ISR_IN _SB_MAKEMASK1(3)
256#define M_DUART_ISR_ALL _SB_MAKEMASK(4, 0)
257#define M_DUART_ISR_RESERVED _SB_MAKEMASK(4, 4)
258
259/*
260 * DUART Interrupt Mask Register (Table 10-19)
261 * Register: DUART_IMR
262 */
263
264#define M_DUART_IMR_TX_A _SB_MAKEMASK1(0)
265#define M_DUART_IMR_RX_A _SB_MAKEMASK1(1)
266#define M_DUART_IMR_BRK_A _SB_MAKEMASK1(2)
267#define M_DUART_IMR_IN_A _SB_MAKEMASK1(3)
268#define M_DUART_IMR_ALL_A _SB_MAKEMASK(4, 0)
269
270#define M_DUART_IMR_TX_B _SB_MAKEMASK1(4)
271#define M_DUART_IMR_RX_B _SB_MAKEMASK1(5)
272#define M_DUART_IMR_BRK_B _SB_MAKEMASK1(6)
273#define M_DUART_IMR_IN_B _SB_MAKEMASK1(7)
274#define M_DUART_IMR_ALL_B _SB_MAKEMASK(4, 4)
275
276/*
277 * DUART Channel A Interrupt Mask Register (Table 10-20)
278 * DUART Channel B Interrupt Mask Register (Table 10-21)
279 * Register: DUART_IMR_A
280 * Register: DUART_IMR_B
281 */
282
283#define M_DUART_IMR_TX _SB_MAKEMASK1(0)
284#define M_DUART_IMR_RX _SB_MAKEMASK1(1)
285#define M_DUART_IMR_BRK _SB_MAKEMASK1(2)
286#define M_DUART_IMR_IN _SB_MAKEMASK1(3)
287#define M_DUART_IMR_ALL _SB_MAKEMASK(4, 0)
288#define M_DUART_IMR_RESERVED _SB_MAKEMASK(4, 4)
289
290
291/*
292 * DUART Output Port Set Register (Table 10-22)
293 * Register: DUART_SET_OPR
294 */
295
296#define M_DUART_SET_OPR0 _SB_MAKEMASK1(0)
297#define M_DUART_SET_OPR1 _SB_MAKEMASK1(1)
298#define M_DUART_SET_OPR2 _SB_MAKEMASK1(2)
299#define M_DUART_SET_OPR3 _SB_MAKEMASK1(3)
300#define M_DUART_OPSR_RESERVED _SB_MAKEMASK(4, 4)
301
302/*
303 * DUART Output Port Clear Register (Table 10-23)
304 * Register: DUART_CLEAR_OPR
305 */
306
307#define M_DUART_CLR_OPR0 _SB_MAKEMASK1(0)
308#define M_DUART_CLR_OPR1 _SB_MAKEMASK1(1)
309#define M_DUART_CLR_OPR2 _SB_MAKEMASK1(2)
310#define M_DUART_CLR_OPR3 _SB_MAKEMASK1(3)
311#define M_DUART_OPCR_RESERVED _SB_MAKEMASK(4, 4)
312
313/*
314 * DUART Output Port RTS Register (Table 10-24)
315 * Register: DUART_OUT_PORT
316 */
317
318#define M_DUART_OUT_PIN_SET0 _SB_MAKEMASK1(0)
319#define M_DUART_OUT_PIN_SET1 _SB_MAKEMASK1(1)
320#define M_DUART_OUT_PIN_CLR0 _SB_MAKEMASK1(2)
321#define M_DUART_OUT_PIN_CLR1 _SB_MAKEMASK1(3)
322#define M_DUART_OPRR_RESERVED _SB_MAKEMASK(4, 4)
323
324#define M_DUART_OUT_PIN_SET(chan) \
325 (chan == 0 ? M_DUART_OUT_PIN_SET0 : M_DUART_OUT_PIN_SET1)
326#define M_DUART_OUT_PIN_CLR(chan) \
327 (chan == 0 ? M_DUART_OUT_PIN_CLR0 : M_DUART_OUT_PIN_CLR1)
328
329#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
330/*
331 * Full Interrupt Control Register
332 */
333
334#define S_DUART_SIG_FULL _SB_MAKE64(0)
335#define M_DUART_SIG_FULL _SB_MAKEMASK(4, S_DUART_SIG_FULL)
336#define V_DUART_SIG_FULL(x) _SB_MAKEVALUE(x, S_DUART_SIG_FULL)
337#define G_DUART_SIG_FULL(x) _SB_GETVALUE(x, S_DUART_SIG_FULL, M_DUART_SIG_FULL)
338
339#define S_DUART_INT_TIME _SB_MAKE64(4)
340#define M_DUART_INT_TIME _SB_MAKEMASK(4, S_DUART_INT_TIME)
341#define V_DUART_INT_TIME(x) _SB_MAKEVALUE(x, S_DUART_INT_TIME)
342#define G_DUART_INT_TIME(x) _SB_GETVALUE(x, S_DUART_INT_TIME, M_DUART_INT_TIME)
343#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
344
345
346/* ********************************************************************** */
347
348
349#endif
diff --git a/arch/mips/include/asm/sibyte/sentosa.h b/arch/mips/include/asm/sibyte/sentosa.h
new file mode 100644
index 000000000..a27cda344
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/sentosa.h
@@ -0,0 +1,27 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2000, 2001 Broadcom Corporation
4 */
5#ifndef __ASM_SIBYTE_SENTOSA_H
6#define __ASM_SIBYTE_SENTOSA_H
7
8#include <asm/sibyte/sb1250.h>
9#include <asm/sibyte/sb1250_int.h>
10
11#ifdef CONFIG_SIBYTE_SENTOSA
12#define SIBYTE_BOARD_NAME "BCM91250E (Sentosa)"
13#endif
14#ifdef CONFIG_SIBYTE_RHONE
15#define SIBYTE_BOARD_NAME "BCM91125E (Rhone)"
16#endif
17
18/* Generic bus chip selects */
19#ifdef CONFIG_SIBYTE_RHONE
20#define LEDS_CS 6
21#define LEDS_PHYS 0x1d0a0000
22#endif
23
24/* GPIOs */
25#define K_GPIO_DBG_LED 0
26
27#endif /* __ASM_SIBYTE_SENTOSA_H */
diff --git a/arch/mips/include/asm/sibyte/swarm.h b/arch/mips/include/asm/sibyte/swarm.h
new file mode 100644
index 000000000..947122f48
--- /dev/null
+++ b/arch/mips/include/asm/sibyte/swarm.h
@@ -0,0 +1,51 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
4 */
5#ifndef __ASM_SIBYTE_SWARM_H
6#define __ASM_SIBYTE_SWARM_H
7
8#include <asm/sibyte/sb1250.h>
9#include <asm/sibyte/sb1250_int.h>
10
11#ifdef CONFIG_SIBYTE_SWARM
12#define SIBYTE_BOARD_NAME "BCM91250A (SWARM)"
13#define SIBYTE_HAVE_PCMCIA 1
14#define SIBYTE_HAVE_IDE 1
15#endif
16#ifdef CONFIG_SIBYTE_LITTLESUR
17#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)"
18#define SIBYTE_HAVE_PCMCIA 0
19#define SIBYTE_HAVE_IDE 1
20#define SIBYTE_DEFAULT_CONSOLE "cfe0"
21#endif
22#ifdef CONFIG_SIBYTE_CRHONE
23#define SIBYTE_BOARD_NAME "BCM91125C (CRhone)"
24#define SIBYTE_HAVE_PCMCIA 0
25#define SIBYTE_HAVE_IDE 0
26#endif
27#ifdef CONFIG_SIBYTE_CRHINE
28#define SIBYTE_BOARD_NAME "BCM91120C (CRhine)"
29#define SIBYTE_HAVE_PCMCIA 0
30#define SIBYTE_HAVE_IDE 0
31#endif
32
33/* Generic bus chip selects */
34#define LEDS_CS 3
35#define LEDS_PHYS 0x100a0000
36
37#ifdef SIBYTE_HAVE_IDE
38#define IDE_CS 4
39#define IDE_PHYS 0x100b0000
40#define K_GPIO_GB_IDE 4
41#define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE)
42#endif
43
44#ifdef SIBYTE_HAVE_PCMCIA
45#define PCMCIA_CS 6
46#define PCMCIA_PHYS 0x11000000
47#define K_GPIO_PC_READY 9
48#define K_INT_PC_READY (K_INT_GPIO_0 + K_GPIO_PC_READY)
49#endif
50
51#endif /* __ASM_SIBYTE_SWARM_H */
diff --git a/arch/mips/include/asm/sigcontext.h b/arch/mips/include/asm/sigcontext.h
new file mode 100644
index 000000000..eeeb0f48c
--- /dev/null
+++ b/arch/mips/include/asm/sigcontext.h
@@ -0,0 +1,37 @@
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 <uapi/asm/sigcontext.h>
13
14#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
15
16struct sigcontext32 {
17 __u32 sc_regmask; /* Unused */
18 __u32 sc_status; /* Unused */
19 __u64 sc_pc;
20 __u64 sc_regs[32];
21 __u64 sc_fpregs[32];
22 __u32 sc_acx; /* Only MIPS32; was sc_ownedfp */
23 __u32 sc_fpc_csr;
24 __u32 sc_fpc_eir; /* Unused */
25 __u32 sc_used_math;
26 __u32 sc_dsp; /* dsp status, was sc_ssflags */
27 __u64 sc_mdhi;
28 __u64 sc_mdlo;
29 __u32 sc_hi1; /* Was sc_cause */
30 __u32 sc_lo1; /* Was sc_badvaddr */
31 __u32 sc_hi2; /* Was sc_sigset[4] */
32 __u32 sc_lo2;
33 __u32 sc_hi3;
34 __u32 sc_lo3;
35};
36#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
37#endif /* _ASM_SIGCONTEXT_H */
diff --git a/arch/mips/include/asm/signal.h b/arch/mips/include/asm/signal.h
new file mode 100644
index 000000000..23d6b8015
--- /dev/null
+++ b/arch/mips/include/asm/signal.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) 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 <uapi/asm/signal.h>
13
14#ifdef CONFIG_MIPS32_O32
15extern struct mips_abi mips_abi_32;
16
17#define sig_uses_siginfo(ka, abi) \
18 ((abi != &mips_abi_32) ? 1 : \
19 ((ka)->sa.sa_flags & SA_SIGINFO))
20#else
21#define sig_uses_siginfo(ka, abi) \
22 (IS_ENABLED(CONFIG_64BIT) ? 1 : \
23 (IS_ENABLED(CONFIG_TRAD_SIGNALS) ? \
24 ((ka)->sa.sa_flags & SA_SIGINFO) : 1) )
25#endif
26
27#include <asm/sigcontext.h>
28#include <asm/siginfo.h>
29
30#define __ARCH_HAS_IRIX_SIGACTION
31
32extern int protected_save_fp_context(void __user *sc);
33extern int protected_restore_fp_context(void __user *sc);
34
35#endif /* _ASM_SIGNAL_H */
diff --git a/arch/mips/include/asm/sim.h b/arch/mips/include/asm/sim.h
new file mode 100644
index 000000000..59f31a95f
--- /dev/null
+++ b/arch/mips/include/asm/sim.h
@@ -0,0 +1,70 @@
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
13#include <asm/asm-offsets.h>
14
15#define __str2(x) #x
16#define __str(x) __str2(x)
17
18#ifdef CONFIG_32BIT
19
20#define save_static_function(symbol) \
21__asm__( \
22 ".text\n\t" \
23 ".globl\t__" #symbol "\n\t" \
24 ".align\t2\n\t" \
25 ".type\t__" #symbol ", @function\n\t" \
26 ".ent\t__" #symbol ", 0\n__" \
27 #symbol":\n\t" \
28 ".frame\t$29, 0, $31\n\t" \
29 "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
30 "sw\t$17,"__str(PT_R17)"($29)\n\t" \
31 "sw\t$18,"__str(PT_R18)"($29)\n\t" \
32 "sw\t$19,"__str(PT_R19)"($29)\n\t" \
33 "sw\t$20,"__str(PT_R20)"($29)\n\t" \
34 "sw\t$21,"__str(PT_R21)"($29)\n\t" \
35 "sw\t$22,"__str(PT_R22)"($29)\n\t" \
36 "sw\t$23,"__str(PT_R23)"($29)\n\t" \
37 "sw\t$30,"__str(PT_R30)"($29)\n\t" \
38 "j\t" #symbol "\n\t" \
39 ".end\t__" #symbol "\n\t" \
40 ".size\t__" #symbol",. - __" #symbol)
41
42#endif /* CONFIG_32BIT */
43
44#ifdef CONFIG_64BIT
45
46#define save_static_function(symbol) \
47__asm__( \
48 ".text\n\t" \
49 ".globl\t__" #symbol "\n\t" \
50 ".align\t2\n\t" \
51 ".type\t__" #symbol ", @function\n\t" \
52 ".ent\t__" #symbol ", 0\n__" \
53 #symbol":\n\t" \
54 ".frame\t$29, 0, $31\n\t" \
55 "sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
56 "sd\t$17,"__str(PT_R17)"($29)\n\t" \
57 "sd\t$18,"__str(PT_R18)"($29)\n\t" \
58 "sd\t$19,"__str(PT_R19)"($29)\n\t" \
59 "sd\t$20,"__str(PT_R20)"($29)\n\t" \
60 "sd\t$21,"__str(PT_R21)"($29)\n\t" \
61 "sd\t$22,"__str(PT_R22)"($29)\n\t" \
62 "sd\t$23,"__str(PT_R23)"($29)\n\t" \
63 "sd\t$30,"__str(PT_R30)"($29)\n\t" \
64 "j\t" #symbol "\n\t" \
65 ".end\t__" #symbol "\n\t" \
66 ".size\t__" #symbol",. - __" #symbol)
67
68#endif /* CONFIG_64BIT */
69
70#endif /* _ASM_SIM_H */
diff --git a/arch/mips/include/asm/smp-cps.h b/arch/mips/include/asm/smp-cps.h
new file mode 100644
index 000000000..7e5b9411f
--- /dev/null
+++ b/arch/mips/include/asm/smp-cps.h
@@ -0,0 +1,48 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2013 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_SMP_CPS_H__
8#define __MIPS_ASM_SMP_CPS_H__
9
10#ifndef __ASSEMBLY__
11
12struct vpe_boot_config {
13 unsigned long pc;
14 unsigned long sp;
15 unsigned long gp;
16};
17
18struct core_boot_config {
19 atomic_t vpe_mask;
20 struct vpe_boot_config *vpe_config;
21};
22
23extern struct core_boot_config *mips_cps_core_bootcfg;
24
25extern void mips_cps_core_entry(void);
26extern void mips_cps_core_init(void);
27
28extern void mips_cps_boot_vpes(struct core_boot_config *cfg, unsigned vpe);
29
30extern void mips_cps_pm_save(void);
31extern void mips_cps_pm_restore(void);
32
33#ifdef CONFIG_MIPS_CPS
34
35extern bool mips_cps_smp_in_use(void);
36
37#else /* !CONFIG_MIPS_CPS */
38
39static inline bool mips_cps_smp_in_use(void) { return false; }
40
41#endif /* !CONFIG_MIPS_CPS */
42
43#else /* __ASSEMBLY__ */
44
45.extern mips_cps_bootcfg;
46
47#endif /* __ASSEMBLY__ */
48#endif /* __MIPS_ASM_SMP_CPS_H__ */
diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h
new file mode 100644
index 000000000..65618ff12
--- /dev/null
+++ b/arch/mips/include/asm/smp-ops.h
@@ -0,0 +1,121 @@
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_OPS_H
12#define __ASM_SMP_OPS_H
13
14#include <linux/errno.h>
15
16#include <asm/mips-cps.h>
17
18#ifdef CONFIG_SMP
19
20#include <linux/cpumask.h>
21
22struct task_struct;
23
24struct plat_smp_ops {
25 void (*send_ipi_single)(int cpu, unsigned int action);
26 void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action);
27 void (*init_secondary)(void);
28 void (*smp_finish)(void);
29 int (*boot_secondary)(int cpu, struct task_struct *idle);
30 void (*smp_setup)(void);
31 void (*prepare_cpus)(unsigned int max_cpus);
32 void (*prepare_boot_cpu)(void);
33#ifdef CONFIG_HOTPLUG_CPU
34 int (*cpu_disable)(void);
35 void (*cpu_die)(unsigned int cpu);
36#endif
37#ifdef CONFIG_KEXEC
38 void (*kexec_nonboot_cpu)(void);
39#endif
40};
41
42extern void register_smp_ops(const struct plat_smp_ops *ops);
43
44static inline void plat_smp_setup(void)
45{
46 extern const struct plat_smp_ops *mp_ops; /* private */
47
48 mp_ops->smp_setup();
49}
50
51extern void mips_smp_send_ipi_single(int cpu, unsigned int action);
52extern void mips_smp_send_ipi_mask(const struct cpumask *mask,
53 unsigned int action);
54
55#else /* !CONFIG_SMP */
56
57struct plat_smp_ops;
58
59static inline void plat_smp_setup(void)
60{
61 /* UP, nothing to do ... */
62}
63
64static inline void register_smp_ops(const struct plat_smp_ops *ops)
65{
66}
67
68#endif /* !CONFIG_SMP */
69
70static inline int register_up_smp_ops(void)
71{
72#ifdef CONFIG_SMP_UP
73 extern const struct plat_smp_ops up_smp_ops;
74
75 register_smp_ops(&up_smp_ops);
76
77 return 0;
78#else
79 return -ENODEV;
80#endif
81}
82
83static inline int register_cmp_smp_ops(void)
84{
85#ifdef CONFIG_MIPS_CMP
86 extern const struct plat_smp_ops cmp_smp_ops;
87
88 if (!mips_cm_present())
89 return -ENODEV;
90
91 register_smp_ops(&cmp_smp_ops);
92
93 return 0;
94#else
95 return -ENODEV;
96#endif
97}
98
99static inline int register_vsmp_smp_ops(void)
100{
101#ifdef CONFIG_MIPS_MT_SMP
102 extern const struct plat_smp_ops vsmp_smp_ops;
103
104 register_smp_ops(&vsmp_smp_ops);
105
106 return 0;
107#else
108 return -ENODEV;
109#endif
110}
111
112#ifdef CONFIG_MIPS_CPS
113extern int register_cps_smp_ops(void);
114#else
115static inline int register_cps_smp_ops(void)
116{
117 return -ENODEV;
118}
119#endif
120
121#endif /* __ASM_SMP_OPS_H */
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
new file mode 100644
index 000000000..5d9ff6100
--- /dev/null
+++ b/arch/mips/include/asm/smp.h
@@ -0,0 +1,138 @@
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/bitops.h>
15#include <linux/linkage.h>
16#include <linux/smp.h>
17#include <linux/threads.h>
18#include <linux/cpumask.h>
19
20#include <linux/atomic.h>
21#include <asm/smp-ops.h>
22
23extern int smp_num_siblings;
24extern cpumask_t cpu_sibling_map[];
25extern cpumask_t cpu_core_map[];
26extern cpumask_t cpu_foreign_map[];
27
28static inline int raw_smp_processor_id(void)
29{
30#if defined(__VDSO__)
31 extern int vdso_smp_processor_id(void)
32 __compiletime_error("VDSO should not call smp_processor_id()");
33 return vdso_smp_processor_id();
34#else
35 return current_thread_info()->cpu;
36#endif
37}
38#define raw_smp_processor_id raw_smp_processor_id
39
40/* Map from cpu id to sequential logical cpu number. This will only
41 not be idempotent when cpus failed to come on-line. */
42extern int __cpu_number_map[CONFIG_MIPS_NR_CPU_NR_MAP];
43#define cpu_number_map(cpu) __cpu_number_map[cpu]
44
45/* The reverse map from sequential logical cpu number to cpu id. */
46extern int __cpu_logical_map[NR_CPUS];
47#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
48
49#define NO_PROC_ID (-1)
50
51#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */
52#define SMP_CALL_FUNCTION 0x2
53/* Octeon - Tell another core to flush its icache */
54#define SMP_ICACHE_FLUSH 0x4
55#define SMP_ASK_C0COUNT 0x8
56
57/* Mask of CPUs which are currently definitely operating coherently */
58extern cpumask_t cpu_coherent_mask;
59
60extern asmlinkage void smp_bootstrap(void);
61
62extern void calculate_cpu_foreign_map(void);
63
64/*
65 * this function sends a 'reschedule' IPI to another CPU.
66 * it goes straight through and wastes no time serializing
67 * anything. Worst case is that we lose a reschedule ...
68 */
69static inline void smp_send_reschedule(int cpu)
70{
71 extern const struct plat_smp_ops *mp_ops; /* private */
72
73 mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
74}
75
76#ifdef CONFIG_HOTPLUG_CPU
77static inline int __cpu_disable(void)
78{
79 extern const struct plat_smp_ops *mp_ops; /* private */
80
81 return mp_ops->cpu_disable();
82}
83
84static inline void __cpu_die(unsigned int cpu)
85{
86 extern const struct plat_smp_ops *mp_ops; /* private */
87
88 mp_ops->cpu_die(cpu);
89}
90
91extern void play_dead(void);
92#endif
93
94#ifdef CONFIG_KEXEC
95static inline void kexec_nonboot_cpu(void)
96{
97 extern const struct plat_smp_ops *mp_ops; /* private */
98
99 return mp_ops->kexec_nonboot_cpu();
100}
101
102static inline void *kexec_nonboot_cpu_func(void)
103{
104 extern const struct plat_smp_ops *mp_ops; /* private */
105
106 return mp_ops->kexec_nonboot_cpu;
107}
108#endif
109
110/*
111 * This function will set up the necessary IPIs for Linux to communicate
112 * with the CPUs in mask.
113 * Return 0 on success.
114 */
115int mips_smp_ipi_allocate(const struct cpumask *mask);
116
117/*
118 * This function will free up IPIs allocated with mips_smp_ipi_allocate to the
119 * CPUs in mask, which must be a subset of the IPIs that have been configured.
120 * Return 0 on success.
121 */
122int mips_smp_ipi_free(const struct cpumask *mask);
123
124static inline void arch_send_call_function_single_ipi(int cpu)
125{
126 extern const struct plat_smp_ops *mp_ops; /* private */
127
128 mp_ops->send_ipi_single(cpu, SMP_CALL_FUNCTION);
129}
130
131static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
132{
133 extern const struct plat_smp_ops *mp_ops; /* private */
134
135 mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
136}
137
138#endif /* __ASM_SMP_H */
diff --git a/arch/mips/include/asm/sn/addrs.h b/arch/mips/include/asm/sn/addrs.h
new file mode 100644
index 000000000..837d23e24
--- /dev/null
+++ b/arch/mips/include/asm/sn/addrs.h
@@ -0,0 +1,377 @@
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
13#ifndef __ASSEMBLY__
14#include <linux/smp.h>
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#define UINT64_CAST (unsigned long)
31
32#else /* __ASSEMBLY__ */
33
34#define UINT64_CAST
35
36#endif /* __ASSEMBLY__ */
37
38
39#define NASID_GET_META(_n) ((_n) >> NASID_LOCAL_BITS)
40#ifdef CONFIG_SGI_IP27
41#define NASID_GET_LOCAL(_n) ((_n) & 0xf)
42#endif
43#define NASID_MAKE(_m, _l) (((_m) << NASID_LOCAL_BITS) | (_l))
44
45#define NODE_ADDRSPACE_MASK (NODE_ADDRSPACE_SIZE - 1)
46#define TO_NODE_ADDRSPACE(_pa) (UINT64_CAST (_pa) & NODE_ADDRSPACE_MASK)
47
48#define CHANGE_ADDR_NASID(_pa, _nasid) \
49 ((UINT64_CAST(_pa) & ~NASID_MASK) | \
50 (UINT64_CAST(_nasid) << NASID_SHFT))
51
52
53/*
54 * The following macros are used to index to the beginning of a specific
55 * node's address space.
56 */
57
58#define NODE_OFFSET(_n) (UINT64_CAST (_n) << NODE_SIZE_BITS)
59
60#define NODE_CAC_BASE(_n) (CAC_BASE + NODE_OFFSET(_n))
61#define NODE_HSPEC_BASE(_n) (HSPEC_BASE + NODE_OFFSET(_n))
62#define NODE_IO_BASE(_n) (IO_BASE + NODE_OFFSET(_n))
63#define NODE_MSPEC_BASE(_n) (MSPEC_BASE + NODE_OFFSET(_n))
64#define NODE_UNCAC_BASE(_n) (UNCAC_BASE + NODE_OFFSET(_n))
65
66#define TO_NODE(_n, _x) (NODE_OFFSET(_n) | ((_x) ))
67#define TO_NODE_CAC(_n, _x) (NODE_CAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
68#define TO_NODE_UNCAC(_n, _x) (NODE_UNCAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
69#define TO_NODE_MSPEC(_n, _x) (NODE_MSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
70#define TO_NODE_HSPEC(_n, _x) (NODE_HSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
71
72
73#define RAW_NODE_SWIN_BASE(nasid, widget) \
74 (NODE_IO_BASE(nasid) + (UINT64_CAST(widget) << SWIN_SIZE_BITS))
75
76#define WIDGETID_GET(addr) ((unsigned char)((addr >> SWIN_SIZE_BITS) & 0xff))
77
78/*
79 * The following definitions pertain to the IO special address
80 * space. They define the location of the big and little windows
81 * of any given node.
82 */
83
84#define SWIN_SIZE_BITS 24
85#define SWIN_SIZE (UINT64_CAST 1 << 24)
86#define SWIN_SIZEMASK (SWIN_SIZE - 1)
87#define SWIN_WIDGET_MASK 0xF
88
89/*
90 * Convert smallwindow address to xtalk address.
91 *
92 * 'addr' can be physical or virtual address, but will be converted
93 * to Xtalk address in the range 0 -> SWINZ_SIZEMASK
94 */
95#define SWIN_WIDGETADDR(addr) ((addr) & SWIN_SIZEMASK)
96#define SWIN_WIDGETNUM(addr) (((addr) >> SWIN_SIZE_BITS) & SWIN_WIDGET_MASK)
97/*
98 * Verify if addr belongs to small window address on node with "nasid"
99 *
100 *
101 * NOTE: "addr" is expected to be XKPHYS address, and NOT physical
102 * address
103 *
104 *
105 */
106#define NODE_SWIN_ADDR(nasid, addr) \
107 (((addr) >= NODE_SWIN_BASE(nasid, 0)) && \
108 ((addr) < (NODE_SWIN_BASE(nasid, HUB_NUM_WIDGET) + SWIN_SIZE)\
109 ))
110
111/*
112 * The following define the major position-independent aliases used
113 * in SN.
114 * UALIAS -- 256MB in size, reads in the UALIAS result in
115 * uncached references to the memory of the reader's node.
116 * CPU_UALIAS -- 128kb in size, the bottom part of UALIAS is flipped
117 * depending on which CPU does the access to provide
118 * all CPUs with unique uncached memory at low addresses.
119 * LBOOT -- 256MB in size, reads in the LBOOT area result in
120 * uncached references to the local hub's boot prom and
121 * other directory-bus connected devices.
122 * IALIAS -- 8MB in size, reads in the IALIAS result in uncached
123 * references to the local hub's registers.
124 */
125
126#define UALIAS_BASE HSPEC_BASE
127#define UALIAS_SIZE 0x10000000 /* 256 Megabytes */
128#define UALIAS_LIMIT (UALIAS_BASE + UALIAS_SIZE)
129
130/*
131 * The bottom of ualias space is flipped depending on whether you're
132 * processor 0 or 1 within a node.
133 */
134#ifdef CONFIG_SGI_IP27
135#define UALIAS_FLIP_BASE UALIAS_BASE
136#define UALIAS_FLIP_SIZE 0x20000
137#define UALIAS_FLIP_BIT 0x10000
138#define UALIAS_FLIP_ADDR(_x) (cputoslice(smp_processor_id()) ? \
139 (_x) ^ UALIAS_FLIP_BIT : (_x))
140
141#define LBOOT_BASE (HSPEC_BASE + 0x10000000)
142#define LBOOT_SIZE 0x10000000
143#define LBOOT_LIMIT (LBOOT_BASE + LBOOT_SIZE)
144#define LBOOT_STRIDE 0 /* IP27 has only one CPU PROM */
145
146#endif
147
148#define HUB_REGISTER_WIDGET 1
149#define IALIAS_BASE NODE_SWIN_BASE(0, HUB_REGISTER_WIDGET)
150#define IALIAS_SIZE 0x800000 /* 8 Megabytes */
151#define IS_IALIAS(_a) (((_a) >= IALIAS_BASE) && \
152 ((_a) < (IALIAS_BASE + IALIAS_SIZE)))
153
154/*
155 * Macro for referring to Hub's RBOOT space
156 */
157
158#ifdef CONFIG_SGI_IP27
159#define RBOOT_SIZE 0x10000000 /* 256 Megabytes */
160#define NODE_RBOOT_BASE(_n) (NODE_HSPEC_BASE(_n) + 0x30000000)
161#define NODE_RBOOT_LIMIT(_n) (NODE_RBOOT_BASE(_n) + RBOOT_SIZE)
162
163#endif
164
165/*
166 * Macros for referring the Hub's back door space
167 *
168 * These macros correctly process addresses in any node's space.
169 * WARNING: They won't work in assembler.
170 *
171 * BDDIR_ENTRY_LO returns the address of the low double-word of the dir
172 * entry corresponding to a physical (Cac or Uncac) address.
173 * BDDIR_ENTRY_HI returns the address of the high double-word of the entry.
174 * BDPRT_ENTRY returns the address of the double-word protection entry
175 * corresponding to the page containing the physical address.
176 * BDPRT_ENTRY_S Stores the value into the protection entry.
177 * BDPRT_ENTRY_L Load the value from the protection entry.
178 * BDECC_ENTRY returns the address of the ECC byte corresponding to a
179 * double-word at a specified physical address.
180 * BDECC_ENTRY_H returns the address of the two ECC bytes corresponding to a
181 * quad-word at a specified physical address.
182 */
183#define NODE_BDOOR_BASE(_n) (NODE_HSPEC_BASE(_n) + (NODE_ADDRSPACE_SIZE/2))
184
185#define NODE_BDECC_BASE(_n) (NODE_BDOOR_BASE(_n))
186#define NODE_BDDIR_BASE(_n) (NODE_BDOOR_BASE(_n) + (NODE_ADDRSPACE_SIZE/4))
187#ifdef CONFIG_SGI_IP27
188#define BDDIR_ENTRY_LO(_pa) ((HSPEC_BASE + \
189 NODE_ADDRSPACE_SIZE * 3 / 4 + \
190 0x200) | \
191 UINT64_CAST(_pa) & NASID_MASK | \
192 UINT64_CAST(_pa) >> 2 & BDDIR_UPPER_MASK | \
193 UINT64_CAST(_pa) >> 3 & 0x1f << 4)
194
195#define BDDIR_ENTRY_HI(_pa) ((HSPEC_BASE + \
196 NODE_ADDRSPACE_SIZE * 3 / 4 + \
197 0x208) | \
198 UINT64_CAST(_pa) & NASID_MASK | \
199 UINT64_CAST(_pa) >> 2 & BDDIR_UPPER_MASK | \
200 UINT64_CAST(_pa) >> 3 & 0x1f << 4)
201
202#define BDPRT_ENTRY(_pa, _rgn) ((HSPEC_BASE + \
203 NODE_ADDRSPACE_SIZE * 3 / 4) | \
204 UINT64_CAST(_pa) & NASID_MASK | \
205 UINT64_CAST(_pa) >> 2 & BDDIR_UPPER_MASK | \
206 (_rgn) << 3)
207#define BDPRT_ENTRY_ADDR(_pa, _rgn) (BDPRT_ENTRY((_pa), (_rgn)))
208#define BDPRT_ENTRY_S(_pa, _rgn, _val) (*(__psunsigned_t *)BDPRT_ENTRY((_pa), (_rgn))=(_val))
209#define BDPRT_ENTRY_L(_pa, _rgn) (*(__psunsigned_t *)BDPRT_ENTRY((_pa), (_rgn)))
210
211#define BDECC_ENTRY(_pa) ((HSPEC_BASE + \
212 NODE_ADDRSPACE_SIZE / 2) | \
213 UINT64_CAST(_pa) & NASID_MASK | \
214 UINT64_CAST(_pa) >> 2 & BDECC_UPPER_MASK | \
215 UINT64_CAST(_pa) >> 3 & 3)
216
217/*
218 * Macro to convert a back door directory or protection address into the
219 * raw physical address of the associated cache line or protection page.
220 */
221#define BDADDR_IS_DIR(_ba) ((UINT64_CAST (_ba) & 0x200) != 0)
222#define BDADDR_IS_PRT(_ba) ((UINT64_CAST (_ba) & 0x200) == 0)
223
224#define BDDIR_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
225 (UINT64_CAST(_ba) & BDDIR_UPPER_MASK)<<2 | \
226 (UINT64_CAST(_ba) & 0x1f << 4) << 3)
227
228#define BDPRT_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
229 (UINT64_CAST(_ba) & BDDIR_UPPER_MASK)<<2)
230
231#define BDECC_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
232 (UINT64_CAST(_ba) & BDECC_UPPER_MASK)<<2 | \
233 (UINT64_CAST(_ba) & 3) << 3)
234#endif /* CONFIG_SGI_IP27 */
235
236
237/*
238 * The following macros produce the correct base virtual address for
239 * the hub registers. The LOCAL_HUB_* macros produce the appropriate
240 * address for the local registers. The REMOTE_HUB_* macro produce
241 * the address for the specified hub's registers. The intent is
242 * that the appropriate PI, MD, NI, or II register would be substituted
243 * for _x.
244 */
245
246/*
247 * WARNING:
248 * When certain Hub chip workaround are defined, it's not sufficient
249 * to dereference the *_HUB_ADDR() macros. You should instead use
250 * HUB_L() and HUB_S() if you must deal with pointers to hub registers.
251 * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S().
252 * They're always safe.
253 */
254#define LOCAL_HUB_ADDR(_x) (IALIAS_BASE + (_x))
255#define REMOTE_HUB_ADDR(_n, _x) ((NODE_SWIN_BASE(_n, 1) + 0x800000 + (_x)))
256
257#ifndef __ASSEMBLY__
258
259#define LOCAL_HUB_PTR(_x) ((u64 *)LOCAL_HUB_ADDR((_x)))
260#define REMOTE_HUB_PTR(_n, _x) ((u64 *)REMOTE_HUB_ADDR((_n), (_x)))
261
262#define LOCAL_HUB_L(_r) __raw_readq(LOCAL_HUB_PTR(_r))
263#define LOCAL_HUB_S(_r, _d) __raw_writeq((_d), LOCAL_HUB_PTR(_r))
264#define REMOTE_HUB_L(_n, _r) __raw_readq(REMOTE_HUB_PTR((_n), (_r)))
265#define REMOTE_HUB_S(_n, _r, _d) __raw_writeq((_d), \
266 REMOTE_HUB_PTR((_n), (_r)))
267
268#endif /* !__ASSEMBLY__ */
269
270/*
271 * Software structure locations -- permanently fixed
272 * See diagram in kldir.h
273 */
274
275#define PHYS_RAMBASE 0x0
276#define K0_RAMBASE PHYS_TO_K0(PHYS_RAMBASE)
277
278#define EX_HANDLER_OFFSET(slice) ((slice) << 16)
279#define EX_HANDLER_ADDR(nasid, slice) \
280 PHYS_TO_K0(NODE_OFFSET(nasid) | EX_HANDLER_OFFSET(slice))
281#define EX_HANDLER_SIZE 0x0400
282
283#define EX_FRAME_OFFSET(slice) ((slice) << 16 | 0x400)
284#define EX_FRAME_ADDR(nasid, slice) \
285 PHYS_TO_K0(NODE_OFFSET(nasid) | EX_FRAME_OFFSET(slice))
286#define EX_FRAME_SIZE 0x0c00
287
288#define ARCS_SPB_OFFSET 0x1000
289#define ARCS_SPB_ADDR(nasid) \
290 PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET)
291#define ARCS_SPB_SIZE 0x0400
292
293#define KLDIR_OFFSET 0x2000
294#define KLDIR_ADDR(nasid) \
295 TO_NODE_UNCAC((nasid), KLDIR_OFFSET)
296#define KLDIR_SIZE 0x0400
297
298
299/*
300 * Software structure locations -- indirected through KLDIR
301 * See diagram in kldir.h
302 *
303 * Important: All low memory structures must only be accessed
304 * uncached, except for the symmon stacks.
305 */
306
307#define KLI_LAUNCH 0 /* Dir. entries */
308#define KLI_KLCONFIG 1
309#define KLI_NMI 2
310#define KLI_GDA 3
311#define KLI_FREEMEM 4
312#define KLI_SYMMON_STK 5
313#define KLI_PI_ERROR 6
314#define KLI_KERN_VARS 7
315#define KLI_KERN_XP 8
316#define KLI_KERN_PARTID 9
317
318#ifndef __ASSEMBLY__
319
320#define KLD_BASE(nasid) ((kldir_ent_t *) KLDIR_ADDR(nasid))
321#define KLD_LAUNCH(nasid) (KLD_BASE(nasid) + KLI_LAUNCH)
322#define KLD_NMI(nasid) (KLD_BASE(nasid) + KLI_NMI)
323#define KLD_KLCONFIG(nasid) (KLD_BASE(nasid) + KLI_KLCONFIG)
324#define KLD_PI_ERROR(nasid) (KLD_BASE(nasid) + KLI_PI_ERROR)
325#define KLD_GDA(nasid) (KLD_BASE(nasid) + KLI_GDA)
326#define KLD_SYMMON_STK(nasid) (KLD_BASE(nasid) + KLI_SYMMON_STK)
327#define KLD_FREEMEM(nasid) (KLD_BASE(nasid) + KLI_FREEMEM)
328#define KLD_KERN_VARS(nasid) (KLD_BASE(nasid) + KLI_KERN_VARS)
329#define KLD_KERN_XP(nasid) (KLD_BASE(nasid) + KLI_KERN_XP)
330#define KLD_KERN_PARTID(nasid) (KLD_BASE(nasid) + KLI_KERN_PARTID)
331
332#define LAUNCH_OFFSET(nasid, slice) \
333 (KLD_LAUNCH(nasid)->offset + \
334 KLD_LAUNCH(nasid)->stride * (slice))
335#define LAUNCH_ADDR(nasid, slice) \
336 TO_NODE_UNCAC((nasid), LAUNCH_OFFSET(nasid, slice))
337#define LAUNCH_SIZE(nasid) KLD_LAUNCH(nasid)->size
338
339#define SN_NMI_OFFSET(nasid, slice) \
340 (KLD_NMI(nasid)->offset + \
341 KLD_NMI(nasid)->stride * (slice))
342#define NMI_ADDR(nasid, slice) \
343 TO_NODE_UNCAC((nasid), SN_NMI_OFFSET(nasid, slice))
344#define NMI_SIZE(nasid) KLD_NMI(nasid)->size
345
346#define KLCONFIG_OFFSET(nasid) KLD_KLCONFIG(nasid)->offset
347#define KLCONFIG_ADDR(nasid) \
348 TO_NODE_UNCAC((nasid), KLCONFIG_OFFSET(nasid))
349#define KLCONFIG_SIZE(nasid) KLD_KLCONFIG(nasid)->size
350
351#define GDA_ADDR(nasid) KLD_GDA(nasid)->pointer
352#define GDA_SIZE(nasid) KLD_GDA(nasid)->size
353
354#define SYMMON_STK_OFFSET(nasid, slice) \
355 (KLD_SYMMON_STK(nasid)->offset + \
356 KLD_SYMMON_STK(nasid)->stride * (slice))
357#define SYMMON_STK_STRIDE(nasid) KLD_SYMMON_STK(nasid)->stride
358
359#define SYMMON_STK_ADDR(nasid, slice) \
360 TO_NODE_CAC((nasid), SYMMON_STK_OFFSET(nasid, slice))
361
362#define SYMMON_STK_SIZE(nasid) KLD_SYMMON_STK(nasid)->stride
363
364#define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size)
365
366#define NODE_OFFSET_TO_K0(_nasid, _off) \
367 PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE)
368#define NODE_OFFSET_TO_K1(_nasid, _off) \
369 TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE)
370
371#define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer
372#define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size
373
374#endif /* !__ASSEMBLY__ */
375
376
377#endif /* _ASM_SN_ADDRS_H */
diff --git a/arch/mips/include/asm/sn/agent.h b/arch/mips/include/asm/sn/agent.h
new file mode 100644
index 000000000..7e9b32717
--- /dev/null
+++ b/arch/mips/include/asm/sn/agent.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 * 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 <asm/sn/addrs.h>
15#include <asm/sn/arch.h>
16
17#if defined(CONFIG_SGI_IP27)
18#include <asm/sn/sn0/hub.h>
19#elif defined(CONFIG_SGI_IP35)
20#include <asm/sn/sn1/hub.h>
21#endif /* !CONFIG_SGI_IP27 && !CONFIG_SGI_IP35 */
22
23/*
24 * NIC register macros
25 */
26
27#if defined(CONFIG_SGI_IP27)
28#define HUB_NIC_ADDR(_cpuid) \
29 REMOTE_HUB_ADDR(cpu_to_node(_cpuid), \
30 MD_MLAN_CTL)
31#endif
32
33#define SET_HUB_NIC(_my_cpuid, _val) \
34 (HUB_S(HUB_NIC_ADDR(_my_cpuid), (_val)))
35
36#define SET_MY_HUB_NIC(_v) \
37 SET_HUB_NIC(cpuid(), (_v))
38
39#define GET_HUB_NIC(_my_cpuid) \
40 (HUB_L(HUB_NIC_ADDR(_my_cpuid)))
41
42#define GET_MY_HUB_NIC() \
43 GET_HUB_NIC(cpuid())
44
45#endif /* _ASM_SGI_SN_AGENT_H */
diff --git a/arch/mips/include/asm/sn/arch.h b/arch/mips/include/asm/sn/arch.h
new file mode 100644
index 000000000..9a9682543
--- /dev/null
+++ b/arch/mips/include/asm/sn/arch.h
@@ -0,0 +1,28 @@
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/types.h>
15#include <asm/sn/types.h>
16#ifdef CONFIG_SGI_IP27
17#include <asm/sn/sn0/arch.h>
18#endif
19
20#define cputonasid(cpu) (sn_cpu_info[(cpu)].p_nasid)
21#define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice)
22
23#define INVALID_NASID (nasid_t)-1
24#define INVALID_PNODEID (pnodeid_t)-1
25#define INVALID_MODULE (moduleid_t)-1
26#define INVALID_PARTID (partid_t)-1
27
28#endif /* _ASM_SN_ARCH_H */
diff --git a/arch/mips/include/asm/sn/fru.h b/arch/mips/include/asm/sn/fru.h
new file mode 100644
index 000000000..bbb83257c
--- /dev/null
+++ b/arch/mips/include/asm/sn/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, 2006 Ralf Baechle (ralf@linux-mips)
10 */
11#ifndef __ASM_SN_FRU_H
12#define __ASM_SN_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_FRU_H */
diff --git a/arch/mips/include/asm/sn/gda.h b/arch/mips/include/asm/sn/gda.h
new file mode 100644
index 000000000..d52f81620
--- /dev/null
+++ b/arch/mips/include/asm/sn/gda.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 * 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_NUMNODES]; /* NASID of each node */
64} gda_t;
65
66#define GDA ((gda_t*) GDA_ADDR(get_nasid()))
67
68#endif /* !__ASSEMBLY__ */
69/*
70 * Define: PART_GDA_VERSION
71 * Purpose: Define the minimum version of the GDA required, lower
72 * revisions assume GDA is NOT set up, and read partition
73 * information from the board info.
74 */
75#define PART_GDA_VERSION 2
76
77/*
78 * The following requests can be sent to the PROM during startup.
79 */
80
81#define PROMOP_MAGIC 0x0ead0000
82#define PROMOP_MAGIC_MASK 0x0fff0000
83
84#define PROMOP_BIST_SHIFT 11
85#define PROMOP_BIST_MASK (0x3 << 11)
86
87#define PROMOP_REG PI_ERR_STACK_ADDR_A
88
89#define PROMOP_INVALID (PROMOP_MAGIC | 0x00)
90#define PROMOP_HALT (PROMOP_MAGIC | 0x10)
91#define PROMOP_POWERDOWN (PROMOP_MAGIC | 0x20)
92#define PROMOP_RESTART (PROMOP_MAGIC | 0x30)
93#define PROMOP_REBOOT (PROMOP_MAGIC | 0x40)
94#define PROMOP_IMODE (PROMOP_MAGIC | 0x50)
95
96#define PROMOP_CMD_MASK 0x00f0
97#define PROMOP_OPTIONS_MASK 0xfff0
98
99#define PROMOP_SKIP_DIAGS 0x0100 /* don't bother running diags */
100#define PROMOP_SKIP_MEMINIT 0x0200 /* don't bother initing memory */
101#define PROMOP_SKIP_DEVINIT 0x0400 /* don't bother initing devices */
102#define PROMOP_BIST1 0x0800 /* keep track of which BIST ran */
103#define PROMOP_BIST2 0x1000 /* keep track of which BIST ran */
104
105#endif /* _ASM_SN_GDA_H */
diff --git a/arch/mips/include/asm/sn/intr.h b/arch/mips/include/asm/sn/intr.h
new file mode 100644
index 000000000..3d6954d37
--- /dev/null
+++ b/arch/mips/include/asm/sn/intr.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) 1992 - 1997 Silicon Graphics, Inc.
7 */
8#ifndef __ASM_SN_INTR_H
9#define __ASM_SN_INTR_H
10
11/*
12 * Macros to manipulate the interrupt register on the calling hub chip.
13 */
14
15#define LOCAL_HUB_SEND_INTR(level) \
16 LOCAL_HUB_S(PI_INT_PEND_MOD, (0x100 | (level)))
17#define REMOTE_HUB_SEND_INTR(hub, level) \
18 REMOTE_HUB_S((hub), PI_INT_PEND_MOD, (0x100 | (level)))
19
20/*
21 * When clearing the interrupt, make sure this clear does make it
22 * to the hub. Otherwise we could end up losing interrupts.
23 * We do an uncached load of the int_pend0 register to ensure this.
24 */
25
26#define LOCAL_HUB_CLR_INTR(level) \
27do { \
28 LOCAL_HUB_S(PI_INT_PEND_MOD, (level)); \
29 LOCAL_HUB_L(PI_INT_PEND0); \
30} while (0);
31
32#define REMOTE_HUB_CLR_INTR(hub, level) \
33do { \
34 nasid_t __hub = (hub); \
35 \
36 REMOTE_HUB_S(__hub, PI_INT_PEND_MOD, (level)); \
37 REMOTE_HUB_L(__hub, PI_INT_PEND0); \
38} while (0);
39
40/*
41 * Hard-coded interrupt levels:
42 */
43
44/*
45 * L0 = SW1
46 * L1 = SW2
47 * L2 = INT_PEND0
48 * L3 = INT_PEND1
49 * L4 = RTC
50 * L5 = Profiling Timer
51 * L6 = Hub Errors
52 * L7 = Count/Compare (T5 counters)
53 */
54
55
56/*
57 * INT_PEND0 hard-coded bits.
58 */
59
60/*
61 * INT_PEND0 bits determined by hardware:
62 */
63#define RESERVED_INTR 0 /* What is this bit? */
64#define GFX_INTR_A 1
65#define GFX_INTR_B 2
66#define PG_MIG_INTR 3
67#define UART_INTR 4
68#define CC_PEND_A 5
69#define CC_PEND_B 6
70
71/*
72 * INT_PEND0 used by the kernel for itself ...
73 */
74#define CPU_RESCHED_A_IRQ 7
75#define CPU_RESCHED_B_IRQ 8
76#define CPU_CALL_A_IRQ 9
77#define CPU_CALL_B_IRQ 10
78
79/*
80 * INT_PEND1 hard-coded bits:
81 */
82#define NI_BRDCAST_ERR_A 39
83#define NI_BRDCAST_ERR_B 40
84
85#define LLP_PFAIL_INTR_A 41 /* see ml/SN/SN0/sysctlr.c */
86#define LLP_PFAIL_INTR_B 42
87
88#define TLB_INTR_A 43 /* used for tlb flush random */
89#define TLB_INTR_B 44
90
91#define IP27_INTR_0 45 /* Reserved for PROM use */
92#define IP27_INTR_1 46 /* do not use in Kernel */
93#define IP27_INTR_2 47
94#define IP27_INTR_3 48
95#define IP27_INTR_4 49
96#define IP27_INTR_5 50
97#define IP27_INTR_6 51
98#define IP27_INTR_7 52
99
100#define BRIDGE_ERROR_INTR 53 /* Setup by PROM to catch */
101 /* Bridge Errors */
102#define DEBUG_INTR_A 54
103#define DEBUG_INTR_B 55 /* Used by symmon to stop all cpus */
104#define IO_ERROR_INTR 57 /* Setup by PROM */
105#define CLK_ERR_INTR 58
106#define COR_ERR_INTR_A 59
107#define COR_ERR_INTR_B 60
108#define MD_COR_ERR_INTR 61
109#define NI_ERROR_INTR 62
110#define MSC_PANIC_INTR 63
111
112#endif /* __ASM_SN_INTR_H */
diff --git a/arch/mips/include/asm/sn/io.h b/arch/mips/include/asm/sn/io.h
new file mode 100644
index 000000000..211f1e83b
--- /dev/null
+++ b/arch/mips/include/asm/sn/io.h
@@ -0,0 +1,59 @@
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#if defined(CONFIG_SGI_IP27)
13#include <asm/sn/sn0/hubio.h>
14#endif
15
16
17#define IIO_ITTE_BASE 0x400160 /* base of translation table entries */
18#define IIO_ITTE(bigwin) (IIO_ITTE_BASE + 8*(bigwin))
19
20#define IIO_ITTE_OFFSET_BITS 5 /* size of offset field */
21#define IIO_ITTE_OFFSET_MASK ((1<<IIO_ITTE_OFFSET_BITS)-1)
22#define IIO_ITTE_OFFSET_SHIFT 0
23
24#define IIO_ITTE_WIDGET_BITS 4 /* size of widget field */
25#define IIO_ITTE_WIDGET_MASK ((1<<IIO_ITTE_WIDGET_BITS)-1)
26#define IIO_ITTE_WIDGET_SHIFT 8
27
28#define IIO_ITTE_IOSP 1 /* I/O Space bit */
29#define IIO_ITTE_IOSP_MASK 1
30#define IIO_ITTE_IOSP_SHIFT 12
31#define HUB_PIO_MAP_TO_MEM 0
32#define HUB_PIO_MAP_TO_IO 1
33
34#define IIO_ITTE_INVALID_WIDGET 3 /* an invalid widget */
35
36#define IIO_ITTE_PUT(nasid, bigwin, io_or_mem, widget, addr) \
37 REMOTE_HUB_S((nasid), IIO_ITTE(bigwin), \
38 (((((addr) >> BWIN_SIZE_BITS) & \
39 IIO_ITTE_OFFSET_MASK) << IIO_ITTE_OFFSET_SHIFT) | \
40 (io_or_mem << IIO_ITTE_IOSP_SHIFT) | \
41 (((widget) & IIO_ITTE_WIDGET_MASK) << IIO_ITTE_WIDGET_SHIFT)))
42
43#define IIO_ITTE_DISABLE(nasid, bigwin) \
44 IIO_ITTE_PUT((nasid), HUB_PIO_MAP_TO_MEM, \
45 (bigwin), IIO_ITTE_INVALID_WIDGET, 0)
46
47#define IIO_ITTE_GET(nasid, bigwin) REMOTE_HUB_PTR((nasid), IIO_ITTE(bigwin))
48
49/*
50 * Macro which takes the widget number, and returns the
51 * IO PRB address of that widget.
52 * value _x is expected to be a widget number in the range
53 * 0, 8 - 0xF
54 */
55#define IIO_IOPRB(_x) (IIO_IOPRB_0 + ( ( (_x) < HUB_WIDGET_ID_MIN ? \
56 (_x) : \
57 (_x) - (HUB_WIDGET_ID_MIN-1)) << 3) )
58
59#endif /* _ASM_SN_IO_H */
diff --git a/arch/mips/include/asm/sn/ioc3.h b/arch/mips/include/asm/sn/ioc3.h
new file mode 100644
index 000000000..2c09c17ca
--- /dev/null
+++ b/arch/mips/include/asm/sn/ioc3.h
@@ -0,0 +1,606 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 1999, 2000 Ralf Baechle
4 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
5 */
6#ifndef MIPS_SN_IOC3_H
7#define MIPS_SN_IOC3_H
8
9#include <linux/types.h>
10
11/* serial port register map */
12struct ioc3_serialregs {
13 u32 sscr;
14 u32 stpir;
15 u32 stcir;
16 u32 srpir;
17 u32 srcir;
18 u32 srtr;
19 u32 shadow;
20};
21
22/* SUPERIO uart register map */
23struct ioc3_uartregs {
24 u8 iu_lcr;
25 union {
26 u8 iu_iir; /* read only */
27 u8 iu_fcr; /* write only */
28 };
29 union {
30 u8 iu_ier; /* DLAB == 0 */
31 u8 iu_dlm; /* DLAB == 1 */
32 };
33 union {
34 u8 iu_rbr; /* read only, DLAB == 0 */
35 u8 iu_thr; /* write only, DLAB == 0 */
36 u8 iu_dll; /* DLAB == 1 */
37 };
38 u8 iu_scr;
39 u8 iu_msr;
40 u8 iu_lsr;
41 u8 iu_mcr;
42};
43
44struct ioc3_sioregs {
45 u8 fill[0x141]; /* starts at 0x141 */
46
47 u8 kbdcg;
48 u8 uartc;
49
50 u8 fill0[0x151 - 0x142 - 1];
51
52 u8 pp_dcr;
53 u8 pp_dsr;
54 u8 pp_data;
55
56 u8 fill1[0x159 - 0x153 - 1];
57
58 u8 pp_ecr;
59 u8 pp_cfgb;
60 u8 pp_fifa;
61
62 u8 fill2[0x16a - 0x15b - 1];
63
64 u8 rtcdat;
65 u8 rtcad;
66
67 u8 fill3[0x170 - 0x16b - 1];
68
69 struct ioc3_uartregs uartb; /* 0x20170 */
70 struct ioc3_uartregs uarta; /* 0x20178 */
71};
72
73struct ioc3_ethregs {
74 u32 emcr; /* 0x000f0 */
75 u32 eisr; /* 0x000f4 */
76 u32 eier; /* 0x000f8 */
77 u32 ercsr; /* 0x000fc */
78 u32 erbr_h; /* 0x00100 */
79 u32 erbr_l; /* 0x00104 */
80 u32 erbar; /* 0x00108 */
81 u32 ercir; /* 0x0010c */
82 u32 erpir; /* 0x00110 */
83 u32 ertr; /* 0x00114 */
84 u32 etcsr; /* 0x00118 */
85 u32 ersr; /* 0x0011c */
86 u32 etcdc; /* 0x00120 */
87 u32 ebir; /* 0x00124 */
88 u32 etbr_h; /* 0x00128 */
89 u32 etbr_l; /* 0x0012c */
90 u32 etcir; /* 0x00130 */
91 u32 etpir; /* 0x00134 */
92 u32 emar_h; /* 0x00138 */
93 u32 emar_l; /* 0x0013c */
94 u32 ehar_h; /* 0x00140 */
95 u32 ehar_l; /* 0x00144 */
96 u32 micr; /* 0x00148 */
97 u32 midr_r; /* 0x0014c */
98 u32 midr_w; /* 0x00150 */
99};
100
101struct ioc3_serioregs {
102 u32 km_csr; /* 0x0009c */
103 u32 k_rd; /* 0x000a0 */
104 u32 m_rd; /* 0x000a4 */
105 u32 k_wd; /* 0x000a8 */
106 u32 m_wd; /* 0x000ac */
107};
108
109/* Register layout of IOC3 in configuration space. */
110struct ioc3 {
111 /* PCI Config Space registers */
112 u32 pci_id; /* 0x00000 */
113 u32 pci_scr; /* 0x00004 */
114 u32 pci_rev; /* 0x00008 */
115 u32 pci_lat; /* 0x0000c */
116 u32 pci_addr; /* 0x00010 */
117 u32 pci_err_addr_l; /* 0x00014 */
118 u32 pci_err_addr_h; /* 0x00018 */
119
120 u32 sio_ir; /* 0x0001c */
121 u32 sio_ies; /* 0x00020 */
122 u32 sio_iec; /* 0x00024 */
123 u32 sio_cr; /* 0x00028 */
124 u32 int_out; /* 0x0002c */
125 u32 mcr; /* 0x00030 */
126
127 /* General Purpose I/O registers */
128 u32 gpcr_s; /* 0x00034 */
129 u32 gpcr_c; /* 0x00038 */
130 u32 gpdr; /* 0x0003c */
131 u32 gppr[16]; /* 0x00040 */
132
133 /* Parallel Port Registers */
134 u32 ppbr_h_a; /* 0x00080 */
135 u32 ppbr_l_a; /* 0x00084 */
136 u32 ppcr_a; /* 0x00088 */
137 u32 ppcr; /* 0x0008c */
138 u32 ppbr_h_b; /* 0x00090 */
139 u32 ppbr_l_b; /* 0x00094 */
140 u32 ppcr_b; /* 0x00098 */
141
142 /* Keyboard and Mouse Registers */
143 struct ioc3_serioregs serio;
144
145 /* Serial Port Registers */
146 u32 sbbr_h; /* 0x000b0 */
147 u32 sbbr_l; /* 0x000b4 */
148 struct ioc3_serialregs port_a;
149 struct ioc3_serialregs port_b;
150
151 /* Ethernet Registers */
152 struct ioc3_ethregs eth;
153 u32 pad1[(0x20000 - 0x00154) / 4];
154
155 /* SuperIO Registers XXX */
156 struct ioc3_sioregs sregs; /* 0x20000 */
157 u32 pad2[(0x40000 - 0x20180) / 4];
158
159 /* SSRAM Diagnostic Access */
160 u32 ssram[(0x80000 - 0x40000) / 4];
161
162 /* Bytebus device offsets
163 0x80000 - Access to the generic devices selected with DEV0
164 0x9FFFF bytebus DEV_SEL_0
165 0xA0000 - Access to the generic devices selected with DEV1
166 0xBFFFF bytebus DEV_SEL_1
167 0xC0000 - Access to the generic devices selected with DEV2
168 0xDFFFF bytebus DEV_SEL_2
169 0xE0000 - Access to the generic devices selected with DEV3
170 0xFFFFF bytebus DEV_SEL_3 */
171};
172
173
174#define PCI_LAT 0xc /* Latency Timer */
175#define PCI_SCR_DROP_MODE_EN 0x00008000 /* drop pios on parity err */
176#define UARTA_BASE 0x178
177#define UARTB_BASE 0x170
178
179/*
180 * Bytebus device space
181 */
182#define IOC3_BYTEBUS_DEV0 0x80000L
183#define IOC3_BYTEBUS_DEV1 0xa0000L
184#define IOC3_BYTEBUS_DEV2 0xc0000L
185#define IOC3_BYTEBUS_DEV3 0xe0000L
186
187/*
188 * Ethernet RX Buffer
189 */
190struct ioc3_erxbuf {
191 u32 w0; /* first word (valid,bcnt,cksum) */
192 u32 err; /* second word various errors */
193 /* next comes n bytes of padding */
194 /* then the received ethernet frame itself */
195};
196
197#define ERXBUF_IPCKSUM_MASK 0x0000ffff
198#define ERXBUF_BYTECNT_MASK 0x07ff0000
199#define ERXBUF_BYTECNT_SHIFT 16
200#define ERXBUF_V 0x80000000
201
202#define ERXBUF_CRCERR 0x00000001 /* aka RSV15 */
203#define ERXBUF_FRAMERR 0x00000002 /* aka RSV14 */
204#define ERXBUF_CODERR 0x00000004 /* aka RSV13 */
205#define ERXBUF_INVPREAMB 0x00000008 /* aka RSV18 */
206#define ERXBUF_LOLEN 0x00007000 /* aka RSV2_0 */
207#define ERXBUF_HILEN 0x03ff0000 /* aka RSV12_3 */
208#define ERXBUF_MULTICAST 0x04000000 /* aka RSV16 */
209#define ERXBUF_BROADCAST 0x08000000 /* aka RSV17 */
210#define ERXBUF_LONGEVENT 0x10000000 /* aka RSV19 */
211#define ERXBUF_BADPKT 0x20000000 /* aka RSV20 */
212#define ERXBUF_GOODPKT 0x40000000 /* aka RSV21 */
213#define ERXBUF_CARRIER 0x80000000 /* aka RSV22 */
214
215/*
216 * Ethernet TX Descriptor
217 */
218#define ETXD_DATALEN 104
219struct ioc3_etxd {
220 u32 cmd; /* command field */
221 u32 bufcnt; /* buffer counts field */
222 u64 p1; /* buffer pointer 1 */
223 u64 p2; /* buffer pointer 2 */
224 u8 data[ETXD_DATALEN]; /* opt. tx data */
225};
226
227#define ETXD_BYTECNT_MASK 0x000007ff /* total byte count */
228#define ETXD_INTWHENDONE 0x00001000 /* intr when done */
229#define ETXD_D0V 0x00010000 /* data 0 valid */
230#define ETXD_B1V 0x00020000 /* buf 1 valid */
231#define ETXD_B2V 0x00040000 /* buf 2 valid */
232#define ETXD_DOCHECKSUM 0x00080000 /* insert ip cksum */
233#define ETXD_CHKOFF_MASK 0x07f00000 /* cksum byte offset */
234#define ETXD_CHKOFF_SHIFT 20
235
236#define ETXD_D0CNT_MASK 0x0000007f
237#define ETXD_B1CNT_MASK 0x0007ff00
238#define ETXD_B1CNT_SHIFT 8
239#define ETXD_B2CNT_MASK 0x7ff00000
240#define ETXD_B2CNT_SHIFT 20
241
242/* ------------------------------------------------------------------------- */
243
244/* Superio Registers (PIO Access) */
245#define IOC3_SIO_BASE 0x20000
246#define IOC3_SIO_UARTC (IOC3_SIO_BASE+0x141) /* UART Config */
247#define IOC3_SIO_KBDCG (IOC3_SIO_BASE+0x142) /* KBD Config */
248#define IOC3_SIO_PP_BASE (IOC3_SIO_BASE+PP_BASE) /* Parallel Port */
249#define IOC3_SIO_RTC_BASE (IOC3_SIO_BASE+0x168) /* Real Time Clock */
250#define IOC3_SIO_UB_BASE (IOC3_SIO_BASE+UARTB_BASE) /* UART B */
251#define IOC3_SIO_UA_BASE (IOC3_SIO_BASE+UARTA_BASE) /* UART A */
252
253/* SSRAM Diagnostic Access */
254#define IOC3_SSRAM IOC3_RAM_OFF /* base of SSRAM diagnostic access */
255#define IOC3_SSRAM_LEN 0x40000 /* 256kb (addrspc sz, may not be populated) */
256#define IOC3_SSRAM_DM 0x0000ffff /* data mask */
257#define IOC3_SSRAM_PM 0x00010000 /* parity mask */
258
259/* bitmasks for PCI_SCR */
260#define PCI_SCR_PAR_RESP_EN 0x00000040 /* enb PCI parity checking */
261#define PCI_SCR_SERR_EN 0x00000100 /* enable the SERR# driver */
262#define PCI_SCR_DROP_MODE_EN 0x00008000 /* drop pios on parity err */
263#define PCI_SCR_RX_SERR (0x1 << 16)
264#define PCI_SCR_DROP_MODE (0x1 << 17)
265#define PCI_SCR_SIG_PAR_ERR (0x1 << 24)
266#define PCI_SCR_SIG_TAR_ABRT (0x1 << 27)
267#define PCI_SCR_RX_TAR_ABRT (0x1 << 28)
268#define PCI_SCR_SIG_MST_ABRT (0x1 << 29)
269#define PCI_SCR_SIG_SERR (0x1 << 30)
270#define PCI_SCR_PAR_ERR (0x1 << 31)
271
272/* bitmasks for IOC3_KM_CSR */
273#define KM_CSR_K_WRT_PEND 0x00000001 /* kbd port xmitting or resetting */
274#define KM_CSR_M_WRT_PEND 0x00000002 /* mouse port xmitting or resetting */
275#define KM_CSR_K_LCB 0x00000004 /* Line Cntrl Bit for last KBD write */
276#define KM_CSR_M_LCB 0x00000008 /* same for mouse */
277#define KM_CSR_K_DATA 0x00000010 /* state of kbd data line */
278#define KM_CSR_K_CLK 0x00000020 /* state of kbd clock line */
279#define KM_CSR_K_PULL_DATA 0x00000040 /* pull kbd data line low */
280#define KM_CSR_K_PULL_CLK 0x00000080 /* pull kbd clock line low */
281#define KM_CSR_M_DATA 0x00000100 /* state of ms data line */
282#define KM_CSR_M_CLK 0x00000200 /* state of ms clock line */
283#define KM_CSR_M_PULL_DATA 0x00000400 /* pull ms data line low */
284#define KM_CSR_M_PULL_CLK 0x00000800 /* pull ms clock line low */
285#define KM_CSR_EMM_MODE 0x00001000 /* emulation mode */
286#define KM_CSR_SIM_MODE 0x00002000 /* clock X8 */
287#define KM_CSR_K_SM_IDLE 0x00004000 /* Keyboard is idle */
288#define KM_CSR_M_SM_IDLE 0x00008000 /* Mouse is idle */
289#define KM_CSR_K_TO 0x00010000 /* Keyboard trying to send/receive */
290#define KM_CSR_M_TO 0x00020000 /* Mouse trying to send/receive */
291#define KM_CSR_K_TO_EN 0x00040000 /* KM_CSR_K_TO + KM_CSR_K_TO_EN = cause
292 SIO_IR to assert */
293#define KM_CSR_M_TO_EN 0x00080000 /* KM_CSR_M_TO + KM_CSR_M_TO_EN = cause
294 SIO_IR to assert */
295#define KM_CSR_K_CLAMP_1 0x00100000 /* Pull K_CLK low aft recv 1 char */
296#define KM_CSR_M_CLAMP_1 0x00200000 /* Pull M_CLK low aft recv 1 char */
297#define KM_CSR_K_CLAMP_3 0x00400000 /* Pull K_CLK low aft recv 3 chars */
298#define KM_CSR_M_CLAMP_3 0x00800000 /* Pull M_CLK low aft recv 3 chars */
299
300/* bitmasks for IOC3_K_RD and IOC3_M_RD */
301#define KM_RD_DATA_2 0x000000ff /* 3rd char recvd since last read */
302#define KM_RD_DATA_2_SHIFT 0
303#define KM_RD_DATA_1 0x0000ff00 /* 2nd char recvd since last read */
304#define KM_RD_DATA_1_SHIFT 8
305#define KM_RD_DATA_0 0x00ff0000 /* 1st char recvd since last read */
306#define KM_RD_DATA_0_SHIFT 16
307#define KM_RD_FRAME_ERR_2 0x01000000 /* framing or parity error in byte 2 */
308#define KM_RD_FRAME_ERR_1 0x02000000 /* same for byte 1 */
309#define KM_RD_FRAME_ERR_0 0x04000000 /* same for byte 0 */
310
311#define KM_RD_KBD_MSE 0x08000000 /* 0 if from kbd, 1 if from mouse */
312#define KM_RD_OFLO 0x10000000 /* 4th char recvd before this read */
313#define KM_RD_VALID_2 0x20000000 /* DATA_2 valid */
314#define KM_RD_VALID_1 0x40000000 /* DATA_1 valid */
315#define KM_RD_VALID_0 0x80000000 /* DATA_0 valid */
316#define KM_RD_VALID_ALL (KM_RD_VALID_0|KM_RD_VALID_1|KM_RD_VALID_2)
317
318/* bitmasks for IOC3_K_WD & IOC3_M_WD */
319#define KM_WD_WRT_DATA 0x000000ff /* write to keyboard/mouse port */
320#define KM_WD_WRT_DATA_SHIFT 0
321
322/* bitmasks for serial RX status byte */
323#define RXSB_OVERRUN 0x01 /* char(s) lost */
324#define RXSB_PAR_ERR 0x02 /* parity error */
325#define RXSB_FRAME_ERR 0x04 /* framing error */
326#define RXSB_BREAK 0x08 /* break character */
327#define RXSB_CTS 0x10 /* state of CTS */
328#define RXSB_DCD 0x20 /* state of DCD */
329#define RXSB_MODEM_VALID 0x40 /* DCD, CTS and OVERRUN are valid */
330#define RXSB_DATA_VALID 0x80 /* data byte, FRAME_ERR PAR_ERR & BREAK valid */
331
332/* bitmasks for serial TX control byte */
333#define TXCB_INT_WHEN_DONE 0x20 /* interrupt after this byte is sent */
334#define TXCB_INVALID 0x00 /* byte is invalid */
335#define TXCB_VALID 0x40 /* byte is valid */
336#define TXCB_MCR 0x80 /* data<7:0> to modem control register */
337#define TXCB_DELAY 0xc0 /* delay data<7:0> mSec */
338
339/* bitmasks for IOC3_SBBR_L */
340#define SBBR_L_SIZE 0x00000001 /* 0 == 1KB rings, 1 == 4KB rings */
341#define SBBR_L_BASE 0xfffff000 /* lower serial ring base addr */
342
343/* bitmasks for IOC3_SSCR_<A:B> */
344#define SSCR_RX_THRESHOLD 0x000001ff /* hiwater mark */
345#define SSCR_TX_TIMER_BUSY 0x00010000 /* TX timer in progress */
346#define SSCR_HFC_EN 0x00020000 /* hardware flow control enabled */
347#define SSCR_RX_RING_DCD 0x00040000 /* post RX record on delta-DCD */
348#define SSCR_RX_RING_CTS 0x00080000 /* post RX record on delta-CTS */
349#define SSCR_HIGH_SPD 0x00100000 /* 4X speed */
350#define SSCR_DIAG 0x00200000 /* bypass clock divider for sim */
351#define SSCR_RX_DRAIN 0x08000000 /* drain RX buffer to memory */
352#define SSCR_DMA_EN 0x10000000 /* enable ring buffer DMA */
353#define SSCR_DMA_PAUSE 0x20000000 /* pause DMA */
354#define SSCR_PAUSE_STATE 0x40000000 /* sets when PAUSE takes effect */
355#define SSCR_RESET 0x80000000 /* reset DMA channels */
356
357/* all producer/consumer pointers are the same bitfield */
358#define PROD_CONS_PTR_4K 0x00000ff8 /* for 4K buffers */
359#define PROD_CONS_PTR_1K 0x000003f8 /* for 1K buffers */
360#define PROD_CONS_PTR_OFF 3
361
362/* bitmasks for IOC3_SRCIR_<A:B> */
363#define SRCIR_ARM 0x80000000 /* arm RX timer */
364
365/* bitmasks for IOC3_SRPIR_<A:B> */
366#define SRPIR_BYTE_CNT 0x07000000 /* bytes in packer */
367#define SRPIR_BYTE_CNT_SHIFT 24
368
369/* bitmasks for IOC3_STCIR_<A:B> */
370#define STCIR_BYTE_CNT 0x0f000000 /* bytes in unpacker */
371#define STCIR_BYTE_CNT_SHIFT 24
372
373/* bitmasks for IOC3_SHADOW_<A:B> */
374#define SHADOW_DR 0x00000001 /* data ready */
375#define SHADOW_OE 0x00000002 /* overrun error */
376#define SHADOW_PE 0x00000004 /* parity error */
377#define SHADOW_FE 0x00000008 /* framing error */
378#define SHADOW_BI 0x00000010 /* break interrupt */
379#define SHADOW_THRE 0x00000020 /* transmit holding register empty */
380#define SHADOW_TEMT 0x00000040 /* transmit shift register empty */
381#define SHADOW_RFCE 0x00000080 /* char in RX fifo has an error */
382#define SHADOW_DCTS 0x00010000 /* delta clear to send */
383#define SHADOW_DDCD 0x00080000 /* delta data carrier detect */
384#define SHADOW_CTS 0x00100000 /* clear to send */
385#define SHADOW_DCD 0x00800000 /* data carrier detect */
386#define SHADOW_DTR 0x01000000 /* data terminal ready */
387#define SHADOW_RTS 0x02000000 /* request to send */
388#define SHADOW_OUT1 0x04000000 /* 16550 OUT1 bit */
389#define SHADOW_OUT2 0x08000000 /* 16550 OUT2 bit */
390#define SHADOW_LOOP 0x10000000 /* loopback enabled */
391
392/* bitmasks for IOC3_SRTR_<A:B> */
393#define SRTR_CNT 0x00000fff /* reload value for RX timer */
394#define SRTR_CNT_VAL 0x0fff0000 /* current value of RX timer */
395#define SRTR_CNT_VAL_SHIFT 16
396#define SRTR_HZ 16000 /* SRTR clock frequency */
397
398/* bitmasks for IOC3_SIO_IR, IOC3_SIO_IEC and IOC3_SIO_IES */
399#define SIO_IR_SA_TX_MT 0x00000001 /* Serial port A TX empty */
400#define SIO_IR_SA_RX_FULL 0x00000002 /* port A RX buf full */
401#define SIO_IR_SA_RX_HIGH 0x00000004 /* port A RX hiwat */
402#define SIO_IR_SA_RX_TIMER 0x00000008 /* port A RX timeout */
403#define SIO_IR_SA_DELTA_DCD 0x00000010 /* port A delta DCD */
404#define SIO_IR_SA_DELTA_CTS 0x00000020 /* port A delta CTS */
405#define SIO_IR_SA_INT 0x00000040 /* port A pass-thru intr */
406#define SIO_IR_SA_TX_EXPLICIT 0x00000080 /* port A explicit TX thru */
407#define SIO_IR_SA_MEMERR 0x00000100 /* port A PCI error */
408#define SIO_IR_SB_TX_MT 0x00000200 /* */
409#define SIO_IR_SB_RX_FULL 0x00000400 /* */
410#define SIO_IR_SB_RX_HIGH 0x00000800 /* */
411#define SIO_IR_SB_RX_TIMER 0x00001000 /* */
412#define SIO_IR_SB_DELTA_DCD 0x00002000 /* */
413#define SIO_IR_SB_DELTA_CTS 0x00004000 /* */
414#define SIO_IR_SB_INT 0x00008000 /* */
415#define SIO_IR_SB_TX_EXPLICIT 0x00010000 /* */
416#define SIO_IR_SB_MEMERR 0x00020000 /* */
417#define SIO_IR_PP_INT 0x00040000 /* P port pass-thru intr */
418#define SIO_IR_PP_INTA 0x00080000 /* PP context A thru */
419#define SIO_IR_PP_INTB 0x00100000 /* PP context B thru */
420#define SIO_IR_PP_MEMERR 0x00200000 /* PP PCI error */
421#define SIO_IR_KBD_INT 0x00400000 /* kbd/mouse intr */
422#define SIO_IR_RT_INT 0x08000000 /* RT output pulse */
423#define SIO_IR_GEN_INT1 0x10000000 /* RT input pulse */
424#define SIO_IR_GEN_INT_SHIFT 28
425
426/* per device interrupt masks */
427#define SIO_IR_SA (SIO_IR_SA_TX_MT | SIO_IR_SA_RX_FULL | \
428 SIO_IR_SA_RX_HIGH | SIO_IR_SA_RX_TIMER | \
429 SIO_IR_SA_DELTA_DCD | SIO_IR_SA_DELTA_CTS | \
430 SIO_IR_SA_INT | SIO_IR_SA_TX_EXPLICIT | \
431 SIO_IR_SA_MEMERR)
432#define SIO_IR_SB (SIO_IR_SB_TX_MT | SIO_IR_SB_RX_FULL | \
433 SIO_IR_SB_RX_HIGH | SIO_IR_SB_RX_TIMER | \
434 SIO_IR_SB_DELTA_DCD | SIO_IR_SB_DELTA_CTS | \
435 SIO_IR_SB_INT | SIO_IR_SB_TX_EXPLICIT | \
436 SIO_IR_SB_MEMERR)
437#define SIO_IR_PP (SIO_IR_PP_INT | SIO_IR_PP_INTA | \
438 SIO_IR_PP_INTB | SIO_IR_PP_MEMERR)
439#define SIO_IR_RT (SIO_IR_RT_INT | SIO_IR_GEN_INT1)
440
441/* bitmasks for SIO_CR */
442#define SIO_CR_SIO_RESET 0x00000001 /* reset the SIO */
443#define SIO_CR_SER_A_BASE 0x000000fe /* DMA poll addr port A */
444#define SIO_CR_SER_A_BASE_SHIFT 1
445#define SIO_CR_SER_B_BASE 0x00007f00 /* DMA poll addr port B */
446#define SIO_CR_SER_B_BASE_SHIFT 8
447#define SIO_SR_CMD_PULSE 0x00078000 /* byte bus strobe length */
448#define SIO_CR_CMD_PULSE_SHIFT 15
449#define SIO_CR_ARB_DIAG 0x00380000 /* cur !enet PCI requet (ro) */
450#define SIO_CR_ARB_DIAG_TXA 0x00000000
451#define SIO_CR_ARB_DIAG_RXA 0x00080000
452#define SIO_CR_ARB_DIAG_TXB 0x00100000
453#define SIO_CR_ARB_DIAG_RXB 0x00180000
454#define SIO_CR_ARB_DIAG_PP 0x00200000
455#define SIO_CR_ARB_DIAG_IDLE 0x00400000 /* 0 -> active request (ro) */
456
457/* bitmasks for INT_OUT */
458#define INT_OUT_COUNT 0x0000ffff /* pulse interval timer */
459#define INT_OUT_MODE 0x00070000 /* mode mask */
460#define INT_OUT_MODE_0 0x00000000 /* set output to 0 */
461#define INT_OUT_MODE_1 0x00040000 /* set output to 1 */
462#define INT_OUT_MODE_1PULSE 0x00050000 /* send 1 pulse */
463#define INT_OUT_MODE_PULSES 0x00060000 /* send 1 pulse every interval */
464#define INT_OUT_MODE_SQW 0x00070000 /* toggle output every interval */
465#define INT_OUT_DIAG 0x40000000 /* diag mode */
466#define INT_OUT_INT_OUT 0x80000000 /* current state of INT_OUT */
467
468/* time constants for INT_OUT */
469#define INT_OUT_NS_PER_TICK (30 * 260) /* 30 ns PCI clock, divisor=260 */
470#define INT_OUT_TICKS_PER_PULSE 3 /* outgoing pulse lasts 3 ticks */
471#define INT_OUT_US_TO_COUNT(x) /* convert uS to a count value */ \
472 (((x) * 10 + INT_OUT_NS_PER_TICK / 200) * \
473 100 / INT_OUT_NS_PER_TICK - 1)
474#define INT_OUT_COUNT_TO_US(x) /* convert count value to uS */ \
475 (((x) + 1) * INT_OUT_NS_PER_TICK / 1000)
476#define INT_OUT_MIN_TICKS 3 /* min period is width of pulse in "ticks" */
477#define INT_OUT_MAX_TICKS INT_OUT_COUNT /* largest possible count */
478
479/* bitmasks for GPCR */
480#define GPCR_DIR 0x000000ff /* tristate pin input or output */
481#define GPCR_DIR_PIN(x) (1<<(x)) /* access one of the DIR bits */
482#define GPCR_EDGE 0x000f0000 /* extint edge or level sensitive */
483#define GPCR_EDGE_PIN(x) (1<<((x)+15)) /* access one of the EDGE bits */
484
485/* values for GPCR */
486#define GPCR_INT_OUT_EN 0x00100000 /* enable INT_OUT to pin 0 */
487#define GPCR_MLAN_EN 0x00200000 /* enable MCR to pin 8 */
488#define GPCR_DIR_SERA_XCVR 0x00000080 /* Port A Transceiver select enable */
489#define GPCR_DIR_SERB_XCVR 0x00000040 /* Port B Transceiver select enable */
490#define GPCR_DIR_PHY_RST 0x00000020 /* ethernet PHY reset enable */
491
492/* defs for some of the generic I/O pins */
493#define GPCR_PHY_RESET 0x20 /* pin is output to PHY reset */
494#define GPCR_UARTB_MODESEL 0x40 /* pin is output to port B mode sel */
495#define GPCR_UARTA_MODESEL 0x80 /* pin is output to port A mode sel */
496
497#define GPPR_PHY_RESET_PIN 5 /* GIO pin cntrlling phy reset */
498#define GPPR_UARTB_MODESEL_PIN 6 /* GIO pin cntrlling uart b mode sel */
499#define GPPR_UARTA_MODESEL_PIN 7 /* GIO pin cntrlling uart a mode sel */
500
501/* ethernet */
502#define EMCR_DUPLEX 0x00000001
503#define EMCR_PROMISC 0x00000002
504#define EMCR_PADEN 0x00000004
505#define EMCR_RXOFF_MASK 0x000001f8
506#define EMCR_RXOFF_SHIFT 3
507#define EMCR_RAMPAR 0x00000200
508#define EMCR_BADPAR 0x00000800
509#define EMCR_BUFSIZ 0x00001000
510#define EMCR_TXDMAEN 0x00002000
511#define EMCR_TXEN 0x00004000
512#define EMCR_RXDMAEN 0x00008000
513#define EMCR_RXEN 0x00010000
514#define EMCR_LOOPBACK 0x00020000
515#define EMCR_ARB_DIAG 0x001c0000
516#define EMCR_ARB_DIAG_IDLE 0x00200000
517#define EMCR_RST 0x80000000
518
519#define EISR_RXTIMERINT 0x00000001
520#define EISR_RXTHRESHINT 0x00000002
521#define EISR_RXOFLO 0x00000004
522#define EISR_RXBUFOFLO 0x00000008
523#define EISR_RXMEMERR 0x00000010
524#define EISR_RXPARERR 0x00000020
525#define EISR_TXEMPTY 0x00010000
526#define EISR_TXRTRY 0x00020000
527#define EISR_TXEXDEF 0x00040000
528#define EISR_TXLCOL 0x00080000
529#define EISR_TXGIANT 0x00100000
530#define EISR_TXBUFUFLO 0x00200000
531#define EISR_TXEXPLICIT 0x00400000
532#define EISR_TXCOLLWRAP 0x00800000
533#define EISR_TXDEFERWRAP 0x01000000
534#define EISR_TXMEMERR 0x02000000
535#define EISR_TXPARERR 0x04000000
536
537#define ERCSR_THRESH_MASK 0x000001ff /* enet RX threshold */
538#define ERCSR_RX_TMR 0x40000000 /* simulation only */
539#define ERCSR_DIAG_OFLO 0x80000000 /* simulation only */
540
541#define ERBR_ALIGNMENT 4096
542#define ERBR_L_RXRINGBASE_MASK 0xfffff000
543
544#define ERBAR_BARRIER_BIT 0x0100
545#define ERBAR_RXBARR_MASK 0xffff0000
546#define ERBAR_RXBARR_SHIFT 16
547
548#define ERCIR_RXCONSUME_MASK 0x00000fff
549
550#define ERPIR_RXPRODUCE_MASK 0x00000fff
551#define ERPIR_ARM 0x80000000
552
553#define ERTR_CNT_MASK 0x000007ff
554
555#define ETCSR_IPGT_MASK 0x0000007f
556#define ETCSR_IPGR1_MASK 0x00007f00
557#define ETCSR_IPGR1_SHIFT 8
558#define ETCSR_IPGR2_MASK 0x007f0000
559#define ETCSR_IPGR2_SHIFT 16
560#define ETCSR_NOTXCLK 0x80000000
561
562#define ETCDC_COLLCNT_MASK 0x0000ffff
563#define ETCDC_DEFERCNT_MASK 0xffff0000
564#define ETCDC_DEFERCNT_SHIFT 16
565
566#define ETBR_ALIGNMENT (64*1024)
567#define ETBR_L_RINGSZ_MASK 0x00000001
568#define ETBR_L_RINGSZ128 0
569#define ETBR_L_RINGSZ512 1
570#define ETBR_L_TXRINGBASE_MASK 0xffffc000
571
572#define ETCIR_TXCONSUME_MASK 0x0000ffff
573#define ETCIR_IDLE 0x80000000
574
575#define ETPIR_TXPRODUCE_MASK 0x0000ffff
576
577#define EBIR_TXBUFPROD_MASK 0x0000001f
578#define EBIR_TXBUFCONS_MASK 0x00001f00
579#define EBIR_TXBUFCONS_SHIFT 8
580#define EBIR_RXBUFPROD_MASK 0x007fc000
581#define EBIR_RXBUFPROD_SHIFT 14
582#define EBIR_RXBUFCONS_MASK 0xff800000
583#define EBIR_RXBUFCONS_SHIFT 23
584
585#define MICR_REGADDR_MASK 0x0000001f
586#define MICR_PHYADDR_MASK 0x000003e0
587#define MICR_PHYADDR_SHIFT 5
588#define MICR_READTRIG 0x00000400
589#define MICR_BUSY 0x00000800
590
591#define MIDR_DATA_MASK 0x0000ffff
592
593/* subsystem IDs supplied by card detection in pci-xtalk-bridge */
594#define IOC3_SUBSYS_IP27_BASEIO6G 0xc300
595#define IOC3_SUBSYS_IP27_MIO 0xc301
596#define IOC3_SUBSYS_IP27_BASEIO 0xc302
597#define IOC3_SUBSYS_IP29_SYSBOARD 0xc303
598#define IOC3_SUBSYS_IP30_SYSBOARD 0xc304
599#define IOC3_SUBSYS_MENET 0xc305
600#define IOC3_SUBSYS_MENET4 0xc306
601#define IOC3_SUBSYS_IO7 0xc307
602#define IOC3_SUBSYS_IO8 0xc308
603#define IOC3_SUBSYS_IO9 0xc309
604#define IOC3_SUBSYS_IP34_SYSBOARD 0xc30A
605
606#endif /* MIPS_SN_IOC3_H */
diff --git a/arch/mips/include/asm/sn/irq_alloc.h b/arch/mips/include/asm/sn/irq_alloc.h
new file mode 100644
index 000000000..09b89cecf
--- /dev/null
+++ b/arch/mips/include/asm/sn/irq_alloc.h
@@ -0,0 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_SN_IRQ_ALLOC_H
3#define __ASM_SN_IRQ_ALLOC_H
4
5struct irq_alloc_info {
6 void *ctrl;
7 nasid_t nasid;
8 int pin;
9};
10
11#endif /* __ASM_SN_IRQ_ALLOC_H */
diff --git a/arch/mips/include/asm/sn/klconfig.h b/arch/mips/include/asm/sn/klconfig.h
new file mode 100644
index 000000000..117f85e4b
--- /dev/null
+++ b/arch/mips/include/asm/sn/klconfig.h
@@ -0,0 +1,894 @@
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/types.h>
31#include <asm/sn/types.h>
32
33#if defined(CONFIG_SGI_IP27)
34
35#include <asm/sn/sn0/addrs.h>
36//#include <sys/SN/router.h>
37// XXX Stolen from <sys/SN/router.h>:
38#define MAX_ROUTER_PORTS (6) /* Max. number of ports on a router */
39#include <asm/sn/fru.h>
40//#include <sys/graph.h>
41//#include <sys/xtalk/xbow.h>
42
43#elif defined(CONFIG_SGI_IP35)
44
45#include <asm/sn/sn1/addrs.h>
46#include <sys/sn/router.h>
47#include <sys/graph.h>
48#include <asm/xtalk/xbow.h>
49
50#endif /* !CONFIG_SGI_IP27 && !CONFIG_SGI_IP35 */
51
52#if defined(CONFIG_SGI_IP27) || defined(CONFIG_SGI_IP35)
53#include <asm/sn/agent.h>
54#include <asm/fw/arc/types.h>
55#include <asm/fw/arc/hinv.h>
56#if defined(CONFIG_SGI_IP35)
57// The hack file has to be before vector and after sn0_fru....
58#include <asm/hack.h>
59#include <asm/sn/vector.h>
60#include <asm/xtalk/xtalk.h>
61#endif /* CONFIG_SGI_IP35 */
62#endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */
63
64typedef u64 nic_t;
65
66#define KLCFGINFO_MAGIC 0xbeedbabe
67
68typedef s32 klconf_off_t;
69
70/*
71 * Some IMPORTANT OFFSETS. These are the offsets on all NODES.
72 */
73#define MAX_MODULE_ID 255
74#define SIZE_PAD 4096 /* 4k padding for structures */
75/*
76 * 1 NODE brd, 2 Router brd (1 8p, 1 meta), 6 Widgets,
77 * 2 Midplanes assuming no pci card cages
78 */
79#define MAX_SLOTS_PER_NODE (1 + 2 + 6 + 2)
80
81/* XXX if each node is guaranteed to have some memory */
82
83#define MAX_PCI_DEVS 8
84
85/* lboard_t->brd_flags fields */
86/* All bits in this field are currently used. Try the pad fields if
87 you need more flag bits */
88
89#define ENABLE_BOARD 0x01
90#define FAILED_BOARD 0x02
91#define DUPLICATE_BOARD 0x04 /* Boards like midplanes/routers which
92 are discovered twice. Use one of them */
93#define VISITED_BOARD 0x08 /* Used for compact hub numbering. */
94#define LOCAL_MASTER_IO6 0x10 /* master io6 for that node */
95#define GLOBAL_MASTER_IO6 0x20
96#define THIRD_NIC_PRESENT 0x40 /* for future use */
97#define SECOND_NIC_PRESENT 0x80 /* addons like MIO are present */
98
99/* klinfo->flags fields */
100
101#define KLINFO_ENABLE 0x01 /* This component is enabled */
102#define KLINFO_FAILED 0x02 /* This component failed */
103#define KLINFO_DEVICE 0x04 /* This component is a device */
104#define KLINFO_VISITED 0x08 /* This component has been visited */
105#define KLINFO_CONTROLLER 0x10 /* This component is a device controller */
106#define KLINFO_INSTALL 0x20 /* Install a driver */
107#define KLINFO_HEADLESS 0x40 /* Headless (or hubless) component */
108#define IS_CONSOLE_IOC3(i) ((((klinfo_t *)i)->flags) & KLINFO_INSTALL)
109
110#define GB2 0x80000000
111
112#define MAX_RSV_PTRS 32
113
114/* Structures to manage various data storage areas */
115/* The numbers must be contiguous since the array index i
116 is used in the code to allocate various areas.
117*/
118
119#define BOARD_STRUCT 0
120#define COMPONENT_STRUCT 1
121#define ERRINFO_STRUCT 2
122#define KLMALLOC_TYPE_MAX (ERRINFO_STRUCT + 1)
123#define DEVICE_STRUCT 3
124
125
126typedef struct console_s {
127 unsigned long uart_base;
128 unsigned long config_base;
129 unsigned long memory_base;
130 short baud;
131 short flag;
132 int type;
133 nasid_t nasid;
134 char wid;
135 char npci;
136 nic_t baseio_nic;
137} console_t;
138
139typedef struct klc_malloc_hdr {
140 klconf_off_t km_base;
141 klconf_off_t km_limit;
142 klconf_off_t km_current;
143} klc_malloc_hdr_t;
144
145/* Functions/macros needed to use this structure */
146
147typedef struct kl_config_hdr {
148 u64 ch_magic; /* set this to KLCFGINFO_MAGIC */
149 u32 ch_version; /* structure version number */
150 klconf_off_t ch_malloc_hdr_off; /* offset of ch_malloc_hdr */
151 klconf_off_t ch_cons_off; /* offset of ch_cons */
152 klconf_off_t ch_board_info; /* the link list of boards */
153 console_t ch_cons_info; /* address info of the console */
154 klc_malloc_hdr_t ch_malloc_hdr[KLMALLOC_TYPE_MAX];
155 confidence_t ch_sw_belief; /* confidence that software is bad*/
156 confidence_t ch_sn0net_belief; /* confidence that sn0net is bad */
157} kl_config_hdr_t;
158
159
160#define KL_CONFIG_HDR(_nasid) ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid)))
161#define KL_CONFIG_INFO_OFFSET(_nasid) \
162 (KL_CONFIG_HDR(_nasid)->ch_board_info)
163#define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off) \
164 (KL_CONFIG_HDR(_nasid)->ch_board_info = (_off))
165
166#define KL_CONFIG_INFO(_nasid) \
167 (lboard_t *)((KL_CONFIG_HDR(_nasid)->ch_board_info) ? \
168 NODE_OFFSET_TO_K1((_nasid), KL_CONFIG_HDR(_nasid)->ch_board_info) : \
169 0)
170#define KL_CONFIG_MAGIC(_nasid) (KL_CONFIG_HDR(_nasid)->ch_magic)
171
172#define KL_CONFIG_CHECK_MAGIC(_nasid) \
173 (KL_CONFIG_HDR(_nasid)->ch_magic == KLCFGINFO_MAGIC)
174
175#define KL_CONFIG_HDR_INIT_MAGIC(_nasid) \
176 (KL_CONFIG_HDR(_nasid)->ch_magic = KLCFGINFO_MAGIC)
177
178/* --- New Macros for the changed kl_config_hdr_t structure --- */
179
180#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
181 ((unsigned long)_k + (_k->ch_malloc_hdr_off)))
182
183#define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
184
185#define PTR_CH_CONS_INFO(_k) ((console_t *)\
186 ((unsigned long)_k + (_k->ch_cons_off)))
187
188#define KL_CONFIG_CH_CONS_INFO(_n) PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))
189
190/* ------------------------------------------------------------- */
191
192#define KL_CONFIG_INFO_START(_nasid) \
193 (klconf_off_t)(KLCONFIG_OFFSET(_nasid) + sizeof(kl_config_hdr_t))
194
195#define KL_CONFIG_BOARD_NASID(_brd) ((_brd)->brd_nasid)
196#define KL_CONFIG_BOARD_SET_NEXT(_brd, _off) ((_brd)->brd_next = (_off))
197
198#define KL_CONFIG_DUPLICATE_BOARD(_brd) ((_brd)->brd_flags & DUPLICATE_BOARD)
199
200#define XBOW_PORT_TYPE_HUB(_xbowp, _link) \
201 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_HUB)
202#define XBOW_PORT_TYPE_IO(_xbowp, _link) \
203 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_IO)
204
205#define XBOW_PORT_IS_ENABLED(_xbowp, _link) \
206 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_ENABLE)
207#define XBOW_PORT_NASID(_xbowp, _link) \
208 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_nasid)
209
210#define XBOW_PORT_IO 0x1
211#define XBOW_PORT_HUB 0x2
212#define XBOW_PORT_ENABLE 0x4
213
214#define SN0_PORT_FENCE_SHFT 0
215#define SN0_PORT_FENCE_MASK (1 << SN0_PORT_FENCE_SHFT)
216
217/*
218 * The KLCONFIG area is organized as a LINKED LIST of BOARDs. A BOARD
219 * can be either 'LOCAL' or 'REMOTE'. LOCAL means it is attached to
220 * the LOCAL/current NODE. REMOTE means it is attached to a different
221 * node.(TBD - Need a way to treat ROUTER boards.)
222 *
223 * There are 2 different structures to represent these boards -
224 * lboard - Local board, rboard - remote board. These 2 structures
225 * can be arbitrarily mixed in the LINKED LIST of BOARDs. (Refer
226 * Figure below). The first byte of the rboard or lboard structure
227 * is used to find out its type - no unions are used.
228 * If it is a lboard, then the config info of this board will be found
229 * on the local node. (LOCAL NODE BASE + offset value gives pointer to
230 * the structure.
231 * If it is a rboard, the local structure contains the node number
232 * and the offset of the beginning of the LINKED LIST on the remote node.
233 * The details of the hardware on a remote node can be built locally,
234 * if required, by reading the LINKED LIST on the remote node and
235 * ignoring all the rboards on that node.
236 *
237 * The local node uses the REMOTE NODE NUMBER + OFFSET to point to the
238 * First board info on the remote node. The remote node list is
239 * traversed as the local list, using the REMOTE BASE ADDRESS and not
240 * the local base address and ignoring all rboard values.
241 *
242 *
243 KLCONFIG
244
245 +------------+ +------------+ +------------+ +------------+
246 | lboard | +-->| lboard | +-->| rboard | +-->| lboard |
247 +------------+ | +------------+ | +------------+ | +------------+
248 | board info | | | board info | | |errinfo,bptr| | | board info |
249 +------------+ | +------------+ | +------------+ | +------------+
250 | offset |--+ | offset |--+ | offset |--+ |offset=NULL |
251 +------------+ +------------+ +------------+ +------------+
252
253
254 +------------+
255 | board info |
256 +------------+ +--------------------------------+
257 | compt 1 |------>| type, rev, diaginfo, size ... | (CPU)
258 +------------+ +--------------------------------+
259 | compt 2 |--+
260 +------------+ | +--------------------------------+
261 | ... | +--->| type, rev, diaginfo, size ... | (MEM_BANK)
262 +------------+ +--------------------------------+
263 | errinfo |--+
264 +------------+ | +--------------------------------+
265 +--->|r/l brd errinfo,compt err flags |
266 +--------------------------------+
267
268 *
269 * Each BOARD consists of COMPONENTs and the BOARD structure has
270 * pointers (offsets) to its COMPONENT structure.
271 * The COMPONENT structure has version info, size and speed info, revision,
272 * error info and the NIC info. This structure can accommodate any
273 * BOARD with arbitrary COMPONENT composition.
274 *
275 * The ERRORINFO part of each BOARD has error information
276 * that describes errors about the BOARD itself. It also has flags to
277 * indicate the COMPONENT(s) on the board that have errors. The error
278 * information specific to the COMPONENT is present in the respective
279 * COMPONENT structure.
280 *
281 * The ERRORINFO structure is also treated like a COMPONENT, ie. the
282 * BOARD has pointers(offset) to the ERRORINFO structure. The rboard
283 * structure also has a pointer to the ERRORINFO structure. This is
284 * the place to store ERRORINFO about a REMOTE NODE, if the HUB on
285 * that NODE is not working or if the REMOTE MEMORY is BAD. In cases where
286 * only the CPU of the REMOTE NODE is disabled, the ERRORINFO pointer can
287 * be a NODE NUMBER, REMOTE OFFSET combination, pointing to error info
288 * which is present on the REMOTE NODE.(TBD)
289 * REMOTE ERRINFO can be stored on any of the nearest nodes
290 * or on all the nearest nodes.(TBD)
291 * Like BOARD structures, REMOTE ERRINFO structures can be built locally
292 * using the rboard errinfo pointer.
293 *
294 * In order to get useful information from this Data organization, a set of
295 * interface routines are provided (TBD). The important thing to remember while
296 * manipulating the structures, is that, the NODE number information should
297 * be used. If the NODE is non-zero (remote) then each offset should
298 * be added to the REMOTE BASE ADDR else it should be added to the LOCAL BASE ADDR.
299 * This includes offsets for BOARDS, COMPONENTS and ERRORINFO.
300 *
301 * Note that these structures do not provide much info about connectivity.
302 * That info will be part of HWGRAPH, which is an extension of the cfg_t
303 * data structure. (ref IP27prom/cfg.h) It has to be extended to include
304 * the IO part of the Network(TBD).
305 *
306 * The data structures below define the above concepts.
307 */
308
309/*
310 * Values for CPU types
311 */
312#define KL_CPU_R4000 0x1 /* Standard R4000 */
313#define KL_CPU_TFP 0x2 /* TFP processor */
314#define KL_CPU_R10000 0x3 /* R10000 (T5) */
315#define KL_CPU_NONE (-1) /* no cpu present in slot */
316
317/*
318 * IP27 BOARD classes
319 */
320
321#define KLCLASS_MASK 0xf0
322#define KLCLASS_NONE 0x00
323#define KLCLASS_NODE 0x10 /* CPU, Memory and HUB board */
324#define KLCLASS_CPU KLCLASS_NODE
325#define KLCLASS_IO 0x20 /* BaseIO, 4 ch SCSI, ethernet, FDDI
326 and the non-graphics widget boards */
327#define KLCLASS_ROUTER 0x30 /* Router board */
328#define KLCLASS_MIDPLANE 0x40 /* We need to treat this as a board
329 so that we can record error info */
330#define KLCLASS_GFX 0x50 /* graphics boards */
331
332#define KLCLASS_PSEUDO_GFX 0x60 /* HDTV type cards that use a gfx
333 * hw ifc to xtalk and are not gfx
334 * class for sw purposes */
335
336#define KLCLASS_MAX 7 /* Bump this if a new CLASS is added */
337#define KLTYPE_MAX 10 /* Bump this if a new CLASS is added */
338
339#define KLCLASS_UNKNOWN 0xf0
340
341#define KLCLASS(_x) ((_x) & KLCLASS_MASK)
342
343/*
344 * IP27 board types
345 */
346
347#define KLTYPE_MASK 0x0f
348#define KLTYPE_NONE 0x00
349#define KLTYPE_EMPTY 0x00
350
351#define KLTYPE_WEIRDCPU (KLCLASS_CPU | 0x0)
352#define KLTYPE_IP27 (KLCLASS_CPU | 0x1) /* 2 CPUs(R10K) per board */
353
354#define KLTYPE_WEIRDIO (KLCLASS_IO | 0x0)
355#define KLTYPE_BASEIO (KLCLASS_IO | 0x1) /* IOC3, SuperIO, Bridge, SCSI */
356#define KLTYPE_IO6 KLTYPE_BASEIO /* Additional name */
357#define KLTYPE_4CHSCSI (KLCLASS_IO | 0x2)
358#define KLTYPE_MSCSI KLTYPE_4CHSCSI /* Additional name */
359#define KLTYPE_ETHERNET (KLCLASS_IO | 0x3)
360#define KLTYPE_MENET KLTYPE_ETHERNET /* Additional name */
361#define KLTYPE_FDDI (KLCLASS_IO | 0x4)
362#define KLTYPE_UNUSED (KLCLASS_IO | 0x5) /* XXX UNUSED */
363#define KLTYPE_HAROLD (KLCLASS_IO | 0x6) /* PCI SHOE BOX */
364#define KLTYPE_PCI KLTYPE_HAROLD
365#define KLTYPE_VME (KLCLASS_IO | 0x7) /* Any 3rd party VME card */
366#define KLTYPE_MIO (KLCLASS_IO | 0x8)
367#define KLTYPE_FC (KLCLASS_IO | 0x9)
368#define KLTYPE_LINC (KLCLASS_IO | 0xA)
369#define KLTYPE_TPU (KLCLASS_IO | 0xB) /* Tensor Processing Unit */
370#define KLTYPE_GSN_A (KLCLASS_IO | 0xC) /* Main GSN board */
371#define KLTYPE_GSN_B (KLCLASS_IO | 0xD) /* Auxiliary GSN board */
372
373#define KLTYPE_GFX (KLCLASS_GFX | 0x0) /* unknown graphics type */
374#define KLTYPE_GFX_KONA (KLCLASS_GFX | 0x1) /* KONA graphics on IP27 */
375#define KLTYPE_GFX_MGRA (KLCLASS_GFX | 0x3) /* MGRAS graphics on IP27 */
376
377#define KLTYPE_WEIRDROUTER (KLCLASS_ROUTER | 0x0)
378#define KLTYPE_ROUTER (KLCLASS_ROUTER | 0x1)
379#define KLTYPE_ROUTER2 KLTYPE_ROUTER /* Obsolete! */
380#define KLTYPE_NULL_ROUTER (KLCLASS_ROUTER | 0x2)
381#define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3)
382
383#define KLTYPE_WEIRDMIDPLANE (KLCLASS_MIDPLANE | 0x0)
384#define KLTYPE_MIDPLANE8 (KLCLASS_MIDPLANE | 0x1) /* 8 slot backplane */
385#define KLTYPE_MIDPLANE KLTYPE_MIDPLANE8
386#define KLTYPE_PBRICK_XBOW (KLCLASS_MIDPLANE | 0x2)
387
388#define KLTYPE_IOBRICK (KLCLASS_IOBRICK | 0x0)
389#define KLTYPE_IBRICK (KLCLASS_IOBRICK | 0x1)
390#define KLTYPE_PBRICK (KLCLASS_IOBRICK | 0x2)
391#define KLTYPE_XBRICK (KLCLASS_IOBRICK | 0x3)
392
393#define KLTYPE_PBRICK_BRIDGE KLTYPE_PBRICK
394
395/* The value of type should be more than 8 so that hinv prints
396 * out the board name from the NIC string. For values less than
397 * 8 the name of the board needs to be hard coded in a few places.
398 * When bringup started nic names had not standardized and so we
399 * had to hard code. (For people interested in history.)
400 */
401#define KLTYPE_XTHD (KLCLASS_PSEUDO_GFX | 0x9)
402
403#define KLTYPE_UNKNOWN (KLCLASS_UNKNOWN | 0xf)
404
405#define KLTYPE(_x) ((_x) & KLTYPE_MASK)
406#define IS_MIO_PRESENT(l) ((l->brd_type == KLTYPE_BASEIO) && \
407 (l->brd_flags & SECOND_NIC_PRESENT))
408#define IS_MIO_IOC3(l, n) (IS_MIO_PRESENT(l) && (n > 2))
409
410/*
411 * board structures
412 */
413
414#define MAX_COMPTS_PER_BRD 24
415
416#define LOCAL_BOARD 1
417#define REMOTE_BOARD 2
418
419#define LBOARD_STRUCT_VERSION 2
420
421typedef struct lboard_s {
422 klconf_off_t brd_next; /* Next BOARD */
423 unsigned char struct_type; /* type of structure, local or remote */
424 unsigned char brd_type; /* type+class */
425 unsigned char brd_sversion; /* version of this structure */
426 unsigned char brd_brevision; /* board revision */
427 unsigned char brd_promver; /* board prom version, if any */
428 unsigned char brd_flags; /* Enabled, Disabled etc */
429 unsigned char brd_slot; /* slot number */
430 unsigned short brd_debugsw; /* Debug switches */
431 moduleid_t brd_module; /* module to which it belongs */
432 partid_t brd_partition; /* Partition number */
433 unsigned short brd_diagval; /* diagnostic value */
434 unsigned short brd_diagparm; /* diagnostic parameter */
435 unsigned char brd_inventory; /* inventory history */
436 unsigned char brd_numcompts; /* Number of components */
437 nic_t brd_nic; /* Number in CAN */
438 nasid_t brd_nasid; /* passed parameter */
439 klconf_off_t brd_compts[MAX_COMPTS_PER_BRD]; /* pointers to COMPONENTS */
440 klconf_off_t brd_errinfo; /* Board's error information */
441 struct lboard_s *brd_parent; /* Logical parent for this brd */
442 vertex_hdl_t brd_graph_link; /* vertex hdl to connect extern compts */
443 confidence_t brd_confidence; /* confidence that the board is bad */
444 nasid_t brd_owner; /* who owns this board */
445 unsigned char brd_nic_flags; /* To handle 8 more NICs */
446 char brd_name[32];
447} lboard_t;
448
449
450/*
451 * Make sure we pass back the calias space address for local boards.
452 * klconfig board traversal and error structure extraction defines.
453 */
454
455#define BOARD_SLOT(_brd) ((_brd)->brd_slot)
456
457#define KLCF_CLASS(_brd) KLCLASS((_brd)->brd_type)
458#define KLCF_TYPE(_brd) KLTYPE((_brd)->brd_type)
459#define KLCF_REMOTE(_brd) (((_brd)->struct_type & LOCAL_BOARD) ? 0 : 1)
460#define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts)
461#define KLCF_MODULE_ID(_brd) ((_brd)->brd_module)
462
463#define KLCF_NEXT(_brd) \
464 ((_brd)->brd_next ? \
465 (lboard_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), (_brd)->brd_next)):\
466 NULL)
467#define KLCF_COMP(_brd, _ndx) \
468 (klinfo_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), \
469 (_brd)->brd_compts[(_ndx)]))
470
471#define KLCF_COMP_ERROR(_brd, _comp) \
472 (NODE_OFFSET_TO_K1(NASID_GET(_brd), (_comp)->errinfo))
473
474#define KLCF_COMP_TYPE(_comp) ((_comp)->struct_type)
475#define KLCF_BRIDGE_W_ID(_comp) ((_comp)->physid) /* Widget ID */
476
477
478
479/*
480 * Generic info structure. This stores common info about a
481 * component.
482 */
483
484typedef struct klinfo_s { /* Generic info */
485 unsigned char struct_type; /* type of this structure */
486 unsigned char struct_version; /* version of this structure */
487 unsigned char flags; /* Enabled, disabled etc */
488 unsigned char revision; /* component revision */
489 unsigned short diagval; /* result of diagnostics */
490 unsigned short diagparm; /* diagnostic parameter */
491 unsigned char inventory; /* previous inventory status */
492 nic_t nic; /* MUst be aligned properly */
493 unsigned char physid; /* physical id of component */
494 unsigned int virtid; /* virtual id as seen by system */
495 unsigned char widid; /* Widget id - if applicable */
496 nasid_t nasid; /* node number - from parent */
497 char pad1; /* pad out structure. */
498 char pad2; /* pad out structure. */
499 COMPONENT *arcs_compt; /* ptr to the arcs struct for ease*/
500 klconf_off_t errinfo; /* component specific errors */
501 unsigned short pad3; /* pci fields have moved over to */
502 unsigned short pad4; /* klbri_t */
503} klinfo_t ;
504
505#define KLCONFIG_INFO_ENABLED(_i) ((_i)->flags & KLINFO_ENABLE)
506/*
507 * Component structures.
508 * Following are the currently identified components:
509 * CPU, HUB, MEM_BANK,
510 * XBOW(consists of 16 WIDGETs, each of which can be HUB or GRAPHICS or BRIDGE)
511 * BRIDGE, IOC3, SuperIO, SCSI, FDDI
512 * ROUTER
513 * GRAPHICS
514 */
515#define KLSTRUCT_UNKNOWN 0
516#define KLSTRUCT_CPU 1
517#define KLSTRUCT_HUB 2
518#define KLSTRUCT_MEMBNK 3
519#define KLSTRUCT_XBOW 4
520#define KLSTRUCT_BRI 5
521#define KLSTRUCT_IOC3 6
522#define KLSTRUCT_PCI 7
523#define KLSTRUCT_VME 8
524#define KLSTRUCT_ROU 9
525#define KLSTRUCT_GFX 10
526#define KLSTRUCT_SCSI 11
527#define KLSTRUCT_FDDI 12
528#define KLSTRUCT_MIO 13
529#define KLSTRUCT_DISK 14
530#define KLSTRUCT_TAPE 15
531#define KLSTRUCT_CDROM 16
532#define KLSTRUCT_HUB_UART 17
533#define KLSTRUCT_IOC3ENET 18
534#define KLSTRUCT_IOC3UART 19
535#define KLSTRUCT_UNUSED 20 /* XXX UNUSED */
536#define KLSTRUCT_IOC3PCKM 21
537#define KLSTRUCT_RAD 22
538#define KLSTRUCT_HUB_TTY 23
539#define KLSTRUCT_IOC3_TTY 24
540
541/* Early Access IO proms are compatible
542 only with KLSTRUCT values up to 24. */
543
544#define KLSTRUCT_FIBERCHANNEL 25
545#define KLSTRUCT_MOD_SERIAL_NUM 26
546#define KLSTRUCT_IOC3MS 27
547#define KLSTRUCT_TPU 28
548#define KLSTRUCT_GSN_A 29
549#define KLSTRUCT_GSN_B 30
550#define KLSTRUCT_XTHD 31
551
552/*
553 * These are the indices of various components within a lboard structure.
554 */
555
556#define IP27_CPU0_INDEX 0
557#define IP27_CPU1_INDEX 1
558#define IP27_HUB_INDEX 2
559#define IP27_MEM_INDEX 3
560
561#define BASEIO_BRIDGE_INDEX 0
562#define BASEIO_IOC3_INDEX 1
563#define BASEIO_SCSI1_INDEX 2
564#define BASEIO_SCSI2_INDEX 3
565
566#define MIDPLANE_XBOW_INDEX 0
567#define ROUTER_COMPONENT_INDEX 0
568
569#define CH4SCSI_BRIDGE_INDEX 0
570
571/* Info holders for various hardware components */
572
573typedef u64 *pci_t;
574typedef u64 *vmeb_t;
575typedef u64 *vmed_t;
576typedef u64 *fddi_t;
577typedef u64 *scsi_t;
578typedef u64 *mio_t;
579typedef u64 *graphics_t;
580typedef u64 *router_t;
581
582/*
583 * The port info in ip27_cfg area translates to a lboart_t in the
584 * KLCONFIG area. But since KLCONFIG does not use pointers, lboart_t
585 * is stored in terms of a nasid and a offset from start of KLCONFIG
586 * area on that nasid.
587 */
588typedef struct klport_s {
589 nasid_t port_nasid;
590 unsigned char port_flag;
591 klconf_off_t port_offset;
592} klport_t;
593
594typedef struct klcpu_s { /* CPU */
595 klinfo_t cpu_info;
596 unsigned short cpu_prid; /* Processor PRID value */
597 unsigned short cpu_fpirr; /* FPU IRR value */
598 unsigned short cpu_speed; /* Speed in MHZ */
599 unsigned short cpu_scachesz; /* secondary cache size in MB */
600 unsigned short cpu_scachespeed;/* secondary cache speed in MHz */
601} klcpu_t ;
602
603#define CPU_STRUCT_VERSION 2
604
605typedef struct klhub_s { /* HUB */
606 klinfo_t hub_info;
607 unsigned int hub_flags; /* PCFG_HUB_xxx flags */
608 klport_t hub_port; /* hub is connected to this */
609 nic_t hub_box_nic; /* nic of containing box */
610 klconf_off_t hub_mfg_nic; /* MFG NIC string */
611 u64 hub_speed; /* Speed of hub in HZ */
612} klhub_t ;
613
614typedef struct klhub_uart_s { /* HUB */
615 klinfo_t hubuart_info;
616 unsigned int hubuart_flags; /* PCFG_HUB_xxx flags */
617 nic_t hubuart_box_nic; /* nic of containing box */
618} klhub_uart_t ;
619
620#define MEMORY_STRUCT_VERSION 2
621
622typedef struct klmembnk_s { /* MEMORY BANK */
623 klinfo_t membnk_info;
624 short membnk_memsz; /* Total memory in megabytes */
625 short membnk_dimm_select; /* bank to physical addr mapping*/
626 short membnk_bnksz[MD_MEM_BANKS]; /* Memory bank sizes */
627 short membnk_attr;
628} klmembnk_t ;
629
630#define KLCONFIG_MEMBNK_SIZE(_info, _bank) \
631 ((_info)->membnk_bnksz[(_bank)])
632
633
634#define MEMBNK_PREMIUM 1
635#define KLCONFIG_MEMBNK_PREMIUM(_info, _bank) \
636 ((_info)->membnk_attr & (MEMBNK_PREMIUM << (_bank)))
637
638#define MAX_SERIAL_NUM_SIZE 10
639
640typedef struct klmod_serial_num_s {
641 klinfo_t snum_info;
642 union {
643 char snum_str[MAX_SERIAL_NUM_SIZE];
644 unsigned long long snum_int;
645 } snum;
646} klmod_serial_num_t;
647
648/* Macros needed to access serial number structure in lboard_t.
649 Hard coded values are necessary since we cannot treat
650 serial number struct as a component without losing compatibility
651 between prom versions. */
652
653#define GET_SNUM_COMP(_l) ((klmod_serial_num_t *)\
654 KLCF_COMP(_l, _l->brd_numcompts))
655
656#define MAX_XBOW_LINKS 16
657
658typedef struct klxbow_s { /* XBOW */
659 klinfo_t xbow_info ;
660 klport_t xbow_port_info[MAX_XBOW_LINKS] ; /* Module number */
661 int xbow_master_hub_link;
662 /* type of brd connected+component struct ptr+flags */
663} klxbow_t ;
664
665#define MAX_PCI_SLOTS 8
666
667typedef struct klpci_device_s {
668 s32 pci_device_id; /* 32 bits of vendor/device ID. */
669 s32 pci_device_pad; /* 32 bits of padding. */
670} klpci_device_t;
671
672#define BRIDGE_STRUCT_VERSION 2
673
674typedef struct klbri_s { /* BRIDGE */
675 klinfo_t bri_info ;
676 unsigned char bri_eprominfo ; /* IO6prom connected to bridge */
677 unsigned char bri_bustype ; /* PCI/VME BUS bridge/GIO */
678 pci_t pci_specific ; /* PCI Board config info */
679 klpci_device_t bri_devices[MAX_PCI_DEVS] ; /* PCI IDs */
680 klconf_off_t bri_mfg_nic ;
681} klbri_t ;
682
683#define MAX_IOC3_TTY 2
684
685typedef struct klioc3_s { /* IOC3 */
686 klinfo_t ioc3_info ;
687 unsigned char ioc3_ssram ; /* Info about ssram */
688 unsigned char ioc3_nvram ; /* Info about nvram */
689 klinfo_t ioc3_superio ; /* Info about superio */
690 klconf_off_t ioc3_tty_off ;
691 klinfo_t ioc3_enet ;
692 klconf_off_t ioc3_enet_off ;
693 klconf_off_t ioc3_kbd_off ;
694} klioc3_t ;
695
696#define MAX_VME_SLOTS 8
697
698typedef struct klvmeb_s { /* VME BRIDGE - PCI CTLR */
699 klinfo_t vmeb_info ;
700 vmeb_t vmeb_specific ;
701 klconf_off_t vmeb_brdinfo[MAX_VME_SLOTS] ; /* VME Board config info */
702} klvmeb_t ;
703
704typedef struct klvmed_s { /* VME DEVICE - VME BOARD */
705 klinfo_t vmed_info ;
706 vmed_t vmed_specific ;
707 klconf_off_t vmed_brdinfo[MAX_VME_SLOTS] ; /* VME Board config info */
708} klvmed_t ;
709
710#define ROUTER_VECTOR_VERS 2
711
712/* XXX - Don't we need the number of ports here?!? */
713typedef struct klrou_s { /* ROUTER */
714 klinfo_t rou_info ;
715 unsigned int rou_flags ; /* PCFG_ROUTER_xxx flags */
716 nic_t rou_box_nic ; /* nic of the containing module */
717 klport_t rou_port[MAX_ROUTER_PORTS + 1] ; /* array index 1 to 6 */
718 klconf_off_t rou_mfg_nic ; /* MFG NIC string */
719 u64 rou_vector; /* vector from master node */
720} klrou_t ;
721
722/*
723 * Graphics Controller/Device
724 *
725 * (IP27/IO6) Prom versions 6.13 (and 6.5.1 kernels) and earlier
726 * used a couple different structures to store graphics information.
727 * For compatibility reasons, the newer data structure preserves some
728 * of the layout so that fields that are used in the old versions remain
729 * in the same place (with the same info). Determination of what version
730 * of this structure we have is done by checking the cookie field.
731 */
732#define KLGFX_COOKIE 0x0c0de000
733
734typedef struct klgfx_s { /* GRAPHICS Device */
735 klinfo_t gfx_info;
736 klconf_off_t old_gndevs; /* for compatibility with older proms */
737 klconf_off_t old_gdoff0; /* for compatibility with older proms */
738 unsigned int cookie; /* for compatibility with older proms */
739 unsigned int moduleslot;
740 struct klgfx_s *gfx_next_pipe;
741 graphics_t gfx_specific;
742 klconf_off_t pad0; /* for compatibility with older proms */
743 klconf_off_t gfx_mfg_nic;
744} klgfx_t;
745
746typedef struct klxthd_s {
747 klinfo_t xthd_info ;
748 klconf_off_t xthd_mfg_nic ; /* MFG NIC string */
749} klxthd_t ;
750
751typedef struct kltpu_s { /* TPU board */
752 klinfo_t tpu_info ;
753 klconf_off_t tpu_mfg_nic ; /* MFG NIC string */
754} kltpu_t ;
755
756typedef struct klgsn_s { /* GSN board */
757 klinfo_t gsn_info ;
758 klconf_off_t gsn_mfg_nic ; /* MFG NIC string */
759} klgsn_t ;
760
761#define MAX_SCSI_DEVS 16
762
763/*
764 * NOTE: THis is the max sized kl* structure and is used in klmalloc.c
765 * to allocate space of type COMPONENT. Make sure that if the size of
766 * any other component struct becomes more than this, then redefine
767 * that as the size to be klmalloced.
768 */
769
770typedef struct klscsi_s { /* SCSI Controller */
771 klinfo_t scsi_info ;
772 scsi_t scsi_specific ;
773 unsigned char scsi_numdevs ;
774 klconf_off_t scsi_devinfo[MAX_SCSI_DEVS] ;
775} klscsi_t ;
776
777typedef struct klscdev_s { /* SCSI device */
778 klinfo_t scdev_info ;
779 struct scsidisk_data *scdev_cfg ; /* driver fills up this */
780} klscdev_t ;
781
782typedef struct klttydev_s { /* TTY device */
783 klinfo_t ttydev_info ;
784 struct terminal_data *ttydev_cfg ; /* driver fills up this */
785} klttydev_t ;
786
787typedef struct klenetdev_s { /* ENET device */
788 klinfo_t enetdev_info ;
789 struct net_data *enetdev_cfg ; /* driver fills up this */
790} klenetdev_t ;
791
792typedef struct klkbddev_s { /* KBD device */
793 klinfo_t kbddev_info ;
794 struct keyboard_data *kbddev_cfg ; /* driver fills up this */
795} klkbddev_t ;
796
797typedef struct klmsdev_s { /* mouse device */
798 klinfo_t msdev_info ;
799 void *msdev_cfg ;
800} klmsdev_t ;
801
802#define MAX_FDDI_DEVS 10 /* XXX Is this true */
803
804typedef struct klfddi_s { /* FDDI */
805 klinfo_t fddi_info ;
806 fddi_t fddi_specific ;
807 klconf_off_t fddi_devinfo[MAX_FDDI_DEVS] ;
808} klfddi_t ;
809
810typedef struct klmio_s { /* MIO */
811 klinfo_t mio_info ;
812 mio_t mio_specific ;
813} klmio_t ;
814
815
816typedef union klcomp_s {
817 klcpu_t kc_cpu;
818 klhub_t kc_hub;
819 klmembnk_t kc_mem;
820 klxbow_t kc_xbow;
821 klbri_t kc_bri;
822 klioc3_t kc_ioc3;
823 klvmeb_t kc_vmeb;
824 klvmed_t kc_vmed;
825 klrou_t kc_rou;
826 klgfx_t kc_gfx;
827 klscsi_t kc_scsi;
828 klscdev_t kc_scsi_dev;
829 klfddi_t kc_fddi;
830 klmio_t kc_mio;
831 klmod_serial_num_t kc_snum ;
832} klcomp_t;
833
834typedef union kldev_s { /* for device structure allocation */
835 klscdev_t kc_scsi_dev ;
836 klttydev_t kc_tty_dev ;
837 klenetdev_t kc_enet_dev ;
838 klkbddev_t kc_kbd_dev ;
839} kldev_t ;
840
841/* Data structure interface routines. TBD */
842
843/* Include launch info in this file itself? TBD */
844
845/*
846 * TBD - Can the ARCS and device driver related info also be included in the
847 * KLCONFIG area. On the IO4PROM, prom device driver info is part of cfgnode_t
848 * structure, viz private to the IO4prom.
849 */
850
851/*
852 * TBD - Allocation issues.
853 *
854 * Do we need to Mark off sepatate heaps for lboard_t, rboard_t, component,
855 * errinfo and allocate from them, or have a single heap and allocate all
856 * structures from it. Debug is easier in the former method since we can
857 * dump all similar structs in one command, but there will be lots of holes,
858 * in memory and max limits are needed for number of structures.
859 * Another way to make it organized, is to have a union of all components
860 * and allocate a aligned chunk of memory greater than the biggest
861 * component.
862 */
863
864typedef union {
865 lboard_t *lbinfo ;
866} biptr_t ;
867
868
869#define BRI_PER_XBOW 6
870#define PCI_PER_BRI 8
871#define DEV_PER_PCI 16
872
873
874/* Virtual dipswitch values (starting from switch "7"): */
875
876#define VDS_NOGFX 0x8000 /* Don't enable gfx and autoboot */
877#define VDS_NOMP 0x100 /* Don't start slave processors */
878#define VDS_MANUMODE 0x80 /* Manufacturing mode */
879#define VDS_NOARB 0x40 /* No bootmaster arbitration */
880#define VDS_PODMODE 0x20 /* Go straight to POD mode */
881#define VDS_NO_DIAGS 0x10 /* Don't run any diags after BM arb */
882#define VDS_DEFAULTS 0x08 /* Use default environment values */
883#define VDS_NOMEMCLEAR 0x04 /* Don't run mem cfg code */
884#define VDS_2ND_IO4 0x02 /* Boot from the second IO4 */
885#define VDS_DEBUG_PROM 0x01 /* Print PROM debugging messages */
886
887/* external declarations of Linux kernel functions. */
888
889extern lboard_t *find_lboard(lboard_t *start, unsigned char type);
890extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
891extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
892extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class);
893
894#endif /* _ASM_SN_KLCONFIG_H */
diff --git a/arch/mips/include/asm/sn/kldir.h b/arch/mips/include/asm/sn/kldir.h
new file mode 100644
index 000000000..245f59bf3
--- /dev/null
+++ b/arch/mips/include/asm/sn/kldir.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef _ASM_SN_KLDIR_H
4#define _ASM_SN_KLDIR_H
5
6#define KLDIR_MAGIC 0x434d5f53505f5357
7
8#define KLDIR_OFF_MAGIC 0x00
9#define KLDIR_OFF_OFFSET 0x08
10#define KLDIR_OFF_POINTER 0x10
11#define KLDIR_OFF_SIZE 0x18
12#define KLDIR_OFF_COUNT 0x20
13#define KLDIR_OFF_STRIDE 0x28
14
15#define KLDIR_ENT_SIZE 0x40
16#define KLDIR_MAX_ENTRIES (0x400 / 0x40)
17
18#ifndef __ASSEMBLY__
19typedef struct kldir_ent_s {
20 u64 magic; /* Indicates validity of entry */
21 off_t offset; /* Offset from start of node space */
22 unsigned long pointer; /* Pointer to area in some cases */
23 size_t size; /* Size in bytes */
24 u64 count; /* Repeat count if array, 1 if not */
25 size_t stride; /* Stride if array, 0 if not */
26 char rsvd[16]; /* Pad entry to 0x40 bytes */
27 /* NOTE: These 16 bytes are used in the Partition KLDIR
28 entry to store partition info. Refer to klpart.h for this. */
29} kldir_ent_t;
30#endif /* !__ASSEMBLY__ */
31
32#ifdef CONFIG_SGI_IP27
33#include <asm/sn/sn0/kldir.h>
34#endif
35
36#endif /* _ASM_SN_KLDIR_H */
diff --git a/arch/mips/include/asm/sn/klkernvars.h b/arch/mips/include/asm/sn/klkernvars.h
new file mode 100644
index 000000000..ea6b21795
--- /dev/null
+++ b/arch/mips/include/asm/sn/klkernvars.h
@@ -0,0 +1,29 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * File ported from IRIX to Linux by Kanoj Sarcar, 06/08/00.
4 * Copyright 2000 Silicon Graphics, Inc.
5 */
6#ifndef __ASM_SN_KLKERNVARS_H
7#define __ASM_SN_KLKERNVARS_H
8
9#define KV_MAGIC_OFFSET 0x0
10#define KV_RO_NASID_OFFSET 0x4
11#define KV_RW_NASID_OFFSET 0x6
12
13#define KV_MAGIC 0x5f4b565f
14
15#ifndef __ASSEMBLY__
16
17#include <asm/sn/types.h>
18
19typedef struct kern_vars_s {
20 int kv_magic;
21 nasid_t kv_ro_nasid;
22 nasid_t kv_rw_nasid;
23 unsigned long kv_ro_baseaddr;
24 unsigned long kv_rw_baseaddr;
25} kern_vars_t;
26
27#endif /* !__ASSEMBLY__ */
28
29#endif /* __ASM_SN_KLKERNVARS_H */
diff --git a/arch/mips/include/asm/sn/launch.h b/arch/mips/include/asm/sn/launch.h
new file mode 100644
index 000000000..04226d8d3
--- /dev/null
+++ b/arch/mips/include/asm/sn/launch.h
@@ -0,0 +1,106 @@
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 <asm/sn/types.h>
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, then returns to the slave loop. The master may poll or wait
24 * for the slaves to finish.
25 *
26 * There is an array of launch structures, one per CPU on the node. One
27 * interrupt level is used per local CPU.
28 */
29
30#define LAUNCH_MAGIC 0xaddbead2addbead3
31#ifdef CONFIG_SGI_IP27
32#define LAUNCH_SIZEOF 0x100
33#define LAUNCH_PADSZ 0xa0
34#endif
35
36#define LAUNCH_OFF_MAGIC 0x00 /* Struct offsets for assembly */
37#define LAUNCH_OFF_BUSY 0x08
38#define LAUNCH_OFF_CALL 0x10
39#define LAUNCH_OFF_CALLC 0x18
40#define LAUNCH_OFF_CALLPARM 0x20
41#define LAUNCH_OFF_STACK 0x28
42#define LAUNCH_OFF_GP 0x30
43#define LAUNCH_OFF_BEVUTLB 0x38
44#define LAUNCH_OFF_BEVNORMAL 0x40
45#define LAUNCH_OFF_BEVECC 0x48
46
47#define LAUNCH_STATE_DONE 0 /* Return value of LAUNCH_POLL */
48#define LAUNCH_STATE_SENT 1
49#define LAUNCH_STATE_RECD 2
50
51/*
52 * The launch routine is called only if the complement address is correct.
53 *
54 * Before control is transferred to a routine, the complement address
55 * is zeroed (invalidated) to prevent an accidental call from a spurious
56 * interrupt.
57 *
58 * The slave_launch routine turns on the BUSY flag, and the slave loop
59 * clears the BUSY flag after control is returned to it.
60 */
61
62#ifndef __ASSEMBLY__
63
64typedef int launch_state_t;
65typedef void (*launch_proc_t)(u64 call_parm);
66
67typedef struct launch_s {
68 volatile u64 magic; /* Magic number */
69 volatile u64 busy; /* Slave currently active */
70 volatile launch_proc_t call_addr; /* Func. for slave to call */
71 volatile u64 call_addr_c; /* 1's complement of call_addr*/
72 volatile u64 call_parm; /* Single parm passed to call*/
73 volatile void *stack_addr; /* Stack pointer for slave function */
74 volatile void *gp_addr; /* Global pointer for slave func. */
75 volatile char *bevutlb;/* Address of bev utlb ex handler */
76 volatile char *bevnormal;/*Address of bev normal ex handler */
77 volatile char *bevecc;/* Address of bev cache err handler */
78 volatile char pad[160]; /* Pad to LAUNCH_SIZEOF */
79} launch_t;
80
81/*
82 * PROM entry points for launch routines are determined by IPxxprom/start.s
83 */
84
85#define LAUNCH_SLAVE (*(void (*)(int nasid, int cpu, \
86 launch_proc_t call_addr, \
87 u64 call_parm, \
88 void *stack_addr, \
89 void *gp_addr)) \
90 IP27PROM_LAUNCHSLAVE)
91
92#define LAUNCH_WAIT (*(void (*)(int nasid, int cpu, int timeout_msec)) \
93 IP27PROM_WAITSLAVE)
94
95#define LAUNCH_POLL (*(launch_state_t (*)(int nasid, int cpu)) \
96 IP27PROM_POLLSLAVE)
97
98#define LAUNCH_LOOP (*(void (*)(void)) \
99 IP27PROM_SLAVELOOP)
100
101#define LAUNCH_FLASH (*(void (*)(void)) \
102 IP27PROM_FLASHLEDS)
103
104#endif /* !__ASSEMBLY__ */
105
106#endif /* _ASM_SN_LAUNCH_H */
diff --git a/arch/mips/include/asm/sn/mapped_kernel.h b/arch/mips/include/asm/sn/mapped_kernel.h
new file mode 100644
index 000000000..3f1049807
--- /dev/null
+++ b/arch/mips/include/asm/sn/mapped_kernel.h
@@ -0,0 +1,55 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * File created by Kanoj Sarcar 06/06/00.
4 * Copyright 2000 Silicon Graphics, Inc.
5 */
6#ifndef __ASM_SN_MAPPED_KERNEL_H
7#define __ASM_SN_MAPPED_KERNEL_H
8
9#include <linux/mmzone.h>
10
11/*
12 * Note on how mapped kernels work: the text and data section is
13 * compiled at cksseg segment (LOADADDR = 0xc001c000), and the
14 * init/setup/data section gets a 16M virtual address bump in the
15 * ld.script file (so that tlblo0 and tlblo1 maps the sections).
16 * The vmlinux.64 section addresses are put in the xkseg range
17 * using the change-addresses makefile option. Use elfdump -of
18 * on IRIX to see where the sections go. The Origin loader loads
19 * the two sections contiguously in physical memory. The loader
20 * sets the entry point into kernel_entry using a xkphys address,
21 * but instead of using 0xa800000001160000, it uses the address
22 * 0xa800000000160000, which is where it physically loaded that
23 * code. So no jumps can be done before we have switched to using
24 * cksseg addresses.
25 */
26#include <asm/addrspace.h>
27
28#define REP_BASE CAC_BASE
29
30#ifdef CONFIG_MAPPED_KERNEL
31
32#define MAPPED_ADDR_RO_TO_PHYS(x) (x - REP_BASE)
33#define MAPPED_ADDR_RW_TO_PHYS(x) (x - REP_BASE - 16777216)
34
35#define MAPPED_KERN_RO_PHYSBASE(n) (hub_data(n)->kern_vars.kv_ro_baseaddr)
36#define MAPPED_KERN_RW_PHYSBASE(n) (hub_data(n)->kern_vars.kv_rw_baseaddr)
37
38#define MAPPED_KERN_RO_TO_PHYS(x) \
39 ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \
40 MAPPED_KERN_RO_PHYSBASE(get_nasid()))
41#define MAPPED_KERN_RW_TO_PHYS(x) \
42 ((unsigned long)MAPPED_ADDR_RW_TO_PHYS(x) | \
43 MAPPED_KERN_RW_PHYSBASE(get_nasid()))
44
45#else /* CONFIG_MAPPED_KERNEL */
46
47#define MAPPED_KERN_RO_TO_PHYS(x) (x - REP_BASE)
48#define MAPPED_KERN_RW_TO_PHYS(x) (x - REP_BASE)
49
50#endif /* CONFIG_MAPPED_KERNEL */
51
52#define MAPPED_KERN_RO_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RO_TO_PHYS(x))
53#define MAPPED_KERN_RW_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RW_TO_PHYS(x))
54
55#endif /* __ASM_SN_MAPPED_KERNEL_H */
diff --git a/arch/mips/include/asm/sn/nmi.h b/arch/mips/include/asm/sn/nmi.h
new file mode 100644
index 000000000..12ac210f1
--- /dev/null
+++ b/arch/mips/include/asm/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 * Derived from IRIX <sys/SN/nmi.h>, Revision 1.5.
7 *
8 * Copyright (C) 1992 - 1997 Silicon Graphics, Inc.
9 */
10#ifndef __ASM_SN_NMI_H
11#define __ASM_SN_NMI_H
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/arch/mips/include/asm/sn/sn0/addrs.h b/arch/mips/include/asm/sn/sn0/addrs.h
new file mode 100644
index 000000000..f13df84ed
--- /dev/null
+++ b/arch/mips/include/asm/sn/sn0/addrs.h
@@ -0,0 +1,283 @@
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
15/*
16 * SN0 (on a T5) Address map
17 *
18 * This file contains a set of definitions and macros which are used
19 * to reference into the major address spaces (CAC, HSPEC, IO, MSPEC,
20 * and UNCAC) used by the SN0 architecture. It also contains addresses
21 * for "major" statically locatable PROM/Kernel data structures, such as
22 * the partition table, the configuration data structure, etc.
23 * We make an implicit assumption that the processor using this file
24 * follows the R10K's provisions for specifying uncached attributes;
25 * should this change, the base registers may very well become processor-
26 * dependent.
27 *
28 * For more information on the address spaces, see the "Local Resources"
29 * chapter of the Hub specification.
30 *
31 * NOTE: This header file is included both by C and by assembler source
32 * files. Please bracket any language-dependent definitions
33 * appropriately.
34 */
35
36/*
37 * Some of the macros here need to be casted to appropriate types when used
38 * from C. They definitely must not be casted from assembly language so we
39 * use some new ANSI preprocessor stuff to paste these on where needed.
40 */
41
42/*
43 * The following couple of definitions will eventually need to be variables,
44 * since the amount of address space assigned to each node depends on
45 * whether the system is running in N-mode (more nodes with less memory)
46 * or M-mode (fewer nodes with more memory). We expect that it will
47 * be a while before we need to make this decision dynamically, though,
48 * so for now we just use defines bracketed by an ifdef.
49 */
50
51#ifdef CONFIG_SGI_SN_N_MODE
52
53#define NODE_SIZE_BITS 31
54#define BWIN_SIZE_BITS 28
55
56#define NASID_BITS 9
57#define NASID_BITMASK (0x1ffLL)
58#define NASID_SHFT 31
59#define NASID_META_BITS 5
60#define NASID_LOCAL_BITS 4
61
62#define BDDIR_UPPER_MASK (UINT64_CAST 0x7ffff << 10)
63#define BDECC_UPPER_MASK (UINT64_CAST 0x3ffffff << 3)
64
65#else /* !defined(CONFIG_SGI_SN_N_MODE), assume that M-mode is desired */
66
67#define NODE_SIZE_BITS 32
68#define BWIN_SIZE_BITS 29
69
70#define NASID_BITMASK (0xffLL)
71#define NASID_BITS 8
72#define NASID_SHFT 32
73#define NASID_META_BITS 4
74#define NASID_LOCAL_BITS 4
75
76#define BDDIR_UPPER_MASK (UINT64_CAST 0xfffff << 10)
77#define BDECC_UPPER_MASK (UINT64_CAST 0x7ffffff << 3)
78
79#endif /* !defined(CONFIG_SGI_SN_N_MODE) */
80
81#define NODE_ADDRSPACE_SIZE (UINT64_CAST 1 << NODE_SIZE_BITS)
82
83#define NASID_MASK (UINT64_CAST NASID_BITMASK << NASID_SHFT)
84#define NASID_GET(_pa) (int) ((UINT64_CAST (_pa) >> \
85 NASID_SHFT) & NASID_BITMASK)
86
87#if !defined(__ASSEMBLY__)
88
89#define NODE_SWIN_BASE(nasid, widget) \
90 ((widget == 0) ? NODE_BWIN_BASE((nasid), SWIN0_BIGWIN) \
91 : RAW_NODE_SWIN_BASE(nasid, widget))
92#else /* __ASSEMBLY__ */
93#define NODE_SWIN_BASE(nasid, widget) \
94 (NODE_IO_BASE(nasid) + (UINT64_CAST(widget) << SWIN_SIZE_BITS))
95#endif /* __ASSEMBLY__ */
96
97/*
98 * The following definitions pertain to the IO special address
99 * space. They define the location of the big and little windows
100 * of any given node.
101 */
102
103#define BWIN_INDEX_BITS 3
104#define BWIN_SIZE (UINT64_CAST 1 << BWIN_SIZE_BITS)
105#define BWIN_SIZEMASK (BWIN_SIZE - 1)
106#define BWIN_WIDGET_MASK 0x7
107#define NODE_BWIN_BASE0(nasid) (NODE_IO_BASE(nasid) + BWIN_SIZE)
108#define NODE_BWIN_BASE(nasid, bigwin) (NODE_BWIN_BASE0(nasid) + \
109 (UINT64_CAST(bigwin) << BWIN_SIZE_BITS))
110
111#define BWIN_WIDGETADDR(addr) ((addr) & BWIN_SIZEMASK)
112#define BWIN_WINDOWNUM(addr) (((addr) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK)
113/*
114 * Verify if addr belongs to large window address of node with "nasid"
115 *
116 *
117 * NOTE: "addr" is expected to be XKPHYS address, and NOT physical
118 * address
119 *
120 *
121 */
122
123#define NODE_BWIN_ADDR(nasid, addr) \
124 (((addr) >= NODE_BWIN_BASE0(nasid)) && \
125 ((addr) < (NODE_BWIN_BASE(nasid, HUB_NUM_BIG_WINDOW) + \
126 BWIN_SIZE)))
127
128/*
129 * The following define the major position-independent aliases used
130 * in SN0.
131 * CALIAS -- Varies in size, points to the first n bytes of memory
132 * on the reader's node.
133 */
134
135#define CALIAS_BASE CAC_BASE
136
137#define SN0_WIDGET_BASE(_nasid, _wid) (NODE_SWIN_BASE((_nasid), (_wid)))
138
139/* Turn on sable logging for the processors whose bits are set. */
140#define SABLE_LOG_TRIGGER(_map)
141
142#ifndef __ASSEMBLY__
143#define KERN_NMI_ADDR(nasid, slice) \
144 TO_NODE_UNCAC((nasid), IP27_NMI_KREGS_OFFSET + \
145 (IP27_NMI_KREGS_CPU_SIZE * (slice)))
146#endif /* !__ASSEMBLY__ */
147
148#ifdef PROM
149
150#define MISC_PROM_BASE PHYS_TO_K0(0x01300000)
151#define MISC_PROM_SIZE 0x200000
152
153#define DIAG_BASE PHYS_TO_K0(0x01500000)
154#define DIAG_SIZE 0x300000
155
156#define ROUTE_BASE PHYS_TO_K0(0x01800000)
157#define ROUTE_SIZE 0x200000
158
159#define IP27PROM_FLASH_HDR PHYS_TO_K0(0x01300000)
160#define IP27PROM_FLASH_DATA PHYS_TO_K0(0x01301000)
161#define IP27PROM_CORP_MAX 32
162#define IP27PROM_CORP PHYS_TO_K0(0x01800000)
163#define IP27PROM_CORP_SIZE 0x10000
164#define IP27PROM_CORP_STK PHYS_TO_K0(0x01810000)
165#define IP27PROM_CORP_STKSIZE 0x2000
166#define IP27PROM_DECOMP_BUF PHYS_TO_K0(0x01900000)
167#define IP27PROM_DECOMP_SIZE 0xfff00
168
169#define IP27PROM_BASE PHYS_TO_K0(0x01a00000)
170#define IP27PROM_BASE_MAPPED (UNCAC_BASE | 0x1fc00000)
171#define IP27PROM_SIZE_MAX 0x100000
172
173#define IP27PROM_PCFG PHYS_TO_K0(0x01b00000)
174#define IP27PROM_PCFG_SIZE 0xd0000
175#define IP27PROM_ERRDMP PHYS_TO_K1(0x01bd0000)
176#define IP27PROM_ERRDMP_SIZE 0xf000
177
178#define IP27PROM_INIT_START PHYS_TO_K1(0x01bd0000)
179#define IP27PROM_CONSOLE PHYS_TO_K1(0x01bdf000)
180#define IP27PROM_CONSOLE_SIZE 0x200
181#define IP27PROM_NETUART PHYS_TO_K1(0x01bdf200)
182#define IP27PROM_NETUART_SIZE 0x100
183#define IP27PROM_UNUSED1 PHYS_TO_K1(0x01bdf300)
184#define IP27PROM_UNUSED1_SIZE 0x500
185#define IP27PROM_ELSC_BASE_A PHYS_TO_K0(0x01bdf800)
186#define IP27PROM_ELSC_BASE_B PHYS_TO_K0(0x01bdfc00)
187#define IP27PROM_STACK_A PHYS_TO_K0(0x01be0000)
188#define IP27PROM_STACK_B PHYS_TO_K0(0x01bf0000)
189#define IP27PROM_STACK_SHFT 16
190#define IP27PROM_STACK_SIZE (1 << IP27PROM_STACK_SHFT)
191#define IP27PROM_INIT_END PHYS_TO_K0(0x01c00000)
192
193#define SLAVESTACK_BASE PHYS_TO_K0(0x01580000)
194#define SLAVESTACK_SIZE 0x40000
195
196#define ENETBUFS_BASE PHYS_TO_K0(0x01f80000)
197#define ENETBUFS_SIZE 0x20000
198
199#define IO6PROM_BASE PHYS_TO_K0(0x01c00000)
200#define IO6PROM_SIZE 0x400000
201#define IO6PROM_BASE_MAPPED (UNCAC_BASE | 0x11c00000)
202#define IO6DPROM_BASE PHYS_TO_K0(0x01c00000)
203#define IO6DPROM_SIZE 0x200000
204
205#define NODEBUGUNIX_ADDR PHYS_TO_K0(0x00019000)
206#define DEBUGUNIX_ADDR PHYS_TO_K0(0x00100000)
207
208#define IP27PROM_INT_LAUNCH 10 /* and 11 */
209#define IP27PROM_INT_NETUART 12 /* through 17 */
210
211#endif /* PROM */
212
213/*
214 * needed by symmon so it needs to be outside #if PROM
215 */
216#define IP27PROM_ELSC_SHFT 10
217#define IP27PROM_ELSC_SIZE (1 << IP27PROM_ELSC_SHFT)
218
219/*
220 * This address is used by IO6PROM to build MemoryDescriptors of
221 * free memory. This address is important since unix gets loaded
222 * at this address, and this memory has to be FREE if unix is to
223 * be loaded.
224 */
225
226#define FREEMEM_BASE PHYS_TO_K0(0x2000000)
227
228#define IO6PROM_STACK_SHFT 14 /* stack per cpu */
229#define IO6PROM_STACK_SIZE (1 << IO6PROM_STACK_SHFT)
230
231/*
232 * IP27 PROM vectors
233 */
234
235#define IP27PROM_ENTRY PHYS_TO_COMPATK1(0x1fc00000)
236#define IP27PROM_RESTART PHYS_TO_COMPATK1(0x1fc00008)
237#define IP27PROM_SLAVELOOP PHYS_TO_COMPATK1(0x1fc00010)
238#define IP27PROM_PODMODE PHYS_TO_COMPATK1(0x1fc00018)
239#define IP27PROM_IOC3UARTPOD PHYS_TO_COMPATK1(0x1fc00020)
240#define IP27PROM_FLASHLEDS PHYS_TO_COMPATK1(0x1fc00028)
241#define IP27PROM_REPOD PHYS_TO_COMPATK1(0x1fc00030)
242#define IP27PROM_LAUNCHSLAVE PHYS_TO_COMPATK1(0x1fc00038)
243#define IP27PROM_WAITSLAVE PHYS_TO_COMPATK1(0x1fc00040)
244#define IP27PROM_POLLSLAVE PHYS_TO_COMPATK1(0x1fc00048)
245
246#define KL_UART_BASE LOCAL_HUB_ADDR(MD_UREG0_0) /* base of UART regs */
247#define KL_UART_CMD LOCAL_HUB_ADDR(MD_UREG0_0) /* UART command reg */
248#define KL_UART_DATA LOCAL_HUB_ADDR(MD_UREG0_1) /* UART data reg */
249#define KL_I2C_REG MD_UREG0_0 /* I2C reg */
250
251#ifndef __ASSEMBLY__
252
253/* Address 0x400 to 0x1000 ualias points to cache error eframe + misc
254 * CACHE_ERR_SP_PTR could either contain an address to the stack, or
255 * the stack could start at CACHE_ERR_SP_PTR
256 */
257#if defined(HUB_ERR_STS_WAR)
258#define CACHE_ERR_EFRAME 0x480
259#else /* HUB_ERR_STS_WAR */
260#define CACHE_ERR_EFRAME 0x400
261#endif /* HUB_ERR_STS_WAR */
262
263#define CACHE_ERR_ECCFRAME (CACHE_ERR_EFRAME + EF_SIZE)
264#define CACHE_ERR_SP_PTR (0x1000 - 32) /* why -32? TBD */
265#define CACHE_ERR_IBASE_PTR (0x1000 - 40)
266#define CACHE_ERR_SP (CACHE_ERR_SP_PTR - 16)
267#define CACHE_ERR_AREA_SIZE (ARCS_SPB_OFFSET - CACHE_ERR_EFRAME)
268
269#endif /* !__ASSEMBLY__ */
270
271#define _ARCSPROM
272
273#if defined(HUB_ERR_STS_WAR)
274
275#define ERR_STS_WAR_REGISTER IIO_IIBUSERR
276#define ERR_STS_WAR_ADDR LOCAL_HUB_ADDR(IIO_IIBUSERR)
277#define ERR_STS_WAR_PHYSADDR TO_PHYS((__psunsigned_t)ERR_STS_WAR_ADDR)
278 /* Used to match addr in error reg. */
279#define OLD_ERR_STS_WAR_OFFSET ((MD_MEM_BANKS * MD_BANK_SIZE) - 0x100)
280
281#endif /* HUB_ERR_STS_WAR */
282
283#endif /* _ASM_SN_SN0_ADDRS_H */
diff --git a/arch/mips/include/asm/sn/sn0/arch.h b/arch/mips/include/asm/sn/sn0/arch.h
new file mode 100644
index 000000000..12f4c4649
--- /dev/null
+++ b/arch/mips/include/asm/sn/sn0/arch.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 * 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
15/*
16 * MAXCPUS refers to the maximum number of CPUs in a single kernel.
17 * This is not necessarily the same as MAXNODES * CPUS_PER_NODE
18 */
19#define MAXCPUS (MAX_NUMNODES * CPUS_PER_NODE)
20
21/*
22 * This is the maximum number of NASIDS that can be present in a system.
23 * (Highest NASID plus one.)
24 */
25#define MAX_NASIDS 256
26
27/*
28 * MAX_REGIONS refers to the maximum number of hardware partitioned regions.
29 */
30#define MAX_REGIONS 64
31#define MAX_NONPREMIUM_REGIONS 16
32#define MAX_PREMIUM_REGIONS MAX_REGIONS
33
34/*
35 * MAX_PARITIONS refers to the maximum number of logically defined
36 * partitions the system can support.
37 */
38#define MAX_PARTITIONS MAX_REGIONS
39
40#define NASID_MASK_BYTES ((MAX_NASIDS + 7) / 8)
41
42/*
43 * Slot constants for SN0
44 */
45#ifdef CONFIG_SGI_SN_N_MODE
46#define MAX_MEM_SLOTS 16 /* max slots per node */
47#else /* !CONFIG_SGI_SN_N_MODE, assume CONFIG_SGI_SN_M_MODE */
48#define MAX_MEM_SLOTS 32 /* max slots per node */
49#endif /* CONFIG_SGI_SN_M_MODE */
50
51#define SLOT_SHIFT (27)
52#define SLOT_MIN_MEM_SIZE (32*1024*1024)
53
54#define CPUS_PER_NODE 2 /* CPUs on a single hub */
55
56#endif /* _ASM_SN_SN0_ARCH_H */
diff --git a/arch/mips/include/asm/sn/sn0/hub.h b/arch/mips/include/asm/sn/sn0/hub.h
new file mode 100644
index 000000000..c84adde36
--- /dev/null
+++ b/arch/mips/include/asm/sn/sn0/hub.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) 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/* Translation of uncached attributes */
35#define UATTR_HSPEC 0
36#define UATTR_IO 1
37#define UATTR_MSPEC 2
38#define UATTR_UNCAC 3
39
40#ifdef __ASSEMBLY__
41/*
42 * Returns the local nasid into res.
43 */
44 .macro GET_NASID_ASM res
45 dli \res, LOCAL_HUB_ADDR(NI_STATUS_REV_ID)
46 ld \res, (\res)
47 and \res, NSRI_NODEID_MASK
48 dsrl \res, NSRI_NODEID_SHFT
49 .endm
50#else
51
52/*
53 * get_nasid() returns the physical node id number of the caller.
54 */
55static inline nasid_t get_nasid(void)
56{
57 return (nasid_t)((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_NODEID_MASK)
58 >> NSRI_NODEID_SHFT);
59}
60#endif
61
62#endif /* _ASM_SN_SN0_HUB_H */
diff --git a/arch/mips/include/asm/sn/sn0/hubio.h b/arch/mips/include/asm/sn/sn0/hubio.h
new file mode 100644
index 000000000..57ece90f8
--- /dev/null
+++ b/arch/mips/include/asm/sn/sn0/hubio.h
@@ -0,0 +1,972 @@
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 Management 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#endif /* !__ASSEMBLY__ */
490
491#define IIO_ICRB_ADDR_SHFT 2 /* Shift to get proper address */
492
493/*
494 * values for "ecode" field
495 */
496#define IIO_ICRB_ECODE_DERR 0 /* Directory error due to IIO access */
497#define IIO_ICRB_ECODE_PERR 1 /* Poison error on IO access */
498#define IIO_ICRB_ECODE_WERR 2 /* Write error by IIO access
499 * e.g. WINV to a Read only line.
500 */
501#define IIO_ICRB_ECODE_AERR 3 /* Access error caused by IIO access */
502#define IIO_ICRB_ECODE_PWERR 4 /* Error on partial write */
503#define IIO_ICRB_ECODE_PRERR 5 /* Error on partial read */
504#define IIO_ICRB_ECODE_TOUT 6 /* CRB timeout before deallocating */
505#define IIO_ICRB_ECODE_XTERR 7 /* Incoming xtalk pkt had error bit */
506
507
508
509/*
510 * Fields in CRB Register B
511 */
512#ifndef __ASSEMBLY__
513typedef union icrbb_u {
514 u64 reg_value;
515 struct {
516 u64 rsvd1: 5,
517 btenum: 1, /* BTE to which entry belongs to */
518 cohtrans: 1, /* Coherent transaction */
519 xtsize: 2, /* Xtalk operation size
520 * 0: Double Word
521 * 1: 32 Bytes.
522 * 2: 128 Bytes,
523 * 3: Reserved.
524 */
525 srcnode: 9, /* Source Node ID */
526 srcinit: 2, /* Source Initiator:
527 * See below for field values.
528 */
529 useold: 1, /* Use OLD command for processing */
530 imsgtype: 2, /* Incoming message type
531 * see below for field values
532 */
533 imsg: 8, /* Incoming message */
534 initator: 3, /* Initiator of original request
535 * See below for field values.
536 */
537 reqtype: 5, /* Identifies type of request
538 * See below for field values.
539 */
540 rsvd2: 7,
541 ackcnt: 11, /* Invalidate ack count */
542 resp: 1, /* data response given to processor */
543 ack: 1, /* indicates data ack received */
544 hold: 1, /* entry is gathering inval acks */
545 wb_pend:1, /* waiting for writeback to complete */
546 intvn: 1, /* Intervention */
547 stall_ib: 1, /* Stall Ibuf (from crosstalk) */
548 stall_intr: 1; /* Stall internal interrupts */
549 } icrbb_field_s;
550} icrbb_t;
551
552/* This is an alternate typedef for the HUB1 CRB B in order to allow
553 runtime selection of the format based on the REV_ID field of the
554 NI_STATUS_REV_ID register. */
555typedef union h1_icrbb_u {
556 u64 reg_value;
557 struct {
558 u64 rsvd1: 5,
559 btenum: 1, /* BTE to which entry belongs to */
560 cohtrans: 1, /* Coherent transaction */
561 xtsize: 2, /* Xtalk operation size
562 * 0: Double Word
563 * 1: 32 Bytes.
564 * 2: 128 Bytes,
565 * 3: Reserved.
566 */
567 srcnode: 9, /* Source Node ID */
568 srcinit: 2, /* Source Initiator:
569 * See below for field values.
570 */
571 useold: 1, /* Use OLD command for processing */
572 imsgtype: 2, /* Incoming message type
573 * see below for field values
574 */
575 imsg: 8, /* Incoming message */
576 initator: 3, /* Initiator of original request
577 * See below for field values.
578 */
579 rsvd2: 1,
580 pcache: 1, /* entry belongs to partial cache */
581 reqtype: 5, /* Identifies type of request
582 * See below for field values.
583 */
584 stl_ib: 1, /* stall Ibus coming from xtalk */
585 stl_intr: 1, /* Stall internal interrupts */
586 stl_bte0: 1, /* Stall BTE 0 */
587 stl_bte1: 1, /* Stall BTE 1 */
588 intrvn: 1, /* Req was target of intervention */
589 ackcnt: 11, /* Invalidate ack count */
590 resp: 1, /* data response given to processor */
591 ack: 1, /* indicates data ack received */
592 hold: 1, /* entry is gathering inval acks */
593 wb_pend:1, /* waiting for writeback to complete */
594 sleep: 1, /* xtalk req sleeping till IO-sync */
595 pnd_reply: 1, /* replies not issed due to IOQ full */
596 pnd_req: 1; /* reqs not issued due to IOQ full */
597 } h1_icrbb_field_s;
598} h1_icrbb_t;
599
600
601#define b_imsgtype icrbb_field_s.imsgtype
602#define b_btenum icrbb_field_s.btenum
603#define b_cohtrans icrbb_field_s.cohtrans
604#define b_xtsize icrbb_field_s.xtsize
605#define b_srcnode icrbb_field_s.srcnode
606#define b_srcinit icrbb_field_s.srcinit
607#define b_imsgtype icrbb_field_s.imsgtype
608#define b_imsg icrbb_field_s.imsg
609#define b_initiator icrbb_field_s.initiator
610
611#endif /* !__ASSEMBLY__ */
612
613/*
614 * values for field xtsize
615 */
616#define IIO_ICRB_XTSIZE_DW 0 /* Xtalk operation size is 8 bytes */
617#define IIO_ICRB_XTSIZE_32 1 /* Xtalk operation size is 32 bytes */
618#define IIO_ICRB_XTSIZE_128 2 /* Xtalk operation size is 128 bytes */
619
620/*
621 * values for field srcinit
622 */
623#define IIO_ICRB_PROC0 0 /* Source of request is Proc 0 */
624#define IIO_ICRB_PROC1 1 /* Source of request is Proc 1 */
625#define IIO_ICRB_GB_REQ 2 /* Source is Guaranteed BW request */
626#define IIO_ICRB_IO_REQ 3 /* Source is Normal IO request */
627
628/*
629 * Values for field imsgtype
630 */
631#define IIO_ICRB_IMSGT_XTALK 0 /* Incoming Message from Xtalk */
632#define IIO_ICRB_IMSGT_BTE 1 /* Incoming message from BTE */
633#define IIO_ICRB_IMSGT_SN0NET 2 /* Incoming message from SN0 net */
634#define IIO_ICRB_IMSGT_CRB 3 /* Incoming message from CRB ??? */
635
636/*
637 * values for field initiator.
638 */
639#define IIO_ICRB_INIT_XTALK 0 /* Message originated in xtalk */
640#define IIO_ICRB_INIT_BTE0 0x1 /* Message originated in BTE 0 */
641#define IIO_ICRB_INIT_SN0NET 0x2 /* Message originated in SN0net */
642#define IIO_ICRB_INIT_CRB 0x3 /* Message originated in CRB ? */
643#define IIO_ICRB_INIT_BTE1 0x5 /* MEssage originated in BTE 1 */
644
645/*
646 * Values for field reqtype.
647 */
648/* XXX - Need to fix this for Hub 2 */
649#define IIO_ICRB_REQ_DWRD 0 /* Request type double word */
650#define IIO_ICRB_REQ_QCLRD 1 /* Request is Qrtr Caceh line Rd */
651#define IIO_ICRB_REQ_BLKRD 2 /* Request is block read */
652#define IIO_ICRB_REQ_RSHU 6 /* Request is BTE block read */
653#define IIO_ICRB_REQ_REXU 7 /* request is BTE Excl Read */
654#define IIO_ICRB_REQ_RDEX 8 /* Request is Read Exclusive */
655#define IIO_ICRB_REQ_WINC 9 /* Request is Write Invalidate */
656#define IIO_ICRB_REQ_BWINV 10 /* Request is BTE Winv */
657#define IIO_ICRB_REQ_PIORD 11 /* Request is PIO read */
658#define IIO_ICRB_REQ_PIOWR 12 /* Request is PIO Write */
659#define IIO_ICRB_REQ_PRDM 13 /* Request is Fetch&Op */
660#define IIO_ICRB_REQ_PWRM 14 /* Request is Store &Op */
661#define IIO_ICRB_REQ_PTPWR 15 /* Request is Peer to peer */
662#define IIO_ICRB_REQ_WB 16 /* Request is Write back */
663#define IIO_ICRB_REQ_DEX 17 /* Retained DEX Cache line */
664
665/*
666 * Fields in CRB Register C
667 */
668
669#ifndef __ASSEMBLY__
670
671typedef union icrbc_s {
672 u64 reg_value;
673 struct {
674 u64 rsvd: 6,
675 sleep: 1,
676 pricnt: 4, /* Priority count sent with Read req */
677 pripsc: 4, /* Priority Pre scalar */
678 bteop: 1, /* BTE Operation */
679 push_be: 34, /* Push address Byte enable
680 * Holds push addr, if CRB is for BTE
681 * If CRB belongs to Partial cache,
682 * this contains byte enables bits
683 * ([47:46] = 0)
684 */
685 suppl: 11, /* Supplemental field */
686 barrop: 1, /* Barrier Op bit set in xtalk req */
687 doresp: 1, /* Xtalk req needs a response */
688 gbr: 1; /* GBR bit set in xtalk packet */
689 } icrbc_field_s;
690} icrbc_t;
691
692#define c_pricnt icrbc_field_s.pricnt
693#define c_pripsc icrbc_field_s.pripsc
694#define c_bteop icrbc_field_s.bteop
695#define c_bteaddr icrbc_field_s.push_be /* push_be field has 2 names */
696#define c_benable icrbc_field_s.push_be /* push_be field has 2 names */
697#define c_suppl icrbc_field_s.suppl
698#define c_barrop icrbc_field_s.barrop
699#define c_doresp icrbc_field_s.doresp
700#define c_gbr icrbc_field_s.gbr
701#endif /* !__ASSEMBLY__ */
702
703/*
704 * Fields in CRB Register D
705 */
706
707#ifndef __ASSEMBLY__
708typedef union icrbd_s {
709 u64 reg_value;
710 struct {
711 u64 rsvd: 38,
712 toutvld: 1, /* Timeout in progress for this CRB */
713 ctxtvld: 1, /* Context field below is valid */
714 rsvd2: 1,
715 context: 15, /* Bit vector:
716 * Has a bit set for each CRB entry
717 * which needs to be deallocated
718 * before this CRB entry is processed.
719 * Set only for barrier operations.
720 */
721 timeout: 8; /* Timeout Upper 8 bits */
722 } icrbd_field_s;
723} icrbd_t;
724
725#define icrbd_toutvld icrbd_field_s.toutvld
726#define icrbd_ctxtvld icrbd_field_s.ctxtvld
727#define icrbd_context icrbd_field_s.context
728
729
730typedef union hubii_ifdr_u {
731 u64 hi_ifdr_value;
732 struct {
733 u64 ifdr_rsvd: 49,
734 ifdr_maxrp: 7,
735 ifdr_rsvd1: 1,
736 ifdr_maxrq: 7;
737 } hi_ifdr_fields;
738} hubii_ifdr_t;
739
740#endif /* !__ASSEMBLY__ */
741
742/*
743 * Hardware designed names for the BTE control registers.
744 */
745#define IIO_IBLS_0 0x410000 /* BTE length/status 0 */
746#define IIO_IBSA_0 0x410008 /* BTE source address 0 */
747#define IIO_IBDA_0 0x410010 /* BTE destination address 0 */
748#define IIO_IBCT_0 0x410018 /* BTE control/terminate 0 */
749#define IIO_IBNA_0 0x410020 /* BTE notification address 0 */
750#define IIO_IBNR_0 IIO_IBNA_0
751#define IIO_IBIA_0 0x410028 /* BTE interrupt address 0 */
752
753#define IIO_IBLS_1 0x420000 /* BTE length/status 1 */
754#define IIO_IBSA_1 0x420008 /* BTE source address 1 */
755#define IIO_IBDA_1 0x420010 /* BTE destination address 1 */
756#define IIO_IBCT_1 0x420018 /* BTE control/terminate 1 */
757#define IIO_IBNA_1 0x420020 /* BTE notification address 1 */
758#define IIO_IBNR_1 IIO_IBNA_1
759#define IIO_IBIA_1 0x420028 /* BTE interrupt address 1 */
760
761/*
762 * More miscellaneous registers
763 */
764#define IIO_IPCR 0x430000 /* Performance Control */
765#define IIO_IPPR 0x430008 /* Performance Profiling */
766
767/*
768 * IO Error Clear register bit field definitions
769 */
770#define IECLR_BTE1 (1 << 18) /* clear bte error 1 ??? */
771#define IECLR_BTE0 (1 << 17) /* clear bte error 0 ??? */
772#define IECLR_CRAZY (1 << 16) /* clear crazy bit in wstat reg */
773#define IECLR_PRB_F (1 << 15) /* clear err bit in PRB_F reg */
774#define IECLR_PRB_E (1 << 14) /* clear err bit in PRB_E reg */
775#define IECLR_PRB_D (1 << 13) /* clear err bit in PRB_D reg */
776#define IECLR_PRB_C (1 << 12) /* clear err bit in PRB_C reg */
777#define IECLR_PRB_B (1 << 11) /* clear err bit in PRB_B reg */
778#define IECLR_PRB_A (1 << 10) /* clear err bit in PRB_A reg */
779#define IECLR_PRB_9 (1 << 9) /* clear err bit in PRB_9 reg */
780#define IECLR_PRB_8 (1 << 8) /* clear err bit in PRB_8 reg */
781#define IECLR_PRB_0 (1 << 0) /* clear err bit in PRB_0 reg */
782
783/*
784 * IO PIO Read Table Entry format
785 */
786
787#ifndef __ASSEMBLY__
788
789typedef union iprte_a {
790 u64 entry;
791 struct {
792 u64 rsvd1 : 7, /* Reserved field */
793 valid : 1, /* Maps to a timeout entry */
794 rsvd2 : 1,
795 srcnode : 9, /* Node which did this PIO */
796 initiator : 2, /* If T5A or T5B or IO */
797 rsvd3 : 3,
798 addr : 38, /* Physical address of PIO */
799 rsvd4 : 3;
800 } iprte_fields;
801} iprte_a_t;
802
803#define iprte_valid iprte_fields.valid
804#define iprte_timeout iprte_fields.timeout
805#define iprte_srcnode iprte_fields.srcnode
806#define iprte_init iprte_fields.initiator
807#define iprte_addr iprte_fields.addr
808
809#endif /* !__ASSEMBLY__ */
810
811#define IPRTE_ADDRSHFT 3
812
813/*
814 * Hub IIO PRB Register format.
815 */
816
817#ifndef __ASSEMBLY__
818/*
819 * Note: Fields bnakctr, anakctr, xtalkctrmode, ovflow fields are
820 * "Status" fields, and should only be used in case of clean up after errors.
821 */
822
823typedef union iprb_u {
824 u64 reg_value;
825 struct {
826 u64 rsvd1: 15,
827 error: 1, /* Widget rcvd wr resp pkt w/ error */
828 ovflow: 5, /* Overflow count. perf measurement */
829 fire_and_forget: 1, /* Launch Write without response */
830 mode: 2, /* Widget operation Mode */
831 rsvd2: 2,
832 bnakctr: 14,
833 rsvd3: 2,
834 anakctr: 14,
835 xtalkctr: 8;
836 } iprb_fields_s;
837} iprb_t;
838
839#define iprb_regval reg_value
840
841#define iprb_error iprb_fields_s.error
842#define iprb_ovflow iprb_fields_s.ovflow
843#define iprb_ff iprb_fields_s.fire_and_forget
844#define iprb_mode iprb_fields_s.mode
845#define iprb_bnakctr iprb_fields_s.bnakctr
846#define iprb_anakctr iprb_fields_s.anakctr
847#define iprb_xtalkctr iprb_fields_s.xtalkctr
848
849#endif /* !__ASSEMBLY__ */
850
851/*
852 * values for mode field in iprb_t.
853 * For details of the meanings of NAK and Accept, refer the PIO flow
854 * document
855 */
856#define IPRB_MODE_NORMAL (0)
857#define IPRB_MODE_COLLECT_A (1) /* PRB in collect A mode */
858#define IPRB_MODE_SERVICE_A (2) /* NAK B and Accept A */
859#define IPRB_MODE_SERVICE_B (3) /* NAK A and Accept B */
860
861/*
862 * IO CRB entry C_A to E_A : Partial (cache) CRBS
863 */
864#ifndef __ASSEMBLY__
865typedef union icrbp_a {
866 u64 ip_reg; /* the entire register value */
867 struct {
868 u64 error: 1, /* 63, error occurred */
869 ln_uce: 1, /* 62: uncorrectable memory */
870 ln_ae: 1, /* 61: protection violation */
871 ln_werr:1, /* 60: write access error */
872 ln_aerr:1, /* 59: sn0net: Address error */
873 ln_perr:1, /* 58: sn0net: poison error */
874 timeout:1, /* 57: CRB timed out */
875 l_bdpkt:1, /* 56: truncated pkt on sn0net */
876 c_bdpkt:1, /* 55: truncated pkt on xtalk */
877 c_err: 1, /* 54: incoming xtalk req, err set*/
878 rsvd1: 12, /* 53-42: reserved */
879 valid: 1, /* 41: Valid status */
880 sidn: 4, /* 40-37: SIDN field of xtalk rqst */
881 tnum: 5, /* 36-32: TNUM of xtalk request */
882 bo: 1, /* 31: barrier op set in xtalk rqst*/
883 resprqd:1, /* 30: xtalk rqst requires response*/
884 gbr: 1, /* 29: gbr bit set in xtalk rqst */
885 size: 2, /* 28-27: size of xtalk request */
886 excl: 4, /* 26-23: exclusive bit(s) */
887 stall: 3, /* 22-20: stall (xtalk, bte 0/1) */
888 intvn: 1, /* 19: rqst target of intervention*/
889 resp: 1, /* 18: Data response given to t5 */
890 ack: 1, /* 17: Data ack received. */
891 hold: 1, /* 16: crb gathering invalidate acks*/
892 wb: 1, /* 15: writeback pending. */
893 ack_cnt:11, /* 14-04: counter of invalidate acks*/
894 tscaler:4; /* 03-00: Timeout prescaler */
895 } ip_fmt;
896} icrbp_a_t;
897
898#endif /* !__ASSEMBLY__ */
899
900/*
901 * A couple of defines to go with the above structure.
902 */
903#define ICRBP_A_CERR_SHFT 54
904#define ICRBP_A_ERR_MASK 0x3ff
905
906#ifndef __ASSEMBLY__
907typedef union hubii_idsr {
908 u64 iin_reg;
909 struct {
910 u64 rsvd1 : 35,
911 isent : 1,
912 rsvd2 : 3,
913 ienable: 1,
914 rsvd : 7,
915 node : 9,
916 rsvd4 : 1,
917 level : 7;
918 } iin_fmt;
919} hubii_idsr_t;
920#endif /* !__ASSEMBLY__ */
921
922/*
923 * IO BTE Length/Status (IIO_IBLS) register bit field definitions
924 */
925#define IBLS_BUSY (0x1 << 20)
926#define IBLS_ERROR_SHFT 16
927#define IBLS_ERROR (0x1 << IBLS_ERROR_SHFT)
928#define IBLS_LENGTH_MASK 0xffff
929
930/*
931 * IO BTE Control/Terminate register (IBCT) register bit field definitions
932 */
933#define IBCT_POISON (0x1 << 8)
934#define IBCT_NOTIFY (0x1 << 4)
935#define IBCT_ZFIL_MODE (0x1 << 0)
936
937/*
938 * IO BTE Interrupt Address Register (IBIA) register bit field definitions
939 */
940#define IBIA_LEVEL_SHFT 16
941#define IBIA_LEVEL_MASK (0x7f << IBIA_LEVEL_SHFT)
942#define IBIA_NODE_ID_SHFT 0
943#define IBIA_NODE_ID_MASK (0x1ff)
944
945/*
946 * Miscellaneous hub constants
947 */
948
949/* Number of widgets supported by hub */
950#define HUB_NUM_WIDGET 9
951#define HUB_WIDGET_ID_MIN 0x8
952#define HUB_WIDGET_ID_MAX 0xf
953
954#define HUB_WIDGET_PART_NUM 0xc101
955#define MAX_HUBS_PER_XBOW 2
956
957/*
958 * Get a hub's widget id from widget control register
959 */
960#define IIO_WCR_WID_GET(nasid) (REMOTE_HUB_L(nasid, III_WCR) & 0xf)
961#define IIO_WST_ERROR_MASK (UINT64_CAST 1 << 32) /* Widget status error */
962
963/*
964 * Number of credits Hub widget has while sending req/response to
965 * xbow.
966 * Value of 3 is required by Xbow 1.1
967 * We may be able to increase this to 4 with Xbow 1.2.
968 */
969#define HUBII_XBOW_CREDIT 3
970#define HUBII_XBOW_REV2_CREDIT 4
971
972#endif /* _ASM_SGI_SN_SN0_HUBIO_H */
diff --git a/arch/mips/include/asm/sn/sn0/hubmd.h b/arch/mips/include/asm/sn/sn0/hubmd.h
new file mode 100644
index 000000000..305d002be
--- /dev/null
+++ b/arch/mips/include/asm/sn/sn0/hubmd.h
@@ -0,0 +1,789 @@
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
15/*
16 * Hub Memory/Directory interface registers
17 */
18#define CACHE_SLINE_SIZE 128 /* Secondary cache line size on SN0 */
19
20#define MAX_REGIONS 64
21
22/* Hardware page size and shift */
23
24#define MD_PAGE_SIZE 4096 /* Page size in bytes */
25#define MD_PAGE_NUM_SHFT 12 /* Address to page number shift */
26
27/* Register offsets from LOCAL_HUB or REMOTE_HUB */
28
29#define MD_BASE 0x200000
30#define MD_BASE_PERF 0x210000
31#define MD_BASE_JUNK 0x220000
32
33#define MD_IO_PROTECT 0x200000 /* MD and core register protection */
34#define MD_IO_PROT_OVRRD 0x200008 /* Clear my bit in MD_IO_PROTECT */
35#define MD_HSPEC_PROTECT 0x200010 /* BDDIR, LBOOT, RBOOT protection */
36#define MD_MEMORY_CONFIG 0x200018 /* Memory/Directory DIMM control */
37#define MD_REFRESH_CONTROL 0x200020 /* Memory/Directory refresh ctrl */
38#define MD_FANDOP_CAC_STAT 0x200028 /* Fetch-and-op cache status */
39#define MD_MIG_DIFF_THRESH 0x200030 /* Page migr. count diff thresh. */
40#define MD_MIG_VALUE_THRESH 0x200038 /* Page migr. count abs. thresh. */
41#define MD_MIG_CANDIDATE 0x200040 /* Latest page migration candidate */
42#define MD_MIG_CANDIDATE_CLR 0x200048 /* Clear page migration candidate */
43#define MD_DIR_ERROR 0x200050 /* Directory DIMM error */
44#define MD_DIR_ERROR_CLR 0x200058 /* Directory DIMM error clear */
45#define MD_PROTOCOL_ERROR 0x200060 /* Directory protocol error */
46#define MD_PROTOCOL_ERROR_CLR 0x200068 /* Directory protocol error clear */
47#define MD_MEM_ERROR 0x200070 /* Memory DIMM error */
48#define MD_MEM_ERROR_CLR 0x200078 /* Memory DIMM error clear */
49#define MD_MISC_ERROR 0x200080 /* Miscellaneous MD error */
50#define MD_MISC_ERROR_CLR 0x200088 /* Miscellaneous MD error clear */
51#define MD_MEM_DIMM_INIT 0x200090 /* Memory DIMM mode initization. */
52#define MD_DIR_DIMM_INIT 0x200098 /* Directory DIMM mode init. */
53#define MD_MOQ_SIZE 0x2000a0 /* MD outgoing queue size */
54#define MD_MLAN_CTL 0x2000a8 /* NIC (Microlan) control register */
55
56#define MD_PERF_SEL 0x210000 /* Select perf monitor events */
57#define MD_PERF_CNT0 0x210010 /* Performance counter 0 */
58#define MD_PERF_CNT1 0x210018 /* Performance counter 1 */
59#define MD_PERF_CNT2 0x210020 /* Performance counter 2 */
60#define MD_PERF_CNT3 0x210028 /* Performance counter 3 */
61#define MD_PERF_CNT4 0x210030 /* Performance counter 4 */
62#define MD_PERF_CNT5 0x210038 /* Performance counter 5 */
63
64#define MD_UREG0_0 0x220000 /* uController/UART 0 register */
65#define MD_UREG0_1 0x220008 /* uController/UART 0 register */
66#define MD_UREG0_2 0x220010 /* uController/UART 0 register */
67#define MD_UREG0_3 0x220018 /* uController/UART 0 register */
68#define MD_UREG0_4 0x220020 /* uController/UART 0 register */
69#define MD_UREG0_5 0x220028 /* uController/UART 0 register */
70#define MD_UREG0_6 0x220030 /* uController/UART 0 register */
71#define MD_UREG0_7 0x220038 /* uController/UART 0 register */
72
73#define MD_SLOTID_USTAT 0x220048 /* Hub slot ID & UART/uCtlr status */
74#define MD_LED0 0x220050 /* Eight-bit LED for CPU A */
75#define MD_LED1 0x220058 /* Eight-bit LED for CPU B */
76
77#define MD_UREG1_0 0x220080 /* uController/UART 1 register */
78#define MD_UREG1_1 0x220088 /* uController/UART 1 register */
79#define MD_UREG1_2 0x220090 /* uController/UART 1 register */
80#define MD_UREG1_3 0x220098 /* uController/UART 1 register */
81#define MD_UREG1_4 0x2200a0 /* uController/UART 1 register */
82#define MD_UREG1_5 0x2200a8 /* uController/UART 1 register */
83#define MD_UREG1_6 0x2200b0 /* uController/UART 1 register */
84#define MD_UREG1_7 0x2200b8 /* uController/UART 1 register */
85#define MD_UREG1_8 0x2200c0 /* uController/UART 1 register */
86#define MD_UREG1_9 0x2200c8 /* uController/UART 1 register */
87#define MD_UREG1_10 0x2200d0 /* uController/UART 1 register */
88#define MD_UREG1_11 0x2200d8 /* uController/UART 1 register */
89#define MD_UREG1_12 0x2200e0 /* uController/UART 1 register */
90#define MD_UREG1_13 0x2200e8 /* uController/UART 1 register */
91#define MD_UREG1_14 0x2200f0 /* uController/UART 1 register */
92#define MD_UREG1_15 0x2200f8 /* uController/UART 1 register */
93
94#ifdef CONFIG_SGI_SN_N_MODE
95#define MD_MEM_BANKS 4 /* 4 banks of memory max in N mode */
96#else
97#define MD_MEM_BANKS 8 /* 8 banks of memory max in M mode */
98#endif
99
100/*
101 * MD_MEMORY_CONFIG fields
102 *
103 * MD_SIZE_xxx are useful for representing the size of a SIMM or bank
104 * (SIMM pair). They correspond to the values needed for the bit
105 * triplets (MMC_BANK_MASK) in the MD_MEMORY_CONFIG register for bank size.
106 * Bits not used by the MD are used by software.
107 */
108
109#define MD_SIZE_EMPTY 0 /* Valid in MEMORY_CONFIG */
110#define MD_SIZE_8MB 1
111#define MD_SIZE_16MB 2
112#define MD_SIZE_32MB 3 /* Broken in Hub 1 */
113#define MD_SIZE_64MB 4 /* Valid in MEMORY_CONFIG */
114#define MD_SIZE_128MB 5 /* Valid in MEMORY_CONFIG */
115#define MD_SIZE_256MB 6
116#define MD_SIZE_512MB 7 /* Valid in MEMORY_CONFIG */
117#define MD_SIZE_1GB 8
118#define MD_SIZE_2GB 9
119#define MD_SIZE_4GB 10
120
121#define MD_SIZE_BYTES(size) ((size) == 0 ? 0 : 0x400000L << (size))
122#define MD_SIZE_MBYTES(size) ((size) == 0 ? 0 : 4 << (size))
123
124#define MMC_FPROM_CYC_SHFT 49 /* Have to use UINT64_CAST, instead */
125#define MMC_FPROM_CYC_MASK (UINT64_CAST 31 << 49) /* of 'L' suffix, */
126#define MMC_FPROM_WR_SHFT 44 /* for assembler */
127#define MMC_FPROM_WR_MASK (UINT64_CAST 31 << 44)
128#define MMC_UCTLR_CYC_SHFT 39
129#define MMC_UCTLR_CYC_MASK (UINT64_CAST 31 << 39)
130#define MMC_UCTLR_WR_SHFT 34
131#define MMC_UCTLR_WR_MASK (UINT64_CAST 31 << 34)
132#define MMC_DIMM0_SEL_SHFT 32
133#define MMC_DIMM0_SEL_MASK (UINT64_CAST 3 << 32)
134#define MMC_IO_PROT_EN_SHFT 31
135#define MMC_IO_PROT_EN_MASK (UINT64_CAST 1 << 31)
136#define MMC_IO_PROT (UINT64_CAST 1 << 31)
137#define MMC_ARB_MLSS_SHFT 30
138#define MMC_ARB_MLSS_MASK (UINT64_CAST 1 << 30)
139#define MMC_ARB_MLSS (UINT64_CAST 1 << 30)
140#define MMC_IGNORE_ECC_SHFT 29
141#define MMC_IGNORE_ECC_MASK (UINT64_CAST 1 << 29)
142#define MMC_IGNORE_ECC (UINT64_CAST 1 << 29)
143#define MMC_DIR_PREMIUM_SHFT 28
144#define MMC_DIR_PREMIUM_MASK (UINT64_CAST 1 << 28)
145#define MMC_DIR_PREMIUM (UINT64_CAST 1 << 28)
146#define MMC_REPLY_GUAR_SHFT 24
147#define MMC_REPLY_GUAR_MASK (UINT64_CAST 15 << 24)
148#define MMC_BANK_SHFT(_b) ((_b) * 3)
149#define MMC_BANK_MASK(_b) (UINT64_CAST 7 << MMC_BANK_SHFT(_b))
150#define MMC_BANK_ALL_MASK 0xffffff
151#define MMC_RESET_DEFAULTS (UINT64_CAST 0x0f << MMC_FPROM_CYC_SHFT | \
152 UINT64_CAST 0x07 << MMC_FPROM_WR_SHFT | \
153 UINT64_CAST 0x1f << MMC_UCTLR_CYC_SHFT | \
154 UINT64_CAST 0x0f << MMC_UCTLR_WR_SHFT | \
155 MMC_IGNORE_ECC | MMC_DIR_PREMIUM | \
156 UINT64_CAST 0x0f << MMC_REPLY_GUAR_SHFT | \
157 MMC_BANK_ALL_MASK)
158
159/* MD_REFRESH_CONTROL fields */
160
161#define MRC_ENABLE_SHFT 63
162#define MRC_ENABLE_MASK (UINT64_CAST 1 << 63)
163#define MRC_ENABLE (UINT64_CAST 1 << 63)
164#define MRC_COUNTER_SHFT 12
165#define MRC_COUNTER_MASK (UINT64_CAST 0xfff << 12)
166#define MRC_CNT_THRESH_MASK 0xfff
167#define MRC_RESET_DEFAULTS (UINT64_CAST 0x400)
168
169/* MD_MEM_DIMM_INIT and MD_DIR_DIMM_INIT fields */
170
171#define MDI_SELECT_SHFT 32
172#define MDI_SELECT_MASK (UINT64_CAST 0x0f << 32)
173#define MDI_DIMM_MODE_MASK (UINT64_CAST 0xfff)
174
175/* MD_MOQ_SIZE fields */
176
177#define MMS_RP_SIZE_SHFT 8
178#define MMS_RP_SIZE_MASK (UINT64_CAST 0x3f << 8)
179#define MMS_RQ_SIZE_SHFT 0
180#define MMS_RQ_SIZE_MASK (UINT64_CAST 0x1f)
181#define MMS_RESET_DEFAULTS (0x32 << 8 | 0x12)
182
183/* MD_FANDOP_CAC_STAT fields */
184
185#define MFC_VALID_SHFT 63
186#define MFC_VALID_MASK (UINT64_CAST 1 << 63)
187#define MFC_VALID (UINT64_CAST 1 << 63)
188#define MFC_ADDR_SHFT 6
189#define MFC_ADDR_MASK (UINT64_CAST 0x3ffffff)
190
191/* MD_MLAN_CTL fields */
192
193#define MLAN_PHI1_SHFT 27
194#define MLAN_PHI1_MASK (UINT64_CAST 0x7f << 27)
195#define MLAN_PHI0_SHFT 20
196#define MLAN_PHI0_MASK (UINT64_CAST 0x7f << 27)
197#define MLAN_PULSE_SHFT 10
198#define MLAN_PULSE_MASK (UINT64_CAST 0x3ff << 10)
199#define MLAN_SAMPLE_SHFT 2
200#define MLAN_SAMPLE_MASK (UINT64_CAST 0xff << 2)
201#define MLAN_DONE_SHFT 1
202#define MLAN_DONE_MASK 2
203#define MLAN_DONE (UINT64_CAST 0x02)
204#define MLAN_RD_DATA (UINT64_CAST 0x01)
205#define MLAN_RESET_DEFAULTS (UINT64_CAST 0x31 << MLAN_PHI1_SHFT | \
206 UINT64_CAST 0x31 << MLAN_PHI0_SHFT)
207
208/* MD_SLOTID_USTAT bit definitions */
209
210#define MSU_CORECLK_TST_SHFT 7 /* You don't wanna know */
211#define MSU_CORECLK_TST_MASK (UINT64_CAST 1 << 7)
212#define MSU_CORECLK_TST (UINT64_CAST 1 << 7)
213#define MSU_CORECLK_SHFT 6 /* You don't wanna know */
214#define MSU_CORECLK_MASK (UINT64_CAST 1 << 6)
215#define MSU_CORECLK (UINT64_CAST 1 << 6)
216#define MSU_NETSYNC_SHFT 5 /* You don't wanna know */
217#define MSU_NETSYNC_MASK (UINT64_CAST 1 << 5)
218#define MSU_NETSYNC (UINT64_CAST 1 << 5)
219#define MSU_FPROMRDY_SHFT 4 /* Flash PROM ready bit */
220#define MSU_FPROMRDY_MASK (UINT64_CAST 1 << 4)
221#define MSU_FPROMRDY (UINT64_CAST 1 << 4)
222#define MSU_I2CINTR_SHFT 3 /* I2C interrupt bit */
223#define MSU_I2CINTR_MASK (UINT64_CAST 1 << 3)
224#define MSU_I2CINTR (UINT64_CAST 1 << 3)
225#define MSU_SLOTID_MASK 0xff
226#define MSU_SN0_SLOTID_SHFT 0 /* Slot ID */
227#define MSU_SN0_SLOTID_MASK (UINT64_CAST 7)
228#define MSU_SN00_SLOTID_SHFT 7
229#define MSU_SN00_SLOTID_MASK (UINT64_CAST 0x80)
230
231#define MSU_PIMM_PSC_SHFT 4
232#define MSU_PIMM_PSC_MASK (0xf << MSU_PIMM_PSC_SHFT)
233
234/* MD_MIG_DIFF_THRESH bit definitions */
235
236#define MD_MIG_DIFF_THRES_VALID_MASK (UINT64_CAST 0x1 << 63)
237#define MD_MIG_DIFF_THRES_VALID_SHFT 63
238#define MD_MIG_DIFF_THRES_VALUE_MASK (UINT64_CAST 0xfffff)
239
240/* MD_MIG_VALUE_THRESH bit definitions */
241
242#define MD_MIG_VALUE_THRES_VALID_MASK (UINT64_CAST 0x1 << 63)
243#define MD_MIG_VALUE_THRES_VALID_SHFT 63
244#define MD_MIG_VALUE_THRES_VALUE_MASK (UINT64_CAST 0xfffff)
245
246/* MD_MIG_CANDIDATE bit definitions */
247
248#define MD_MIG_CANDIDATE_VALID_MASK (UINT64_CAST 0x1 << 63)
249#define MD_MIG_CANDIDATE_VALID_SHFT 63
250#define MD_MIG_CANDIDATE_TYPE_MASK (UINT64_CAST 0x1 << 30)
251#define MD_MIG_CANDIDATE_TYPE_SHFT 30
252#define MD_MIG_CANDIDATE_OVERRUN_MASK (UINT64_CAST 0x1 << 29)
253#define MD_MIG_CANDIDATE_OVERRUN_SHFT 29
254#define MD_MIG_CANDIDATE_INITIATOR_MASK (UINT64_CAST 0x7ff << 18)
255#define MD_MIG_CANDIDATE_INITIATOR_SHFT 18
256#define MD_MIG_CANDIDATE_NODEID_MASK (UINT64_CAST 0x1ff << 20)
257#define MD_MIG_CANDIDATE_NODEID_SHFT 20
258#define MD_MIG_CANDIDATE_ADDR_MASK (UINT64_CAST 0x3ffff)
259#define MD_MIG_CANDIDATE_ADDR_SHFT 14 /* The address starts at bit 14 */
260
261/* Other MD definitions */
262
263#define MD_BANK_SHFT 29 /* log2(512 MB) */
264#define MD_BANK_MASK (UINT64_CAST 7 << 29)
265#define MD_BANK_SIZE (UINT64_CAST 1 << MD_BANK_SHFT) /* 512 MB */
266#define MD_BANK_OFFSET(_b) (UINT64_CAST (_b) << MD_BANK_SHFT)
267
268/*
269 * The following definitions cover the bit field definitions for the
270 * various MD registers. For multi-bit registers, we define both
271 * a shift amount and a mask value. By convention, if you want to
272 * isolate a field, you should mask the field and then shift it down,
273 * since this makes the masks useful without a shift.
274 */
275
276/* Directory entry states for both premium and standard SIMMs. */
277
278#define MD_DIR_SHARED (UINT64_CAST 0x0) /* 000 */
279#define MD_DIR_POISONED (UINT64_CAST 0x1) /* 001 */
280#define MD_DIR_EXCLUSIVE (UINT64_CAST 0x2) /* 010 */
281#define MD_DIR_BUSY_SHARED (UINT64_CAST 0x3) /* 011 */
282#define MD_DIR_BUSY_EXCL (UINT64_CAST 0x4) /* 100 */
283#define MD_DIR_WAIT (UINT64_CAST 0x5) /* 101 */
284#define MD_DIR_UNOWNED (UINT64_CAST 0x7) /* 111 */
285
286/*
287 * The MD_DIR_FORCE_ECC bit can be added directory entry write data
288 * to forcing the ECC to be written as-is instead of recalculated.
289 */
290
291#define MD_DIR_FORCE_ECC (UINT64_CAST 1 << 63)
292
293/*
294 * Premium SIMM directory entry shifts and masks. Each is valid only in the
295 * context(s) indicated, where A, B, and C indicate the directory entry format
296 * as shown, and low and/or high indicates which double-word of the entry.
297 *
298 * Format A: STATE = shared, FINE = 1
299 * Format B: STATE = shared, FINE = 0
300 * Format C: STATE != shared (FINE must be 0)
301 */
302
303#define MD_PDIR_MASK 0xffffffffffff /* Whole entry */
304#define MD_PDIR_ECC_SHFT 0 /* ABC low or high */
305#define MD_PDIR_ECC_MASK 0x7f
306#define MD_PDIR_PRIO_SHFT 8 /* ABC low */
307#define MD_PDIR_PRIO_MASK (0xf << 8)
308#define MD_PDIR_AX_SHFT 7 /* ABC low */
309#define MD_PDIR_AX_MASK (1 << 7)
310#define MD_PDIR_AX (1 << 7)
311#define MD_PDIR_FINE_SHFT 12 /* ABC low */
312#define MD_PDIR_FINE_MASK (1 << 12)
313#define MD_PDIR_FINE (1 << 12)
314#define MD_PDIR_OCT_SHFT 13 /* A low */
315#define MD_PDIR_OCT_MASK (7 << 13)
316#define MD_PDIR_STATE_SHFT 13 /* BC low */
317#define MD_PDIR_STATE_MASK (7 << 13)
318#define MD_PDIR_ONECNT_SHFT 16 /* BC low */
319#define MD_PDIR_ONECNT_MASK (0x3f << 16)
320#define MD_PDIR_PTR_SHFT 22 /* C low */
321#define MD_PDIR_PTR_MASK (UINT64_CAST 0x7ff << 22)
322#define MD_PDIR_VECMSB_SHFT 22 /* AB low */
323#define MD_PDIR_VECMSB_BITMASK 0x3ffffff
324#define MD_PDIR_VECMSB_BITSHFT 27
325#define MD_PDIR_VECMSB_MASK (UINT64_CAST MD_PDIR_VECMSB_BITMASK << 22)
326#define MD_PDIR_CWOFF_SHFT 7 /* C high */
327#define MD_PDIR_CWOFF_MASK (7 << 7)
328#define MD_PDIR_VECLSB_SHFT 10 /* AB high */
329#define MD_PDIR_VECLSB_BITMASK (UINT64_CAST 0x3fffffffff)
330#define MD_PDIR_VECLSB_BITSHFT 0
331#define MD_PDIR_VECLSB_MASK (MD_PDIR_VECLSB_BITMASK << 10)
332
333/*
334 * Directory initialization values
335 */
336
337#define MD_PDIR_INIT_LO (MD_DIR_UNOWNED << MD_PDIR_STATE_SHFT | \
338 MD_PDIR_AX)
339#define MD_PDIR_INIT_HI 0
340#define MD_PDIR_INIT_PROT (MD_PROT_RW << MD_PPROT_IO_SHFT | \
341 MD_PROT_RW << MD_PPROT_SHFT)
342
343/*
344 * Standard SIMM directory entry shifts and masks. Each is valid only in the
345 * context(s) indicated, where A and C indicate the directory entry format
346 * as shown, and low and/or high indicates which double-word of the entry.
347 *
348 * Format A: STATE == shared
349 * Format C: STATE != shared
350 */
351
352#define MD_SDIR_MASK 0xffff /* Whole entry */
353#define MD_SDIR_ECC_SHFT 0 /* AC low or high */
354#define MD_SDIR_ECC_MASK 0x1f
355#define MD_SDIR_PRIO_SHFT 6 /* AC low */
356#define MD_SDIR_PRIO_MASK (1 << 6)
357#define MD_SDIR_AX_SHFT 5 /* AC low */
358#define MD_SDIR_AX_MASK (1 << 5)
359#define MD_SDIR_AX (1 << 5)
360#define MD_SDIR_STATE_SHFT 7 /* AC low */
361#define MD_SDIR_STATE_MASK (7 << 7)
362#define MD_SDIR_PTR_SHFT 10 /* C low */
363#define MD_SDIR_PTR_MASK (0x3f << 10)
364#define MD_SDIR_CWOFF_SHFT 5 /* C high */
365#define MD_SDIR_CWOFF_MASK (7 << 5)
366#define MD_SDIR_VECMSB_SHFT 11 /* A low */
367#define MD_SDIR_VECMSB_BITMASK 0x1f
368#define MD_SDIR_VECMSB_BITSHFT 7
369#define MD_SDIR_VECMSB_MASK (MD_SDIR_VECMSB_BITMASK << 11)
370#define MD_SDIR_VECLSB_SHFT 5 /* A high */
371#define MD_SDIR_VECLSB_BITMASK 0x7ff
372#define MD_SDIR_VECLSB_BITSHFT 0
373#define MD_SDIR_VECLSB_MASK (MD_SDIR_VECLSB_BITMASK << 5)
374
375/*
376 * Directory initialization values
377 */
378
379#define MD_SDIR_INIT_LO (MD_DIR_UNOWNED << MD_SDIR_STATE_SHFT | \
380 MD_SDIR_AX)
381#define MD_SDIR_INIT_HI 0
382#define MD_SDIR_INIT_PROT (MD_PROT_RW << MD_SPROT_SHFT)
383
384/* Protection and migration field values */
385
386#define MD_PROT_RW (UINT64_CAST 0x6)
387#define MD_PROT_RO (UINT64_CAST 0x3)
388#define MD_PROT_NO (UINT64_CAST 0x0)
389#define MD_PROT_BAD (UINT64_CAST 0x5)
390
391/* Premium SIMM protection entry shifts and masks. */
392
393#define MD_PPROT_SHFT 0 /* Prot. field */
394#define MD_PPROT_MASK 7
395#define MD_PPROT_MIGMD_SHFT 3 /* Migration mode */
396#define MD_PPROT_MIGMD_MASK (3 << 3)
397#define MD_PPROT_REFCNT_SHFT 5 /* Reference count */
398#define MD_PPROT_REFCNT_WIDTH 0x7ffff
399#define MD_PPROT_REFCNT_MASK (MD_PPROT_REFCNT_WIDTH << 5)
400
401#define MD_PPROT_IO_SHFT 45 /* I/O Prot field */
402#define MD_PPROT_IO_MASK (UINT64_CAST 7 << 45)
403
404/* Standard SIMM protection entry shifts and masks. */
405
406#define MD_SPROT_SHFT 0 /* Prot. field */
407#define MD_SPROT_MASK 7
408#define MD_SPROT_MIGMD_SHFT 3 /* Migration mode */
409#define MD_SPROT_MIGMD_MASK (3 << 3)
410#define MD_SPROT_REFCNT_SHFT 5 /* Reference count */
411#define MD_SPROT_REFCNT_WIDTH 0x7ff
412#define MD_SPROT_REFCNT_MASK (MD_SPROT_REFCNT_WIDTH << 5)
413
414/* Migration modes used in protection entries */
415
416#define MD_PROT_MIGMD_IREL (UINT64_CAST 0x3 << 3)
417#define MD_PROT_MIGMD_IABS (UINT64_CAST 0x2 << 3)
418#define MD_PROT_MIGMD_PREL (UINT64_CAST 0x1 << 3)
419#define MD_PROT_MIGMD_OFF (UINT64_CAST 0x0 << 3)
420
421
422/*
423 * Operations on page migration threshold register
424 */
425
426#ifndef __ASSEMBLY__
427
428/*
429 * LED register macros
430 */
431
432#define CPU_LED_ADDR(_nasid, _slice) \
433 (private.p_sn00 ? \
434 REMOTE_HUB_ADDR((_nasid), MD_UREG1_0 + ((_slice) << 5)) : \
435 REMOTE_HUB_ADDR((_nasid), MD_LED0 + ((_slice) << 3)))
436
437#define SET_CPU_LEDS(_nasid, _slice, _val) \
438 (HUB_S(CPU_LED_ADDR(_nasid, _slice), (_val)))
439
440#define SET_MY_LEDS(_v) \
441 SET_CPU_LEDS(get_nasid(), get_slice(), (_v))
442
443/*
444 * Operations on Memory/Directory DIMM control register
445 */
446
447#define DIRTYPE_PREMIUM 1
448#define DIRTYPE_STANDARD 0
449#define MD_MEMORY_CONFIG_DIR_TYPE_GET(region) (\
450 (REMOTE_HUB_L(region, MD_MEMORY_CONFIG) & MMC_DIR_PREMIUM_MASK) >> \
451 MMC_DIR_PREMIUM_SHFT)
452
453
454/*
455 * Operations on page migration count difference and absolute threshold
456 * registers
457 */
458
459#define MD_MIG_DIFF_THRESH_GET(region) ( \
460 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) & \
461 MD_MIG_DIFF_THRES_VALUE_MASK)
462
463#define MD_MIG_DIFF_THRESH_SET(region, value) ( \
464 REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH, \
465 MD_MIG_DIFF_THRES_VALID_MASK | (value)))
466
467#define MD_MIG_DIFF_THRESH_DISABLE(region) ( \
468 REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH, \
469 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) \
470 & ~MD_MIG_DIFF_THRES_VALID_MASK))
471
472#define MD_MIG_DIFF_THRESH_ENABLE(region) ( \
473 REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH, \
474 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) \
475 | MD_MIG_DIFF_THRES_VALID_MASK))
476
477#define MD_MIG_DIFF_THRESH_IS_ENABLED(region) ( \
478 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) & \
479 MD_MIG_DIFF_THRES_VALID_MASK)
480
481#define MD_MIG_VALUE_THRESH_GET(region) ( \
482 REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) & \
483 MD_MIG_VALUE_THRES_VALUE_MASK)
484
485#define MD_MIG_VALUE_THRESH_SET(region, value) ( \
486 REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH, \
487 MD_MIG_VALUE_THRES_VALID_MASK | (value)))
488
489#define MD_MIG_VALUE_THRESH_DISABLE(region) ( \
490 REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH, \
491 REMOTE_HUB_L(region, MD_MIG_VALUE_THRESH) \
492 & ~MD_MIG_VALUE_THRES_VALID_MASK))
493
494#define MD_MIG_VALUE_THRESH_ENABLE(region) ( \
495 REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH, \
496 REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) \
497 | MD_MIG_VALUE_THRES_VALID_MASK))
498
499#define MD_MIG_VALUE_THRESH_IS_ENABLED(region) ( \
500 REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) & \
501 MD_MIG_VALUE_THRES_VALID_MASK)
502
503/*
504 * Operations on page migration candidate register
505 */
506
507#define MD_MIG_CANDIDATE_GET(my_region_id) ( \
508 REMOTE_HUB_L((my_region_id), MD_MIG_CANDIDATE_CLR))
509
510#define MD_MIG_CANDIDATE_HWPFN(value) ((value) & MD_MIG_CANDIDATE_ADDR_MASK)
511
512#define MD_MIG_CANDIDATE_NODEID(value) ( \
513 ((value) & MD_MIG_CANDIDATE_NODEID_MASK) >> MD_MIG_CANDIDATE_NODEID_SHFT)
514
515#define MD_MIG_CANDIDATE_TYPE(value) ( \
516 ((value) & MD_MIG_CANDIDATE_TYPE_MASK) >> MD_MIG_CANDIDATE_TYPE_SHFT)
517
518#define MD_MIG_CANDIDATE_VALID(value) ( \
519 ((value) & MD_MIG_CANDIDATE_VALID_MASK) >> MD_MIG_CANDIDATE_VALID_SHFT)
520
521/*
522 * Macros to retrieve fields in the protection entry
523 */
524
525/* for Premium SIMM */
526#define MD_PPROT_REFCNT_GET(value) ( \
527 ((value) & MD_PPROT_REFCNT_MASK) >> MD_PPROT_REFCNT_SHFT)
528
529#define MD_PPROT_MIGMD_GET(value) ( \
530 ((value) & MD_PPROT_MIGMD_MASK) >> MD_PPROT_MIGMD_SHFT)
531
532/* for Standard SIMM */
533#define MD_SPROT_REFCNT_GET(value) ( \
534 ((value) & MD_SPROT_REFCNT_MASK) >> MD_SPROT_REFCNT_SHFT)
535
536#define MD_SPROT_MIGMD_GET(value) ( \
537 ((value) & MD_SPROT_MIGMD_MASK) >> MD_SPROT_MIGMD_SHFT)
538
539/*
540 * Format of dir_error, mem_error, protocol_error and misc_error registers
541 */
542
543struct dir_error_reg {
544 u64 uce_vld: 1, /* 63: valid directory uce */
545 ae_vld: 1, /* 62: valid dir prot ecc error */
546 ce_vld: 1, /* 61: valid correctable ECC err*/
547 rsvd1: 19, /* 60-42: reserved */
548 bad_prot: 3, /* 41-39: encoding, bad access rights*/
549 bad_syn: 7, /* 38-32: bad dir syndrome */
550 rsvd2: 2, /* 31-30: reserved */
551 hspec_addr:27, /* 29-03: bddir space bad entry */
552 uce_ovr: 1, /* 2: multiple dir uce's */
553 ae_ovr: 1, /* 1: multiple prot ecc errs*/
554 ce_ovr: 1; /* 0: multiple correctable errs */
555};
556
557typedef union md_dir_error {
558 u64 derr_reg; /* the entire register */
559 struct dir_error_reg derr_fmt; /* the register format */
560} md_dir_error_t;
561
562
563struct mem_error_reg {
564 u64 uce_vld: 1, /* 63: valid memory uce */
565 ce_vld: 1, /* 62: valid correctable ECC err*/
566 rsvd1: 22, /* 61-40: reserved */
567 bad_syn: 8, /* 39-32: bad mem ecc syndrome */
568 address: 29, /* 31-03: bad entry pointer */
569 rsvd2: 1, /* 2: reserved */
570 uce_ovr: 1, /* 1: multiple mem uce's */
571 ce_ovr: 1; /* 0: multiple correctable errs */
572};
573
574
575typedef union md_mem_error {
576 u64 merr_reg; /* the entire register */
577 struct mem_error_reg merr_fmt; /* format of the mem_error reg */
578} md_mem_error_t;
579
580
581struct proto_error_reg {
582 u64 valid: 1, /* 63: valid protocol error */
583 rsvd1: 2, /* 62-61: reserved */
584 initiator:11, /* 60-50: id of request initiator*/
585 backoff: 2, /* 49-48: backoff control */
586 msg_type: 8, /* 47-40: type of request */
587 access: 2, /* 39-38: access rights of initiator*/
588 priority: 1, /* 37: priority level of requestor*/
589 dir_state: 4, /* 36-33: state of directory */
590 pointer_me:1, /* 32: initiator same as dir ptr */
591 address: 29, /* 31-03: request address */
592 rsvd2: 2, /* 02-01: reserved */
593 overrun: 1; /* 0: multiple protocol errs */
594};
595
596typedef union md_proto_error {
597 u64 perr_reg; /* the entire register */
598 struct proto_error_reg perr_fmt; /* format of the register */
599} md_proto_error_t;
600
601
602struct md_sdir_high_fmt {
603 unsigned short sd_hi_bvec : 11,
604 sd_hi_ecc : 5;
605};
606
607
608typedef union md_sdir_high {
609 /* The 16 bits of standard directory, upper word */
610 unsigned short sd_hi_val;
611 struct md_sdir_high_fmt sd_hi_fmt;
612}md_sdir_high_t;
613
614
615struct md_sdir_low_shared_fmt {
616 /* The meaning of lower directory, shared */
617 unsigned short sds_lo_bvec : 5,
618 sds_lo_unused: 1,
619 sds_lo_state : 3,
620 sds_lo_prio : 1,
621 sds_lo_ax : 1,
622 sds_lo_ecc : 5;
623};
624
625struct md_sdir_low_exclusive_fmt {
626 /* The meaning of lower directory, exclusive */
627 unsigned short sde_lo_ptr : 6,
628 sde_lo_state : 3,
629 sde_lo_prio : 1,
630 sde_lo_ax : 1,
631 sde_lo_ecc : 5;
632};
633
634
635typedef union md_sdir_low {
636 /* The 16 bits of standard directory, lower word */
637 unsigned short sd_lo_val;
638 struct md_sdir_low_exclusive_fmt sde_lo_fmt;
639 struct md_sdir_low_shared_fmt sds_lo_fmt;
640}md_sdir_low_t;
641
642
643
644struct md_pdir_high_fmt {
645 u64 pd_hi_unused : 16,
646 pd_hi_bvec : 38,
647 pd_hi_unused1 : 3,
648 pd_hi_ecc : 7;
649};
650
651
652typedef union md_pdir_high {
653 /* The 48 bits of standard directory, upper word */
654 u64 pd_hi_val;
655 struct md_pdir_high_fmt pd_hi_fmt;
656}md_pdir_high_t;
657
658
659struct md_pdir_low_shared_fmt {
660 /* The meaning of lower directory, shared */
661 u64 pds_lo_unused : 16,
662 pds_lo_bvec : 26,
663 pds_lo_cnt : 6,
664 pds_lo_state : 3,
665 pds_lo_ste : 1,
666 pds_lo_prio : 4,
667 pds_lo_ax : 1,
668 pds_lo_ecc : 7;
669};
670
671struct md_pdir_low_exclusive_fmt {
672 /* The meaning of lower directory, exclusive */
673 u64 pde_lo_unused : 31,
674 pde_lo_ptr : 11,
675 pde_lo_unused1 : 6,
676 pde_lo_state : 3,
677 pde_lo_ste : 1,
678 pde_lo_prio : 4,
679 pde_lo_ax : 1,
680 pde_lo_ecc : 7;
681};
682
683
684typedef union md_pdir_loent {
685 /* The 48 bits of premium directory, lower word */
686 u64 pd_lo_val;
687 struct md_pdir_low_exclusive_fmt pde_lo_fmt;
688 struct md_pdir_low_shared_fmt pds_lo_fmt;
689}md_pdir_low_t;
690
691
692/*
693 * the following two "union" definitions and two
694 * "struct" definitions are used in vmdump.c to
695 * represent directory memory information.
696 */
697
698typedef union md_dir_high {
699 md_sdir_high_t md_sdir_high;
700 md_pdir_high_t md_pdir_high;
701} md_dir_high_t;
702
703typedef union md_dir_low {
704 md_sdir_low_t md_sdir_low;
705 md_pdir_low_t md_pdir_low;
706} md_dir_low_t;
707
708typedef struct bddir_entry {
709 md_dir_low_t md_dir_low;
710 md_dir_high_t md_dir_high;
711} bddir_entry_t;
712
713typedef struct dir_mem_entry {
714 u64 prcpf[MAX_REGIONS];
715 bddir_entry_t directory_words[MD_PAGE_SIZE/CACHE_SLINE_SIZE];
716} dir_mem_entry_t;
717
718
719
720typedef union md_perf_sel {
721 u64 perf_sel_reg;
722 struct {
723 u64 perf_rsvd : 60,
724 perf_en : 1,
725 perf_sel : 3;
726 } perf_sel_bits;
727} md_perf_sel_t;
728
729typedef union md_perf_cnt {
730 u64 perf_cnt;
731 struct {
732 u64 perf_rsvd : 44,
733 perf_cnt : 20;
734 } perf_cnt_bits;
735} md_perf_cnt_t;
736
737
738#endif /* !__ASSEMBLY__ */
739
740
741#define DIR_ERROR_VALID_MASK 0xe000000000000000
742#define DIR_ERROR_VALID_SHFT 61
743#define DIR_ERROR_VALID_UCE 0x8000000000000000
744#define DIR_ERROR_VALID_AE 0x4000000000000000
745#define DIR_ERROR_VALID_CE 0x2000000000000000
746
747#define MEM_ERROR_VALID_MASK 0xc000000000000000
748#define MEM_ERROR_VALID_SHFT 62
749#define MEM_ERROR_VALID_UCE 0x8000000000000000
750#define MEM_ERROR_VALID_CE 0x4000000000000000
751
752#define PROTO_ERROR_VALID_MASK 0x8000000000000000
753
754#define MISC_ERROR_VALID_MASK 0x3ff
755
756/*
757 * Mask for hspec address that is stored in the dir error register.
758 * This represents bits 29 through 3.
759 */
760#define DIR_ERR_HSPEC_MASK 0x3ffffff8
761#define ERROR_HSPEC_MASK 0x3ffffff8
762#define ERROR_HSPEC_SHFT 3
763#define ERROR_ADDR_MASK 0xfffffff8
764#define ERROR_ADDR_SHFT 3
765
766/*
767 * MD_MISC_ERROR register defines.
768 */
769
770#define MMCE_VALID_MASK 0x3ff
771#define MMCE_ILL_MSG_SHFT 8
772#define MMCE_ILL_MSG_MASK (UINT64_CAST 0x03 << MMCE_ILL_MSG_SHFT)
773#define MMCE_ILL_REV_SHFT 6
774#define MMCE_ILL_REV_MASK (UINT64_CAST 0x03 << MMCE_ILL_REV_SHFT)
775#define MMCE_LONG_PACK_SHFT 4
776#define MMCE_LONG_PACK_MASK (UINT64_CAST 0x03 << MMCE_lONG_PACK_SHFT)
777#define MMCE_SHORT_PACK_SHFT 2
778#define MMCE_SHORT_PACK_MASK (UINT64_CAST 0x03 << MMCE_SHORT_PACK_SHFT)
779#define MMCE_BAD_DATA_SHFT 0
780#define MMCE_BAD_DATA_MASK (UINT64_CAST 0x03 << MMCE_BAD_DATA_SHFT)
781
782
783#define MD_PERF_COUNTERS 6
784#define MD_PERF_SETS 6
785
786#define MEM_DIMM_MASK 0xe0000000
787#define MEM_DIMM_SHFT 29
788
789#endif /* _ASM_SN_SN0_HUBMD_H */
diff --git a/arch/mips/include/asm/sn/sn0/hubni.h b/arch/mips/include/asm/sn/sn0/hubni.h
new file mode 100644
index 000000000..b8253142c
--- /dev/null
+++ b/arch/mips/include/asm/sn/sn0/hubni.h
@@ -0,0 +1,263 @@
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
253static inline int get_region_shift(void)
254{
255 if (LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK)
256 return NASID_TO_FINEREG_SHFT;
257
258 return NASID_TO_COARSEREG_SHFT;
259}
260
261#endif /* !__ASSEMBLY__ */
262
263#endif /* _ASM_SGI_SN0_HUBNI_H */
diff --git a/arch/mips/include/asm/sn/sn0/hubpi.h b/arch/mips/include/asm/sn/sn0/hubpi.h
new file mode 100644
index 000000000..7b8365591
--- /dev/null
+++ b/arch/mips/include/asm/sn/sn0/hubpi.h
@@ -0,0 +1,409 @@
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/*
402 * Bits for NACK_CNT_A/B and NACK_CMP
403 */
404#define PI_NACK_CNT_EN_SHFT 20
405#define PI_NACK_CNT_EN_MASK 0x100000
406#define PI_NACK_CNT_MASK 0x0fffff
407#define PI_NACK_CNT_MAX 0x0fffff
408
409#endif /* _ASM_SN_SN0_HUBPI_H */
diff --git a/arch/mips/include/asm/sn/sn0/kldir.h b/arch/mips/include/asm/sn/sn0/kldir.h
new file mode 100644
index 000000000..1b10af6cb
--- /dev/null
+++ b/arch/mips/include/asm/sn/sn0/kldir.h
@@ -0,0 +1,186 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Derived from IRIX <sys/SN/kldir.h>, revision 1.21.
4 *
5 * Copyright (C) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc.
6 * Copyright (C) 1999, 2000 by Ralf Baechle
7 */
8#ifndef _ASM_SN_SN0_KLDIR_H
9#define _ASM_SN_SN0_KLDIR_H
10
11
12/*
13 * The kldir memory area resides at a fixed place in each node's memory and
14 * provides pointers to most other IP27 memory areas. This allows us to
15 * resize and/or relocate memory areas at a later time without breaking all
16 * firmware and kernels that use them. Indices in the array are
17 * permanently dedicated to areas listed below. Some memory areas (marked
18 * below) reside at a permanently fixed location, but are included in the
19 * directory for completeness.
20 */
21
22/*
23 * The upper portion of the memory map applies during boot
24 * only and is overwritten by IRIX/SYMMON.
25 *
26 * MEMORY MAP PER NODE
27 *
28 * 0x2000000 (32M) +-----------------------------------------+
29 * | IO6 BUFFERS FOR FLASH ENET IOC3 |
30 * 0x1F80000 (31.5M) +-----------------------------------------+
31 * | IO6 TEXT/DATA/BSS/stack |
32 * 0x1C00000 (30M) +-----------------------------------------+
33 * | IO6 PROM DEBUG TEXT/DATA/BSS/stack |
34 * 0x0800000 (28M) +-----------------------------------------+
35 * | IP27 PROM TEXT/DATA/BSS/stack |
36 * 0x1B00000 (27M) +-----------------------------------------+
37 * | IP27 CFG |
38 * 0x1A00000 (26M) +-----------------------------------------+
39 * | Graphics PROM |
40 * 0x1800000 (24M) +-----------------------------------------+
41 * | 3rd Party PROM drivers |
42 * 0x1600000 (22M) +-----------------------------------------+
43 * | |
44 * | Free |
45 * | |
46 * +-----------------------------------------+
47 * | UNIX DEBUG Version |
48 * 0x190000 (2M--) +-----------------------------------------+
49 * | SYMMON |
50 * | (For UNIX Debug only) |
51 * 0x34000 (208K) +-----------------------------------------+
52 * | SYMMON STACK [NUM_CPU_PER_NODE] |
53 * | (For UNIX Debug only) |
54 * 0x25000 (148K) +-----------------------------------------+
55 * | KLCONFIG - II (temp) |
56 * | |
57 * | ---------------------------- |
58 * | |
59 * | UNIX NON-DEBUG Version |
60 * 0x19000 (100K) +-----------------------------------------+
61 *
62 *
63 * The lower portion of the memory map contains information that is
64 * permanent and is used by the IP27PROM, IO6PROM and IRIX.
65 *
66 * 0x19000 (100K) +-----------------------------------------+
67 * | |
68 * | PI Error Spools (32K) |
69 * | |
70 * 0x12000 (72K) +-----------------------------------------+
71 * | Unused |
72 * 0x11c00 (71K) +-----------------------------------------+
73 * | CPU 1 NMI Eframe area |
74 * 0x11a00 (70.5K) +-----------------------------------------+
75 * | CPU 0 NMI Eframe area |
76 * 0x11800 (70K) +-----------------------------------------+
77 * | CPU 1 NMI Register save area |
78 * 0x11600 (69.5K) +-----------------------------------------+
79 * | CPU 0 NMI Register save area |
80 * 0x11400 (69K) +-----------------------------------------+
81 * | GDA (1k) |
82 * 0x11000 (68K) +-----------------------------------------+
83 * | Early cache Exception stack |
84 * | and/or |
85 * | kernel/io6prom nmi registers |
86 * 0x10800 (66k) +-----------------------------------------+
87 * | cache error eframe |
88 * 0x10400 (65K) +-----------------------------------------+
89 * | Exception Handlers (UALIAS copy) |
90 * 0x10000 (64K) +-----------------------------------------+
91 * | |
92 * | |
93 * | KLCONFIG - I (permanent) (48K) |
94 * | |
95 * | |
96 * | |
97 * 0x4000 (16K) +-----------------------------------------+
98 * | NMI Handler (Protected Page) |
99 * 0x3000 (12K) +-----------------------------------------+
100 * | ARCS PVECTORS (master node only) |
101 * 0x2c00 (11K) +-----------------------------------------+
102 * | ARCS TVECTORS (master node only) |
103 * 0x2800 (10K) +-----------------------------------------+
104 * | LAUNCH [NUM_CPU] |
105 * 0x2400 (9K) +-----------------------------------------+
106 * | Low memory directory (KLDIR) |
107 * 0x2000 (8K) +-----------------------------------------+
108 * | ARCS SPB (1K) |
109 * 0x1000 (4K) +-----------------------------------------+
110 * | Early cache Exception stack |
111 * | and/or |
112 * | kernel/io6prom nmi registers |
113 * 0x800 (2k) +-----------------------------------------+
114 * | cache error eframe |
115 * 0x400 (1K) +-----------------------------------------+
116 * | Exception Handlers |
117 * 0x0 (0K) +-----------------------------------------+
118 */
119
120/*
121 * This is defined here because IP27_SYMMON_STK_SIZE must be at least what
122 * we define here. Since it's set up in the prom. We can't redefine it later
123 * and expect more space to be allocated. The way to find out the true size
124 * of the symmon stacks is to divide SYMMON_STK_SIZE by SYMMON_STK_STRIDE
125 * for a particular node.
126 */
127#define SYMMON_STACK_SIZE 0x8000
128
129#if defined(PROM)
130
131/*
132 * These defines are prom version dependent. No code other than the IP27
133 * prom should attempt to use these values.
134 */
135#define IP27_LAUNCH_OFFSET 0x2400
136#define IP27_LAUNCH_SIZE 0x400
137#define IP27_LAUNCH_COUNT 2
138#define IP27_LAUNCH_STRIDE 0x200
139
140#define IP27_KLCONFIG_OFFSET 0x4000
141#define IP27_KLCONFIG_SIZE 0xc000
142#define IP27_KLCONFIG_COUNT 1
143#define IP27_KLCONFIG_STRIDE 0
144
145#define IP27_NMI_OFFSET 0x3000
146#define IP27_NMI_SIZE 0x40
147#define IP27_NMI_COUNT 2
148#define IP27_NMI_STRIDE 0x40
149
150#define IP27_PI_ERROR_OFFSET 0x12000
151#define IP27_PI_ERROR_SIZE 0x4000
152#define IP27_PI_ERROR_COUNT 1
153#define IP27_PI_ERROR_STRIDE 0
154
155#define IP27_SYMMON_STK_OFFSET 0x25000
156#define IP27_SYMMON_STK_SIZE 0xe000
157#define IP27_SYMMON_STK_COUNT 2
158/* IP27_SYMMON_STK_STRIDE must be >= SYMMON_STACK_SIZE */
159#define IP27_SYMMON_STK_STRIDE 0x7000
160
161#define IP27_FREEMEM_OFFSET 0x19000
162#define IP27_FREEMEM_SIZE -1
163#define IP27_FREEMEM_COUNT 1
164#define IP27_FREEMEM_STRIDE 0
165
166#endif /* PROM */
167/*
168 * There will be only one of these in a partition so the IO6 must set it up.
169 */
170#define IO6_GDA_OFFSET 0x11000
171#define IO6_GDA_SIZE 0x400
172#define IO6_GDA_COUNT 1
173#define IO6_GDA_STRIDE 0
174
175/*
176 * save area of kernel nmi regs in the prom format
177 */
178#define IP27_NMI_KREGS_OFFSET 0x11400
179#define IP27_NMI_KREGS_CPU_SIZE 0x200
180/*
181 * save area of kernel nmi regs in eframe format
182 */
183#define IP27_NMI_EFRAME_OFFSET 0x11800
184#define IP27_NMI_EFRAME_SIZE 0x200
185
186#endif /* _ASM_SN_SN0_KLDIR_H */
diff --git a/arch/mips/include/asm/sn/types.h b/arch/mips/include/asm/sn/types.h
new file mode 100644
index 000000000..451ba1ee4
--- /dev/null
+++ b/arch/mips/include/asm/sn/types.h
@@ -0,0 +1,25 @@
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
14#ifndef __ASSEMBLY__
15
16typedef unsigned long cpuid_t;
17typedef signed short nasid_t; /* node id in numa-as-id space */
18typedef signed char partid_t; /* partition ID type */
19typedef signed short moduleid_t; /* user-visible module number type */
20
21typedef dev_t vertex_hdl_t; /* hardware graph vertex handle */
22
23#endif
24
25#endif /* _ASM_SN_TYPES_H */
diff --git a/arch/mips/include/asm/sni.h b/arch/mips/include/asm/sni.h
new file mode 100644
index 000000000..7dfa297ce
--- /dev/null
+++ b/arch/mips/include/asm/sni.h
@@ -0,0 +1,246 @@
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 * Copyright (C) 2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */
11#ifndef __ASM_SNI_H
12#define __ASM_SNI_H
13
14#include <linux/irqreturn.h>
15
16extern unsigned int sni_brd_type;
17
18#define SNI_BRD_10 2
19#define SNI_BRD_10NEW 3
20#define SNI_BRD_TOWER_OASIC 4
21#define SNI_BRD_MINITOWER 5
22#define SNI_BRD_PCI_TOWER 6
23#define SNI_BRD_RM200 7
24#define SNI_BRD_PCI_MTOWER 8
25#define SNI_BRD_PCI_DESKTOP 9
26#define SNI_BRD_PCI_TOWER_CPLUS 10
27#define SNI_BRD_PCI_MTOWER_CPLUS 11
28
29/* RM400 cpu types */
30#define SNI_CPU_M8021 0x01
31#define SNI_CPU_M8030 0x04
32#define SNI_CPU_M8031 0x06
33#define SNI_CPU_M8034 0x0f
34#define SNI_CPU_M8037 0x07
35#define SNI_CPU_M8040 0x05
36#define SNI_CPU_M8043 0x09
37#define SNI_CPU_M8050 0x0b
38#define SNI_CPU_M8053 0x0d
39
40#define SNI_PORT_BASE CKSEG1ADDR(0xb4000000)
41
42#ifndef __MIPSEL__
43/*
44 * ASIC PCI registers for big endian configuration.
45 */
46#define PCIMT_UCONF CKSEG1ADDR(0xbfff0004)
47#define PCIMT_IOADTIMEOUT2 CKSEG1ADDR(0xbfff000c)
48#define PCIMT_IOMEMCONF CKSEG1ADDR(0xbfff0014)
49#define PCIMT_IOMMU CKSEG1ADDR(0xbfff001c)
50#define PCIMT_IOADTIMEOUT1 CKSEG1ADDR(0xbfff0024)
51#define PCIMT_DMAACCESS CKSEG1ADDR(0xbfff002c)
52#define PCIMT_DMAHIT CKSEG1ADDR(0xbfff0034)
53#define PCIMT_ERRSTATUS CKSEG1ADDR(0xbfff003c)
54#define PCIMT_ERRADDR CKSEG1ADDR(0xbfff0044)
55#define PCIMT_SYNDROME CKSEG1ADDR(0xbfff004c)
56#define PCIMT_ITPEND CKSEG1ADDR(0xbfff0054)
57#define IT_INT2 0x01
58#define IT_INTD 0x02
59#define IT_INTC 0x04
60#define IT_INTB 0x08
61#define IT_INTA 0x10
62#define IT_EISA 0x20
63#define IT_SCSI 0x40
64#define IT_ETH 0x80
65#define PCIMT_IRQSEL CKSEG1ADDR(0xbfff005c)
66#define PCIMT_TESTMEM CKSEG1ADDR(0xbfff0064)
67#define PCIMT_ECCREG CKSEG1ADDR(0xbfff006c)
68#define PCIMT_CONFIG_ADDRESS CKSEG1ADDR(0xbfff0074)
69#define PCIMT_ASIC_ID CKSEG1ADDR(0xbfff007c) /* read */
70#define PCIMT_SOFT_RESET CKSEG1ADDR(0xbfff007c) /* write */
71#define PCIMT_PIA_OE CKSEG1ADDR(0xbfff0084)
72#define PCIMT_PIA_DATAOUT CKSEG1ADDR(0xbfff008c)
73#define PCIMT_PIA_DATAIN CKSEG1ADDR(0xbfff0094)
74#define PCIMT_CACHECONF CKSEG1ADDR(0xbfff009c)
75#define PCIMT_INVSPACE CKSEG1ADDR(0xbfff00a4)
76#else
77/*
78 * ASIC PCI registers for little endian configuration.
79 */
80#define PCIMT_UCONF CKSEG1ADDR(0xbfff0000)
81#define PCIMT_IOADTIMEOUT2 CKSEG1ADDR(0xbfff0008)
82#define PCIMT_IOMEMCONF CKSEG1ADDR(0xbfff0010)
83#define PCIMT_IOMMU CKSEG1ADDR(0xbfff0018)
84#define PCIMT_IOADTIMEOUT1 CKSEG1ADDR(0xbfff0020)
85#define PCIMT_DMAACCESS CKSEG1ADDR(0xbfff0028)
86#define PCIMT_DMAHIT CKSEG1ADDR(0xbfff0030)
87#define PCIMT_ERRSTATUS CKSEG1ADDR(0xbfff0038)
88#define PCIMT_ERRADDR CKSEG1ADDR(0xbfff0040)
89#define PCIMT_SYNDROME CKSEG1ADDR(0xbfff0048)
90#define PCIMT_ITPEND CKSEG1ADDR(0xbfff0050)
91#define IT_INT2 0x01
92#define IT_INTD 0x02
93#define IT_INTC 0x04
94#define IT_INTB 0x08
95#define IT_INTA 0x10
96#define IT_EISA 0x20
97#define IT_SCSI 0x40
98#define IT_ETH 0x80
99#define PCIMT_IRQSEL CKSEG1ADDR(0xbfff0058)
100#define PCIMT_TESTMEM CKSEG1ADDR(0xbfff0060)
101#define PCIMT_ECCREG CKSEG1ADDR(0xbfff0068)
102#define PCIMT_CONFIG_ADDRESS CKSEG1ADDR(0xbfff0070)
103#define PCIMT_ASIC_ID CKSEG1ADDR(0xbfff0078) /* read */
104#define PCIMT_SOFT_RESET CKSEG1ADDR(0xbfff0078) /* write */
105#define PCIMT_PIA_OE CKSEG1ADDR(0xbfff0080)
106#define PCIMT_PIA_DATAOUT CKSEG1ADDR(0xbfff0088)
107#define PCIMT_PIA_DATAIN CKSEG1ADDR(0xbfff0090)
108#define PCIMT_CACHECONF CKSEG1ADDR(0xbfff0098)
109#define PCIMT_INVSPACE CKSEG1ADDR(0xbfff00a0)
110#endif
111
112#define PCIMT_PCI_CONF CKSEG1ADDR(0xbfff0100)
113
114/*
115 * Data port for the PCI bus in IO space
116 */
117#define PCIMT_CONFIG_DATA 0x0cfc
118
119/*
120 * Board specific registers
121 */
122#define PCIMT_CSMSR CKSEG1ADDR(0xbfd00000)
123#define PCIMT_CSSWITCH CKSEG1ADDR(0xbfd10000)
124#define PCIMT_CSITPEND CKSEG1ADDR(0xbfd20000)
125#define PCIMT_AUTO_PO_EN CKSEG1ADDR(0xbfd30000)
126#define PCIMT_CLR_TEMP CKSEG1ADDR(0xbfd40000)
127#define PCIMT_AUTO_PO_DIS CKSEG1ADDR(0xbfd50000)
128#define PCIMT_EXMSR CKSEG1ADDR(0xbfd60000)
129#define PCIMT_UNUSED1 CKSEG1ADDR(0xbfd70000)
130#define PCIMT_CSWCSM CKSEG1ADDR(0xbfd80000)
131#define PCIMT_UNUSED2 CKSEG1ADDR(0xbfd90000)
132#define PCIMT_CSLED CKSEG1ADDR(0xbfda0000)
133#define PCIMT_CSMAPISA CKSEG1ADDR(0xbfdb0000)
134#define PCIMT_CSRSTBP CKSEG1ADDR(0xbfdc0000)
135#define PCIMT_CLRPOFF CKSEG1ADDR(0xbfdd0000)
136#define PCIMT_CSTIMER CKSEG1ADDR(0xbfde0000)
137#define PCIMT_PWDN CKSEG1ADDR(0xbfdf0000)
138
139/*
140 * A20R based boards
141 */
142#define A20R_PT_CLOCK_BASE CKSEG1ADDR(0xbc040000)
143#define A20R_PT_TIM0_ACK CKSEG1ADDR(0xbc050000)
144#define A20R_PT_TIM1_ACK CKSEG1ADDR(0xbc060000)
145
146#define SNI_A20R_IRQ_BASE MIPS_CPU_IRQ_BASE
147#define SNI_A20R_IRQ_TIMER (SNI_A20R_IRQ_BASE+5)
148
149#define SNI_PCIT_INT_REG CKSEG1ADDR(0xbfff000c)
150
151#define SNI_PCIT_INT_START 24
152#define SNI_PCIT_INT_END 30
153
154#define PCIT_IRQ_ETHERNET (MIPS_CPU_IRQ_BASE + 5)
155#define PCIT_IRQ_INTA (SNI_PCIT_INT_START + 0)
156#define PCIT_IRQ_INTB (SNI_PCIT_INT_START + 1)
157#define PCIT_IRQ_INTC (SNI_PCIT_INT_START + 2)
158#define PCIT_IRQ_INTD (SNI_PCIT_INT_START + 3)
159#define PCIT_IRQ_SCSI0 (SNI_PCIT_INT_START + 4)
160#define PCIT_IRQ_SCSI1 (SNI_PCIT_INT_START + 5)
161
162
163/*
164 * Interrupt 0-16 are EISA interrupts. Interrupts from 16 on are assigned
165 * to the other interrupts generated by ASIC PCI.
166 *
167 * INT2 is a wired-or of the push button interrupt, high temperature interrupt
168 * ASIC PCI interrupt.
169 */
170#define PCIMT_KEYBOARD_IRQ 1
171#define PCIMT_IRQ_INT2 24
172#define PCIMT_IRQ_INTD 25
173#define PCIMT_IRQ_INTC 26
174#define PCIMT_IRQ_INTB 27
175#define PCIMT_IRQ_INTA 28
176#define PCIMT_IRQ_EISA 29
177#define PCIMT_IRQ_SCSI 30
178
179#define PCIMT_IRQ_ETHERNET (MIPS_CPU_IRQ_BASE+6)
180
181#if 0
182#define PCIMT_IRQ_TEMPERATURE 24
183#define PCIMT_IRQ_EISA_NMI 25
184#define PCIMT_IRQ_POWER_OFF 26
185#define PCIMT_IRQ_BUTTON 27
186#endif
187
188/*
189 * Base address for the mapped 16mb EISA bus segment.
190 */
191#define PCIMT_EISA_BASE CKSEG1ADDR(0xb0000000)
192
193/* PCI EISA Interrupt acknowledge */
194#define PCIMT_INT_ACKNOWLEDGE CKSEG1ADDR(0xba000000)
195
196/*
197 * SNI ID PROM
198 *
199 * SNI_IDPROM_MEMSIZE Memsize in 16MB quantities
200 * SNI_IDPROM_BRDTYPE Board Type
201 * SNI_IDPROM_CPUTYPE CPU Type on RM400
202 */
203#ifdef CONFIG_CPU_BIG_ENDIAN
204#define __SNI_END 0
205#endif
206#ifdef CONFIG_CPU_LITTLE_ENDIAN
207#define __SNI_END 3
208#endif
209#define SNI_IDPROM_BASE CKSEG1ADDR(0x1ff00000)
210#define SNI_IDPROM_MEMSIZE (SNI_IDPROM_BASE + (0x28 ^ __SNI_END))
211#define SNI_IDPROM_BRDTYPE (SNI_IDPROM_BASE + (0x29 ^ __SNI_END))
212#define SNI_IDPROM_CPUTYPE (SNI_IDPROM_BASE + (0x30 ^ __SNI_END))
213
214#define SNI_IDPROM_SIZE 0x1000
215
216/* board specific init functions */
217extern void sni_a20r_init(void);
218extern void sni_pcit_init(void);
219extern void sni_rm200_init(void);
220extern void sni_pcimt_init(void);
221
222/* board specific irq init functions */
223extern void sni_a20r_irq_init(void);
224extern void sni_pcit_irq_init(void);
225extern void sni_pcit_cplus_irq_init(void);
226extern void sni_rm200_irq_init(void);
227extern void sni_pcimt_irq_init(void);
228
229/* timer inits */
230extern void sni_cpu_time_init(void);
231
232/* eisa init for RM200/400 */
233#ifdef CONFIG_EISA
234extern int sni_eisa_root_init(void);
235#else
236static inline int sni_eisa_root_init(void)
237{
238 return 0;
239}
240#endif
241
242/* common irq stuff */
243extern void (*sni_hwint)(void);
244extern irqreturn_t sni_isa_irq_handler(int dummy, void *p);
245
246#endif /* __ASM_SNI_H */
diff --git a/arch/mips/include/asm/socket.h b/arch/mips/include/asm/socket.h
new file mode 100644
index 000000000..4724a563c
--- /dev/null
+++ b/arch/mips/include/asm/socket.h
@@ -0,0 +1,50 @@
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 <uapi/asm/socket.h>
13
14
15/** sock_type - Socket types
16 *
17 * Please notice that for binary compat reasons MIPS has to
18 * override the enum sock_type in include/linux/net.h, so
19 * we define ARCH_HAS_SOCKET_TYPES here.
20 *
21 * @SOCK_DGRAM - datagram (conn.less) socket
22 * @SOCK_STREAM - stream (connection) socket
23 * @SOCK_RAW - raw socket
24 * @SOCK_RDM - reliably-delivered message
25 * @SOCK_SEQPACKET - sequential packet socket
26 * @SOCK_PACKET - linux specific way of getting packets at the dev level.
27 * For writing rarp and other similar things on the user level.
28 */
29enum sock_type {
30 SOCK_DGRAM = 1,
31 SOCK_STREAM = 2,
32 SOCK_RAW = 3,
33 SOCK_RDM = 4,
34 SOCK_SEQPACKET = 5,
35 SOCK_DCCP = 6,
36 SOCK_PACKET = 10,
37};
38
39#define SOCK_MAX (SOCK_PACKET + 1)
40/* Mask which covers at least up to SOCK_MASK-1. The
41 * * remaining bits are used as flags. */
42#define SOCK_TYPE_MASK 0xf
43
44/* Flags for socket, socketpair, paccept */
45#define SOCK_CLOEXEC O_CLOEXEC
46#define SOCK_NONBLOCK O_NONBLOCK
47
48#define ARCH_HAS_SOCKET_TYPES 1
49
50#endif /* _ASM_SOCKET_H */
diff --git a/arch/mips/include/asm/sparsemem.h b/arch/mips/include/asm/sparsemem.h
new file mode 100644
index 000000000..b0686ca3d
--- /dev/null
+++ b/arch/mips/include/asm/sparsemem.h
@@ -0,0 +1,18 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _MIPS_SPARSEMEM_H
3#define _MIPS_SPARSEMEM_H
4#ifdef CONFIG_SPARSEMEM
5
6/*
7 * SECTION_SIZE_BITS 2^N: how big each section will be
8 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
9 */
10#if defined(CONFIG_MIPS_HUGE_TLB_SUPPORT) && defined(CONFIG_PAGE_SIZE_64KB)
11# define SECTION_SIZE_BITS 29
12#else
13# define SECTION_SIZE_BITS 28
14#endif
15#define MAX_PHYSMEM_BITS 48
16
17#endif /* CONFIG_SPARSEMEM */
18#endif /* _MIPS_SPARSEMEM_H */
diff --git a/arch/mips/include/asm/spinlock.h b/arch/mips/include/asm/spinlock.h
new file mode 100644
index 000000000..8a88eb265
--- /dev/null
+++ b/arch/mips/include/asm/spinlock.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) 1999, 2000, 06 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SPINLOCK_H
10#define _ASM_SPINLOCK_H
11
12#include <asm/processor.h>
13#include <asm/qrwlock.h>
14
15#include <asm-generic/qspinlock_types.h>
16
17#define queued_spin_unlock queued_spin_unlock
18/**
19 * queued_spin_unlock - release a queued spinlock
20 * @lock : Pointer to queued spinlock structure
21 */
22static inline void queued_spin_unlock(struct qspinlock *lock)
23{
24 /* This could be optimised with ARCH_HAS_MMIOWB */
25 mmiowb();
26 smp_store_release(&lock->locked, 0);
27}
28
29#include <asm/qspinlock.h>
30
31#endif /* _ASM_SPINLOCK_H */
diff --git a/arch/mips/include/asm/spinlock_types.h b/arch/mips/include/asm/spinlock_types.h
new file mode 100644
index 000000000..28fd4b140
--- /dev/null
+++ b/arch/mips/include/asm/spinlock_types.h
@@ -0,0 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_SPINLOCK_TYPES_H
3#define _ASM_SPINLOCK_TYPES_H
4
5#include <asm-generic/qspinlock_types.h>
6#include <asm-generic/qrwlock_types.h>
7
8#endif
diff --git a/arch/mips/include/asm/spram.h b/arch/mips/include/asm/spram.h
new file mode 100644
index 000000000..63cb90fd4
--- /dev/null
+++ b/arch/mips/include/asm/spram.h
@@ -0,0 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _MIPS_SPRAM_H
3#define _MIPS_SPRAM_H
4
5#if defined(CONFIG_MIPS_SPRAM)
6extern __init void spram_config(void);
7#else
8static inline void spram_config(void) { };
9#endif /* CONFIG_MIPS_SPRAM */
10
11#endif /* _MIPS_SPRAM_H */
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h
new file mode 100644
index 000000000..aa430a6c6
--- /dev/null
+++ b/arch/mips/include/asm/stackframe.h
@@ -0,0 +1,492 @@
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 * Copyright (C) 2007 Maciej W. Rozycki
10 */
11#ifndef _ASM_STACKFRAME_H
12#define _ASM_STACKFRAME_H
13
14#include <linux/threads.h>
15
16#include <asm/asm.h>
17#include <asm/asmmacro.h>
18#include <asm/mipsregs.h>
19#include <asm/asm-offsets.h>
20#include <asm/thread_info.h>
21
22/* Make the addition of cfi info a little easier. */
23 .macro cfi_rel_offset reg offset=0 docfi=0
24 .if \docfi
25 .cfi_rel_offset \reg, \offset
26 .endif
27 .endm
28
29 .macro cfi_st reg offset=0 docfi=0
30 LONG_S \reg, \offset(sp)
31 cfi_rel_offset \reg, \offset, \docfi
32 .endm
33
34 .macro cfi_restore reg offset=0 docfi=0
35 .if \docfi
36 .cfi_restore \reg
37 .endif
38 .endm
39
40 .macro cfi_ld reg offset=0 docfi=0
41 LONG_L \reg, \offset(sp)
42 cfi_restore \reg \offset \docfi
43 .endm
44
45#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
46#define STATMASK 0x3f
47#else
48#define STATMASK 0x1f
49#endif
50
51 .macro SAVE_AT docfi=0
52 .set push
53 .set noat
54 cfi_st $1, PT_R1, \docfi
55 .set pop
56 .endm
57
58 .macro SAVE_TEMP docfi=0
59#ifdef CONFIG_CPU_HAS_SMARTMIPS
60 mflhxu v1
61 LONG_S v1, PT_LO(sp)
62 mflhxu v1
63 LONG_S v1, PT_HI(sp)
64 mflhxu v1
65 LONG_S v1, PT_ACX(sp)
66#elif !defined(CONFIG_CPU_MIPSR6)
67 mfhi v1
68#endif
69#ifdef CONFIG_32BIT
70 cfi_st $8, PT_R8, \docfi
71 cfi_st $9, PT_R9, \docfi
72#endif
73 cfi_st $10, PT_R10, \docfi
74 cfi_st $11, PT_R11, \docfi
75 cfi_st $12, PT_R12, \docfi
76#if !defined(CONFIG_CPU_HAS_SMARTMIPS) && !defined(CONFIG_CPU_MIPSR6)
77 LONG_S v1, PT_HI(sp)
78 mflo v1
79#endif
80 cfi_st $13, PT_R13, \docfi
81 cfi_st $14, PT_R14, \docfi
82 cfi_st $15, PT_R15, \docfi
83 cfi_st $24, PT_R24, \docfi
84#if !defined(CONFIG_CPU_HAS_SMARTMIPS) && !defined(CONFIG_CPU_MIPSR6)
85 LONG_S v1, PT_LO(sp)
86#endif
87#ifdef CONFIG_CPU_CAVIUM_OCTEON
88 /*
89 * The Octeon multiplier state is affected by general
90 * multiply instructions. It must be saved before and
91 * kernel code might corrupt it
92 */
93 jal octeon_mult_save
94#endif
95 .endm
96
97 .macro SAVE_STATIC docfi=0
98 cfi_st $16, PT_R16, \docfi
99 cfi_st $17, PT_R17, \docfi
100 cfi_st $18, PT_R18, \docfi
101 cfi_st $19, PT_R19, \docfi
102 cfi_st $20, PT_R20, \docfi
103 cfi_st $21, PT_R21, \docfi
104 cfi_st $22, PT_R22, \docfi
105 cfi_st $23, PT_R23, \docfi
106 cfi_st $30, PT_R30, \docfi
107 .endm
108
109/*
110 * get_saved_sp returns the SP for the current CPU by looking in the
111 * kernelsp array for it. If tosp is set, it stores the current sp in
112 * k0 and loads the new value in sp. If not, it clobbers k0 and
113 * stores the new value in k1, leaving sp unaffected.
114 */
115#ifdef CONFIG_SMP
116
117 /* SMP variation */
118 .macro get_saved_sp docfi=0 tosp=0
119 ASM_CPUID_MFC0 k0, ASM_SMP_CPUID_REG
120#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
121 lui k1, %hi(kernelsp)
122#else
123 lui k1, %highest(kernelsp)
124 daddiu k1, %higher(kernelsp)
125 dsll k1, 16
126 daddiu k1, %hi(kernelsp)
127 dsll k1, 16
128#endif
129 LONG_SRL k0, SMP_CPUID_PTRSHIFT
130 LONG_ADDU k1, k0
131 .if \tosp
132 move k0, sp
133 .if \docfi
134 .cfi_register sp, k0
135 .endif
136 LONG_L sp, %lo(kernelsp)(k1)
137 .else
138 LONG_L k1, %lo(kernelsp)(k1)
139 .endif
140 .endm
141
142 .macro set_saved_sp stackp temp temp2
143 ASM_CPUID_MFC0 \temp, ASM_SMP_CPUID_REG
144 LONG_SRL \temp, SMP_CPUID_PTRSHIFT
145 LONG_S \stackp, kernelsp(\temp)
146 .endm
147#else /* !CONFIG_SMP */
148 /* Uniprocessor variation */
149 .macro get_saved_sp docfi=0 tosp=0
150#ifdef CONFIG_CPU_JUMP_WORKAROUNDS
151 /*
152 * Clear BTB (branch target buffer), forbid RAS (return address
153 * stack) to workaround the Out-of-order Issue in Loongson2F
154 * via its diagnostic register.
155 */
156 move k0, ra
157 jal 1f
158 nop
1591: jal 1f
160 nop
1611: jal 1f
162 nop
1631: jal 1f
164 nop
1651: move ra, k0
166 li k0, 3
167 mtc0 k0, $22
168#endif /* CONFIG_CPU_JUMP_WORKAROUNDS */
169#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
170 lui k1, %hi(kernelsp)
171#else
172 lui k1, %highest(kernelsp)
173 daddiu k1, %higher(kernelsp)
174 dsll k1, k1, 16
175 daddiu k1, %hi(kernelsp)
176 dsll k1, k1, 16
177#endif
178 .if \tosp
179 move k0, sp
180 .if \docfi
181 .cfi_register sp, k0
182 .endif
183 LONG_L sp, %lo(kernelsp)(k1)
184 .else
185 LONG_L k1, %lo(kernelsp)(k1)
186 .endif
187 .endm
188
189 .macro set_saved_sp stackp temp temp2
190 LONG_S \stackp, kernelsp
191 .endm
192#endif
193
194 .macro SAVE_SOME docfi=0
195 .set push
196 .set noat
197 .set reorder
198 mfc0 k0, CP0_STATUS
199 sll k0, 3 /* extract cu0 bit */
200 .set noreorder
201 bltz k0, 8f
202 move k0, sp
203 .if \docfi
204 .cfi_register sp, k0
205 .endif
206#ifdef CONFIG_EVA
207 /*
208 * Flush interAptiv's Return Prediction Stack (RPS) by writing
209 * EntryHi. Toggling Config7.RPS is slower and less portable.
210 *
211 * The RPS isn't automatically flushed when exceptions are
212 * taken, which can result in kernel mode speculative accesses
213 * to user addresses if the RPS mispredicts. That's harmless
214 * when user and kernel share the same address space, but with
215 * EVA the same user segments may be unmapped to kernel mode,
216 * even containing sensitive MMIO regions or invalid memory.
217 *
218 * This can happen when the kernel sets the return address to
219 * ret_from_* and jr's to the exception handler, which looks
220 * more like a tail call than a function call. If nested calls
221 * don't evict the last user address in the RPS, it will
222 * mispredict the return and fetch from a user controlled
223 * address into the icache.
224 *
225 * More recent EVA-capable cores with MAAR to restrict
226 * speculative accesses aren't affected.
227 */
228 MFC0 k0, CP0_ENTRYHI
229 MTC0 k0, CP0_ENTRYHI
230#endif
231 .set reorder
232 /* Called from user mode, new stack. */
233 get_saved_sp docfi=\docfi tosp=1
2348:
235#ifdef CONFIG_CPU_DADDI_WORKAROUNDS
236 .set at=k1
237#endif
238 PTR_SUBU sp, PT_SIZE
239#ifdef CONFIG_CPU_DADDI_WORKAROUNDS
240 .set noat
241#endif
242 .if \docfi
243 .cfi_def_cfa sp,0
244 .endif
245 cfi_st k0, PT_R29, \docfi
246 cfi_rel_offset sp, PT_R29, \docfi
247 cfi_st v1, PT_R3, \docfi
248 /*
249 * You might think that you don't need to save $0,
250 * but the FPU emulator and gdb remote debug stub
251 * need it to operate correctly
252 */
253 LONG_S $0, PT_R0(sp)
254 mfc0 v1, CP0_STATUS
255 cfi_st v0, PT_R2, \docfi
256 LONG_S v1, PT_STATUS(sp)
257 cfi_st $4, PT_R4, \docfi
258 mfc0 v1, CP0_CAUSE
259 cfi_st $5, PT_R5, \docfi
260 LONG_S v1, PT_CAUSE(sp)
261 cfi_st $6, PT_R6, \docfi
262 cfi_st ra, PT_R31, \docfi
263 MFC0 ra, CP0_EPC
264 cfi_st $7, PT_R7, \docfi
265#ifdef CONFIG_64BIT
266 cfi_st $8, PT_R8, \docfi
267 cfi_st $9, PT_R9, \docfi
268#endif
269 LONG_S ra, PT_EPC(sp)
270 .if \docfi
271 .cfi_rel_offset ra, PT_EPC
272 .endif
273 cfi_st $25, PT_R25, \docfi
274 cfi_st $28, PT_R28, \docfi
275
276 /* Set thread_info if we're coming from user mode */
277 mfc0 k0, CP0_STATUS
278 sll k0, 3 /* extract cu0 bit */
279 bltz k0, 9f
280
281 ori $28, sp, _THREAD_MASK
282 xori $28, _THREAD_MASK
283#ifdef CONFIG_CPU_CAVIUM_OCTEON
284 .set mips64
285 pref 0, 0($28) /* Prefetch the current pointer */
286#endif
2879:
288 .set pop
289 .endm
290
291 .macro SAVE_ALL docfi=0
292 SAVE_SOME \docfi
293 SAVE_AT \docfi
294 SAVE_TEMP \docfi
295 SAVE_STATIC \docfi
296 .endm
297
298 .macro RESTORE_AT docfi=0
299 .set push
300 .set noat
301 cfi_ld $1, PT_R1, \docfi
302 .set pop
303 .endm
304
305 .macro RESTORE_TEMP docfi=0
306#ifdef CONFIG_CPU_CAVIUM_OCTEON
307 /* Restore the Octeon multiplier state */
308 jal octeon_mult_restore
309#endif
310#ifdef CONFIG_CPU_HAS_SMARTMIPS
311 LONG_L $24, PT_ACX(sp)
312 mtlhx $24
313 LONG_L $24, PT_HI(sp)
314 mtlhx $24
315 LONG_L $24, PT_LO(sp)
316 mtlhx $24
317#elif !defined(CONFIG_CPU_MIPSR6)
318 LONG_L $24, PT_LO(sp)
319 mtlo $24
320 LONG_L $24, PT_HI(sp)
321 mthi $24
322#endif
323#ifdef CONFIG_32BIT
324 cfi_ld $8, PT_R8, \docfi
325 cfi_ld $9, PT_R9, \docfi
326#endif
327 cfi_ld $10, PT_R10, \docfi
328 cfi_ld $11, PT_R11, \docfi
329 cfi_ld $12, PT_R12, \docfi
330 cfi_ld $13, PT_R13, \docfi
331 cfi_ld $14, PT_R14, \docfi
332 cfi_ld $15, PT_R15, \docfi
333 cfi_ld $24, PT_R24, \docfi
334 .endm
335
336 .macro RESTORE_STATIC docfi=0
337 cfi_ld $16, PT_R16, \docfi
338 cfi_ld $17, PT_R17, \docfi
339 cfi_ld $18, PT_R18, \docfi
340 cfi_ld $19, PT_R19, \docfi
341 cfi_ld $20, PT_R20, \docfi
342 cfi_ld $21, PT_R21, \docfi
343 cfi_ld $22, PT_R22, \docfi
344 cfi_ld $23, PT_R23, \docfi
345 cfi_ld $30, PT_R30, \docfi
346 .endm
347
348 .macro RESTORE_SP docfi=0
349 cfi_ld sp, PT_R29, \docfi
350 .endm
351
352#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
353
354 .macro RESTORE_SOME docfi=0
355 .set push
356 .set reorder
357 .set noat
358 mfc0 a0, CP0_STATUS
359 li v1, ST0_CU1 | ST0_IM
360 ori a0, STATMASK
361 xori a0, STATMASK
362 mtc0 a0, CP0_STATUS
363 and a0, v1
364 LONG_L v0, PT_STATUS(sp)
365 nor v1, $0, v1
366 and v0, v1
367 or v0, a0
368 mtc0 v0, CP0_STATUS
369 cfi_ld $31, PT_R31, \docfi
370 cfi_ld $28, PT_R28, \docfi
371 cfi_ld $25, PT_R25, \docfi
372 cfi_ld $7, PT_R7, \docfi
373 cfi_ld $6, PT_R6, \docfi
374 cfi_ld $5, PT_R5, \docfi
375 cfi_ld $4, PT_R4, \docfi
376 cfi_ld $3, PT_R3, \docfi
377 cfi_ld $2, PT_R2, \docfi
378 .set pop
379 .endm
380
381 .macro RESTORE_SP_AND_RET docfi=0
382 .set push
383 .set noreorder
384 LONG_L k0, PT_EPC(sp)
385 RESTORE_SP \docfi
386 jr k0
387 rfe
388 .set pop
389 .endm
390
391#else
392 .macro RESTORE_SOME docfi=0
393 .set push
394 .set reorder
395 .set noat
396 mfc0 a0, CP0_STATUS
397 ori a0, STATMASK
398 xori a0, STATMASK
399 mtc0 a0, CP0_STATUS
400 li v1, ST0_CU1 | ST0_FR | ST0_IM
401 and a0, v1
402 LONG_L v0, PT_STATUS(sp)
403 nor v1, $0, v1
404 and v0, v1
405 or v0, a0
406 mtc0 v0, CP0_STATUS
407 LONG_L v1, PT_EPC(sp)
408 MTC0 v1, CP0_EPC
409 cfi_ld $31, PT_R31, \docfi
410 cfi_ld $28, PT_R28, \docfi
411 cfi_ld $25, PT_R25, \docfi
412#ifdef CONFIG_64BIT
413 cfi_ld $8, PT_R8, \docfi
414 cfi_ld $9, PT_R9, \docfi
415#endif
416 cfi_ld $7, PT_R7, \docfi
417 cfi_ld $6, PT_R6, \docfi
418 cfi_ld $5, PT_R5, \docfi
419 cfi_ld $4, PT_R4, \docfi
420 cfi_ld $3, PT_R3, \docfi
421 cfi_ld $2, PT_R2, \docfi
422 .set pop
423 .endm
424
425 .macro RESTORE_SP_AND_RET docfi=0
426 RESTORE_SP \docfi
427#if defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
428 eretnc
429#else
430 .set push
431 .set arch=r4000
432 eret
433 .set pop
434#endif
435 .endm
436
437#endif
438
439 .macro RESTORE_ALL docfi=0
440 RESTORE_TEMP \docfi
441 RESTORE_STATIC \docfi
442 RESTORE_AT \docfi
443 RESTORE_SOME \docfi
444 RESTORE_SP \docfi
445 .endm
446
447/*
448 * Move to kernel mode and disable interrupts.
449 * Set cp0 enable bit as sign that we're running on the kernel stack
450 */
451 .macro CLI
452 mfc0 t0, CP0_STATUS
453 li t1, ST0_KERNEL_CUMASK | STATMASK
454 or t0, t1
455 xori t0, STATMASK
456 mtc0 t0, CP0_STATUS
457 irq_disable_hazard
458 .endm
459
460/*
461 * Move to kernel mode and enable interrupts.
462 * Set cp0 enable bit as sign that we're running on the kernel stack
463 */
464 .macro STI
465 mfc0 t0, CP0_STATUS
466 li t1, ST0_KERNEL_CUMASK | STATMASK
467 or t0, t1
468 xori t0, STATMASK & ~1
469 mtc0 t0, CP0_STATUS
470 irq_enable_hazard
471 .endm
472
473/*
474 * Just move to kernel mode and leave interrupts as they are. Note
475 * for the R3000 this means copying the previous enable from IEp.
476 * Set cp0 enable bit as sign that we're running on the kernel stack
477 */
478 .macro KMODE
479 mfc0 t0, CP0_STATUS
480 li t1, ST0_KERNEL_CUMASK | (STATMASK & ~1)
481#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
482 andi t2, t0, ST0_IEP
483 srl t2, 2
484 or t0, t2
485#endif
486 or t0, t1
487 xori t0, STATMASK & ~1
488 mtc0 t0, CP0_STATUS
489 irq_disable_hazard
490 .endm
491
492#endif /* _ASM_STACKFRAME_H */
diff --git a/arch/mips/include/asm/stackprotector.h b/arch/mips/include/asm/stackprotector.h
new file mode 100644
index 000000000..68d4be9e1
--- /dev/null
+++ b/arch/mips/include/asm/stackprotector.h
@@ -0,0 +1,41 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * GCC stack protector support.
4 *
5 * (This is directly adopted from the ARM implementation)
6 *
7 * Stack protector works by putting predefined pattern at the start of
8 * the stack frame and verifying that it hasn't been overwritten when
9 * returning from the function. The pattern is called stack canary
10 * and gcc expects it to be defined by a global variable called
11 * "__stack_chk_guard" on MIPS. This unfortunately means that on SMP
12 * we cannot have a different canary value per task.
13 */
14
15#ifndef _ASM_STACKPROTECTOR_H
16#define _ASM_STACKPROTECTOR_H 1
17
18#include <linux/random.h>
19#include <linux/version.h>
20
21extern unsigned long __stack_chk_guard;
22
23/*
24 * Initialize the stackprotector canary value.
25 *
26 * NOTE: this must only be called from functions that never return,
27 * and it must always be inlined.
28 */
29static __always_inline void boot_init_stack_canary(void)
30{
31 unsigned long canary;
32
33 /* Try to get a semi random initial value. */
34 get_random_bytes(&canary, sizeof(canary));
35 canary ^= LINUX_VERSION_CODE;
36
37 current->stack_canary = canary;
38 __stack_chk_guard = current->stack_canary;
39}
40
41#endif /* _ASM_STACKPROTECTOR_H */
diff --git a/arch/mips/include/asm/stacktrace.h b/arch/mips/include/asm/stacktrace.h
new file mode 100644
index 000000000..8ad25c25b
--- /dev/null
+++ b/arch/mips/include/asm/stacktrace.h
@@ -0,0 +1,89 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_STACKTRACE_H
3#define _ASM_STACKTRACE_H
4
5#include <asm/ptrace.h>
6#include <asm/asm.h>
7#include <linux/stringify.h>
8
9#ifdef CONFIG_KALLSYMS
10extern int raw_show_trace;
11extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
12 unsigned long pc, unsigned long *ra);
13extern unsigned long unwind_stack_by_address(unsigned long stack_page,
14 unsigned long *sp,
15 unsigned long pc,
16 unsigned long *ra);
17#else
18#define raw_show_trace 1
19static inline unsigned long unwind_stack(struct task_struct *task,
20 unsigned long *sp, unsigned long pc, unsigned long *ra)
21{
22 return 0;
23}
24#endif
25
26#define STR_PTR_LA __stringify(PTR_LA)
27#define STR_LONG_S __stringify(LONG_S)
28#define STR_LONG_L __stringify(LONG_L)
29#define STR_LONGSIZE __stringify(LONGSIZE)
30
31#define STORE_ONE_REG(r) \
32 STR_LONG_S " $" __stringify(r)",("STR_LONGSIZE"*"__stringify(r)")(%1)\n\t"
33
34static __always_inline void prepare_frametrace(struct pt_regs *regs)
35{
36#ifndef CONFIG_KALLSYMS
37 /*
38 * Remove any garbage that may be in regs (specially func
39 * addresses) to avoid show_raw_backtrace() to report them
40 */
41 memset(regs, 0, sizeof(*regs));
42#endif
43 __asm__ __volatile__(
44 ".set push\n\t"
45 ".set noat\n\t"
46 /* Store $1 so we can use it */
47 STR_LONG_S " $1,"STR_LONGSIZE"(%1)\n\t"
48 /* Store the PC */
49 "1: " STR_PTR_LA " $1, 1b\n\t"
50 STR_LONG_S " $1,%0\n\t"
51 STORE_ONE_REG(2)
52 STORE_ONE_REG(3)
53 STORE_ONE_REG(4)
54 STORE_ONE_REG(5)
55 STORE_ONE_REG(6)
56 STORE_ONE_REG(7)
57 STORE_ONE_REG(8)
58 STORE_ONE_REG(9)
59 STORE_ONE_REG(10)
60 STORE_ONE_REG(11)
61 STORE_ONE_REG(12)
62 STORE_ONE_REG(13)
63 STORE_ONE_REG(14)
64 STORE_ONE_REG(15)
65 STORE_ONE_REG(16)
66 STORE_ONE_REG(17)
67 STORE_ONE_REG(18)
68 STORE_ONE_REG(19)
69 STORE_ONE_REG(20)
70 STORE_ONE_REG(21)
71 STORE_ONE_REG(22)
72 STORE_ONE_REG(23)
73 STORE_ONE_REG(24)
74 STORE_ONE_REG(25)
75 STORE_ONE_REG(26)
76 STORE_ONE_REG(27)
77 STORE_ONE_REG(28)
78 STORE_ONE_REG(29)
79 STORE_ONE_REG(30)
80 STORE_ONE_REG(31)
81 /* Restore $1 */
82 STR_LONG_L " $1,"STR_LONGSIZE"(%1)\n\t"
83 ".set pop\n\t"
84 : "=m" (regs->cp0_epc)
85 : "r" (regs->regs)
86 : "memory");
87}
88
89#endif /* _ASM_STACKTRACE_H */
diff --git a/arch/mips/include/asm/string.h b/arch/mips/include/asm/string.h
new file mode 100644
index 000000000..1de3bbce8
--- /dev/null
+++ b/arch/mips/include/asm/string.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) 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#define __HAVE_ARCH_MEMSET
14extern void *memset(void *__s, int __c, size_t __count);
15
16#define __HAVE_ARCH_MEMCPY
17extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
18
19#define __HAVE_ARCH_MEMMOVE
20extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
21
22#endif /* _ASM_STRING_H */
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
new file mode 100644
index 000000000..a4374b4cb
--- /dev/null
+++ b/arch/mips/include/asm/switch_to.h
@@ -0,0 +1,142 @@
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, 06 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_SWITCH_TO_H
13#define _ASM_SWITCH_TO_H
14
15#include <asm/cpu-features.h>
16#include <asm/watch.h>
17#include <asm/dsp.h>
18#include <asm/cop2.h>
19#include <asm/fpu.h>
20
21struct task_struct;
22
23/**
24 * resume - resume execution of a task
25 * @prev: The task previously executed.
26 * @next: The task to begin executing.
27 * @next_ti: task_thread_info(next).
28 *
29 * This function is used whilst scheduling to save the context of prev & load
30 * the context of next. Returns prev.
31 */
32extern asmlinkage struct task_struct *resume(struct task_struct *prev,
33 struct task_struct *next, struct thread_info *next_ti);
34
35extern unsigned int ll_bit;
36extern struct task_struct *ll_task;
37
38#ifdef CONFIG_MIPS_MT_FPAFF
39
40/*
41 * Handle the scheduler resume end of FPU affinity management. We do this
42 * inline to try to keep the overhead down. If we have been forced to run on
43 * a "CPU" with an FPU because of a previous high level of FP computation,
44 * but did not actually use the FPU during the most recent time-slice (CU1
45 * isn't set), we undo the restriction on cpus_mask.
46 *
47 * We're not calling set_cpus_allowed() here, because we have no need to
48 * force prompt migration - we're already switching the current CPU to a
49 * different thread.
50 */
51
52#define __mips_mt_fpaff_switch_to(prev) \
53do { \
54 struct thread_info *__prev_ti = task_thread_info(prev); \
55 \
56 if (cpu_has_fpu && \
57 test_ti_thread_flag(__prev_ti, TIF_FPUBOUND) && \
58 (!(KSTK_STATUS(prev) & ST0_CU1))) { \
59 clear_ti_thread_flag(__prev_ti, TIF_FPUBOUND); \
60 prev->cpus_mask = prev->thread.user_cpus_allowed; \
61 } \
62 next->thread.emulated_fp = 0; \
63} while(0)
64
65#else
66#define __mips_mt_fpaff_switch_to(prev) do { (void) (prev); } while (0)
67#endif
68
69/*
70 * Clear LLBit during context switches on MIPSr5+ such that eretnc can be used
71 * unconditionally when returning to userland in entry.S.
72 */
73#define __clear_r5_hw_ll_bit() do { \
74 if (cpu_has_mips_r5 || cpu_has_mips_r6) \
75 write_c0_lladdr(0); \
76} while (0)
77
78#define __clear_software_ll_bit() do { \
79 if (!__builtin_constant_p(cpu_has_llsc) || !cpu_has_llsc) \
80 ll_bit = 0; \
81} while (0)
82
83/*
84 * Check FCSR for any unmasked exceptions pending set with `ptrace',
85 * clear them and send a signal.
86 */
87#ifdef CONFIG_MIPS_FP_SUPPORT
88# define __sanitize_fcr31(next) \
89do { \
90 unsigned long fcr31 = mask_fcr31_x(next->thread.fpu.fcr31); \
91 void __user *pc; \
92 \
93 if (unlikely(fcr31)) { \
94 pc = (void __user *)task_pt_regs(next)->cp0_epc; \
95 next->thread.fpu.fcr31 &= ~fcr31; \
96 force_fcr31_sig(fcr31, pc, next); \
97 } \
98} while (0)
99#else
100# define __sanitize_fcr31(next)
101#endif
102
103/*
104 * For newly created kernel threads switch_to() will return to
105 * ret_from_kernel_thread, newly created user threads to ret_from_fork.
106 * That is, everything following resume() will be skipped for new threads.
107 * So everything that matters to new threads should be placed before resume().
108 */
109#define switch_to(prev, next, last) \
110do { \
111 __mips_mt_fpaff_switch_to(prev); \
112 lose_fpu_inatomic(1, prev); \
113 if (tsk_used_math(next)) \
114 __sanitize_fcr31(next); \
115 if (cpu_has_dsp) { \
116 __save_dsp(prev); \
117 __restore_dsp(next); \
118 } \
119 if (cop2_present) { \
120 u32 status = read_c0_status(); \
121 \
122 set_c0_status(ST0_CU2); \
123 if ((KSTK_STATUS(prev) & ST0_CU2)) { \
124 if (cop2_lazy_restore) \
125 KSTK_STATUS(prev) &= ~ST0_CU2; \
126 cop2_save(prev); \
127 } \
128 if (KSTK_STATUS(next) & ST0_CU2 && \
129 !cop2_lazy_restore) { \
130 cop2_restore(next); \
131 } \
132 write_c0_status(status); \
133 } \
134 __clear_r5_hw_ll_bit(); \
135 __clear_software_ll_bit(); \
136 if (cpu_has_userlocal) \
137 write_c0_userlocal(task_thread_info(next)->tp_value); \
138 __restore_watch(next); \
139 (last) = resume(prev, next, task_thread_info(next)); \
140} while (0)
141
142#endif /* _ASM_SWITCH_TO_H */
diff --git a/arch/mips/include/asm/sync.h b/arch/mips/include/asm/sync.h
new file mode 100644
index 000000000..aabd09793
--- /dev/null
+++ b/arch/mips/include/asm/sync.h
@@ -0,0 +1,209 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2#ifndef __MIPS_ASM_SYNC_H__
3#define __MIPS_ASM_SYNC_H__
4
5/*
6 * sync types are defined by the MIPS64 Instruction Set documentation in Volume
7 * II-A of the MIPS Architecture Reference Manual, which can be found here:
8 *
9 * https://www.mips.com/?do-download=the-mips64-instruction-set-v6-06
10 *
11 * Two types of barrier are provided:
12 *
13 * 1) Completion barriers, which ensure that a memory operation has actually
14 * completed & often involve stalling the CPU pipeline to do so.
15 *
16 * 2) Ordering barriers, which only ensure that affected memory operations
17 * won't be reordered in the CPU pipeline in a manner that violates the
18 * restrictions imposed by the barrier.
19 *
20 * Ordering barriers can be more efficient than completion barriers, since:
21 *
22 * a) Ordering barriers only require memory access instructions which preceed
23 * them in program order (older instructions) to reach a point in the
24 * load/store datapath beyond which reordering is not possible before
25 * allowing memory access instructions which follow them (younger
26 * instructions) to be performed. That is, older instructions don't
27 * actually need to complete - they just need to get far enough that all
28 * other coherent CPUs will observe their completion before they observe
29 * the effects of younger instructions.
30 *
31 * b) Multiple variants of ordering barrier are provided which allow the
32 * effects to be restricted to different combinations of older or younger
33 * loads or stores. By way of example, if we only care that stores older
34 * than a barrier are observed prior to stores that are younger than a
35 * barrier & don't care about the ordering of loads then the 'wmb'
36 * ordering barrier can be used. Limiting the barrier's effects to stores
37 * allows loads to continue unaffected & potentially allows the CPU to
38 * make progress faster than if younger loads had to wait for older stores
39 * to complete.
40 */
41
42/*
43 * No sync instruction at all; used to allow code to nullify the effect of the
44 * __SYNC() macro without needing lots of #ifdefery.
45 */
46#define __SYNC_none -1
47
48/*
49 * A full completion barrier; all memory accesses appearing prior to this sync
50 * instruction in program order must complete before any memory accesses
51 * appearing after this sync instruction in program order.
52 */
53#define __SYNC_full 0x00
54
55/*
56 * For now we use a full completion barrier to implement all sync types, until
57 * we're satisfied that lightweight ordering barriers defined by MIPSr6 are
58 * sufficient to uphold our desired memory model.
59 */
60#define __SYNC_aq __SYNC_full
61#define __SYNC_rl __SYNC_full
62#define __SYNC_mb __SYNC_full
63
64/*
65 * ...except on Cavium Octeon CPUs, which have been using the 'wmb' ordering
66 * barrier since 2010 & omit 'rmb' barriers because the CPUs don't perform
67 * speculative reads.
68 */
69#ifdef CONFIG_CPU_CAVIUM_OCTEON
70# define __SYNC_rmb __SYNC_none
71# define __SYNC_wmb 0x04
72#else
73# define __SYNC_rmb __SYNC_full
74# define __SYNC_wmb __SYNC_full
75#endif
76
77/*
78 * A GINV sync is a little different; it doesn't relate directly to loads or
79 * stores, but instead causes synchronization of an icache or TLB global
80 * invalidation operation triggered by the ginvi or ginvt instructions
81 * respectively. In cases where we need to know that a ginvi or ginvt operation
82 * has been performed by all coherent CPUs, we must issue a sync instruction of
83 * this type. Once this instruction graduates all coherent CPUs will have
84 * observed the invalidation.
85 */
86#define __SYNC_ginv 0x14
87
88/* Trivial; indicate that we always need this sync instruction. */
89#define __SYNC_always (1 << 0)
90
91/*
92 * Indicate that we need this sync instruction only on systems with weakly
93 * ordered memory access. In general this is most MIPS systems, but there are
94 * exceptions which provide strongly ordered memory.
95 */
96#ifdef CONFIG_WEAK_ORDERING
97# define __SYNC_weak_ordering (1 << 1)
98#else
99# define __SYNC_weak_ordering 0
100#endif
101
102/*
103 * Indicate that we need this sync instruction only on systems where LL/SC
104 * don't implicitly provide a memory barrier. In general this is most MIPS
105 * systems.
106 */
107#ifdef CONFIG_WEAK_REORDERING_BEYOND_LLSC
108# define __SYNC_weak_llsc (1 << 2)
109#else
110# define __SYNC_weak_llsc 0
111#endif
112
113/*
114 * Some Loongson 3 CPUs have a bug wherein execution of a memory access (load,
115 * store or prefetch) in between an LL & SC can cause the SC instruction to
116 * erroneously succeed, breaking atomicity. Whilst it's unusual to write code
117 * containing such sequences, this bug bites harder than we might otherwise
118 * expect due to reordering & speculation:
119 *
120 * 1) A memory access appearing prior to the LL in program order may actually
121 * be executed after the LL - this is the reordering case.
122 *
123 * In order to avoid this we need to place a memory barrier (ie. a SYNC
124 * instruction) prior to every LL instruction, in between it and any earlier
125 * memory access instructions.
126 *
127 * This reordering case is fixed by 3A R2 CPUs, ie. 3A2000 models and later.
128 *
129 * 2) If a conditional branch exists between an LL & SC with a target outside
130 * of the LL-SC loop, for example an exit upon value mismatch in cmpxchg()
131 * or similar, then misprediction of the branch may allow speculative
132 * execution of memory accesses from outside of the LL-SC loop.
133 *
134 * In order to avoid this we need a memory barrier (ie. a SYNC instruction)
135 * at each affected branch target.
136 *
137 * This case affects all current Loongson 3 CPUs.
138 *
139 * The above described cases cause an error in the cache coherence protocol;
140 * such that the Invalidate of a competing LL-SC goes 'missing' and SC
141 * erroneously observes its core still has Exclusive state and lets the SC
142 * proceed.
143 *
144 * Therefore the error only occurs on SMP systems.
145 */
146#ifdef CONFIG_CPU_LOONGSON3_WORKAROUNDS
147# define __SYNC_loongson3_war (1 << 31)
148#else
149# define __SYNC_loongson3_war 0
150#endif
151
152/*
153 * Some Cavium Octeon CPUs suffer from a bug that causes a single wmb ordering
154 * barrier to be ineffective, requiring the use of 2 in sequence to provide an
155 * effective barrier as noted by commit 6b07d38aaa52 ("MIPS: Octeon: Use
156 * optimized memory barrier primitives."). Here we specify that the affected
157 * sync instructions should be emitted twice.
158 * Note that this expression is evaluated by the assembler (not the compiler),
159 * and that the assembler evaluates '==' as 0 or -1, not 0 or 1.
160 */
161#ifdef CONFIG_CPU_CAVIUM_OCTEON
162# define __SYNC_rpt(type) (1 - (type == __SYNC_wmb))
163#else
164# define __SYNC_rpt(type) 1
165#endif
166
167/*
168 * The main event. Here we actually emit a sync instruction of a given type, if
169 * reason is non-zero.
170 *
171 * In future we have the option of emitting entries in a fixups-style table
172 * here that would allow us to opportunistically remove some sync instructions
173 * when we detect at runtime that we're running on a CPU that doesn't need
174 * them.
175 */
176#ifdef CONFIG_CPU_HAS_SYNC
177# define ____SYNC(_type, _reason, _else) \
178 .if (( _type ) != -1) && ( _reason ); \
179 .set push; \
180 .set MIPS_ISA_LEVEL_RAW; \
181 .rept __SYNC_rpt(_type); \
182 sync _type; \
183 .endr; \
184 .set pop; \
185 .else; \
186 _else; \
187 .endif
188#else
189# define ____SYNC(_type, _reason, _else)
190#endif
191
192/*
193 * Preprocessor magic to expand macros used as arguments before we insert them
194 * into assembly code.
195 */
196#ifdef __ASSEMBLY__
197# define ___SYNC(type, reason, else) \
198 ____SYNC(type, reason, else)
199#else
200# define ___SYNC(type, reason, else) \
201 __stringify(____SYNC(type, reason, else))
202#endif
203
204#define __SYNC(type, reason) \
205 ___SYNC(__SYNC_##type, __SYNC_##reason, )
206#define __SYNC_ELSE(type, reason, else) \
207 ___SYNC(__SYNC_##type, __SYNC_##reason, else)
208
209#endif /* __MIPS_ASM_SYNC_H__ */
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
new file mode 100644
index 000000000..25fa651c9
--- /dev/null
+++ b/arch/mips/include/asm/syscall.h
@@ -0,0 +1,160 @@
1/*
2 * Access to user system call parameters and results
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 * See asm-generic/syscall.h for descriptions of what we must do here.
9 *
10 * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org>
11 */
12
13#ifndef __ASM_MIPS_SYSCALL_H
14#define __ASM_MIPS_SYSCALL_H
15
16#include <linux/compiler.h>
17#include <uapi/linux/audit.h>
18#include <linux/elf-em.h>
19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/uaccess.h>
22#include <asm/ptrace.h>
23#include <asm/unistd.h>
24
25#ifndef __NR_syscall /* Only defined if _MIPS_SIM == _MIPS_SIM_ABI32 */
26#define __NR_syscall 4000
27#endif
28
29static inline bool mips_syscall_is_indirect(struct task_struct *task,
30 struct pt_regs *regs)
31{
32 /* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
33 return (IS_ENABLED(CONFIG_32BIT) ||
34 test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
35 (regs->regs[2] == __NR_syscall);
36}
37
38static inline long syscall_get_nr(struct task_struct *task,
39 struct pt_regs *regs)
40{
41 return current_thread_info()->syscall;
42}
43
44static inline void mips_syscall_update_nr(struct task_struct *task,
45 struct pt_regs *regs)
46{
47 /*
48 * v0 is the system call number, except for O32 ABI syscall(), where it
49 * ends up in a0.
50 */
51 if (mips_syscall_is_indirect(task, regs))
52 task_thread_info(task)->syscall = regs->regs[4];
53 else
54 task_thread_info(task)->syscall = regs->regs[2];
55}
56
57static inline void mips_get_syscall_arg(unsigned long *arg,
58 struct task_struct *task, struct pt_regs *regs, unsigned int n)
59{
60 unsigned long usp __maybe_unused = regs->regs[29];
61
62 switch (n) {
63 case 0: case 1: case 2: case 3:
64 *arg = regs->regs[4 + n];
65
66 return;
67
68#ifdef CONFIG_32BIT
69 case 4: case 5: case 6: case 7:
70 get_user(*arg, (int *)usp + n);
71 return;
72#endif
73
74#ifdef CONFIG_64BIT
75 case 4: case 5: case 6: case 7:
76#ifdef CONFIG_MIPS32_O32
77 if (test_tsk_thread_flag(task, TIF_32BIT_REGS))
78 get_user(*arg, (int *)usp + n);
79 else
80#endif
81 *arg = regs->regs[4 + n];
82
83 return;
84#endif
85
86 default:
87 BUG();
88 }
89
90 unreachable();
91}
92
93static inline long syscall_get_error(struct task_struct *task,
94 struct pt_regs *regs)
95{
96 return regs->regs[7] ? -regs->regs[2] : 0;
97}
98
99static inline long syscall_get_return_value(struct task_struct *task,
100 struct pt_regs *regs)
101{
102 return regs->regs[2];
103}
104
105static inline void syscall_rollback(struct task_struct *task,
106 struct pt_regs *regs)
107{
108 /* Do nothing */
109}
110
111static inline void syscall_set_return_value(struct task_struct *task,
112 struct pt_regs *regs,
113 int error, long val)
114{
115 if (error) {
116 regs->regs[2] = -error;
117 regs->regs[7] = 1;
118 } else {
119 regs->regs[2] = val;
120 regs->regs[7] = 0;
121 }
122}
123
124static inline void syscall_get_arguments(struct task_struct *task,
125 struct pt_regs *regs,
126 unsigned long *args)
127{
128 unsigned int i = 0;
129 unsigned int n = 6;
130
131 /* O32 ABI syscall() */
132 if (mips_syscall_is_indirect(task, regs))
133 i++;
134
135 while (n--)
136 mips_get_syscall_arg(args++, task, regs, i++);
137}
138
139extern const unsigned long sys_call_table[];
140extern const unsigned long sys32_call_table[];
141extern const unsigned long sysn32_call_table[];
142
143static inline int syscall_get_arch(struct task_struct *task)
144{
145 int arch = AUDIT_ARCH_MIPS;
146#ifdef CONFIG_64BIT
147 if (!test_tsk_thread_flag(task, TIF_32BIT_REGS)) {
148 arch |= __AUDIT_ARCH_64BIT;
149 /* N32 sets only TIF_32BIT_ADDR */
150 if (test_tsk_thread_flag(task, TIF_32BIT_ADDR))
151 arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
152 }
153#endif
154#if defined(__LITTLE_ENDIAN)
155 arch |= __AUDIT_ARCH_LE;
156#endif
157 return arch;
158}
159
160#endif /* __ASM_MIPS_SYSCALL_H */
diff --git a/arch/mips/include/asm/termios.h b/arch/mips/include/asm/termios.h
new file mode 100644
index 000000000..bc29eeacc
--- /dev/null
+++ b/arch/mips/include/asm/termios.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, 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 <linux/uaccess.h>
13#include <uapi/asm/termios.h>
14
15/*
16 * intr=^C quit=^\ erase=del kill=^U
17 * vmin=\1 vtime=\0 eol2=\0 swtc=\0
18 * start=^Q stop=^S susp=^Z vdsusp=
19 * reprint=^R discard=^U werase=^W lnext=^V
20 * eof=^D eol=\0
21 */
22#define INIT_C_CC "\003\034\177\025\1\0\0\0\021\023\032\0\022\017\027\026\004\0"
23
24#include <linux/string.h>
25
26/*
27 * Translate a "termio" structure into a "termios". Ugh.
28 */
29static inline int user_termio_to_kernel_termios(struct ktermios *termios,
30 struct termio __user *termio)
31{
32 unsigned short iflag, oflag, cflag, lflag;
33 unsigned int err;
34
35 if (!access_ok(termio, sizeof(struct termio)))
36 return -EFAULT;
37
38 err = __get_user(iflag, &termio->c_iflag);
39 termios->c_iflag = (termios->c_iflag & 0xffff0000) | iflag;
40 err |=__get_user(oflag, &termio->c_oflag);
41 termios->c_oflag = (termios->c_oflag & 0xffff0000) | oflag;
42 err |=__get_user(cflag, &termio->c_cflag);
43 termios->c_cflag = (termios->c_cflag & 0xffff0000) | cflag;
44 err |=__get_user(lflag, &termio->c_lflag);
45 termios->c_lflag = (termios->c_lflag & 0xffff0000) | lflag;
46 err |=__get_user(termios->c_line, &termio->c_line);
47 if (err)
48 return -EFAULT;
49
50 if (__copy_from_user(termios->c_cc, termio->c_cc, NCC))
51 return -EFAULT;
52
53 return 0;
54}
55
56/*
57 * Translate a "termios" structure into a "termio". Ugh.
58 */
59static inline int kernel_termios_to_user_termio(struct termio __user *termio,
60 struct ktermios *termios)
61{
62 int err;
63
64 if (!access_ok(termio, sizeof(struct termio)))
65 return -EFAULT;
66
67 err = __put_user(termios->c_iflag, &termio->c_iflag);
68 err |= __put_user(termios->c_oflag, &termio->c_oflag);
69 err |= __put_user(termios->c_cflag, &termio->c_cflag);
70 err |= __put_user(termios->c_lflag, &termio->c_lflag);
71 err |= __put_user(termios->c_line, &termio->c_line);
72 if (err)
73 return -EFAULT;
74
75 if (__copy_to_user(termio->c_cc, termios->c_cc, NCC))
76 return -EFAULT;
77
78 return 0;
79}
80
81static inline int user_termios_to_kernel_termios(struct ktermios __user *k,
82 struct termios2 *u)
83{
84 return copy_from_user(k, u, sizeof(struct termios2)) ? -EFAULT : 0;
85}
86
87static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
88 struct ktermios *k)
89{
90 return copy_to_user(u, k, sizeof(struct termios2)) ? -EFAULT : 0;
91}
92
93static inline int user_termios_to_kernel_termios_1(struct ktermios *k,
94 struct termios __user *u)
95{
96 return copy_from_user(k, u, sizeof(struct termios)) ? -EFAULT : 0;
97}
98
99static inline int kernel_termios_to_user_termios_1(struct termios __user *u,
100 struct ktermios *k)
101{
102 return copy_to_user(u, k, sizeof(struct termios)) ? -EFAULT : 0;
103}
104
105#endif /* _ASM_TERMIOS_H */
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
new file mode 100644
index 000000000..e2c352da3
--- /dev/null
+++ b/arch/mips/include/asm/thread_info.h
@@ -0,0 +1,199 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/* thread_info.h: MIPS low-level thread information
3 *
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6 */
7
8#ifndef _ASM_THREAD_INFO_H
9#define _ASM_THREAD_INFO_H
10
11#ifdef __KERNEL__
12
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 unsigned long flags; /* low level flags */
28 unsigned long tp_value; /* thread pointer */
29 __u32 cpu; /* current CPU */
30 int preempt_count; /* 0 => preemptable, <0 => BUG */
31 mm_segment_t addr_limit; /*
32 * thread address space limit:
33 * 0x7fffffff for user-thead
34 * 0xffffffff for kernel-thread
35 */
36 struct pt_regs *regs;
37 long syscall; /* syscall number */
38};
39
40/*
41 * macros/functions for gaining access to the thread information structure
42 */
43#define INIT_THREAD_INFO(tsk) \
44{ \
45 .task = &tsk, \
46 .flags = _TIF_FIXADE, \
47 .cpu = 0, \
48 .preempt_count = INIT_PREEMPT_COUNT, \
49 .addr_limit = KERNEL_DS, \
50}
51
52/*
53 * A pointer to the struct thread_info for the currently executing thread is
54 * held in register $28/$gp.
55 *
56 * We declare __current_thread_info as a global register variable rather than a
57 * local register variable within current_thread_info() because clang doesn't
58 * support explicit local register variables.
59 *
60 * When building the VDSO we take care not to declare the global register
61 * variable because this causes GCC to not preserve the value of $28/$gp in
62 * functions that change its value (which is common in the PIC VDSO when
63 * accessing the GOT). Since the VDSO shouldn't be accessing
64 * __current_thread_info anyway we declare it extern in order to cause a link
65 * failure if it's referenced.
66 */
67#ifdef __VDSO__
68extern struct thread_info *__current_thread_info;
69#else
70register struct thread_info *__current_thread_info __asm__("$28");
71#endif
72
73static inline struct thread_info *current_thread_info(void)
74{
75 return __current_thread_info;
76}
77
78#endif /* !__ASSEMBLY__ */
79
80/* thread information allocation */
81#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_32BIT)
82#define THREAD_SIZE_ORDER (1)
83#endif
84#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_64BIT)
85#define THREAD_SIZE_ORDER (2)
86#endif
87#ifdef CONFIG_PAGE_SIZE_8KB
88#define THREAD_SIZE_ORDER (1)
89#endif
90#ifdef CONFIG_PAGE_SIZE_16KB
91#define THREAD_SIZE_ORDER (0)
92#endif
93#ifdef CONFIG_PAGE_SIZE_32KB
94#define THREAD_SIZE_ORDER (0)
95#endif
96#ifdef CONFIG_PAGE_SIZE_64KB
97#define THREAD_SIZE_ORDER (0)
98#endif
99
100#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
101#define THREAD_MASK (THREAD_SIZE - 1UL)
102
103#define STACK_WARN (THREAD_SIZE / 8)
104
105/*
106 * thread information flags
107 * - these are process state flags that various assembly files may need to
108 * access
109 * - pending work-to-be-done flags are in LSW
110 * - other flags in MSW
111 */
112#define TIF_SIGPENDING 1 /* signal pending */
113#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
114#define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */
115#define TIF_SECCOMP 4 /* secure computing */
116#define TIF_NOTIFY_RESUME 5 /* callback before returning to user */
117#define TIF_UPROBE 6 /* breakpointed or singlestepping */
118#define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */
119#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
120#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
121#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
122#define TIF_NOHZ 19 /* in adaptive nohz mode */
123#define TIF_FIXADE 20 /* Fix address errors in software */
124#define TIF_LOGADE 21 /* Log address errors to syslog */
125#define TIF_32BIT_REGS 22 /* 32-bit general purpose registers */
126#define TIF_32BIT_ADDR 23 /* 32-bit address space (o32/n32) */
127#define TIF_FPUBOUND 24 /* thread bound to FPU-full CPU set */
128#define TIF_LOAD_WATCH 25 /* If set, load watch registers */
129#define TIF_SYSCALL_TRACEPOINT 26 /* syscall tracepoint instrumentation */
130#define TIF_32BIT_FPREGS 27 /* 32-bit floating point registers */
131#define TIF_HYBRID_FPREGS 28 /* 64b FP registers, odd singles in bits 63:32 of even doubles */
132#define TIF_USEDMSA 29 /* MSA has been used this quantum */
133#define TIF_MSA_CTX_LIVE 30 /* MSA context must be preserved */
134#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
135
136#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
137#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
138#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
139#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
140#define _TIF_SECCOMP (1<<TIF_SECCOMP)
141#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
142#define _TIF_UPROBE (1<<TIF_UPROBE)
143#define _TIF_NOTIFY_SIGNAL (1<<TIF_NOTIFY_SIGNAL)
144#define _TIF_USEDFPU (1<<TIF_USEDFPU)
145#define _TIF_NOHZ (1<<TIF_NOHZ)
146#define _TIF_FIXADE (1<<TIF_FIXADE)
147#define _TIF_LOGADE (1<<TIF_LOGADE)
148#define _TIF_32BIT_REGS (1<<TIF_32BIT_REGS)
149#define _TIF_32BIT_ADDR (1<<TIF_32BIT_ADDR)
150#define _TIF_FPUBOUND (1<<TIF_FPUBOUND)
151#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH)
152#define _TIF_32BIT_FPREGS (1<<TIF_32BIT_FPREGS)
153#define _TIF_HYBRID_FPREGS (1<<TIF_HYBRID_FPREGS)
154#define _TIF_USEDMSA (1<<TIF_USEDMSA)
155#define _TIF_MSA_CTX_LIVE (1<<TIF_MSA_CTX_LIVE)
156#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
157
158#define _TIF_WORK_SYSCALL_ENTRY (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
159 _TIF_SYSCALL_AUDIT | \
160 _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP)
161
162/* work to do in syscall_trace_leave() */
163#define _TIF_WORK_SYSCALL_EXIT (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
164 _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT)
165
166/* work to do on interrupt/exception return */
167#define _TIF_WORK_MASK \
168 (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME | \
169 _TIF_UPROBE | _TIF_NOTIFY_SIGNAL)
170/* work to do on any return to u-space */
171#define _TIF_ALLWORK_MASK (_TIF_NOHZ | _TIF_WORK_MASK | \
172 _TIF_WORK_SYSCALL_EXIT | \
173 _TIF_SYSCALL_TRACEPOINT)
174
175/*
176 * We stash processor id into a COP0 register to retrieve it fast
177 * at kernel exception entry.
178 */
179#if defined(CONFIG_MIPS_PGD_C0_CONTEXT)
180#define SMP_CPUID_REG 20, 0 /* XCONTEXT */
181#define ASM_SMP_CPUID_REG $20
182#define SMP_CPUID_PTRSHIFT 48
183#else
184#define SMP_CPUID_REG 4, 0 /* CONTEXT */
185#define ASM_SMP_CPUID_REG $4
186#define SMP_CPUID_PTRSHIFT 23
187#endif
188
189#ifdef CONFIG_64BIT
190#define SMP_CPUID_REGSHIFT (SMP_CPUID_PTRSHIFT + 3)
191#else
192#define SMP_CPUID_REGSHIFT (SMP_CPUID_PTRSHIFT + 2)
193#endif
194
195#define ASM_CPUID_MFC0 MFC0
196#define UASM_i_CPUID_MFC0 UASM_i_MFC0
197
198#endif /* __KERNEL__ */
199#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h
new file mode 100644
index 000000000..e855a3611
--- /dev/null
+++ b/arch/mips/include/asm/time.h
@@ -0,0 +1,73 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2001, 2002, MontaVista Software Inc.
4 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
5 * Copyright (c) 2003 Maciej W. Rozycki
6 *
7 * include/asm-mips/time.h
8 * header file for the new style time.c file and time services.
9 */
10#ifndef _ASM_TIME_H
11#define _ASM_TIME_H
12
13#include <linux/rtc.h>
14#include <linux/spinlock.h>
15#include <linux/clockchips.h>
16#include <linux/clocksource.h>
17
18extern spinlock_t rtc_lock;
19
20/*
21 * board specific routines required by time_init().
22 */
23extern void plat_time_init(void);
24
25/*
26 * mips_hpt_frequency - must be set if you intend to use an R4k-compatible
27 * counter as a timer interrupt source.
28 */
29extern unsigned int mips_hpt_frequency;
30
31/*
32 * The performance counter IRQ on MIPS is a close relative to the timer IRQ
33 * so it lives here.
34 */
35extern int (*perf_irq)(void);
36extern int __weak get_c0_perfcount_int(void);
37
38/*
39 * Initialize the calling CPU's compare interrupt as clockevent device
40 */
41extern unsigned int get_c0_compare_int(void);
42extern int r4k_clockevent_init(void);
43
44static inline int mips_clockevent_init(void)
45{
46#ifdef CONFIG_CEVT_R4K
47 return r4k_clockevent_init();
48#else
49 return -ENXIO;
50#endif
51}
52
53/*
54 * Initialize the count register as a clocksource
55 */
56extern int init_r4k_clocksource(void);
57
58static inline int init_mips_clocksource(void)
59{
60#ifdef CONFIG_CSRC_R4K
61 return init_r4k_clocksource();
62#else
63 return 0;
64#endif
65}
66
67static inline void clockevent_set_clock(struct clock_event_device *cd,
68 unsigned int clock)
69{
70 clockevents_calc_mult_shift(cd, clock, 4);
71}
72
73#endif /* _ASM_TIME_H */
diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h
new file mode 100644
index 000000000..2e107886f
--- /dev/null
+++ b/arch/mips/include/asm/timex.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) 1998, 1999, 2003 by Ralf Baechle
7 * Copyright (C) 2014 by Maciej W. Rozycki
8 */
9#ifndef _ASM_TIMEX_H
10#define _ASM_TIMEX_H
11
12#ifdef __KERNEL__
13
14#include <linux/compiler.h>
15
16#include <asm/cpu.h>
17#include <asm/cpu-features.h>
18#include <asm/mipsregs.h>
19#include <asm/cpu-type.h>
20
21/*
22 * This is the clock rate of the i8253 PIT. A MIPS system may not have
23 * a PIT by the symbol is used all over the kernel including some APIs.
24 * So keeping it defined to the number for the PIT is the only sane thing
25 * for now.
26 */
27#define CLOCK_TICK_RATE 1193182
28
29/*
30 * Standard way to access the cycle counter.
31 * Currently only used on SMP for scheduling.
32 *
33 * Only the low 32 bits are available as a continuously counting entity.
34 * But this only means we'll force a reschedule every 8 seconds or so,
35 * which isn't an evil thing.
36 *
37 * We know that all SMP capable CPUs have cycle counters.
38 */
39
40typedef unsigned int cycles_t;
41
42/*
43 * On R4000/R4400 an erratum exists such that if the cycle counter is
44 * read in the exact moment that it is matching the compare register,
45 * no interrupt will be generated.
46 *
47 * There is a suggested workaround and also the erratum can't strike if
48 * the compare interrupt isn't being used as the clock source device.
49 * However for now the implementaton of this function doesn't get these
50 * fine details right.
51 */
52static inline int can_use_mips_counter(unsigned int prid)
53{
54 int comp = (prid & PRID_COMP_MASK) != PRID_COMP_LEGACY;
55
56 if (__builtin_constant_p(cpu_has_counter) && !cpu_has_counter)
57 return 0;
58 else if (__builtin_constant_p(cpu_has_mips_r) && cpu_has_mips_r)
59 return 1;
60 else if (likely(!__builtin_constant_p(cpu_has_mips_r) && comp))
61 return 1;
62 /* Make sure we don't peek at cpu_data[0].options in the fast path! */
63 if (!__builtin_constant_p(cpu_has_counter))
64 asm volatile("" : "=m" (cpu_data[0].options));
65 if (likely(cpu_has_counter &&
66 prid > (PRID_IMP_R4000 | PRID_REV_ENCODE_44(15, 15))))
67 return 1;
68 else
69 return 0;
70}
71
72static inline cycles_t get_cycles(void)
73{
74 if (can_use_mips_counter(read_c0_prid()))
75 return read_c0_count();
76 else
77 return 0; /* no usable counter */
78}
79#define get_cycles get_cycles
80
81/*
82 * Like get_cycles - but where c0_count is not available we desperately
83 * use c0_random in an attempt to get at least a little bit of entropy.
84 */
85static inline unsigned long random_get_entropy(void)
86{
87 unsigned int c0_random;
88
89 if (can_use_mips_counter(read_c0_prid()))
90 return read_c0_count();
91
92 if (cpu_has_3kex)
93 c0_random = (read_c0_random() >> 8) & 0x3f;
94 else
95 c0_random = read_c0_random() & 0x3f;
96 return (random_get_entropy_fallback() << 6) | (0x3f - c0_random);
97}
98#define random_get_entropy random_get_entropy
99
100#endif /* __KERNEL__ */
101
102#endif /* _ASM_TIMEX_H */
diff --git a/arch/mips/include/asm/tlb.h b/arch/mips/include/asm/tlb.h
new file mode 100644
index 000000000..90f3ad76d
--- /dev/null
+++ b/arch/mips/include/asm/tlb.h
@@ -0,0 +1,26 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_TLB_H
3#define __ASM_TLB_H
4
5#include <asm/cpu-features.h>
6#include <asm/mipsregs.h>
7
8#define _UNIQUE_ENTRYHI(base, idx) \
9 (((base) + ((idx) << (PAGE_SHIFT + 1))) | \
10 (cpu_has_tlbinv ? MIPS_ENTRYHI_EHINV : 0))
11#define UNIQUE_ENTRYHI(idx) _UNIQUE_ENTRYHI(CKSEG0, idx)
12#define UNIQUE_GUEST_ENTRYHI(idx) _UNIQUE_ENTRYHI(CKSEG1, idx)
13
14static inline unsigned int num_wired_entries(void)
15{
16 unsigned int wired = read_c0_wired();
17
18 if (cpu_has_mips_r6)
19 wired &= MIPSR6_WIRED_WIRED;
20
21 return wired;
22}
23
24#include <asm-generic/tlb.h>
25
26#endif /* __ASM_TLB_H */
diff --git a/arch/mips/include/asm/tlbdebug.h b/arch/mips/include/asm/tlbdebug.h
new file mode 100644
index 000000000..3a25a8780
--- /dev/null
+++ b/arch/mips/include/asm/tlbdebug.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) 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_regs(void);
15extern void dump_tlb_all(void);
16
17#endif /* __ASM_TLBDEBUG_H */
diff --git a/arch/mips/include/asm/tlbex.h b/arch/mips/include/asm/tlbex.h
new file mode 100644
index 000000000..6d97e23f3
--- /dev/null
+++ b/arch/mips/include/asm/tlbex.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_TLBEX_H
3#define __ASM_TLBEX_H
4
5#include <asm/uasm.h>
6
7/*
8 * Write random or indexed TLB entry, and care about the hazards from
9 * the preceding mtc0 and for the following eret.
10 */
11enum tlb_write_entry {
12 tlb_random,
13 tlb_indexed
14};
15
16extern int pgd_reg;
17
18void build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
19 unsigned int tmp, unsigned int ptr);
20void build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr);
21void build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr);
22void build_update_entries(u32 **p, unsigned int tmp, unsigned int ptep);
23void build_tlb_write_entry(u32 **p, struct uasm_label **l,
24 struct uasm_reloc **r,
25 enum tlb_write_entry wmode);
26
27extern void handle_tlbl(void);
28extern char handle_tlbl_end[];
29
30extern void handle_tlbs(void);
31extern char handle_tlbs_end[];
32
33extern void handle_tlbm(void);
34extern char handle_tlbm_end[];
35
36#endif /* __ASM_TLBEX_H */
diff --git a/arch/mips/include/asm/tlbflush.h b/arch/mips/include/asm/tlbflush.h
new file mode 100644
index 000000000..9789e7a32
--- /dev/null
+++ b/arch/mips/include/asm/tlbflush.h
@@ -0,0 +1,49 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_TLBFLUSH_H
3#define __ASM_TLBFLUSH_H
4
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 */
16extern void local_flush_tlb_all(void);
17extern void local_flush_tlb_range(struct vm_area_struct *vma,
18 unsigned long start, unsigned long end);
19extern void local_flush_tlb_kernel_range(unsigned long start,
20 unsigned long end);
21extern void local_flush_tlb_page(struct vm_area_struct *vma,
22 unsigned long page);
23extern void local_flush_tlb_one(unsigned long vaddr);
24
25#include <asm/mmu_context.h>
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) drop_mmu_context(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
49#endif /* __ASM_TLBFLUSH_H */
diff --git a/arch/mips/include/asm/tlbmisc.h b/arch/mips/include/asm/tlbmisc.h
new file mode 100644
index 000000000..c1a540669
--- /dev/null
+++ b/arch/mips/include/asm/tlbmisc.h
@@ -0,0 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_TLBMISC_H
3#define __ASM_TLBMISC_H
4
5/*
6 * - add_wired_entry() add a fixed TLB entry, and move wired register
7 */
8extern void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
9 unsigned long entryhi, unsigned long pagemask);
10
11#endif /* __ASM_TLBMISC_H */
diff --git a/arch/mips/include/asm/topology.h b/arch/mips/include/asm/topology.h
new file mode 100644
index 000000000..0673d2d0f
--- /dev/null
+++ b/arch/mips/include/asm/topology.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 * Copyright (C) 2007 by Ralf Baechle
7 */
8#ifndef __ASM_TOPOLOGY_H
9#define __ASM_TOPOLOGY_H
10
11#include <topology.h>
12#include <linux/smp.h>
13
14#ifdef CONFIG_SMP
15#define topology_physical_package_id(cpu) (cpu_data[cpu].package)
16#define topology_core_id(cpu) (cpu_core(&cpu_data[cpu]))
17#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
18#define topology_sibling_cpumask(cpu) (&cpu_sibling_map[cpu])
19#endif
20
21#endif /* __ASM_TOPOLOGY_H */
diff --git a/arch/mips/include/asm/traps.h b/arch/mips/include/asm/traps.h
new file mode 100644
index 000000000..6a0864bb6
--- /dev/null
+++ b/arch/mips/include/asm/traps.h
@@ -0,0 +1,38 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Trap handling definitions.
4 *
5 * Copyright (C) 2002, 2003 Maciej W. Rozycki
6 */
7#ifndef _ASM_TRAPS_H
8#define _ASM_TRAPS_H
9
10/*
11 * Possible status responses for a board_be_handler backend.
12 */
13#define MIPS_BE_DISCARD 0 /* return with no action */
14#define MIPS_BE_FIXUP 1 /* return to the fixup code */
15#define MIPS_BE_FATAL 2 /* treat as an unrecoverable error */
16
17extern void (*board_be_init)(void);
18extern int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
19
20extern void (*board_nmi_handler_setup)(void);
21extern void (*board_ejtag_handler_setup)(void);
22extern void (*board_bind_eic_interrupt)(int irq, int regset);
23extern void (*board_ebase_setup)(void);
24extern void (*board_cache_error_setup)(void);
25
26extern int register_nmi_notifier(struct notifier_block *nb);
27
28#define nmi_notifier(fn, pri) \
29({ \
30 static struct notifier_block fn##_nb = { \
31 .notifier_call = fn, \
32 .priority = pri \
33 }; \
34 \
35 register_nmi_notifier(&fn##_nb); \
36})
37
38#endif /* _ASM_TRAPS_H */
diff --git a/arch/mips/include/asm/txx9/boards.h b/arch/mips/include/asm/txx9/boards.h
new file mode 100644
index 000000000..d45237bef
--- /dev/null
+++ b/arch/mips/include/asm/txx9/boards.h
@@ -0,0 +1,14 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifdef CONFIG_TOSHIBA_JMR3927
3BOARD_VEC(jmr3927_vec)
4#endif
5#ifdef CONFIG_TOSHIBA_RBTX4927
6BOARD_VEC(rbtx4927_vec)
7BOARD_VEC(rbtx4937_vec)
8#endif
9#ifdef CONFIG_TOSHIBA_RBTX4938
10BOARD_VEC(rbtx4938_vec)
11#endif
12#ifdef CONFIG_TOSHIBA_RBTX4939
13BOARD_VEC(rbtx4939_vec)
14#endif
diff --git a/arch/mips/include/asm/txx9/dmac.h b/arch/mips/include/asm/txx9/dmac.h
new file mode 100644
index 000000000..b47ef5fe7
--- /dev/null
+++ b/arch/mips/include/asm/txx9/dmac.h
@@ -0,0 +1,48 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * TXx9 SoC DMA Controller
4 */
5
6#ifndef __ASM_TXX9_DMAC_H
7#define __ASM_TXX9_DMAC_H
8
9#include <linux/dmaengine.h>
10
11#define TXX9_DMA_MAX_NR_CHANNELS 4
12
13/**
14 * struct txx9dmac_platform_data - Controller configuration parameters
15 * @memcpy_chan: Channel used for DMA_MEMCPY
16 * @have_64bit_regs: DMAC have 64 bit registers
17 */
18struct txx9dmac_platform_data {
19 int memcpy_chan;
20 bool have_64bit_regs;
21};
22
23/**
24 * struct txx9dmac_chan_platform_data - Channel configuration parameters
25 * @dmac_dev: A platform device for DMAC
26 */
27struct txx9dmac_chan_platform_data {
28 struct platform_device *dmac_dev;
29};
30
31/**
32 * struct txx9dmac_slave - Controller-specific information about a slave
33 * @tx_reg: physical address of data register used for
34 * memory-to-peripheral transfers
35 * @rx_reg: physical address of data register used for
36 * peripheral-to-memory transfers
37 * @reg_width: peripheral register width
38 */
39struct txx9dmac_slave {
40 u64 tx_reg;
41 u64 rx_reg;
42 unsigned int reg_width;
43};
44
45void txx9_dmac_init(int id, unsigned long baseaddr, int irq,
46 const struct txx9dmac_platform_data *pdata);
47
48#endif /* __ASM_TXX9_DMAC_H */
diff --git a/arch/mips/include/asm/txx9/generic.h b/arch/mips/include/asm/txx9/generic.h
new file mode 100644
index 000000000..9a2c47bf3
--- /dev/null
+++ b/arch/mips/include/asm/txx9/generic.h
@@ -0,0 +1,98 @@
1/*
2 * linux/include/asm-mips/txx9/generic.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#ifndef __ASM_TXX9_GENERIC_H
9#define __ASM_TXX9_GENERIC_H
10
11#include <linux/init.h>
12#include <linux/ioport.h> /* for struct resource */
13
14extern struct resource txx9_ce_res[];
15#define TXX9_CE(n) (unsigned long)(txx9_ce_res[(n)].start)
16extern unsigned int txx9_pcode;
17extern char txx9_pcode_str[8];
18void txx9_reg_res_init(unsigned int pcode, unsigned long base,
19 unsigned long size);
20
21extern unsigned int txx9_master_clock;
22extern unsigned int txx9_cpu_clock;
23extern unsigned int txx9_gbus_clock;
24#define TXX9_IMCLK (txx9_gbus_clock / 2)
25
26extern int txx9_ccfg_toeon;
27struct uart_port;
28int early_serial_txx9_setup(struct uart_port *port);
29
30struct pci_dev;
31struct txx9_board_vec {
32 const char *system;
33 void (*prom_init)(void);
34 void (*mem_setup)(void);
35 void (*irq_setup)(void);
36 void (*time_init)(void);
37 void (*arch_init)(void);
38 void (*device_init)(void);
39#ifdef CONFIG_PCI
40 int (*pci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
41#endif
42};
43extern struct txx9_board_vec *txx9_board_vec;
44extern int (*txx9_irq_dispatch)(int pending);
45const char *prom_getenv(const char *name);
46void txx9_wdt_init(unsigned long base);
47void txx9_wdt_now(unsigned long base);
48void txx9_spi_init(int busid, unsigned long base, int irq);
49void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
50void txx9_sio_init(unsigned long baseaddr, int irq,
51 unsigned int line, unsigned int sclk, int nocts);
52#ifdef CONFIG_EARLY_PRINTK
53extern void (*txx9_prom_putchar)(char c);
54void txx9_sio_putchar_init(unsigned long baseaddr);
55#else
56static inline void txx9_sio_putchar_init(unsigned long baseaddr)
57{
58}
59#endif
60
61struct physmap_flash_data;
62void txx9_physmap_flash_init(int no, unsigned long addr, unsigned long size,
63 const struct physmap_flash_data *pdata);
64
65/* 8 bit version of __fls(): find first bit set (returns 0..7) */
66static inline unsigned int __fls8(unsigned char x)
67{
68 int r = 7;
69
70 if (!(x & 0xf0)) {
71 r -= 4;
72 x <<= 4;
73 }
74 if (!(x & 0xc0)) {
75 r -= 2;
76 x <<= 2;
77 }
78 if (!(x & 0x80))
79 r -= 1;
80 return r;
81}
82
83void txx9_iocled_init(unsigned long baseaddr,
84 int basenum, unsigned int num, int lowactive,
85 const char *color, char **deftriggers);
86
87/* 7SEG LED */
88void txx9_7segled_init(unsigned int num,
89 void (*putc)(unsigned int pos, unsigned char val));
90int txx9_7segled_putc(unsigned int pos, char c);
91
92void __init txx9_aclc_init(unsigned long baseaddr, int irq,
93 unsigned int dmac_id,
94 unsigned int dma_chan_out,
95 unsigned int dma_chan_in);
96void __init txx9_sramc_init(struct resource *r);
97
98#endif /* __ASM_TXX9_GENERIC_H */
diff --git a/arch/mips/include/asm/txx9/jmr3927.h b/arch/mips/include/asm/txx9/jmr3927.h
new file mode 100644
index 000000000..aab959dc3
--- /dev/null
+++ b/arch/mips/include/asm/txx9/jmr3927.h
@@ -0,0 +1,179 @@
1/*
2 * Defines for the TJSYS JMR-TX3927
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_TXX9_JMR3927_H
11#define __ASM_TXX9_JMR3927_H
12
13#include <asm/txx9/tx3927.h>
14#include <asm/addrspace.h>
15#include <asm/txx9irq.h>
16
17/* CS */
18#define JMR3927_ROMCE0 0x1fc00000 /* 4M */
19#define JMR3927_ROMCE1 0x1e000000 /* 4M */
20#define JMR3927_ROMCE2 0x14000000 /* 16M */
21#define JMR3927_ROMCE3 0x10000000 /* 64M */
22#define JMR3927_ROMCE5 0x1d000000 /* 4M */
23#define JMR3927_SDCS0 0x00000000 /* 32M */
24#define JMR3927_SDCS1 0x02000000 /* 32M */
25/* PCI Direct Mappings */
26
27#define JMR3927_PCIMEM 0x08000000
28#define JMR3927_PCIMEM_SIZE 0x08000000 /* 128M */
29#define JMR3927_PCIIO 0x15000000
30#define JMR3927_PCIIO_SIZE 0x01000000 /* 16M */
31
32#define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */
33#define JMR3927_PORT_BASE KSEG1
34
35/* Address map (virtual address) */
36#define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0)
37#define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1)
38#define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2)
39#define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM)
40#define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO)
41
42#define JMR3927_IOC_REV_ADDR (JMR3927_IOC_BASE + 0x00000000)
43#define JMR3927_IOC_NVRAMB_ADDR (JMR3927_IOC_BASE + 0x00010000)
44#define JMR3927_IOC_LED_ADDR (JMR3927_IOC_BASE + 0x00020000)
45#define JMR3927_IOC_DIPSW_ADDR (JMR3927_IOC_BASE + 0x00030000)
46#define JMR3927_IOC_BREV_ADDR (JMR3927_IOC_BASE + 0x00040000)
47#define JMR3927_IOC_DTR_ADDR (JMR3927_IOC_BASE + 0x00050000)
48#define JMR3927_IOC_INTS1_ADDR (JMR3927_IOC_BASE + 0x00080000)
49#define JMR3927_IOC_INTS2_ADDR (JMR3927_IOC_BASE + 0x00090000)
50#define JMR3927_IOC_INTM_ADDR (JMR3927_IOC_BASE + 0x000a0000)
51#define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000)
52#define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000)
53
54/* Flash ROM */
55#define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE)
56#define JMR3927_FLASH_SIZE 0x00400000
57
58/* bits for IOC_REV/IOC_BREV (high byte) */
59#define JMR3927_IDT_MASK 0xfc
60#define JMR3927_REV_MASK 0x03
61#define JMR3927_IOC_IDT 0xe0
62
63/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */
64#define JMR3927_IOC_INTB_PCIA 0
65#define JMR3927_IOC_INTB_PCIB 1
66#define JMR3927_IOC_INTB_PCIC 2
67#define JMR3927_IOC_INTB_PCID 3
68#define JMR3927_IOC_INTB_MODEM 4
69#define JMR3927_IOC_INTB_INT6 5
70#define JMR3927_IOC_INTB_INT7 6
71#define JMR3927_IOC_INTB_SOFT 7
72#define JMR3927_IOC_INTF_PCIA (1 << JMR3927_IOC_INTF_PCIA)
73#define JMR3927_IOC_INTF_PCIB (1 << JMR3927_IOC_INTB_PCIB)
74#define JMR3927_IOC_INTF_PCIC (1 << JMR3927_IOC_INTB_PCIC)
75#define JMR3927_IOC_INTF_PCID (1 << JMR3927_IOC_INTB_PCID)
76#define JMR3927_IOC_INTF_MODEM (1 << JMR3927_IOC_INTB_MODEM)
77#define JMR3927_IOC_INTF_INT6 (1 << JMR3927_IOC_INTB_INT6)
78#define JMR3927_IOC_INTF_INT7 (1 << JMR3927_IOC_INTB_INT7)
79#define JMR3927_IOC_INTF_SOFT (1 << JMR3927_IOC_INTB_SOFT)
80
81/* bits for IOC_RESET (high byte) */
82#define JMR3927_IOC_RESET_CPU 1
83#define JMR3927_IOC_RESET_PCI 2
84
85#if defined(__BIG_ENDIAN)
86#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
87#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a))
88#elif defined(__LITTLE_ENDIAN)
89#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)((a)^1)) = (d))
90#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)((a)^1))
91#else
92#error "No Endian"
93#endif
94
95/* LED macro */
96#define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR)
97
98#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)
99
100/* DIPSW4 macro */
101#define jmr3927_dipsw1() (gpio_get_value(11) == 0)
102#define jmr3927_dipsw2() (gpio_get_value(10) == 0)
103#define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0)
104#define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0)
105
106/*
107 * IRQ mappings
108 */
109
110/* These are the virtual IRQ numbers, we divide all IRQ's into
111 * 'spaces', the 'space' determines where and how to enable/disable
112 * that particular IRQ on an JMR machine. Add new 'spaces' as new
113 * IRQ hardware is supported.
114 */
115#define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */
116#define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */
117
118#define JMR3927_IRQ_IRC TXX9_IRQ_BASE
119#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC)
120#define JMR3927_IRQ_END (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC)
121
122#define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0)
123#define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1)
124#define JMR3927_IRQ_IRC_INT2 (JMR3927_IRQ_IRC + TX3927_IR_INT2)
125#define JMR3927_IRQ_IRC_INT3 (JMR3927_IRQ_IRC + TX3927_IR_INT3)
126#define JMR3927_IRQ_IRC_INT4 (JMR3927_IRQ_IRC + TX3927_IR_INT4)
127#define JMR3927_IRQ_IRC_INT5 (JMR3927_IRQ_IRC + TX3927_IR_INT5)
128#define JMR3927_IRQ_IRC_SIO0 (JMR3927_IRQ_IRC + TX3927_IR_SIO0)
129#define JMR3927_IRQ_IRC_SIO1 (JMR3927_IRQ_IRC + TX3927_IR_SIO1)
130#define JMR3927_IRQ_IRC_SIO(ch) (JMR3927_IRQ_IRC + TX3927_IR_SIO(ch))
131#define JMR3927_IRQ_IRC_DMA (JMR3927_IRQ_IRC + TX3927_IR_DMA)
132#define JMR3927_IRQ_IRC_PIO (JMR3927_IRQ_IRC + TX3927_IR_PIO)
133#define JMR3927_IRQ_IRC_PCI (JMR3927_IRQ_IRC + TX3927_IR_PCI)
134#define JMR3927_IRQ_IRC_TMR(ch) (JMR3927_IRQ_IRC + TX3927_IR_TMR(ch))
135#define JMR3927_IRQ_IOC_PCIA (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIA)
136#define JMR3927_IRQ_IOC_PCIB (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIB)
137#define JMR3927_IRQ_IOC_PCIC (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIC)
138#define JMR3927_IRQ_IOC_PCID (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCID)
139#define JMR3927_IRQ_IOC_MODEM (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_MODEM)
140#define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6)
141#define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7)
142#define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT)
143
144/* IOC (PCI, MODEM) */
145#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1
146/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */
147#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3
148
149/* Clocks */
150#define JMR3927_CORECLK 132710400 /* 132.7MHz */
151
152/*
153 * TX3927 Pin Configuration:
154 *
155 * PCFG bits Avail Dead
156 * SELSIO[1:0]:11 RXD[1:0], TXD[1:0] PIO[6:3]
157 * SELSIOC[0]:1 CTS[0], RTS[0] INT[5:4]
158 * SELSIOC[1]:0,SELDSF:0, GSDAO[0],GPCST[3] CTS[1], RTS[1],DSF,
159 * GDBGE* PIO[2:1]
160 * SELDMA[2]:1 DMAREQ[2],DMAACK[2] PIO[13:12]
161 * SELTMR[2:0]:000 TIMER[1:0]
162 * SELCS:0,SELDMA[1]:0 PIO[11;10] SDCS_CE[7:6],
163 * DMAREQ[1],DMAACK[1]
164 * SELDMA[0]:1 DMAREQ[0],DMAACK[0] PIO[9:8]
165 * SELDMA[3]:1 DMAREQ[3],DMAACK[3] PIO[15:14]
166 * SELDONE:1 DMADONE PIO[7]
167 *
168 * Usable pins are:
169 * RXD[1;0],TXD[1:0],CTS[0],RTS[0],
170 * DMAREQ[0,2,3],DMAACK[0,2,3],DMADONE,PIO[0,10,11]
171 * INT[3:0]
172 */
173
174void jmr3927_prom_init(void);
175void jmr3927_irq_setup(void);
176struct pci_dev;
177int jmr3927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
178
179#endif /* __ASM_TXX9_JMR3927_H */
diff --git a/arch/mips/include/asm/txx9/pci.h b/arch/mips/include/asm/txx9/pci.h
new file mode 100644
index 000000000..3d3252906
--- /dev/null
+++ b/arch/mips/include/asm/txx9/pci.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#ifndef __ASM_TXX9_PCI_H
7#define __ASM_TXX9_PCI_H
8
9#include <linux/pci.h>
10
11extern struct pci_controller txx9_primary_pcic;
12struct pci_controller *
13txx9_alloc_pci_controller(struct pci_controller *pcic,
14 unsigned long mem_base, unsigned long mem_size,
15 unsigned long io_base, unsigned long io_size);
16
17int txx9_pci66_check(struct pci_controller *hose, int top_bus,
18 int current_bus);
19extern int txx9_pci_mem_high __initdata;
20
21extern int txx9_pci_option;
22#define TXX9_PCI_OPT_PICMG 0x0002
23#define TXX9_PCI_OPT_CLK_33 0x0008
24#define TXX9_PCI_OPT_CLK_66 0x0010
25#define TXX9_PCI_OPT_CLK_MASK \
26 (TXX9_PCI_OPT_CLK_33 | TXX9_PCI_OPT_CLK_66)
27#define TXX9_PCI_OPT_CLK_AUTO TXX9_PCI_OPT_CLK_MASK
28
29enum txx9_pci_err_action {
30 TXX9_PCI_ERR_REPORT,
31 TXX9_PCI_ERR_IGNORE,
32 TXX9_PCI_ERR_PANIC,
33};
34extern enum txx9_pci_err_action txx9_pci_err_action;
35
36extern char * (*txx9_board_pcibios_setup)(char *str);
37char *txx9_pcibios_setup(char *str);
38
39#endif /* __ASM_TXX9_PCI_H */
diff --git a/arch/mips/include/asm/txx9/rbtx4927.h b/arch/mips/include/asm/txx9/rbtx4927.h
new file mode 100644
index 000000000..4060ad26c
--- /dev/null
+++ b/arch/mips/include/asm/txx9/rbtx4927.h
@@ -0,0 +1,92 @@
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_TXX9_RBTX4927_H
28#define __ASM_TXX9_RBTX4927_H
29
30#include <asm/txx9/tx4927.h>
31
32#define RBTX4927_PCIMEM 0x08000000
33#define RBTX4927_PCIMEM_SIZE 0x08000000
34#define RBTX4927_PCIIO 0x16000000
35#define RBTX4927_PCIIO_SIZE 0x01000000
36
37#define RBTX4927_LED_ADDR (IO_BASE + TXX9_CE(2) + 0x00001000)
38#define RBTX4927_IMASK_ADDR (IO_BASE + TXX9_CE(2) + 0x00002000)
39#define RBTX4927_IMSTAT_ADDR (IO_BASE + TXX9_CE(2) + 0x00002006)
40#define RBTX4927_SOFTINT_ADDR (IO_BASE + TXX9_CE(2) + 0x00003000)
41#define RBTX4927_SOFTRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x0000f000)
42#define RBTX4927_SOFTRESETLOCK_ADDR (IO_BASE + TXX9_CE(2) + 0x0000f002)
43#define RBTX4927_PCIRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x0000f006)
44#define RBTX4927_BRAMRTC_BASE (IO_BASE + TXX9_CE(2) + 0x00010000)
45#define RBTX4927_ETHER_BASE (IO_BASE + TXX9_CE(2) + 0x00020000)
46
47/* Ethernet port address */
48#define RBTX4927_ETHER_ADDR (RBTX4927_ETHER_BASE + 0x280)
49
50#define rbtx4927_imask_addr ((__u8 __iomem *)RBTX4927_IMASK_ADDR)
51#define rbtx4927_imstat_addr ((__u8 __iomem *)RBTX4927_IMSTAT_ADDR)
52#define rbtx4927_softint_addr ((__u8 __iomem *)RBTX4927_SOFTINT_ADDR)
53#define rbtx4927_softreset_addr ((__u8 __iomem *)RBTX4927_SOFTRESET_ADDR)
54#define rbtx4927_softresetlock_addr \
55 ((__u8 __iomem *)RBTX4927_SOFTRESETLOCK_ADDR)
56#define rbtx4927_pcireset_addr ((__u8 __iomem *)RBTX4927_PCIRESET_ADDR)
57
58/* bits for ISTAT/IMASK/IMSTAT */
59#define RBTX4927_INTB_PCID 0
60#define RBTX4927_INTB_PCIC 1
61#define RBTX4927_INTB_PCIB 2
62#define RBTX4927_INTB_PCIA 3
63#define RBTX4927_INTF_PCID (1 << RBTX4927_INTB_PCID)
64#define RBTX4927_INTF_PCIC (1 << RBTX4927_INTB_PCIC)
65#define RBTX4927_INTF_PCIB (1 << RBTX4927_INTB_PCIB)
66#define RBTX4927_INTF_PCIA (1 << RBTX4927_INTB_PCIA)
67
68#define RBTX4927_NR_IRQ_IOC 8 /* IOC */
69
70#define RBTX4927_IRQ_IOC (TXX9_IRQ_BASE + TX4927_NUM_IR)
71#define RBTX4927_IRQ_IOC_PCID (RBTX4927_IRQ_IOC + RBTX4927_INTB_PCID)
72#define RBTX4927_IRQ_IOC_PCIC (RBTX4927_IRQ_IOC + RBTX4927_INTB_PCIC)
73#define RBTX4927_IRQ_IOC_PCIB (RBTX4927_IRQ_IOC + RBTX4927_INTB_PCIB)
74#define RBTX4927_IRQ_IOC_PCIA (RBTX4927_IRQ_IOC + RBTX4927_INTB_PCIA)
75
76#define RBTX4927_IRQ_IOCINT (TXX9_IRQ_BASE + TX4927_IR_INT(1))
77
78#ifdef CONFIG_PCI
79#define RBTX4927_ISA_IO_OFFSET RBTX4927_PCIIO
80#else
81#define RBTX4927_ISA_IO_OFFSET 0
82#endif
83
84#define RBTX4927_RTL_8019_BASE (RBTX4927_ETHER_ADDR - mips_io_port_base)
85#define RBTX4927_RTL_8019_IRQ (TXX9_IRQ_BASE + TX4927_IR_INT(3))
86
87void rbtx4927_prom_init(void);
88void rbtx4927_irq_setup(void);
89struct pci_dev;
90int rbtx4927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
91
92#endif /* __ASM_TXX9_RBTX4927_H */
diff --git a/arch/mips/include/asm/txx9/rbtx4938.h b/arch/mips/include/asm/txx9/rbtx4938.h
new file mode 100644
index 000000000..9c969dd3c
--- /dev/null
+++ b/arch/mips/include/asm/txx9/rbtx4938.h
@@ -0,0 +1,145 @@
1/*
2 * Definitions for TX4937/TX4938
3 *
4 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
5 * terms of the GNU General Public License version 2. This program is
6 * licensed "as is" without any warranty of any kind, whether express
7 * or implied.
8 *
9 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
10 */
11#ifndef __ASM_TXX9_RBTX4938_H
12#define __ASM_TXX9_RBTX4938_H
13
14#include <asm/addrspace.h>
15#include <asm/txx9irq.h>
16#include <asm/txx9/tx4938.h>
17
18/* Address map */
19#define RBTX4938_FPGA_REG_ADDR (IO_BASE + TXX9_CE(2) + 0x00000000)
20#define RBTX4938_FPGA_REV_ADDR (IO_BASE + TXX9_CE(2) + 0x00000002)
21#define RBTX4938_CONFIG1_ADDR (IO_BASE + TXX9_CE(2) + 0x00000004)
22#define RBTX4938_CONFIG2_ADDR (IO_BASE + TXX9_CE(2) + 0x00000006)
23#define RBTX4938_CONFIG3_ADDR (IO_BASE + TXX9_CE(2) + 0x00000008)
24#define RBTX4938_LED_ADDR (IO_BASE + TXX9_CE(2) + 0x00001000)
25#define RBTX4938_DIPSW_ADDR (IO_BASE + TXX9_CE(2) + 0x00001002)
26#define RBTX4938_BDIPSW_ADDR (IO_BASE + TXX9_CE(2) + 0x00001004)
27#define RBTX4938_IMASK_ADDR (IO_BASE + TXX9_CE(2) + 0x00002000)
28#define RBTX4938_IMASK2_ADDR (IO_BASE + TXX9_CE(2) + 0x00002002)
29#define RBTX4938_INTPOL_ADDR (IO_BASE + TXX9_CE(2) + 0x00002004)
30#define RBTX4938_ISTAT_ADDR (IO_BASE + TXX9_CE(2) + 0x00002006)
31#define RBTX4938_ISTAT2_ADDR (IO_BASE + TXX9_CE(2) + 0x00002008)
32#define RBTX4938_IMSTAT_ADDR (IO_BASE + TXX9_CE(2) + 0x0000200a)
33#define RBTX4938_IMSTAT2_ADDR (IO_BASE + TXX9_CE(2) + 0x0000200c)
34#define RBTX4938_SOFTINT_ADDR (IO_BASE + TXX9_CE(2) + 0x00003000)
35#define RBTX4938_PIOSEL_ADDR (IO_BASE + TXX9_CE(2) + 0x00005000)
36#define RBTX4938_SPICS_ADDR (IO_BASE + TXX9_CE(2) + 0x00005002)
37#define RBTX4938_SFPWR_ADDR (IO_BASE + TXX9_CE(2) + 0x00005008)
38#define RBTX4938_SFVOL_ADDR (IO_BASE + TXX9_CE(2) + 0x0000500a)
39#define RBTX4938_SOFTRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x00007000)
40#define RBTX4938_SOFTRESETLOCK_ADDR (IO_BASE + TXX9_CE(2) + 0x00007002)
41#define RBTX4938_PCIRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x00007004)
42#define RBTX4938_ETHER_BASE (IO_BASE + TXX9_CE(2) + 0x00020000)
43
44/* Ethernet port address (Jumperless Mode (W12:Open)) */
45#define RBTX4938_ETHER_ADDR (RBTX4938_ETHER_BASE + 0x280)
46
47/* bits for ISTAT/IMASK/IMSTAT */
48#define RBTX4938_INTB_PCID 0
49#define RBTX4938_INTB_PCIC 1
50#define RBTX4938_INTB_PCIB 2
51#define RBTX4938_INTB_PCIA 3
52#define RBTX4938_INTB_RTC 4
53#define RBTX4938_INTB_ATA 5
54#define RBTX4938_INTB_MODEM 6
55#define RBTX4938_INTB_SWINT 7
56#define RBTX4938_INTF_PCID (1 << RBTX4938_INTB_PCID)
57#define RBTX4938_INTF_PCIC (1 << RBTX4938_INTB_PCIC)
58#define RBTX4938_INTF_PCIB (1 << RBTX4938_INTB_PCIB)
59#define RBTX4938_INTF_PCIA (1 << RBTX4938_INTB_PCIA)
60#define RBTX4938_INTF_RTC (1 << RBTX4938_INTB_RTC)
61#define RBTX4938_INTF_ATA (1 << RBTX4938_INTB_ATA)
62#define RBTX4938_INTF_MODEM (1 << RBTX4938_INTB_MODEM)
63#define RBTX4938_INTF_SWINT (1 << RBTX4938_INTB_SWINT)
64
65#define rbtx4938_fpga_rev_addr ((__u8 __iomem *)RBTX4938_FPGA_REV_ADDR)
66#define rbtx4938_led_addr ((__u8 __iomem *)RBTX4938_LED_ADDR)
67#define rbtx4938_dipsw_addr ((__u8 __iomem *)RBTX4938_DIPSW_ADDR)
68#define rbtx4938_bdipsw_addr ((__u8 __iomem *)RBTX4938_BDIPSW_ADDR)
69#define rbtx4938_imask_addr ((__u8 __iomem *)RBTX4938_IMASK_ADDR)
70#define rbtx4938_imask2_addr ((__u8 __iomem *)RBTX4938_IMASK2_ADDR)
71#define rbtx4938_intpol_addr ((__u8 __iomem *)RBTX4938_INTPOL_ADDR)
72#define rbtx4938_istat_addr ((__u8 __iomem *)RBTX4938_ISTAT_ADDR)
73#define rbtx4938_istat2_addr ((__u8 __iomem *)RBTX4938_ISTAT2_ADDR)
74#define rbtx4938_imstat_addr ((__u8 __iomem *)RBTX4938_IMSTAT_ADDR)
75#define rbtx4938_imstat2_addr ((__u8 __iomem *)RBTX4938_IMSTAT2_ADDR)
76#define rbtx4938_softint_addr ((__u8 __iomem *)RBTX4938_SOFTINT_ADDR)
77#define rbtx4938_piosel_addr ((__u8 __iomem *)RBTX4938_PIOSEL_ADDR)
78#define rbtx4938_spics_addr ((__u8 __iomem *)RBTX4938_SPICS_ADDR)
79#define rbtx4938_sfpwr_addr ((__u8 __iomem *)RBTX4938_SFPWR_ADDR)
80#define rbtx4938_sfvol_addr ((__u8 __iomem *)RBTX4938_SFVOL_ADDR)
81#define rbtx4938_softreset_addr ((__u8 __iomem *)RBTX4938_SOFTRESET_ADDR)
82#define rbtx4938_softresetlock_addr \
83 ((__u8 __iomem *)RBTX4938_SOFTRESETLOCK_ADDR)
84#define rbtx4938_pcireset_addr ((__u8 __iomem *)RBTX4938_PCIRESET_ADDR)
85
86/*
87 * IRQ mappings
88 */
89
90#define RBTX4938_SOFT_INT0 0 /* not used */
91#define RBTX4938_SOFT_INT1 1 /* not used */
92#define RBTX4938_IRC_INT 2
93#define RBTX4938_TIMER_INT 7
94
95/* These are the virtual IRQ numbers, we divide all IRQ's into
96 * 'spaces', the 'space' determines where and how to enable/disable
97 * that particular IRQ on an RBTX4938 machine. Add new 'spaces' as new
98 * IRQ hardware is supported.
99 */
100#define RBTX4938_NR_IRQ_IOC 8
101
102#define RBTX4938_IRQ_IRC TXX9_IRQ_BASE
103#define RBTX4938_IRQ_IOC (TXX9_IRQ_BASE + TX4938_NUM_IR)
104#define RBTX4938_IRQ_END (RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC)
105
106#define RBTX4938_IRQ_IRC_ECCERR (RBTX4938_IRQ_IRC + TX4938_IR_ECCERR)
107#define RBTX4938_IRQ_IRC_WTOERR (RBTX4938_IRQ_IRC + TX4938_IR_WTOERR)
108#define RBTX4938_IRQ_IRC_INT(n) (RBTX4938_IRQ_IRC + TX4938_IR_INT(n))
109#define RBTX4938_IRQ_IRC_SIO(n) (RBTX4938_IRQ_IRC + TX4938_IR_SIO(n))
110#define RBTX4938_IRQ_IRC_DMA(ch, n) (RBTX4938_IRQ_IRC + TX4938_IR_DMA(ch, n))
111#define RBTX4938_IRQ_IRC_PIO (RBTX4938_IRQ_IRC + TX4938_IR_PIO)
112#define RBTX4938_IRQ_IRC_PDMAC (RBTX4938_IRQ_IRC + TX4938_IR_PDMAC)
113#define RBTX4938_IRQ_IRC_PCIC (RBTX4938_IRQ_IRC + TX4938_IR_PCIC)
114#define RBTX4938_IRQ_IRC_TMR(n) (RBTX4938_IRQ_IRC + TX4938_IR_TMR(n))
115#define RBTX4938_IRQ_IRC_NDFMC (RBTX4938_IRQ_IRC + TX4938_IR_NDFMC)
116#define RBTX4938_IRQ_IRC_PCIERR (RBTX4938_IRQ_IRC + TX4938_IR_PCIERR)
117#define RBTX4938_IRQ_IRC_PCIPME (RBTX4938_IRQ_IRC + TX4938_IR_PCIPME)
118#define RBTX4938_IRQ_IRC_ACLC (RBTX4938_IRQ_IRC + TX4938_IR_ACLC)
119#define RBTX4938_IRQ_IRC_ACLCPME (RBTX4938_IRQ_IRC + TX4938_IR_ACLCPME)
120#define RBTX4938_IRQ_IRC_PCIC1 (RBTX4938_IRQ_IRC + TX4938_IR_PCIC1)
121#define RBTX4938_IRQ_IRC_SPI (RBTX4938_IRQ_IRC + TX4938_IR_SPI)
122#define RBTX4938_IRQ_IOC_PCID (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCID)
123#define RBTX4938_IRQ_IOC_PCIC (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIC)
124#define RBTX4938_IRQ_IOC_PCIB (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIB)
125#define RBTX4938_IRQ_IOC_PCIA (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIA)
126#define RBTX4938_IRQ_IOC_RTC (RBTX4938_IRQ_IOC + RBTX4938_INTB_RTC)
127#define RBTX4938_IRQ_IOC_ATA (RBTX4938_IRQ_IOC + RBTX4938_INTB_ATA)
128#define RBTX4938_IRQ_IOC_MODEM (RBTX4938_IRQ_IOC + RBTX4938_INTB_MODEM)
129#define RBTX4938_IRQ_IOC_SWINT (RBTX4938_IRQ_IOC + RBTX4938_INTB_SWINT)
130
131
132/* IOC (PCI, etc) */
133#define RBTX4938_IRQ_IOCINT (TXX9_IRQ_BASE + TX4938_IR_INT(0))
134/* Onboard 10M Ether */
135#define RBTX4938_IRQ_ETHER (TXX9_IRQ_BASE + TX4938_IR_INT(1))
136
137#define RBTX4938_RTL_8019_BASE (RBTX4938_ETHER_ADDR - mips_io_port_base)
138#define RBTX4938_RTL_8019_IRQ (RBTX4938_IRQ_ETHER)
139
140void rbtx4938_prom_init(void);
141void rbtx4938_irq_setup(void);
142struct pci_dev;
143int rbtx4938_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
144
145#endif /* __ASM_TXX9_RBTX4938_H */
diff --git a/arch/mips/include/asm/txx9/rbtx4939.h b/arch/mips/include/asm/txx9/rbtx4939.h
new file mode 100644
index 000000000..6157bfd90
--- /dev/null
+++ b/arch/mips/include/asm/txx9/rbtx4939.h
@@ -0,0 +1,142 @@
1/*
2 * Definitions for RBTX4939
3 *
4 * (C) Copyright TOSHIBA CORPORATION 2005-2006
5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
6 * terms of the GNU General Public License version 2. This program is
7 * licensed "as is" without any warranty of any kind, whether express
8 * or implied.
9 */
10#ifndef __ASM_TXX9_RBTX4939_H
11#define __ASM_TXX9_RBTX4939_H
12
13#include <asm/addrspace.h>
14#include <asm/txx9irq.h>
15#include <asm/txx9/generic.h>
16#include <asm/txx9/tx4939.h>
17
18/* Address map */
19#define RBTX4939_IOC_REG_ADDR (IO_BASE + TXX9_CE(1) + 0x00000000)
20#define RBTX4939_BOARD_REV_ADDR (IO_BASE + TXX9_CE(1) + 0x00000000)
21#define RBTX4939_IOC_REV_ADDR (IO_BASE + TXX9_CE(1) + 0x00000002)
22#define RBTX4939_CONFIG1_ADDR (IO_BASE + TXX9_CE(1) + 0x00000004)
23#define RBTX4939_CONFIG2_ADDR (IO_BASE + TXX9_CE(1) + 0x00000006)
24#define RBTX4939_CONFIG3_ADDR (IO_BASE + TXX9_CE(1) + 0x00000008)
25#define RBTX4939_CONFIG4_ADDR (IO_BASE + TXX9_CE(1) + 0x0000000a)
26#define RBTX4939_USTAT_ADDR (IO_BASE + TXX9_CE(1) + 0x00001000)
27#define RBTX4939_UDIPSW_ADDR (IO_BASE + TXX9_CE(1) + 0x00001002)
28#define RBTX4939_BDIPSW_ADDR (IO_BASE + TXX9_CE(1) + 0x00001004)
29#define RBTX4939_IEN_ADDR (IO_BASE + TXX9_CE(1) + 0x00002000)
30#define RBTX4939_IPOL_ADDR (IO_BASE + TXX9_CE(1) + 0x00002002)
31#define RBTX4939_IFAC1_ADDR (IO_BASE + TXX9_CE(1) + 0x00002004)
32#define RBTX4939_IFAC2_ADDR (IO_BASE + TXX9_CE(1) + 0x00002006)
33#define RBTX4939_SOFTINT_ADDR (IO_BASE + TXX9_CE(1) + 0x00003000)
34#define RBTX4939_ISASTAT_ADDR (IO_BASE + TXX9_CE(1) + 0x00004000)
35#define RBTX4939_PCISTAT_ADDR (IO_BASE + TXX9_CE(1) + 0x00004002)
36#define RBTX4939_ROME_ADDR (IO_BASE + TXX9_CE(1) + 0x00004004)
37#define RBTX4939_SPICS_ADDR (IO_BASE + TXX9_CE(1) + 0x00004006)
38#define RBTX4939_AUDI_ADDR (IO_BASE + TXX9_CE(1) + 0x00004008)
39#define RBTX4939_ISAGPIO_ADDR (IO_BASE + TXX9_CE(1) + 0x0000400a)
40#define RBTX4939_PE1_ADDR (IO_BASE + TXX9_CE(1) + 0x00005000)
41#define RBTX4939_PE2_ADDR (IO_BASE + TXX9_CE(1) + 0x00005002)
42#define RBTX4939_PE3_ADDR (IO_BASE + TXX9_CE(1) + 0x00005004)
43#define RBTX4939_VP_ADDR (IO_BASE + TXX9_CE(1) + 0x00005006)
44#define RBTX4939_VPRESET_ADDR (IO_BASE + TXX9_CE(1) + 0x00005008)
45#define RBTX4939_VPSOUT_ADDR (IO_BASE + TXX9_CE(1) + 0x0000500a)
46#define RBTX4939_VPSIN_ADDR (IO_BASE + TXX9_CE(1) + 0x0000500c)
47#define RBTX4939_7SEG_ADDR(s, ch) \
48 (IO_BASE + TXX9_CE(1) + 0x00006000 + (s) * 16 + ((ch) & 3) * 2)
49#define RBTX4939_SOFTRESET_ADDR (IO_BASE + TXX9_CE(1) + 0x00007000)
50#define RBTX4939_RESETEN_ADDR (IO_BASE + TXX9_CE(1) + 0x00007002)
51#define RBTX4939_RESETSTAT_ADDR (IO_BASE + TXX9_CE(1) + 0x00007004)
52#define RBTX4939_ETHER_BASE (IO_BASE + TXX9_CE(1) + 0x00020000)
53
54/* Ethernet port address */
55#define RBTX4939_ETHER_ADDR (RBTX4939_ETHER_BASE + 0x300)
56
57/* bits for IEN/IPOL/IFAC */
58#define RBTX4938_INTB_ISA0 0
59#define RBTX4938_INTB_ISA11 1
60#define RBTX4938_INTB_ISA12 2
61#define RBTX4938_INTB_ISA15 3
62#define RBTX4938_INTB_I2S 4
63#define RBTX4938_INTB_SW 5
64#define RBTX4938_INTF_ISA0 (1 << RBTX4938_INTB_ISA0)
65#define RBTX4938_INTF_ISA11 (1 << RBTX4938_INTB_ISA11)
66#define RBTX4938_INTF_ISA12 (1 << RBTX4938_INTB_ISA12)
67#define RBTX4938_INTF_ISA15 (1 << RBTX4938_INTB_ISA15)
68#define RBTX4938_INTF_I2S (1 << RBTX4938_INTB_I2S)
69#define RBTX4938_INTF_SW (1 << RBTX4938_INTB_SW)
70
71/* bits for PE1,PE2,PE3 */
72#define RBTX4939_PE1_ATA(ch) (0x01 << (ch))
73#define RBTX4939_PE1_RMII(ch) (0x04 << (ch))
74#define RBTX4939_PE2_SIO0 0x01
75#define RBTX4939_PE2_SIO2 0x02
76#define RBTX4939_PE2_SIO3 0x04
77#define RBTX4939_PE2_CIR 0x08
78#define RBTX4939_PE2_SPI 0x10
79#define RBTX4939_PE2_GPIO 0x20
80#define RBTX4939_PE3_VP 0x01
81#define RBTX4939_PE3_VP_P 0x02
82#define RBTX4939_PE3_VP_S 0x04
83
84#define rbtx4939_board_rev_addr ((u8 __iomem *)RBTX4939_BOARD_REV_ADDR)
85#define rbtx4939_ioc_rev_addr ((u8 __iomem *)RBTX4939_IOC_REV_ADDR)
86#define rbtx4939_config1_addr ((u8 __iomem *)RBTX4939_CONFIG1_ADDR)
87#define rbtx4939_config2_addr ((u8 __iomem *)RBTX4939_CONFIG2_ADDR)
88#define rbtx4939_config3_addr ((u8 __iomem *)RBTX4939_CONFIG3_ADDR)
89#define rbtx4939_config4_addr ((u8 __iomem *)RBTX4939_CONFIG4_ADDR)
90#define rbtx4939_ustat_addr ((u8 __iomem *)RBTX4939_USTAT_ADDR)
91#define rbtx4939_udipsw_addr ((u8 __iomem *)RBTX4939_UDIPSW_ADDR)
92#define rbtx4939_bdipsw_addr ((u8 __iomem *)RBTX4939_BDIPSW_ADDR)
93#define rbtx4939_ien_addr ((u8 __iomem *)RBTX4939_IEN_ADDR)
94#define rbtx4939_ipol_addr ((u8 __iomem *)RBTX4939_IPOL_ADDR)
95#define rbtx4939_ifac1_addr ((u8 __iomem *)RBTX4939_IFAC1_ADDR)
96#define rbtx4939_ifac2_addr ((u8 __iomem *)RBTX4939_IFAC2_ADDR)
97#define rbtx4939_softint_addr ((u8 __iomem *)RBTX4939_SOFTINT_ADDR)
98#define rbtx4939_isastat_addr ((u8 __iomem *)RBTX4939_ISASTAT_ADDR)
99#define rbtx4939_pcistat_addr ((u8 __iomem *)RBTX4939_PCISTAT_ADDR)
100#define rbtx4939_rome_addr ((u8 __iomem *)RBTX4939_ROME_ADDR)
101#define rbtx4939_spics_addr ((u8 __iomem *)RBTX4939_SPICS_ADDR)
102#define rbtx4939_audi_addr ((u8 __iomem *)RBTX4939_AUDI_ADDR)
103#define rbtx4939_isagpio_addr ((u8 __iomem *)RBTX4939_ISAGPIO_ADDR)
104#define rbtx4939_pe1_addr ((u8 __iomem *)RBTX4939_PE1_ADDR)
105#define rbtx4939_pe2_addr ((u8 __iomem *)RBTX4939_PE2_ADDR)
106#define rbtx4939_pe3_addr ((u8 __iomem *)RBTX4939_PE3_ADDR)
107#define rbtx4939_vp_addr ((u8 __iomem *)RBTX4939_VP_ADDR)
108#define rbtx4939_vpreset_addr ((u8 __iomem *)RBTX4939_VPRESET_ADDR)
109#define rbtx4939_vpsout_addr ((u8 __iomem *)RBTX4939_VPSOUT_ADDR)
110#define rbtx4939_vpsin_addr ((u8 __iomem *)RBTX4939_VPSIN_ADDR)
111#define rbtx4939_7seg_addr(s, ch) \
112 ((u8 __iomem *)RBTX4939_7SEG_ADDR(s, ch))
113#define rbtx4939_softreset_addr ((u8 __iomem *)RBTX4939_SOFTRESET_ADDR)
114#define rbtx4939_reseten_addr ((u8 __iomem *)RBTX4939_RESETEN_ADDR)
115#define rbtx4939_resetstat_addr ((u8 __iomem *)RBTX4939_RESETSTAT_ADDR)
116
117/*
118 * IRQ mappings
119 */
120#define RBTX4939_NR_IRQ_IOC 8
121
122#define RBTX4939_IRQ_IOC (TXX9_IRQ_BASE + TX4939_NUM_IR)
123#define RBTX4939_IRQ_END (RBTX4939_IRQ_IOC + RBTX4939_NR_IRQ_IOC)
124
125/* IOC (ISA, etc) */
126#define RBTX4939_IRQ_IOCINT (TXX9_IRQ_BASE + TX4939_IR_INT(0))
127/* Onboard 10M Ether */
128#define RBTX4939_IRQ_ETHER (TXX9_IRQ_BASE + TX4939_IR_INT(1))
129
130void rbtx4939_prom_init(void);
131void rbtx4939_irq_setup(void);
132
133struct mtd_partition;
134struct map_info;
135struct rbtx4939_flash_data {
136 unsigned int width;
137 unsigned int nr_parts;
138 struct mtd_partition *parts;
139 void (*map_init)(struct map_info *map);
140};
141
142#endif /* __ASM_TXX9_RBTX4939_H */
diff --git a/arch/mips/include/asm/txx9/smsc_fdc37m81x.h b/arch/mips/include/asm/txx9/smsc_fdc37m81x.h
new file mode 100644
index 000000000..926d08f18
--- /dev/null
+++ b/arch/mips/include/asm/txx9/smsc_fdc37m81x.h
@@ -0,0 +1,68 @@
1/*
2 * Interface for smsc fdc48m81x Super IO chip
3 *
4 * Author: MontaVista Software, Inc. source@mvista.com
5 *
6 * 2001-2003 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 *
11 * Copyright (C) 2004 MontaVista Software Inc.
12 * Manish Lachwani, mlachwani@mvista.com
13 */
14
15#ifndef _SMSC_FDC37M81X_H_
16#define _SMSC_FDC37M81X_H_
17
18/* Common Registers */
19#define SMSC_FDC37M81X_CONFIG_INDEX 0x00
20#define SMSC_FDC37M81X_CONFIG_DATA 0x01
21#define SMSC_FDC37M81X_CONF 0x02
22#define SMSC_FDC37M81X_INDEX 0x03
23#define SMSC_FDC37M81X_DNUM 0x07
24#define SMSC_FDC37M81X_DID 0x20
25#define SMSC_FDC37M81X_DREV 0x21
26#define SMSC_FDC37M81X_PCNT 0x22
27#define SMSC_FDC37M81X_PMGT 0x23
28#define SMSC_FDC37M81X_OSC 0x24
29#define SMSC_FDC37M81X_CONFPA0 0x26
30#define SMSC_FDC37M81X_CONFPA1 0x27
31#define SMSC_FDC37M81X_TEST4 0x2B
32#define SMSC_FDC37M81X_TEST5 0x2C
33#define SMSC_FDC37M81X_TEST1 0x2D
34#define SMSC_FDC37M81X_TEST2 0x2E
35#define SMSC_FDC37M81X_TEST3 0x2F
36
37/* Logical device numbers */
38#define SMSC_FDC37M81X_FDD 0x00
39#define SMSC_FDC37M81X_PARALLEL 0x03
40#define SMSC_FDC37M81X_SERIAL1 0x04
41#define SMSC_FDC37M81X_SERIAL2 0x05
42#define SMSC_FDC37M81X_KBD 0x07
43#define SMSC_FDC37M81X_AUXIO 0x08
44#define SMSC_FDC37M81X_NONE 0xff
45
46/* Logical device Config Registers */
47#define SMSC_FDC37M81X_ACTIVE 0x30
48#define SMSC_FDC37M81X_BASEADDR0 0x60
49#define SMSC_FDC37M81X_BASEADDR1 0x61
50#define SMSC_FDC37M81X_INT 0x70
51#define SMSC_FDC37M81X_INT2 0x72
52#define SMSC_FDC37M81X_LDCR_F0 0xF0
53
54/* Chip Config Values */
55#define SMSC_FDC37M81X_CONFIG_ENTER 0x55
56#define SMSC_FDC37M81X_CONFIG_EXIT 0xaa
57#define SMSC_FDC37M81X_CHIP_ID 0x4d
58
59unsigned long smsc_fdc37m81x_init(unsigned long port);
60
61void smsc_fdc37m81x_config_beg(void);
62
63void smsc_fdc37m81x_config_end(void);
64
65u8 smsc_fdc37m81x_config_get(u8 reg);
66void smsc_fdc37m81x_config_set(u8 reg, u8 val);
67
68#endif
diff --git a/arch/mips/include/asm/txx9/spi.h b/arch/mips/include/asm/txx9/spi.h
new file mode 100644
index 000000000..0d727f354
--- /dev/null
+++ b/arch/mips/include/asm/txx9/spi.h
@@ -0,0 +1,34 @@
1/*
2 * Definitions for TX4937/TX4938 SPI
3 *
4 * Copyright (C) 2000-2001 Toshiba Corporation
5 *
6 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
7 * terms of the GNU General Public License version 2. This program is
8 * licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 *
11 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
12 */
13#ifndef __ASM_TXX9_SPI_H
14#define __ASM_TXX9_SPI_H
15
16#include <linux/errno.h>
17
18#ifdef CONFIG_SPI
19int spi_eeprom_register(int busid, int chipid, int size);
20int spi_eeprom_read(int busid, int chipid,
21 int address, unsigned char *buf, int len);
22#else
23static inline int spi_eeprom_register(int busid, int chipid, int size)
24{
25 return -ENODEV;
26}
27static inline int spi_eeprom_read(int busid, int chipid,
28 int address, unsigned char *buf, int len)
29{
30 return -ENODEV;
31}
32#endif
33
34#endif /* __ASM_TXX9_SPI_H */
diff --git a/arch/mips/include/asm/txx9/tx3927.h b/arch/mips/include/asm/txx9/tx3927.h
new file mode 100644
index 000000000..149fab4f8
--- /dev/null
+++ b/arch/mips/include/asm/txx9/tx3927.h
@@ -0,0 +1,341 @@
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_TXX9_TX3927_H
9#define __ASM_TXX9_TX3927_H
10
11#define TX3927_REG_BASE 0xfffe0000UL
12#define TX3927_REG_SIZE 0x00010000
13#define TX3927_SDRAMC_REG (TX3927_REG_BASE + 0x8000)
14#define TX3927_ROMC_REG (TX3927_REG_BASE + 0x9000)
15#define TX3927_DMA_REG (TX3927_REG_BASE + 0xb000)
16#define TX3927_IRC_REG (TX3927_REG_BASE + 0xc000)
17#define TX3927_PCIC_REG (TX3927_REG_BASE + 0xd000)
18#define TX3927_CCFG_REG (TX3927_REG_BASE + 0xe000)
19#define TX3927_NR_TMR 3
20#define TX3927_TMR_REG(ch) (TX3927_REG_BASE + 0xf000 + (ch) * 0x100)
21#define TX3927_NR_SIO 2
22#define TX3927_SIO_REG(ch) (TX3927_REG_BASE + 0xf300 + (ch) * 0x100)
23#define TX3927_PIO_REG (TX3927_REG_BASE + 0xf500)
24
25struct tx3927_sdramc_reg {
26 volatile unsigned long cr[8];
27 volatile unsigned long tr[3];
28 volatile unsigned long cmd;
29 volatile unsigned long smrs[2];
30};
31
32struct tx3927_romc_reg {
33 volatile unsigned long cr[8];
34};
35
36struct tx3927_dma_reg {
37 struct tx3927_dma_ch_reg {
38 volatile unsigned long cha;
39 volatile unsigned long sar;
40 volatile unsigned long dar;
41 volatile unsigned long cntr;
42 volatile unsigned long sair;
43 volatile unsigned long dair;
44 volatile unsigned long ccr;
45 volatile unsigned long csr;
46 } ch[4];
47 volatile unsigned long dbr[8];
48 volatile unsigned long tdhr;
49 volatile unsigned long mcr;
50 volatile unsigned long unused0;
51};
52
53#include <asm/byteorder.h>
54
55#ifdef __BIG_ENDIAN
56#define endian_def_s2(e1, e2) \
57 volatile unsigned short e1, e2
58#define endian_def_sb2(e1, e2, e3) \
59 volatile unsigned short e1;volatile unsigned char e2, e3
60#define endian_def_b2s(e1, e2, e3) \
61 volatile unsigned char e1, e2;volatile unsigned short e3
62#define endian_def_b4(e1, e2, e3, e4) \
63 volatile unsigned char e1, e2, e3, e4
64#else
65#define endian_def_s2(e1, e2) \
66 volatile unsigned short e2, e1
67#define endian_def_sb2(e1, e2, e3) \
68 volatile unsigned char e3, e2;volatile unsigned short e1
69#define endian_def_b2s(e1, e2, e3) \
70 volatile unsigned short e3;volatile unsigned char e2, e1
71#define endian_def_b4(e1, e2, e3, e4) \
72 volatile unsigned char e4, e3, e2, e1
73#endif
74
75struct tx3927_pcic_reg {
76 endian_def_s2(did, vid);
77 endian_def_s2(pcistat, pcicmd);
78 endian_def_b4(cc, scc, rpli, rid);
79 endian_def_b4(unused0, ht, mlt, cls);
80 volatile unsigned long ioba; /* +10 */
81 volatile unsigned long mba;
82 volatile unsigned long unused1[5];
83 endian_def_s2(svid, ssvid);
84 volatile unsigned long unused2; /* +30 */
85 endian_def_sb2(unused3, unused4, capptr);
86 volatile unsigned long unused5;
87 endian_def_b4(ml, mg, ip, il);
88 volatile unsigned long unused6; /* +40 */
89 volatile unsigned long istat;
90 volatile unsigned long iim;
91 volatile unsigned long rrt;
92 volatile unsigned long unused7[3]; /* +50 */
93 volatile unsigned long ipbmma;
94 volatile unsigned long ipbioma; /* +60 */
95 volatile unsigned long ilbmma;
96 volatile unsigned long ilbioma;
97 volatile unsigned long unused8[9];
98 volatile unsigned long tc; /* +90 */
99 volatile unsigned long tstat;
100 volatile unsigned long tim;
101 volatile unsigned long tccmd;
102 volatile unsigned long pcirrt; /* +a0 */
103 volatile unsigned long pcirrt_cmd;
104 volatile unsigned long pcirrdt;
105 volatile unsigned long unused9[3];
106 volatile unsigned long tlboap;
107 volatile unsigned long tlbiap;
108 volatile unsigned long tlbmma; /* +c0 */
109 volatile unsigned long tlbioma;
110 volatile unsigned long sc_msg;
111 volatile unsigned long sc_be;
112 volatile unsigned long tbl; /* +d0 */
113 volatile unsigned long unused10[3];
114 volatile unsigned long pwmng; /* +e0 */
115 volatile unsigned long pwmngs;
116 volatile unsigned long unused11[6];
117 volatile unsigned long req_trace; /* +100 */
118 volatile unsigned long pbapmc;
119 volatile unsigned long pbapms;
120 volatile unsigned long pbapmim;
121 volatile unsigned long bm; /* +110 */
122 volatile unsigned long cpcibrs;
123 volatile unsigned long cpcibgs;
124 volatile unsigned long pbacs;
125 volatile unsigned long iobas; /* +120 */
126 volatile unsigned long mbas;
127 volatile unsigned long lbc;
128 volatile unsigned long lbstat;
129 volatile unsigned long lbim; /* +130 */
130 volatile unsigned long pcistatim;
131 volatile unsigned long ica;
132 volatile unsigned long icd;
133 volatile unsigned long iiadp; /* +140 */
134 volatile unsigned long iscdp;
135 volatile unsigned long mmas;
136 volatile unsigned long iomas;
137 volatile unsigned long ipciaddr; /* +150 */
138 volatile unsigned long ipcidata;
139 volatile unsigned long ipcibe;
140};
141
142struct tx3927_ccfg_reg {
143 volatile unsigned long ccfg;
144 volatile unsigned long crir;
145 volatile unsigned long pcfg;
146 volatile unsigned long tear;
147 volatile unsigned long pdcr;
148};
149
150/*
151 * SDRAMC
152 */
153
154/*
155 * ROMC
156 */
157
158/*
159 * DMA
160 */
161/* bits for MCR */
162#define TX3927_DMA_MCR_EIS(ch) (0x10000000<<(ch))
163#define TX3927_DMA_MCR_DIS(ch) (0x01000000<<(ch))
164#define TX3927_DMA_MCR_RSFIF 0x00000080
165#define TX3927_DMA_MCR_FIFUM(ch) (0x00000008<<(ch))
166#define TX3927_DMA_MCR_LE 0x00000004
167#define TX3927_DMA_MCR_RPRT 0x00000002
168#define TX3927_DMA_MCR_MSTEN 0x00000001
169
170/* bits for CCRn */
171#define TX3927_DMA_CCR_DBINH 0x04000000
172#define TX3927_DMA_CCR_SBINH 0x02000000
173#define TX3927_DMA_CCR_CHRST 0x01000000
174#define TX3927_DMA_CCR_RVBYTE 0x00800000
175#define TX3927_DMA_CCR_ACKPOL 0x00400000
176#define TX3927_DMA_CCR_REQPL 0x00200000
177#define TX3927_DMA_CCR_EGREQ 0x00100000
178#define TX3927_DMA_CCR_CHDN 0x00080000
179#define TX3927_DMA_CCR_DNCTL 0x00060000
180#define TX3927_DMA_CCR_EXTRQ 0x00010000
181#define TX3927_DMA_CCR_INTRQD 0x0000e000
182#define TX3927_DMA_CCR_INTENE 0x00001000
183#define TX3927_DMA_CCR_INTENC 0x00000800
184#define TX3927_DMA_CCR_INTENT 0x00000400
185#define TX3927_DMA_CCR_CHNEN 0x00000200
186#define TX3927_DMA_CCR_XFACT 0x00000100
187#define TX3927_DMA_CCR_SNOP 0x00000080
188#define TX3927_DMA_CCR_DSTINC 0x00000040
189#define TX3927_DMA_CCR_SRCINC 0x00000020
190#define TX3927_DMA_CCR_XFSZ(order) (((order) << 2) & 0x0000001c)
191#define TX3927_DMA_CCR_XFSZ_1W TX3927_DMA_CCR_XFSZ(2)
192#define TX3927_DMA_CCR_XFSZ_4W TX3927_DMA_CCR_XFSZ(4)
193#define TX3927_DMA_CCR_XFSZ_8W TX3927_DMA_CCR_XFSZ(5)
194#define TX3927_DMA_CCR_XFSZ_16W TX3927_DMA_CCR_XFSZ(6)
195#define TX3927_DMA_CCR_XFSZ_32W TX3927_DMA_CCR_XFSZ(7)
196#define TX3927_DMA_CCR_MEMIO 0x00000002
197#define TX3927_DMA_CCR_ONEAD 0x00000001
198
199/* bits for CSRn */
200#define TX3927_DMA_CSR_CHNACT 0x00000100
201#define TX3927_DMA_CSR_ABCHC 0x00000080
202#define TX3927_DMA_CSR_NCHNC 0x00000040
203#define TX3927_DMA_CSR_NTRNFC 0x00000020
204#define TX3927_DMA_CSR_EXTDN 0x00000010
205#define TX3927_DMA_CSR_CFERR 0x00000008
206#define TX3927_DMA_CSR_CHERR 0x00000004
207#define TX3927_DMA_CSR_DESERR 0x00000002
208#define TX3927_DMA_CSR_SORERR 0x00000001
209
210/*
211 * IRC
212 */
213#define TX3927_IR_INT0 0
214#define TX3927_IR_INT1 1
215#define TX3927_IR_INT2 2
216#define TX3927_IR_INT3 3
217#define TX3927_IR_INT4 4
218#define TX3927_IR_INT5 5
219#define TX3927_IR_SIO0 6
220#define TX3927_IR_SIO1 7
221#define TX3927_IR_SIO(ch) (6 + (ch))
222#define TX3927_IR_DMA 8
223#define TX3927_IR_PIO 9
224#define TX3927_IR_PCI 10
225#define TX3927_IR_TMR(ch) (13 + (ch))
226#define TX3927_NUM_IR 16
227
228/*
229 * PCIC
230 */
231/* bits for PCICMD */
232/* see PCI_COMMAND_XXX in linux/pci.h */
233
234/* bits for PCISTAT */
235/* see PCI_STATUS_XXX in linux/pci.h */
236#define PCI_STATUS_NEW_CAP 0x0010
237
238/* bits for ISTAT/IIM */
239#define TX3927_PCIC_IIM_ALL 0x00001600
240
241/* bits for TC */
242#define TX3927_PCIC_TC_OF16E 0x00000020
243#define TX3927_PCIC_TC_IF8E 0x00000010
244#define TX3927_PCIC_TC_OF8E 0x00000008
245
246/* bits for TSTAT/TIM */
247#define TX3927_PCIC_TIM_ALL 0x0003ffff
248
249/* bits for IOBA/MBA */
250/* see PCI_BASE_ADDRESS_XXX in linux/pci.h */
251
252/* bits for PBAPMC */
253#define TX3927_PCIC_PBAPMC_RPBA 0x00000004
254#define TX3927_PCIC_PBAPMC_PBAEN 0x00000002
255#define TX3927_PCIC_PBAPMC_BMCEN 0x00000001
256
257/* bits for LBSTAT/LBIM */
258#define TX3927_PCIC_LBIM_ALL 0x0000003e
259
260/* bits for PCISTATIM (see also PCI_STATUS_XXX in linux/pci.h */
261#define TX3927_PCIC_PCISTATIM_ALL 0x0000f900
262
263/* bits for LBC */
264#define TX3927_PCIC_LBC_IBSE 0x00004000
265#define TX3927_PCIC_LBC_TIBSE 0x00002000
266#define TX3927_PCIC_LBC_TMFBSE 0x00001000
267#define TX3927_PCIC_LBC_HRST 0x00000800
268#define TX3927_PCIC_LBC_SRST 0x00000400
269#define TX3927_PCIC_LBC_EPCAD 0x00000200
270#define TX3927_PCIC_LBC_MSDSE 0x00000100
271#define TX3927_PCIC_LBC_CRR 0x00000080
272#define TX3927_PCIC_LBC_ILMDE 0x00000040
273#define TX3927_PCIC_LBC_ILIDE 0x00000020
274
275#define TX3927_PCIC_IDSEL_AD_TO_SLOT(ad) ((ad) - 11)
276#define TX3927_PCIC_MAX_DEVNU TX3927_PCIC_IDSEL_AD_TO_SLOT(32)
277
278/*
279 * CCFG
280 */
281/* CCFG : Chip Configuration */
282#define TX3927_CCFG_TLBOFF 0x00020000
283#define TX3927_CCFG_BEOW 0x00010000
284#define TX3927_CCFG_WR 0x00008000
285#define TX3927_CCFG_TOE 0x00004000
286#define TX3927_CCFG_PCIXARB 0x00002000
287#define TX3927_CCFG_PCI3 0x00001000
288#define TX3927_CCFG_PSNP 0x00000800
289#define TX3927_CCFG_PPRI 0x00000400
290#define TX3927_CCFG_PLLM 0x00000030
291#define TX3927_CCFG_ENDIAN 0x00000004
292#define TX3927_CCFG_HALT 0x00000002
293#define TX3927_CCFG_ACEHOLD 0x00000001
294
295/* PCFG : Pin Configuration */
296#define TX3927_PCFG_SYSCLKEN 0x08000000
297#define TX3927_PCFG_SDRCLKEN_ALL 0x07c00000
298#define TX3927_PCFG_SDRCLKEN(ch) (0x00400000<<(ch))
299#define TX3927_PCFG_PCICLKEN_ALL 0x003c0000
300#define TX3927_PCFG_PCICLKEN(ch) (0x00040000<<(ch))
301#define TX3927_PCFG_SELALL 0x0003ffff
302#define TX3927_PCFG_SELCS 0x00020000
303#define TX3927_PCFG_SELDSF 0x00010000
304#define TX3927_PCFG_SELSIOC_ALL 0x0000c000
305#define TX3927_PCFG_SELSIOC(ch) (0x00004000<<(ch))
306#define TX3927_PCFG_SELSIO_ALL 0x00003000
307#define TX3927_PCFG_SELSIO(ch) (0x00001000<<(ch))
308#define TX3927_PCFG_SELTMR_ALL 0x00000e00
309#define TX3927_PCFG_SELTMR(ch) (0x00000200<<(ch))
310#define TX3927_PCFG_SELDONE 0x00000100
311#define TX3927_PCFG_INTDMA_ALL 0x000000f0
312#define TX3927_PCFG_INTDMA(ch) (0x00000010<<(ch))
313#define TX3927_PCFG_SELDMA_ALL 0x0000000f
314#define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch))
315
316#define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG)
317#define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG)
318#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG)
319#define tx3927_pcicptr ((struct tx3927_pcic_reg *)TX3927_PCIC_REG)
320#define tx3927_ccfgptr ((struct tx3927_ccfg_reg *)TX3927_CCFG_REG)
321#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch))
322#define tx3927_pioptr ((struct txx9_pio_reg __iomem *)TX3927_PIO_REG)
323
324#define TX3927_REV_PCODE() (tx3927_ccfgptr->crir >> 16)
325#define TX3927_ROMC_BA(ch) (tx3927_romcptr->cr[(ch)] & 0xfff00000)
326#define TX3927_ROMC_SIZE(ch) \
327 (0x00100000 << ((tx3927_romcptr->cr[(ch)] >> 8) & 0xf))
328#define TX3927_ROMC_WIDTH(ch) (32 >> ((tx3927_romcptr->cr[(ch)] >> 7) & 0x1))
329
330void tx3927_wdt_init(void);
331void tx3927_setup(void);
332void tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr);
333void tx3927_sio_init(unsigned int sclk, unsigned int cts_mask);
334struct pci_controller;
335void tx3927_pcic_setup(struct pci_controller *channel,
336 unsigned long sdram_size, int extarb);
337void tx3927_setup_pcierr_irq(void);
338void tx3927_irq_init(void);
339void tx3927_mtd_init(int ch);
340
341#endif /* __ASM_TXX9_TX3927_H */
diff --git a/arch/mips/include/asm/txx9/tx4927.h b/arch/mips/include/asm/txx9/tx4927.h
new file mode 100644
index 000000000..284eea752
--- /dev/null
+++ b/arch/mips/include/asm/txx9/tx4927.h
@@ -0,0 +1,273 @@
1/*
2 * Author: MontaVista Software, Inc.
3 * source@mvista.com
4 *
5 * Copyright 2001-2006 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_TXX9_TX4927_H
28#define __ASM_TXX9_TX4927_H
29
30#include <linux/types.h>
31#include <linux/io.h>
32#include <asm/txx9irq.h>
33#include <asm/txx9/tx4927pcic.h>
34
35#ifdef CONFIG_64BIT
36#define TX4927_REG_BASE 0xffffffffff1f0000UL
37#else
38#define TX4927_REG_BASE 0xff1f0000UL
39#endif
40#define TX4927_REG_SIZE 0x00010000
41
42#define TX4927_SDRAMC_REG (TX4927_REG_BASE + 0x8000)
43#define TX4927_EBUSC_REG (TX4927_REG_BASE + 0x9000)
44#define TX4927_DMA_REG (TX4927_REG_BASE + 0xb000)
45#define TX4927_PCIC_REG (TX4927_REG_BASE + 0xd000)
46#define TX4927_CCFG_REG (TX4927_REG_BASE + 0xe000)
47#define TX4927_IRC_REG (TX4927_REG_BASE + 0xf600)
48#define TX4927_NR_TMR 3
49#define TX4927_TMR_REG(ch) (TX4927_REG_BASE + 0xf000 + (ch) * 0x100)
50#define TX4927_NR_SIO 2
51#define TX4927_SIO_REG(ch) (TX4927_REG_BASE + 0xf300 + (ch) * 0x100)
52#define TX4927_PIO_REG (TX4927_REG_BASE + 0xf500)
53#define TX4927_ACLC_REG (TX4927_REG_BASE + 0xf700)
54
55#define TX4927_IR_ECCERR 0
56#define TX4927_IR_WTOERR 1
57#define TX4927_NUM_IR_INT 6
58#define TX4927_IR_INT(n) (2 + (n))
59#define TX4927_NUM_IR_SIO 2
60#define TX4927_IR_SIO(n) (8 + (n))
61#define TX4927_NUM_IR_DMA 4
62#define TX4927_IR_DMA(n) (10 + (n))
63#define TX4927_IR_PIO 14
64#define TX4927_IR_PDMAC 15
65#define TX4927_IR_PCIC 16
66#define TX4927_NUM_IR_TMR 3
67#define TX4927_IR_TMR(n) (17 + (n))
68#define TX4927_IR_PCIERR 22
69#define TX4927_IR_PCIPME 23
70#define TX4927_IR_ACLC 24
71#define TX4927_IR_ACLCPME 25
72#define TX4927_NUM_IR 32
73
74#define TX4927_IRC_INT 2 /* IP[2] in Status register */
75
76#define TX4927_NUM_PIO 16
77
78struct tx4927_sdramc_reg {
79 u64 cr[4];
80 u64 unused0[4];
81 u64 tr;
82 u64 unused1[2];
83 u64 cmd;
84};
85
86struct tx4927_ebusc_reg {
87 u64 cr[8];
88};
89
90struct tx4927_ccfg_reg {
91 u64 ccfg;
92 u64 crir;
93 u64 pcfg;
94 u64 toea;
95 u64 clkctr;
96 u64 unused0;
97 u64 garbc;
98 u64 unused1;
99 u64 unused2;
100 u64 ramp;
101};
102
103/*
104 * CCFG
105 */
106/* CCFG : Chip Configuration */
107#define TX4927_CCFG_WDRST 0x0000020000000000ULL
108#define TX4927_CCFG_WDREXEN 0x0000010000000000ULL
109#define TX4927_CCFG_BCFG_MASK 0x000000ff00000000ULL
110#define TX4927_CCFG_TINTDIS 0x01000000
111#define TX4927_CCFG_PCI66 0x00800000
112#define TX4927_CCFG_PCIMODE 0x00400000
113#define TX4927_CCFG_DIVMODE_MASK 0x000e0000
114#define TX4927_CCFG_DIVMODE_8 (0x0 << 17)
115#define TX4927_CCFG_DIVMODE_12 (0x1 << 17)
116#define TX4927_CCFG_DIVMODE_16 (0x2 << 17)
117#define TX4927_CCFG_DIVMODE_10 (0x3 << 17)
118#define TX4927_CCFG_DIVMODE_2 (0x4 << 17)
119#define TX4927_CCFG_DIVMODE_3 (0x5 << 17)
120#define TX4927_CCFG_DIVMODE_4 (0x6 << 17)
121#define TX4927_CCFG_DIVMODE_2_5 (0x7 << 17)
122#define TX4927_CCFG_BEOW 0x00010000
123#define TX4927_CCFG_WR 0x00008000
124#define TX4927_CCFG_TOE 0x00004000
125#define TX4927_CCFG_PCIARB 0x00002000
126#define TX4927_CCFG_PCIDIVMODE_MASK 0x00001800
127#define TX4927_CCFG_PCIDIVMODE_2_5 0x00000000
128#define TX4927_CCFG_PCIDIVMODE_3 0x00000800
129#define TX4927_CCFG_PCIDIVMODE_5 0x00001000
130#define TX4927_CCFG_PCIDIVMODE_6 0x00001800
131#define TX4927_CCFG_SYSSP_MASK 0x000000c0
132#define TX4927_CCFG_ENDIAN 0x00000004
133#define TX4927_CCFG_HALT 0x00000002
134#define TX4927_CCFG_ACEHOLD 0x00000001
135#define TX4927_CCFG_W1CBITS (TX4927_CCFG_WDRST | TX4927_CCFG_BEOW)
136
137/* PCFG : Pin Configuration */
138#define TX4927_PCFG_SDCLKDLY_MASK 0x30000000
139#define TX4927_PCFG_SDCLKDLY(d) ((d)<<28)
140#define TX4927_PCFG_SYSCLKEN 0x08000000
141#define TX4927_PCFG_SDCLKEN_ALL 0x07800000
142#define TX4927_PCFG_SDCLKEN(ch) (0x00800000<<(ch))
143#define TX4927_PCFG_PCICLKEN_ALL 0x003f0000
144#define TX4927_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
145#define TX4927_PCFG_SEL2 0x00000200
146#define TX4927_PCFG_SEL1 0x00000100
147#define TX4927_PCFG_DMASEL_ALL 0x000000ff
148#define TX4927_PCFG_DMASEL0_MASK 0x00000003
149#define TX4927_PCFG_DMASEL1_MASK 0x0000000c
150#define TX4927_PCFG_DMASEL2_MASK 0x00000030
151#define TX4927_PCFG_DMASEL3_MASK 0x000000c0
152#define TX4927_PCFG_DMASEL0_DRQ0 0x00000000
153#define TX4927_PCFG_DMASEL0_SIO1 0x00000001
154#define TX4927_PCFG_DMASEL0_ACL0 0x00000002
155#define TX4927_PCFG_DMASEL0_ACL2 0x00000003
156#define TX4927_PCFG_DMASEL1_DRQ1 0x00000000
157#define TX4927_PCFG_DMASEL1_SIO1 0x00000004
158#define TX4927_PCFG_DMASEL1_ACL1 0x00000008
159#define TX4927_PCFG_DMASEL1_ACL3 0x0000000c
160#define TX4927_PCFG_DMASEL2_DRQ2 0x00000000 /* SEL2=0 */
161#define TX4927_PCFG_DMASEL2_SIO0 0x00000010 /* SEL2=0 */
162#define TX4927_PCFG_DMASEL2_ACL1 0x00000000 /* SEL2=1 */
163#define TX4927_PCFG_DMASEL2_ACL2 0x00000020 /* SEL2=1 */
164#define TX4927_PCFG_DMASEL2_ACL0 0x00000030 /* SEL2=1 */
165#define TX4927_PCFG_DMASEL3_DRQ3 0x00000000
166#define TX4927_PCFG_DMASEL3_SIO0 0x00000040
167#define TX4927_PCFG_DMASEL3_ACL3 0x00000080
168#define TX4927_PCFG_DMASEL3_ACL1 0x000000c0
169
170/* CLKCTR : Clock Control */
171#define TX4927_CLKCTR_ACLCKD 0x02000000
172#define TX4927_CLKCTR_PIOCKD 0x01000000
173#define TX4927_CLKCTR_DMACKD 0x00800000
174#define TX4927_CLKCTR_PCICKD 0x00400000
175#define TX4927_CLKCTR_TM0CKD 0x00100000
176#define TX4927_CLKCTR_TM1CKD 0x00080000
177#define TX4927_CLKCTR_TM2CKD 0x00040000
178#define TX4927_CLKCTR_SIO0CKD 0x00020000
179#define TX4927_CLKCTR_SIO1CKD 0x00010000
180#define TX4927_CLKCTR_ACLRST 0x00000200
181#define TX4927_CLKCTR_PIORST 0x00000100
182#define TX4927_CLKCTR_DMARST 0x00000080
183#define TX4927_CLKCTR_PCIRST 0x00000040
184#define TX4927_CLKCTR_TM0RST 0x00000010
185#define TX4927_CLKCTR_TM1RST 0x00000008
186#define TX4927_CLKCTR_TM2RST 0x00000004
187#define TX4927_CLKCTR_SIO0RST 0x00000002
188#define TX4927_CLKCTR_SIO1RST 0x00000001
189
190#define tx4927_sdramcptr \
191 ((struct tx4927_sdramc_reg __iomem *)TX4927_SDRAMC_REG)
192#define tx4927_pcicptr \
193 ((struct tx4927_pcic_reg __iomem *)TX4927_PCIC_REG)
194#define tx4927_ccfgptr \
195 ((struct tx4927_ccfg_reg __iomem *)TX4927_CCFG_REG)
196#define tx4927_ebuscptr \
197 ((struct tx4927_ebusc_reg __iomem *)TX4927_EBUSC_REG)
198#define tx4927_pioptr ((struct txx9_pio_reg __iomem *)TX4927_PIO_REG)
199
200#define TX4927_REV_PCODE() \
201 ((__u32)__raw_readq(&tx4927_ccfgptr->crir) >> 16)
202
203#define TX4927_SDRAMC_CR(ch) __raw_readq(&tx4927_sdramcptr->cr[(ch)])
204#define TX4927_SDRAMC_BA(ch) ((TX4927_SDRAMC_CR(ch) >> 49) << 21)
205#define TX4927_SDRAMC_SIZE(ch) \
206 ((((TX4927_SDRAMC_CR(ch) >> 33) & 0x7fff) + 1) << 21)
207
208#define TX4927_EBUSC_CR(ch) __raw_readq(&tx4927_ebuscptr->cr[(ch)])
209#define TX4927_EBUSC_BA(ch) ((TX4927_EBUSC_CR(ch) >> 48) << 20)
210#define TX4927_EBUSC_SIZE(ch) \
211 (0x00100000 << ((unsigned long)(TX4927_EBUSC_CR(ch) >> 8) & 0xf))
212#define TX4927_EBUSC_WIDTH(ch) \
213 (64 >> ((__u32)(TX4927_EBUSC_CR(ch) >> 20) & 0x3))
214
215/* utilities */
216static inline void txx9_clear64(__u64 __iomem *adr, __u64 bits)
217{
218#ifdef CONFIG_32BIT
219 unsigned long flags;
220 local_irq_save(flags);
221#endif
222 ____raw_writeq(____raw_readq(adr) & ~bits, adr);
223#ifdef CONFIG_32BIT
224 local_irq_restore(flags);
225#endif
226}
227static inline void txx9_set64(__u64 __iomem *adr, __u64 bits)
228{
229#ifdef CONFIG_32BIT
230 unsigned long flags;
231 local_irq_save(flags);
232#endif
233 ____raw_writeq(____raw_readq(adr) | bits, adr);
234#ifdef CONFIG_32BIT
235 local_irq_restore(flags);
236#endif
237}
238
239/* These functions are not interrupt safe. */
240static inline void tx4927_ccfg_clear(__u64 bits)
241{
242 ____raw_writeq(____raw_readq(&tx4927_ccfgptr->ccfg)
243 & ~(TX4927_CCFG_W1CBITS | bits),
244 &tx4927_ccfgptr->ccfg);
245}
246static inline void tx4927_ccfg_set(__u64 bits)
247{
248 ____raw_writeq((____raw_readq(&tx4927_ccfgptr->ccfg)
249 & ~TX4927_CCFG_W1CBITS) | bits,
250 &tx4927_ccfgptr->ccfg);
251}
252static inline void tx4927_ccfg_change(__u64 change, __u64 new)
253{
254 ____raw_writeq((____raw_readq(&tx4927_ccfgptr->ccfg)
255 & ~(TX4927_CCFG_W1CBITS | change)) |
256 new,
257 &tx4927_ccfgptr->ccfg);
258}
259
260unsigned int tx4927_get_mem_size(void);
261void tx4927_wdt_init(void);
262void tx4927_setup(void);
263void tx4927_time_init(unsigned int tmrnr);
264void tx4927_sio_init(unsigned int sclk, unsigned int cts_mask);
265int tx4927_report_pciclk(void);
266int tx4927_pciclk66_setup(void);
267void tx4927_setup_pcierr_irq(void);
268void tx4927_irq_init(void);
269void tx4927_mtd_init(int ch);
270void tx4927_dmac_init(int memcpy_chan);
271void tx4927_aclc_init(unsigned int dma_chan_out, unsigned int dma_chan_in);
272
273#endif /* __ASM_TXX9_TX4927_H */
diff --git a/arch/mips/include/asm/txx9/tx4927pcic.h b/arch/mips/include/asm/txx9/tx4927pcic.h
new file mode 100644
index 000000000..9eab2698c
--- /dev/null
+++ b/arch/mips/include/asm/txx9/tx4927pcic.h
@@ -0,0 +1,203 @@
1/*
2 * include/asm-mips/txx9/tx4927pcic.h
3 * TX4927 PCI controller definitions.
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_TXX9_TX4927PCIC_H
10#define __ASM_TXX9_TX4927PCIC_H
11
12#include <linux/pci.h>
13#include <linux/irqreturn.h>
14
15struct tx4927_pcic_reg {
16 u32 pciid;
17 u32 pcistatus;
18 u32 pciccrev;
19 u32 pcicfg1;
20 u32 p2gm0plbase; /* +10 */
21 u32 p2gm0pubase;
22 u32 p2gm1plbase;
23 u32 p2gm1pubase;
24 u32 p2gm2pbase; /* +20 */
25 u32 p2giopbase;
26 u32 unused0;
27 u32 pcisid;
28 u32 unused1; /* +30 */
29 u32 pcicapptr;
30 u32 unused2;
31 u32 pcicfg2;
32 u32 g2ptocnt; /* +40 */
33 u32 unused3[15];
34 u32 g2pstatus; /* +80 */
35 u32 g2pmask;
36 u32 pcisstatus;
37 u32 pcimask;
38 u32 p2gcfg; /* +90 */
39 u32 p2gstatus;
40 u32 p2gmask;
41 u32 p2gccmd;
42 u32 unused4[24]; /* +a0 */
43 u32 pbareqport; /* +100 */
44 u32 pbacfg;
45 u32 pbastatus;
46 u32 pbamask;
47 u32 pbabm; /* +110 */
48 u32 pbacreq;
49 u32 pbacgnt;
50 u32 pbacstate;
51 u64 g2pmgbase[3]; /* +120 */
52 u64 g2piogbase;
53 u32 g2pmmask[3]; /* +140 */
54 u32 g2piomask;
55 u64 g2pmpbase[3]; /* +150 */
56 u64 g2piopbase;
57 u32 pciccfg; /* +170 */
58 u32 pcicstatus;
59 u32 pcicmask;
60 u32 unused5;
61 u64 p2gmgbase[3]; /* +180 */
62 u64 p2giogbase;
63 u32 g2pcfgadrs; /* +1a0 */
64 u32 g2pcfgdata;
65 u32 unused6[8];
66 u32 g2pintack;
67 u32 g2pspc;
68 u32 unused7[12]; /* +1d0 */
69 u64 pdmca; /* +200 */
70 u64 pdmga;
71 u64 pdmpa;
72 u64 pdmctr;
73 u64 pdmcfg; /* +220 */
74 u64 pdmsts;
75};
76
77/* bits for PCICMD */
78/* see PCI_COMMAND_XXX in linux/pci_regs.h */
79
80/* bits for PCISTAT */
81/* see PCI_STATUS_XXX in linux/pci_regs.h */
82
83/* bits for IOBA/MBA */
84/* see PCI_BASE_ADDRESS_XXX in linux/pci_regs.h */
85
86/* bits for G2PSTATUS/G2PMASK */
87#define TX4927_PCIC_G2PSTATUS_ALL 0x00000003
88#define TX4927_PCIC_G2PSTATUS_TTOE 0x00000002
89#define TX4927_PCIC_G2PSTATUS_RTOE 0x00000001
90
91/* bits for PCIMASK (see also PCI_STATUS_XXX in linux/pci_regs.h */
92#define TX4927_PCIC_PCISTATUS_ALL 0x0000f900
93
94/* bits for PBACFG */
95#define TX4927_PCIC_PBACFG_FIXPA 0x00000008
96#define TX4927_PCIC_PBACFG_RPBA 0x00000004
97#define TX4927_PCIC_PBACFG_PBAEN 0x00000002
98#define TX4927_PCIC_PBACFG_BMCEN 0x00000001
99
100/* bits for PBASTATUS/PBAMASK */
101#define TX4927_PCIC_PBASTATUS_ALL 0x00000001
102#define TX4927_PCIC_PBASTATUS_BM 0x00000001
103
104/* bits for G2PMnGBASE */
105#define TX4927_PCIC_G2PMnGBASE_BSDIS 0x0000002000000000ULL
106#define TX4927_PCIC_G2PMnGBASE_ECHG 0x0000001000000000ULL
107
108/* bits for G2PIOGBASE */
109#define TX4927_PCIC_G2PIOGBASE_BSDIS 0x0000002000000000ULL
110#define TX4927_PCIC_G2PIOGBASE_ECHG 0x0000001000000000ULL
111
112/* bits for PCICSTATUS/PCICMASK */
113#define TX4927_PCIC_PCICSTATUS_ALL 0x000007b8
114#define TX4927_PCIC_PCICSTATUS_PME 0x00000400
115#define TX4927_PCIC_PCICSTATUS_TLB 0x00000200
116#define TX4927_PCIC_PCICSTATUS_NIB 0x00000100
117#define TX4927_PCIC_PCICSTATUS_ZIB 0x00000080
118#define TX4927_PCIC_PCICSTATUS_PERR 0x00000020
119#define TX4927_PCIC_PCICSTATUS_SERR 0x00000010
120#define TX4927_PCIC_PCICSTATUS_GBE 0x00000008
121#define TX4927_PCIC_PCICSTATUS_IWB 0x00000002
122#define TX4927_PCIC_PCICSTATUS_E2PDONE 0x00000001
123
124/* bits for PCICCFG */
125#define TX4927_PCIC_PCICCFG_GBWC_MASK 0x0fff0000
126#define TX4927_PCIC_PCICCFG_HRST 0x00000800
127#define TX4927_PCIC_PCICCFG_SRST 0x00000400
128#define TX4927_PCIC_PCICCFG_IRBER 0x00000200
129#define TX4927_PCIC_PCICCFG_G2PMEN(ch) (0x00000100>>(ch))
130#define TX4927_PCIC_PCICCFG_G2PM0EN 0x00000100
131#define TX4927_PCIC_PCICCFG_G2PM1EN 0x00000080
132#define TX4927_PCIC_PCICCFG_G2PM2EN 0x00000040
133#define TX4927_PCIC_PCICCFG_G2PIOEN 0x00000020
134#define TX4927_PCIC_PCICCFG_TCAR 0x00000010
135#define TX4927_PCIC_PCICCFG_ICAEN 0x00000008
136
137/* bits for P2GMnGBASE */
138#define TX4927_PCIC_P2GMnGBASE_TMEMEN 0x0000004000000000ULL
139#define TX4927_PCIC_P2GMnGBASE_TBSDIS 0x0000002000000000ULL
140#define TX4927_PCIC_P2GMnGBASE_TECHG 0x0000001000000000ULL
141
142/* bits for P2GIOGBASE */
143#define TX4927_PCIC_P2GIOGBASE_TIOEN 0x0000004000000000ULL
144#define TX4927_PCIC_P2GIOGBASE_TBSDIS 0x0000002000000000ULL
145#define TX4927_PCIC_P2GIOGBASE_TECHG 0x0000001000000000ULL
146
147#define TX4927_PCIC_IDSEL_AD_TO_SLOT(ad) ((ad) - 11)
148#define TX4927_PCIC_MAX_DEVNU TX4927_PCIC_IDSEL_AD_TO_SLOT(32)
149
150/* bits for PDMCFG */
151#define TX4927_PCIC_PDMCFG_RSTFIFO 0x00200000
152#define TX4927_PCIC_PDMCFG_EXFER 0x00100000
153#define TX4927_PCIC_PDMCFG_REQDLY_MASK 0x00003800
154#define TX4927_PCIC_PDMCFG_REQDLY_NONE (0 << 11)
155#define TX4927_PCIC_PDMCFG_REQDLY_16 (1 << 11)
156#define TX4927_PCIC_PDMCFG_REQDLY_32 (2 << 11)
157#define TX4927_PCIC_PDMCFG_REQDLY_64 (3 << 11)
158#define TX4927_PCIC_PDMCFG_REQDLY_128 (4 << 11)
159#define TX4927_PCIC_PDMCFG_REQDLY_256 (5 << 11)
160#define TX4927_PCIC_PDMCFG_REQDLY_512 (6 << 11)
161#define TX4927_PCIC_PDMCFG_REQDLY_1024 (7 << 11)
162#define TX4927_PCIC_PDMCFG_ERRIE 0x00000400
163#define TX4927_PCIC_PDMCFG_NCCMPIE 0x00000200
164#define TX4927_PCIC_PDMCFG_NTCMPIE 0x00000100
165#define TX4927_PCIC_PDMCFG_CHNEN 0x00000080
166#define TX4927_PCIC_PDMCFG_XFRACT 0x00000040
167#define TX4927_PCIC_PDMCFG_BSWAP 0x00000020
168#define TX4927_PCIC_PDMCFG_XFRSIZE_MASK 0x0000000c
169#define TX4927_PCIC_PDMCFG_XFRSIZE_1DW 0x00000000
170#define TX4927_PCIC_PDMCFG_XFRSIZE_1QW 0x00000004
171#define TX4927_PCIC_PDMCFG_XFRSIZE_4QW 0x00000008
172#define TX4927_PCIC_PDMCFG_XFRDIRC 0x00000002
173#define TX4927_PCIC_PDMCFG_CHRST 0x00000001
174
175/* bits for PDMSTS */
176#define TX4927_PCIC_PDMSTS_REQCNT_MASK 0x3f000000
177#define TX4927_PCIC_PDMSTS_FIFOCNT_MASK 0x00f00000
178#define TX4927_PCIC_PDMSTS_FIFOWP_MASK 0x000c0000
179#define TX4927_PCIC_PDMSTS_FIFORP_MASK 0x00030000
180#define TX4927_PCIC_PDMSTS_ERRINT 0x00000800
181#define TX4927_PCIC_PDMSTS_DONEINT 0x00000400
182#define TX4927_PCIC_PDMSTS_CHNEN 0x00000200
183#define TX4927_PCIC_PDMSTS_XFRACT 0x00000100
184#define TX4927_PCIC_PDMSTS_ACCMP 0x00000080
185#define TX4927_PCIC_PDMSTS_NCCMP 0x00000040
186#define TX4927_PCIC_PDMSTS_NTCMP 0x00000020
187#define TX4927_PCIC_PDMSTS_CFGERR 0x00000008
188#define TX4927_PCIC_PDMSTS_PCIERR 0x00000004
189#define TX4927_PCIC_PDMSTS_CHNERR 0x00000002
190#define TX4927_PCIC_PDMSTS_DATAERR 0x00000001
191#define TX4927_PCIC_PDMSTS_ALL_CMP 0x000000e0
192#define TX4927_PCIC_PDMSTS_ALL_ERR 0x0000000f
193
194struct tx4927_pcic_reg __iomem *get_tx4927_pcicptr(
195 struct pci_controller *channel);
196void tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr,
197 struct pci_controller *channel, int extarb);
198void tx4927_report_pcic_status(void);
199char *tx4927_pcibios_setup(char *str);
200void tx4927_dump_pcic_settings(void);
201irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id);
202
203#endif /* __ASM_TXX9_TX4927PCIC_H */
diff --git a/arch/mips/include/asm/txx9/tx4938.h b/arch/mips/include/asm/txx9/tx4938.h
new file mode 100644
index 000000000..6ca767ee6
--- /dev/null
+++ b/arch/mips/include/asm/txx9/tx4938.h
@@ -0,0 +1,312 @@
1/*
2 * Definitions for TX4937/TX4938
3 * Copyright (C) 2000-2001 Toshiba Corporation
4 *
5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
6 * terms of the GNU General Public License version 2. This program is
7 * licensed "as is" without any warranty of any kind, whether express
8 * or implied.
9 *
10 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
11 */
12#ifndef __ASM_TXX9_TX4938_H
13#define __ASM_TXX9_TX4938_H
14
15/* some controllers are compatible with 4927 */
16#include <asm/txx9/tx4927.h>
17
18#ifdef CONFIG_64BIT
19#define TX4938_REG_BASE 0xffffffffff1f0000UL /* == TX4937_REG_BASE */
20#else
21#define TX4938_REG_BASE 0xff1f0000UL /* == TX4937_REG_BASE */
22#endif
23#define TX4938_REG_SIZE 0x00010000 /* == TX4937_REG_SIZE */
24
25/* NDFMC, SRAMC, PCIC1, SPIC: TX4938 only */
26#define TX4938_NDFMC_REG (TX4938_REG_BASE + 0x5000)
27#define TX4938_SRAMC_REG (TX4938_REG_BASE + 0x6000)
28#define TX4938_PCIC1_REG (TX4938_REG_BASE + 0x7000)
29#define TX4938_SDRAMC_REG (TX4938_REG_BASE + 0x8000)
30#define TX4938_EBUSC_REG (TX4938_REG_BASE + 0x9000)
31#define TX4938_DMA_REG(ch) (TX4938_REG_BASE + 0xb000 + (ch) * 0x800)
32#define TX4938_PCIC_REG (TX4938_REG_BASE + 0xd000)
33#define TX4938_CCFG_REG (TX4938_REG_BASE + 0xe000)
34#define TX4938_NR_TMR 3
35#define TX4938_TMR_REG(ch) ((TX4938_REG_BASE + 0xf000) + (ch) * 0x100)
36#define TX4938_NR_SIO 2
37#define TX4938_SIO_REG(ch) ((TX4938_REG_BASE + 0xf300) + (ch) * 0x100)
38#define TX4938_PIO_REG (TX4938_REG_BASE + 0xf500)
39#define TX4938_IRC_REG (TX4938_REG_BASE + 0xf600)
40#define TX4938_ACLC_REG (TX4938_REG_BASE + 0xf700)
41#define TX4938_SPI_REG (TX4938_REG_BASE + 0xf800)
42
43struct tx4938_sramc_reg {
44 u64 cr;
45};
46
47struct tx4938_ccfg_reg {
48 u64 ccfg;
49 u64 crir;
50 u64 pcfg;
51 u64 toea;
52 u64 clkctr;
53 u64 unused0;
54 u64 garbc;
55 u64 unused1;
56 u64 unused2;
57 u64 ramp;
58 u64 unused3;
59 u64 jmpadr;
60};
61
62/*
63 * IRC
64 */
65
66#define TX4938_IR_ECCERR 0
67#define TX4938_IR_WTOERR 1
68#define TX4938_NUM_IR_INT 6
69#define TX4938_IR_INT(n) (2 + (n))
70#define TX4938_NUM_IR_SIO 2
71#define TX4938_IR_SIO(n) (8 + (n))
72#define TX4938_NUM_IR_DMA 4
73#define TX4938_IR_DMA(ch, n) ((ch ? 27 : 10) + (n)) /* 10-13, 27-30 */
74#define TX4938_IR_PIO 14
75#define TX4938_IR_PDMAC 15
76#define TX4938_IR_PCIC 16
77#define TX4938_NUM_IR_TMR 3
78#define TX4938_IR_TMR(n) (17 + (n))
79#define TX4938_IR_NDFMC 21
80#define TX4938_IR_PCIERR 22
81#define TX4938_IR_PCIPME 23
82#define TX4938_IR_ACLC 24
83#define TX4938_IR_ACLCPME 25
84#define TX4938_IR_PCIC1 26
85#define TX4938_IR_SPI 31
86#define TX4938_NUM_IR 32
87/* multiplex */
88#define TX4938_IR_ETH0 TX4938_IR_INT(4)
89#define TX4938_IR_ETH1 TX4938_IR_INT(3)
90
91#define TX4938_IRC_INT 2 /* IP[2] in Status register */
92
93#define TX4938_NUM_PIO 16
94
95/*
96 * CCFG
97 */
98/* CCFG : Chip Configuration */
99#define TX4938_CCFG_WDRST 0x0000020000000000ULL
100#define TX4938_CCFG_WDREXEN 0x0000010000000000ULL
101#define TX4938_CCFG_BCFG_MASK 0x000000ff00000000ULL
102#define TX4938_CCFG_TINTDIS 0x01000000
103#define TX4938_CCFG_PCI66 0x00800000
104#define TX4938_CCFG_PCIMODE 0x00400000
105#define TX4938_CCFG_PCI1_66 0x00200000
106#define TX4938_CCFG_DIVMODE_MASK 0x001e0000
107#define TX4938_CCFG_DIVMODE_2 (0x4 << 17)
108#define TX4938_CCFG_DIVMODE_2_5 (0xf << 17)
109#define TX4938_CCFG_DIVMODE_3 (0x5 << 17)
110#define TX4938_CCFG_DIVMODE_4 (0x6 << 17)
111#define TX4938_CCFG_DIVMODE_4_5 (0xd << 17)
112#define TX4938_CCFG_DIVMODE_8 (0x0 << 17)
113#define TX4938_CCFG_DIVMODE_10 (0xb << 17)
114#define TX4938_CCFG_DIVMODE_12 (0x1 << 17)
115#define TX4938_CCFG_DIVMODE_16 (0x2 << 17)
116#define TX4938_CCFG_DIVMODE_18 (0x9 << 17)
117#define TX4938_CCFG_BEOW 0x00010000
118#define TX4938_CCFG_WR 0x00008000
119#define TX4938_CCFG_TOE 0x00004000
120#define TX4938_CCFG_PCIARB 0x00002000
121#define TX4938_CCFG_PCIDIVMODE_MASK 0x00001c00
122#define TX4938_CCFG_PCIDIVMODE_4 (0x1 << 10)
123#define TX4938_CCFG_PCIDIVMODE_4_5 (0x3 << 10)
124#define TX4938_CCFG_PCIDIVMODE_5 (0x5 << 10)
125#define TX4938_CCFG_PCIDIVMODE_5_5 (0x7 << 10)
126#define TX4938_CCFG_PCIDIVMODE_8 (0x0 << 10)
127#define TX4938_CCFG_PCIDIVMODE_9 (0x2 << 10)
128#define TX4938_CCFG_PCIDIVMODE_10 (0x4 << 10)
129#define TX4938_CCFG_PCIDIVMODE_11 (0x6 << 10)
130#define TX4938_CCFG_PCI1DMD 0x00000100
131#define TX4938_CCFG_SYSSP_MASK 0x000000c0
132#define TX4938_CCFG_ENDIAN 0x00000004
133#define TX4938_CCFG_HALT 0x00000002
134#define TX4938_CCFG_ACEHOLD 0x00000001
135
136/* PCFG : Pin Configuration */
137#define TX4938_PCFG_ETH0_SEL 0x8000000000000000ULL
138#define TX4938_PCFG_ETH1_SEL 0x4000000000000000ULL
139#define TX4938_PCFG_ATA_SEL 0x2000000000000000ULL
140#define TX4938_PCFG_ISA_SEL 0x1000000000000000ULL
141#define TX4938_PCFG_SPI_SEL 0x0800000000000000ULL
142#define TX4938_PCFG_NDF_SEL 0x0400000000000000ULL
143#define TX4938_PCFG_SDCLKDLY_MASK 0x30000000
144#define TX4938_PCFG_SDCLKDLY(d) ((d)<<28)
145#define TX4938_PCFG_SYSCLKEN 0x08000000
146#define TX4938_PCFG_SDCLKEN_ALL 0x07800000
147#define TX4938_PCFG_SDCLKEN(ch) (0x00800000<<(ch))
148#define TX4938_PCFG_PCICLKEN_ALL 0x003f0000
149#define TX4938_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
150#define TX4938_PCFG_SEL2 0x00000200
151#define TX4938_PCFG_SEL1 0x00000100
152#define TX4938_PCFG_DMASEL_ALL 0x0000000f
153#define TX4938_PCFG_DMASEL0_DRQ0 0x00000000
154#define TX4938_PCFG_DMASEL0_SIO1 0x00000001
155#define TX4938_PCFG_DMASEL1_DRQ1 0x00000000
156#define TX4938_PCFG_DMASEL1_SIO1 0x00000002
157#define TX4938_PCFG_DMASEL2_DRQ2 0x00000000
158#define TX4938_PCFG_DMASEL2_SIO0 0x00000004
159#define TX4938_PCFG_DMASEL3_DRQ3 0x00000000
160#define TX4938_PCFG_DMASEL3_SIO0 0x00000008
161
162/* CLKCTR : Clock Control */
163#define TX4938_CLKCTR_NDFCKD 0x0001000000000000ULL
164#define TX4938_CLKCTR_NDFRST 0x0000000100000000ULL
165#define TX4938_CLKCTR_ETH1CKD 0x80000000
166#define TX4938_CLKCTR_ETH0CKD 0x40000000
167#define TX4938_CLKCTR_SPICKD 0x20000000
168#define TX4938_CLKCTR_SRAMCKD 0x10000000
169#define TX4938_CLKCTR_PCIC1CKD 0x08000000
170#define TX4938_CLKCTR_DMA1CKD 0x04000000
171#define TX4938_CLKCTR_ACLCKD 0x02000000
172#define TX4938_CLKCTR_PIOCKD 0x01000000
173#define TX4938_CLKCTR_DMACKD 0x00800000
174#define TX4938_CLKCTR_PCICKD 0x00400000
175#define TX4938_CLKCTR_TM0CKD 0x00100000
176#define TX4938_CLKCTR_TM1CKD 0x00080000
177#define TX4938_CLKCTR_TM2CKD 0x00040000
178#define TX4938_CLKCTR_SIO0CKD 0x00020000
179#define TX4938_CLKCTR_SIO1CKD 0x00010000
180#define TX4938_CLKCTR_ETH1RST 0x00008000
181#define TX4938_CLKCTR_ETH0RST 0x00004000
182#define TX4938_CLKCTR_SPIRST 0x00002000
183#define TX4938_CLKCTR_SRAMRST 0x00001000
184#define TX4938_CLKCTR_PCIC1RST 0x00000800
185#define TX4938_CLKCTR_DMA1RST 0x00000400
186#define TX4938_CLKCTR_ACLRST 0x00000200
187#define TX4938_CLKCTR_PIORST 0x00000100
188#define TX4938_CLKCTR_DMARST 0x00000080
189#define TX4938_CLKCTR_PCIRST 0x00000040
190#define TX4938_CLKCTR_TM0RST 0x00000010
191#define TX4938_CLKCTR_TM1RST 0x00000008
192#define TX4938_CLKCTR_TM2RST 0x00000004
193#define TX4938_CLKCTR_SIO0RST 0x00000002
194#define TX4938_CLKCTR_SIO1RST 0x00000001
195
196/*
197 * DMA
198 */
199/* bits for MCR */
200#define TX4938_DMA_MCR_EIS(ch) (0x10000000<<(ch))
201#define TX4938_DMA_MCR_DIS(ch) (0x01000000<<(ch))
202#define TX4938_DMA_MCR_RSFIF 0x00000080
203#define TX4938_DMA_MCR_FIFUM(ch) (0x00000008<<(ch))
204#define TX4938_DMA_MCR_RPRT 0x00000002
205#define TX4938_DMA_MCR_MSTEN 0x00000001
206
207/* bits for CCRn */
208#define TX4938_DMA_CCR_IMMCHN 0x20000000
209#define TX4938_DMA_CCR_USEXFSZ 0x10000000
210#define TX4938_DMA_CCR_LE 0x08000000
211#define TX4938_DMA_CCR_DBINH 0x04000000
212#define TX4938_DMA_CCR_SBINH 0x02000000
213#define TX4938_DMA_CCR_CHRST 0x01000000
214#define TX4938_DMA_CCR_RVBYTE 0x00800000
215#define TX4938_DMA_CCR_ACKPOL 0x00400000
216#define TX4938_DMA_CCR_REQPL 0x00200000
217#define TX4938_DMA_CCR_EGREQ 0x00100000
218#define TX4938_DMA_CCR_CHDN 0x00080000
219#define TX4938_DMA_CCR_DNCTL 0x00060000
220#define TX4938_DMA_CCR_EXTRQ 0x00010000
221#define TX4938_DMA_CCR_INTRQD 0x0000e000
222#define TX4938_DMA_CCR_INTENE 0x00001000
223#define TX4938_DMA_CCR_INTENC 0x00000800
224#define TX4938_DMA_CCR_INTENT 0x00000400
225#define TX4938_DMA_CCR_CHNEN 0x00000200
226#define TX4938_DMA_CCR_XFACT 0x00000100
227#define TX4938_DMA_CCR_SMPCHN 0x00000020
228#define TX4938_DMA_CCR_XFSZ(order) (((order) << 2) & 0x0000001c)
229#define TX4938_DMA_CCR_XFSZ_1W TX4938_DMA_CCR_XFSZ(2)
230#define TX4938_DMA_CCR_XFSZ_2W TX4938_DMA_CCR_XFSZ(3)
231#define TX4938_DMA_CCR_XFSZ_4W TX4938_DMA_CCR_XFSZ(4)
232#define TX4938_DMA_CCR_XFSZ_8W TX4938_DMA_CCR_XFSZ(5)
233#define TX4938_DMA_CCR_XFSZ_16W TX4938_DMA_CCR_XFSZ(6)
234#define TX4938_DMA_CCR_XFSZ_32W TX4938_DMA_CCR_XFSZ(7)
235#define TX4938_DMA_CCR_MEMIO 0x00000002
236#define TX4938_DMA_CCR_SNGAD 0x00000001
237
238/* bits for CSRn */
239#define TX4938_DMA_CSR_CHNEN 0x00000400
240#define TX4938_DMA_CSR_STLXFER 0x00000200
241#define TX4938_DMA_CSR_CHNACT 0x00000100
242#define TX4938_DMA_CSR_ABCHC 0x00000080
243#define TX4938_DMA_CSR_NCHNC 0x00000040
244#define TX4938_DMA_CSR_NTRNFC 0x00000020
245#define TX4938_DMA_CSR_EXTDN 0x00000010
246#define TX4938_DMA_CSR_CFERR 0x00000008
247#define TX4938_DMA_CSR_CHERR 0x00000004
248#define TX4938_DMA_CSR_DESERR 0x00000002
249#define TX4938_DMA_CSR_SORERR 0x00000001
250
251#define tx4938_sdramcptr tx4927_sdramcptr
252#define tx4938_ebuscptr tx4927_ebuscptr
253#define tx4938_pcicptr tx4927_pcicptr
254#define tx4938_pcic1ptr \
255 ((struct tx4927_pcic_reg __iomem *)TX4938_PCIC1_REG)
256#define tx4938_ccfgptr \
257 ((struct tx4938_ccfg_reg __iomem *)TX4938_CCFG_REG)
258#define tx4938_pioptr ((struct txx9_pio_reg __iomem *)TX4938_PIO_REG)
259#define tx4938_sramcptr \
260 ((struct tx4938_sramc_reg __iomem *)TX4938_SRAMC_REG)
261
262
263#define TX4938_REV_PCODE() \
264 ((__u32)__raw_readq(&tx4938_ccfgptr->crir) >> 16)
265
266#define tx4938_ccfg_clear(bits) tx4927_ccfg_clear(bits)
267#define tx4938_ccfg_set(bits) tx4927_ccfg_set(bits)
268#define tx4938_ccfg_change(change, new) tx4927_ccfg_change(change, new)
269
270#define TX4938_SDRAMC_CR(ch) TX4927_SDRAMC_CR(ch)
271#define TX4938_SDRAMC_BA(ch) TX4927_SDRAMC_BA(ch)
272#define TX4938_SDRAMC_SIZE(ch) TX4927_SDRAMC_SIZE(ch)
273
274#define TX4938_EBUSC_CR(ch) TX4927_EBUSC_CR(ch)
275#define TX4938_EBUSC_BA(ch) TX4927_EBUSC_BA(ch)
276#define TX4938_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch)
277#define TX4938_EBUSC_WIDTH(ch) TX4927_EBUSC_WIDTH(ch)
278
279#define tx4938_get_mem_size() tx4927_get_mem_size()
280void tx4938_wdt_init(void);
281void tx4938_setup(void);
282void tx4938_time_init(unsigned int tmrnr);
283void tx4938_sio_init(unsigned int sclk, unsigned int cts_mask);
284void tx4938_spi_init(int busid);
285void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
286int tx4938_report_pciclk(void);
287void tx4938_report_pci1clk(void);
288int tx4938_pciclk66_setup(void);
289struct pci_dev;
290int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot);
291void tx4938_setup_pcierr_irq(void);
292void tx4938_irq_init(void);
293void tx4938_mtd_init(int ch);
294void tx4938_ndfmc_init(unsigned int hold, unsigned int spw);
295
296struct tx4938ide_platform_info {
297 /*
298 * I/O port shift, for platforms with ports that are
299 * constantly spaced and need larger than the 1-byte
300 * spacing used by ata_std_ports().
301 */
302 unsigned int ioport_shift;
303 unsigned int gbus_clock; /* 0 means no PIO mode tuning. */
304 unsigned int ebus_ch;
305};
306
307void tx4938_ata_init(unsigned int irq, unsigned int shift, int tune);
308void tx4938_dmac_init(int memcpy_chan0, int memcpy_chan1);
309void tx4938_aclc_init(void);
310void tx4938_sramc_init(void);
311
312#endif
diff --git a/arch/mips/include/asm/txx9/tx4939.h b/arch/mips/include/asm/txx9/tx4939.h
new file mode 100644
index 000000000..abf980af9
--- /dev/null
+++ b/arch/mips/include/asm/txx9/tx4939.h
@@ -0,0 +1,524 @@
1/*
2 * Definitions for TX4939
3 *
4 * Copyright (C) 2000-2001,2005-2006 Toshiba Corporation
5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
6 * terms of the GNU General Public License version 2. This program is
7 * licensed "as is" without any warranty of any kind, whether express
8 * or implied.
9 */
10#ifndef __ASM_TXX9_TX4939_H
11#define __ASM_TXX9_TX4939_H
12
13/* some controllers are compatible with 4927/4938 */
14#include <asm/txx9/tx4938.h>
15
16#ifdef CONFIG_64BIT
17#define TX4939_REG_BASE 0xffffffffff1f0000UL /* == TX4938_REG_BASE */
18#else
19#define TX4939_REG_BASE 0xff1f0000UL /* == TX4938_REG_BASE */
20#endif
21#define TX4939_REG_SIZE 0x00010000 /* == TX4938_REG_SIZE */
22
23#define TX4939_ATA_REG(ch) (TX4939_REG_BASE + 0x3000 + (ch) * 0x1000)
24#define TX4939_NDFMC_REG (TX4939_REG_BASE + 0x5000)
25#define TX4939_SRAMC_REG (TX4939_REG_BASE + 0x6000)
26#define TX4939_CRYPTO_REG (TX4939_REG_BASE + 0x6800)
27#define TX4939_PCIC1_REG (TX4939_REG_BASE + 0x7000)
28#define TX4939_DDRC_REG (TX4939_REG_BASE + 0x8000)
29#define TX4939_EBUSC_REG (TX4939_REG_BASE + 0x9000)
30#define TX4939_VPC_REG (TX4939_REG_BASE + 0xa000)
31#define TX4939_DMA_REG(ch) (TX4939_REG_BASE + 0xb000 + (ch) * 0x800)
32#define TX4939_PCIC_REG (TX4939_REG_BASE + 0xd000)
33#define TX4939_CCFG_REG (TX4939_REG_BASE + 0xe000)
34#define TX4939_IRC_REG (TX4939_REG_BASE + 0xe800)
35#define TX4939_NR_TMR 6 /* 0xf000,0xf100,0xf200,0xfd00,0xfe00,0xff00 */
36#define TX4939_TMR_REG(ch) \
37 (TX4939_REG_BASE + 0xf000 + ((ch) + ((ch) >= 3) * 10) * 0x100)
38#define TX4939_NR_SIO 4 /* 0xf300, 0xf400, 0xf380, 0xf480 */
39#define TX4939_SIO_REG(ch) \
40 (TX4939_REG_BASE + 0xf300 + (((ch) & 1) << 8) + (((ch) & 2) << 6))
41#define TX4939_ACLC_REG (TX4939_REG_BASE + 0xf700)
42#define TX4939_SPI_REG (TX4939_REG_BASE + 0xf800)
43#define TX4939_I2C_REG (TX4939_REG_BASE + 0xf900)
44#define TX4939_I2S_REG (TX4939_REG_BASE + 0xfa00)
45#define TX4939_RTC_REG (TX4939_REG_BASE + 0xfb00)
46#define TX4939_CIR_REG (TX4939_REG_BASE + 0xfc00)
47
48#define TX4939_RNG_REG (TX4939_CRYPTO_REG + 0xb0)
49
50struct tx4939_le_reg {
51 __u32 r;
52 __u32 unused;
53};
54
55struct tx4939_ddrc_reg {
56 struct tx4939_le_reg ctl[47];
57 __u64 unused0[17];
58 __u64 winen;
59 __u64 win[4];
60};
61
62struct tx4939_ccfg_reg {
63 __u64 ccfg;
64 __u64 crir;
65 __u64 pcfg;
66 __u64 toea;
67 __u64 clkctr;
68 __u64 unused0;
69 __u64 garbc;
70 __u64 unused1[2];
71 __u64 ramp;
72 __u64 unused2[2];
73 __u64 dskwctrl;
74 __u64 mclkosc;
75 __u64 mclkctl;
76 __u64 unused3[17];
77 struct {
78 __u64 mr;
79 __u64 dr;
80 } gpio[2];
81};
82
83struct tx4939_irc_reg {
84 struct tx4939_le_reg den;
85 struct tx4939_le_reg scipb;
86 struct tx4939_le_reg dm[2];
87 struct tx4939_le_reg lvl[16];
88 struct tx4939_le_reg msk;
89 struct tx4939_le_reg edc;
90 struct tx4939_le_reg pnd0;
91 struct tx4939_le_reg cs;
92 struct tx4939_le_reg pnd1;
93 struct tx4939_le_reg dm2[2];
94 struct tx4939_le_reg dbr[2];
95 struct tx4939_le_reg dben;
96 struct tx4939_le_reg unused0[2];
97 struct tx4939_le_reg flag[2];
98 struct tx4939_le_reg pol;
99 struct tx4939_le_reg cnt;
100 struct tx4939_le_reg maskint;
101 struct tx4939_le_reg maskext;
102};
103
104struct tx4939_crypto_reg {
105 struct tx4939_le_reg csr;
106 struct tx4939_le_reg idesptr;
107 struct tx4939_le_reg cdesptr;
108 struct tx4939_le_reg buserr;
109 struct tx4939_le_reg cip_tout;
110 struct tx4939_le_reg cir;
111 union {
112 struct {
113 struct tx4939_le_reg data[8];
114 struct tx4939_le_reg ctrl;
115 } gen;
116 struct {
117 struct {
118 struct tx4939_le_reg l;
119 struct tx4939_le_reg u;
120 } key[3], ini;
121 struct tx4939_le_reg ctrl;
122 } des;
123 struct {
124 struct tx4939_le_reg key[4];
125 struct tx4939_le_reg ini[4];
126 struct tx4939_le_reg ctrl;
127 } aes;
128 struct {
129 struct {
130 struct tx4939_le_reg l;
131 struct tx4939_le_reg u;
132 } cnt;
133 struct tx4939_le_reg ini[5];
134 struct tx4939_le_reg unused;
135 struct tx4939_le_reg ctrl;
136 } hash;
137 } cdr;
138 struct tx4939_le_reg unused0[7];
139 struct tx4939_le_reg rcsr;
140 struct tx4939_le_reg rpr;
141 __u64 rdr;
142 __u64 ror[3];
143 struct tx4939_le_reg unused1[2];
144 struct tx4939_le_reg xorslr;
145 struct tx4939_le_reg xorsur;
146};
147
148struct tx4939_crypto_desc {
149 __u32 src;
150 __u32 dst;
151 __u32 next;
152 __u32 ctrl;
153 __u32 index;
154 __u32 xor;
155};
156
157struct tx4939_vpc_reg {
158 struct tx4939_le_reg csr;
159 struct {
160 struct tx4939_le_reg ctrlA;
161 struct tx4939_le_reg ctrlB;
162 struct tx4939_le_reg idesptr;
163 struct tx4939_le_reg cdesptr;
164 } port[3];
165 struct tx4939_le_reg buserr;
166};
167
168struct tx4939_vpc_desc {
169 __u32 src;
170 __u32 next;
171 __u32 ctrl1;
172 __u32 ctrl2;
173};
174
175/*
176 * IRC
177 */
178#define TX4939_IR_NONE 0
179#define TX4939_IR_DDR 1
180#define TX4939_IR_WTOERR 2
181#define TX4939_NUM_IR_INT 3
182#define TX4939_IR_INT(n) (3 + (n))
183#define TX4939_NUM_IR_ETH 2
184#define TX4939_IR_ETH(n) ((n) ? 43 : 6)
185#define TX4939_IR_VIDEO 7
186#define TX4939_IR_CIR 8
187#define TX4939_NUM_IR_SIO 4
188#define TX4939_IR_SIO(n) ((n) ? 43 + (n) : 9) /* 9,44-46 */
189#define TX4939_NUM_IR_DMA 4
190#define TX4939_IR_DMA(ch, n) (((ch) ? 22 : 10) + (n)) /* 10-13,22-25 */
191#define TX4939_IR_IRC 14
192#define TX4939_IR_PDMAC 15
193#define TX4939_NUM_IR_TMR 6
194#define TX4939_IR_TMR(n) (((n) >= 3 ? 45 : 16) + (n)) /* 16-18,48-50 */
195#define TX4939_NUM_IR_ATA 2
196#define TX4939_IR_ATA(n) (19 + (n))
197#define TX4939_IR_ACLC 21
198#define TX4939_IR_CIPHER 26
199#define TX4939_IR_INTA 27
200#define TX4939_IR_INTB 28
201#define TX4939_IR_INTC 29
202#define TX4939_IR_INTD 30
203#define TX4939_IR_I2C 33
204#define TX4939_IR_SPI 34
205#define TX4939_IR_PCIC 35
206#define TX4939_IR_PCIC1 36
207#define TX4939_IR_PCIERR 37
208#define TX4939_IR_PCIPME 38
209#define TX4939_IR_NDFMC 39
210#define TX4939_IR_ACLCPME 40
211#define TX4939_IR_RTC 41
212#define TX4939_IR_RND 42
213#define TX4939_IR_I2S 47
214#define TX4939_NUM_IR 64
215
216#define TX4939_IRC_INT 2 /* IP[2] in Status register */
217
218/*
219 * CCFG
220 */
221/* CCFG : Chip Configuration */
222#define TX4939_CCFG_PCIBOOT 0x0000040000000000ULL
223#define TX4939_CCFG_WDRST 0x0000020000000000ULL
224#define TX4939_CCFG_WDREXEN 0x0000010000000000ULL
225#define TX4939_CCFG_BCFG_MASK 0x000000ff00000000ULL
226#define TX4939_CCFG_GTOT_MASK 0x06000000
227#define TX4939_CCFG_GTOT_4096 0x06000000
228#define TX4939_CCFG_GTOT_2048 0x04000000
229#define TX4939_CCFG_GTOT_1024 0x02000000
230#define TX4939_CCFG_GTOT_512 0x00000000
231#define TX4939_CCFG_TINTDIS 0x01000000
232#define TX4939_CCFG_PCI66 0x00800000
233#define TX4939_CCFG_PCIMODE 0x00400000
234#define TX4939_CCFG_SSCG 0x00100000
235#define TX4939_CCFG_MULCLK_MASK 0x000e0000
236#define TX4939_CCFG_MULCLK_8 (0x7 << 17)
237#define TX4939_CCFG_MULCLK_9 (0x0 << 17)
238#define TX4939_CCFG_MULCLK_10 (0x1 << 17)
239#define TX4939_CCFG_MULCLK_11 (0x2 << 17)
240#define TX4939_CCFG_MULCLK_12 (0x3 << 17)
241#define TX4939_CCFG_MULCLK_13 (0x4 << 17)
242#define TX4939_CCFG_MULCLK_14 (0x5 << 17)
243#define TX4939_CCFG_MULCLK_15 (0x6 << 17)
244#define TX4939_CCFG_BEOW 0x00010000
245#define TX4939_CCFG_WR 0x00008000
246#define TX4939_CCFG_TOE 0x00004000
247#define TX4939_CCFG_PCIARB 0x00002000
248#define TX4939_CCFG_YDIVMODE_MASK 0x00001c00
249#define TX4939_CCFG_YDIVMODE_2 (0x0 << 10)
250#define TX4939_CCFG_YDIVMODE_3 (0x1 << 10)
251#define TX4939_CCFG_YDIVMODE_5 (0x6 << 10)
252#define TX4939_CCFG_YDIVMODE_6 (0x7 << 10)
253#define TX4939_CCFG_PTSEL 0x00000200
254#define TX4939_CCFG_BESEL 0x00000100
255#define TX4939_CCFG_SYSSP_MASK 0x000000c0
256#define TX4939_CCFG_ACKSEL 0x00000020
257#define TX4939_CCFG_ROMW 0x00000010
258#define TX4939_CCFG_ENDIAN 0x00000004
259#define TX4939_CCFG_ARMODE 0x00000002
260#define TX4939_CCFG_ACEHOLD 0x00000001
261
262/* PCFG : Pin Configuration */
263#define TX4939_PCFG_SIO2MODE_MASK 0xc000000000000000ULL
264#define TX4939_PCFG_SIO2MODE_GPIO 0x8000000000000000ULL
265#define TX4939_PCFG_SIO2MODE_SIO2 0x4000000000000000ULL
266#define TX4939_PCFG_SIO2MODE_SIO0 0x0000000000000000ULL
267#define TX4939_PCFG_SPIMODE 0x2000000000000000ULL
268#define TX4939_PCFG_I2CMODE 0x1000000000000000ULL
269#define TX4939_PCFG_I2SMODE_MASK 0x0c00000000000000ULL
270#define TX4939_PCFG_I2SMODE_GPIO 0x0c00000000000000ULL
271#define TX4939_PCFG_I2SMODE_I2S 0x0800000000000000ULL
272#define TX4939_PCFG_I2SMODE_I2S_ALT 0x0400000000000000ULL
273#define TX4939_PCFG_I2SMODE_ACLC 0x0000000000000000ULL
274#define TX4939_PCFG_SIO3MODE 0x0200000000000000ULL
275#define TX4939_PCFG_DMASEL3 0x0004000000000000ULL
276#define TX4939_PCFG_DMASEL3_SIO0 0x0004000000000000ULL
277#define TX4939_PCFG_DMASEL3_NDFC 0x0000000000000000ULL
278#define TX4939_PCFG_VSSMODE 0x0000200000000000ULL
279#define TX4939_PCFG_VPSMODE 0x0000100000000000ULL
280#define TX4939_PCFG_ET1MODE 0x0000080000000000ULL
281#define TX4939_PCFG_ET0MODE 0x0000040000000000ULL
282#define TX4939_PCFG_ATA1MODE 0x0000020000000000ULL
283#define TX4939_PCFG_ATA0MODE 0x0000010000000000ULL
284#define TX4939_PCFG_BP_PLL 0x0000000100000000ULL
285
286#define TX4939_PCFG_SYSCLKEN 0x08000000
287#define TX4939_PCFG_PCICLKEN_ALL 0x000f0000
288#define TX4939_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
289#define TX4939_PCFG_SPEED1 0x00002000
290#define TX4939_PCFG_SPEED0 0x00001000
291#define TX4939_PCFG_ITMODE 0x00000300
292#define TX4939_PCFG_DMASEL_ALL (0x00000007 | TX4939_PCFG_DMASEL3)
293#define TX4939_PCFG_DMASEL2 0x00000004
294#define TX4939_PCFG_DMASEL2_DRQ2 0x00000000
295#define TX4939_PCFG_DMASEL2_SIO0 0x00000004
296#define TX4939_PCFG_DMASEL1 0x00000002
297#define TX4939_PCFG_DMASEL1_DRQ1 0x00000000
298#define TX4939_PCFG_DMASEL0 0x00000001
299#define TX4939_PCFG_DMASEL0_DRQ0 0x00000000
300
301/* CLKCTR : Clock Control */
302#define TX4939_CLKCTR_IOSCKD 0x8000000000000000ULL
303#define TX4939_CLKCTR_SYSCKD 0x4000000000000000ULL
304#define TX4939_CLKCTR_TM5CKD 0x2000000000000000ULL
305#define TX4939_CLKCTR_TM4CKD 0x1000000000000000ULL
306#define TX4939_CLKCTR_TM3CKD 0x0800000000000000ULL
307#define TX4939_CLKCTR_CIRCKD 0x0400000000000000ULL
308#define TX4939_CLKCTR_SIO3CKD 0x0200000000000000ULL
309#define TX4939_CLKCTR_SIO2CKD 0x0100000000000000ULL
310#define TX4939_CLKCTR_SIO1CKD 0x0080000000000000ULL
311#define TX4939_CLKCTR_VPCCKD 0x0040000000000000ULL
312#define TX4939_CLKCTR_EPCICKD 0x0020000000000000ULL
313#define TX4939_CLKCTR_ETH1CKD 0x0008000000000000ULL
314#define TX4939_CLKCTR_ATA1CKD 0x0004000000000000ULL
315#define TX4939_CLKCTR_BROMCKD 0x0002000000000000ULL
316#define TX4939_CLKCTR_NDCCKD 0x0001000000000000ULL
317#define TX4939_CLKCTR_I2CCKD 0x0000800000000000ULL
318#define TX4939_CLKCTR_ETH0CKD 0x0000400000000000ULL
319#define TX4939_CLKCTR_SPICKD 0x0000200000000000ULL
320#define TX4939_CLKCTR_SRAMCKD 0x0000100000000000ULL
321#define TX4939_CLKCTR_PCI1CKD 0x0000080000000000ULL
322#define TX4939_CLKCTR_DMA1CKD 0x0000040000000000ULL
323#define TX4939_CLKCTR_ACLCKD 0x0000020000000000ULL
324#define TX4939_CLKCTR_ATA0CKD 0x0000010000000000ULL
325#define TX4939_CLKCTR_DMA0CKD 0x0000008000000000ULL
326#define TX4939_CLKCTR_PCICCKD 0x0000004000000000ULL
327#define TX4939_CLKCTR_I2SCKD 0x0000002000000000ULL
328#define TX4939_CLKCTR_TM0CKD 0x0000001000000000ULL
329#define TX4939_CLKCTR_TM1CKD 0x0000000800000000ULL
330#define TX4939_CLKCTR_TM2CKD 0x0000000400000000ULL
331#define TX4939_CLKCTR_SIO0CKD 0x0000000200000000ULL
332#define TX4939_CLKCTR_CYPCKD 0x0000000100000000ULL
333#define TX4939_CLKCTR_IOSRST 0x80000000
334#define TX4939_CLKCTR_SYSRST 0x40000000
335#define TX4939_CLKCTR_TM5RST 0x20000000
336#define TX4939_CLKCTR_TM4RST 0x10000000
337#define TX4939_CLKCTR_TM3RST 0x08000000
338#define TX4939_CLKCTR_CIRRST 0x04000000
339#define TX4939_CLKCTR_SIO3RST 0x02000000
340#define TX4939_CLKCTR_SIO2RST 0x01000000
341#define TX4939_CLKCTR_SIO1RST 0x00800000
342#define TX4939_CLKCTR_VPCRST 0x00400000
343#define TX4939_CLKCTR_EPCIRST 0x00200000
344#define TX4939_CLKCTR_ETH1RST 0x00080000
345#define TX4939_CLKCTR_ATA1RST 0x00040000
346#define TX4939_CLKCTR_BROMRST 0x00020000
347#define TX4939_CLKCTR_NDCRST 0x00010000
348#define TX4939_CLKCTR_I2CRST 0x00008000
349#define TX4939_CLKCTR_ETH0RST 0x00004000
350#define TX4939_CLKCTR_SPIRST 0x00002000
351#define TX4939_CLKCTR_SRAMRST 0x00001000
352#define TX4939_CLKCTR_PCI1RST 0x00000800
353#define TX4939_CLKCTR_DMA1RST 0x00000400
354#define TX4939_CLKCTR_ACLRST 0x00000200
355#define TX4939_CLKCTR_ATA0RST 0x00000100
356#define TX4939_CLKCTR_DMA0RST 0x00000080
357#define TX4939_CLKCTR_PCICRST 0x00000040
358#define TX4939_CLKCTR_I2SRST 0x00000020
359#define TX4939_CLKCTR_TM0RST 0x00000010
360#define TX4939_CLKCTR_TM1RST 0x00000008
361#define TX4939_CLKCTR_TM2RST 0x00000004
362#define TX4939_CLKCTR_SIO0RST 0x00000002
363#define TX4939_CLKCTR_CYPRST 0x00000001
364
365/*
366 * CRYPTO
367 */
368#define TX4939_CRYPTO_CSR_SAESO 0x08000000
369#define TX4939_CRYPTO_CSR_SAESI 0x04000000
370#define TX4939_CRYPTO_CSR_SDESO 0x02000000
371#define TX4939_CRYPTO_CSR_SDESI 0x01000000
372#define TX4939_CRYPTO_CSR_INDXBST_MASK 0x00700000
373#define TX4939_CRYPTO_CSR_INDXBST(n) ((n) << 20)
374#define TX4939_CRYPTO_CSR_TOINT 0x00080000
375#define TX4939_CRYPTO_CSR_DCINT 0x00040000
376#define TX4939_CRYPTO_CSR_GBINT 0x00010000
377#define TX4939_CRYPTO_CSR_INDXAST_MASK 0x0000e000
378#define TX4939_CRYPTO_CSR_INDXAST(n) ((n) << 13)
379#define TX4939_CRYPTO_CSR_CSWAP_MASK 0x00001800
380#define TX4939_CRYPTO_CSR_CSWAP_NONE 0x00000000
381#define TX4939_CRYPTO_CSR_CSWAP_IN 0x00000800
382#define TX4939_CRYPTO_CSR_CSWAP_OUT 0x00001000
383#define TX4939_CRYPTO_CSR_CSWAP_BOTH 0x00001800
384#define TX4939_CRYPTO_CSR_CDIV_MASK 0x00000600
385#define TX4939_CRYPTO_CSR_CDIV_DIV2 0x00000000
386#define TX4939_CRYPTO_CSR_CDIV_DIV1 0x00000200
387#define TX4939_CRYPTO_CSR_CDIV_DIV2ALT 0x00000400
388#define TX4939_CRYPTO_CSR_CDIV_DIV1ALT 0x00000600
389#define TX4939_CRYPTO_CSR_PDINT_MASK 0x000000c0
390#define TX4939_CRYPTO_CSR_PDINT_ALL 0x00000000
391#define TX4939_CRYPTO_CSR_PDINT_END 0x00000040
392#define TX4939_CRYPTO_CSR_PDINT_NEXT 0x00000080
393#define TX4939_CRYPTO_CSR_PDINT_NONE 0x000000c0
394#define TX4939_CRYPTO_CSR_GINTE 0x00000008
395#define TX4939_CRYPTO_CSR_RSTD 0x00000004
396#define TX4939_CRYPTO_CSR_RSTC 0x00000002
397#define TX4939_CRYPTO_CSR_ENCR 0x00000001
398
399/* bits for tx4939_crypto_reg.cdr.gen.ctrl */
400#define TX4939_CRYPTO_CTX_ENGINE_MASK 0x00000003
401#define TX4939_CRYPTO_CTX_ENGINE_DES 0x00000000
402#define TX4939_CRYPTO_CTX_ENGINE_AES 0x00000001
403#define TX4939_CRYPTO_CTX_ENGINE_MD5 0x00000002
404#define TX4939_CRYPTO_CTX_ENGINE_SHA1 0x00000003
405#define TX4939_CRYPTO_CTX_TDMS 0x00000010
406#define TX4939_CRYPTO_CTX_CMS 0x00000020
407#define TX4939_CRYPTO_CTX_DMS 0x00000040
408#define TX4939_CRYPTO_CTX_UPDATE 0x00000080
409
410/* bits for tx4939_crypto_desc.ctrl */
411#define TX4939_CRYPTO_DESC_OB_CNT_MASK 0xffe00000
412#define TX4939_CRYPTO_DESC_OB_CNT(cnt) ((cnt) << 21)
413#define TX4939_CRYPTO_DESC_IB_CNT_MASK 0x001ffc00
414#define TX4939_CRYPTO_DESC_IB_CNT(cnt) ((cnt) << 10)
415#define TX4939_CRYPTO_DESC_START 0x00000200
416#define TX4939_CRYPTO_DESC_END 0x00000100
417#define TX4939_CRYPTO_DESC_XOR 0x00000010
418#define TX4939_CRYPTO_DESC_LAST 0x00000008
419#define TX4939_CRYPTO_DESC_ERR_MASK 0x00000006
420#define TX4939_CRYPTO_DESC_ERR_NONE 0x00000000
421#define TX4939_CRYPTO_DESC_ERR_TOUT 0x00000002
422#define TX4939_CRYPTO_DESC_ERR_DIGEST 0x00000004
423#define TX4939_CRYPTO_DESC_OWN 0x00000001
424
425/* bits for tx4939_crypto_desc.index */
426#define TX4939_CRYPTO_DESC_HASH_IDX_MASK 0x00000070
427#define TX4939_CRYPTO_DESC_HASH_IDX(idx) ((idx) << 4)
428#define TX4939_CRYPTO_DESC_ENCRYPT_IDX_MASK 0x00000007
429#define TX4939_CRYPTO_DESC_ENCRYPT_IDX(idx) ((idx) << 0)
430
431#define TX4939_CRYPTO_NR_SET 6
432
433#define TX4939_CRYPTO_RCSR_INTE 0x00000008
434#define TX4939_CRYPTO_RCSR_RST 0x00000004
435#define TX4939_CRYPTO_RCSR_FIN 0x00000002
436#define TX4939_CRYPTO_RCSR_ST 0x00000001
437
438/*
439 * VPC
440 */
441#define TX4939_VPC_CSR_GBINT 0x00010000
442#define TX4939_VPC_CSR_SWAPO 0x00000020
443#define TX4939_VPC_CSR_SWAPI 0x00000010
444#define TX4939_VPC_CSR_GINTE 0x00000008
445#define TX4939_VPC_CSR_RSTD 0x00000004
446#define TX4939_VPC_CSR_RSTVPC 0x00000002
447
448#define TX4939_VPC_CTRLA_VDPSN 0x00000200
449#define TX4939_VPC_CTRLA_PBUSY 0x00000100
450#define TX4939_VPC_CTRLA_DCINT 0x00000080
451#define TX4939_VPC_CTRLA_UOINT 0x00000040
452#define TX4939_VPC_CTRLA_PDINT_MASK 0x00000030
453#define TX4939_VPC_CTRLA_PDINT_ALL 0x00000000
454#define TX4939_VPC_CTRLA_PDINT_NEXT 0x00000010
455#define TX4939_VPC_CTRLA_PDINT_NONE 0x00000030
456#define TX4939_VPC_CTRLA_VDVLDP 0x00000008
457#define TX4939_VPC_CTRLA_VDMODE 0x00000004
458#define TX4939_VPC_CTRLA_VDFOR 0x00000002
459#define TX4939_VPC_CTRLA_ENVPC 0x00000001
460
461/* bits for tx4939_vpc_desc.ctrl1 */
462#define TX4939_VPC_DESC_CTRL1_ERR_MASK 0x00000006
463#define TX4939_VPC_DESC_CTRL1_OWN 0x00000001
464
465#define tx4939_ddrcptr ((struct tx4939_ddrc_reg __iomem *)TX4939_DDRC_REG)
466#define tx4939_ebuscptr tx4938_ebuscptr
467#define tx4939_ircptr \
468 ((struct tx4939_irc_reg __iomem *)TX4939_IRC_REG)
469#define tx4939_pcicptr tx4938_pcicptr
470#define tx4939_pcic1ptr tx4938_pcic1ptr
471#define tx4939_ccfgptr \
472 ((struct tx4939_ccfg_reg __iomem *)TX4939_CCFG_REG)
473#define tx4939_sramcptr tx4938_sramcptr
474#define tx4939_cryptoptr \
475 ((struct tx4939_crypto_reg __iomem *)TX4939_CRYPTO_REG)
476#define tx4939_vpcptr ((struct tx4939_vpc_reg __iomem *)TX4939_VPC_REG)
477
478#define TX4939_REV_MAJ_MIN() \
479 ((__u32)__raw_readq(&tx4939_ccfgptr->crir) & 0x00ff)
480#define TX4939_REV_PCODE() \
481 ((__u32)__raw_readq(&tx4939_ccfgptr->crir) >> 16)
482#define TX4939_CCFG_BCFG() \
483 ((__u32)((__raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_BCFG_MASK) \
484 >> 32))
485
486#define tx4939_ccfg_clear(bits) tx4938_ccfg_clear(bits)
487#define tx4939_ccfg_set(bits) tx4938_ccfg_set(bits)
488#define tx4939_ccfg_change(change, new) tx4938_ccfg_change(change, new)
489
490#define TX4939_EBUSC_CR(ch) TX4927_EBUSC_CR(ch)
491#define TX4939_EBUSC_BA(ch) TX4927_EBUSC_BA(ch)
492#define TX4939_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch)
493#define TX4939_EBUSC_WIDTH(ch) \
494 (16 >> ((__u32)(TX4939_EBUSC_CR(ch) >> 20) & 0x1))
495
496/* SCLK0 = MSTCLK * 429/19 * 16/245 / 2 (14.745MHz for MST 20MHz) */
497#define TX4939_SCLK0(mst) \
498 ((((mst) + 245/2) / 245UL * 429 * 16 + 19) / 19 / 2)
499
500void tx4939_wdt_init(void);
501void tx4939_setup(void);
502void tx4939_time_init(unsigned int tmrnr);
503void tx4939_sio_init(unsigned int sclk, unsigned int cts_mask);
504void tx4939_spi_init(int busid);
505void tx4939_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
506int tx4939_report_pciclk(void);
507void tx4939_report_pci1clk(void);
508struct pci_dev;
509int tx4939_pcic1_map_irq(const struct pci_dev *dev, u8 slot);
510int tx4939_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
511void tx4939_setup_pcierr_irq(void);
512void tx4939_irq_init(void);
513int tx4939_irq(void);
514void tx4939_mtd_init(int ch);
515void tx4939_ata_init(void);
516void tx4939_rtc_init(void);
517void tx4939_ndfmc_init(unsigned int hold, unsigned int spw,
518 unsigned char ch_mask, unsigned char wide_mask);
519void tx4939_dmac_init(int memcpy_chan0, int memcpy_chan1);
520void tx4939_aclc_init(void);
521void tx4939_sramc_init(void);
522void tx4939_rng_init(void);
523
524#endif /* __ASM_TXX9_TX4939_H */
diff --git a/arch/mips/include/asm/txx9irq.h b/arch/mips/include/asm/txx9irq.h
new file mode 100644
index 000000000..68a6650a4
--- /dev/null
+++ b/arch/mips/include/asm/txx9irq.h
@@ -0,0 +1,34 @@
1/*
2 * include/asm-mips/txx9irq.h
3 * TX39/TX49 interrupt controller definitions.
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_TXX9IRQ_H
10#define __ASM_TXX9IRQ_H
11
12#include <irq.h>
13
14#ifdef CONFIG_IRQ_MIPS_CPU
15#define TXX9_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
16#else
17#ifdef CONFIG_I8259
18#define TXX9_IRQ_BASE (I8259A_IRQ_BASE + 16)
19#else
20#define TXX9_IRQ_BASE 0
21#endif
22#endif
23
24#ifdef CONFIG_CPU_TX39XX
25#define TXx9_MAX_IR 16
26#else
27#define TXx9_MAX_IR 32
28#endif
29
30void txx9_irq_init(unsigned long baseaddr);
31int txx9_irq(void);
32int txx9_irq_set_pri(int irc_irq, int new_pri);
33
34#endif /* __ASM_TXX9IRQ_H */
diff --git a/arch/mips/include/asm/txx9pio.h b/arch/mips/include/asm/txx9pio.h
new file mode 100644
index 000000000..3d6fa9f8d
--- /dev/null
+++ b/arch/mips/include/asm/txx9pio.h
@@ -0,0 +1,29 @@
1/*
2 * include/asm-mips/txx9pio.h
3 * TX39/TX49 PIO controller definitions.
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_TXX9PIO_H
10#define __ASM_TXX9PIO_H
11
12#include <linux/types.h>
13
14struct txx9_pio_reg {
15 __u32 dout;
16 __u32 din;
17 __u32 dir;
18 __u32 od;
19 __u32 flag[2];
20 __u32 pol;
21 __u32 intc;
22 __u32 maskcpu;
23 __u32 maskext;
24};
25
26int txx9_gpio_init(unsigned long baseaddr,
27 unsigned int base, unsigned int num);
28
29#endif /* __ASM_TXX9PIO_H */
diff --git a/arch/mips/include/asm/txx9tmr.h b/arch/mips/include/asm/txx9tmr.h
new file mode 100644
index 000000000..466a3def3
--- /dev/null
+++ b/arch/mips/include/asm/txx9tmr.h
@@ -0,0 +1,67 @@
1/*
2 * include/asm-mips/txx9tmr.h
3 * TX39/TX49 timer controller definitions.
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_TXX9TMR_H
10#define __ASM_TXX9TMR_H
11
12#include <linux/types.h>
13
14struct txx9_tmr_reg {
15 u32 tcr;
16 u32 tisr;
17 u32 cpra;
18 u32 cprb;
19 u32 itmr;
20 u32 unused0[3];
21 u32 ccdr;
22 u32 unused1[3];
23 u32 pgmr;
24 u32 unused2[3];
25 u32 wtmr;
26 u32 unused3[43];
27 u32 trr;
28};
29
30/* TMTCR : Timer Control */
31#define TXx9_TMTCR_TCE 0x00000080
32#define TXx9_TMTCR_CCDE 0x00000040
33#define TXx9_TMTCR_CRE 0x00000020
34#define TXx9_TMTCR_ECES 0x00000008
35#define TXx9_TMTCR_CCS 0x00000004
36#define TXx9_TMTCR_TMODE_MASK 0x00000003
37#define TXx9_TMTCR_TMODE_ITVL 0x00000000
38#define TXx9_TMTCR_TMODE_PGEN 0x00000001
39#define TXx9_TMTCR_TMODE_WDOG 0x00000002
40
41/* TMTISR : Timer Int. Status */
42#define TXx9_TMTISR_TPIBS 0x00000004
43#define TXx9_TMTISR_TPIAS 0x00000002
44#define TXx9_TMTISR_TIIS 0x00000001
45
46/* TMITMR : Interval Timer Mode */
47#define TXx9_TMITMR_TIIE 0x00008000
48#define TXx9_TMITMR_TZCE 0x00000001
49
50/* TMWTMR : Watchdog Timer Mode */
51#define TXx9_TMWTMR_TWIE 0x00008000
52#define TXx9_TMWTMR_WDIS 0x00000080
53#define TXx9_TMWTMR_TWC 0x00000001
54
55void txx9_clocksource_init(unsigned long baseaddr,
56 unsigned int imbusclk);
57void txx9_clockevent_init(unsigned long baseaddr, int irq,
58 unsigned int imbusclk);
59void txx9_tmr_init(unsigned long baseaddr);
60
61#ifdef CONFIG_CPU_TX39XX
62#define TXX9_TIMER_BITS 24
63#else
64#define TXX9_TIMER_BITS 32
65#endif
66
67#endif /* __ASM_TXX9TMR_H */
diff --git a/arch/mips/include/asm/types.h b/arch/mips/include/asm/types.h
new file mode 100644
index 000000000..148d42a17
--- /dev/null
+++ b/arch/mips/include/asm/types.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) 1994, 1995, 1996, 1999 by Ralf Baechle
7 * Copyright (C) 2008 Wind River Systems,
8 * written by Ralf Baechle
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 */
11#ifndef _ASM_TYPES_H
12#define _ASM_TYPES_H
13
14#include <asm-generic/int-ll64.h>
15#include <uapi/asm/types.h>
16
17#endif /* _ASM_TYPES_H */
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
new file mode 100644
index 000000000..61fc01f17
--- /dev/null
+++ b/arch/mips/include/asm/uaccess.h
@@ -0,0 +1,791 @@
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 * Copyright (C) 2007 Maciej W. Rozycki
9 * Copyright (C) 2014, Imagination Technologies Ltd.
10 */
11#ifndef _ASM_UACCESS_H
12#define _ASM_UACCESS_H
13
14#include <linux/kernel.h>
15#include <linux/string.h>
16#include <asm/asm-eva.h>
17#include <asm/extable.h>
18
19/*
20 * The fs value determines whether argument validity checking should be
21 * performed or not. If get_fs() == USER_DS, checking is performed, with
22 * get_fs() == KERNEL_DS, checking is bypassed.
23 *
24 * For historical reasons, these macros are grossly misnamed.
25 */
26#ifdef CONFIG_32BIT
27
28#ifdef CONFIG_KVM_GUEST
29#define __UA_LIMIT 0x40000000UL
30#else
31#define __UA_LIMIT 0x80000000UL
32#endif
33
34#define __UA_ADDR ".word"
35#define __UA_LA "la"
36#define __UA_ADDU "addu"
37#define __UA_t0 "$8"
38#define __UA_t1 "$9"
39
40#endif /* CONFIG_32BIT */
41
42#ifdef CONFIG_64BIT
43
44extern u64 __ua_limit;
45
46#define __UA_LIMIT __ua_limit
47
48#define __UA_ADDR ".dword"
49#define __UA_LA "dla"
50#define __UA_ADDU "daddu"
51#define __UA_t0 "$12"
52#define __UA_t1 "$13"
53
54#endif /* CONFIG_64BIT */
55
56/*
57 * USER_DS is a bitmask that has the bits set that may not be set in a valid
58 * userspace address. Note that we limit 32-bit userspace to 0x7fff8000 but
59 * the arithmetic we're doing only works if the limit is a power of two, so
60 * we use 0x80000000 here on 32-bit kernels. If a process passes an invalid
61 * address in this range it's the process's problem, not ours :-)
62 */
63
64#ifdef CONFIG_KVM_GUEST
65#define KERNEL_DS ((mm_segment_t) { 0x80000000UL })
66#define USER_DS ((mm_segment_t) { 0xC0000000UL })
67#else
68#define KERNEL_DS ((mm_segment_t) { 0UL })
69#define USER_DS ((mm_segment_t) { __UA_LIMIT })
70#endif
71
72#define get_fs() (current_thread_info()->addr_limit)
73#define set_fs(x) (current_thread_info()->addr_limit = (x))
74
75#define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg)
76
77/*
78 * eva_kernel_access() - determine whether kernel memory access on an EVA system
79 *
80 * Determines whether memory accesses should be performed to kernel memory
81 * on a system using Extended Virtual Addressing (EVA).
82 *
83 * Return: true if a kernel memory access on an EVA system, else false.
84 */
85static inline bool eva_kernel_access(void)
86{
87 if (!IS_ENABLED(CONFIG_EVA))
88 return false;
89
90 return uaccess_kernel();
91}
92
93/*
94 * Is a address valid? This does a straightforward calculation rather
95 * than tests.
96 *
97 * Address valid if:
98 * - "addr" doesn't have any high-bits set
99 * - AND "size" doesn't have any high-bits set
100 * - AND "addr+size" doesn't have any high-bits set
101 * - OR we are in kernel mode.
102 *
103 * __ua_size() is a trick to avoid runtime checking of positive constant
104 * sizes; for those we already know at compile time that the size is ok.
105 */
106#define __ua_size(size) \
107 ((__builtin_constant_p(size) && (signed long) (size) > 0) ? 0 : (size))
108
109/*
110 * access_ok: - Checks if a user space pointer is valid
111 * @addr: User space pointer to start of block to check
112 * @size: Size of block to check
113 *
114 * Context: User context only. This function may sleep if pagefaults are
115 * enabled.
116 *
117 * Checks if a pointer to a block of memory in user space is valid.
118 *
119 * Returns true (nonzero) if the memory block may be valid, false (zero)
120 * if it is definitely invalid.
121 *
122 * Note that, depending on architecture, this function probably just
123 * checks that the pointer is in the user space range - after calling
124 * this function, memory access functions may still return -EFAULT.
125 */
126
127static inline int __access_ok(const void __user *p, unsigned long size)
128{
129 unsigned long addr = (unsigned long)p;
130 return (get_fs().seg & (addr | (addr + size) | __ua_size(size))) == 0;
131}
132
133#define access_ok(addr, size) \
134 likely(__access_ok((addr), (size)))
135
136/*
137 * put_user: - Write a simple value into user space.
138 * @x: Value to copy to user space.
139 * @ptr: Destination address, in user space.
140 *
141 * Context: User context only. This function may sleep if pagefaults are
142 * enabled.
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 if pagefaults are
162 * enabled.
163 *
164 * This macro copies a single simple variable from user space to kernel
165 * space. It supports simple types like char and int, but not larger
166 * data types like structures or arrays.
167 *
168 * @ptr must have pointer-to-simple-variable type, and the result of
169 * dereferencing @ptr must be assignable to @x without a cast.
170 *
171 * Returns zero on success, or -EFAULT on error.
172 * On error, the variable @x is set to zero.
173 */
174#define get_user(x,ptr) \
175 __get_user_check((x), (ptr), sizeof(*(ptr)))
176
177/*
178 * __put_user: - Write a simple value into user space, with less checking.
179 * @x: Value to copy to user space.
180 * @ptr: Destination address, in user space.
181 *
182 * Context: User context only. This function may sleep if pagefaults are
183 * enabled.
184 *
185 * This macro copies a single simple value from kernel space to user
186 * space. It supports simple types like char and int, but not larger
187 * data types like structures or arrays.
188 *
189 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
190 * to the result of dereferencing @ptr.
191 *
192 * Caller must check the pointer with access_ok() before calling this
193 * function.
194 *
195 * Returns zero on success, or -EFAULT on error.
196 */
197#define __put_user(x,ptr) \
198 __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
199
200/*
201 * __get_user: - Get a simple variable from user space, with less checking.
202 * @x: Variable to store result.
203 * @ptr: Source address, in user space.
204 *
205 * Context: User context only. This function may sleep if pagefaults are
206 * enabled.
207 *
208 * This macro copies a single simple variable from user space to kernel
209 * space. It supports simple types like char and int, but not larger
210 * data types like structures or arrays.
211 *
212 * @ptr must have pointer-to-simple-variable type, and the result of
213 * dereferencing @ptr must be assignable to @x without a cast.
214 *
215 * Caller must check the pointer with access_ok() before calling this
216 * function.
217 *
218 * Returns zero on success, or -EFAULT on error.
219 * On error, the variable @x is set to zero.
220 */
221#define __get_user(x,ptr) \
222 __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
223
224struct __large_struct { unsigned long buf[100]; };
225#define __m(x) (*(struct __large_struct __user *)(x))
226
227/*
228 * Yuck. We need two variants, one for 64bit operation and one
229 * for 32 bit mode and old iron.
230 */
231#ifndef CONFIG_EVA
232#define __get_kernel_common(val, size, ptr) __get_user_common(val, size, ptr)
233#else
234/*
235 * Kernel specific functions for EVA. We need to use normal load instructions
236 * to read data from kernel when operating in EVA mode. We use these macros to
237 * avoid redefining __get_user_asm for EVA.
238 */
239#undef _loadd
240#undef _loadw
241#undef _loadh
242#undef _loadb
243#ifdef CONFIG_32BIT
244#define _loadd _loadw
245#else
246#define _loadd(reg, addr) "ld " reg ", " addr
247#endif
248#define _loadw(reg, addr) "lw " reg ", " addr
249#define _loadh(reg, addr) "lh " reg ", " addr
250#define _loadb(reg, addr) "lb " reg ", " addr
251
252#define __get_kernel_common(val, size, ptr) \
253do { \
254 switch (size) { \
255 case 1: __get_data_asm(val, _loadb, ptr); break; \
256 case 2: __get_data_asm(val, _loadh, ptr); break; \
257 case 4: __get_data_asm(val, _loadw, ptr); break; \
258 case 8: __GET_DW(val, _loadd, ptr); break; \
259 default: __get_user_unknown(); break; \
260 } \
261} while (0)
262#endif
263
264#ifdef CONFIG_32BIT
265#define __GET_DW(val, insn, ptr) __get_data_asm_ll32(val, insn, ptr)
266#endif
267#ifdef CONFIG_64BIT
268#define __GET_DW(val, insn, ptr) __get_data_asm(val, insn, ptr)
269#endif
270
271extern void __get_user_unknown(void);
272
273#define __get_user_common(val, size, ptr) \
274do { \
275 switch (size) { \
276 case 1: __get_data_asm(val, user_lb, ptr); break; \
277 case 2: __get_data_asm(val, user_lh, ptr); break; \
278 case 4: __get_data_asm(val, user_lw, ptr); break; \
279 case 8: __GET_DW(val, user_ld, ptr); break; \
280 default: __get_user_unknown(); break; \
281 } \
282} while (0)
283
284#define __get_user_nocheck(x, ptr, size) \
285({ \
286 int __gu_err; \
287 \
288 if (eva_kernel_access()) { \
289 __get_kernel_common((x), size, ptr); \
290 } else { \
291 __chk_user_ptr(ptr); \
292 __get_user_common((x), size, ptr); \
293 } \
294 __gu_err; \
295})
296
297#define __get_user_check(x, ptr, size) \
298({ \
299 int __gu_err = -EFAULT; \
300 const __typeof__(*(ptr)) __user * __gu_ptr = (ptr); \
301 \
302 might_fault(); \
303 if (likely(access_ok( __gu_ptr, size))) { \
304 if (eva_kernel_access()) \
305 __get_kernel_common((x), size, __gu_ptr); \
306 else \
307 __get_user_common((x), size, __gu_ptr); \
308 } else \
309 (x) = 0; \
310 \
311 __gu_err; \
312})
313
314#define __get_data_asm(val, insn, addr) \
315{ \
316 long __gu_tmp; \
317 \
318 __asm__ __volatile__( \
319 "1: "insn("%1", "%3")" \n" \
320 "2: \n" \
321 " .insn \n" \
322 " .section .fixup,\"ax\" \n" \
323 "3: li %0, %4 \n" \
324 " move %1, $0 \n" \
325 " j 2b \n" \
326 " .previous \n" \
327 " .section __ex_table,\"a\" \n" \
328 " "__UA_ADDR "\t1b, 3b \n" \
329 " .previous \n" \
330 : "=r" (__gu_err), "=r" (__gu_tmp) \
331 : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \
332 \
333 (val) = (__typeof__(*(addr))) __gu_tmp; \
334}
335
336/*
337 * Get a long long 64 using 32 bit registers.
338 */
339#define __get_data_asm_ll32(val, insn, addr) \
340{ \
341 union { \
342 unsigned long long l; \
343 __typeof__(*(addr)) t; \
344 } __gu_tmp; \
345 \
346 __asm__ __volatile__( \
347 "1: " insn("%1", "(%3)")" \n" \
348 "2: " insn("%D1", "4(%3)")" \n" \
349 "3: \n" \
350 " .insn \n" \
351 " .section .fixup,\"ax\" \n" \
352 "4: li %0, %4 \n" \
353 " move %1, $0 \n" \
354 " move %D1, $0 \n" \
355 " j 3b \n" \
356 " .previous \n" \
357 " .section __ex_table,\"a\" \n" \
358 " " __UA_ADDR " 1b, 4b \n" \
359 " " __UA_ADDR " 2b, 4b \n" \
360 " .previous \n" \
361 : "=r" (__gu_err), "=&r" (__gu_tmp.l) \
362 : "0" (0), "r" (addr), "i" (-EFAULT)); \
363 \
364 (val) = __gu_tmp.t; \
365}
366
367#ifndef CONFIG_EVA
368#define __put_kernel_common(ptr, size) __put_user_common(ptr, size)
369#else
370/*
371 * Kernel specific functions for EVA. We need to use normal load instructions
372 * to read data from kernel when operating in EVA mode. We use these macros to
373 * avoid redefining __get_data_asm for EVA.
374 */
375#undef _stored
376#undef _storew
377#undef _storeh
378#undef _storeb
379#ifdef CONFIG_32BIT
380#define _stored _storew
381#else
382#define _stored(reg, addr) "ld " reg ", " addr
383#endif
384
385#define _storew(reg, addr) "sw " reg ", " addr
386#define _storeh(reg, addr) "sh " reg ", " addr
387#define _storeb(reg, addr) "sb " reg ", " addr
388
389#define __put_kernel_common(ptr, size) \
390do { \
391 switch (size) { \
392 case 1: __put_data_asm(_storeb, ptr); break; \
393 case 2: __put_data_asm(_storeh, ptr); break; \
394 case 4: __put_data_asm(_storew, ptr); break; \
395 case 8: __PUT_DW(_stored, ptr); break; \
396 default: __put_user_unknown(); break; \
397 } \
398} while(0)
399#endif
400
401/*
402 * Yuck. We need two variants, one for 64bit operation and one
403 * for 32 bit mode and old iron.
404 */
405#ifdef CONFIG_32BIT
406#define __PUT_DW(insn, ptr) __put_data_asm_ll32(insn, ptr)
407#endif
408#ifdef CONFIG_64BIT
409#define __PUT_DW(insn, ptr) __put_data_asm(insn, ptr)
410#endif
411
412#define __put_user_common(ptr, size) \
413do { \
414 switch (size) { \
415 case 1: __put_data_asm(user_sb, ptr); break; \
416 case 2: __put_data_asm(user_sh, ptr); break; \
417 case 4: __put_data_asm(user_sw, ptr); break; \
418 case 8: __PUT_DW(user_sd, ptr); break; \
419 default: __put_user_unknown(); break; \
420 } \
421} while (0)
422
423#define __put_user_nocheck(x, ptr, size) \
424({ \
425 __typeof__(*(ptr)) __pu_val; \
426 int __pu_err = 0; \
427 \
428 __pu_val = (x); \
429 if (eva_kernel_access()) { \
430 __put_kernel_common(ptr, size); \
431 } else { \
432 __chk_user_ptr(ptr); \
433 __put_user_common(ptr, size); \
434 } \
435 __pu_err; \
436})
437
438#define __put_user_check(x, ptr, size) \
439({ \
440 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
441 __typeof__(*(ptr)) __pu_val = (x); \
442 int __pu_err = -EFAULT; \
443 \
444 might_fault(); \
445 if (likely(access_ok( __pu_addr, size))) { \
446 if (eva_kernel_access()) \
447 __put_kernel_common(__pu_addr, size); \
448 else \
449 __put_user_common(__pu_addr, size); \
450 } \
451 \
452 __pu_err; \
453})
454
455#define __put_data_asm(insn, ptr) \
456{ \
457 __asm__ __volatile__( \
458 "1: "insn("%z2", "%3")" # __put_data_asm \n" \
459 "2: \n" \
460 " .insn \n" \
461 " .section .fixup,\"ax\" \n" \
462 "3: li %0, %4 \n" \
463 " j 2b \n" \
464 " .previous \n" \
465 " .section __ex_table,\"a\" \n" \
466 " " __UA_ADDR " 1b, 3b \n" \
467 " .previous \n" \
468 : "=r" (__pu_err) \
469 : "0" (0), "Jr" (__pu_val), "o" (__m(ptr)), \
470 "i" (-EFAULT)); \
471}
472
473#define __put_data_asm_ll32(insn, ptr) \
474{ \
475 __asm__ __volatile__( \
476 "1: "insn("%2", "(%3)")" # __put_data_asm_ll32 \n" \
477 "2: "insn("%D2", "4(%3)")" \n" \
478 "3: \n" \
479 " .insn \n" \
480 " .section .fixup,\"ax\" \n" \
481 "4: li %0, %4 \n" \
482 " j 3b \n" \
483 " .previous \n" \
484 " .section __ex_table,\"a\" \n" \
485 " " __UA_ADDR " 1b, 4b \n" \
486 " " __UA_ADDR " 2b, 4b \n" \
487 " .previous" \
488 : "=r" (__pu_err) \
489 : "0" (0), "r" (__pu_val), "r" (ptr), \
490 "i" (-EFAULT)); \
491}
492
493extern void __put_user_unknown(void);
494
495/*
496 * We're generating jump to subroutines which will be outside the range of
497 * jump instructions
498 */
499#ifdef MODULE
500#define __MODULE_JAL(destination) \
501 ".set\tnoat\n\t" \
502 __UA_LA "\t$1, " #destination "\n\t" \
503 "jalr\t$1\n\t" \
504 ".set\tat\n\t"
505#else
506#define __MODULE_JAL(destination) \
507 "jal\t" #destination "\n\t"
508#endif
509
510#if defined(CONFIG_CPU_DADDI_WORKAROUNDS) || (defined(CONFIG_EVA) && \
511 defined(CONFIG_CPU_HAS_PREFETCH))
512#define DADDI_SCRATCH "$3"
513#else
514#define DADDI_SCRATCH "$0"
515#endif
516
517extern size_t __copy_user(void *__to, const void *__from, size_t __n);
518
519#define __invoke_copy_from(func, to, from, n) \
520({ \
521 register void *__cu_to_r __asm__("$4"); \
522 register const void __user *__cu_from_r __asm__("$5"); \
523 register long __cu_len_r __asm__("$6"); \
524 \
525 __cu_to_r = (to); \
526 __cu_from_r = (from); \
527 __cu_len_r = (n); \
528 __asm__ __volatile__( \
529 ".set\tnoreorder\n\t" \
530 __MODULE_JAL(func) \
531 ".set\tnoat\n\t" \
532 __UA_ADDU "\t$1, %1, %2\n\t" \
533 ".set\tat\n\t" \
534 ".set\treorder" \
535 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
536 : \
537 : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \
538 DADDI_SCRATCH, "memory"); \
539 __cu_len_r; \
540})
541
542#define __invoke_copy_to(func, to, from, n) \
543({ \
544 register void __user *__cu_to_r __asm__("$4"); \
545 register const void *__cu_from_r __asm__("$5"); \
546 register long __cu_len_r __asm__("$6"); \
547 \
548 __cu_to_r = (to); \
549 __cu_from_r = (from); \
550 __cu_len_r = (n); \
551 __asm__ __volatile__( \
552 __MODULE_JAL(func) \
553 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
554 : \
555 : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \
556 DADDI_SCRATCH, "memory"); \
557 __cu_len_r; \
558})
559
560#define __invoke_copy_from_kernel(to, from, n) \
561 __invoke_copy_from(__copy_user, to, from, n)
562
563#define __invoke_copy_to_kernel(to, from, n) \
564 __invoke_copy_to(__copy_user, to, from, n)
565
566#define ___invoke_copy_in_kernel(to, from, n) \
567 __invoke_copy_from(__copy_user, to, from, n)
568
569#ifndef CONFIG_EVA
570#define __invoke_copy_from_user(to, from, n) \
571 __invoke_copy_from(__copy_user, to, from, n)
572
573#define __invoke_copy_to_user(to, from, n) \
574 __invoke_copy_to(__copy_user, to, from, n)
575
576#define ___invoke_copy_in_user(to, from, n) \
577 __invoke_copy_from(__copy_user, to, from, n)
578
579#else
580
581/* EVA specific functions */
582
583extern size_t __copy_from_user_eva(void *__to, const void *__from,
584 size_t __n);
585extern size_t __copy_to_user_eva(void *__to, const void *__from,
586 size_t __n);
587extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
588
589/*
590 * Source or destination address is in userland. We need to go through
591 * the TLB
592 */
593#define __invoke_copy_from_user(to, from, n) \
594 __invoke_copy_from(__copy_from_user_eva, to, from, n)
595
596#define __invoke_copy_to_user(to, from, n) \
597 __invoke_copy_to(__copy_to_user_eva, to, from, n)
598
599#define ___invoke_copy_in_user(to, from, n) \
600 __invoke_copy_from(__copy_in_user_eva, to, from, n)
601
602#endif /* CONFIG_EVA */
603
604static inline unsigned long
605raw_copy_to_user(void __user *to, const void *from, unsigned long n)
606{
607 if (eva_kernel_access())
608 return __invoke_copy_to_kernel(to, from, n);
609 else
610 return __invoke_copy_to_user(to, from, n);
611}
612
613static inline unsigned long
614raw_copy_from_user(void *to, const void __user *from, unsigned long n)
615{
616 if (eva_kernel_access())
617 return __invoke_copy_from_kernel(to, from, n);
618 else
619 return __invoke_copy_from_user(to, from, n);
620}
621
622#define INLINE_COPY_FROM_USER
623#define INLINE_COPY_TO_USER
624
625static inline unsigned long
626raw_copy_in_user(void __user*to, const void __user *from, unsigned long n)
627{
628 if (eva_kernel_access())
629 return ___invoke_copy_in_kernel(to, from, n);
630 else
631 return ___invoke_copy_in_user(to, from, n);
632}
633
634extern __kernel_size_t __bzero_kernel(void __user *addr, __kernel_size_t size);
635extern __kernel_size_t __bzero(void __user *addr, __kernel_size_t size);
636
637/*
638 * __clear_user: - Zero a block of memory in user space, with less checking.
639 * @to: Destination address, in user space.
640 * @n: Number of bytes to zero.
641 *
642 * Zero a block of memory in user space. Caller must check
643 * the specified block with access_ok() before calling this function.
644 *
645 * Returns number of bytes that could not be cleared.
646 * On success, this will be zero.
647 */
648static inline __kernel_size_t
649__clear_user(void __user *addr, __kernel_size_t size)
650{
651 __kernel_size_t res;
652
653#ifdef CONFIG_CPU_MICROMIPS
654/* micromips memset / bzero also clobbers t7 & t8 */
655#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$15", "$24", "$31"
656#else
657#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"
658#endif /* CONFIG_CPU_MICROMIPS */
659
660 if (eva_kernel_access()) {
661 __asm__ __volatile__(
662 "move\t$4, %1\n\t"
663 "move\t$5, $0\n\t"
664 "move\t$6, %2\n\t"
665 __MODULE_JAL(__bzero_kernel)
666 "move\t%0, $6"
667 : "=r" (res)
668 : "r" (addr), "r" (size)
669 : bzero_clobbers);
670 } else {
671 might_fault();
672 __asm__ __volatile__(
673 "move\t$4, %1\n\t"
674 "move\t$5, $0\n\t"
675 "move\t$6, %2\n\t"
676 __MODULE_JAL(__bzero)
677 "move\t%0, $6"
678 : "=r" (res)
679 : "r" (addr), "r" (size)
680 : bzero_clobbers);
681 }
682
683 return res;
684}
685
686#define clear_user(addr,n) \
687({ \
688 void __user * __cl_addr = (addr); \
689 unsigned long __cl_size = (n); \
690 if (__cl_size && access_ok(__cl_addr, __cl_size)) \
691 __cl_size = __clear_user(__cl_addr, __cl_size); \
692 __cl_size; \
693})
694
695extern long __strncpy_from_kernel_asm(char *__to, const char __user *__from, long __len);
696extern long __strncpy_from_user_asm(char *__to, const char __user *__from, long __len);
697
698/*
699 * strncpy_from_user: - Copy a NUL terminated string from userspace.
700 * @dst: Destination address, in kernel space. This buffer must be at
701 * least @count bytes long.
702 * @src: Source address, in user space.
703 * @count: Maximum number of bytes to copy, including the trailing NUL.
704 *
705 * Copies a NUL-terminated string from userspace to kernel space.
706 *
707 * On success, returns the length of the string (not including the trailing
708 * NUL).
709 *
710 * If access to userspace fails, returns -EFAULT (some data may have been
711 * copied).
712 *
713 * If @count is smaller than the length of the string, copies @count bytes
714 * and returns @count.
715 */
716static inline long
717strncpy_from_user(char *__to, const char __user *__from, long __len)
718{
719 long res;
720
721 if (eva_kernel_access()) {
722 __asm__ __volatile__(
723 "move\t$4, %1\n\t"
724 "move\t$5, %2\n\t"
725 "move\t$6, %3\n\t"
726 __MODULE_JAL(__strncpy_from_kernel_asm)
727 "move\t%0, $2"
728 : "=r" (res)
729 : "r" (__to), "r" (__from), "r" (__len)
730 : "$2", "$3", "$4", "$5", "$6", __UA_t0, "$31", "memory");
731 } else {
732 might_fault();
733 __asm__ __volatile__(
734 "move\t$4, %1\n\t"
735 "move\t$5, %2\n\t"
736 "move\t$6, %3\n\t"
737 __MODULE_JAL(__strncpy_from_user_asm)
738 "move\t%0, $2"
739 : "=r" (res)
740 : "r" (__to), "r" (__from), "r" (__len)
741 : "$2", "$3", "$4", "$5", "$6", __UA_t0, "$31", "memory");
742 }
743
744 return res;
745}
746
747extern long __strnlen_kernel_asm(const char __user *s, long n);
748extern long __strnlen_user_asm(const char __user *s, long n);
749
750/*
751 * strnlen_user: - Get the size of a string in user space.
752 * @str: The string to measure.
753 *
754 * Context: User context only. This function may sleep if pagefaults are
755 * enabled.
756 *
757 * Get the size of a NUL-terminated string in user space.
758 *
759 * Returns the size of the string INCLUDING the terminating NUL.
760 * On exception, returns 0.
761 * If the string is too long, returns a value greater than @n.
762 */
763static inline long strnlen_user(const char __user *s, long n)
764{
765 long res;
766
767 might_fault();
768 if (eva_kernel_access()) {
769 __asm__ __volatile__(
770 "move\t$4, %1\n\t"
771 "move\t$5, %2\n\t"
772 __MODULE_JAL(__strnlen_kernel_asm)
773 "move\t%0, $2"
774 : "=r" (res)
775 : "r" (s), "r" (n)
776 : "$2", "$4", "$5", __UA_t0, "$31");
777 } else {
778 __asm__ __volatile__(
779 "move\t$4, %1\n\t"
780 "move\t$5, %2\n\t"
781 __MODULE_JAL(__strnlen_user_asm)
782 "move\t%0, $2"
783 : "=r" (res)
784 : "r" (s), "r" (n)
785 : "$2", "$4", "$5", __UA_t0, "$31");
786 }
787
788 return res;
789}
790
791#endif /* _ASM_UACCESS_H */
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
new file mode 100644
index 000000000..f7effca79
--- /dev/null
+++ b/arch/mips/include/asm/uasm.h
@@ -0,0 +1,325 @@
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, 2005, 2006, 2008 Thiemo Seufer
7 * Copyright (C) 2005 Maciej W. Rozycki
8 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2012, 2013 MIPS Technologies, Inc. All rights reserved.
10 */
11
12#ifndef __ASM_UASM_H
13#define __ASM_UASM_H
14
15#include <linux/types.h>
16
17#ifdef CONFIG_EXPORT_UASM
18#include <linux/export.h>
19#define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym)
20#else
21#define UASM_EXPORT_SYMBOL(sym)
22#endif
23
24#define Ip_u1u2u3(op) \
25void uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
26
27#define Ip_u2u1u3(op) \
28void uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
29
30#define Ip_u3u2u1(op) \
31void uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
32
33#define Ip_u3u1u2(op) \
34void uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
35
36#define Ip_u1u2s3(op) \
37void uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)
38
39#define Ip_u2s3u1(op) \
40void uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c)
41
42#define Ip_s3s1s2(op) \
43void uasm_i##op(u32 **buf, int a, int b, int c)
44
45#define Ip_u2u1s3(op) \
46void uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)
47
48#define Ip_u2u1msbu3(op) \
49void uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
50 unsigned int d)
51
52#define Ip_u1u2(op) \
53void uasm_i##op(u32 **buf, unsigned int a, unsigned int b)
54
55#define Ip_u2u1(op) \
56void uasm_i##op(u32 **buf, unsigned int a, unsigned int b)
57
58#define Ip_u1s2(op) \
59void uasm_i##op(u32 **buf, unsigned int a, signed int b)
60
61#define Ip_u1(op) void uasm_i##op(u32 **buf, unsigned int a)
62
63#define Ip_0(op) void uasm_i##op(u32 **buf)
64
65Ip_u2u1s3(_addiu);
66Ip_u3u1u2(_addu);
67Ip_u3u1u2(_and);
68Ip_u2u1u3(_andi);
69Ip_u1u2s3(_bbit0);
70Ip_u1u2s3(_bbit1);
71Ip_u1u2s3(_beq);
72Ip_u1u2s3(_beql);
73Ip_u1s2(_bgez);
74Ip_u1s2(_bgezl);
75Ip_u1s2(_bgtz);
76Ip_u1s2(_blez);
77Ip_u1s2(_bltz);
78Ip_u1s2(_bltzl);
79Ip_u1u2s3(_bne);
80Ip_u1(_break);
81Ip_u2s3u1(_cache);
82Ip_u1u2(_cfc1);
83Ip_u2u1(_cfcmsa);
84Ip_u1u2(_ctc1);
85Ip_u2u1(_ctcmsa);
86Ip_u2u1s3(_daddiu);
87Ip_u3u1u2(_daddu);
88Ip_u1u2(_ddivu);
89Ip_u3u1u2(_ddivu_r6);
90Ip_u1(_di);
91Ip_u2u1msbu3(_dins);
92Ip_u2u1msbu3(_dinsm);
93Ip_u2u1msbu3(_dinsu);
94Ip_u1u2(_divu);
95Ip_u3u1u2(_divu_r6);
96Ip_u1u2u3(_dmfc0);
97Ip_u3u1u2(_dmodu);
98Ip_u1u2u3(_dmtc0);
99Ip_u1u2(_dmultu);
100Ip_u3u1u2(_dmulu);
101Ip_u2u1u3(_drotr);
102Ip_u2u1u3(_drotr32);
103Ip_u2u1(_dsbh);
104Ip_u2u1(_dshd);
105Ip_u2u1u3(_dsll);
106Ip_u2u1u3(_dsll32);
107Ip_u3u2u1(_dsllv);
108Ip_u2u1u3(_dsra);
109Ip_u2u1u3(_dsra32);
110Ip_u3u2u1(_dsrav);
111Ip_u2u1u3(_dsrl);
112Ip_u2u1u3(_dsrl32);
113Ip_u3u2u1(_dsrlv);
114Ip_u3u1u2(_dsubu);
115Ip_0(_eret);
116Ip_u2u1msbu3(_ext);
117Ip_u2u1msbu3(_ins);
118Ip_u1(_j);
119Ip_u1(_jal);
120Ip_u2u1(_jalr);
121Ip_u1(_jr);
122Ip_u2s3u1(_lb);
123Ip_u2s3u1(_lbu);
124Ip_u2s3u1(_ld);
125Ip_u3u1u2(_ldx);
126Ip_u2s3u1(_lh);
127Ip_u2s3u1(_lhu);
128Ip_u2s3u1(_ll);
129Ip_u2s3u1(_lld);
130Ip_u1s2(_lui);
131Ip_u2s3u1(_lw);
132Ip_u2s3u1(_lwu);
133Ip_u3u1u2(_lwx);
134Ip_u1u2u3(_mfc0);
135Ip_u1u2u3(_mfhc0);
136Ip_u1(_mfhi);
137Ip_u1(_mflo);
138Ip_u3u1u2(_modu);
139Ip_u3u1u2(_movn);
140Ip_u3u1u2(_movz);
141Ip_u1u2u3(_mtc0);
142Ip_u1u2u3(_mthc0);
143Ip_u1(_mthi);
144Ip_u1(_mtlo);
145Ip_u3u1u2(_mul);
146Ip_u1u2(_multu);
147Ip_u3u1u2(_mulu);
148Ip_u3u1u2(_nor);
149Ip_u3u1u2(_or);
150Ip_u2u1u3(_ori);
151Ip_u2s3u1(_pref);
152Ip_0(_rfe);
153Ip_u2u1u3(_rotr);
154Ip_u2s3u1(_sb);
155Ip_u2s3u1(_sc);
156Ip_u2s3u1(_scd);
157Ip_u2s3u1(_sd);
158Ip_u3u1u2(_seleqz);
159Ip_u3u1u2(_selnez);
160Ip_u2s3u1(_sh);
161Ip_u2u1u3(_sll);
162Ip_u3u2u1(_sllv);
163Ip_s3s1s2(_slt);
164Ip_u2u1s3(_slti);
165Ip_u2u1s3(_sltiu);
166Ip_u3u1u2(_sltu);
167Ip_u2u1u3(_sra);
168Ip_u3u2u1(_srav);
169Ip_u2u1u3(_srl);
170Ip_u3u2u1(_srlv);
171Ip_u3u1u2(_subu);
172Ip_u2s3u1(_sw);
173Ip_u1(_sync);
174Ip_u1(_syscall);
175Ip_0(_tlbp);
176Ip_0(_tlbr);
177Ip_0(_tlbwi);
178Ip_0(_tlbwr);
179Ip_u1(_wait);
180Ip_u2u1(_wsbh);
181Ip_u3u1u2(_xor);
182Ip_u2u1u3(_xori);
183Ip_u2u1(_yield);
184Ip_u1u2(_ldpte);
185Ip_u2u1u3(_lddir);
186
187/* Handle labels. */
188struct uasm_label {
189 u32 *addr;
190 int lab;
191};
192
193void uasm_build_label(struct uasm_label **lab, u32 *addr,
194 int lid);
195#ifdef CONFIG_64BIT
196int uasm_in_compat_space_p(long addr);
197#endif
198int uasm_rel_hi(long val);
199int uasm_rel_lo(long val);
200void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr);
201void UASM_i_LA(u32 **buf, unsigned int rs, long addr);
202
203#define UASM_L_LA(lb) \
204static inline void uasm_l##lb(struct uasm_label **lab, u32 *addr) \
205{ \
206 uasm_build_label(lab, addr, label##lb); \
207}
208
209/* convenience macros for instructions */
210#ifdef CONFIG_64BIT
211# define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_daddiu(buf, rs, rt, val)
212# define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_daddu(buf, rs, rt, rd)
213# define UASM_i_LL(buf, rs, rt, off) uasm_i_lld(buf, rs, rt, off)
214# define UASM_i_LW(buf, rs, rt, off) uasm_i_ld(buf, rs, rt, off)
215# define UASM_i_LWX(buf, rs, rt, rd) uasm_i_ldx(buf, rs, rt, rd)
216# define UASM_i_MFC0(buf, rt, rd...) uasm_i_dmfc0(buf, rt, rd)
217# define UASM_i_MTC0(buf, rt, rd...) uasm_i_dmtc0(buf, rt, rd)
218# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_drotr(buf, rs, rt, sh)
219# define UASM_i_SC(buf, rs, rt, off) uasm_i_scd(buf, rs, rt, off)
220# define UASM_i_SLL(buf, rs, rt, sh) uasm_i_dsll(buf, rs, rt, sh)
221# define UASM_i_SRA(buf, rs, rt, sh) uasm_i_dsra(buf, rs, rt, sh)
222# define UASM_i_SRL(buf, rs, rt, sh) uasm_i_dsrl(buf, rs, rt, sh)
223# define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_dsrl_safe(buf, rs, rt, sh)
224# define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_dsubu(buf, rs, rt, rd)
225# define UASM_i_SW(buf, rs, rt, off) uasm_i_sd(buf, rs, rt, off)
226#else
227# define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_addiu(buf, rs, rt, val)
228# define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_addu(buf, rs, rt, rd)
229# define UASM_i_LL(buf, rs, rt, off) uasm_i_ll(buf, rs, rt, off)
230# define UASM_i_LW(buf, rs, rt, off) uasm_i_lw(buf, rs, rt, off)
231# define UASM_i_LWX(buf, rs, rt, rd) uasm_i_lwx(buf, rs, rt, rd)
232# define UASM_i_MFC0(buf, rt, rd...) uasm_i_mfc0(buf, rt, rd)
233# define UASM_i_MTC0(buf, rt, rd...) uasm_i_mtc0(buf, rt, rd)
234# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_rotr(buf, rs, rt, sh)
235# define UASM_i_SC(buf, rs, rt, off) uasm_i_sc(buf, rs, rt, off)
236# define UASM_i_SLL(buf, rs, rt, sh) uasm_i_sll(buf, rs, rt, sh)
237# define UASM_i_SRA(buf, rs, rt, sh) uasm_i_sra(buf, rs, rt, sh)
238# define UASM_i_SRL(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh)
239# define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh)
240# define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_subu(buf, rs, rt, rd)
241# define UASM_i_SW(buf, rs, rt, off) uasm_i_sw(buf, rs, rt, off)
242#endif
243
244#define uasm_i_b(buf, off) uasm_i_beq(buf, 0, 0, off)
245#define uasm_i_beqz(buf, rs, off) uasm_i_beq(buf, rs, 0, off)
246#define uasm_i_beqzl(buf, rs, off) uasm_i_beql(buf, rs, 0, off)
247#define uasm_i_bnez(buf, rs, off) uasm_i_bne(buf, rs, 0, off)
248#define uasm_i_bnezl(buf, rs, off) uasm_i_bnel(buf, rs, 0, off)
249#define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3)
250#define uasm_i_move(buf, a, b) UASM_i_ADDU(buf, a, 0, b)
251#define uasm_i_nop(buf) uasm_i_sll(buf, 0, 0, 0)
252#define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1)
253
254static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1,
255 unsigned int a2, unsigned int a3)
256{
257 if (a3 < 32)
258 uasm_i_drotr(p, a1, a2, a3);
259 else
260 uasm_i_drotr32(p, a1, a2, a3 - 32);
261}
262
263static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1,
264 unsigned int a2, unsigned int a3)
265{
266 if (a3 < 32)
267 uasm_i_dsll(p, a1, a2, a3);
268 else
269 uasm_i_dsll32(p, a1, a2, a3 - 32);
270}
271
272static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1,
273 unsigned int a2, unsigned int a3)
274{
275 if (a3 < 32)
276 uasm_i_dsrl(p, a1, a2, a3);
277 else
278 uasm_i_dsrl32(p, a1, a2, a3 - 32);
279}
280
281static inline void uasm_i_dsra_safe(u32 **p, unsigned int a1,
282 unsigned int a2, unsigned int a3)
283{
284 if (a3 < 32)
285 uasm_i_dsra(p, a1, a2, a3);
286 else
287 uasm_i_dsra32(p, a1, a2, a3 - 32);
288}
289
290/* Handle relocations. */
291struct uasm_reloc {
292 u32 *addr;
293 unsigned int type;
294 int lab;
295};
296
297/* This is zero so we can use zeroed label arrays. */
298#define UASM_LABEL_INVALID 0
299
300void uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid);
301void uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab);
302void uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end, long off);
303void uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end, long off);
304void uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab,
305 u32 *first, u32 *end, u32 *target);
306int uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr);
307
308/* Convenience functions for labeled branches. */
309void uasm_il_b(u32 **p, struct uasm_reloc **r, int lid);
310void uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg,
311 unsigned int bit, int lid);
312void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg,
313 unsigned int bit, int lid);
314void uasm_il_beq(u32 **p, struct uasm_reloc **r, unsigned int r1,
315 unsigned int r2, int lid);
316void uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
317void uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
318void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
319void uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
320void uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
321void uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1,
322 unsigned int reg2, int lid);
323void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
324
325#endif /* __ASM_UASM_H */
diff --git a/arch/mips/include/asm/unaligned-emul.h b/arch/mips/include/asm/unaligned-emul.h
new file mode 100644
index 000000000..2022b1894
--- /dev/null
+++ b/arch/mips/include/asm/unaligned-emul.h
@@ -0,0 +1,779 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2#ifndef _ASM_MIPS_UNALIGNED_EMUL_H
3#define _ASM_MIPS_UNALIGNED_EMUL_H
4
5#include <asm/asm.h>
6
7#ifdef __BIG_ENDIAN
8#define _LoadHW(addr, value, res, type) \
9do { \
10 __asm__ __volatile__ (".set\tnoat\n" \
11 "1:\t"type##_lb("%0", "0(%2)")"\n" \
12 "2:\t"type##_lbu("$1", "1(%2)")"\n\t"\
13 "sll\t%0, 0x8\n\t" \
14 "or\t%0, $1\n\t" \
15 "li\t%1, 0\n" \
16 "3:\t.set\tat\n\t" \
17 ".insn\n\t" \
18 ".section\t.fixup,\"ax\"\n\t" \
19 "4:\tli\t%1, %3\n\t" \
20 "j\t3b\n\t" \
21 ".previous\n\t" \
22 ".section\t__ex_table,\"a\"\n\t" \
23 STR(PTR)"\t1b, 4b\n\t" \
24 STR(PTR)"\t2b, 4b\n\t" \
25 ".previous" \
26 : "=&r" (value), "=r" (res) \
27 : "r" (addr), "i" (-EFAULT)); \
28} while (0)
29
30#ifndef CONFIG_CPU_NO_LOAD_STORE_LR
31#define _LoadW(addr, value, res, type) \
32do { \
33 __asm__ __volatile__ ( \
34 "1:\t"type##_lwl("%0", "(%2)")"\n" \
35 "2:\t"type##_lwr("%0", "3(%2)")"\n\t"\
36 "li\t%1, 0\n" \
37 "3:\n\t" \
38 ".insn\n\t" \
39 ".section\t.fixup,\"ax\"\n\t" \
40 "4:\tli\t%1, %3\n\t" \
41 "j\t3b\n\t" \
42 ".previous\n\t" \
43 ".section\t__ex_table,\"a\"\n\t" \
44 STR(PTR)"\t1b, 4b\n\t" \
45 STR(PTR)"\t2b, 4b\n\t" \
46 ".previous" \
47 : "=&r" (value), "=r" (res) \
48 : "r" (addr), "i" (-EFAULT)); \
49} while (0)
50
51#else /* CONFIG_CPU_NO_LOAD_STORE_LR */
52/* For CPUs without lwl instruction */
53#define _LoadW(addr, value, res, type) \
54do { \
55 __asm__ __volatile__ ( \
56 ".set\tpush\n" \
57 ".set\tnoat\n\t" \
58 "1:"type##_lb("%0", "0(%2)")"\n\t" \
59 "2:"type##_lbu("$1", "1(%2)")"\n\t" \
60 "sll\t%0, 0x8\n\t" \
61 "or\t%0, $1\n\t" \
62 "3:"type##_lbu("$1", "2(%2)")"\n\t" \
63 "sll\t%0, 0x8\n\t" \
64 "or\t%0, $1\n\t" \
65 "4:"type##_lbu("$1", "3(%2)")"\n\t" \
66 "sll\t%0, 0x8\n\t" \
67 "or\t%0, $1\n\t" \
68 "li\t%1, 0\n" \
69 ".set\tpop\n" \
70 "10:\n\t" \
71 ".insn\n\t" \
72 ".section\t.fixup,\"ax\"\n\t" \
73 "11:\tli\t%1, %3\n\t" \
74 "j\t10b\n\t" \
75 ".previous\n\t" \
76 ".section\t__ex_table,\"a\"\n\t" \
77 STR(PTR)"\t1b, 11b\n\t" \
78 STR(PTR)"\t2b, 11b\n\t" \
79 STR(PTR)"\t3b, 11b\n\t" \
80 STR(PTR)"\t4b, 11b\n\t" \
81 ".previous" \
82 : "=&r" (value), "=r" (res) \
83 : "r" (addr), "i" (-EFAULT)); \
84} while (0)
85
86#endif /* CONFIG_CPU_NO_LOAD_STORE_LR */
87
88#define _LoadHWU(addr, value, res, type) \
89do { \
90 __asm__ __volatile__ ( \
91 ".set\tnoat\n" \
92 "1:\t"type##_lbu("%0", "0(%2)")"\n" \
93 "2:\t"type##_lbu("$1", "1(%2)")"\n\t"\
94 "sll\t%0, 0x8\n\t" \
95 "or\t%0, $1\n\t" \
96 "li\t%1, 0\n" \
97 "3:\n\t" \
98 ".insn\n\t" \
99 ".set\tat\n\t" \
100 ".section\t.fixup,\"ax\"\n\t" \
101 "4:\tli\t%1, %3\n\t" \
102 "j\t3b\n\t" \
103 ".previous\n\t" \
104 ".section\t__ex_table,\"a\"\n\t" \
105 STR(PTR)"\t1b, 4b\n\t" \
106 STR(PTR)"\t2b, 4b\n\t" \
107 ".previous" \
108 : "=&r" (value), "=r" (res) \
109 : "r" (addr), "i" (-EFAULT)); \
110} while (0)
111
112#ifndef CONFIG_CPU_NO_LOAD_STORE_LR
113#define _LoadWU(addr, value, res, type) \
114do { \
115 __asm__ __volatile__ ( \
116 "1:\t"type##_lwl("%0", "(%2)")"\n" \
117 "2:\t"type##_lwr("%0", "3(%2)")"\n\t"\
118 "dsll\t%0, %0, 32\n\t" \
119 "dsrl\t%0, %0, 32\n\t" \
120 "li\t%1, 0\n" \
121 "3:\n\t" \
122 ".insn\n\t" \
123 "\t.section\t.fixup,\"ax\"\n\t" \
124 "4:\tli\t%1, %3\n\t" \
125 "j\t3b\n\t" \
126 ".previous\n\t" \
127 ".section\t__ex_table,\"a\"\n\t" \
128 STR(PTR)"\t1b, 4b\n\t" \
129 STR(PTR)"\t2b, 4b\n\t" \
130 ".previous" \
131 : "=&r" (value), "=r" (res) \
132 : "r" (addr), "i" (-EFAULT)); \
133} while (0)
134
135#define _LoadDW(addr, value, res) \
136do { \
137 __asm__ __volatile__ ( \
138 "1:\tldl\t%0, (%2)\n" \
139 "2:\tldr\t%0, 7(%2)\n\t" \
140 "li\t%1, 0\n" \
141 "3:\n\t" \
142 ".insn\n\t" \
143 "\t.section\t.fixup,\"ax\"\n\t" \
144 "4:\tli\t%1, %3\n\t" \
145 "j\t3b\n\t" \
146 ".previous\n\t" \
147 ".section\t__ex_table,\"a\"\n\t" \
148 STR(PTR)"\t1b, 4b\n\t" \
149 STR(PTR)"\t2b, 4b\n\t" \
150 ".previous" \
151 : "=&r" (value), "=r" (res) \
152 : "r" (addr), "i" (-EFAULT)); \
153} while (0)
154
155#else /* CONFIG_CPU_NO_LOAD_STORE_LR */
156/* For CPUs without lwl and ldl instructions */
157#define _LoadWU(addr, value, res, type) \
158do { \
159 __asm__ __volatile__ ( \
160 ".set\tpush\n\t" \
161 ".set\tnoat\n\t" \
162 "1:"type##_lbu("%0", "0(%2)")"\n\t" \
163 "2:"type##_lbu("$1", "1(%2)")"\n\t" \
164 "sll\t%0, 0x8\n\t" \
165 "or\t%0, $1\n\t" \
166 "3:"type##_lbu("$1", "2(%2)")"\n\t" \
167 "sll\t%0, 0x8\n\t" \
168 "or\t%0, $1\n\t" \
169 "4:"type##_lbu("$1", "3(%2)")"\n\t" \
170 "sll\t%0, 0x8\n\t" \
171 "or\t%0, $1\n\t" \
172 "li\t%1, 0\n" \
173 ".set\tpop\n" \
174 "10:\n\t" \
175 ".insn\n\t" \
176 ".section\t.fixup,\"ax\"\n\t" \
177 "11:\tli\t%1, %3\n\t" \
178 "j\t10b\n\t" \
179 ".previous\n\t" \
180 ".section\t__ex_table,\"a\"\n\t" \
181 STR(PTR)"\t1b, 11b\n\t" \
182 STR(PTR)"\t2b, 11b\n\t" \
183 STR(PTR)"\t3b, 11b\n\t" \
184 STR(PTR)"\t4b, 11b\n\t" \
185 ".previous" \
186 : "=&r" (value), "=r" (res) \
187 : "r" (addr), "i" (-EFAULT)); \
188} while (0)
189
190#define _LoadDW(addr, value, res) \
191do { \
192 __asm__ __volatile__ ( \
193 ".set\tpush\n\t" \
194 ".set\tnoat\n\t" \
195 "1:lb\t%0, 0(%2)\n\t" \
196 "2:lbu\t $1, 1(%2)\n\t" \
197 "dsll\t%0, 0x8\n\t" \
198 "or\t%0, $1\n\t" \
199 "3:lbu\t$1, 2(%2)\n\t" \
200 "dsll\t%0, 0x8\n\t" \
201 "or\t%0, $1\n\t" \
202 "4:lbu\t$1, 3(%2)\n\t" \
203 "dsll\t%0, 0x8\n\t" \
204 "or\t%0, $1\n\t" \
205 "5:lbu\t$1, 4(%2)\n\t" \
206 "dsll\t%0, 0x8\n\t" \
207 "or\t%0, $1\n\t" \
208 "6:lbu\t$1, 5(%2)\n\t" \
209 "dsll\t%0, 0x8\n\t" \
210 "or\t%0, $1\n\t" \
211 "7:lbu\t$1, 6(%2)\n\t" \
212 "dsll\t%0, 0x8\n\t" \
213 "or\t%0, $1\n\t" \
214 "8:lbu\t$1, 7(%2)\n\t" \
215 "dsll\t%0, 0x8\n\t" \
216 "or\t%0, $1\n\t" \
217 "li\t%1, 0\n" \
218 ".set\tpop\n\t" \
219 "10:\n\t" \
220 ".insn\n\t" \
221 ".section\t.fixup,\"ax\"\n\t" \
222 "11:\tli\t%1, %3\n\t" \
223 "j\t10b\n\t" \
224 ".previous\n\t" \
225 ".section\t__ex_table,\"a\"\n\t" \
226 STR(PTR)"\t1b, 11b\n\t" \
227 STR(PTR)"\t2b, 11b\n\t" \
228 STR(PTR)"\t3b, 11b\n\t" \
229 STR(PTR)"\t4b, 11b\n\t" \
230 STR(PTR)"\t5b, 11b\n\t" \
231 STR(PTR)"\t6b, 11b\n\t" \
232 STR(PTR)"\t7b, 11b\n\t" \
233 STR(PTR)"\t8b, 11b\n\t" \
234 ".previous" \
235 : "=&r" (value), "=r" (res) \
236 : "r" (addr), "i" (-EFAULT)); \
237} while (0)
238
239#endif /* CONFIG_CPU_NO_LOAD_STORE_LR */
240
241
242#define _StoreHW(addr, value, res, type) \
243do { \
244 __asm__ __volatile__ ( \
245 ".set\tnoat\n" \
246 "1:\t"type##_sb("%1", "1(%2)")"\n" \
247 "srl\t$1, %1, 0x8\n" \
248 "2:\t"type##_sb("$1", "0(%2)")"\n" \
249 ".set\tat\n\t" \
250 "li\t%0, 0\n" \
251 "3:\n\t" \
252 ".insn\n\t" \
253 ".section\t.fixup,\"ax\"\n\t" \
254 "4:\tli\t%0, %3\n\t" \
255 "j\t3b\n\t" \
256 ".previous\n\t" \
257 ".section\t__ex_table,\"a\"\n\t" \
258 STR(PTR)"\t1b, 4b\n\t" \
259 STR(PTR)"\t2b, 4b\n\t" \
260 ".previous" \
261 : "=r" (res) \
262 : "r" (value), "r" (addr), "i" (-EFAULT));\
263} while (0)
264
265#ifndef CONFIG_CPU_NO_LOAD_STORE_LR
266#define _StoreW(addr, value, res, type) \
267do { \
268 __asm__ __volatile__ ( \
269 "1:\t"type##_swl("%1", "(%2)")"\n" \
270 "2:\t"type##_swr("%1", "3(%2)")"\n\t"\
271 "li\t%0, 0\n" \
272 "3:\n\t" \
273 ".insn\n\t" \
274 ".section\t.fixup,\"ax\"\n\t" \
275 "4:\tli\t%0, %3\n\t" \
276 "j\t3b\n\t" \
277 ".previous\n\t" \
278 ".section\t__ex_table,\"a\"\n\t" \
279 STR(PTR)"\t1b, 4b\n\t" \
280 STR(PTR)"\t2b, 4b\n\t" \
281 ".previous" \
282 : "=r" (res) \
283 : "r" (value), "r" (addr), "i" (-EFAULT)); \
284} while (0)
285
286#define _StoreDW(addr, value, res) \
287do { \
288 __asm__ __volatile__ ( \
289 "1:\tsdl\t%1,(%2)\n" \
290 "2:\tsdr\t%1, 7(%2)\n\t" \
291 "li\t%0, 0\n" \
292 "3:\n\t" \
293 ".insn\n\t" \
294 ".section\t.fixup,\"ax\"\n\t" \
295 "4:\tli\t%0, %3\n\t" \
296 "j\t3b\n\t" \
297 ".previous\n\t" \
298 ".section\t__ex_table,\"a\"\n\t" \
299 STR(PTR)"\t1b, 4b\n\t" \
300 STR(PTR)"\t2b, 4b\n\t" \
301 ".previous" \
302 : "=r" (res) \
303 : "r" (value), "r" (addr), "i" (-EFAULT)); \
304} while (0)
305
306#else /* CONFIG_CPU_NO_LOAD_STORE_LR */
307#define _StoreW(addr, value, res, type) \
308do { \
309 __asm__ __volatile__ ( \
310 ".set\tpush\n\t" \
311 ".set\tnoat\n\t" \
312 "1:"type##_sb("%1", "3(%2)")"\n\t" \
313 "srl\t$1, %1, 0x8\n\t" \
314 "2:"type##_sb("$1", "2(%2)")"\n\t" \
315 "srl\t$1, $1, 0x8\n\t" \
316 "3:"type##_sb("$1", "1(%2)")"\n\t" \
317 "srl\t$1, $1, 0x8\n\t" \
318 "4:"type##_sb("$1", "0(%2)")"\n\t" \
319 ".set\tpop\n\t" \
320 "li\t%0, 0\n" \
321 "10:\n\t" \
322 ".insn\n\t" \
323 ".section\t.fixup,\"ax\"\n\t" \
324 "11:\tli\t%0, %3\n\t" \
325 "j\t10b\n\t" \
326 ".previous\n\t" \
327 ".section\t__ex_table,\"a\"\n\t" \
328 STR(PTR)"\t1b, 11b\n\t" \
329 STR(PTR)"\t2b, 11b\n\t" \
330 STR(PTR)"\t3b, 11b\n\t" \
331 STR(PTR)"\t4b, 11b\n\t" \
332 ".previous" \
333 : "=&r" (res) \
334 : "r" (value), "r" (addr), "i" (-EFAULT) \
335 : "memory"); \
336} while (0)
337
338#define _StoreDW(addr, value, res) \
339do { \
340 __asm__ __volatile__ ( \
341 ".set\tpush\n\t" \
342 ".set\tnoat\n\t" \
343 "1:sb\t%1, 7(%2)\n\t" \
344 "dsrl\t$1, %1, 0x8\n\t" \
345 "2:sb\t$1, 6(%2)\n\t" \
346 "dsrl\t$1, $1, 0x8\n\t" \
347 "3:sb\t$1, 5(%2)\n\t" \
348 "dsrl\t$1, $1, 0x8\n\t" \
349 "4:sb\t$1, 4(%2)\n\t" \
350 "dsrl\t$1, $1, 0x8\n\t" \
351 "5:sb\t$1, 3(%2)\n\t" \
352 "dsrl\t$1, $1, 0x8\n\t" \
353 "6:sb\t$1, 2(%2)\n\t" \
354 "dsrl\t$1, $1, 0x8\n\t" \
355 "7:sb\t$1, 1(%2)\n\t" \
356 "dsrl\t$1, $1, 0x8\n\t" \
357 "8:sb\t$1, 0(%2)\n\t" \
358 "dsrl\t$1, $1, 0x8\n\t" \
359 ".set\tpop\n\t" \
360 "li\t%0, 0\n" \
361 "10:\n\t" \
362 ".insn\n\t" \
363 ".section\t.fixup,\"ax\"\n\t" \
364 "11:\tli\t%0, %3\n\t" \
365 "j\t10b\n\t" \
366 ".previous\n\t" \
367 ".section\t__ex_table,\"a\"\n\t" \
368 STR(PTR)"\t1b, 11b\n\t" \
369 STR(PTR)"\t2b, 11b\n\t" \
370 STR(PTR)"\t3b, 11b\n\t" \
371 STR(PTR)"\t4b, 11b\n\t" \
372 STR(PTR)"\t5b, 11b\n\t" \
373 STR(PTR)"\t6b, 11b\n\t" \
374 STR(PTR)"\t7b, 11b\n\t" \
375 STR(PTR)"\t8b, 11b\n\t" \
376 ".previous" \
377 : "=&r" (res) \
378 : "r" (value), "r" (addr), "i" (-EFAULT) \
379 : "memory"); \
380} while (0)
381
382#endif /* CONFIG_CPU_NO_LOAD_STORE_LR */
383
384#else /* __BIG_ENDIAN */
385
386#define _LoadHW(addr, value, res, type) \
387do { \
388 __asm__ __volatile__ (".set\tnoat\n" \
389 "1:\t"type##_lb("%0", "1(%2)")"\n" \
390 "2:\t"type##_lbu("$1", "0(%2)")"\n\t"\
391 "sll\t%0, 0x8\n\t" \
392 "or\t%0, $1\n\t" \
393 "li\t%1, 0\n" \
394 "3:\t.set\tat\n\t" \
395 ".insn\n\t" \
396 ".section\t.fixup,\"ax\"\n\t" \
397 "4:\tli\t%1, %3\n\t" \
398 "j\t3b\n\t" \
399 ".previous\n\t" \
400 ".section\t__ex_table,\"a\"\n\t" \
401 STR(PTR)"\t1b, 4b\n\t" \
402 STR(PTR)"\t2b, 4b\n\t" \
403 ".previous" \
404 : "=&r" (value), "=r" (res) \
405 : "r" (addr), "i" (-EFAULT)); \
406} while (0)
407
408#ifndef CONFIG_CPU_NO_LOAD_STORE_LR
409#define _LoadW(addr, value, res, type) \
410do { \
411 __asm__ __volatile__ ( \
412 "1:\t"type##_lwl("%0", "3(%2)")"\n" \
413 "2:\t"type##_lwr("%0", "(%2)")"\n\t"\
414 "li\t%1, 0\n" \
415 "3:\n\t" \
416 ".insn\n\t" \
417 ".section\t.fixup,\"ax\"\n\t" \
418 "4:\tli\t%1, %3\n\t" \
419 "j\t3b\n\t" \
420 ".previous\n\t" \
421 ".section\t__ex_table,\"a\"\n\t" \
422 STR(PTR)"\t1b, 4b\n\t" \
423 STR(PTR)"\t2b, 4b\n\t" \
424 ".previous" \
425 : "=&r" (value), "=r" (res) \
426 : "r" (addr), "i" (-EFAULT)); \
427} while (0)
428
429#else /* CONFIG_CPU_NO_LOAD_STORE_LR */
430/* For CPUs without lwl instruction */
431#define _LoadW(addr, value, res, type) \
432do { \
433 __asm__ __volatile__ ( \
434 ".set\tpush\n" \
435 ".set\tnoat\n\t" \
436 "1:"type##_lb("%0", "3(%2)")"\n\t" \
437 "2:"type##_lbu("$1", "2(%2)")"\n\t" \
438 "sll\t%0, 0x8\n\t" \
439 "or\t%0, $1\n\t" \
440 "3:"type##_lbu("$1", "1(%2)")"\n\t" \
441 "sll\t%0, 0x8\n\t" \
442 "or\t%0, $1\n\t" \
443 "4:"type##_lbu("$1", "0(%2)")"\n\t" \
444 "sll\t%0, 0x8\n\t" \
445 "or\t%0, $1\n\t" \
446 "li\t%1, 0\n" \
447 ".set\tpop\n" \
448 "10:\n\t" \
449 ".insn\n\t" \
450 ".section\t.fixup,\"ax\"\n\t" \
451 "11:\tli\t%1, %3\n\t" \
452 "j\t10b\n\t" \
453 ".previous\n\t" \
454 ".section\t__ex_table,\"a\"\n\t" \
455 STR(PTR)"\t1b, 11b\n\t" \
456 STR(PTR)"\t2b, 11b\n\t" \
457 STR(PTR)"\t3b, 11b\n\t" \
458 STR(PTR)"\t4b, 11b\n\t" \
459 ".previous" \
460 : "=&r" (value), "=r" (res) \
461 : "r" (addr), "i" (-EFAULT)); \
462} while (0)
463
464#endif /* CONFIG_CPU_NO_LOAD_STORE_LR */
465
466
467#define _LoadHWU(addr, value, res, type) \
468do { \
469 __asm__ __volatile__ ( \
470 ".set\tnoat\n" \
471 "1:\t"type##_lbu("%0", "1(%2)")"\n" \
472 "2:\t"type##_lbu("$1", "0(%2)")"\n\t"\
473 "sll\t%0, 0x8\n\t" \
474 "or\t%0, $1\n\t" \
475 "li\t%1, 0\n" \
476 "3:\n\t" \
477 ".insn\n\t" \
478 ".set\tat\n\t" \
479 ".section\t.fixup,\"ax\"\n\t" \
480 "4:\tli\t%1, %3\n\t" \
481 "j\t3b\n\t" \
482 ".previous\n\t" \
483 ".section\t__ex_table,\"a\"\n\t" \
484 STR(PTR)"\t1b, 4b\n\t" \
485 STR(PTR)"\t2b, 4b\n\t" \
486 ".previous" \
487 : "=&r" (value), "=r" (res) \
488 : "r" (addr), "i" (-EFAULT)); \
489} while (0)
490
491#ifndef CONFIG_CPU_NO_LOAD_STORE_LR
492#define _LoadWU(addr, value, res, type) \
493do { \
494 __asm__ __volatile__ ( \
495 "1:\t"type##_lwl("%0", "3(%2)")"\n" \
496 "2:\t"type##_lwr("%0", "(%2)")"\n\t"\
497 "dsll\t%0, %0, 32\n\t" \
498 "dsrl\t%0, %0, 32\n\t" \
499 "li\t%1, 0\n" \
500 "3:\n\t" \
501 ".insn\n\t" \
502 "\t.section\t.fixup,\"ax\"\n\t" \
503 "4:\tli\t%1, %3\n\t" \
504 "j\t3b\n\t" \
505 ".previous\n\t" \
506 ".section\t__ex_table,\"a\"\n\t" \
507 STR(PTR)"\t1b, 4b\n\t" \
508 STR(PTR)"\t2b, 4b\n\t" \
509 ".previous" \
510 : "=&r" (value), "=r" (res) \
511 : "r" (addr), "i" (-EFAULT)); \
512} while (0)
513
514#define _LoadDW(addr, value, res) \
515do { \
516 __asm__ __volatile__ ( \
517 "1:\tldl\t%0, 7(%2)\n" \
518 "2:\tldr\t%0, (%2)\n\t" \
519 "li\t%1, 0\n" \
520 "3:\n\t" \
521 ".insn\n\t" \
522 "\t.section\t.fixup,\"ax\"\n\t" \
523 "4:\tli\t%1, %3\n\t" \
524 "j\t3b\n\t" \
525 ".previous\n\t" \
526 ".section\t__ex_table,\"a\"\n\t" \
527 STR(PTR)"\t1b, 4b\n\t" \
528 STR(PTR)"\t2b, 4b\n\t" \
529 ".previous" \
530 : "=&r" (value), "=r" (res) \
531 : "r" (addr), "i" (-EFAULT)); \
532} while (0)
533
534#else /* CONFIG_CPU_NO_LOAD_STORE_LR */
535/* For CPUs without lwl and ldl instructions */
536#define _LoadWU(addr, value, res, type) \
537do { \
538 __asm__ __volatile__ ( \
539 ".set\tpush\n\t" \
540 ".set\tnoat\n\t" \
541 "1:"type##_lbu("%0", "3(%2)")"\n\t" \
542 "2:"type##_lbu("$1", "2(%2)")"\n\t" \
543 "sll\t%0, 0x8\n\t" \
544 "or\t%0, $1\n\t" \
545 "3:"type##_lbu("$1", "1(%2)")"\n\t" \
546 "sll\t%0, 0x8\n\t" \
547 "or\t%0, $1\n\t" \
548 "4:"type##_lbu("$1", "0(%2)")"\n\t" \
549 "sll\t%0, 0x8\n\t" \
550 "or\t%0, $1\n\t" \
551 "li\t%1, 0\n" \
552 ".set\tpop\n" \
553 "10:\n\t" \
554 ".insn\n\t" \
555 ".section\t.fixup,\"ax\"\n\t" \
556 "11:\tli\t%1, %3\n\t" \
557 "j\t10b\n\t" \
558 ".previous\n\t" \
559 ".section\t__ex_table,\"a\"\n\t" \
560 STR(PTR)"\t1b, 11b\n\t" \
561 STR(PTR)"\t2b, 11b\n\t" \
562 STR(PTR)"\t3b, 11b\n\t" \
563 STR(PTR)"\t4b, 11b\n\t" \
564 ".previous" \
565 : "=&r" (value), "=r" (res) \
566 : "r" (addr), "i" (-EFAULT)); \
567} while (0)
568
569#define _LoadDW(addr, value, res) \
570do { \
571 __asm__ __volatile__ ( \
572 ".set\tpush\n\t" \
573 ".set\tnoat\n\t" \
574 "1:lb\t%0, 7(%2)\n\t" \
575 "2:lbu\t$1, 6(%2)\n\t" \
576 "dsll\t%0, 0x8\n\t" \
577 "or\t%0, $1\n\t" \
578 "3:lbu\t$1, 5(%2)\n\t" \
579 "dsll\t%0, 0x8\n\t" \
580 "or\t%0, $1\n\t" \
581 "4:lbu\t$1, 4(%2)\n\t" \
582 "dsll\t%0, 0x8\n\t" \
583 "or\t%0, $1\n\t" \
584 "5:lbu\t$1, 3(%2)\n\t" \
585 "dsll\t%0, 0x8\n\t" \
586 "or\t%0, $1\n\t" \
587 "6:lbu\t$1, 2(%2)\n\t" \
588 "dsll\t%0, 0x8\n\t" \
589 "or\t%0, $1\n\t" \
590 "7:lbu\t$1, 1(%2)\n\t" \
591 "dsll\t%0, 0x8\n\t" \
592 "or\t%0, $1\n\t" \
593 "8:lbu\t$1, 0(%2)\n\t" \
594 "dsll\t%0, 0x8\n\t" \
595 "or\t%0, $1\n\t" \
596 "li\t%1, 0\n" \
597 ".set\tpop\n\t" \
598 "10:\n\t" \
599 ".insn\n\t" \
600 ".section\t.fixup,\"ax\"\n\t" \
601 "11:\tli\t%1, %3\n\t" \
602 "j\t10b\n\t" \
603 ".previous\n\t" \
604 ".section\t__ex_table,\"a\"\n\t" \
605 STR(PTR)"\t1b, 11b\n\t" \
606 STR(PTR)"\t2b, 11b\n\t" \
607 STR(PTR)"\t3b, 11b\n\t" \
608 STR(PTR)"\t4b, 11b\n\t" \
609 STR(PTR)"\t5b, 11b\n\t" \
610 STR(PTR)"\t6b, 11b\n\t" \
611 STR(PTR)"\t7b, 11b\n\t" \
612 STR(PTR)"\t8b, 11b\n\t" \
613 ".previous" \
614 : "=&r" (value), "=r" (res) \
615 : "r" (addr), "i" (-EFAULT)); \
616} while (0)
617#endif /* CONFIG_CPU_NO_LOAD_STORE_LR */
618
619#define _StoreHW(addr, value, res, type) \
620do { \
621 __asm__ __volatile__ ( \
622 ".set\tnoat\n" \
623 "1:\t"type##_sb("%1", "0(%2)")"\n" \
624 "srl\t$1,%1, 0x8\n" \
625 "2:\t"type##_sb("$1", "1(%2)")"\n" \
626 ".set\tat\n\t" \
627 "li\t%0, 0\n" \
628 "3:\n\t" \
629 ".insn\n\t" \
630 ".section\t.fixup,\"ax\"\n\t" \
631 "4:\tli\t%0, %3\n\t" \
632 "j\t3b\n\t" \
633 ".previous\n\t" \
634 ".section\t__ex_table,\"a\"\n\t" \
635 STR(PTR)"\t1b, 4b\n\t" \
636 STR(PTR)"\t2b, 4b\n\t" \
637 ".previous" \
638 : "=r" (res) \
639 : "r" (value), "r" (addr), "i" (-EFAULT));\
640} while (0)
641
642#ifndef CONFIG_CPU_NO_LOAD_STORE_LR
643#define _StoreW(addr, value, res, type) \
644do { \
645 __asm__ __volatile__ ( \
646 "1:\t"type##_swl("%1", "3(%2)")"\n" \
647 "2:\t"type##_swr("%1", "(%2)")"\n\t"\
648 "li\t%0, 0\n" \
649 "3:\n\t" \
650 ".insn\n\t" \
651 ".section\t.fixup,\"ax\"\n\t" \
652 "4:\tli\t%0, %3\n\t" \
653 "j\t3b\n\t" \
654 ".previous\n\t" \
655 ".section\t__ex_table,\"a\"\n\t" \
656 STR(PTR)"\t1b, 4b\n\t" \
657 STR(PTR)"\t2b, 4b\n\t" \
658 ".previous" \
659 : "=r" (res) \
660 : "r" (value), "r" (addr), "i" (-EFAULT)); \
661} while (0)
662
663#define _StoreDW(addr, value, res) \
664do { \
665 __asm__ __volatile__ ( \
666 "1:\tsdl\t%1, 7(%2)\n" \
667 "2:\tsdr\t%1, (%2)\n\t" \
668 "li\t%0, 0\n" \
669 "3:\n\t" \
670 ".insn\n\t" \
671 ".section\t.fixup,\"ax\"\n\t" \
672 "4:\tli\t%0, %3\n\t" \
673 "j\t3b\n\t" \
674 ".previous\n\t" \
675 ".section\t__ex_table,\"a\"\n\t" \
676 STR(PTR)"\t1b, 4b\n\t" \
677 STR(PTR)"\t2b, 4b\n\t" \
678 ".previous" \
679 : "=r" (res) \
680 : "r" (value), "r" (addr), "i" (-EFAULT)); \
681} while (0)
682
683#else /* CONFIG_CPU_NO_LOAD_STORE_LR */
684/* For CPUs without swl and sdl instructions */
685#define _StoreW(addr, value, res, type) \
686do { \
687 __asm__ __volatile__ ( \
688 ".set\tpush\n\t" \
689 ".set\tnoat\n\t" \
690 "1:"type##_sb("%1", "0(%2)")"\n\t" \
691 "srl\t$1, %1, 0x8\n\t" \
692 "2:"type##_sb("$1", "1(%2)")"\n\t" \
693 "srl\t$1, $1, 0x8\n\t" \
694 "3:"type##_sb("$1", "2(%2)")"\n\t" \
695 "srl\t$1, $1, 0x8\n\t" \
696 "4:"type##_sb("$1", "3(%2)")"\n\t" \
697 ".set\tpop\n\t" \
698 "li\t%0, 0\n" \
699 "10:\n\t" \
700 ".insn\n\t" \
701 ".section\t.fixup,\"ax\"\n\t" \
702 "11:\tli\t%0, %3\n\t" \
703 "j\t10b\n\t" \
704 ".previous\n\t" \
705 ".section\t__ex_table,\"a\"\n\t" \
706 STR(PTR)"\t1b, 11b\n\t" \
707 STR(PTR)"\t2b, 11b\n\t" \
708 STR(PTR)"\t3b, 11b\n\t" \
709 STR(PTR)"\t4b, 11b\n\t" \
710 ".previous" \
711 : "=&r" (res) \
712 : "r" (value), "r" (addr), "i" (-EFAULT) \
713 : "memory"); \
714} while (0)
715
716#define _StoreDW(addr, value, res) \
717do { \
718 __asm__ __volatile__ ( \
719 ".set\tpush\n\t" \
720 ".set\tnoat\n\t" \
721 "1:sb\t%1, 0(%2)\n\t" \
722 "dsrl\t$1, %1, 0x8\n\t" \
723 "2:sb\t$1, 1(%2)\n\t" \
724 "dsrl\t$1, $1, 0x8\n\t" \
725 "3:sb\t$1, 2(%2)\n\t" \
726 "dsrl\t$1, $1, 0x8\n\t" \
727 "4:sb\t$1, 3(%2)\n\t" \
728 "dsrl\t$1, $1, 0x8\n\t" \
729 "5:sb\t$1, 4(%2)\n\t" \
730 "dsrl\t$1, $1, 0x8\n\t" \
731 "6:sb\t$1, 5(%2)\n\t" \
732 "dsrl\t$1, $1, 0x8\n\t" \
733 "7:sb\t$1, 6(%2)\n\t" \
734 "dsrl\t$1, $1, 0x8\n\t" \
735 "8:sb\t$1, 7(%2)\n\t" \
736 "dsrl\t$1, $1, 0x8\n\t" \
737 ".set\tpop\n\t" \
738 "li\t%0, 0\n" \
739 "10:\n\t" \
740 ".insn\n\t" \
741 ".section\t.fixup,\"ax\"\n\t" \
742 "11:\tli\t%0, %3\n\t" \
743 "j\t10b\n\t" \
744 ".previous\n\t" \
745 ".section\t__ex_table,\"a\"\n\t" \
746 STR(PTR)"\t1b, 11b\n\t" \
747 STR(PTR)"\t2b, 11b\n\t" \
748 STR(PTR)"\t3b, 11b\n\t" \
749 STR(PTR)"\t4b, 11b\n\t" \
750 STR(PTR)"\t5b, 11b\n\t" \
751 STR(PTR)"\t6b, 11b\n\t" \
752 STR(PTR)"\t7b, 11b\n\t" \
753 STR(PTR)"\t8b, 11b\n\t" \
754 ".previous" \
755 : "=&r" (res) \
756 : "r" (value), "r" (addr), "i" (-EFAULT) \
757 : "memory"); \
758} while (0)
759
760#endif /* CONFIG_CPU_NO_LOAD_STORE_LR */
761#endif
762
763#define LoadHWU(addr, value, res) _LoadHWU(addr, value, res, kernel)
764#define LoadHWUE(addr, value, res) _LoadHWU(addr, value, res, user)
765#define LoadWU(addr, value, res) _LoadWU(addr, value, res, kernel)
766#define LoadWUE(addr, value, res) _LoadWU(addr, value, res, user)
767#define LoadHW(addr, value, res) _LoadHW(addr, value, res, kernel)
768#define LoadHWE(addr, value, res) _LoadHW(addr, value, res, user)
769#define LoadW(addr, value, res) _LoadW(addr, value, res, kernel)
770#define LoadWE(addr, value, res) _LoadW(addr, value, res, user)
771#define LoadDW(addr, value, res) _LoadDW(addr, value, res)
772
773#define StoreHW(addr, value, res) _StoreHW(addr, value, res, kernel)
774#define StoreHWE(addr, value, res) _StoreHW(addr, value, res, user)
775#define StoreW(addr, value, res) _StoreW(addr, value, res, kernel)
776#define StoreWE(addr, value, res) _StoreW(addr, value, res, user)
777#define StoreDW(addr, value, res) _StoreDW(addr, value, res)
778
779#endif /* _ASM_MIPS_UNALIGNED_EMUL_H */
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
new file mode 100644
index 000000000..5d70babfc
--- /dev/null
+++ b/arch/mips/include/asm/unistd.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) 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 <uapi/asm/unistd.h>
16#include <asm/unistd_nr_n32.h>
17#include <asm/unistd_nr_n64.h>
18#include <asm/unistd_nr_o32.h>
19
20#ifdef CONFIG_MIPS32_N32
21#define NR_syscalls (__NR_N32_Linux + __NR_N32_Linux_syscalls)
22#elif defined(CONFIG_64BIT)
23#define NR_syscalls (__NR_64_Linux + __NR_64_Linux_syscalls)
24#else
25#define NR_syscalls (__NR_O32_Linux + __NR_O32_Linux_syscalls)
26#endif
27
28#ifndef __ASSEMBLY__
29
30#define __ARCH_WANT_NEW_STAT
31#define __ARCH_WANT_OLD_READDIR
32#define __ARCH_WANT_SYS_ALARM
33#define __ARCH_WANT_SYS_GETHOSTNAME
34#define __ARCH_WANT_SYS_IPC
35#define __ARCH_WANT_SYS_PAUSE
36#define __ARCH_WANT_SYS_UTIME
37#define __ARCH_WANT_SYS_UTIME32
38#define __ARCH_WANT_SYS_WAITPID
39#define __ARCH_WANT_SYS_SOCKETCALL
40#define __ARCH_WANT_SYS_GETPGRP
41#define __ARCH_WANT_SYS_NICE
42#define __ARCH_WANT_SYS_OLD_UNAME
43#define __ARCH_WANT_SYS_OLDUMOUNT
44#define __ARCH_WANT_SYS_SIGPENDING
45#define __ARCH_WANT_SYS_SIGPROCMASK
46# ifdef CONFIG_32BIT
47# define __ARCH_WANT_STAT64
48# define __ARCH_WANT_SYS_TIME32
49# endif
50# ifdef CONFIG_MIPS32_O32
51# define __ARCH_WANT_SYS_TIME32
52# endif
53#define __ARCH_WANT_SYS_FORK
54#define __ARCH_WANT_SYS_CLONE
55#define __ARCH_WANT_SYS_CLONE3
56
57/* whitelists for checksyscalls */
58#define __IGNORE_fadvise64_64
59
60#endif /* !__ASSEMBLY__ */
61
62#endif /* _ASM_UNISTD_H */
diff --git a/arch/mips/include/asm/unroll.h b/arch/mips/include/asm/unroll.h
new file mode 100644
index 000000000..6f4ac854b
--- /dev/null
+++ b/arch/mips/include/asm/unroll.h
@@ -0,0 +1,75 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2#ifndef __ASM_UNROLL_H__
3#define __ASM_UNROLL_H__
4
5/*
6 * Explicitly unroll a loop, for use in cases where doing so is performance
7 * critical.
8 *
9 * Ideally we'd rely upon the compiler to provide this but there's no commonly
10 * available means to do so. For example GCC's "#pragma GCC unroll"
11 * functionality would be ideal but is only available from GCC 8 onwards. Using
12 * -funroll-loops is an option but GCC tends to make poor choices when
13 * compiling our string functions. -funroll-all-loops leads to massive code
14 * bloat, even if only applied to the string functions.
15 */
16#define unroll(times, fn, ...) do { \
17 extern void bad_unroll(void) \
18 __compiletime_error("Unsupported unroll"); \
19 \
20 /* \
21 * We can't unroll if the number of iterations isn't \
22 * compile-time constant. Unfortunately clang versions \
23 * up until 8.0 tend to miss obvious constants & cause \
24 * this check to fail, even though they go on to \
25 * generate reasonable code for the switch statement, \
26 * so we skip the sanity check for those compilers. \
27 */ \
28 BUILD_BUG_ON(!__builtin_constant_p(times)); \
29 \
30 switch (times) { \
31 case 32: fn(__VA_ARGS__); fallthrough; \
32 case 31: fn(__VA_ARGS__); fallthrough; \
33 case 30: fn(__VA_ARGS__); fallthrough; \
34 case 29: fn(__VA_ARGS__); fallthrough; \
35 case 28: fn(__VA_ARGS__); fallthrough; \
36 case 27: fn(__VA_ARGS__); fallthrough; \
37 case 26: fn(__VA_ARGS__); fallthrough; \
38 case 25: fn(__VA_ARGS__); fallthrough; \
39 case 24: fn(__VA_ARGS__); fallthrough; \
40 case 23: fn(__VA_ARGS__); fallthrough; \
41 case 22: fn(__VA_ARGS__); fallthrough; \
42 case 21: fn(__VA_ARGS__); fallthrough; \
43 case 20: fn(__VA_ARGS__); fallthrough; \
44 case 19: fn(__VA_ARGS__); fallthrough; \
45 case 18: fn(__VA_ARGS__); fallthrough; \
46 case 17: fn(__VA_ARGS__); fallthrough; \
47 case 16: fn(__VA_ARGS__); fallthrough; \
48 case 15: fn(__VA_ARGS__); fallthrough; \
49 case 14: fn(__VA_ARGS__); fallthrough; \
50 case 13: fn(__VA_ARGS__); fallthrough; \
51 case 12: fn(__VA_ARGS__); fallthrough; \
52 case 11: fn(__VA_ARGS__); fallthrough; \
53 case 10: fn(__VA_ARGS__); fallthrough; \
54 case 9: fn(__VA_ARGS__); fallthrough; \
55 case 8: fn(__VA_ARGS__); fallthrough; \
56 case 7: fn(__VA_ARGS__); fallthrough; \
57 case 6: fn(__VA_ARGS__); fallthrough; \
58 case 5: fn(__VA_ARGS__); fallthrough; \
59 case 4: fn(__VA_ARGS__); fallthrough; \
60 case 3: fn(__VA_ARGS__); fallthrough; \
61 case 2: fn(__VA_ARGS__); fallthrough; \
62 case 1: fn(__VA_ARGS__); fallthrough; \
63 case 0: break; \
64 \
65 default: \
66 /* \
67 * Either the iteration count is unreasonable \
68 * or we need to add more cases above. \
69 */ \
70 bad_unroll(); \
71 break; \
72 } \
73} while (0)
74
75#endif /* __ASM_UNROLL_H__ */
diff --git a/arch/mips/include/asm/uprobes.h b/arch/mips/include/asm/uprobes.h
new file mode 100644
index 000000000..b86d1ae07
--- /dev/null
+++ b/arch/mips/include/asm/uprobes.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#ifndef __ASM_UPROBES_H
7#define __ASM_UPROBES_H
8
9#include <linux/notifier.h>
10#include <linux/types.h>
11
12#include <asm/break.h>
13#include <asm/inst.h>
14
15/*
16 * We want this to be defined as union mips_instruction but that makes the
17 * generic code blow up.
18 */
19typedef u32 uprobe_opcode_t;
20
21/*
22 * Classic MIPS (note this implementation doesn't consider microMIPS yet)
23 * instructions are always 4 bytes but in order to deal with branches and
24 * their delay slots, we treat instructions as having 8 bytes maximum.
25 */
26#define MAX_UINSN_BYTES 8
27#define UPROBE_XOL_SLOT_BYTES 128 /* Max. cache line size */
28
29#define UPROBE_BRK_UPROBE 0x000d000d /* break 13 */
30#define UPROBE_BRK_UPROBE_XOL 0x000e000d /* break 14 */
31
32#define UPROBE_SWBP_INSN UPROBE_BRK_UPROBE
33#define UPROBE_SWBP_INSN_SIZE 4
34
35struct arch_uprobe {
36 unsigned long resume_epc;
37 u32 insn[2];
38 u32 ixol[2];
39};
40
41struct arch_uprobe_task {
42 unsigned long saved_trap_nr;
43};
44
45#endif /* __ASM_UPROBES_H */
diff --git a/arch/mips/include/asm/vdso.h b/arch/mips/include/asm/vdso.h
new file mode 100644
index 000000000..cc7b51612
--- /dev/null
+++ b/arch/mips/include/asm/vdso.h
@@ -0,0 +1,58 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2015 Imagination Technologies
4 * Author: Alex Smith <alex.smith@imgtec.com>
5 */
6
7#ifndef __ASM_VDSO_H
8#define __ASM_VDSO_H
9
10#include <linux/mm_types.h>
11#include <vdso/datapage.h>
12
13#include <asm/barrier.h>
14
15/**
16 * struct mips_vdso_image - Details of a VDSO image.
17 * @data: Pointer to VDSO image data (page-aligned).
18 * @size: Size of the VDSO image data (page-aligned).
19 * @off_sigreturn: Offset of the sigreturn() trampoline.
20 * @off_rt_sigreturn: Offset of the rt_sigreturn() trampoline.
21 * @mapping: Special mapping structure.
22 *
23 * This structure contains details of a VDSO image, including the image data
24 * and offsets of certain symbols required by the kernel. It is generated as
25 * part of the VDSO build process, aside from the mapping page array, which is
26 * populated at runtime.
27 */
28struct mips_vdso_image {
29 void *data;
30 unsigned long size;
31
32 unsigned long off_sigreturn;
33 unsigned long off_rt_sigreturn;
34
35 struct vm_special_mapping mapping;
36};
37
38/*
39 * The following structures are auto-generated as part of the build for each
40 * ABI by genvdso, see arch/mips/vdso/Makefile.
41 */
42
43extern struct mips_vdso_image vdso_image;
44
45#ifdef CONFIG_MIPS32_O32
46extern struct mips_vdso_image vdso_image_o32;
47#endif
48
49#ifdef CONFIG_MIPS32_N32
50extern struct mips_vdso_image vdso_image_n32;
51#endif
52
53union mips_vdso_data {
54 struct vdso_data data[CS_BASES];
55 u8 page[PAGE_SIZE];
56};
57
58#endif /* __ASM_VDSO_H */
diff --git a/arch/mips/include/asm/vdso/clocksource.h b/arch/mips/include/asm/vdso/clocksource.h
new file mode 100644
index 000000000..510e1671d
--- /dev/null
+++ b/arch/mips/include/asm/vdso/clocksource.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2#ifndef __ASM_VDSOCLOCKSOURCE_H
3#define __ASM_VDSOCLOCKSOURCE_H
4
5#define VDSO_ARCH_CLOCKMODES \
6 VDSO_CLOCKMODE_R4K, \
7 VDSO_CLOCKMODE_GIC
8
9#endif /* __ASM_VDSOCLOCKSOURCE_H */
diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h
new file mode 100644
index 000000000..44a45f3fa
--- /dev/null
+++ b/arch/mips/include/asm/vdso/gettimeofday.h
@@ -0,0 +1,219 @@
1/*
2 * Copyright (C) 2018 ARM Limited
3 * Copyright (C) 2015 Imagination Technologies
4 * Author: Alex Smith <alex.smith@imgtec.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11#ifndef __ASM_VDSO_GETTIMEOFDAY_H
12#define __ASM_VDSO_GETTIMEOFDAY_H
13
14#ifndef __ASSEMBLY__
15
16#include <asm/vdso/vdso.h>
17#include <asm/clocksource.h>
18#include <asm/unistd.h>
19#include <asm/vdso.h>
20
21#define VDSO_HAS_CLOCK_GETRES 1
22
23#if MIPS_ISA_REV < 6
24#define VDSO_SYSCALL_CLOBBERS "hi", "lo",
25#else
26#define VDSO_SYSCALL_CLOBBERS
27#endif
28
29static __always_inline long gettimeofday_fallback(
30 struct __kernel_old_timeval *_tv,
31 struct timezone *_tz)
32{
33 register struct timezone *tz asm("a1") = _tz;
34 register struct __kernel_old_timeval *tv asm("a0") = _tv;
35 register long ret asm("v0");
36 register long nr asm("v0") = __NR_gettimeofday;
37 register long error asm("a3");
38
39 asm volatile(
40 " syscall\n"
41 : "=r" (ret), "=r" (error)
42 : "r" (tv), "r" (tz), "r" (nr)
43 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
44 "$14", "$15", "$24", "$25",
45 VDSO_SYSCALL_CLOBBERS
46 "memory");
47
48 return error ? -ret : ret;
49}
50
51static __always_inline long clock_gettime_fallback(
52 clockid_t _clkid,
53 struct __kernel_timespec *_ts)
54{
55 register struct __kernel_timespec *ts asm("a1") = _ts;
56 register clockid_t clkid asm("a0") = _clkid;
57 register long ret asm("v0");
58#if _MIPS_SIM == _MIPS_SIM_ABI64
59 register long nr asm("v0") = __NR_clock_gettime;
60#else
61 register long nr asm("v0") = __NR_clock_gettime64;
62#endif
63 register long error asm("a3");
64
65 asm volatile(
66 " syscall\n"
67 : "=r" (ret), "=r" (error)
68 : "r" (clkid), "r" (ts), "r" (nr)
69 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
70 "$14", "$15", "$24", "$25",
71 VDSO_SYSCALL_CLOBBERS
72 "memory");
73
74 return error ? -ret : ret;
75}
76
77static __always_inline int clock_getres_fallback(
78 clockid_t _clkid,
79 struct __kernel_timespec *_ts)
80{
81 register struct __kernel_timespec *ts asm("a1") = _ts;
82 register clockid_t clkid asm("a0") = _clkid;
83 register long ret asm("v0");
84#if _MIPS_SIM == _MIPS_SIM_ABI64
85 register long nr asm("v0") = __NR_clock_getres;
86#else
87 register long nr asm("v0") = __NR_clock_getres_time64;
88#endif
89 register long error asm("a3");
90
91 asm volatile(
92 " syscall\n"
93 : "=r" (ret), "=r" (error)
94 : "r" (clkid), "r" (ts), "r" (nr)
95 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
96 "$14", "$15", "$24", "$25",
97 VDSO_SYSCALL_CLOBBERS
98 "memory");
99
100 return error ? -ret : ret;
101}
102
103#if _MIPS_SIM != _MIPS_SIM_ABI64
104
105static __always_inline long clock_gettime32_fallback(
106 clockid_t _clkid,
107 struct old_timespec32 *_ts)
108{
109 register struct old_timespec32 *ts asm("a1") = _ts;
110 register clockid_t clkid asm("a0") = _clkid;
111 register long ret asm("v0");
112 register long nr asm("v0") = __NR_clock_gettime;
113 register long error asm("a3");
114
115 asm volatile(
116 " syscall\n"
117 : "=r" (ret), "=r" (error)
118 : "r" (clkid), "r" (ts), "r" (nr)
119 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
120 "$14", "$15", "$24", "$25",
121 VDSO_SYSCALL_CLOBBERS
122 "memory");
123
124 return error ? -ret : ret;
125}
126
127static __always_inline int clock_getres32_fallback(
128 clockid_t _clkid,
129 struct old_timespec32 *_ts)
130{
131 register struct old_timespec32 *ts asm("a1") = _ts;
132 register clockid_t clkid asm("a0") = _clkid;
133 register long ret asm("v0");
134 register long nr asm("v0") = __NR_clock_getres;
135 register long error asm("a3");
136
137 asm volatile(
138 " syscall\n"
139 : "=r" (ret), "=r" (error)
140 : "r" (clkid), "r" (ts), "r" (nr)
141 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
142 "$14", "$15", "$24", "$25",
143 VDSO_SYSCALL_CLOBBERS
144 "memory");
145
146 return error ? -ret : ret;
147}
148#endif
149
150#ifdef CONFIG_CSRC_R4K
151
152static __always_inline u64 read_r4k_count(void)
153{
154 unsigned int count;
155
156 __asm__ __volatile__(
157 " .set push\n"
158 " .set mips32r2\n"
159 " rdhwr %0, $2\n"
160 " .set pop\n"
161 : "=r" (count));
162
163 return count;
164}
165
166#endif
167
168#ifdef CONFIG_CLKSRC_MIPS_GIC
169
170static __always_inline u64 read_gic_count(const struct vdso_data *data)
171{
172 void __iomem *gic = get_gic(data);
173 u32 hi, hi2, lo;
174
175 do {
176 hi = __raw_readl(gic + sizeof(lo));
177 lo = __raw_readl(gic);
178 hi2 = __raw_readl(gic + sizeof(lo));
179 } while (hi2 != hi);
180
181 return (((u64)hi) << 32) + lo;
182}
183
184#endif
185
186static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
187 const struct vdso_data *vd)
188{
189#ifdef CONFIG_CSRC_R4K
190 if (clock_mode == VDSO_CLOCKMODE_R4K)
191 return read_r4k_count();
192#endif
193#ifdef CONFIG_CLKSRC_MIPS_GIC
194 if (clock_mode == VDSO_CLOCKMODE_GIC)
195 return read_gic_count(vd);
196#endif
197 /*
198 * Core checks mode already. So this raced against a concurrent
199 * update. Return something. Core will do another round see the
200 * change and fallback to syscall.
201 */
202 return 0;
203}
204
205static inline bool mips_vdso_hres_capable(void)
206{
207 return IS_ENABLED(CONFIG_CSRC_R4K) ||
208 IS_ENABLED(CONFIG_CLKSRC_MIPS_GIC);
209}
210#define __arch_vdso_hres_capable mips_vdso_hres_capable
211
212static __always_inline const struct vdso_data *__arch_get_vdso_data(void)
213{
214 return get_vdso_data();
215}
216
217#endif /* !__ASSEMBLY__ */
218
219#endif /* __ASM_VDSO_GETTIMEOFDAY_H */
diff --git a/arch/mips/include/asm/vdso/processor.h b/arch/mips/include/asm/vdso/processor.h
new file mode 100644
index 000000000..511c95d73
--- /dev/null
+++ b/arch/mips/include/asm/vdso/processor.h
@@ -0,0 +1,27 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2020 ARM Ltd.
4 */
5#ifndef __ASM_VDSO_PROCESSOR_H
6#define __ASM_VDSO_PROCESSOR_H
7
8#ifndef __ASSEMBLY__
9
10#ifdef CONFIG_CPU_LOONGSON64
11/*
12 * Loongson-3's SFB (Store-Fill-Buffer) may buffer writes indefinitely when a
13 * tight read loop is executed, because reads take priority over writes & the
14 * hardware (incorrectly) doesn't ensure that writes will eventually occur.
15 *
16 * Since spin loops of any kind should have a cpu_relax() in them, force an SFB
17 * flush from cpu_relax() such that any pending writes will become visible as
18 * expected.
19 */
20#define cpu_relax() smp_mb()
21#else
22#define cpu_relax() barrier()
23#endif
24
25#endif /* __ASSEMBLY__ */
26
27#endif /* __ASM_VDSO_PROCESSOR_H */
diff --git a/arch/mips/include/asm/vdso/vdso.h b/arch/mips/include/asm/vdso/vdso.h
new file mode 100644
index 000000000..a327ca212
--- /dev/null
+++ b/arch/mips/include/asm/vdso/vdso.h
@@ -0,0 +1,75 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2015 Imagination Technologies
4 * Author: Alex Smith <alex.smith@imgtec.com>
5 */
6
7#include <asm/sgidefs.h>
8
9#ifndef __ASSEMBLY__
10
11#include <asm/asm.h>
12#include <asm/page.h>
13#include <asm/vdso.h>
14
15static inline unsigned long get_vdso_base(void)
16{
17 unsigned long addr;
18
19 /*
20 * We can't use cpu_has_mips_r6 since it needs the cpu_data[]
21 * kernel symbol.
22 */
23#ifdef CONFIG_CPU_MIPSR6
24 /*
25 * lapc <symbol> is an alias to addiupc reg, <symbol> - .
26 *
27 * We can't use addiupc because there is no label-label
28 * support for the addiupc reloc
29 */
30 __asm__("lapc %0, _start \n"
31 : "=r" (addr) : :);
32#else
33 /*
34 * Get the base load address of the VDSO. We have to avoid generating
35 * relocations and references to the GOT because ld.so does not peform
36 * relocations on the VDSO. We use the current offset from the VDSO base
37 * and perform a PC-relative branch which gives the absolute address in
38 * ra, and take the difference. The assembler chokes on
39 * "li %0, _start - .", so embed the offset as a word and branch over
40 * it.
41 *
42 */
43
44 __asm__(
45 " .set push \n"
46 " .set noreorder \n"
47 " bal 1f \n"
48 " nop \n"
49 " .word _start - . \n"
50 "1: lw %0, 0($31) \n"
51 " " STR(PTR_ADDU) " %0, $31, %0 \n"
52 " .set pop \n"
53 : "=r" (addr)
54 :
55 : "$31");
56#endif /* CONFIG_CPU_MIPSR6 */
57
58 return addr;
59}
60
61static inline const struct vdso_data *get_vdso_data(void)
62{
63 return (const struct vdso_data *)(get_vdso_base() - PAGE_SIZE);
64}
65
66#ifdef CONFIG_CLKSRC_MIPS_GIC
67
68static inline void __iomem *get_gic(const struct vdso_data *data)
69{
70 return (void __iomem *)((unsigned long)data & PAGE_MASK) - PAGE_SIZE;
71}
72
73#endif /* CONFIG_CLKSRC_MIPS_GIC */
74
75#endif /* __ASSEMBLY__ */
diff --git a/arch/mips/include/asm/vdso/vsyscall.h b/arch/mips/include/asm/vdso/vsyscall.h
new file mode 100644
index 000000000..47168aaf1
--- /dev/null
+++ b/arch/mips/include/asm/vdso/vsyscall.h
@@ -0,0 +1,27 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ASM_VDSO_VSYSCALL_H
3#define __ASM_VDSO_VSYSCALL_H
4
5#ifndef __ASSEMBLY__
6
7#include <linux/timekeeper_internal.h>
8#include <vdso/datapage.h>
9
10extern struct vdso_data *vdso_data;
11
12/*
13 * Update the vDSO data page to keep in sync with kernel timekeeping.
14 */
15static __always_inline
16struct vdso_data *__mips_get_k_vdso_data(void)
17{
18 return vdso_data;
19}
20#define __arch_get_k_vdso_data __mips_get_k_vdso_data
21
22/* The asm-generic header needs to be included after the definitions above */
23#include <asm-generic/vdso/vsyscall.h>
24
25#endif /* !__ASSEMBLY__ */
26
27#endif /* __ASM_VDSO_VSYSCALL_H */
diff --git a/arch/mips/include/asm/vermagic.h b/arch/mips/include/asm/vermagic.h
new file mode 100644
index 000000000..4d2dae0c7
--- /dev/null
+++ b/arch/mips/include/asm/vermagic.h
@@ -0,0 +1,72 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_VERMAGIC_H
3#define _ASM_VERMAGIC_H
4
5#ifdef CONFIG_CPU_BMIPS
6#define MODULE_PROC_FAMILY "BMIPS "
7#elif defined CONFIG_CPU_MIPS32_R1
8#define MODULE_PROC_FAMILY "MIPS32_R1 "
9#elif defined CONFIG_CPU_MIPS32_R2
10#define MODULE_PROC_FAMILY "MIPS32_R2 "
11#elif defined CONFIG_CPU_MIPS32_R5
12#define MODULE_PROC_FAMILY "MIPS32_R5 "
13#elif defined CONFIG_CPU_MIPS32_R6
14#define MODULE_PROC_FAMILY "MIPS32_R6 "
15#elif defined CONFIG_CPU_MIPS64_R1
16#define MODULE_PROC_FAMILY "MIPS64_R1 "
17#elif defined CONFIG_CPU_MIPS64_R2
18#define MODULE_PROC_FAMILY "MIPS64_R2 "
19#elif defined CONFIG_CPU_MIPS64_R5
20#define MODULE_PROC_FAMILY "MIPS64_R5 "
21#elif defined CONFIG_CPU_MIPS64_R6
22#define MODULE_PROC_FAMILY "MIPS64_R6 "
23#elif defined CONFIG_CPU_R3000
24#define MODULE_PROC_FAMILY "R3000 "
25#elif defined CONFIG_CPU_TX39XX
26#define MODULE_PROC_FAMILY "TX39XX "
27#elif defined CONFIG_CPU_VR41XX
28#define MODULE_PROC_FAMILY "VR41XX "
29#elif defined CONFIG_CPU_R4X00
30#define MODULE_PROC_FAMILY "R4X00 "
31#elif defined CONFIG_CPU_TX49XX
32#define MODULE_PROC_FAMILY "TX49XX "
33#elif defined CONFIG_CPU_R5000
34#define MODULE_PROC_FAMILY "R5000 "
35#elif defined CONFIG_CPU_R5500
36#define MODULE_PROC_FAMILY "R5500 "
37#elif defined CONFIG_CPU_NEVADA
38#define MODULE_PROC_FAMILY "NEVADA "
39#elif defined CONFIG_CPU_R10000
40#define MODULE_PROC_FAMILY "R10000 "
41#elif defined CONFIG_CPU_RM7000
42#define MODULE_PROC_FAMILY "RM7000 "
43#elif defined CONFIG_CPU_SB1
44#define MODULE_PROC_FAMILY "SB1 "
45#elif defined CONFIG_CPU_LOONGSON32
46#define MODULE_PROC_FAMILY "LOONGSON32 "
47#elif defined CONFIG_CPU_LOONGSON2EF
48#define MODULE_PROC_FAMILY "LOONGSON2EF "
49#elif defined CONFIG_CPU_LOONGSON64
50#define MODULE_PROC_FAMILY "LOONGSON64 "
51#elif defined CONFIG_CPU_CAVIUM_OCTEON
52#define MODULE_PROC_FAMILY "OCTEON "
53#elif defined CONFIG_CPU_P5600
54#define MODULE_PROC_FAMILY "P5600 "
55#elif defined CONFIG_CPU_XLR
56#define MODULE_PROC_FAMILY "XLR "
57#elif defined CONFIG_CPU_XLP
58#define MODULE_PROC_FAMILY "XLP "
59#else
60#error MODULE_PROC_FAMILY undefined for your processor configuration
61#endif
62
63#ifdef CONFIG_32BIT
64#define MODULE_KERNEL_TYPE "32BIT "
65#elif defined CONFIG_64BIT
66#define MODULE_KERNEL_TYPE "64BIT "
67#endif
68
69#define MODULE_ARCH_VERMAGIC \
70 MODULE_PROC_FAMILY MODULE_KERNEL_TYPE
71
72#endif /* _ASM_VERMAGIC_H */
diff --git a/arch/mips/include/asm/vga.h b/arch/mips/include/asm/vga.h
new file mode 100644
index 000000000..0136e0366
--- /dev/null
+++ b/arch/mips/include/asm/vga.h
@@ -0,0 +1,56 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Access to VGA videoram
4 *
5 * (c) 1998 Martin Mares <mj@ucw.cz>
6 */
7#ifndef _ASM_VGA_H
8#define _ASM_VGA_H
9
10#include <linux/string.h>
11#include <asm/addrspace.h>
12#include <asm/byteorder.h>
13
14/*
15 * On the PC, we can just recalculate addresses and then
16 * access the videoram directly without any black magic.
17 */
18
19#define VGA_MAP_MEM(x, s) CKSEG1ADDR(0x10000000L + (unsigned long)(x))
20
21#define vga_readb(x) (*(x))
22#define vga_writeb(x, y) (*(y) = (x))
23
24#define VT_BUF_HAVE_RW
25/*
26 * These are only needed for supporting VGA or MDA text mode, which use little
27 * endian byte ordering.
28 * In other cases, we can optimize by using native byte ordering and
29 * <linux/vt_buffer.h> has already done the right job for us.
30 */
31
32#undef scr_writew
33#undef scr_readw
34
35static inline void scr_writew(u16 val, volatile u16 *addr)
36{
37 *addr = cpu_to_le16(val);
38}
39
40static inline u16 scr_readw(volatile const u16 *addr)
41{
42 return le16_to_cpu(*addr);
43}
44
45static inline void scr_memsetw(u16 *s, u16 v, unsigned int count)
46{
47 memset16(s, cpu_to_le16(v), count / 2);
48}
49
50#define scr_memcpyw(d, s, c) memcpy(d, s, c)
51#define scr_memmovew(d, s, c) memmove(d, s, c)
52#define VT_BUF_HAVE_MEMCPYW
53#define VT_BUF_HAVE_MEMMOVEW
54#define VT_BUF_HAVE_MEMSETW
55
56#endif /* _ASM_VGA_H */
diff --git a/arch/mips/include/asm/vmalloc.h b/arch/mips/include/asm/vmalloc.h
new file mode 100644
index 000000000..25dc09b25
--- /dev/null
+++ b/arch/mips/include/asm/vmalloc.h
@@ -0,0 +1,4 @@
1#ifndef _ASM_MIPS_VMALLOC_H
2#define _ASM_MIPS_VMALLOC_H
3
4#endif /* _ASM_MIPS_VMALLOC_H */
diff --git a/arch/mips/include/asm/vpe.h b/arch/mips/include/asm/vpe.h
new file mode 100644
index 000000000..80e70dbd1
--- /dev/null
+++ b/arch/mips/include/asm/vpe.h
@@ -0,0 +1,130 @@
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 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
8 */
9#ifndef _ASM_VPE_H
10#define _ASM_VPE_H
11
12#include <linux/init.h>
13#include <linux/list.h>
14#include <linux/smp.h>
15#include <linux/spinlock.h>
16
17#define VPE_MODULE_NAME "vpe"
18#define VPE_MODULE_MINOR 1
19
20/* grab the likely amount of memory we will need. */
21#ifdef CONFIG_MIPS_VPE_LOADER_TOM
22#define P_SIZE (2 * 1024 * 1024)
23#else
24/* add an overhead to the max kmalloc size for non-striped symbols/etc */
25#define P_SIZE (256 * 1024)
26#endif
27
28#define MAX_VPES 16
29#define VPE_PATH_MAX 256
30
31static inline int aprp_cpu_index(void)
32{
33#ifdef CONFIG_MIPS_CMP
34 return setup_max_cpus;
35#else
36 extern int tclimit;
37 return tclimit;
38#endif
39}
40
41enum vpe_state {
42 VPE_STATE_UNUSED = 0,
43 VPE_STATE_INUSE,
44 VPE_STATE_RUNNING
45};
46
47enum tc_state {
48 TC_STATE_UNUSED = 0,
49 TC_STATE_INUSE,
50 TC_STATE_RUNNING,
51 TC_STATE_DYNAMIC
52};
53
54struct vpe {
55 enum vpe_state state;
56
57 /* (device) minor associated with this vpe */
58 int minor;
59
60 /* elfloader stuff */
61 void *load_addr;
62 unsigned long len;
63 char *pbuffer;
64 unsigned long plen;
65 char cwd[VPE_PATH_MAX];
66
67 unsigned long __start;
68
69 /* tc's associated with this vpe */
70 struct list_head tc;
71
72 /* The list of vpe's */
73 struct list_head list;
74
75 /* shared symbol address */
76 void *shared_ptr;
77
78 /* the list of who wants to know when something major happens */
79 struct list_head notify;
80
81 unsigned int ntcs;
82};
83
84struct tc {
85 enum tc_state state;
86 int index;
87
88 struct vpe *pvpe; /* parent VPE */
89 struct list_head tc; /* The list of TC's with this VPE */
90 struct list_head list; /* The global list of tc's */
91};
92
93struct vpe_notifications {
94 void (*start)(int vpe);
95 void (*stop)(int vpe);
96
97 struct list_head list;
98};
99
100struct vpe_control {
101 spinlock_t vpe_list_lock;
102 struct list_head vpe_list; /* Virtual processing elements */
103 spinlock_t tc_list_lock;
104 struct list_head tc_list; /* Thread contexts */
105};
106
107extern unsigned long physical_memsize;
108extern struct vpe_control vpecontrol;
109extern const struct file_operations vpe_fops;
110
111int vpe_notify(int index, struct vpe_notifications *notify);
112
113void *vpe_get_shared(int index);
114char *vpe_getcwd(int index);
115
116struct vpe *get_vpe(int minor);
117struct tc *get_tc(int index);
118struct vpe *alloc_vpe(int minor);
119struct tc *alloc_tc(int index);
120void release_vpe(struct vpe *v);
121
122void *alloc_progmem(unsigned long len);
123void release_progmem(void *ptr);
124
125int vpe_run(struct vpe *v);
126void cleanup_tc(struct tc *tc);
127
128int __init vpe_module_init(void);
129void __exit vpe_module_exit(void);
130#endif /* _ASM_VPE_H */
diff --git a/arch/mips/include/asm/vr41xx/capcella.h b/arch/mips/include/asm/vr41xx/capcella.h
new file mode 100644
index 000000000..d45a33969
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/capcella.h
@@ -0,0 +1,30 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * capcella.h, Include file for ZAO Networks Capcella.
4 *
5 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@linux-mips.org>
6 */
7#ifndef __ZAO_CAPCELLA_H
8#define __ZAO_CAPCELLA_H
9
10#include <asm/vr41xx/irq.h>
11
12/*
13 * General-Purpose I/O Pin Number
14 */
15#define PC104PLUS_INTA_PIN 2
16#define PC104PLUS_INTB_PIN 3
17#define PC104PLUS_INTC_PIN 4
18#define PC104PLUS_INTD_PIN 5
19
20/*
21 * Interrupt Number
22 */
23#define RTL8139_1_IRQ GIU_IRQ(PC104PLUS_INTC_PIN)
24#define RTL8139_2_IRQ GIU_IRQ(PC104PLUS_INTD_PIN)
25#define PC104PLUS_INTA_IRQ GIU_IRQ(PC104PLUS_INTA_PIN)
26#define PC104PLUS_INTB_IRQ GIU_IRQ(PC104PLUS_INTB_PIN)
27#define PC104PLUS_INTC_IRQ GIU_IRQ(PC104PLUS_INTC_PIN)
28#define PC104PLUS_INTD_IRQ GIU_IRQ(PC104PLUS_INTD_PIN)
29
30#endif /* __ZAO_CAPCELLA_H */
diff --git a/arch/mips/include/asm/vr41xx/giu.h b/arch/mips/include/asm/vr41xx/giu.h
new file mode 100644
index 000000000..0211fa898
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/giu.h
@@ -0,0 +1,41 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Include file for NEC VR4100 series General-purpose I/O Unit.
4 *
5 * Copyright (C) 2005-2009 Yoichi Yuasa <yuasa@linux-mips.org>
6 */
7#ifndef __NEC_VR41XX_GIU_H
8#define __NEC_VR41XX_GIU_H
9
10/*
11 * NEC VR4100 series GIU platform device IDs.
12 */
13enum {
14 GPIO_50PINS_PULLUPDOWN,
15 GPIO_36PINS,
16 GPIO_48PINS_EDGE_SELECT,
17};
18
19typedef enum {
20 IRQ_TRIGGER_LEVEL,
21 IRQ_TRIGGER_EDGE,
22 IRQ_TRIGGER_EDGE_FALLING,
23 IRQ_TRIGGER_EDGE_RISING,
24} irq_trigger_t;
25
26typedef enum {
27 IRQ_SIGNAL_THROUGH,
28 IRQ_SIGNAL_HOLD,
29} irq_signal_t;
30
31extern void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger,
32 irq_signal_t signal);
33
34typedef enum {
35 IRQ_LEVEL_LOW,
36 IRQ_LEVEL_HIGH,
37} irq_level_t;
38
39extern void vr41xx_set_irq_level(unsigned int pin, irq_level_t level);
40
41#endif /* __NEC_VR41XX_GIU_H */
diff --git a/arch/mips/include/asm/vr41xx/irq.h b/arch/mips/include/asm/vr41xx/irq.h
new file mode 100644
index 000000000..2f3d552f9
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/irq.h
@@ -0,0 +1,97 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/vr41xx/irq.h
4 *
5 * Interrupt numbers for NEC VR4100 series.
6 *
7 * Copyright (C) 1999 Michael Klar
8 * Copyright (C) 2001, 2002 Paul Mundt
9 * Copyright (C) 2002 MontaVista Software, Inc.
10 * Copyright (C) 2002 TimeSys Corp.
11 * Copyright (C) 2003-2006 Yoichi Yuasa <yuasa@linux-mips.org>
12 */
13#ifndef __NEC_VR41XX_IRQ_H
14#define __NEC_VR41XX_IRQ_H
15
16/*
17 * CPU core Interrupt Numbers
18 */
19#define MIPS_CPU_IRQ_BASE 0
20#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
21#define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0)
22#define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1)
23#define INT0_IRQ MIPS_CPU_IRQ(2)
24#define INT1_IRQ MIPS_CPU_IRQ(3)
25#define INT2_IRQ MIPS_CPU_IRQ(4)
26#define INT3_IRQ MIPS_CPU_IRQ(5)
27#define INT4_IRQ MIPS_CPU_IRQ(6)
28#define TIMER_IRQ MIPS_CPU_IRQ(7)
29
30/*
31 * SYINT1 Interrupt Numbers
32 */
33#define SYSINT1_IRQ_BASE 8
34#define SYSINT1_IRQ(x) (SYSINT1_IRQ_BASE + (x))
35#define BATTRY_IRQ SYSINT1_IRQ(0)
36#define POWER_IRQ SYSINT1_IRQ(1)
37#define RTCLONG1_IRQ SYSINT1_IRQ(2)
38#define ELAPSEDTIME_IRQ SYSINT1_IRQ(3)
39/* RFU */
40#define PIU_IRQ SYSINT1_IRQ(5)
41#define AIU_IRQ SYSINT1_IRQ(6)
42#define KIU_IRQ SYSINT1_IRQ(7)
43#define GIUINT_IRQ SYSINT1_IRQ(8)
44#define SIU_IRQ SYSINT1_IRQ(9)
45#define BUSERR_IRQ SYSINT1_IRQ(10)
46#define SOFTINT_IRQ SYSINT1_IRQ(11)
47#define CLKRUN_IRQ SYSINT1_IRQ(12)
48#define DOZEPIU_IRQ SYSINT1_IRQ(13)
49#define SYSINT1_IRQ_LAST DOZEPIU_IRQ
50
51/*
52 * SYSINT2 Interrupt Numbers
53 */
54#define SYSINT2_IRQ_BASE 24
55#define SYSINT2_IRQ(x) (SYSINT2_IRQ_BASE + (x))
56#define RTCLONG2_IRQ SYSINT2_IRQ(0)
57#define LED_IRQ SYSINT2_IRQ(1)
58#define HSP_IRQ SYSINT2_IRQ(2)
59#define TCLOCK_IRQ SYSINT2_IRQ(3)
60#define FIR_IRQ SYSINT2_IRQ(4)
61#define CEU_IRQ SYSINT2_IRQ(4) /* same number as FIR_IRQ */
62#define DSIU_IRQ SYSINT2_IRQ(5)
63#define PCI_IRQ SYSINT2_IRQ(6)
64#define SCU_IRQ SYSINT2_IRQ(7)
65#define CSI_IRQ SYSINT2_IRQ(8)
66#define BCU_IRQ SYSINT2_IRQ(9)
67#define ETHERNET_IRQ SYSINT2_IRQ(10)
68#define SYSINT2_IRQ_LAST ETHERNET_IRQ
69
70/*
71 * GIU Interrupt Numbers
72 */
73#define GIU_IRQ_BASE 40
74#define GIU_IRQ(x) (GIU_IRQ_BASE + (x)) /* IRQ 40-71 */
75#define GIU_IRQ_LAST GIU_IRQ(31)
76
77/*
78 * VRC4173 Interrupt Numbers
79 */
80#define VRC4173_IRQ_BASE 72
81#define VRC4173_IRQ(x) (VRC4173_IRQ_BASE + (x))
82#define VRC4173_USB_IRQ VRC4173_IRQ(0)
83#define VRC4173_PCMCIA2_IRQ VRC4173_IRQ(1)
84#define VRC4173_PCMCIA1_IRQ VRC4173_IRQ(2)
85#define VRC4173_PS2CH2_IRQ VRC4173_IRQ(3)
86#define VRC4173_PS2CH1_IRQ VRC4173_IRQ(4)
87#define VRC4173_PIU_IRQ VRC4173_IRQ(5)
88#define VRC4173_AIU_IRQ VRC4173_IRQ(6)
89#define VRC4173_KIU_IRQ VRC4173_IRQ(7)
90#define VRC4173_GIU_IRQ VRC4173_IRQ(8)
91#define VRC4173_AC97_IRQ VRC4173_IRQ(9)
92#define VRC4173_AC97INT1_IRQ VRC4173_IRQ(10)
93/* RFU */
94#define VRC4173_DOZEPIU_IRQ VRC4173_IRQ(13)
95#define VRC4173_IRQ_LAST VRC4173_DOZEPIU_IRQ
96
97#endif /* __NEC_VR41XX_IRQ_H */
diff --git a/arch/mips/include/asm/vr41xx/mpc30x.h b/arch/mips/include/asm/vr41xx/mpc30x.h
new file mode 100644
index 000000000..9f977e18d
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/mpc30x.h
@@ -0,0 +1,24 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * mpc30x.h, Include file for Victor MP-C303/304.
4 *
5 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@linux-mips.org>
6 */
7#ifndef __VICTOR_MPC30X_H
8#define __VICTOR_MPC30X_H
9
10#include <asm/vr41xx/irq.h>
11
12/*
13 * General-Purpose I/O Pin Number
14 */
15#define VRC4173_PIN 1
16#define MQ200_PIN 4
17
18/*
19 * Interrupt Number
20 */
21#define VRC4173_CASCADE_IRQ GIU_IRQ(VRC4173_PIN)
22#define MQ200_IRQ GIU_IRQ(MQ200_PIN)
23
24#endif /* __VICTOR_MPC30X_H */
diff --git a/arch/mips/include/asm/vr41xx/pci.h b/arch/mips/include/asm/vr41xx/pci.h
new file mode 100644
index 000000000..ad93b5e89
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/pci.h
@@ -0,0 +1,77 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Include file for NEC VR4100 series PCI Control Unit.
4 *
5 * Copyright (C) 2004-2005 Yoichi Yuasa <yuasa@linux-mips.org>
6 */
7#ifndef __NEC_VR41XX_PCI_H
8#define __NEC_VR41XX_PCI_H
9
10#define PCI_MASTER_ADDRESS_MASK 0x7fffffffU
11
12struct pci_master_address_conversion {
13 uint32_t bus_base_address;
14 uint32_t address_mask;
15 uint32_t pci_base_address;
16};
17
18struct pci_target_address_conversion {
19 uint32_t address_mask;
20 uint32_t bus_base_address;
21};
22
23typedef enum {
24 CANNOT_LOCK_FROM_DEVICE,
25 CAN_LOCK_FROM_DEVICE,
26} pci_exclusive_access_t;
27
28struct pci_mailbox_address {
29 uint32_t base_address;
30};
31
32struct pci_target_address_window {
33 uint32_t base_address;
34};
35
36typedef enum {
37 PCI_ARBITRATION_MODE_FAIR,
38 PCI_ARBITRATION_MODE_ALTERNATE_0,
39 PCI_ARBITRATION_MODE_ALTERNATE_B,
40} pci_arbiter_priority_control_t;
41
42typedef enum {
43 PCI_TAKE_AWAY_GNT_DISABLE,
44 PCI_TAKE_AWAY_GNT_ENABLE,
45} pci_take_away_gnt_mode_t;
46
47struct pci_controller_unit_setup {
48 struct pci_master_address_conversion *master_memory1;
49 struct pci_master_address_conversion *master_memory2;
50
51 struct pci_target_address_conversion *target_memory1;
52 struct pci_target_address_conversion *target_memory2;
53
54 struct pci_master_address_conversion *master_io;
55
56 pci_exclusive_access_t exclusive_access;
57
58 uint32_t pci_clock_max;
59 uint8_t wait_time_limit_from_irdy_to_trdy; /* Only VR4122 is supported */
60
61 struct pci_mailbox_address *mailbox;
62 struct pci_target_address_window *target_window1;
63 struct pci_target_address_window *target_window2;
64
65 uint8_t master_latency_timer;
66 uint8_t retry_limit;
67
68 pci_arbiter_priority_control_t arbiter_priority_control;
69 pci_take_away_gnt_mode_t take_away_gnt_mode;
70
71 struct resource *mem_resource;
72 struct resource *io_resource;
73};
74
75extern void vr41xx_pciu_setup(struct pci_controller_unit_setup *setup);
76
77#endif /* __NEC_VR41XX_PCI_H */
diff --git a/arch/mips/include/asm/vr41xx/siu.h b/arch/mips/include/asm/vr41xx/siu.h
new file mode 100644
index 000000000..e920cd2cf
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/siu.h
@@ -0,0 +1,45 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Include file for NEC VR4100 series Serial Interface Unit.
4 *
5 * Copyright (C) 2005-2008 Yoichi Yuasa <yuasa@linux-mips.org>
6 */
7#ifndef __NEC_VR41XX_SIU_H
8#define __NEC_VR41XX_SIU_H
9
10#define SIU_PORTS_MAX 2
11
12typedef enum {
13 SIU_INTERFACE_RS232C,
14 SIU_INTERFACE_IRDA,
15} siu_interface_t;
16
17extern void vr41xx_select_siu_interface(siu_interface_t interface);
18
19typedef enum {
20 SIU_USE_IRDA,
21 FIR_USE_IRDA,
22} irda_use_t;
23
24extern void vr41xx_use_irda(irda_use_t use);
25
26typedef enum {
27 SHARP_IRDA,
28 TEMIC_IRDA,
29 HP_IRDA,
30} irda_module_t;
31
32typedef enum {
33 IRDA_TX_1_5MBPS,
34 IRDA_TX_4MBPS,
35} irda_speed_t;
36
37extern void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed);
38
39#ifdef CONFIG_SERIAL_VR41XX_CONSOLE
40extern void vr41xx_siu_early_setup(struct uart_port *port);
41#else
42static inline void vr41xx_siu_early_setup(struct uart_port *port) {}
43#endif
44
45#endif /* __NEC_VR41XX_SIU_H */
diff --git a/arch/mips/include/asm/vr41xx/tb0219.h b/arch/mips/include/asm/vr41xx/tb0219.h
new file mode 100644
index 000000000..01e96d6c2
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/tb0219.h
@@ -0,0 +1,29 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * tb0219.h, Include file for TANBAC TB0219.
4 *
5 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@linux-mips.org>
6 *
7 * Modified for TANBAC TB0219:
8 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp>
9 */
10#ifndef __TANBAC_TB0219_H
11#define __TANBAC_TB0219_H
12
13#include <asm/vr41xx/irq.h>
14
15/*
16 * General-Purpose I/O Pin Number
17 */
18#define TB0219_PCI_SLOT1_PIN 2
19#define TB0219_PCI_SLOT2_PIN 3
20#define TB0219_PCI_SLOT3_PIN 4
21
22/*
23 * Interrupt Number
24 */
25#define TB0219_PCI_SLOT1_IRQ GIU_IRQ(TB0219_PCI_SLOT1_PIN)
26#define TB0219_PCI_SLOT2_IRQ GIU_IRQ(TB0219_PCI_SLOT2_PIN)
27#define TB0219_PCI_SLOT3_IRQ GIU_IRQ(TB0219_PCI_SLOT3_PIN)
28
29#endif /* __TANBAC_TB0219_H */
diff --git a/arch/mips/include/asm/vr41xx/tb0226.h b/arch/mips/include/asm/vr41xx/tb0226.h
new file mode 100644
index 000000000..64993d149
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/tb0226.h
@@ -0,0 +1,30 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * tb0226.h, Include file for TANBAC TB0226.
4 *
5 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@linux-mips.org>
6 */
7#ifndef __TANBAC_TB0226_H
8#define __TANBAC_TB0226_H
9
10#include <asm/vr41xx/irq.h>
11
12/*
13 * General-Purpose I/O Pin Number
14 */
15#define GD82559_1_PIN 2
16#define GD82559_2_PIN 3
17#define UPD720100_INTA_PIN 4
18#define UPD720100_INTB_PIN 8
19#define UPD720100_INTC_PIN 13
20
21/*
22 * Interrupt Number
23 */
24#define GD82559_1_IRQ GIU_IRQ(GD82559_1_PIN)
25#define GD82559_2_IRQ GIU_IRQ(GD82559_2_PIN)
26#define UPD720100_INTA_IRQ GIU_IRQ(UPD720100_INTA_PIN)
27#define UPD720100_INTB_IRQ GIU_IRQ(UPD720100_INTB_PIN)
28#define UPD720100_INTC_IRQ GIU_IRQ(UPD720100_INTC_PIN)
29
30#endif /* __TANBAC_TB0226_H */
diff --git a/arch/mips/include/asm/vr41xx/tb0287.h b/arch/mips/include/asm/vr41xx/tb0287.h
new file mode 100644
index 000000000..3ddc91386
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/tb0287.h
@@ -0,0 +1,30 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * tb0287.h, Include file for TANBAC TB0287 mini-ITX board.
4 *
5 * Copyright (C) 2005 Media Lab Inc. <ito@mlb.co.jp>
6 *
7 * This code is largely based on tb0219.h.
8 */
9#ifndef __TANBAC_TB0287_H
10#define __TANBAC_TB0287_H
11
12#include <asm/vr41xx/irq.h>
13
14/*
15 * General-Purpose I/O Pin Number
16 */
17#define TB0287_PCI_SLOT_PIN 2
18#define TB0287_SM501_PIN 3
19#define TB0287_SIL680A_PIN 8
20#define TB0287_RTL8110_PIN 13
21
22/*
23 * Interrupt Number
24 */
25#define TB0287_PCI_SLOT_IRQ GIU_IRQ(TB0287_PCI_SLOT_PIN)
26#define TB0287_SM501_IRQ GIU_IRQ(TB0287_SM501_PIN)
27#define TB0287_SIL680A_IRQ GIU_IRQ(TB0287_SIL680A_PIN)
28#define TB0287_RTL8110_IRQ GIU_IRQ(TB0287_RTL8110_PIN)
29
30#endif /* __TANBAC_TB0287_H */
diff --git a/arch/mips/include/asm/vr41xx/vr41xx.h b/arch/mips/include/asm/vr41xx/vr41xx.h
new file mode 100644
index 000000000..9a4b36b75
--- /dev/null
+++ b/arch/mips/include/asm/vr41xx/vr41xx.h
@@ -0,0 +1,148 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * include/asm-mips/vr41xx/vr41xx.h
4 *
5 * Include file for NEC VR4100 series.
6 *
7 * Copyright (C) 1999 Michael Klar
8 * Copyright (C) 2001, 2002 Paul Mundt
9 * Copyright (C) 2002 MontaVista Software, Inc.
10 * Copyright (C) 2002 TimeSys Corp.
11 * Copyright (C) 2003-2008 Yoichi Yuasa <yuasa@linux-mips.org>
12 */
13#ifndef __NEC_VR41XX_H
14#define __NEC_VR41XX_H
15
16#include <linux/interrupt.h>
17
18/*
19 * CPU Revision
20 */
21/* VR4122 0x00000c70-0x00000c72 */
22#define PRID_VR4122_REV1_0 0x00000c70
23#define PRID_VR4122_REV2_0 0x00000c70
24#define PRID_VR4122_REV2_1 0x00000c70
25#define PRID_VR4122_REV3_0 0x00000c71
26#define PRID_VR4122_REV3_1 0x00000c72
27
28/* VR4181A 0x00000c73-0x00000c7f */
29#define PRID_VR4181A_REV1_0 0x00000c73
30#define PRID_VR4181A_REV1_1 0x00000c74
31
32/* VR4131 0x00000c80-0x00000c83 */
33#define PRID_VR4131_REV1_2 0x00000c80
34#define PRID_VR4131_REV2_0 0x00000c81
35#define PRID_VR4131_REV2_1 0x00000c82
36#define PRID_VR4131_REV2_2 0x00000c83
37
38/* VR4133 0x00000c84- */
39#define PRID_VR4133 0x00000c84
40
41/*
42 * Bus Control Uint
43 */
44extern unsigned long vr41xx_calculate_clock_frequency(void);
45extern unsigned long vr41xx_get_vtclock_frequency(void);
46extern unsigned long vr41xx_get_tclock_frequency(void);
47
48/*
49 * Clock Mask Unit
50 */
51typedef enum {
52 PIU_CLOCK,
53 SIU_CLOCK,
54 AIU_CLOCK,
55 KIU_CLOCK,
56 FIR_CLOCK,
57 DSIU_CLOCK,
58 CSI_CLOCK,
59 PCIU_CLOCK,
60 HSP_CLOCK,
61 PCI_CLOCK,
62 CEU_CLOCK,
63 ETHER0_CLOCK,
64 ETHER1_CLOCK
65} vr41xx_clock_t;
66
67extern void vr41xx_supply_clock(vr41xx_clock_t clock);
68extern void vr41xx_mask_clock(vr41xx_clock_t clock);
69
70/*
71 * Interrupt Control Unit
72 */
73extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
74extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int));
75
76#define PIUINT_COMMAND 0x0040
77#define PIUINT_DATA 0x0020
78#define PIUINT_PAGE1 0x0010
79#define PIUINT_PAGE0 0x0008
80#define PIUINT_DATALOST 0x0004
81#define PIUINT_STATUSCHANGE 0x0001
82
83extern void vr41xx_enable_piuint(uint16_t mask);
84extern void vr41xx_disable_piuint(uint16_t mask);
85
86#define AIUINT_INPUT_DMAEND 0x0800
87#define AIUINT_INPUT_DMAHALT 0x0400
88#define AIUINT_INPUT_DATALOST 0x0200
89#define AIUINT_INPUT_DATA 0x0100
90#define AIUINT_OUTPUT_DMAEND 0x0008
91#define AIUINT_OUTPUT_DMAHALT 0x0004
92#define AIUINT_OUTPUT_NODATA 0x0002
93
94extern void vr41xx_enable_aiuint(uint16_t mask);
95extern void vr41xx_disable_aiuint(uint16_t mask);
96
97#define KIUINT_DATALOST 0x0004
98#define KIUINT_DATAREADY 0x0002
99#define KIUINT_SCAN 0x0001
100
101extern void vr41xx_enable_kiuint(uint16_t mask);
102extern void vr41xx_disable_kiuint(uint16_t mask);
103
104#define DSIUINT_CTS 0x0800
105#define DSIUINT_RXERR 0x0400
106#define DSIUINT_RX 0x0200
107#define DSIUINT_TX 0x0100
108#define DSIUINT_ALL 0x0f00
109
110extern void vr41xx_enable_dsiuint(uint16_t mask);
111extern void vr41xx_disable_dsiuint(uint16_t mask);
112
113#define FIRINT_UNIT 0x0010
114#define FIRINT_RX_DMAEND 0x0008
115#define FIRINT_RX_DMAHALT 0x0004
116#define FIRINT_TX_DMAEND 0x0002
117#define FIRINT_TX_DMAHALT 0x0001
118
119extern void vr41xx_enable_firint(uint16_t mask);
120extern void vr41xx_disable_firint(uint16_t mask);
121
122extern void vr41xx_enable_pciint(void);
123extern void vr41xx_disable_pciint(void);
124
125extern void vr41xx_enable_scuint(void);
126extern void vr41xx_disable_scuint(void);
127
128#define CSIINT_TX_DMAEND 0x0040
129#define CSIINT_TX_DMAHALT 0x0020
130#define CSIINT_TX_DATA 0x0010
131#define CSIINT_TX_FIFOEMPTY 0x0008
132#define CSIINT_RX_DMAEND 0x0004
133#define CSIINT_RX_DMAHALT 0x0002
134#define CSIINT_RX_FIFOEMPTY 0x0001
135
136extern void vr41xx_enable_csiint(uint16_t mask);
137extern void vr41xx_disable_csiint(uint16_t mask);
138
139extern void vr41xx_enable_bcuint(void);
140extern void vr41xx_disable_bcuint(void);
141
142#ifdef CONFIG_SERIAL_VR41XX_CONSOLE
143extern void vr41xx_siu_setup(void);
144#else
145static inline void vr41xx_siu_setup(void) {}
146#endif
147
148#endif /* __NEC_VR41XX_H */
diff --git a/arch/mips/include/asm/war.h b/arch/mips/include/asm/war.h
new file mode 100644
index 000000000..21443f096
--- /dev/null
+++ b/arch/mips/include/asm/war.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) 2002, 2004, 2007 by Ralf Baechle
7 * Copyright (C) 2007 Maciej W. Rozycki
8 */
9#ifndef _ASM_WAR_H
10#define _ASM_WAR_H
11
12/*
13 * Work around certain R4000 CPU errata (as implemented by GCC):
14 *
15 * - A double-word or a variable shift may give an incorrect result
16 * if executed immediately after starting an integer division:
17 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
18 * erratum #28
19 * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
20 * #19
21 *
22 * - A double-word or a variable shift may give an incorrect result
23 * if executed while an integer multiplication is in progress:
24 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
25 * errata #16 & #28
26 *
27 * - An integer division may give an incorrect result if started in
28 * a delay slot of a taken branch or a jump:
29 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
30 * erratum #52
31 */
32#ifdef CONFIG_CPU_R4000_WORKAROUNDS
33#define R4000_WAR 1
34#else
35#define R4000_WAR 0
36#endif
37
38/*
39 * Work around certain R4400 CPU errata (as implemented by GCC):
40 *
41 * - A double-word or a variable shift may give an incorrect result
42 * if executed immediately after starting an integer division:
43 * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #10
44 * "MIPS R4400MC Errata, Processor Revision 2.0 & 3.0", erratum #4
45 */
46#ifdef CONFIG_CPU_R4400_WORKAROUNDS
47#define R4400_WAR 1
48#else
49#define R4400_WAR 0
50#endif
51
52/*
53 * Work around the "daddi" and "daddiu" CPU errata:
54 *
55 * - The `daddi' instruction fails to trap on overflow.
56 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
57 * erratum #23
58 *
59 * - The `daddiu' instruction can produce an incorrect result.
60 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
61 * erratum #41
62 * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
63 * #15
64 * "MIPS R4400PC/SC Errata, Processor Revision 1.0", erratum #7
65 * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #5
66 */
67#ifdef CONFIG_CPU_DADDI_WORKAROUNDS
68#define DADDI_WAR 1
69#else
70#define DADDI_WAR 0
71#endif
72
73#endif /* _ASM_WAR_H */
diff --git a/arch/mips/include/asm/watch.h b/arch/mips/include/asm/watch.h
new file mode 100644
index 000000000..6ffe3eadf
--- /dev/null
+++ b/arch/mips/include/asm/watch.h
@@ -0,0 +1,32 @@
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) 2008 David Daney
7 */
8#ifndef _ASM_WATCH_H
9#define _ASM_WATCH_H
10
11#include <linux/bitops.h>
12
13#include <asm/mipsregs.h>
14
15void mips_install_watch_registers(struct task_struct *t);
16void mips_read_watch_registers(void);
17void mips_clear_watch_registers(void);
18void mips_probe_watch_registers(struct cpuinfo_mips *c);
19
20#ifdef CONFIG_HARDWARE_WATCHPOINTS
21#define __restore_watch(task) do { \
22 if (unlikely(test_bit(TIF_LOAD_WATCH, \
23 &task_thread_info(task)->flags))) { \
24 mips_install_watch_registers(task); \
25 } \
26} while (0)
27
28#else
29#define __restore_watch(task) do {} while (0)
30#endif
31
32#endif /* _ASM_WATCH_H */
diff --git a/arch/mips/include/asm/wbflush.h b/arch/mips/include/asm/wbflush.h
new file mode 100644
index 000000000..eadc0ac47
--- /dev/null
+++ b/arch/mips/include/asm/wbflush.h
@@ -0,0 +1,34 @@
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
15#ifdef CONFIG_CPU_HAS_WB
16
17extern void (*__wbflush)(void);
18extern void wbflush_setup(void);
19
20#define wbflush() \
21 do { \
22 __sync(); \
23 __wbflush(); \
24 } while (0)
25
26#else /* !CONFIG_CPU_HAS_WB */
27
28#define wbflush_setup() do { } while (0)
29
30#define wbflush() fast_iob()
31
32#endif /* !CONFIG_CPU_HAS_WB */
33
34#endif /* _ASM_WBFLUSH_H */
diff --git a/arch/mips/include/asm/xtalk/xtalk.h b/arch/mips/include/asm/xtalk/xtalk.h
new file mode 100644
index 000000000..680e7efeb
--- /dev/null
+++ b/arch/mips/include/asm/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/arch/mips/include/asm/xtalk/xwidget.h b/arch/mips/include/asm/xtalk/xwidget.h
new file mode 100644
index 000000000..24f121da6
--- /dev/null
+++ b/arch/mips/include/asm/xtalk/xwidget.h
@@ -0,0 +1,279 @@
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/* Xtalk Widget Device Mfgr Nums */
88#define WIDGET_XBOW_MFGR_NUM 0x0 /* IP30 XBow Chip */
89#define WIDGET_XXBOW_MFGR_NUM 0x0 /* IP35 Xbow + XBridge Chip */
90#define WIDGET_ODYS_MFGR_NUM 0x023 /* Odyssey / VPro GFX */
91#define WIDGET_TPU_MFGR_NUM 0x024 /* Tensor Processor Unit */
92#define WIDGET_XBRDG_MFGR_NUM 0x024 /* IP35 XBridge Chip */
93#define WIDGET_HEART_MFGR_NUM 0x036 /* IP30 HEART Chip */
94#define WIDGET_BRIDG_MFGR_NUM 0x036 /* PCI Bridge */
95#define WIDGET_HUB_MFGR_NUM 0x036 /* IP27 Hub Chip */
96#define WIDGET_BDRCK_MFGR_NUM 0x036 /* IP35 Bedrock Chip */
97#define WIDGET_IMPCT_MFGR_NUM 0x2aa /* HQ4 / Impact GFX */
98#define WIDGET_KONA_MFGR_NUM 0x2aa /* InfiniteReality3 / Kona GFX */
99#define WIDGET_NULL_MFGR_NUM -1 /* NULL */
100
101/* Xtalk Widget Device Part Nums */
102#define WIDGET_XBOW_PART_NUM 0x0000
103#define WIDGET_HEART_PART_NUM 0xc001
104#define WIDGET_BRIDG_PART_NUM 0xc002
105#define WIDGET_IMPCT_PART_NUM 0xc003
106#define WIDGET_ODYS_PART_NUM 0xc013
107#define WIDGET_HUB_PART_NUM 0xc101
108#define WIDGET_KONA_PART_NUM 0xc102
109#define WIDGET_BDRCK_PART_NUM 0xc110
110#define WIDGET_TPU_PART_NUM 0xc202
111#define WIDGET_XXBOW_PART_NUM 0xd000
112#define WIDGET_XBRDG_PART_NUM 0xd002
113#define WIDGET_NULL_PART_NUM -1
114
115/* For Xtalk Widget identification */
116struct widget_ident {
117 u32 mfgr;
118 u32 part;
119 char *name;
120 char *revs[16];
121};
122
123/* Known Xtalk Widgets */
124static const struct widget_ident __initconst widget_idents[] = {
125 {
126 WIDGET_XBOW_MFGR_NUM,
127 WIDGET_XBOW_PART_NUM,
128 "xbow",
129 {NULL, "1.0", "1.1", "1.2", "1.3", "2.0", NULL},
130 },
131 {
132 WIDGET_HEART_MFGR_NUM,
133 WIDGET_HEART_PART_NUM,
134 "heart",
135 {NULL, "A", "B", "C", "D", "E", "F", NULL},
136 },
137 {
138 WIDGET_BRIDG_MFGR_NUM,
139 WIDGET_BRIDG_PART_NUM,
140 "bridge",
141 {NULL, "A", "B", "C", "D", NULL},
142 },
143 {
144 WIDGET_IMPCT_MFGR_NUM,
145 WIDGET_IMPCT_PART_NUM,
146 "impact",
147 {NULL, "A", "B", NULL},
148 },
149 {
150 WIDGET_ODYS_MFGR_NUM,
151 WIDGET_ODYS_PART_NUM,
152 "odyssey",
153 {NULL, "A", "B", NULL},
154 },
155 {
156 WIDGET_HUB_MFGR_NUM,
157 WIDGET_HUB_PART_NUM,
158 "hub",
159 {NULL, "1.0", "2.0", "2.1", "2.2", "2.3", "2.4", NULL},
160 },
161 {
162 WIDGET_KONA_MFGR_NUM,
163 WIDGET_KONA_PART_NUM,
164 "kona",
165 {NULL},
166 },
167 {
168 WIDGET_BDRCK_MFGR_NUM,
169 WIDGET_BDRCK_PART_NUM,
170 "bedrock",
171 {NULL, "1.0", "1.1", NULL},
172 },
173 {
174 WIDGET_TPU_MFGR_NUM,
175 WIDGET_TPU_PART_NUM,
176 "tpu",
177 {"0", NULL},
178 },
179 {
180 WIDGET_XXBOW_MFGR_NUM,
181 WIDGET_XXBOW_PART_NUM,
182 "xxbow",
183 {NULL, "1.0", "2.0", NULL},
184 },
185 {
186 WIDGET_XBRDG_MFGR_NUM,
187 WIDGET_XBRDG_PART_NUM,
188 "xbridge",
189 {NULL, "A", "B", NULL},
190 },
191 {
192 WIDGET_NULL_MFGR_NUM,
193 WIDGET_NULL_PART_NUM,
194 NULL,
195 {NULL},
196 }
197};
198
199/*
200 * according to the crosstalk spec, only 32-bits access to the widget
201 * configuration registers is allowed. some widgets may allow 64-bits
202 * access but software should not depend on it. registers beyond the
203 * widget target flush register are widget dependent thus will not be
204 * defined here
205 */
206#ifndef __ASSEMBLY__
207typedef u32 widgetreg_t;
208
209/* widget configuration registers */
210typedef volatile struct widget_cfg {
211 widgetreg_t w_pad_0; /* 0x00 */
212 widgetreg_t w_id; /* 0x04 */
213 widgetreg_t w_pad_1; /* 0x08 */
214 widgetreg_t w_status; /* 0x0c */
215 widgetreg_t w_pad_2; /* 0x10 */
216 widgetreg_t w_err_upper_addr; /* 0x14 */
217 widgetreg_t w_pad_3; /* 0x18 */
218 widgetreg_t w_err_lower_addr; /* 0x1c */
219 widgetreg_t w_pad_4; /* 0x20 */
220 widgetreg_t w_control; /* 0x24 */
221 widgetreg_t w_pad_5; /* 0x28 */
222 widgetreg_t w_req_timeout; /* 0x2c */
223 widgetreg_t w_pad_6; /* 0x30 */
224 widgetreg_t w_intdest_upper_addr; /* 0x34 */
225 widgetreg_t w_pad_7; /* 0x38 */
226 widgetreg_t w_intdest_lower_addr; /* 0x3c */
227 widgetreg_t w_pad_8; /* 0x40 */
228 widgetreg_t w_err_cmd_word; /* 0x44 */
229 widgetreg_t w_pad_9; /* 0x48 */
230 widgetreg_t w_llp_cfg; /* 0x4c */
231 widgetreg_t w_pad_10; /* 0x50 */
232 widgetreg_t w_tflush; /* 0x54 */
233} widget_cfg_t;
234
235typedef struct {
236 unsigned didn:4;
237 unsigned sidn:4;
238 unsigned pactyp:4;
239 unsigned tnum:5;
240 unsigned ct:1;
241 unsigned ds:2;
242 unsigned gbr:1;
243 unsigned vbpm:1;
244 unsigned error:1;
245 unsigned bo:1;
246 unsigned other:8;
247} w_err_cmd_word_f;
248
249typedef union {
250 widgetreg_t r;
251 w_err_cmd_word_f f;
252} w_err_cmd_word_u;
253
254typedef struct xwidget_info_s *xwidget_info_t;
255
256/*
257 * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
258 */
259typedef struct xwidget_hwid_s {
260 xwidget_part_num_t part_num;
261 xwidget_rev_num_t rev_num;
262 xwidget_mfg_num_t mfg_num;
263} *xwidget_hwid_t;
264
265
266/*
267 * Returns 1 if a driver that handles devices described by hwid1 is able
268 * to manage a device with hardwareid hwid2. NOTE: We don't check rev
269 * numbers at all.
270 */
271#define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \
272 (((hwid1)->part_num == (hwid2)->part_num) && \
273 (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
274 ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
275 ((hwid1)->mfg_num == (hwid2)->mfg_num)))
276
277#endif /* !__ASSEMBLY__ */
278
279#endif /* _ASM_XTALK_XWIDGET_H */
diff --git a/arch/mips/include/asm/yamon-dt.h b/arch/mips/include/asm/yamon-dt.h
new file mode 100644
index 000000000..e20475540
--- /dev/null
+++ b/arch/mips/include/asm/yamon-dt.h
@@ -0,0 +1,60 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2016 Imagination Technologies
4 * Author: Paul Burton <paul.burton@mips.com>
5 */
6
7#ifndef __MIPS_ASM_YAMON_DT_H__
8#define __MIPS_ASM_YAMON_DT_H__
9
10#include <linux/types.h>
11
12/**
13 * struct yamon_mem_region - Represents a contiguous range of physical RAM.
14 * @start: Start physical address.
15 * @size: Maximum size of region.
16 * @discard: Length of additional memory to discard after the region.
17 */
18struct yamon_mem_region {
19 phys_addr_t start;
20 phys_addr_t size;
21 phys_addr_t discard;
22};
23
24/**
25 * yamon_dt_append_cmdline() - Append YAMON-provided command line to /chosen
26 * @fdt: the FDT blob
27 *
28 * Write the YAMON-provided command line to the bootargs property of the
29 * /chosen node in @fdt.
30 *
31 * Return: 0 on success, else -errno
32 */
33extern __init int yamon_dt_append_cmdline(void *fdt);
34
35/**
36 * yamon_dt_append_memory() - Append YAMON-provided memory info to /memory
37 * @fdt: the FDT blob
38 * @regions: zero size terminated array of physical memory regions
39 *
40 * Generate a /memory node in @fdt based upon memory size information provided
41 * by YAMON in its environment and the @regions array.
42 *
43 * Return: 0 on success, else -errno
44 */
45extern __init int yamon_dt_append_memory(void *fdt,
46 const struct yamon_mem_region *regions);
47
48/**
49 * yamon_dt_serial_config() - Append YAMON-provided serial config to /chosen
50 * @fdt: the FDT blob
51 *
52 * Generate a stdout-path property in the /chosen node of @fdt, based upon
53 * information provided in the YAMON environment about the UART configuration
54 * of the system.
55 *
56 * Return: 0 on success, else -errno
57 */
58extern __init int yamon_dt_serial_config(void *fdt);
59
60#endif /* __MIPS_ASM_YAMON_DT_H__ */
diff --git a/arch/mips/include/uapi/asm/Kbuild b/arch/mips/include/uapi/asm/Kbuild
new file mode 100644
index 000000000..6db08385d
--- /dev/null
+++ b/arch/mips/include/uapi/asm/Kbuild
@@ -0,0 +1,9 @@
1# SPDX-License-Identifier: GPL-2.0
2generated-y += unistd_n32.h
3generated-y += unistd_n64.h
4generated-y += unistd_o32.h
5generated-y += unistd_nr_n32.h
6generated-y += unistd_nr_n64.h
7generated-y += unistd_nr_o32.h
8
9generic-y += kvm_para.h
diff --git a/arch/mips/include/uapi/asm/auxvec.h b/arch/mips/include/uapi/asm/auxvec.h
new file mode 100644
index 000000000..612c2c41f
--- /dev/null
+++ b/arch/mips/include/uapi/asm/auxvec.h
@@ -0,0 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2/*
3 * Copyright (C) 2015 Imagination Technologies
4 * Author: Alex Smith <alex.smith@imgtec.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __ASM_AUXVEC_H
13#define __ASM_AUXVEC_H
14
15/* Location of VDSO image. */
16#define AT_SYSINFO_EHDR 33
17
18#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */
19
20#endif /* __ASM_AUXVEC_H */
diff --git a/arch/mips/include/uapi/asm/bitfield.h b/arch/mips/include/uapi/asm/bitfield.h
new file mode 100644
index 000000000..b11713d87
--- /dev/null
+++ b/arch/mips/include/uapi/asm/bitfield.h
@@ -0,0 +1,30 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 2014 by Ralf Baechle <ralf@linux-mips.org>
8 */
9#ifndef __UAPI_ASM_BITFIELD_H
10#define __UAPI_ASM_BITFIELD_H
11
12/*
13 * * Damn ... bitfields depend from byteorder :-(
14 * */
15#ifdef __MIPSEB__
16#define __BITFIELD_FIELD(field, more) \
17 field; \
18 more
19
20#elif defined(__MIPSEL__)
21
22#define __BITFIELD_FIELD(field, more) \
23 more \
24 field;
25
26#else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */
27#error "MIPS but neither __MIPSEL__ nor __MIPSEB__?"
28#endif
29
30#endif /* __UAPI_ASM_BITFIELD_H */
diff --git a/arch/mips/include/uapi/asm/bitsperlong.h b/arch/mips/include/uapi/asm/bitsperlong.h
new file mode 100644
index 000000000..7268380d8
--- /dev/null
+++ b/arch/mips/include/uapi/asm/bitsperlong.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef __ASM_MIPS_BITSPERLONG_H
3#define __ASM_MIPS_BITSPERLONG_H
4
5#define __BITS_PER_LONG _MIPS_SZLONG
6
7#include <asm-generic/bitsperlong.h>
8
9#endif /* __ASM_MIPS_BITSPERLONG_H */
diff --git a/arch/mips/include/uapi/asm/break.h b/arch/mips/include/uapi/asm/break.h
new file mode 100644
index 000000000..10380b1bc
--- /dev/null
+++ b/arch/mips/include/uapi/asm/break.h
@@ -0,0 +1,32 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 2003 by Ralf Baechle
8 * Copyright (C) 1999 Silicon Graphics, Inc.
9 */
10#ifndef __UAPI_ASM_BREAK_H
11#define __UAPI_ASM_BREAK_H
12
13/*
14 * The following break codes are or were in use for specific purposes in
15 * other MIPS operating systems. Linux/MIPS doesn't use all of them. The
16 * unused ones are here as placeholders; we might encounter them in
17 * non-Linux/MIPS object files or make use of them in the future.
18 */
19#define BRK_USERBP 0 /* User bp (used by debuggers) */
20#define BRK_SSTEPBP 5 /* User bp (used by debuggers) */
21#define BRK_OVERFLOW 6 /* Overflow check */
22#define BRK_DIVZERO 7 /* Divide by zero check */
23#define BRK_RANGE 8 /* Range error check */
24#define BRK_BUG 12 /* Used by BUG() */
25#define BRK_UPROBE 13 /* See <asm/uprobes.h> */
26#define BRK_UPROBE_XOL 14 /* See <asm/uprobes.h> */
27#define BRK_MEMU 514 /* Used by FPU emulator */
28#define BRK_KPROBE_BP 515 /* Kprobe break */
29#define BRK_KPROBE_SSTEPBP 516 /* Kprobe single step software implementation */
30#define BRK_MULOVF 1023 /* Multiply overflow */
31
32#endif /* __UAPI_ASM_BREAK_H */
diff --git a/arch/mips/include/uapi/asm/byteorder.h b/arch/mips/include/uapi/asm/byteorder.h
new file mode 100644
index 000000000..b4edc85f9
--- /dev/null
+++ b/arch/mips/include/uapi/asm/byteorder.h
@@ -0,0 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1996, 99, 2003 by Ralf Baechle
8 */
9#ifndef _ASM_BYTEORDER_H
10#define _ASM_BYTEORDER_H
11
12#if defined(__MIPSEB__)
13#include <linux/byteorder/big_endian.h>
14#elif defined(__MIPSEL__)
15#include <linux/byteorder/little_endian.h>
16#else
17# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
18#endif
19
20#endif /* _ASM_BYTEORDER_H */
diff --git a/arch/mips/include/uapi/asm/cachectl.h b/arch/mips/include/uapi/asm/cachectl.h
new file mode 100644
index 000000000..af7639ff4
--- /dev/null
+++ b/arch/mips/include/uapi/asm/cachectl.h
@@ -0,0 +1,27 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1994, 1995, 1996 by Ralf Baechle
8 */
9#ifndef _ASM_CACHECTL
10#define _ASM_CACHECTL
11
12/*
13 * Options for cacheflush system call
14 */
15#define ICACHE (1<<0) /* flush instruction cache */
16#define DCACHE (1<<1) /* writeback and flush data cache */
17#define BCACHE (ICACHE|DCACHE) /* flush both caches */
18
19/*
20 * Caching modes for the cachectl(2) call
21 *
22 * cachectl(2) is currently not supported and returns ENOSYS.
23 */
24#define CACHEABLE 0 /* make pages cacheable */
25#define UNCACHEABLE 1 /* make pages uncacheable */
26
27#endif /* _ASM_CACHECTL */
diff --git a/arch/mips/include/uapi/asm/errno.h b/arch/mips/include/uapi/asm/errno.h
new file mode 100644
index 000000000..2fb714e2d
--- /dev/null
+++ b/arch/mips/include/uapi/asm/errno.h
@@ -0,0 +1,130 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 1999, 2001, 2002 by Ralf Baechle
8 */
9#ifndef _UAPI_ASM_ERRNO_H
10#define _UAPI_ASM_ERRNO_H
11
12/*
13 * These error numbers are intended to be MIPS ABI compatible
14 */
15
16#include <asm-generic/errno-base.h>
17
18#define ENOMSG 35 /* No message of desired type */
19#define EIDRM 36 /* Identifier removed */
20#define ECHRNG 37 /* Channel number out of range */
21#define EL2NSYNC 38 /* Level 2 not synchronized */
22#define EL3HLT 39 /* Level 3 halted */
23#define EL3RST 40 /* Level 3 reset */
24#define ELNRNG 41 /* Link number out of range */
25#define EUNATCH 42 /* Protocol driver not attached */
26#define ENOCSI 43 /* No CSI structure available */
27#define EL2HLT 44 /* Level 2 halted */
28#define EDEADLK 45 /* Resource deadlock would occur */
29#define ENOLCK 46 /* No record locks available */
30#define EBADE 50 /* Invalid exchange */
31#define EBADR 51 /* Invalid request descriptor */
32#define EXFULL 52 /* Exchange full */
33#define ENOANO 53 /* No anode */
34#define EBADRQC 54 /* Invalid request code */
35#define EBADSLT 55 /* Invalid slot */
36#define EDEADLOCK 56 /* File locking deadlock error */
37#define EBFONT 59 /* Bad font file format */
38#define ENOSTR 60 /* Device not a stream */
39#define ENODATA 61 /* No data available */
40#define ETIME 62 /* Timer expired */
41#define ENOSR 63 /* Out of streams resources */
42#define ENONET 64 /* Machine is not on the network */
43#define ENOPKG 65 /* Package not installed */
44#define EREMOTE 66 /* Object is remote */
45#define ENOLINK 67 /* Link has been severed */
46#define EADV 68 /* Advertise error */
47#define ESRMNT 69 /* Srmount error */
48#define ECOMM 70 /* Communication error on send */
49#define EPROTO 71 /* Protocol error */
50#define EDOTDOT 73 /* RFS specific error */
51#define EMULTIHOP 74 /* Multihop attempted */
52#define EBADMSG 77 /* Not a data message */
53#define ENAMETOOLONG 78 /* File name too long */
54#define EOVERFLOW 79 /* Value too large for defined data type */
55#define ENOTUNIQ 80 /* Name not unique on network */
56#define EBADFD 81 /* File descriptor in bad state */
57#define EREMCHG 82 /* Remote address changed */
58#define ELIBACC 83 /* Can not access a needed shared library */
59#define ELIBBAD 84 /* Accessing a corrupted shared library */
60#define ELIBSCN 85 /* .lib section in a.out corrupted */
61#define ELIBMAX 86 /* Attempting to link in too many shared libraries */
62#define ELIBEXEC 87 /* Cannot exec a shared library directly */
63#define EILSEQ 88 /* Illegal byte sequence */
64#define ENOSYS 89 /* Function not implemented */
65#define ELOOP 90 /* Too many symbolic links encountered */
66#define ERESTART 91 /* Interrupted system call should be restarted */
67#define ESTRPIPE 92 /* Streams pipe error */
68#define ENOTEMPTY 93 /* Directory not empty */
69#define EUSERS 94 /* Too many users */
70#define ENOTSOCK 95 /* Socket operation on non-socket */
71#define EDESTADDRREQ 96 /* Destination address required */
72#define EMSGSIZE 97 /* Message too long */
73#define EPROTOTYPE 98 /* Protocol wrong type for socket */
74#define ENOPROTOOPT 99 /* Protocol not available */
75#define EPROTONOSUPPORT 120 /* Protocol not supported */
76#define ESOCKTNOSUPPORT 121 /* Socket type not supported */
77#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */
78#define EPFNOSUPPORT 123 /* Protocol family not supported */
79#define EAFNOSUPPORT 124 /* Address family not supported by protocol */
80#define EADDRINUSE 125 /* Address already in use */
81#define EADDRNOTAVAIL 126 /* Cannot assign requested address */
82#define ENETDOWN 127 /* Network is down */
83#define ENETUNREACH 128 /* Network is unreachable */
84#define ENETRESET 129 /* Network dropped connection because of reset */
85#define ECONNABORTED 130 /* Software caused connection abort */
86#define ECONNRESET 131 /* Connection reset by peer */
87#define ENOBUFS 132 /* No buffer space available */
88#define EISCONN 133 /* Transport endpoint is already connected */
89#define ENOTCONN 134 /* Transport endpoint is not connected */
90#define EUCLEAN 135 /* Structure needs cleaning */
91#define ENOTNAM 137 /* Not a XENIX named type file */
92#define ENAVAIL 138 /* No XENIX semaphores available */
93#define EISNAM 139 /* Is a named type file */
94#define EREMOTEIO 140 /* Remote I/O error */
95#define EINIT 141 /* Reserved */
96#define EREMDEV 142 /* Error 142 */
97#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */
98#define ETOOMANYREFS 144 /* Too many references: cannot splice */
99#define ETIMEDOUT 145 /* Connection timed out */
100#define ECONNREFUSED 146 /* Connection refused */
101#define EHOSTDOWN 147 /* Host is down */
102#define EHOSTUNREACH 148 /* No route to host */
103#define EWOULDBLOCK EAGAIN /* Operation would block */
104#define EALREADY 149 /* Operation already in progress */
105#define EINPROGRESS 150 /* Operation now in progress */
106#define ESTALE 151 /* Stale file handle */
107#define ECANCELED 158 /* AIO operation canceled */
108
109/*
110 * These error are Linux extensions.
111 */
112#define ENOMEDIUM 159 /* No medium found */
113#define EMEDIUMTYPE 160 /* Wrong medium type */
114#define ENOKEY 161 /* Required key not available */
115#define EKEYEXPIRED 162 /* Key has expired */
116#define EKEYREVOKED 163 /* Key has been revoked */
117#define EKEYREJECTED 164 /* Key was rejected by service */
118
119/* for robust mutexes */
120#define EOWNERDEAD 165 /* Owner died */
121#define ENOTRECOVERABLE 166 /* State not recoverable */
122
123#define ERFKILL 167 /* Operation not possible due to RF-kill */
124
125#define EHWPOISON 168 /* Memory page has hardware error */
126
127#define EDQUOT 1133 /* Quota exceeded */
128
129
130#endif /* _UAPI_ASM_ERRNO_H */
diff --git a/arch/mips/include/uapi/asm/fcntl.h b/arch/mips/include/uapi/asm/fcntl.h
new file mode 100644
index 000000000..42e13dead
--- /dev/null
+++ b/arch/mips/include/uapi/asm/fcntl.h
@@ -0,0 +1,80 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 96, 97, 98, 99, 2003, 05 Ralf Baechle
8 */
9#ifndef _UAPI_ASM_FCNTL_H
10#define _UAPI_ASM_FCNTL_H
11
12#include <asm/sgidefs.h>
13
14#define O_APPEND 0x0008
15#define O_DSYNC 0x0010 /* used to be O_SYNC, see below */
16#define O_NONBLOCK 0x0080
17#define O_CREAT 0x0100 /* not fcntl */
18#define O_TRUNC 0x0200 /* not fcntl */
19#define O_EXCL 0x0400 /* not fcntl */
20#define O_NOCTTY 0x0800 /* not fcntl */
21#define FASYNC 0x1000 /* fcntl, for BSD compatibility */
22#define O_LARGEFILE 0x2000 /* allow large file opens */
23/*
24 * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
25 * the O_SYNC flag. We continue to use the existing numerical value
26 * for O_DSYNC semantics now, but using the correct symbolic name for it.
27 * This new value is used to request true Posix O_SYNC semantics. It is
28 * defined in this strange way to make sure applications compiled against
29 * new headers get at least O_DSYNC semantics on older kernels.
30 *
31 * This has the nice side-effect that we can simply test for O_DSYNC
32 * wherever we do not care if O_DSYNC or O_SYNC is used.
33 *
34 * Note: __O_SYNC must never be used directly.
35 */
36#define __O_SYNC 0x4000
37#define O_SYNC (__O_SYNC|O_DSYNC)
38#define O_DIRECT 0x8000 /* direct disk access hint */
39
40#define F_GETLK 14
41#define F_SETLK 6
42#define F_SETLKW 7
43
44#define F_SETOWN 24 /* for sockets. */
45#define F_GETOWN 23 /* 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/*
54 * The flavours of struct flock. "struct flock" is the ABI compliant
55 * variant. Finally struct flock64 is the LFS variant of struct flock. As
56 * a historic accident and inconsistence with the ABI definition it doesn't
57 * contain all the same fields as struct flock.
58 */
59
60#if _MIPS_SIM != _MIPS_SIM_ABI64
61
62#include <linux/types.h>
63
64struct flock {
65 short l_type;
66 short l_whence;
67 __kernel_off_t l_start;
68 __kernel_off_t l_len;
69 long l_sysid;
70 __kernel_pid_t l_pid;
71 long pad[4];
72};
73
74#define HAVE_ARCH_STRUCT_FLOCK
75
76#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
77
78#include <asm-generic/fcntl.h>
79
80#endif /* _UAPI_ASM_FCNTL_H */
diff --git a/arch/mips/include/uapi/asm/hwcap.h b/arch/mips/include/uapi/asm/hwcap.h
new file mode 100644
index 000000000..b7e02bdc1
--- /dev/null
+++ b/arch/mips/include/uapi/asm/hwcap.h
@@ -0,0 +1,22 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _UAPI_ASM_HWCAP_H
3#define _UAPI_ASM_HWCAP_H
4
5/* HWCAP flags */
6#define HWCAP_MIPS_R6 (1 << 0)
7#define HWCAP_MIPS_MSA (1 << 1)
8#define HWCAP_MIPS_CRC32 (1 << 2)
9#define HWCAP_MIPS_MIPS16 (1 << 3)
10#define HWCAP_MIPS_MDMX (1 << 4)
11#define HWCAP_MIPS_MIPS3D (1 << 5)
12#define HWCAP_MIPS_SMARTMIPS (1 << 6)
13#define HWCAP_MIPS_DSP (1 << 7)
14#define HWCAP_MIPS_DSP2 (1 << 8)
15#define HWCAP_MIPS_DSP3 (1 << 9)
16#define HWCAP_MIPS_MIPS16E2 (1 << 10)
17#define HWCAP_LOONGSON_MMI (1 << 11)
18#define HWCAP_LOONGSON_EXT (1 << 12)
19#define HWCAP_LOONGSON_EXT2 (1 << 13)
20#define HWCAP_LOONGSON_CPUCFG (1 << 14)
21
22#endif /* _UAPI_ASM_HWCAP_H */
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h
new file mode 100644
index 000000000..43d1faa02
--- /dev/null
+++ b/arch/mips/include/uapi/asm/inst.h
@@ -0,0 +1,1141 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * Format of an instruction in memory.
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) 1996, 2000 by Ralf Baechle
10 * Copyright (C) 2006 by Thiemo Seufer
11 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
12 * Copyright (C) 2014 Imagination Technologies Ltd.
13 */
14#ifndef _UAPI_ASM_INST_H
15#define _UAPI_ASM_INST_H
16
17#include <asm/bitfield.h>
18
19/*
20 * Major opcodes; before MIPS IV cop1x was called cop3.
21 */
22enum major_op {
23 spec_op, bcond_op, j_op, jal_op,
24 beq_op, bne_op, blez_op, bgtz_op,
25 addi_op, pop10_op = addi_op, addiu_op, slti_op, sltiu_op,
26 andi_op, ori_op, xori_op, lui_op,
27 cop0_op, cop1_op, cop2_op, cop1x_op,
28 beql_op, bnel_op, blezl_op, bgtzl_op,
29 daddi_op, pop30_op = daddi_op, daddiu_op, ldl_op, ldr_op,
30 spec2_op, jalx_op, mdmx_op, msa_op = mdmx_op, spec3_op,
31 lb_op, lh_op, lwl_op, lw_op,
32 lbu_op, lhu_op, lwr_op, lwu_op,
33 sb_op, sh_op, swl_op, sw_op,
34 sdl_op, sdr_op, swr_op, cache_op,
35 ll_op, lwc1_op, lwc2_op, bc6_op = lwc2_op, pref_op,
36 lld_op, ldc1_op, ldc2_op, pop66_op = ldc2_op, ld_op,
37 sc_op, swc1_op, swc2_op, balc6_op = swc2_op, major_3b_op,
38 scd_op, sdc1_op, sdc2_op, pop76_op = sdc2_op, sd_op
39};
40
41/*
42 * func field of spec opcode.
43 */
44enum spec_op {
45 sll_op, movc_op, srl_op, sra_op,
46 sllv_op, pmon_op, srlv_op, srav_op,
47 jr_op, jalr_op, movz_op, movn_op,
48 syscall_op, break_op, spim_op, sync_op,
49 mfhi_op, mthi_op, mflo_op, mtlo_op,
50 dsllv_op, spec2_unused_op, dsrlv_op, dsrav_op,
51 mult_op, multu_op, div_op, divu_op,
52 dmult_op, dmultu_op, ddiv_op, ddivu_op,
53 add_op, addu_op, sub_op, subu_op,
54 and_op, or_op, xor_op, nor_op,
55 spec3_unused_op, spec4_unused_op, slt_op, sltu_op,
56 dadd_op, daddu_op, dsub_op, dsubu_op,
57 tge_op, tgeu_op, tlt_op, tltu_op,
58 teq_op, seleqz_op, tne_op, selnez_op,
59 dsll_op, spec5_unused_op, dsrl_op, dsra_op,
60 dsll32_op, spec6_unused_op, dsrl32_op, dsra32_op
61};
62
63/*
64 * func field of spec2 opcode.
65 */
66enum spec2_op {
67 madd_op, maddu_op, mul_op, spec2_3_unused_op,
68 msub_op, msubu_op, /* more unused ops */
69 clz_op = 0x20, clo_op,
70 dclz_op = 0x24, dclo_op,
71 sdbpp_op = 0x3f
72};
73
74/*
75 * func field of spec3 opcode.
76 */
77enum spec3_op {
78 ext_op, dextm_op, dextu_op, dext_op,
79 ins_op, dinsm_op, dinsu_op, dins_op,
80 yield_op = 0x09, lx_op = 0x0a,
81 lwle_op = 0x19, lwre_op = 0x1a,
82 cachee_op = 0x1b, sbe_op = 0x1c,
83 she_op = 0x1d, sce_op = 0x1e,
84 swe_op = 0x1f, bshfl_op = 0x20,
85 swle_op = 0x21, swre_op = 0x22,
86 prefe_op = 0x23, dbshfl_op = 0x24,
87 cache6_op = 0x25, sc6_op = 0x26,
88 scd6_op = 0x27, lbue_op = 0x28,
89 lhue_op = 0x29, lbe_op = 0x2c,
90 lhe_op = 0x2d, lle_op = 0x2e,
91 lwe_op = 0x2f, pref6_op = 0x35,
92 ll6_op = 0x36, lld6_op = 0x37,
93 rdhwr_op = 0x3b
94};
95
96/*
97 * Bits 10-6 minor opcode for r6 spec mult/div encodings
98 */
99enum mult_op {
100 mult_mult_op = 0x0,
101 mult_mul_op = 0x2,
102 mult_muh_op = 0x3,
103};
104enum multu_op {
105 multu_multu_op = 0x0,
106 multu_mulu_op = 0x2,
107 multu_muhu_op = 0x3,
108};
109enum div_op {
110 div_div_op = 0x0,
111 div_div6_op = 0x2,
112 div_mod_op = 0x3,
113};
114enum divu_op {
115 divu_divu_op = 0x0,
116 divu_divu6_op = 0x2,
117 divu_modu_op = 0x3,
118};
119enum dmult_op {
120 dmult_dmult_op = 0x0,
121 dmult_dmul_op = 0x2,
122 dmult_dmuh_op = 0x3,
123};
124enum dmultu_op {
125 dmultu_dmultu_op = 0x0,
126 dmultu_dmulu_op = 0x2,
127 dmultu_dmuhu_op = 0x3,
128};
129enum ddiv_op {
130 ddiv_ddiv_op = 0x0,
131 ddiv_ddiv6_op = 0x2,
132 ddiv_dmod_op = 0x3,
133};
134enum ddivu_op {
135 ddivu_ddivu_op = 0x0,
136 ddivu_ddivu6_op = 0x2,
137 ddivu_dmodu_op = 0x3,
138};
139
140/*
141 * rt field of bcond opcodes.
142 */
143enum rt_op {
144 bltz_op, bgez_op, bltzl_op, bgezl_op,
145 spimi_op, unused_rt_op_0x05, unused_rt_op_0x06, unused_rt_op_0x07,
146 tgei_op, tgeiu_op, tlti_op, tltiu_op,
147 teqi_op, unused_0x0d_rt_op, tnei_op, unused_0x0f_rt_op,
148 bltzal_op, bgezal_op, bltzall_op, bgezall_op,
149 rt_op_0x14, rt_op_0x15, rt_op_0x16, rt_op_0x17,
150 rt_op_0x18, rt_op_0x19, rt_op_0x1a, rt_op_0x1b,
151 bposge32_op, rt_op_0x1d, rt_op_0x1e, synci_op
152};
153
154/*
155 * rs field of cop opcodes.
156 */
157enum cop_op {
158 mfc_op = 0x00, dmfc_op = 0x01,
159 cfc_op = 0x02, mfhc0_op = 0x02,
160 mfhc_op = 0x03, mtc_op = 0x04,
161 dmtc_op = 0x05, ctc_op = 0x06,
162 mthc0_op = 0x06, mthc_op = 0x07,
163 bc_op = 0x08, bc1eqz_op = 0x09,
164 mfmc0_op = 0x0b, bc1nez_op = 0x0d,
165 wrpgpr_op = 0x0e, cop_op = 0x10,
166 copm_op = 0x18
167};
168
169/*
170 * rt field of cop.bc_op opcodes
171 */
172enum bcop_op {
173 bcf_op, bct_op, bcfl_op, bctl_op
174};
175
176/*
177 * func field of cop0 coi opcodes.
178 */
179enum cop0_coi_func {
180 tlbr_op = 0x01, tlbwi_op = 0x02,
181 tlbwr_op = 0x06, tlbp_op = 0x08,
182 rfe_op = 0x10, eret_op = 0x18,
183 wait_op = 0x20, hypcall_op = 0x28
184};
185
186/*
187 * func field of cop0 com opcodes.
188 */
189enum cop0_com_func {
190 tlbr1_op = 0x01, tlbw_op = 0x02,
191 tlbp1_op = 0x08, dctr_op = 0x09,
192 dctw_op = 0x0a
193};
194
195/*
196 * fmt field of cop1 opcodes.
197 */
198enum cop1_fmt {
199 s_fmt, d_fmt, e_fmt, q_fmt,
200 w_fmt, l_fmt
201};
202
203/*
204 * func field of cop1 instructions using d, s or w format.
205 */
206enum cop1_sdw_func {
207 fadd_op = 0x00, fsub_op = 0x01,
208 fmul_op = 0x02, fdiv_op = 0x03,
209 fsqrt_op = 0x04, fabs_op = 0x05,
210 fmov_op = 0x06, fneg_op = 0x07,
211 froundl_op = 0x08, ftruncl_op = 0x09,
212 fceill_op = 0x0a, ffloorl_op = 0x0b,
213 fround_op = 0x0c, ftrunc_op = 0x0d,
214 fceil_op = 0x0e, ffloor_op = 0x0f,
215 fsel_op = 0x10,
216 fmovc_op = 0x11, fmovz_op = 0x12,
217 fmovn_op = 0x13, fseleqz_op = 0x14,
218 frecip_op = 0x15, frsqrt_op = 0x16,
219 fselnez_op = 0x17, fmaddf_op = 0x18,
220 fmsubf_op = 0x19, frint_op = 0x1a,
221 fclass_op = 0x1b, fmin_op = 0x1c,
222 fmina_op = 0x1d, fmax_op = 0x1e,
223 fmaxa_op = 0x1f, fcvts_op = 0x20,
224 fcvtd_op = 0x21, fcvte_op = 0x22,
225 fcvtw_op = 0x24, fcvtl_op = 0x25,
226 fcmp_op = 0x30
227};
228
229/*
230 * func field of cop1x opcodes (MIPS IV).
231 */
232enum cop1x_func {
233 lwxc1_op = 0x00, ldxc1_op = 0x01,
234 swxc1_op = 0x08, sdxc1_op = 0x09,
235 pfetch_op = 0x0f, madd_s_op = 0x20,
236 madd_d_op = 0x21, madd_e_op = 0x22,
237 msub_s_op = 0x28, msub_d_op = 0x29,
238 msub_e_op = 0x2a, nmadd_s_op = 0x30,
239 nmadd_d_op = 0x31, nmadd_e_op = 0x32,
240 nmsub_s_op = 0x38, nmsub_d_op = 0x39,
241 nmsub_e_op = 0x3a
242};
243
244/*
245 * func field for mad opcodes (MIPS IV).
246 */
247enum mad_func {
248 madd_fp_op = 0x08, msub_fp_op = 0x0a,
249 nmadd_fp_op = 0x0c, nmsub_fp_op = 0x0e
250};
251
252/*
253 * func field for page table walker (Loongson-3).
254 */
255enum ptw_func {
256 lwdir_op = 0x00,
257 lwpte_op = 0x01,
258 lddir_op = 0x02,
259 ldpte_op = 0x03,
260};
261
262/*
263 * func field for special3 lx opcodes (Cavium Octeon).
264 */
265enum lx_func {
266 lwx_op = 0x00,
267 lhx_op = 0x04,
268 lbux_op = 0x06,
269 ldx_op = 0x08,
270 lwux_op = 0x10,
271 lhux_op = 0x14,
272 lbx_op = 0x16,
273};
274
275/*
276 * BSHFL opcodes
277 */
278enum bshfl_func {
279 wsbh_op = 0x2,
280 seb_op = 0x10,
281 seh_op = 0x18,
282};
283
284/*
285 * DBSHFL opcodes
286 */
287enum dbshfl_func {
288 dsbh_op = 0x2,
289 dshd_op = 0x5,
290};
291
292/*
293 * MSA minor opcodes.
294 */
295enum msa_func {
296 msa_elm_op = 0x19,
297};
298
299/*
300 * MSA ELM opcodes.
301 */
302enum msa_elm {
303 msa_ctc_op = 0x3e,
304 msa_cfc_op = 0x7e,
305};
306
307/*
308 * func field for MSA MI10 format.
309 */
310enum msa_mi10_func {
311 msa_ld_op = 8,
312 msa_st_op = 9,
313};
314
315/*
316 * MSA 2 bit format fields.
317 */
318enum msa_2b_fmt {
319 msa_fmt_b = 0,
320 msa_fmt_h = 1,
321 msa_fmt_w = 2,
322 msa_fmt_d = 3,
323};
324
325/*
326 * (microMIPS) Major opcodes.
327 */
328enum mm_major_op {
329 mm_pool32a_op, mm_pool16a_op, mm_lbu16_op, mm_move16_op,
330 mm_addi32_op, mm_lbu32_op, mm_sb32_op, mm_lb32_op,
331 mm_pool32b_op, mm_pool16b_op, mm_lhu16_op, mm_andi16_op,
332 mm_addiu32_op, mm_lhu32_op, mm_sh32_op, mm_lh32_op,
333 mm_pool32i_op, mm_pool16c_op, mm_lwsp16_op, mm_pool16d_op,
334 mm_ori32_op, mm_pool32f_op, mm_pool32s_op, mm_reserved2_op,
335 mm_pool32c_op, mm_lwgp16_op, mm_lw16_op, mm_pool16e_op,
336 mm_xori32_op, mm_jals32_op, mm_addiupc_op, mm_reserved3_op,
337 mm_reserved4_op, mm_pool16f_op, mm_sb16_op, mm_beqz16_op,
338 mm_slti32_op, mm_beq32_op, mm_swc132_op, mm_lwc132_op,
339 mm_reserved5_op, mm_reserved6_op, mm_sh16_op, mm_bnez16_op,
340 mm_sltiu32_op, mm_bne32_op, mm_sdc132_op, mm_ldc132_op,
341 mm_reserved7_op, mm_reserved8_op, mm_swsp16_op, mm_b16_op,
342 mm_andi32_op, mm_j32_op, mm_sd32_op, mm_ld32_op,
343 mm_reserved11_op, mm_reserved12_op, mm_sw16_op, mm_li16_op,
344 mm_jalx32_op, mm_jal32_op, mm_sw32_op, mm_lw32_op,
345};
346
347/*
348 * (microMIPS) POOL32I minor opcodes.
349 */
350enum mm_32i_minor_op {
351 mm_bltz_op, mm_bltzal_op, mm_bgez_op, mm_bgezal_op,
352 mm_blez_op, mm_bnezc_op, mm_bgtz_op, mm_beqzc_op,
353 mm_tlti_op, mm_tgei_op, mm_tltiu_op, mm_tgeiu_op,
354 mm_tnei_op, mm_lui_op, mm_teqi_op, mm_reserved13_op,
355 mm_synci_op, mm_bltzals_op, mm_reserved14_op, mm_bgezals_op,
356 mm_bc2f_op, mm_bc2t_op, mm_reserved15_op, mm_reserved16_op,
357 mm_reserved17_op, mm_reserved18_op, mm_bposge64_op, mm_bposge32_op,
358 mm_bc1f_op, mm_bc1t_op, mm_reserved19_op, mm_reserved20_op,
359 mm_bc1any2f_op, mm_bc1any2t_op, mm_bc1any4f_op, mm_bc1any4t_op,
360};
361
362/*
363 * (microMIPS) POOL32A minor opcodes.
364 */
365enum mm_32a_minor_op {
366 mm_sll32_op = 0x000,
367 mm_ins_op = 0x00c,
368 mm_sllv32_op = 0x010,
369 mm_ext_op = 0x02c,
370 mm_pool32axf_op = 0x03c,
371 mm_srl32_op = 0x040,
372 mm_srlv32_op = 0x050,
373 mm_sra_op = 0x080,
374 mm_srav_op = 0x090,
375 mm_rotr_op = 0x0c0,
376 mm_lwxs_op = 0x118,
377 mm_addu32_op = 0x150,
378 mm_subu32_op = 0x1d0,
379 mm_wsbh_op = 0x1ec,
380 mm_mul_op = 0x210,
381 mm_and_op = 0x250,
382 mm_or32_op = 0x290,
383 mm_xor32_op = 0x310,
384 mm_slt_op = 0x350,
385 mm_sltu_op = 0x390,
386};
387
388/*
389 * (microMIPS) POOL32B functions.
390 */
391enum mm_32b_func {
392 mm_lwc2_func = 0x0,
393 mm_lwp_func = 0x1,
394 mm_ldc2_func = 0x2,
395 mm_ldp_func = 0x4,
396 mm_lwm32_func = 0x5,
397 mm_cache_func = 0x6,
398 mm_ldm_func = 0x7,
399 mm_swc2_func = 0x8,
400 mm_swp_func = 0x9,
401 mm_sdc2_func = 0xa,
402 mm_sdp_func = 0xc,
403 mm_swm32_func = 0xd,
404 mm_sdm_func = 0xf,
405};
406
407/*
408 * (microMIPS) POOL32C functions.
409 */
410enum mm_32c_func {
411 mm_pref_func = 0x2,
412 mm_ll_func = 0x3,
413 mm_swr_func = 0x9,
414 mm_sc_func = 0xb,
415 mm_lwu_func = 0xe,
416};
417
418/*
419 * (microMIPS) POOL32AXF minor opcodes.
420 */
421enum mm_32axf_minor_op {
422 mm_mfc0_op = 0x003,
423 mm_mtc0_op = 0x00b,
424 mm_tlbp_op = 0x00d,
425 mm_mfhi32_op = 0x035,
426 mm_jalr_op = 0x03c,
427 mm_tlbr_op = 0x04d,
428 mm_mflo32_op = 0x075,
429 mm_jalrhb_op = 0x07c,
430 mm_tlbwi_op = 0x08d,
431 mm_mthi32_op = 0x0b5,
432 mm_tlbwr_op = 0x0cd,
433 mm_mtlo32_op = 0x0f5,
434 mm_di_op = 0x11d,
435 mm_jalrs_op = 0x13c,
436 mm_jalrshb_op = 0x17c,
437 mm_sync_op = 0x1ad,
438 mm_syscall_op = 0x22d,
439 mm_wait_op = 0x24d,
440 mm_eret_op = 0x3cd,
441 mm_divu_op = 0x5dc,
442};
443
444/*
445 * (microMIPS) POOL32F minor opcodes.
446 */
447enum mm_32f_minor_op {
448 mm_32f_00_op = 0x00,
449 mm_32f_01_op = 0x01,
450 mm_32f_02_op = 0x02,
451 mm_32f_10_op = 0x08,
452 mm_32f_11_op = 0x09,
453 mm_32f_12_op = 0x0a,
454 mm_32f_20_op = 0x10,
455 mm_32f_30_op = 0x18,
456 mm_32f_40_op = 0x20,
457 mm_32f_41_op = 0x21,
458 mm_32f_42_op = 0x22,
459 mm_32f_50_op = 0x28,
460 mm_32f_51_op = 0x29,
461 mm_32f_52_op = 0x2a,
462 mm_32f_60_op = 0x30,
463 mm_32f_70_op = 0x38,
464 mm_32f_73_op = 0x3b,
465 mm_32f_74_op = 0x3c,
466};
467
468/*
469 * (microMIPS) POOL32F secondary minor opcodes.
470 */
471enum mm_32f_10_minor_op {
472 mm_lwxc1_op = 0x1,
473 mm_swxc1_op,
474 mm_ldxc1_op,
475 mm_sdxc1_op,
476 mm_luxc1_op,
477 mm_suxc1_op,
478};
479
480enum mm_32f_func {
481 mm_lwxc1_func = 0x048,
482 mm_swxc1_func = 0x088,
483 mm_ldxc1_func = 0x0c8,
484 mm_sdxc1_func = 0x108,
485};
486
487/*
488 * (microMIPS) POOL32F secondary minor opcodes.
489 */
490enum mm_32f_40_minor_op {
491 mm_fmovf_op,
492 mm_fmovt_op,
493};
494
495/*
496 * (microMIPS) POOL32F secondary minor opcodes.
497 */
498enum mm_32f_60_minor_op {
499 mm_fadd_op,
500 mm_fsub_op,
501 mm_fmul_op,
502 mm_fdiv_op,
503};
504
505/*
506 * (microMIPS) POOL32F secondary minor opcodes.
507 */
508enum mm_32f_70_minor_op {
509 mm_fmovn_op,
510 mm_fmovz_op,
511};
512
513/*
514 * (microMIPS) POOL32FXF secondary minor opcodes for POOL32F.
515 */
516enum mm_32f_73_minor_op {
517 mm_fmov0_op = 0x01,
518 mm_fcvtl_op = 0x04,
519 mm_movf0_op = 0x05,
520 mm_frsqrt_op = 0x08,
521 mm_ffloorl_op = 0x0c,
522 mm_fabs0_op = 0x0d,
523 mm_fcvtw_op = 0x24,
524 mm_movt0_op = 0x25,
525 mm_fsqrt_op = 0x28,
526 mm_ffloorw_op = 0x2c,
527 mm_fneg0_op = 0x2d,
528 mm_cfc1_op = 0x40,
529 mm_frecip_op = 0x48,
530 mm_fceill_op = 0x4c,
531 mm_fcvtd0_op = 0x4d,
532 mm_ctc1_op = 0x60,
533 mm_fceilw_op = 0x6c,
534 mm_fcvts0_op = 0x6d,
535 mm_mfc1_op = 0x80,
536 mm_fmov1_op = 0x81,
537 mm_movf1_op = 0x85,
538 mm_ftruncl_op = 0x8c,
539 mm_fabs1_op = 0x8d,
540 mm_mtc1_op = 0xa0,
541 mm_movt1_op = 0xa5,
542 mm_ftruncw_op = 0xac,
543 mm_fneg1_op = 0xad,
544 mm_mfhc1_op = 0xc0,
545 mm_froundl_op = 0xcc,
546 mm_fcvtd1_op = 0xcd,
547 mm_mthc1_op = 0xe0,
548 mm_froundw_op = 0xec,
549 mm_fcvts1_op = 0xed,
550};
551
552/*
553 * (microMIPS) POOL32S minor opcodes.
554 */
555enum mm_32s_minor_op {
556 mm_32s_elm_op = 0x16,
557};
558
559/*
560 * (microMIPS) POOL16C minor opcodes.
561 */
562enum mm_16c_minor_op {
563 mm_lwm16_op = 0x04,
564 mm_swm16_op = 0x05,
565 mm_jr16_op = 0x0c,
566 mm_jrc_op = 0x0d,
567 mm_jalr16_op = 0x0e,
568 mm_jalrs16_op = 0x0f,
569 mm_jraddiusp_op = 0x18,
570};
571
572/*
573 * (microMIPS) POOL16D minor opcodes.
574 */
575enum mm_16d_minor_op {
576 mm_addius5_func,
577 mm_addiusp_func,
578};
579
580/*
581 * (MIPS16e) opcodes.
582 */
583enum MIPS16e_ops {
584 MIPS16e_jal_op = 003,
585 MIPS16e_ld_op = 007,
586 MIPS16e_i8_op = 014,
587 MIPS16e_sd_op = 017,
588 MIPS16e_lb_op = 020,
589 MIPS16e_lh_op = 021,
590 MIPS16e_lwsp_op = 022,
591 MIPS16e_lw_op = 023,
592 MIPS16e_lbu_op = 024,
593 MIPS16e_lhu_op = 025,
594 MIPS16e_lwpc_op = 026,
595 MIPS16e_lwu_op = 027,
596 MIPS16e_sb_op = 030,
597 MIPS16e_sh_op = 031,
598 MIPS16e_swsp_op = 032,
599 MIPS16e_sw_op = 033,
600 MIPS16e_rr_op = 035,
601 MIPS16e_extend_op = 036,
602 MIPS16e_i64_op = 037,
603};
604
605enum MIPS16e_i64_func {
606 MIPS16e_ldsp_func,
607 MIPS16e_sdsp_func,
608 MIPS16e_sdrasp_func,
609 MIPS16e_dadjsp_func,
610 MIPS16e_ldpc_func,
611};
612
613enum MIPS16e_rr_func {
614 MIPS16e_jr_func,
615};
616
617enum MIPS6e_i8_func {
618 MIPS16e_swrasp_func = 02,
619};
620
621/*
622 * (microMIPS) NOP instruction.
623 */
624#define MM_NOP16 0x0c00
625
626struct j_format {
627 __BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */
628 __BITFIELD_FIELD(unsigned int target : 26,
629 ;))
630};
631
632struct i_format { /* signed immediate format */
633 __BITFIELD_FIELD(unsigned int opcode : 6,
634 __BITFIELD_FIELD(unsigned int rs : 5,
635 __BITFIELD_FIELD(unsigned int rt : 5,
636 __BITFIELD_FIELD(signed int simmediate : 16,
637 ;))))
638};
639
640struct u_format { /* unsigned immediate format */
641 __BITFIELD_FIELD(unsigned int opcode : 6,
642 __BITFIELD_FIELD(unsigned int rs : 5,
643 __BITFIELD_FIELD(unsigned int rt : 5,
644 __BITFIELD_FIELD(unsigned int uimmediate : 16,
645 ;))))
646};
647
648struct c_format { /* Cache (>= R6000) format */
649 __BITFIELD_FIELD(unsigned int opcode : 6,
650 __BITFIELD_FIELD(unsigned int rs : 5,
651 __BITFIELD_FIELD(unsigned int c_op : 3,
652 __BITFIELD_FIELD(unsigned int cache : 2,
653 __BITFIELD_FIELD(unsigned int simmediate : 16,
654 ;)))))
655};
656
657struct r_format { /* Register format */
658 __BITFIELD_FIELD(unsigned int opcode : 6,
659 __BITFIELD_FIELD(unsigned int rs : 5,
660 __BITFIELD_FIELD(unsigned int rt : 5,
661 __BITFIELD_FIELD(unsigned int rd : 5,
662 __BITFIELD_FIELD(unsigned int re : 5,
663 __BITFIELD_FIELD(unsigned int func : 6,
664 ;))))))
665};
666
667struct c0r_format { /* C0 register format */
668 __BITFIELD_FIELD(unsigned int opcode : 6,
669 __BITFIELD_FIELD(unsigned int rs : 5,
670 __BITFIELD_FIELD(unsigned int rt : 5,
671 __BITFIELD_FIELD(unsigned int rd : 5,
672 __BITFIELD_FIELD(unsigned int z: 8,
673 __BITFIELD_FIELD(unsigned int sel : 3,
674 ;))))))
675};
676
677struct mfmc0_format { /* MFMC0 register format */
678 __BITFIELD_FIELD(unsigned int opcode : 6,
679 __BITFIELD_FIELD(unsigned int rs : 5,
680 __BITFIELD_FIELD(unsigned int rt : 5,
681 __BITFIELD_FIELD(unsigned int rd : 5,
682 __BITFIELD_FIELD(unsigned int re : 5,
683 __BITFIELD_FIELD(unsigned int sc : 1,
684 __BITFIELD_FIELD(unsigned int : 2,
685 __BITFIELD_FIELD(unsigned int sel : 3,
686 ;))))))))
687};
688
689struct co_format { /* C0 CO format */
690 __BITFIELD_FIELD(unsigned int opcode : 6,
691 __BITFIELD_FIELD(unsigned int co : 1,
692 __BITFIELD_FIELD(unsigned int code : 19,
693 __BITFIELD_FIELD(unsigned int func : 6,
694 ;))))
695};
696
697struct p_format { /* Performance counter format (R10000) */
698 __BITFIELD_FIELD(unsigned int opcode : 6,
699 __BITFIELD_FIELD(unsigned int rs : 5,
700 __BITFIELD_FIELD(unsigned int rt : 5,
701 __BITFIELD_FIELD(unsigned int rd : 5,
702 __BITFIELD_FIELD(unsigned int re : 5,
703 __BITFIELD_FIELD(unsigned int func : 6,
704 ;))))))
705};
706
707struct f_format { /* FPU register format */
708 __BITFIELD_FIELD(unsigned int opcode : 6,
709 __BITFIELD_FIELD(unsigned int : 1,
710 __BITFIELD_FIELD(unsigned int fmt : 4,
711 __BITFIELD_FIELD(unsigned int rt : 5,
712 __BITFIELD_FIELD(unsigned int rd : 5,
713 __BITFIELD_FIELD(unsigned int re : 5,
714 __BITFIELD_FIELD(unsigned int func : 6,
715 ;)))))))
716};
717
718struct ma_format { /* FPU multiply and add format (MIPS IV) */
719 __BITFIELD_FIELD(unsigned int opcode : 6,
720 __BITFIELD_FIELD(unsigned int fr : 5,
721 __BITFIELD_FIELD(unsigned int ft : 5,
722 __BITFIELD_FIELD(unsigned int fs : 5,
723 __BITFIELD_FIELD(unsigned int fd : 5,
724 __BITFIELD_FIELD(unsigned int func : 4,
725 __BITFIELD_FIELD(unsigned int fmt : 2,
726 ;)))))))
727};
728
729struct b_format { /* BREAK and SYSCALL */
730 __BITFIELD_FIELD(unsigned int opcode : 6,
731 __BITFIELD_FIELD(unsigned int code : 20,
732 __BITFIELD_FIELD(unsigned int func : 6,
733 ;)))
734};
735
736struct ps_format { /* MIPS-3D / paired single format */
737 __BITFIELD_FIELD(unsigned int opcode : 6,
738 __BITFIELD_FIELD(unsigned int rs : 5,
739 __BITFIELD_FIELD(unsigned int ft : 5,
740 __BITFIELD_FIELD(unsigned int fs : 5,
741 __BITFIELD_FIELD(unsigned int fd : 5,
742 __BITFIELD_FIELD(unsigned int func : 6,
743 ;))))))
744};
745
746struct v_format { /* MDMX vector format */
747 __BITFIELD_FIELD(unsigned int opcode : 6,
748 __BITFIELD_FIELD(unsigned int sel : 4,
749 __BITFIELD_FIELD(unsigned int fmt : 1,
750 __BITFIELD_FIELD(unsigned int vt : 5,
751 __BITFIELD_FIELD(unsigned int vs : 5,
752 __BITFIELD_FIELD(unsigned int vd : 5,
753 __BITFIELD_FIELD(unsigned int func : 6,
754 ;)))))))
755};
756
757struct msa_mi10_format { /* MSA MI10 */
758 __BITFIELD_FIELD(unsigned int opcode : 6,
759 __BITFIELD_FIELD(signed int s10 : 10,
760 __BITFIELD_FIELD(unsigned int rs : 5,
761 __BITFIELD_FIELD(unsigned int wd : 5,
762 __BITFIELD_FIELD(unsigned int func : 4,
763 __BITFIELD_FIELD(unsigned int df : 2,
764 ;))))))
765};
766
767struct dsp_format { /* SPEC3 DSP format instructions */
768 __BITFIELD_FIELD(unsigned int opcode : 6,
769 __BITFIELD_FIELD(unsigned int base : 5,
770 __BITFIELD_FIELD(unsigned int index : 5,
771 __BITFIELD_FIELD(unsigned int rd : 5,
772 __BITFIELD_FIELD(unsigned int op : 5,
773 __BITFIELD_FIELD(unsigned int func : 6,
774 ;))))))
775};
776
777struct spec3_format { /* SPEC3 */
778 __BITFIELD_FIELD(unsigned int opcode:6,
779 __BITFIELD_FIELD(unsigned int rs:5,
780 __BITFIELD_FIELD(unsigned int rt:5,
781 __BITFIELD_FIELD(signed int simmediate:9,
782 __BITFIELD_FIELD(unsigned int func:7,
783 ;)))))
784};
785
786/*
787 * microMIPS instruction formats (32-bit length)
788 *
789 * NOTE:
790 * Parenthesis denote whether the format is a microMIPS instruction or
791 * if it is MIPS32 instruction re-encoded for use in the microMIPS ASE.
792 */
793struct fb_format { /* FPU branch format (MIPS32) */
794 __BITFIELD_FIELD(unsigned int opcode : 6,
795 __BITFIELD_FIELD(unsigned int bc : 5,
796 __BITFIELD_FIELD(unsigned int cc : 3,
797 __BITFIELD_FIELD(unsigned int flag : 2,
798 __BITFIELD_FIELD(signed int simmediate : 16,
799 ;)))))
800};
801
802struct fp0_format { /* FPU multiply and add format (MIPS32) */
803 __BITFIELD_FIELD(unsigned int opcode : 6,
804 __BITFIELD_FIELD(unsigned int fmt : 5,
805 __BITFIELD_FIELD(unsigned int ft : 5,
806 __BITFIELD_FIELD(unsigned int fs : 5,
807 __BITFIELD_FIELD(unsigned int fd : 5,
808 __BITFIELD_FIELD(unsigned int func : 6,
809 ;))))))
810};
811
812struct mm_fp0_format { /* FPU multiply and add format (microMIPS) */
813 __BITFIELD_FIELD(unsigned int opcode : 6,
814 __BITFIELD_FIELD(unsigned int ft : 5,
815 __BITFIELD_FIELD(unsigned int fs : 5,
816 __BITFIELD_FIELD(unsigned int fd : 5,
817 __BITFIELD_FIELD(unsigned int fmt : 3,
818 __BITFIELD_FIELD(unsigned int op : 2,
819 __BITFIELD_FIELD(unsigned int func : 6,
820 ;)))))))
821};
822
823struct fp1_format { /* FPU mfc1 and cfc1 format (MIPS32) */
824 __BITFIELD_FIELD(unsigned int opcode : 6,
825 __BITFIELD_FIELD(unsigned int op : 5,
826 __BITFIELD_FIELD(unsigned int rt : 5,
827 __BITFIELD_FIELD(unsigned int fs : 5,
828 __BITFIELD_FIELD(unsigned int fd : 5,
829 __BITFIELD_FIELD(unsigned int func : 6,
830 ;))))))
831};
832
833struct mm_fp1_format { /* FPU mfc1 and cfc1 format (microMIPS) */
834 __BITFIELD_FIELD(unsigned int opcode : 6,
835 __BITFIELD_FIELD(unsigned int rt : 5,
836 __BITFIELD_FIELD(unsigned int fs : 5,
837 __BITFIELD_FIELD(unsigned int fmt : 2,
838 __BITFIELD_FIELD(unsigned int op : 8,
839 __BITFIELD_FIELD(unsigned int func : 6,
840 ;))))))
841};
842
843struct mm_fp2_format { /* FPU movt and movf format (microMIPS) */
844 __BITFIELD_FIELD(unsigned int opcode : 6,
845 __BITFIELD_FIELD(unsigned int fd : 5,
846 __BITFIELD_FIELD(unsigned int fs : 5,
847 __BITFIELD_FIELD(unsigned int cc : 3,
848 __BITFIELD_FIELD(unsigned int zero : 2,
849 __BITFIELD_FIELD(unsigned int fmt : 2,
850 __BITFIELD_FIELD(unsigned int op : 3,
851 __BITFIELD_FIELD(unsigned int func : 6,
852 ;))))))))
853};
854
855struct mm_fp3_format { /* FPU abs and neg format (microMIPS) */
856 __BITFIELD_FIELD(unsigned int opcode : 6,
857 __BITFIELD_FIELD(unsigned int rt : 5,
858 __BITFIELD_FIELD(unsigned int fs : 5,
859 __BITFIELD_FIELD(unsigned int fmt : 3,
860 __BITFIELD_FIELD(unsigned int op : 7,
861 __BITFIELD_FIELD(unsigned int func : 6,
862 ;))))))
863};
864
865struct mm_fp4_format { /* FPU c.cond format (microMIPS) */
866 __BITFIELD_FIELD(unsigned int opcode : 6,
867 __BITFIELD_FIELD(unsigned int rt : 5,
868 __BITFIELD_FIELD(unsigned int fs : 5,
869 __BITFIELD_FIELD(unsigned int cc : 3,
870 __BITFIELD_FIELD(unsigned int fmt : 3,
871 __BITFIELD_FIELD(unsigned int cond : 4,
872 __BITFIELD_FIELD(unsigned int func : 6,
873 ;)))))))
874};
875
876struct mm_fp5_format { /* FPU lwxc1 and swxc1 format (microMIPS) */
877 __BITFIELD_FIELD(unsigned int opcode : 6,
878 __BITFIELD_FIELD(unsigned int index : 5,
879 __BITFIELD_FIELD(unsigned int base : 5,
880 __BITFIELD_FIELD(unsigned int fd : 5,
881 __BITFIELD_FIELD(unsigned int op : 5,
882 __BITFIELD_FIELD(unsigned int func : 6,
883 ;))))))
884};
885
886struct fp6_format { /* FPU madd and msub format (MIPS IV) */
887 __BITFIELD_FIELD(unsigned int opcode : 6,
888 __BITFIELD_FIELD(unsigned int fr : 5,
889 __BITFIELD_FIELD(unsigned int ft : 5,
890 __BITFIELD_FIELD(unsigned int fs : 5,
891 __BITFIELD_FIELD(unsigned int fd : 5,
892 __BITFIELD_FIELD(unsigned int func : 6,
893 ;))))))
894};
895
896struct mm_fp6_format { /* FPU madd and msub format (microMIPS) */
897 __BITFIELD_FIELD(unsigned int opcode : 6,
898 __BITFIELD_FIELD(unsigned int ft : 5,
899 __BITFIELD_FIELD(unsigned int fs : 5,
900 __BITFIELD_FIELD(unsigned int fd : 5,
901 __BITFIELD_FIELD(unsigned int fr : 5,
902 __BITFIELD_FIELD(unsigned int func : 6,
903 ;))))))
904};
905
906struct mm_i_format { /* Immediate format (microMIPS) */
907 __BITFIELD_FIELD(unsigned int opcode : 6,
908 __BITFIELD_FIELD(unsigned int rt : 5,
909 __BITFIELD_FIELD(unsigned int rs : 5,
910 __BITFIELD_FIELD(signed int simmediate : 16,
911 ;))))
912};
913
914struct mm_m_format { /* Multi-word load/store format (microMIPS) */
915 __BITFIELD_FIELD(unsigned int opcode : 6,
916 __BITFIELD_FIELD(unsigned int rd : 5,
917 __BITFIELD_FIELD(unsigned int base : 5,
918 __BITFIELD_FIELD(unsigned int func : 4,
919 __BITFIELD_FIELD(signed int simmediate : 12,
920 ;)))))
921};
922
923struct mm_x_format { /* Scaled indexed load format (microMIPS) */
924 __BITFIELD_FIELD(unsigned int opcode : 6,
925 __BITFIELD_FIELD(unsigned int index : 5,
926 __BITFIELD_FIELD(unsigned int base : 5,
927 __BITFIELD_FIELD(unsigned int rd : 5,
928 __BITFIELD_FIELD(unsigned int func : 11,
929 ;)))))
930};
931
932struct mm_a_format { /* ADDIUPC format (microMIPS) */
933 __BITFIELD_FIELD(unsigned int opcode : 6,
934 __BITFIELD_FIELD(unsigned int rs : 3,
935 __BITFIELD_FIELD(signed int simmediate : 23,
936 ;)))
937};
938
939/*
940 * microMIPS instruction formats (16-bit length)
941 */
942struct mm_b0_format { /* Unconditional branch format (microMIPS) */
943 __BITFIELD_FIELD(unsigned int opcode : 6,
944 __BITFIELD_FIELD(signed int simmediate : 10,
945 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
946 ;)))
947};
948
949struct mm_b1_format { /* Conditional branch format (microMIPS) */
950 __BITFIELD_FIELD(unsigned int opcode : 6,
951 __BITFIELD_FIELD(unsigned int rs : 3,
952 __BITFIELD_FIELD(signed int simmediate : 7,
953 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
954 ;))))
955};
956
957struct mm16_m_format { /* Multi-word load/store format */
958 __BITFIELD_FIELD(unsigned int opcode : 6,
959 __BITFIELD_FIELD(unsigned int func : 4,
960 __BITFIELD_FIELD(unsigned int rlist : 2,
961 __BITFIELD_FIELD(unsigned int imm : 4,
962 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
963 ;)))))
964};
965
966struct mm16_rb_format { /* Signed immediate format */
967 __BITFIELD_FIELD(unsigned int opcode : 6,
968 __BITFIELD_FIELD(unsigned int rt : 3,
969 __BITFIELD_FIELD(unsigned int base : 3,
970 __BITFIELD_FIELD(signed int simmediate : 4,
971 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
972 ;)))))
973};
974
975struct mm16_r3_format { /* Load from global pointer format */
976 __BITFIELD_FIELD(unsigned int opcode : 6,
977 __BITFIELD_FIELD(unsigned int rt : 3,
978 __BITFIELD_FIELD(signed int simmediate : 7,
979 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
980 ;))))
981};
982
983struct mm16_r5_format { /* Load/store from stack pointer format */
984 __BITFIELD_FIELD(unsigned int opcode : 6,
985 __BITFIELD_FIELD(unsigned int rt : 5,
986 __BITFIELD_FIELD(unsigned int imm : 5,
987 __BITFIELD_FIELD(unsigned int : 16, /* Ignored */
988 ;))))
989};
990
991/*
992 * Loongson-3 overridden COP2 instruction formats (32-bit length)
993 */
994struct loongson3_lswc2_format { /* Loongson-3 overridden lwc2/swc2 Load/Store format */
995 __BITFIELD_FIELD(unsigned int opcode : 6,
996 __BITFIELD_FIELD(unsigned int base : 5,
997 __BITFIELD_FIELD(unsigned int rt : 5,
998 __BITFIELD_FIELD(unsigned int fr : 1,
999 __BITFIELD_FIELD(unsigned int offset : 9,
1000 __BITFIELD_FIELD(unsigned int ls : 1,
1001 __BITFIELD_FIELD(unsigned int rq : 5,
1002 ;)))))))
1003};
1004
1005struct loongson3_lsdc2_format { /* Loongson-3 overridden ldc2/sdc2 Load/Store format */
1006 __BITFIELD_FIELD(unsigned int opcode : 6,
1007 __BITFIELD_FIELD(unsigned int base : 5,
1008 __BITFIELD_FIELD(unsigned int rt : 5,
1009 __BITFIELD_FIELD(unsigned int index : 5,
1010 __BITFIELD_FIELD(unsigned int offset : 8,
1011 __BITFIELD_FIELD(unsigned int opcode1 : 3,
1012 ;))))))
1013};
1014
1015struct loongson3_lscsr_format { /* Loongson-3 CPUCFG&CSR read/write format */
1016 __BITFIELD_FIELD(unsigned int opcode : 6,
1017 __BITFIELD_FIELD(unsigned int rs : 5,
1018 __BITFIELD_FIELD(unsigned int fr : 5,
1019 __BITFIELD_FIELD(unsigned int rd : 5,
1020 __BITFIELD_FIELD(unsigned int fd : 5,
1021 __BITFIELD_FIELD(unsigned int func : 6,
1022 ;))))))
1023};
1024
1025/*
1026 * MIPS16e instruction formats (16-bit length)
1027 */
1028struct m16e_rr {
1029 __BITFIELD_FIELD(unsigned int opcode : 5,
1030 __BITFIELD_FIELD(unsigned int rx : 3,
1031 __BITFIELD_FIELD(unsigned int nd : 1,
1032 __BITFIELD_FIELD(unsigned int l : 1,
1033 __BITFIELD_FIELD(unsigned int ra : 1,
1034 __BITFIELD_FIELD(unsigned int func : 5,
1035 ;))))))
1036};
1037
1038struct m16e_jal {
1039 __BITFIELD_FIELD(unsigned int opcode : 5,
1040 __BITFIELD_FIELD(unsigned int x : 1,
1041 __BITFIELD_FIELD(unsigned int imm20_16 : 5,
1042 __BITFIELD_FIELD(signed int imm25_21 : 5,
1043 ;))))
1044};
1045
1046struct m16e_i64 {
1047 __BITFIELD_FIELD(unsigned int opcode : 5,
1048 __BITFIELD_FIELD(unsigned int func : 3,
1049 __BITFIELD_FIELD(unsigned int imm : 8,
1050 ;)))
1051};
1052
1053struct m16e_ri64 {
1054 __BITFIELD_FIELD(unsigned int opcode : 5,
1055 __BITFIELD_FIELD(unsigned int func : 3,
1056 __BITFIELD_FIELD(unsigned int ry : 3,
1057 __BITFIELD_FIELD(unsigned int imm : 5,
1058 ;))))
1059};
1060
1061struct m16e_ri {
1062 __BITFIELD_FIELD(unsigned int opcode : 5,
1063 __BITFIELD_FIELD(unsigned int rx : 3,
1064 __BITFIELD_FIELD(unsigned int imm : 8,
1065 ;)))
1066};
1067
1068struct m16e_rri {
1069 __BITFIELD_FIELD(unsigned int opcode : 5,
1070 __BITFIELD_FIELD(unsigned int rx : 3,
1071 __BITFIELD_FIELD(unsigned int ry : 3,
1072 __BITFIELD_FIELD(unsigned int imm : 5,
1073 ;))))
1074};
1075
1076struct m16e_i8 {
1077 __BITFIELD_FIELD(unsigned int opcode : 5,
1078 __BITFIELD_FIELD(unsigned int func : 3,
1079 __BITFIELD_FIELD(unsigned int imm : 8,
1080 ;)))
1081};
1082
1083union mips_instruction {
1084 unsigned int word;
1085 unsigned short halfword[2];
1086 unsigned char byte[4];
1087 struct j_format j_format;
1088 struct i_format i_format;
1089 struct u_format u_format;
1090 struct c_format c_format;
1091 struct r_format r_format;
1092 struct c0r_format c0r_format;
1093 struct mfmc0_format mfmc0_format;
1094 struct co_format co_format;
1095 struct p_format p_format;
1096 struct f_format f_format;
1097 struct ma_format ma_format;
1098 struct msa_mi10_format msa_mi10_format;
1099 struct b_format b_format;
1100 struct ps_format ps_format;
1101 struct v_format v_format;
1102 struct dsp_format dsp_format;
1103 struct spec3_format spec3_format;
1104 struct fb_format fb_format;
1105 struct fp0_format fp0_format;
1106 struct mm_fp0_format mm_fp0_format;
1107 struct fp1_format fp1_format;
1108 struct mm_fp1_format mm_fp1_format;
1109 struct mm_fp2_format mm_fp2_format;
1110 struct mm_fp3_format mm_fp3_format;
1111 struct mm_fp4_format mm_fp4_format;
1112 struct mm_fp5_format mm_fp5_format;
1113 struct fp6_format fp6_format;
1114 struct mm_fp6_format mm_fp6_format;
1115 struct mm_i_format mm_i_format;
1116 struct mm_m_format mm_m_format;
1117 struct mm_x_format mm_x_format;
1118 struct mm_a_format mm_a_format;
1119 struct mm_b0_format mm_b0_format;
1120 struct mm_b1_format mm_b1_format;
1121 struct mm16_m_format mm16_m_format ;
1122 struct mm16_rb_format mm16_rb_format;
1123 struct mm16_r3_format mm16_r3_format;
1124 struct mm16_r5_format mm16_r5_format;
1125 struct loongson3_lswc2_format loongson3_lswc2_format;
1126 struct loongson3_lsdc2_format loongson3_lsdc2_format;
1127 struct loongson3_lscsr_format loongson3_lscsr_format;
1128};
1129
1130union mips16e_instruction {
1131 unsigned int full : 16;
1132 struct m16e_rr rr;
1133 struct m16e_jal jal;
1134 struct m16e_i64 i64;
1135 struct m16e_ri64 ri64;
1136 struct m16e_ri ri;
1137 struct m16e_rri rri;
1138 struct m16e_i8 i8;
1139};
1140
1141#endif /* _UAPI_ASM_INST_H */
diff --git a/arch/mips/include/uapi/asm/ioctl.h b/arch/mips/include/uapi/asm/ioctl.h
new file mode 100644
index 000000000..1050a6ea2
--- /dev/null
+++ b/arch/mips/include/uapi/asm/ioctl.h
@@ -0,0 +1,28 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 96, 99, 2001 Ralf Baechle <ralf@linux-mips.org>
8 * Copyright (C) 2009 Wind River Systems
9 * Written by Ralf Baechle <ralf@linux-mips.org>
10 */
11#ifndef __ASM_IOCTL_H
12#define __ASM_IOCTL_H
13
14#define _IOC_SIZEBITS 13
15#define _IOC_DIRBITS 3
16
17/*
18 * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
19 * And this turns out useful to catch old ioctl numbers in header
20 * files for us.
21 */
22#define _IOC_NONE 1U
23#define _IOC_READ 2U
24#define _IOC_WRITE 4U
25
26#include <asm-generic/ioctl.h>
27
28#endif /* __ASM_IOCTL_H */
diff --git a/arch/mips/include/uapi/asm/ioctls.h b/arch/mips/include/uapi/asm/ioctls.h
new file mode 100644
index 000000000..16aa8a766
--- /dev/null
+++ b/arch/mips/include/uapi/asm/ioctls.h
@@ -0,0 +1,119 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 1996, 2001 Ralf Baechle
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#ifndef __ASM_IOCTLS_H
11#define __ASM_IOCTLS_H
12
13#include <asm/ioctl.h>
14
15#define TCGETA 0x5401
16#define TCSETA 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
17#define TCSETAW 0x5403
18#define TCSETAF 0x5404
19
20#define TCSBRK 0x5405
21#define TCXONC 0x5406
22#define TCFLSH 0x5407
23
24#define TCGETS 0x540d
25#define TCSETS 0x540e
26#define TCSETSW 0x540f
27#define TCSETSF 0x5410
28
29#define TIOCEXCL 0x740d /* set exclusive use of tty */
30#define TIOCNXCL 0x740e /* reset exclusive use of tty */
31#define TIOCOUTQ 0x7472 /* output queue size */
32#define TIOCSTI 0x5472 /* simulate terminal input */
33#define TIOCMGET 0x741d /* get all modem bits */
34#define TIOCMBIS 0x741b /* bis modem bits */
35#define TIOCMBIC 0x741c /* bic modem bits */
36#define TIOCMSET 0x741a /* set all modem bits */
37#define TIOCPKT 0x5470 /* pty: set/clear packet mode */
38#define TIOCPKT_DATA 0x00 /* data packet */
39#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
40#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
41#define TIOCPKT_STOP 0x04 /* stop output */
42#define TIOCPKT_START 0x08 /* start output */
43#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
44#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
45#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */
46#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
47#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
48#define TIOCNOTTY 0x5471 /* void tty association */
49#define TIOCSETD 0x7401
50#define TIOCGETD 0x7400
51
52#define FIOCLEX 0x6601
53#define FIONCLEX 0x6602
54#define FIOASYNC 0x667d
55#define FIONBIO 0x667e
56#define FIOQSIZE 0x667f
57
58#define TIOCGLTC 0x7474 /* get special local chars */
59#define TIOCSLTC 0x7475 /* set special local chars */
60#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
61#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
62#define TIOCCONS _IOW('t', 120, int) /* become virtual console */
63
64#define FIONREAD 0x467f
65#define TIOCINQ FIONREAD
66
67#define TIOCGETP 0x7408
68#define TIOCSETP 0x7409
69#define TIOCSETN 0x740a /* TIOCSETP wo flush */
70
71/* #define TIOCSETA _IOW('t', 20, struct termios) set termios struct */
72/* #define TIOCSETAW _IOW('t', 21, struct termios) drain output, set */
73/* #define TIOCSETAF _IOW('t', 22, struct termios) drn out, fls in, set */
74/* #define TIOCGETD _IOR('t', 26, int) get line discipline */
75/* #define TIOCSETD _IOW('t', 27, int) set line discipline */
76 /* 127-124 compat */
77
78#define TIOCSBRK 0x5427 /* BSD compatibility */
79#define TIOCCBRK 0x5428 /* BSD compatibility */
80#define TIOCGSID 0x7416 /* Return the session ID of FD */
81#define TCGETS2 _IOR('T', 0x2A, struct termios2)
82#define TCSETS2 _IOW('T', 0x2B, struct termios2)
83#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
84#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
85#define TIOCGRS485 _IOR('T', 0x2E, struct serial_rs485)
86#define TIOCSRS485 _IOWR('T', 0x2F, struct serial_rs485)
87#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
88#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
89#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
90#define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */
91#define TIOCVHANGUP 0x5437
92#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
93#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
94#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
95#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
96#define TIOCGISO7816 _IOR('T', 0x42, struct serial_iso7816)
97#define TIOCSISO7816 _IOWR('T', 0x43, struct serial_iso7816)
98
99/* I hope the range from 0x5480 on is free ... */
100#define TIOCSCTTY 0x5480 /* become controlling tty */
101#define TIOCGSOFTCAR 0x5481
102#define TIOCSSOFTCAR 0x5482
103#define TIOCLINUX 0x5483
104#define TIOCGSERIAL 0x5484
105#define TIOCSSERIAL 0x5485
106#define TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */
107#define TIOCSERCONFIG 0x5488
108#define TIOCSERGWILD 0x5489
109#define TIOCSERSWILD 0x548a
110#define TIOCGLCKTRMIOS 0x548b
111#define TIOCSLCKTRMIOS 0x548c
112#define TIOCSERGSTRUCT 0x548d /* For debugging only */
113#define TIOCSERGETLSR 0x548e /* Get line status register */
114#define TIOCSERGETMULTI 0x548f /* Get multiport config */
115#define TIOCSERSETMULTI 0x5490 /* Set multiport config */
116#define TIOCMIWAIT 0x5491 /* wait for a change on serial input line(s) */
117#define TIOCGICOUNT 0x5492 /* read serial port inline interrupt counts */
118
119#endif /* __ASM_IOCTLS_H */
diff --git a/arch/mips/include/uapi/asm/kvm.h b/arch/mips/include/uapi/asm/kvm.h
new file mode 100644
index 000000000..edcf717c4
--- /dev/null
+++ b/arch/mips/include/uapi/asm/kvm.h
@@ -0,0 +1,227 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
8 * Copyright (C) 2013 Cavium, Inc.
9 * Authors: Sanjay Lal <sanjayl@kymasys.com>
10 */
11
12#ifndef __LINUX_KVM_MIPS_H
13#define __LINUX_KVM_MIPS_H
14
15#include <linux/types.h>
16
17/*
18 * KVM MIPS specific structures and definitions.
19 *
20 * Some parts derived from the x86 version of this file.
21 */
22
23#define __KVM_HAVE_READONLY_MEM
24
25#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
26
27/*
28 * for KVM_GET_REGS and KVM_SET_REGS
29 *
30 * If Config[AT] is zero (32-bit CPU), the register contents are
31 * stored in the lower 32-bits of the struct kvm_regs fields and sign
32 * extended to 64-bits.
33 */
34struct kvm_regs {
35 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
36 __u64 gpr[32];
37 __u64 hi;
38 __u64 lo;
39 __u64 pc;
40};
41
42/*
43 * for KVM_GET_FPU and KVM_SET_FPU
44 */
45struct kvm_fpu {
46};
47
48
49/*
50 * For MIPS, we use KVM_SET_ONE_REG and KVM_GET_ONE_REG to access various
51 * registers. The id field is broken down as follows:
52 *
53 * bits[63..52] - As per linux/kvm.h
54 * bits[51..32] - Must be zero.
55 * bits[31..16] - Register set.
56 *
57 * Register set = 0: GP registers from kvm_regs (see definitions below).
58 *
59 * Register set = 1: CP0 registers.
60 * bits[15..8] - COP0 register set.
61 *
62 * COP0 register set = 0: Main CP0 registers.
63 * bits[7..3] - Register 'rd' index.
64 * bits[2..0] - Register 'sel' index.
65 *
66 * COP0 register set = 1: MAARs.
67 * bits[7..0] - MAAR index.
68 *
69 * Register set = 2: KVM specific registers (see definitions below).
70 *
71 * Register set = 3: FPU / MSA registers (see definitions below).
72 *
73 * Other sets registers may be added in the future. Each set would
74 * have its own identifier in bits[31..16].
75 */
76
77#define KVM_REG_MIPS_GP (KVM_REG_MIPS | 0x0000000000000000ULL)
78#define KVM_REG_MIPS_CP0 (KVM_REG_MIPS | 0x0000000000010000ULL)
79#define KVM_REG_MIPS_KVM (KVM_REG_MIPS | 0x0000000000020000ULL)
80#define KVM_REG_MIPS_FPU (KVM_REG_MIPS | 0x0000000000030000ULL)
81
82
83/*
84 * KVM_REG_MIPS_GP - General purpose registers from kvm_regs.
85 */
86
87#define KVM_REG_MIPS_R0 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 0)
88#define KVM_REG_MIPS_R1 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 1)
89#define KVM_REG_MIPS_R2 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 2)
90#define KVM_REG_MIPS_R3 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 3)
91#define KVM_REG_MIPS_R4 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 4)
92#define KVM_REG_MIPS_R5 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 5)
93#define KVM_REG_MIPS_R6 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 6)
94#define KVM_REG_MIPS_R7 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 7)
95#define KVM_REG_MIPS_R8 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 8)
96#define KVM_REG_MIPS_R9 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 9)
97#define KVM_REG_MIPS_R10 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 10)
98#define KVM_REG_MIPS_R11 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 11)
99#define KVM_REG_MIPS_R12 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 12)
100#define KVM_REG_MIPS_R13 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 13)
101#define KVM_REG_MIPS_R14 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 14)
102#define KVM_REG_MIPS_R15 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 15)
103#define KVM_REG_MIPS_R16 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 16)
104#define KVM_REG_MIPS_R17 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 17)
105#define KVM_REG_MIPS_R18 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 18)
106#define KVM_REG_MIPS_R19 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 19)
107#define KVM_REG_MIPS_R20 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 20)
108#define KVM_REG_MIPS_R21 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 21)
109#define KVM_REG_MIPS_R22 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 22)
110#define KVM_REG_MIPS_R23 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 23)
111#define KVM_REG_MIPS_R24 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 24)
112#define KVM_REG_MIPS_R25 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 25)
113#define KVM_REG_MIPS_R26 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 26)
114#define KVM_REG_MIPS_R27 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 27)
115#define KVM_REG_MIPS_R28 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 28)
116#define KVM_REG_MIPS_R29 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 29)
117#define KVM_REG_MIPS_R30 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 30)
118#define KVM_REG_MIPS_R31 (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 31)
119
120#define KVM_REG_MIPS_HI (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 32)
121#define KVM_REG_MIPS_LO (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 33)
122#define KVM_REG_MIPS_PC (KVM_REG_MIPS_GP | KVM_REG_SIZE_U64 | 34)
123
124
125/*
126 * KVM_REG_MIPS_CP0 - Coprocessor 0 registers.
127 */
128
129#define KVM_REG_MIPS_MAAR (KVM_REG_MIPS_CP0 | (1 << 8))
130#define KVM_REG_MIPS_CP0_MAAR(n) (KVM_REG_MIPS_MAAR | \
131 KVM_REG_SIZE_U64 | (n))
132
133
134/*
135 * KVM_REG_MIPS_KVM - KVM specific control registers.
136 */
137
138/*
139 * CP0_Count control
140 * DC: Set 0: Master disable CP0_Count and set COUNT_RESUME to now
141 * Set 1: Master re-enable CP0_Count with unchanged bias, handling timer
142 * interrupts since COUNT_RESUME
143 * This can be used to freeze the timer to get a consistent snapshot of
144 * the CP0_Count and timer interrupt pending state, while also resuming
145 * safely without losing time or guest timer interrupts.
146 * Other: Reserved, do not change.
147 */
148#define KVM_REG_MIPS_COUNT_CTL (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 0)
149#define KVM_REG_MIPS_COUNT_CTL_DC 0x00000001
150
151/*
152 * CP0_Count resume monotonic nanoseconds
153 * The monotonic nanosecond time of the last set of COUNT_CTL.DC (master
154 * disable). Any reads and writes of Count related registers while
155 * COUNT_CTL.DC=1 will appear to occur at this time. When COUNT_CTL.DC is
156 * cleared again (master enable) any timer interrupts since this time will be
157 * emulated.
158 * Modifications to times in the future are rejected.
159 */
160#define KVM_REG_MIPS_COUNT_RESUME (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 1)
161/*
162 * CP0_Count rate in Hz
163 * Specifies the rate of the CP0_Count timer in Hz. Modifications occur without
164 * discontinuities in CP0_Count.
165 */
166#define KVM_REG_MIPS_COUNT_HZ (KVM_REG_MIPS_KVM | KVM_REG_SIZE_U64 | 2)
167
168
169/*
170 * KVM_REG_MIPS_FPU - Floating Point and MIPS SIMD Architecture (MSA) registers.
171 *
172 * bits[15..8] - Register subset (see definitions below).
173 * bits[7..5] - Must be zero.
174 * bits[4..0] - Register number within register subset.
175 */
176
177#define KVM_REG_MIPS_FPR (KVM_REG_MIPS_FPU | 0x0000000000000000ULL)
178#define KVM_REG_MIPS_FCR (KVM_REG_MIPS_FPU | 0x0000000000000100ULL)
179#define KVM_REG_MIPS_MSACR (KVM_REG_MIPS_FPU | 0x0000000000000200ULL)
180
181/*
182 * KVM_REG_MIPS_FPR - Floating point / Vector registers.
183 */
184#define KVM_REG_MIPS_FPR_32(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U32 | (n))
185#define KVM_REG_MIPS_FPR_64(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U64 | (n))
186#define KVM_REG_MIPS_VEC_128(n) (KVM_REG_MIPS_FPR | KVM_REG_SIZE_U128 | (n))
187
188/*
189 * KVM_REG_MIPS_FCR - Floating point control registers.
190 */
191#define KVM_REG_MIPS_FCR_IR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 0)
192#define KVM_REG_MIPS_FCR_CSR (KVM_REG_MIPS_FCR | KVM_REG_SIZE_U32 | 31)
193
194/*
195 * KVM_REG_MIPS_MSACR - MIPS SIMD Architecture (MSA) control registers.
196 */
197#define KVM_REG_MIPS_MSA_IR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 0)
198#define KVM_REG_MIPS_MSA_CSR (KVM_REG_MIPS_MSACR | KVM_REG_SIZE_U32 | 1)
199
200
201/*
202 * KVM MIPS specific structures and definitions
203 *
204 */
205struct kvm_debug_exit_arch {
206 __u64 epc;
207};
208
209/* for KVM_SET_GUEST_DEBUG */
210struct kvm_guest_debug_arch {
211};
212
213/* definition of registers in kvm_run */
214struct kvm_sync_regs {
215};
216
217/* dummy definition */
218struct kvm_sregs {
219};
220
221struct kvm_mips_interrupt {
222 /* in */
223 __u32 cpu;
224 __u32 irq;
225};
226
227#endif /* __LINUX_KVM_MIPS_H */
diff --git a/arch/mips/include/uapi/asm/mman.h b/arch/mips/include/uapi/asm/mman.h
new file mode 100644
index 000000000..57dc2ac4f
--- /dev/null
+++ b/arch/mips/include/uapi/asm/mman.h
@@ -0,0 +1,109 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 1999, 2002 by Ralf Baechle
8 */
9#ifndef _ASM_MMAN_H
10#define _ASM_MMAN_H
11
12/*
13 * Protections are chosen from these bits, OR'd together. The
14 * implementation does not necessarily support PROT_EXEC or PROT_WRITE
15 * without PROT_READ. The only guarantees are that no writing will be
16 * allowed without PROT_WRITE and no access will be allowed for PROT_NONE.
17 */
18#define PROT_NONE 0x00 /* page can not be accessed */
19#define PROT_READ 0x01 /* page can be read */
20#define PROT_WRITE 0x02 /* page can be written */
21#define PROT_EXEC 0x04 /* page can be executed */
22/* 0x08 reserved for PROT_EXEC_NOFLUSH */
23#define PROT_SEM 0x10 /* page may be used for atomic ops */
24#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
25#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
26
27/*
28 * Flags for mmap
29 */
30/* 0x01 - 0x03 are defined in linux/mman.h */
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#define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */
50#define MAP_HUGETLB 0x80000 /* create a huge page mapping */
51#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */
52
53/*
54 * Flags for msync
55 */
56#define MS_ASYNC 0x0001 /* sync memory asynchronously */
57#define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */
58#define MS_SYNC 0x0004 /* synchronous memory sync */
59
60/*
61 * Flags for mlockall
62 */
63#define MCL_CURRENT 1 /* lock all current mappings */
64#define MCL_FUTURE 2 /* lock all future mappings */
65#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
66
67/*
68 * Flags for mlock
69 */
70#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */
71
72#define MADV_NORMAL 0 /* no further special treatment */
73#define MADV_RANDOM 1 /* expect random page references */
74#define MADV_SEQUENTIAL 2 /* expect sequential page references */
75#define MADV_WILLNEED 3 /* will need these pages */
76#define MADV_DONTNEED 4 /* don't need these pages */
77
78/* common parameters: try to keep these consistent across architectures */
79#define MADV_FREE 8 /* free pages only if memory pressure */
80#define MADV_REMOVE 9 /* remove these pages & resources */
81#define MADV_DONTFORK 10 /* don't inherit across fork */
82#define MADV_DOFORK 11 /* do inherit across fork */
83
84#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
85#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
86#define MADV_HWPOISON 100 /* poison a page for testing */
87
88#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
89#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
90
91#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
92 overrides the coredump filter bits */
93#define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */
94
95#define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */
96#define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */
97
98#define MADV_COLD 20 /* deactivate these pages */
99#define MADV_PAGEOUT 21 /* reclaim these pages */
100
101/* compatibility flags */
102#define MAP_FILE 0
103
104#define PKEY_DISABLE_ACCESS 0x1
105#define PKEY_DISABLE_WRITE 0x2
106#define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\
107 PKEY_DISABLE_WRITE)
108
109#endif /* _ASM_MMAN_H */
diff --git a/arch/mips/include/uapi/asm/msgbuf.h b/arch/mips/include/uapi/asm/msgbuf.h
new file mode 100644
index 000000000..128af72f2
--- /dev/null
+++ b/arch/mips/include/uapi/asm/msgbuf.h
@@ -0,0 +1,68 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_MSGBUF_H
3#define _ASM_MSGBUF_H
4
5#include <asm/ipcbuf.h>
6
7/*
8 * The msqid64_ds structure for the MIPS architecture.
9 * Note extra padding because this structure is passed back and forth
10 * between kernel and user space.
11 *
12 * Pad space is left for:
13 * - 2 miscellaneous unsigned long values
14 */
15
16#if defined(__mips64)
17struct msqid64_ds {
18 struct ipc64_perm msg_perm;
19 long msg_stime; /* last msgsnd time */
20 long msg_rtime; /* last msgrcv time */
21 long msg_ctime; /* last change time */
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30#elif defined (__MIPSEB__)
31struct msqid64_ds {
32 struct ipc64_perm msg_perm;
33 unsigned long msg_stime_high;
34 unsigned long msg_stime; /* last msgsnd time */
35 unsigned long msg_rtime_high;
36 unsigned long msg_rtime; /* last msgrcv time */
37 unsigned long msg_ctime_high;
38 unsigned long msg_ctime; /* last change time */
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#elif defined (__MIPSEL__)
48struct msqid64_ds {
49 struct ipc64_perm msg_perm;
50 unsigned long msg_stime; /* last msgsnd time */
51 unsigned long msg_stime_high;
52 unsigned long msg_rtime; /* last msgrcv time */
53 unsigned long msg_rtime_high;
54 unsigned long msg_ctime; /* last change time */
55 unsigned long msg_ctime_high;
56 unsigned long msg_cbytes; /* current number of bytes on queue */
57 unsigned long msg_qnum; /* number of messages in queue */
58 unsigned long msg_qbytes; /* max number of bytes on queue */
59 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
60 __kernel_pid_t msg_lrpid; /* last receive pid */
61 unsigned long __unused4;
62 unsigned long __unused5;
63};
64#else
65#warning no endianess set
66#endif
67
68#endif /* _ASM_MSGBUF_H */
diff --git a/arch/mips/include/uapi/asm/param.h b/arch/mips/include/uapi/asm/param.h
new file mode 100644
index 000000000..3f337ed66
--- /dev/null
+++ b/arch/mips/include/uapi/asm/param.h
@@ -0,0 +1,17 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright 1994 - 2000, 2002 Ralf Baechle (ralf@gnu.org)
8 * Copyright 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_PARAM_H
11#define _ASM_PARAM_H
12
13#define EXEC_PAGESIZE 65536
14
15#include <asm-generic/param.h>
16
17#endif /* _ASM_PARAM_H */
diff --git a/arch/mips/include/uapi/asm/poll.h b/arch/mips/include/uapi/asm/poll.h
new file mode 100644
index 000000000..ad289d7b7
--- /dev/null
+++ b/arch/mips/include/uapi/asm/poll.h
@@ -0,0 +1,10 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef __ASM_POLL_H
3#define __ASM_POLL_H
4
5#define POLLWRNORM POLLOUT
6#define POLLWRBAND 0x0100
7
8#include <asm-generic/poll.h>
9
10#endif /* __ASM_POLL_H */
diff --git a/arch/mips/include/uapi/asm/posix_types.h b/arch/mips/include/uapi/asm/posix_types.h
new file mode 100644
index 000000000..f0ccb5b90
--- /dev/null
+++ b/arch/mips/include/uapi/asm/posix_types.h
@@ -0,0 +1,26 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1996, 97, 98, 99, 2000 by Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_POSIX_TYPES_H
11#define _ASM_POSIX_TYPES_H
12
13#include <asm/sgidefs.h>
14
15/*
16 * This file is generally used by user-level software, so you need to
17 * be a little careful about namespace pollution etc. Also, we cannot
18 * assume GCC is being used.
19 */
20
21typedef long __kernel_daddr_t;
22#define __kernel_daddr_t __kernel_daddr_t
23
24#include <asm-generic/posix_types.h>
25
26#endif /* _ASM_POSIX_TYPES_H */
diff --git a/arch/mips/include/uapi/asm/ptrace.h b/arch/mips/include/uapi/asm/ptrace.h
new file mode 100644
index 000000000..f3c025445
--- /dev/null
+++ b/arch/mips/include/uapi/asm/ptrace.h
@@ -0,0 +1,109 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 by Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _UAPI_ASM_PTRACE_H
11#define _UAPI_ASM_PTRACE_H
12
13#include <linux/types.h>
14
15/* 0 - 31 are integer registers, 32 - 63 are fp registers. */
16#define FPR_BASE 32
17#define PC 64
18#define CAUSE 65
19#define BADVADDR 66
20#define MMHI 67
21#define MMLO 68
22#define FPC_CSR 69
23#define FPC_EIR 70
24#define DSP_BASE 71 /* 3 more hi / lo register pairs */
25#define DSP_CONTROL 77
26#define ACX 78
27
28/*
29 * This struct defines the registers as used by PTRACE_{GET,SET}REGS. The
30 * format is the same for both 32- and 64-bit processes. Registers for 32-bit
31 * processes are sign extended.
32 */
33#ifdef __KERNEL__
34struct user_pt_regs {
35#else
36struct pt_regs {
37#endif
38 /* Saved main processor registers. */
39 __u64 regs[32];
40
41 /* Saved special registers. */
42 __u64 lo;
43 __u64 hi;
44 __u64 cp0_epc;
45 __u64 cp0_badvaddr;
46 __u64 cp0_status;
47 __u64 cp0_cause;
48} __attribute__ ((aligned (8)));
49
50/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
51#define PTRACE_GETREGS 12
52#define PTRACE_SETREGS 13
53#define PTRACE_GETFPREGS 14
54#define PTRACE_SETFPREGS 15
55/* #define PTRACE_GETFPXREGS 18 */
56/* #define PTRACE_SETFPXREGS 19 */
57
58#define PTRACE_OLDSETOPTIONS 21
59
60#define PTRACE_GET_THREAD_AREA 25
61#define PTRACE_SET_THREAD_AREA 26
62
63/* Calls to trace a 64bit program from a 32bit program. */
64#define PTRACE_PEEKTEXT_3264 0xc0
65#define PTRACE_PEEKDATA_3264 0xc1
66#define PTRACE_POKETEXT_3264 0xc2
67#define PTRACE_POKEDATA_3264 0xc3
68#define PTRACE_GET_THREAD_AREA_3264 0xc4
69
70/* Read and write watchpoint registers. */
71enum pt_watch_style {
72 pt_watch_style_mips32,
73 pt_watch_style_mips64
74};
75struct mips32_watch_regs {
76 unsigned int watchlo[8];
77 /* Lower 16 bits of watchhi. */
78 unsigned short watchhi[8];
79 /* Valid mask and I R W bits.
80 * bit 0 -- 1 if W bit is usable.
81 * bit 1 -- 1 if R bit is usable.
82 * bit 2 -- 1 if I bit is usable.
83 * bits 3 - 11 -- Valid watchhi mask bits.
84 */
85 unsigned short watch_masks[8];
86 /* The number of valid watch register pairs. */
87 unsigned int num_valid;
88} __attribute__((aligned(8)));
89
90struct mips64_watch_regs {
91 unsigned long long watchlo[8];
92 unsigned short watchhi[8];
93 unsigned short watch_masks[8];
94 unsigned int num_valid;
95} __attribute__((aligned(8)));
96
97struct pt_watch_regs {
98 enum pt_watch_style style;
99 union {
100 struct mips32_watch_regs mips32;
101 struct mips64_watch_regs mips64;
102 };
103};
104
105#define PTRACE_GET_WATCH_REGS 0xd0
106#define PTRACE_SET_WATCH_REGS 0xd1
107
108
109#endif /* _UAPI_ASM_PTRACE_H */
diff --git a/arch/mips/include/uapi/asm/reg.h b/arch/mips/include/uapi/asm/reg.h
new file mode 100644
index 000000000..56d15cb81
--- /dev/null
+++ b/arch/mips/include/uapi/asm/reg.h
@@ -0,0 +1,207 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * Various register offset definitions for debuggers, core file
4 * examiners and whatnot.
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, 1999 Ralf Baechle
11 * Copyright (C) 1995, 1999 Silicon Graphics
12 */
13#ifndef __UAPI_ASM_MIPS_REG_H
14#define __UAPI_ASM_MIPS_REG_H
15
16#define MIPS32_EF_R0 6
17#define MIPS32_EF_R1 7
18#define MIPS32_EF_R2 8
19#define MIPS32_EF_R3 9
20#define MIPS32_EF_R4 10
21#define MIPS32_EF_R5 11
22#define MIPS32_EF_R6 12
23#define MIPS32_EF_R7 13
24#define MIPS32_EF_R8 14
25#define MIPS32_EF_R9 15
26#define MIPS32_EF_R10 16
27#define MIPS32_EF_R11 17
28#define MIPS32_EF_R12 18
29#define MIPS32_EF_R13 19
30#define MIPS32_EF_R14 20
31#define MIPS32_EF_R15 21
32#define MIPS32_EF_R16 22
33#define MIPS32_EF_R17 23
34#define MIPS32_EF_R18 24
35#define MIPS32_EF_R19 25
36#define MIPS32_EF_R20 26
37#define MIPS32_EF_R21 27
38#define MIPS32_EF_R22 28
39#define MIPS32_EF_R23 29
40#define MIPS32_EF_R24 30
41#define MIPS32_EF_R25 31
42
43/*
44 * k0/k1 unsaved
45 */
46#define MIPS32_EF_R26 32
47#define MIPS32_EF_R27 33
48
49#define MIPS32_EF_R28 34
50#define MIPS32_EF_R29 35
51#define MIPS32_EF_R30 36
52#define MIPS32_EF_R31 37
53
54/*
55 * Saved special registers
56 */
57#define MIPS32_EF_LO 38
58#define MIPS32_EF_HI 39
59
60#define MIPS32_EF_CP0_EPC 40
61#define MIPS32_EF_CP0_BADVADDR 41
62#define MIPS32_EF_CP0_STATUS 42
63#define MIPS32_EF_CP0_CAUSE 43
64#define MIPS32_EF_UNUSED0 44
65
66#define MIPS32_EF_SIZE 180
67
68#define MIPS64_EF_R0 0
69#define MIPS64_EF_R1 1
70#define MIPS64_EF_R2 2
71#define MIPS64_EF_R3 3
72#define MIPS64_EF_R4 4
73#define MIPS64_EF_R5 5
74#define MIPS64_EF_R6 6
75#define MIPS64_EF_R7 7
76#define MIPS64_EF_R8 8
77#define MIPS64_EF_R9 9
78#define MIPS64_EF_R10 10
79#define MIPS64_EF_R11 11
80#define MIPS64_EF_R12 12
81#define MIPS64_EF_R13 13
82#define MIPS64_EF_R14 14
83#define MIPS64_EF_R15 15
84#define MIPS64_EF_R16 16
85#define MIPS64_EF_R17 17
86#define MIPS64_EF_R18 18
87#define MIPS64_EF_R19 19
88#define MIPS64_EF_R20 20
89#define MIPS64_EF_R21 21
90#define MIPS64_EF_R22 22
91#define MIPS64_EF_R23 23
92#define MIPS64_EF_R24 24
93#define MIPS64_EF_R25 25
94
95/*
96 * k0/k1 unsaved
97 */
98#define MIPS64_EF_R26 26
99#define MIPS64_EF_R27 27
100
101
102#define MIPS64_EF_R28 28
103#define MIPS64_EF_R29 29
104#define MIPS64_EF_R30 30
105#define MIPS64_EF_R31 31
106
107/*
108 * Saved special registers
109 */
110#define MIPS64_EF_LO 32
111#define MIPS64_EF_HI 33
112
113#define MIPS64_EF_CP0_EPC 34
114#define MIPS64_EF_CP0_BADVADDR 35
115#define MIPS64_EF_CP0_STATUS 36
116#define MIPS64_EF_CP0_CAUSE 37
117
118#define MIPS64_EF_SIZE 304 /* size in bytes */
119
120#if _MIPS_SIM == _MIPS_SIM_ABI32
121
122#define EF_R0 MIPS32_EF_R0
123#define EF_R1 MIPS32_EF_R1
124#define EF_R2 MIPS32_EF_R2
125#define EF_R3 MIPS32_EF_R3
126#define EF_R4 MIPS32_EF_R4
127#define EF_R5 MIPS32_EF_R5
128#define EF_R6 MIPS32_EF_R6
129#define EF_R7 MIPS32_EF_R7
130#define EF_R8 MIPS32_EF_R8
131#define EF_R9 MIPS32_EF_R9
132#define EF_R10 MIPS32_EF_R10
133#define EF_R11 MIPS32_EF_R11
134#define EF_R12 MIPS32_EF_R12
135#define EF_R13 MIPS32_EF_R13
136#define EF_R14 MIPS32_EF_R14
137#define EF_R15 MIPS32_EF_R15
138#define EF_R16 MIPS32_EF_R16
139#define EF_R17 MIPS32_EF_R17
140#define EF_R18 MIPS32_EF_R18
141#define EF_R19 MIPS32_EF_R19
142#define EF_R20 MIPS32_EF_R20
143#define EF_R21 MIPS32_EF_R21
144#define EF_R22 MIPS32_EF_R22
145#define EF_R23 MIPS32_EF_R23
146#define EF_R24 MIPS32_EF_R24
147#define EF_R25 MIPS32_EF_R25
148#define EF_R26 MIPS32_EF_R26
149#define EF_R27 MIPS32_EF_R27
150#define EF_R28 MIPS32_EF_R28
151#define EF_R29 MIPS32_EF_R29
152#define EF_R30 MIPS32_EF_R30
153#define EF_R31 MIPS32_EF_R31
154#define EF_LO MIPS32_EF_LO
155#define EF_HI MIPS32_EF_HI
156#define EF_CP0_EPC MIPS32_EF_CP0_EPC
157#define EF_CP0_BADVADDR MIPS32_EF_CP0_BADVADDR
158#define EF_CP0_STATUS MIPS32_EF_CP0_STATUS
159#define EF_CP0_CAUSE MIPS32_EF_CP0_CAUSE
160#define EF_UNUSED0 MIPS32_EF_UNUSED0
161#define EF_SIZE MIPS32_EF_SIZE
162
163#elif _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
164
165#define EF_R0 MIPS64_EF_R0
166#define EF_R1 MIPS64_EF_R1
167#define EF_R2 MIPS64_EF_R2
168#define EF_R3 MIPS64_EF_R3
169#define EF_R4 MIPS64_EF_R4
170#define EF_R5 MIPS64_EF_R5
171#define EF_R6 MIPS64_EF_R6
172#define EF_R7 MIPS64_EF_R7
173#define EF_R8 MIPS64_EF_R8
174#define EF_R9 MIPS64_EF_R9
175#define EF_R10 MIPS64_EF_R10
176#define EF_R11 MIPS64_EF_R11
177#define EF_R12 MIPS64_EF_R12
178#define EF_R13 MIPS64_EF_R13
179#define EF_R14 MIPS64_EF_R14
180#define EF_R15 MIPS64_EF_R15
181#define EF_R16 MIPS64_EF_R16
182#define EF_R17 MIPS64_EF_R17
183#define EF_R18 MIPS64_EF_R18
184#define EF_R19 MIPS64_EF_R19
185#define EF_R20 MIPS64_EF_R20
186#define EF_R21 MIPS64_EF_R21
187#define EF_R22 MIPS64_EF_R22
188#define EF_R23 MIPS64_EF_R23
189#define EF_R24 MIPS64_EF_R24
190#define EF_R25 MIPS64_EF_R25
191#define EF_R26 MIPS64_EF_R26
192#define EF_R27 MIPS64_EF_R27
193#define EF_R28 MIPS64_EF_R28
194#define EF_R29 MIPS64_EF_R29
195#define EF_R30 MIPS64_EF_R30
196#define EF_R31 MIPS64_EF_R31
197#define EF_LO MIPS64_EF_LO
198#define EF_HI MIPS64_EF_HI
199#define EF_CP0_EPC MIPS64_EF_CP0_EPC
200#define EF_CP0_BADVADDR MIPS64_EF_CP0_BADVADDR
201#define EF_CP0_STATUS MIPS64_EF_CP0_STATUS
202#define EF_CP0_CAUSE MIPS64_EF_CP0_CAUSE
203#define EF_SIZE MIPS64_EF_SIZE
204
205#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
206
207#endif /* __UAPI_ASM_MIPS_REG_H */
diff --git a/arch/mips/include/uapi/asm/resource.h b/arch/mips/include/uapi/asm/resource.h
new file mode 100644
index 000000000..372ff8f4b
--- /dev/null
+++ b/arch/mips/include/uapi/asm/resource.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 96, 98, 99, 2000 by Ralf Baechle
8 * Copyright (C) 1999 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_RESOURCE_H
11#define _ASM_RESOURCE_H
12
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#ifndef __mips64
31# define RLIM_INFINITY 0x7fffffffUL
32#endif
33
34#include <asm-generic/resource.h>
35
36#endif /* _ASM_RESOURCE_H */
diff --git a/arch/mips/include/uapi/asm/sembuf.h b/arch/mips/include/uapi/asm/sembuf.h
new file mode 100644
index 000000000..ba7fe0c89
--- /dev/null
+++ b/arch/mips/include/uapi/asm/sembuf.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_SEMBUF_H
3#define _ASM_SEMBUF_H
4
5#include <asm/ipcbuf.h>
6
7/*
8 * The semid64_ds structure for the MIPS architecture.
9 * Note extra padding because this structure is passed back and forth
10 * between kernel and user space.
11 *
12 * Pad space is left for 2 miscellaneous 64-bit values on mips64,
13 * but used for the upper 32 bit of the time values on mips32.
14 */
15
16#ifdef __mips64
17struct semid64_ds {
18 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
19 long sem_otime; /* last semop time */
20 long sem_ctime; /* last change time */
21 unsigned long sem_nsems; /* no. of semaphores in array */
22 unsigned long __unused1;
23 unsigned long __unused2;
24};
25#else
26struct semid64_ds {
27 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
28 unsigned long sem_otime; /* last semop time */
29 unsigned long sem_ctime; /* last change time */
30 unsigned long sem_nsems; /* no. of semaphores in array */
31 unsigned long sem_otime_high;
32 unsigned long sem_ctime_high;
33};
34#endif
35
36#endif /* _ASM_SEMBUF_H */
diff --git a/arch/mips/include/uapi/asm/setup.h b/arch/mips/include/uapi/asm/setup.h
new file mode 100644
index 000000000..7d48c433b
--- /dev/null
+++ b/arch/mips/include/uapi/asm/setup.h
@@ -0,0 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _UAPI_MIPS_SETUP_H
3#define _UAPI_MIPS_SETUP_H
4
5#define COMMAND_LINE_SIZE 4096
6
7
8#endif /* _UAPI_MIPS_SETUP_H */
diff --git a/arch/mips/include/uapi/asm/sgidefs.h b/arch/mips/include/uapi/asm/sgidefs.h
new file mode 100644
index 000000000..69c3de90c
--- /dev/null
+++ b/arch/mips/include/uapi/asm/sgidefs.h
@@ -0,0 +1,37 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1996, 1999, 2001 Ralf Baechle
8 * Copyright (C) 1999 Silicon Graphics, Inc.
9 * Copyright (C) 2001 MIPS Technologies, Inc.
10 */
11#ifndef __ASM_SGIDEFS_H
12#define __ASM_SGIDEFS_H
13
14/*
15 * Definitions for the ISA levels
16 *
17 * With the introduction of MIPS32 / MIPS64 instruction sets definitions
18 * MIPS ISAs are no longer subsets of each other. Therefore comparisons
19 * on these symbols except with == may result in unexpected results and
20 * are forbidden!
21 */
22#define _MIPS_ISA_MIPS1 1
23#define _MIPS_ISA_MIPS2 2
24#define _MIPS_ISA_MIPS3 3
25#define _MIPS_ISA_MIPS4 4
26#define _MIPS_ISA_MIPS5 5
27#define _MIPS_ISA_MIPS32 6
28#define _MIPS_ISA_MIPS64 7
29
30/*
31 * Subprogram calling convention
32 */
33#define _MIPS_SIM_ABI32 1
34#define _MIPS_SIM_NABI32 2
35#define _MIPS_SIM_ABI64 3
36
37#endif /* __ASM_SGIDEFS_H */
diff --git a/arch/mips/include/uapi/asm/shmbuf.h b/arch/mips/include/uapi/asm/shmbuf.h
new file mode 100644
index 000000000..680bb95b2
--- /dev/null
+++ b/arch/mips/include/uapi/asm/shmbuf.h
@@ -0,0 +1,58 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_SHMBUF_H
3#define _ASM_SHMBUF_H
4
5/*
6 * The shmid64_ds structure for the MIPS architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * As MIPS was lacking proper padding after shm_?time, we use 48 bits
11 * of the padding at the end to store a few additional bits of the time.
12 * libc implementations need to take care to convert this into a proper
13 * data structure when moving to 64-bit time_t.
14 */
15
16#ifdef __mips64
17struct shmid64_ds {
18 struct ipc64_perm shm_perm; /* operation perms */
19 size_t shm_segsz; /* size of segment (bytes) */
20 long shm_atime; /* last attach time */
21 long shm_dtime; /* last detach time */
22 long shm_ctime; /* last change time */
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused1;
27 unsigned long __unused2;
28};
29#else
30struct shmid64_ds {
31 struct ipc64_perm shm_perm; /* operation perms */
32 size_t shm_segsz; /* size of segment (bytes) */
33 unsigned long shm_atime; /* last attach time */
34 unsigned long shm_dtime; /* last detach time */
35 unsigned long shm_ctime; /* last change time */
36 __kernel_pid_t shm_cpid; /* pid of creator */
37 __kernel_pid_t shm_lpid; /* pid of last operator */
38 unsigned long shm_nattch; /* no. of current attaches */
39 unsigned short shm_atime_high;
40 unsigned short shm_dtime_high;
41 unsigned short shm_ctime_high;
42 unsigned short __unused1;
43};
44#endif
45
46struct shminfo64 {
47 unsigned long shmmax;
48 unsigned long shmmin;
49 unsigned long shmmni;
50 unsigned long shmseg;
51 unsigned long shmall;
52 unsigned long __unused1;
53 unsigned long __unused2;
54 unsigned long __unused3;
55 unsigned long __unused4;
56};
57
58#endif /* _ASM_SHMBUF_H */
diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h
new file mode 100644
index 000000000..d0a540e88
--- /dev/null
+++ b/arch/mips/include/uapi/asm/sigcontext.h
@@ -0,0 +1,91 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1996, 1997, 1999 by Ralf Baechle
8 * Copyright (C) 1999 Silicon Graphics, Inc.
9 */
10#ifndef _UAPI_ASM_SIGCONTEXT_H
11#define _UAPI_ASM_SIGCONTEXT_H
12
13#include <linux/types.h>
14#include <asm/sgidefs.h>
15
16/* scalar FP context was used */
17#define USED_FP (1 << 0)
18
19/* the value of Status.FR when context was saved */
20#define USED_FR1 (1 << 1)
21
22/* FR=1, but with odd singles in bits 63:32 of preceding even double */
23#define USED_HYBRID_FPRS (1 << 2)
24
25/* extended context was used, see struct extcontext for details */
26#define USED_EXTCONTEXT (1 << 3)
27
28#if _MIPS_SIM == _MIPS_SIM_ABI32
29
30/*
31 * Keep this struct definition in sync with the sigcontext fragment
32 * in arch/mips/kernel/asm-offsets.c
33 */
34struct sigcontext {
35 unsigned int sc_regmask; /* Unused */
36 unsigned int sc_status; /* Unused */
37 unsigned long long sc_pc;
38 unsigned long long sc_regs[32];
39 unsigned long long sc_fpregs[32];
40 unsigned int sc_acx; /* Was sc_ownedfp */
41 unsigned int sc_fpc_csr;
42 unsigned int sc_fpc_eir; /* Unused */
43 unsigned int sc_used_math;
44 unsigned int sc_dsp; /* dsp status, was sc_ssflags */
45 unsigned long long sc_mdhi;
46 unsigned long long sc_mdlo;
47 unsigned long sc_hi1; /* Was sc_cause */
48 unsigned long sc_lo1; /* Was sc_badvaddr */
49 unsigned long sc_hi2; /* Was sc_sigset[4] */
50 unsigned long sc_lo2;
51 unsigned long sc_hi3;
52 unsigned long sc_lo3;
53};
54
55#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
56
57#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
58
59#include <linux/posix_types.h>
60/*
61 * Keep this struct definition in sync with the sigcontext fragment
62 * in arch/mips/kernel/asm-offsets.c
63 *
64 * Warning: this structure illdefined with sc_badvaddr being just an unsigned
65 * int so it was changed to unsigned long in 2.6.0-test1. This may break
66 * binary compatibility - no prisoners.
67 * DSP ASE in 2.6.12-rc4. Turn sc_mdhi and sc_mdlo into an array of four
68 * entries, add sc_dsp and sc_reserved for padding. No prisoners.
69 */
70struct sigcontext {
71 __u64 sc_regs[32];
72 __u64 sc_fpregs[32];
73 __u64 sc_mdhi;
74 __u64 sc_hi1;
75 __u64 sc_hi2;
76 __u64 sc_hi3;
77 __u64 sc_mdlo;
78 __u64 sc_lo1;
79 __u64 sc_lo2;
80 __u64 sc_lo3;
81 __u64 sc_pc;
82 __u32 sc_fpc_csr;
83 __u32 sc_used_math;
84 __u32 sc_dsp;
85 __u32 sc_reserved;
86};
87
88
89#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
90
91#endif /* _UAPI_ASM_SIGCONTEXT_H */
diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h
new file mode 100644
index 000000000..c34c7eef0
--- /dev/null
+++ b/arch/mips/include/uapi/asm/siginfo.h
@@ -0,0 +1,32 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1998, 1999, 2001, 2003 Ralf Baechle
8 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
9 */
10#ifndef _UAPI_ASM_SIGINFO_H
11#define _UAPI_ASM_SIGINFO_H
12
13
14#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int))
15#undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
16
17#define __ARCH_HAS_SWAPPED_SIGINFO
18
19#include <asm-generic/siginfo.h>
20
21/*
22 * si_code values
23 * Again these have been chosen to be IRIX compatible.
24 */
25#undef SI_ASYNCIO
26#undef SI_TIMER
27#undef SI_MESGQ
28#define SI_ASYNCIO -2 /* sent by AIO completion */
29#define SI_TIMER -3 /* sent by timer expiration */
30#define SI_MESGQ -4 /* sent by real time mesq state change */
31
32#endif /* _UAPI_ASM_SIGINFO_H */
diff --git a/arch/mips/include/uapi/asm/signal.h b/arch/mips/include/uapi/asm/signal.h
new file mode 100644
index 000000000..53104b10a
--- /dev/null
+++ b/arch/mips/include/uapi/asm/signal.h
@@ -0,0 +1,120 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 96, 97, 98, 99, 2003 by Ralf Baechle
8 * Copyright (C) 1999 Silicon Graphics, Inc.
9 */
10#ifndef _UAPI_ASM_SIGNAL_H
11#define _UAPI_ASM_SIGNAL_H
12
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_RESTART flag to get restarting signals (which were the default long ago)
69 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
70 * SA_RESETHAND clears the handler when the signal is delivered.
71 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
72 * SA_NODEFER prevents the current signal from being masked in the handler.
73 *
74 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
75 * Unix names RESETHAND and NODEFER respectively.
76 *
77 * SA_RESTORER used to be defined as 0x04000000 but only the O32 ABI ever
78 * supported its use and no libc was using it, so the entire sa-restorer
79 * functionality was removed with lmo commit 39bffc12c3580ab for 2.5.48
80 * retaining only the SA_RESTORER definition as a reminder to avoid
81 * accidental reuse of the mask bit.
82 */
83#define SA_ONSTACK 0x08000000
84#define SA_RESETHAND 0x80000000
85#define SA_RESTART 0x10000000
86#define SA_SIGINFO 0x00000008
87#define SA_NODEFER 0x40000000
88#define SA_NOCLDWAIT 0x00010000
89#define SA_NOCLDSTOP 0x00000001
90
91#define SA_NOMASK SA_NODEFER
92#define SA_ONESHOT SA_RESETHAND
93
94#define MINSIGSTKSZ 2048
95#define SIGSTKSZ 8192
96
97
98#define SIG_BLOCK 1 /* for blocking signals */
99#define SIG_UNBLOCK 2 /* for unblocking signals */
100#define SIG_SETMASK 3 /* for setting the signal mask */
101
102#include <asm-generic/signal-defs.h>
103
104#ifndef __KERNEL__
105struct sigaction {
106 unsigned int sa_flags;
107 __sighandler_t sa_handler;
108 sigset_t sa_mask;
109};
110#endif
111
112/* IRIX compatible stack_t */
113typedef struct sigaltstack {
114 void __user *ss_sp;
115 size_t ss_size;
116 int ss_flags;
117} stack_t;
118
119
120#endif /* _UAPI_ASM_SIGNAL_H */
diff --git a/arch/mips/include/uapi/asm/socket.h b/arch/mips/include/uapi/asm/socket.h
new file mode 100644
index 000000000..d0a9ed2ca
--- /dev/null
+++ b/arch/mips/include/uapi/asm/socket.h
@@ -0,0 +1,162 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1997, 1999, 2000, 2001 Ralf Baechle
8 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
9 */
10#ifndef _UAPI_ASM_SOCKET_H
11#define _UAPI_ASM_SOCKET_H
12
13#include <linux/posix_types.h>
14#include <asm/sockios.h>
15
16/*
17 * For setsockopt(2)
18 *
19 * This defines are ABI conformant as far as Linux supports these ...
20 */
21#define SOL_SOCKET 0xffff
22
23#define SO_DEBUG 0x0001 /* Record debugging information. */
24#define SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
25#define SO_KEEPALIVE 0x0008 /* Keep connections alive and send
26 SIGPIPE when they die. */
27#define SO_DONTROUTE 0x0010 /* Don't do local routing. */
28#define SO_BROADCAST 0x0020 /* Allow transmission of
29 broadcast messages. */
30#define SO_LINGER 0x0080 /* Block on close of a reliable
31 socket to transmit pending data. */
32#define SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band. */
33#define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
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_OLD 0x1005 /* send timeout */
43#define SO_RCVTIMEO_OLD 0x1006 /* receive timeout */
44#define SO_ACCEPTCONN 0x1009
45#define SO_PROTOCOL 0x1028 /* protocol type */
46#define SO_DOMAIN 0x1029 /* domain/socket family */
47
48/* linux-specific, might as well be the same as on i386 */
49#define SO_NO_CHECK 11
50#define SO_PRIORITY 12
51#define SO_BSDCOMPAT 14
52
53#define SO_PASSCRED 17
54#define SO_PEERCRED 18
55
56/* Security levels - as per NRL IPv6 - don't actually do anything */
57#define SO_SECURITY_AUTHENTICATION 22
58#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
59#define SO_SECURITY_ENCRYPTION_NETWORK 24
60
61#define SO_BINDTODEVICE 25
62
63/* Socket filtering */
64#define SO_ATTACH_FILTER 26
65#define SO_DETACH_FILTER 27
66#define SO_GET_FILTER SO_ATTACH_FILTER
67
68#define SO_PEERNAME 28
69
70#define SO_PEERSEC 30
71#define SO_SNDBUFFORCE 31
72#define SO_RCVBUFFORCE 33
73#define SO_PASSSEC 34
74
75#define SO_MARK 36
76
77#define SO_RXQ_OVFL 40
78
79#define SO_WIFI_STATUS 41
80#define SCM_WIFI_STATUS SO_WIFI_STATUS
81#define SO_PEEK_OFF 42
82
83/* Instruct lower device to use last 4-bytes of skb data as FCS */
84#define SO_NOFCS 43
85
86#define SO_LOCK_FILTER 44
87
88#define SO_SELECT_ERR_QUEUE 45
89
90#define SO_BUSY_POLL 46
91
92#define SO_MAX_PACING_RATE 47
93
94#define SO_BPF_EXTENSIONS 48
95
96#define SO_INCOMING_CPU 49
97
98#define SO_ATTACH_BPF 50
99#define SO_DETACH_BPF SO_DETACH_FILTER
100
101#define SO_ATTACH_REUSEPORT_CBPF 51
102#define SO_ATTACH_REUSEPORT_EBPF 52
103
104#define SO_CNX_ADVICE 53
105
106#define SCM_TIMESTAMPING_OPT_STATS 54
107
108#define SO_MEMINFO 55
109
110#define SO_INCOMING_NAPI_ID 56
111
112#define SO_COOKIE 57
113
114#define SCM_TIMESTAMPING_PKTINFO 58
115
116#define SO_PEERGROUPS 59
117
118#define SO_ZEROCOPY 60
119
120#define SO_TXTIME 61
121#define SCM_TXTIME SO_TXTIME
122
123#define SO_BINDTOIFINDEX 62
124
125#define SO_TIMESTAMP_OLD 29
126#define SO_TIMESTAMPNS_OLD 35
127#define SO_TIMESTAMPING_OLD 37
128
129#define SO_TIMESTAMP_NEW 63
130#define SO_TIMESTAMPNS_NEW 64
131#define SO_TIMESTAMPING_NEW 65
132
133#define SO_RCVTIMEO_NEW 66
134#define SO_SNDTIMEO_NEW 67
135
136#define SO_DETACH_REUSEPORT_BPF 68
137
138#if !defined(__KERNEL__)
139
140#if __BITS_PER_LONG == 64
141#define SO_TIMESTAMP SO_TIMESTAMP_OLD
142#define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
143#define SO_TIMESTAMPING SO_TIMESTAMPING_OLD
144
145#define SO_RCVTIMEO SO_RCVTIMEO_OLD
146#define SO_SNDTIMEO SO_SNDTIMEO_OLD
147#else
148#define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
149#define SO_TIMESTAMPNS (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
150#define SO_TIMESTAMPING (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPING_OLD : SO_TIMESTAMPING_NEW)
151
152#define SO_RCVTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_RCVTIMEO_OLD : SO_RCVTIMEO_NEW)
153#define SO_SNDTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_SNDTIMEO_OLD : SO_SNDTIMEO_NEW)
154#endif
155
156#define SCM_TIMESTAMP SO_TIMESTAMP
157#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
158#define SCM_TIMESTAMPING SO_TIMESTAMPING
159
160#endif
161
162#endif /* _UAPI_ASM_SOCKET_H */
diff --git a/arch/mips/include/uapi/asm/sockios.h b/arch/mips/include/uapi/asm/sockios.h
new file mode 100644
index 000000000..66f60234f
--- /dev/null
+++ b/arch/mips/include/uapi/asm/sockios.h
@@ -0,0 +1,27 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * Socket-level I/O control calls.
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 by Ralf Baechle
10 */
11#ifndef _ASM_SOCKIOS_H
12#define _ASM_SOCKIOS_H
13
14#include <asm/ioctl.h>
15
16/* Socket-level I/O control calls. */
17#define FIOGETOWN _IOR('f', 123, int)
18#define FIOSETOWN _IOW('f', 124, int)
19
20#define SIOCATMARK _IOR('s', 7, int)
21#define SIOCSPGRP _IOW('s', 8, pid_t)
22#define SIOCGPGRP _IOR('s', 9, pid_t)
23
24#define SIOCGSTAMP_OLD 0x8906 /* Get stamp (timeval) */
25#define SIOCGSTAMPNS_OLD 0x8907 /* Get stamp (timespec) */
26
27#endif /* _ASM_SOCKIOS_H */
diff --git a/arch/mips/include/uapi/asm/stat.h b/arch/mips/include/uapi/asm/stat.h
new file mode 100644
index 000000000..3d2a3b718
--- /dev/null
+++ b/arch/mips/include/uapi/asm/stat.h
@@ -0,0 +1,133 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 1999, 2000 Ralf Baechle
8 * Copyright (C) 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_STAT_H
11#define _ASM_STAT_H
12
13#include <linux/types.h>
14
15#include <asm/sgidefs.h>
16
17#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
18
19struct stat {
20 unsigned st_dev;
21 long st_pad1[3]; /* Reserved for network id */
22 ino_t st_ino;
23 mode_t st_mode;
24 __u32 st_nlink;
25 uid_t st_uid;
26 gid_t st_gid;
27 unsigned st_rdev;
28 long st_pad2[2];
29 long st_size;
30 long st_pad3;
31 /*
32 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
33 * but we don't have it under Linux.
34 */
35 long st_atime;
36 long st_atime_nsec;
37 long st_mtime;
38 long st_mtime_nsec;
39 long st_ctime;
40 long st_ctime_nsec;
41 long st_blksize;
42 long st_blocks;
43 long st_pad4[14];
44};
45
46/*
47 * This matches struct stat64 in glibc2.1, hence the absolutely insane
48 * amounts of padding around dev_t's. The memory layout is the same as of
49 * struct stat of the 64-bit kernel.
50 */
51
52struct stat64 {
53 unsigned long st_dev;
54 unsigned long st_pad0[3]; /* Reserved for st_dev expansion */
55
56 unsigned long long st_ino;
57
58 mode_t st_mode;
59 __u32 st_nlink;
60
61 uid_t st_uid;
62 gid_t st_gid;
63
64 unsigned long st_rdev;
65 unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
66
67 long long st_size;
68
69 /*
70 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
71 * but we don't have it under Linux.
72 */
73 long st_atime;
74 unsigned long st_atime_nsec; /* Reserved for st_atime expansion */
75
76 long st_mtime;
77 unsigned long st_mtime_nsec; /* Reserved for st_mtime expansion */
78
79 long st_ctime;
80 unsigned long st_ctime_nsec; /* Reserved for st_ctime expansion */
81
82 unsigned long st_blksize;
83 unsigned long st_pad2;
84
85 long long st_blocks;
86};
87
88#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
89
90#if _MIPS_SIM == _MIPS_SIM_ABI64
91
92/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
93struct stat {
94 unsigned int st_dev;
95 unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
96
97 unsigned long st_ino;
98
99 mode_t st_mode;
100 __u32 st_nlink;
101
102 uid_t st_uid;
103 gid_t st_gid;
104
105 unsigned int st_rdev;
106 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
107
108 long st_size;
109
110 /*
111 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
112 * but we don't have it under Linux.
113 */
114 unsigned int st_atime;
115 unsigned int st_atime_nsec;
116
117 unsigned int st_mtime;
118 unsigned int st_mtime_nsec;
119
120 unsigned int st_ctime;
121 unsigned int st_ctime_nsec;
122
123 unsigned int st_blksize;
124 unsigned int st_pad2;
125
126 unsigned long st_blocks;
127};
128
129#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
130
131#define STAT_HAVE_NSEC 1
132
133#endif /* _ASM_STAT_H */
diff --git a/arch/mips/include/uapi/asm/statfs.h b/arch/mips/include/uapi/asm/statfs.h
new file mode 100644
index 000000000..f4174dcae
--- /dev/null
+++ b/arch/mips/include/uapi/asm/statfs.h
@@ -0,0 +1,101 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 1999 by Ralf Baechle
8 */
9#ifndef _ASM_STATFS_H
10#define _ASM_STATFS_H
11
12#include <linux/posix_types.h>
13#include <asm/sgidefs.h>
14
15#ifndef __KERNEL_STRICT_NAMES
16
17#include <linux/types.h>
18
19typedef __kernel_fsid_t fsid_t;
20
21#endif
22
23struct statfs {
24 long f_type;
25#define f_fstyp f_type
26 long f_bsize;
27 long f_frsize; /* Fragment size - unsupported */
28 long f_blocks;
29 long f_bfree;
30 long f_files;
31 long f_ffree;
32 long f_bavail;
33
34 /* Linux specials */
35 __kernel_fsid_t f_fsid;
36 long f_namelen;
37 long f_flags;
38 long f_spare[5];
39};
40
41#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
42
43/*
44 * Unlike the traditional version the LFAPI version has none of the ABI junk
45 */
46struct statfs64 {
47 __u32 f_type;
48 __u32 f_bsize;
49 __u32 f_frsize; /* Fragment size - unsupported */
50 __u32 __pad;
51 __u64 f_blocks;
52 __u64 f_bfree;
53 __u64 f_files;
54 __u64 f_ffree;
55 __u64 f_bavail;
56 __kernel_fsid_t f_fsid;
57 __u32 f_namelen;
58 __u32 f_flags;
59 __u32 f_spare[5];
60};
61
62#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
63
64#if _MIPS_SIM == _MIPS_SIM_ABI64
65
66struct statfs64 { /* Same as struct statfs */
67 long f_type;
68 long f_bsize;
69 long f_frsize; /* Fragment size - unsupported */
70 long f_blocks;
71 long f_bfree;
72 long f_files;
73 long f_ffree;
74 long f_bavail;
75
76 /* Linux specials */
77 __kernel_fsid_t f_fsid;
78 long f_namelen;
79 long f_flags;
80 long f_spare[5];
81};
82
83struct compat_statfs64 {
84 __u32 f_type;
85 __u32 f_bsize;
86 __u32 f_frsize; /* Fragment size - unsupported */
87 __u32 __pad;
88 __u64 f_blocks;
89 __u64 f_bfree;
90 __u64 f_files;
91 __u64 f_ffree;
92 __u64 f_bavail;
93 __kernel_fsid_t f_fsid;
94 __u32 f_namelen;
95 __u32 f_flags;
96 __u32 f_spare[5];
97};
98
99#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
100
101#endif /* _ASM_STATFS_H */
diff --git a/arch/mips/include/uapi/asm/swab.h b/arch/mips/include/uapi/asm/swab.h
new file mode 100644
index 000000000..d6795fe4e
--- /dev/null
+++ b/arch/mips/include/uapi/asm/swab.h
@@ -0,0 +1,71 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1996, 99, 2003 by Ralf Baechle
8 */
9#ifndef _ASM_SWAB_H
10#define _ASM_SWAB_H
11
12#include <linux/compiler.h>
13#include <linux/types.h>
14
15#define __SWAB_64_THRU_32__
16
17#if !defined(__mips16) && \
18 ((defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \
19 defined(_MIPS_ARCH_LOONGSON3A))
20
21static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
22{
23 __asm__(
24 " .set push \n"
25 " .set arch=mips32r2 \n"
26 " wsbh %0, %1 \n"
27 " .set pop \n"
28 : "=r" (x)
29 : "r" (x));
30
31 return x;
32}
33#define __arch_swab16 __arch_swab16
34
35static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
36{
37 __asm__(
38 " .set push \n"
39 " .set arch=mips32r2 \n"
40 " wsbh %0, %1 \n"
41 " rotr %0, %0, 16 \n"
42 " .set pop \n"
43 : "=r" (x)
44 : "r" (x));
45
46 return x;
47}
48#define __arch_swab32 __arch_swab32
49
50/*
51 * Having already checked for MIPS R2, enable the optimized version for
52 * 64-bit kernel on r2 CPUs.
53 */
54#ifdef __mips64
55static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
56{
57 __asm__(
58 " .set push \n"
59 " .set arch=mips64r2 \n"
60 " dsbh %0, %1 \n"
61 " dshd %0, %0 \n"
62 " .set pop \n"
63 : "=r" (x)
64 : "r" (x));
65
66 return x;
67}
68#define __arch_swab64 __arch_swab64
69#endif /* __mips64 */
70#endif /* (not __mips16) and (MIPS R2 or newer or Loongson 3A) */
71#endif /* _ASM_SWAB_H */
diff --git a/arch/mips/include/uapi/asm/sysmips.h b/arch/mips/include/uapi/asm/sysmips.h
new file mode 100644
index 000000000..4c009e10d
--- /dev/null
+++ b/arch/mips/include/uapi/asm/sysmips.h
@@ -0,0 +1,26 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * Definitions for the MIPS sysmips(2) call
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 by Ralf Baechle
10 */
11#ifndef _ASM_SYSMIPS_H
12#define _ASM_SYSMIPS_H
13
14/*
15 * Commands for the sysmips(2) call
16 *
17 * sysmips(2) is deprecated - though some existing software uses it.
18 * We only support the following commands.
19 */
20#define SETNAME 1 /* set hostname */
21#define FLUSH_CACHE 3 /* writeback and invalidate caches */
22#define MIPS_FIXADE 7 /* control address error fixing */
23#define MIPS_RDNVRAM 10 /* read NVRAM */
24#define MIPS_ATOMIC_SET 2001 /* atomically set variable */
25
26#endif /* _ASM_SYSMIPS_H */
diff --git a/arch/mips/include/uapi/asm/termbits.h b/arch/mips/include/uapi/asm/termbits.h
new file mode 100644
index 000000000..dfeffba72
--- /dev/null
+++ b/arch/mips/include/uapi/asm/termbits.h
@@ -0,0 +1,228 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 96, 99, 2001, 06 Ralf Baechle
8 * Copyright (C) 1999 Silicon Graphics, Inc.
9 * Copyright (C) 2001 MIPS Technologies, Inc.
10 */
11#ifndef _ASM_TERMBITS_H
12#define _ASM_TERMBITS_H
13
14#include <linux/posix_types.h>
15
16typedef unsigned char cc_t;
17typedef unsigned int speed_t;
18typedef unsigned int tcflag_t;
19
20/*
21 * The ABI says nothing about NCC but seems to use NCCS as
22 * replacement for it in struct termio
23 */
24#define NCCS 23
25struct termios {
26 tcflag_t c_iflag; /* input mode flags */
27 tcflag_t c_oflag; /* output mode flags */
28 tcflag_t c_cflag; /* control mode flags */
29 tcflag_t c_lflag; /* local mode flags */
30 cc_t c_line; /* line discipline */
31 cc_t c_cc[NCCS]; /* control characters */
32};
33
34struct termios2 {
35 tcflag_t c_iflag; /* input mode flags */
36 tcflag_t c_oflag; /* output mode flags */
37 tcflag_t c_cflag; /* control mode flags */
38 tcflag_t c_lflag; /* local mode flags */
39 cc_t c_line; /* line discipline */
40 cc_t c_cc[NCCS]; /* control characters */
41 speed_t c_ispeed; /* input speed */
42 speed_t c_ospeed; /* output speed */
43};
44
45struct ktermios {
46 tcflag_t c_iflag; /* input mode flags */
47 tcflag_t c_oflag; /* output mode flags */
48 tcflag_t c_cflag; /* control mode flags */
49 tcflag_t c_lflag; /* local mode flags */
50 cc_t c_line; /* line discipline */
51 cc_t c_cc[NCCS]; /* control characters */
52 speed_t c_ispeed; /* input speed */
53 speed_t c_ospeed; /* output speed */
54};
55
56/* c_cc characters */
57#define VINTR 0 /* Interrupt character [ISIG]. */
58#define VQUIT 1 /* Quit character [ISIG]. */
59#define VERASE 2 /* Erase character [ICANON]. */
60#define VKILL 3 /* Kill-line character [ICANON]. */
61#define VMIN 4 /* Minimum number of bytes read at once [!ICANON]. */
62#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON]. */
63#define VEOL2 6 /* Second EOL character [ICANON]. */
64#define VSWTC 7 /* ??? */
65#define VSWTCH VSWTC
66#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */
67#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */
68#define VSUSP 10 /* Suspend character [ISIG]. */
69#if 0
70/*
71 * VDSUSP is not supported
72 */
73#define VDSUSP 11 /* Delayed suspend character [ISIG]. */
74#endif
75#define VREPRINT 12 /* Reprint-line character [ICANON]. */
76#define VDISCARD 13 /* Discard character [IEXTEN]. */
77#define VWERASE 14 /* Word-erase character [ICANON]. */
78#define VLNEXT 15 /* Literal-next character [IEXTEN]. */
79#define VEOF 16 /* End-of-file character [ICANON]. */
80#define VEOL 17 /* End-of-line character [ICANON]. */
81
82/* c_iflag bits */
83#define IGNBRK 0000001 /* Ignore break condition. */
84#define BRKINT 0000002 /* Signal interrupt on break. */
85#define IGNPAR 0000004 /* Ignore characters with parity errors. */
86#define PARMRK 0000010 /* Mark parity and framing errors. */
87#define INPCK 0000020 /* Enable input parity check. */
88#define ISTRIP 0000040 /* Strip 8th bit off characters. */
89#define INLCR 0000100 /* Map NL to CR on input. */
90#define IGNCR 0000200 /* Ignore CR. */
91#define ICRNL 0000400 /* Map CR to NL on input. */
92#define IUCLC 0001000 /* Map upper case to lower case on input. */
93#define IXON 0002000 /* Enable start/stop output control. */
94#define IXANY 0004000 /* Any character will restart after stop. */
95#define IXOFF 0010000 /* Enable start/stop input control. */
96#define IMAXBEL 0020000 /* Ring bell when input queue is full. */
97#define IUTF8 0040000 /* Input is UTF-8 */
98
99/* c_oflag bits */
100#define OPOST 0000001 /* Perform output processing. */
101#define OLCUC 0000002 /* Map lower case to upper case on output. */
102#define ONLCR 0000004 /* Map NL to CR-NL on output. */
103#define OCRNL 0000010
104#define ONOCR 0000020
105#define ONLRET 0000040
106#define OFILL 0000100
107#define OFDEL 0000200
108#define NLDLY 0000400
109#define NL0 0000000
110#define NL1 0000400
111#define CRDLY 0003000
112#define CR0 0000000
113#define CR1 0001000
114#define CR2 0002000
115#define CR3 0003000
116#define TABDLY 0014000
117#define TAB0 0000000
118#define TAB1 0004000
119#define TAB2 0010000
120#define TAB3 0014000
121#define XTABS 0014000
122#define BSDLY 0020000
123#define BS0 0000000
124#define BS1 0020000
125#define VTDLY 0040000
126#define VT0 0000000
127#define VT1 0040000
128#define FFDLY 0100000
129#define FF0 0000000
130#define FF1 0100000
131/*
132#define PAGEOUT ???
133#define WRAP ???
134 */
135
136/* c_cflag bit meaning */
137#define CBAUD 0010017
138#define B0 0000000 /* hang up */
139#define B50 0000001
140#define B75 0000002
141#define B110 0000003
142#define B134 0000004
143#define B150 0000005
144#define B200 0000006
145#define B300 0000007
146#define B600 0000010
147#define B1200 0000011
148#define B1800 0000012
149#define B2400 0000013
150#define B4800 0000014
151#define B9600 0000015
152#define B19200 0000016
153#define B38400 0000017
154#define EXTA B19200
155#define EXTB B38400
156#define CSIZE 0000060 /* Number of bits per byte (mask). */
157#define CS5 0000000 /* 5 bits per byte. */
158#define CS6 0000020 /* 6 bits per byte. */
159#define CS7 0000040 /* 7 bits per byte. */
160#define CS8 0000060 /* 8 bits per byte. */
161#define CSTOPB 0000100 /* Two stop bits instead of one. */
162#define CREAD 0000200 /* Enable receiver. */
163#define PARENB 0000400 /* Parity enable. */
164#define PARODD 0001000 /* Odd parity instead of even. */
165#define HUPCL 0002000 /* Hang up on last close. */
166#define CLOCAL 0004000 /* Ignore modem status lines. */
167#define CBAUDEX 0010000
168#define BOTHER 0010000
169#define B57600 0010001
170#define B115200 0010002
171#define B230400 0010003
172#define B460800 0010004
173#define B500000 0010005
174#define B576000 0010006
175#define B921600 0010007
176#define B1000000 0010010
177#define B1152000 0010011
178#define B1500000 0010012
179#define B2000000 0010013
180#define B2500000 0010014
181#define B3000000 0010015
182#define B3500000 0010016
183#define B4000000 0010017
184#define CIBAUD 002003600000 /* input baud rate */
185#define CMSPAR 010000000000 /* mark or space (stick) parity */
186#define CRTSCTS 020000000000 /* flow control */
187
188#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
189
190/* c_lflag bits */
191#define ISIG 0000001 /* Enable signals. */
192#define ICANON 0000002 /* Do erase and kill processing. */
193#define XCASE 0000004
194#define ECHO 0000010 /* Enable echo. */
195#define ECHOE 0000020 /* Visual erase for ERASE. */
196#define ECHOK 0000040 /* Echo NL after KILL. */
197#define ECHONL 0000100 /* Echo NL even if ECHO is off. */
198#define NOFLSH 0000200 /* Disable flush after interrupt. */
199#define IEXTEN 0000400 /* Enable DISCARD and LNEXT. */
200#define ECHOCTL 0001000 /* Echo control characters as ^X. */
201#define ECHOPRT 0002000 /* Hardcopy visual erase. */
202#define ECHOKE 0004000 /* Visual erase for KILL. */
203#define FLUSHO 0020000
204#define PENDIN 0040000 /* Retype pending input (state). */
205#define TOSTOP 0100000 /* Send SIGTTOU for background output. */
206#define ITOSTOP TOSTOP
207#define EXTPROC 0200000 /* External processing on pty */
208
209/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
210#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
211
212/* tcflow() and TCXONC use these */
213#define TCOOFF 0 /* Suspend output. */
214#define TCOON 1 /* Restart suspended output. */
215#define TCIOFF 2 /* Send a STOP character. */
216#define TCION 3 /* Send a START character. */
217
218/* tcflush() and TCFLSH use these */
219#define TCIFLUSH 0 /* Discard data received but not yet read. */
220#define TCOFLUSH 1 /* Discard data written but not yet sent. */
221#define TCIOFLUSH 2 /* Discard all pending data. */
222
223/* tcsetattr uses these */
224#define TCSANOW TCSETS /* Change immediately. */
225#define TCSADRAIN TCSETSW /* Change when pending output is written. */
226#define TCSAFLUSH TCSETSF /* Flush pending input before changing. */
227
228#endif /* _ASM_TERMBITS_H */
diff --git a/arch/mips/include/uapi/asm/termios.h b/arch/mips/include/uapi/asm/termios.h
new file mode 100644
index 000000000..d6c576794
--- /dev/null
+++ b/arch/mips/include/uapi/asm/termios.h
@@ -0,0 +1,81 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 1996, 2000, 2001 by Ralf Baechle
8 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
9 */
10#ifndef _UAPI_ASM_TERMIOS_H
11#define _UAPI_ASM_TERMIOS_H
12
13#include <linux/errno.h>
14#include <asm/termbits.h>
15#include <asm/ioctls.h>
16
17struct sgttyb {
18 char sg_ispeed;
19 char sg_ospeed;
20 char sg_erase;
21 char sg_kill;
22 int sg_flags; /* SGI special - int, not short */
23};
24
25struct tchars {
26 char t_intrc;
27 char t_quitc;
28 char t_startc;
29 char t_stopc;
30 char t_eofc;
31 char t_brkc;
32};
33
34struct ltchars {
35 char t_suspc; /* stop process signal */
36 char t_dsuspc; /* delayed stop process signal */
37 char t_rprntc; /* reprint line */
38 char t_flushc; /* flush output (toggles) */
39 char t_werasc; /* word erase */
40 char t_lnextc; /* literal next character */
41};
42
43/* TIOCGSIZE, TIOCSSIZE not defined yet. Only needed for SunOS source
44 compatibility anyway ... */
45
46struct winsize {
47 unsigned short ws_row;
48 unsigned short ws_col;
49 unsigned short ws_xpixel;
50 unsigned short ws_ypixel;
51};
52
53#define NCC 8
54struct termio {
55 unsigned short c_iflag; /* input mode flags */
56 unsigned short c_oflag; /* output mode flags */
57 unsigned short c_cflag; /* control mode flags */
58 unsigned short c_lflag; /* local mode flags */
59 char c_line; /* line discipline */
60 unsigned char c_cc[NCCS]; /* control characters */
61};
62
63
64/* modem lines */
65#define TIOCM_LE 0x001 /* line enable */
66#define TIOCM_DTR 0x002 /* data terminal ready */
67#define TIOCM_RTS 0x004 /* request to send */
68#define TIOCM_ST 0x010 /* secondary transmit */
69#define TIOCM_SR 0x020 /* secondary receive */
70#define TIOCM_CTS 0x040 /* clear to send */
71#define TIOCM_CAR 0x100 /* carrier detect */
72#define TIOCM_CD TIOCM_CAR
73#define TIOCM_RNG 0x200 /* ring */
74#define TIOCM_RI TIOCM_RNG
75#define TIOCM_DSR 0x400 /* data set ready */
76#define TIOCM_OUT1 0x2000
77#define TIOCM_OUT2 0x4000
78#define TIOCM_LOOP 0x8000
79
80
81#endif /* _UAPI_ASM_TERMIOS_H */
diff --git a/arch/mips/include/uapi/asm/types.h b/arch/mips/include/uapi/asm/types.h
new file mode 100644
index 000000000..6b2150484
--- /dev/null
+++ b/arch/mips/include/uapi/asm/types.h
@@ -0,0 +1,31 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1994, 1995, 1996, 1999 by Ralf Baechle
8 * Copyright (C) 2008 Wind River Systems,
9 * written by Ralf Baechle
10 * Copyright (C) 1999 Silicon Graphics, Inc.
11 */
12#ifndef _UAPI_ASM_TYPES_H
13#define _UAPI_ASM_TYPES_H
14
15/*
16 * We don't use int-l64.h for the kernel anymore but still use it for
17 * userspace to avoid code changes.
18 *
19 * However, some user programs (e.g. perf) may not want this. They can
20 * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
21 */
22#ifndef __KERNEL__
23# if _MIPS_SZLONG == 64 && !defined(__SANE_USERSPACE_TYPES__)
24# include <asm-generic/int-l64.h>
25# else
26# include <asm-generic/int-ll64.h>
27# endif
28#endif
29
30
31#endif /* _UAPI_ASM_TYPES_H */
diff --git a/arch/mips/include/uapi/asm/ucontext.h b/arch/mips/include/uapi/asm/ucontext.h
new file mode 100644
index 000000000..2d3bf8eeb
--- /dev/null
+++ b/arch/mips/include/uapi/asm/ucontext.h
@@ -0,0 +1,66 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef __MIPS_UAPI_ASM_UCONTEXT_H
3#define __MIPS_UAPI_ASM_UCONTEXT_H
4
5/**
6 * struct extcontext - extended context header structure
7 * @magic: magic value identifying the type of extended context
8 * @size: the size in bytes of the enclosing structure
9 *
10 * Extended context structures provide context which does not fit within struct
11 * sigcontext. They are placed sequentially in memory at the end of struct
12 * ucontext and struct sigframe, with each extended context structure beginning
13 * with a header defined by this struct. The type of context represented is
14 * indicated by the magic field. Userland may check each extended context
15 * structure against magic values that it recognises. The size field allows any
16 * unrecognised context to be skipped, allowing for future expansion. The end
17 * of the extended context data is indicated by the magic value
18 * END_EXTCONTEXT_MAGIC.
19 */
20struct extcontext {
21 unsigned int magic;
22 unsigned int size;
23};
24
25/**
26 * struct msa_extcontext - MSA extended context structure
27 * @ext: the extended context header, with magic == MSA_EXTCONTEXT_MAGIC
28 * @wr: the most significant 64 bits of each MSA vector register
29 * @csr: the value of the MSA control & status register
30 *
31 * If MSA context is live for a task at the time a signal is delivered to it,
32 * this structure will hold the MSA context of the task as it was prior to the
33 * signal delivery.
34 */
35struct msa_extcontext {
36 struct extcontext ext;
37#define MSA_EXTCONTEXT_MAGIC 0x784d5341 /* xMSA */
38
39 unsigned long long wr[32];
40 unsigned int csr;
41};
42
43#define END_EXTCONTEXT_MAGIC 0x78454e44 /* xEND */
44
45/**
46 * struct ucontext - user context structure
47 * @uc_flags:
48 * @uc_link:
49 * @uc_stack:
50 * @uc_mcontext: holds basic processor state
51 * @uc_sigmask:
52 * @uc_extcontext: holds extended processor state
53 */
54struct ucontext {
55 /* Historic fields matching asm-generic */
56 unsigned long uc_flags;
57 struct ucontext *uc_link;
58 stack_t uc_stack;
59 struct sigcontext uc_mcontext;
60 sigset_t uc_sigmask;
61
62 /* Extended context structures may follow ucontext */
63 unsigned long long uc_extcontext[0];
64};
65
66#endif /* __MIPS_UAPI_ASM_UCONTEXT_H */
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
new file mode 100644
index 000000000..4abe38754
--- /dev/null
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -0,0 +1,39 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 *
10 * Changed system calls macros _syscall5 - _syscall7 to push args 5 to 7 onto
11 * the stack. Robin Farine for ACN S.A, Copyright (C) 1996 by ACN S.A
12 */
13#ifndef _UAPI_ASM_UNISTD_H
14#define _UAPI_ASM_UNISTD_H
15
16#include <asm/sgidefs.h>
17
18#if _MIPS_SIM == _MIPS_SIM_ABI32
19
20#define __NR_Linux 4000
21#include <asm/unistd_o32.h>
22
23#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
24
25#if _MIPS_SIM == _MIPS_SIM_ABI64
26
27#define __NR_Linux 5000
28#include <asm/unistd_n64.h>
29
30#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
31
32#if _MIPS_SIM == _MIPS_SIM_NABI32
33
34#define __NR_Linux 6000
35#include <asm/unistd_n32.h>
36
37#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
38
39#endif /* _UAPI_ASM_UNISTD_H */